add default timezone to site admin panel
This commit is contained in:
parent
691beefd0f
commit
977d5d6f85
|
@ -90,7 +90,7 @@ class SiteadminpanelAction extends AdminPanelAction
|
||||||
|
|
||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
static $settings = array('name', 'broughtby', 'broughtbyurl', 'email');
|
static $settings = array('name', 'broughtby', 'broughtbyurl', 'email', 'timezone');
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
|
|
||||||
|
@ -135,6 +135,14 @@ class SiteadminpanelAction extends AdminPanelAction
|
||||||
if (!Validate::email($values['email'], common_config('email', 'check_domain'))) {
|
if (!Validate::email($values['email'], common_config('email', 'check_domain'))) {
|
||||||
$this->clientError(_('Not a valid email address'));
|
$this->clientError(_('Not a valid email address'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate timezone
|
||||||
|
|
||||||
|
if (is_null($values['timezone']) ||
|
||||||
|
!in_array($values['timezone'], DateTimeZone::listIdentifiers())) {
|
||||||
|
$this->clientError(_('Timezone not selected.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +197,18 @@ class SiteAdminPanelForm extends Form
|
||||||
_('URL used for credits link in footer of each page'));
|
_('URL used for credits link in footer of each page'));
|
||||||
$this->input('email', _('Email'),
|
$this->input('email', _('Email'),
|
||||||
_('contact email address for your site'));
|
_('contact email address for your site'));
|
||||||
|
|
||||||
|
$timezones = array();
|
||||||
|
|
||||||
|
foreach (DateTimeZone::listIdentifiers() as $k => $v) {
|
||||||
|
$timezones[$v] = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
asort($timezones);
|
||||||
|
|
||||||
|
$this->out->dropdown('timezone', _('Default timezone'),
|
||||||
|
$timezones, _('Default timezone for the site; usually UTC.'),
|
||||||
|
true, $this->value('timezone'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -203,12 +223,25 @@ class SiteAdminPanelForm extends Form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function input($setting, $title, $instructions)
|
function input($setting, $title, $instructions)
|
||||||
|
{
|
||||||
|
$this->out->input($setting, $title, $this->value($setting), $instructions);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility to simplify getting the posted-or-stored setting value
|
||||||
|
*
|
||||||
|
* @param string $setting Name of the setting
|
||||||
|
*
|
||||||
|
* @return string param value if posted, or current config value
|
||||||
|
*/
|
||||||
|
|
||||||
|
function value($setting)
|
||||||
{
|
{
|
||||||
$value = $this->out->trimmed($setting);
|
$value = $this->out->trimmed($setting);
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
$value = common_config('site', $setting);
|
$value = common_config('site', $setting);
|
||||||
}
|
}
|
||||||
$this->out->input($setting, $title, $value, $instructions);
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user