diff --git a/api/v1/entries/bug.php b/api/v1/entries/bug.php index 6bc0243f45..7146d2d879 100644 --- a/api/v1/entries/bug.php +++ b/api/v1/entries/bug.php @@ -92,7 +92,7 @@ class bugEntry extends entry $oldBug = $this->loadModel('bug')->getByID($bugID); /* Set $_POST variables. */ - $fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story,resolvedBy,closedBy,resolution,product,plan,task,module,steps'; + $fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story,resolvedBy,closedBy,resolution,product,plan,task,module,steps,mailto,keywords'; $this->batchSetPost($fields, $oldBug); $this->setPost('notifyEmail', implode(',', $this->request('notifyEmail', array()))); diff --git a/api/v1/entries/bugs.php b/api/v1/entries/bugs.php index 9e6621a61d..ef00d94398 100644 --- a/api/v1/entries/bugs.php +++ b/api/v1/entries/bugs.php @@ -79,7 +79,7 @@ class bugsEntry extends entry if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product; if(!$productID) return $this->sendError(400, 'Need product id.'); - $fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story'; + $fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story,task,mailto,keywords,steps'; $this->batchSetPost($fields); $this->setPost('product', $productID); diff --git a/api/v1/entries/builds.php b/api/v1/entries/builds.php index e303c9a4e1..3709a0463c 100644 --- a/api/v1/entries/builds.php +++ b/api/v1/entries/builds.php @@ -21,7 +21,6 @@ class buildsEntry extends entry public function get($projectID = 0) { if(empty($projectID)) $projectID = $this->param('project', 0); - if(empty($projectID)) return $this->sendError(400, "Need project id."); $control = $this->loadController('project', 'build'); $control->build($projectID, $this->param('type', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc')); 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/executionmembers.php b/api/v1/entries/executionmembers.php new file mode 100644 index 0000000000..6b7a680b93 --- /dev/null +++ b/api/v1/entries/executionmembers.php @@ -0,0 +1,25 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class executionMembersEntry extends entry +{ + public function get($executionID = 0) + { + if(!$executionID) $executionID = $this->param('execution', 0); + if(empty($executionID)) return $this->sendError(400, 'Need execution id.'); + $members = $this->loadModel('execution')->getTeamMembers($executionID); + if(isset($members)) + { + foreach($members as $member) $result[] = $this->format($member, 'join:date'); + } + return $this->send(200, array('members' => $result)); + } +} diff --git a/api/v1/entries/executionstories.php b/api/v1/entries/executionstories.php index 4f32cb527c..d2f74e1126 100644 --- a/api/v1/entries/executionstories.php +++ b/api/v1/entries/executionstories.php @@ -34,6 +34,7 @@ class executionStoriesEntry extends entry $result = array(); foreach($stories as $story) { + $story->name =$story->title; $result[] = $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'); } return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result)); diff --git a/api/v1/entries/modulestories.php b/api/v1/entries/modulestories.php new file mode 100644 index 0000000000..03a29b2f2f --- /dev/null +++ b/api/v1/entries/modulestories.php @@ -0,0 +1,32 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class moduleStoriesEntry extends Entry +{ + public function get($moduleID) + { + $executionID = $this->param('executionID', 0); + if(empty($executionID)) return $this->sendError(400, 'Need execution id.'); + $control = $this->loadController('story', 'ajaxGetExecutionStories'); + $control->ajaxGetExecutionStories($executionID, $this->param('productID', 0), $this->param('branchID', 0), $moduleID); + + $data = $this->getData(); + $this->loadModel('story'); + $result = []; + foreach($data as $storyID => $storyName) + { + if(empty($storyID)) continue; + $story = $this->story->getById($storyID); + $result[] = $this->filterFields($story, 'id,title,module,pri,status,stage,estimate'); + } + return $this->send(200, array('stories' => $result)); + } +} diff --git a/api/v1/entries/product.php b/api/v1/entries/product.php index cedc89b2a2..effecc6a9a 100644 --- a/api/v1/entries/product.php +++ b/api/v1/entries/product.php @@ -51,9 +51,16 @@ class productEntry extends Entry $product->modules = $data->data->tree; } break; + case 'moduleoptionmenu': + $product->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, 'bug', 0, 'all'); + break; + case 'builds': + $product->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone,withbranch'); + break; case 'actions': $product->addComment = common::hasPriv('action', 'comment') ? true : false; + $users = $this->loadModel('user')->getPairs(); $actions = $data->data->actions; $product->actions = $this->loadModel('action')->processActionForAPI($actions, $users, $this->lang->product); break; diff --git a/api/v1/entries/productplans.php b/api/v1/entries/productplans.php index f56cf3ae96..e903903f4c 100644 --- a/api/v1/entries/productplans.php +++ b/api/v1/entries/productplans.php @@ -36,6 +36,7 @@ class productplansEntry extends entry foreach($plans as $plan) { + $plan->name = $plan->title; if($plan->parent > 0 and isset($result[$plan->parent])) { $parentPlan = $result[$plan->parent]; diff --git a/api/v1/entries/stories.php b/api/v1/entries/stories.php index af5333b2bc..d92f3ddd6e 100644 --- a/api/v1/entries/stories.php +++ b/api/v1/entries/stories.php @@ -35,6 +35,7 @@ class storiesEntry extends entry $result = array(); foreach($stories as $story) { + $story->name =$story->title; if(isset($story->children)) $story->children = array_values((array)$story->children); $result[] = $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'); } @@ -54,7 +55,7 @@ class storiesEntry extends entry if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product; if(!$productID) return $this->sendError(400, 'Need product id.'); - $fields = 'title,spec,verify,reviewer,type,plan,module,source,sourceNote,category,pri,estimate'; + $fields = 'title,spec,verify,reviewer,type,plan,module,moduleOptionMenu,source,sourceNote,category,pri,estimate,mailto,keywords'; $this->batchSetPost($fields); /* If reviewer is not post, set needNotReview. */ diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php index b9ed92df75..77889a3dbc 100644 --- a/api/v1/entries/story.php +++ b/api/v1/entries/story.php @@ -95,14 +95,19 @@ class storyEntry extends Entry $oldStory = $this->loadModel('story')->getByID($storyID); /* Set $_POST variables. */ - $fields = 'type'; + $fields = 'title,product,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords'; $this->batchSetPost($fields, $oldStory); $this->setPost('parent', 0); $control = $this->loadController('story', 'edit'); $control->edit($storyID); - $this->getData(); + + $data = $this->getData(); + + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + if(!isset($data->status)) return $this->sendError(400, 'error'); + $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/storyactive.php b/api/v1/entries/storyactive.php new file mode 100644 index 0000000000..d5d6189f55 --- /dev/null +++ b/api/v1/entries/storyactive.php @@ -0,0 +1,42 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + **/ + +class storyActiveEntry extends Entry +{ + /** + * POST method. + * + * @param int $storyID + * @access public + * @return void + */ + public function post($storyID) + { + $oldStory = $this->loadModel('story')->getByID($storyID); + + $fields = 'assignedTo,status,comment'; + $this->batchSetPost($fields); + + $control = $this->loadController('story', 'activate'); + + $control->activate($storyID); + + $data = $this->getData(); + if(!$data or !isset($data->status)) return $this->send400('error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); + + $story = $this->loadModel('story')->getByID($storyID); + + $this->send(200, $story); + } +} + diff --git a/api/v1/entries/storyassignto.php b/api/v1/entries/storyassignto.php new file mode 100644 index 0000000000..0b3477a1ee --- /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 +{ + /** + * POST method. + * + * @param int $storyID + * @access public + * @return void + */ + public function post($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/storychange.php b/api/v1/entries/storychange.php index 67f5102eb4..174ec4620f 100644 --- a/api/v1/entries/storychange.php +++ b/api/v1/entries/storychange.php @@ -35,7 +35,7 @@ class storyChangeEntry extends Entry } $control = $this->loadController('story', 'change'); - $this->requireFields('title,spec,verify'); + $this->requireFields('title'); $control->change($storyID); diff --git a/api/v1/entries/storychild.php b/api/v1/entries/storychild.php new file mode 100644 index 0000000000..0c9a292663 --- /dev/null +++ b/api/v1/entries/storychild.php @@ -0,0 +1,44 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + **/ +class storyChildEntry extends Entry +{ + /** + * POST method. + * + * @param int $storyID + * @access public + * @return void + **/ + public function post($storyID) + { + $fields = 'title,spec,verify,reviewer,type,plan,module,moduleOptionMenu,source,sourceNote,category,pri,estimate,keywords,parent'; + $this->batchSetPost($fields); + + $fields = explode(',', $fields); + foreach($fields as $field) $this->setArrayPost($field); + $story = $this->loadModel('story')->getById($storyID); + + $control = $this->loadController('story', 'batchCreate'); + $control->batchCreate($story->product, 0, 0, $storyID); + + $data = $this->getData(); + + $story = $this->story->getById($data->idList[0]); + $this->send(200, $this->format($story, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + } + + public function setArrayPost($field) + { + $_POST[$field] = array('0' => $_POST[$field]); + } +} + diff --git a/api/v1/entries/storyclose.php b/api/v1/entries/storyclose.php new file mode 100644 index 0000000000..a83948232e --- /dev/null +++ b/api/v1/entries/storyclose.php @@ -0,0 +1,39 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class storyCloseEntry extends Entry +{ + /** + * POST method. + * + * @param int $storyID + * @access public + * @return void + */ + public function post($storyID) + { + $story = $this->loadModel('story')->getByID($storyID); + + $fields = 'closedReason,duplicateStory,childStories,comment'; + $this->batchSetPost($fields); + + $control = $this->loadController('story', 'close'); + $control->close($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/tabs.php b/api/v1/entries/tabs.php index caf7fa7ae5..71c245e10a 100644 --- a/api/v1/entries/tabs.php +++ b/api/v1/entries/tabs.php @@ -28,6 +28,7 @@ class tabsEntry extends baseEntry foreach($tabs as $menuKey) { + if(!isset($this->lang->my->$menuKey)) continue; if(!common::hasPriv('my', $menuKey)) continue; $label = $this->lang->my->$menuKey; if($menuKey == 'calendar') $label = $this->lang->my->calendarAction; diff --git a/api/v1/entries/task.php b/api/v1/entries/task.php index c91060d76f..b06bd8f677 100644 --- a/api/v1/entries/task.php +++ b/api/v1/entries/task.php @@ -102,13 +102,14 @@ class taskEntry extends Entry $oldTask = $this->loadModel('task')->getByID($taskID); /* Set $_POST variables. */ - $fields = 'name,type,assignedTo,estimate,left,consumed,story,parent,execution,module,closedReason,status,estStarted,deadline'; + $fields = 'name,type,desc,assignedTo,pri,estimate,left,consumed,story,parent,execution,module,closedReason,status,estStarted,deadline,team,teamEstimate,multiple,mailto'; $this->batchSetPost($fields, $oldTask); $control = $this->loadController('task', 'edit'); $control->edit($taskID); - $this->getData(); + $data = $this->getData(); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $task = $this->task->getByID($taskID); $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); } diff --git a/api/v1/entries/taskclose.php b/api/v1/entries/taskclose.php new file mode 100644 index 0000000000..774c115c53 --- /dev/null +++ b/api/v1/entries/taskclose.php @@ -0,0 +1,39 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class taskCloseEntry extends Entry +{ + /** + * POST method. + * + * @param int $taskID + * @access public + * @return void + */ + public function post($taskID) + { + $task = $this->loadModel('task')->getByID($taskID); + + $fields = 'comment'; + $this->batchSetPost($fields); + + $control = $this->loadController('task', 'close'); + $control->close($taskID); + + $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); + + $task = $this->loadModel('task')->getByID($taskID); + + $this->send(200, $task); + } +} diff --git a/api/v1/entries/taskcomponent.php b/api/v1/entries/taskcomponent.php new file mode 100644 index 0000000000..6921b7e5b1 --- /dev/null +++ b/api/v1/entries/taskcomponent.php @@ -0,0 +1,45 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class taskComponentEntry extends Entry +{ + /** + * POST method. + * + * @param int $taskID + * @access public + * @return void + */ + public function post($taskID) + { + $fields = 'name,type,assignedTo,parent,estimate,story,module,pri,desc,estStarted,deadline'; + $this->batchSetPost($fields); + + $fields = explode(',', $fields); + foreach($fields as $field) $this->setArrayPost($field); + $task = $this->loadModel('task')->getById($taskID); + + $control = $this->loadController('task', 'batchCreate'); + $control->batchCreate($task->execution, 0, 0, $taskID); + + $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); + + $task = $this->task->getById($data->idList[0]); + $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + } + + public function setArrayPost($field) + { + $_POST[$field] = array('0' => $_POST[$field]); + } +} diff --git a/api/v1/entries/taskfinish.php b/api/v1/entries/taskfinish.php index 28de8ae47e..2c12a46cc6 100644 --- a/api/v1/entries/taskfinish.php +++ b/api/v1/entries/taskfinish.php @@ -36,7 +36,7 @@ class taskFinishEntry extends Entry $control->finish($taskID); $data = $this->getData(); - if(!$data or !isset($data->status)) return $this->send400('error'); + if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $task = $this->loadModel('task')->getByID($taskID); diff --git a/api/v1/entries/taskpause.php b/api/v1/entries/taskpause.php new file mode 100644 index 0000000000..7548fa25e0 --- /dev/null +++ b/api/v1/entries/taskpause.php @@ -0,0 +1,39 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class taskPauseEntry extends Entry +{ + /** + * POST method. + * + * @param int $taskID + * @access public + * @return void + */ + public function post($taskID) + { + $task = $this->loadModel('task')->getByID($taskID); + + $fields = 'comment'; + $this->batchSetPost($fields); + + $control = $this->loadController('task', 'pause'); + $control->pause($taskID); + + $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); + + $task = $this->loadModel('task')->getByID($taskID); + + $this->send(200, $task); + } +} diff --git a/api/v1/entries/taskrecordestimate.php b/api/v1/entries/taskrecordestimate.php new file mode 100644 index 0000000000..178452030c --- /dev/null +++ b/api/v1/entries/taskrecordestimate.php @@ -0,0 +1,45 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class taskRecordEstimateEntry extends Entry +{ + /** + * POST method. + * + * @param int $taskID + * @access public + * @return void + */ + public function post($taskID) + { + if($this->config->edition != 'open') + { + $fields = 'id,dates,consumed,left,objectType,objectID,work'; + $this->batchSetPost($fields); + $control = $this->loadController('effort', 'createForObject'); + $control->createForObject('task', $taskID); + } + else + { + $fields = 'id,dates,consumed,left,work'; + $this->batchSetPost($fields); + $control = $this->loadController('task', 'recordEstimate'); + $control->recordEstimate($taskID); + } + + $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); + + $task = $this->loadModel('task')->getById($taskID); + $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + } +} diff --git a/api/v1/entries/taskstart.php b/api/v1/entries/taskstart.php index cf5adaee15..d21d4bb37a 100644 --- a/api/v1/entries/taskstart.php +++ b/api/v1/entries/taskstart.php @@ -22,7 +22,7 @@ class taskStartEntry extends Entry { $task = $this->loadModel('task')->getByID($taskID); - $fields = 'assignedTo,realStarted,comment,left'; + $fields = 'assignedTo,realStarted,consumed,left,comment'; $this->batchSetPost($fields); $control = $this->loadController('task', 'start'); @@ -30,7 +30,7 @@ class taskStartEntry extends Entry $control->start($taskID); $data = $this->getData(); - if(!$data or !isset($data->status)) return $this->send400('error'); + if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $task = $this->loadModel('task')->getByID($taskID); diff --git a/config/routes.php b/config/routes.php index bc4f6c8bcb..df7cda86a9 100644 --- a/config/routes.php +++ b/config/routes.php @@ -39,12 +39,19 @@ $routes['/products/:id/releases'] = 'releases'; $routes['/projects/:id/releases'] = 'projectReleases'; $routes['/releases/:id'] = 'release'; -$routes['/stories'] = 'stories'; -$routes['/products/:id/stories'] = 'stories'; -$routes['/projects/:id/stories'] = 'projectStories'; -$routes['/executions/:id/stories'] = 'executionStories'; -$routes['/stories/:id'] = 'story'; -$routes['/stories/:id/change'] = 'storyChange'; +$routes['/stories'] = 'stories'; +$routes['/products/:id/stories'] = 'stories'; +$routes['/projects/:id/stories'] = 'projectStories'; +$routes['/executions/:id/stories'] = 'executionStories'; +$routes['/stories/:id'] = 'story'; +$routes['/stories/:id/change'] = 'storyChange'; +$routes['/stories/:id/close'] = 'storyClose'; +$routes['/stories/:id/active'] = 'storyActive'; +$routes['/stories/:id/assign'] = 'storyAssignto'; +$routes['/stories/:id/recordEstimate'] = 'storyRecordEstimate'; +$routes['/stories/:id/child'] = 'storyChild'; + +$routes['/module/:id/stories'] = 'moduleStories'; $routes['/products/:id/bugs'] = 'bugs'; $routes['/projects/:id/bugs'] = 'projectBugs'; @@ -61,12 +68,16 @@ $routes['/projects/:id/executions'] = 'executions'; $routes['/executions'] = 'executions'; $routes['/executions/:id'] = 'execution'; -$routes['/executions/:id/tasks'] = 'tasks'; -$routes['/tasks'] = 'tasks'; -$routes['/tasks/:id'] = 'task'; -$routes['/tasks/:id/assignto'] = 'taskAssignTo'; -$routes['/tasks/:id/start'] = 'taskStart'; -$routes['/tasks/:id/finish'] = 'taskFinish'; +$routes['/executions/:id/tasks'] = 'tasks'; +$routes['/tasks'] = 'tasks'; +$routes['/tasks/:id'] = 'task'; +$routes['/tasks/:id/component'] = 'taskComponent'; +$routes['/tasks/:id/assignto'] = 'taskAssignTo'; +$routes['/tasks/:id/start'] = 'taskStart'; +$routes['/tasks/:id/pause'] = 'taskPause'; +$routes['/tasks/:id/finish'] = 'taskFinish'; +$routes['/tasks/:id/close'] = 'taskClose'; +$routes['/tasks/:id/recordEstimate'] = 'taskRecordEstimate'; $routes['/users'] = 'users'; $routes['/users/:id'] = 'user'; @@ -95,6 +106,7 @@ $routes['/builds/:id'] = 'build'; $routes['/products/:id/testcases'] = 'testcases'; $routes['/projects/:id/testcases'] = 'projectCases'; $routes['/executions/:id/testcases'] = 'executionCases'; +$routes['/executions/:id/members'] = 'executionMembers'; $routes['/testcases'] = 'testcases'; $routes['/testcases/:id'] = 'testcase'; $routes['/testcases/:id/results'] = 'testresults'; diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php index a2c6496563..6ae1237f45 100644 --- a/framework/api/entry.class.php +++ b/framework/api/entry.class.php @@ -246,6 +246,18 @@ class baseEntry $this->send($code, $response); } + /** + * Send 400 response. + * + * @param string message + * @access public + * @return void + */ + public function send400($message = 'error') + { + $this->sendError(400, $message); + } + /** * Send 404 response. * @@ -286,7 +298,20 @@ class baseEntry * 引入该模块的control文件。 * Include the control file of the module. **/ + $file2Included = $app->setActionExtFile() ? $app->extActionFile : $app->controlFile; + + $isExt = $app->setActionExtFile(); + if($isExt) + { + $controlFile = $app->controlFile; + spl_autoload_register(function($class) use ($moduleName, $controlFile) + { + if($class == $moduleName) include $controlFile; + }); + } + + $file2Included = $isExt ? $app->extActionFile : $app->controlFile; chdir(dirname($file2Included)); helper::import($file2Included); } diff --git a/module/execution/control.php b/module/execution/control.php index 536f54314c..b32ca62eb3 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -126,7 +126,7 @@ class execution extends control $execution = $this->commonAction($executionID, $status); $executionID = $execution->id; - if($execution->type == 'kanban' and $this->config->vision != 'lite') $this->locate($this->createLink('execution', 'kanban', "executionID=$executionID")); + if($execution->type == 'kanban' and $this->config->vision != 'lite' and defined('RUN_MODE') and RUN_MODE != 'api') $this->locate($this->createLink('execution', 'kanban', "executionID=$executionID")); /* Get products by execution. */ $products = $this->product->getProductPairsByProject($executionID); diff --git a/module/my/model.php b/module/my/model.php index 21028cfc01..3941377e1e 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -149,6 +149,7 @@ class myModel extends model } /* Sort by storyCount, get 5 records */ + $products = json_decode(json_encode($products), true); array_multisort(array_column($products, 'storyEstimateCount'), SORT_DESC, $products); $products = array_slice($products, 0, 5); diff --git a/module/story/control.php b/module/story/control.php index 22fe810d3a..aeb1053d9a 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1351,7 +1351,7 @@ class story extends control if(defined('RUN_MODE') && RUN_MODE == 'api') { - return print(array('status' => 'success', 'data' => $storyID)); + return $this->send(array('status' => 'success', 'data' => $storyID)); } else {