Improve timezone pull-request and settings page

This commit is contained in:
Frédéric Guillot
2014-02-24 18:08:58 -05:00
parent e374a6fd64
commit 64e2e07229
6 changed files with 17 additions and 14 deletions

View File

@@ -16,7 +16,7 @@ class Config extends Base
'errors' => array(), 'errors' => array(),
'menu' => 'config', 'menu' => 'config',
'title' => t('Settings'), 'title' => t('Settings'),
'timezones' => array_combine(timezone_identifiers_list(), timezone_identifiers_list()) 'timezones' => $this->config->getTimezones()
))); )));
} }
@@ -49,7 +49,7 @@ class Config extends Base
'errors' => $errors, 'errors' => $errors,
'menu' => 'config', 'menu' => 'config',
'title' => t('Settings'), 'title' => t('Settings'),
'timezones' => array_combine(timezone_identifiers_list(), timezone_identifiers_list()) 'timezones' => $this->config->getTimezones()
))); )));
} }

View File

@@ -85,7 +85,7 @@ return array(
'settings' => 'préférences', 'settings' => 'préférences',
'Application Settings' => 'Paramètres de l\'application', 'Application Settings' => 'Paramètres de l\'application',
'Language' => 'Langue', 'Language' => 'Langue',
'Webhooks token' => 'Jeton de securité pour les webhooks', 'Webhooks token:' => 'Jeton de securité pour les webhooks :',
'More information' => 'Plus d\'informations', 'More information' => 'Plus d\'informations',
'Database size:' => 'Taille de la base de données :', 'Database size:' => 'Taille de la base de données :',
'Download the database' => 'Télécharger la base de données', 'Download the database' => 'Télécharger la base de données',
@@ -183,7 +183,5 @@ return array(
'There is no column in your project!' => 'Il n\'y a aucune colonne dans votre projet !', 'There is no column in your project!' => 'Il n\'y a aucune colonne dans votre projet !',
'Change assignee' => 'Changer la personne assignée', 'Change assignee' => 'Changer la personne assignée',
'Change assignee for the task "%s"' => 'Changer la personne assignée pour la tâche « %s »', 'Change assignee for the task "%s"' => 'Changer la personne assignée pour la tâche « %s »',
/* missing 'Timezone' => 'Fuseau horaire',
'Timezone' => ''
*/
); );

View File

@@ -85,7 +85,7 @@ return array(
'settings' => 'ustawienia', 'settings' => 'ustawienia',
'Application Settings' => 'Ustawienia aplikacji', 'Application Settings' => 'Ustawienia aplikacji',
'Language' => 'Język', 'Language' => 'Język',
'Webhooks token' => 'Token', 'Webhooks token:' => 'Token :',
'More information' => 'Więcej informacji', 'More information' => 'Więcej informacji',
'Database size:' => 'Rozmiar bazy danych :', 'Database size:' => 'Rozmiar bazy danych :',
'Download the database' => 'Pobierz bazę danych', 'Download the database' => 'Pobierz bazę danych',

View File

@@ -9,6 +9,12 @@ class Config extends Base
{ {
const TABLE = 'config'; const TABLE = 'config';
public function getTimezones()
{
$timezones = \timezone_identifiers_list();
return array_combine(array_values($timezones), $timezones);
}
public function getLanguages() public function getLanguages()
{ {
$languages = array( $languages = array(

View File

@@ -4,10 +4,7 @@ namespace Schema;
function version_4($pdo) function version_4($pdo)
{ {
$pdo->exec('ALTER TABLE config ADD column timezone TEXT'); $pdo->exec("ALTER TABLE config ADD column timezone TEXT DEFAULT 'UTC'");
//set default timezone to UTC
$pdo->exec('UPDATE config SET timezone = \'UTC\'');
} }
function version_3($pdo) function version_3($pdo)

View File

@@ -10,11 +10,9 @@
<?= Helper\form_label(t('Language'), 'language') ?> <?= Helper\form_label(t('Language'), 'language') ?>
<?= Helper\form_select('language', $languages, $values, $errors) ?><br/> <?= Helper\form_select('language', $languages, $values, $errors) ?><br/>
<?= Helper\form_label(t('Webhooks token'), 'webhooks_token') ?>
<?= Helper\form_text('webhooks_token', $values, $errors, array('readonly')) ?><br/>
<?= Helper\form_label(t('Timezone'), 'timezone') ?> <?= Helper\form_label(t('Timezone'), 'timezone') ?>
<?= Helper\form_select('timezone', $timezones, $values, $errors) ?><br/> <?= Helper\form_select('timezone', $timezones, $values, $errors) ?><br/>
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
</div> </div>
@@ -25,6 +23,10 @@
</div> </div>
<section class="settings"> <section class="settings">
<ul> <ul>
<li>
<?= t('Webhooks token:') ?>
<strong><?= Helper\escape($values['webhooks_token']) ?></strong>
</li>
<li><?= t('Database size:') ?> <strong><?= Helper\format_bytes($db_size) ?></strong></li> <li><?= t('Database size:') ?> <strong><?= Helper\format_bytes($db_size) ?></strong></li>
<li> <li>
<a href="?controller=config&amp;action=downloadDb"><?= t('Download the database') ?></a> <a href="?controller=config&amp;action=downloadDb"><?= t('Download the database') ?></a>