aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam McLoughlin <hexxeh@hexxeh.net>2011-07-21 23:12:21 +0100
committerLiam McLoughlin <hexxeh@hexxeh.net>2011-07-21 23:12:21 +0100
commit3dd50e713424c76cdfc709bb4f6b96be9bced1b0 (patch)
tree66488bab92bb57bf893f0491d23f9123d372db05
parentAlso, let's NOT trash the log file when things go wrong. REALLY bad idea. (diff)
downloadgentoaster-3dd50e713424c76cdfc709bb4f6b96be9bced1b0.tar.gz
gentoaster-3dd50e713424c76cdfc709bb4f6b96be9bced1b0.tar.bz2
gentoaster-3dd50e713424c76cdfc709bb4f6b96be9bced1b0.zip
Added zonetab loading for timezone lists
-rw-r--r--web/index.php147
1 files changed, 33 insertions, 114 deletions
diff --git a/web/index.php b/web/index.php
index 86b608c..181d07b 100644
--- a/web/index.php
+++ b/web/index.php
@@ -1,3 +1,25 @@
+<?php
+ define("ZONETAB", "/usr/share/zoneinfo/zone.tab");
+
+ $timezones = array();
+ $zonetab = file(ZONETAB);
+ foreach ($zonetab as $buf)
+ {
+ if (substr($buf,0,1)=='#') continue;
+ $rec = preg_split('/\s+/',$buf);
+ $key = $rec[2];
+ $val = $rec[2];
+ $c = count($rec);
+ for ($i=3;$i<$c;$i++) $val.= ' '.$rec[$i];
+ $timezones[$key] = $val;
+ ksort($timezones);
+ }
+ $timezoneOption = "";
+ foreach ($timezones as $timezone => $description)
+ {
+ $timezoneOption .= "<option>".$timezone."</option>\n";
+ }
+?>
<html>
<head>
<title>Gentoaster</title>
@@ -23,7 +45,7 @@
</div>
<div id="locale" class="step">
<h1>Locale</h1>
-
+
<label for="locale_language">Language</label><br />
<select id="locale_language" class="required" name="language">
<option>English (UK)</option>
@@ -38,36 +60,36 @@
<label for="locale_timezone">Timezone</label><br />
<select id="locale_timezone" class="required" name="timezone">
- <option>Europe/London</option>
+ <?php echo $timezoneOption; ?>
</select>
<br>
</div>
<div id="user" class="step">
<h1>User details</h1>
-
+
<label for="user_username">Username</label><br />
<input id="user_username" class="required" type="text" name="username"><br>
<label for="user_password">Password</label><br />
<input id="user_password" class="required" type="password" name="password">
<input id="user_confirmpassword" class="required" type="password" name="confirmpassword"><br>
-
+
<label for="user_rootpassword">Root Password</label><br />
<input id="user_rootpassword" class="required" type="password" name="rootpassword">
<input id="user_confirmrootpassword" class="required" type="password" name="confirmrootpassword"><br>
</div>
<div id="network" class="step">
<h1>Network</h1>
-
+
<label for="network_hostname">Hostname</label><br />
<input id="network_hostname" class="required" type="text" name="hostname"><br>
</div>
<div id="partitioning" class="step">
<h1>Partitioning</h1>
-
+
<label for="partitioning_size">Disk size</label><br />
<input id="partitioning_size" class="required" type="text" name="size" value="4096"><br>
-
+
<label for="">Split</label><br /><br />
<div id="partitioning_split" name="split"></div><br /><br />
<div id="partitioning_display">Not yet updated</div><br />
@@ -77,14 +99,14 @@
</div>
<div id="packages" class="step">
<h1>Packages</h1>
-
+
<label for="packages_packages">Packages list</label><br /><br />
<textarea id="packages_packages" name="packages" style="width: 680px; height: 330px;">dhcpcd</textarea>
<br>
</div>
<div id="format" class="step submit_step">
<h1>Image format</h1>
-
+
<label for="format_format">Output format</label><br />
<select id="format_format" class="required" name="format">
<option value="raw">Raw</option>
@@ -106,109 +128,6 @@
</div>
</form>
</div>
- <script type="text/javascript">
- $(function(){
- $("#wizard").formwizard({
- validationEnabled: true,
- focusFirstInput: true,
- disableUIStyles: true,
- //historyEnabled: true,
- validationOptions: {
- rules: {
- username: {
- minlength: 2
- },
- password: {
- minlength: 5
- },
- confirmpassword: {
- minlength: 5,
- equalTo: "#user_password"
- },
- boot_size: {
- min: 32
- },
- swap_size: {
- min: 16
- },
- root_size: {
- min: 3072
- },
- size: {
- min: 4020
- }
- },
- messages: {
- username: {
- minlength: "Your username must consist of at least 2 characters"
- },
- password: {
- minlength: "Your password must be at least 5 characters long"
- },
- confirmpassword: {
- minlength: "Your password must be at least 5 characters long",
- equalTo: "Please enter the same password in both boxes"
- },
- boot_size: {
- min: "Your boot partition must be at least 32MB"
- },
- swap_size: {
- min: "Your swap partition must be at least 128MB"
- },
- root_size: {
- min: "Your root partition must be at least 3072MB"
- },
- size: {
- min: "Your disk image must be at least 4020MB"
- }
- }
- }
- });
-
- function partitioning_update(event, ui) {
- if(!ui.values) {
- ui.values = ui;
- }
- $('.partitionrange').css('width', $('.ui-slider-range').css('left'));
- var boot_size = ui.values[0];
- var swap_size = ui.values[1]-ui.values[0];
- var root_size = $("#partitioning_split").slider( "option", "max" )-ui.values[1];
- var image_size = boot_size+swap_size+root_size;
- $("#partitioning_display").html("Disk image size: "+image_size+"MB<br>Boot partition size: "+boot_size+"MB<br>Swap partition size: "+swap_size+"MB<br>Root partition size: "+root_size+"MB");
- $("#partitioning_boot").attr("value", boot_size);
- $("#partitioning_swap").attr("value", swap_size);
- $("#partitioning_root").attr("value", root_size);
-
- //since it doesn't seem to redraw by itself, hacky fix!
- $("#partitioning_split").slider("option", "values", $("#partitioning_split").slider("option", "values"));
- }
-
- $("#partitioning_split").slider({
- range: true,
- min: 0,
- max: 4096,
- values: [128, 640],
- slide: partitioning_update,
- change: partitioning_update,
- create: function(event, ui) {
- var slider = $(event.target);
- var range = slider.find('.ui-slider-range');
- var newrange = $('<div />');
- newrange.appendTo(slider).addClass('ui-slider-range partitionrange').css('width', range.css('left'));
- }
- });
-
- function update_slider() {
- var new_size = $("#partitioning_size").val();
- $("#partitioning_split").slider("option", "max", new_size);
- partitioning_update(null, $("#partitioning_split").slider("option", "values"));
- }
-
-
- $("#partitioning_size").change(update_slider);
-
- partitioning_update(null, $("#partitioning_split").slider("option", "values"));
- });
- </script>
+ <script type="text/javascript" src=" /js/gentoaster.js"></script>
</body>
-</html> \ No newline at end of file
+</html>