From c626a0b84da7ec05c04543c12594869988b4e886 Mon Sep 17 00:00:00 2001 From: Liam McLoughlin Date: Tue, 2 Aug 2011 18:21:43 +0100 Subject: Fix a simultaneous builds bug where failed builds were counted as still being in progress, add keyboard layout support to WebUI. --- web/config.php | 3 +++ web/index.php | 20 ++++++++++++++++---- web/process.php | 2 ++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/web/config.php b/web/config.php index 210d1db..39f505f 100644 --- a/web/config.php +++ b/web/config.php @@ -3,6 +3,9 @@ // Gentoaster web interface settings // Licensed under GPL v3, see COPYING file + // Path to the Gentoaster binaries/resources + define("GENTOASTER_PATH", "/usr/share/gentoaster"); + // Path to the zonetab file define("ZONETAB", "/usr/share/zoneinfo/zone.tab"); diff --git a/web/index.php b/web/index.php index 55484d0..b6cb119 100644 --- a/web/index.php +++ b/web/index.php @@ -23,12 +23,14 @@ FILTER_VALIDATE_IP ); - $stmt = $db->prepare("SELECT id FROM builds WHERE ipaddress = ?"); - $stmt->bind_param("s", $ipaddress); + $query = "SELECT id, returncode ". + "FROM builds WHERE ipaddress = ?"; + $stmt = $db->prepare($query); + $stmt->bind_param("sd", $ipaddress, $returncode); $stmt->execute(); $stmt->store_result(); - if ($stmt->num_rows == 1) { + if ($stmt->num_rows == 1 && $returncode === null) { $stmt->bind_result($buildID); $stmt->fetch(); $url = "status.php?uuid=".$buildID."&simultaneous=true"; @@ -57,6 +59,16 @@ foreach ($timezones as $timezone => $description) { $timezoneOption .= "\n"; } + $layoutLines = file(GENTOASTER_PATH."/res/keyboard.lst"); + $keyboardOption = ""; + + foreach($layoutLines as $layout) { + $layoutdata = explode("\t", $layout); + $keyboardOption .= "\n"; + } + + asort($layouts); ?> @@ -117,7 +129,7 @@

diff --git a/web/process.php b/web/process.php index b16f272..c590bee 100644 --- a/web/process.php +++ b/web/process.php @@ -51,6 +51,7 @@ $swapMegabytes = filter_input(INPUT_POST, "swap_size", FILTER_VALIDATE_INT); $rootMegabytes = filter_input(INPUT_POST, "root_size", FILTER_VALIDATE_INT); $timezone = filter_input(INPUT_POST, "timezone", FILTER_CALLBACK, $sfi); + $keyboard = filter_input(INPUT_POST, "keyboard", FILTER_CALLBACK, $sfi); $hostname = filter_input(INPUT_POST, "hostname", FILTER_CALLBACK, $sfi); $username = filter_input(INPUT_POST, "username", FILTER_CALLBACK, $sfi); $password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $sfi); @@ -69,6 +70,7 @@ BOOT_MEGABYTES='$bootMegabytes' SWAP_MEGABYTES='$swapMegabytes' ROOT_MEGABYTES='$rootMegabytes' TIMEZONE=$timezone +KEYBOARD=$keyboard HOSTNAME=$hostname ROOT_PASSWORD=$rootPass DEFAULT_USERNAME=$username -- cgit v1.2.3-65-gdbad