From 78218b47d01a44462f586ff7dd7814356964bd99 Mon Sep 17 00:00:00 2001
From: wangyidong
2、如果文件名可以开头含有 数字+下划线,以方便排序,程序会将他们忽略。
diff --git a/module/file/model.php b/module/file/model.php index 5956bb2460..3cb1d13679 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -403,8 +403,14 @@ class fileModel extends model if(is_dir($filePath)) $classFile->removeDir($filePath); $this->app->loadClass('pclzip', true); - $zip = new pclzip($zipFile); + $zip = new pclzip($zipFile); $files = $zip->listContent(); + foreach($files as $uploadFile) + { + $extension = substr(strrchr($uploadFile['filename'], '.'), 1); + if(empty($extension) or strpos($this->config->file->dangers, $extension) !== false) return false; + } + if($zip->extract(PCLZIP_OPT_PATH, $filePath) == 0) return false; return $filePath; } From 9ad38472fc36ee805741c569fa28de4e8cde7886 Mon Sep 17 00:00:00 2001 From: wangyidong| idAB);?> | priAB);?> | story->title);?> | diff --git a/module/product/view/create.html.php b/module/product/view/create.html.php index 04cb35cbfe..59dc8c93da 100644 --- a/module/product/view/create.html.php +++ b/module/product/view/create.html.php @@ -41,6 +41,10 @@product->RD;?> | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| product->type;?> | +product->typeList, 'normal', "class='form-control'");?> | + | ||||||||||||
| product->desc;?> | diff --git a/module/product/view/edit.html.php b/module/product/view/edit.html.php index 201494a4bf..d665866660 100644 --- a/module/product/view/edit.html.php +++ b/module/product/view/edit.html.php @@ -42,6 +42,10 @@ | product->RD;?> | RD, "class='form-control chosen'");?> | |||||||||||
| product->type;?> | +product->typeList, $product->type, "class='form-control'");?> | + | ||||||||||||
| product->status;?> | product->statusList, $product->status, "class='form-control'");?> | diff --git a/module/product/view/view.html.php b/module/product/view/view.html.php index ca66c7814c..21a25cfe5f 100644 --- a/module/product/view/view.html.php +++ b/module/product/view/view.html.php @@ -81,6 +81,10 @@ | product->RD;?> | RD];?> | ||||||||||
| product->type;?> | +product->typeList[$product->type];?> | + | ||||||||||||
| product->status;?> | product->statusList[$product->status];?> | diff --git a/module/productplan/control.php b/module/productplan/control.php index 1fe52294b5..4f0b3a7115 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -290,7 +290,7 @@ class productplan extends control } else { - $allStories = $this->story->getProductStories($this->view->product->id, $moduleID = '0', $status = 'draft,active,changed'); + $allStories = $this->story->getProductStories($this->view->product->id, $plan->branch, $moduleID = '0', $status = 'draft,active,changed'); } $this->view->allStories = $allStories; diff --git a/module/project/model.php b/module/project/model.php index a5b16ad328..fb7d5ed343 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -551,7 +551,7 @@ class projectModel extends model * @access public * @return array */ - public function getList($status = 'all', $limit = 0, $productID = 0) + public function getList($status = 'all', $limit = 0, $productID = 0, $branch = 0) { if($productID != 0) { @@ -563,6 +563,7 @@ class projectModel extends model ->andWhere('t2.deleted')->eq(0) ->andWhere('t2.iscat')->eq(0) ->beginIF($status == 'undone')->andWhere('t2.status')->ne('done')->fi() + ->beginIF($branch != 0)->andWhere('t1.branch')->like(",$branch,")->fi() ->beginIF($status == 'isdoing')->andWhere('t2.status')->ne('done')->andWhere('t2.status')->ne('suspended')->fi() ->beginIF($status != 'all' and $status != 'isdoing' and $status != 'undone')->andWhere('status')->in($status)->fi() ->orderBy('order_desc') @@ -630,10 +631,10 @@ class projectModel extends model * @access public * @return void */ - public function getProjectStats($status = 'undone', $productID = 0, $itemCounts = 30, $orderBy = 'order_desc', $pager = null) + public function getProjectStats($status = 'undone', $productID = 0, $branch, $itemCounts = 30, $orderBy = 'order_desc', $pager = null) { /* Init vars. */ - $projects = $this->getList($status, 0, $productID); + $projects = $this->getList($status, 0, $productID, $branch); foreach($projects as $projectID => $project) { if(!$this->checkPriv($project)) unset($projects[$projectID]); diff --git a/module/story/model.php b/module/story/model.php index 771b3467eb..1f8502f1e1 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -926,14 +926,15 @@ class storyModel extends model * @access public * @return array */ - public function getProductStories($productID = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id_desc', $pager = null) + public function getProductStories($productID = 0, $branch = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id_desc', $pager = null) { return $this->dao->select('t1.*, t2.title as planTitle') ->from(TABLE_STORY)->alias('t1') ->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id') ->where('t1.product')->in($productID) - ->beginIF(!empty($moduleIds))->andWhere('module')->in($moduleIds)->fi() - ->beginIF($status and $status != 'all')->andWhere('status')->in($status)->fi() + ->beginIF(!empty($branch))->andWhere("CONCAT(',', t1.branch, ',')")->like("%,$branch,%")->fi() + ->beginIF(!empty($moduleIds))->andWhere('t1.module')->in($moduleIds)->fi() + ->beginIF($status and $status != 'all')->andWhere('t1.status')->in($status)->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); } @@ -974,9 +975,9 @@ class storyModel extends model * @access public * @return array */ - public function getByAssignedTo($productID, $account, $orderBy, $pager) + public function getByAssignedTo($productID, $branch, $account, $orderBy, $pager) { - return $this->getByField($productID, 'assignedTo', $account, $orderBy, $pager); + return $this->getByField($productID, $branch, 'assignedTo', $account, $orderBy, $pager); } /** @@ -989,9 +990,9 @@ class storyModel extends model * @access public * @return array */ - public function getByOpenedBy($productID, $account, $orderBy, $pager) + public function getByOpenedBy($productID, $branch, $account, $orderBy, $pager) { - return $this->getByField($productID, 'openedBy', $account, $orderBy, $pager); + return $this->getByField($productID, $branch, 'openedBy', $account, $orderBy, $pager); } /** @@ -1004,9 +1005,9 @@ class storyModel extends model * @access public * @return array */ - public function getByReviewedBy($productID, $account, $orderBy, $pager) + public function getByReviewedBy($productID, $branch, $account, $orderBy, $pager) { - return $this->getByField($productID, 'reviewedBy', $account, $orderBy, $pager, 'include'); + return $this->getByField($productID, $branch, 'reviewedBy', $account, $orderBy, $pager, 'include'); } /** @@ -1018,9 +1019,9 @@ class storyModel extends model * @param object $pager * @return array */ - public function getByClosedBy($productID, $account, $orderBy, $pager) + public function getByClosedBy($productID, $branch, $account, $orderBy, $pager) { - return $this->getByField($productID, 'closedBy', $account, $orderBy, $pager); + return $this->getByField($productID, $branch, 'closedBy', $account, $orderBy, $pager); } /** @@ -1033,9 +1034,9 @@ class storyModel extends model * @access public * @return array */ - public function getByStatus($productID, $status, $orderBy, $pager) + public function getByStatus($productID, $branch, $status, $orderBy, $pager) { - return $this->getByField($productID, 'status', $status, $orderBy, $pager); + return $this->getByField($productID, $branch, 'status', $status, $orderBy, $pager); } /** @@ -1050,13 +1051,14 @@ class storyModel extends model * @access public * @return array */ - public function getByField($productID, $fieldName, $fieldValue, $orderBy, $pager, $operator = 'equal') + public function getByField($productID, $branch, $fieldName, $fieldValue, $orderBy, $pager, $operator = 'equal') { return $this->dao->select('t1.*, t2.title as planTitle') ->from(TABLE_STORY)->alias('t1') ->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id') ->where('t1.product')->in($productID) ->andWhere('t1.deleted')->eq(0) + ->beginIF(!empty($branch))->andWhere("CONCAT(',', t1.branch, ',')")->like("%,$branch,%")->fi() ->beginIF($operator == 'equal')->andWhere($fieldName)->eq($fieldValue)->fi() ->beginIF($operator == 'include')->andWhere($fieldName)->like("%$fieldValue%")->fi() ->orderBy($orderBy) @@ -1073,7 +1075,7 @@ class storyModel extends model * @access public * @return array */ - public function getWillClose($productID, $orderBy, $pager) + public function getWillClose($productID, $branch, $orderBy, $pager) { return $this->dao->select('t1.*, t2.title as planTitle') ->from(TABLE_STORY)->alias('t1') @@ -1099,7 +1101,7 @@ class storyModel extends model * @access public * @return array */ - public function getBySearch($productID, $queryID, $orderBy, $pager = null, $projectID = '') + public function getBySearch($productID, $branch, $queryID, $orderBy, $pager = null, $projectID = '') { if($projectID != '') { @@ -1367,7 +1369,7 @@ class storyModel extends model */ public function getZeroCase($productID, $orderBy = 'id_desc') { - $allStories = $this->getProductStories($productID, 0, 'all', $orderBy); + $allStories = $this->getProductStories($productID, 0, 0, 'all', $orderBy); $casedStories = $this->dao->select('DISTINCT story')->from(TABLE_CASE)->where('product')->eq($productID)->andWhere('story')->ne(0)->andWhere('deleted')->eq(0)->fetchAll('story'); foreach($allStories as $key => $story) diff --git a/www/js/my.full.js b/www/js/my.full.js index b651f1ff01..3fc58f0412 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -93,10 +93,11 @@ function shortcut() */ function showDropMenu(objectType, objectID, module, method, extra) { - var li = $('#currentItem').closest('li'); + var itemID = objectType == 'branch' ? '#currentBranch' : '#currentItem'; + var li = $(itemID).closest('li'); if(li.hasClass('show')) {li.removeClass('show'); return;} - var $dropMenu = $('#dropMenu'); + var $dropMenu = li.find('#dropMenu'); if(!li.data('showagain')) { li.data('showagain', true); @@ -105,7 +106,7 @@ function showDropMenu(objectType, objectID, module, method, extra) $dropMenu.on('keydown', '#search', function(e){ var code = e.which; - var $this = $('#searchResult > .search-list > ul > li.active'); + var $this = $dropMenu.find('#searchResult > .search-list > ul > li.active'); if(code === 38) // up { $this.removeClass('active'); @@ -122,7 +123,7 @@ function showDropMenu(objectType, objectID, module, method, extra) return; } } - $('#searchResult > .search-list > ul > li:not(.heading):last').addClass('active'); + $dropMenu.find('#searchResult > .search-list > ul > li:not(.heading):last').addClass('active'); } else if(code === 40) // down { @@ -140,7 +141,7 @@ function showDropMenu(objectType, objectID, module, method, extra) return; } } - $('#searchResult > .search-list > ul > li:not(.heading):first').addClass('active'); + $dropMenu.find('#searchResult > .search-list > ul > li:not(.heading):first').addClass('active'); } else if(code === 13) // enter { @@ -158,14 +159,14 @@ function showDropMenu(objectType, objectID, module, method, extra) searchItems(searchKey, objectType, objectID, module, method, extra); }, 200)); }).on('mouseenter', '#searchResult .search-list > ul > li', function(){ - $('#searchResult > .search-list > ul > li.active').removeClass('active'); + $dropMenu.find('#searchResult > .search-list > ul > li.active').removeClass('active'); $(this).addClass('active'); }); } $.get(createLink(objectType, 'ajaxGetDropMenu', "objectID=" + objectID + "&module=" + module + "&method=" + method + "&extra=" + extra), function(data) { $dropMenu.html(data).find('#search').focus(); - $('#searchResult > .search-list > ul > li:not(.heading)').removeClass('active').first().addClass('active'); + $dropMenu.find('#searchResult > .search-list > ul > li:not(.heading)').removeClass('active').first().addClass('active'); }); li.addClass('show'); @@ -184,11 +185,14 @@ function showDropMenu(objectType, objectID, module, method, extra) */ function showDropResult(objectType, objectID, module, method, extra) { + var itemID = objectType == 'branch' ? '#currentBranch' : '#currentItem'; + var li = $(itemID).closest('li'); + var $dropMenu = li.find('#dropMenu'); $.get(createLink(objectType, 'ajaxGetDropMenu', "objectID=" + objectID + "&module=" + module + "&method=" + method + "&extra=" + extra), function(data) { - $('#dropMenu').html(data); - setTimeout(function(){$("#dropMenu #search").focus();}, 200); - $('#searchResult > .search-list > ul > li:not(.heading)').removeClass('active').first().addClass('active'); + $dropMenu.html(data); + setTimeout(function(){$dropMenu.find("#search").focus();}, 200); + $dropMenu.find('#searchResult > .search-list > ul > li:not(.heading)').removeClass('active').first().addClass('active'); }); } @@ -213,10 +217,13 @@ function searchItems(keywords, objectType, objectID, module, method, extra) } else { + var itemID = objectType == 'branch' ? '#currentBranch' : '#currentItem'; + var li = $(itemID).closest('li'); + var $dropMenu = li.find('#dropMenu'); keywords = encodeURI(keywords); - if(keywords != '-') $.get(createLink(objectType, 'ajaxGetMatchedItems', "keywords=" + keywords + "&module=" + module + "&method=" + method + "&extra=" + extra), function(data) + if(keywords != '-') $.get(createLink(objectType, 'ajaxGetMatchedItems', "keywords=" + keywords + "&module=" + module + "&method=" + method + "&extra=" + extra + "&objectID=" + objectID), function(data) { - $('#searchResult').html(data).find('.search-list > ul > li:not(.heading)').removeClass('active').first().addClass('active'); + $dropMenu.find('#searchResult').html(data).find('.search-list > ul > li:not(.heading)').removeClass('active').first().addClass('active'); }); } } From 333b0be157ac15717e7a7b39b53ccef49ec4a707 Mon Sep 17 00:00:00 2001 From: wangyidongstory->priList, $story->pri, $story->pri)?>'>story->priList, $story->pri, $story->pri);?> | -createLink('product', 'browse', "productID=$story->product"), $products[$story->product], '_blank');?> | +createLink('product', 'browse', "productID=$story->product&branch=$story->branch"), $products[$story->product], '_blank');?> | title);?> | planTitle;?> | openedBy];?> | diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index 9c2e873d8e..3aa370c06c 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -22,7 +22,7 @@ common::printIcon('story', 'export', "productID=$productID&orderBy=id_desc", '', 'button', '', '', 'export'); $this->lang->story->create = $this->lang->project->createStory; - if($productID) common::printIcon('story', 'create', "productID=$productID&moduleID=0&story=0&project=$project->id"); + if($productID) common::printIcon('story', 'create', "productID=$productID&branch=&moduleID=0&story=0&project=$project->id"); common::printIcon('project', 'linkStory', "project=$project->id", '', 'button', 'link'); ?> diff --git a/module/release/control.php b/module/release/control.php index bbf0c2db38..96c8c94507 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -18,11 +18,14 @@ class release extends control * @access public * @return void */ - public function commonAction($productID) + public function commonAction($productID, $branch = 0) { $this->loadModel('product'); - $this->view->product = $this->product->getById($productID); - $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}"), $this->view->product->name); + $product = $this->product->getById($productID); + $this->view->product = $product; + $this->view->branch = $branch; + $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id); + $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}&branch=$branch"), $this->view->product->name); $this->product->setMenu($this->product->getPairs(), $productID); } @@ -332,6 +335,7 @@ class release extends control $this->loadModel('product'); /* Build search form. */ + $product = $this->product->getByID($release->product); $queryID = ($browseType == 'bySearch') ? (int)$param : 0; unset($this->config->product->search['fields']['product']); unset($this->config->product->search['fields']['project']); @@ -341,6 +345,15 @@ class release extends control $this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product)); $this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($release->product, $viewType = 'story', $startModuleID = 0); $this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList); + if($product->type == 'normal') + { + unset($this->config->product->search['fields']['branch']); + unset($this->config->product->search['params']['branch']); + } + else + { + $this->config->product->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($product->id, 'noempty'); + } $this->loadModel('search')->setSearchParams($this->config->product->search); if($browseType == 'bySearch') diff --git a/module/story/control.php b/module/story/control.php index f862f887d8..fb533d0515 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -35,7 +35,7 @@ class story extends control * @access public * @return void */ - public function create($productID = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0) + public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0) { if(!empty($_POST)) { @@ -77,7 +77,7 @@ class story extends control if($this->post->newStory) { $response['message'] = $this->lang->story->successSaved . $this->lang->story->newStory; - $response['locate'] = $this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID&story=0&projectID=$projectID&bugID=$bugID"); + $response['locate'] = $this->createLink('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID&story=0&projectID=$projectID&bugID=$bugID"); $this->send($response); } if($projectID == 0) @@ -106,7 +106,7 @@ class story extends control } $users = $this->user->getPairs('nodeleted|pdfirst|noclosed'); - $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story'); + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); /* Set menu. */ $this->product->setMenu($products, $product->id); @@ -158,7 +158,7 @@ class story extends control } $this->view->title = $product->name . $this->lang->colon . $this->lang->story->create; - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID"), $product->name); + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID&branch=$branch"), $product->name); $this->view->position[] = $this->lang->story->common; $this->view->position[] = $this->lang->story->create; $this->view->products = $products; @@ -170,6 +170,8 @@ class story extends control $this->view->planID = $planID; $this->view->source = $source; $this->view->pri = $pri; + $this->view->branch = $branch; + $this->view->branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($productID) : array(); $this->view->productID = $productID; $this->view->product = $product; $this->view->projectID = $projectID; @@ -192,27 +194,27 @@ class story extends control * @access public * @return void */ - public function batchCreate($productID = 0, $moduleID = 0) + public function batchCreate($productID = 0, $branch = 0, $moduleID = 0) { if(!empty($_POST)) { - $mails = $this->story->batchCreate($productID); + $mails = $this->story->batchCreate($productID, $branch); if(dao::isError()) die(js::error(dao::getError())); foreach($mails as $mail) { $this->sendmail($mail->storyID, $mail->actionID); } - die(js::locate($this->createLink('product', 'browse', "productID=$productID"), 'parent')); + die(js::locate($this->createLink('product', 'browse', "productID=$productID&branch=$branch"), 'parent')); } /* Set products and module. */ $product = $this->product->getById($productID); $products = $this->product->getPairs(); - $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story'); + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); /* Set menu. */ - $this->product->setMenu($products, $product->id); + $this->product->setMenu($products, $product->id, $branch); /* Init vars. */ $planID = 0; @@ -241,13 +243,14 @@ class story extends control $moduleOptionMenu['same'] = $this->lang->story->same; $plans = $this->loadModel('productplan')->getPairs($productID, 'unexpired'); - $plans['same'] = $this->lang->story->same; - $priList = (array)$this->lang->story->priList; - $priList['same'] = $this->lang->story->same; + $plans['same'] = $this->lang->story->same; + $priList = (array)$this->lang->story->priList; + $priList['same'] = $this->lang->story->same; + $branches['same'] = $this->lang->story->same; $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchCreate; $this->view->productName = $product->name; - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID"), $product->name); + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID&branch=$branch"), $product->name); $this->view->position[] = $this->lang->story->common; $this->view->position[] = $this->lang->story->batchCreate; $this->view->products = $products; @@ -261,6 +264,8 @@ class story extends control $this->view->estimate = $estimate; $this->view->storyTitle = $title; $this->view->spec = $spec; + $this->view->branches = $branches; + $this->view->branch = $branch; $this->display(); } @@ -278,13 +283,13 @@ class story extends control $story = $this->story->getById($storyID); $product = $this->product->getById($story->product); $products = $this->product->getPairs(); - $moduleOptionMenu = $this->tree->getOptionMenu($product->id, $viewType = 'story'); + $moduleOptionMenu = $this->tree->getOptionMenu($product->id, $viewType = 'story', 0, $story->branch); /* Set menu. */ $this->product->setMenu($products, $product->id); /* Assign. */ - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name); + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name); $this->view->position[] = $this->lang->story->common; $this->view->product = $product; $this->view->products = $products; @@ -320,11 +325,14 @@ class story extends control $this->commonAction($storyID); /* Assign. */ - $story = $this->story->getById($storyID, 0, true); + $story = $this->story->getById($storyID, 0, true); + $product = $this->loadModel('product')->getById($story->product); $this->view->title = $this->lang->story->edit . "STORY" . $this->lang->colon . $this->view->story->title; $this->view->position[] = $this->lang->story->edit; $this->view->story = $story; $this->view->users = $this->user->getPairs('nodeleted|pofirst', "$story->assignedTo,$story->openedBy,$story->closedBy"); + $this->view->product = $product; + $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($story->product); $this->display(); } @@ -336,7 +344,7 @@ class story extends control * @access public * @return void */ - public function batchEdit($productID = 0, $projectID = 0) + public function batchEdit($productID = 0, $projectID = 0, $branch = 0) { if($this->post->titles) { @@ -365,9 +373,9 @@ class story extends control /* The stories of a product. */ if($productID) { - $this->product->setMenu($this->product->getPairs('nodeleted'), $productID); + $this->product->setMenu($this->product->getPairs('nodeleted'), $productID, $branch); $product = $this->product->getByID($productID); - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name); + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name); $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit; } @@ -399,8 +407,8 @@ class story extends control $this->loadModel('productplan'); foreach($stories as $story) { - $moduleOptionMenus[$story->product] = $this->tree->getOptionMenu($story->product, $viewType = 'story'); - $productPlans[$story->product] = $this->productplan->getPairs($story->product); + $moduleOptionMenus[$story->product] = $this->tree->getOptionMenu($story->product, $viewType = 'story', 0, $branch); + $productPlans[$story->product] = $this->productplan->getPairs($story->product, $branch); } /* Judge whether the editedStories is too large and set session. */ @@ -507,7 +515,7 @@ class story extends control if(!$story) die(js::error($this->lang->notFound) . js::locate('back')); $story->files = $this->loadModel('file')->getByObject('story', $storyID); - $product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id')->fetch(); + $product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id, type')->fetch(); $plan = $this->dao->findById($story->plan)->from(TABLE_PRODUCTPLAN)->fetch('title'); $bugs = $this->dao->select('id,title')->from(TABLE_BUG)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll(); $fromBug = $this->dao->select('id,title')->from(TABLE_BUG)->where('toStory')->eq($storyID)->fetch(); @@ -525,13 +533,14 @@ class story extends control } $title = "STORY #$story->id $story->title - $product->name"; - $position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name); + $position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name); $position[] = $this->lang->story->common; $position[] = $this->lang->story->view; $this->view->title = $title; $this->view->position = $position; $this->view->product = $product; + $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id); $this->view->plan = $plan; $this->view->bugs = $bugs; $this->view->fromBug = $fromBug; @@ -607,7 +616,7 @@ class story extends control if($story->status == 'changed') unset($this->lang->story->reviewResultList['reject']); $this->view->title = $this->lang->story->review . "STORY" . $this->lang->colon . $story->title; - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name); + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name); $this->view->position[] = $this->lang->story->common; $this->view->position[] = $this->lang->story->review; @@ -675,7 +684,7 @@ class story extends control if($story->status == 'draft') unset($this->lang->story->reasonList['cancel']); $this->view->title = $this->lang->story->close . "STORY" . $this->lang->colon . $story->title; - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name); + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name); $this->view->position[] = $this->lang->story->common; $this->view->position[] = $this->lang->story->close; @@ -911,7 +920,7 @@ class story extends control * @access public * @return void */ - public function ajaxGetProductStories($productID, $moduleID = 0, $storyID = 0, $onlyOption = 'false', $status = '', $limit = 0) + public function ajaxGetProductStories($productID, $branch = 0, $moduleID = 0, $storyID = 0, $onlyOption = 'false', $status = '', $limit = 0) { if($moduleID) { @@ -927,7 +936,7 @@ class story extends control $storyStatus = array_keys($storyStatus); } - $stories = $this->story->getProductStoryPairs($productID, $moduleID, $storyStatus, 'id_desc', $limit); + $stories = $this->story->getProductStoryPairs($productID, $branch, $moduleID, $storyStatus, 'id_desc', $limit); $select = html::select('story', empty($stories) ? array('' => '') : $stories, $storyID, "class='form-control'"); /* If only need options, remove select wrap. */ @@ -947,7 +956,7 @@ class story extends control * @access public * @return void */ - public function ajaxSearchProductStories($key, $productID, $moduleID = 0, $storyID = 0, $status = 'noclosed', $limit = 50) + public function ajaxSearchProductStories($key, $productID, $branch = 0, $moduleID = 0, $storyID = 0, $status = 'noclosed', $limit = 50) { if($moduleID) { @@ -963,7 +972,7 @@ class story extends control $storyStatus = array_keys($storyStatus); } - $stories = $this->story->getProductStoryPairs($productID, $moduleID, $storyStatus, 'id_desc'); + $stories = $this->story->getProductStoryPairs($productID, $branch, $moduleID, $storyStatus, 'id_desc'); $result = array(); $i = 0; foreach ($stories as $id => $story) diff --git a/module/story/css/create.css b/module/story/css/create.css index 73c283b6c5..03216bd698 100644 --- a/module/story/css/create.css +++ b/module/story/css/create.css @@ -1,6 +1,7 @@ #mailto {width:90.3%} select {border:1px solid #ccc} #module_chosen.chosen-container .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important} +#branch_chosen.chosen-container .chosen-choices{width:100px;} .row .col-sm-8{width:76%} .row .col-sm-2{padding-left:0px; padding-right:0px; width:12%} diff --git a/module/story/js/view.js b/module/story/js/view.js index c7329b89bb..180672d6e5 100644 --- a/module/story/js/view.js +++ b/module/story/js/view.js @@ -2,7 +2,7 @@ $(function() { if(canCreate) { - link = createLink('story', 'create', 'productID=' + productID + '&moduleID=' + moduleID); + link = createLink('story', 'create', 'productID=' + productID + "&branch=" + branch + '&moduleID=' + moduleID); $('#modulemenu ul.nav li.right:first').before("|||||||
| story->product;?> |
-
+
+
+ type != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?>
+
|
diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php
index c995045f2f..5e5874d9e1 100644
--- a/module/story/view/edit.html.php
+++ b/module/story/view/edit.html.php
@@ -55,7 +55,12 @@
| ||||||||||||