diff options
author | 2009-07-15 19:42:53 -0400 | |
---|---|---|
committer | 2009-07-15 19:42:53 -0400 | |
commit | 5634227db6e7264c908a582685770b88f6ba69e5 (patch) | |
tree | 7336adddf8f447a1ae927cfb8d2f691b4eefb121 /frontend | |
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')
-rw-r--r-- | frontend/classes/wizard_api.php | 29 | ||||
-rw-r--r-- | frontend/modules/gentoo/step1.php | 1 | ||||
-rw-r--r-- | frontend/modules/gentoo/step2.php | 2 | ||||
-rw-r--r-- | frontend/modules/gentoo/step3.php | 12 | ||||
-rw-r--r-- | frontend/modules/gentoo/step4.php | 15 | ||||
-rw-r--r-- | frontend/modules/gentoo_common.php | 2 | ||||
-rw-r--r-- | frontend/pages/configurations/manager.php | 11 | ||||
-rw-r--r-- | frontend/pages/configurations/wizard.php | 1 |
8 files changed, 41 insertions, 32 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; diff --git a/frontend/modules/gentoo/step1.php b/frontend/modules/gentoo/step1.php index 2b7a9f2..297f7c0 100644 --- a/frontend/modules/gentoo/step1.php +++ b/frontend/modules/gentoo/step1.php @@ -1,5 +1,4 @@ <?php -$title='Choose Profile'; $opts=array(); $r=$this->query('SELECT * FROM `gentoo_profiles` WHERE `flags` NOT LIKE "%d%"'); while ($profile=$r->fetch(PDO::FETCH_ASSOC)) { diff --git a/frontend/modules/gentoo/step2.php b/frontend/modules/gentoo/step2.php index da023c6..b5b95df 100644 --- a/frontend/modules/gentoo/step2.php +++ b/frontend/modules/gentoo/step2.php @@ -1,6 +1,4 @@ <?php -$title='Choose Extra Packages'; -$scripts='wlca'; $profile=new sql_gentoo_profile($this->get_opt('profile')); $pkgs=$profile->get_packages(); $meta=array( diff --git a/frontend/modules/gentoo/step3.php b/frontend/modules/gentoo/step3.php index 0643856..a420a0f 100644 --- a/frontend/modules/gentoo/step3.php +++ b/frontend/modules/gentoo/step3.php @@ -1,13 +1,3 @@ <?php -// TODO This shouldn't be a step at all, it should be in wizard.php to choose between bundlers -// TODO This shouldn't be part of configurations, except possibly a default value. It should be for builds -$title='Image Format'; -$this->select('bundler', 'bundler', 'Image type', array( - 'tgz' => 'Tar/Gzip', - 'tbz2' => 'Tar/Bzip2', - 'installcd' => 'Installer CD with Tar/Bzip2', - 'livecd' => 'LiveCD', - 'ext2' => 'ext2', - 'jffs2' => 'jffs2' -)); +$this->checkbox_array('options', 'options', null, array('timezone' => 'Select timezone')); ?> diff --git a/frontend/modules/gentoo/step4.php b/frontend/modules/gentoo/step4.php new file mode 100644 index 0000000..b5edf91 --- /dev/null +++ b/frontend/modules/gentoo/step4.php @@ -0,0 +1,15 @@ +<?php +$opts=explode(' ', $this->get_opt('options')); +if (in_array('timezone', $opts)) + $this->select('timezone', 'timezone', 'Timezone', get_timezones()); +// TODO This shouldn't be a step at all, it should be in wizard.php to choose between bundlers +// TODO This shouldn't be part of configurations, except possibly a default value. It should be for builds +$this->select('bundler', 'bundler', 'Image type', array( + 'tgz' => 'Tar/Gzip', + 'tbz2' => 'Tar/Bzip2', + 'installcd' => 'Installer CD with Tar/Bzip2', + 'livecd' => 'LiveCD', + 'ext2' => 'ext2', + 'jffs2' => 'jffs2' +)); +?> diff --git a/frontend/modules/gentoo_common.php b/frontend/modules/gentoo_common.php index bc72b0b..ee2e7f1 100644 --- a/frontend/modules/gentoo_common.php +++ b/frontend/modules/gentoo_common.php @@ -1,4 +1,4 @@ <?php -$steps=array('Profile', 'Extra Packages', 'Image Format'); +$steps=array('Profile', 'Packages', 'Extra Options', 'Etc.'); $dir='gentoo'; ?> diff --git a/frontend/pages/configurations/manager.php b/frontend/pages/configurations/manager.php index 68297fe..0488a11 100644 --- a/frontend/pages/configurations/manager.php +++ b/frontend/pages/configurations/manager.php @@ -9,11 +9,7 @@ function init_configurations_manager() { function body_configurations_manager() { global $S, $request, $conf; echo '<h3>Configurations Manager</h3>'; - $r=$S['pdo']->query('SELECT * FROM `configurations` WHERE `owner`='.$S['user']->id); - if ($r->rowCount() == 0) { - echo print_warning('You have no configurations.').'<a href="'.url('create').'">Create a configuration</a>'; - return; - } elseif (isset($request['build']) && isset($request['configuration'])) { + if (isset($request['build']) && isset($request['configuration'])) { $c=new sql_configuration($request['configuration']); if ($c->owner!=$S['user']->id) { echo print_error('You do not have permission to build this configuration.'); @@ -26,6 +22,11 @@ function body_configurations_manager() { echo print_error('Invalid configuration', 'Your configuration could not be submitted for build. Please return to <a href="'.url("config/$c->id/$build").'">step '.$build.'</a> and continue configuration from there.'); } } + $r=$S['pdo']->query('SELECT * FROM `configurations` WHERE `owner`='.$S['user']->id); + if ($r->rowCount() == 0) { + echo print_warning('You have no configurations.').'<a href="'.url('create').'">Create a configuration</a>'; + return; + } echo '<form action="'.url('configurations').'" method="post"><table><tr><th>ID</th><th>Name</th>'.(count($conf['modules']) > 1?'<th>Module</th>':'').'<th>Status</th><th>Options</th><th>Builds</th></tr>'."\n"; $ready=0; while($c=$r->fetch(PDO::FETCH_ASSOC)) { diff --git a/frontend/pages/configurations/wizard.php b/frontend/pages/configurations/wizard.php index cc46405..947e321 100644 --- a/frontend/pages/configurations/wizard.php +++ b/frontend/pages/configurations/wizard.php @@ -35,7 +35,6 @@ function init_configurations_wizard() { } } elseif (isset($request['init'])) { $S['wizard']['configuration']=new sql_configuration(); - wizard::set_configuration($S['wizard']['configuration']); $configuration=&$S['wizard']['configuration']; $configuration->name=$request['name']; $mod=isset($request['mod']) && isset($conf['modules'][$request['mod']])?$conf['modules'][$request['mod']]:$conf['modules'][0]; |