diff --git a/module/mr/control.php b/module/mr/control.php
index 40196a980d..548e5d9ad8 100644
--- a/module/mr/control.php
+++ b/module/mr/control.php
@@ -42,6 +42,14 @@ class mr extends control
/* Sync GitLab MR to ZenTao Database. */
$MRList = $this->mr->batchSyncMR($MRList);
+ /* Check whether Mr is linked with the product. */
+ $this->loadModel('gitlab');
+ foreach($MRList as $MR)
+ {
+ $products = $this->gitlab->getProductsByProjects(array($MR->targetProject, $MR->sourceProject));
+ $MR->linkButton = empty($products) ? false : true;
+ }
+
/* Load lang from compile module */
$this->app->loadLang('compile');
@@ -196,6 +204,15 @@ class mr extends control
$this->view->httpRepoURL = $sourceProject->http_url_to_repo;
$this->view->branchPath = $sourceProject->path_with_namespace . '-' . $rawMR->source_branch;
+ /* Get mr linked list. */
+ $this->app->loadLang('productplan');
+ $products = $this->loadModel('gitlab')->getProductsByProjects(array($MR->targetProject, $MR->sourceProject));
+ $product = $this->loadModel('product')->getById(array_shift($products));
+ $this->view->product = $product;
+ $this->view->stories = $this->mr->getLinkList($MR->id, $product->id, 'story');
+ $this->view->bugs = $this->mr->getLinkList($MR->id, $product->id, 'bug');
+ $this->view->tasks = $this->mr->getLinkList($MR->id, $product->id, 'task');
+
$this->display();
}
@@ -413,7 +430,7 @@ class mr extends control
$product = $this->loadModel('product')->getById(array_shift($products));
/* Load pager. */
- $this->app->loadClass('pager', $static = true);
+ $this->app->loadClass('pager', $static = true);
$storyPager = new pager(0, $recPerPage, $type == 'story' ? $pageID : 1);
$bugPager = new pager(0, $recPerPage, $type == 'bug' ? $pageID : 1);
$taskPager = new pager(0, $recPerPage, $type == 'task' ? $pageID : 1);
@@ -422,6 +439,7 @@ class mr extends control
$bugs = $this->mr->getLinkList($MRID, $product->id, 'bug', $orderBy, $bugPager);
$tasks = $this->mr->getLinkList($MRID, $product->id, 'task', $orderBy, $taskPager);
+ $this->view->title = $this->lang->mr->common . $this->lang->colon . $this->lang->mr->link;
$this->view->MR = $MR;
$this->view->canBeChanged = true;
$this->view->modulePairs = $this->loadModel('tree')->getOptionMenu($product->id, 'story');
@@ -500,7 +518,7 @@ class mr extends control
$MR = $this->mr->getByID($MRID);
$relatedStories = $this->mr->getCommitedLink($MR->gitlabID, $MR->targetProject, $MR->mriid, 'story');
- $linkedStories = $this->mr->getLinkList($MRID, $product->id, '', 'story');
+ $linkedStories = $this->mr->getLinkList($MRID, $product->id, 'story');
if($browseType == 'bySearch')
{
$allStories = $this->story->getBySearch($productID, 0, $queryID, 'id', '', 'story', array_keys($linkedStories), null);
@@ -578,7 +596,7 @@ class mr extends control
$MR = $this->mr->getByID($MRID);
$relatedBugs = $this->mr->getCommitedLink($MR->gitlabID, $MR->targetProject, $MR->mriid, 'bug');
- $linkedBugs = $this->mr->getLinkList($MRID, $product->id, '','bug');
+ $linkedBugs = $this->mr->getLinkList($MRID, $product->id, 'bug');
if($browseType == 'bySearch')
{
$allBugs = $this->bug->getBySearch($productID, 0, $queryID, 'id_desc', array_keys($linkedBugs), null);
@@ -641,7 +659,7 @@ class mr extends control
$MR = $this->mr->getByID($MRID);
$relatedTasks = $this->mr->getCommitedLink($MR->gitlabID, $MR->targetProject, $MR->mriid, 'task');
- $linkedTasks = $this->mr->getLinkList($MRID, $product->id, '','task');
+ $linkedTasks = $this->mr->getLinkList($MRID, $product->id, 'task');
/* Get executions by product. */
$productExecutions = $this->product->getExecutionPairsByProduct($productID);
diff --git a/module/mr/css/link.css b/module/mr/css/link.css
index 3a10e0993b..5cded22bcf 100644
--- a/module/mr/css/link.css
+++ b/module/mr/css/link.css
@@ -23,3 +23,4 @@ ol, ul {padding-left: 20px;}
#tabsNav .tab-pane>.main-table {border-radius: 0;}
.body-modal #mainMenu>.btn-toolbar {width: auto;}
.body-modal #mainContent {min-height: 240px;}
+.body-modal #mainMenu>.btn-toolbar .page-title>.text {overflow: visible}
\ No newline at end of file
diff --git a/module/mr/css/view.css b/module/mr/css/view.css
new file mode 100644
index 0000000000..68e960c22c
--- /dev/null
+++ b/module/mr/css/view.css
@@ -0,0 +1 @@
+#legendStories ul li, #legendBugs ul li, #legendTasks ul li {padding: 10px 0 0 12px; line-height: 20px;}
diff --git a/module/mr/model.php b/module/mr/model.php
index c5d4d23772..5cef8690fd 100644
--- a/module/mr/model.php
+++ b/module/mr/model.php
@@ -998,7 +998,7 @@ class mrModel extends model
* @access public
* @return array
*/
- public function getLinkList($MRID, $productID, $type, $orderBy, $pager = null)
+ public function getLinkList($MRID, $productID, $type, $orderBy = 'id_desc', $pager = null)
{
$linkIDs = $this->dao->select('BID')->from(TABLE_RELATION)
->where('product')->eq($productID)
diff --git a/module/mr/view/view.html.php b/module/mr/view/view.html.php
index e4dbf6cee1..fd68b5f027 100644
--- a/module/mr/view/view.html.php
+++ b/module/mr/view/view.html.php
@@ -120,6 +120,50 @@
+
+
+
+
+
+
+ $story)
+ {
+ echo "- " . html::a($this->createLink('story', 'view', "id=$id", '', true), "#$id $story->title", '', "class='iframe' data-width='80%'") . '
';
+ }
+ ?>
+ - createLink('mr', 'link', "MRID=$MR->id&type=story&orderBy=id_desc&link=true", '', true), $lang->productplan->linkStory, '', "class='btn btn-info iframe' data-width='95%' id='linkButton'"); ?>
+
+
+
+
+ $bug)
+ {
+ echo "- " . html::a($this->createLink('bug', 'view', "id=$id", '', true), "#$id $bug->title", '', "class='iframe' data-width='80%'") . '
';
+ }
+ ?>
+ - createLink('mr', 'link', "MRID=$MR->id&type=bug&orderBy=id_desc&link=true", '', true), $lang->productplan->linkBug, '', "class='btn btn-info iframe' data-width='95%' id='linkButton'"); ?>
+
+
+
+
+ $task)
+ {
+ echo "- " . html::a($this->createLink('task', 'view', "id=$id", '', true), "#$id $task->name", '', "class='iframe' data-width='80%'") . '
';
+ }
+ ?>
+ - createLink('mr', 'link', "MRID=$MR->id&type=task&orderBy=id_desc&link=true", '', true), $lang->mr->linkTask, '', "class='btn btn-info iframe' data-width='95%' id='linkButton'"); ?>
+
+
+
+
+