diff options
author | 2009-07-10 14:09:00 -0400 | |
---|---|---|
committer | 2009-07-10 14:09:00 -0400 | |
commit | 06ab593e5dd40df96f79179a68ba8f3d7c70033a (patch) | |
tree | 75f4d351328893b2cf7f6f9e74951409212ac576 /frontend | |
parent | Finished porting package selection to new wizard format - everything works again (diff) | |
download | ingenue-06ab593e5dd40df96f79179a68ba8f3d7c70033a.tar.gz ingenue-06ab593e5dd40df96f79179a68ba8f3d7c70033a.tar.bz2 ingenue-06ab593e5dd40df96f79179a68ba8f3d7c70033a.zip |
Made bundling finished images separate from modules in backend; added metadata for frontend modules; added default config options and simplified config file; added verbose output to update_gentoo_profiles.php; etc.
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/classes/module.php | 12 | ||||
-rw-r--r-- | frontend/classes/wizard_api.php | 11 | ||||
-rwxr-xr-x | frontend/images/empty.gif | bin | 0 -> 799 bytes | |||
-rwxr-xr-x | frontend/images/full.gif | bin | 0 -> 812 bytes | |||
-rw-r--r-- | frontend/modules/gentoo/step1.php | 1 | ||||
-rw-r--r-- | frontend/modules/gentoo/step2.php | 37 | ||||
-rw-r--r-- | frontend/modules/gentoo/step3.php | 6 | ||||
l--------- | frontend/modules/gentoo_catalyst | 1 | ||||
-rw-r--r-- | frontend/modules/gentoo_catalyst.info.alpha | 4 | ||||
-rw-r--r-- | frontend/modules/gentoo_common.php | 4 | ||||
l--------- | frontend/modules/gentoo_portage | 1 | ||||
-rw-r--r-- | frontend/modules/gentoo_portage.info | 4 | ||||
-rw-r--r-- | frontend/pages/configurations/manager.php | 27 | ||||
-rw-r--r-- | frontend/pages/configurations/wizard.php | 12 |
14 files changed, 63 insertions, 57 deletions
diff --git a/frontend/classes/module.php b/frontend/classes/module.php new file mode 100644 index 0000000..8971c42 --- /dev/null +++ b/frontend/classes/module.php @@ -0,0 +1,12 @@ +<?php +class module { + var $id, $name, $steps, $dir; + function __construct($id) { + $this->id=$id; + require(FRONTEND."/modules/$id.info"); + $this->name=$name; + $this->steps=$steps; + $this->dir=FRONTEND.'/modules/'.$dir; + } +} +?> diff --git a/frontend/classes/wizard_api.php b/frontend/classes/wizard_api.php index b23b8a5..a3b6fc8 100644 --- a/frontend/classes/wizard_api.php +++ b/frontend/classes/wizard_api.php @@ -2,18 +2,21 @@ class wizard_step { var $module, $step, $title, $next, $data=array(); function __construct($mod, $step) { - $this->module=$mod; + $this->module=new module($mod); $this->step=$step; - $file=FRONTEND."/modules/$mod/step$step.php"; + $file=$this->module->dir."/step$step.php"; if (!is_readable($file)) { throw_exception("$mod step $step doesn't exist!"); } require($file); - $this->title="Step $step".($title?" - $title":''); - $this->next=isset($next)?$next:$step+1; + $this->title="Step $step/{$this->module->steps}".($title?" - $title":''); + $this->next=isset($next)?$next:($this->step == $this->module->steps?null:$step+1); } public function output() { + global $conf; echo "<h3>$this->title</h3>\n"; + $scale=$conf['progressbar_width']/$this->module->steps; + 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: '.($this->module->steps-$this->step)*$scale.'px; height: 15px" /><br/>'."\n"; echo '<form action="'.url('config/'.wizard::$configuration->id).'" method="post">'; foreach ($this->data as $obj) { if (!$obj->status) { diff --git a/frontend/images/empty.gif b/frontend/images/empty.gif Binary files differnew file mode 100755 index 0000000..cbcda5d --- /dev/null +++ b/frontend/images/empty.gif diff --git a/frontend/images/full.gif b/frontend/images/full.gif Binary files differnew file mode 100755 index 0000000..cfe77aa --- /dev/null +++ b/frontend/images/full.gif diff --git a/frontend/modules/gentoo/step1.php b/frontend/modules/gentoo/step1.php index d3ee3b9..2b7a9f2 100644 --- a/frontend/modules/gentoo/step1.php +++ b/frontend/modules/gentoo/step1.php @@ -8,5 +8,4 @@ while ($profile=$r->fetch(PDO::FETCH_ASSOC)) { $opts[$profile->id]=$display; } $this->select('profile', 'profile', 'Profile', $opts); -$next=2; ?> diff --git a/frontend/modules/gentoo/step2.php b/frontend/modules/gentoo/step2.php index df8ecce..da023c6 100644 --- a/frontend/modules/gentoo/step2.php +++ b/frontend/modules/gentoo/step2.php @@ -11,41 +11,4 @@ $meta=array( array('tag' => 'div', 'label' => '=%p', 'checkbox' => '=%p', 'search' => true) ); $this->layered_checkbox_array('install_packages', 'p', null, $pkgs, ' ', $meta); -/*function gentoo_body_step2() { - global $S; - $configuration=&$S['wizard']['configuration']; - $opts=$configuration->get_configopts(); - $profile=new sql_gentoo_profile($opts['profile']); - $bcs=$profile->get_packages(); - echo 'Search packages: <input id="psearch" onkeyup="packagesearch(this)" /> <a href="javascript:var e=document.getElementById(\'psearch\'); e.value=\'\'; e.onkeyup()">Clear</a>'; - echo '<div id="plist"><div id="zero" style="display: none">'.print_error('No results found.').'</div>'; - $i=0; - foreach ($bcs as $bc => $lcs) { - echo '<div class="bct" id="bct-'.$bc.'">'.htmlentities($bc).'</div><div class="bc" id="bc-'.$bc.'">'."\n"; - foreach ($lcs as $lc => $packages) { - echo '<div class="lct" id="lct-'.$bc.$lc.'"><a href="javascript:tog_show_pkgs(\''.$bc.$lc.'\')">±</a> '.htmlentities("$bc$lc").'</div><div class="lc" id="lc-'.$bc.$lc.'" style="display: none">'."\n"; - foreach ($packages as $name => $vers) { - foreach ($vers as $ver => $attrs) { - $safename=htmlentities("$bc$lc/$name-$ver"); - echo '<div class="pkg'.($attrs['masked']?' masked':'').'"><input id="p'.$i.'" type="checkbox" name="expkgs['.$safename.']" /><label class="pd" for="p'.$i++.'">'.htmlentities("$name-$ver").' - '.htmlentities($attrs['desc']).($attrs['masked']?' [MASKED]':'').'</label></div>'."\n"; - } - } - echo '</div>'."\n"; - } - echo '</div>'."\n"; - } - echo '</div>'; -} -function gentoo_process_step2() { - global $S, $request; - if (isset($request['expkgs'])) { - $packages=array(); - foreach ($request['expkgs'] as $name => $null) { - $packages[]='='.$name; - } - $packages=implode(' ', $packages); - $opt=new sql_configopt($S['wizard']['configuration']->id, 'install_packages', $packages); - $opt->write(); - } -}*/ ?> diff --git a/frontend/modules/gentoo/step3.php b/frontend/modules/gentoo/step3.php index 9dd523a..0643856 100644 --- a/frontend/modules/gentoo/step3.php +++ b/frontend/modules/gentoo/step3.php @@ -1,7 +1,8 @@ <?php -// TODO This shouldn't be a step at all, it should be in wizard.php to choose between output modules +// 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('image_type', 'image_type', 'Image type', array( +$this->select('bundler', 'bundler', 'Image type', array( 'tgz' => 'Tar/Gzip', 'tbz2' => 'Tar/Bzip2', 'installcd' => 'Installer CD with Tar/Bzip2', @@ -9,5 +10,4 @@ $this->select('image_type', 'image_type', 'Image type', array( 'ext2' => 'ext2', 'jffs2' => 'jffs2' )); -$next=null; ?> diff --git a/frontend/modules/gentoo_catalyst b/frontend/modules/gentoo_catalyst deleted file mode 120000 index 0c0273e..0000000 --- a/frontend/modules/gentoo_catalyst +++ /dev/null @@ -1 +0,0 @@ -gentoo
\ No newline at end of file diff --git a/frontend/modules/gentoo_catalyst.info.alpha b/frontend/modules/gentoo_catalyst.info.alpha new file mode 100644 index 0000000..4803759 --- /dev/null +++ b/frontend/modules/gentoo_catalyst.info.alpha @@ -0,0 +1,4 @@ +<?php +$name='Gentoo Catalyst'; +require(dirname(__FILE__).'/gentoo_common.php'); +?> diff --git a/frontend/modules/gentoo_common.php b/frontend/modules/gentoo_common.php new file mode 100644 index 0000000..cac9b4b --- /dev/null +++ b/frontend/modules/gentoo_common.php @@ -0,0 +1,4 @@ +<?php +$steps=3; +$dir='gentoo'; +?> diff --git a/frontend/modules/gentoo_portage b/frontend/modules/gentoo_portage deleted file mode 120000 index 0c0273e..0000000 --- a/frontend/modules/gentoo_portage +++ /dev/null @@ -1 +0,0 @@ -gentoo
\ No newline at end of file diff --git a/frontend/modules/gentoo_portage.info b/frontend/modules/gentoo_portage.info new file mode 100644 index 0000000..cb6e198 --- /dev/null +++ b/frontend/modules/gentoo_portage.info @@ -0,0 +1,4 @@ +<?php +$name='Gentoo Portage'; +require(dirname(__FILE__).'/gentoo_common.php'); +?> diff --git a/frontend/pages/configurations/manager.php b/frontend/pages/configurations/manager.php index 21ee9dc..aef03d1 100644 --- a/frontend/pages/configurations/manager.php +++ b/frontend/pages/configurations/manager.php @@ -7,7 +7,7 @@ function init_configurations_manager() { return array('title' => 'Manage Configurations'); } function body_configurations_manager() { - global $S, $request; + 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) { @@ -23,10 +23,29 @@ function body_configurations_manager() { echo print_success('Submitted for build - <a href="'.url('logs/'.$build->id).'">Logs</a>'); } } - echo '<form action="'.url('configurations').'" method="post"><table><tr><th>ID</th><th>Name</th><th>Status</th><th>Options</th><th>Builds</th></tr>'."\n"; + echo '<form action="'.url('configurations').'" method="post"><table><tr><th>ID</th><th>Name</th>'.(count(explode(' ', $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)) { $c=new sql_configuration($c); - echo "<tr><td><input id=\"radio-$c->id\" type=\"radio\" name=\"configuration\" value=\"$c->id\" /> <label for=\"radio-$c->id\">$c->id</label></td><td>".(isset($c->name) && strlen($c->name)?htmlentities($c->name):'<i>Unnamed</i>')."</td><td>$c->status</td><td>".$c->summary().'</td><td>'; + echo "<tr><td>"; + if ($c->status == 0) { + $ready++; + echo "<input id=\"radio-$c->id\" type=\"radio\" name=\"configuration\" value=\"$c->id\" /> <label for=\"radio-$c->id\">".$c->id.'</label>'; + } else { + echo $c->id; + } + echo '</td><td>'.(isset($c->name) && strlen($c->name)?htmlentities($c->name):'<i>Unnamed</i>').'</td><td>'; + if (count(explode(' ', $conf['modules'])) > 1) { + echo "$c->module</td><td>"; + } + if ($c->status > 0) { + echo '<a href="'.url("config/$c->id")."\">Step $c->status</a>'"; + } elseif ($c->status == 0) { + echo '<b>Ready</b>'; + } else { + echo $c->status; + } + echo '</td><td>'.$c->summary().'</td><td>'; $builds=$c->get_builds(); if ($builds) { foreach ($builds as $build) { @@ -37,6 +56,6 @@ function body_configurations_manager() { } echo "</td></tr>\n"; } - echo '</table>Name (optional): <input name="name" /> <input type="submit" name="build" value="Build" /></form>'; + echo '</table>'.($ready?'Name (optional): <input name="name" /> <input type="submit" name="build" value="Build" />':'').'</form>'; } ?> diff --git a/frontend/pages/configurations/wizard.php b/frontend/pages/configurations/wizard.php index de35c65..9a2b5d4 100644 --- a/frontend/pages/configurations/wizard.php +++ b/frontend/pages/configurations/wizard.php @@ -38,8 +38,7 @@ function init_configurations_wizard() { wizard::set_configuration($S['wizard']['configuration']); $configuration=&$S['wizard']['configuration']; $configuration->name=$request['name']; - $mods=explode(' ', $conf['modules']); - $mod=isset($request['mod']) && isset($mods[$request['mod']])?$mods[$request['mod']]:$mods[0]; + $mod=isset($request['mod']) && isset($conf['modules'][$request['mod']])?$conf['modules'][$request['mod']]:$conf['modules'][0]; $configuration->module=$mod; $configuration->init(); debug('wizard', "Module: $mod"); @@ -62,12 +61,13 @@ function body_configurations_wizard() { } } else { echo '<form action="'.url('create').'" method="post"><h3>Request an image built</h3>Name of your configuration (optional): <input name="name" /><br/>'; - $mods=explode(' ', $conf['modules']); - if (count($mods) > 1) { + if (count($conf['modules']) > 1) { echo 'Module: <select name="mod">'; $i=0; - foreach ($mods as $mod) - echo '<option value="'.$i++."\">$mod</option>"; + foreach ($conf['modules'] as $mod) { + $mod=new module($mod); + echo '<option value="'.$i++.'">'.htmlentities($mod->name).'</option>'; + } echo '</select><br/>'; } echo '<input type="submit" name="init" value="Start" /></form>'; |