From 7782222a680e2752239bd7f9a853630412d47c74 Mon Sep 17 00:00:00 2001
From: Michael Andreen
Date: Fri, 2 Jan 2009 21:41:39 +0100
Subject: [PATCH] Possible to edit timezone manually
---
lib/NDWeb/Controller/Settings.pm | 3 +--
root/src/settings/index.tt2 | 26 +++++++++++++++++++-------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/lib/NDWeb/Controller/Settings.pm b/lib/NDWeb/Controller/Settings.pm
index d6743fb..4a60ebe 100644
--- a/lib/NDWeb/Controller/Settings.pm
+++ b/lib/NDWeb/Controller/Settings.pm
@@ -92,8 +92,7 @@ sub changeTimezone : Local {
my ( $self, $c ) = @_;
my $dbh = $c->model;
- my $timezone = $c->req->param('category');
- $timezone .= '/' . $c->req->param('country') if $c->req->param('country');
+ my $timezone = $c->req->param('timezone');
my $query = $dbh->prepare(q{UPDATE users SET timezone = $2 WHERE uid = $1});
eval{
$dbh->selectrow_array(q{SELECT NOW() AT TIME ZONE $1},undef,$timezone);
diff --git a/root/src/settings/index.tt2 b/root/src/settings/index.tt2
index 6291e33..c2a88ce 100644
--- a/root/src/settings/index.tt2
+++ b/root/src/settings/index.tt2
@@ -23,7 +23,7 @@
-
+
[%- site.stylesheets = ['ui/ui.datepicker.css'] %]
@@ -50,12 +52,22 @@ $(document).ready(function(){
showOn: "both"
});
$("#tzcategory").change(function(){
- $.get("/jsrpc/tzcountries/" + $(this).val(),function(xml){
+ if ($(this).val() == 'GMT'){
+ $("#timezone").val($(this).val());
$("#tzcountry").empty();
- $("country",xml).each(function(i){
- $("#tzcountry").append('');
+ }else{
+ $.get("/jsrpc/tzcountries/" + $(this).val(),function(xml){
+ $("#tzcountry").empty();
+ $("country",xml).each(function(i){
+ var opt = $('