diff options
Diffstat (limited to 'app')
38 files changed, 1025 insertions, 723 deletions
diff --git a/app/Controller/Action.php b/app/Controller/Action.php index 797bbfa2..b2f80009 100644 --- a/app/Controller/Action.php +++ b/app/Controller/Action.php @@ -17,15 +17,9 @@ class Action extends Base */ public function index() { - $project_id = $this->request->getIntegerParam('project_id'); - $project = $this->project->getById($project_id); + $project = $this->getProject(); - if (! $project) { - $this->session->flashError(t('Project not found.')); - $this->response->redirect('?controller=project'); - } - - $this->response->html($this->template->layout('action_index', array( + $this->response->html($this->projectLayout('action_index', array( 'values' => array('project_id' => $project['id']), 'project' => $project, 'actions' => $this->action->getAllByProject($project['id']), @@ -49,18 +43,11 @@ class Action extends Base */ public function params() { - $project_id = $this->request->getIntegerParam('project_id'); - $project = $this->project->getById($project_id); - - if (! $project) { - $this->session->flashError(t('Project not found.')); - $this->response->redirect('?controller=project'); - } - + $project = $this->getProject(); $values = $this->request->getValues(); $action = $this->action->load($values['action_name'], $values['project_id']); - $this->response->html($this->template->layout('action_params', array( + $this->response->html($this->projectLayout('action_params', array( 'values' => $values, 'action_params' => $action->getActionRequiredParameters(), 'columns_list' => $this->board->getColumnsList($project['id']), @@ -81,14 +68,7 @@ class Action extends Base */ public function create() { - $project_id = $this->request->getIntegerParam('project_id'); - $project = $this->project->getById($project_id); - - if (! $project) { - $this->session->flashError(t('Project not found.')); - $this->response->redirect('?controller=project'); - } - + $project = $this->getProject(); $values = $this->request->getValues(); list($valid,) = $this->action->validateCreation($values); @@ -113,10 +93,13 @@ class Action extends Base */ public function confirm() { - $this->response->html($this->template->layout('action_remove', array( + $project = $this->getProject(); + + $this->response->html($this->projectLayout('action_remove', array( 'action' => $this->action->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->action->getAvailableEvents(), 'available_actions' => $this->action->getAvailableActions(), + 'project' => $project, 'menu' => 'projects', 'title' => t('Remove an action') ))); diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 41585965..f9059d1e 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -212,6 +212,22 @@ abstract class Base } /** + * Common layout for project views + * + * @access protected + * @param string $template Template name + * @param array $params Template parameters + * @return string + */ + protected function projectLayout($template, array $params) + { + $content = $this->template->load($template, $params); + $params['project_content_for_layout'] = $content; + + return $this->template->layout('project_layout', $params); + } + + /** * Common method to get a task for task views * * @access protected diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 7fe9c4ae..f43527ea 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -212,12 +212,8 @@ class Board extends Base */ public function edit() { - $project_id = $this->request->getIntegerParam('project_id'); - $project = $this->project->getById($project_id); - - if (! $project) $this->notfound(); - - $columns = $this->board->getColumns($project_id); + $project = $this->getProject(); + $columns = $this->board->getColumns($project['id']); $values = array(); foreach ($columns as $column) { @@ -225,9 +221,9 @@ class Board extends Base $values['task_limit['.$column['id'].']'] = $column['task_limit'] ?: null; } - $this->response->html($this->template->layout('board_edit', array( + $this->response->html($this->projectLayout('board_edit', array( 'errors' => array(), - 'values' => $values + array('project_id' => $project_id), + 'values' => $values + array('project_id' => $project['id']), 'columns' => $columns, 'project' => $project, 'menu' => 'projects', @@ -242,12 +238,8 @@ class Board extends Base */ public function update() { - $project_id = $this->request->getIntegerParam('project_id'); - $project = $this->project->getById($project_id); - - if (! $project) $this->notfound(); - - $columns = $this->board->getColumns($project_id); + $project = $this->getProject(); + $columns = $this->board->getColumns($project['id']); $data = $this->request->getValues(); $values = $columns_list = array(); @@ -270,9 +262,9 @@ class Board extends Base } } - $this->response->html($this->template->layout('board_edit', array( + $this->response->html($this->projectLayout('board_edit', array( 'errors' => $errors, - 'values' => $values + array('project_id' => $project_id), + 'values' => $values + array('project_id' => $project['id']), 'columns' => $columns, 'project' => $project, 'menu' => 'projects', @@ -287,11 +279,7 @@ class Board extends Base */ public function add() { - $project_id = $this->request->getIntegerParam('project_id'); - $project = $this->project->getById($project_id); - - if (! $project) $this->notfound(); - + $project = $this->getProject(); $columns = $this->board->getColumnsList($project_id); $data = $this->request->getValues(); $values = array(); @@ -313,7 +301,7 @@ class Board extends Base } } - $this->response->html($this->template->layout('board_edit', array( + $this->response->html($this->projectLayout('board_edit', array( 'errors' => $errors, 'values' => $values + $data, 'columns' => $columns, @@ -330,8 +318,11 @@ class Board extends Base */ public function confirm() { - $this->response->html($this->template->layout('board_remove', array( + $project = $this->getProject(); + + $this->response->html($this->projectLayout('board_remove', array( 'column' => $this->board->getColumn($this->request->getIntegerParam('column_id')), + 'project' => $project, 'menu' => 'projects', 'title' => t('Remove a column from a board') ))); diff --git a/app/Controller/Category.php b/app/Controller/Category.php index 5fd59c0a..3c9d0523 100644 --- a/app/Controller/Category.php +++ b/app/Controller/Category.php @@ -38,7 +38,7 @@ class Category extends Base { $project = $this->getProject(); - $this->response->html($this->template->layout('category_index', array( + $this->response->html($this->projectLayout('category_index', array( 'categories' => $this->category->getList($project['id'], false), 'values' => array('project_id' => $project['id']), 'errors' => array(), @@ -71,7 +71,7 @@ class Category extends Base } } - $this->response->html($this->template->layout('category_index', array( + $this->response->html($this->projectLayout('category_index', array( 'categories' => $this->category->getList($project['id'], false), 'values' => $values, 'errors' => $errors, @@ -91,7 +91,7 @@ class Category extends Base $project = $this->getProject(); $category = $this->getCategory($project['id']); - $this->response->html($this->template->layout('category_edit', array( + $this->response->html($this->projectLayout('category_edit', array( 'values' => $category, 'errors' => array(), 'project' => $project, @@ -123,7 +123,7 @@ class Category extends Base } } - $this->response->html($this->template->layout('category_edit', array( + $this->response->html($this->projectLayout('category_edit', array( 'values' => $values, 'errors' => $errors, 'project' => $project, @@ -142,7 +142,7 @@ class Category extends Base $project = $this->getProject(); $category = $this->getCategory($project['id']); - $this->response->html($this->template->layout('category_remove', array( + $this->response->html($this->projectLayout('category_remove', array( 'project' => $project, 'category' => $category, 'menu' => 'projects', diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 0d430b44..deca7e1a 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -13,26 +13,52 @@ use Core\Translator; */ class Project extends Base { + /** + * List of projects + * + * @access public + */ + public function index() + { + $projects = $this->project->getAll($this->acl->isRegularUser()); + $nb_projects = count($projects); + $active_projects = array(); + $inactive_projects = array(); + + foreach ($projects as $project) { + if ($project['is_active'] == 1) { + $active_projects[] = $project; + } + else { + $inactive_projects[] = $project; + } + } + + $this->response->html($this->template->layout('project_index', array( + 'active_projects' => $active_projects, + 'inactive_projects' => $inactive_projects, + 'nb_projects' => $nb_projects, + 'menu' => 'projects', + 'title' => t('Projects').' ('.$nb_projects.')' + ))); + } + + /** + * Show the project information page + * + * @access public + */ + public function show() + { + $project = $this->getProject(); - /** - * Clone Project - * - * @author Antonio Rabelo - * @access public - */ - public function duplicate() - { - $this->checkCSRFParam(); - $project_id = $this->request->getIntegerParam('project_id'); - - if ($project_id && $this->project->duplicate($project_id)) { - $this->session->flash(t('Project cloned successfully.')); - } else { - $this->session->flashError(t('Unable to clone this project.')); - } - - $this->response->redirect('?controller=project'); - } + $this->response->html($this->projectLayout('project_show', array( + 'project' => $project, + 'stats' => $this->project->getStats($project['id']), + 'menu' => 'projects', + 'title' => $project['name'], + ))); + } /** * Task export @@ -52,7 +78,7 @@ class Project extends Base $this->response->csv($data); } - $this->response->html($this->template->layout('project_export', array( + $this->response->html($this->projectLayout('project_export', array( 'values' => array( 'controller' => 'project', 'action' => 'export', @@ -68,182 +94,175 @@ class Project extends Base } /** - * Task search for a given project + * Public access management * * @access public */ - public function search() + public function share() { $project = $this->getProject(); - $search = $this->request->getStringParam('search'); - $tasks = array(); - $nb_tasks = 0; - - if ($search !== '') { - - $filters = array( - array('column' => 'project_id', 'operator' => 'eq', 'value' => $project['id']), - 'or' => array( - array('column' => 'title', 'operator' => 'like', 'value' => '%'.$search.'%'), - //array('column' => 'description', 'operator' => 'like', 'value' => '%'.$search.'%'), - ) - ); - - $tasks = $this->task->find($filters); - $nb_tasks = count($tasks); - } - $this->response->html($this->template->layout('project_search', array( - 'tasks' => $tasks, - 'nb_tasks' => $nb_tasks, - 'values' => array( - 'search' => $search, - 'controller' => 'project', - 'action' => 'search', - 'project_id' => $project['id'], - ), - 'menu' => 'projects', + $this->response->html($this->projectLayout('project_share', array( 'project' => $project, - 'columns' => $this->board->getColumnsList($project['id']), - 'categories' => $this->category->getList($project['id'], false), - 'title' => $project['name'].($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') + 'menu' => 'projects', + 'title' => t('Public access'), ))); } /** - * List of completed tasks for a given project + * Enable public access for a project * * @access public */ - public function tasks() + public function enablePublic() { - $project = $this->getProject(); - - $filters = array( - array('column' => 'project_id', 'operator' => 'eq', 'value' => $project['id']), - array('column' => 'is_active', 'operator' => 'eq', 'value' => TaskModel::STATUS_CLOSED), - ); + $this->checkCSRFParam(); + $project_id = $this->request->getIntegerParam('project_id'); - $tasks = $this->task->find($filters); - $nb_tasks = count($tasks); + if ($project_id && $this->project->enablePublicAccess($project_id)) { + $this->session->flash(t('Project updated successfully.')); + } else { + $this->session->flashError(t('Unable to update this project.')); + } - $this->response->html($this->template->layout('project_tasks', array( - 'menu' => 'projects', - 'project' => $project, - 'columns' => $this->board->getColumnsList($project['id']), - 'categories' => $this->category->getList($project['id'], false), - 'tasks' => $tasks, - 'nb_tasks' => $nb_tasks, - 'title' => $project['name'].' ('.$nb_tasks.')' - ))); + $this->response->redirect('?controller=project&action=share&project_id='.$project_id); } /** - * List of projects + * Disable public access for a project * * @access public */ - public function index() + public function disablePublic() { - $projects = $this->project->getAll(true, $this->acl->isRegularUser()); - $nb_projects = count($projects); + $this->checkCSRFParam(); + $project_id = $this->request->getIntegerParam('project_id'); - $this->response->html($this->template->layout('project_index', array( - 'projects' => $projects, - 'nb_projects' => $nb_projects, - 'menu' => 'projects', - 'title' => t('Projects').' ('.$nb_projects.')' - ))); + if ($project_id && $this->project->disablePublicAccess($project_id)) { + $this->session->flash(t('Project updated successfully.')); + } else { + $this->session->flashError(t('Unable to update this project.')); + } + + $this->response->redirect('?controller=project&action=share&project_id='.$project_id); } /** - * Display a form to create a new project + * Display a form to edit a project * * @access public */ - public function create() + public function edit() { - $this->response->html($this->template->layout('project_new', array( + $project = $this->getProject(); + + $this->response->html($this->projectLayout('project_edit', array( 'errors' => array(), - 'values' => array(), + 'values' => $project, + 'project' => $project, 'menu' => 'projects', - 'title' => t('New project') + 'title' => t('Edit project') ))); } /** - * Validate and save a new project + * Validate and update a project * * @access public */ - public function save() + public function update() { - $values = $this->request->getValues(); - list($valid, $errors) = $this->project->validateCreation($values); + $project = $this->getProject(); + $values = $this->request->getValues() + array('is_active' => 0); + list($valid, $errors) = $this->project->validateModification($values); if ($valid) { - if ($this->project->create($values)) { - $this->session->flash(t('Your project have been created successfully.')); - $this->response->redirect('?controller=project'); + if ($this->project->update($values)) { + $this->session->flash(t('Project updated successfully.')); + $this->response->redirect('?controller=project&action=edit&project_id='.$project['id']); } else { - $this->session->flashError(t('Unable to create your project.')); + $this->session->flashError(t('Unable to update this project.')); } } - $this->response->html($this->template->layout('project_new', array( + $this->response->html($this->projectLayout('project_edit', array( 'errors' => $errors, 'values' => $values, + 'project' => $project, 'menu' => 'projects', - 'title' => t('New Project') + 'title' => t('Edit Project') ))); } - /** - * Display a form to edit a project + /** + * Users list for the selected project * * @access public */ - public function edit() + public function users() { $project = $this->getProject(); - $this->response->html($this->template->layout('project_edit', array( - 'errors' => array(), - 'values' => $project, + $this->response->html($this->projectLayout('project_users', array( + 'project' => $project, + 'users' => $this->project->getAllUsers($project['id']), 'menu' => 'projects', - 'title' => t('Edit project') + 'title' => t('Edit project access list') ))); } /** - * Validate and update a project + * Allow a specific user for the selected project * * @access public */ - public function update() + public function allow() { - $values = $this->request->getValues() + array('is_active' => 0); - list($valid, $errors) = $this->project->validateModification($values); + $values = $this->request->getValues(); + list($valid,) = $this->project->validateUserAccess($values); if ($valid) { - if ($this->project->update($values)) { + if ($this->project->allowUser($values['project_id'], $values['user_id'])) { $this->session->flash(t('Project updated successfully.')); - $this->response->redirect('?controller=project'); } else { $this->session->flashError(t('Unable to update this project.')); } } - $this->response->html($this->template->layout('project_edit', array( - 'errors' => $errors, - 'values' => $values, - 'menu' => 'projects', - 'title' => t('Edit Project') - ))); + $this->response->redirect('?controller=project&action=users&project_id='.$values['project_id']); + } + + /** + * Revoke user access + * + * @access public + */ + public function revoke() + { + $this->checkCSRFParam(); + + $values = array( + 'project_id' => $this->request->getIntegerParam('project_id'), + 'user_id' => $this->request->getIntegerParam('user_id'), + ); + + list($valid,) = $this->project->validateUserAccess($values); + + if ($valid) { + + if ($this->project->revokeUser($values['project_id'], $values['user_id'])) { + $this->session->flash(t('Project updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update this project.')); + } + } + + $this->response->redirect('?controller=project&action=users&project_id='.$values['project_id']); } /** @@ -251,11 +270,11 @@ class Project extends Base * * @access public */ - public function confirm() + public function confirmRemove() { $project = $this->getProject(); - $this->response->html($this->template->layout('project_remove', array( + $this->response->html($this->projectLayout('project_remove', array( 'project' => $project, 'menu' => 'projects', 'title' => t('Remove project') @@ -282,25 +301,58 @@ class Project extends Base } /** - * Enable a project + * Confirmation dialog before to clone a project * * @access public */ - public function enable() + public function confirmDuplicate() + { + $project = $this->getProject(); + + $this->response->html($this->projectLayout('project_duplicate', array( + 'project' => $project, + 'menu' => 'projects', + 'title' => t('Clone this project') + ))); + } + + /** + * Duplicate a project + * + * @author Antonio Rabelo + * @access public + */ + public function duplicate() { $this->checkCSRFParam(); $project_id = $this->request->getIntegerParam('project_id'); - if ($project_id && $this->project->enable($project_id)) { - $this->session->flash(t('Project activated successfully.')); + if ($project_id && $this->project->duplicate($project_id)) { + $this->session->flash(t('Project cloned successfully.')); } else { - $this->session->flashError(t('Unable to activate this project.')); + $this->session->flashError(t('Unable to clone this project.')); } $this->response->redirect('?controller=project'); } /** + * Confirmation dialog before to disable a project + * + * @access public + */ + public function confirmDisable() + { + $project = $this->getProject(); + + $this->response->html($this->projectLayout('project_disable', array( + 'project' => $project, + 'menu' => 'projects', + 'title' => t('Project activation') + ))); + } + + /** * Disable a project * * @access public @@ -316,75 +368,156 @@ class Project extends Base $this->session->flashError(t('Unable to disable this project.')); } - $this->response->redirect('?controller=project'); + $this->response->redirect('?controller=project&action=show&project_id='.$project_id); } /** - * Users list for the selected project + * Confirmation dialog before to enable a project * * @access public */ - public function users() + public function confirmEnable() { $project = $this->getProject(); - $this->response->html($this->template->layout('project_users', array( + $this->response->html($this->projectLayout('project_enable', array( 'project' => $project, - 'users' => $this->project->getAllUsers($project['id']), 'menu' => 'projects', - 'title' => t('Edit project access list') + 'title' => t('Project activation') ))); } /** - * Allow a specific user for the selected project + * Enable a project * * @access public */ - public function allow() + public function enable() { - $values = $this->request->getValues(); - list($valid,) = $this->project->validateUserAccess($values); + $this->checkCSRFParam(); + $project_id = $this->request->getIntegerParam('project_id'); - if ($valid) { + if ($project_id && $this->project->enable($project_id)) { + $this->session->flash(t('Project activated successfully.')); + } else { + $this->session->flashError(t('Unable to activate this project.')); + } - if ($this->project->allowUser($values['project_id'], $values['user_id'])) { - $this->session->flash(t('Project updated successfully.')); - } - else { - $this->session->flashError(t('Unable to update this project.')); - } + $this->response->redirect('?controller=project&action=show&project_id='.$project_id); + } + + /** + * Task search for a given project + * + * @access public + */ + public function search() + { + $project = $this->getProject(); + $search = $this->request->getStringParam('search'); + $tasks = array(); + $nb_tasks = 0; + + if ($search !== '') { + + $filters = array( + array('column' => 'project_id', 'operator' => 'eq', 'value' => $project['id']), + 'or' => array( + array('column' => 'title', 'operator' => 'like', 'value' => '%'.$search.'%'), + //array('column' => 'description', 'operator' => 'like', 'value' => '%'.$search.'%'), + ) + ); + + $tasks = $this->task->find($filters); + $nb_tasks = count($tasks); } - $this->response->redirect('?controller=project&action=users&project_id='.$values['project_id']); + $this->response->html($this->template->layout('project_search', array( + 'tasks' => $tasks, + 'nb_tasks' => $nb_tasks, + 'values' => array( + 'search' => $search, + 'controller' => 'project', + 'action' => 'search', + 'project_id' => $project['id'], + ), + 'menu' => 'projects', + 'project' => $project, + 'columns' => $this->board->getColumnsList($project['id']), + 'categories' => $this->category->getList($project['id'], false), + 'title' => $project['name'].($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') + ))); } /** - * Revoke user access + * List of completed tasks for a given project * * @access public */ - public function revoke() + public function tasks() { - $this->checkCSRFParam(); + $project = $this->getProject(); - $values = array( - 'project_id' => $this->request->getIntegerParam('project_id'), - 'user_id' => $this->request->getIntegerParam('user_id'), + $filters = array( + array('column' => 'project_id', 'operator' => 'eq', 'value' => $project['id']), + array('column' => 'is_active', 'operator' => 'eq', 'value' => TaskModel::STATUS_CLOSED), ); - list($valid,) = $this->project->validateUserAccess($values); + $tasks = $this->task->find($filters); + $nb_tasks = count($tasks); + + $this->response->html($this->template->layout('project_tasks', array( + 'menu' => 'projects', + 'project' => $project, + 'columns' => $this->board->getColumnsList($project['id']), + 'categories' => $this->category->getList($project['id'], false), + 'tasks' => $tasks, + 'nb_tasks' => $nb_tasks, + 'title' => $project['name'].' ('.$nb_tasks.')' + ))); + } + + /** + * Display a form to create a new project + * + * @access public + */ + public function create() + { + $this->response->html($this->template->layout('project_new', array( + 'errors' => array(), + 'values' => array(), + 'menu' => 'projects', + 'title' => t('New project') + ))); + } + + /** + * Validate and save a new project + * + * @access public + */ + public function save() + { + $values = $this->request->getValues(); + list($valid, $errors) = $this->project->validateCreation($values); if ($valid) { - if ($this->project->revokeUser($values['project_id'], $values['user_id'])) { - $this->session->flash(t('Project updated successfully.')); + if ($this->project->create($values)) { + $this->session->flash(t('Your project have been created successfully.')); + $this->response->redirect('?controller=project'); } else { - $this->session->flashError(t('Unable to update this project.')); + $this->session->flashError(t('Unable to create your project.')); } } - $this->response->redirect('?controller=project&action=users&project_id='.$values['project_id']); + $this->response->html($this->template->layout('project_new', array( + 'errors' => $errors, + 'values' => $values, + 'menu' => 'projects', + 'title' => t('New Project') + ))); } } diff --git a/app/Locales/de_DE/translations.php b/app/Locales/de_DE/translations.php index 6997a0b3..2a5a4c0c 100644 --- a/app/Locales/de_DE/translations.php +++ b/app/Locales/de_DE/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => 'Liste der Projekte', 'Completed tasks for "%s"' => 'Abgeschlossene Aufgaben für "%s"', '%d closed tasks' => '%d abgeschlossene Aufgaben', - 'no task for this project' => 'Keine Aufgaben in diesem Projekt', + 'No task for this project' => 'Keine Aufgaben in diesem Projekt', 'Public link' => 'Öffentlicher Link', 'There is no column in your project!' => 'Es gibt keine Spalte in deinem Projekt!', 'Change assignee' => 'Zuständigkeit ändern', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Zugriffsberechtigungen des Projektes bearbeiten', 'Edit users access' => 'Benutzerzugriff ändern', 'Allow this user' => 'Diesen Benutzer autorisieren', - 'Project access list for "%s"' => 'Zugriffsliste für Projekt "%s"', 'Only those users have access to this project:' => 'Nur diese Benutzer haben Zugang zum Projekt:', 'Don\'t forget that administrators have access to everything.' => 'Nicht vergessen: Administratoren haben überall Zugang.', 'revoke' => 'entfernen', @@ -422,4 +421,17 @@ return array( // '[Kanboard] Notification' => '', // 'I want to receive notifications only for those projects:' => '', // 'view the task on Kanboard' => '', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Locales/es_ES/translations.php b/app/Locales/es_ES/translations.php index 801094c3..0edf3837 100644 --- a/app/Locales/es_ES/translations.php +++ b/app/Locales/es_ES/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => 'Lista de los proyectos', 'Completed tasks for "%s"' => 'Tarea completada por « %s »', '%d closed tasks' => '%d tareas completadas', - 'no task for this project' => 'ninguna tarea para este proyecto', + 'No task for this project' => 'Ninguna tarea para este proyecto', 'Public link' => 'Enlace público', 'There is no column in your project!' => '¡No hay ninguna columna para este proyecto!', 'Change assignee' => 'Cambiar la persona asignada', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Editar los permisos del proyecto', 'Edit users access' => 'Editar los permisos de usuario', 'Allow this user' => 'Autorizar este usuario', - 'Project access list for "%s"' => 'Permisos del proyecto « %s »', 'Only those users have access to this project:' => 'Solo estos usuarios tienen acceso a este proyecto:', 'Don\'t forget that administrators have access to everything.' => 'No olvide que los administradores tienen acceso a todo.', 'revoke' => 'revocar', @@ -422,4 +421,17 @@ return array( '[Kanboard] Notification' => '[Kanboard] Notificación', 'I want to receive notifications only for those projects:' => 'Quiero recibir notificaciones solo de estos proyectos:', 'view the task on Kanboard' => 'ver la tarea en Kanboard', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Locales/fi_FI/translations.php b/app/Locales/fi_FI/translations.php index f18314ed..df0d4176 100644 --- a/app/Locales/fi_FI/translations.php +++ b/app/Locales/fi_FI/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => 'Projektit', 'Completed tasks for "%s"' => 'Suoritetut tehtävät projektille %s', '%d closed tasks' => '%d suljettua tehtävää', - 'no task for this project' => 'ei tehtävää tälle projektille', + 'No task for this project' => 'Ei tehtävää tälle projektille', 'Public link' => 'Julkinen linkki', 'There is no column in your project!' => 'Projektilta puuttuu sarakkeet!', 'Change assignee' => 'Vaihda suorittajaa', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Muuta projektin käyttäjiä', 'Edit users access' => 'Muuta käyttäjien pääsyä', 'Allow this user' => 'Salli tämä projekti', - 'Project access list for "%s"' => 'Projektin pääsylista "%s"', 'Only those users have access to this project:' => 'Vain näillä käyttäjillä on pääsy projektiin:', 'Don\'t forget that administrators have access to everything.' => 'Muista että ylläpitäjät pääsevät kaikkialle.', 'revoke' => 'poista', @@ -422,4 +421,17 @@ return array( // '[Kanboard] Notification' => '', // 'I want to receive notifications only for those projects:' => '', // 'view the task on Kanboard' => '', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Locales/fr_FR/translations.php b/app/Locales/fr_FR/translations.php index 3f5bb633..cfb0733f 100644 --- a/app/Locales/fr_FR/translations.php +++ b/app/Locales/fr_FR/translations.php @@ -176,8 +176,8 @@ return array( 'List of projects' => 'Liste des projets', 'Completed tasks for "%s"' => 'Tâches terminées pour « %s »', '%d closed tasks' => '%d tâches terminées', - 'no task for this project' => 'aucune tâche pour ce projet', - 'Public link' => 'Accès public', + 'No task for this project' => 'Aucune tâche pour ce projet', + 'Public link' => 'Lien publique', 'There is no column in your project!' => 'Il n\'y a aucune colonne dans votre projet !', 'Change assignee' => 'Changer la personne assignée', 'Change assignee for the task "%s"' => 'Changer la personne assignée pour la tâche « %s »', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Modifier l\'accès au projet', 'Edit users access' => 'Modifier les utilisateurs autorisés', 'Allow this user' => 'Autoriser cet utilisateur', - 'Project access list for "%s"' => 'Liste des accès au projet « %s »', 'Only those users have access to this project:' => 'Seulement ces utilisateurs ont accès à ce projet :', 'Don\'t forget that administrators have access to everything.' => 'N\'oubliez pas que les administrateurs ont accès à tout.', 'revoke' => 'révoquer', @@ -422,4 +421,17 @@ return array( '[Kanboard] Notification' => '[Kanboard] Notification', 'I want to receive notifications only for those projects:' => 'Je souhaite reçevoir les notifications uniquement pour les projets sélectionnés :', 'view the task on Kanboard' => 'voir la tâche sur Kanboard', + 'Public access' => 'Accès publique', + 'Categories management' => 'Gestion des catégories', + 'Users management' => 'Gestion des utilisateurs', + 'Active tasks' => 'Tâches actives', + 'Disable public access' => 'Désactiver l\'accès publique', + 'Enable public access' => 'Activer l\'accès publique', + 'Active projects' => 'Projets activés', + 'Inactive projects' => 'Projets désactivés', + 'Public access disabled' => 'Accès publique désactivé', + 'Do you really want to disable this project: "%s"?' => 'Voulez-vous vraiment désactiver ce projet : « %s » ?', + 'Do you really want to duplicate this project: "%s"?' => 'Voulez-vous vraiment dupliquer ce projet : « %s » ?', + 'Do you really want to enable this project: "%s"?' => 'Voulez-vous vraiment activer ce projet : « %s » ?', + 'Project activation' => 'Activation du projet', ); diff --git a/app/Locales/it_IT/translations.php b/app/Locales/it_IT/translations.php index 08d82d79..9dad1d6d 100644 --- a/app/Locales/it_IT/translations.php +++ b/app/Locales/it_IT/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => 'Lista di progetti', 'Completed tasks for "%s"' => 'Compiti fatti da « %s »', '%d closed tasks' => '%d compiti chiusi', - 'no task for this project' => 'nessun compito per questo progetto', + 'No task for this project' => 'Nessun compito per questo progetto', 'Public link' => 'Link pubblico', 'There is no column in your project!' => 'Non c\'è nessuna colonna per questo progetto!', 'Change assignee' => 'Cambiare la persona assegnata', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Modificare i permessi del progetto', 'Edit users access' => 'Modificare i permessi degli utenti', 'Allow this user' => 'Permettere a questo utente', - 'Project access list for "%s"' => 'Permessi del progetto « %s »', 'Only those users have access to this project:' => 'Solo questi utenti hanno accesso a questo progetto:', 'Don\'t forget that administrators have access to everything.' => 'Non dimenticare che gli amministratori hanno accesso a tutto.', 'revoke' => 'revocare', @@ -422,4 +421,17 @@ return array( '[Kanboard] Notification' => '[Kanboard] Notification', 'I want to receive notifications only for those projects:' => 'Vorrei ricevere le notifiche solo da questi progetti:', 'view the task on Kanboard' => 'vedere il compito su Kanboard', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Locales/pl_PL/translations.php b/app/Locales/pl_PL/translations.php index 22c1de19..e042ef21 100644 --- a/app/Locales/pl_PL/translations.php +++ b/app/Locales/pl_PL/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => 'Lista projektów', 'Completed tasks for "%s"' => 'Zadania zakończone dla "%s"', '%d closed tasks' => '%d zamkniętych zadań', - 'no task for this project' => 'brak zadań dla tego projektu', + 'No task for this project' => 'Brak zadań dla tego projektu', 'Public link' => 'Link publiczny', 'There is no column in your project!' => 'Brak kolumny w Twoim projekcie', 'Change assignee' => 'Zmień odpowiedzialną osobę', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Edycja list dostępu dla projektu', 'Edit users access' => 'Edytuj dostęp', 'Allow this user' => 'Dodaj użytkownika', - 'Project access list for "%s"' => 'Lista uprawnionych dla projektu "%s"', 'Only those users have access to this project:' => 'Użytkownicy mający dostęp:', 'Don\'t forget that administrators have access to everything.' => 'Pamiętaj: Administratorzy mają zawsze dostęp do wszystkiego!', 'revoke' => 'odbierz dostęp', @@ -422,4 +421,17 @@ return array( // '[Kanboard] Notification' => '', // 'I want to receive notifications only for those projects:' => '', // 'view the task on Kanboard' => '', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Locales/pt_BR/translations.php b/app/Locales/pt_BR/translations.php index 70378433..a0bad1c1 100644 --- a/app/Locales/pt_BR/translations.php +++ b/app/Locales/pt_BR/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => 'Lista de projetos', 'Completed tasks for "%s"' => 'Tarefas completadas por "%s"', '%d closed tasks' => '%d tarefas encerradas', - 'no task for this project' => 'nenhuma tarefa para este projeto', + 'No task for this project' => 'Nenhuma tarefa para este projeto', 'Public link' => 'Link público', 'There is no column in your project!' => 'Não há colunas no seu projeto!', 'Change assignee' => 'Mudar a designação', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Editar lista de acesso ao projeto', 'Edit users access' => 'Editar acesso de usuários', 'Allow this user' => 'Permitir esse usuário', - 'Project access list for "%s"' => 'Lista de acesso ao projeto para "%s"', 'Only those users have access to this project:' => 'Somente estes usuários têm acesso a este projeto:', 'Don\'t forget that administrators have access to everything.' => 'Não esqueça que administradores têm acesso a tudo.', 'revoke' => 'revogar', @@ -422,4 +421,17 @@ return array( // '[Kanboard] Notification' => '', // 'I want to receive notifications only for those projects:' => '', // 'view the task on Kanboard' => '', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Locales/sv_SE/translations.php b/app/Locales/sv_SE/translations.php index 4a4044b0..5de96279 100644 --- a/app/Locales/sv_SE/translations.php +++ b/app/Locales/sv_SE/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => 'Lista med projekt', 'Completed tasks for "%s"' => 'Slutföra uppgifter för "%s"', '%d closed tasks' => '%d stängda uppgifter', - 'no task for this project' => 'inga uppgifter i detta projekt', + 'No task for this project' => 'Inga uppgifter i detta projekt', 'Public link' => 'Publik länk', 'There is no column in your project!' => 'Det saknas kolumner i ditt projekt!', 'Change assignee' => 'Ändra uppdragsinnehavare', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => 'Ändra projektåtkomst lista', 'Edit users access' => 'Användaråtkomst', 'Allow this user' => 'Tillåt användare', - 'Project access list for "%s"' => 'Behörighetslista för "%s"', 'Only those users have access to this project:' => 'Bara de användarna har tillgång till detta projekt.', 'Don\'t forget that administrators have access to everything.' => 'Glöm inte att administratörerna har rätt att göra allt.', 'revoke' => 'Dra tillbaka behörighet', @@ -422,4 +421,17 @@ return array( '[Kanboard] Notification' => '[Kanboard] Notis', 'I want to receive notifications only for those projects:' => 'Jag vill endast få notiser för dessa projekt:', 'view the task on Kanboard' => 'Visa uppgiften på Kanboard', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Locales/zh_CN/translations.php b/app/Locales/zh_CN/translations.php index 0d3500ed..31addc37 100644 --- a/app/Locales/zh_CN/translations.php +++ b/app/Locales/zh_CN/translations.php @@ -176,7 +176,7 @@ return array( 'List of projects' => '项目列表', 'Completed tasks for "%s"' => '任务因"%s"原因完成', '%d closed tasks' => '%d个已关闭任务', - 'no task for this project' => '该项目尚无任务', + 'No task for this project' => '该项目尚无任务', 'Public link' => '公开链接', 'There is no column in your project!' => '该项目尚无栏目项!', 'Change assignee' => '被指派人变更', @@ -191,7 +191,6 @@ return array( 'Edit project access list' => '编辑项目存取列表', 'Edit users access' => '编辑用户存取权限', 'Allow this user' => '允许该用户', - 'Project access list for "%s"' => '"%s"的项目存取列表', 'Only those users have access to this project:' => '只有这些用户有该项目的存取权限:', 'Don\'t forget that administrators have access to everything.' => '别忘了管理员有一切的权限。', 'revoke' => '撤销', @@ -422,4 +421,17 @@ return array( // '[Kanboard] Notification' => '', // 'I want to receive notifications only for those projects:' => '', // 'view the task on Kanboard' => '', + // 'Public access' => '', + // 'Categories management' => '', + // 'Users management' => '', + // 'Active tasks' => '', + // 'Disable public access' => '', + // 'Enable public access' => '', + // 'Active projects' => '', + // 'Inactive projects' => '', + // 'Public access disabled' => '', + // 'Do you really want to disable this project: "%s"?' => '', + // 'Do you really want to duplicate this project: "%s"?' => '', + // 'Do you really want to enable this project: "%s"?' => '', + // 'Project activation' => '', ); diff --git a/app/Model/Acl.php b/app/Model/Acl.php index c4b31079..b2644686 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -31,7 +31,7 @@ class Acl extends Base private $user_actions = array( 'app' => array('index'), 'board' => array('index', 'show', 'assign', 'assigntask', 'save', 'check'), - 'project' => array('tasks', 'index', 'forbidden', 'search'), + 'project' => array('tasks', 'index', 'forbidden', 'search', 'export', 'show'), 'user' => array('index', 'edit', 'update', 'forbidden', 'logout', 'index', 'unlinkgoogle', 'unlinkgithub'), 'config' => array('index', 'removeremembermetoken', 'notifications'), 'comment' => array('create', 'save', 'confirm', 'remove', 'update', 'edit', 'forbidden'), diff --git a/app/Model/Project.php b/app/Model/Project.php index dc72addc..3298b496 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -227,7 +227,7 @@ class Project extends Base */ public function getByToken($token) { - return $this->db->table(self::TABLE)->eq('token', $token)->findOne(); + return $this->db->table(self::TABLE)->eq('token', $token)->eq('is_public', 1)->findOne(); } /** @@ -245,46 +245,23 @@ class Project extends Base * Get all projects, optionaly fetch stats for each project and can check users permissions * * @access public - * @param bool $fetch_stats If true, return metrics about each projects - * @param bool $check_permissions If true, remove projects not allowed for the current user + * @param bool $filter_permissions If true, remove projects not allowed for the current user * @return array */ - public function getAll($fetch_stats = false, $check_permissions = false) + public function getAll($filter_permissions = false) { - if (! $fetch_stats) { - return $this->db->table(self::TABLE)->asc('name')->findAll(); - } - - $this->db->startTransaction(); + $projects = $this->db->table(self::TABLE)->asc('name')->findAll(); - $projects = $this->db - ->table(self::TABLE) - ->asc('name') - ->findAll(); - - foreach ($projects as $pkey => &$project) { - - if ($check_permissions && ! $this->isUserAllowed($project['id'], $this->acl->getUserId())) { - unset($projects[$pkey]); - } - else { + if ($filter_permissions) { - $columns = $this->board->getcolumns($project['id']); - $project['nb_active_tasks'] = 0; + foreach ($projects as $key => $project) { - foreach ($columns as &$column) { - $column['nb_active_tasks'] = $this->task->countByColumnId($project['id'], $column['id']); - $project['nb_active_tasks'] += $column['nb_active_tasks']; + if (! $this->isUserAllowed($project['id'], $this->acl->getUserId())) { + unset($projects[$key]); } - - $project['columns'] = $columns; - $project['nb_tasks'] = $this->task->countByProjectId($project['id']); - $project['nb_inactive_tasks'] = $project['nb_tasks'] - $project['nb_active_tasks']; } } - $this->db->closeTransaction(); - return $projects; } @@ -383,6 +360,31 @@ class Project extends Base } /** + * Gather some task metrics for a given project + * + * @access public + * @param integer $project_id Project id + * @return array + */ + public function getStats($project_id) + { + $stats = array(); + $columns = $this->board->getcolumns($project_id); + $stats['nb_active_tasks'] = 0; + + foreach ($columns as &$column) { + $column['nb_active_tasks'] = $this->task->countByColumnId($project_id, $column['id']); + $stats['nb_active_tasks'] += $column['nb_active_tasks']; + } + + $stats['columns'] = $columns; + $stats['nb_tasks'] = $this->task->countByProjectId($project_id); + $stats['nb_inactive_tasks'] = $stats['nb_tasks'] - $stats['nb_active_tasks']; + + return $stats; + } + + /** * Create a project from another one. * * @author Antonio Rabelo @@ -397,7 +399,7 @@ class Project extends Base 'name' => $project_name.' ('.t('Clone').')', 'is_active' => true, 'last_modified' => 0, - 'token' => Security::generateToken(), + 'token' => '', ); if (! $this->db->table(self::TABLE)->save($project)) { @@ -486,7 +488,7 @@ class Project extends Base { $this->db->startTransaction(); - $values['token'] = Security::generateToken(); + $values['token'] = ''; if (! $this->db->table(self::TABLE)->save($values)) { $this->db->cancelTransaction(); @@ -592,6 +594,36 @@ class Project extends Base } /** + * Enable public access for a project + * + * @access public + * @param integer $project_id Project id + * @return bool + */ + public function enablePublicAccess($project_id) + { + return $this->db + ->table(self::TABLE) + ->eq('id', $project_id) + ->save(array('is_public' => 1, 'token' => Security::generateToken())); + } + + /** + * Disable public access for a project + * + * @access public + * @param integer $project_id Project id + * @return bool + */ + public function disablePublicAccess($project_id) + { + return $this->db + ->table(self::TABLE) + ->eq('id', $project_id) + ->save(array('is_public' => 0, 'token' => '')); + } + + /** * Validate project creation * * @access public diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 8f3ae5a1..ca4bbbae 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -4,7 +4,12 @@ namespace Schema; use Core\Security; -const VERSION = 23; +const VERSION = 24; + +function version_24($pdo) +{ + $pdo->exec("ALTER TABLE projects ADD COLUMN is_public TINYINT(1) DEFAULT '0'"); +} function version_23($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index ce77a4ed..ac27f786 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -4,7 +4,12 @@ namespace Schema; use Core\Security; -const VERSION = 4; +const VERSION = 5; + +function version_5($pdo) +{ + $pdo->exec("ALTER TABLE projects ADD COLUMN is_public BOOLEAN DEFAULT '0'"); +} function version_4($pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index c3a3f10e..fed9aaf8 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -4,7 +4,12 @@ namespace Schema; use Core\Security; -const VERSION = 23; +const VERSION = 24; + +function version_24($pdo) +{ + $pdo->exec('ALTER TABLE projects ADD COLUMN is_public INTEGER DEFAULT "0"'); +} function version_23($pdo) { @@ -238,19 +243,6 @@ function version_4($pdo) function version_3($pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN token TEXT'); - - // For each existing project, assign a different token - $rq = $pdo->prepare("SELECT id FROM projects WHERE token IS NULL"); - $rq->execute(); - $results = $rq->fetchAll(\PDO::FETCH_ASSOC); - - if ($results !== false) { - - foreach ($results as &$result) { - $rq = $pdo->prepare('UPDATE projects SET token=? WHERE id=?'); - $rq->execute(array(Security::generateToken(), $result['id'])); - } - } } function version_2($pdo) diff --git a/app/Templates/action_index.php b/app/Templates/action_index.php index 36c333a9..c21395fd 100644 --- a/app/Templates/action_index.php +++ b/app/Templates/action_index.php @@ -1,77 +1,70 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2> - <ul> - <li><a href="?controller=project"><?= t('All projects') ?></a></li> - </ul> - </div> - <section> +<div class="page-header"> + <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2> +</div> - <?php if (! empty($actions)): ?> +<?php if (! empty($actions)): ?> - <h3><?= t('Defined actions') ?></h3> - <table> - <tr> - <th><?= t('Event name') ?></th> - <th><?= t('Action name') ?></th> - <th><?= t('Action parameters') ?></th> - <th><?= t('Action') ?></th> - </tr> +<h3><?= t('Defined actions') ?></h3> +<table> + <tr> + <th><?= t('Event name') ?></th> + <th><?= t('Action name') ?></th> + <th><?= t('Action parameters') ?></th> + <th><?= t('Action') ?></th> + </tr> - <?php foreach ($actions as $action): ?> - <tr> - <td><?= Helper\in_list($action['event_name'], $available_events) ?></td> - <td><?= Helper\in_list($action['action_name'], $available_actions) ?></td> - <td> - <ul> - <?php foreach ($action['params'] as $param): ?> - <li> - <?= Helper\in_list($param['name'], $available_params) ?> = - <strong> - <?php if (Helper\contains($param['name'], 'column_id')): ?> - <?= Helper\in_list($param['value'], $columns_list) ?> - <?php elseif (Helper\contains($param['name'], 'user_id')): ?> - <?= Helper\in_list($param['value'], $users_list) ?> - <?php elseif (Helper\contains($param['name'], 'project_id')): ?> - <?= Helper\in_list($param['value'], $projects_list) ?> - <?php elseif (Helper\contains($param['name'], 'color_id')): ?> - <?= Helper\in_list($param['value'], $colors_list) ?> - <?php elseif (Helper\contains($param['name'], 'category_id')): ?> - <?= Helper\in_list($param['value'], $categories_list) ?> - <?php endif ?> - </strong> - </li> - <?php endforeach ?> - </ul> - </td> - <td> - <a href="?controller=action&action=confirm&action_id=<?= $action['id'] ?>"><?= t('Remove') ?></a> - </td> - </tr> - <?php endforeach ?> + <?php foreach ($actions as $action): ?> + <tr> + <td><?= Helper\in_list($action['event_name'], $available_events) ?></td> + <td><?= Helper\in_list($action['action_name'], $available_actions) ?></td> + <td> + <ul> + <?php foreach ($action['params'] as $param): ?> + <li> + <?= Helper\in_list($param['name'], $available_params) ?> = + <strong> + <?php if (Helper\contains($param['name'], 'column_id')): ?> + <?= Helper\in_list($param['value'], $columns_list) ?> + <?php elseif (Helper\contains($param['name'], 'user_id')): ?> + <?= Helper\in_list($param['value'], $users_list) ?> + <?php elseif (Helper\contains($param['name'], 'project_id')): ?> + <?= Helper\in_list($param['value'], $projects_list) ?> + <?php elseif (Helper\contains($param['name'], 'color_id')): ?> + <?= Helper\in_list($param['value'], $colors_list) ?> + <?php elseif (Helper\contains($param['name'], 'category_id')): ?> + <?= Helper\in_list($param['value'], $categories_list) ?> + <?php endif ?> + </strong> + </li> + <?php endforeach ?> + </ul> + </td> + <td> + <a href="?controller=action&action=confirm&project_id=<?= $project['id'] ?>&action_id=<?= $action['id'] ?>"><?= t('Remove') ?></a> + </td> + </tr> + <?php endforeach ?> - </table> +</table> - <?php endif ?> +<?php endif ?> - <h3><?= t('Add an action') ?></h3> - <form method="post" action="?controller=action&action=params&project_id=<?= $project['id'] ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> +<h3><?= t('Add an action') ?></h3> +<form method="post" action="?controller=action&action=params&project_id=<?= $project['id'] ?>" autocomplete="off"> + <?= Helper\form_csrf() ?> + <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_label(t('Event'), 'event_name') ?> - <?= Helper\form_select('event_name', $available_events, $values) ?><br/> + <?= Helper\form_label(t('Event'), 'event_name') ?> + <?= Helper\form_select('event_name', $available_events, $values) ?><br/> - <?= Helper\form_label(t('Action'), 'action_name') ?> - <?= Helper\form_select('action_name', $available_actions, $values) ?><br/> + <?= Helper\form_label(t('Action'), 'action_name') ?> + <?= Helper\form_select('action_name', $available_actions, $values) ?><br/> - <div class="form-help"> - <?= t('When the selected event occurs execute the corresponding action.') ?> - </div> + <div class="form-help"> + <?= t('When the selected event occurs execute the corresponding action.') ?> + </div> - <div class="form-actions"> - <input type="submit" value="<?= t('Next step') ?>" class="btn btn-blue"/> - </div> - </form> - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Next step') ?>" class="btn btn-blue"/> + </div> +</form>
\ No newline at end of file diff --git a/app/Templates/action_params.php b/app/Templates/action_params.php index da685860..92d16288 100644 --- a/app/Templates/action_params.php +++ b/app/Templates/action_params.php @@ -1,43 +1,37 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2> - <ul> - <li><a href="?controller=project"><?= t('All projects') ?></a></li> - </ul> - </div> - <section> +<div class="page-header"> + <h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2> +</div> +<section> - <h3><?= t('Define action parameters') ?></h3> - <form method="post" action="?controller=action&action=create&project_id=<?= $project['id'] ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_hidden('event_name', $values) ?> - <?= Helper\form_hidden('action_name', $values) ?> +<h3><?= t('Define action parameters') ?></h3> +<form method="post" action="?controller=action&action=create&project_id=<?= $project['id'] ?>" autocomplete="off"> + <?= Helper\form_csrf() ?> + <?= Helper\form_hidden('project_id', $values) ?> + <?= Helper\form_hidden('event_name', $values) ?> + <?= Helper\form_hidden('action_name', $values) ?> - <?php foreach ($action_params as $param_name => $param_desc): ?> + <?php foreach ($action_params as $param_name => $param_desc): ?> - <?php if (Helper\contains($param_name, 'column_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $columns_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'user_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $users_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'project_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $projects_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'color_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $colors_list, $values) ?><br/> - <?php elseif (Helper\contains($param_name, 'category_id')): ?> - <?= Helper\form_label($param_desc, $param_name) ?> - <?= Helper\form_select('params['.$param_name.']', $categories_list, $values) ?><br/> - <?php endif ?> - <?php endforeach ?> + <?php if (Helper\contains($param_name, 'column_id')): ?> + <?= Helper\form_label($param_desc, $param_name) ?> + <?= Helper\form_select('params['.$param_name.']', $columns_list, $values) ?><br/> + <?php elseif (Helper\contains($param_name, 'user_id')): ?> + <?= Helper\form_label($param_desc, $param_name) ?> + <?= Helper\form_select('params['.$param_name.']', $users_list, $values) ?><br/> + <?php elseif (Helper\contains($param_name, 'project_id')): ?> + <?= Helper\form_label($param_desc, $param_name) ?> + <?= Helper\form_select('params['.$param_name.']', $projects_list, $values) ?><br/> + <?php elseif (Helper\contains($param_name, 'color_id')): ?> + <?= Helper\form_label($param_desc, $param_name) ?> + <?= Helper\form_select('params['.$param_name.']', $colors_list, $values) ?><br/> + <?php elseif (Helper\contains($param_name, 'category_id')): ?> + <?= Helper\form_label($param_desc, $param_name) ?> + <?= Helper\form_select('params['.$param_name.']', $categories_list, $values) ?><br/> + <?php endif ?> + <?php endforeach ?> - <div class="form-actions"> - <input type="submit" value="<?= t('Save this action') ?>" class="btn btn-blue"/> - <?= t('or') ?> <a href="?controller=action&action=index&project_id=<?= $project['id'] ?>"><?= t('cancel') ?></a> - </div> - </form> - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Save this action') ?>" class="btn btn-blue"/> + <?= t('or') ?> <a href="?controller=action&action=index&project_id=<?= $project['id'] ?>"><?= t('cancel') ?></a> + </div> +</form>
\ No newline at end of file diff --git a/app/Templates/action_remove.php b/app/Templates/action_remove.php index 13679eab..4b574f11 100644 --- a/app/Templates/action_remove.php +++ b/app/Templates/action_remove.php @@ -1,16 +1,14 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Remove an automatic action') ?></h2> - </div> +<div class="page-header"> + <h2><?= t('Remove an automatic action') ?></h2> +</div> - <div class="confirm"> - <p class="alert alert-info"> - <?= t('Do you really want to remove this action: "%s"?', Helper\in_list($action['event_name'], $available_events).'/'.Helper\in_list($action['action_name'], $available_actions)) ?> - </p> +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to remove this action: "%s"?', Helper\in_list($action['event_name'], $available_events).'/'.Helper\in_list($action['action_name'], $available_actions)) ?> + </p> - <div class="form-actions"> - <a href="?controller=action&action=remove&action_id=<?= $action['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> - <?= t('or') ?> <a href="?controller=action&action=index&project_id=<?= $action['project_id'] ?>"><?= t('cancel') ?></a> - </div> + <div class="form-actions"> + <a href="?controller=action&action=remove&action_id=<?= $action['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=action&action=index&project_id=<?= $action['project_id'] ?>"><?= t('cancel') ?></a> </div> -</section>
\ No newline at end of file +</div>
\ No newline at end of file diff --git a/app/Templates/board_edit.php b/app/Templates/board_edit.php index 05d9a6f6..8832e71d 100644 --- a/app/Templates/board_edit.php +++ b/app/Templates/board_edit.php @@ -1,66 +1,58 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Edit the board for "%s"', $project['name']) ?></h2> - <ul> - <li><a href="?controller=project"><?= t('All projects') ?></a></li> - </ul> - </div> - <section> +<div class="page-header"> + <h2><?= t('Edit the board for "%s"', $project['name']) ?></h2> +</div> +<section> - <h3><?= t('Change columns') ?></h3> - <form method="post" action="?controller=board&action=update&project_id=<?= $project['id'] ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?php $i = 0; ?> - <table> - <tr> - <th><?= t('Position') ?></th> - <th><?= t('Column title') ?></th> - <th><?= t('Task limit') ?></th> - <th><?= t('Actions') ?></th> - </tr> - <?php foreach ($columns as $column): ?> - <tr> - <td><?= Helper\form_label(t('Column %d', ++$i), 'title['.$column['id'].']', array('title="column_id='.$column['id'].'"')) ?></td> - <td><?= Helper\form_text('title['.$column['id'].']', $values, $errors, array('required')) ?></td> - <td><?= Helper\form_number('task_limit['.$column['id'].']', $values, $errors, array('placeholder="'.t('limit').'"')) ?></td> - <td> - <ul> - <?php if ($column['position'] != 1): ?> - <li> - <a href="?controller=board&action=moveUp&project_id=<?= $project['id'] ?>&column_id=<?= $column['id'].Helper\param_csrf() ?>"><?= t('Move Up') ?></a> - </li> - <?php endif ?> - <?php if ($column['position'] != count($columns)): ?> - <li> - <a href="?controller=board&action=moveDown&project_id=<?= $project['id'] ?>&column_id=<?= $column['id'].Helper\param_csrf() ?>"><?= t('Move Down') ?></a> - </li> - <?php endif ?> - <li> - <a href="?controller=board&action=confirm&project_id=<?= $project['id'] ?>&column_id=<?= $column['id'] ?>"><?= t('Remove') ?></a> - </li> - </ul> - </td> - </tr> - <?php endforeach ?> - </table> +<h3><?= t('Change columns') ?></h3> +<form method="post" action="?controller=board&action=update&project_id=<?= $project['id'] ?>" autocomplete="off"> + <?= Helper\form_csrf() ?> + <?php $i = 0; ?> + <table> + <tr> + <th><?= t('Position') ?></th> + <th><?= t('Column title') ?></th> + <th><?= t('Task limit') ?></th> + <th><?= t('Actions') ?></th> + </tr> + <?php foreach ($columns as $column): ?> + <tr> + <td><?= Helper\form_label(t('Column %d', ++$i), 'title['.$column['id'].']', array('title="column_id='.$column['id'].'"')) ?></td> + <td><?= Helper\form_text('title['.$column['id'].']', $values, $errors, array('required')) ?></td> + <td><?= Helper\form_number('task_limit['.$column['id'].']', $values, $errors, array('placeholder="'.t('limit').'"')) ?></td> + <td> + <ul> + <?php if ($column['position'] != 1): ?> + <li> + <a href="?controller=board&action=moveUp&project_id=<?= $project['id'] ?>&column_id=<?= $column['id'].Helper\param_csrf() ?>"><?= t('Move Up') ?></a> + </li> + <?php endif ?> + <?php if ($column['position'] != count($columns)): ?> + <li> + <a href="?controller=board&action=moveDown&project_id=<?= $project['id'] ?>&column_id=<?= $column['id'].Helper\param_csrf() ?>"><?= t('Move Down') ?></a> + </li> + <?php endif ?> + <li> + <a href="?controller=board&action=confirm&project_id=<?= $project['id'] ?>&column_id=<?= $column['id'] ?>"><?= t('Remove') ?></a> + </li> + </ul> + </td> + </tr> + <?php endforeach ?> + </table> - <div class="form-actions"> - <input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/> - <?= t('or') ?> <a href="?controller=project"><?= t('cancel') ?></a> - </div> - </form> + <div class="form-actions"> + <input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/> + </div> +</form> - <h3><?= t('Add a new column') ?></h3> - <form method="post" action="?controller=board&action=add&project_id=<?= $project['id'] ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_label(t('Title'), 'title') ?> - <?= Helper\form_text('title', $values, $errors, array('required')) ?> +<h3><?= t('Add a new column') ?></h3> +<form method="post" action="?controller=board&action=add&project_id=<?= $project['id'] ?>" autocomplete="off"> + <?= Helper\form_csrf() ?> + <?= Helper\form_hidden('project_id', $values) ?> + <?= Helper\form_label(t('Title'), 'title') ?> + <?= Helper\form_text('title', $values, $errors, array('required')) ?> - <div class="form-actions"> - <input type="submit" value="<?= t('Add this column') ?>" class="btn btn-blue"/> - <?= t('or') ?> <a href="?controller=project"><?= t('cancel') ?></a> - </div> - </form> - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Add this column') ?>" class="btn btn-blue"/> + </div> +</form>
\ No newline at end of file diff --git a/app/Templates/board_remove.php b/app/Templates/board_remove.php index 76c217b3..d6fa9a88 100644 --- a/app/Templates/board_remove.php +++ b/app/Templates/board_remove.php @@ -1,17 +1,15 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Remove a column') ?></h2> - </div> +<div class="page-header"> + <h2><?= t('Remove a column') ?></h2> +</div> - <div class="confirm"> - <p class="alert alert-info"> - <?= t('Do you really want to remove this column: "%s"?', $column['title']) ?> - <?= t('This action will REMOVE ALL TASKS associated to this column!') ?> - </p> +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to remove this column: "%s"?', $column['title']) ?> + <?= t('This action will REMOVE ALL TASKS associated to this column!') ?> + </p> - <div class="form-actions"> - <a href="?controller=board&action=remove&column_id=<?= $column['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> - <?= t('or') ?> <a href="?controller=board&action=edit&project_id=<?= $column['project_id'] ?>"><?= t('cancel') ?></a> - </div> + <div class="form-actions"> + <a href="?controller=board&action=remove&column_id=<?= $column['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=board&action=edit&project_id=<?= $column['project_id'] ?>"><?= t('cancel') ?></a> </div> -</section>
\ No newline at end of file +</div>
\ No newline at end of file diff --git a/app/Templates/category_edit.php b/app/Templates/category_edit.php index 327acce6..278d7e12 100644 --- a/app/Templates/category_edit.php +++ b/app/Templates/category_edit.php @@ -1,24 +1,16 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Category modification for the project "%s"', $project['name']) ?></h2> - <ul> - <li><a href="?controller=project"><?= t('All projects') ?></a></li> - </ul> - </div> - <section> - - <form method="post" action="?controller=category&action=update&project_id=<?= $project['id'] ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> +<div class="page-header"> + <h2><?= t('Category modification for the project "%s"', $project['name']) ?></h2> +</div> - <?= Helper\form_label(t('Category Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> +<form method="post" action="?controller=category&action=update&project_id=<?= $project['id'] ?>" autocomplete="off"> + <?= Helper\form_csrf() ?> + <?= Helper\form_hidden('id', $values) ?> + <?= Helper\form_hidden('project_id', $values) ?> - <div class="form-actions"> - <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - </div> - </form> + <?= Helper\form_label(t('Category Name'), 'name') ?> + <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> + </div> +</form>
\ No newline at end of file diff --git a/app/Templates/category_index.php b/app/Templates/category_index.php index 18e81b78..4635406e 100644 --- a/app/Templates/category_index.php +++ b/app/Templates/category_index.php @@ -1,49 +1,41 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Categories for the project "%s"', $project['name']) ?></h2> - <ul> - <li><a href="?controller=project"><?= t('All projects') ?></a></li> - </ul> - </div> - <section> - - <?php if (! empty($categories)): ?> - <table> - <tr> - <th><?= t('Category Name') ?></th> - <th><?= t('Actions') ?></th> - </tr> - <?php foreach ($categories as $category_id => $category_name): ?> - <tr> - <td><?= Helper\escape($category_name) ?></td> - <td> - <ul> - <li> - <a href="?controller=category&action=edit&project_id=<?= $project['id'] ?>&category_id=<?= $category_id ?>"><?= t('Edit') ?></a> - </li> - <li> - <a href="?controller=category&action=confirm&project_id=<?= $project['id'] ?>&category_id=<?= $category_id ?>"><?= t('Remove') ?></a> - </li> - </ul> - </td> - </tr> - <?php endforeach ?> - </table> - <?php endif ?> +<div class="page-header"> + <h2><?= t('Categories') ?></h2> +</div> - <h3><?= t('Add a new category') ?></h3> - <form method="post" action="?controller=category&action=save&project_id=<?= $project['id'] ?>" autocomplete="off"> +<?php if (! empty($categories)): ?> +<table> + <tr> + <th><?= t('Category Name') ?></th> + <th><?= t('Actions') ?></th> + </tr> + <?php foreach ($categories as $category_id => $category_name): ?> + <tr> + <td><?= Helper\escape($category_name) ?></td> + <td> + <ul> + <li> + <a href="?controller=category&action=edit&project_id=<?= $project['id'] ?>&category_id=<?= $category_id ?>"><?= t('Edit') ?></a> + </li> + <li> + <a href="?controller=category&action=confirm&project_id=<?= $project['id'] ?>&category_id=<?= $category_id ?>"><?= t('Remove') ?></a> + </li> + </ul> + </td> + </tr> + <?php endforeach ?> +</table> +<?php endif ?> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('project_id', $values) ?> +<h3><?= t('Add a new category') ?></h3> +<form method="post" action="?controller=category&action=save&project_id=<?= $project['id'] ?>" autocomplete="off"> - <?= Helper\form_label(t('Category Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> + <?= Helper\form_csrf() ?> + <?= Helper\form_hidden('project_id', $values) ?> - <div class="form-actions"> - <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - </div> - </form> + <?= Helper\form_label(t('Category Name'), 'name') ?> + <?= Helper\form_text('name', $values, $errors, array('autofocus required')) ?> - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> + </div> +</form>
\ No newline at end of file diff --git a/app/Templates/project_disable.php b/app/Templates/project_disable.php new file mode 100644 index 00000000..39f55570 --- /dev/null +++ b/app/Templates/project_disable.php @@ -0,0 +1,14 @@ +<div class="page-header"> + <h2><?= t('Project activation') ?></h2> +</div> + +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to disable this project: "%s"?', $project['name']) ?> + </p> + + <div class="form-actions"> + <a href="?controller=project&action=disable&project_id=<?= $project['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=project&action=show&project_id=<?= $project['id'] ?>"><?= t('cancel') ?></a> + </div> +</div>
\ No newline at end of file diff --git a/app/Templates/project_duplicate.php b/app/Templates/project_duplicate.php new file mode 100644 index 00000000..32cbd5d8 --- /dev/null +++ b/app/Templates/project_duplicate.php @@ -0,0 +1,14 @@ +<div class="page-header"> + <h2><?= t('Clone this project') ?></h2> +</div> + +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to duplicate this project: "%s"?', $project['name']) ?> + </p> + + <div class="form-actions"> + <a href="?controller=project&action=duplicate&project_id=<?= $project['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=project&action=show&project_id=<?= $project['id'] ?>"><?= t('cancel') ?></a> + </div> +</div>
\ No newline at end of file diff --git a/app/Templates/project_edit.php b/app/Templates/project_edit.php index a882fbc6..4c9420f0 100644 --- a/app/Templates/project_edit.php +++ b/app/Templates/project_edit.php @@ -1,25 +1,17 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Edit project') ?></h2> - <ul> - <li><a href="?controller=project"><?= t('All projects') ?></a></li> - </ul> - </div> - <section> - <form method="post" action="?controller=project&action=update&project_id=<?= $values['id'] ?>" autocomplete="off"> +<div class="page-header"> + <h2><?= t('Edit project') ?></h2> +</div> +<form method="post" action="?controller=project&action=update&project_id=<?= $values['id'] ?>" autocomplete="off"> - <?= Helper\form_csrf() ?> - <?= Helper\form_hidden('id', $values) ?> + <?= Helper\form_csrf() ?> + <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_label(t('Name'), 'name') ?> - <?= Helper\form_text('name', $values, $errors, array('required')) ?> + <?= Helper\form_label(t('Name'), 'name') ?> + <?= Helper\form_text('name', $values, $errors, array('required')) ?> - <?= Helper\form_checkbox('is_active', t('Activated'), 1, isset($values['is_active']) && $values['is_active'] == 1 ? true : false) ?><br/> + <?= Helper\form_checkbox('is_active', t('Activated'), 1, isset($values['is_active']) && $values['is_active'] == 1) ?><br/> - <div class="form-actions"> - <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - <?= t('or') ?> <a href="?controller=project"><?= t('cancel') ?></a> - </div> - </form> - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> + </div> +</form>
\ No newline at end of file diff --git a/app/Templates/project_enable.php b/app/Templates/project_enable.php new file mode 100644 index 00000000..d2fce9f3 --- /dev/null +++ b/app/Templates/project_enable.php @@ -0,0 +1,14 @@ +<div class="page-header"> + <h2><?= t('Project activation') ?></h2> +</div> + +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to enable this project: "%s"?', $project['name']) ?> + </p> + + <div class="form-actions"> + <a href="?controller=project&action=enable&project_id=<?= $project['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=project&action=show&project_id=<?= $project['id'] ?>"><?= t('cancel') ?></a> + </div> +</div>
\ No newline at end of file diff --git a/app/Templates/project_export.php b/app/Templates/project_export.php index 946a68a8..46b4f369 100644 --- a/app/Templates/project_export.php +++ b/app/Templates/project_export.php @@ -1,33 +1,24 @@ -<section id="main"> - <div class="page-header"> - <h2> - <?= t('Tasks exportation for "%s"', $project['name']) ?> - </h2> - <ul> - <li><a href="?controller=board&action=show&project_id=<?= $project['id'] ?>"><?= t('Back to the board') ?></a></li> - <li><a href="?controller=project&action=index"><?= t('List of projects') ?></a></li> - </ul> - </div> - <section id="project-section"> - - <form method="get" action="?" autocomplete="off"> +<div class="page-header"> + <h2> + <?= t('Tasks exportation for "%s"', $project['name']) ?> + </h2> +</div> - <?= Helper\form_hidden('controller', $values) ?> - <?= Helper\form_hidden('action', $values) ?> - <?= Helper\form_hidden('project_id', $values) ?> +<form method="get" action="?" autocomplete="off"> - <?= Helper\form_label(t('Start Date'), 'from') ?> - <?= Helper\form_text('from', $values, $errors, array('required', 'placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/> + <?= Helper\form_hidden('controller', $values) ?> + <?= Helper\form_hidden('action', $values) ?> + <?= Helper\form_hidden('project_id', $values) ?> - <?= Helper\form_label(t('End Date'), 'to') ?> - <?= Helper\form_text('to', $values, $errors, array('required', 'placeholder="'.t('month/day/year').'"'), 'form-date') ?> + <?= Helper\form_label(t('Start Date'), 'from') ?> + <?= Helper\form_text('from', $values, $errors, array('required', 'placeholder="'.t('month/day/year').'"'), 'form-date') ?><br/> - <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> + <?= Helper\form_label(t('End Date'), 'to') ?> + <?= Helper\form_text('to', $values, $errors, array('required', 'placeholder="'.t('month/day/year').'"'), 'form-date') ?> - <div class="form-actions"> - <input type="submit" value="<?= t('Execute') ?>" class="btn btn-blue"/> - </div> - </form> + <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Execute') ?>" class="btn btn-blue"/> + </div> +</form>
\ No newline at end of file diff --git a/app/Templates/project_index.php b/app/Templates/project_index.php index dc71033f..8b103c52 100644 --- a/app/Templates/project_index.php +++ b/app/Templates/project_index.php @@ -8,99 +8,32 @@ <?php endif ?> </div> <section> - <?php if (empty($projects)): ?> + <?php if (empty($active_projects) && empty($inactive_projects)): ?> <p class="alert"><?= t('No project') ?></p> <?php else: ?> - <table> - <tr> - <th><?= t('Project') ?></th> - <th><?= t('Status') ?></th> - <th><?= t('Tasks') ?></th> - <th><?= t('Board') ?></th> - <?php if (Helper\is_admin()): ?> - <th><?= t('Actions') ?></th> - <?php endif ?> - </tr> - <?php foreach ($projects as $project): ?> - <tr> - <td> - <a href="?controller=board&action=show&project_id=<?= $project['id'] ?>" title="project_id=<?= $project['id'] ?>"><?= Helper\escape($project['name']) ?></a> - </td> - <td> - <?= $project['is_active'] ? t('Active') : t('Inactive') ?> - </td> - <td> - <ul> - <?php if ($project['nb_tasks'] > 0): ?> - - <?php if ($project['nb_active_tasks'] > 0): ?> - <li><a href="?controller=board&action=show&project_id=<?= $project['id'] ?>"><?= t('%d tasks on the board', $project['nb_active_tasks']) ?></a></li> - <?php endif ?> - - <?php if ($project['nb_inactive_tasks'] > 0): ?> - <li><a href="?controller=project&action=tasks&project_id=<?= $project['id'] ?>"><?= t('%d closed tasks', $project['nb_inactive_tasks']) ?></a></li> - <?php endif ?> + <?php if (! empty($active_projects)): ?> + <h3><?= t('Active projects') ?></h3> + <ul class="project-listing"> + <?php foreach ($active_projects as $project): ?> + <li> + <a href="?controller=project&action=show&project_id=<?= $project['id'] ?>"><?= Helper\escape($project['name']) ?></a> + </li> + <?php endforeach ?> + </ul> + <?php endif ?> - <li><?= t('%d tasks in total', $project['nb_tasks']) ?></li> + <?php if (! empty($inactive_projects)): ?> + <h3><?= t('Inactive projects') ?></h3> + <ul class="project-listing"> + <?php foreach ($inactive_projects as $project): ?> + <li> + <a href="?controller=project&action=show&project_id=<?= $project['id'] ?>"><?= Helper\escape($project['name']) ?></a> + </li> + <?php endforeach ?> + </ul> + <?php endif ?> - <?php else: ?> - <li><?= t('no task for this project') ?></li> - <?php endif ?> - </ul> - </td> - <td> - <ul> - <?php foreach ($project['columns'] as $column): ?> - <li> - <span title="column_id=<?= $column['id'] ?>"><?= Helper\escape($column['title']) ?></span> (<?= $column['nb_active_tasks'] ?>) - </li> - <?php endforeach ?> - </ul> - </td> - <?php if (Helper\is_admin()): ?> - <td> - <ul> - <li> - <a href="?controller=category&action=index&project_id=<?= $project['id'] ?>"><?= t('Categories') ?></a> - </li> - <li> - <a href="?controller=project&action=edit&project_id=<?= $project['id'] ?>"><?= t('Edit project') ?></a> - </li> - <li> - <a href="?controller=project&action=users&project_id=<?= $project['id'] ?>"><?= t('Edit users access') ?></a> - </li> - <li> - <a href="?controller=board&action=edit&project_id=<?= $project['id'] ?>"><?= t('Edit board') ?></a> - </li> - <li> - <a href="?controller=action&action=index&project_id=<?= $project['id'] ?>"><?= t('Automatic actions') ?></a> - </li> - <li> - <?php if ($project['is_active']): ?> - <a href="?controller=project&action=disable&project_id=<?= $project['id'].Helper\param_csrf() ?>"><?= t('Disable') ?></a> - <?php else: ?> - <a href="?controller=project&action=enable&project_id=<?= $project['id'].Helper\param_csrf() ?>"><?= t('Enable') ?></a> - <?php endif ?> - </li> - <li> - <a href="?controller=project&action=confirm&project_id=<?= $project['id'] ?>"><?= t('Remove') ?></a> - </li> - <li> - <a href="?controller=board&action=readonly&token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a> - </li> - <li> - <a href="?controller=project&action=export&project_id=<?= $project['id'] ?>"><?= t('Tasks Export') ?></a> - </li> - <li> - <a href="?controller=project&action=duplicate&project_id=<?= $project['id'].Helper\param_csrf() ?>"><?= t('Clone Project') ?></a> - </li> - </ul> - </td> - <?php endif ?> - </tr> - <?php endforeach ?> - </table> <?php endif ?> </section> </section>
\ No newline at end of file diff --git a/app/Templates/project_layout.php b/app/Templates/project_layout.php new file mode 100644 index 00000000..c8cc9236 --- /dev/null +++ b/app/Templates/project_layout.php @@ -0,0 +1,17 @@ +<section id="main"> + <div class="page-header"> + <h2><?= t('Project "%s"', $project['name']) ?></h2> + <ul> + <li><a href="?controller=board&action=show&project_id=<?= $project['id'] ?>"><?= t('Back to the board') ?></a></li> + <li><a href="?controller=project"><?= t('All projects') ?></a></li> + </ul> + </div> + <section class="project-show" id="project-section"> + + <?= Helper\template('project_sidebar', array('project' => $project)) ?> + + <div class="project-show-main"> + <?= $project_content_for_layout ?> + </div> + </section> +</section>
\ No newline at end of file diff --git a/app/Templates/project_remove.php b/app/Templates/project_remove.php index e25efa2f..00771b5f 100644 --- a/app/Templates/project_remove.php +++ b/app/Templates/project_remove.php @@ -1,16 +1,14 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Remove project') ?></h2> - </div> +<div class="page-header"> + <h2><?= t('Remove project') ?></h2> +</div> - <div class="confirm"> - <p class="alert alert-info"> - <?= t('Do you really want to remove this project: "%s"?', $project['name']) ?> - </p> +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to remove this project: "%s"?', $project['name']) ?> + </p> - <div class="form-actions"> - <a href="?controller=project&action=remove&project_id=<?= $project['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> - <?= t('or') ?> <a href="?controller=project"><?= t('cancel') ?></a> - </div> + <div class="form-actions"> + <a href="?controller=project&action=remove&project_id=<?= $project['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=project&action=show&project_id=<?= $project['id'] ?>"><?= t('cancel') ?></a> </div> -</section>
\ No newline at end of file +</div>
\ No newline at end of file diff --git a/app/Templates/project_share.php b/app/Templates/project_share.php new file mode 100644 index 00000000..62e05b73 --- /dev/null +++ b/app/Templates/project_share.php @@ -0,0 +1,18 @@ +<div class="page-header"> + <h2><?= t('Public access') ?></h2> +</div> + +<?php if ($project['is_public']): ?> + + <div class="settings"> + <strong><a href="?controller=board&action=readonly&token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></strong><br/> + <input type="text" readonly="readonly" value="<?= Helper\get_current_base_url() ?>?controller=board&action=readonly&token=<?= $project['token'] ?>"/> + </div> + + <a href="?controller=project&action=disablePublic&project_id=<?= $project['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Disable public access') ?></a> + +<?php else: ?> + + <a href="?controller=project&action=enablePublic&project_id=<?= $project['id'].Helper\param_csrf() ?>" class="btn btn-blue"><?= t('Enable public access') ?></a> + +<?php endif ?> diff --git a/app/Templates/project_show.php b/app/Templates/project_show.php new file mode 100644 index 00000000..12b0ae64 --- /dev/null +++ b/app/Templates/project_show.php @@ -0,0 +1,50 @@ +<div class="page-header"> + <h2><?= t('Summary') ?></h2> +</div> +<ul class="settings"> + <li><strong><?= $project['is_active'] ? t('Active') : t('Inactive') ?></strong></li> + + <?php if ($project['is_public']): ?> + <li><a href="?controller=board&action=readonly&token=<?= $project['token'] ?>" target="_blank"><?= t('Public link') ?></a></li> + <?php else: ?> + <li><?= t('Public access disabled') ?></li> + <?php endif ?> + + <?php if ($project['last_modified']): ?> + <li><?= dt('Last modified on %B %e, %Y at %k:%M %p', $project['last_modified']) ?></li> + <?php endif ?> + + <?php if ($stats['nb_tasks'] > 0): ?> + + <?php if ($stats['nb_active_tasks'] > 0): ?> + <li><a href="?controller=board&action=show&project_id=<?= $project['id'] ?>"><?= t('%d tasks on the board', $stats['nb_active_tasks']) ?></a></li> + <?php endif ?> + + <?php if ($stats['nb_inactive_tasks'] > 0): ?> + <li><a href="?controller=project&action=tasks&project_id=<?= $project['id'] ?>"><?= t('%d closed tasks', $stats['nb_inactive_tasks']) ?></a></li> + <?php endif ?> + + <li><?= t('%d tasks in total', $stats['nb_tasks']) ?></li> + + <?php else: ?> + <li><?= t('No task for this project') ?></li> + <?php endif ?> +</ul> + +<div class="page-header"> + <h2><?= t('Board') ?></h2> +</div> +<table class="table-stripped"> + <tr> + <th width="50%"><?= t('Column') ?></th> + <th><?= t('Task limit') ?></th> + <th><?= t('Active tasks') ?></th> + </tr> + <?php foreach ($stats['columns'] as $column): ?> + <tr> + <td><?= Helper\escape($column['title']) ?></td> + <td><?= $column['task_limit'] ?: '∞' ?></td> + <td><?= $column['nb_active_tasks'] ?></td> + </tr> + <?php endforeach ?> +</table> diff --git a/app/Templates/project_sidebar.php b/app/Templates/project_sidebar.php new file mode 100644 index 00000000..d711e347 --- /dev/null +++ b/app/Templates/project_sidebar.php @@ -0,0 +1,47 @@ +<div class="project-show-sidebar"> + <h2><?= t('Actions') ?></h2> + <div class="project-show-actions"> + <ul> + <li> + <a href="?controller=project&action=show&project_id=<?= $project['id'] ?>"><?= t('Summary') ?></a> + </li> + <li> + <a href="?controller=project&action=export&project_id=<?= $project['id'] ?>"><?= t('Tasks Export') ?></a> + </li> + + <?php if (Helper\is_admin()): ?> + <li> + <a href="?controller=project&action=share&project_id=<?= $project['id'] ?>"><?= t('Public access') ?></a> + </li> + <li> + <a href="?controller=project&action=edit&project_id=<?= $project['id'] ?>"><?= t('Edit project') ?></a> + </li> + <li> + <a href="?controller=board&action=edit&project_id=<?= $project['id'] ?>"><?= t('Edit board') ?></a> + </li> + <li> + <a href="?controller=category&action=index&project_id=<?= $project['id'] ?>"><?= t('Categories management') ?></a> + </li> + <li> + <a href="?controller=project&action=users&project_id=<?= $project['id'] ?>"><?= t('Users management') ?></a> + </li> + <li> + <a href="?controller=action&action=index&project_id=<?= $project['id'] ?>"><?= t('Automatic actions') ?></a> + </li> + <li> + <a href="?controller=project&action=confirmDuplicate&project_id=<?= $project['id'].Helper\param_csrf() ?>"><?= t('Duplicate') ?></a> + </li> + <li> + <?php if ($project['is_active']): ?> + <a href="?controller=project&action=confirmDisable&project_id=<?= $project['id'].Helper\param_csrf() ?>"><?= t('Disable') ?></a> + <?php else: ?> + <a href="?controller=project&action=confirmEnable&project_id=<?= $project['id'].Helper\param_csrf() ?>"><?= t('Enable') ?></a> + <?php endif ?> + </li> + <li> + <a href="?controller=project&action=confirmRemove&project_id=<?= $project['id'] ?>"><?= t('Remove') ?></a> + </li> + <?php endif ?> + </ul> + </div> +</div>
\ No newline at end of file diff --git a/app/Templates/project_users.php b/app/Templates/project_users.php index 8afac709..dca3524f 100644 --- a/app/Templates/project_users.php +++ b/app/Templates/project_users.php @@ -1,46 +1,36 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Project access list for "%s"', $project['name']) ?></h2> - <ul> - <li><a href="?controller=project"><?= t('All projects') ?></a></li> - </ul> - </div> - <section> +<div class="page-header"> + <h2><?= t('List of authorized users') ?></h2> +</div> - <?php if (! empty($users['not_allowed'])): ?> - <form method="post" action="?controller=project&action=allow&project_id=<?= $project['id'] ?>" autocomplete="off"> +<?php if (empty($users['allowed'])): ?> + <div class="alert alert-info"><?= t('Everybody have access to this project.') ?></div> +<?php else: ?> +<div class="listing"> + <p><?= t('Only those users have access to this project:') ?></p> + <ul> + <?php foreach ($users['allowed'] as $user_id => $username): ?> + <li> + <strong><?= Helper\escape($username) ?></strong> + (<a href="?controller=project&action=revoke&project_id=<?= $project['id'] ?>&user_id=<?= $user_id.Helper\param_csrf() ?>"><?= t('revoke') ?></a>) + </li> + <?php endforeach ?> + </ul> + <p><?= t('Don\'t forget that administrators have access to everything.') ?></p> +</div> +<?php endif ?> - <?= Helper\form_csrf() ?> +<?php if (! empty($users['not_allowed'])): ?> + <form method="post" action="?controller=project&action=allow&project_id=<?= $project['id'] ?>" autocomplete="off"> - <?= Helper\form_hidden('project_id', array('project_id' => $project['id'])) ?> + <?= Helper\form_csrf() ?> - <?= Helper\form_label(t('User'), 'user_id') ?> - <?= Helper\form_select('user_id', $users['not_allowed']) ?><br/> + <?= Helper\form_hidden('project_id', array('project_id' => $project['id'])) ?> - <div class="form-actions"> - <input type="submit" value="<?= t('Allow this user') ?>" class="btn btn-blue"/> - <?= t('or') ?> <a href="?controller=project"><?= t('cancel') ?></a> - </div> - </form> - <?php endif ?> + <?= Helper\form_label(t('User'), 'user_id') ?> + <?= Helper\form_select('user_id', $users['not_allowed']) ?><br/> - <h3><?= t('List of authorized users') ?></h3> - <?php if (empty($users['allowed'])): ?> - <div class="alert alert-info"><?= t('Everybody have access to this project.') ?></div> - <?php else: ?> - <div class="listing"> - <p><?= t('Only those users have access to this project:') ?></p> - <ul> - <?php foreach ($users['allowed'] as $user_id => $username): ?> - <li> - <strong><?= Helper\escape($username) ?></strong> - (<a href="?controller=project&action=revoke&project_id=<?= $project['id'] ?>&user_id=<?= $user_id.Helper\param_csrf() ?>"><?= t('revoke') ?></a>) - </li> - <?php endforeach ?> - </ul> - <p><?= t('Don\'t forget that administrators have access to everything.') ?></p> - </div> - <?php endif ?> - - </section> -</section>
\ No newline at end of file + <div class="form-actions"> + <input type="submit" value="<?= t('Allow this user') ?>" class="btn btn-blue"/> + </div> + </form> +<?php endif ?>
\ No newline at end of file |