From 1353929a7dbd3f2e897fa7d3ab88e959ca573f9f Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Sat, 28 May 2016 13:41:54 -0400
Subject: Rename controllers
---
app/Api/BaseApi.php | 4 +-
app/Controller/Action.php | 77 -----
app/Controller/ActionController.php | 77 +++++
app/Controller/ActionCreation.php | 122 --------
app/Controller/ActionCreationController.php | 122 ++++++++
app/Controller/ActionProject.php | 38 ---
app/Controller/Activity.php | 45 ---
app/Controller/ActivityController.php | 45 +++
app/Controller/Analytic.php | 178 ------------
app/Controller/AnalyticController.php | 178 ++++++++++++
app/Controller/AppController.php | 1 +
app/Controller/Auth.php | 83 ------
app/Controller/AuthController.php | 83 ++++++
app/Controller/BoardPopover.php | 47 ---
app/Controller/BoardPopoverController.php | 47 +++
app/Controller/BoardTooltip.php | 127 ---------
app/Controller/BoardTooltipController.php | 127 +++++++++
app/Controller/Calendar.php | 107 -------
app/Controller/CalendarController.php | 107 +++++++
app/Controller/Category.php | 159 -----------
app/Controller/CategoryController.php | 159 +++++++++++
app/Controller/Column.php | 178 ------------
app/Controller/ColumnController.php | 178 ++++++++++++
app/Controller/Comment.php | 191 -------------
app/Controller/CommentController.php | 191 +++++++++++++
app/Controller/CustomFilterController.php | 165 +++++++++++
app/Controller/Customfilter.php | 164 -----------
app/Controller/Export.php | 91 ------
app/Controller/ExportController.php | 91 ++++++
app/Controller/FileViewer.php | 136 ---------
app/Controller/FileViewerController.php | 136 +++++++++
app/Controller/Link.php | 150 ----------
app/Controller/LinkController.php | 150 ++++++++++
app/Controller/Listing.php | 45 ---
app/Controller/OAuthController.php | 130 +++++++++
app/Controller/Oauth.php | 130 ---------
app/Controller/PasswordReset.php | 122 --------
app/Controller/PasswordResetController.php | 122 ++++++++
.../ProjectActionDuplicationController.php | 38 +++
app/Controller/ProjectCreation.php | 129 ---------
app/Controller/ProjectCreationController.php | 129 +++++++++
app/Controller/ProjectEditController.php | 4 +-
app/Controller/ProjectFile.php | 79 ------
app/Controller/ProjectFileController.php | 79 ++++++
app/Controller/ProjectOverview.php | 32 ---
app/Controller/ProjectOverviewController.php | 32 +++
app/Controller/ProjectUserOverviewController.php | 130 +++++++++
app/Controller/Projectuser.php | 130 ---------
app/Controller/Swimlane.php | 314 ---------------------
app/Controller/SwimlaneController.php | 314 +++++++++++++++++++++
app/Controller/TaskBulkController.php | 1 +
app/Controller/TaskDuplicationController.php | 141 +++++++++
app/Controller/TaskExternalLink.php | 178 ------------
app/Controller/TaskExternalLinkController.php | 178 ++++++++++++
app/Controller/TaskFile.php | 98 -------
app/Controller/TaskFileController.php | 98 +++++++
app/Controller/TaskListController.php | 45 +++
app/Controller/Taskduplication.php | 141 ---------
app/Helper/LayoutHelper.php | 2 +-
app/Middleware/AuthenticationMiddleware.php | 2 +-
app/Middleware/PostAuthenticationMiddleware.php | 2 +-
app/ServiceProvider/AuthenticationProvider.php | 45 ++-
app/ServiceProvider/RouteProvider.php | 70 ++---
app/Template/action/index.php | 8 +-
app/Template/action/remove.php | 6 +-
app/Template/action_creation/create.php | 6 +-
app/Template/action_creation/event.php | 6 +-
app/Template/action_creation/params.php | 4 +-
app/Template/action_project/project.php | 20 --
app/Template/activity/project.php | 2 +-
app/Template/analytic/burndown.php | 2 +-
app/Template/analytic/cfd.php | 2 +-
app/Template/analytic/layout.php | 2 +-
app/Template/analytic/lead_cycle_time.php | 2 +-
app/Template/analytic/sidebar.php | 32 +--
app/Template/auth/index.php | 4 +-
app/Template/board/table_column.php | 2 +-
app/Template/board/table_swimlane.php | 2 +-
app/Template/board/task_footer.php | 16 +-
app/Template/board/tooltip_files.php | 4 +-
.../board_popover/close_all_tasks_column.php | 4 +-
app/Template/calendar/show.php | 8 +-
app/Template/category/edit.php | 6 +-
app/Template/category/index.php | 8 +-
app/Template/category/remove.php | 6 +-
app/Template/column/create.php | 4 +-
app/Template/column/edit.php | 6 +-
app/Template/column/index.php | 8 +-
app/Template/column/remove.php | 6 +-
app/Template/comment/create.php | 2 +-
app/Template/comment/edit.php | 2 +-
app/Template/comment/remove.php | 2 +-
app/Template/comment/show.php | 4 +-
app/Template/comments/create.php | 2 +-
app/Template/comments/show.php | 4 +-
app/Template/config/sidebar.php | 4 +-
app/Template/custom_filter/add.php | 2 +-
app/Template/custom_filter/edit.php | 4 +-
app/Template/custom_filter/index.php | 6 +-
app/Template/custom_filter/remove.php | 4 +-
app/Template/dashboard/calendar.php | 4 +-
app/Template/dashboard/layout.php | 6 +-
app/Template/dashboard/projects.php | 4 +-
app/Template/export/sidebar.php | 10 +-
app/Template/file_viewer/show.php | 4 +-
app/Template/gantt/projects.php | 4 +-
app/Template/header.php | 10 +-
app/Template/layout.php | 2 +-
app/Template/link/create.php | 4 +-
app/Template/link/edit.php | 4 +-
app/Template/link/index.php | 6 +-
app/Template/link/remove.php | 6 +-
app/Template/listing/show.php | 62 ----
app/Template/password_reset/change.php | 4 +-
app/Template/password_reset/create.php | 2 +-
app/Template/password_reset/email.php | 4 +-
app/Template/project/dropdown.php | 10 +-
app/Template/project/layout.php | 4 +-
app/Template/project/sidebar.php | 20 +-
app/Template/project_action_duplication/show.php | 19 ++
app/Template/project_creation/create.php | 2 +-
app/Template/project_edit/general.php | 2 +-
app/Template/project_file/create.php | 6 +-
app/Template/project_file/remove.php | 6 +-
app/Template/project_header/dropdown.php | 14 +-
app/Template/project_header/views.php | 18 +-
app/Template/project_list/show.php | 10 +-
app/Template/project_overview/attachments.php | 4 +-
app/Template/project_overview/files.php | 8 +-
app/Template/project_overview/images.php | 8 +-
app/Template/project_overview/show.php | 2 +-
app/Template/project_user/layout.php | 27 --
app/Template/project_user/roles.php | 33 ---
app/Template/project_user/sidebar.php | 30 --
app/Template/project_user/tasks.php | 46 ---
app/Template/project_user/tooltip_users.php | 16 --
app/Template/project_user_overview/layout.php | 27 ++
app/Template/project_user_overview/roles.php | 33 +++
app/Template/project_user_overview/sidebar.php | 30 ++
app/Template/project_user_overview/tasks.php | 46 +++
.../project_user_overview/tooltip_users.php | 16 ++
app/Template/project_view/show.php | 2 +-
app/Template/swimlane/create.php | 4 +-
app/Template/swimlane/edit.php | 6 +-
app/Template/swimlane/edit_default.php | 4 +-
app/Template/swimlane/index.php | 2 +-
app/Template/swimlane/remove.php | 6 +-
app/Template/swimlane/table.php | 16 +-
app/Template/task/dropdown.php | 10 +-
app/Template/task/layout.php | 4 +-
app/Template/task/show.php | 2 +-
app/Template/task/sidebar.php | 18 +-
app/Template/task_duplication/copy.php | 4 +-
app/Template/task_duplication/duplicate.php | 2 +-
app/Template/task_duplication/move.php | 4 +-
app/Template/task_external_link/create.php | 6 +-
app/Template/task_external_link/edit.php | 6 +-
app/Template/task_external_link/find.php | 2 +-
app/Template/task_external_link/remove.php | 6 +-
app/Template/task_external_link/table.php | 8 +-
app/Template/task_file/create.php | 2 +-
app/Template/task_file/files.php | 10 +-
app/Template/task_file/images.php | 10 +-
app/Template/task_file/remove.php | 2 +-
app/Template/task_file/screenshot.php | 2 +-
app/Template/task_list/show.php | 62 ++++
tests/units/Helper/UserHelperTest.php | 46 +--
167 files changed, 3874 insertions(+), 3871 deletions(-)
delete mode 100644 app/Controller/Action.php
create mode 100644 app/Controller/ActionController.php
delete mode 100644 app/Controller/ActionCreation.php
create mode 100644 app/Controller/ActionCreationController.php
delete mode 100644 app/Controller/ActionProject.php
delete mode 100644 app/Controller/Activity.php
create mode 100644 app/Controller/ActivityController.php
delete mode 100644 app/Controller/Analytic.php
create mode 100644 app/Controller/AnalyticController.php
delete mode 100644 app/Controller/Auth.php
create mode 100644 app/Controller/AuthController.php
delete mode 100644 app/Controller/BoardPopover.php
create mode 100644 app/Controller/BoardPopoverController.php
delete mode 100644 app/Controller/BoardTooltip.php
create mode 100644 app/Controller/BoardTooltipController.php
delete mode 100644 app/Controller/Calendar.php
create mode 100644 app/Controller/CalendarController.php
delete mode 100644 app/Controller/Category.php
create mode 100644 app/Controller/CategoryController.php
delete mode 100644 app/Controller/Column.php
create mode 100644 app/Controller/ColumnController.php
delete mode 100644 app/Controller/Comment.php
create mode 100644 app/Controller/CommentController.php
create mode 100644 app/Controller/CustomFilterController.php
delete mode 100644 app/Controller/Customfilter.php
delete mode 100644 app/Controller/Export.php
create mode 100644 app/Controller/ExportController.php
delete mode 100644 app/Controller/FileViewer.php
create mode 100644 app/Controller/FileViewerController.php
delete mode 100644 app/Controller/Link.php
create mode 100644 app/Controller/LinkController.php
delete mode 100644 app/Controller/Listing.php
create mode 100644 app/Controller/OAuthController.php
delete mode 100644 app/Controller/Oauth.php
delete mode 100644 app/Controller/PasswordReset.php
create mode 100644 app/Controller/PasswordResetController.php
create mode 100644 app/Controller/ProjectActionDuplicationController.php
delete mode 100644 app/Controller/ProjectCreation.php
create mode 100644 app/Controller/ProjectCreationController.php
delete mode 100644 app/Controller/ProjectFile.php
create mode 100644 app/Controller/ProjectFileController.php
delete mode 100644 app/Controller/ProjectOverview.php
create mode 100644 app/Controller/ProjectOverviewController.php
create mode 100644 app/Controller/ProjectUserOverviewController.php
delete mode 100644 app/Controller/Projectuser.php
delete mode 100644 app/Controller/Swimlane.php
create mode 100644 app/Controller/SwimlaneController.php
create mode 100644 app/Controller/TaskDuplicationController.php
delete mode 100644 app/Controller/TaskExternalLink.php
create mode 100644 app/Controller/TaskExternalLinkController.php
delete mode 100644 app/Controller/TaskFile.php
create mode 100644 app/Controller/TaskFileController.php
create mode 100644 app/Controller/TaskListController.php
delete mode 100644 app/Controller/Taskduplication.php
delete mode 100644 app/Template/action_project/project.php
delete mode 100644 app/Template/listing/show.php
create mode 100644 app/Template/project_action_duplication/show.php
delete mode 100644 app/Template/project_user/layout.php
delete mode 100644 app/Template/project_user/roles.php
delete mode 100644 app/Template/project_user/sidebar.php
delete mode 100644 app/Template/project_user/tasks.php
delete mode 100644 app/Template/project_user/tooltip_users.php
create mode 100644 app/Template/project_user_overview/layout.php
create mode 100644 app/Template/project_user_overview/roles.php
create mode 100644 app/Template/project_user_overview/sidebar.php
create mode 100644 app/Template/project_user_overview/tasks.php
create mode 100644 app/Template/project_user_overview/tooltip_users.php
create mode 100644 app/Template/task_list/show.php
diff --git a/app/Api/BaseApi.php b/app/Api/BaseApi.php
index d8c46fd5..5de7f527 100644
--- a/app/Api/BaseApi.php
+++ b/app/Api/BaseApi.php
@@ -98,8 +98,8 @@ abstract class BaseApi extends Base
if (! empty($project)) {
$project['url'] = array(
'board' => $this->helper->url->to('board', 'show', array('project_id' => $project['id']), '', true),
- 'calendar' => $this->helper->url->to('calendar', 'show', array('project_id' => $project['id']), '', true),
- 'list' => $this->helper->url->to('listing', 'show', array('project_id' => $project['id']), '', true),
+ 'calendar' => $this->helper->url->to('CalendarController', 'show', array('project_id' => $project['id']), '', true),
+ 'list' => $this->helper->url->to('TaskListController', 'show', array('project_id' => $project['id']), '', true),
);
}
diff --git a/app/Controller/Action.php b/app/Controller/Action.php
deleted file mode 100644
index 40497a62..00000000
--- a/app/Controller/Action.php
+++ /dev/null
@@ -1,77 +0,0 @@
-getProject();
- $actions = $this->action->getAllByProject($project['id']);
-
- $this->response->html($this->helper->layout->project('action/index', array(
- 'values' => array('project_id' => $project['id']),
- 'project' => $project,
- 'actions' => $actions,
- 'available_actions' => $this->actionManager->getAvailableActions(),
- 'available_events' => $this->eventManager->getAll(),
- 'available_params' => $this->actionManager->getAvailableParameters($actions),
- 'columns_list' => $this->column->getList($project['id']),
- 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']),
- 'projects_list' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
- 'colors_list' => $this->color->getList(),
- 'categories_list' => $this->category->getList($project['id']),
- 'links_list' => $this->link->getList(0, false),
- 'title' => t('Automatic actions')
- )));
- }
-
- /**
- * Confirmation dialog before removing an action
- *
- * @access public
- */
- public function confirm()
- {
- $project = $this->getProject();
-
- $this->response->html($this->helper->layout->project('action/remove', array(
- 'action' => $this->action->getById($this->request->getIntegerParam('action_id')),
- 'available_events' => $this->eventManager->getAll(),
- 'available_actions' => $this->actionManager->getAvailableActions(),
- 'project' => $project,
- 'title' => t('Remove an action')
- )));
- }
-
- /**
- * Remove an action
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
- $action = $this->action->getById($this->request->getIntegerParam('action_id'));
-
- if (! empty($action) && $this->action->remove($action['id'])) {
- $this->flash->success(t('Action removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this action.'));
- }
-
- $this->response->redirect($this->helper->url->to('action', 'index', array('project_id' => $project['id'])));
- }
-}
diff --git a/app/Controller/ActionController.php b/app/Controller/ActionController.php
new file mode 100644
index 00000000..51090d22
--- /dev/null
+++ b/app/Controller/ActionController.php
@@ -0,0 +1,77 @@
+getProject();
+ $actions = $this->action->getAllByProject($project['id']);
+
+ $this->response->html($this->helper->layout->project('action/index', array(
+ 'values' => array('project_id' => $project['id']),
+ 'project' => $project,
+ 'actions' => $actions,
+ 'available_actions' => $this->actionManager->getAvailableActions(),
+ 'available_events' => $this->eventManager->getAll(),
+ 'available_params' => $this->actionManager->getAvailableParameters($actions),
+ 'columns_list' => $this->column->getList($project['id']),
+ 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']),
+ 'projects_list' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
+ 'colors_list' => $this->color->getList(),
+ 'categories_list' => $this->category->getList($project['id']),
+ 'links_list' => $this->link->getList(0, false),
+ 'title' => t('Automatic actions')
+ )));
+ }
+
+ /**
+ * Confirmation dialog before removing an action
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->helper->layout->project('action/remove', array(
+ 'action' => $this->action->getById($this->request->getIntegerParam('action_id')),
+ 'available_events' => $this->eventManager->getAll(),
+ 'available_actions' => $this->actionManager->getAvailableActions(),
+ 'project' => $project,
+ 'title' => t('Remove an action')
+ )));
+ }
+
+ /**
+ * Remove an action
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+ $action = $this->action->getById($this->request->getIntegerParam('action_id'));
+
+ if (! empty($action) && $this->action->remove($action['id'])) {
+ $this->flash->success(t('Action removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this action.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
+ }
+}
diff --git a/app/Controller/ActionCreation.php b/app/Controller/ActionCreation.php
deleted file mode 100644
index 388b30e2..00000000
--- a/app/Controller/ActionCreation.php
+++ /dev/null
@@ -1,122 +0,0 @@
-getProject();
-
- $this->response->html($this->template->render('action_creation/create', array(
- 'project' => $project,
- 'values' => array('project_id' => $project['id']),
- 'available_actions' => $this->actionManager->getAvailableActions(),
- )));
- }
-
- /**
- * Choose the event according to the action (step 2)
- *
- * @access public
- */
- public function event()
- {
- $project = $this->getProject();
- $values = $this->request->getValues();
-
- if (empty($values['action_name']) || empty($values['project_id'])) {
- return $this->create();
- }
-
- $this->response->html($this->template->render('action_creation/event', array(
- 'values' => $values,
- 'project' => $project,
- 'available_actions' => $this->actionManager->getAvailableActions(),
- 'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
- )));
- }
-
- /**
- * Define action parameters (step 3)
- *
- * @access public
- */
- public function params()
- {
- $project = $this->getProject();
- $values = $this->request->getValues();
-
- if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
- return $this->create();
- }
-
- $action = $this->actionManager->getAction($values['action_name']);
- $action_params = $action->getActionRequiredParameters();
-
- if (empty($action_params)) {
- $this->doCreation($project, $values + array('params' => array()));
- }
-
- $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
- unset($projects_list[$project['id']]);
-
- $this->response->html($this->template->render('action_creation/params', array(
- 'values' => $values,
- 'action_params' => $action_params,
- 'columns_list' => $this->column->getList($project['id']),
- 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']),
- 'projects_list' => $projects_list,
- 'colors_list' => $this->color->getList(),
- 'categories_list' => $this->category->getList($project['id']),
- 'links_list' => $this->link->getList(0, false),
- 'priorities_list' => $this->project->getPriorities($project),
- 'project' => $project,
- 'available_actions' => $this->actionManager->getAvailableActions(),
- 'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
- )));
- }
-
- /**
- * Save the action (last step)
- *
- * @access public
- */
- public function save()
- {
- $this->doCreation($this->getProject(), $this->request->getValues());
- }
-
- /**
- * Common method to save the action
- *
- * @access private
- * @param array $project Project properties
- * @param array $values Form values
- */
- private function doCreation(array $project, array $values)
- {
- list($valid, ) = $this->actionValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->action->create($values) !== false) {
- $this->flash->success(t('Your automatic action have been created successfully.'));
- } else {
- $this->flash->failure(t('Unable to create your automatic action.'));
- }
- }
-
- $this->response->redirect($this->helper->url->to('action', 'index', array('project_id' => $project['id'])));
- }
-}
diff --git a/app/Controller/ActionCreationController.php b/app/Controller/ActionCreationController.php
new file mode 100644
index 00000000..e055f11b
--- /dev/null
+++ b/app/Controller/ActionCreationController.php
@@ -0,0 +1,122 @@
+getProject();
+
+ $this->response->html($this->template->render('action_creation/create', array(
+ 'project' => $project,
+ 'values' => array('project_id' => $project['id']),
+ 'available_actions' => $this->actionManager->getAvailableActions(),
+ )));
+ }
+
+ /**
+ * Choose the event according to the action (step 2)
+ *
+ * @access public
+ */
+ public function event()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+
+ if (empty($values['action_name']) || empty($values['project_id'])) {
+ return $this->create();
+ }
+
+ $this->response->html($this->template->render('action_creation/event', array(
+ 'values' => $values,
+ 'project' => $project,
+ 'available_actions' => $this->actionManager->getAvailableActions(),
+ 'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
+ )));
+ }
+
+ /**
+ * Define action parameters (step 3)
+ *
+ * @access public
+ */
+ public function params()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+
+ if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
+ return $this->create();
+ }
+
+ $action = $this->actionManager->getAction($values['action_name']);
+ $action_params = $action->getActionRequiredParameters();
+
+ if (empty($action_params)) {
+ $this->doCreation($project, $values + array('params' => array()));
+ }
+
+ $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
+ unset($projects_list[$project['id']]);
+
+ $this->response->html($this->template->render('action_creation/params', array(
+ 'values' => $values,
+ 'action_params' => $action_params,
+ 'columns_list' => $this->column->getList($project['id']),
+ 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']),
+ 'projects_list' => $projects_list,
+ 'colors_list' => $this->color->getList(),
+ 'categories_list' => $this->category->getList($project['id']),
+ 'links_list' => $this->link->getList(0, false),
+ 'priorities_list' => $this->project->getPriorities($project),
+ 'project' => $project,
+ 'available_actions' => $this->actionManager->getAvailableActions(),
+ 'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
+ )));
+ }
+
+ /**
+ * Save the action (last step)
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $this->doCreation($this->getProject(), $this->request->getValues());
+ }
+
+ /**
+ * Common method to save the action
+ *
+ * @access private
+ * @param array $project Project properties
+ * @param array $values Form values
+ */
+ private function doCreation(array $project, array $values)
+ {
+ list($valid, ) = $this->actionValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->action->create($values) !== false) {
+ $this->flash->success(t('Your automatic action have been created successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to create your automatic action.'));
+ }
+ }
+
+ $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
+ }
+}
diff --git a/app/Controller/ActionProject.php b/app/Controller/ActionProject.php
deleted file mode 100644
index 10b3c9d4..00000000
--- a/app/Controller/ActionProject.php
+++ /dev/null
@@ -1,38 +0,0 @@
-getProject();
- $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
- unset($projects[$project['id']]);
-
- $this->response->html($this->template->render('action_project/project', array(
- 'project' => $project,
- 'projects_list' => $projects,
- )));
- }
-
- public function save()
- {
- $project = $this->getProject();
- $src_project_id = $this->request->getValue('src_project_id');
-
- if ($this->action->duplicate($src_project_id, $project['id'])) {
- $this->flash->success(t('Actions duplicated successfully.'));
- } else {
- $this->flash->failure(t('Unable to duplicate actions.'));
- }
-
- $this->response->redirect($this->helper->url->to('action', 'index', array('project_id' => $project['id'])));
- }
-}
diff --git a/app/Controller/Activity.php b/app/Controller/Activity.php
deleted file mode 100644
index 0c6aa3f3..00000000
--- a/app/Controller/Activity.php
+++ /dev/null
@@ -1,45 +0,0 @@
-getProject();
-
- $this->response->html($this->helper->layout->app('activity/project', array(
- 'events' => $this->helper->projectActivity->getProjectEvents($project['id']),
- 'project' => $project,
- 'title' => t('%s\'s activity', $project['name'])
- )));
- }
-
- /**
- * Display task activities
- *
- * @access public
- */
- public function task()
- {
- $task = $this->getTask();
-
- $this->response->html($this->helper->layout->task('activity/task', array(
- 'title' => $task['title'],
- 'task' => $task,
- 'project' => $this->project->getById($task['project_id']),
- 'events' => $this->helper->projectActivity->getTaskEvents($task['id']),
- )));
- }
-}
diff --git a/app/Controller/ActivityController.php b/app/Controller/ActivityController.php
new file mode 100644
index 00000000..a8fc1b39
--- /dev/null
+++ b/app/Controller/ActivityController.php
@@ -0,0 +1,45 @@
+getProject();
+
+ $this->response->html($this->helper->layout->app('activity/project', array(
+ 'events' => $this->helper->projectActivity->getProjectEvents($project['id']),
+ 'project' => $project,
+ 'title' => t('%s\'s activity', $project['name'])
+ )));
+ }
+
+ /**
+ * Display task activities
+ *
+ * @access public
+ */
+ public function task()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->helper->layout->task('activity/task', array(
+ 'title' => $task['title'],
+ 'task' => $task,
+ 'project' => $this->project->getById($task['project_id']),
+ 'events' => $this->helper->projectActivity->getTaskEvents($task['id']),
+ )));
+ }
+}
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php
deleted file mode 100644
index ba73c15c..00000000
--- a/app/Controller/Analytic.php
+++ /dev/null
@@ -1,178 +0,0 @@
-getProject();
- list($from, $to) = $this->getDates();
-
- $this->response->html($this->helper->layout->analytic('analytic/lead_cycle_time', array(
- 'values' => array(
- 'from' => $from,
- 'to' => $to,
- ),
- 'project' => $project,
- 'average' => $this->averageLeadCycleTimeAnalytic->build($project['id']),
- 'metrics' => $this->projectDailyStats->getRawMetrics($project['id'], $from, $to),
- 'date_format' => $this->config->get('application_date_format'),
- 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
- 'title' => t('Lead and Cycle time for "%s"', $project['name']),
- )));
- }
-
- /**
- * Show comparison between actual and estimated hours chart
- *
- * @access public
- */
- public function compareHours()
- {
- $project = $this->getProject();
-
- $paginator = $this->paginator
- ->setUrl('analytic', 'compareHours', array('project_id' => $project['id']))
- ->setMax(30)
- ->setOrder(TaskModel::TABLE.'.id')
- ->setQuery($this->taskQuery
- ->withFilter(new TaskProjectFilter($project['id']))
- ->getQuery()
- )
- ->calculate();
-
- $this->response->html($this->helper->layout->analytic('analytic/compare_hours', array(
- 'project' => $project,
- 'paginator' => $paginator,
- 'metrics' => $this->estimatedTimeComparisonAnalytic->build($project['id']),
- 'title' => t('Compare hours for "%s"', $project['name']),
- )));
- }
-
- /**
- * Show average time spent by column
- *
- * @access public
- */
- public function averageTimeByColumn()
- {
- $project = $this->getProject();
-
- $this->response->html($this->helper->layout->analytic('analytic/avg_time_columns', array(
- 'project' => $project,
- 'metrics' => $this->averageTimeSpentColumnAnalytic->build($project['id']),
- 'title' => t('Average time spent into each column for "%s"', $project['name']),
- )));
- }
-
- /**
- * Show tasks distribution graph
- *
- * @access public
- */
- public function tasks()
- {
- $project = $this->getProject();
-
- $this->response->html($this->helper->layout->analytic('analytic/tasks', array(
- 'project' => $project,
- 'metrics' => $this->taskDistributionAnalytic->build($project['id']),
- 'title' => t('Task repartition for "%s"', $project['name']),
- )));
- }
-
- /**
- * Show users repartition
- *
- * @access public
- */
- public function users()
- {
- $project = $this->getProject();
-
- $this->response->html($this->helper->layout->analytic('analytic/users', array(
- 'project' => $project,
- 'metrics' => $this->userDistributionAnalytic->build($project['id']),
- 'title' => t('User repartition for "%s"', $project['name']),
- )));
- }
-
- /**
- * Show cumulative flow diagram
- *
- * @access public
- */
- public function cfd()
- {
- $this->commonAggregateMetrics('analytic/cfd', 'total', 'Cumulative flow diagram for "%s"');
- }
-
- /**
- * Show burndown chart
- *
- * @access public
- */
- public function burndown()
- {
- $this->commonAggregateMetrics('analytic/burndown', 'score', 'Burndown chart for "%s"');
- }
-
- /**
- * Common method for CFD and Burdown chart
- *
- * @access private
- * @param string $template
- * @param string $column
- * @param string $title
- */
- private function commonAggregateMetrics($template, $column, $title)
- {
- $project = $this->getProject();
- list($from, $to) = $this->getDates();
-
- $display_graph = $this->projectDailyColumnStats->countDays($project['id'], $from, $to) >= 2;
-
- $this->response->html($this->helper->layout->analytic($template, array(
- 'values' => array(
- 'from' => $from,
- 'to' => $to,
- ),
- 'display_graph' => $display_graph,
- 'metrics' => $display_graph ? $this->projectDailyColumnStats->getAggregatedMetrics($project['id'], $from, $to, $column) : array(),
- 'project' => $project,
- 'date_format' => $this->config->get('application_date_format'),
- 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
- 'title' => t($title, $project['name']),
- )));
- }
-
- private function getDates()
- {
- $values = $this->request->getValues();
-
- $from = $this->request->getStringParam('from', date('Y-m-d', strtotime('-1week')));
- $to = $this->request->getStringParam('to', date('Y-m-d'));
-
- if (! empty($values)) {
- $from = $values['from'];
- $to = $values['to'];
- }
-
- return array($from, $to);
- }
-}
diff --git a/app/Controller/AnalyticController.php b/app/Controller/AnalyticController.php
new file mode 100644
index 00000000..99d34c66
--- /dev/null
+++ b/app/Controller/AnalyticController.php
@@ -0,0 +1,178 @@
+getProject();
+ list($from, $to) = $this->getDates();
+
+ $this->response->html($this->helper->layout->analytic('analytic/lead_cycle_time', array(
+ 'values' => array(
+ 'from' => $from,
+ 'to' => $to,
+ ),
+ 'project' => $project,
+ 'average' => $this->averageLeadCycleTimeAnalytic->build($project['id']),
+ 'metrics' => $this->projectDailyStats->getRawMetrics($project['id'], $from, $to),
+ 'date_format' => $this->config->get('application_date_format'),
+ 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
+ 'title' => t('Lead and Cycle time for "%s"', $project['name']),
+ )));
+ }
+
+ /**
+ * Show comparison between actual and estimated hours chart
+ *
+ * @access public
+ */
+ public function compareHours()
+ {
+ $project = $this->getProject();
+
+ $paginator = $this->paginator
+ ->setUrl('AnalyticController', 'compareHours', array('project_id' => $project['id']))
+ ->setMax(30)
+ ->setOrder(TaskModel::TABLE.'.id')
+ ->setQuery($this->taskQuery
+ ->withFilter(new TaskProjectFilter($project['id']))
+ ->getQuery()
+ )
+ ->calculate();
+
+ $this->response->html($this->helper->layout->analytic('analytic/compare_hours', array(
+ 'project' => $project,
+ 'paginator' => $paginator,
+ 'metrics' => $this->estimatedTimeComparisonAnalytic->build($project['id']),
+ 'title' => t('Compare hours for "%s"', $project['name']),
+ )));
+ }
+
+ /**
+ * Show average time spent by column
+ *
+ * @access public
+ */
+ public function averageTimeByColumn()
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->helper->layout->analytic('analytic/avg_time_columns', array(
+ 'project' => $project,
+ 'metrics' => $this->averageTimeSpentColumnAnalytic->build($project['id']),
+ 'title' => t('Average time spent into each column for "%s"', $project['name']),
+ )));
+ }
+
+ /**
+ * Show tasks distribution graph
+ *
+ * @access public
+ */
+ public function tasks()
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->helper->layout->analytic('analytic/tasks', array(
+ 'project' => $project,
+ 'metrics' => $this->taskDistributionAnalytic->build($project['id']),
+ 'title' => t('Task repartition for "%s"', $project['name']),
+ )));
+ }
+
+ /**
+ * Show users repartition
+ *
+ * @access public
+ */
+ public function users()
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->helper->layout->analytic('analytic/users', array(
+ 'project' => $project,
+ 'metrics' => $this->userDistributionAnalytic->build($project['id']),
+ 'title' => t('User repartition for "%s"', $project['name']),
+ )));
+ }
+
+ /**
+ * Show cumulative flow diagram
+ *
+ * @access public
+ */
+ public function cfd()
+ {
+ $this->commonAggregateMetrics('analytic/cfd', 'total', 'Cumulative flow diagram for "%s"');
+ }
+
+ /**
+ * Show burndown chart
+ *
+ * @access public
+ */
+ public function burndown()
+ {
+ $this->commonAggregateMetrics('analytic/burndown', 'score', 'Burndown chart for "%s"');
+ }
+
+ /**
+ * Common method for CFD and Burdown chart
+ *
+ * @access private
+ * @param string $template
+ * @param string $column
+ * @param string $title
+ */
+ private function commonAggregateMetrics($template, $column, $title)
+ {
+ $project = $this->getProject();
+ list($from, $to) = $this->getDates();
+
+ $display_graph = $this->projectDailyColumnStats->countDays($project['id'], $from, $to) >= 2;
+
+ $this->response->html($this->helper->layout->analytic($template, array(
+ 'values' => array(
+ 'from' => $from,
+ 'to' => $to,
+ ),
+ 'display_graph' => $display_graph,
+ 'metrics' => $display_graph ? $this->projectDailyColumnStats->getAggregatedMetrics($project['id'], $from, $to, $column) : array(),
+ 'project' => $project,
+ 'date_format' => $this->config->get('application_date_format'),
+ 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
+ 'title' => t($title, $project['name']),
+ )));
+ }
+
+ private function getDates()
+ {
+ $values = $this->request->getValues();
+
+ $from = $this->request->getStringParam('from', date('Y-m-d', strtotime('-1week')));
+ $to = $this->request->getStringParam('to', date('Y-m-d'));
+
+ if (! empty($values)) {
+ $from = $values['from'];
+ $to = $values['to'];
+ }
+
+ return array($from, $to);
+ }
+}
diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php
index 60bc154a..45cf39a5 100644
--- a/app/Controller/AppController.php
+++ b/app/Controller/AppController.php
@@ -8,6 +8,7 @@ use Kanboard\Core\Base;
* Class AppController
*
* @package Kanboard\Controller
+ * @author Frederic Guillot
*/
class AppController extends Base
{
diff --git a/app/Controller/Auth.php b/app/Controller/Auth.php
deleted file mode 100644
index cad44a34..00000000
--- a/app/Controller/Auth.php
+++ /dev/null
@@ -1,83 +0,0 @@
-userSession->isLogged()) {
- $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
- } else {
- $this->response->html($this->helper->layout->app('auth/index', array(
- 'captcha' => ! empty($values['username']) && $this->userLocking->hasCaptcha($values['username']),
- 'errors' => $errors,
- 'values' => $values,
- 'no_layout' => true,
- 'title' => t('Login')
- )));
- }
- }
-
- /**
- * Check credentials
- *
- * @access public
- */
- public function check()
- {
- $values = $this->request->getValues();
- $this->sessionStorage->hasRememberMe = ! empty($values['remember_me']);
- list($valid, $errors) = $this->authValidator->validateForm($values);
-
- if ($valid) {
- $this->redirectAfterLogin();
- } else {
- $this->login($values, $errors);
- }
- }
-
- /**
- * Logout and destroy session
- *
- * @access public
- */
- public function logout()
- {
- if (! DISABLE_LOGOUT) {
- $this->sessionManager->close();
- $this->response->redirect($this->helper->url->to('auth', 'login'));
- } else {
- $this->response->redirect($this->helper->url->to('auth', 'index'));
- }
- }
-
- /**
- * Redirect the user after the authentication
- *
- * @access private
- */
- private function redirectAfterLogin()
- {
- if (isset($this->sessionStorage->redirectAfterLogin) && ! empty($this->sessionStorage->redirectAfterLogin) && ! filter_var($this->sessionStorage->redirectAfterLogin, FILTER_VALIDATE_URL)) {
- $redirect = $this->sessionStorage->redirectAfterLogin;
- unset($this->sessionStorage->redirectAfterLogin);
- $this->response->redirect($redirect);
- } else {
- $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
- }
- }
-}
diff --git a/app/Controller/AuthController.php b/app/Controller/AuthController.php
new file mode 100644
index 00000000..598b3ff8
--- /dev/null
+++ b/app/Controller/AuthController.php
@@ -0,0 +1,83 @@
+userSession->isLogged()) {
+ $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
+ } else {
+ $this->response->html($this->helper->layout->app('auth/index', array(
+ 'captcha' => ! empty($values['username']) && $this->userLocking->hasCaptcha($values['username']),
+ 'errors' => $errors,
+ 'values' => $values,
+ 'no_layout' => true,
+ 'title' => t('Login')
+ )));
+ }
+ }
+
+ /**
+ * Check credentials
+ *
+ * @access public
+ */
+ public function check()
+ {
+ $values = $this->request->getValues();
+ $this->sessionStorage->hasRememberMe = ! empty($values['remember_me']);
+ list($valid, $errors) = $this->authValidator->validateForm($values);
+
+ if ($valid) {
+ $this->redirectAfterLogin();
+ } else {
+ $this->login($values, $errors);
+ }
+ }
+
+ /**
+ * Logout and destroy session
+ *
+ * @access public
+ */
+ public function logout()
+ {
+ if (! DISABLE_LOGOUT) {
+ $this->sessionManager->close();
+ $this->response->redirect($this->helper->url->to('AuthController', 'login'));
+ } else {
+ $this->response->redirect($this->helper->url->to('AuthController', 'index'));
+ }
+ }
+
+ /**
+ * Redirect the user after the authentication
+ *
+ * @access private
+ */
+ private function redirectAfterLogin()
+ {
+ if (isset($this->sessionStorage->redirectAfterLogin) && ! empty($this->sessionStorage->redirectAfterLogin) && ! filter_var($this->sessionStorage->redirectAfterLogin, FILTER_VALIDATE_URL)) {
+ $redirect = $this->sessionStorage->redirectAfterLogin;
+ unset($this->sessionStorage->redirectAfterLogin);
+ $this->response->redirect($redirect);
+ } else {
+ $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
+ }
+ }
+}
diff --git a/app/Controller/BoardPopover.php b/app/Controller/BoardPopover.php
deleted file mode 100644
index d3117f78..00000000
--- a/app/Controller/BoardPopover.php
+++ /dev/null
@@ -1,47 +0,0 @@
-getProject();
- $column_id = $this->request->getIntegerParam('column_id');
- $swimlane_id = $this->request->getIntegerParam('swimlane_id');
-
- $this->response->html($this->template->render('board_popover/close_all_tasks_column', array(
- 'project' => $project,
- 'nb_tasks' => $this->taskFinder->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id),
- 'column' => $this->column->getColumnTitleById($column_id),
- 'swimlane' => $this->swimlane->getNameById($swimlane_id) ?: t($project['default_swimlane']),
- 'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id),
- )));
- }
-
- /**
- * Close all column tasks
- *
- * @access public
- */
- public function closeColumnTasks()
- {
- $project = $this->getProject();
- $values = $this->request->getValues();
-
- $this->taskStatus->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']);
- $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->column->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane'])));
- $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id'])));
- }
-}
diff --git a/app/Controller/BoardPopoverController.php b/app/Controller/BoardPopoverController.php
new file mode 100644
index 00000000..b204af39
--- /dev/null
+++ b/app/Controller/BoardPopoverController.php
@@ -0,0 +1,47 @@
+getProject();
+ $column_id = $this->request->getIntegerParam('column_id');
+ $swimlane_id = $this->request->getIntegerParam('swimlane_id');
+
+ $this->response->html($this->template->render('board_popover/close_all_tasks_column', array(
+ 'project' => $project,
+ 'nb_tasks' => $this->taskFinder->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id),
+ 'column' => $this->column->getColumnTitleById($column_id),
+ 'swimlane' => $this->swimlane->getNameById($swimlane_id) ?: t($project['default_swimlane']),
+ 'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id),
+ )));
+ }
+
+ /**
+ * Close all column tasks
+ *
+ * @access public
+ */
+ public function closeColumnTasks()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+
+ $this->taskStatus->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']);
+ $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->column->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane'])));
+ $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id'])));
+ }
+}
diff --git a/app/Controller/BoardTooltip.php b/app/Controller/BoardTooltip.php
deleted file mode 100644
index 49d02ced..00000000
--- a/app/Controller/BoardTooltip.php
+++ /dev/null
@@ -1,127 +0,0 @@
-getTask();
- $this->response->html($this->template->render('board/tooltip_tasklinks', array(
- 'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
- 'task' => $task,
- )));
- }
-
- /**
- * Get links on mouseover
- *
- * @access public
- */
- public function externallinks()
- {
- $task = $this->getTask();
- $this->response->html($this->template->render('board/tooltip_external_links', array(
- 'links' => $this->taskExternalLink->getAll($task['id']),
- 'task' => $task,
- )));
- }
-
- /**
- * Get subtasks on mouseover
- *
- * @access public
- */
- public function subtasks()
- {
- $task = $this->getTask();
- $this->response->html($this->template->render('board/tooltip_subtasks', array(
- 'subtasks' => $this->subtask->getAll($task['id']),
- 'task' => $task,
- )));
- }
-
- /**
- * Display all attachments during the task mouseover
- *
- * @access public
- */
- public function attachments()
- {
- $task = $this->getTask();
-
- $this->response->html($this->template->render('board/tooltip_files', array(
- 'files' => $this->taskFile->getAll($task['id']),
- 'task' => $task,
- )));
- }
-
- /**
- * Display comments during a task mouseover
- *
- * @access public
- */
- public function comments()
- {
- $task = $this->getTask();
-
- $this->response->html($this->template->render('board/tooltip_comments', array(
- 'task' => $task,
- 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting())
- )));
- }
-
- /**
- * Display task description
- *
- * @access public
- */
- public function description()
- {
- $task = $this->getTask();
-
- $this->response->html($this->template->render('board/tooltip_description', array(
- 'task' => $task
- )));
- }
-
- /**
- * Get recurrence information on mouseover
- *
- * @access public
- */
- public function recurrence()
- {
- $task = $this->getTask();
-
- $this->response->html($this->template->render('task_recurrence/info', array(
- 'task' => $task,
- 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(),
- 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(),
- 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(),
- )));
- }
-
- /**
- * Display swimlane description in tooltip
- *
- * @access public
- */
- public function swimlane()
- {
- $this->getProject();
- $swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id'));
- $this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane)));
- }
-}
diff --git a/app/Controller/BoardTooltipController.php b/app/Controller/BoardTooltipController.php
new file mode 100644
index 00000000..2f1d949e
--- /dev/null
+++ b/app/Controller/BoardTooltipController.php
@@ -0,0 +1,127 @@
+getTask();
+ $this->response->html($this->template->render('board/tooltip_tasklinks', array(
+ 'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * Get links on mouseover
+ *
+ * @access public
+ */
+ public function externallinks()
+ {
+ $task = $this->getTask();
+ $this->response->html($this->template->render('board/tooltip_external_links', array(
+ 'links' => $this->taskExternalLink->getAll($task['id']),
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * Get subtasks on mouseover
+ *
+ * @access public
+ */
+ public function subtasks()
+ {
+ $task = $this->getTask();
+ $this->response->html($this->template->render('board/tooltip_subtasks', array(
+ 'subtasks' => $this->subtask->getAll($task['id']),
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * Display all attachments during the task mouseover
+ *
+ * @access public
+ */
+ public function attachments()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->template->render('board/tooltip_files', array(
+ 'files' => $this->taskFile->getAll($task['id']),
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * Display comments during a task mouseover
+ *
+ * @access public
+ */
+ public function comments()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->template->render('board/tooltip_comments', array(
+ 'task' => $task,
+ 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting())
+ )));
+ }
+
+ /**
+ * Display task description
+ *
+ * @access public
+ */
+ public function description()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->template->render('board/tooltip_description', array(
+ 'task' => $task
+ )));
+ }
+
+ /**
+ * Get recurrence information on mouseover
+ *
+ * @access public
+ */
+ public function recurrence()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->template->render('task_recurrence/info', array(
+ 'task' => $task,
+ 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(),
+ 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(),
+ 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(),
+ )));
+ }
+
+ /**
+ * Display swimlane description in tooltip
+ *
+ * @access public
+ */
+ public function swimlane()
+ {
+ $this->getProject();
+ $swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id'));
+ $this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane)));
+ }
+}
diff --git a/app/Controller/Calendar.php b/app/Controller/Calendar.php
deleted file mode 100644
index 706c1d3b..00000000
--- a/app/Controller/Calendar.php
+++ /dev/null
@@ -1,107 +0,0 @@
-getProject();
-
- $this->response->html($this->helper->layout->app('calendar/show', array(
- 'project' => $project,
- 'title' => $project['name'],
- 'description' => $this->helper->projectHeader->getDescription($project),
- 'check_interval' => $this->config->get('board_private_refresh_interval'),
- )));
- }
-
- /**
- * Get tasks to display on the calendar (project view)
- *
- * @access public
- */
- public function project()
- {
- $project_id = $this->request->getIntegerParam('project_id');
- $start = $this->request->getStringParam('start');
- $end = $this->request->getStringParam('end');
- $search = $this->userSession->getFilters($project_id);
- $queryBuilder = $this->taskLexer->build($search)->withFilter(new TaskProjectFilter($project_id));
-
- $events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end);
- $events = array_merge($events, $this->helper->calendar->getTaskEvents(clone($queryBuilder), $start, $end));
-
- $events = $this->hook->merge('controller:calendar:project:events', $events, array(
- 'project_id' => $project_id,
- 'start' => $start,
- 'end' => $end,
- ));
-
- $this->response->json($events);
- }
-
- /**
- * Get tasks to display on the calendar (user view)
- *
- * @access public
- */
- public function user()
- {
- $user_id = $this->request->getIntegerParam('user_id');
- $start = $this->request->getStringParam('start');
- $end = $this->request->getStringParam('end');
- $queryBuilder = $this->taskQuery
- ->withFilter(new TaskAssigneeFilter($user_id))
- ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN));
-
- $events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end);
- $events = array_merge($events, $this->helper->calendar->getTaskEvents(clone($queryBuilder), $start, $end));
-
- if ($this->config->get('calendar_user_subtasks_time_tracking') == 1) {
- $events = array_merge($events, $this->helper->calendar->getSubtaskTimeTrackingEvents($user_id, $start, $end));
- }
-
- $events = $this->hook->merge('controller:calendar:user:events', $events, array(
- 'user_id' => $user_id,
- 'start' => $start,
- 'end' => $end,
- ));
-
- $this->response->json($events);
- }
-
- /**
- * Update task due date
- *
- * @access public
- */
- public function save()
- {
- if ($this->request->isAjax() && $this->request->isPost()) {
- $values = $this->request->getJson();
-
- $this->taskModification->update(array(
- 'id' => $values['task_id'],
- 'date_due' => substr($values['date_due'], 0, 10),
- ));
- }
- }
-}
diff --git a/app/Controller/CalendarController.php b/app/Controller/CalendarController.php
new file mode 100644
index 00000000..c875a18c
--- /dev/null
+++ b/app/Controller/CalendarController.php
@@ -0,0 +1,107 @@
+getProject();
+
+ $this->response->html($this->helper->layout->app('calendar/show', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
+ 'check_interval' => $this->config->get('board_private_refresh_interval'),
+ )));
+ }
+
+ /**
+ * Get tasks to display on the calendar (project view)
+ *
+ * @access public
+ */
+ public function project()
+ {
+ $project_id = $this->request->getIntegerParam('project_id');
+ $start = $this->request->getStringParam('start');
+ $end = $this->request->getStringParam('end');
+ $search = $this->userSession->getFilters($project_id);
+ $queryBuilder = $this->taskLexer->build($search)->withFilter(new TaskProjectFilter($project_id));
+
+ $events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end);
+ $events = array_merge($events, $this->helper->calendar->getTaskEvents(clone($queryBuilder), $start, $end));
+
+ $events = $this->hook->merge('controller:calendar:project:events', $events, array(
+ 'project_id' => $project_id,
+ 'start' => $start,
+ 'end' => $end,
+ ));
+
+ $this->response->json($events);
+ }
+
+ /**
+ * Get tasks to display on the calendar (user view)
+ *
+ * @access public
+ */
+ public function user()
+ {
+ $user_id = $this->request->getIntegerParam('user_id');
+ $start = $this->request->getStringParam('start');
+ $end = $this->request->getStringParam('end');
+ $queryBuilder = $this->taskQuery
+ ->withFilter(new TaskAssigneeFilter($user_id))
+ ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN));
+
+ $events = $this->helper->calendar->getTaskDateDueEvents(clone($queryBuilder), $start, $end);
+ $events = array_merge($events, $this->helper->calendar->getTaskEvents(clone($queryBuilder), $start, $end));
+
+ if ($this->config->get('calendar_user_subtasks_time_tracking') == 1) {
+ $events = array_merge($events, $this->helper->calendar->getSubtaskTimeTrackingEvents($user_id, $start, $end));
+ }
+
+ $events = $this->hook->merge('controller:calendar:user:events', $events, array(
+ 'user_id' => $user_id,
+ 'start' => $start,
+ 'end' => $end,
+ ));
+
+ $this->response->json($events);
+ }
+
+ /**
+ * Update task due date
+ *
+ * @access public
+ */
+ public function save()
+ {
+ if ($this->request->isAjax() && $this->request->isPost()) {
+ $values = $this->request->getJson();
+
+ $this->taskModification->update(array(
+ 'id' => $values['task_id'],
+ 'date_due' => substr($values['date_due'], 0, 10),
+ ));
+ }
+ }
+}
diff --git a/app/Controller/Category.php b/app/Controller/Category.php
deleted file mode 100644
index 954d92cc..00000000
--- a/app/Controller/Category.php
+++ /dev/null
@@ -1,159 +0,0 @@
-category->getById($this->request->getIntegerParam('category_id'));
-
- if (empty($category)) {
- throw new PageNotFoundException();
- }
-
- return $category;
- }
-
- /**
- * List of categories for a given project
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws PageNotFoundException
- */
- public function index(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
-
- $this->response->html($this->helper->layout->project('category/index', array(
- 'categories' => $this->category->getList($project['id'], false),
- 'values' => $values + array('project_id' => $project['id']),
- 'errors' => $errors,
- 'project' => $project,
- 'title' => t('Categories')
- )));
- }
-
- /**
- * Validate and save a new category
- *
- * @access public
- */
- public function save()
- {
- $project = $this->getProject();
-
- $values = $this->request->getValues();
- list($valid, $errors) = $this->categoryValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->category->create($values)) {
- $this->flash->success(t('Your category have been created successfully.'));
- return $this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id'])));
- } else {
- $this->flash->failure(t('Unable to create your category.'));
- }
- }
-
- return $this->index($values, $errors);
- }
-
- /**
- * Edit a category (display the form)
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws PageNotFoundException
- */
- public function edit(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
- $category = $this->getCategory();
-
- $this->response->html($this->helper->layout->project('category/edit', array(
- 'values' => empty($values) ? $category : $values,
- 'errors' => $errors,
- 'project' => $project,
- 'title' => t('Categories')
- )));
- }
-
- /**
- * Edit a category (validate the form and update the database)
- *
- * @access public
- */
- public function update()
- {
- $project = $this->getProject();
-
- $values = $this->request->getValues();
- list($valid, $errors) = $this->categoryValidator->validateModification($values);
-
- if ($valid) {
- if ($this->category->update($values)) {
- $this->flash->success(t('Your category have been updated successfully.'));
- return $this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id'])));
- } else {
- $this->flash->failure(t('Unable to update your category.'));
- }
- }
-
- return $this->edit($values, $errors);
- }
-
- /**
- * Confirmation dialog before removing a category
- *
- * @access public
- */
- public function confirm()
- {
- $project = $this->getProject();
- $category = $this->getCategory();
-
- $this->response->html($this->helper->layout->project('category/remove', array(
- 'project' => $project,
- 'category' => $category,
- 'title' => t('Remove a category')
- )));
- }
-
- /**
- * Remove a category
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
- $category = $this->getCategory();
-
- if ($this->category->remove($category['id'])) {
- $this->flash->success(t('Category removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this category.'));
- }
-
- $this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id'])));
- }
-}
diff --git a/app/Controller/CategoryController.php b/app/Controller/CategoryController.php
new file mode 100644
index 00000000..e7c8db54
--- /dev/null
+++ b/app/Controller/CategoryController.php
@@ -0,0 +1,159 @@
+category->getById($this->request->getIntegerParam('category_id'));
+
+ if (empty($category)) {
+ throw new PageNotFoundException();
+ }
+
+ return $category;
+ }
+
+ /**
+ * List of categories for a given project
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws PageNotFoundException
+ */
+ public function index(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->helper->layout->project('category/index', array(
+ 'categories' => $this->category->getList($project['id'], false),
+ 'values' => $values + array('project_id' => $project['id']),
+ 'errors' => $errors,
+ 'project' => $project,
+ 'title' => t('Categories')
+ )));
+ }
+
+ /**
+ * Validate and save a new category
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $project = $this->getProject();
+
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->categoryValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->category->create($values)) {
+ $this->flash->success(t('Your category have been created successfully.'));
+ return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
+ } else {
+ $this->flash->failure(t('Unable to create your category.'));
+ }
+ }
+
+ return $this->index($values, $errors);
+ }
+
+ /**
+ * Edit a category (display the form)
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws PageNotFoundException
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+ $category = $this->getCategory();
+
+ $this->response->html($this->helper->layout->project('category/edit', array(
+ 'values' => empty($values) ? $category : $values,
+ 'errors' => $errors,
+ 'project' => $project,
+ 'title' => t('Categories')
+ )));
+ }
+
+ /**
+ * Edit a category (validate the form and update the database)
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $project = $this->getProject();
+
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->categoryValidator->validateModification($values);
+
+ if ($valid) {
+ if ($this->category->update($values)) {
+ $this->flash->success(t('Your category have been updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
+ } else {
+ $this->flash->failure(t('Unable to update your category.'));
+ }
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ /**
+ * Confirmation dialog before removing a category
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $project = $this->getProject();
+ $category = $this->getCategory();
+
+ $this->response->html($this->helper->layout->project('category/remove', array(
+ 'project' => $project,
+ 'category' => $category,
+ 'title' => t('Remove a category')
+ )));
+ }
+
+ /**
+ * Remove a category
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+ $category = $this->getCategory();
+
+ if ($this->category->remove($category['id'])) {
+ $this->flash->success(t('Category removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this category.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
+ }
+}
diff --git a/app/Controller/Column.php b/app/Controller/Column.php
deleted file mode 100644
index 294c31d8..00000000
--- a/app/Controller/Column.php
+++ /dev/null
@@ -1,178 +0,0 @@
-getProject();
- $columns = $this->column->getAll($project['id']);
-
- $this->response->html($this->helper->layout->project('column/index', array(
- 'columns' => $columns,
- 'project' => $project,
- 'title' => t('Edit board')
- )));
- }
-
- /**
- * Show form to create a new column
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws \Kanboard\Core\Controller\PageNotFoundException
- */
- public function create(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
-
- if (empty($values)) {
- $values = array('project_id' => $project['id']);
- }
-
- $this->response->html($this->template->render('column/create', array(
- 'values' => $values,
- 'errors' => $errors,
- 'project' => $project,
- 'title' => t('Add a new column')
- )));
- }
-
- /**
- * Validate and add a new column
- *
- * @access public
- */
- public function save()
- {
- $project = $this->getProject();
- $values = $this->request->getValues();
-
- list($valid, $errors) = $this->columnValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->column->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) {
- $this->flash->success(t('Column created successfully.'));
- return $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])), true);
- } else {
- $errors['title'] = array(t('Another column with the same name exists in the project'));
- }
- }
-
- return $this->create($values, $errors);
- }
-
- /**
- * Display a form to edit a column
- *
- * @access public
- * @param array $values
- * @param array $errors
- */
- public function edit(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
- $column = $this->column->getById($this->request->getIntegerParam('column_id'));
-
- $this->response->html($this->helper->layout->project('column/edit', array(
- 'errors' => $errors,
- 'values' => $values ?: $column,
- 'project' => $project,
- 'column' => $column,
- 'title' => t('Edit column "%s"', $column['title'])
- )));
- }
-
- /**
- * Validate and update a column
- *
- * @access public
- */
- public function update()
- {
- $project = $this->getProject();
- $values = $this->request->getValues();
-
- list($valid, $errors) = $this->columnValidator->validateModification($values);
-
- if ($valid) {
- if ($this->column->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
- $this->flash->success(t('Board updated successfully.'));
- return $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
- } else {
- $this->flash->failure(t('Unable to update this board.'));
- }
- }
-
- return $this->edit($values, $errors);
- }
-
- /**
- * Move column position
- *
- * @access public
- */
- public function move()
- {
- $project = $this->getProject();
- $values = $this->request->getJson();
-
- if (! empty($values) && isset($values['column_id']) && isset($values['position'])) {
- $result = $this->column->changePosition($project['id'], $values['column_id'], $values['position']);
- $this->response->json(array('result' => $result));
- } else {
- throw new AccessForbiddenException();
- }
- }
-
- /**
- * Confirm column suppression
- *
- * @access public
- */
- public function confirm()
- {
- $project = $this->getProject();
-
- $this->response->html($this->helper->layout->project('column/remove', array(
- 'column' => $this->column->getById($this->request->getIntegerParam('column_id')),
- 'project' => $project,
- 'title' => t('Remove a column from a board')
- )));
- }
-
- /**
- * Remove a column
- *
- * @access public
- */
- public function remove()
- {
- $project = $this->getProject();
- $this->checkCSRFParam();
- $column_id = $this->request->getIntegerParam('column_id');
-
- if ($this->column->remove($column_id)) {
- $this->flash->success(t('Column removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this column.'));
- }
-
- $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
- }
-}
diff --git a/app/Controller/ColumnController.php b/app/Controller/ColumnController.php
new file mode 100644
index 00000000..5f04f426
--- /dev/null
+++ b/app/Controller/ColumnController.php
@@ -0,0 +1,178 @@
+getProject();
+ $columns = $this->column->getAll($project['id']);
+
+ $this->response->html($this->helper->layout->project('column/index', array(
+ 'columns' => $columns,
+ 'project' => $project,
+ 'title' => t('Edit board')
+ )));
+ }
+
+ /**
+ * Show form to create a new column
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws \Kanboard\Core\Controller\PageNotFoundException
+ */
+ public function create(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+
+ if (empty($values)) {
+ $values = array('project_id' => $project['id']);
+ }
+
+ $this->response->html($this->template->render('column/create', array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'project' => $project,
+ 'title' => t('Add a new column')
+ )));
+ }
+
+ /**
+ * Validate and add a new column
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+
+ list($valid, $errors) = $this->columnValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->column->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) {
+ $this->flash->success(t('Column created successfully.'));
+ return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);
+ } else {
+ $errors['title'] = array(t('Another column with the same name exists in the project'));
+ }
+ }
+
+ return $this->create($values, $errors);
+ }
+
+ /**
+ * Display a form to edit a column
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+ $column = $this->column->getById($this->request->getIntegerParam('column_id'));
+
+ $this->response->html($this->helper->layout->project('column/edit', array(
+ 'errors' => $errors,
+ 'values' => $values ?: $column,
+ 'project' => $project,
+ 'column' => $column,
+ 'title' => t('Edit column "%s"', $column['title'])
+ )));
+ }
+
+ /**
+ * Validate and update a column
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+
+ list($valid, $errors) = $this->columnValidator->validateModification($values);
+
+ if ($valid) {
+ if ($this->column->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
+ $this->flash->success(t('Board updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
+ } else {
+ $this->flash->failure(t('Unable to update this board.'));
+ }
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ /**
+ * Move column position
+ *
+ * @access public
+ */
+ public function move()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getJson();
+
+ if (! empty($values) && isset($values['column_id']) && isset($values['position'])) {
+ $result = $this->column->changePosition($project['id'], $values['column_id'], $values['position']);
+ $this->response->json(array('result' => $result));
+ } else {
+ throw new AccessForbiddenException();
+ }
+ }
+
+ /**
+ * Confirm column suppression
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->helper->layout->project('column/remove', array(
+ 'column' => $this->column->getById($this->request->getIntegerParam('column_id')),
+ 'project' => $project,
+ 'title' => t('Remove a column from a board')
+ )));
+ }
+
+ /**
+ * Remove a column
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $project = $this->getProject();
+ $this->checkCSRFParam();
+ $column_id = $this->request->getIntegerParam('column_id');
+
+ if ($this->column->remove($column_id)) {
+ $this->flash->success(t('Column removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this column.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
+ }
+}
diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php
deleted file mode 100644
index 8d3b7862..00000000
--- a/app/Controller/Comment.php
+++ /dev/null
@@ -1,191 +0,0 @@
-comment->getById($this->request->getIntegerParam('comment_id'));
-
- if (empty($comment)) {
- throw new PageNotFoundException();
- }
-
- if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) {
- throw new AccessForbiddenException();
- }
-
- return $comment;
- }
-
- /**
- * Add comment form
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws AccessForbiddenException
- * @throws PageNotFoundException
- */
- public function create(array $values = array(), array $errors = array())
- {
- $task = $this->getTask();
-
- if (empty($values)) {
- $values = array(
- 'user_id' => $this->userSession->getId(),
- 'task_id' => $task['id'],
- );
- }
-
- $this->response->html($this->template->render('comment/create', array(
- 'values' => $values,
- 'errors' => $errors,
- 'task' => $task,
- )));
- }
-
- /**
- * Add a comment
- *
- * @access public
- */
- public function save()
- {
- $task = $this->getTask();
- $values = $this->request->getValues();
-
- list($valid, $errors) = $this->commentValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->comment->create($values)) {
- $this->flash->success(t('Comment added successfully.'));
- } else {
- $this->flash->failure(t('Unable to create your comment.'));
- }
-
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true);
- }
-
- return $this->create($values, $errors);
- }
-
- /**
- * Edit a comment
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws AccessForbiddenException
- * @throws PageNotFoundException
- */
- public function edit(array $values = array(), array $errors = array())
- {
- $task = $this->getTask();
- $comment = $this->getComment();
-
- $this->response->html($this->template->render('comment/edit', array(
- 'values' => empty($values) ? $comment : $values,
- 'errors' => $errors,
- 'comment' => $comment,
- 'task' => $task,
- 'title' => t('Edit a comment')
- )));
- }
-
- /**
- * Update and validate a comment
- *
- * @access public
- */
- public function update()
- {
- $task = $this->getTask();
- $this->getComment();
-
- $values = $this->request->getValues();
- list($valid, $errors) = $this->commentValidator->validateModification($values);
-
- if ($valid) {
- if ($this->comment->update($values)) {
- $this->flash->success(t('Comment updated successfully.'));
- } else {
- $this->flash->failure(t('Unable to update your comment.'));
- }
-
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false);
- }
-
- return $this->edit($values, $errors);
- }
-
- /**
- * Confirmation dialog before removing a comment
- *
- * @access public
- */
- public function confirm()
- {
- $task = $this->getTask();
- $comment = $this->getComment();
-
- $this->response->html($this->template->render('comment/remove', array(
- 'comment' => $comment,
- 'task' => $task,
- 'title' => t('Remove a comment')
- )));
- }
-
- /**
- * Remove a comment
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $task = $this->getTask();
- $comment = $this->getComment();
-
- if ($this->comment->remove($comment['id'])) {
- $this->flash->success(t('Comment removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this comment.'));
- }
-
- $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'));
- }
-
- /**
- * Toggle comment sorting
- *
- * @access public
- */
- public function toggleSorting()
- {
- $task = $this->getTask();
-
- $order = $this->userSession->getCommentSorting() === 'ASC' ? 'DESC' : 'ASC';
- $this->userSession->setCommentSorting($order);
-
- $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'));
- }
-}
diff --git a/app/Controller/CommentController.php b/app/Controller/CommentController.php
new file mode 100644
index 00000000..8d1132ae
--- /dev/null
+++ b/app/Controller/CommentController.php
@@ -0,0 +1,191 @@
+comment->getById($this->request->getIntegerParam('comment_id'));
+
+ if (empty($comment)) {
+ throw new PageNotFoundException();
+ }
+
+ if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) {
+ throw new AccessForbiddenException();
+ }
+
+ return $comment;
+ }
+
+ /**
+ * Add comment form
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws AccessForbiddenException
+ * @throws PageNotFoundException
+ */
+ public function create(array $values = array(), array $errors = array())
+ {
+ $task = $this->getTask();
+
+ if (empty($values)) {
+ $values = array(
+ 'user_id' => $this->userSession->getId(),
+ 'task_id' => $task['id'],
+ );
+ }
+
+ $this->response->html($this->template->render('comment/create', array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * Add a comment
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $task = $this->getTask();
+ $values = $this->request->getValues();
+
+ list($valid, $errors) = $this->commentValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->comment->create($values)) {
+ $this->flash->success(t('Comment added successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to create your comment.'));
+ }
+
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true);
+ }
+
+ return $this->create($values, $errors);
+ }
+
+ /**
+ * Edit a comment
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws AccessForbiddenException
+ * @throws PageNotFoundException
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $task = $this->getTask();
+ $comment = $this->getComment();
+
+ $this->response->html($this->template->render('comment/edit', array(
+ 'values' => empty($values) ? $comment : $values,
+ 'errors' => $errors,
+ 'comment' => $comment,
+ 'task' => $task,
+ 'title' => t('Edit a comment')
+ )));
+ }
+
+ /**
+ * Update and validate a comment
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $task = $this->getTask();
+ $this->getComment();
+
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->commentValidator->validateModification($values);
+
+ if ($valid) {
+ if ($this->comment->update($values)) {
+ $this->flash->success(t('Comment updated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to update your comment.'));
+ }
+
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false);
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ /**
+ * Confirmation dialog before removing a comment
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $task = $this->getTask();
+ $comment = $this->getComment();
+
+ $this->response->html($this->template->render('comment/remove', array(
+ 'comment' => $comment,
+ 'task' => $task,
+ 'title' => t('Remove a comment')
+ )));
+ }
+
+ /**
+ * Remove a comment
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $task = $this->getTask();
+ $comment = $this->getComment();
+
+ if ($this->comment->remove($comment['id'])) {
+ $this->flash->success(t('Comment removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this comment.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'));
+ }
+
+ /**
+ * Toggle comment sorting
+ *
+ * @access public
+ */
+ public function toggleSorting()
+ {
+ $task = $this->getTask();
+
+ $order = $this->userSession->getCommentSorting() === 'ASC' ? 'DESC' : 'ASC';
+ $this->userSession->setCommentSorting($order);
+
+ $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'));
+ }
+}
diff --git a/app/Controller/CustomFilterController.php b/app/Controller/CustomFilterController.php
new file mode 100644
index 00000000..8dd98764
--- /dev/null
+++ b/app/Controller/CustomFilterController.php
@@ -0,0 +1,165 @@
+getProject();
+
+ $this->response->html($this->helper->layout->project('custom_filter/index', array(
+ 'values' => $values + array('project_id' => $project['id']),
+ 'errors' => $errors,
+ 'project' => $project,
+ 'custom_filters' => $this->customFilter->getAll($project['id'], $this->userSession->getId()),
+ 'title' => t('Custom filters'),
+ )));
+ }
+
+ /**
+ * Save a new custom filter
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $project = $this->getProject();
+
+ $values = $this->request->getValues();
+ $values['user_id'] = $this->userSession->getId();
+
+ list($valid, $errors) = $this->customFilterValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->customFilter->create($values)) {
+ $this->flash->success(t('Your custom filter have been created successfully.'));
+ return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
+ } else {
+ $this->flash->failure(t('Unable to create your custom filter.'));
+ }
+ }
+
+ return $this->index($values, $errors);
+ }
+
+ /**
+ * Confirmation dialog before removing a custom filter
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $project = $this->getProject();
+ $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
+
+ $this->response->html($this->helper->layout->project('custom_filter/remove', array(
+ 'project' => $project,
+ 'filter' => $filter,
+ 'title' => t('Remove a custom filter')
+ )));
+ }
+
+ /**
+ * Remove a custom filter
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+ $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
+
+ $this->checkPermission($project, $filter);
+
+ if ($this->customFilter->remove($filter['id'])) {
+ $this->flash->success(t('Custom filter removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this custom filter.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
+ }
+
+ /**
+ * Edit a custom filter (display the form)
+ *
+ * @access public
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+ $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
+
+ $this->checkPermission($project, $filter);
+
+ $this->response->html($this->helper->layout->project('custom_filter/edit', array(
+ 'values' => empty($values) ? $filter : $values,
+ 'errors' => $errors,
+ 'project' => $project,
+ 'filter' => $filter,
+ 'title' => t('Edit custom filter')
+ )));
+ }
+
+ /**
+ * Edit a custom filter (validate the form and update the database)
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $project = $this->getProject();
+ $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
+
+ $this->checkPermission($project, $filter);
+
+ $values = $this->request->getValues();
+
+ if (! isset($values['is_shared'])) {
+ $values += array('is_shared' => 0);
+ }
+
+ if (! isset($values['append'])) {
+ $values += array('append' => 0);
+ }
+
+ list($valid, $errors) = $this->customFilterValidator->validateModification($values);
+
+ if ($valid) {
+ if ($this->customFilter->update($values)) {
+ $this->flash->success(t('Your custom filter have been updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
+ } else {
+ $this->flash->failure(t('Unable to update custom filter.'));
+ }
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ private function checkPermission(array $project, array $filter)
+ {
+ $user_id = $this->userSession->getId();
+
+ if ($filter['user_id'] != $user_id && ($this->projectUserRole->getUserRole($project['id'], $user_id) === Role::PROJECT_MANAGER || ! $this->userSession->isAdmin())) {
+ throw new AccessForbiddenException();
+ }
+ }
+}
diff --git a/app/Controller/Customfilter.php b/app/Controller/Customfilter.php
deleted file mode 100644
index d0794366..00000000
--- a/app/Controller/Customfilter.php
+++ /dev/null
@@ -1,164 +0,0 @@
-getProject();
-
- $this->response->html($this->helper->layout->project('custom_filter/index', array(
- 'values' => $values + array('project_id' => $project['id']),
- 'errors' => $errors,
- 'project' => $project,
- 'custom_filters' => $this->customFilter->getAll($project['id'], $this->userSession->getId()),
- 'title' => t('Custom filters'),
- )));
- }
-
- /**
- * Save a new custom filter
- *
- * @access public
- */
- public function save()
- {
- $project = $this->getProject();
-
- $values = $this->request->getValues();
- $values['user_id'] = $this->userSession->getId();
-
- list($valid, $errors) = $this->customFilterValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->customFilter->create($values)) {
- $this->flash->success(t('Your custom filter have been created successfully.'));
- return $this->response->redirect($this->helper->url->to('customfilter', 'index', array('project_id' => $project['id'])));
- } else {
- $this->flash->failure(t('Unable to create your custom filter.'));
- }
- }
-
- return $this->index($values, $errors);
- }
-
- /**
- * Confirmation dialog before removing a custom filter
- *
- * @access public
- */
- public function confirm()
- {
- $project = $this->getProject();
- $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
-
- $this->response->html($this->helper->layout->project('custom_filter/remove', array(
- 'project' => $project,
- 'filter' => $filter,
- 'title' => t('Remove a custom filter')
- )));
- }
-
- /**
- * Remove a custom filter
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
- $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
-
- $this->checkPermission($project, $filter);
-
- if ($this->customFilter->remove($filter['id'])) {
- $this->flash->success(t('Custom filter removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this custom filter.'));
- }
-
- $this->response->redirect($this->helper->url->to('customfilter', 'index', array('project_id' => $project['id'])));
- }
-
- /**
- * Edit a custom filter (display the form)
- *
- * @access public
- */
- public function edit(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
- $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
-
- $this->checkPermission($project, $filter);
-
- $this->response->html($this->helper->layout->project('custom_filter/edit', array(
- 'values' => empty($values) ? $filter : $values,
- 'errors' => $errors,
- 'project' => $project,
- 'filter' => $filter,
- 'title' => t('Edit custom filter')
- )));
- }
-
- /**
- * Edit a custom filter (validate the form and update the database)
- *
- * @access public
- */
- public function update()
- {
- $project = $this->getProject();
- $filter = $this->customFilter->getById($this->request->getIntegerParam('filter_id'));
-
- $this->checkPermission($project, $filter);
-
- $values = $this->request->getValues();
-
- if (! isset($values['is_shared'])) {
- $values += array('is_shared' => 0);
- }
-
- if (! isset($values['append'])) {
- $values += array('append' => 0);
- }
-
- list($valid, $errors) = $this->customFilterValidator->validateModification($values);
-
- if ($valid) {
- if ($this->customFilter->update($values)) {
- $this->flash->success(t('Your custom filter have been updated successfully.'));
- return $this->response->redirect($this->helper->url->to('customfilter', 'index', array('project_id' => $project['id'])));
- } else {
- $this->flash->failure(t('Unable to update custom filter.'));
- }
- }
-
- return $this->edit($values, $errors);
- }
-
- private function checkPermission(array $project, array $filter)
- {
- $user_id = $this->userSession->getId();
-
- if ($filter['user_id'] != $user_id && ($this->projectUserRole->getUserRole($project['id'], $user_id) === Role::PROJECT_MANAGER || ! $this->userSession->isAdmin())) {
- throw new AccessForbiddenException();
- }
- }
-}
diff --git a/app/Controller/Export.php b/app/Controller/Export.php
deleted file mode 100644
index 7e1d2fdc..00000000
--- a/app/Controller/Export.php
+++ /dev/null
@@ -1,91 +0,0 @@
-getProject();
- $from = $this->request->getStringParam('from');
- $to = $this->request->getStringParam('to');
-
- if ($from && $to) {
- $data = $this->$model->$method($project['id'], $from, $to);
- $this->response->withFileDownload($filename.'.csv');
- $this->response->csv($data);
- }
-
- $this->response->html($this->helper->layout->project('export/'.$action, array(
- 'values' => array(
- 'controller' => 'export',
- 'action' => $action,
- 'project_id' => $project['id'],
- 'from' => $from,
- 'to' => $to,
- ),
- 'errors' => array(),
- 'date_format' => $this->config->get('application_date_format'),
- 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
- 'project' => $project,
- 'title' => $page_title,
- ), 'export/sidebar'));
- }
-
- /**
- * Task export
- *
- * @access public
- */
- public function tasks()
- {
- $this->common('taskExport', 'export', t('Tasks'), 'tasks', t('Tasks Export'));
- }
-
- /**
- * Subtask export
- *
- * @access public
- */
- public function subtasks()
- {
- $this->common('subtaskExport', 'export', t('Subtasks'), 'subtasks', t('Subtasks Export'));
- }
-
- /**
- * Daily project summary export
- *
- * @access public
- */
- public function summary()
- {
- $this->common('projectDailyColumnStats', 'getAggregatedMetrics', t('Summary'), 'summary', t('Daily project summary export'));
- }
-
- /**
- * Transition export
- *
- * @access public
- */
- public function transitions()
- {
- $this->common('transitionExport', 'export', t('Transitions'), 'transitions', t('Task transitions export'));
- }
-}
diff --git a/app/Controller/ExportController.php b/app/Controller/ExportController.php
new file mode 100644
index 00000000..4ed9ee08
--- /dev/null
+++ b/app/Controller/ExportController.php
@@ -0,0 +1,91 @@
+getProject();
+ $from = $this->request->getStringParam('from');
+ $to = $this->request->getStringParam('to');
+
+ if ($from && $to) {
+ $data = $this->$model->$method($project['id'], $from, $to);
+ $this->response->withFileDownload($filename.'.csv');
+ $this->response->csv($data);
+ }
+
+ $this->response->html($this->helper->layout->project('export/'.$action, array(
+ 'values' => array(
+ 'controller' => 'ExportController',
+ 'action' => $action,
+ 'project_id' => $project['id'],
+ 'from' => $from,
+ 'to' => $to,
+ ),
+ 'errors' => array(),
+ 'date_format' => $this->config->get('application_date_format'),
+ 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
+ 'project' => $project,
+ 'title' => $page_title,
+ ), 'export/sidebar'));
+ }
+
+ /**
+ * Task export
+ *
+ * @access public
+ */
+ public function tasks()
+ {
+ $this->common('taskExport', 'export', t('Tasks'), 'tasks', t('Tasks Export'));
+ }
+
+ /**
+ * Subtask export
+ *
+ * @access public
+ */
+ public function subtasks()
+ {
+ $this->common('subtaskExport', 'export', t('Subtasks'), 'subtasks', t('Subtasks Export'));
+ }
+
+ /**
+ * Daily project summary export
+ *
+ * @access public
+ */
+ public function summary()
+ {
+ $this->common('projectDailyColumnStats', 'getAggregatedMetrics', t('Summary'), 'summary', t('Daily project summary export'));
+ }
+
+ /**
+ * Transition export
+ *
+ * @access public
+ */
+ public function transitions()
+ {
+ $this->common('transitionExport', 'export', t('Transitions'), 'transitions', t('Task transitions export'));
+ }
+}
diff --git a/app/Controller/FileViewer.php b/app/Controller/FileViewer.php
deleted file mode 100644
index a49b0fb2..00000000
--- a/app/Controller/FileViewer.php
+++ /dev/null
@@ -1,136 +0,0 @@
-objectStorage->get($file['path']);
- }
- } catch (ObjectStorageException $e) {
- $this->logger->error($e->getMessage());
- }
-
- return $content;
- }
-
- /**
- * Show file content in a popover
- *
- * @access public
- */
- public function show()
- {
- $file = $this->getFile();
- $type = $this->helper->file->getPreviewType($file['name']);
- $params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id'));
-
- if ($file['model'] === 'taskFile') {
- $params['task_id'] = $file['task_id'];
- }
-
- $this->response->html($this->template->render('file_viewer/show', array(
- 'file' => $file,
- 'params' => $params,
- 'type' => $type,
- 'content' => $this->getFileContent($file),
- )));
- }
-
- /**
- * Display image
- *
- * @access public
- */
- public function image()
- {
- $file = $this->getFile();
- $etag = md5($file['path']);
- $this->response->withContentType($this->helper->file->getImageMimeType($file['name']));
- $this->response->withCache(5 * 86400, $etag);
-
- if ($this->request->getHeader('If-None-Match') === '"'.$etag.'"') {
- $this->response->status(304);
- } else {
-
- try {
- $this->response->send();
- $this->objectStorage->output($file['path']);
- } catch (ObjectStorageException $e) {
- $this->logger->error($e->getMessage());
- }
- }
- }
-
- /**
- * Display image thumbnail
- *
- * @access public
- */
- public function thumbnail()
- {
- $file = $this->getFile();
- $model = $file['model'];
- $filename = $this->$model->getThumbnailPath($file['path']);
- $etag = md5($filename);
-
- $this->response->withCache(5 * 86400, $etag);
- $this->response->withContentType('image/jpeg');
-
- if ($this->request->getHeader('If-None-Match') === '"'.$etag.'"') {
- $this->response->status(304);
- } else {
-
- $this->response->send();
-
- try {
-
- $this->objectStorage->output($filename);
- } catch (ObjectStorageException $e) {
- $this->logger->error($e->getMessage());
-
- // Try to generate thumbnail on the fly for images uploaded before Kanboard < 1.0.19
- $data = $this->objectStorage->get($file['path']);
- $this->$model->generateThumbnailFromData($file['path'], $data);
- $this->objectStorage->output($this->$model->getThumbnailPath($file['path']));
- }
- }
- }
-
- /**
- * File download
- *
- * @access public
- */
- public function download()
- {
- try {
- $file = $this->getFile();
- $this->response->withFileDownload($file['name']);
- $this->response->send();
- $this->objectStorage->output($file['path']);
- } catch (ObjectStorageException $e) {
- $this->logger->error($e->getMessage());
- }
- }
-}
diff --git a/app/Controller/FileViewerController.php b/app/Controller/FileViewerController.php
new file mode 100644
index 00000000..245845c7
--- /dev/null
+++ b/app/Controller/FileViewerController.php
@@ -0,0 +1,136 @@
+objectStorage->get($file['path']);
+ }
+ } catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
+
+ return $content;
+ }
+
+ /**
+ * Show file content in a popover
+ *
+ * @access public
+ */
+ public function show()
+ {
+ $file = $this->getFile();
+ $type = $this->helper->file->getPreviewType($file['name']);
+ $params = array('file_id' => $file['id'], 'project_id' => $this->request->getIntegerParam('project_id'));
+
+ if ($file['model'] === 'taskFile') {
+ $params['task_id'] = $file['task_id'];
+ }
+
+ $this->response->html($this->template->render('file_viewer/show', array(
+ 'file' => $file,
+ 'params' => $params,
+ 'type' => $type,
+ 'content' => $this->getFileContent($file),
+ )));
+ }
+
+ /**
+ * Display image
+ *
+ * @access public
+ */
+ public function image()
+ {
+ $file = $this->getFile();
+ $etag = md5($file['path']);
+ $this->response->withContentType($this->helper->file->getImageMimeType($file['name']));
+ $this->response->withCache(5 * 86400, $etag);
+
+ if ($this->request->getHeader('If-None-Match') === '"'.$etag.'"') {
+ $this->response->status(304);
+ } else {
+
+ try {
+ $this->response->send();
+ $this->objectStorage->output($file['path']);
+ } catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
+ }
+ }
+
+ /**
+ * Display image thumbnail
+ *
+ * @access public
+ */
+ public function thumbnail()
+ {
+ $file = $this->getFile();
+ $model = $file['model'];
+ $filename = $this->$model->getThumbnailPath($file['path']);
+ $etag = md5($filename);
+
+ $this->response->withCache(5 * 86400, $etag);
+ $this->response->withContentType('image/jpeg');
+
+ if ($this->request->getHeader('If-None-Match') === '"'.$etag.'"') {
+ $this->response->status(304);
+ } else {
+
+ $this->response->send();
+
+ try {
+
+ $this->objectStorage->output($filename);
+ } catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+
+ // Try to generate thumbnail on the fly for images uploaded before Kanboard < 1.0.19
+ $data = $this->objectStorage->get($file['path']);
+ $this->$model->generateThumbnailFromData($file['path'], $data);
+ $this->objectStorage->output($this->$model->getThumbnailPath($file['path']));
+ }
+ }
+ }
+
+ /**
+ * File download
+ *
+ * @access public
+ */
+ public function download()
+ {
+ try {
+ $file = $this->getFile();
+ $this->response->withFileDownload($file['name']);
+ $this->response->send();
+ $this->objectStorage->output($file['path']);
+ } catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
+ }
+}
diff --git a/app/Controller/Link.php b/app/Controller/Link.php
deleted file mode 100644
index d28f5e4e..00000000
--- a/app/Controller/Link.php
+++ /dev/null
@@ -1,150 +0,0 @@
-link->getById($this->request->getIntegerParam('link_id'));
-
- if (empty($link)) {
- throw new PageNotFoundException();
- }
-
- return $link;
- }
-
- /**
- * List of links
- *
- * @access public
- * @param array $values
- * @param array $errors
- */
- public function index(array $values = array(), array $errors = array())
- {
- $this->response->html($this->helper->layout->config('link/index', array(
- 'links' => $this->link->getMergedList(),
- 'values' => $values,
- 'errors' => $errors,
- 'title' => t('Settings').' > '.t('Task\'s links'),
- )));
- }
-
- /**
- * Validate and save a new link
- *
- * @access public
- */
- public function save()
- {
- $values = $this->request->getValues();
- list($valid, $errors) = $this->linkValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->link->create($values['label'], $values['opposite_label']) !== false) {
- $this->flash->success(t('Link added successfully.'));
- return $this->response->redirect($this->helper->url->to('link', 'index'));
- } else {
- $this->flash->failure(t('Unable to create your link.'));
- }
- }
-
- return $this->index($values, $errors);
- }
-
- /**
- * Edit form
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws PageNotFoundException
- */
- public function edit(array $values = array(), array $errors = array())
- {
- $link = $this->getLink();
- $link['label'] = t($link['label']);
-
- $this->response->html($this->helper->layout->config('link/edit', array(
- 'values' => $values ?: $link,
- 'errors' => $errors,
- 'labels' => $this->link->getList($link['id']),
- 'link' => $link,
- 'title' => t('Link modification')
- )));
- }
-
- /**
- * Edit a link (validate the form and update the database)
- *
- * @access public
- */
- public function update()
- {
- $values = $this->request->getValues();
- list($valid, $errors) = $this->linkValidator->validateModification($values);
-
- if ($valid) {
- if ($this->link->update($values)) {
- $this->flash->success(t('Link updated successfully.'));
- return $this->response->redirect($this->helper->url->to('link', 'index'));
- } else {
- $this->flash->failure(t('Unable to update your link.'));
- }
- }
-
- return $this->edit($values, $errors);
- }
-
- /**
- * Confirmation dialog before removing a link
- *
- * @access public
- */
- public function confirm()
- {
- $link = $this->getLink();
-
- $this->response->html($this->helper->layout->config('link/remove', array(
- 'link' => $link,
- 'title' => t('Remove a link')
- )));
- }
-
- /**
- * Remove a link
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $link = $this->getLink();
-
- if ($this->link->remove($link['id'])) {
- $this->flash->success(t('Link removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this link.'));
- }
-
- $this->response->redirect($this->helper->url->to('link', 'index'));
- }
-}
diff --git a/app/Controller/LinkController.php b/app/Controller/LinkController.php
new file mode 100644
index 00000000..08627d40
--- /dev/null
+++ b/app/Controller/LinkController.php
@@ -0,0 +1,150 @@
+link->getById($this->request->getIntegerParam('link_id'));
+
+ if (empty($link)) {
+ throw new PageNotFoundException();
+ }
+
+ return $link;
+ }
+
+ /**
+ * List of links
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ */
+ public function index(array $values = array(), array $errors = array())
+ {
+ $this->response->html($this->helper->layout->config('link/index', array(
+ 'links' => $this->link->getMergedList(),
+ 'values' => $values,
+ 'errors' => $errors,
+ 'title' => t('Settings').' > '.t('Task\'s links'),
+ )));
+ }
+
+ /**
+ * Validate and save a new link
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->linkValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->link->create($values['label'], $values['opposite_label']) !== false) {
+ $this->flash->success(t('Link added successfully.'));
+ return $this->response->redirect($this->helper->url->to('LinkController', 'index'));
+ } else {
+ $this->flash->failure(t('Unable to create your link.'));
+ }
+ }
+
+ return $this->index($values, $errors);
+ }
+
+ /**
+ * Edit form
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws PageNotFoundException
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $link = $this->getLink();
+ $link['label'] = t($link['label']);
+
+ $this->response->html($this->helper->layout->config('link/edit', array(
+ 'values' => $values ?: $link,
+ 'errors' => $errors,
+ 'labels' => $this->link->getList($link['id']),
+ 'link' => $link,
+ 'title' => t('Link modification')
+ )));
+ }
+
+ /**
+ * Edit a link (validate the form and update the database)
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->linkValidator->validateModification($values);
+
+ if ($valid) {
+ if ($this->link->update($values)) {
+ $this->flash->success(t('Link updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('LinkController', 'index'));
+ } else {
+ $this->flash->failure(t('Unable to update your link.'));
+ }
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ /**
+ * Confirmation dialog before removing a link
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $link = $this->getLink();
+
+ $this->response->html($this->helper->layout->config('link/remove', array(
+ 'link' => $link,
+ 'title' => t('Remove a link')
+ )));
+ }
+
+ /**
+ * Remove a link
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $link = $this->getLink();
+
+ if ($this->link->remove($link['id'])) {
+ $this->flash->success(t('Link removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this link.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('LinkController', 'index'));
+ }
+}
diff --git a/app/Controller/Listing.php b/app/Controller/Listing.php
deleted file mode 100644
index 93a7b836..00000000
--- a/app/Controller/Listing.php
+++ /dev/null
@@ -1,45 +0,0 @@
-getProject();
- $search = $this->helper->projectHeader->getSearchQuery($project);
-
- $paginator = $this->paginator
- ->setUrl('listing', 'show', array('project_id' => $project['id']))
- ->setMax(30)
- ->setOrder(TaskModel::TABLE.'.id')
- ->setDirection('DESC')
- ->setQuery($this->taskLexer
- ->build($search)
- ->withFilter(new TaskProjectFilter($project['id']))
- ->getQuery()
- )
- ->calculate();
-
- $this->response->html($this->helper->layout->app('listing/show', array(
- 'project' => $project,
- 'title' => $project['name'],
- 'description' => $this->helper->projectHeader->getDescription($project),
- 'paginator' => $paginator,
- )));
- }
-}
diff --git a/app/Controller/OAuthController.php b/app/Controller/OAuthController.php
new file mode 100644
index 00000000..7663ddcc
--- /dev/null
+++ b/app/Controller/OAuthController.php
@@ -0,0 +1,130 @@
+request->getStringParam('code');
+ $state = $this->request->getStringParam('state');
+
+ if (! empty($code)) {
+ $this->step2($provider, $code, $state);
+ } else {
+ $this->response->redirect($this->authenticationManager->getProvider($provider)->getService()->getAuthorizationUrl());
+ }
+ }
+
+ /**
+ * Link or authenticate the user
+ *
+ * @access protected
+ * @param string $providerName
+ * @param string $code
+ * @param string $state
+ */
+ protected function step2($providerName, $code, $state)
+ {
+ $provider = $this->authenticationManager->getProvider($providerName);
+ $provider->setCode($code);
+ $hasValidState = $provider->getService()->isValidateState($state);
+
+ if ($this->userSession->isLogged()) {
+ if ($hasValidState) {
+ $this->link($provider);
+ } else {
+ $this->flash->failure(t('The OAuth2 state parameter is invalid'));
+ $this->response->redirect($this->helper->url->to('UserViewController', 'external', array('user_id' => $this->userSession->getId())));
+ }
+ } else {
+ if ($hasValidState) {
+ $this->authenticate($providerName);
+ } else {
+ $this->authenticationFailure(t('The OAuth2 state parameter is invalid'));
+ }
+ }
+ }
+
+ /**
+ * Link the account
+ *
+ * @access protected
+ * @param OAuthAuthenticationProviderInterface $provider
+ */
+ protected function link(OAuthAuthenticationProviderInterface $provider)
+ {
+ if (! $provider->authenticate()) {
+ $this->flash->failure(t('External authentication failed'));
+ } else {
+ $this->userProfile->assign($this->userSession->getId(), $provider->getUser());
+ $this->flash->success(t('Your external account is linked to your profile successfully.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('UserViewController', 'external', array('user_id' => $this->userSession->getId())));
+ }
+
+ /**
+ * Unlink external account
+ *
+ * @access public
+ */
+ public function unlink()
+ {
+ $backend = $this->request->getStringParam('backend');
+ $this->checkCSRFParam();
+
+ if ($this->authenticationManager->getProvider($backend)->unlink($this->userSession->getId())) {
+ $this->flash->success(t('Your external account is not linked anymore to your profile.'));
+ } else {
+ $this->flash->failure(t('Unable to unlink your external account.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('UserViewController', 'external', array('user_id' => $this->userSession->getId())));
+ }
+
+ /**
+ * Authenticate the account
+ *
+ * @access protected
+ * @param string $providerName
+ */
+ protected function authenticate($providerName)
+ {
+ if ($this->authenticationManager->oauthAuthentication($providerName)) {
+ $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
+ } else {
+ $this->authenticationFailure(t('External authentication failed'));
+ }
+ }
+
+ /**
+ * Show login failure page
+ *
+ * @access protected
+ * @param string $message
+ */
+ protected function authenticationFailure($message)
+ {
+ $this->response->html($this->helper->layout->app('auth/index', array(
+ 'errors' => array('login' => $message),
+ 'values' => array(),
+ 'no_layout' => true,
+ 'title' => t('Login')
+ )));
+ }
+}
diff --git a/app/Controller/Oauth.php b/app/Controller/Oauth.php
deleted file mode 100644
index 04adf154..00000000
--- a/app/Controller/Oauth.php
+++ /dev/null
@@ -1,130 +0,0 @@
-request->getStringParam('code');
- $state = $this->request->getStringParam('state');
-
- if (! empty($code)) {
- $this->step2($provider, $code, $state);
- } else {
- $this->response->redirect($this->authenticationManager->getProvider($provider)->getService()->getAuthorizationUrl());
- }
- }
-
- /**
- * Link or authenticate the user
- *
- * @access protected
- * @param string $providerName
- * @param string $code
- * @param string $state
- */
- protected function step2($providerName, $code, $state)
- {
- $provider = $this->authenticationManager->getProvider($providerName);
- $provider->setCode($code);
- $hasValidState = $provider->getService()->isValidateState($state);
-
- if ($this->userSession->isLogged()) {
- if ($hasValidState) {
- $this->link($provider);
- } else {
- $this->flash->failure(t('The OAuth2 state parameter is invalid'));
- $this->response->redirect($this->helper->url->to('UserViewController', 'external', array('user_id' => $this->userSession->getId())));
- }
- } else {
- if ($hasValidState) {
- $this->authenticate($providerName);
- } else {
- $this->authenticationFailure(t('The OAuth2 state parameter is invalid'));
- }
- }
- }
-
- /**
- * Link the account
- *
- * @access protected
- * @param OAuthAuthenticationProviderInterface $provider
- */
- protected function link(OAuthAuthenticationProviderInterface $provider)
- {
- if (! $provider->authenticate()) {
- $this->flash->failure(t('External authentication failed'));
- } else {
- $this->userProfile->assign($this->userSession->getId(), $provider->getUser());
- $this->flash->success(t('Your external account is linked to your profile successfully.'));
- }
-
- $this->response->redirect($this->helper->url->to('UserViewController', 'external', array('user_id' => $this->userSession->getId())));
- }
-
- /**
- * Unlink external account
- *
- * @access public
- */
- public function unlink()
- {
- $backend = $this->request->getStringParam('backend');
- $this->checkCSRFParam();
-
- if ($this->authenticationManager->getProvider($backend)->unlink($this->userSession->getId())) {
- $this->flash->success(t('Your external account is not linked anymore to your profile.'));
- } else {
- $this->flash->failure(t('Unable to unlink your external account.'));
- }
-
- $this->response->redirect($this->helper->url->to('UserViewController', 'external', array('user_id' => $this->userSession->getId())));
- }
-
- /**
- * Authenticate the account
- *
- * @access protected
- * @param string $providerName
- */
- protected function authenticate($providerName)
- {
- if ($this->authenticationManager->oauthAuthentication($providerName)) {
- $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
- } else {
- $this->authenticationFailure(t('External authentication failed'));
- }
- }
-
- /**
- * Show login failure page
- *
- * @access protected
- * @param string $message
- */
- protected function authenticationFailure($message)
- {
- $this->response->html($this->helper->layout->app('auth/index', array(
- 'errors' => array('login' => $message),
- 'values' => array(),
- 'no_layout' => true,
- 'title' => t('Login')
- )));
- }
-}
diff --git a/app/Controller/PasswordReset.php b/app/Controller/PasswordReset.php
deleted file mode 100644
index 7050d6d2..00000000
--- a/app/Controller/PasswordReset.php
+++ /dev/null
@@ -1,122 +0,0 @@
-checkActivation();
-
- $this->response->html($this->helper->layout->app('password_reset/create', array(
- 'errors' => $errors,
- 'values' => $values,
- 'no_layout' => true,
- )));
- }
-
- /**
- * Validate and send the email
- */
- public function save()
- {
- $this->checkActivation();
-
- $values = $this->request->getValues();
- list($valid, $errors) = $this->passwordResetValidator->validateCreation($values);
-
- if ($valid) {
- $this->sendEmail($values['username']);
- $this->response->redirect($this->helper->url->to('auth', 'login'));
- } else {
- $this->create($values, $errors);
- }
- }
-
- /**
- * Show the form to set a new password
- */
- public function change(array $values = array(), array $errors = array())
- {
- $this->checkActivation();
-
- $token = $this->request->getStringParam('token');
- $user_id = $this->passwordReset->getUserIdByToken($token);
-
- if ($user_id !== false) {
- $this->response->html($this->helper->layout->app('password_reset/change', array(
- 'token' => $token,
- 'errors' => $errors,
- 'values' => $values,
- 'no_layout' => true,
- )));
- } else {
- $this->response->redirect($this->helper->url->to('auth', 'login'));
- }
- }
-
- /**
- * Set the new password
- */
- public function update()
- {
- $this->checkActivation();
-
- $token = $this->request->getStringParam('token');
- $values = $this->request->getValues();
- list($valid, $errors) = $this->passwordResetValidator->validateModification($values);
-
- if ($valid) {
- $user_id = $this->passwordReset->getUserIdByToken($token);
-
- if ($user_id !== false) {
- $this->user->update(array('id' => $user_id, 'password' => $values['password']));
- $this->passwordReset->disable($user_id);
- }
-
- return $this->response->redirect($this->helper->url->to('auth', 'login'));
- }
-
- return $this->change($values, $errors);
- }
-
- /**
- * Send the email
- */
- private function sendEmail($username)
- {
- $token = $this->passwordReset->create($username);
-
- if ($token !== false) {
- $user = $this->user->getByUsername($username);
-
- $this->emailClient->send(
- $user['email'],
- $user['name'] ?: $user['username'],
- t('Password Reset for Kanboard'),
- $this->template->render('password_reset/email', array('token' => $token))
- );
- }
- }
-
- /**
- * Check feature availability
- */
- private function checkActivation()
- {
- if ($this->config->get('password_reset', 0) == 0) {
- throw AccessForbiddenException::getInstance()->withoutLayout();
- }
- }
-}
diff --git a/app/Controller/PasswordResetController.php b/app/Controller/PasswordResetController.php
new file mode 100644
index 00000000..9036b3e7
--- /dev/null
+++ b/app/Controller/PasswordResetController.php
@@ -0,0 +1,122 @@
+checkActivation();
+
+ $this->response->html($this->helper->layout->app('password_reset/create', array(
+ 'errors' => $errors,
+ 'values' => $values,
+ 'no_layout' => true,
+ )));
+ }
+
+ /**
+ * Validate and send the email
+ */
+ public function save()
+ {
+ $this->checkActivation();
+
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->passwordResetValidator->validateCreation($values);
+
+ if ($valid) {
+ $this->sendEmail($values['username']);
+ $this->response->redirect($this->helper->url->to('AuthController', 'login'));
+ } else {
+ $this->create($values, $errors);
+ }
+ }
+
+ /**
+ * Show the form to set a new password
+ */
+ public function change(array $values = array(), array $errors = array())
+ {
+ $this->checkActivation();
+
+ $token = $this->request->getStringParam('token');
+ $user_id = $this->passwordReset->getUserIdByToken($token);
+
+ if ($user_id !== false) {
+ $this->response->html($this->helper->layout->app('password_reset/change', array(
+ 'token' => $token,
+ 'errors' => $errors,
+ 'values' => $values,
+ 'no_layout' => true,
+ )));
+ } else {
+ $this->response->redirect($this->helper->url->to('AuthController', 'login'));
+ }
+ }
+
+ /**
+ * Set the new password
+ */
+ public function update()
+ {
+ $this->checkActivation();
+
+ $token = $this->request->getStringParam('token');
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->passwordResetValidator->validateModification($values);
+
+ if ($valid) {
+ $user_id = $this->passwordReset->getUserIdByToken($token);
+
+ if ($user_id !== false) {
+ $this->user->update(array('id' => $user_id, 'password' => $values['password']));
+ $this->passwordReset->disable($user_id);
+ }
+
+ return $this->response->redirect($this->helper->url->to('AuthController', 'login'));
+ }
+
+ return $this->change($values, $errors);
+ }
+
+ /**
+ * Send the email
+ */
+ private function sendEmail($username)
+ {
+ $token = $this->passwordReset->create($username);
+
+ if ($token !== false) {
+ $user = $this->user->getByUsername($username);
+
+ $this->emailClient->send(
+ $user['email'],
+ $user['name'] ?: $user['username'],
+ t('Password Reset for Kanboard'),
+ $this->template->render('password_reset/email', array('token' => $token))
+ );
+ }
+ }
+
+ /**
+ * Check feature availability
+ */
+ private function checkActivation()
+ {
+ if ($this->config->get('password_reset', 0) == 0) {
+ throw AccessForbiddenException::getInstance()->withoutLayout();
+ }
+ }
+}
diff --git a/app/Controller/ProjectActionDuplicationController.php b/app/Controller/ProjectActionDuplicationController.php
new file mode 100644
index 00000000..790b7ed3
--- /dev/null
+++ b/app/Controller/ProjectActionDuplicationController.php
@@ -0,0 +1,38 @@
+getProject();
+ $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
+ unset($projects[$project['id']]);
+
+ $this->response->html($this->template->render('project_action_duplication/show', array(
+ 'project' => $project,
+ 'projects_list' => $projects,
+ )));
+ }
+
+ public function save()
+ {
+ $project = $this->getProject();
+ $src_project_id = $this->request->getValue('src_project_id');
+
+ if ($this->action->duplicate($src_project_id, $project['id'])) {
+ $this->flash->success(t('Actions duplicated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to duplicate actions.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
+ }
+}
diff --git a/app/Controller/ProjectCreation.php b/app/Controller/ProjectCreation.php
deleted file mode 100644
index 0ffa2174..00000000
--- a/app/Controller/ProjectCreation.php
+++ /dev/null
@@ -1,129 +0,0 @@
- t('Do not duplicate anything')) + $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
-
- $this->response->html($this->helper->layout->app('project_creation/create', array(
- 'values' => $values,
- 'errors' => $errors,
- 'is_private' => $is_private,
- 'projects_list' => $projects_list,
- 'title' => $is_private ? t('New private project') : t('New project'),
- )));
- }
-
- /**
- * Display a form to create a private project
- *
- * @access public
- * @param array $values
- * @param array $errors
- */
- public function createPrivate(array $values = array(), array $errors = array())
- {
- $values['is_private'] = 1;
- $this->create($values, $errors);
- }
-
- /**
- * Validate and save a new project
- *
- * @access public
- */
- public function save()
- {
- $values = $this->request->getValues();
- list($valid, $errors) = $this->projectValidator->validateCreation($values);
-
- if ($valid) {
- $project_id = $this->createOrDuplicate($values);
-
- if ($project_id > 0) {
- $this->flash->success(t('Your project have been created successfully.'));
- return $this->response->redirect($this->helper->url->to('ProjectViewController', 'show', array('project_id' => $project_id)));
- }
-
- $this->flash->failure(t('Unable to create your project.'));
- }
-
- return $this->create($values, $errors);
- }
-
- /**
- * Create or duplicate a project
- *
- * @access private
- * @param array $values
- * @return boolean|integer
- */
- private function createOrDuplicate(array $values)
- {
- if (empty($values['src_project_id'])) {
- return $this->createNewProject($values);
- }
-
- return $this->duplicateNewProject($values);
- }
-
- /**
- * Save a new project
- *
- * @access private
- * @param array $values
- * @return boolean|integer
- */
- private function createNewProject(array $values)
- {
- $project = array(
- 'name' => $values['name'],
- 'is_private' => $values['is_private'],
- );
-
- return $this->project->create($project, $this->userSession->getId(), true);
- }
-
- /**
- * Creatte from another project
- *
- * @access private
- * @param array $values
- * @return boolean|integer
- */
- private function duplicateNewProject(array $values)
- {
- $selection = array();
-
- foreach ($this->projectDuplication->getOptionalSelection() as $item) {
- if (isset($values[$item]) && $values[$item] == 1) {
- $selection[] = $item;
- }
- }
-
- return $this->projectDuplication->duplicate(
- $values['src_project_id'],
- $selection,
- $this->userSession->getId(),
- $values['name'],
- $values['is_private'] == 1
- );
- }
-}
diff --git a/app/Controller/ProjectCreationController.php b/app/Controller/ProjectCreationController.php
new file mode 100644
index 00000000..4166ead1
--- /dev/null
+++ b/app/Controller/ProjectCreationController.php
@@ -0,0 +1,129 @@
+ t('Do not duplicate anything')) + $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
+
+ $this->response->html($this->helper->layout->app('project_creation/create', array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'is_private' => $is_private,
+ 'projects_list' => $projects_list,
+ 'title' => $is_private ? t('New private project') : t('New project'),
+ )));
+ }
+
+ /**
+ * Display a form to create a private project
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ */
+ public function createPrivate(array $values = array(), array $errors = array())
+ {
+ $values['is_private'] = 1;
+ $this->create($values, $errors);
+ }
+
+ /**
+ * Validate and save a new project
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->projectValidator->validateCreation($values);
+
+ if ($valid) {
+ $project_id = $this->createOrDuplicate($values);
+
+ if ($project_id > 0) {
+ $this->flash->success(t('Your project have been created successfully.'));
+ return $this->response->redirect($this->helper->url->to('ProjectViewController', 'show', array('project_id' => $project_id)));
+ }
+
+ $this->flash->failure(t('Unable to create your project.'));
+ }
+
+ return $this->create($values, $errors);
+ }
+
+ /**
+ * Create or duplicate a project
+ *
+ * @access private
+ * @param array $values
+ * @return boolean|integer
+ */
+ private function createOrDuplicate(array $values)
+ {
+ if (empty($values['src_project_id'])) {
+ return $this->createNewProject($values);
+ }
+
+ return $this->duplicateNewProject($values);
+ }
+
+ /**
+ * Save a new project
+ *
+ * @access private
+ * @param array $values
+ * @return boolean|integer
+ */
+ private function createNewProject(array $values)
+ {
+ $project = array(
+ 'name' => $values['name'],
+ 'is_private' => $values['is_private'],
+ );
+
+ return $this->project->create($project, $this->userSession->getId(), true);
+ }
+
+ /**
+ * Creatte from another project
+ *
+ * @access private
+ * @param array $values
+ * @return boolean|integer
+ */
+ private function duplicateNewProject(array $values)
+ {
+ $selection = array();
+
+ foreach ($this->projectDuplication->getOptionalSelection() as $item) {
+ if (isset($values[$item]) && $values[$item] == 1) {
+ $selection[] = $item;
+ }
+ }
+
+ return $this->projectDuplication->duplicate(
+ $values['src_project_id'],
+ $selection,
+ $this->userSession->getId(),
+ $values['name'],
+ $values['is_private'] == 1
+ );
+ }
+}
diff --git a/app/Controller/ProjectEditController.php b/app/Controller/ProjectEditController.php
index 774c6909..64e02d1a 100644
--- a/app/Controller/ProjectEditController.php
+++ b/app/Controller/ProjectEditController.php
@@ -97,11 +97,11 @@ class ProjectEditController extends BaseController
{
if ($redirect === 'edit') {
if (isset($values['is_private'])) {
- if (! $this->helper->user->hasProjectAccess('ProjectCreation', 'create', $project['id'])) {
+ if (! $this->helper->user->hasProjectAccess('ProjectCreationController', 'create', $project['id'])) {
unset($values['is_private']);
}
} elseif ($project['is_private'] == 1 && ! isset($values['is_private'])) {
- if ($this->helper->user->hasProjectAccess('ProjectCreation', 'create', $project['id'])) {
+ if ($this->helper->user->hasProjectAccess('ProjectCreationController', 'create', $project['id'])) {
$values += array('is_private' => 0);
}
}
diff --git a/app/Controller/ProjectFile.php b/app/Controller/ProjectFile.php
deleted file mode 100644
index 6ec5ff27..00000000
--- a/app/Controller/ProjectFile.php
+++ /dev/null
@@ -1,79 +0,0 @@
-getProject();
-
- $this->response->html($this->template->render('project_file/create', array(
- 'project' => $project,
- 'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
- )));
- }
-
- /**
- * Save uploaded files
- *
- * @access public
- */
- public function save()
- {
- $project = $this->getProject();
-
- if (! $this->projectFile->uploadFiles($project['id'], $this->request->getFileInfo('files'))) {
- $this->flash->failure(t('Unable to upload the file.'));
- }
-
- $this->response->redirect($this->helper->url->to('ProjectOverview', 'show', array('project_id' => $project['id'])), true);
- }
-
- /**
- * Remove a file
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
- $file = $this->projectFile->getById($this->request->getIntegerParam('file_id'));
-
- if ($this->projectFile->remove($file['id'])) {
- $this->flash->success(t('File removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this file.'));
- }
-
- $this->response->redirect($this->helper->url->to('ProjectOverview', 'show', array('project_id' => $project['id'])));
- }
-
- /**
- * Confirmation dialog before removing a file
- *
- * @access public
- */
- public function confirm()
- {
- $project = $this->getProject();
- $file = $this->projectFile->getById($this->request->getIntegerParam('file_id'));
-
- $this->response->html($this->template->render('project_file/remove', array(
- 'project' => $project,
- 'file' => $file,
- )));
- }
-}
diff --git a/app/Controller/ProjectFileController.php b/app/Controller/ProjectFileController.php
new file mode 100644
index 00000000..f1bce09d
--- /dev/null
+++ b/app/Controller/ProjectFileController.php
@@ -0,0 +1,79 @@
+getProject();
+
+ $this->response->html($this->template->render('project_file/create', array(
+ 'project' => $project,
+ 'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
+ )));
+ }
+
+ /**
+ * Save uploaded files
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $project = $this->getProject();
+
+ if (! $this->projectFile->uploadFiles($project['id'], $this->request->getFileInfo('files'))) {
+ $this->flash->failure(t('Unable to upload the file.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id'])), true);
+ }
+
+ /**
+ * Remove a file
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+ $file = $this->projectFile->getById($this->request->getIntegerParam('file_id'));
+
+ if ($this->projectFile->remove($file['id'])) {
+ $this->flash->success(t('File removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this file.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id'])));
+ }
+
+ /**
+ * Confirmation dialog before removing a file
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $project = $this->getProject();
+ $file = $this->projectFile->getById($this->request->getIntegerParam('file_id'));
+
+ $this->response->html($this->template->render('project_file/remove', array(
+ 'project' => $project,
+ 'file' => $file,
+ )));
+ }
+}
diff --git a/app/Controller/ProjectOverview.php b/app/Controller/ProjectOverview.php
deleted file mode 100644
index f8837f95..00000000
--- a/app/Controller/ProjectOverview.php
+++ /dev/null
@@ -1,32 +0,0 @@
-getProject();
- $this->project->getColumnStats($project);
-
- $this->response->html($this->helper->layout->app('project_overview/show', array(
- 'project' => $project,
- 'title' => $project['name'],
- 'description' => $this->helper->projectHeader->getDescription($project),
- 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']),
- 'roles' => $this->role->getProjectRoles(),
- 'events' => $this->helper->projectActivity->getProjectEvents($project['id'], 10),
- 'images' => $this->projectFile->getAllImages($project['id']),
- 'files' => $this->projectFile->getAllDocuments($project['id']),
- )));
- }
-}
diff --git a/app/Controller/ProjectOverviewController.php b/app/Controller/ProjectOverviewController.php
new file mode 100644
index 00000000..75cf25ba
--- /dev/null
+++ b/app/Controller/ProjectOverviewController.php
@@ -0,0 +1,32 @@
+getProject();
+ $this->project->getColumnStats($project);
+
+ $this->response->html($this->helper->layout->app('project_overview/show', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
+ 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']),
+ 'roles' => $this->role->getProjectRoles(),
+ 'events' => $this->helper->projectActivity->getProjectEvents($project['id'], 10),
+ 'images' => $this->projectFile->getAllImages($project['id']),
+ 'files' => $this->projectFile->getAllDocuments($project['id']),
+ )));
+ }
+}
diff --git a/app/Controller/ProjectUserOverviewController.php b/app/Controller/ProjectUserOverviewController.php
new file mode 100644
index 00000000..90887a8a
--- /dev/null
+++ b/app/Controller/ProjectUserOverviewController.php
@@ -0,0 +1,130 @@
+request->getIntegerParam('user_id', UserModel::EVERYBODY_ID);
+
+ if ($this->userSession->isAdmin()) {
+ $project_ids = $this->project->getAllIds();
+ } else {
+ $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId());
+ }
+
+ return array($user_id, $project_ids, $this->user->getActiveUsersList(true));
+ }
+
+ private function role($role, $action, $title, $title_user)
+ {
+ list($user_id, $project_ids, $users) = $this->common();
+
+ $query = $this->projectPermission->getQueryByRole($project_ids, $role)->callback(array($this->project, 'applyColumnStats'));
+
+ if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) {
+ $query->eq(UserModel::TABLE.'.id', $user_id);
+ $title = t($title_user, $users[$user_id]);
+ }
+
+ $paginator = $this->paginator
+ ->setUrl('ProjectUserOverviewController', $action, array('user_id' => $user_id))
+ ->setMax(30)
+ ->setOrder('projects.name')
+ ->setQuery($query)
+ ->calculate();
+
+ $this->response->html($this->helper->layout->projectUser('project_user_overview/roles', array(
+ 'paginator' => $paginator,
+ 'title' => $title,
+ 'user_id' => $user_id,
+ 'users' => $users,
+ )));
+ }
+
+ private function tasks($is_active, $action, $title, $title_user)
+ {
+ list($user_id, $project_ids, $users) = $this->common();
+
+ $query = $this->taskFinder->getProjectUserOverviewQuery($project_ids, $is_active);
+
+ if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) {
+ $query->eq(TaskModel::TABLE.'.owner_id', $user_id);
+ $title = t($title_user, $users[$user_id]);
+ }
+
+ $paginator = $this->paginator
+ ->setUrl('ProjectUserOverviewController', $action, array('user_id' => $user_id))
+ ->setMax(50)
+ ->setOrder(TaskModel::TABLE.'.id')
+ ->setQuery($query)
+ ->calculate();
+
+ $this->response->html($this->helper->layout->projectUser('project_user_overview/tasks', array(
+ 'paginator' => $paginator,
+ 'title' => $title,
+ 'user_id' => $user_id,
+ 'users' => $users,
+ )));
+ }
+
+ /**
+ * Display the list of project managers
+ *
+ */
+ public function managers()
+ {
+ $this->role(Role::PROJECT_MANAGER, 'managers', t('People who are project managers'), 'Projects where "%s" is manager');
+ }
+
+ /**
+ * Display the list of project members
+ *
+ */
+ public function members()
+ {
+ $this->role(Role::PROJECT_MEMBER, 'members', t('People who are project members'), 'Projects where "%s" is member');
+ }
+
+ /**
+ * Display the list of open taks
+ *
+ */
+ public function opens()
+ {
+ $this->tasks(TaskModel::STATUS_OPEN, 'opens', t('Open tasks'), 'Open tasks assigned to "%s"');
+ }
+
+ /**
+ * Display the list of closed tasks
+ *
+ */
+ public function closed()
+ {
+ $this->tasks(TaskModel::STATUS_CLOSED, 'closed', t('Closed tasks'), 'Closed tasks assigned to "%s"');
+ }
+
+ /**
+ * Users tooltip
+ */
+ public function users()
+ {
+ $project = $this->getProject();
+
+ return $this->response->html($this->template->render('project_user_overview/tooltip_users', array(
+ 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']),
+ 'roles' => $this->role->getProjectRoles(),
+ )));
+ }
+}
diff --git a/app/Controller/Projectuser.php b/app/Controller/Projectuser.php
deleted file mode 100644
index fe1fe0f1..00000000
--- a/app/Controller/Projectuser.php
+++ /dev/null
@@ -1,130 +0,0 @@
-request->getIntegerParam('user_id', UserModel::EVERYBODY_ID);
-
- if ($this->userSession->isAdmin()) {
- $project_ids = $this->project->getAllIds();
- } else {
- $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId());
- }
-
- return array($user_id, $project_ids, $this->user->getActiveUsersList(true));
- }
-
- private function role($role, $action, $title, $title_user)
- {
- list($user_id, $project_ids, $users) = $this->common();
-
- $query = $this->projectPermission->getQueryByRole($project_ids, $role)->callback(array($this->project, 'applyColumnStats'));
-
- if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) {
- $query->eq(UserModel::TABLE.'.id', $user_id);
- $title = t($title_user, $users[$user_id]);
- }
-
- $paginator = $this->paginator
- ->setUrl('projectuser', $action, array('user_id' => $user_id))
- ->setMax(30)
- ->setOrder('projects.name')
- ->setQuery($query)
- ->calculate();
-
- $this->response->html($this->helper->layout->projectUser('project_user/roles', array(
- 'paginator' => $paginator,
- 'title' => $title,
- 'user_id' => $user_id,
- 'users' => $users,
- )));
- }
-
- private function tasks($is_active, $action, $title, $title_user)
- {
- list($user_id, $project_ids, $users) = $this->common();
-
- $query = $this->taskFinder->getProjectUserOverviewQuery($project_ids, $is_active);
-
- if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) {
- $query->eq(TaskModel::TABLE.'.owner_id', $user_id);
- $title = t($title_user, $users[$user_id]);
- }
-
- $paginator = $this->paginator
- ->setUrl('projectuser', $action, array('user_id' => $user_id))
- ->setMax(50)
- ->setOrder(TaskModel::TABLE.'.id')
- ->setQuery($query)
- ->calculate();
-
- $this->response->html($this->helper->layout->projectUser('project_user/tasks', array(
- 'paginator' => $paginator,
- 'title' => $title,
- 'user_id' => $user_id,
- 'users' => $users,
- )));
- }
-
- /**
- * Display the list of project managers
- *
- */
- public function managers()
- {
- $this->role(Role::PROJECT_MANAGER, 'managers', t('People who are project managers'), 'Projects where "%s" is manager');
- }
-
- /**
- * Display the list of project members
- *
- */
- public function members()
- {
- $this->role(Role::PROJECT_MEMBER, 'members', t('People who are project members'), 'Projects where "%s" is member');
- }
-
- /**
- * Display the list of open taks
- *
- */
- public function opens()
- {
- $this->tasks(TaskModel::STATUS_OPEN, 'opens', t('Open tasks'), 'Open tasks assigned to "%s"');
- }
-
- /**
- * Display the list of closed tasks
- *
- */
- public function closed()
- {
- $this->tasks(TaskModel::STATUS_CLOSED, 'closed', t('Closed tasks'), 'Closed tasks assigned to "%s"');
- }
-
- /**
- * Users tooltip
- */
- public function users()
- {
- $project = $this->getProject();
-
- return $this->response->html($this->template->render('project_user/tooltip_users', array(
- 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']),
- 'roles' => $this->role->getProjectRoles(),
- )));
- }
-}
diff --git a/app/Controller/Swimlane.php b/app/Controller/Swimlane.php
deleted file mode 100644
index 4575e909..00000000
--- a/app/Controller/Swimlane.php
+++ /dev/null
@@ -1,314 +0,0 @@
-swimlane->getById($this->request->getIntegerParam('swimlane_id'));
-
- if (empty($swimlane)) {
- throw new PageNotFoundException();
- }
-
- return $swimlane;
- }
-
- /**
- * List of swimlanes for a given project
- *
- * @access public
- */
- public function index()
- {
- $project = $this->getProject();
-
- $this->response->html($this->helper->layout->project('swimlane/index', array(
- 'default_swimlane' => $this->swimlane->getDefault($project['id']),
- 'active_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::ACTIVE),
- 'inactive_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::INACTIVE),
- 'project' => $project,
- 'title' => t('Swimlanes')
- )));
- }
-
- /**
- * Create a new swimlane
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws \Kanboard\Core\Controller\PageNotFoundException
- */
- public function create(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
-
- $this->response->html($this->template->render('swimlane/create', array(
- 'values' => $values + array('project_id' => $project['id']),
- 'errors' => $errors,
- 'project' => $project,
- )));
- }
-
- /**
- * Validate and save a new swimlane
- *
- * @access public
- */
- public function save()
- {
- $project = $this->getProject();
- $values = $this->request->getValues();
- list($valid, $errors) = $this->swimlaneValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->swimlane->create($values)) {
- $this->flash->success(t('Your swimlane have been created successfully.'));
- return $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
- } else {
- $errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
- }
- }
-
- return $this->create($values, $errors);
- }
-
- /**
- * Edit default swimlane (display the form)
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws \Kanboard\Core\Controller\PageNotFoundException
- */
- public function editDefault(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
- $swimlane = $this->swimlane->getDefault($project['id']);
-
- $this->response->html($this->helper->layout->project('swimlane/edit_default', array(
- 'values' => empty($values) ? $swimlane : $values,
- 'errors' => $errors,
- 'project' => $project,
- )));
- }
-
- /**
- * Change the default swimlane
- *
- * @access public
- */
- public function updateDefault()
- {
- $project = $this->getProject();
-
- $values = $this->request->getValues() + array('show_default_swimlane' => 0);
- list($valid, $errors) = $this->swimlaneValidator->validateDefaultModification($values);
-
- if ($valid) {
- if ($this->swimlane->updateDefault($values)) {
- $this->flash->success(t('The default swimlane have been updated successfully.'));
- return $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])), true);
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
- }
-
- return $this->editDefault($values, $errors);
- }
-
- /**
- * Edit a swimlane (display the form)
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws \Kanboard\Core\Controller\PageNotFoundException
- */
- public function edit(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
- $swimlane = $this->getSwimlane();
-
- $this->response->html($this->helper->layout->project('swimlane/edit', array(
- 'values' => empty($values) ? $swimlane : $values,
- 'errors' => $errors,
- 'project' => $project,
- )));
- }
-
- /**
- * Edit a swimlane (validate the form and update the database)
- *
- * @access public
- */
- public function update()
- {
- $project = $this->getProject();
-
- $values = $this->request->getValues();
- list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
-
- if ($valid) {
- if ($this->swimlane->update($values)) {
- $this->flash->success(t('Swimlane updated successfully.'));
- return $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
- } else {
- $errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
- }
- }
-
- return $this->edit($values, $errors);
- }
-
- /**
- * Confirmation dialog before removing a swimlane
- *
- * @access public
- */
- public function confirm()
- {
- $project = $this->getProject();
- $swimlane = $this->getSwimlane();
-
- $this->response->html($this->helper->layout->project('swimlane/remove', array(
- 'project' => $project,
- 'swimlane' => $swimlane,
- )));
- }
-
- /**
- * Remove a swimlane
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
- $swimlane_id = $this->request->getIntegerParam('swimlane_id');
-
- if ($this->swimlane->remove($project['id'], $swimlane_id)) {
- $this->flash->success(t('Swimlane removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this swimlane.'));
- }
-
- $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
- }
-
- /**
- * Disable a swimlane
- *
- * @access public
- */
- public function disable()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
- $swimlane_id = $this->request->getIntegerParam('swimlane_id');
-
- if ($this->swimlane->disable($project['id'], $swimlane_id)) {
- $this->flash->success(t('Swimlane updated successfully.'));
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
-
- $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
- }
-
- /**
- * Disable default swimlane
- *
- * @access public
- */
- public function disableDefault()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
-
- if ($this->swimlane->disableDefault($project['id'])) {
- $this->flash->success(t('Swimlane updated successfully.'));
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
-
- $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
- }
-
- /**
- * Enable a swimlane
- *
- * @access public
- */
- public function enable()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
- $swimlane_id = $this->request->getIntegerParam('swimlane_id');
-
- if ($this->swimlane->enable($project['id'], $swimlane_id)) {
- $this->flash->success(t('Swimlane updated successfully.'));
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
-
- $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
- }
-
- /**
- * Enable default swimlane
- *
- * @access public
- */
- public function enableDefault()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
-
- if ($this->swimlane->enableDefault($project['id'])) {
- $this->flash->success(t('Swimlane updated successfully.'));
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
-
- $this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
- }
-
- /**
- * Move swimlane position
- *
- * @access public
- */
- public function move()
- {
- $project = $this->getProject();
- $values = $this->request->getJson();
-
- if (! empty($values) && isset($values['swimlane_id']) && isset($values['position'])) {
- $result = $this->swimlane->changePosition($project['id'], $values['swimlane_id'], $values['position']);
- $this->response->json(array('result' => $result));
- } else {
- throw new AccessForbiddenException();
- }
- }
-}
diff --git a/app/Controller/SwimlaneController.php b/app/Controller/SwimlaneController.php
new file mode 100644
index 00000000..13a64d40
--- /dev/null
+++ b/app/Controller/SwimlaneController.php
@@ -0,0 +1,314 @@
+swimlane->getById($this->request->getIntegerParam('swimlane_id'));
+
+ if (empty($swimlane)) {
+ throw new PageNotFoundException();
+ }
+
+ return $swimlane;
+ }
+
+ /**
+ * List of swimlanes for a given project
+ *
+ * @access public
+ */
+ public function index()
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->helper->layout->project('swimlane/index', array(
+ 'default_swimlane' => $this->swimlane->getDefault($project['id']),
+ 'active_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::ACTIVE),
+ 'inactive_swimlanes' => $this->swimlane->getAllByStatus($project['id'], SwimlaneModel::INACTIVE),
+ 'project' => $project,
+ 'title' => t('Swimlanes')
+ )));
+ }
+
+ /**
+ * Create a new swimlane
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws \Kanboard\Core\Controller\PageNotFoundException
+ */
+ public function create(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->template->render('swimlane/create', array(
+ 'values' => $values + array('project_id' => $project['id']),
+ 'errors' => $errors,
+ 'project' => $project,
+ )));
+ }
+
+ /**
+ * Validate and save a new swimlane
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->swimlaneValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->swimlane->create($values)) {
+ $this->flash->success(t('Your swimlane have been created successfully.'));
+ return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ } else {
+ $errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
+ }
+ }
+
+ return $this->create($values, $errors);
+ }
+
+ /**
+ * Edit default swimlane (display the form)
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws \Kanboard\Core\Controller\PageNotFoundException
+ */
+ public function editDefault(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+ $swimlane = $this->swimlane->getDefault($project['id']);
+
+ $this->response->html($this->helper->layout->project('swimlane/edit_default', array(
+ 'values' => empty($values) ? $swimlane : $values,
+ 'errors' => $errors,
+ 'project' => $project,
+ )));
+ }
+
+ /**
+ * Change the default swimlane
+ *
+ * @access public
+ */
+ public function updateDefault()
+ {
+ $project = $this->getProject();
+
+ $values = $this->request->getValues() + array('show_default_swimlane' => 0);
+ list($valid, $errors) = $this->swimlaneValidator->validateDefaultModification($values);
+
+ if ($valid) {
+ if ($this->swimlane->updateDefault($values)) {
+ $this->flash->success(t('The default swimlane have been updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])), true);
+ } else {
+ $this->flash->failure(t('Unable to update this swimlane.'));
+ }
+ }
+
+ return $this->editDefault($values, $errors);
+ }
+
+ /**
+ * Edit a swimlane (display the form)
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws \Kanboard\Core\Controller\PageNotFoundException
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $project = $this->getProject();
+ $swimlane = $this->getSwimlane();
+
+ $this->response->html($this->helper->layout->project('swimlane/edit', array(
+ 'values' => empty($values) ? $swimlane : $values,
+ 'errors' => $errors,
+ 'project' => $project,
+ )));
+ }
+
+ /**
+ * Edit a swimlane (validate the form and update the database)
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $project = $this->getProject();
+
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
+
+ if ($valid) {
+ if ($this->swimlane->update($values)) {
+ $this->flash->success(t('Swimlane updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ } else {
+ $errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
+ }
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ /**
+ * Confirmation dialog before removing a swimlane
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $project = $this->getProject();
+ $swimlane = $this->getSwimlane();
+
+ $this->response->html($this->helper->layout->project('swimlane/remove', array(
+ 'project' => $project,
+ 'swimlane' => $swimlane,
+ )));
+ }
+
+ /**
+ * Remove a swimlane
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+ $swimlane_id = $this->request->getIntegerParam('swimlane_id');
+
+ if ($this->swimlane->remove($project['id'], $swimlane_id)) {
+ $this->flash->success(t('Swimlane removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this swimlane.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ }
+
+ /**
+ * Disable a swimlane
+ *
+ * @access public
+ */
+ public function disable()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+ $swimlane_id = $this->request->getIntegerParam('swimlane_id');
+
+ if ($this->swimlane->disable($project['id'], $swimlane_id)) {
+ $this->flash->success(t('Swimlane updated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to update this swimlane.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ }
+
+ /**
+ * Disable default swimlane
+ *
+ * @access public
+ */
+ public function disableDefault()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+
+ if ($this->swimlane->disableDefault($project['id'])) {
+ $this->flash->success(t('Swimlane updated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to update this swimlane.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ }
+
+ /**
+ * Enable a swimlane
+ *
+ * @access public
+ */
+ public function enable()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+ $swimlane_id = $this->request->getIntegerParam('swimlane_id');
+
+ if ($this->swimlane->enable($project['id'], $swimlane_id)) {
+ $this->flash->success(t('Swimlane updated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to update this swimlane.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ }
+
+ /**
+ * Enable default swimlane
+ *
+ * @access public
+ */
+ public function enableDefault()
+ {
+ $this->checkCSRFParam();
+ $project = $this->getProject();
+
+ if ($this->swimlane->enableDefault($project['id'])) {
+ $this->flash->success(t('Swimlane updated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to update this swimlane.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ }
+
+ /**
+ * Move swimlane position
+ *
+ * @access public
+ */
+ public function move()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getJson();
+
+ if (! empty($values) && isset($values['swimlane_id']) && isset($values['position'])) {
+ $result = $this->swimlane->changePosition($project['id'], $values['swimlane_id'], $values['position']);
+ $this->response->json(array('result' => $result));
+ } else {
+ throw new AccessForbiddenException();
+ }
+ }
+}
diff --git a/app/Controller/TaskBulkController.php b/app/Controller/TaskBulkController.php
index 4b4a2594..c0214ea7 100644
--- a/app/Controller/TaskBulkController.php
+++ b/app/Controller/TaskBulkController.php
@@ -6,6 +6,7 @@ namespace Kanboard\Controller;
* Class TaskBulkController
*
* @package Kanboard\Controller
+ * @author Frederic Guillot
*/
class TaskBulkController extends BaseController
{
diff --git a/app/Controller/TaskDuplicationController.php b/app/Controller/TaskDuplicationController.php
new file mode 100644
index 00000000..ab7b6b42
--- /dev/null
+++ b/app/Controller/TaskDuplicationController.php
@@ -0,0 +1,141 @@
+getTask();
+
+ if ($this->request->getStringParam('confirmation') === 'yes') {
+ $this->checkCSRFParam();
+ $task_id = $this->taskDuplication->duplicate($task['id']);
+
+ if ($task_id > 0) {
+ $this->flash->success(t('Task created successfully.'));
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id)));
+ } else {
+ $this->flash->failure(t('Unable to create this task.'));
+ return $this->response->redirect($this->helper->url->to('TaskDuplicationController', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
+ }
+ }
+
+ return $this->response->html($this->template->render('task_duplication/duplicate', array(
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * Move a task to another project
+ *
+ * @access public
+ */
+ public function move()
+ {
+ $task = $this->getTask();
+
+ if ($this->request->isPost()) {
+ $values = $this->request->getValues();
+ list($valid, ) = $this->taskValidator->validateProjectModification($values);
+
+ if ($valid && $this->taskDuplication->moveToProject($task['id'],
+ $values['project_id'],
+ $values['swimlane_id'],
+ $values['column_id'],
+ $values['category_id'],
+ $values['owner_id'])) {
+ $this->flash->success(t('Task updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $values['project_id'], 'task_id' => $task['id'])));
+ }
+
+ $this->flash->failure(t('Unable to update your task.'));
+ }
+
+ return $this->chooseDestination($task, 'task_duplication/move');
+ }
+
+ /**
+ * Duplicate a task to another project
+ *
+ * @access public
+ */
+ public function copy()
+ {
+ $task = $this->getTask();
+
+ if ($this->request->isPost()) {
+ $values = $this->request->getValues();
+ list($valid, ) = $this->taskValidator->validateProjectModification($values);
+
+ if ($valid) {
+ $task_id = $this->taskDuplication->duplicateToProject(
+ $task['id'], $values['project_id'], $values['swimlane_id'],
+ $values['column_id'], $values['category_id'], $values['owner_id']
+ );
+
+ if ($task_id > 0) {
+ $this->flash->success(t('Task created successfully.'));
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $values['project_id'], 'task_id' => $task_id)));
+ }
+ }
+
+ $this->flash->failure(t('Unable to create your task.'));
+ }
+
+ return $this->chooseDestination($task, 'task_duplication/copy');
+ }
+
+ /**
+ * Choose destination when move/copy task to another project
+ *
+ * @access private
+ * @param array $task
+ * @param string $template
+ */
+ private function chooseDestination(array $task, $template)
+ {
+ $values = array();
+ $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
+
+ unset($projects_list[$task['project_id']]);
+
+ if (! empty($projects_list)) {
+ $dst_project_id = $this->request->getIntegerParam('dst_project_id', key($projects_list));
+
+ $swimlanes_list = $this->swimlane->getList($dst_project_id, false, true);
+ $columns_list = $this->column->getList($dst_project_id);
+ $categories_list = $this->category->getList($dst_project_id);
+ $users_list = $this->projectUserRole->getAssignableUsersList($dst_project_id);
+
+ $values = $this->taskDuplication->checkDestinationProjectValues($task);
+ $values['project_id'] = $dst_project_id;
+ } else {
+ $swimlanes_list = array();
+ $columns_list = array();
+ $categories_list = array();
+ $users_list = array();
+ }
+
+ $this->response->html($this->template->render($template, array(
+ 'values' => $values,
+ 'task' => $task,
+ 'projects_list' => $projects_list,
+ 'swimlanes_list' => $swimlanes_list,
+ 'columns_list' => $columns_list,
+ 'categories_list' => $categories_list,
+ 'users_list' => $users_list,
+ )));
+ }
+}
diff --git a/app/Controller/TaskExternalLink.php b/app/Controller/TaskExternalLink.php
deleted file mode 100644
index 0bd55dba..00000000
--- a/app/Controller/TaskExternalLink.php
+++ /dev/null
@@ -1,178 +0,0 @@
-getTask();
-
- $this->response->html($this->template->render('task_external_link/find', array(
- 'values' => $values,
- 'errors' => $errors,
- 'task' => $task,
- 'types' => $this->externalLinkManager->getTypes(),
- )));
- }
-
- /**
- * Second creation form
- *
- * @access public
- */
- public function create()
- {
- $task = $this->getTask();
- $values = $this->request->getValues();
-
- try {
- $provider = $this->externalLinkManager->setUserInput($values)->find();
- $link = $provider->getLink();
-
- $this->response->html($this->template->render('task_external_link/create', array(
- 'values' => array(
- 'title' => $link->getTitle(),
- 'url' => $link->getUrl(),
- 'link_type' => $provider->getType(),
- ),
- 'dependencies' => $provider->getDependencies(),
- 'errors' => array(),
- 'task' => $task,
- )));
-
- } catch (ExternalLinkProviderNotFound $e) {
- $errors = array('text' => array(t('Unable to fetch link information.')));
- $this->find($values, $errors);
- }
- }
-
- /**
- * Save link
- *
- * @access public
- */
- public function save()
- {
- $task = $this->getTask();
- $values = $this->request->getValues();
- list($valid, $errors) = $this->externalLinkValidator->validateCreation($values);
-
- if ($valid && $this->taskExternalLink->create($values)) {
- $this->flash->success(t('Link added successfully.'));
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
- }
-
- return $this->edit($values, $errors);
- }
-
- /**
- * Edit form
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws ExternalLinkProviderNotFound
- * @throws PageNotFoundException
- * @throws \Kanboard\Core\Controller\AccessForbiddenException
- */
- public function edit(array $values = array(), array $errors = array())
- {
- $task = $this->getTask();
- $link_id = $this->request->getIntegerParam('link_id');
-
- if ($link_id > 0) {
- $values = $this->taskExternalLink->getById($link_id);
- }
-
- if (empty($values)) {
- throw new PageNotFoundException();
- }
-
- $provider = $this->externalLinkManager->getProvider($values['link_type']);
-
- $this->response->html($this->template->render('task_external_link/edit', array(
- 'values' => $values,
- 'errors' => $errors,
- 'task' => $task,
- 'dependencies' => $provider->getDependencies(),
- )));
- }
-
- /**
- * Update link
- *
- * @access public
- */
- public function update()
- {
- $task = $this->getTask();
- $values = $this->request->getValues();
- list($valid, $errors) = $this->externalLinkValidator->validateModification($values);
-
- if ($valid && $this->taskExternalLink->update($values)) {
- $this->flash->success(t('Link updated successfully.'));
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
- }
-
- return $this->edit($values, $errors);
- }
-
- /**
- * Confirmation dialog before removing a link
- *
- * @access public
- */
- public function confirm()
- {
- $task = $this->getTask();
- $link_id = $this->request->getIntegerParam('link_id');
- $link = $this->taskExternalLink->getById($link_id);
-
- if (empty($link)) {
- throw new PageNotFoundException();
- }
-
- $this->response->html($this->template->render('task_external_link/remove', array(
- 'link' => $link,
- 'task' => $task,
- )));
- }
-
- /**
- * Remove a link
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $task = $this->getTask();
-
- if ($this->taskExternalLink->remove($this->request->getIntegerParam('link_id'))) {
- $this->flash->success(t('Link removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this link.'));
- }
-
- $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
- }
-}
diff --git a/app/Controller/TaskExternalLinkController.php b/app/Controller/TaskExternalLinkController.php
new file mode 100644
index 00000000..91dc734a
--- /dev/null
+++ b/app/Controller/TaskExternalLinkController.php
@@ -0,0 +1,178 @@
+getTask();
+
+ $this->response->html($this->template->render('task_external_link/find', array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'task' => $task,
+ 'types' => $this->externalLinkManager->getTypes(),
+ )));
+ }
+
+ /**
+ * Second creation form
+ *
+ * @access public
+ */
+ public function create()
+ {
+ $task = $this->getTask();
+ $values = $this->request->getValues();
+
+ try {
+ $provider = $this->externalLinkManager->setUserInput($values)->find();
+ $link = $provider->getLink();
+
+ $this->response->html($this->template->render('task_external_link/create', array(
+ 'values' => array(
+ 'title' => $link->getTitle(),
+ 'url' => $link->getUrl(),
+ 'link_type' => $provider->getType(),
+ ),
+ 'dependencies' => $provider->getDependencies(),
+ 'errors' => array(),
+ 'task' => $task,
+ )));
+
+ } catch (ExternalLinkProviderNotFound $e) {
+ $errors = array('text' => array(t('Unable to fetch link information.')));
+ $this->find($values, $errors);
+ }
+ }
+
+ /**
+ * Save link
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $task = $this->getTask();
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->externalLinkValidator->validateCreation($values);
+
+ if ($valid && $this->taskExternalLink->create($values)) {
+ $this->flash->success(t('Link added successfully.'));
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ /**
+ * Edit form
+ *
+ * @access public
+ * @param array $values
+ * @param array $errors
+ * @throws ExternalLinkProviderNotFound
+ * @throws PageNotFoundException
+ * @throws \Kanboard\Core\Controller\AccessForbiddenException
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $task = $this->getTask();
+ $link_id = $this->request->getIntegerParam('link_id');
+
+ if ($link_id > 0) {
+ $values = $this->taskExternalLink->getById($link_id);
+ }
+
+ if (empty($values)) {
+ throw new PageNotFoundException();
+ }
+
+ $provider = $this->externalLinkManager->getProvider($values['link_type']);
+
+ $this->response->html($this->template->render('task_external_link/edit', array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'task' => $task,
+ 'dependencies' => $provider->getDependencies(),
+ )));
+ }
+
+ /**
+ * Update link
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $task = $this->getTask();
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->externalLinkValidator->validateModification($values);
+
+ if ($valid && $this->taskExternalLink->update($values)) {
+ $this->flash->success(t('Link updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
+ }
+
+ return $this->edit($values, $errors);
+ }
+
+ /**
+ * Confirmation dialog before removing a link
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $task = $this->getTask();
+ $link_id = $this->request->getIntegerParam('link_id');
+ $link = $this->taskExternalLink->getById($link_id);
+
+ if (empty($link)) {
+ throw new PageNotFoundException();
+ }
+
+ $this->response->html($this->template->render('task_external_link/remove', array(
+ 'link' => $link,
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * Remove a link
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $task = $this->getTask();
+
+ if ($this->taskExternalLink->remove($this->request->getIntegerParam('link_id'))) {
+ $this->flash->success(t('Link removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this link.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
+ }
+}
diff --git a/app/Controller/TaskFile.php b/app/Controller/TaskFile.php
deleted file mode 100644
index 544c1ea7..00000000
--- a/app/Controller/TaskFile.php
+++ /dev/null
@@ -1,98 +0,0 @@
-getTask();
-
- if ($this->request->isPost() && $this->taskFile->uploadScreenshot($task['id'], $this->request->getValue('screenshot')) !== false) {
- $this->flash->success(t('Screenshot uploaded successfully.'));
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
- }
-
- return $this->response->html($this->template->render('task_file/screenshot', array(
- 'task' => $task,
- )));
- }
-
- /**
- * File upload form
- *
- * @access public
- */
- public function create()
- {
- $task = $this->getTask();
-
- $this->response->html($this->template->render('task_file/create', array(
- 'task' => $task,
- 'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
- )));
- }
-
- /**
- * File upload (save files)
- *
- * @access public
- */
- public function save()
- {
- $task = $this->getTask();
-
- if (! $this->taskFile->uploadFiles($task['id'], $this->request->getFileInfo('files'))) {
- $this->flash->failure(t('Unable to upload the file.'));
- }
-
- $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
- }
-
- /**
- * Remove a file
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $task = $this->getTask();
- $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
-
- if ($file['task_id'] == $task['id'] && $this->taskFile->remove($file['id'])) {
- $this->flash->success(t('File removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this file.'));
- }
-
- $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
- }
-
- /**
- * Confirmation dialog before removing a file
- *
- * @access public
- */
- public function confirm()
- {
- $task = $this->getTask();
- $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
-
- $this->response->html($this->template->render('task_file/remove', array(
- 'task' => $task,
- 'file' => $file,
- )));
- }
-}
diff --git a/app/Controller/TaskFileController.php b/app/Controller/TaskFileController.php
new file mode 100644
index 00000000..44c19c27
--- /dev/null
+++ b/app/Controller/TaskFileController.php
@@ -0,0 +1,98 @@
+getTask();
+
+ if ($this->request->isPost() && $this->taskFile->uploadScreenshot($task['id'], $this->request->getValue('screenshot')) !== false) {
+ $this->flash->success(t('Screenshot uploaded successfully.'));
+ return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
+ }
+
+ return $this->response->html($this->template->render('task_file/screenshot', array(
+ 'task' => $task,
+ )));
+ }
+
+ /**
+ * File upload form
+ *
+ * @access public
+ */
+ public function create()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->template->render('task_file/create', array(
+ 'task' => $task,
+ 'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
+ )));
+ }
+
+ /**
+ * File upload (save files)
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $task = $this->getTask();
+
+ if (! $this->taskFile->uploadFiles($task['id'], $this->request->getFileInfo('files'))) {
+ $this->flash->failure(t('Unable to upload the file.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
+ }
+
+ /**
+ * Remove a file
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $this->checkCSRFParam();
+ $task = $this->getTask();
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
+
+ if ($file['task_id'] == $task['id'] && $this->taskFile->remove($file['id'])) {
+ $this->flash->success(t('File removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this file.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
+ }
+
+ /**
+ * Confirmation dialog before removing a file
+ *
+ * @access public
+ */
+ public function confirm()
+ {
+ $task = $this->getTask();
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
+
+ $this->response->html($this->template->render('task_file/remove', array(
+ 'task' => $task,
+ 'file' => $file,
+ )));
+ }
+}
diff --git a/app/Controller/TaskListController.php b/app/Controller/TaskListController.php
new file mode 100644
index 00000000..898c14c8
--- /dev/null
+++ b/app/Controller/TaskListController.php
@@ -0,0 +1,45 @@
+getProject();
+ $search = $this->helper->projectHeader->getSearchQuery($project);
+
+ $paginator = $this->paginator
+ ->setUrl('TaskListController', 'show', array('project_id' => $project['id']))
+ ->setMax(30)
+ ->setOrder(TaskModel::TABLE.'.id')
+ ->setDirection('DESC')
+ ->setQuery($this->taskLexer
+ ->build($search)
+ ->withFilter(new TaskProjectFilter($project['id']))
+ ->getQuery()
+ )
+ ->calculate();
+
+ $this->response->html($this->helper->layout->app('task_list/show', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
+ 'paginator' => $paginator,
+ )));
+ }
+}
diff --git a/app/Controller/Taskduplication.php b/app/Controller/Taskduplication.php
deleted file mode 100644
index 1ea3a3f9..00000000
--- a/app/Controller/Taskduplication.php
+++ /dev/null
@@ -1,141 +0,0 @@
-getTask();
-
- if ($this->request->getStringParam('confirmation') === 'yes') {
- $this->checkCSRFParam();
- $task_id = $this->taskDuplication->duplicate($task['id']);
-
- if ($task_id > 0) {
- $this->flash->success(t('Task created successfully.'));
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id)));
- } else {
- $this->flash->failure(t('Unable to create this task.'));
- return $this->response->redirect($this->helper->url->to('taskduplication', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
- }
- }
-
- return $this->response->html($this->template->render('task_duplication/duplicate', array(
- 'task' => $task,
- )));
- }
-
- /**
- * Move a task to another project
- *
- * @access public
- */
- public function move()
- {
- $task = $this->getTask();
-
- if ($this->request->isPost()) {
- $values = $this->request->getValues();
- list($valid, ) = $this->taskValidator->validateProjectModification($values);
-
- if ($valid && $this->taskDuplication->moveToProject($task['id'],
- $values['project_id'],
- $values['swimlane_id'],
- $values['column_id'],
- $values['category_id'],
- $values['owner_id'])) {
- $this->flash->success(t('Task updated successfully.'));
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $values['project_id'], 'task_id' => $task['id'])));
- }
-
- $this->flash->failure(t('Unable to update your task.'));
- }
-
- return $this->chooseDestination($task, 'task_duplication/move');
- }
-
- /**
- * Duplicate a task to another project
- *
- * @access public
- */
- public function copy()
- {
- $task = $this->getTask();
-
- if ($this->request->isPost()) {
- $values = $this->request->getValues();
- list($valid, ) = $this->taskValidator->validateProjectModification($values);
-
- if ($valid) {
- $task_id = $this->taskDuplication->duplicateToProject(
- $task['id'], $values['project_id'], $values['swimlane_id'],
- $values['column_id'], $values['category_id'], $values['owner_id']
- );
-
- if ($task_id > 0) {
- $this->flash->success(t('Task created successfully.'));
- return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $values['project_id'], 'task_id' => $task_id)));
- }
- }
-
- $this->flash->failure(t('Unable to create your task.'));
- }
-
- return $this->chooseDestination($task, 'task_duplication/copy');
- }
-
- /**
- * Choose destination when move/copy task to another project
- *
- * @access private
- * @param array $task
- * @param string $template
- */
- private function chooseDestination(array $task, $template)
- {
- $values = array();
- $projects_list = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
-
- unset($projects_list[$task['project_id']]);
-
- if (! empty($projects_list)) {
- $dst_project_id = $this->request->getIntegerParam('dst_project_id', key($projects_list));
-
- $swimlanes_list = $this->swimlane->getList($dst_project_id, false, true);
- $columns_list = $this->column->getList($dst_project_id);
- $categories_list = $this->category->getList($dst_project_id);
- $users_list = $this->projectUserRole->getAssignableUsersList($dst_project_id);
-
- $values = $this->taskDuplication->checkDestinationProjectValues($task);
- $values['project_id'] = $dst_project_id;
- } else {
- $swimlanes_list = array();
- $columns_list = array();
- $categories_list = array();
- $users_list = array();
- }
-
- $this->response->html($this->template->render($template, array(
- 'values' => $values,
- 'task' => $task,
- 'projects_list' => $projects_list,
- 'swimlanes_list' => $swimlanes_list,
- 'columns_list' => $columns_list,
- 'categories_list' => $categories_list,
- 'users_list' => $users_list,
- )));
- }
-}
diff --git a/app/Helper/LayoutHelper.php b/app/Helper/LayoutHelper.php
index aeb0c846..42047dd9 100644
--- a/app/Helper/LayoutHelper.php
+++ b/app/Helper/LayoutHelper.php
@@ -96,7 +96,7 @@ class LayoutHelper extends Base
public function projectUser($template, array $params)
{
$params['filter'] = array('user_id' => $params['user_id']);
- return $this->subLayout('project_user/layout', 'project_user/sidebar', $template, $params);
+ return $this->subLayout('project_user_overview/layout', 'project_user_overview/sidebar', $template, $params);
}
/**
diff --git a/app/Middleware/AuthenticationMiddleware.php b/app/Middleware/AuthenticationMiddleware.php
index c29b7ab6..499843fd 100644
--- a/app/Middleware/AuthenticationMiddleware.php
+++ b/app/Middleware/AuthenticationMiddleware.php
@@ -39,7 +39,7 @@ class AuthenticationMiddleware extends BaseMiddleware
$this->response->text('Not Authorized', 401);
} else {
$this->sessionStorage->redirectAfterLogin = $this->request->getUri();
- $this->response->redirect($this->helper->url->to('auth', 'login'));
+ $this->response->redirect($this->helper->url->to('AuthController', 'login'));
}
}
}
diff --git a/app/Middleware/PostAuthenticationMiddleware.php b/app/Middleware/PostAuthenticationMiddleware.php
index 650d47aa..f7eccbce 100644
--- a/app/Middleware/PostAuthenticationMiddleware.php
+++ b/app/Middleware/PostAuthenticationMiddleware.php
@@ -19,7 +19,7 @@ class PostAuthenticationMiddleware extends BaseMiddleware
{
$controller = strtolower($this->router->getController());
$action = strtolower($this->router->getAction());
- $ignore = ($controller === 'twofactorcontroller' && in_array($action, array('code', 'check'))) || ($controller === 'auth' && $action === 'logout');
+ $ignore = ($controller === 'twofactorcontroller' && in_array($action, array('code', 'check'))) || ($controller === 'authcontroller' && $action === 'logout');
if ($ignore === false && $this->userSession->hasPostAuthentication() && ! $this->userSession->isPostAuthenticationValidated()) {
$this->nextMiddleware = null;
diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php
index 3d4c7f6b..406cf1c2 100644
--- a/app/ServiceProvider/AuthenticationProvider.php
+++ b/app/ServiceProvider/AuthenticationProvider.php
@@ -66,39 +66,39 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->setRoleHierarchy(Role::PROJECT_MANAGER, array(Role::PROJECT_MEMBER, Role::PROJECT_VIEWER));
$acl->setRoleHierarchy(Role::PROJECT_MEMBER, array(Role::PROJECT_VIEWER));
- $acl->add('Action', '*', Role::PROJECT_MANAGER);
- $acl->add('ActionProject', '*', Role::PROJECT_MANAGER);
- $acl->add('ActionCreation', '*', Role::PROJECT_MANAGER);
- $acl->add('Analytic', '*', Role::PROJECT_MANAGER);
+ $acl->add('ActionController', '*', Role::PROJECT_MANAGER);
+ $acl->add('ProjectActionDuplicationController', '*', Role::PROJECT_MANAGER);
+ $acl->add('ActionCreationController', '*', Role::PROJECT_MANAGER);
+ $acl->add('AnalyticController', '*', Role::PROJECT_MANAGER);
$acl->add('Board', 'save', Role::PROJECT_MEMBER);
- $acl->add('BoardPopover', '*', Role::PROJECT_MEMBER);
+ $acl->add('BoardPopoverController', '*', Role::PROJECT_MEMBER);
$acl->add('TaskPopoverController', '*', Role::PROJECT_MEMBER);
- $acl->add('Calendar', 'save', Role::PROJECT_MEMBER);
- $acl->add('Category', '*', Role::PROJECT_MANAGER);
- $acl->add('Column', '*', Role::PROJECT_MANAGER);
- $acl->add('Comment', '*', Role::PROJECT_MEMBER);
- $acl->add('Customfilter', '*', Role::PROJECT_MEMBER);
- $acl->add('Export', '*', Role::PROJECT_MANAGER);
- $acl->add('TaskFile', array('screenshot', 'create', 'save', 'remove', 'confirm'), Role::PROJECT_MEMBER);
+ $acl->add('CalendarController', 'save', Role::PROJECT_MEMBER);
+ $acl->add('CategoryController', '*', Role::PROJECT_MANAGER);
+ $acl->add('ColumnController', '*', Role::PROJECT_MANAGER);
+ $acl->add('CommentController', '*', Role::PROJECT_MEMBER);
+ $acl->add('CustomFilterController', '*', Role::PROJECT_MEMBER);
+ $acl->add('ExportController', '*', Role::PROJECT_MANAGER);
+ $acl->add('TaskFileController', array('screenshot', 'create', 'save', 'remove', 'confirm'), Role::PROJECT_MEMBER);
$acl->add('Gantt', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectViewController', array('share', 'updateSharing', 'integrations', 'updateIntegrations', 'notifications', 'updateNotifications', 'duplicate', 'doDuplication'), Role::PROJECT_MANAGER);
$acl->add('ProjectPermissionController', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectEditController', '*', Role::PROJECT_MANAGER);
- $acl->add('ProjectFile', '*', Role::PROJECT_MEMBER);
- $acl->add('Projectuser', '*', Role::PROJECT_MANAGER);
+ $acl->add('ProjectFileController', '*', Role::PROJECT_MEMBER);
+ $acl->add('ProjectUserOverviewController', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectStatusController', '*', Role::PROJECT_MANAGER);
$acl->add('SubtaskController', '*', Role::PROJECT_MEMBER);
$acl->add('SubtaskRestrictionController', '*', Role::PROJECT_MEMBER);
$acl->add('SubtaskStatusController', '*', Role::PROJECT_MEMBER);
- $acl->add('Swimlane', '*', Role::PROJECT_MANAGER);
+ $acl->add('SwimlaneController', '*', Role::PROJECT_MANAGER);
$acl->add('TaskViewController', 'remove', Role::PROJECT_MEMBER);
$acl->add('TaskCreationController', '*', Role::PROJECT_MEMBER);
$acl->add('TaskBulkController', '*', Role::PROJECT_MEMBER);
- $acl->add('Taskduplication', '*', Role::PROJECT_MEMBER);
+ $acl->add('TaskDuplicationController', '*', Role::PROJECT_MEMBER);
$acl->add('TaskRecurrenceController', '*', Role::PROJECT_MEMBER);
$acl->add('TaskImportController', '*', Role::PROJECT_MANAGER);
$acl->add('TaskInternalLinkController', '*', Role::PROJECT_MEMBER);
- $acl->add('TaskExternalLink', '*', Role::PROJECT_MEMBER);
+ $acl->add('TaskExternalLinkController', '*', Role::PROJECT_MEMBER);
$acl->add('TaskModificationController', '*', Role::PROJECT_MEMBER);
$acl->add('TaskStatusController', '*', Role::PROJECT_MEMBER);
$acl->add('UserAjaxController', array('mention'), Role::PROJECT_MEMBER);
@@ -120,10 +120,9 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->setRoleHierarchy(Role::APP_MANAGER, array(Role::APP_USER, Role::APP_PUBLIC));
$acl->setRoleHierarchy(Role::APP_USER, array(Role::APP_PUBLIC));
- $acl->add('Auth', array('login', 'check'), Role::APP_PUBLIC);
+ $acl->add('AuthController', array('login', 'check'), Role::APP_PUBLIC);
$acl->add('CaptchaController', '*', Role::APP_PUBLIC);
- $acl->add('PasswordReset', '*', Role::APP_PUBLIC);
- $acl->add('Webhook', '*', Role::APP_PUBLIC);
+ $acl->add('PasswordResetController', '*', Role::APP_PUBLIC);
$acl->add('TaskViewController', 'readonly', Role::APP_PUBLIC);
$acl->add('Board', 'readonly', Role::APP_PUBLIC);
$acl->add('ICalendarController', '*', Role::APP_PUBLIC);
@@ -137,9 +136,9 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('GroupListController', '*', Role::APP_ADMIN);
$acl->add('GroupCreationController', '*', Role::APP_ADMIN);
$acl->add('GroupModificationController', '*', Role::APP_ADMIN);
- $acl->add('Link', '*', Role::APP_ADMIN);
- $acl->add('ProjectCreation', 'create', Role::APP_MANAGER);
- $acl->add('Projectuser', '*', Role::APP_MANAGER);
+ $acl->add('LinkController', '*', Role::APP_ADMIN);
+ $acl->add('ProjectCreationController', 'create', Role::APP_MANAGER);
+ $acl->add('ProjectUserOverviewController', '*', Role::APP_MANAGER);
$acl->add('TwoFactorController', 'disable', Role::APP_ADMIN);
$acl->add('UserImportController', '*', Role::APP_ADMIN);
$acl->add('UserCreationController', '*', Role::APP_ADMIN);
diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php
index c30c1574..0182fb39 100644
--- a/app/ServiceProvider/RouteProvider.php
+++ b/app/ServiceProvider/RouteProvider.php
@@ -45,24 +45,24 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('search/activity', 'SearchController', 'activity');
// ProjectCreation routes
- $container['route']->addRoute('project/create', 'ProjectCreation', 'create');
- $container['route']->addRoute('project/create/private', 'ProjectCreation', 'createPrivate');
+ $container['route']->addRoute('project/create', 'ProjectCreationController', 'create');
+ $container['route']->addRoute('project/create/private', 'ProjectCreationController', 'createPrivate');
// Project routes
$container['route']->addRoute('projects', 'ProjectListController', 'show');
$container['route']->addRoute('project/:project_id', 'ProjectViewController', 'show');
$container['route']->addRoute('p/:project_id', 'ProjectViewController', 'show');
- $container['route']->addRoute('project/:project_id/customer-filters', 'customfilter', 'index');
+ $container['route']->addRoute('project/:project_id/customer-filters', 'CustomFilterController', 'index');
$container['route']->addRoute('project/:project_id/share', 'ProjectViewController', 'share');
$container['route']->addRoute('project/:project_id/notifications', 'ProjectViewController', 'notifications');
$container['route']->addRoute('project/:project_id/integrations', 'ProjectViewController', 'integrations');
$container['route']->addRoute('project/:project_id/duplicate', 'ProjectViewController', 'duplicate');
$container['route']->addRoute('project/:project_id/permissions', 'ProjectPermissionController', 'index');
$container['route']->addRoute('project/:project_id/import', 'TaskImportController', 'step1');
- $container['route']->addRoute('project/:project_id/activity', 'activity', 'project');
+ $container['route']->addRoute('project/:project_id/activity', 'ActivityController', 'project');
// Project Overview
- $container['route']->addRoute('project/:project_id/overview', 'ProjectOverview', 'show');
+ $container['route']->addRoute('project/:project_id/overview', 'ProjectOverviewController', 'show');
// ProjectEdit routes
$container['route']->addRoute('project/:project_id/edit', 'ProjectEditController', 'edit');
@@ -71,48 +71,48 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('project/:project_id/edit/priority', 'ProjectEditController', 'priority');
// ProjectUser routes
- $container['route']->addRoute('projects/managers/:user_id', 'projectuser', 'managers');
- $container['route']->addRoute('projects/members/:user_id', 'projectuser', 'members');
- $container['route']->addRoute('projects/tasks/:user_id/opens', 'projectuser', 'opens');
- $container['route']->addRoute('projects/tasks/:user_id/closed', 'projectuser', 'closed');
- $container['route']->addRoute('projects/managers', 'projectuser', 'managers');
+ $container['route']->addRoute('projects/managers/:user_id', 'ProjectUserOverviewController', 'managers');
+ $container['route']->addRoute('projects/members/:user_id', 'ProjectUserOverviewController', 'members');
+ $container['route']->addRoute('projects/tasks/:user_id/opens', 'ProjectUserOverviewController', 'opens');
+ $container['route']->addRoute('projects/tasks/:user_id/closed', 'ProjectUserOverviewController', 'closed');
+ $container['route']->addRoute('projects/managers', 'ProjectUserOverviewController', 'managers');
// Action routes
- $container['route']->addRoute('project/:project_id/actions', 'action', 'index');
+ $container['route']->addRoute('project/:project_id/actions', 'ActionController', 'index');
// Column routes
- $container['route']->addRoute('project/:project_id/columns', 'column', 'index');
+ $container['route']->addRoute('project/:project_id/columns', 'ColumnController', 'index');
// Swimlane routes
- $container['route']->addRoute('project/:project_id/swimlanes', 'swimlane', 'index');
+ $container['route']->addRoute('project/:project_id/swimlanes', 'SwimlaneController', 'index');
// Category routes
- $container['route']->addRoute('project/:project_id/categories', 'category', 'index');
+ $container['route']->addRoute('project/:project_id/categories', 'CategoryController', 'index');
// Task routes
$container['route']->addRoute('project/:project_id/task/:task_id', 'TaskViewController', 'show');
$container['route']->addRoute('t/:task_id', 'TaskViewController', 'show');
$container['route']->addRoute('public/task/:task_id/:token', 'TaskViewController', 'readonly');
- $container['route']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task');
+ $container['route']->addRoute('project/:project_id/task/:task_id/activity', 'ActivityController', 'task');
$container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'TaskViewController', 'transitions');
$container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'TaskViewController', 'analytics');
$container['route']->addRoute('project/:project_id/task/:task_id/time-tracking', 'TaskViewController', 'timetracking');
// Exports
- $container['route']->addRoute('export/tasks/:project_id', 'export', 'tasks');
- $container['route']->addRoute('export/subtasks/:project_id', 'export', 'subtasks');
- $container['route']->addRoute('export/transitions/:project_id', 'export', 'transitions');
- $container['route']->addRoute('export/summary/:project_id', 'export', 'summary');
+ $container['route']->addRoute('export/tasks/:project_id', 'ExportController', 'tasks');
+ $container['route']->addRoute('export/subtasks/:project_id', 'ExportController', 'subtasks');
+ $container['route']->addRoute('export/transitions/:project_id', 'ExportController', 'transitions');
+ $container['route']->addRoute('export/summary/:project_id', 'ExportController', 'summary');
// Analytics routes
- $container['route']->addRoute('analytics/tasks/:project_id', 'analytic', 'tasks');
- $container['route']->addRoute('analytics/users/:project_id', 'analytic', 'users');
- $container['route']->addRoute('analytics/cfd/:project_id', 'analytic', 'cfd');
- $container['route']->addRoute('analytics/burndown/:project_id', 'analytic', 'burndown');
- $container['route']->addRoute('analytics/average-time-column/:project_id', 'analytic', 'averageTimeByColumn');
- $container['route']->addRoute('analytics/lead-cycle-time/:project_id', 'analytic', 'leadAndCycleTime');
- $container['route']->addRoute('analytics/estimated-spent-time/:project_id', 'analytic', 'compareHours');
+ $container['route']->addRoute('analytics/tasks/:project_id', 'AnalyticController', 'tasks');
+ $container['route']->addRoute('analytics/users/:project_id', 'AnalyticController', 'users');
+ $container['route']->addRoute('analytics/cfd/:project_id', 'AnalyticController', 'cfd');
+ $container['route']->addRoute('analytics/burndown/:project_id', 'AnalyticController', 'burndown');
+ $container['route']->addRoute('analytics/average-time-column/:project_id', 'AnalyticController', 'averageTimeByColumn');
+ $container['route']->addRoute('analytics/lead-cycle-time/:project_id', 'AnalyticController', 'leadAndCycleTime');
+ $container['route']->addRoute('analytics/estimated-spent-time/:project_id', 'AnalyticController', 'compareHours');
// Board routes
$container['route']->addRoute('board/:project_id', 'board', 'show');
@@ -120,12 +120,12 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('public/board/:token', 'board', 'readonly');
// Calendar routes
- $container['route']->addRoute('calendar/:project_id', 'calendar', 'show');
- $container['route']->addRoute('c/:project_id', 'calendar', 'show');
+ $container['route']->addRoute('calendar/:project_id', 'CalendarController', 'show');
+ $container['route']->addRoute('c/:project_id', 'CalendarController', 'show');
// Listing routes
- $container['route']->addRoute('list/:project_id', 'listing', 'show');
- $container['route']->addRoute('l/:project_id', 'listing', 'show');
+ $container['route']->addRoute('list/:project_id', 'TaskListController', 'show');
+ $container['route']->addRoute('l/:project_id', 'TaskListController', 'show');
// Gantt routes
$container['route']->addRoute('gantt/:project_id', 'gantt', 'project');
@@ -170,7 +170,7 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('settings/integrations', 'ConfigController', 'integrations');
$container['route']->addRoute('settings/webhook', 'ConfigController', 'webhook');
$container['route']->addRoute('settings/api', 'ConfigController', 'api');
- $container['route']->addRoute('settings/links', 'link', 'index');
+ $container['route']->addRoute('settings/links', 'LinkController', 'index');
$container['route']->addRoute('settings/currencies', 'CurrencyController', 'index');
// Plugins
@@ -182,12 +182,12 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('documentation', 'DocumentationController', 'show');
// Auth routes
- $container['route']->addRoute('login', 'auth', 'login');
- $container['route']->addRoute('logout', 'auth', 'logout');
+ $container['route']->addRoute('login', 'AuthController', 'login');
+ $container['route']->addRoute('logout', 'AuthController', 'logout');
// PasswordReset
- $container['route']->addRoute('forgot-password', 'PasswordReset', 'create');
- $container['route']->addRoute('forgot-password/change/:token', 'PasswordReset', 'change');
+ $container['route']->addRoute('forgot-password', 'PasswordResetController', 'create');
+ $container['route']->addRoute('forgot-password/change/:token', 'PasswordResetController', 'change');
}
return $container;
diff --git a/app/Template/action/index.php b/app/Template/action/index.php
index 63d63887..0a94e4f0 100644
--- a/app/Template/action/index.php
+++ b/app/Template/action/index.php
@@ -3,11 +3,11 @@
- = $this->url->link(t('Add a new action'), 'ActionCreation', 'create', array('project_id' => $project['id']), false, 'popover') ?>
+ = $this->url->link(t('Add a new action'), 'ActionCreationController', 'create', array('project_id' => $project['id']), false, 'popover') ?>
- = $this->url->link(t('Import from another project'), 'ActionProject', 'project', array('project_id' => $project['id']), false, 'popover') ?>
+ = $this->url->link(t('Import from another project'), 'ProjectActionDuplicationController', 'show', array('project_id' => $project['id']), false, 'popover') ?>
@@ -63,9 +63,9 @@
- = $this->url->link(t('Remove'), 'action', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id']), false, 'popover') ?>
+ = $this->url->link(t('Remove'), 'ActionController', 'confirm', array('project_id' => $project['id'], 'action_id' => $action['id']), false, 'popover') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/action/remove.php b/app/Template/action/remove.php
index 070a7918..384bec7a 100644
--- a/app/Template/action/remove.php
+++ b/app/Template/action/remove.php
@@ -8,8 +8,8 @@
- = $this->url->link(t('Yes'), 'action', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?>
+ = $this->url->link(t('Yes'), 'ActionController', 'remove', array('project_id' => $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?>
= t('or') ?>
- = $this->url->link(t('cancel'), 'action', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
+ = $this->url->link(t('cancel'), 'ActionController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/action_creation/create.php b/app/Template/action_creation/create.php
index bccb19b3..c0d2880e 100644
--- a/app/Template/action_creation/create.php
+++ b/app/Template/action_creation/create.php
@@ -1,7 +1,7 @@
-
\ No newline at end of file
+
diff --git a/app/Template/action_creation/event.php b/app/Template/action_creation/event.php
index e7e5aaf9..cdf00310 100644
--- a/app/Template/action_creation/event.php
+++ b/app/Template/action_creation/event.php
@@ -2,7 +2,7 @@
= t('Choose an event') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/action_creation/params.php b/app/Template/action_creation/params.php
index 46ca52a4..fa892177 100644
--- a/app/Template/action_creation/params.php
+++ b/app/Template/action_creation/params.php
@@ -2,7 +2,7 @@
= t('Define action parameters') ?>
-
diff --git a/app/Template/action_project/project.php b/app/Template/action_project/project.php
deleted file mode 100644
index 226f3b19..00000000
--- a/app/Template/action_project/project.php
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- = t('There is no available project.') ?>
-
-
-
\ No newline at end of file
diff --git a/app/Template/activity/project.php b/app/Template/activity/project.php
index 70235cfc..ce1c8c0f 100644
--- a/app/Template/activity/project.php
+++ b/app/Template/activity/project.php
@@ -1,5 +1,5 @@
- = $this->projectHeader->render($project, 'Analytic', $this->app->getRouterAction()) ?>
+ = $this->projectHeader->render($project, 'AnalyticController', $this->app->getRouterAction()) ?>
app->config('password_reset') == 1): ?>
- = $this->url->link(t('Forgot password?'), 'PasswordReset', 'create') ?>
+ = $this->url->link(t('Forgot password?'), 'PasswordResetController', 'create') ?>
diff --git a/app/Template/board/table_column.php b/app/Template/board/table_column.php
index eced52dc..f7a9f6ad 100644
--- a/app/Template/board/table_column.php
+++ b/app/Template/board/table_column.php
@@ -43,7 +43,7 @@
0): ?>
- = $this->url->link(t('Close all tasks of this column'), 'BoardPopover', 'confirmCloseColumnTasks', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?>
+ = $this->url->link(t('Close all tasks of this column'), 'BoardPopoverController', 'confirmCloseColumnTasks', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?>
diff --git a/app/Template/board/table_swimlane.php b/app/Template/board/table_swimlane.php
index 349b9acb..c5937e01 100644
--- a/app/Template/board/table_swimlane.php
+++ b/app/Template/board/table_swimlane.php
@@ -14,7 +14,7 @@
+ data-href="= $this->url->href('BoardTooltipController', 'swimlane', array('swimlane_id' => $swimlane['id'], 'project_id' => $project['id'])) ?>">
diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php
index 67cae77a..8cf3e709 100644
--- a/app/Template/board/task_footer.php
+++ b/app/Template/board/task_footer.php
@@ -34,35 +34,35 @@
-
+
-
+
- = $task['nb_links'] ?>
+ = $task['nb_links'] ?>
- = $task['nb_external_links'] ?>
+ = $task['nb_external_links'] ?>
- = round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?>
+ = round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?>
- = $task['nb_files'] ?>
+ = $task['nb_files'] ?>
- = $task['nb_comments'] ?>
+ = $task['nb_comments'] ?>
-
+
diff --git a/app/Template/board/tooltip_files.php b/app/Template/board/tooltip_files.php
index 5ade5b5b..6f9e2640 100644
--- a/app/Template/board/tooltip_files.php
+++ b/app/Template/board/tooltip_files.php
@@ -9,9 +9,9 @@
- = $this->url->link(t('download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
+ = $this->url->link(t('download'), 'FileViewerController', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
- = $this->url->link(t('open file'), 'FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
+ = $this->url->link(t('open file'), 'FileViewerController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
diff --git a/app/Template/board_popover/close_all_tasks_column.php b/app/Template/board_popover/close_all_tasks_column.php
index 5090f499..bd167786 100644
--- a/app/Template/board_popover/close_all_tasks_column.php
+++ b/app/Template/board_popover/close_all_tasks_column.php
@@ -2,7 +2,7 @@
-
-
\ No newline at end of file
+
diff --git a/app/Template/calendar/show.php b/app/Template/calendar/show.php
index f00e810b..3635f627 100644
--- a/app/Template/calendar/show.php
+++ b/app/Template/calendar/show.php
@@ -1,9 +1,9 @@
- = $this->projectHeader->render($project, 'Calendar', 'show') ?>
+ = $this->projectHeader->render($project, 'CalendarController', 'show') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/category/edit.php b/app/Template/category/edit.php
index 7b592689..fac56db3 100644
--- a/app/Template/category/edit.php
+++ b/app/Template/category/edit.php
@@ -2,7 +2,7 @@
= t('Category modification for the project "%s"', $project['name']) ?>
-
\ No newline at end of file
+
diff --git a/app/Template/category/index.php b/app/Template/category/index.php
index b3bdfd81..a103d89f 100644
--- a/app/Template/category/index.php
+++ b/app/Template/category/index.php
@@ -15,10 +15,10 @@
- = $this->url->link(t('Edit'), 'category', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?>
+ = $this->url->link(t('Edit'), 'CategoryController', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?>
- = $this->url->link(t('Remove'), 'category', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?>
+ = $this->url->link(t('Remove'), 'CategoryController', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?>
@@ -31,7 +31,7 @@
-
\ No newline at end of file
+
diff --git a/app/Template/category/remove.php b/app/Template/category/remove.php
index cad58d37..e7b9c9b4 100644
--- a/app/Template/category/remove.php
+++ b/app/Template/category/remove.php
@@ -9,9 +9,9 @@
- = $this->url->link(t('Yes'), 'category', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?>
+ = $this->url->link(t('Yes'), 'CategoryController', 'remove', array('project_id' => $project['id'], 'category_id' => $category['id']), true, 'btn btn-red') ?>
= t('or') ?>
- = $this->url->link(t('cancel'), 'category', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
+ = $this->url->link(t('cancel'), 'CategoryController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/column/create.php b/app/Template/column/create.php
index 2d325f76..023de525 100644
--- a/app/Template/column/create.php
+++ b/app/Template/column/create.php
@@ -1,7 +1,7 @@
-
\ No newline at end of file
+
diff --git a/app/Template/column/edit.php b/app/Template/column/edit.php
index 412858a9..a742e4b9 100644
--- a/app/Template/column/edit.php
+++ b/app/Template/column/edit.php
@@ -2,7 +2,7 @@
= t('Edit column "%s"', $column['title']) ?>
-
\ No newline at end of file
+
diff --git a/app/Template/column/index.php b/app/Template/column/index.php
index 6bc67c5a..4f5f0a60 100644
--- a/app/Template/column/index.php
+++ b/app/Template/column/index.php
@@ -3,7 +3,7 @@
- = $this->url->link(t('Add a new column'), 'Column', 'create', array('project_id' => $project['id']), false, 'popover') ?>
+ = $this->url->link(t('Add a new column'), 'ColumnController', 'create', array('project_id' => $project['id']), false, 'popover') ?>
@@ -13,7 +13,7 @@
+ data-save-position-url="= $this->url->href('ColumnController', 'move', array('project_id' => $project['id'])) ?>">
= t('Column title') ?>
@@ -41,10 +41,10 @@
- = $this->url->link(t('Edit'), 'column', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?>
+ = $this->url->link(t('Edit'), 'ColumnController', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?>
- = $this->url->link(t('Remove'), 'column', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?>
+ = $this->url->link(t('Remove'), 'ColumnController', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id']), false, 'popover') ?>
diff --git a/app/Template/column/remove.php b/app/Template/column/remove.php
index ccab889d..b231a9a7 100644
--- a/app/Template/column/remove.php
+++ b/app/Template/column/remove.php
@@ -9,7 +9,7 @@
- = $this->url->link(t('Yes'), 'column', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?>
- = t('or') ?> = $this->url->link(t('cancel'), 'column', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
+ = $this->url->link(t('Yes'), 'ColumnController', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?>
+ = t('or') ?> = $this->url->link(t('cancel'), 'ColumnController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/comment/create.php b/app/Template/comment/create.php
index 2a92a2f8..0358107a 100644
--- a/app/Template/comment/create.php
+++ b/app/Template/comment/create.php
@@ -1,7 +1,7 @@
-
@@ -30,4 +30,4 @@
= t('There is no link.') ?>
-= $this->render('link/create', array('values' => $values, 'errors' => $errors)) ?>
\ No newline at end of file
+= $this->render('link/create', array('values' => $values, 'errors' => $errors)) ?>
diff --git a/app/Template/link/remove.php b/app/Template/link/remove.php
index 12ca14bb..b7fbef5e 100644
--- a/app/Template/link/remove.php
+++ b/app/Template/link/remove.php
@@ -8,8 +8,8 @@
- = $this->url->link(t('Yes'), 'link', 'remove', array('link_id' => $link['id']), true, 'btn btn-red') ?>
+ = $this->url->link(t('Yes'), 'LinkController', 'remove', array('link_id' => $link['id']), true, 'btn btn-red') ?>
= t('or') ?>
- = $this->url->link(t('cancel'), 'link', 'index') ?>
+ = $this->url->link(t('cancel'), 'LinkController', 'index') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/listing/show.php b/app/Template/listing/show.php
deleted file mode 100644
index 4ceb7f87..00000000
--- a/app/Template/listing/show.php
+++ /dev/null
@@ -1,62 +0,0 @@
-
- = $this->projectHeader->render($project, 'Listing', 'show') ?>
-
- isEmpty()): ?>
- = t('No tasks found.') ?>
- isEmpty()): ?>
-
-
- = $paginator->order(t('Id'), 'tasks.id') ?>
- = $paginator->order(t('Swimlane'), 'tasks.swimlane_id') ?>
- = $paginator->order(t('Column'), 'tasks.column_id') ?>
- = $paginator->order(t('Category'), 'tasks.category_id') ?>
- = $paginator->order(t('Title'), 'tasks.title') ?>
- = $paginator->order(t('Assignee'), 'users.username') ?>
- = $paginator->order(t('Due date'), 'tasks.date_due') ?>
- = $paginator->order(t('Status'), 'tasks.is_active') ?>
-
- getCollection() as $task): ?>
-
-
- user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
- = $this->render('task/dropdown', array('task' => $task)) ?>
-
- #= $task['id'] ?>
-
-
-
- = $this->text->e($task['swimlane_name'] ?: $task['default_swimlane']) ?>
-
-
- = $this->text->e($task['column_name']) ?>
-
-
- = $this->text->e($task['category_name']) ?>
-
-
- = $this->url->link($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?>
-
-
-
- = $this->text->e($task['assignee_name'] ?: $task['assignee_username']) ?>
-
- = t('Unassigned') ?>
-
-
-
- = $this->dt->date($task['date_due']) ?>
-
-
-
- = t('Open') ?>
-
- = t('Closed') ?>
-
-
-
-
-
-
- = $paginator ?>
-
-
diff --git a/app/Template/password_reset/change.php b/app/Template/password_reset/change.php
index 0a1d8de4..80a035da 100644
--- a/app/Template/password_reset/change.php
+++ b/app/Template/password_reset/change.php
@@ -1,6 +1,6 @@
= t('Password Reset') ?>
-
+
= $this->form->csrf() ?>
= $this->form->label(t('New password'), 'password') ?>
@@ -13,4 +13,4 @@
= t('Change Password') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/password_reset/create.php b/app/Template/password_reset/create.php
index f1877aa7..f43d95fc 100644
--- a/app/Template/password_reset/create.php
+++ b/app/Template/password_reset/create.php
@@ -1,6 +1,6 @@
-
\ No newline at end of file
+
diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php
index 0f58c112..3fac3fd1 100644
--- a/app/Template/project/sidebar.php
+++ b/app/Template/project/sidebar.php
@@ -4,9 +4,9 @@
app->checkMenuSelection('ProjectViewController', 'show') ?>>
= $this->url->link(t('Summary'), 'ProjectViewController', 'show', array('project_id' => $project['id'])) ?>
- user->hasProjectAccess('customfilter', 'index', $project['id'])): ?>
- app->checkMenuSelection('customfilter') ?>>
- = $this->url->link(t('Custom filters'), 'customfilter', 'index', array('project_id' => $project['id'])) ?>
+ user->hasProjectAccess('CustomFilterController', 'index', $project['id'])): ?>
+ app->checkMenuSelection('CustomFilterController') ?>>
+ = $this->url->link(t('Custom filters'), 'CustomFilterController', 'index', array('project_id' => $project['id'])) ?>
@@ -23,22 +23,22 @@
app->checkMenuSelection('ProjectViewController', 'integrations') ?>>
= $this->url->link(t('Integrations'), 'ProjectViewController', 'integrations', array('project_id' => $project['id'])) ?>
- app->checkMenuSelection('column') ?>>
- = $this->url->link(t('Columns'), 'column', 'index', array('project_id' => $project['id'])) ?>
+ app->checkMenuSelection('ColumnController') ?>>
+ = $this->url->link(t('Columns'), 'ColumnController', 'index', array('project_id' => $project['id'])) ?>
- app->checkMenuSelection('swimlane') ?>>
- = $this->url->link(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?>
+ app->checkMenuSelection('SwimlaneController') ?>>
+ = $this->url->link(t('Swimlanes'), 'SwimlaneController', 'index', array('project_id' => $project['id'])) ?>
app->checkMenuSelection('category') ?>>
- = $this->url->link(t('Categories'), 'category', 'index', array('project_id' => $project['id'])) ?>
+ = $this->url->link(t('Categories'), 'CategoryController', 'index', array('project_id' => $project['id'])) ?>
app->checkMenuSelection('ProjectPermissionController') ?>>
= $this->url->link(t('Permissions'), 'ProjectPermissionController', 'index', array('project_id' => $project['id'])) ?>
- app->checkMenuSelection('action') ?>>
- = $this->url->link(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?>
+ app->checkMenuSelection('ActionController') ?>>
+ = $this->url->link(t('Automatic actions'), 'ActionController', 'index', array('project_id' => $project['id'])) ?>
app->checkMenuSelection('ProjectViewController', 'duplicate') ?>>
= $this->url->link(t('Duplicate'), 'ProjectViewController', 'duplicate', array('project_id' => $project['id'])) ?>
diff --git a/app/Template/project_action_duplication/show.php b/app/Template/project_action_duplication/show.php
new file mode 100644
index 00000000..2eebb262
--- /dev/null
+++ b/app/Template/project_action_duplication/show.php
@@ -0,0 +1,19 @@
+
+
+ = t('There is no available project.') ?>
+
+
+ = $this->form->csrf() ?>
+
+ = $this->form->label(t('Create from another project'), 'src_project_id') ?>
+ = $this->form->select('src_project_id', $projects_list) ?>
+
+
+ = t('Save') ?>
+ = t('or') ?>
+ = $this->url->link(t('cancel'), 'Action', 'index', array(), false, 'close-popover') ?>
+
+
+
diff --git a/app/Template/project_creation/create.php b/app/Template/project_creation/create.php
index ea5783a6..fb892012 100644
--- a/app/Template/project_creation/create.php
+++ b/app/Template/project_creation/create.php
@@ -2,7 +2,7 @@
-
+
= $this->form->csrf() ?>
= $this->form->hidden('is_private', $values) ?>
diff --git a/app/Template/project_edit/general.php b/app/Template/project_edit/general.php
index b817bcd4..c7421477 100644
--- a/app/Template/project_edit/general.php
+++ b/app/Template/project_edit/general.php
@@ -24,7 +24,7 @@
= $this->form->select('owner_id', $owners, $values, $errors) ?>
- user->hasProjectAccess('ProjectCreation', 'create', $project['id'])): ?>
+ user->hasProjectAccess('ProjectCreationController', 'create', $project['id'])): ?>
= $this->form->checkbox('is_private', t('Private project'), 1, $project['is_private'] == 1) ?>
= t('Private projects do not have users and groups management.') ?>
diff --git a/app/Template/project_file/create.php b/app/Template/project_file/create.php
index 9858b273..e262799b 100644
--- a/app/Template/project_file/create.php
+++ b/app/Template/project_file/create.php
@@ -4,7 +4,7 @@
= t('All files have been uploaded successfully.') ?>
- = $this->url->link(t('View uploaded files'), 'ProjectOverview', 'show', array('project_id' => $project['id'])) ?>
+ = $this->url->link(t('View uploaded files'), 'ProjectOverviewController', 'show', array('project_id' => $project['id'])) ?>
@@ -18,7 +18,7 @@
+ data-url="= $this->url->href('ProjectFileController', 'save', array('project_id' => $project['id'])) ?>">
@@ -29,5 +29,5 @@
= t('or') ?>
- = $this->url->link(t('cancel'), 'ProjectOverview', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
+ = $this->url->link(t('cancel'), 'ProjectOverviewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
diff --git a/app/Template/project_file/remove.php b/app/Template/project_file/remove.php
index ba834288..0517a9e7 100644
--- a/app/Template/project_file/remove.php
+++ b/app/Template/project_file/remove.php
@@ -8,8 +8,8 @@
- = $this->url->link(t('Yes'), 'ProjectFile', 'remove', array('project_id' => $project['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?>
+ = $this->url->link(t('Yes'), 'ProjectFileController', 'remove', array('project_id' => $project['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?>
= t('or') ?>
- = $this->url->link(t('cancel'), 'ProjectOverview', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
+ = $this->url->link(t('cancel'), 'ProjectOverviewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
-
\ No newline at end of file
+
diff --git a/app/Template/project_header/dropdown.php b/app/Template/project_header/dropdown.php
index 5a27e981..d98552e6 100644
--- a/app/Template/project_header/dropdown.php
+++ b/app/Template/project_header/dropdown.php
@@ -39,13 +39,13 @@
- = $this->url->link(t('Activity'), 'activity', 'project', array('project_id' => $project['id'])) ?>
+ = $this->url->link(t('Activity'), 'ActivityController', 'project', array('project_id' => $project['id'])) ?>
- user->hasProjectAccess('customfilter', 'index', $project['id'])): ?>
+ user->hasProjectAccess('CustomFilterController', 'index', $project['id'])): ?>
- = $this->url->link(t('Custom filters'), 'customfilter', 'index', array('project_id' => $project['id'])) ?>
+ = $this->url->link(t('Custom filters'), 'CustomFilterController', 'index', array('project_id' => $project['id'])) ?>
@@ -58,17 +58,17 @@
= $this->hook->render('template:project:dropdown', array('project' => $project)) ?>
- user->hasProjectAccess('analytic', 'tasks', $project['id'])): ?>
+ user->hasProjectAccess('AnalyticController', 'tasks', $project['id'])): ?>
- = $this->url->link(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?>
+ = $this->url->link(t('Analytics'), 'AnalyticController', 'tasks', array('project_id' => $project['id'])) ?>
- user->hasProjectAccess('export', 'tasks', $project['id'])): ?>
+ user->hasProjectAccess('ExportController', 'tasks', $project['id'])): ?>
- = $this->url->link(t('Exports'), 'export', 'tasks', array('project_id' => $project['id'])) ?>
+ = $this->url->link(t('Exports'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?>
diff --git a/app/Template/project_header/views.php b/app/Template/project_header/views.php
index 353e4b62..e444235a 100644
--- a/app/Template/project_header/views.php
+++ b/app/Template/project_header/views.php
@@ -1,24 +1,24 @@
- app->getRouterController() === 'ProjectOverview' ? 'class="active"' : '' ?>>
+ app->checkMenuSelection('ProjectOverviewController') ?>>
- = $this->url->link(t('Overview'), 'ProjectOverview', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-overview', t('Keyboard shortcut: "%s"', 'v o')) ?>
+ = $this->url->link(t('Overview'), 'ProjectOverviewController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-overview', t('Keyboard shortcut: "%s"', 'v o')) ?>
- app->getRouterController() === 'Board' ? 'class="active"' : '' ?>>
+ app->checkMenuSelection('Board') ?>>
= $this->url->link(t('Board'), 'board', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-board', t('Keyboard shortcut: "%s"', 'v b')) ?>
- app->getRouterController() === 'Calendar' ? 'class="active"' : '' ?>>
+ app->checkMenuSelection('Calendar') ?>>
- = $this->url->link(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-calendar', t('Keyboard shortcut: "%s"', 'v c')) ?>
+ = $this->url->link(t('Calendar'), 'CalendarController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-calendar', t('Keyboard shortcut: "%s"', 'v c')) ?>
- app->getRouterController() === 'Listing' ? 'class="active"' : '' ?>>
+ app->checkMenuSelection('TaskListController') ?>>
- = $this->url->link(t('List'), 'listing', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-listing', t('Keyboard shortcut: "%s"', 'v l')) ?>
+ = $this->url->link(t('List'), 'TaskListController', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-listing', t('Keyboard shortcut: "%s"', 'v l')) ?>
user->hasProjectAccess('gantt', 'project', $project['id'])): ?>
- app->getRouterController() === 'Gantt' ? 'class="active"' : '' ?>>
+ app->checkMenuSelection('Gantt') ?>>
= $this->url->link(t('Gantt'), 'gantt', 'project', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-gantt', t('Keyboard shortcut: "%s"', 'v g')) ?>
-
\ No newline at end of file
+
diff --git a/app/Template/project_list/show.php b/app/Template/project_list/show.php
index 06e4a626..3fd69f41 100644
--- a/app/Template/project_list/show.php
+++ b/app/Template/project_list/show.php
@@ -1,8 +1,8 @@