From: Michael Andreen Date: Fri, 2 Jan 2009 20:41:39 +0000 (+0100) Subject: Possible to edit timezone manually X-Git-Url: https://ruin.nu/git/?p=ndwebbie.git;a=commitdiff_plain;h=7782222a680e2752239bd7f9a853630412d47c74 Possible to edit timezone manually --- 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 @@

-
Timezone +
Timezone -
+ +

+

Remember that GMT stays the same all year, so if you're in the UK you should pick Europe/London.

-
+
[%- 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 = $('