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:
parent
a99bc26715
commit
37df86723d
4 changed files with 12 additions and 11 deletions
|
@ -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);
|
||||
|
|
|
@ -122,10 +122,13 @@ class Application_Form_EditUser extends Zend_Form
|
|||
$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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,7 +353,9 @@ INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('zh_CN', '简体中文'
|
|||
-- added in 2.5.2
|
||||
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', 'UTC');
|
||||
INSERT INTO cc_pref (subjid, keystr, valstr) VALUES (1, 'user_timezone', 'UTC');
|
||||
-- We don't want to set the user timezone by default - it should instead use the station timezone
|
||||
-- until the user changes it manually.
|
||||
-- INSERT INTO cc_pref (subjid, keystr, valstr) VALUES (1, 'user_timezone', 'UTC');
|
||||
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('import_timestamp', '0');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue