From 24530f75cabd1f92af861712fc38bee7c90d4da2 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Sun, 24 Apr 2022 08:40:45 +0800 Subject: [PATCH] * When create story can choise parent story. --- api/v1/entries/modulestories.php | 31 ---------------------- api/v1/entries/product.php | 3 +++ api/v1/entries/storychild.php | 44 -------------------------------- module/file/model.php | 1 - 4 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 api/v1/entries/modulestories.php delete mode 100644 api/v1/entries/storychild.php diff --git a/api/v1/entries/modulestories.php b/api/v1/entries/modulestories.php deleted file mode 100644 index 16ac618148..0000000000 --- a/api/v1/entries/modulestories.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @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('execution', 'story'); - $control->story($executionID, 'order_desc', 'byModule', $moduleID); - - $data = $this->getData(); - - $result = []; - foreach($data->data->stories as $story) - { - $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 36ef598f11..a46ca2debc 100644 --- a/api/v1/entries/product.php +++ b/api/v1/entries/product.php @@ -57,6 +57,9 @@ class productEntry extends Entry case 'moduleoptionmenu': $product->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, 'story', 0, 'all'); break; + case 'parentstories': + $product->parentstories= $this->loadModel('story')->getParentStoryPairs($productID); + break; case 'builds': $product->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone,withbranch', $this->param('object', 0), $this->param('objectType', 'execution')); break; diff --git a/api/v1/entries/storychild.php b/api/v1/entries/storychild.php deleted file mode 100644 index 0c9a292663..0000000000 --- a/api/v1/entries/storychild.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @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/module/file/model.php b/module/file/model.php index 38242c70aa..f20d6c5796 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -737,7 +737,6 @@ class fileModel extends model if($content) $data->$editorID = $content; $data->$editorID = preg_replace("/ src=\"$readLinkReg\" /", ' src="' . $imgURL . '" ', $data->$editorID); $data->$editorID = preg_replace("/ src=\"" . htmlSpecialString($readLinkReg) . "\" /", ' src="' . $imgURL . '" ', $data->$editorID); - preg_match_all('/ src="{([0-9]+)\.\w+}"/', $data->$editorID, $matchs); if($matchs[1]) {