From 48b40ec7bff777ca9c4c7ec2f91c8e803baab57b Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 30 Oct 2017 16:46:39 -0700 Subject: [PATCH] Add section for predefined contents --- .../ProjectPredefinedContentController.php | 61 +++++++++++++++++++ app/Locale/bs_BA/translations.php | 2 + app/Locale/ca_ES/translations.php | 2 + app/Locale/cs_CZ/translations.php | 2 + app/Locale/da_DK/translations.php | 2 + app/Locale/de_DE/translations.php | 2 + app/Locale/el_GR/translations.php | 2 + app/Locale/es_ES/translations.php | 2 + app/Locale/fi_FI/translations.php | 2 + app/Locale/fr_FR/translations.php | 2 + app/Locale/hr_HR/translations.php | 2 + app/Locale/hu_HU/translations.php | 2 + app/Locale/id_ID/translations.php | 2 + app/Locale/it_IT/translations.php | 2 + app/Locale/ja_JP/translations.php | 2 + app/Locale/ko_KR/translations.php | 2 + app/Locale/my_MY/translations.php | 2 + app/Locale/nb_NO/translations.php | 2 + app/Locale/nl_NL/translations.php | 2 + app/Locale/pl_PL/translations.php | 2 + app/Locale/pt_BR/translations.php | 2 + app/Locale/pt_PT/translations.php | 2 + app/Locale/ru_RU/translations.php | 2 + app/Locale/sr_Latn_RS/translations.php | 2 + app/Locale/sv_SE/translations.php | 2 + app/Locale/th_TH/translations.php | 2 + app/Locale/tr_TR/translations.php | 2 + app/Locale/vi_VN/translations.php | 2 + app/Locale/zh_CN/translations.php | 2 + .../AuthenticationProvider.php | 1 + app/Template/project/sidebar.php | 3 + app/Template/project_edit/show.php | 6 -- .../project_predefined_content/show.php | 14 +++++ vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_static.php | 1 + 35 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 app/Controller/ProjectPredefinedContentController.php create mode 100644 app/Template/project_predefined_content/show.php diff --git a/app/Controller/ProjectPredefinedContentController.php b/app/Controller/ProjectPredefinedContentController.php new file mode 100644 index 000000000..1195dfa3b --- /dev/null +++ b/app/Controller/ProjectPredefinedContentController.php @@ -0,0 +1,61 @@ +getProject(); + + $this->response->html($this->helper->layout->project('project_predefined_content/show', array( + 'values' => empty($values) ? $project : $values, + 'errors' => $errors, + 'project' => $project, + 'title' => t('Predefined Contents') + ))); + } + + /** + * Validate and update a project + * + * @access public + */ + public function update() + { + $project = $this->getProject(); + $values = $this->request->getValues(); + + $values = array( + 'id' => $project['id'], + 'name' => $project['name'], + 'predefined_email_subjects' => isset($values['predefined_email_subjects']) ? $values['predefined_email_subjects'] : '', + ); + + list($valid, $errors) = $this->projectValidator->validateModification($values); + + if ($valid) { + if ($this->projectModel->update($values)) { + $this->flash->success(t('Project updated successfully.')); + return $this->response->redirect($this->helper->url->to('ProjectPredefinedContentController', 'show', array('project_id' => $project['id'])), true); + } else { + $this->flash->failure(t('Unable to update this project.')); + } + } + + return $this->show($values, $errors); + } +} diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index b576af096..ce0374f2d 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php index bb8dc50b1..8e14e2fb0 100644 --- a/app/Locale/ca_ES/translations.php +++ b/app/Locale/ca_ES/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index 2e7291756..92645582c 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 112be1728..cfd27c2c8 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index b06b37213..811393778 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 9fb2a41e2..9bd08132e 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 0490e4661..d0777c00a 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 27ff0eedf..ad2fa6b10 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 830cb5c3a..243673899 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1343,4 +1343,6 @@ return array( 'Subtask added successfully.' => 'Sous-tâche ajoutée avec succès.', '%d subtasks added successfully.' => '%d sous-tâches ajoutées avec succès.', 'Enter one subtask by line.' => 'Entrez une sous-tâche par ligne.', + 'Predefined Contents' => 'Contenus prédéfini', + 'Predefined contents' => 'Contenus prédéfini', ); diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php index 2eeb5bb09..fa4c87d77 100644 --- a/app/Locale/hr_HR/translations.php +++ b/app/Locale/hr_HR/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index c19a9b5a6..c8f9d8ea1 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 4f9227520..aad497ade 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 1c2b7144c..986475746 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 5eac59867..86c4800bc 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1343,4 +1343,6 @@ return array( 'Subtask added successfully.' => 'サブタスクを追加しました', '%d subtasks added successfully.' => '%d 件のサブタスクを追加しました', 'Enter one subtask by line.' => '1行に1件のサブタスクを入力', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index fa75667e7..083ddc675 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index 62aeecadf..50544f2e0 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 3445cb5fd..3fe604245 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 0a3706c89..169654c42 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 58bcbb469..d0858db90 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 20a2f983f..079271d1a 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index 9d5d5efed..6fddbfb2b 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 3e7d8a023..6223f94c3 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1343,4 +1343,6 @@ return array( 'Subtask added successfully.' => 'Подзадача успешно добавлена.', '%d subtasks added successfully.' => '%d подзадач(а) успешно добавлено.', 'Enter one subtask by line.' => 'Записывайте по одной подзадаче на строку.', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 0173b8fdf..7d88e0af3 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 8522072f1..427f00a15 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 1cf743520..ba4a587e6 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index e049d2867..e420eff47 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php index 35984b9b3..dde397bb6 100644 --- a/app/Locale/vi_VN/translations.php +++ b/app/Locale/vi_VN/translations.php @@ -1349,4 +1349,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 8d51fa9fe..9094a7b49 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1343,4 +1343,6 @@ return array( // 'Subtask added successfully.' => '', // '%d subtasks added successfully.' => '', // 'Enter one subtask by line.' => '', + // 'Predefined Contents' => '', + // 'Predefined contents' => '', ); diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php index fe07fc0c0..98212d45a 100644 --- a/app/ServiceProvider/AuthenticationProvider.php +++ b/app/ServiceProvider/AuthenticationProvider.php @@ -92,6 +92,7 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('ProjectViewController', array('share', 'updateSharing', 'integrations', 'updateIntegrations', 'notifications', 'updateNotifications', 'duplicate', 'doDuplication'), Role::PROJECT_MANAGER); $acl->add('ProjectPermissionController', '*', Role::PROJECT_MANAGER); $acl->add('ProjectEditController', '*', Role::PROJECT_MANAGER); + $acl->add('ProjectPredefinedContentController', '*', Role::PROJECT_MANAGER); $acl->add('ProjectFileController', '*', Role::PROJECT_MEMBER); $acl->add('ProjectUserOverviewController', '*', Role::PROJECT_MANAGER); $acl->add('ProjectStatusController', '*', Role::PROJECT_MANAGER); diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php index 9775c7a1d..4b39172cd 100644 --- a/app/Template/project/sidebar.php +++ b/app/Template/project/sidebar.php @@ -13,6 +13,9 @@
  • app->checkMenuSelection('ProjectEditController') ?>> url->link(t('Edit project'), 'ProjectEditController', 'show', array('project_id' => $project['id'])) ?>
  • +
  • app->checkMenuSelection('ProjectPredefinedContentController') ?>> + url->link(t('Predefined contents'), 'ProjectPredefinedContentController', 'show', array('project_id' => $project['id'])) ?> +
  • app->checkMenuSelection('ProjectViewController', 'share') ?>> url->link(t('Public access'), 'ProjectViewController', 'share', array('project_id' => $project['id'])) ?>
  • diff --git a/app/Template/project_edit/show.php b/app/Template/project_edit/show.php index 8b85f0105..965310079 100644 --- a/app/Template/project_edit/show.php +++ b/app/Template/project_edit/show.php @@ -62,11 +62,5 @@ form->number('priority_end', $values, $errors, array('tabindex="10"')) ?> -
    - - form->textarea('predefined_email_subjects', $values, $errors, array('tabindex="11"')) ?> -

    -
    - modal->submitButtons(array('tabindex' => 11)) ?> diff --git a/app/Template/project_predefined_content/show.php b/app/Template/project_predefined_content/show.php new file mode 100644 index 000000000..8e5ca3dcb --- /dev/null +++ b/app/Template/project_predefined_content/show.php @@ -0,0 +1,14 @@ + +
    + form->csrf() ?> + +
    + + form->textarea('predefined_email_subjects', $values, $errors, array('tabindex="1"')) ?> +

    +
    + + modal->submitButtons(array('tabindex' => 2)) ?> +
    diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 75207dbe5..38fda2577 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -210,6 +210,7 @@ return array( 'Kanboard\\Controller\\ProjectListController' => $baseDir . '/app/Controller/ProjectListController.php', 'Kanboard\\Controller\\ProjectOverviewController' => $baseDir . '/app/Controller/ProjectOverviewController.php', 'Kanboard\\Controller\\ProjectPermissionController' => $baseDir . '/app/Controller/ProjectPermissionController.php', + 'Kanboard\\Controller\\ProjectPredefinedContentController' => $baseDir . '/app/Controller/ProjectPredefinedContentController.php', 'Kanboard\\Controller\\ProjectRoleController' => $baseDir . '/app/Controller/ProjectRoleController.php', 'Kanboard\\Controller\\ProjectRoleRestrictionController' => $baseDir . '/app/Controller/ProjectRoleRestrictionController.php', 'Kanboard\\Controller\\ProjectStatusController' => $baseDir . '/app/Controller/ProjectStatusController.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 626fed60d..6bf637e71 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -346,6 +346,7 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b 'Kanboard\\Controller\\ProjectListController' => __DIR__ . '/../..' . '/app/Controller/ProjectListController.php', 'Kanboard\\Controller\\ProjectOverviewController' => __DIR__ . '/../..' . '/app/Controller/ProjectOverviewController.php', 'Kanboard\\Controller\\ProjectPermissionController' => __DIR__ . '/../..' . '/app/Controller/ProjectPermissionController.php', + 'Kanboard\\Controller\\ProjectPredefinedContentController' => __DIR__ . '/../..' . '/app/Controller/ProjectPredefinedContentController.php', 'Kanboard\\Controller\\ProjectRoleController' => __DIR__ . '/../..' . '/app/Controller/ProjectRoleController.php', 'Kanboard\\Controller\\ProjectRoleRestrictionController' => __DIR__ . '/../..' . '/app/Controller/ProjectRoleRestrictionController.php', 'Kanboard\\Controller\\ProjectStatusController' => __DIR__ . '/../..' . '/app/Controller/ProjectStatusController.php',