diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-07-29 11:53:46 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-07-29 11:53:46 -0400 |
commit | 53891176a55bf07ea6e0629a3cf51736aac01f4b (patch) | |
tree | 73b62aafd5df3a9fefb880a90e933e23c6ef70e4 /shared/classes | |
parent | Implement init script and package pruning in backend (diff) | |
download | ingenue-53891176a55bf07ea6e0629a3cf51736aac01f4b.tar.gz ingenue-53891176a55bf07ea6e0629a3cf51736aac01f4b.tar.bz2 ingenue-53891176a55bf07ea6e0629a3cf51736aac01f4b.zip |
Add visibility column to builds, configurations
Diffstat (limited to 'shared/classes')
-rw-r--r-- | shared/classes/build.php | 21 | ||||
-rw-r--r-- | shared/classes/configuration.php | 5 |
2 files changed, 18 insertions, 8 deletions
diff --git a/shared/classes/build.php b/shared/classes/build.php index 4e11407..db12801 100644 --- a/shared/classes/build.php +++ b/shared/classes/build.php @@ -25,6 +25,11 @@ class sql_build extends conf_build_common { 'not_null' => true, 'default' => '' ), + 'visibility' => array ( + 'type' => 'ENUM', + 'length' => '\'public\',\'private\'', + 'not_null' => true + ), 'status' => array ( 'type' => 'TINYINT', 'length' => 4, @@ -51,7 +56,7 @@ class sql_build extends conf_build_common { public function display() { global $S; $format='D j M Y G:i:s T'; - $OoA=owner_or_admin($this->id); + $perms=$this->visibility == 'public' || owner_or_admin($this->id); $html='<div class="build"><span class="name">'.(isset($this->name) && strlen($this->name)?htmlentities($this->name):'Unnamed Build').'</span> '; $links=array(); if ($this->status == -128) { @@ -60,32 +65,32 @@ class sql_build extends conf_build_common { $html.="<span class=\"status queued\">[Queued ($num/$total)]</span>"; } elseif ($this->status == -127) { $html.='<span class="status successful">[uploading]</span>'; - if ($OoA) $links['Build log']="build/$this->id"; + if ($perms) $links['Build log']="build/$this->id"; } elseif ($this->status < 0) { // TODO Build stage X $html.='<span class="status building">[building]</span>'; - if ($OoA) { + if ($perms) { //$links['Watch']="build/$this->id/live"; $links['Build Log']="build/$this->id"; } } elseif ($this->status == 0) { $r=$S['pdo']->query('SELECT COUNT(*) as `count`, MAX(`time`) as `time` FROM `downloads` WHERE `build`="'.$this->id.'"')->fetch(PDO::FETCH_ASSOC); - $d=($OoA && $r['count']?'<a href="'.url("build/$this->id/history").'">':'').$r['count'].' download'.($r['count'] != 1?'s':'').($r['count']?($OoA?'</a>':'').'<br/><span class="time">(last at '.date($format, $r['time']).')</span>':''); + $d=($perms && $r['count']?'<a href="'.url("build/$this->id/history").'">':'').$r['count'].' download'.($r['count'] != 1?'s':'').($r['count']?($perms?'</a>':'').'<br/><span class="time">(last at '.date($format, $r['time']).')</span>':''); $html.='<span class="downloads">'.$d.'</span><span class="status successful">[successful]</span>'; $links['Download image']="build/$this->id/download"; - if ($OoA) $links['Build log']="build/$this->id"; + if ($perms) $links['Build log']="build/$this->id"; } elseif ($this->status == 127) { $html.='<span class="status failed">[upload failed]</span>'; - if ($OoA) $links['Build log']="build/$this->id"; + if ($perms) $links['Build log']="build/$this->id"; } elseif ($this->status == 126) { $html.='<span class="status failed">[failed]</span>'; - if ($OoA) { + if ($perms) { //$links['View output of failed command']="build/$this->id/failure"; $links['Build log']="build/$this->id"; } } else { $html.='<span class="status failed">[failed: got signal '.$this->status.']</span>'; - if ($OoA) $links['Build log']="build/$this->id"; + if ($perms) $links['Build log']="build/$this->id"; } if ($this->status >= 0 || $this->status == -128) // Finished or queued $links['Delete']="build/$this->id/delete"; diff --git a/shared/classes/configuration.php b/shared/classes/configuration.php index a3cdec3..c6d5766 100644 --- a/shared/classes/configuration.php +++ b/shared/classes/configuration.php @@ -25,6 +25,11 @@ class sql_configuration extends conf_build_common { 'not_null' => true, 'default' => '' ), + 'visibility' => array ( + 'type' => 'ENUM', + 'length' => '\'public\',\'private\'', + 'not_null' => true + ), 'status' => array ( 'type' => 'TINYINT', 'length' => 4, |