diff --git a/api/v1/entries/execution.php b/api/v1/entries/execution.php index 00ae8b68c7..306d6f374b 100644 --- a/api/v1/entries/execution.php +++ b/api/v1/entries/execution.php @@ -20,7 +20,8 @@ class executionEntry extends Entry */ public function get($executionID) { - $fields = $this->param('fields'); + $fields = $this->param('fields'); + $productID = $this->param('productID'); $control = $this->loadController('execution', 'view'); $control->view($executionID); @@ -63,14 +64,8 @@ class executionEntry extends Entry { 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; - } + case 'builds': + $execution->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone', $executionID, 'execution'); break; case 'moduleoptionmenu': $execution->moduleOptionMenu = $this->loadModel('tree')->getTaskOptionMenu($executionID, 0, 0, 'allModule'); diff --git a/api/v1/entries/storyassignto.php b/api/v1/entries/storyassignto.php new file mode 100644 index 0000000000..f6869b59f4 --- /dev/null +++ b/api/v1/entries/storyassignto.php @@ -0,0 +1,39 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class storyAssignToEntry extends Entry +{ + /** + * PUT method. + * + * @param int $storyID + * @access public + * @return void + */ + public function put($storyID) + { + $task = $this->loadModel('story')->getByID($storyID); + + $fields = 'assignedTo'; + $this->batchSetPost($fields); + + $control = $this->loadController('story', 'assignTo'); + $control->assignTo($storyID); + + $data = $this->getData(); + if(!$data) return $this->send400('error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); + + $story = $this->story->getByID($storyID); + + $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + } +} diff --git a/api/v1/entries/storyclose.php b/api/v1/entries/storyclose.php index a83948232e..1f6057178d 100644 --- a/api/v1/entries/storyclose.php +++ b/api/v1/entries/storyclose.php @@ -12,13 +12,13 @@ class storyCloseEntry extends Entry { /** - * POST method. + * PUT method. * * @param int $storyID * @access public * @return void */ - public function post($storyID) + public function put($storyID) { $story = $this->loadModel('story')->getByID($storyID); diff --git a/api/v1/entries/taskclose.php b/api/v1/entries/taskclose.php index 774c115c53..da57db1ec8 100644 --- a/api/v1/entries/taskclose.php +++ b/api/v1/entries/taskclose.php @@ -12,13 +12,13 @@ class taskCloseEntry extends Entry { /** - * POST method. + * PUT method. * * @param int $taskID * @access public * @return void */ - public function post($taskID) + public function put($taskID) { $task = $this->loadModel('task')->getByID($taskID); diff --git a/api/v1/entries/taskfinish.php b/api/v1/entries/taskfinish.php index 2c12a46cc6..564b037bae 100644 --- a/api/v1/entries/taskfinish.php +++ b/api/v1/entries/taskfinish.php @@ -12,13 +12,13 @@ class taskFinishEntry extends Entry { /** - * POST method. + * PUT method. * * @param int $taskID * @access public * @return void */ - public function post($taskID) + public function put($taskID) { $task = $this->loadModel('task')->getByID($taskID); diff --git a/api/v1/entries/taskpause.php b/api/v1/entries/taskpause.php index 7548fa25e0..438785b5f2 100644 --- a/api/v1/entries/taskpause.php +++ b/api/v1/entries/taskpause.php @@ -12,13 +12,13 @@ class taskPauseEntry extends Entry { /** - * POST method. + * PUT method. * * @param int $taskID * @access public * @return void */ - public function post($taskID) + public function put($taskID) { $task = $this->loadModel('task')->getByID($taskID); diff --git a/api/v1/entries/taskstart.php b/api/v1/entries/taskstart.php index d21d4bb37a..8a041bb377 100644 --- a/api/v1/entries/taskstart.php +++ b/api/v1/entries/taskstart.php @@ -12,13 +12,13 @@ class taskStartEntry extends Entry { /** - * POST method. + * PUT method. * * @param int $taskID * @access public * @return void */ - public function post($taskID) + public function put($taskID) { $task = $this->loadModel('task')->getByID($taskID); diff --git a/config/routes.php b/config/routes.php index 5988f71312..2dc12543fc 100644 --- a/config/routes.php +++ b/config/routes.php @@ -47,6 +47,8 @@ $routes['/stories/:id'] = 'story'; $routes['/stories/:id/change'] = 'storyChange'; $routes['/stories/:id/close'] = 'storyClose'; +$routes['/stories/:id/active'] = 'storyActive'; + $routes['/module/:id/stories'] = 'moduleStories'; $routes['/products/:id/bugs'] = 'bugs';