diff options
author | 2009-07-15 17:15:54 -0400 | |
---|---|---|
committer | 2009-07-15 17:15:54 -0400 | |
commit | f852ea2a5df175f9969e7e2fe160e894aeaac043 (patch) | |
tree | 5af998fa7c468b5ff19bcffbbedf83a2938aa27b | |
parent | Moved 'module' attribute into builds table from buildopts (diff) | |
download | ingenue-f852ea2a5df175f9969e7e2fe160e894aeaac043.tar.gz ingenue-f852ea2a5df175f9969e7e2fe160e894aeaac043.tar.bz2 ingenue-f852ea2a5df175f9969e7e2fe160e894aeaac043.zip |
Added viewing of chosen options to status viewer
-rw-r--r-- | frontend/classes/wizard_api.php | 89 | ||||
-rw-r--r-- | frontend/pages/configurations/manager.php | 3 | ||||
-rw-r--r-- | frontend/pages/configurations/status.php | 17 | ||||
-rw-r--r-- | todo | 1 |
4 files changed, 78 insertions, 32 deletions
diff --git a/frontend/classes/wizard_api.php b/frontend/classes/wizard_api.php index 381a267..049f3cc 100644 --- a/frontend/classes/wizard_api.php +++ b/frontend/classes/wizard_api.php @@ -15,21 +15,28 @@ class wizard_step { $this->title=$this->module->steps[$step-1]; $this->next=isset($next)?$next:($this->step == $this->module->numsteps?null:$step+1); } - public function output() { + public function output($rw=true) { global $conf; echo "<div class=\"wizard\" id=\"step$this->step\">"; - echo '<form action="'.url('config/'.$this->configuration->id).'" method="post"><a style="float: right" href="'.url('config/'.$this->configuration->id.'/status').'">Status</a><h3>Step '.$this->step.': '.$this->title."</h3>\n"; - $scale=$conf['progressbar_width']/$this->module->numsteps; - echo '<img src="'.url('images/full.gif').'" style="border-left: 1px solid black; border-top: 1px solid black; border-bottom: 1px solid black; width: '.$this->step*$scale.'px; height: 15px" /><img src="'.url('images/empty.gif').'" style="border-right: 1px solid black; border-top: 1px solid black; border-bottom: 1px solid black; width: '.(count($this->module->steps)-$this->step)*$scale.'px; height: 15px" /><br/>'."\n"; - $this->echo_buttons(); + if ($rw) + echo '<form action="'.url('config/'.$this->configuration->id).'" method="post"><a style="float: right" href="'.url('config/'.$this->configuration->id.'/status').'">Status</a>'; + if ($rw) { + echo '<h3>Step '.$this->step.': '.$this->title."</h3>\n"; + $scale=$conf['progressbar_width']/$this->module->numsteps; + echo '<img src="'.url('images/full.gif').'" style="border-left: 1px solid black; border-top: 1px solid black; border-bottom: 1px solid black; width: '.$this->step*$scale.'px; height: 15px" /><img src="'.url('images/empty.gif').'" style="border-right: 1px solid black; border-top: 1px solid black; border-bottom: 1px solid black; width: '.(count($this->module->steps)-$this->step)*$scale.'px; height: 15px" /><br/>'."\n"; + $this->echo_buttons(); + } foreach ($this->data as $obj) { + // print warning if rw is false? if (!$obj->status) { echo print_warning('Please complete this field.'); } - $obj->output(); + $obj->output($rw); + } + if ($rw) { + echo '<br/>'; + $this->echo_buttons(); } - echo '<br/>'; - $this->echo_buttons(); echo '</div>'."\n"; } public function process() { @@ -86,7 +93,7 @@ abstract class wizard { function __construct(&$c) { $this->configuration=&$c; } - abstract public function output(); + abstract public function output($rw=true); abstract public function process(); abstract public function verify(); abstract public function clear(); @@ -115,7 +122,7 @@ class wizard_text extends wizard { parent::__construct($c); $this->text=$text; } - public function output() { + public function output($rw=true) { echo $this->text; } public function process() { @@ -134,7 +141,7 @@ abstract class wizard_input extends wizard { $this->htmlname=htmlentities($htmlname); $this->label=htmlentities($label); } - public function output() { + public function output($rw=true) { echo "$this->label: "; } public function process() { @@ -154,9 +161,10 @@ abstract class wizard_input extends wizard { } } class wizard_text_input extends wizard_input { - public function output() { - parent::output(); - echo "<input name=\"$this->htmlname\" /><br/>\n"; + public function output($rw=true) { + parent::output($rw); + echo $rw?"<input name=\"$this->htmlname\"".(($val=$this->get_opt($this->optname)) === null?'':'value="'.htmlentities($val).'"').' />':htmlentities($this->get_opt($this->optname)); + echo "<br/>\n"; } } class wizard_select extends wizard_input { @@ -165,14 +173,22 @@ class wizard_select extends wizard_input { parent::__construct($c, $optname, $htmlname, $label); $this->options=$options; } - public function output() { - parent::output(); - echo '<select name="'.$this->htmlname.'">'."\n"; - $i=0; + public function output($rw=true) { + parent::output($rw); + if ($rw) { + echo '<select name="'.$this->htmlname.'">'."\n"; + $i=0; + } foreach ($this->options as $val => $label) { - echo "\t".'<option value="'.$i++.'"'.($this->opt_is($this->optname, $val)?' selected="selected"':'').'>'.htmlentities($label).'</option>'."\n"; + if ($rw) + echo "\t".'<option value="'.$i++.'"'.($this->opt_is($this->optname, $val)?' selected="selected"':'').'>'.htmlentities($label).'</option>'."\n"; + elseif ($this->opt_is($this->optname, $val)) + echo htmlentities($label); } - echo '</select>'."\n"; + if ($rw) + echo "</select>\n"; + else + echo "<br/>\n"; } public function process() { global $request; @@ -188,7 +204,8 @@ class wizard_select extends wizard_input { } } class wizard_radio extends wizard_select { - public function output() { + public function output($rw=true) { + if (!$rw) return parent::output($rw); echo "$this->label:<br/>\n"; $i=0; foreach ($this->options as $val => $label) { @@ -204,7 +221,7 @@ class wizard_checkbox_array extends wizard_input { $this->array=$array; $this->delim=$delim; } - public function output() { + public function output($rw=true) { echo "$this->label:<br/>\n"; $i=0; foreach ($this->array as $val => $label) { @@ -251,11 +268,14 @@ class wizard_layered_checkbox_array extends wizard_checkbox_array { $S['scripts'][]='wlca'; } } - public function output() { + public function output($rw=true) { if ($this->label) { echo '<h4>'.htmlentities($this->label).'</h4>'; } - $this->r_output($this->array); + if ($rw) + $this->r_output($this->array); + else + $this->r_ro_output($this->array); } public function process() { $this->set_opt($this->optname, implode($this->delim, $this->r_process($this->array))); @@ -359,12 +379,31 @@ class wizard_layered_checkbox_array extends wizard_checkbox_array { } } if ($depth < $this->depth) { - foreach($array as $name => &$val) + foreach ($array as $name => &$val) $this->r_verify($vals, $val, $depth+1, $path.$meta['delim'].$name, $name); } return $vals; } } + private function r_ro_output(&$array, $depth=0, $path=null, $name=null) { + if ($depth == 0) { + foreach ($array as $name => &$val) { + $this->r_ro_output($val, $depth+1, $name, $name); + } + } else { + $meta=$this->metadata[$depth]; + if (isset($meta['checkbox'])) { + $val=$this->format_label($array, $meta['checkbox'], $path, $name); + if ($this->opt_has($this->optname, $val, $this->delim)) { + echo $this->format_label($array, $meta['label'], $path, $name)."<br/>\n"; + } + } + if ($depth < $this->depth) { + foreach ($array as $name => &$val) + $this->r_ro_output($val, $depth+1, $path.$meta['delim'].$name, $name); + } + } + } private function format_label(&$array, $label='%p', $path, $name) { $arg=$array; $label=str_replace(array('%p', '%n'), array($path, $name), $label); diff --git a/frontend/pages/configurations/manager.php b/frontend/pages/configurations/manager.php index 148a470..68297fe 100644 --- a/frontend/pages/configurations/manager.php +++ b/frontend/pages/configurations/manager.php @@ -44,10 +44,11 @@ function body_configurations_manager() { if ($c->status > 0) { echo '<a href="'.url("config/$c->id")."\">Step $c->status</a>"; } elseif ($c->status == 0) { - echo '<b>Ready</b> (<a href="'.url("config/$c->id/status").'">modify</a>)'; + echo '<b>Ready</b>'; } else { echo $c->status; } + echo ' (<a href="'.url("config/$c->id/status").'">view</a>)'; echo '</td><td>'.$c->summary().'</td><td>'; $builds=$c->get_builds(); if ($builds) { diff --git a/frontend/pages/configurations/status.php b/frontend/pages/configurations/status.php index ebeeab3..d27efd4 100644 --- a/frontend/pages/configurations/status.php +++ b/frontend/pages/configurations/status.php @@ -24,12 +24,11 @@ function body_configurations_status() { $status=true; $good=0; for ($i=1; $i<=$module->numsteps; $i++) { - $r[$i]='<li>'; - $step=new wizard_step($c, $i, !$status); - $r[$i].=($status?'<a href="'.url("config/$c->id/$i")."\">$step->title</a>":$step->title); + $steps[$i]=new wizard_step($c, $i, !$status); + $r[$i]=($status?'<a href="'.url("config/$c->id/$i")."\">{$steps[$i]->title}</a>":$steps[$i]->title); if ($status) { $r[$i].=' - '; - $good+=($status=$step->verify())?1:0; + $good+=($status=$steps[$i]->verify())?1:0; if ($status === null) $r[$i].='<span style="color: yellow; background-color: black">Incomplete</span>'; elseif ($status) @@ -37,10 +36,16 @@ function body_configurations_status() { else $r[$i].='<span style="color: red">INVALID</span>'; } - $r[$i].='</li>'; } echo '<h3>'.($c->name?htmlentities($c->name):$c->id).": $good of $module->numsteps steps complete</h3>\n"; - echo '<ol>'.implode('', $r).'</ol>'; + echo '<ol>'; + foreach ($steps as $i => $step) { + echo '<li>'; + echo $r[$i]; + $step->output(false); + echo '</li>'; + } + echo '</ol>'; if ($good < $module->numsteps) echo '<a href="'.url("config/$c->id/".($good+1)).'">Finish configuration</a>'; } @@ -21,3 +21,4 @@ Simplify status to numeric on builds - varchar isn't necessary Move gentoo_profiles setup out of the general setup.php, allow per-module setup Move bundler selection out of gentoo module and generalize it (switch to builds instead of configurations) Improve the quality of base system creation (if necessary) +Allow config viewing for builds, not just logs |