CC-6127 - Add 'Use station default' option to user settings timezone, don't set user timezone by default when creating the admin user

This commit is contained in:
Duncan Sommerville 2015-09-01 16:10:33 -04:00
parent a99bc26715
commit 37df86723d
4 changed files with 12 additions and 11 deletions

View file

@ -18,7 +18,7 @@ class Application_Common_Timezone
'UTC' => DateTimeZone::UTC
);
$tzlist = array();
$tzlist = array(NULL => "Use station default");
foreach ($regions as $name => $mask) {
$ids = DateTimeZone::listIdentifiers($mask);

View file

@ -121,11 +121,14 @@ class Application_Form_EditUser extends Zend_Form
$locale->setValue(Application_Model_Preference::GetUserLocale($currentUserId));
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);
$stationTz = Application_Model_Preference::GetTimezone($currentUserId);
$userTz = Application_Model_Preference::GetUserTimezone($currentUserId);
$timezone = new Zend_Form_Element_Select("cu_timezone");
$timezone->setLabel(_("Interface Timezone:"));
$timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
$timezone->setValue(Application_Model_Preference::GetUserTimezone($currentUserId));
$timezone->setValue($userTz == $stationTz ? null : $userTz);
$timezone->setDecorators(array('ViewHelper'));
$this->addElement($timezone);

View file

@ -477,10 +477,6 @@ class Application_Model_Preference
public static function SetUserTimezone($timezone = null)
{
// When a new user is created they will get the default timezone
// setting which the admin sets on preferences page
if (is_null($timezone))
$timezone = self::GetDefaultTimezone();
self::setValue("user_timezone", $timezone, true);
}
@ -520,10 +516,10 @@ class Application_Model_Preference
public static function GetUserLocale()
{
$locale = self::getValue("user_locale", true);
if (!$locale) {
// empty() checks for null and empty strings - more robust than !val
if (empty($locale)) {
return self::GetDefaultLocale();
}
else {
} else {
return $locale;
}
}