Cleanup and fixes
This commit is contained in:
@@ -169,7 +169,7 @@ abstract class Base
|
|||||||
*/
|
*/
|
||||||
public function handleAuthenticatedUser($controller, $action)
|
public function handleAuthenticatedUser($controller, $action)
|
||||||
{
|
{
|
||||||
if (! $this->authentication->isAuthenticated($controller, $action)) {
|
if (! $this->authentication->isAuthenticated()) {
|
||||||
|
|
||||||
if ($this->request->isAjax()) {
|
if ($this->request->isAjax()) {
|
||||||
$this->response->text('Not Authorized', 401);
|
$this->response->text('Not Authorized', 401);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class Subtask extends Base
|
|||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$subtask = $this->getSubtask();
|
$this->getSubtask();
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
list($valid, $errors) = $this->subTask->validateModification($values);
|
list($valid, $errors) = $this->subTask->validateModification($values);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Swimlane extends Base
|
|||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
list($valid, $errors) = $this->swimlane->validateDefaultModification($values);
|
list($valid,) = $this->swimlane->validateDefaultModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class Task extends Base
|
|||||||
$this->response->redirect('?controller=task&action=create&'.http_build_query($values));
|
$this->response->redirect('?controller=task&action=create&'.http_build_query($values));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->response->redirect('?controller=board&action=show&project_id='.$values['project_id']);
|
$this->response->redirect('?controller=board&action=show&project_id='.$project['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -157,16 +157,20 @@ class Task extends Base
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function edit()
|
public function edit(array $values = array(), array $errors = array())
|
||||||
{
|
{
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$ajax = $this->request->isAjax();
|
$ajax = $this->request->isAjax();
|
||||||
|
|
||||||
$this->dateParser->format($task, array('date_due'));
|
if (empty($values)) {
|
||||||
|
$values = $task;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->dateParser->format($values, array('date_due'));
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'values' => $task,
|
'values' => $values,
|
||||||
'errors' => array(),
|
'errors' => $errors,
|
||||||
'task' => $task,
|
'task' => $task,
|
||||||
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
|
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
|
||||||
'colors_list' => $this->color->getList(),
|
'colors_list' => $this->color->getList(),
|
||||||
@@ -213,18 +217,7 @@ class Task extends Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->html($this->taskLayout('task/edit', array(
|
$this->edit($values, $errors);
|
||||||
'values' => $values,
|
|
||||||
'errors' => $errors,
|
|
||||||
'task' => $task,
|
|
||||||
'columns_list' => $this->board->getColumnsList($values['project_id']),
|
|
||||||
'users_list' => $this->projectPermission->getMemberList($values['project_id']),
|
|
||||||
'colors_list' => $this->color->getList(),
|
|
||||||
'categories_list' => $this->category->getList($values['project_id']),
|
|
||||||
'date_format' => $this->config->get('application_date_format'),
|
|
||||||
'date_formats' => $this->dateParser->getAvailableFormats(),
|
|
||||||
'ajax' => $this->request->isAjax(),
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -35,11 +35,9 @@ class Authentication extends Base
|
|||||||
* Check if the current user is authenticated
|
* Check if the current user is authenticated
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $controller Controller
|
|
||||||
* @param string $action Action name
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isAuthenticated($controller, $action)
|
public function isAuthenticated()
|
||||||
{
|
{
|
||||||
// If the user is already logged it's ok
|
// If the user is already logged it's ok
|
||||||
if ($this->userSession->isLogged()) {
|
if ($this->userSession->isLogged()) {
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class Project extends Base
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (! $this->db->table(self::TABLE)->save($values)) {
|
if (! $this->db->table(self::TABLE)->save($values)) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->db->getConnection()->getLastId();
|
return $this->db->getConnection()->getLastId();
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(GenericEvent $event)
|
public function execute(GenericEvent $event, $event_name)
|
||||||
{
|
{
|
||||||
$values = $this->getTemplateData($event);
|
$values = $this->getTemplateData($event);
|
||||||
$users = $this->notification->getUsersList($values['task']['project_id']);
|
$users = $this->notification->getUsersList($values['task']['project_id']);
|
||||||
|
|
||||||
if ($users) {
|
if ($users) {
|
||||||
$this->notification->sendEmails($this->templates[$event->getName()], $users, $values);
|
$this->notification->sendEmails($this->templates[$event_name], $users, $values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(GenericEvent $event)
|
public function execute(GenericEvent $event, $event_name)
|
||||||
{
|
{
|
||||||
// Executed only when someone is logged
|
// Executed only when someone is logged
|
||||||
if ($this->userSession->isLogged() && isset($event['task_id'])) {
|
if ($this->userSession->isLogged() && isset($event['task_id'])) {
|
||||||
@@ -38,7 +38,7 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
|
|||||||
$values['task']['project_id'],
|
$values['task']['project_id'],
|
||||||
$values['task']['id'],
|
$values['task']['id'],
|
||||||
$this->userSession->getId(),
|
$this->userSession->getId(),
|
||||||
$event->getName(),
|
$event_name,
|
||||||
$values
|
$values
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<?php foreach ($subtasks as $subtask): ?>
|
<?php foreach ($subtasks as $subtask): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="task-table task-<?= $subtask['color_id'] ?>">
|
<td class="task-table task-<?= $subtask['color_id'] ?>">
|
||||||
<?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
|
<?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->a($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
|
<?= $this->a($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<?= $this->e($subtask['status_name']) ?>
|
<?= $this->e($subtask['status_name']) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->a($this->e($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
|
<?= $this->a($this->e($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
<?php foreach ($tasks as $task): ?>
|
<?php foreach ($tasks as $task): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="task-table task-<?= $task['color_id'] ?>">
|
<td class="task-table task-<?= $task['color_id'] ?>">
|
||||||
<?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'])) ?>
|
<?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->a($this->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?>
|
<?= $this->a($this->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'])) ?>
|
<?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= dt('%B %e, %Y', $task['date_due']) ?>
|
<?= dt('%B %e, %Y', $task['date_due']) ?>
|
||||||
|
|||||||
@@ -23,11 +23,11 @@
|
|||||||
<i class="fa fa-dashboard fa-fw"></i>
|
<i class="fa fa-dashboard fa-fw"></i>
|
||||||
<?= $this->a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?>
|
<?= $this->a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?>
|
||||||
</li>
|
</li>
|
||||||
|
<?php if ($this->acl->isManagerActionAllowed($project['id'])): ?>
|
||||||
<li>
|
<li>
|
||||||
<i class="fa fa-line-chart fa-fw"></i>
|
<i class="fa fa-line-chart fa-fw"></i>
|
||||||
<?= $this->a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?>
|
<?= $this->a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?>
|
||||||
</li>
|
</li>
|
||||||
<?php if ($this->acl->isManagerActionAllowed($project['id'])): ?>
|
|
||||||
<li><i class="fa fa-cog fa-fw"></i>
|
<li><i class="fa fa-cog fa-fw"></i>
|
||||||
<?= $this->a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?>
|
<?= $this->a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user