From a92d35447840a814dad4dca507533f8fe4bd2b63 Mon Sep 17 00:00:00 2001
From: Robert Sesek <rsesek@bluestatic.org>
Date: Fri, 4 Apr 2014 00:02:49 -0400
Subject: [PATCH] Move the defaulttimzone setting to the new page.

---
 admin/setting.php                  |  4 ----
 admin/settings.php                 |  5 +++++
 admin/templates/admin_settings.tpl | 14 +++++++++++++-
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/admin/setting.php b/admin/setting.php
index 9c77d99..1ffb789 100644
--- a/admin/setting.php
+++ b/admin/setting.php
@@ -94,10 +94,6 @@ if ($_REQUEST['do'] == 'modify')
 	}
 	$admin->row_list(T('The authentication class to use to validate cookie data and longins. You may need to edit the actual file for certain authentication systems.'), 'setting[authmethod]');
 	
-	// defaulttimezone
-	$admin->row_span(T('Default Time Zone'), 'thead');
-	$admin->row_text(T('This controls the time zone that all unregistered users view the tracker with.'), construct_option_select('setting[defaulttimezone]', $bugsys->datef->fetch_timezone_list(), $bugsys->options['defaulttimezone']), $bugsys->options['defaulttimezone']);
-	
 	// defaultlanguage
 	$admin->row_span(T('Default Language'), 'thead');
 	$admin->row_text(T('You can set the default language that all new users (and guests) will use.'), construct_option_select('setting[defaultlanguage]', Bugdar::$datastore['language'], $bugsys->options['defaultlanguage'], 'languageid', 'title'), $bugsys->options['defaultlanguage']);
diff --git a/admin/settings.php b/admin/settings.php
index d2a4cb7..fab1a8b 100644
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -36,9 +36,14 @@ class SettingsAction extends http\Action implements TemplatePreCaching
 
 	public function Invoke(http\Request $request, http\Response $response)
 	{
+		// TODO(port): global.
+		global $bugsys;
+
 		$response->data['title'] = T('Settings');
 		$response->context['template'] = 'admin_settings';
 
+		$response->data['timezone_list'] = $bugsys->datef->fetch_timezone_list();
+
 		// Save settings on POST.
 		if ($request->http_method == 'POST') {
 			$query_bits = array();
diff --git a/admin/templates/admin_settings.tpl b/admin/templates/admin_settings.tpl
index 505f351..020f057 100644
--- a/admin/templates/admin_settings.tpl
+++ b/admin/templates/admin_settings.tpl
@@ -70,7 +70,19 @@
 			title="{%=T('Date Format')%}"
 			description="{%=T('Set the date format used for bug report and comment information. This is based on PHP\'s date() function.')%}"
 			value="{%= Bugdar::$options['dateformat'] %}">
-		<!-- defaulttimezone -->
+		<tr>
+			<th>
+				<label for="setting-defaulttimezone">{%=T('Default Time Zone')%}</label>
+				<dfn>{%=T('This controls the time zone that all unregistered users view the tracker with.')%}</dfn>
+			</th>
+			<td>
+				<select id="setting-defaulttimezone" name="settings[defaulttimezone]">
+					{% foreach ($timezone_list as $offset => $name): %}
+					<option value="{%= $offset %}" {%= ($offset == Bugdar::$options['defaulttimezone']) ? 'selected' : '' %}>{%= $name %}</option>
+					{% endforeach %}
+				</select>
+			</td>
+		</tr>
 		<!-- defaultlanguage -->
 		<tr setting-type="text"
 			name="syndicateditems"
-- 
2.43.5