From 7b8a15e7f2b6bcde88a47da9ddfc99bcd7d3e30e Mon Sep 17 00:00:00 2001 From: vgilc Date: Thu, 19 Apr 2012 09:50:52 +0000 Subject: [PATCH] 2012-04-19 Vanessa Gil * godmode/setup/setup.php index.php pandora_db.sql pandoradb_data.sql: Changed timezone setup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6031 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 + pandora_console/godmode/setup/setup.php | 66 ++++++- pandora_console/index.php | 2 +- pandora_console/pandoradb.sql | 10 + pandora_console/pandoradb_data.sql | 235 ++++++++++++++++++++++++ 5 files changed, 318 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 83b8937895..f3e91b10d0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-04-19 Vanessa Gil + + * godmode/setup/setup.php + index.php + pandora_db.sql + pandoradb_data.sql: Changed timezone setup. + 2012-04-18 Miguel de Dios * include/functions_config.php, extensions/update_manager.php, diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 4c00facd2c..944df2f30a 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -20,6 +20,7 @@ check_login (); if (is_ajax ()) { $get_os_icon = (bool) get_parameter ('get_os_icon'); + $select_timezone = get_parameter ('select_timezone', 0); if ($get_os_icon) { $id_os = (int) get_parameter ('id_os'); @@ -27,6 +28,21 @@ if (is_ajax ()) { return; } + if ($select_timezone) { + $zone = get_parameter('zone'); + + $timezones = db_get_all_rows_sql ("SELECT timezone FROM ttimezone WHERE zone='$zone'"); + if ($timezones === false) + $timezones = array(); + + foreach ($timezones as $timezone) { + foreach ($timezone as $key=>$name_tz) { + if ($key == 'timezone') + $timezone_name[$name_tz] = $name_tz; + } + } + echo json_encode($timezone_name); + } return; } @@ -186,8 +202,30 @@ if ($config["integria_enabled"]) { $table->data[22][1] = html_print_select($inventories, 'integria_inventory', $config["integria_inventory"], '', '', '', true); } +$zones = db_get_all_rows_sql("SELECT DISTINCT(zone) FROM ttimezone"); +if ($zones === false) { + $zones = array(); +} +foreach ($zones as $zone) { + foreach ($zone as $key=>$name) { + $zone_name[$name] = $name; + } +} + +$timezones = db_get_all_rows_sql ("SELECT timezone FROM ttimezone WHERE zone='Africa'"); +foreach ($timezones as $timezone) { + foreach ($timezone as $key=>$name_tz) { + if ($key == 'timezone') + $timezone_n[$name_tz] = $name_tz; + } +} + $table->data[23][0] = __('Timezone setup'); -$table->data[23][1] = html_print_input_text ('timezone', $config["timezone"], '', 25, 25, true); +$table->data[23][1] = html_print_input_text_extended ('timezone_text', $config["timezone"], 'text-timezone_text', '', 25, 25, false, '', 'readonly', true); +$table->data[23][1] .= ''.html_print_image ('images/pencil.png', true, array ('title' => __('Change timezone'))).''; +$table->data[23][1] .= "  ". html_print_select($zone_name, 'zone', 'None', 'show_timezone();', '', '', true); +$table->data[23][1] .= "  ". html_print_select($timezone_n, 'timezone', $config["timezone"], '', '', '', true); + $sounds = get_sounds(); $table->data[24][0] = __('Sound for Alert fired'); @@ -233,14 +271,40 @@ function replaySound(type) { } } +function show_timezone () { + zone = $("#zone").val(); + $.ajax({ + type: "POST", + url: "ajax.php", + data: "page=&select_timezone=1&zone=" + zone, + dataType: "json", + success: function(data){ + $("#timezone").empty(); + jQuery.each (data, function (id, value) { + timezone = value; + $("select[name='timezone']").append($("