From 67a5dd6a89890f7aa09eb9037a35df0b55b21927 Mon Sep 17 00:00:00 2001 From: Timo Date: Sat, 4 Apr 2020 20:39:17 +0200 Subject: [PATCH] Add option to enable or disable global tags per projects --- app/Controller/ProjectTagController.php | 35 +++++++++++++++++++-- app/Helper/TaskHelper.php | 2 +- app/Locale/bs_BA/translations.php | 3 +- app/Locale/ca_ES/translations.php | 3 +- app/Locale/cs_CZ/translations.php | 3 +- app/Locale/da_DK/translations.php | 3 +- app/Locale/de_DE/translations.php | 3 +- app/Locale/el_GR/translations.php | 3 +- app/Locale/es_ES/translations.php | 3 +- app/Locale/es_VE/translations.php | 3 +- app/Locale/fa_IR/translations.php | 3 +- app/Locale/fi_FI/translations.php | 3 +- app/Locale/fr_FR/translations.php | 3 +- app/Locale/hr_HR/translations.php | 3 +- app/Locale/hu_HU/translations.php | 3 +- app/Locale/id_ID/translations.php | 3 +- app/Locale/it_IT/translations.php | 3 +- app/Locale/ja_JP/translations.php | 3 +- app/Locale/ko_KR/translations.php | 3 +- app/Locale/my_MY/translations.php | 3 +- app/Locale/nb_NO/translations.php | 3 +- app/Locale/nl_NL/translations.php | 3 +- app/Locale/pl_PL/translations.php | 3 +- app/Locale/pt_BR/translations.php | 3 +- app/Locale/pt_PT/translations.php | 3 +- app/Locale/ro_RO/translations.php | 3 +- app/Locale/ru_RU/translations.php | 3 +- app/Locale/sk_SK/translations.php | 3 +- app/Locale/sr_Latn_RS/translations.php | 3 +- app/Locale/sv_SE/translations.php | 3 +- app/Locale/th_TH/translations.php | 3 +- app/Locale/tr_TR/translations.php | 3 +- app/Locale/uk_UA/translations.php | 3 +- app/Locale/vi_VN/translations.php | 3 +- app/Locale/zh_CN/translations.php | 3 +- app/Locale/zh_TW/translations.php | 3 +- app/Model/ProjectModel.php | 16 ++++++++++ app/Model/TagModel.php | 41 +++++++++++++++---------- app/Schema/Mysql.php | 7 ++++- app/Schema/Postgres.php | 7 ++++- app/Schema/Sqlite.php | 7 ++++- app/Template/project_tag/index.php | 30 ++++++++++++++---- 42 files changed, 185 insertions(+), 62 deletions(-) diff --git a/app/Controller/ProjectTagController.php b/app/Controller/ProjectTagController.php index 397ac0aaf..0c30fba1e 100644 --- a/app/Controller/ProjectTagController.php +++ b/app/Controller/ProjectTagController.php @@ -121,7 +121,12 @@ class ProjectTagController extends BaseController $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } - + + /** + * Confirm dialog to make a tag global + * + * @return void + */ public function confirmMakeGlobalTag() { $project = $this->getProject(); @@ -132,7 +137,12 @@ class ProjectTagController extends BaseController 'project' => $project, ))); } - + + /** + * Make a tag global and flash result + * + * @return void + */ public function makeGlobalTag(){ if ($this->userSession->isAdmin()) { $project = $this->getProject(); @@ -147,4 +157,25 @@ class ProjectTagController extends BaseController $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } } + + /** + * Update project tag settings + * + * @return void + */ + public function updateSettings() + { + $project = $this->getProject(); + $values = $this->request->getValues(); + + $values['enable_global_tags'] = array_key_exists('enable_global_tags', $values) ? $values['enable_global_tags'] : 0; + + if ($this->projectModel->changeGlobalTagUsage($project['id'], $values['enable_global_tags'])) { + $this->flash->success(t('Project updated successfully.')); + return $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); + } else { + $this->flash->failure(t('Unable to update this project.')); + } + + } } diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index dcb2c25be..6791c2b5e 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -86,7 +86,7 @@ class TaskHelper extends Base public function renderTagField(array $project, array $tags = array()) { - $options = $this->tagModel->getAssignableList($project['id']); + $options = $this->tagModel->getAssignableList($project['id'], $project['enable_global_tags']); $html = $this->helper->form->label(t('Tags'), 'tags[]'); $html .= ''; diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index fd2e37fba..b33523855 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Ukloni grupu', 'Group removed successfully.' => 'Grupa uspješno uklonjena.', 'Unable to remove this group.' => 'Nemoguće ukloniti grupu.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Prava na projektu', 'Manager' => 'Menadžer', 'Project Manager' => 'Menadžer projekta', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php index 9f1efe002..c59bf1571 100644 --- a/app/Locale/ca_ES/translations.php +++ b/app/Locale/ca_ES/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Elimina el grup', 'Group removed successfully.' => 'Grup eliminat correctament.', 'Unable to remove this group.' => 'No es pot eliminar aquest grup.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permisos de projectes', 'Manager' => 'Gerent', 'Project Manager' => 'Gerent de projectes', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index 9b17d3f4a..8a0f42785 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -838,7 +838,7 @@ return array( // 'Remove group' => '', // 'Group removed successfully.' => '', // 'Unable to remove this group.' => '', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Oprávnění projektu', 'Manager' => 'Správce', 'Project Manager' => 'Správce projektu', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index c635d91b1..08139167f 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Fjerne gruppe', 'Group removed successfully.' => 'Gruppe fjernet.', 'Unable to remove this group.' => 'Kan ikke fjerne gruppe.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Projekt tilladelser', 'Manager' => 'Leder', 'Project Manager' => 'Projektleder', @@ -1416,4 +1416,5 @@ return array( 'Task limit: ' => 'Opgave grænser:', 'Change to global tag' => 'Ændre til globalt mærke', 'Do you really want to make the tag "%s" global?' => 'Skal mærket "%s" gøres globalt?', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 186ad6262..eb54d9b24 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Gruppe löschen', 'Group removed successfully.' => 'Gruppe erfolgreich gelöscht.', 'Unable to remove this group.' => 'Gruppe konnte nicht gelöscht werden.', - 'Group membership(s):' => 'Gruppen-Mitgliedschaft(en):', + // 'Group membership(s):' => '', 'Project Permissions' => 'Projekt Berechtigungen', 'Manager' => 'Manager', 'Project Manager' => 'Projekt Manager', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', 'Change to global tag' => 'Zu globalem Schlagwort machen', 'Do you really want to make the tag "%s" global?' => 'Das Schlagwort "%s" wirklich global machen?', + 'Enable global tags for this project' => 'Globale Schlagworte für dieses Projekt aktivieren', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index e13d40ba6..b3b4c7d4c 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Αφαίρεση ομάδας', 'Group removed successfully.' => 'Η ομάδα αφαιρέθηκε με επιτυχία.', 'Unable to remove this group.' => 'Δεν είναι δυνατή η αφαίρεση της ομάδας.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Επιτρέψεις έργου', 'Manager' => 'Διευθυντής', 'Project Manager' => 'Διευθυντής έργου', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index af2c7e744..f8cf5d1fb 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Eliminar grupo', 'Group removed successfully.' => 'Grupo eliminado correctamente.', 'Unable to remove this group.' => 'No se pudo eliminar este grupo.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permisos del proyecto', 'Manager' => 'Gerente', 'Project Manager' => 'Gerente de proyecto', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/es_VE/translations.php b/app/Locale/es_VE/translations.php index 324a67ede..66b346b1a 100644 --- a/app/Locale/es_VE/translations.php +++ b/app/Locale/es_VE/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Eliminar grupo', 'Group removed successfully.' => 'Grupo eliminado correctamente.', 'Unable to remove this group.' => 'No se pudo eliminar este grupo.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permisos del proyecto', 'Manager' => 'Gerente', 'Project Manager' => 'Gerente de proyecto', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/fa_IR/translations.php b/app/Locale/fa_IR/translations.php index 48b826451..df66c2e9e 100644 --- a/app/Locale/fa_IR/translations.php +++ b/app/Locale/fa_IR/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'حذف گروه', 'Group removed successfully.' => 'گروه با موفقیت حذف شد.', 'Unable to remove this group.' => 'حذف این گروه امکان پذیر نیست.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'مجوز های پروژه', 'Manager' => 'مدیر', 'Project Manager' => 'مدیر پروژه', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 14a7e831c..52a264935 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -838,7 +838,7 @@ return array( // 'Remove group' => '', // 'Group removed successfully.' => '', // 'Unable to remove this group.' => '', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', // 'Project Permissions' => '', // 'Manager' => '', // 'Project Manager' => '', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 8c4ce671a..f9e0b8254 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Supprimer le groupe', 'Group removed successfully.' => 'Groupe supprimé avec succès.', 'Unable to remove this group.' => 'Impossible de supprimer ce groupe.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permissions du projet', 'Manager' => 'Gestionnaire', 'Project Manager' => 'Chef de projet', @@ -1416,4 +1416,5 @@ return array( 'Task limit: ' => 'Limite de tâche : ', 'Change to global tag' => 'Changer le libellé à global', 'Do you really want to make the tag "%s" global?' => 'Voulez-vous vraiment rendre le libellé « %s » global ?', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php index ddfab6c08..da99a9ef5 100644 --- a/app/Locale/hr_HR/translations.php +++ b/app/Locale/hr_HR/translations.php @@ -838,7 +838,7 @@ return array( // 'Remove group' => '', // 'Group removed successfully.' => '', // 'Unable to remove this group.' => '', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', // 'Project Permissions' => '', // 'Manager' => '', // 'Project Manager' => '', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index d90e631df..d213d61f1 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Csoport eltávolítása', 'Group removed successfully.' => 'A csoport sikeresen eltávolítva.', 'Unable to remove this group.' => 'Nem lehet eltávolítani a csoportot.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Projektjogosultságok', 'Manager' => 'Vezető', 'Project Manager' => 'Projektvezető', @@ -1416,4 +1416,5 @@ return array( 'Task limit: ' => 'Feladatkorlát: ', 'Change to global tag' => 'Megváltoztatás globális címkére', 'Do you really want to make the tag "%s" global?' => 'Valóban globálissá szeretné tenni a(z) „%s” címkét?', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index c3cbb3659..813078a73 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Hapus grup', 'Group removed successfully.' => 'Grup berhasil dihapus', 'Unable to remove this group.' => 'Tidak dapat menghapus grup ini', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Izin Proyek', 'Manager' => 'Manajer', 'Project Manager' => 'Manajer Proyek', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 54bd13ae0..fbe1c4ea7 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Rimuovi gruppo', 'Group removed successfully.' => 'Gruppo rimosso con successo.', 'Unable to remove this group.' => 'Impossibile rimuovere questo gruppo.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permessi del progetto', 'Manager' => 'Manager', 'Project Manager' => 'Manager del progetto', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 6fd9d4bf8..0d268c9c6 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'グループを削除', 'Group removed successfully.' => 'グループは正常に削除されました', 'Unable to remove this group.' => 'このグループを削除できません', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'プロジェクトの権限', 'Manager' => '組織の管理者', 'Project Manager' => 'プロジェクト管理者', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index 32aabcd03..ffde01fb0 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => '그룹 삭제', 'Group removed successfully.' => '그룹이 성공적으로 삭제되었습니다', 'Unable to remove this group.' => '그룹 삭제 비활성화', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => '프로젝트 권한', 'Manager' => '매니저', 'Project Manager' => '프로젝트 매니저', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index b33848610..0d229b634 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -838,7 +838,7 @@ return array( // 'Remove group' => '', // 'Group removed successfully.' => '', // 'Unable to remove this group.' => '', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', // 'Project Permissions' => '', // 'Manager' => '', // 'Project Manager' => '', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index cab0465f3..9f47d5bec 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Fjern gruppe', 'Group removed successfully.' => 'Gruppen er fjernet', 'Unable to remove this group.' => 'Kunne ikke fjerne gruppen', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Prosjektrettigheter', 'Manager' => 'Leder', 'Project Manager' => 'Prosjektleder', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 6d560fde2..5f348a3a1 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -838,7 +838,7 @@ return array( // 'Remove group' => '', // 'Group removed successfully.' => '', // 'Unable to remove this group.' => '', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', // 'Project Permissions' => '', // 'Manager' => '', // 'Project Manager' => '', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index ed2896db5..bdb97cf6c 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Usuń grupę', 'Group removed successfully.' => 'Grupa została usunięta.', 'Unable to remove this group.' => 'Nie można usunąć grupy.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Prawa dostępowe projektu', 'Manager' => 'Menedżer', 'Project Manager' => 'Menedżer projektu', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index bca6573a9..ccce8fcf1 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Remover o grupo', 'Group removed successfully.' => 'Grupo removido com sucesso.', 'Unable to remove this group.' => 'Não foi possível remover este grupo.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permissões do projeto', 'Manager' => 'Gerente', 'Project Manager' => 'Gerente de projeto', @@ -1416,4 +1416,5 @@ return array( 'Task limit: ' => 'Limite de tarefas:', 'Change to global tag' => 'Transformar em etiqueta global', 'Do you really want to make the tag "%s" global?' => 'Você realmente deseja transformar a etiqueta "%s" em etiqueta global?', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index 08c4f943e..af3c39199 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Remover grupo.', 'Group removed successfully.' => 'Grupo removido com sucesso.', 'Unable to remove this group.' => 'Não foi possivel remover este grupo.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permissões de Projeto', 'Manager' => 'Gestor', 'Project Manager' => 'Gestor de Projeto', @@ -1416,4 +1416,5 @@ return array( 'Task limit: ' => 'Limite da tarefa: ', 'Change to global tag' => 'Alterar para etiqueta global', 'Do you really want to make the tag "%s" global?' => 'Tem a certeza que pretende por a etiqueta "%s" como global?', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/ro_RO/translations.php b/app/Locale/ro_RO/translations.php index 4730fea5f..ea53fea40 100644 --- a/app/Locale/ro_RO/translations.php +++ b/app/Locale/ro_RO/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Șterge grupul', 'Group removed successfully.' => 'Grupul a fost șters.', 'Unable to remove this group.' => 'Nu am putut șterge grupul.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Permisiunile proiectului', 'Manager' => 'Gestionar', 'Project Manager' => 'Șef de proiect', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 57bdeb1de..e09fc4967 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Удалить группу', 'Group removed successfully.' => 'Группа успешно удалена.', 'Unable to remove this group.' => 'Невозможно удалить группу.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Разрешения проекта', 'Manager' => 'Менеджер', 'Project Manager' => 'Менеджер проекта', @@ -1416,4 +1416,5 @@ return array( 'Task limit: ' => 'Лимит задач:', 'Change to global tag' => 'Сменить на глобальную метку', 'Do you really want to make the tag "%s" global?' => 'Вы действительно хотите сделать метку "%s" глобальной?', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/sk_SK/translations.php b/app/Locale/sk_SK/translations.php index 55c091d5c..82a19efb7 100644 --- a/app/Locale/sk_SK/translations.php +++ b/app/Locale/sk_SK/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Odstrániť skupinu', 'Group removed successfully.' => 'Skupina úspešne odstránená.', 'Unable to remove this group.' => 'Nemožno odstrániť skupinu.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Povolenia projektu', 'Manager' => 'Správca', 'Project Manager' => 'Správca projektu', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 5a11c13b8..c77c31424 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -838,7 +838,7 @@ return array( // 'Remove group' => '', // 'Group removed successfully.' => '', // 'Unable to remove this group.' => '', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', // 'Project Permissions' => '', // 'Manager' => '', // 'Project Manager' => '', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 4adb994b0..fba642b5c 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Ta bort grupp', // 'Group removed successfully.' => '', // 'Unable to remove this group.' => '', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', // 'Project Permissions' => '', // 'Manager' => '', 'Project Manager' => 'Projektägare', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 827979711..bf0705717 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'ลบกลุ่ม', 'Group removed successfully.' => 'ลบกลุ่มเรียบร้อย', 'Unable to remove this group.' => 'ไม่สามารถลบกลุ่มนี้', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'การอนุญาตใช้งานโปรเจค', 'Manager' => 'ผู้จัดการ', 'Project Manager' => 'ผู้จัดการโปรเจค', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 945266408..45a943a15 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Grubu sil', 'Group removed successfully.' => 'Grup başarıyla silindi.', 'Unable to remove this group.' => 'Grup silinemedi.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Proje izimleri', 'Manager' => 'Müdür', 'Project Manager' => 'Proje müdürü', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/uk_UA/translations.php b/app/Locale/uk_UA/translations.php index a5f1507b6..d8c275a87 100644 --- a/app/Locale/uk_UA/translations.php +++ b/app/Locale/uk_UA/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Видалити групу', 'Group removed successfully.' => 'Групу успішно видалено.', 'Unable to remove this group.' => 'Не вдалося видалити групу.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Дозволи проєкту', 'Manager' => 'Керівник', 'Project Manager' => 'Керівник проєкту', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php index 379781c65..c8877215f 100644 --- a/app/Locale/vi_VN/translations.php +++ b/app/Locale/vi_VN/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => 'Loại bỏ nhóm', 'Group removed successfully.' => 'Nhóm đã xoá thành công.', 'Unable to remove this group.' => 'Không thể xóa nhóm này.', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => 'Quyền dự án', 'Manager' => 'Giám đốc', 'Project Manager' => 'Quản lý dự án', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 6301c53f7..9d89f7d23 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => '删除用户组', 'Group removed successfully.' => '用户组已删除', 'Unable to remove this group.' => '无法删除该用户组', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => '项目权限', 'Manager' => '管理员', 'Project Manager' => '项目管理员', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Locale/zh_TW/translations.php b/app/Locale/zh_TW/translations.php index 80dbd3a96..30fd1ea41 100644 --- a/app/Locale/zh_TW/translations.php +++ b/app/Locale/zh_TW/translations.php @@ -838,7 +838,7 @@ return array( 'Remove group' => '删除群組', 'Group removed successfully.' => '群組已删除', 'Unable to remove this group.' => '無法删除群組', - // 'Group membership(s):' => ':', + // 'Group membership(s):' => '', 'Project Permissions' => '專案全線', 'Manager' => '管理員', 'Project Manager' => '專案管理員', @@ -1416,4 +1416,5 @@ return array( // 'Task limit: ' => '', // 'Change to global tag' => '', // 'Do you really want to make the tag "%s" global?' => '', + // 'Enable global tags for this project' => '', ); diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php index 683d20ff6..3cff12180 100644 --- a/app/Model/ProjectModel.php +++ b/app/Model/ProjectModel.php @@ -605,4 +605,20 @@ class ProjectModel extends Base ->join(ColumnModel::TABLE, 'id', 'project_id') ->count(); } + + /** + * Change usage of global tags + * + * @param integer $project_id Project id + * @param bool $global_tags New global tag value + * @return bool + */ + public function changeGlobalTagUsage($project_id, $global_tags) + { + return $this->exists($project_id) && + $this->db + ->table(self::TABLE) + ->eq('id', $project_id) + ->save(array('enable_global_tags' => $global_tags)); + } } diff --git a/app/Model/TagModel.php b/app/Model/TagModel.php index c2abd2c13..dc258c41e 100644 --- a/app/Model/TagModel.php +++ b/app/Model/TagModel.php @@ -45,19 +45,28 @@ class TagModel extends Base /** * Get assignable tags for a project * - * @access public - * @param integer $project_id + * @param integer $project_id Project Id + * @param bool $include_global_tags Flag to include global tags * @return array */ - public function getAssignableList($project_id) + public function getAssignableList($project_id, $include_global_tags = true) { - return $this->db->hashtable(self::TABLE) - ->beginOr() - ->eq('project_id', $project_id) - ->eq('project_id', 0) - ->closeOr() - ->asc('name') - ->getAll('id', 'name'); + if ($include_global_tags) { + return $this->db->hashtable(self::TABLE) + ->beginOr() + ->eq('project_id', $project_id) + ->eq('project_id', 0) + ->closeOr() + ->asc('name') + ->getAll('id', 'name'); + } else { + return $this->db->hashtable(self::TABLE) + ->beginOr() + ->eq('project_id', $project_id) + ->closeOr() + ->asc('name') + ->getAll('id', 'name'); + } } /** @@ -85,8 +94,8 @@ class TagModel extends Base return $this->db ->table(self::TABLE) ->beginOr() - ->eq('project_id', 0) - ->eq('project_id', $project_id) + ->eq('project_id', 0) + ->eq('project_id', $project_id) ->closeOr() ->ilike('name', $tag) ->asc('project_id') @@ -162,18 +171,18 @@ class TagModel extends Base */ public function update($tag_id, $tag, $color_id = null, $project_id = null) { - if($project_id !== null){ + if ($project_id !== null) { return $this->db->table(self::TABLE)->eq('id', $tag_id)->update(array( 'name' => $tag, 'color_id' => $color_id, - 'project_id' => $project_id + 'project_id' => $project_id, )); } else { return $this->db->table(self::TABLE)->eq('id', $tag_id)->update(array( 'name' => $tag, - 'color_id' => $color_id + 'color_id' => $color_id, )); - } + } } /** diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 62a28d34d..ca1d1a8e3 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -8,7 +8,12 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 136; +const VERSION = 137; + +function version_137(PDO $pdo) +{ + $pdo->exec('ALTER TABLE `projects` ADD COLUMN `enable_global_tags` TINYINT(1) DEFAULT 1 NOT NULL'); +} function version_136(PDO $pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index cbb885067..de5282ee4 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -8,7 +8,12 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 114; +const VERSION = 115; + +function version_115(PDO $pdo) +{ + $pdo->exec('ALTER TABLE "projects" ADD COLUMN enable_global_tags BOOLEAN DEFAULT TRUE'); +} function version_114(PDO $pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 964d3032b..ea6dd88c0 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -8,7 +8,12 @@ use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; use PDO; -const VERSION = 123; +const VERSION = 124; + +function version_124(PDO $pdo) +{ + $pdo->exec('ALTER TABLE projects ADD COLUMN enable_global_tags INTEGER DEFAULT 1 NOT NULL'); +} function version_123(PDO $pdo) { diff --git a/app/Template/project_tag/index.php b/app/Template/project_tag/index.php index b1825b74d..8bad93045 100644 --- a/app/Template/project_tag/index.php +++ b/app/Template/project_tag/index.php @@ -1,12 +1,14 @@ +

+ +

@@ -41,3 +43,19 @@ + +

+ + \ No newline at end of file