Index: application/controllers/TaskController.class.php =================================================================== --- application/controllers/TaskController.class.php (revision 161) +++ application/controllers/TaskController.class.php (working copy) @@ -28,6 +28,7 @@ * @return null */ function index() { + $this->addHelper('textile'); tpl_assign('open_task_lists', active_project()->getOpenTaskLists()); tpl_assign('completed_task_lists', active_project()->getCompletedTaskLists()); $this->setSidebar(get_template_path('index_sidebar', 'task')); @@ -41,6 +42,7 @@ * @return null */ function view_list() { + $this->addHelper('textile'); $task_list = ProjectTaskLists::findById(get_id()); if (!($task_list instanceof ProjectTaskList)) { flash_error(lang('task list dnx')); @@ -450,8 +452,51 @@ } // if } // edit_task - + /** + * View task details page + * + * @access public + * @param void + * @return null + */ + function view_task() { + $this->setTemplate('view_task'); + $this->addHelper('textile'); + + $task = ProjectTasks::findById(get_id()); + if (!($task instanceof ProjectTask)) { + flash_error(lang('task dnx')); + $this->redirectTo('task'); + } // if + + $task_list = $task->getTaskList(); + if (!($task_list instanceof ProjectTaskList)) { + flash_error('task list dnx'); + $this->redirectTo('task'); + } // if + + if (!$task->canEdit(logged_user())) { + flash_error(lang('no access permissions')); + $this->redirectTo('task'); + } // if + + $task_data = array_var($_POST, 'task'); + if (!is_array($task_data)) { + $task_data = array( + 'text' => $task->getText(), + 'task_list_id' => $task->getTaskListId(), + 'assigned_to' => $task->getAssignedToCompanyId() . ':' . $task->getAssignedToUserId() + ); // array + } // if + + tpl_assign('task', $task); + tpl_assign('task_list', $task_list); + tpl_assign('task_data', $task_data); + + } // task_details + + /** * Delete specific task * * @access public Index: application/models/project_tasks/ProjectTask.class.php =================================================================== --- application/models/project_tasks/ProjectTask.class.php (revision 161) +++ application/models/project_tasks/ProjectTask.class.php (working copy) @@ -14,8 +14,15 @@ * @var boolean */ protected $is_searchable = true; - + /** + * Project task is commentable object + * + * @var boolean + */ + protected $is_commentable = true; + + /** * Array of searchable columns * * @var array @@ -149,7 +156,13 @@ * @return boolean */ function canView(User $user) { - return false; + if (!$user->isProjectUser($this->getProject())) { + return false; // user have access to project + } // if + if ($this->isPrivate() && !$user->isMemberOfOwnerCompany()) { + return false; // user that is not member of owner company can't access private objects + } // if + return true; } // canView /** @@ -308,8 +321,19 @@ function getEditUrl() { return get_url('task', 'edit_task', array('id' => $this->getId(), 'active_project' => $this->getProjectId())); } // getEditUrl - + /** + * Return view task URL + * + * @access public + * @param void + * @return string + */ + function getViewUrl() { + return get_url('task', 'view_task', array('id' => $this->getId(), 'active_project' => $this->getProjectId())); + } // getViewUrl + + /** * Return delete task URL * * @access public @@ -426,6 +450,7 @@ * @return string */ function getObjectUrl() { + return $this->getViewUrl(); $list = $this->getTaskList(); return $list instanceof ProjectTaskList ? $list->getViewUrl() : null; } // getObjectUrl Index: application/views/task/task_list.php =================================================================== --- application/views/task/task_list.php (revision 161) +++ application/views/task/task_list.php (working copy) @@ -21,7 +21,7 @@
getDescription()) { ?> -