Gentoo Archives: gentoo-commits

From: Liam McLoughlin <hexxeh@××××××.net>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoaster:webui commit in: web/
Date: Tue, 02 Aug 2011 17:31:46
Message-Id: a0a786dbc48cf83aab4954058c28b4ff8dfa19f5.hexxeh@gentoo
1 commit: a0a786dbc48cf83aab4954058c28b4ff8dfa19f5
2 Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
3 AuthorDate: Tue Aug 2 17:31:27 2011 +0000
4 Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
5 CommitDate: Tue Aug 2 17:31:27 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=a0a786db
7
8 Add options for configuring default keyboard layout and timezone
9
10 ---
11 web/config.php | 6 ++++++
12 web/index.php | 13 ++++++++++---
13 2 files changed, 16 insertions(+), 3 deletions(-)
14
15 diff --git a/web/config.php b/web/config.php
16 index 39f505f..38076e8 100644
17 --- a/web/config.php
18 +++ b/web/config.php
19 @@ -11,6 +11,12 @@
20
21 // Should we allow multiple simultaneous builds for a user?
22 define("SIMULTANEOUS_BUILDS", false);
23 +
24 + // What should we set as the default keyboard layout?
25 + define("DEFAULT_KEYBOARD", "gb");
26 +
27 + // What should we set as the default timezone?
28 + define("DEFAULT_TIMEZONE", "Europe/London");
29
30 // What should we set as the default list of packages?
31 define("DEFAULT_PACKAGES", "dhcpd");
32
33 diff --git a/web/index.php b/web/index.php
34 index b6cb119..4903bbb 100644
35 --- a/web/index.php
36 +++ b/web/index.php
37 @@ -57,15 +57,22 @@
38 }
39 $timezoneOption = "";
40 foreach ($timezones as $timezone => $description) {
41 - $timezoneOption .= "<option>".$timezone."</option>\n";
42 + $timezoneOption .= "<option";
43 + if ($timezone == DEFAULT_TIMEZONE) {
44 + $timezoneOption .= " selected";
45 + }
46 + $timezoneOption .= ">".$timezone."</option>\n";
47 }
48 $layoutLines = file(GENTOASTER_PATH."/res/keyboard.lst");
49 $keyboardOption = "";
50
51 foreach($layoutLines as $layout) {
52 $layoutdata = explode("\t", $layout);
53 - $keyboardOption .= "<option value=\"".$layoutdata[0]."\">";
54 - $keyboardOption .= trim($layoutdata[1])."</option>\n";
55 + $keyboardOption .= "<option value=\"".$layoutdata[0]."\"";
56 + if ($layoutdata[0] == DEFAULT_KEYBOARD) {
57 + $keyboardOption .= " selected";
58 + }
59 + $keyboardOption .= ">".trim($layoutdata[1])."</option>\n";
60 }
61
62 asort($layouts);