diff --git a/api/v1/entries/bug.php b/api/v1/entries/bug.php index 4b44f4cef8..74469a009b 100644 --- a/api/v1/entries/bug.php +++ b/api/v1/entries/bug.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class bugEntry extends entry { + /** + * GET method. + * + * @param int $bugID + * @access public + * @return void + */ public function get($bugID) { $control = $this->loadController('bug', 'view'); @@ -18,6 +28,13 @@ class bugEntry extends entry $this->send(200, $this->format($bug, 'deleted:bool,activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time')); } + /** + * PUT method. + * + * @param int $bugID + * @access public + * @return void + */ public function put($bugID) { $oldBug = $this->loadModel('bug')->getByID($bugID); @@ -38,6 +55,13 @@ class bugEntry extends entry $this->send(200, $this->format($bug, 'activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time')); } + /** + * DELETE method. + * + * @param int $bugID + * @access public + * @return void + */ public function delete($bugID) { $control = $this->loadController('bug', 'delete'); diff --git a/api/v1/entries/bugs.php b/api/v1/entries/bugs.php index 93729e30ee..6d71887da0 100644 --- a/api/v1/entries/bugs.php +++ b/api/v1/entries/bugs.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class bugsEntry extends entry { + /** + * GET method. + * + * @param int $productID + * @access public + * @return void + */ public function get($productID) { $control = $this->loadController('bug', 'browse'); @@ -33,6 +43,13 @@ class bugsEntry extends entry return $this->sendError(400, 'error'); } + /** + * POST method. + * + * @param int $productID + * @access public + * @return void + */ public function post($productID) { $fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story'; diff --git a/api/v1/entries/build.php b/api/v1/entries/build.php index de504a5a3b..81fc27e005 100644 --- a/api/v1/entries/build.php +++ b/api/v1/entries/build.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class buildEntry extends Entry { + /** + * GET method. + * + * @param int $buildID + * @access public + * @return void + */ public function get($buildID) { $control = $this->loadController('build', 'view'); @@ -21,6 +31,13 @@ class buildEntry extends Entry $this->sendError(400, 'error'); } + /** + * PUT method. + * + * @param int $buildID + * @access public + * @return void + */ public function put($buildID) { $old = $this->loadModel('build')->getByID($buildID); @@ -40,6 +57,13 @@ class buildEntry extends Entry $this->send(200, $this->format($build, 'createdDate:time,editedDate:time,assignedDate:time')); } + /** + * DELETE method. + * + * @param int $buildID + * @access public + * @return void + */ public function delete($buildID) { $control = $this->loadController('build', 'delete'); diff --git a/api/v1/entries/builds.php b/api/v1/entries/builds.php index fab10bdb4f..3698222b44 100644 --- a/api/v1/entries/builds.php +++ b/api/v1/entries/builds.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class buildsEntry extends entry { + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ public function get($projectID = 0) { $control = $this->loadController('project', 'build'); @@ -28,6 +38,13 @@ class buildsEntry extends entry return $this->send(200, $result); } + /** + * POST method. + * + * @param int $projectID + * @access public + * @return void + */ public function post($projectID = 0) { $project = $this->loadModel('project')->getByID($projectID); diff --git a/api/v1/entries/config.php b/api/v1/entries/config.php index 5479ea405e..392188a061 100644 --- a/api/v1/entries/config.php +++ b/api/v1/entries/config.php @@ -1,34 +1,44 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class configEntry extends baseEntry { + /** + * GET method. + * + * @param int $name language,version,timezone etc. + * @access public + * @return void + */ public function get($name) { $config = array('name' => $name); switch($name) { - case 'language': - $config['value'] = $this->config->default->lang; - break; - case 'version': - $config['value'] = $this->config->version; - break; - case 'charset': - $config['value'] = $this->config->charset; - break; - case 'timezone': - $config['value'] = $this->config->timezone; - break; - default: - $this->sendError(400, 'No configuration.'); - return; + case 'language': + $config['value'] = $this->config->default->lang; + break; + case 'version': + $config['value'] = $this->config->version; + break; + case 'charset': + $config['value'] = $this->config->charset; + break; + case 'timezone': + $config['value'] = $this->config->timezone; + break; + default: + $this->sendError(400, 'No configuration.'); + return; } $this->send(200, $config); diff --git a/api/v1/entries/configs.php b/api/v1/entries/configs.php index c1797fe805..18982fbc08 100644 --- a/api/v1/entries/configs.php +++ b/api/v1/entries/configs.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class configsEntry extends baseEntry { + /** + * GET method. + * + * @access public + * @return void + */ public function get() { $configs = array(); diff --git a/api/v1/entries/department.php b/api/v1/entries/department.php index 1ae7815d6d..774bef0363 100644 --- a/api/v1/entries/department.php +++ b/api/v1/entries/department.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class departmentEntry extends Entry { + /** + * GET method. + * + * @param int $departmentID + * @access public + * @return void + */ public function get($departmentID) { $dept = $this->loadModel('dept')->getByID($departmentID); @@ -16,6 +26,13 @@ class departmentEntry extends Entry return $this->send(200, $dept); } + /** + * PUT method. + * + * @param int $departmentID + * @access public + * @return void + */ public function put($departmentID) { $oldDept = $this->loadModel('dept')->getByID($departmentID); @@ -33,6 +50,13 @@ class departmentEntry extends Entry $this->send(200, $department); } + /** + * DELETE method. + * + * @param int $departmentID + * @access public + * @return void + */ public function delete($departmentID) { $control = $this->loadController('dept', 'delete'); diff --git a/api/v1/entries/departments.php b/api/v1/entries/departments.php index ca80c6ed94..c03b4f8b30 100644 --- a/api/v1/entries/departments.php +++ b/api/v1/entries/departments.php @@ -1,10 +1,13 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class departmentsEntry extends entry { diff --git a/api/v1/entries/error.php b/api/v1/entries/error.php index c2b5eece56..f242886439 100644 --- a/api/v1/entries/error.php +++ b/api/v1/entries/error.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class errorEntry extends Entry { + /** + * 404 Not Found. + * + * @access public + * @return void + */ public function notFound() { $this->send(404, array('error' => 'not found')); diff --git a/api/v1/entries/execution.php b/api/v1/entries/execution.php index cbbf55da09..bb6c51528e 100644 --- a/api/v1/entries/execution.php +++ b/api/v1/entries/execution.php @@ -1,23 +1,68 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class executionEntry extends Entry { + /** + * GET method. + * + * @param int $executionID + * @access public + * @return void + */ public function get($executionID) { + $fields = $this->param('fields'); + $control = $this->loadController('execution', 'view'); $control->view($executionID); - $data = $this->getData(); - $execution = $data->data->execution; - $this->send(200, $this->format($execution, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); + $data = $this->getData(); + if(!$data or !isset($data->status)) return $this->send400('error'); + if(isset($data->status) and $data->status == 'fail') + { + return isset($data->code) and $data->code == 404 ? $this->send404() : $this->sendError(400, $data->message); + } + + $execution = $this->format($data->data->execution, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time'); + if(!$fields) $this->send(200, $execution); + + /* Set other fields. */ + $fields = explode(',', $fields); + foreach($fields as $field) + { + switch($field) + { + case 'modules': + $control = $this->loadController('tree', 'browsetask'); + $control->browsetask($executionID); + $data = $this->getData(); + if(isset($data->status) and $data->status == 'success') + { + $execution->modules = $data->data->tree; + } + break; + } + } + + return $this->send(200, $execution); } + /** + * PUT method. + * + * @param int $executionID + * @access public + * @return void + */ public function put($executionID) { $oldExecution = $this->loadModel('execution')->getByID($executionID); @@ -39,6 +84,13 @@ class executionEntry extends Entry $this->send(200, $this->format($execution, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); } + /** + * DELETE method. + * + * @param int $executionID + * @access public + * @return void + */ public function delete($executionID) { $control = $this->loadController('execution', 'delete'); diff --git a/api/v1/entries/executionStories.php b/api/v1/entries/executionStories.php index 6d358c7b3f..cf6ba73b58 100644 --- a/api/v1/entries/executionStories.php +++ b/api/v1/entries/executionStories.php @@ -1,13 +1,23 @@ + * @package execution + * @version 1 + * @link http://www.zentao.net */ class executionStoriesEntry extends entry { + /** + * GET method. + * + * @param int $executionID + * @access public + * @return void + */ public function get($executionID) { $control = $this->loadController('execution', 'story'); diff --git a/api/v1/entries/executions.php b/api/v1/entries/executions.php index c994ac729d..2bb7d54177 100644 --- a/api/v1/entries/executions.php +++ b/api/v1/entries/executions.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class executionsEntry extends entry { + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ public function get($projectID = 0) { $control = $this->loadController('execution', 'all'); @@ -29,6 +39,13 @@ class executionsEntry extends entry return $this->sendError(400, 'error'); } + /** + * POST method. + * + * @param int $projectID + * @access public + * @return void + */ public function post($projectID = 0) { $fields = 'project,code,name,begin,end,lifetime,desc,days'; diff --git a/api/v1/entries/issue.php b/api/v1/entries/issue.php index 7bae43e939..d5a4cc0825 100644 --- a/api/v1/entries/issue.php +++ b/api/v1/entries/issue.php @@ -1,18 +1,29 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class issueEntry extends Entry { + /** + * GET method. + * + * @param int|string $issueID. Issues id for Gitlab has '-', such as task-1, bug-1. + * @access public + * @return void + */ public function get($issueID) { /* If $issueID has '-', go to productIssue entry point for Gitlab. */ if(strpos($issueID, '-') !== FALSE) return $this->fetch('productIssue', 'get', array('issueID' => $issueID)); + /* Otherwise, get issue of project. */ $control = $this->loadController('issue', 'view'); $control->view($issueID); @@ -24,6 +35,13 @@ class issueEntry extends Entry $this->sendError(400, 'error'); } + /** + * PUT method. + * + * @param int $issueID + * @access public + * @return void + */ public function put($issueID) { $oldIssue = $this->loadModel('issue')->getByID($issueID); @@ -43,6 +61,13 @@ class issueEntry extends Entry $this->send(200, $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time')); } + /** + * DELETE method. + * + * @param int $issueID + * @access public + * @return void + */ public function delete($issueID) { $control = $this->loadController('issue', 'delete'); diff --git a/api/v1/entries/issues.php b/api/v1/entries/issues.php index 45eb900c96..a387c246b1 100644 --- a/api/v1/entries/issues.php +++ b/api/v1/entries/issues.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class issuesEntry extends entry { + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ public function get($projectID = 0) { if($projectID) return $this->getProjectIssues($projectID); @@ -30,6 +40,13 @@ class issuesEntry extends entry return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'issues' => $result)); } + /** + * Get issues of project. + * + * @param int $projectID + * @access public + * @return void + */ private function getProjectIssues($projectID) { $project = $this->loadModel('project')->getByID($projectID); @@ -52,6 +69,13 @@ class issuesEntry extends entry return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'issues' => $result)); } + /** + * POST method. + * + * @param int $projectID + * @access public + * @return void + */ public function post($projectID = 0) { $project = $this->loadModel('project')->getByID($projectID); diff --git a/api/v1/entries/product.php b/api/v1/entries/product.php index 9a3628a5fb..a8286fbf8e 100644 --- a/api/v1/entries/product.php +++ b/api/v1/entries/product.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class productEntry extends Entry { + /** + * GET method. + * + * @param int $productID + * @access public + * @return void + */ public function get($productID) { $fields = $this->param('fields'); @@ -46,6 +56,13 @@ class productEntry extends Entry return $this->send(200, $product); } + /** + * PUT method. + * + * @param int $productID + * @access public + * @return void + */ public function put($productID) { $oldProduct = $this->loadModel('product')->getByID($productID); @@ -64,6 +81,13 @@ class productEntry extends Entry $this->sendSuccess(200, $this->format($product, 'createdDate:time')); } + /** + * DELETE method. + * + * @param int $productID + * @access public + * @return void + */ public function delete($productID) { $control = $this->loadController('product', 'delete'); diff --git a/api/v1/entries/productissue.php b/api/v1/entries/productissue.php index 8523a02956..183da2b281 100644 --- a/api/v1/entries/productissue.php +++ b/api/v1/entries/productissue.php @@ -1,14 +1,24 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class productIssueEntry extends entry { + /** + * GET method. + * + * @param string $issueID, such as task-1, story-1, bug-1 + * @access public + * @return void + */ public function get($issueID) { $this->loadModel('entry'); diff --git a/api/v1/entries/productissues.php b/api/v1/entries/productissues.php index 6237f1e5f3..1a1a23294a 100644 --- a/api/v1/entries/productissues.php +++ b/api/v1/entries/productissues.php @@ -1,14 +1,24 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class productIssuesEntry extends entry { + /** + * GET method. + * + * @param int $productID + * @access public + * @return void + */ public function get($productID) { if(!is_numeric($productID)) $this->sendError(400, 'The product_id is not supported'); diff --git a/api/v1/entries/products.php b/api/v1/entries/products.php index 3e837f2b99..e3c0dc7b76 100644 --- a/api/v1/entries/products.php +++ b/api/v1/entries/products.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class productsEntry extends entry { + /** + * POST method. + * + * @param int $projectID + * @access public + * @return void + */ public function get() { $programID = $this->param('program', 0); @@ -49,6 +59,12 @@ class productsEntry extends entry return $this->sendError(400, 'error'); } + /** + * POST method. + * + * @access public + * @return void + */ public function post() { $fields = 'program,line,name,PO,QD,RD,type,desc,whitelist'; diff --git a/api/v1/entries/program.php b/api/v1/entries/program.php index 6916a80784..f423487ef4 100644 --- a/api/v1/entries/program.php +++ b/api/v1/entries/program.php @@ -1,10 +1,13 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class ProgramEntry extends Entry { diff --git a/api/v1/entries/programs.php b/api/v1/entries/programs.php index 80b3bc422a..265aaa6178 100644 --- a/api/v1/entries/programs.php +++ b/api/v1/entries/programs.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class ProgramsEntry extends Entry { + /** + * GET method. + * + * @access public + * @return void + */ public function get() { $program = $this->loadController('program', 'browse'); diff --git a/api/v1/entries/project.php b/api/v1/entries/project.php index c8af26898a..8492d4ce03 100644 --- a/api/v1/entries/project.php +++ b/api/v1/entries/project.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class projectEntry extends entry { + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ public function get($projectID) { $control = $this->loadController('project', 'view'); @@ -21,6 +31,13 @@ class projectEntry extends entry $this->sendError(400, 'error'); } + /** + * PUT method. + * + * @param int $projectID + * @access public + * @return void + */ public function put($projectID) { $oldProject = $this->loadModel('project')->getByID($projectID); @@ -51,6 +68,13 @@ class projectEntry extends entry $this->send(200, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); } + /** + * DELETE method. + * + * @param int $projectID + * @access public + * @return void + */ public function delete($projectID) { $control = $this->loadController('project', 'delete'); diff --git a/api/v1/entries/projects.php b/api/v1/entries/projects.php index f0480dce7d..fe62531b04 100644 --- a/api/v1/entries/projects.php +++ b/api/v1/entries/projects.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class projectsEntry extends entry { + /** + * GET method. + * + * @access public + * @return void + */ public function get() { $control = $this->loadController('project', 'browse'); @@ -34,6 +43,12 @@ class projectsEntry extends entry return $this->sendError(400, 'error'); } + /** + * POST method. + * + * @access public + * @return void + */ public function post() { $fields = 'name,begin,end,products'; diff --git a/api/v1/entries/risk.php b/api/v1/entries/risk.php index feea8ed412..dc887f6b31 100644 --- a/api/v1/entries/risk.php +++ b/api/v1/entries/risk.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class riskEntry extends Entry { + /** + * GET method. + * + * @param int $riskID + * @access public + * @return void + */ public function get($riskID) { $control = $this->loadController('risk', 'view'); @@ -21,6 +31,13 @@ class riskEntry extends Entry $this->sendError(400, 'error'); } + /** + * PUT method. + * + * @param int $riskID + * @access public + * @return void + */ public function put($riskID) { $oldRisk = $this->loadModel('risk')->getByID($riskID); @@ -40,6 +57,13 @@ class riskEntry extends Entry $this->send(200, $this->format($risk, 'createdDate:time,editedDate:time')); } + /** + * DELETE method. + * + * @param int $riskID + * @access public + * @return void + */ public function delete($riskID) { $control = $this->loadController('risk', 'delete'); diff --git a/api/v1/entries/risks.php b/api/v1/entries/risks.php index ef354fa5ea..92026fd104 100644 --- a/api/v1/entries/risks.php +++ b/api/v1/entries/risks.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class risksEntry extends entry { + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ public function get($projectID = 0) { if(!$projectID) @@ -41,6 +51,13 @@ class risksEntry extends entry return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'risks' => $result)); } + /** + * POST method. + * + * @param int $projectID + * @access public + * @return void + */ public function post($projectID = 0) { $project = $this->loadModel('project')->getByID($projectID); diff --git a/api/v1/entries/stories.php b/api/v1/entries/stories.php index ffebfbcb3c..74f37226a6 100644 --- a/api/v1/entries/stories.php +++ b/api/v1/entries/stories.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class storiesEntry extends entry { + /** + * GET method. + * + * @param int $productID + * @access public + * @return void + */ public function get($productID) { $control = $this->loadController('product', 'browse'); @@ -34,6 +44,13 @@ class storiesEntry extends entry return $this->sendError(400, 'error'); } + /** + * POST method. + * + * @param int $productID + * @access public + * @return void + */ public function post($productID) { $fields = 'title,spec,verify,reviewer,type'; diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php index 7e668e0d73..9dd4e9c14b 100644 --- a/api/v1/entries/story.php +++ b/api/v1/entries/story.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class storyEntry extends Entry { + /** + * GET method. + * + * @param int $storyID + * @access public + * @return void + */ public function get($storyID) { $control = $this->loadController('story', 'view'); @@ -18,6 +28,13 @@ class storyEntry extends Entry $this->send(200, $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time')); } + /** + * PUT method. + * + * @param int $storyID + * @access public + * @return void + */ public function put($storyID) { $oldStory = $this->loadModel('story')->getByID($storyID); @@ -35,6 +52,13 @@ class storyEntry extends Entry $this->sendSuccess(200, $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time')); } + /** + * DELETE method. + * + * @param int $storyID + * @access public + * @return void + */ public function delete($storyID) { $control = $this->loadController('story', 'delete'); diff --git a/api/v1/entries/storychange.php b/api/v1/entries/storychange.php index 04da596b2b..4ae530c544 100644 --- a/api/v1/entries/storychange.php +++ b/api/v1/entries/storychange.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class storyChangeEntry extends Entry { + /** + * POST method. + * + * @param int $storyID + * @access public + * @return void + */ public function post($storyID) { $oldStory = $this->loadModel('story')->getByID($storyID); diff --git a/api/v1/entries/task.php b/api/v1/entries/task.php index 058646316b..351d0704a8 100644 --- a/api/v1/entries/task.php +++ b/api/v1/entries/task.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class taskEntry extends Entry { + /** + * GET method. + * + * @param int $taskID + * @access public + * @return void + */ public function get($taskID) { $control = $this->loadController('task', 'view'); @@ -25,6 +35,13 @@ class taskEntry extends Entry $this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time')); } + /** + * PUT method. + * + * @param int $taskID + * @access public + * @return void + */ public function put($taskID) { $oldTask = $this->loadModel('task')->getByID($taskID); @@ -41,6 +58,13 @@ class taskEntry extends Entry $this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time')); } + /** + * DELETE method. + * + * @param int $taskID + * @access public + * @return void + */ public function delete($taskID) { $control = $this->loadController('task', 'delete'); diff --git a/api/v1/entries/taskassignto.php b/api/v1/entries/taskassignto.php index 009b1e31a1..ed6477fd8f 100644 --- a/api/v1/entries/taskassignto.php +++ b/api/v1/entries/taskassignto.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class taskAssignToEntry extends Entry { + /** + * POST method. + * + * @param int $taskID + * @access public + * @return void + */ public function post($taskID) { $task = $this->loadModel('task')->getByID($taskID); diff --git a/api/v1/entries/taskfinish.php b/api/v1/entries/taskfinish.php index bb6bb1d312..80f20d20ce 100644 --- a/api/v1/entries/taskfinish.php +++ b/api/v1/entries/taskfinish.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class taskFinishEntry extends Entry { + /** + * POST method. + * + * @param int $taskID + * @access public + * @return void + */ public function post($taskID) { $task = $this->loadModel('task')->getByID($taskID); diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index a321f88c55..c581874622 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class tasksEntry extends entry { + /** + * GET method. + * + * @param int $executionID + * @access public + * @return void + */ public function get($executionID = 0) { if(!$executionID) @@ -42,6 +52,13 @@ class tasksEntry extends entry return $this->sendError(400, 'error'); } + /** + * POST method. + * + * @param int $executionID + * @access public + * @return void + */ public function post($executionID) { $fields = 'name,type,assignedTo,estimate,story,parent,execution,module,pri,desc,estStarted,deadline,mailto'; diff --git a/api/v1/entries/taskstart.php b/api/v1/entries/taskstart.php index 3990c3f9a0..d5896bf748 100644 --- a/api/v1/entries/taskstart.php +++ b/api/v1/entries/taskstart.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class taskStartEntry extends Entry { + /** + * POST method. + * + * @param int $taskID + * @access public + * @return void + */ public function post($taskID) { $task = $this->loadModel('task')->getByID($taskID); diff --git a/api/v1/entries/testcase.php b/api/v1/entries/testcase.php index 7d0a7e8f42..342097c9bc 100644 --- a/api/v1/entries/testcase.php +++ b/api/v1/entries/testcase.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class testcaseEntry extends entry { + /** + * GET method. + * + * @param int $testcaseID + * @access public + * @return void + */ public function get($testcaseID) { $control = $this->loadController('testcase', 'view'); diff --git a/api/v1/entries/testcases.php b/api/v1/entries/testcases.php index 9078ab60c6..682559feda 100644 --- a/api/v1/entries/testcases.php +++ b/api/v1/entries/testcases.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class testcasesEntry extends entry { + /** + * GET method. + * + * @access public + * @return void + */ public function get() { $this->app->loadClass('pager', $static = true); diff --git a/api/v1/entries/testtask.php b/api/v1/entries/testtask.php index ca65cb7a76..42d6740e50 100644 --- a/api/v1/entries/testtask.php +++ b/api/v1/entries/testtask.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class testtaskEntry extends entry { + /** + * GET method. + * + * @param int $testtaskID + * @access public + * @return void + */ public function get($testtaskID) { $control = $this->loadController('testtask', 'view'); @@ -22,6 +32,13 @@ class testtaskEntry extends entry $this->send(200, $this->format($testtask, 'realFinishedDate:time')); } + /** + * DELETE method. + * + * @param int $testtaskID + * @access public + * @return void + */ public function delete($testtaskID) { $control = $this->loadController('testtask', 'delete'); diff --git a/api/v1/entries/testtasks.php b/api/v1/entries/testtasks.php index 5a7da5b00e..155af3a789 100644 --- a/api/v1/entries/testtasks.php +++ b/api/v1/entries/testtasks.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class testtasksEntry extends entry { + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ public function get($projectID = 0) { if($projectID) return $this->getProjectTesttasks($projectID); @@ -31,6 +41,13 @@ class testtasksEntry extends entry return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'testtasks' => $result)); } + /** + * Get testtasks of project. + * + * @param int $projectID + * @access public + * @return void + */ private function getProjectTesttasks($projectID) { $project = $this->loadModel('project')->getByID($projectID); diff --git a/api/v1/entries/todo.php b/api/v1/entries/todo.php index 33f6c0bd12..ff9f59a67b 100644 --- a/api/v1/entries/todo.php +++ b/api/v1/entries/todo.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class todoEntry extends entry { + /** + * GET method. + * + * @param int $todoID + * @access public + * @return void + */ public function get($todoID) { $control = $this->loadController('todo', 'view'); @@ -21,6 +31,13 @@ class todoEntry extends entry $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } + /** + * PUT method. + * + * @param int $todoID + * @access public + * @return void + */ public function put($todoID) { $oldTodo = $this->loadModel('todo')->getByID($todoID); @@ -46,6 +63,13 @@ class todoEntry extends entry $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } + /** + * DELETE method. + * + * @param int $todoID + * @access public + * @return void + */ public function delete($todoID) { $control = $this->loadController('todo', 'delete'); diff --git a/api/v1/entries/todos.php b/api/v1/entries/todos.php index e01efef14f..e03e26d90d 100644 --- a/api/v1/entries/todos.php +++ b/api/v1/entries/todos.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class todosEntry extends entry { + /** + * GET method. + * + * @access public + * @return void + */ public function get() { $control = $this->loadController('my', 'todo'); @@ -26,6 +35,12 @@ class todosEntry extends entry return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'todos' => $result)); } + /** + * POST method. + * + * @access public + * @return void + */ public function post() { $fields = 'name,desc,begin,end,private'; @@ -51,5 +66,4 @@ class todosEntry extends entry $this->send(201, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } - } diff --git a/api/v1/entries/tokens.php b/api/v1/entries/tokens.php index 2d72658408..db71ddd816 100644 --- a/api/v1/entries/tokens.php +++ b/api/v1/entries/tokens.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class tokensEntry extends baseEntry { + /** + * POST method. + * + * @access public + * @return void + */ public function post() { $account = $this->request('account'); diff --git a/api/v1/entries/user.php b/api/v1/entries/user.php index 690dc0a669..b5c773ea6d 100644 --- a/api/v1/entries/user.php +++ b/api/v1/entries/user.php @@ -1,13 +1,23 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class userEntry extends Entry { + /** + * GET method. + * + * @param int $userID + * @access public + * @return void + */ public function get($userID = 0) { /* Get my info defaultly. */ @@ -95,6 +105,13 @@ class userEntry extends Entry $this->send(200, $info); } + /** + * PUT method. + * + * @param int $userID + * @access public + * @return void + */ public function put($userID) { $oldUser = $this->loadModel('user')->getByID($userID, 'id'); @@ -117,6 +134,13 @@ class userEntry extends Entry $this->send(200, $this->format($user, 'last:time,locked:time')); } + /** + * DELETE method. + * + * @param int $userID + * @access public + * @return void + */ public function delete($userID) { $this->setPost('verifyPassword', md5($this->app->user->password . $this->app->session->rand)); diff --git a/api/v1/entries/users.php b/api/v1/entries/users.php index 9f3c26bdb1..91e7f2fecb 100644 --- a/api/v1/entries/users.php +++ b/api/v1/entries/users.php @@ -1,13 +1,22 @@ + * @package entries + * @version 1 + * @link http://www.zentao.net */ class usersEntry extends entry { + /** + * GET method. + * + * @access public + * @return void + */ public function get() { $control = $this->loadController('company', 'browse'); @@ -28,6 +37,12 @@ class usersEntry extends entry return $this->sendError(400, 'error'); } + /** + * POST method. + * + * @access public + * @return void + */ public function post() { $fields = 'account,dept,realname,email,commiter,gender'; diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php index 00b81db466..1905de0985 100644 --- a/framework/api/entry.class.php +++ b/framework/api/entry.class.php @@ -2,6 +2,15 @@ /** * 禅道API的entry类。 * The entry class file of ZenTao API. + * + * @package framework + * + * The author disclaims copyright to this source code. In place of + * a legal notice, here is a blessing: + * + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. */ class entry extends baseEntry { @@ -275,6 +284,7 @@ class baseEntry $controller = new $className(); $controller->viewType = 'json'; + return $controller; } diff --git a/module/task/control.php b/module/task/control.php index 55285058f8..db3740bcb6 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -677,6 +677,7 @@ class task extends control if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found')); die(js::error($this->lang->notFound) . js::locate('back')); } + $this->session->project = $task->project; if($task->fromBug != 0)