summaryrefslogtreecommitdiff
blob: 4e2907cb2379fc08a94a019f1687b0c94bf5bb67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
function gentoo_init_step2() {
	return array('title' => 'Step 2 - Choose Extra Packages');
}
function gentoo_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 gentoo_process_step2() {
	global $S, $request;
	if (isset($request['extra_packages'])) {
		$packages=array();
		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();
	}
}
?>