From 08c61e75ed70917732e464cf30964da87fe6d230 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 23 Nov 2021 20:15:01 +0800 Subject: [PATCH] * Adjust the page of view for MR module. --- module/mr/control.php | 5 + module/mr/view/diff.html.php | 254 ++++++++++++++++++----------------- module/mr/view/link.html.php | 2 + 3 files changed, 138 insertions(+), 123 deletions(-) diff --git a/module/mr/control.php b/module/mr/control.php index 51d3323a37..facca41074 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -303,12 +303,17 @@ class mr extends control */ public function diff($MRID, $encoding= '') { + $this->app->loadLang('productplan'); + $this->app->loadLang('bug'); + $this->app->loadLang('task'); + $encoding = empty($encoding) ? 'utf-8' : $encoding; $encoding = strtolower(str_replace('_', '-', $encoding)); /* Revert $config->requestFix in $encoding. */ $MR = $this->mr->getByID($MRID); if(isset($MR->gitlabID)) $rawMR = $this->mr->apiGetSingleMR($MR->gitlabID, $MR->targetProject, $MR->mriid); $this->view->title = $this->lang->mr->viewDiff; + $this->view->MR = $MR; $this->view->rawMR = $rawMR; if(!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR)) return $this->display(); diff --git a/module/mr/view/diff.html.php b/module/mr/view/diff.html.php index cbc3adf06f..a01e1a269b 100644 --- a/module/mr/view/diff.html.php +++ b/module/mr/view/diff.html.php @@ -9,137 +9,145 @@ */ ?> - - - -id)): ?> -
-
-

- mr->notFound; ?> - createLink('mr', 'browse'), " " . $lang->mr->browse, '', "class='btn btn-info'"); ?> -

-
-
- - - - + + - -
-
-
-
- repo->viewDiffList['inline'], "id='inline'", $arrange == 'inline' ? 'active btn btn-sm' : 'btn btn-sm')?> - repo->viewDiffList['appose'], "id='appose'", $arrange == 'appose' ? 'active btn btn-sm' : 'btn btn-sm')?> -
-
-
-
- repo->encodingList, $encoding, $lang->repo->encoding) . "", "data-toggle='dropdown'", 'btn dropdown-toggle btn-sm')?> - +
+
+ +
+ + + + id)): ?> +
+
+

+ mr->notFound; ?> + createLink('mr', 'browse'), " " . $lang->mr->browse, '', "class='btn btn-info'"); ?> +

+ + +
+
+ +
+ repo->viewDiffList['inline'], "id='inline'", $arrange == 'inline' ? 'active btn btn-sm' : 'btn btn-sm')?> + repo->viewDiffList['appose'], "id='appose'", $arrange == 'appose' ? 'active btn btn-sm' : 'btn btn-sm')?> +
+
+
+
+ repo->encodingList, $encoding, $lang->repo->encoding) . "", "data-toggle='dropdown'", 'btn dropdown-toggle btn-sm')?> + +
+
+
+ + +
+ +
+ + + contents)) continue;?> + contents as $content):?> + oldStartLine; + $newCurrentLine = $content->newStartLine; + ?> + + + + + + + + + + + + lines as $line):?> + + + + + + + + lines as $line):?> + + type == 'old') + { + $oldlc = $line->oldlc; + $newlc = ''; + if(isset($content->new[$oldlc])) + { + $newlc = $line->oldlc; + $line->type = 'custom'; + } + } + else + { + $oldlc = $line->oldlc; + $newlc = $line->newlc; + if(!isset($content->new[$newlc])) continue; + } + ?> + + + + + old[$oldlc])) unset($content->old[$oldlc]); + if(isset($content->new[$newlc])) unset($content->new[$newlc]); + ?> + + + + +
fileName;?>
......
type != 'new') echo $line->oldlc?>type != 'old') echo $line->newlc?>type == 'old' ? preg_replace('/^\-/', '–', $line->line) : ($line->type == 'new' ? $line->line : ' ' . $line->line); + ?>
type?> type == 'custom') echo "line-old"?> code'>old[$oldlc])) $content->old[$oldlc] = ''; + if(!empty($oldlc)) echo $line->type != 'all' ? preg_replace('/^\-/', '–', $content->old[$oldlc]) : ' ' . $content->old[$oldlc]; + ?>type?> type == 'custom') echo "line-new"?> code'>new[$newlc])) $content->new[$newlc] = ''; + if(!empty($newlc)) echo $line->type != 'all' ? $content->new[$newlc] : ' ' . $content->new[$newlc]; + ?>
+
+
- - -
- -
- - - contents)) continue;?> - contents as $content):?> - oldStartLine; - $newCurrentLine = $content->newStartLine; - ?> - - - - - - - - - - - - lines as $line):?> - - - - - - - - lines as $line):?> - - type == 'old') - { - $oldlc = $line->oldlc; - $newlc = ''; - if(isset($content->new[$oldlc])) - { - $newlc = $line->oldlc; - $line->type = 'custom'; - } - } - else - { - $oldlc = $line->oldlc; - $newlc = $line->newlc; - if(!isset($content->new[$newlc])) continue; - } - ?> - - - - - old[$oldlc])) unset($content->old[$oldlc]); - if(isset($content->new[$newlc])) unset($content->new[$newlc]); - ?> - - + mr->noChanges;?> + + + + - -
fileName;?>
......
type != 'new') echo $line->oldlc?>type != 'old') echo $line->newlc?>type == 'old' ? preg_replace('/^\-/', '–', $line->line) : ($line->type == 'new' ? $line->line : ' ' . $line->line); - ?>
type?> type == 'custom') echo "line-old"?> code'>old[$oldlc])) $content->old[$oldlc] = ''; - if(!empty($oldlc)) echo $line->type != 'all' ? preg_replace('/^\-/', '–', $content->old[$oldlc]) : ' ' . $content->old[$oldlc]; - ?>type?> type == 'custom') echo "line-new"?> code'>new[$newlc])) $content->new[$newlc] = ''; - if(!empty($newlc)) echo $line->type != 'all' ? $content->new[$newlc] : ' ' . $content->new[$newlc]; - ?>
+
-
-mr->noChanges;?> - diff --git a/module/mr/view/link.html.php b/module/mr/view/link.html.php index 90a49078b2..b4a71c13c2 100644 --- a/module/mr/view/link.html.php +++ b/module/mr/view/link.html.php @@ -38,6 +38,8 @@