diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/Config.php | 1 | ||||
-rw-r--r-- | app/Controller/Project.php | 2 | ||||
-rw-r--r-- | app/Controller/Task.php | 10 | ||||
-rw-r--r-- | app/Locales/de_DE/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/es_ES/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/fi_FI/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/fr_FR/translations.php | 6 | ||||
-rw-r--r-- | app/Locales/it_IT/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/pl_PL/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/pt_BR/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/ru_RU/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/sv_SE/translations.php | 4 | ||||
-rw-r--r-- | app/Locales/zh_CN/translations.php | 4 | ||||
-rw-r--r-- | app/Model/DateParser.php | 19 | ||||
-rw-r--r-- | app/Schema/Mysql.php | 8 | ||||
-rw-r--r-- | app/Schema/Postgres.php | 8 | ||||
-rw-r--r-- | app/Schema/Sqlite.php | 8 | ||||
-rw-r--r-- | app/Templates/config_application.php | 4 | ||||
-rw-r--r-- | app/Templates/project_export.php | 4 | ||||
-rw-r--r-- | app/Templates/task_edit.php | 2 | ||||
-rw-r--r-- | app/Templates/task_new.php | 2 |
21 files changed, 79 insertions, 31 deletions
diff --git a/app/Controller/Config.php b/app/Controller/Config.php index 869d4331..7c8373c3 100644 --- a/app/Controller/Config.php +++ b/app/Controller/Config.php @@ -78,6 +78,7 @@ class Config extends Base 'title' => t('Application settings'), 'languages' => $this->config->getLanguages(), 'timezones' => $this->config->getTimezones(), + 'date_formats' => $this->dateParser->getAvailableFormats(), ))); } diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 7b174ef4..48f6f10e 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -86,6 +86,8 @@ class Project extends Base 'to' => $to, ), 'errors' => array(), + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), 'menu' => 'projects', 'project' => $project, 'title' => t('Tasks Export') diff --git a/app/Controller/Task.php b/app/Controller/Task.php index fc7103ef..163929d2 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -92,6 +92,8 @@ class Task extends Base 'users_list' => $this->projectPermission->getUsersList($project_id), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project_id), + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), 'menu' => 'tasks', 'title' => t('New task') ))); @@ -138,6 +140,8 @@ class Task extends Base 'users_list' => $this->projectPermission->getUsersList($values['project_id']), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($values['project_id']), + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), 'menu' => 'tasks', 'title' => t('New task') ))); @@ -153,7 +157,7 @@ class Task extends Base $task = $this->getTask(); if (! empty($task['date_due'])) { - $task['date_due'] = date(t('m/d/Y'), $task['date_due']); + $task['date_due'] = date($this->config->get('application_date_format'), $task['date_due']); } else { $task['date_due'] = ''; @@ -169,6 +173,8 @@ class Task extends Base 'users_list' => $this->projectPermission->getUsersList($task['project_id']), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($task['project_id']), + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), 'ajax' => $ajax, 'menu' => 'tasks', 'title' => t('Edit a task') @@ -219,6 +225,8 @@ class Task extends Base 'users_list' => $this->projectPermission->getUsersList($values['project_id']), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($values['project_id']), + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), 'menu' => 'tasks', 'title' => t('Edit a task'), 'ajax' => $this->request->isAjax(), diff --git a/app/Locales/de_DE/translations.php b/app/Locales/de_DE/translations.php index 93721f65..4e72cfc0 100644 --- a/app/Locales/de_DE/translations.php +++ b/app/Locales/de_DE/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'Eine Beschreibung wird benötigt', 'Edit this task' => 'Aufgabe bearbeiten', 'Due Date' => 'Fällig am', - 'm/d/Y' => 'd.m.Y', - 'month/day/year' => 'TT.MM.JJJJ', 'Invalid date' => 'Ungültiges Datum', 'Must be done before %B %e, %Y' => 'Muss vor dem %d.%m.%Y erledigt werden', '%B %e, %Y' => '%d.%m.%Y', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/es_ES/translations.php b/app/Locales/es_ES/translations.php index 8b92b9a5..4e7bc537 100644 --- a/app/Locales/es_ES/translations.php +++ b/app/Locales/es_ES/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'La descripción es obligatoria', 'Edit this task' => 'Editar esta tarea', 'Due Date' => 'Fecha límite', - 'm/d/Y' => 'd/m/Y', - 'month/day/year' => 'día/mes/año', 'Invalid date' => 'Fecha no válida', 'Must be done before %B %e, %Y' => 'Debe de estar hecho antes del %d/%m/%Y', '%B %e, %Y' => '%d/%m/%Y', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/fi_FI/translations.php b/app/Locales/fi_FI/translations.php index 923ba970..f5618b8b 100644 --- a/app/Locales/fi_FI/translations.php +++ b/app/Locales/fi_FI/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'Kuvaus vaaditaan', 'Edit this task' => 'Muokkaa tehtävää', 'Due Date' => 'Deadline', - 'm/d/Y' => 'd.m.Y', - 'month/day/year' => 'päivä.kuukausi.vuosi', 'Invalid date' => 'Virheellinen päiväys', 'Must be done before %B %e, %Y' => 'Täytyy suorittaa ennen %d.%m.%Y', '%B %e, %Y' => '%d.%m.%Y', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/fr_FR/translations.php b/app/Locales/fr_FR/translations.php index 19c15f86..8c9c74ea 100644 --- a/app/Locales/fr_FR/translations.php +++ b/app/Locales/fr_FR/translations.php @@ -209,11 +209,9 @@ return array( 'The description is required' => 'La description est obligatoire', 'Edit this task' => 'Modifier cette tâche', 'Due Date' => 'Date d\'échéance', - 'm/d/Y' => 'd/m/Y', // Date format parsed with php - 'month/day/year' => 'jour/mois/année', // Help shown to the user 'Invalid date' => 'Date invalide', 'Must be done before %B %e, %Y' => 'Doit être fait avant le %d/%m/%Y', - '%B %e, %Y' => '%d/%m/%Y', + '%B %e, %Y' => '%d %B %Y', 'Automatic actions' => 'Actions automatisées', 'Your automatic action have been created successfully.' => 'Votre action automatisée a été ajouté avec succès.', 'Unable to create your automatic action.' => 'Impossible de créer votre action automatisée.', @@ -534,4 +532,6 @@ return array( 'Application URL' => 'URL de l\'application', 'Example: http://example.kanboard.net/ (used by email notifications)' => 'Exemple : http://exemple.kanboard.net/ (utilisé pour les notifications)', 'Token regenerated.' => 'Jeton de sécurité regénéré.', + 'Date format' => 'Format de date', + 'ISO format is always accepted, example: "%s" and "%s"' => 'Le format ISO est toujours accepté, exemple : « %s » et « %s »', ); diff --git a/app/Locales/it_IT/translations.php b/app/Locales/it_IT/translations.php index e5b5eb57..24d13360 100644 --- a/app/Locales/it_IT/translations.php +++ b/app/Locales/it_IT/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'Si richiede una descrizione', 'Edit this task' => 'Modificare questo compito', 'Due Date' => 'Data di scadenza', - 'm/d/Y' => 'd/m/Y', - 'month/day/year' => 'giorno/mese/anno', 'Invalid date' => 'Data sbagliata', // 'Must be done before %B %e, %Y' => '', // '%B %e, %Y' => '', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/pl_PL/translations.php b/app/Locales/pl_PL/translations.php index cdf200b9..41e5555d 100644 --- a/app/Locales/pl_PL/translations.php +++ b/app/Locales/pl_PL/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'Opis jest wymagany', 'Edit this task' => 'Edytuj zadanie', 'Due Date' => 'Termin', - 'm/d/Y' => 'd/m/Y', - 'month/day/year' => 'dzień/miesiąc/rok', 'Invalid date' => 'Błędna data', 'Must be done before %B %e, %Y' => 'Termin do %e %B %Y', '%B %e, %Y' => '%e %B %Y', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/pt_BR/translations.php b/app/Locales/pt_BR/translations.php index 1524355d..89f789c3 100644 --- a/app/Locales/pt_BR/translations.php +++ b/app/Locales/pt_BR/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'A descrição é obrigatória', 'Edit this task' => 'Editar esta tarefa', 'Due Date' => 'Data de vencimento', - 'm/d/Y' => 'd/m/Y', - 'month/day/year' => 'dia/mês/ano', 'Invalid date' => 'Data inválida', 'Must be done before %B %e, %Y' => 'Deve ser feito antes de %d %B %Y', '%B %e, %Y' => '%d %B %Y', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/ru_RU/translations.php b/app/Locales/ru_RU/translations.php index e5e3e8bc..e658c09c 100644 --- a/app/Locales/ru_RU/translations.php +++ b/app/Locales/ru_RU/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'Требуется описание', 'Edit this task' => 'Изменить задачу', 'Due Date' => 'Срок', - 'm/d/Y' => 'м/д/Г', - 'month/day/year' => 'месяц/день/год', 'Invalid date' => 'Неверная дата', 'Must be done before %B %e, %Y' => 'Должно быть сделано до %d/%m/%Y', '%B %e, %Y' => '%d/%m/%Y', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/sv_SE/translations.php b/app/Locales/sv_SE/translations.php index 4c8aef81..9c9eac02 100644 --- a/app/Locales/sv_SE/translations.php +++ b/app/Locales/sv_SE/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => 'En beskrivning måste lämnas', 'Edit this task' => 'Ändra denna uppgift', 'Due Date' => 'Måldatum', - 'm/d/Y' => 'd/m/Y', - 'month/day/year' => 'dag/månad/år', 'Invalid date' => 'Ej tillåtet datum', 'Must be done before %B %e, %Y' => 'Måste vara klart innan %B %e, %Y', '%B %e, %Y' => '%d %B %Y', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Locales/zh_CN/translations.php b/app/Locales/zh_CN/translations.php index 3285e9a6..41afd362 100644 --- a/app/Locales/zh_CN/translations.php +++ b/app/Locales/zh_CN/translations.php @@ -209,8 +209,6 @@ return array( 'The description is required' => '必须得有描述', 'Edit this task' => '编辑该任务', 'Due Date' => '到期', - 'm/d/Y' => 'Y/m/d', - 'month/day/year' => '年/月/日', 'Invalid date' => '无效日期', 'Must be done before %B %e, %Y' => '必须在%Y年%m月%d日前完成', '%B %e, %Y' => '%Y/%m/%d', @@ -534,4 +532,6 @@ return array( // 'Application URL' => '', // 'Example: http://example.kanboard.net/ (used by email notifications)' => '', // 'Token regenerated.' => '', + // 'Date format' => '', + // 'ISO format is always accepted, example: "%s" and "%s"' => '', ); diff --git a/app/Model/DateParser.php b/app/Model/DateParser.php index b051fb6e..88e67686 100644 --- a/app/Model/DateParser.php +++ b/app/Model/DateParser.php @@ -57,7 +57,7 @@ class DateParser extends Base } /** - * Return the list of supported date formats + * Return the list of supported date formats (for the parser) * * @access public * @return array @@ -65,13 +65,28 @@ class DateParser extends Base public function getDateFormats() { return array( - t('m/d/Y'), + $this->config->get('application_date_format', 'm/d/Y'), 'Y-m-d', 'Y_m_d', ); } /** + * Return the list of available date formats (for the config page) + * + * @access public + * @return array + */ + public function getAvailableFormats() + { + return array( + 'm/d/Y' => date('m/d/Y'), + 'd/m/Y' => date('d/m/Y'), + 'Y/m/d' => date('Y/m/d'), + ); + } + + /** * For a given timestamp, reset the date to midnight * * @access public diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index e6a33ee5..8b6ba5ae 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -5,7 +5,13 @@ namespace Schema; use PDO; use Core\Security; -const VERSION = 29; +const VERSION = 30; + +function version_30($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('application_date_format', 'm/d/Y')); +} function version_29($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 0eeb2a72..90a3da40 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -5,7 +5,13 @@ namespace Schema; use PDO; use Core\Security; -const VERSION = 10; +const VERSION = 11; + +function version_11($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('application_date_format', 'm/d/Y')); +} function version_10($pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 5986d327..b39532f1 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -5,7 +5,13 @@ namespace Schema; use Core\Security; use PDO; -const VERSION = 29; +const VERSION = 30; + +function version_30($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('application_date_format', 'm/d/Y')); +} function version_29($pdo) { diff --git a/app/Templates/config_application.php b/app/Templates/config_application.php index 251a45dc..97071bd0 100644 --- a/app/Templates/config_application.php +++ b/app/Templates/config_application.php @@ -16,6 +16,10 @@ <?= Helper\form_label(t('Timezone'), 'application_timezone') ?> <?= Helper\form_select('application_timezone', $timezones, $values, $errors) ?><br/> + <?= Helper\form_label(t('Date format'), 'application_date_format') ?> + <?= Helper\form_select('application_date_format', $date_formats, $values, $errors) ?><br/> + <p class="form-help"><?= t('ISO format is always accepted, example: "%s" and "%s"', date('Y-m-d'), date('Y_m_d')) ?></p> + <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> </div> diff --git a/app/Templates/project_export.php b/app/Templates/project_export.php index 46b4f369..02eb389f 100644 --- a/app/Templates/project_export.php +++ b/app/Templates/project_export.php @@ -11,10 +11,10 @@ <?= Helper\form_hidden('project_id', $values) ?> <?= Helper\form_label(t('Start Date'), 'from') ?> - <?= Helper\form_text('from', $values, $errors, array('required', 'placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/> + <?= Helper\form_text('from', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/> <?= Helper\form_label(t('End Date'), 'to') ?> - <?= Helper\form_text('to', $values, $errors, array('required', 'placeholder="'.t('month/day/year').'"'), 'form-date') ?> + <?= Helper\form_text('to', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?> <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> diff --git a/app/Templates/task_edit.php b/app/Templates/task_edit.php index 4038717e..73e00a31 100644 --- a/app/Templates/task_edit.php +++ b/app/Templates/task_edit.php @@ -34,7 +34,7 @@ <?= Helper\form_number('score', $values, $errors) ?><br/> <?= Helper\form_label(t('Due Date'), 'date_due') ?> - <?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/> + <?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/> <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> </div> diff --git a/app/Templates/task_new.php b/app/Templates/task_new.php index e07d436c..867bcbc9 100644 --- a/app/Templates/task_new.php +++ b/app/Templates/task_new.php @@ -39,7 +39,7 @@ <?= Helper\form_number('score', $values, $errors) ?><br/> <?= Helper\form_label(t('Due Date'), 'date_due') ?> - <?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/> + <?= Helper\form_text('date_due', $values, $errors, array('placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/> <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> </div> |