* Adjust the page of view for MR module.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
+131
-123
@@ -9,137 +9,145 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/form.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<!-- If this mr is deleted in GitLab, then show this part to user. -->
|
||||
<?php if(empty($rawMR) or !isset($rawMR->id)): ?>
|
||||
<div id='mainContent'>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->mr->notFound; ?></span>
|
||||
<?php echo html::a($this->createLink('mr', 'browse'), "<i class='icon icon-plus'></i> " . $lang->mr->browse, '', "class='btn btn-info'"); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php die; endif;?>
|
||||
|
||||
<?php include 'header.review.html.php';?>
|
||||
<?php if(!isonlybody()):?>
|
||||
<?php include '../../common/view/sortable.html.php';?>
|
||||
<?php include '../../common/view/tablesorter.html.php';?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<?php
|
||||
$backURI = $this->session->mrView ? $this->session->mrView : $this->session->mrList;
|
||||
if($backURI)
|
||||
{
|
||||
echo html::a($backURI, "<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "class='btn btn-link' data-app='{$app->tab}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html::backButton("<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "btn btn-link");
|
||||
}
|
||||
?>
|
||||
<div class="divider"></div>
|
||||
<?php common::printBack(inlink('browse'), 'btn btn-primary');?>
|
||||
<div class='divider'></div>
|
||||
<div class='page-title'>
|
||||
<span class='label label-id'><?php echo $MR->id;?></span>
|
||||
<span title='<?php echo $MR->title;?>' class='text'><?php echo $MR->title;?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class="repo panel">
|
||||
<div class='panel-heading'>
|
||||
<form method='post'>
|
||||
<div class='btn-group pull-right'>
|
||||
<?php echo html::commonButton($lang->repo->viewDiffList['inline'], "id='inline'", $arrange == 'inline' ? 'active btn btn-sm' : 'btn btn-sm')?>
|
||||
<?php echo html::commonButton($lang->repo->viewDiffList['appose'], "id='appose'", $arrange == 'appose' ? 'active btn btn-sm' : 'btn btn-sm')?>
|
||||
</div>
|
||||
<div class='btn-toolbar'>
|
||||
<div class='btn-group'>
|
||||
<div class='btn-group'>
|
||||
<?php echo html::commonButton(zget($lang->repo->encodingList, $encoding, $lang->repo->encoding) . "<span class='caret'></span>", "data-toggle='dropdown'", 'btn dropdown-toggle btn-sm')?>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
<?php foreach($lang->repo->encodingList as $key => $val):?>
|
||||
<li><?php echo html::a('javascript:changeEncoding("'. $key . '")', $val)?></li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='tabs' id='tabsNav'>
|
||||
<ul class='nav nav-tabs'>
|
||||
<li><?php echo html::a(inlink('view', "mr={$MR->id}"), $lang->mr->overview);?></li>
|
||||
<li class='active'><?php echo html::a('#', $lang->mr->viewDiff);?></li>
|
||||
<li><?php echo html::a(inlink('link', "mr={$MR->id}") . "#story", html::icon($lang->icons['story'], 'text-info') . ' ' . $lang->productplan->linkedStories);?></a></li>
|
||||
<li><?php echo html::a(inlink('link', "mr={$MR->id}") . "#bugs", html::icon($lang->icons['bug'], 'text-info') . ' ' . $lang->productplan->linkedBugs);?></a></li>
|
||||
<li><?php echo html::a(inlink('link', "mr={$MR->id}") . "#tasks", html::icon($lang->icons['todo'], 'text-info') . ' ' . $lang->mr->linkedTasks);?></a></li>
|
||||
</ul>
|
||||
<div class='tab-content'>
|
||||
<?php include '../../common/view/form.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php /* If this mr is deleted in GitLab, then show this part to user. */?>
|
||||
<?php if(empty($rawMR) or !isset($rawMR->id)): ?>
|
||||
<div id='mainContent'>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->mr->notFound; ?></span>
|
||||
<?php echo html::a($this->createLink('mr', 'browse'), "<i class='icon icon-plus'></i> " . $lang->mr->browse, '', "class='btn btn-info'"); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php include 'header.review.html.php';?>
|
||||
<div class="repo panel">
|
||||
<div class='panel-heading'>
|
||||
<form method='post'>
|
||||
<div class='btn-group pull-right'>
|
||||
<?php echo html::commonButton($lang->repo->viewDiffList['inline'], "id='inline'", $arrange == 'inline' ? 'active btn btn-sm' : 'btn btn-sm')?>
|
||||
<?php echo html::commonButton($lang->repo->viewDiffList['appose'], "id='appose'", $arrange == 'appose' ? 'active btn btn-sm' : 'btn btn-sm')?>
|
||||
</div>
|
||||
<div class='btn-toolbar'>
|
||||
<div class='btn-group'>
|
||||
<div class='btn-group'>
|
||||
<?php echo html::commonButton(zget($lang->repo->encodingList, $encoding, $lang->repo->encoding) . "<span class='caret'></span>", "data-toggle='dropdown'", 'btn dropdown-toggle btn-sm')?>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
<?php foreach($lang->repo->encodingList as $key => $val):?>
|
||||
<li><?php echo html::a('javascript:changeEncoding("'. $key . '")', $val)?></li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo html::hidden('arrange', $arrange) . html::hidden('encoding', $encoding); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php foreach($diffs as $diffFile):?>
|
||||
<div class='repoCode'>
|
||||
<table class='table diff' id='diff'>
|
||||
<caption><?php echo $diffFile->fileName;?></caption>
|
||||
<?php if(empty($diffFile->contents)) continue;?>
|
||||
<?php foreach($diffFile->contents as $content):?>
|
||||
<?php
|
||||
$oldCurrentLine = $content->oldStartLine;
|
||||
$newCurrentLine = $content->newStartLine;
|
||||
?>
|
||||
<?php if(!in_array($oldCurrentLine, array('0', '1')) and !in_array($newCurrentLine, array('0', '1'))):?>
|
||||
<tr data-line='<?php echo $newCurrentLine ?>' class='empty'>
|
||||
<th class='w-num text-center'>...</th>
|
||||
<?php if($arrange == 'appose'):?>
|
||||
<td class='none code'></td>
|
||||
<?php endif;?>
|
||||
<th class='w-num text-center'>...</th>
|
||||
<td class='none code'></td>
|
||||
</tr>
|
||||
<?php endif?>
|
||||
<?php if($arrange == 'inline'):?>
|
||||
<?php foreach($content->lines as $line):?>
|
||||
<tr data-line='<?php echo $line->newlc ?>'>
|
||||
<th class='w-num text-right'><?php if($line->type != 'new') echo $line->oldlc?></th>
|
||||
<th class='w-num text-left'><?php if($line->type != 'old') echo $line->newlc?></th>
|
||||
<td class='line-<?php echo $line->type?> code'><?php
|
||||
echo $line->type == 'old' ? preg_replace('/^\-/', '–', $line->line) : ($line->type == 'new' ? $line->line : ' ' . $line->line);
|
||||
?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php else:?>
|
||||
<?php foreach($content->lines as $line):?>
|
||||
<tr data-line='<?php echo $line->newlc ?>'>
|
||||
<?php
|
||||
if($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;
|
||||
}
|
||||
?>
|
||||
<th class='w-num text-right'><?php echo $oldlc?></th>
|
||||
<td class='w-code line-<?php if($line->type != 'new')echo $line->type?> <?php if($line->type == 'custom') echo "line-old"?> code'><?php
|
||||
if(!isset($content->old[$oldlc])) $content->old[$oldlc] = '';
|
||||
if(!empty($oldlc)) echo $line->type != 'all' ? preg_replace('/^\-/', '–', $content->old[$oldlc]) : ' ' . $content->old[$oldlc];
|
||||
?></td>
|
||||
<th class='w-num text-right'><?php echo $newlc?></th>
|
||||
<td class='w-code line-<?php if($line->type != 'old') echo $line->type?> <?php if($line->type == 'custom') echo "line-new"?> code'><?php
|
||||
if(!isset($content->new[$newlc])) $content->new[$newlc] = '';
|
||||
if(!empty($newlc)) echo $line->type != 'all' ? $content->new[$newlc] : ' ' . $content->new[$newlc];
|
||||
?></td>
|
||||
<?php
|
||||
if(isset($content->old[$oldlc])) unset($content->old[$oldlc]);
|
||||
if(isset($content->new[$newlc])) unset($content->new[$newlc]);
|
||||
?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
</div>
|
||||
<?php endforeach?>
|
||||
</div>
|
||||
<?php echo html::hidden('arrange', $arrange) . html::hidden('encoding', $encoding); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php foreach($diffs as $diffFile):?>
|
||||
<div class='repoCode'>
|
||||
<table class='table diff' id='diff'>
|
||||
<caption><?php echo $diffFile->fileName;?></caption>
|
||||
<?php if(empty($diffFile->contents)) continue;?>
|
||||
<?php foreach($diffFile->contents as $content):?>
|
||||
<?php
|
||||
$oldCurrentLine = $content->oldStartLine;
|
||||
$newCurrentLine = $content->newStartLine;
|
||||
?>
|
||||
<?php if(!in_array($oldCurrentLine, array('0', '1')) and !in_array($newCurrentLine, array('0', '1'))):?>
|
||||
<tr data-line='<?php echo $newCurrentLine ?>' class='empty'>
|
||||
<th class='w-num text-center'>...</th>
|
||||
<?php if($arrange == 'appose'):?>
|
||||
<td class='none code'></td>
|
||||
<?php endif;?>
|
||||
<th class='w-num text-center'>...</th>
|
||||
<td class='none code'></td>
|
||||
</tr>
|
||||
<?php endif?>
|
||||
<?php if($arrange == 'inline'):?>
|
||||
<?php foreach($content->lines as $line):?>
|
||||
<tr data-line='<?php echo $line->newlc ?>'>
|
||||
<th class='w-num text-right'><?php if($line->type != 'new') echo $line->oldlc?></th>
|
||||
<th class='w-num text-left'><?php if($line->type != 'old') echo $line->newlc?></th>
|
||||
<td class='line-<?php echo $line->type?> code'><?php
|
||||
echo $line->type == 'old' ? preg_replace('/^\-/', '–', $line->line) : ($line->type == 'new' ? $line->line : ' ' . $line->line);
|
||||
?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php else:?>
|
||||
<?php foreach($content->lines as $line):?>
|
||||
<tr data-line='<?php echo $line->newlc ?>'>
|
||||
<?php
|
||||
if($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;
|
||||
}
|
||||
?>
|
||||
<th class='w-num text-right'><?php echo $oldlc?></th>
|
||||
<td class='w-code line-<?php if($line->type != 'new')echo $line->type?> <?php if($line->type == 'custom') echo "line-old"?> code'><?php
|
||||
if(!isset($content->old[$oldlc])) $content->old[$oldlc] = '';
|
||||
if(!empty($oldlc)) echo $line->type != 'all' ? preg_replace('/^\-/', '–', $content->old[$oldlc]) : ' ' . $content->old[$oldlc];
|
||||
?></td>
|
||||
<th class='w-num text-right'><?php echo $newlc?></th>
|
||||
<td class='w-code line-<?php if($line->type != 'old') echo $line->type?> <?php if($line->type == 'custom') echo "line-new"?> code'><?php
|
||||
if(!isset($content->new[$newlc])) $content->new[$newlc] = '';
|
||||
if(!empty($newlc)) echo $line->type != 'all' ? $content->new[$newlc] : ' ' . $content->new[$newlc];
|
||||
?></td>
|
||||
<?php
|
||||
if(isset($content->old[$oldlc])) unset($content->old[$oldlc]);
|
||||
if(isset($content->new[$newlc])) unset($content->new[$newlc]);
|
||||
?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php if(empty($diffs)) echo $lang->mr->noChanges;?>
|
||||
<form method="post" id="exchange" class="hidden">
|
||||
<input type="hidden" name="revision[]" value="<?php echo $oldRevision;?>"/>
|
||||
<input type="hidden" name="revision[]" value="<?php echo $newRevision;?>"/>
|
||||
</form>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach?>
|
||||
</div>
|
||||
<?php if(empty($diffs)) echo $lang->mr->noChanges;?>
|
||||
<form method="post" id="exchange" class="hidden">
|
||||
<input type="hidden" name="revision[]" value="<?php echo $oldRevision;?>"/>
|
||||
<input type="hidden" name="revision[]" value="<?php echo $newRevision;?>"/>
|
||||
</form>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='tabs' id='tabsNav'>
|
||||
<ul class='nav nav-tabs'>
|
||||
<li><?php echo html::a(inlink('view', "mr={$MR->id}"), $lang->mr->overview);?></li>
|
||||
<li><?php echo html::a(inlink('diff', "mr={$MR->id}"), $lang->mr->viewDiff);?></li>
|
||||
<li class='<?php if($type == 'story') echo 'active'?>'><a href='#stories' data-toggle='tab'><?php echo html::icon($lang->icons['story'], 'text-primary') . ' ' . $lang->productplan->linkedStories;?></a></li>
|
||||
<li class='<?php if($type == 'bug') echo 'active'?>'><a href='#bugs' data-toggle='tab'><?php echo html::icon($lang->icons['bug'], 'text-red') . ' ' . $lang->productplan->linkedBugs;?></a></li>
|
||||
<li class='<?php if($type == 'task') echo 'active'?>'><a href='#tasks' data-toggle='tab'><?php echo html::icon('todo', 'text-info') . ' ' . $lang->mr->linkedTasks;?></a></li>
|
||||
|
||||
Reference in New Issue
Block a user