From 06ab593e5dd40df96f79179a68ba8f3d7c70033a Mon Sep 17 00:00:00 2001 From: Eudyptula Date: Fri, 10 Jul 2009 14:09:00 -0400 Subject: 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. --- frontend/classes/module.php | 12 +++++++++ frontend/classes/wizard_api.php | 11 ++++++--- frontend/images/empty.gif | Bin 0 -> 799 bytes frontend/images/full.gif | Bin 0 -> 812 bytes frontend/modules/gentoo/step1.php | 1 - frontend/modules/gentoo/step2.php | 37 ---------------------------- frontend/modules/gentoo/step3.php | 6 ++--- frontend/modules/gentoo_catalyst | 1 - frontend/modules/gentoo_catalyst.info.alpha | 4 +++ frontend/modules/gentoo_common.php | 4 +++ frontend/modules/gentoo_portage | 1 - frontend/modules/gentoo_portage.info | 4 +++ frontend/pages/configurations/manager.php | 27 +++++++++++++++++--- frontend/pages/configurations/wizard.php | 12 ++++----- 14 files changed, 63 insertions(+), 57 deletions(-) create mode 100644 frontend/classes/module.php create mode 100755 frontend/images/empty.gif create mode 100755 frontend/images/full.gif delete mode 120000 frontend/modules/gentoo_catalyst create mode 100644 frontend/modules/gentoo_catalyst.info.alpha create mode 100644 frontend/modules/gentoo_common.php delete mode 120000 frontend/modules/gentoo_portage create mode 100644 frontend/modules/gentoo_portage.info (limited to 'frontend') 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 @@ +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 "

$this->title

\n"; + $scale=$conf['progressbar_width']/$this->module->steps; + echo '
'."\n"; echo '
'; foreach ($this->data as $obj) { if (!$obj->status) { diff --git a/frontend/images/empty.gif b/frontend/images/empty.gif new file mode 100755 index 0000000..cbcda5d Binary files /dev/null and b/frontend/images/empty.gif differ diff --git a/frontend/images/full.gif b/frontend/images/full.gif new file mode 100755 index 0000000..cfe77aa Binary files /dev/null and b/frontend/images/full.gif differ 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: Clear'; - echo '
'; - $i=0; - foreach ($bcs as $bc => $lcs) { - echo '
'.htmlentities($bc).'
'."\n"; - foreach ($lcs as $lc => $packages) { - echo '
± '.htmlentities("$bc$lc").'
'."\n"; - } - echo '
'."\n"; - } - echo '
'; -} -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 @@ 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 @@ + 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 @@ + 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 @@ + 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 '

Configurations Manager

'; $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 - Logs'); } } - echo ''."\n"; + echo '
IDNameStatusOptionsBuilds
'.(count(explode(' ', $conf['modules'])) > 1?'':'').''."\n"; + $ready=0; while($c=$r->fetch(PDO::FETCH_ASSOC)) { $c=new sql_configuration($c); - echo "\n"; } - echo '
IDNameModuleStatusOptionsBuilds
id\" type=\"radio\" name=\"configuration\" value=\"$c->id\" /> ".(isset($c->name) && strlen($c->name)?htmlentities($c->name):'Unnamed')."$c->status".$c->summary().''; + echo "
"; + if ($c->status == 0) { + $ready++; + echo "id\" type=\"radio\" name=\"configuration\" value=\"$c->id\" /> '; + } else { + echo $c->id; + } + echo ''.(isset($c->name) && strlen($c->name)?htmlentities($c->name):'Unnamed').''; + if (count(explode(' ', $conf['modules'])) > 1) { + echo "$c->module"; + } + if ($c->status > 0) { + echo 'id")."\">Step $c->status'"; + } elseif ($c->status == 0) { + echo 'Ready'; + } else { + echo $c->status; + } + echo ''.$c->summary().''; $builds=$c->get_builds(); if ($builds) { foreach ($builds as $build) { @@ -37,6 +56,6 @@ function body_configurations_manager() { } echo "
Name (optional):
'; + echo ''.($ready?'Name (optional): ':'').''; } ?> 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 '

Request an image built

Name of your configuration (optional):
'; - $mods=explode(' ', $conf['modules']); - if (count($mods) > 1) { + if (count($conf['modules']) > 1) { echo 'Module:
'; } echo '
'; -- cgit v1.2.3-65-gdbad