summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Task.php153
-rw-r--r--app/Model/Acl.php18
-rw-r--r--app/Templates/board_task.php2
-rw-r--r--app/Templates/task_close.php2
-rw-r--r--app/Templates/task_edit_description.php2
-rw-r--r--app/Templates/task_open.php2
-rw-r--r--app/Templates/task_remove.php2
-rw-r--r--app/Templates/task_sidebar.php8
8 files changed, 73 insertions, 116 deletions
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index e905ef30..444065f0 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -233,26 +233,20 @@ class Task extends Base
*/
public function close()
{
- $this->checkCSRFParam();
$task = $this->getTask();
- if ($this->task->close($task['id'])) {
- $this->session->flash(t('Task closed successfully.'));
- } else {
- $this->session->flashError(t('Unable to close this task.'));
- }
+ if ($this->request->getStringParam('confirmation') === 'yes') {
- $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
- }
+ $this->checkCSRFParam();
- /**
- * Confirmation dialog before to close a task
- *
- * @access public
- */
- public function confirmClose()
- {
- $task = $this->getTask();
+ if ($this->task->close($task['id'])) {
+ $this->session->flash(t('Task closed successfully.'));
+ } else {
+ $this->session->flashError(t('Unable to close this task.'));
+ }
+
+ $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
+ }
$this->response->html($this->taskLayout('task_close', array(
'task' => $task,
@@ -268,26 +262,20 @@ class Task extends Base
*/
public function open()
{
- $this->checkCSRFParam();
$task = $this->getTask();
- if ($this->task->open($task['id'])) {
- $this->session->flash(t('Task opened successfully.'));
- } else {
- $this->session->flashError(t('Unable to open this task.'));
- }
+ if ($this->request->getStringParam('confirmation') === 'yes') {
- $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
- }
+ $this->checkCSRFParam();
- /**
- * Confirmation dialog before to open a task
- *
- * @access public
- */
- public function confirmOpen()
- {
- $task = $this->getTask();
+ if ($this->task->open($task['id'])) {
+ $this->session->flash(t('Task opened successfully.'));
+ } else {
+ $this->session->flashError(t('Unable to open this task.'));
+ }
+
+ $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
+ }
$this->response->html($this->taskLayout('task_open', array(
'task' => $task,
@@ -303,26 +291,20 @@ class Task extends Base
*/
public function remove()
{
- $this->checkCSRFParam();
$task = $this->getTask();
- if ($this->task->remove($task['id'])) {
- $this->session->flash(t('Task removed successfully.'));
- } else {
- $this->session->flashError(t('Unable to remove this task.'));
- }
+ if ($this->request->getStringParam('confirmation') === 'yes') {
- $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
- }
+ $this->checkCSRFParam();
- /**
- * Confirmation dialog before removing a task
- *
- * @access public
- */
- public function confirmRemove()
- {
- $task = $this->getTask();
+ if ($this->task->remove($task['id'])) {
+ $this->session->flash(t('Task removed successfully.'));
+ } else {
+ $this->session->flashError(t('Unable to remove this task.'));
+ }
+
+ $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
+ }
$this->response->html($this->taskLayout('task_remove', array(
'task' => $task,
@@ -366,63 +348,54 @@ class Task extends Base
*
* @access public
*/
- public function editDescription()
+ public function description()
{
$task = $this->getTask();
+ $ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
- $params = array(
- 'values' => $task,
- 'errors' => array(),
- 'task' => $task,
- 'ajax' => $this->request->isAjax(),
- 'menu' => 'tasks',
- 'title' => t('Edit the description'),
- );
-
- if ($this->request->isAjax()) {
- $this->response->html($this->template->load('task_edit_description', $params));
- }
- else {
- $this->response->html($this->taskLayout('task_edit_description', $params));
- }
- }
+ if ($this->request->isPost()) {
- /**
- * Save and validation the description
- *
- * @access public
- */
- public function saveDescription()
- {
- $task = $this->getTask();
- $values = $this->request->getValues();
+ $values = $this->request->getValues();
- list($valid, $errors) = $this->task->validateDescriptionCreation($values);
+ list($valid, $errors) = $this->task->validateDescriptionCreation($values);
- if ($valid) {
+ if ($valid) {
- if ($this->task->update($values)) {
- $this->session->flash(t('Task updated successfully.'));
- }
- else {
- $this->session->flashError(t('Unable to update your task.'));
- }
+ if ($this->task->update($values)) {
+ $this->session->flash(t('Task updated successfully.'));
+ }
+ else {
+ $this->session->flashError(t('Unable to update your task.'));
+ }
- if ($this->request->getIntegerParam('ajax')) {
- $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
- }
- else {
- $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
+ if ($ajax) {
+ $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
+ }
+ else {
+ $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
+ }
}
}
+ else {
+ $values = $task;
+ $errors = array();
+ }
- $this->response->html($this->taskLayout('task_edit_description', array(
+ $params = array(
'values' => $values,
'errors' => $errors,
'task' => $task,
+ 'ajax' => $ajax,
'menu' => 'tasks',
- 'title' => t('Edit the description')
- )));
+ 'title' => t('Edit the description'),
+ );
+
+ if ($ajax) {
+ $this->response->html($this->template->load('task_edit_description', $params));
+ }
+ else {
+ $this->response->html($this->taskLayout('task_edit_description', $params));
+ }
}
/**
diff --git a/app/Model/Acl.php b/app/Model/Acl.php
index 23f6ff44..f2b287be 100644
--- a/app/Model/Acl.php
+++ b/app/Model/Acl.php
@@ -37,23 +37,7 @@ class Acl extends Base
'comment' => array('create', 'save', 'confirm', 'remove', 'update', 'edit', 'forbidden'),
'file' => array('create', 'save', 'download', 'confirm', 'remove', 'open', 'image'),
'subtask' => array('create', 'save', 'edit', 'update', 'confirm', 'remove'),
- 'task' => array(
- 'show',
- 'create',
- 'save',
- 'edit',
- 'update',
- 'close',
- 'confirmclose',
- 'open',
- 'confirmopen',
- 'duplicate',
- 'remove',
- 'confirmremove',
- 'editdescription',
- 'savedescription',
- 'move',
- ),
+ 'task' => array('show', 'create', 'save', 'edit', 'update', 'close', 'open', 'duplicate', 'remove', 'description', 'move', 'copy'),
);
/**
diff --git a/app/Templates/board_task.php b/app/Templates/board_task.php
index 0bc96579..4370558b 100644
--- a/app/Templates/board_task.php
+++ b/app/Templates/board_task.php
@@ -69,7 +69,7 @@
<?php endif ?>
<?php if (! empty($task['description'])): ?>
- <a class="task-board-popover" href='?controller=task&amp;action=editDescription&amp;task_id=<?= $task['id'] ?>'><i class="fa fa-file-text-o" title="<?= t('Description') ?>"></i></a>
+ <a class="task-description-popover" href="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>"><i class="fa fa-file-text-o" title="<?= t('Description') ?>" data-href="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>"></i></a>
<?php endif ?>
</div>
</div>
diff --git a/app/Templates/task_close.php b/app/Templates/task_close.php
index 5c75b72b..2abfd032 100644
--- a/app/Templates/task_close.php
+++ b/app/Templates/task_close.php
@@ -8,7 +8,7 @@
</p>
<div class="form-actions">
- <a href="?controller=task&amp;action=close&amp;task_id=<?= $task['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
+ <a href="?controller=task&amp;action=close&amp;confirmation=yes&amp;task_id=<?= $task['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
<?= t('or') ?> <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
</div>
</div> \ No newline at end of file
diff --git a/app/Templates/task_edit_description.php b/app/Templates/task_edit_description.php
index d403190f..2d2a4d0b 100644
--- a/app/Templates/task_edit_description.php
+++ b/app/Templates/task_edit_description.php
@@ -2,7 +2,7 @@
<h2><?= t('Edit the description') ?></h2>
</div>
-<form method="post" action="?controller=task&amp;action=saveDescription&amp;task_id=<?= $task['id'] ?>&amp;ajax=<?= $ajax ?>" autocomplete="off">
+<form method="post" action="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>&amp;ajax=<?= $ajax ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
diff --git a/app/Templates/task_open.php b/app/Templates/task_open.php
index 3526ec81..d28970e3 100644
--- a/app/Templates/task_open.php
+++ b/app/Templates/task_open.php
@@ -8,7 +8,7 @@
</p>
<div class="form-actions">
- <a href="?controller=task&amp;action=open&amp;task_id=<?= $task['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
+ <a href="?controller=task&amp;action=open&amp;confirmation=yes&amp;task_id=<?= $task['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
<?= t('or') ?> <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
</div>
</div> \ No newline at end of file
diff --git a/app/Templates/task_remove.php b/app/Templates/task_remove.php
index dd4841db..496ac2d8 100644
--- a/app/Templates/task_remove.php
+++ b/app/Templates/task_remove.php
@@ -8,7 +8,7 @@
</p>
<div class="form-actions">
- <a href="?controller=task&amp;action=remove&amp;task_id=<?= $task['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
+ <a href="?controller=task&amp;action=remove&amp;confirmation=yes&amp;task_id=<?= $task['id'].Helper\param_csrf() ?>" class="btn btn-red"><?= t('Yes') ?></a>
<?= t('or') ?> <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
</div>
</div> \ No newline at end of file
diff --git a/app/Templates/task_sidebar.php b/app/Templates/task_sidebar.php
index 5d93d7b1..4d363fec 100644
--- a/app/Templates/task_sidebar.php
+++ b/app/Templates/task_sidebar.php
@@ -4,7 +4,7 @@
<ul>
<li><a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('Summary') ?></a></li>
<li><a href="?controller=task&amp;action=edit&amp;task_id=<?= $task['id'] ?>"><?= t('Edit the task') ?></a></li>
- <li><a href="?controller=task&amp;action=editDescription&amp;task_id=<?= $task['id'] ?>"><?= t('Edit the description') ?></a></li>
+ <li><a href="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>"><?= t('Edit the description') ?></a></li>
<li><a href="?controller=subtask&amp;action=create&amp;task_id=<?= $task['id'] ?>"><?= t('Add a sub-task') ?></a></li>
<li><a href="?controller=comment&amp;action=create&amp;task_id=<?= $task['id'] ?>"><?= t('Add a comment') ?></a></li>
<li><a href="?controller=file&amp;action=create&amp;task_id=<?= $task['id'] ?>"><?= t('Attach a document') ?></a></li>
@@ -13,12 +13,12 @@
<li><a href="?controller=task&amp;action=move&amp;project_id=<?= $task['project_id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= t('Move to another project') ?></a></li>
<li>
<?php if ($task['is_active'] == 1): ?>
- <a href="?controller=task&amp;action=confirmClose&amp;task_id=<?= $task['id'] ?>"><?= t('Close this task') ?></a>
+ <a href="?controller=task&amp;action=close&amp;task_id=<?= $task['id'] ?>"><?= t('Close this task') ?></a>
<?php else: ?>
- <a href="?controller=task&amp;action=confirmOpen&amp;task_id=<?= $task['id'] ?>"><?= t('Open this task') ?></a>
+ <a href="?controller=task&amp;action=open&amp;task_id=<?= $task['id'] ?>"><?= t('Open this task') ?></a>
<?php endif ?>
</li>
- <li><a href="?controller=task&amp;action=confirmRemove&amp;task_id=<?= $task['id'] ?>"><?= t('Remove') ?></a></li>
+ <li><a href="?controller=task&amp;action=remove&amp;task_id=<?= $task['id'] ?>"><?= t('Remove') ?></a></li>
</ul>
</div>
</div> \ No newline at end of file