summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Auth.php9
-rw-r--r--app/Controller/BoardPopover.php2
-rw-r--r--app/Controller/BoardTooltip.php2
-rw-r--r--app/Controller/Config.php7
-rw-r--r--app/Controller/Customfilter.php17
-rw-r--r--app/Controller/Gantt.php1
-rw-r--r--app/Controller/Listing.php3
-rw-r--r--app/Controller/Projectuser.php6
-rw-r--r--app/Controller/Task.php4
-rw-r--r--app/Controller/TaskFile.php (renamed from app/Controller/File.php)40
-rw-r--r--app/Controller/Taskcreation.php1
-rw-r--r--app/Controller/Taskmodification.php1
-rw-r--r--app/Controller/User.php29
-rw-r--r--app/Controller/UserStatus.php111
14 files changed, 176 insertions, 57 deletions
diff --git a/app/Controller/Auth.php b/app/Controller/Auth.php
index fef7f0e3..b98dff5d 100644
--- a/app/Controller/Auth.php
+++ b/app/Controller/Auth.php
@@ -55,8 +55,13 @@ class Auth extends Base
*/
public function logout()
{
- $this->sessionManager->close();
- $this->response->redirect($this->helper->url->to('auth', 'login'));
+ 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'));
+ }
}
/**
diff --git a/app/Controller/BoardPopover.php b/app/Controller/BoardPopover.php
index f2b39d8d..965669ff 100644
--- a/app/Controller/BoardPopover.php
+++ b/app/Controller/BoardPopover.php
@@ -93,7 +93,7 @@ class BoardPopover extends Base
{
$task = $this->getTask();
- $this->response->html($this->template->render('file/screenshot', array(
+ $this->response->html($this->template->render('task_file/screenshot', array(
'task' => $task,
)));
}
diff --git a/app/Controller/BoardTooltip.php b/app/Controller/BoardTooltip.php
index da07ec4e..bc07ce09 100644
--- a/app/Controller/BoardTooltip.php
+++ b/app/Controller/BoardTooltip.php
@@ -62,7 +62,7 @@ class BoardTooltip extends Base
$task = $this->getTask();
$this->response->html($this->template->render('board/tooltip_files', array(
- 'files' => $this->file->getAll($task['id']),
+ 'files' => $this->taskFile->getAll($task['id']),
'task' => $task,
)));
}
diff --git a/app/Controller/Config.php b/app/Controller/Config.php
index 80522bbe..e811f870 100644
--- a/app/Controller/Config.php
+++ b/app/Controller/Config.php
@@ -26,7 +26,12 @@ class Config extends Base
$values += array('password_reset' => 0);
break;
case 'project':
- $values += array('subtask_restriction' => 0, 'subtask_time_tracking' => 0, 'cfd_include_closed_tasks' => 0);
+ $values += array(
+ 'subtask_restriction' => 0,
+ 'subtask_time_tracking' => 0,
+ 'cfd_include_closed_tasks' => 0,
+ 'disable_private_project' => 0,
+ );
break;
case 'integrations':
$values += array('integration_gravatar' => 0);
diff --git a/app/Controller/Customfilter.php b/app/Controller/Customfilter.php
index da7eb77b..41da0b11 100644
--- a/app/Controller/Customfilter.php
+++ b/app/Controller/Customfilter.php
@@ -57,6 +57,23 @@ class Customfilter extends Base
}
/**
+ * 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
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php
index 2d1edc08..5dbd1243 100644
--- a/app/Controller/Gantt.php
+++ b/app/Controller/Gantt.php
@@ -108,6 +108,7 @@ class Gantt extends Base
);
$values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values));
+ $values = $this->hook->merge('controller:gantt:task:form:default', $values, array('default_values' => $values));
$this->response->html($this->template->render('gantt/task_creation', array(
'project' => $project,
diff --git a/app/Controller/Listing.php b/app/Controller/Listing.php
index c7d3d9a8..c784dd50 100644
--- a/app/Controller/Listing.php
+++ b/app/Controller/Listing.php
@@ -32,6 +32,9 @@ class Listing extends Base
$this->response->html($this->helper->layout->app('listing/show', $params + array(
'paginator' => $paginator,
+ 'categories_list' => $this->category->getList($params['project']['id'], false),
+ 'users_list' => $this->projectUserRole->getAssignableUsersList($params['project']['id'], false),
+ 'custom_filters_list' => $this->customFilter->getAll($params['project']['id'], $this->userSession->getId()),
)));
}
}
diff --git a/app/Controller/Projectuser.php b/app/Controller/Projectuser.php
index 9cd21021..a6d4fe4e 100644
--- a/app/Controller/Projectuser.php
+++ b/app/Controller/Projectuser.php
@@ -24,7 +24,7 @@ class Projectuser extends Base
$project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId());
}
- return array($user_id, $project_ids, $this->user->getList(true));
+ return array($user_id, $project_ids, $this->user->getActiveUsersList(true));
}
private function role($role, $action, $title, $title_user)
@@ -33,7 +33,7 @@ class Projectuser extends Base
$query = $this->projectPermission->getQueryByRole($project_ids, $role)->callback(array($this->project, 'applyColumnStats'));
- if ($user_id !== UserModel::EVERYBODY_ID) {
+ if ($user_id !== UserModel::EVERYBODY_ID && isset($users[$user_id])) {
$query->eq(UserModel::TABLE.'.id', $user_id);
$title = t($title_user, $users[$user_id]);
}
@@ -59,7 +59,7 @@ class Projectuser extends Base
$query = $this->taskFinder->getProjectUserOverviewQuery($project_ids, $is_active);
- if ($user_id !== UserModel::EVERYBODY_ID) {
+ 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]);
}
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 4db8f86e..98b7a041 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -66,8 +66,8 @@ class Task extends Base
$this->response->html($this->helper->layout->task('task/show', array(
'project' => $this->project->getById($task['project_id']),
- 'files' => $this->file->getAllDocuments($task['id']),
- 'images' => $this->file->getAllImages($task['id']),
+ 'files' => $this->taskFile->getAllDocuments($task['id']),
+ 'images' => $this->taskFile->getAllImages($task['id']),
'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()),
'subtasks' => $subtasks,
'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
diff --git a/app/Controller/File.php b/app/Controller/TaskFile.php
index 50db3865..102fdc5c 100644
--- a/app/Controller/File.php
+++ b/app/Controller/TaskFile.php
@@ -5,12 +5,12 @@ namespace Kanboard\Controller;
use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
- * File controller
+ * File File Controller
*
* @package controller
* @author Frederic Guillot
*/
-class File extends Base
+class TaskFile extends Base
{
/**
* Screenshot
@@ -21,12 +21,12 @@ class File extends Base
{
$task = $this->getTask();
- if ($this->request->isPost() && $this->file->uploadScreenshot($task['project_id'], $task['id'], $this->request->getValue('screenshot')) !== false) {
+ 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('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
}
- $this->response->html($this->helper->layout->task('file/screenshot', array(
+ $this->response->html($this->helper->layout->task('task_file/screenshot', array(
'task' => $task,
)));
}
@@ -40,9 +40,9 @@ class File extends Base
{
$task = $this->getTask();
- $this->response->html($this->helper->layout->task('file/new', array(
+ $this->response->html($this->helper->layout->task('task_file/new', array(
'task' => $task,
- 'max_size' => ini_get('upload_max_filesize'),
+ 'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
)));
}
@@ -55,7 +55,7 @@ class File extends Base
{
$task = $this->getTask();
- if (! $this->file->uploadFiles($task['project_id'], $task['id'], 'files')) {
+ if (! $this->taskFile->uploadFiles($task['id'], $this->request->getFileInfo('files'))) {
$this->flash->failure(t('Unable to upload the file.'));
}
@@ -71,7 +71,7 @@ class File extends Base
{
try {
$task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
@@ -92,10 +92,10 @@ class File extends Base
public function open()
{
$task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] == $task['id']) {
- $this->response->html($this->template->render('file/open', array(
+ $this->response->html($this->template->render('task_file/open', array(
'file' => $file,
'task' => $task,
)));
@@ -111,10 +111,10 @@ class File extends Base
{
try {
$task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] == $task['id']) {
- $this->response->contentType($this->file->getImageMimeType($file['name']));
+ $this->response->contentType($this->taskFile->getImageMimeType($file['name']));
$this->objectStorage->output($file['path']);
}
} catch (ObjectStorageException $e) {
@@ -133,18 +133,18 @@ class File extends Base
try {
$task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] == $task['id']) {
- $this->objectStorage->output($this->file->getThumbnailPath($file['path']));
+ $this->objectStorage->output($this->taskFile->getThumbnailPath($file['path']));
}
} 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->file->generateThumbnailFromData($file['path'], $data);
- $this->objectStorage->output($this->file->getThumbnailPath($file['path']));
+ $this->taskFile->generateThumbnailFromData($file['path'], $data);
+ $this->objectStorage->output($this->taskFile->getThumbnailPath($file['path']));
}
}
@@ -157,9 +157,9 @@ class File extends Base
{
$this->checkCSRFParam();
$task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
- if ($file['task_id'] == $task['id'] && $this->file->remove($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.'));
@@ -176,9 +176,9 @@ class File extends Base
public function confirm()
{
$task = $this->getTask();
- $file = $this->file->getById($this->request->getIntegerParam('file_id'));
+ $file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
- $this->response->html($this->helper->layout->task('file/remove', array(
+ $this->response->html($this->helper->layout->task('task_file/remove', array(
'task' => $task,
'file' => $file,
)));
diff --git a/app/Controller/Taskcreation.php b/app/Controller/Taskcreation.php
index e661587c..f1ac7272 100644
--- a/app/Controller/Taskcreation.php
+++ b/app/Controller/Taskcreation.php
@@ -29,6 +29,7 @@ class Taskcreation extends Base
);
$values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values));
+ $values = $this->hook->merge('controller:task-creation:form:default', $values, array('default_values' => $values));
}
$this->response->html($this->template->render('task_creation/form', array(
diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php
index a321322d..306d34c0 100644
--- a/app/Controller/Taskmodification.php
+++ b/app/Controller/Taskmodification.php
@@ -80,6 +80,7 @@ class Taskmodification extends Base
if (empty($values)) {
$values = $task;
$values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values));
+ $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values));
}
$values = $this->dateParser->format($values, array('date_due'), $this->config->get('application_date_format', 'm/d/Y'));
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 881266d4..f7d7d2e0 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -32,7 +32,8 @@ class User extends Base
$this->helper->layout->app('user/index', array(
'title' => t('Users').' ('.$paginator->getTotal().')',
'paginator' => $paginator,
- )));
+ )
+ ));
}
/**
@@ -404,30 +405,4 @@ class User extends Base
'user' => $user,
)));
}
-
- /**
- * Remove a user
- *
- * @access public
- */
- public function remove()
- {
- $user = $this->getUser();
-
- if ($this->request->getStringParam('confirmation') === 'yes') {
- $this->checkCSRFParam();
-
- if ($this->user->remove($user['id'])) {
- $this->flash->success(t('User removed successfully.'));
- } else {
- $this->flash->failure(t('Unable to remove this user.'));
- }
-
- $this->response->redirect($this->helper->url->to('user', 'index'));
- }
-
- $this->response->html($this->helper->layout->user('user/remove', array(
- 'user' => $user,
- )));
- }
}
diff --git a/app/Controller/UserStatus.php b/app/Controller/UserStatus.php
new file mode 100644
index 00000000..b8ee5c91
--- /dev/null
+++ b/app/Controller/UserStatus.php
@@ -0,0 +1,111 @@
+<?php
+
+namespace Kanboard\Controller;
+
+/**
+ * User Status Controller
+ *
+ * @package controller
+ * @author Frederic Guillot
+ */
+class UserStatus extends Base
+{
+ /**
+ * Confirm remove a user
+ *
+ * @access public
+ */
+ public function confirmRemove()
+ {
+ $user = $this->getUser();
+
+ $this->response->html($this->helper->layout->user('user_status/remove', array(
+ 'user' => $user,
+ )));
+ }
+
+ /**
+ * Remove a user
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $user = $this->getUser();
+ $this->checkCSRFParam();
+
+ if ($this->user->remove($user['id'])) {
+ $this->flash->success(t('User removed successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to remove this user.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('user', 'index'));
+ }
+
+ /**
+ * Confirm enable a user
+ *
+ * @access public
+ */
+ public function confirmEnable()
+ {
+ $user = $this->getUser();
+
+ $this->response->html($this->helper->layout->user('user_status/enable', array(
+ 'user' => $user,
+ )));
+ }
+
+ /**
+ * Enable a user
+ *
+ * @access public
+ */
+ public function enable()
+ {
+ $user = $this->getUser();
+ $this->checkCSRFParam();
+
+ if ($this->user->enable($user['id'])) {
+ $this->flash->success(t('User activated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to enable this user.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('user', 'index'));
+ }
+
+ /**
+ * Confirm disable a user
+ *
+ * @access public
+ */
+ public function confirmDisable()
+ {
+ $user = $this->getUser();
+
+ $this->response->html($this->helper->layout->user('user_status/disable', array(
+ 'user' => $user,
+ )));
+ }
+
+ /**
+ * Disable a user
+ *
+ * @access public
+ */
+ public function disable()
+ {
+ $user = $this->getUser();
+ $this->checkCSRFParam();
+
+ if ($this->user->disable($user['id'])) {
+ $this->flash->success(t('User disabled successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to disable this user.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('user', 'index'));
+ }
+}