diff options
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/pages/wizard.php | 2 | ||||
-rw-r--r-- | frontend/wizard/step1.php | 6 | ||||
-rw-r--r-- | frontend/wizard/step2.php | 38 |
3 files changed, 42 insertions, 4 deletions
diff --git a/frontend/pages/wizard.php b/frontend/pages/wizard.php index 9f2af1d..bf3ca32 100644 --- a/frontend/pages/wizard.php +++ b/frontend/pages/wizard.php @@ -26,6 +26,7 @@ function init_wizard() { $proc='wizard_process_step'.$step; if (function_exists($proc)) { if ($proc() === true) { + debug('wizard', "Step $step returned <i>true</i> - config finished!"); $build->status='build/ready'; $build->ctime=time(); $build->write(); @@ -82,6 +83,7 @@ function body_wizard() { } else { $build=&$S['wizard.build']; $step=&$S['wizard.step']; + echo '<h3>'.$S['title'].'</h3>'; echo '<form action="'.url('create/'.$build->id).'" method="post">'; require_once(FRONTEND."/wizard/step$step.php"); $proc='wizard_body_step'.$step; diff --git a/frontend/wizard/step1.php b/frontend/wizard/step1.php index ab3fea5..cb8d2bf 100644 --- a/frontend/wizard/step1.php +++ b/frontend/wizard/step1.php @@ -1,12 +1,11 @@ <?php function wizard_init_step1() { - return array('title' => 'Create - Step 1'); + return array('title' => 'Step 1 - Choose Profile'); } function wizard_body_step1() { global $S; $build=&$S['wizard.build']; - $opts=$build->get_buildopts(); - echo '<h3>Step 1</h3>'; + //$opts=$build->get_buildopts(); // TODO use this to set selected="selected" on the current profile echo 'Profile: <select name="pkgdir">'; $r=$S['pdo']->query('SELECT * FROM `profiles` WHERE `flags` NOT LIKE "%d%"'); // d for disabled while ($profile=$r->fetch(PDO::FETCH_ASSOC)) { @@ -21,6 +20,5 @@ function wizard_process_step1() { $profile=new sql_profile($request['pkgdir']); $profileopt=new sql_buildopt($S['wizard.build']->id, 'profile', $profile->pkgdir); $profileopt->write(); - return true; } ?> diff --git a/frontend/wizard/step2.php b/frontend/wizard/step2.php new file mode 100644 index 0000000..5ce0c46 --- /dev/null +++ b/frontend/wizard/step2.php @@ -0,0 +1,38 @@ +<?php +function wizard_init_step2() { + return array('title' => 'Step 2 - Choose Extra Packages'); +} +function wizard_body_step2() { + global $S; + $build=&$S['wizard.build']; + $opts=$build->get_buildopts(); + $profile=new sql_profile($opts['profile']); + $categories=$profile->get_packages(); + echo '<ul>'; + foreach ($categories as $cat => $packages) { + echo '<li><b>'.htmlentities($cat).'</b><ul>'; + foreach ($packages as $name => $vers) { + echo '<li>'.htmlentities($name).'<ul>'; + foreach ($vers as $ver => $attrs) { + $safename=htmlentities("$cat/$name-$ver"); + echo '<li'.($attrs['masked']?' style="color: red"':'').'><input id="pkg-'.$safename.'" type="checkbox" name="extra_packages[='.$safename.']" /><label class="pointer" for="pkg-'.$safename.'">'.htmlentities($ver).' - '.htmlentities($attrs['description']).'</label></li>'; + } + echo '</ul></li>'; + } + echo '</ul></li>'; + } +} +function wizard_process_step2() { + global $S, $request; + $packages=array(); + if (isset($request['extra_packages'])) { + foreach ($request['extra_packages'] as $name => $null) { + $packages[]=$name; + } + } + $packages=implode(' ', $packages); + $opt=new sql_buildopt($S['wizard.build']->id, 'install_packages', $packages); + $opt->write(); + return true; +} +?> |