diff --git a/module/action/control.php b/module/action/control.php index 2df3d88288..ac9224fabe 100755 --- a/module/action/control.php +++ b/module/action/control.php @@ -175,7 +175,8 @@ class action extends control { $story = $this->loadModel('story')->getById($objectID); $executions = explode(',', $this->app->user->view->sprints); - if(!array_intersect(array_keys($story->executions), $executions)) return print(js::error($this->lang->error->accessDenied)); + $products = explode(',', $this->app->user->view->products); + if(!array_intersect(array_keys($story->executions), $executions) and !in_array($story->product, $products)) return print(js::error($this->lang->error->accessDenied)); } $actionID = $this->action->create($objectType, $objectID, 'Commented', $this->post->comment); diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 0929eaccff..f0027aabb1 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -128,7 +128,7 @@ $lang->my->dividerMenu = ',work,dynamic,'; /* Program menu. */ $lang->program->homeMenu = new stdclass(); -$lang->program->homeMenu->browse = array('link' => "{$lang->program->list}|program|browse|", 'alias' => 'create,edit'); +$lang->program->homeMenu->browse = array('link' => "{$lang->program->list}|program|browse|", 'alias' => 'create,edit', 'subModule' => 'project'); $lang->program->homeMenu->kanban = array('link' => "{$lang->program->kanban}|program|kanban|"); $lang->program->menu = new stdclass(); diff --git a/module/common/model.php b/module/common/model.php index b3ef19aac3..97f1010422 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -450,7 +450,7 @@ class commonModel extends model echo '
  • ' . html::a(helper::createLink('tutorial', 'start'), " " . $lang->tutorialAB, '', "class='iframe' data-class-name='modal-inverse' data-width='800' data-headerless='true' data-backdrop='true' data-keyboard='true'") . '
  • '; } - echo '
  • ' . html::a(helper::createLink('my', 'preference', '', '', true), " " . $lang->preference, '', "class='iframe' data-width='700'") . '
  • '; + echo '
  • ' . html::a(helper::createLink('my', 'preference', 'showTip=false', '', true), " " . $lang->preference, '', "class='iframe' data-width='700'") . '
  • '; } if(common::hasPriv('my', 'changePassword')) echo '
  • ' . html::a(helper::createLink('my', 'changepassword', '', '', true), " " . $lang->changePassword, '', "class='iframe' data-width='600'") . '
  • '; @@ -664,7 +664,12 @@ class commonModel extends model $params = "productID=$productID&branch=&moduleID=0&from=¶m=0&storyID=0&extras=from=global"; break; case 'execution': - $params = "projectID=&executionID=0©ExecutionID=0&planID=0&confirm=no&productID=0&extra=from=global"; + $projectID = 0; + if(in_array($app->tab, array('project', 'execution')) and isset($lang->switcherMenu)) + { + $projectID = isset($_SESSION['project']) ? $_SESSION['project'] : 0; + } + $params = "projectID={$projectID}&executionID=0©ExecutionID=0&planID=0&confirm=no&productID=0&extra=from=global"; break; case 'product': $params = "programID=&extra=from=global"; diff --git a/module/doc/control.php b/module/doc/control.php index a8a29389c1..5ead3e25ec 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1109,6 +1109,7 @@ class doc extends control public function tableContents($type, $objectID = 0, $libID = 0) { list($libs, $libID, $object, $objectID) = $this->doc->setMenuByType($type, $objectID, $libID); + $this->session->set('createProjectLocate', $this->app->getURI(true), 'doc'); $libID = (int)$libID; diff --git a/module/execution/control.php b/module/execution/control.php index 27a71cf6e5..89b484c60e 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -679,7 +679,7 @@ class execution extends control * @access public * @return void */ - public function story($executionID = 0, $orderBy = 'order_desc', $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1) + public function story($executionID = 0, $orderBy = 'order_asc', $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1) { /* Load these models. */ $this->loadModel('story'); @@ -1626,6 +1626,7 @@ class execution extends control /* If the story of the product which linked the execution, you don't allow to remove the product. */ $unmodifiableProducts = array(); $unmodifiableBranches = array(); + $linkedStoryIDList = array(); foreach($linkedProducts as $productID => $linkedProduct) { if(!isset($allProducts[$productID])) $allProducts[$productID] = $linkedProduct->name; @@ -1639,6 +1640,7 @@ class execution extends control { array_push($unmodifiableProducts, $productID); array_push($unmodifiableBranches, $branchID); + $linkedStoryIDList[$productID][$branchID] = $executionStories[$productID][$branchID]->storyIDList; } } } @@ -1672,6 +1674,7 @@ class execution extends control $this->view->allProducts = $allProducts; $this->view->linkedProducts = $linkedProducts; $this->view->linkedBranches = $linkedBranches; + $this->view->linkedStoryIDList = $linkedStoryIDList; $this->view->branches = $branches; $this->view->unmodifiableProducts = $unmodifiableProducts; $this->view->unmodifiableBranches = $unmodifiableBranches; @@ -2655,6 +2658,7 @@ class execution extends control /* If the story of the product which linked the execution, you don't allow to remove the product. */ $unmodifiableProducts = array(); $unmodifiableBranches = array(); + $linkedStoryIDList = array(); foreach($linkedProducts as $productID => $linkedProduct) { $linkedBranches[$productID] = array(); @@ -2666,6 +2670,7 @@ class execution extends control { array_push($unmodifiableProducts, $productID); array_push($unmodifiableBranches, $branchID); + $linkedStoryIDList[$productID][$branchID] = $executionStories[$productID][$branchID]->storyIDList; } } } @@ -2679,6 +2684,7 @@ class execution extends control $this->view->unmodifiableProducts = $unmodifiableProducts; $this->view->unmodifiableBranches = $unmodifiableBranches; $this->view->linkedBranches = $linkedBranches; + $this->view->linkedStoryIDList = $linkedStoryIDList; $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($allProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'ignoreNormal|noclosed'); $this->view->allBranches = $this->execution->getBranchByProduct(array_keys($allProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'ignoreNormal'); @@ -3152,8 +3158,12 @@ class execution extends control */ public function tips($executionID) { - $this->view->execution = $this->execution->getById($executionID); + $execution = $this->execution->getById($executionID); + $projectID = $execution->project; + + $this->view->execution = $execution; $this->view->executionID = $executionID; + $this->view->projectID = $projectID; $this->display('execution', 'tips'); } diff --git a/module/execution/css/importtask.css b/module/execution/css/importtask.css index 942bf6c0f9..f05cfeace0 100644 --- a/module/execution/css/importtask.css +++ b/module/execution/css/importtask.css @@ -1,2 +1,2 @@ #fromproject_chosen .chosen-single {width: 220px;} -.c-name {width: 150px;} +.c-name {width: 200px;} diff --git a/module/execution/js/edit.js b/module/execution/js/edit.js index 276c362e01..7f0807e178 100644 --- a/module/execution/js/edit.js +++ b/module/execution/js/edit.js @@ -45,7 +45,9 @@ $(function() if(isExistedProduct != -1 && productType == 'normal') { $(this).prop('disabled', true).trigger("chosen:updated"); - $(this).siblings('div').find('span').attr('title', tip); + + var productTip = tip.replace('%s', linkedStoryIDList[$(this).attr('data-last')][0]); + $(this).siblings('div').find('span').attr('title', productTip); } }); @@ -55,11 +57,13 @@ $(function() if(isExistedBranch != -1) { var $product = $(this).closest('.has-branch').find("[name^='products']"); - if($.inArray($product.val(), unmodifiableProducts) != -1) + if($.inArray($product.val(), unmodifiableProducts) != -1 && linkedStoryIDList[$product.val()][$(this).attr('data-last')]) { $(this).prop('disabled', true).trigger("chosen:updated"); $product.prop('disabled', true).trigger("chosen:updated"); - $product.siblings('div').find('span').attr('title', tip); + + var productTip = tip.replace('%s', linkedStoryIDList[$product.val()][$(this).attr('data-last')]); + $product.siblings('div').find('span').attr('title', productTip); } } }); diff --git a/module/execution/js/story.js b/module/execution/js/story.js index cc62255f89..85903c09fb 100644 --- a/module/execution/js/story.js +++ b/module/execution/js/story.js @@ -10,7 +10,7 @@ $(function() $target.hide(); $target.fadeIn(1000); order = 'order_asc' - history.pushState({}, 0, createLink('project', 'story', "executionID=" + executionID + '&orderBy=' + order)); + history.pushState({}, 0, createLink('execution', 'story', "executionID=" + executionID + '&orderBy=' + order)); }); }); diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index 8236f40263..8bd05725fe 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -344,7 +344,7 @@ $lang->execution->confirmUnlinkStory = "After {$lang->SRCommon} is remo $lang->execution->confirmSync = "After modifying the project, in order to maintain the consistency of data, the data of products, requirements, teams and whitelist associated with the implementation will be synchronized to the new project. Please know."; $lang->execution->confirmUnlinkExecutionStory = "Do you want to unlink this Story from the execution?"; $lang->execution->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked to the {$lang->executionCommon} of the execution. Remove it from the {$lang->executionCommon}, then try again."; -$lang->execution->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action."; +$lang->execution->notAllowRemoveProducts = "The story %s of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action."; $lang->execution->errorNoLinkedProducts = "No {$lang->productCommon} is linked to {$lang->executionCommon}. You will be directed to {$lang->productCommon} page to link one."; $lang->execution->errorSameProducts = "{$lang->executionCommon} cannot be linked to the same {$lang->productCommon} twice."; $lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice"; @@ -358,7 +358,8 @@ $lang->execution->afterInfo = "{$lang->executionCommon} is cre $lang->execution->setTeam = 'Set Team'; $lang->execution->linkStory = 'Link Story'; $lang->execution->createTask = 'Create Task'; -$lang->execution->goback = "Go Back"; +$lang->execution->goback = "Go Back Task List"; +$lang->execution->gobackExecution = "Go Back Executioni List"; $lang->execution->noweekend = 'Exclude Weekend'; $lang->execution->nodelay = 'Exclude Delay Date'; $lang->execution->withweekend = 'Include Weekend'; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 80299ff188..ca0c943c14 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -344,7 +344,7 @@ $lang->execution->confirmUnlinkStory = "移除该{$lang->SRCommon}后 $lang->execution->confirmSync = "修改所属项目后,为了保持数据的一致性,该执行所关联的产品、需求、团队和白名单数据将会同步到新的项目中,请知悉。"; $lang->execution->confirmUnlinkExecutionStory = "您确定从该项目中移除该{$lang->SRCommon}吗?"; $lang->execution->notAllowedUnlinkStory = "该{$lang->SRCommon}已经与项目下{$lang->executionCommon}相关联,请从{$lang->executionCommon}中移除后再操作。"; -$lang->execution->notAllowRemoveProducts = "该{$lang->productCommon}中的{$lang->SRCommon}已与该{$lang->executionCommon}进行了关联,请取消关联后再操作。"; +$lang->execution->notAllowRemoveProducts = "该{$lang->productCommon}中的{$lang->SRCommon}%s已与该{$lang->executionCommon}进行了关联,请取消关联后再操作。"; $lang->execution->errorNoLinkedProducts = "该{$lang->executionCommon}没有关联的{$lang->productCommon},系统将转到{$lang->productCommon}关联页面"; $lang->execution->errorSameProducts = "{$lang->executionCommon}不能关联多个相同的{$lang->productCommon}。"; $lang->execution->errorSameBranches = "{$lang->executionCommon}不能关联多个相同的分支。"; @@ -359,6 +359,7 @@ $lang->execution->setTeam = '设置团队'; $lang->execution->linkStory = "关联{$lang->SRCommon}"; $lang->execution->createTask = '创建任务'; $lang->execution->goback = "返回任务列表"; +$lang->execution->gobackExecution = "返回迭代列表"; $lang->execution->noweekend = '去除周末'; $lang->execution->nodelay = '去除延期日期'; $lang->execution->withweekend = '显示周末'; diff --git a/module/execution/model.php b/module/execution/model.php index 689ec1dcfb..108f02118b 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1929,18 +1929,14 @@ class executionModel extends model */ public function getToImport($executionIds, $type) { - $executions = $this->dao->select('*')->from(TABLE_EXECUTION) - ->where('id')->in($executionIds) - ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi() - ->andWhere('type')->eq($type) - ->andWhere('deleted')->eq(0) - ->orderBy('id desc') - ->fetchAll('id'); - - $pairs = array(); - $now = date('Y-m-d'); - foreach($executions as $id => $execution) $pairs[$id] = $execution->name; - return $pairs; + return $this->dao->select('t1.id,concat_ws(" / ", t2.name, t1.name) as name')->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t2.id=t1.project') + ->where('t1.id')->in($executionIds) + ->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() + ->andWhere('t1.type')->eq($type) + ->andWhere('t1.deleted')->eq(0) + ->orderBy('t1.id desc') + ->fetchPairs('id', 'name'); } /** diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index 434c094f6c..92bcc82447 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -15,7 +15,7 @@ createLink('execution', 'task', "execution=$executionID");?> -