From cd4c09c10aabb133efa0ef5e0566630941178a4a Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 5 Jun 2016 14:53:46 -0400 Subject: Conifgure email settings through user interface --- ChangeLog | 1 + app/Controller/ConfigController.php | 21 +++++++++++++++++++++ app/Core/Mail/Client.php | 12 ++++++++++++ app/Helper/MailHelper.php | 17 +++++++++++++++++ app/Job/EmailJob.php | 5 +++-- app/Locale/bs_BA/translations.php | 8 +++++--- app/Locale/cs_CZ/translations.php | 8 +++++--- app/Locale/da_DK/translations.php | 8 +++++--- app/Locale/de_DE/translations.php | 8 +++++--- app/Locale/el_GR/translations.php | 8 +++++--- app/Locale/es_ES/translations.php | 8 +++++--- app/Locale/fi_FI/translations.php | 8 +++++--- app/Locale/fr_FR/translations.php | 8 +++++--- app/Locale/hu_HU/translations.php | 10 ++++++---- app/Locale/id_ID/translations.php | 8 +++++--- app/Locale/it_IT/translations.php | 8 +++++--- app/Locale/ja_JP/translations.php | 8 +++++--- app/Locale/ko_KR/translations.php | 8 +++++--- app/Locale/my_MY/translations.php | 8 +++++--- app/Locale/nb_NO/translations.php | 8 +++++--- app/Locale/nl_NL/translations.php | 8 +++++--- app/Locale/pl_PL/translations.php | 8 +++++--- app/Locale/pt_BR/translations.php | 8 +++++--- app/Locale/pt_PT/translations.php | 8 +++++--- app/Locale/ru_RU/translations.php | 8 +++++--- app/Locale/sr_Latn_RS/translations.php | 8 +++++--- app/Locale/sv_SE/translations.php | 8 +++++--- app/Locale/th_TH/translations.php | 8 +++++--- app/Locale/tr_TR/translations.php | 8 +++++--- app/Locale/zh_CN/translations.php | 8 +++++--- app/Template/config/application.php | 3 --- app/Template/config/email.php | 18 ++++++++++++++++++ app/Template/config/sidebar.php | 3 +++ tests/units/Base.php | 2 +- tests/units/Helper/MailHelperTest.php | 11 +++++++++++ 35 files changed, 213 insertions(+), 82 deletions(-) create mode 100644 app/Template/config/email.php diff --git a/ChangeLog b/ChangeLog index fba5eedf..487efd9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ New features: Improvements: +* Configure email settings with the user interface in addition to config file * Upgrade Docker image to Alpine Linux 3.4 * Move task import to a separate section * Mark web notification as read when clicking on it diff --git a/app/Controller/ConfigController.php b/app/Controller/ConfigController.php index 8bcf4c35..8285ee13 100644 --- a/app/Controller/ConfigController.php +++ b/app/Controller/ConfigController.php @@ -72,6 +72,7 @@ class ConfigController extends BaseController public function application() { $this->response->html($this->helper->layout->config('config/application', array( + 'mail_transports' => $this->emailClient->getAvailableTransports(), 'languages' => $this->languageModel->getLanguages(), 'timezones' => $this->timezoneModel->getTimezones(), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), @@ -81,6 +82,26 @@ class ConfigController extends BaseController ))); } + /** + * Display the email settings page + * + * @access public + */ + public function email() + { + $values = $this->configModel->getAll(); + + if (empty($values['mail_transport'])) { + $values['mail_transport'] = MAIL_TRANSPORT; + } + + $this->response->html($this->helper->layout->config('config/email', array( + 'values' => $values, + 'mail_transports' => $this->emailClient->getAvailableTransports(), + 'title' => t('Settings').' > '.t('Email settings'), + ))); + } + /** * Display the project settings page * diff --git a/app/Core/Mail/Client.php b/app/Core/Mail/Client.php index 44f4753a..ee3bdead 100644 --- a/app/Core/Mail/Client.php +++ b/app/Core/Mail/Client.php @@ -102,4 +102,16 @@ class Client extends Base return $this; } + + /** + * Return the list of registered transports + * + * @access public + * @return array + */ + public function getAvailableTransports() + { + $availableTransports = $this->transports->keys(); + return array_combine($availableTransports, $availableTransports); + } } diff --git a/app/Helper/MailHelper.php b/app/Helper/MailHelper.php index 12e7f05f..3b1c9e41 100644 --- a/app/Helper/MailHelper.php +++ b/app/Helper/MailHelper.php @@ -62,4 +62,21 @@ class MailHelper extends Base return MAIL_FROM; } + + /** + * Get mail sender address + * + * @access public + * @return string + */ + public function getMailTransport() + { + $transport = $this->configModel->get('mail_transport'); + + if (!empty($transport)) { + return $transport; + } + + return MAIL_TRANSPORT; + } } diff --git a/app/Job/EmailJob.php b/app/Job/EmailJob.php index 9293a1d4..2da3ca2a 100644 --- a/app/Job/EmailJob.php +++ b/app/Job/EmailJob.php @@ -39,11 +39,12 @@ class EmailJob extends BaseJob */ public function execute($email, $name, $subject, $html, $author) { - $this->logger->debug(__METHOD__.' Sending email to '.$email.' via '.MAIL_TRANSPORT); + $transport = $this->helper->mail->getMailTransport(); + $this->logger->debug(__METHOD__.' Sending email to: '.$email.' using transport: '.$transport); $startTime = microtime(true); $this->emailClient - ->getTransport(MAIL_TRANSPORT) + ->getTransport($transport) ->sendEmail($email, $name, $subject, $html, $author) ; diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index 2532c3c9..ce5c808d 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Pregledaj zadatak', 'Remove user' => 'Ukloni korisnika', 'Do you really want to remove this user: "%s"?' => 'Da li zaista želiš da ukloniš korisnika: "%s"?', - 'New user' => 'Novi korisnik', 'All users' => 'Svi korisnici', 'Username' => 'Korisničko ime', 'Password' => 'Šifra', @@ -412,9 +411,7 @@ return array( 'About' => 'O Kanboardu', 'Database driver:' => 'Database driver:', 'Board settings' => 'Postavke table', - 'URL and token' => 'URL i token', 'Webhook settings' => 'Postavke za webhook', - 'URL for task creation:' => 'URL za kreiranje zadataka', 'Reset token' => 'Resetuj token', 'API endpoint:' => 'API endpoint', 'Refresh interval for private board' => 'Interval osvježavanja privatnih ploča', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index 5bfe2def..94c7d690 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Zobrazit úkol', 'Remove user' => 'Odebrat uživatele', 'Do you really want to remove this user: "%s"?' => 'Opravdu chcete odebrat uživatele: "%s"?', - 'New user' => 'Nový uživatel', 'All users' => 'Všichni uživatelé', 'Username' => 'Uživatelské jméno', 'Password' => 'Heslo', @@ -412,9 +411,7 @@ return array( 'About' => 'O projektu', 'Database driver:' => 'Databáze', 'Board settings' => 'Nastavení nástěnky', - 'URL and token' => 'URL a Token', 'Webhook settings' => 'Webhook nastavení', - 'URL for task creation:' => 'URL pro vytvoření úkolu', 'Reset token' => 'Token reset', 'API endpoint:' => 'API endpoint', 'Refresh interval for private board' => 'Interval automatického obnovování pro soukromé nástěnky', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index e519a042..c6984993 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Se denne opgave', 'Remove user' => 'Fjern bruger', 'Do you really want to remove this user: "%s"?' => 'Ønsker du virkelig at fjerne denne bruger: "%s"?', - 'New user' => 'Ny bruger', 'All users' => 'Alle brugere', 'Username' => 'Brugernavn', 'Password' => 'Password', @@ -412,9 +411,7 @@ return array( 'About' => 'Om', 'Database driver:' => 'Database driver:', 'Board settings' => 'Baord indstillinger', - 'URL and token' => 'URL og token', 'Webhook settings' => 'Webhook indstillinger', - 'URL for task creation:' => 'URL for opgave oprettelse:', 'Reset token' => 'Reset endpoint', 'API endpoint:' => 'API endpoint:', 'Refresh interval for private board' => 'Refresh interval for privat board', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index d6bc0b34..d3039865 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Aufgabe ansehen', 'Remove user' => 'Benutzer löschen', 'Do you really want to remove this user: "%s"?' => 'Soll dieser Benutzer wirklich gelöscht werden: "%s"?', - 'New user' => 'Neuer Benutzer', 'All users' => 'Alle Benutzer', 'Username' => 'Benutzername', 'Password' => 'Passwort', @@ -412,9 +411,7 @@ return array( 'About' => 'Über', 'Database driver:' => 'Datenbanktreiber:', 'Board settings' => 'Pinnwandeinstellungen', - 'URL and token' => 'URL und Token', 'Webhook settings' => 'Webhook-Einstellungen', - 'URL for task creation:' => 'URL zur Aufgabenerstellung:', 'Reset token' => 'Token zurücksetzen', 'API endpoint:' => 'API-Endpunkt:', 'Refresh interval for private board' => 'Aktualisierungsintervall für private Pinnwände', @@ -1200,4 +1197,9 @@ return array( 'Enter one task by line.' => 'Geben Sie eine Aufgabe pro Zeile ein.', 'Number of failed login:' => 'Anzahl fehlgeschlagener Anmeldungen:', 'Account locked until:' => 'Konto gesperrt bis:', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 11ece5c6..4fc481f1 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Προβολή της εργασίας', 'Remove user' => 'Αφαίρεση χρήστη', 'Do you really want to remove this user: "%s"?' => 'Θέλετε σίγουρα να αφαιρέσετε αυτό τον χρήστη: « %s » ?', - 'New user' => 'Νέος Χρήστης', 'All users' => 'Όλοι οι χρήστες', 'Username' => 'Όνομα χρήστη', 'Password' => 'Κωδικός', @@ -412,9 +411,7 @@ return array( 'About' => 'About', 'Database driver:' => 'Database driver:', 'Board settings' => 'Board settings', - 'URL and token' => 'URL / token', 'Webhook settings' => 'Webhook settings', - 'URL for task creation:' => 'URL για δημιουργία εργασίας:', 'Reset token' => 'Reset token', 'API endpoint:' => 'URL API:', 'Refresh interval for private board' => 'Ανανέωση interval στο private board', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 243c2063..4da11633 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Ver esta tarea', 'Remove user' => 'Eliminar un usuario', 'Do you really want to remove this user: "%s"?' => '¿De verdad que desea suprimir a este usuario: « %s » ?', - 'New user' => 'Añadir un usuario', 'All users' => 'Todos los usuarios', 'Username' => 'Nombre de usuario', 'Password' => 'Contraseña', @@ -412,9 +411,7 @@ return array( 'About' => 'Acerca de', 'Database driver:' => 'Controlador (Driver) de la base de datos', 'Board settings' => 'Configuraciones del Tablero', - 'URL and token' => 'URL y ficha', 'Webhook settings' => 'Configuraciones del Disparador Web (Webhook)', - 'URL for task creation:' => 'URL para la creación de tareas', 'Reset token' => 'Limpiar ficha', 'API endpoint:' => 'Punto final del API', 'Refresh interval for private board' => 'Intervalo de refresco del tablero privado', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index bd5fa31b..14b50fbd 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Näytä tämä tehtävä', 'Remove user' => 'Poista käyttäjä', 'Do you really want to remove this user: "%s"?' => 'Oletko varma että haluat poistaa käyttäjän "%s"?', - 'New user' => 'Uusi käyttäjä', 'All users' => 'Kaikki käyttäjät', 'Username' => 'Käyttäjänimi', 'Password' => 'Salasana', @@ -412,9 +411,7 @@ return array( 'About' => 'Tietoja', 'Database driver:' => 'Tietokantaohjelmisto:', 'Board settings' => 'Taulun asetukset', - 'URL and token' => 'URL ja token', 'Webhook settings' => 'Webhookin asetukset', - 'URL for task creation:' => 'URL tehtävän luomiseksi:', 'Reset token' => 'Vaihda token', 'API endpoint:' => 'API päätepiste:', 'Refresh interval for private board' => 'Päivitystiheys yksityisille tauluille', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 1771d1e6..3662d9ce 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Voir cette tâche', 'Remove user' => 'Supprimer un utilisateur', 'Do you really want to remove this user: "%s"?' => 'Voulez-vous vraiment supprimer cet utilisateur : « %s » ?', - 'New user' => 'Ajouter un utilisateur', 'All users' => 'Tous les utilisateurs', 'Username' => 'Nom d\'utilisateur', 'Password' => 'Mot de passe', @@ -412,9 +411,7 @@ return array( 'About' => 'À propos', 'Database driver:' => 'Type de base de données :', 'Board settings' => 'Paramètres du tableau', - 'URL and token' => 'URL et jeton de sécurité', 'Webhook settings' => 'Paramètres pour les webhooks', - 'URL for task creation:' => 'URL pour la création de tâche :', 'Reset token' => 'Regénérer le jeton de sécurité', 'API endpoint:' => 'URL de l\'API :', 'Refresh interval for private board' => 'Intervalle pour rafraîchir un tableau privé', @@ -1201,4 +1198,9 @@ return array( 'Enter one task by line.' => 'Entrez une tâche par ligne.', 'Number of failed login:' => 'Nombre de connexion échouées :', 'Account locked until:' => 'Compte bloqué jusqu\'au :', + 'Email settings' => 'Paramètres des emails', + 'Email sender address' => 'Adresse email de l\'expéditeur', + 'Email transport' => 'Transport des emails', + 'Webhook token' => 'Jeton de sécurité des webhooks', + 'Imports' => 'Importations', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index abe7ee94..660a95cd 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Feladat megtekintése', 'Remove user' => 'Felhasználó törlése', 'Do you really want to remove this user: "%s"?' => 'Valóban törölni akarja ezt a felhasználót: "%s"?', - 'New user' => 'Új felhasználó', 'All users' => 'Minden felhasználó', 'Username' => 'Felhasználónév', 'Password' => 'Jelszó', @@ -412,9 +411,7 @@ return array( 'About' => 'Kanboard információ', 'Database driver:' => 'Adatbázis motor:', 'Board settings' => 'Tábla beállítások', - 'URL and token' => 'URL és tokenek', 'Webhook settings' => 'Webhook beállítások', - 'URL for task creation:' => 'Feladat létrehozás URL:', 'Reset token' => 'Token újragenerálása', 'API endpoint:' => 'API végpont:', 'Refresh interval for private board' => 'Privát táblák frissítési intervalluma', @@ -1189,7 +1186,7 @@ return array( 'Not available' => 'Nem áll rendelkezésre', 'Remove plugin' => 'Plugin eltávolítása', 'Do you really want to remove this plugin: "%s"?' => 'Valóban el kívánja távolítani ezt a plugin-t: "%s"?', - //'Uninstall' => '', + // 'Uninstall' => '', 'Listing' => 'Listázás', 'Metadata' => 'Metaadat', 'Manage projects' => 'Projektek kezelése', @@ -1200,4 +1197,9 @@ return array( 'Enter one task by line.' => 'Minden sorban egy feladatot adjon meg.', 'Number of failed login:' => 'A sikertelen bejelentkezések száma:', 'Account locked until:' => 'A számla zárolva a következő időpontig:', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 050a0997..acb05deb 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Lihat tugas ini', 'Remove user' => 'Hapus pengguna', 'Do you really want to remove this user: "%s"?' => 'Anda yakin akan menghapus pengguna ini : « %s » ?', - 'New user' => 'Pengguna baru', 'All users' => 'Semua pengguna', 'Username' => 'Nama pengguna', 'Password' => 'Kata sandi', @@ -412,9 +411,7 @@ return array( 'About' => 'Tentang', 'Database driver:' => 'Driver basis data :', 'Board settings' => 'Pengaturan papan', - 'URL and token' => 'URL dan token', 'Webhook settings' => 'Pengaturan webhook', - 'URL for task creation:' => 'URL untuk pembuatan tugas :', 'Reset token' => 'Mereset token', 'API endpoint:' => 'API endpoint :', 'Refresh interval for private board' => 'Interval pembaruan untuk papan pribadi', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index fa1c6e6f..57dbecc1 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Visualizza questo task', 'Remove user' => 'Cancella un utente', 'Do you really want to remove this user: "%s"?' => 'Veramente vuoi cancellare questo utente: "%s" ?', - 'New user' => 'Aggiungi un utente', 'All users' => 'Tutti gli utenti', 'Username' => 'Nome utente', 'Password' => 'Password', @@ -412,9 +411,7 @@ return array( 'About' => 'Informazioni', 'Database driver:' => 'Driver per Database', 'Board settings' => 'Impostazioni bacheca', - 'URL and token' => 'URL e token', 'Webhook settings' => 'Impostazione Webhook', - 'URL for task creation:' => 'URL per la creazione dei task:', 'Reset token' => 'Rigenera il token', 'API endpoint:' => 'Endpoint dell\'API:', 'Refresh interval for private board' => 'Intervallo di refresh per le bacheche private', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 3c8fa4c1..92be9ca7 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'このタクスを見る', 'Remove user' => 'ユーザの削除', 'Do you really want to remove this user: "%s"?' => 'ユーザ「%s」を本当に削除しますか?', - 'New user' => 'ユーザを追加する', 'All users' => 'すべてのユーザ', 'Username' => 'ユーザ名', 'Password' => 'パスワード', @@ -412,9 +411,7 @@ return array( 'About' => '情報', 'Database driver:' => 'データベースドライバ:', 'Board settings' => '基本設定', - 'URL and token' => 'URL とトークン', 'Webhook settings' => 'Webhook の設定', - 'URL for task creation:' => 'Task 作成の URL:', 'Reset token' => 'トークンのリセット', 'API endpoint:' => 'API エンドポイント:', 'Refresh interval for private board' => '非公開ボードの更新頻度', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index 5c11ff34..e353b6bc 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => '이 할일 보기', 'Remove user' => '사용자 삭제', 'Do you really want to remove this user: "%s"?' => '사용자 "%s"를 정말로 삭제하시겠습니까?', - 'New user' => '사용자를 추가하는 ', 'All users' => '모든 사용자', 'Username' => '사용자 이름', 'Password' => '패스워드', @@ -412,9 +411,7 @@ return array( 'About' => '정보', 'Database driver:' => '데이터베이스 드라이버:', 'Board settings' => '기본 설정', - 'URL and token' => 'URL와 토큰', 'Webhook settings' => 'Webhook의 설정', - 'URL for task creation:' => 'Task작성의 URL:', 'Reset token' => '토큰 리셋', 'API endpoint:' => 'API엔드 포인트:', 'Refresh interval for private board' => '비공개 보드의 갱신 빈도', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index 2322fa03..5cbf425f 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Lihat tugas ini', 'Remove user' => 'Hapus pengguna', 'Do you really want to remove this user: "%s"?' => 'Anda yakin mahu menghapus pengguna ini : « %s » ?', - 'New user' => 'Pengguna baru', 'All users' => 'Semua pengguna', 'Username' => 'Nama pengguna', 'Password' => 'Kata laluan', @@ -412,9 +411,7 @@ return array( 'About' => 'Tentang', 'Database driver:' => 'Driver pengkalan data:', 'Board settings' => 'Pengaturan papan', - 'URL and token' => 'URL dan token', 'Webhook settings' => 'Penetapan webhook', - 'URL for task creation:' => 'URL untuk cipta tugas:', 'Reset token' => 'Menetap semula token', 'API endpoint:' => 'API endpoint :', 'Refresh interval for private board' => 'Interval pembaruan untuk papan pribadi', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 57fd0f70..b82e7359 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Se denne oppgaven', 'Remove user' => 'Fjern bruker', 'Do you really want to remove this user: "%s"?' => 'Vil du fjerne denne brukeren: "%s"?', - 'New user' => 'Ny bruker', 'All users' => 'Alle brukere', 'Username' => 'Brukernavn', 'Password' => 'Passord', @@ -412,9 +411,7 @@ return array( 'About' => 'Om', 'Database driver:' => 'Database driver:', 'Board settings' => 'Innstillinger for prosjektside', - 'URL and token' => 'URL og token', 'Webhook settings' => 'Webhook innstillinger', - 'URL for task creation:' => 'URL for oppgaveopprettelse:', 'Reset token' => 'Resette token', 'API endpoint:' => 'API endpoint:', 'Refresh interval for private board' => 'Oppdateringsintervall for privat hovedside', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 37192081..c7407563 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Deze taak bekijken', 'Remove user' => 'Gebruiker verwijderen', 'Do you really want to remove this user: "%s"?' => 'Weet u zeker dat u deze gebruiker wil verwijderen : « %s » ?', - 'New user' => 'Nieuwe gebruiker', 'All users' => 'Alle gebruikers', 'Username' => 'Gebruikersnaam', 'Password' => 'Wachtwoord', @@ -412,9 +411,7 @@ return array( 'About' => 'Over', 'Database driver:' => 'Database driver :', 'Board settings' => 'Bord instellingen', - 'URL and token' => 'URL en token', 'Webhook settings' => 'Webhook instellingen', - 'URL for task creation:' => 'URL voor aanmaken taken :', 'Reset token' => 'Token resetten', 'API endpoint:' => 'API endpoint :', 'Refresh interval for private board' => 'Verversingsinterval voor private borden', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 00b57db8..7481a2d8 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Zobacz zadanie', 'Remove user' => 'Usuń użytkownika', 'Do you really want to remove this user: "%s"?' => 'Na pewno chcesz usunąć użytkownika: "%s"?', - 'New user' => 'Nowy użytkownik', 'All users' => 'Wszyscy użytkownicy', 'Username' => 'Nazwa użytkownika', 'Password' => 'Hasło', @@ -412,9 +411,7 @@ return array( 'About' => 'Informacje', 'Database driver:' => 'Silnik bazy danych:', 'Board settings' => 'Ustawienia tablicy', - 'URL and token' => 'URL i token', 'Webhook settings' => 'Ustawienia webhook', - 'URL for task creation:' => 'URL do tworzenia zadań', 'Reset token' => 'Resetuj token', 'API endpoint:' => 'Endpoint API', 'Refresh interval for private board' => 'Częstotliwość odświeżania dla tablicy prywatnej', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index ca8a72b4..ae42089c 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Ver esta tarefa', 'Remove user' => 'Remover usuário', 'Do you really want to remove this user: "%s"?' => 'Você realmente deseja remover este usuário: "%s"?', - 'New user' => 'Novo usuário', 'All users' => 'Todos os usuários', 'Username' => 'Nome de usuário', 'Password' => 'Senha', @@ -412,9 +411,7 @@ return array( 'About' => 'Sobre', 'Database driver:' => 'Driver do banco de dados:', 'Board settings' => 'Configurações do board', - 'URL and token' => 'URL e token', 'Webhook settings' => 'Configurações do Webhook', - 'URL for task creation:' => 'URL para a criação da tarefa:', 'Reset token' => 'Resetar token', 'API endpoint:' => 'API endpoint:', 'Refresh interval for private board' => 'Intervalo de atualização para um board privado', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index d21026e5..b4ccadba 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Ver esta tarefa', 'Remove user' => 'Remover utilizador', 'Do you really want to remove this user: "%s"?' => 'Pretende mesmo remover este utilizador: "%s"?', - 'New user' => 'Novo utilizador', 'All users' => 'Todos os utilizadores', 'Username' => 'Nome de utilizador', 'Password' => 'Senha', @@ -412,9 +411,7 @@ return array( 'About' => 'Sobre', 'Database driver:' => 'Driver da base de dados:', 'Board settings' => 'Configurações do Quadro', - 'URL and token' => 'URL e token', 'Webhook settings' => 'Configurações do Webhook', - 'URL for task creation:' => 'URL para a criação da tarefa:', 'Reset token' => 'Redefinir token', 'API endpoint:' => 'API endpoint:', 'Refresh interval for private board' => 'Intervalo de actualização para um quadro privado', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index de744b9f..fff74cff 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Посмотреть задачу', 'Remove user' => 'Удалить пользователя', 'Do you really want to remove this user: "%s"?' => 'Вы точно хотите удалить пользователя: « %s » ?', - 'New user' => 'Новый пользователь', 'All users' => 'Все пользователи', 'Username' => 'Имя пользователя', 'Password' => 'Пароль', @@ -412,9 +411,7 @@ return array( 'About' => 'Информация', 'Database driver:' => 'Драйвер базы данных', 'Board settings' => 'Настройки доски', - 'URL and token' => 'URL и токен', 'Webhook settings' => 'Параметры Webhook', - 'URL for task creation:' => 'URL для создания задачи:', 'Reset token' => 'Перезагрузить токен', 'API endpoint:' => 'API endpoint:', 'Refresh interval for private board' => 'Период обновления для частных досок', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index e6d39880..69119d30 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Pregledaj zadatak', 'Remove user' => 'Ukloni korisnika', 'Do you really want to remove this user: "%s"?' => 'Da li zaista želiš da ukloniš korisnika: "%s"?', - 'New user' => 'novi korisnik', 'All users' => 'Svi korisnici', 'Username' => 'Korisnik', 'Password' => 'Lozinka', @@ -412,9 +411,7 @@ return array( 'About' => 'Informacje', 'Database driver:' => 'Database driver:', 'Board settings' => 'Podešavanje table', - 'URL and token' => 'URL i token', // 'Webhook settings' => '', - 'URL for task creation:' => 'URL za kreiranje zadataka', 'Reset token' => 'Resetuj token', // 'API endpoint:' => '', 'Refresh interval for private board' => 'Interval osvežavanja privatnih tabli', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index c849acc2..40484aae 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Se denna uppgift', 'Remove user' => 'Ta bort användare', 'Do you really want to remove this user: "%s"?' => 'Vill du verkligen ta bort användaren: "%s"?', - 'New user' => 'Ny användare', 'All users' => 'Alla användare', 'Username' => 'Användarnamn', 'Password' => 'Lösenord', @@ -412,9 +411,7 @@ return array( 'About' => 'Om', 'Database driver:' => 'Databasdrivrutin:', 'Board settings' => 'Inställningar för tavla', - 'URL and token' => 'URL och token', 'Webhook settings' => 'Webhook inställningar', - 'URL for task creation:' => 'URL för att skapa uppgift:', 'Reset token' => 'Nollställ token', 'API endpoint:' => 'API ändpunkt:', 'Refresh interval for private board' => 'Uppdateringsintervall för privat tavla', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 33713490..4044db99 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'รายละเอียดงานนี้', 'Remove user' => 'เอาผู้ใช้ออก', 'Do you really want to remove this user: "%s"?' => 'คุณต้องการเอาผู้ใช้ « %s » ออกใช่หรือไม่?', - 'New user' => 'ผู้ใช้ใหม่', 'All users' => 'ผู้ใช้ทั้งหมด', 'Username' => 'ชื่อผู้ใช้', 'Password' => 'รหัสผ่าน', @@ -412,9 +411,7 @@ return array( 'About' => 'เกี่ยวกับ', 'Database driver:' => 'เครื่องมือฐานขข้อมูล', 'Board settings' => 'ตั้งค่าบอร์ด', - // 'URL and token' => '', // 'Webhook settings' => '', - // 'URL for task creation:' => '', // 'Reset token' => '', // 'API endpoint:' => '', 'Refresh interval for private board' => 'ระยะรีเฟรชบอร์ดส่วนตัว', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 919e6513..d95cc71a 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => 'Bu görevi görüntüle', 'Remove user' => 'Kullanıcıyı kaldır', 'Do you really want to remove this user: "%s"?' => 'Bu kullanıcıyı gerçekten silmek istiyor musunuz: "%s"?', - 'New user' => 'Yeni kullanıcı', 'All users' => 'Tüm kullanıcılar', 'Username' => 'Kullanıcı adı', 'Password' => 'Şifre', @@ -412,9 +411,7 @@ return array( 'About' => 'Hakkında', 'Database driver:' => 'Veritabanı sürücüsü:', 'Board settings' => 'Tablo ayarları', - 'URL and token' => 'URL veya Belirteç', 'Webhook settings' => 'Webhook ayarları', - 'URL for task creation:' => 'Görev oluşturma için URL', 'Reset token' => 'Belirteci sıfırla', 'API endpoint:' => 'API bitiş noktası:', 'Refresh interval for private board' => 'Özel tablolar için yenileme sıklığı', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 2a4d1b1b..f5636564 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -35,7 +35,6 @@ return array( 'View this task' => '查看该任务', 'Remove user' => '移除用户', 'Do you really want to remove this user: "%s"?' => '确定要删除用户"%s"吗?', - 'New user' => '新建用户', 'All users' => '所有用户', 'Username' => '用户名', 'Password' => '密码', @@ -412,9 +411,7 @@ return array( 'About' => '关于', 'Database driver:' => '数据库驱动:', 'Board settings' => '看板设置', - 'URL and token' => 'URL和令牌', 'Webhook settings' => 'Webhook 设置', - 'URL for task creation:' => '创建任务的URL:', 'Reset token' => '重置令牌', 'API endpoint:' => 'API 端点:', 'Refresh interval for private board' => '私人看板的刷新时间', @@ -1200,4 +1197,9 @@ return array( // 'Enter one task by line.' => '', // 'Number of failed login:' => '', // 'Account locked until:' => '', + // 'Email settings' => '', + // 'Email sender address' => '', + // 'Email transport' => '', + // 'Webhook token' => '', + // 'Imports' => '', ); diff --git a/app/Template/config/application.php b/app/Template/config/application.php index b66d0633..0f842f6e 100644 --- a/app/Template/config/application.php +++ b/app/Template/config/application.php @@ -9,9 +9,6 @@ form->text('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?>

- form->label(t('Email sender address'), 'mail_sender_address') ?> - form->text('mail_sender_address', $values, $errors, array('placeholder="'.MAIL_FROM.'"')) ?> - form->label(t('Language'), 'application_language') ?> form->select('application_language', $languages, $values, $errors) ?> diff --git a/app/Template/config/email.php b/app/Template/config/email.php new file mode 100644 index 00000000..6ff76eca --- /dev/null +++ b/app/Template/config/email.php @@ -0,0 +1,18 @@ + +
+ form->csrf() ?> + + form->label(t('Email sender address'), 'mail_sender_address') ?> + form->text('mail_sender_address', $values, $errors, array('placeholder="'.MAIL_FROM.'"')) ?> + + form->label(t('Email transport'), 'mail_transport') ?> + form->select('mail_transport', $mail_transports, $values, $errors) ?> + + hook->render('template:config:email', array('values' => $values, 'errors' => $errors)) ?> + +
+ +
+
diff --git a/app/Template/config/sidebar.php b/app/Template/config/sidebar.php index 187ecd93..29caa0ef 100644 --- a/app/Template/config/sidebar.php +++ b/app/Template/config/sidebar.php @@ -7,6 +7,9 @@
  • app->checkMenuSelection('ConfigController', 'application') ?>> url->link(t('Application settings'), 'ConfigController', 'application') ?>
  • +
  • app->checkMenuSelection('ConfigController', 'email') ?>> + url->link(t('Email settings'), 'ConfigController', 'email') ?> +
  • app->checkMenuSelection('ConfigController', 'project') ?>> url->link(t('Project settings'), 'ConfigController', 'project') ?>
  • diff --git a/tests/units/Base.php b/tests/units/Base.php index c7e066d1..f7bee241 100644 --- a/tests/units/Base.php +++ b/tests/units/Base.php @@ -54,7 +54,7 @@ abstract class Base extends PHPUnit_Framework_TestCase $this->container['httpClient'] = $this ->getMockBuilder('\Kanboard\Core\Http\Client') ->setConstructorArgs(array($this->container)) - ->setMethods(array('get', 'getJson', 'postJson', 'postForm')) + ->setMethods(array('get', 'getJson', 'postJson', 'postJsonAsync', 'postForm', 'postFormAsync')) ->getMock(); $this->container['emailClient'] = $this diff --git a/tests/units/Helper/MailHelperTest.php b/tests/units/Helper/MailHelperTest.php index b2d4ba6e..e871a57d 100644 --- a/tests/units/Helper/MailHelperTest.php +++ b/tests/units/Helper/MailHelperTest.php @@ -32,4 +32,15 @@ class MailHelperTest extends Base $this->assertEquals('me@here', $helper->getMailSenderAddress()); } + + public function testGetTransport() + { + $helper = new MailHelper($this->container); + $this->assertEquals(MAIL_TRANSPORT, $helper->getMailTransport()); + + $this->container['configModel']->save(array('mail_transport' => 'smtp')); + $this->container['memoryCache']->flush(); + + $this->assertEquals('smtp', $helper->getMailTransport()); + } } -- cgit v1.2.3