From 9194a2604d79ef97994d01c35fb454f745b5412c Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 30 Aug 2014 14:08:46 -0800 Subject: Projects management refactoring --- app/Controller/Action.php | 35 +-- app/Controller/Base.php | 16 ++ app/Controller/Board.php | 37 ++- app/Controller/Category.php | 10 +- app/Controller/Project.php | 435 +++++++++++++++++++++++------------- app/Locales/de_DE/translations.php | 16 +- app/Locales/es_ES/translations.php | 16 +- app/Locales/fi_FI/translations.php | 16 +- app/Locales/fr_FR/translations.php | 18 +- app/Locales/it_IT/translations.php | 16 +- app/Locales/pl_PL/translations.php | 16 +- app/Locales/pt_BR/translations.php | 16 +- app/Locales/sv_SE/translations.php | 16 +- app/Locales/zh_CN/translations.php | 16 +- app/Model/Acl.php | 2 +- app/Model/Project.php | 98 +++++--- app/Schema/Mysql.php | 7 +- app/Schema/Postgres.php | 7 +- app/Schema/Sqlite.php | 20 +- app/Templates/action_index.php | 127 +++++------ app/Templates/action_params.php | 72 +++--- app/Templates/action_remove.php | 24 +- app/Templates/board_edit.php | 116 +++++----- app/Templates/board_remove.php | 26 +-- app/Templates/category_edit.php | 34 ++- app/Templates/category_index.php | 80 +++---- app/Templates/project_disable.php | 14 ++ app/Templates/project_duplicate.php | 14 ++ app/Templates/project_edit.php | 34 ++- app/Templates/project_enable.php | 14 ++ app/Templates/project_export.php | 45 ++-- app/Templates/project_index.php | 109 ++------- app/Templates/project_layout.php | 17 ++ app/Templates/project_remove.php | 24 +- app/Templates/project_share.php | 18 ++ app/Templates/project_show.php | 50 +++++ app/Templates/project_sidebar.php | 47 ++++ app/Templates/project_users.php | 70 +++--- 38 files changed, 1025 insertions(+), 723 deletions(-) create mode 100644 app/Templates/project_disable.php create mode 100644 app/Templates/project_duplicate.php create mode 100644 app/Templates/project_enable.php create mode 100644 app/Templates/project_layout.php create mode 100644 app/Templates/project_share.php create mode 100644 app/Templates/project_show.php create mode 100644 app/Templates/project_sidebar.php (limited to 'app') 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 @@ -211,6 +211,22 @@ abstract class Base return $this->template->layout('task_layout', $params); } + /** + * 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 * 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,24 +301,57 @@ 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 * @@ -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; } @@ -382,6 +359,31 @@ class Project extends Base return $this->filterListByAccess($this->getListByStatus(self::ACTIVE), $user_id); } + /** + * 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. * @@ -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(); @@ -591,6 +593,36 @@ class Project extends Base ->save(array('is_active' => 0)); } + /** + * 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 * 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 @@ -
- -
+ - + -

- - - - - - - +

+
+ + + + + + - - - - - - - - + + + + + + + + -
-
    - -
  • - = - - - - - - - - - - - - - -
  • - -
-
- -
+
    + +
  • + = + + + + + + + + + + + + + +
  • + +
+
+ +
+ - + -

-
- - +

+ + + - -
+ +
- -
+ +
-
- -
+
+ +
-
- -
-
-
-
\ No newline at end of file +
+ +
+ \ 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 @@ -
- -
+ +
-

-
- - - - +

+ + + + + - $param_desc): ?> + $param_desc): ?> - - -
- - -
- - -
- - -
- - -
- - + + +
+ + +
+ + +
+ + +
+ + +
+ + -
- - -
-
-
-
\ No newline at end of file +
+ + +
+ \ 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 @@ -
- + -
-

- -

+
+

+ +

-
- - -
+
+ +
-
\ No newline at end of file + \ 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 @@ -
- -
+ +
-

-
- - - - - - - - - - - - - - - - - -
-
    - -
  • - -
  • - - -
  • - -
  • - -
  • - -
  • -
-
+

+ + + + + + + + + + + + + + + + + + +
+
    + +
  • + +
  • + + +
  • + +
  • + +
  • + +
  • +
+
-
- - -
-
+
+ +
+ -

-
- - - - +

+ + + + + -
- - -
-
-
-
\ No newline at end of file +
+ +
+ \ 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 @@ -
- + -
-

- - -

+
+

+ + +

-
- - -
+
+ +
-
\ No newline at end of file + \ 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 @@ -
- -
- -
- - - + - - + + + + -
- -
-
+ + -
-
\ No newline at end of file +
+ +
+ \ 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 @@ -
- -
- - - - - - - - $category_name): ?> - - - - - -
-
    -
  • - -
  • -
  • - -
  • -
-
- + -

-
+ + + + + + + $category_name): ?> + + + + + +
+
    +
  • + +
  • +
  • + +
  • +
+
+ - - +

+ - - + + -
- -
-
+ + -
-
\ No newline at end of file +
+ +
+ \ 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 @@ + + +
+

+ +

+ +
+ + +
+
\ 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 @@ + + +
+

+ +

+ +
+ + +
+
\ 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 @@ -
- -
-
+ + - - + + - - + + -
+
-
- - -
-
-
-
\ No newline at end of file +
+ +
+ \ 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 @@ + + +
+

+ +

+ +
+ + +
+
\ 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 @@ -
- -
- -
+ - - - + - -
+ + + - - + +
-
+ + -
- -
-
+
-
-
\ No newline at end of file +
+ +
+ \ 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 @@
- +

- - - - - - - - - - - - - - - - - - - - - -
- - - - -
    - 0): ?> - - 0): ?> -
  • - - - 0): ?> -
  • - + +

    +
      + +
    • + +
    • + +
    + -
  • + +

    +
      + +
    • + +
    • + +
    + - -
  • - -
-
-
    - -
  • - () -
  • - -
-
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - - - - - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
\ 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 @@ +
+ +
+ + $project)) ?> + +
+ +
+
+
\ 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 @@ -
- + -
-

- -

+
+

+ +

-
- - -
+
+ +
-
\ No newline at end of file + \ 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 @@ + + + + +
+
+ +
+ + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + +
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 @@ +
+

+
+
    +
  • + +
  • +
  • + +
  • + + +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + + + + + +
  • +
  • + +
  • + +
+
+
\ 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 @@ -
- -
+ - -
+ +
+ +
+

+
    + $username): ?> +
  • + + () +
  • + +
+

+
+ - + + - $project['id'])) ?> + - -
+ $project['id'])) ?> -
- - -
-
- + +
-

- -
- -
-

-
    - $username): ?> -
  • - - () -
  • - -
-

-
- - -
-
\ No newline at end of file +
+ +
+ + \ No newline at end of file -- cgit v1.2.3