From 2f63d9014665451e87d669ee14a8be9308e91856 Mon Sep 17 00:00:00 2001 From: Eudyptula Date: Mon, 13 Jul 2009 16:26:49 -0400 Subject: Added 'Show checked' link for package adder, fixed package selector verification, added basic verification frontend --- frontend/classes/wizard_api.php | 10 +++++--- frontend/js/wlca.js | 26 +++++++++++++++++--- frontend/pages/configurations/manager.php | 6 ++--- frontend/pages/configurations/verifier.php | 39 ++++++++++++++++++++++++++++++ frontend/pages/configurations/wizard.php | 4 +-- frontend/routing.csv | 1 + 6 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 frontend/pages/configurations/verifier.php diff --git a/frontend/classes/wizard_api.php b/frontend/classes/wizard_api.php index c0d91b0..48fe637 100644 --- a/frontend/classes/wizard_api.php +++ b/frontend/classes/wizard_api.php @@ -259,7 +259,9 @@ class wizard_layered_checkbox_array extends wizard_checkbox_array { public function verify() { if (($vals=self::get_opt($this->optname)) === null) return false; $vals=explode($this->delim, $vals); - return count($this->r_verify($vals, $this->array)) == 0; + $r=$this->r_verify($vals, $this->array); + debug('wlca', 'got results: '.implode(' ',$r)); + return count($r) == 0; } private function r_output(&$array, $depth=0, $path=null, $name=null) { static $uid=0, $ucid=0; @@ -279,7 +281,7 @@ class wizard_layered_checkbox_array extends wizard_checkbox_array { if (!isset($conf['id'])) { $conf['id']=self::b36($uid++); } - echo 'Search: Clear
'."\n"; + echo 'Search: Clear Show checked
'."\n"; } echo '
'."\n"; foreach ($array as $name => &$val) { @@ -287,7 +289,7 @@ class wizard_layered_checkbox_array extends wizard_checkbox_array { $uid++; } echo '
'; - echo "\n"; + echo "\n"; } else { $meta=$this->metadata[$depth]; if (isset($meta['tag'])) { @@ -346,7 +348,7 @@ class wizard_layered_checkbox_array extends wizard_checkbox_array { $meta=$this->metadata[$depth]; if (isset($meta['checkbox'])) { $label=$this->format_label($array, $meta['checkbox'], $path, $name); - if ($i=array_search($label, $vals) !== false) { + if (($i=array_search($label, $vals)) !== false) { unset($vals[$i]); } } diff --git a/frontend/js/wlca.js b/frontend/js/wlca.js index 942300c..d62994b 100644 --- a/frontend/js/wlca.js +++ b/frontend/js/wlca.js @@ -4,7 +4,7 @@ var wlca_found_last; function wlcat(id, set) { // Short for 'toggle' tag=document.getElementById(id); for (var i=1; i 0?"":"none"); } - if (q.length == 0 && el.className.match(/wlcac/)) { + if (q.length == 0 && el.className.indexOf('wlcac') != -1) { wlca_collapse(el.id); } } return found; } +function wlca_show_checked(el, depth, maxdepth) { + if (depth == 0) { + wlca_last_search=undefined; + } + var found=0; + for (var i=0; i 0?"":"none"); + } + } + return found; +} diff --git a/frontend/pages/configurations/manager.php b/frontend/pages/configurations/manager.php index aef03d1..15ab529 100644 --- a/frontend/pages/configurations/manager.php +++ b/frontend/pages/configurations/manager.php @@ -23,7 +23,7 @@ function body_configurations_manager() { echo print_success('Submitted for build - Logs'); } } - echo '
'.(count(explode(' ', $conf['modules'])) > 1?'':'').''."\n"; + echo '
IDNameModuleStatusOptionsBuilds
'.(count($conf['modules']) > 1?'':'').''."\n"; $ready=0; while($c=$r->fetch(PDO::FETCH_ASSOC)) { $c=new sql_configuration($c); @@ -35,13 +35,13 @@ function body_configurations_manager() { echo $c->id; } echo '
IDNameModuleStatusOptionsBuilds
'.(isset($c->name) && strlen($c->name)?htmlentities($c->name):'Unnamed').''; - if (count(explode(' ', $conf['modules'])) > 1) { + if (count($conf['modules']) > 1) { echo "$c->module"; } if ($c->status > 0) { echo 'id")."\">Step $c->status'"; } elseif ($c->status == 0) { - echo 'Ready'; + echo 'Ready (verify)'; } else { echo $c->status; } diff --git a/frontend/pages/configurations/verifier.php b/frontend/pages/configurations/verifier.php new file mode 100644 index 0000000..ae27c3c --- /dev/null +++ b/frontend/pages/configurations/verifier.php @@ -0,0 +1,39 @@ +query('SELECT * FROM `configurations` WHERE `id`=\''.$request['configuration'].'\''); + if ($r->rowCount() == 0) { + return '404'; + } + $S['verifier']['configuration']=new sql_configuration($r->fetch(PDO::FETCH_ASSOC)); + if ($S['verifier']['configuration']->owner != $S['user']->id) { + return '404'; + } + return array('title' => 'Verify'); +} +function body_configurations_verifier() { + global $S; + $c=&$S['verifier']['configuration']; + wizard::set_configuration($c); + $module=new module($c->module); + $status=true; + echo '
    '; + for ($i=1; $i<=$module->steps; $i++) { + echo '
  1. '; + if ($status) { + $step=new wizard_step($c->module, $i); + $status=$status && ($r=$step->verify()); + echo $r?'Valid':'INVALID'; + } else { + echo 'Unavailable'; + } + echo '
  2. '; + } +} +?> diff --git a/frontend/pages/configurations/wizard.php b/frontend/pages/configurations/wizard.php index 9a2b5d4..571f803 100644 --- a/frontend/pages/configurations/wizard.php +++ b/frontend/pages/configurations/wizard.php @@ -6,11 +6,11 @@ function init_configurations_wizard() { } if (isset($request['configuration']) && strlen($request['configuration']) == 6 && ctype_alnum($request['configuration'])) { $S['wizard']['configuration']=new sql_configuration($request['configuration']); - wizard::set_configuration($S['wizard']['configuration']); $configuration=&$S['wizard']['configuration']; if ($configuration->owner != $S['user']->id) { return '404'; } + wizard::set_configuration($S['wizard']['configuration']); if (isset($request['wizard_submit'])) { $steps=array_keys($request['wizard_submit']); $step=$steps[0]; @@ -35,7 +35,7 @@ function init_configurations_wizard() { } } elseif (isset($request['init'])) { $S['wizard']['configuration']=new sql_configuration(); - wizard::set_configuration($S['wizard']['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]; diff --git a/frontend/routing.csv b/frontend/routing.csv index 1455cf7..492e59e 100644 --- a/frontend/routing.csv +++ b/frontend/routing.csv @@ -22,6 +22,7 @@ ^config/([a-zA-Z0-9]{6})$ configurations/wizard configuration ^config/([a-zA-Z0-9]{6})/([0-9]+)$ configurations/wizard configuration step ^configurations$ configurations/manager +^verify/([a-zA-Z0-9]{6})$ configurations/verifier configuration # Download finished image ^download/([a-zA-Z0-9]{6})$ downloadimage build # Session -- cgit v1.2.3-65-gdbad