Add option to enable or disable global tags per projects

This commit is contained in:
Timo 2020-04-04 20:39:17 +02:00 committed by GitHub
parent 1cc0ac0713
commit 67a5dd6a89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 185 additions and 62 deletions

View File

@ -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.'));
}
}
}

View File

@ -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 .= '<input type="hidden" name="tags[]" value="">';

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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' => '',
);

View File

@ -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));
}
}

View File

@ -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,
));
}
}
}
/**

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -1,12 +1,14 @@
<div class="page-header">
<h2><?= t('Project tags') ?></h2>
<ul>
<li>
<?= $this->modal->medium('plus', t('Add new tag'), 'ProjectTagController', 'create', array('project_id' => $project['id'])) ?>
</li>
</ul>
<h2><?= t('Tags') ?></h2>
</div>
<h3><?= t('Project tags') ?></h3>
<ul class="no-bullet">
<li>
<?= $this->modal->medium('plus', t('Add new tag'), 'ProjectTagController', 'create', array('project_id' => $project['id'])) ?>
</li>
</ul>
<?php if (empty($tags)): ?>
<p class="alert"><?= t('There is no specific tag for this project at the moment.') ?></p>
<?php else: ?>
@ -41,3 +43,19 @@
<?php endforeach ?>
</table>
<?php endif ?>
<h3><?= t('Global tags') ?></h3>
<ul class="panel no-bullet">
<li>
<form method="post" action="<?= $this->url->href('ProjectTagController', 'updateSettings', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->checkbox('enable_global_tags', t('Enable global tags for this project'), 1, $project['enable_global_tags'] == 1) ?>
<?= $this->modal->submitButtons() ?>
</form>
</li>
</ul>