summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'shared/classes/build.php')
-rw-r--r--shared/classes/build.php21
1 files changed, 13 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";