diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-07-15 19:42:53 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-07-15 19:42:53 -0400 |
commit | 5634227db6e7264c908a582685770b88f6ba69e5 (patch) | |
tree | 7336adddf8f447a1ae927cfb8d2f691b4eefb121 /frontend/classes/wizard_api.php | |
parent | Added viewing of chosen options to status viewer (diff) | |
download | ingenue-5634227db6e7264c908a582685770b88f6ba69e5.tar.gz ingenue-5634227db6e7264c908a582685770b88f6ba69e5.tar.bz2 ingenue-5634227db6e7264c908a582685770b88f6ba69e5.zip |
Divided gentoo_portage backend into several parts; Added another config step to choose which options to offer next; Added timezone selection; Fixed pkglist script; Little fixes
Diffstat (limited to 'frontend/classes/wizard_api.php')
-rw-r--r-- | frontend/classes/wizard_api.php | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/frontend/classes/wizard_api.php b/frontend/classes/wizard_api.php index 049f3cc..f4c672e 100644 --- a/frontend/classes/wizard_api.php +++ b/frontend/classes/wizard_api.php @@ -85,7 +85,7 @@ class wizard_step { return $this->configuration->get_opt($opt); } private function echo_buttons() { - echo '<input type="button" onclick="window.location=\''.url('config/'.$this->configuration->id.'/'.($this->step-1)).'\'" value="Back" /> <input style="float: right" type="submit" name="wizard_submit['.$this->step.']" value="Next" /><br/>'; + echo ($this->step > 1?'<input type="button" onclick="window.location=\''.url('config/'.$this->configuration->id.'/'.($this->step-1)).'\'" value="Back" /> ':' ').'<input style="float: right" type="submit" name="wizard_submit['.$this->step.']" value="'.($this->step == $this->module->numsteps?'Finish':'Next').'" /><br/>'; } } abstract class wizard { @@ -186,9 +186,8 @@ class wizard_select extends wizard_input { echo htmlentities($label); } if ($rw) - echo "</select>\n"; - else - echo "<br/>\n"; + echo '</select>'; + echo "<br/>\n"; } public function process() { global $request; @@ -209,7 +208,7 @@ class wizard_radio extends wizard_select { echo "$this->label:<br/>\n"; $i=0; foreach ($this->options as $val => $label) { - echo "\t<input type=\"radio\" id=\"$this->htmlname-$i\" name=\"$this->htmlname\" value=\"".$i."\"".($this->opt_is($this->optname, $val)?' checked="checked"':'')."\" /><label for=\"$this->htmlname-$i\">".htmlentities($label)."</label>\n"; + echo "\t<input type=\"radio\" id=\"$this->htmlname-$i\" name=\"$this->htmlname\" value=\"".$i."\"".($this->opt_is($this->optname, $val)?' checked="checked"':'')."\" /><label for=\"$this->htmlname-$i\">".htmlentities($label)."</label><br/>\n"; $i++; } } @@ -222,21 +221,29 @@ class wizard_checkbox_array extends wizard_input { $this->delim=$delim; } public function output($rw=true) { - echo "$this->label:<br/>\n"; + if (strlen($this->label)) + echo "<b>$this->label:</b><br/>\n"; $i=0; foreach ($this->array as $val => $label) { - echo "\t<input type=\"checkbox\" id=\"$this->htmlname-$i\" name=\"$this->htmlname[$i]\"".($this->opt_has($this->optname, $val, $this->delim)?' checked="checked"':'')." /><label for=\"$this->htmlname-$i\">$label</label><br/>\n"; + $label=htmlentities($label); + if ($rw) + echo "\t<input type=\"checkbox\" id=\"$this->htmlname-$i\" name=\"$this->htmlname[$i]\"".($this->opt_has($this->optname, $val, $this->delim)?' checked="checked"':'')." /><label for=\"$this->htmlname-$i\">$label</label><br/>\n"; + elseif ($this->opt_has($this->optname, $val, $this->delim)) + echo "$label<br/>\n"; $i++; } } public function process() { global $request; $val=array(); - $vals=array_keys($this->array); - foreach ($request[$this->htmlname] as $i) { - $val[]=$vals[$i]; + if (isset($request[$this->htmlname])) { + $vals=array_keys($this->array); + foreach ($request[$this->htmlname] as $i => $null) { + $val[]=$vals[$i]; + } } - $this->set_opt($this->optname, implode($this->delim, $vals)); + $this->set_opt($this->optname, implode($this->delim, $val)); + return true; } public function verify() { if (($vals=$this->get_opt($this->optname)) === null) return null; |