* marge from master.

This commit is contained in:
wangyidong
2020-02-07 10:58:58 +08:00
parent 00799f1f7b
commit 68b0fa26f3
26 changed files with 310 additions and 2403 deletions
+6 -6
View File
@@ -78,12 +78,12 @@ $lang->caselib->menuOrder = $lang->testcase->menuOrder;
$lang->testreport->menuOrder = $lang->testcase->menuOrder;
$lang->repo->menuOrder[5] = 'browse';
$lang->repo->menuOrder[10] = 'review';
$lang->repo->menuOrder[15] = 'maintain';
$lang->repo->menuOrder[20] = 'job';
$lang->repo->menuOrder[25] = 'jenkins';
$lang->repo->menuOrder[10] = 'maintain';
$lang->repo->menuOrder[15] = 'job';
$lang->repo->menuOrder[20] = 'jenkins';
$lang->ci->menuOrder = $lang->repo->menuOrder;
$lang->ci->menuOrder = $lang->repo->menuOrder;
$lang->jenkins->menuOrder = $lang->repo->menuOrder;
/* doc menu order. */
$lang->doc->menuOrder[5] = 'list';
@@ -151,4 +151,4 @@ $lang->mail->menuOrder = $lang->admin->menuOrder;
$lang->dev->menuOrder = $lang->admin->menuOrder;
$lang->entry->menuOrder = $lang->admin->menuOrder;
$lang->webhook->menuOrder = $lang->admin->menuOrder;
$lang->ci->menuOrder = $lang->admin->menuOrder;
$lang->ci->menuOrder = $lang->admin->menuOrder;
-1
View File
@@ -335,7 +335,6 @@ $lang->caselib->menu->caselib = array('link' => '用例库|caselib|browse|libI
$lang->repo = new stdclass();
$lang->repo->menu = new stdclass();
$lang->repo->menu->browse = array('link' =>'浏览|repo|browse|repoID=%s', 'alias' => 'diff,view,revision,log,blame,showsynccomment');
$lang->repo->menu->review = array('link' =>'评审|repo|review|repoID=%s', 'alias' => '');
$lang->repo->menu->maintain = array('link' =>'版本库|repo|maintain', 'alias' => 'create,edit');
$lang->repo->menu->job = array('link' =>'构建|ci|browsejob', 'alias' => 'createjob,editjob,browsebuild,viewbuildlogs');
$lang->repo->menu->jenkins = array('link' =>'Jenkins|jenkins|browse', 'alias' => 'create,edit');
+4 -2
View File
@@ -28,8 +28,10 @@ $config->repo->images = '|png|gif|jpg|ico|jpeg|bmp|';
$config->repo->binary = '|pdf|';
$config->repo->editor = new stdclass();
$config->repo->editor->view = array('id' => 'commentText', 'tools' => 'simpleTools');
$config->repo->editor->diff = array('id' => 'commentText', 'tools' => 'simpleTools');
$config->repo->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->repo->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
$config->repo->editor->view = array('id' => 'commentText', 'tools' => 'simpleTools');
$config->repo->editor->diff = array('id' => 'commentText', 'tools' => 'simpleTools');
$config->repo->create = new stdclass();
$config->repo->create->requiredFields = 'SCM,name,path,encoding,client';
+35 -397
View File
@@ -29,9 +29,7 @@ class repo extends control
$this->scm = $this->app->loadClass('scm');
$this->repos = $this->repo->getRepoPairs();
if(common::hasPriv('repo', 'create') and strpos(',maintain,', $this->methodName) > -1) {
$this->lang->modulePageActions = html::a(helper::createLink('repo', 'create'), "<i class='icon icon-plus text-muted'></i> " . $this->lang->repo->create, '', "class='btn'");
}
if(common::hasPriv('repo', 'create')) $this->lang->modulePageActions = html::a(helper::createLink('repo', 'create'), "<i class='icon icon-plus'></i> " . $this->lang->repo->create, '', "class='btn btn-primary'");
if(empty($this->repos) and $this->methodName != 'create') die(js::locate($this->repo->createLink('create')));
/* Unlock session for wait to get data of repo. */
@@ -137,112 +135,27 @@ class repo extends control
}
/**
* Delete a repo.
*
* @param int $id
* @access public
* @return void
*/
public function delete($id)
{
$this->repo->delete(TABLE_REPO, $id);
$this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($id)->exec();
$this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($id)->exec();
$this->dao->delete()->from(TABLE_REPOBRANCH)->where('repo')->eq($id)->exec();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success'));
}
/**
* View repo content.
* Delete repo.
*
* @param int $repoID
* @param string $path
* @param string $revision
* @param int $refresh
* @param string $confirm
* @access public
* @return void
*/
public function browse($repoID = 0, $path = '', $revision = 'HEAD', $refresh = 0)
public function delete($repoID, $confirm = 'no')
{
if($this->get->path) $path = $this->get->path;
if(empty($refresh) and $this->cookie->repoRefresh) $refresh = $this->cookie->repoRefresh;
$this->repo->setMenu($this->repos, $repoID);
$this->repo->setBackSession('list', $withOtherModule = true);
if($repoID == 0) $repoID = $this->session->repoID;
$repo = $this->repo->getRepoByID($repoID);
if(!$repo->synced) $this->locate($this->repo->createLink('showSyncComment', "repoID=$repoID"));
$path = $this->repo->decodePath($path);
$cacheFile = $this->repo->getCacheFile($repoID, $path, $revision);
$this->scm->setEngine($repo);
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 8, 1);
/* Cache infos. */
if($refresh or !$cacheFile or !file_exists($cacheFile) or (time() - filemtime($cacheFile)) / 60 > $this->config->repo->cacheTime)
if($confirm == 'no')
{
$infos = $this->scm->ls($path, $revision);
if($infos and $repo->SCM == 'Subversion')
{
$revisionList = array();
foreach($infos as $info) $revisionList[$info->revision] = $info->revision;
$comments = $this->repo->getHistory($repoID, $revisionList);
foreach($infos as $info)
{
if(isset($comments[$info->revision]))
{
$comment = $comments[$info->revision];
$info->comment = $comment->comment;
}
}
}
if($cacheFile)
{
if(!file_exists($cacheFile . '.lock'))
{
touch($cacheFile . '.lock');
file_put_contents($cacheFile, serialize($infos));
unlink($cacheFile . '.lock');
}
}
die(js::confirm($this->lang->repo->notice->delete, $this->repo->createLink('delete', "repoID=$repoID&confirm=yes")));
}
else
{
$infos = unserialize(file_get_contents($cacheFile));
}
if($refresh) $this->repo->updateLatestCommit($repo);
if($this->cookie->repoRefresh) setcookie('repoRefresh', 0, 0, $this->config->webRoot);
$logType = 'dir';
$revisions = $this->repo->getLogs($repo, $path, $revision, $logType, $pager);
$commiters = $this->loadModel('user')->getCommiters();
foreach($infos as $info) $info->committer = zget($commiters, $info->account, $info->account);
foreach($revisions as $log) $log->committer = zget($commiters, $log->committer, $log->committer);
$this->dao->delete()->from(TABLE_REPO)->where('id')->eq($repoID)->exec();
$this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->exec();
$this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($repoID)->exec();
$this->dao->delete()->from(TABLE_REPOBRANCH)->where('repo')->eq($repoID)->exec();
$this->view->title = $this->lang->repo->common;
$this->view->repo = $repo;
$this->view->revisions = $revisions;
$this->view->revision = $revision;
$this->view->infos = $infos;
$this->view->repoID = $repoID;
$this->view->pager = $pager;
$this->view->path = urldecode($path);
$this->view->logType = $logType;
$this->view->cacheTime = date('m-d H:i', filemtime($cacheFile));
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->view;
$this->view->position[] = $this->lang->repo->common;
$this->view->position[] = $this->lang->repo->view;
$this->display();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success'));
}
/**
@@ -332,8 +245,22 @@ class repo extends control
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->view;
$this->view->position[] = $this->lang->repo->common;
$this->view->position[] = $this->lang->repo->view;
}
$this->display();
/**
* Browse repo.
*
* @param int $repoID
* @param string $path
* @param string $revision
* @param int $refresh
* @access public
* @return void
*/
public function browse($repoID = 0, $path = '', $revision = 'HEAD', $refresh = 0)
{
if($this->get->path) $path = $this->get->path;
$this->locate($this->repo->createLink('log', "repoID=$repoID&entry=&revision=$revision", empty($path) ? '' : "entry=$path"));
}
/**
@@ -349,7 +276,7 @@ class repo extends control
* @access public
* @return void
*/
public function log($repoID, $entry, $revision = 'HEAD', $type = 'dir', $recTotal = 0, $recPerPage = 50, $pageID = 1)
public function log($repoID = 0, $entry = '', $revision = 'HEAD', $type = 'dir', $recTotal = 0, $recPerPage = 50, $pageID = 1)
{
if($this->get->entry) $entry = $this->get->entry;
$this->repo->setMenu($this->repos, $repoID);
@@ -380,61 +307,6 @@ class repo extends control
$this->view->file = urldecode($file);
$this->view->pager = $pager;
$this->view->info = $info;
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->allLog;
$this->view->position[] = $this->lang->repo->common;
$this->view->position[] = $this->lang->repo->allLog;
$this->display();
}
/**
* Blame repo file.
*
* @param int $repoID
* @param string $entry
* @param string $revision
* @param string $encoding
* @access public
* @return void
*/
public function blame($repoID, $entry, $revision = 'HEAD', $encoding = '')
{
if($this->get->entry) $entry = $this->get->entry;
$this->repo->setMenu($this->repos, $repoID);
if($repoID == 0) $repoID = $this->session->repoID;
$repo = $this->repo->getRepoByID($repoID);
$file = $entry;
$entry = $this->repo->decodePath($entry);
$this->scm->setEngine($repo);
$encoding = empty($encoding) ? $repo->encoding : $encoding;
$encoding = strtolower(str_replace('_', '-', $encoding));
$blames = $this->scm->blame($entry, $revision);
$revisions = array();
foreach($blames as $i => $blame)
{
if(isset($blame['revision'])) $revisions[$blame['revision']] = $blame['revision'];
if($encoding != 'utf-8') $blames[$i]['content'] = helper::convertEncoding($blame['content'], $encoding);
}
$log = $repo->SCM == 'Git' ? $this->dao->select('revision,commit')->from(TABLE_REPOHISTORY)->where('revision')->eq($revision)->andWhere('repo')->eq($repo->id)->fetch() : '';
$this->view->title = $this->lang->repo->common;
$this->view->repoID = $repoID;
$this->view->repo = $repo;
$this->view->revision = $revision;
$this->view->entry = $entry;
$this->view->file = $file;
$this->view->encoding = str_replace('-', '_', $encoding);
$this->view->historys = $repo->SCM == 'Git' ? $this->dao->select('revision,commit')->from(TABLE_REPOHISTORY)->where('revision')->in($revisions)->andWhere('repo')->eq($repo->id)->fetchPairs() : '';
$this->view->revisionName = ($log and $repo->SCM == 'Git') ? $this->repo->getGitRevisionName($log->revision, $log->commit) : $revision;
$this->view->blames = $blames;
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->blame;
$this->view->position[] = $this->lang->repo->common;
$this->view->position[] = $this->lang->repo->blame;
$this->display();
}
@@ -760,227 +632,6 @@ class repo extends control
echo $type == 'batch' ? $commitCount : 'finish';
}
/**
* addBug
*
* @param int $repoID
* @param string $file
* @param int $v1
* @param int $v2
* @access public
* @return void
*/
public function addBug($repoID, $file, $v1, $v2) {
if($this->get->file) $file = $this->get->file;
if(!empty($_POST))
{
$result = $this->repo->saveBug($repoID, $file, $v1, $v2);
if(dao::isError()) die(json_encode($result));
$bugID = $result['id'];
$repo = $this->repo->getRepoById($repoID);
$entry = $repo->name . '/' . $this->repo->decodePath($file);
$location = sprintf($this->lang->repo->reviewLocation, $entry, $repo->SCM == 'Git' ? substr($v2, 0, 10) : $v2, $this->post->begin, $this->post->end);
if(empty($v1))
{
$revision = $repo->SCM == 'Git' ? substr($v2, 0, 10) : $v2;
$link = $this->repo->createLink('view', "repoID=$repoID&entry=&revision=$v2&showBug=true", "entry={$file}") . '#L' . $this->post->begin;
}
else
{
$revision = $repo->SCM == 'Git' ? substr($v1, 0, 10) : $v1;
$revision .= ' : ';
$revision .= $repo->SCM == 'Git' ? substr($v2, 0, 10) : $v2;
$link = $this->repo->createLink('diff', "repoID=$repoID&entry=&oldRevision=$v1&newRevision=$v2&showBug=true", "entry={$file}") . '#L' . $this->post->begin;
}
$actionID = $this->loadModel('action')->create('bug', $bugID, 'repoCreated', '', html::a($link, $location, 'blank'));
$this->loadModel('bug')->sendmail($bugID, $actionID);
echo json_encode($result);
}
}
/**
* Add comment.
*
* @access public
* @return void
*/
public function addComment()
{
if(!empty($_POST))
{
$now = helper::now();
$bug = $this->loadModel('bug')->getByID($this->post->objectID);
$data = fixer::input('post')
->add('objectType', 'bug')
->add('product', ',' . $bug->product . ',')
->add('project', $bug->project)
->add('actor', $this->app->user->account)
->add('action', 'commented')
->add('date', $now)
->get();
$this->dao->insert(TABLE_ACTION)->data($data)->exec();
$actionID = $this->dao->lastInsertID();
$response = array('bugID' => $actionID, 'id' => $actionID, 'realname' => $this->app->user->realname, 'date' => substr($now, 5, 11), 'edit' => true, 'comment' => $data->comment);
echo json_encode($response);
}
}
/**
* Show review.
*
* @param int $repoID
* @param string $browseType
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function review($repoID, $browseType = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$browseType = strtolower($browseType);
$this->app->loadLang('bug');
$this->repo->setMenu($this->repos, $repoID);
$this->repo->setBackSession('list', $withOtherModule = true);
if($repoID == 0) $repoID = $this->session->repoID;
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$bugs = $this->repo->getBugsByRepo($repoID, $browseType, $orderBy, $pager);
$repo = $this->repo->getRepoById($repoID);
if($repo->SCM == 'Git')
{
$revisions = array();
foreach($bugs as $bug)
{
$revisions[] = $bug->v2;
if(!empty($bug->v1)) $revisions[] = $bug->v1;
}
$this->view->historys = $this->dao->select('revision,commit')->from(TABLE_REPOHISTORY)->where('revision')->in($revisions)->andWhere('repo')->eq($repoID)->fetchPairs('revision', 'commit');
}
$this->view->repoID = $repoID;
$this->view->repo = $repo;
$this->view->bugs = $bugs;
$this->view->pager = $pager;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->title = $this->lang->repo->review;
$this->view->browseType = $browseType;
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->review;
$this->view->position[] = $this->lang->repo->common;
$this->view->position[] = $this->lang->repo->review;
$this->display();
}
/**
* Edit bug.
*
* @param int $bugID
* @access public
* @return void
*/
public function editBug($bugID)
{
if(!empty($_POST))
{
$oldBug = $this->loadModel('bug')->getById($bugID);
$data = fixer::input('post')->get();
$data->commentText = $this->loadModel('file')->pasteImage($data->commentText);
$title = $data->commentText;
if($title and $title != $oldBug->title)
{
$this->repo->updateBug($bugID, $title);
$old = new stdclass();
$old->title = $oldBug->title;
$new = new stdclass();
$new->title = $title;
$changes = common::createChanges($old, $new);
$actionID = $this->loadModel('action')->create('bug', $bugID, 'Edited');
$this->action->logHistory($actionID, $changes);
}
echo $title;
}
}
/**
* Delete bug.
*
* @param int $bugID
* @param string $confirm
* @access public
* @return void
*/
public function deleteBug($bugID, $confirm = 'no')
{
if($confirm == 'yes')
{
$this->loadModel('bug')->delete(TABLE_BUG, $bugID);
echo 'deleted';
}
return false;
}
/**
* Edit comment.
*
* @param int $commentID
* @access public
* @return void
*/
public function editComment($commentID)
{
if(!empty($_POST))
{
$comment = $this->loadModel('file')->pasteImage($this->post->commentText);
$result = $this->repo->updateComment($commentID, $comment);
echo $comment;
}
}
/**
* Delete comment.
*
* @param int $commentID
* @param string $confirm
* @access public
* @return void
*/
public function deleteComment($commentID, $confirm = 'no')
{
if($confirm == 'yes')
{
$result = $this->repo->deleteComment($commentID);
if($result) echo 'deleted';
}
return false;
}
/**
* Ajax get projects.
*
* @param int $productID
* @param int $branch
* @access public
* @return void
*/
public function ajaxGetProjects($productID, $branch = 0)
{
$projects = $this->repo->getProjectPairs($productID, $branch);
echo html::select('project', array('' => '') + $projects, '', 'class="form-control chosen"');
}
/**
* Ajax show side logs.
*
@@ -1015,33 +666,20 @@ class repo extends control
}
/**
* Ajax get committer.
* Ajax sync latest commit.
*
* @param int $repoID
* @param string $entry
* @param int $revision
* @param int $line
* @access public
* @return void
*/
public function ajaxGetCommitter($repoID, $entry, $revision, $line)
public function ajaxSyncLatestCommit($repoID)
{
if($this->get->entry) $entry = $this->get->entry;
$repo = $this->repo->getRepoByID($repoID);
$entry = $this->repo->decodePath($entry);
$this->scm->setEngine($repo);
$blames = $this->scm->blame($entry, $revision);
$committer = '';
while($line > 0)
set_time_limit(0);
$repo = $this->repo->getRepoByID($repoID);
if((time() - strtotime($repo->lastSync)) / 60 >= $this->config->repo->syncTime)
{
if(isset($blames[$line]['committer']))
{
$committer = $blames[$line]['committer'];
break;
}
$line--;
$commits = $this->repo->updateLatestCommit($repo);
if($commits > 0) die('finished');
}
die($committer);
}
}
-11
View File
@@ -1,11 +0,0 @@
.panel.code > .content{border: 1px solid #ccc;}
.blame{font-size:13px;}
.blame thead{font-weight:bold; background:#ddd;}
.blame td{border-left:1px solid #ccc;}
.blame tr.topLine > td:first-child{border-left:none;}
.blame .info{ background-color:#f7f7f7; vertical-align:top; padding:0px 4px}
.topLine{border-top: 1px solid #ccc;}
.topLine td.info{padding:8px 4px;}
pre {margin-bottom:0px;display:block; white-space: pre-wrap; padding:0px 3px; border:0px; background:none;}
.line{ font-weight: bold; border: 1px solid #E4E4E4; background-color: #ECECEC; text-align: right;}
.panel-actions.pull-right{margin-top:-5px; }
-2
View File
@@ -1,2 +0,0 @@
#mainMenu > .btn-toolbar{height: 35px; line-height: 35px;}
.btn-toolbar > .last-sync-time{display:inline-block; float:left; margin-right: 10px;}
+4 -2
View File
@@ -76,11 +76,11 @@ h3 {font-size:16px;}
.repoCode tr.commented .comment-btn {display: block;}
.repoCode tr.commented .comment-btn .icon-wrapper {background: none; border: none; width: 24px; line-height: 18px; height: 18px; left: -6px; color: #4183c4}
.repoCode tr.commented .comment-btn .icon-wrapper:hover {border-color: #169; color: #169}
.repoCode tr.commented .comment-btn .icon-wrapper > i:before {content: '\e925'; font-size: 18px; transform: scale(-1, 1); display: inline-block;}
.repoCode tr.commented .comment-btn .icon-wrapper > i:before {content: '\e750'; font-size: 18px; transform: scale(-1, 1); display: inline-block;}
.repoCode tr.commented .comment-btn .icon-wrapper:before {display: none}
.repoCode tr.over.commented .comment-btn .icon-wrapper, .repoCode tr.selected.commented .comment-btn .icon-wrapper {line-height: 20px; height: 20px; background: #4183C4; color: #fff; left: -6px}
.repoCode tr.over.commented .comment-btn .icon-wrapper > i:before {content: "\e925"; font-size: 14px;}
.repoCode tr.over.commented .comment-btn .icon-wrapper > i:before {content: "\e661"; font-size: 14px;}
.repoCode tr.selected.commented .comment-btn .icon-wrapper > i:before {font-size: 14px;}
.repoCode tr.over.commented .comment-btn .icon-wrapper:before, .repoCode tr.selected.commented .comment-btn .icon-wrapper:before {display: block;}
@@ -177,3 +177,5 @@ h3 {font-size:16px;}
#sidebar>.sidebar-toggle{left:5px; right:auto;}
#sidebar>.sidebar-toggle>.icon{right:-4px; left:auto;}
#logForm .fixed-footer a.allLogs{color:#fff !important;}
+1
View File
@@ -0,0 +1 @@
#contentNav{display:none;}
-500
View File
@@ -1,503 +1,3 @@
$(document).ready(function()
{
$("#inline").click(function(){$('#arrange').val('inline');this.form.submit();});
$("#appose").click(function(){$('#arrange').val('appose');this.form.submit();});
$(".label-exchange").click(function(){ $('#exchange').submit();});
var $diffCode = $('.diff');
var hidePreview;
var $bugsPreview = $('#bugsPreview');
var $bugsPreviewMenu = $('#bugsPreview').children('.dropdown-menu');
var $rows = $diffCode.find('tr');
var rowTip = $('#rowTip').html();
var lastLine;
$rows.each(function()
{
var $row = $(this);
if(!$row.hasClass('empty'))
{
$row.children('th').first().prepend("<div class='comment-btn diff'><span class='icon-wrapper'><i class='icon-plus'></i></span></div>");
$row.children('td').first().append(rowTip);
}
if(lastLine && !$row.data('line'))
{
$row.attr('data-line', lastLine);
}
else
{
lastLine = $row.data('line');
}
}).hover(function()
{
var $this = $(this);
if($this.hasClass('empty')) return;
$this.addClass("over");
},
function()
{
$(this).removeClass("over");
});
var isInline = $.cookie('arrange') == 'inline';
var $bugFormRow = $('<tr class="action-row"><th></th>' + (isInline ? '<th></th><td class="action-cell"></td>' : '<td colspan="3" class="action-cell"></td>') + '</tr>');
var $bugForm = $('#bugForm');
var $commentCell = $('#commentCell');
var $bugPanel = $('#bugPanel');
// $bugForm.find('input[name="begin"], input[name="end"]').attr('max', lastLine);
$bugFormRow.find('td').append($bugForm.removeClass('hide'));
var highlight = function($e)
{
$('.highlight').removeClass('highlight');
$e.addClass('highlight');
};
var createComment = function(comment, $comments)
{
console.log();
var $comment = $commentCell.clone()
.removeClass('hide')
.attr('id', 'comment-' + comment.id)
.attr('data-comment', comment.id);
$comment.find('.realname').text(comment.realname);
$comment.find('.comment-content').text(comment.comment);
$comment.find('.date').text(comment.date);
$comment.find('.edit').toggle(comment.edit);
$comment.find('.comment-edit-form').attr('action', createLink('repo', 'editComment', 'commentID=' + comment.id));
if($comments)
{
if(typeof $comments !== 'object') $comments = $('#bug-' + $comments + ' .comments');
($comments.hasClass('comments') ? $comments : $comments.find('.comments')).append($comment);
}
return $comment;
};
var createBug = function(bug, line, $commentRow, show)
{
var commentCount, j;
var $bug = $bugPanel.clone().removeClass('hide').attr('id', 'bug-' + bug.id).attr('data-bug', bug.id);
$bug.find('.bugid').text(bug.id);
$bug.find('.realname').text(bug.realname);
$bug.find('.openedDate').text(bug.openedDate);
$bug.find('.title').text(bug.title);
$bug.find('.steps').toggle(bug.steps != '').html(bug.steps);
$bug.find('.edit').toggle(bug.edit);
$bug.find('.code-lines').text(bug.lines);
$bug.find('.delete').toggle(bug.delete);
$bug.find('input[name="objectID"]').val(bug.id);
$bug.find('.bug-edit-form').attr('action', createLink('repo', 'editBug', 'bugID=' + bug.id));
$bug.find('a.view-bug').attr('href', createLink('bug', 'view', "bugID=" + bug.id));
$bug.data('data', bug);
$bug.toggleClass('show', show > 1);
if(show > 2) highlight($bug);
if(bug.comments)
{
commentCount = bug.comments.length;
$bugComments = $bug.find('.comments');
for(j = 0; j < commentCount; j++)
{
createComment(bug.comments[j], $bugComments);
}
}
if(!line && bug.line) line = bug.line;
if(line)
{
if(!$commentRow)
{
var $row = $rows.filter('[data-line="' + line + '"]').last();
$commentRow = $row.next('tr');
if(!$commentRow.hasClass('comment-row'))
{
$commentRow = $('<tr class="comment-row"><th></th>' + (isInline ? '<th></th><td class="comment-cell"><div class="comment-list"></div></td>' : '<td colspan="3" class="comment-cell"><div class="comment-list"></div></td>') + '</tr>');
$row.addClass('commented').after($commentRow);
}
}
($commentRow.hasClass('comment-list') ? $commentRow : $commentRow.find('.comment-list')).append($bug);
if(show && $commentRow.hasClass('comment-row')) $commentRow.addClass('show');
}
return $bug;
};
var toggleComment = function($row, show)
{
var $commentRow;
if($row.hasClass('comment-row'))
{
$commentRow = $row;
$row = $commentRow.prev('tr');
if($row.hasClass('action-row'))
{
$row = $row.prev('tr');
}
}
else
{
$commentRow = $row.next('tr');
if($commentRow.hasClass('action-row'))
{
$commentRow = $commentRow.next('tr');
}
}
if(show === undefined)
{
show = !$row.hasClass('open');
}
if($row.hasClass('commented') && $commentRow.hasClass('comment-row'))
{
$commentRow.toggleClass('show', show);
$row.toggleClass('open', show);
}
};
$diffCode.on('click', '.comment-btn', function(e)
{
$rows.removeClass('selected');
var $row = $(this).closest('tr');
if($diffCode.hasClass('with-action-row') && $row.hasClass('with-action-row'))
{
$diffCode.removeClass('with-action-row');
}
else
{
$diffCode.addClass('with-action-row');
var line = $row.data('line');
if(!$row.hasClass('with-action-row'))
{
$rows.removeClass('with-action-row')
$row.addClass('with-action-row');
$bugForm.find('input[name="begin"]').val(line);
$bugForm.find('input[name="end"]').attr('min', line).val(line);
$bugForm.find('select#assignedTo').val(blamePairs[line]);
$bugForm.find('select#assignedTo').trigger("chosen:updated");
$row.after($bugFormRow);
KindEditor.remove('#commentText');
$('#commentText').kindeditor();
var getCommiterLink = createLink('repo', 'ajaxgetcommitter', 'repoID=' + repoID + "&entry=" + file + "&revision=" + revision + "&line=" + line);
var connector = getCommiterLink.indexOf('&') >= 0 ? '&' : '?';
getCommiterLink = getCommiterLink + connector + 'entry=' + file;
$.ajax({url: getCommiterLink}).done(function(responseText)
{
$bugForm.find('#assignedTo').val(responseText).trigger("chosen:updated");
});
}
highlight($bugForm);
$bugForm.find('input[name="title"]').focus();
$row.addClass('selected');
}
e.stopPropagation();
}).on('click', '.bugCancel', function()
{
$rows.removeClass('selected');
$diffCode.removeClass('with-action-row');
}).on('click', '.bugEdit', function(e)
{
var $panelBug = $(this).closest('.panel-bug');
if($panelBug.hasClass('show-edit-form'))
{
$panelBug.removeClass('show-edit-form');
e.stopPropagation();
return;
}
$panelBug.addClass('show show-edit-form').find('input[name="commentText"]').val($panelBug.find('.title').first().text()).focus();
e.stopPropagation();
return false;
}).on('submit', '.bug-edit-form', function()
{
var $form = $(this);
$(this).ajaxSubmit(
{
success:function(text)
{
var $bug = $form.closest('.panel-bug');
$bug.find('.title').text(text);
$bug.removeClass('show-edit-form');
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.commentText.value)
{
alert(contentError);
return false;
}
}
});
return false;
}).on('click', '.bugEditCancel', function()
{
$(this).closest('.panel-bug').removeClass('show-edit-form');
}).on('click', '.bugDelete', function(e)
{
var $bug = $(this).closest('.panel-bug');
if(!$bug.length) return;
if(confirm(confirmDelete))
{
var link = createLink('repo', 'deleteBug', 'bugID=' + $bug.data('bug') + '&confirm=yes');
$.get(link, function(data)
{
if(data == 'deleted')
{
var $commentRow = $bug.closest('.comment-row');
if($commentRow.find('.panel-bug').length === 1)
{
$commentRow.removeClass('show').prev('tr').removeClass('commented');
}
$bug.remove();
}
});
}
e.stopPropagation();
return false;
}).on('click', '.addComment', function()
{
$(this).closest('.panel-bug').addClass('show-form').find('.commentForm textarea').focus();
}).on('click', '.commentCancel', function()
{
$(this).closest('.panel-bug').removeClass('show-form');
}).on('submit', '.commentForm', function()
{
var $form = $(this);
$form.ajaxSubmit(
{
success:function(json)
{
var $panelBug = $form.closest('.panel-bug');
$form.find('textarea').val('');
$panelBug.removeClass('show-form');
createComment($.parseJSON(json), $panelBug.data('bug'));
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.comment.value)
{
alert(commentError);
return false;
}
}
});
return false;
}).on('click', '.commentEdit', function()
{
var $comment = $(this).closest('.comment');
if($comment.hasClass('show-form'))
{
$comment.removeClass('show-form');
return;
}
$comment.addClass('show-form').find('textarea').val($comment.find('.comment-content').text()).focus();
}).on('click', '.commentEditCancel', function()
{
$(this).closest('.comment').removeClass('show-form');
}).on('submit', '.comment-edit-form', function()
{
var $form = $(this);
$form.ajaxSubmit(
{
success:function(html)
{
var $comment = $form.closest('.comment');
$comment.find('.comment-content').html(html);
$comment.removeClass('show-form');
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.commentText.value)
{
alert(contentError);
return false;
}
}
});
return false;
}).on('click', '.commentDelete', function()
{
var $container = $(this).closest('.commentContainer');
if(!$container.length) return;
if(confirm(confirmDeleteComment))
{
var commentID = $container.data('comment');
var link = createLink('repo', 'deleteComment', 'commentID=' + commentID + '&confirm=yes');
$.get(link, function(data)
{
if(data == 'deleted')
{
var $commentRow = $container.closest('.comment-row');
if($commentRow.find('.bugContainer, .commentContainer').length === 1)
{
$commentRow.removeClass('show').prev('tr').removeClass('commented');
}
$container.remove();
}
});
}
return false;
}).on('click', 'tr.commented', function()
{
toggleComment($(this));
}).on('click', '.panel-bug > .panel-heading', function()
{
$(this).closest('.panel-bug').toggleClass('show');
}).on('mouseenter', 'tr.commented td .preview-icon', function(e)
{
var $cell = $(this).closest('td');
var $row = $cell.closest('tr');
var $commentRow = $row.next('tr');
var $bugs = $commentRow.find('.panel-bug'), line = '?';
$bugsPreviewMenu.children('li:not(.dropdown-header)').remove();
$bugsPreviewMenu.find('.bug-count').text($bugs.length);
$bugsPreviewMenu.find('.comment-count').text($commentRow.find('.comment').length);
$bugs.each(function()
{
var bug = $(this).data('data');
line = bug.line;
$bugsPreviewMenu.append('<li><a href="javascript:;" data-id="#bug-' + bug.id + '"><small class="text-muted">#' + bug.id + '</small> ' + bug.title + '</a></li>');
});
$bugsPreviewMenu.find('.code-line').text(line);
$bugsPreview.prependTo($cell);
clearTimeout(hidePreview);
$bugsPreviewMenu.css({top: 0-$bugsPreviewMenu.outerHeight(), left: Math.max(0, e.offsetX-$bugsPreviewMenu.outerWidth())}).addClass('show');
setTimeout(function(){$bugsPreviewMenu.addClass('in');}, 50);
}).on('mouseleave', 'tr.commented td', function()
{
$bugsPreviewMenu.removeClass('in');
hidePreview = setTimeout(function(){$bugsPreviewMenu.removeClass('show');}, 200);
});
$bugsPreviewMenu.on('click', 'li', function(e)
{
var $bug = $($(this).find('a').data('id'));
if($bug.length)
{
$bug.addClass('show');
toggleComment($bug.closest('tr.comment-row'), true);
highlight($bug);
$bugsPreviewMenu.removeClass('in');
hidePreview = setTimeout(function(){$bugsPreviewMenu.removeClass('show');}, 200);
}
e.stopPropagation();
});
$bugForm.submit(function()
{
$(this).ajaxSubmit(
{
success:function(json)
{
json = $.parseJSON(json);
if(json.result == 'fail')
{
alert(json.message);
return false;
}
createBug(json, null, null, 3);
$diffCode.removeClass('with-action-row');
$diffCode.find('tr.with-action-row.selected').removeClass('selected');
$bugForm.find('#title').val('');
KindEditor.html('#commentText', '');
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.product.value)
{
alert(productError);
return false;
}
if(!form.title.value)
{
alert(titleError);
$bugForm.find('input[name="title"]').focus();
return false;
}
}
});
return false;
}).on('change', 'input[name="begin"]', function()
{
var begin = $(this).val();
var $end = $bugForm.find('input[name="end"]').attr('min', begin);
if(parseInt($end.val()) < parseInt(begin))
{
$end.val(begin);
}
});
if(bugs)
{
var lineBugs, bugsCount, i;
for(var line in bugs)
{
if(line)
{
lineBugs = bugs[line];
bugsCount = lineBugs.length;
for(i = 0; i < bugsCount; i++)
{
createBug(lineBugs[i], line);
}
}
}
}
setTimeout(anchor, 200);
$(document).on('click', function()
{
$('.highlight').removeClass('highlight');
});
function anchor()
{
var hash = window.location.hash;
if(hash)
{
var line = hash.substr(1).replace('L', '');
var $row = $('.diff tr[data-line="' + line +'"]').first();
if($row.length)
{
var anchor = $row.offset().top;
$('body,html').animate({scrollTop:anchor - 50}, 500);
$row.addClass('highlight');
if($row.hasClass('commented'))
{
toggleComment($row, true);
var $commentRow = $row.next('tr');
if($commentRow.hasClass('comment-row'))
{
$commentRow.addClass('highlight');
}
}
}
}
}
});
function changeEncoding(encoding)
{
$('#encoding').val(encoding);
+36 -1
View File
@@ -1,4 +1,39 @@
$(document).ready(function()
{
processCheckbox();
$.get(createLink('repo', 'ajaxSyncLatestCommit', "repoID=" + repoID), function(data)
{
if(data == 'finished')
{
$('#logList').load(location.href + ' #logList', function()
{
$('#logList #logList thead').unwrap();
if($("input:checkbox[name='revision[]']:checked").length < 2)
{
$("input:checkbox[name='revision[]']:lt(2)").attr('checked', 'checked');
}
$("input:checkbox[name='revision[]']").each(function(){ if(!$(this).is(':checked')) $(this).attr("disabled","disabled")});
$("input:checkbox[name='revision[]']").click(function(){
var checkNum = $("input:checkbox[name='revision[]']:checked").length;
if (checkNum >= 2)
{
$("input:checkbox[name='revision[]']").each(function(){ if(!$(this).is(':checked')) $(this).attr("disabled","disabled")});
}
else
{
$("input:checkbox[name='revision[]']").each(function(){$(this).attr("disabled", false)});
}
});
processCheckbox();
});
}
});
});
function processCheckbox()
{
$("input:checkbox[name='revision[]']").each(function()
{
@@ -15,4 +50,4 @@ $(document).ready(function()
}
});
});
});
}
-4
View File
@@ -1,4 +0,0 @@
$(document).ready(function()
{
$('#' + browseType + 'Tab').addClass('btn-active-text');
});
+3 -474
View File
@@ -1,15 +1,8 @@
$(document).ready(function()
{
var $bugFormRow = $('<tr class="action-row"><th></th><td class="action-cell"></td></tr>');
var $bugForm = $('#bugForm');
$bugFormRow.find('td').append($bugForm.removeClass('hide'));
var $bugPanel = $('#bugPanel');
var $commentCell = $('#commentCell');
var $pre = $('.repoCode .content pre');
var $bugsPreview = $('#bugsPreview');
var hidePreview;
var $bugsPreviewMenu = $('#bugsPreview').children('.dropdown-menu');
var rowTip = $('#rowTip').html();
var rowTip = '';
if($('#rowTip').length > 0) rowTip = $('#rowTip').html();
if($pre.length)
{
@@ -20,472 +13,8 @@ $(document).ready(function()
for(var i = 0 ; i < arr.length ; i++)
{
line = i + 1;
code += "<tr data-line='" + line +"'><th id='L" + line + "'><div class='comment-btn view'><span class='icon-wrapper'><i class='icon-plus'></i></span></div>" + line + "</th><td>" + (arr[i] || '&nbsp;') + rowTip + "</td></tr>";
code += "<tr data-line='" + line +"'><th id='L" + line + "'><div class='comment-btn view'><span class='icon-wrapper'><i class='icon-plus'></i></span></div>" + line + "</th><td>" + (arr[i] || '&nbsp;') + rowTip + "</td></tr>";
}
$bugForm.find('input[name="begin"], input[name="end"]').attr('max', line);
$pre.html("<table><tbody>" + code + "</tbody></table>");
}
var $rows = $pre.find('tr');
var highlight = function($e)
{
$('.highlight').removeClass('highlight');
$e.addClass('highlight');
};
var createComment = function(comment, $comments)
{
var $comment = $commentCell.clone()
.removeClass('hide')
.attr('id', 'comment-' + comment.id)
.attr('data-comment', comment.id);
$comment.find('.realname').text(comment.realname);
$comment.find('.comment-content').text(comment.comment);
$comment.find('.date').text(comment.date);
$comment.find('.edit').toggle(comment.edit);
$comment.find('.comment-edit-form').attr('action', createLink('repo', 'editComment', 'commentID=' + comment.id));
if($comments)
{
if(typeof $comments !== 'object') $comments = $('#bug-' + $comments + ' .comments');
($comments.hasClass('comments') ? $comments : $comments.find('.comments')).append($comment);
}
return $comment;
};
var createBug = function(bug, line, $commentRow, show)
{
var commentCount, j;
var $bug = $bugPanel.clone().removeClass('hide').attr('id', 'bug-' + bug.id).attr('data-bug', bug.id);
$bug.find('.bugid').text(bug.id);
$bug.find('.realname').text(bug.realname);
$bug.find('.openedDate').text(bug.openedDate);
$bug.find('.title').text(bug.title);
$bug.find('.steps').toggle(bug.steps != '').html(bug.steps);
$bug.find('.edit').toggle(bug.edit);
$bug.find('.code-lines').text(bug.lines);
$bug.find('.delete').toggle(bug.delete);
$bug.find('input[name="objectID"]').val(bug.id);
$bug.find('.bug-edit-form').attr('action', createLink('repo', 'editBug', 'bugID=' + bug.id));
$bug.find('a.view-bug').attr('href', createLink('bug', 'view', "bugID=" + bug.id));
$bug.data('data', bug);
$bug.toggleClass('show', show > 1);
if(show > 2) highlight($bug);
if(bug.comments)
{
commentCount = bug.comments.length;
$bugComments = $bug.find('.comments');
for(j = 0; j < commentCount; j++)
{
createComment(bug.comments[j], $bugComments);
}
}
if(!line && bug.line) line = bug.line;
if(line)
{
var $row = $rows.filter('[data-line="' + line + '"]').first();
if(!$commentRow)
{
$commentRow = $row.next('tr');
if(!$commentRow.hasClass('comment-row'))
{
$commentRow = $('<tr class="comment-row"><th></th><td class="comment-cell"><div class="comment-list"></div></td></tr>');
$row.after($commentRow);
}
}
$row.addClass('commented');
($commentRow.hasClass('comment-list') ? $commentRow : $commentRow.find('.comment-list')).append($bug);
if(show && $commentRow.hasClass('comment-row')) $commentRow.addClass('show');
}
return $bug;
};
var toggleComment = function($row, show)
{
var $commentRow;
if($row.hasClass('comment-row'))
{
$commentRow = $row;
$row = $commentRow.prev('tr');
if($row.hasClass('action-row'))
{
$row = $row.prev('tr');
}
}
else
{
$commentRow = $row.next('tr');
if($commentRow.hasClass('action-row'))
{
$commentRow = $commentRow.next('tr');
}
}
if(show === undefined)
{
show = !$row.hasClass('open');
}
if($row.hasClass('commented') && $commentRow.hasClass('comment-row'))
{
$commentRow.toggleClass('show', show);
$row.toggleClass('open', show);
}
};
$rows.hover(function()
{
var $this = $(this);
$this.addClass("over");
},
function()
{
$(this).removeClass("over");
});
$pre.on('click', '.comment-btn', function(e)
{
$rows.removeClass('selected');
var $row = $(this).closest('tr');
if($pre.hasClass('with-action-row') && $row.hasClass('with-action-row'))
{
$pre.removeClass('with-action-row');
}
else
{
$pre.addClass('with-action-row');
var line = $row.data('line');
if(!$row.hasClass('with-action-row'))
{
$rows.removeClass('with-action-row')
$row.addClass('with-action-row');
$bugForm.find('input[name="begin"]').val(line);
$bugForm.find('input[name="end"]').attr('min', line).val(line);
$bugForm.find('select#assignedTo').val(blamePairs[line]);
$bugForm.find('select#assignedTo').trigger("chosen:updated");
var $nextRow = $row.next('tr');
($nextRow.hasClass('comment-row') ? $nextRow : $row).after($bugFormRow);
KindEditor.remove('#commentText');
$('#commentText').kindeditor();
var getCommiterLink = createLink('repo', 'ajaxgetcommitter', 'repoID=' + repoID + "&entry=&revision=" + revision + "&line=" + line);
var connector = getCommiterLink.indexOf('&') >= 0 ? '&' : '?';
getCommiterLink = getCommiterLink + connector + 'entry=' + file;
$.ajax({url: getCommiterLink}).done(function(responseText)
{
$bugForm.find('#assignedTo').val(responseText).trigger("chosen:updated");
});
}
$row.addClass('selected');
highlight($bugForm);
$bugForm.find('input[name="title"]').focus();
}
e.stopPropagation();
}).on('click', '.bugCancel', function()
{
$rows.removeClass('selected');
$pre.removeClass('with-action-row');
}).on('click', '.bugEdit', function(e)
{
var $panelBug = $(this).closest('.panel-bug');
if($panelBug.hasClass('show-edit-form'))
{
$panelBug.removeClass('show-edit-form');
e.stopPropagation();
return;
}
$panelBug.addClass('show show-edit-form').find('input[name="commentText"]').val($panelBug.find('.title').first().text()).focus();
e.stopPropagation();
return false;
}).on('submit', '.bug-edit-form', function()
{
var $form = $(this);
$(this).ajaxSubmit(
{
success:function(text)
{
var $bug = $form.closest('.panel-bug');
$bug.find('.title').text(text);
$bug.removeClass('show-edit-form');
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.commentText.value)
{
alert(contentError);
return false;
}
}
});
return false;
}).on('click', '.bugEditCancel', function()
{
$(this).closest('.panel-bug').removeClass('show-edit-form');
}).on('click', '.bugDelete', function(e)
{
var $bug = $(this).closest('.panel-bug');
if(!$bug.length) return;
if(confirm(confirmDelete))
{
var link = createLink('repo', 'deleteBug', 'bugID=' + $bug.data('bug') + '&confirm=yes');
$.get(link, function(data)
{
if(data == 'deleted')
{
var $commentRow = $bug.closest('.comment-row');
if($commentRow.find('.panel-bug').length === 1)
{
$commentRow.removeClass('show').prev('tr').removeClass('commented');
}
$bug.remove();
}
});
}
e.stopPropagation();
return false;
}).on('click', '.addComment', function()
{
$(this).closest('.panel-bug').addClass('show-form').find('.commentForm textarea').focus();
}).on('click', '.commentCancel', function()
{
$(this).closest('.panel-bug').removeClass('show-form');
}).on('submit', '.commentForm', function()
{
var $form = $(this);
$form.ajaxSubmit(
{
success:function(json)
{
var $panelBug = $form.closest('.panel-bug');
$form.find('textarea').val('');
$panelBug.removeClass('show-form');
createComment($.parseJSON(json), $panelBug.data('bug'));
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.comment.value)
{
alert(commentError);
return false;
}
}
});
return false;
}).on('click', '.commentEdit', function()
{
var $comment = $(this).closest('.comment');
if($comment.hasClass('show-form'))
{
$comment.removeClass('show-form');
return;
}
$comment.addClass('show-form').find('textarea').val($comment.find('.comment-content').text()).focus();
}).on('click', '.commentEditCancel', function()
{
$(this).closest('.comment').removeClass('show-form');
}).on('submit', '.comment-edit-form', function()
{
var $form = $(this);
$form.ajaxSubmit(
{
success:function(html)
{
var $comment = $form.closest('.comment');
$comment.find('.comment-content').html(html);
$comment.removeClass('show-form');
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.commentText.value)
{
alert(contentError);
return false;
}
}
});
return false;
}).on('click', '.commentDelete', function()
{
var $container = $(this).closest('.commentContainer');
if(!$container.length) return;
if(confirm(confirmDeleteComment))
{
var commentID = $container.data('comment');
var link = createLink('repo', 'deleteComment', 'commentID=' + commentID + '&confirm=yes');
$.get(link, function(data)
{
if(data == 'deleted')
{
var $commentRow = $container.closest('.comment-row');
if($commentRow.find('.bugContainer, .commentContainer').length === 1)
{
$commentRow.removeClass('show').prev('tr').removeClass('commented');
}
$container.remove();
}
});
}
return false;
}).on('click', 'tr.commented', function()
{
toggleComment($(this));
}).on('click', '.panel-bug > .panel-heading', function()
{
$(this).closest('.panel-bug').toggleClass('show');
}).on('mouseenter', 'tr.commented td .preview-icon', function(e)
{
var $cell = $(this).closest('td');
var $row = $cell.closest('tr');
var $commentRow = $row.next('tr');
var $bugs = $commentRow.find('.panel-bug'), line = '?';
$bugsPreviewMenu.children('li:not(.dropdown-header)').remove();
$bugsPreviewMenu.find('.bug-count').text($bugs.length);
$bugsPreviewMenu.find('.comment-count').text($commentRow.find('.comment').length);
$bugs.each(function()
{
var bug = $(this).data('data');
line = bug.line;
$bugsPreviewMenu.append('<li><a href="javascript:;" data-id="#bug-' + bug.id + '"><small class="text-muted">#' + bug.id + '</small> ' + bug.title + '</a></li>');
});
$bugsPreviewMenu.find('.code-line').text(line);
$bugsPreview.prependTo($cell);
clearTimeout(hidePreview);
$bugsPreviewMenu.css({top: 0-$bugsPreviewMenu.outerHeight(), left: Math.max(0, e.offsetX-$bugsPreviewMenu.outerWidth())}).addClass('show');
setTimeout(function(){$bugsPreviewMenu.addClass('in');}, 50);
}).on('mouseleave', 'tr.commented td', function()
{
$bugsPreviewMenu.removeClass('in');
hidePreview = setTimeout(function(){$bugsPreviewMenu.removeClass('show');}, 200);
});
$bugsPreviewMenu.on('click', 'li', function(e)
{
var $bug = $($(this).find('a').data('id'));
if($bug.length)
{
$bug.addClass('show');
toggleComment($bug.closest('tr.comment-row'), true);
highlight($bug);
$bugsPreviewMenu.removeClass('in');
hidePreview = setTimeout(function(){$bugsPreviewMenu.removeClass('show');}, 200);
}
e.stopPropagation();
});
$bugForm.submit(function()
{
$(this).ajaxSubmit(
{
success:function(json)
{
json = $.parseJSON(json);
if(json.result == 'fail')
{
alert(json.message);
return false;
}
createBug(json, null, null, 3);
$pre.removeClass('with-action-row');
$pre.find('tr.with-action-row.selected').removeClass('selected');
$bugForm.find('#title').val('');
KindEditor.html('#commentText', '');
},
beforeSubmit:function(formData, jqForm)
{
var form = jqForm[0];
if(!form.product.value)
{
alert(productError);
return false;
}
if(!form.title.value)
{
alert(titleError);
$bugForm.find('input[name="title"]').focus();
return false;
}
}
});
return false;
}).on('change', 'input[name="begin"]', function()
{
var begin = $(this).val();
var $end = $bugForm.find('input[name="end"]').attr('min', begin);
if(parseInt($end.val()) < parseInt(begin)) $end.val(begin);
$bugForm.find('select#assignedTo').val(blamePairs[begin]);
$bugForm.find('select#assignedTo').trigger("chosen:updated");
});
if(bugs)
{
var lineBugs, bugsCount, i;
for(var line in bugs)
{
if(line)
{
lineBugs = bugs[line];
bugsCount = lineBugs.length;
for(i = 0; i < bugsCount; i++)
{
createBug(lineBugs[i], line);
}
}
}
}
setTimeout(anchor, 200);
$(document).on('click', function()
{
$('.highlight').removeClass('highlight');
});
function anchor()
{
var hash = window.location.hash;
if(hash)
{
var $row = $(hash).closest('tr');
if($row.length)
{
var anchor = $row.offset().top;
$('body,html').animate({scrollTop:anchor - 50}, 500);
$row.addClass('highlight');
if($row.hasClass('commented'))
{
var $commentRow = $row.next('tr');
if($commentRow.hasClass('comment-row'))
{
toggleComment($row, true);
$commentRow.addClass('highlight').find('.panel-bug').first().addClass('show');
}
}
}
}
}
});
+3 -2
View File
@@ -1,5 +1,5 @@
<?php
$lang->repo->common = '版本库';
$lang->repo->common = '代码';
$lang->repo->browse = '浏览';
$lang->repo->viewRevision = '查看修订';
$lang->repo->create = '创建';
@@ -42,6 +42,7 @@ $lang->repo->name = '名称';
$lang->repo->path = '地址';
$lang->repo->prefix = '地址扩展';
$lang->repo->config = '配置目录';
$lang->repo->desc = '描述';
$lang->repo->account = '用户名';
$lang->repo->password = '密码';
$lang->repo->encoding = '编码';
@@ -106,8 +107,8 @@ $lang->repo->logStyles['D'] = '删除';
$lang->repo->encodingList['utf_8'] = 'UTF-8';
$lang->repo->encodingList['gbk'] = 'GBK';
$lang->repo->scmList['Git'] = 'Git';
$lang->repo->scmList['Subversion'] = 'Subversion';
$lang->repo->scmList['Git'] = 'Git';
$lang->repo->notice = new stdclass();
$lang->repo->notice->syncing = '正在同步中, 请稍等...';
+32 -228
View File
@@ -81,6 +81,8 @@ class repoModel extends model
$repoIndex .= "<div class='list-group'>";
foreach($branches as $branch)
{
if(empty($branch)) continue;
$class = $branchID == $branch ? "class='active'" : '';
$repoIndex .= html::a("javascript:switchBranch(\"$branch\")", $branch, '', $class);
}
@@ -176,7 +178,7 @@ class repoModel extends model
if($data->prefix) $data->prefix = '/' . $data->prefix;
}
$data->password = base64_encode($data->password);
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
$this->dao->insert(TABLE_REPO)->data($data)
->batchCheck($this->config->repo->create->requiredFields, 'notempty')
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
@@ -185,6 +187,24 @@ class repoModel extends model
return $this->dao->lastInsertID();
}
/**
* Get all repos.
*
* @access public
* @return array
*/
public function getAllRepos()
{
$repos = $this->dao->select('*')->from(TABLE_REPO)->where('deleted')->eq(0)->fetchAll();
foreach($repos as $i => $repo)
{
$repo->acl = json_decode($repo->acl);
if(!$this->checkPriv($repo)) unset($repos[$i]);
}
return $repos;
}
/**
* Update a repo.
*
@@ -232,7 +252,6 @@ class repoModel extends model
return true;
}
/**
* Get repo pairs.
*
@@ -265,7 +284,7 @@ class repoModel extends model
$repo = $this->dao->select('*')->from(TABLE_REPO)->where('id')->eq($repoID)->fetch();
if(!$repo) return false;
$repo->password = base64_decode($repo->password);
if($repo->encrypt == 'base64') $repo->password = base64_decode($repo->password);
$repo->acl = json_decode($repo->acl);
return $repo;
}
@@ -299,7 +318,6 @@ class repoModel extends model
{
$entry = ltrim($entry, '/');
$entry = $repo->prefix . (empty($entry) ? '' : '/' . $entry);
if((time() - strtotime($repo->lastSync)) / 60 >= $this->config->repo->syncTime) $this->updateLatestCommit($repo);
$repoID = $repo->id;
$revisionTime = $this->dao->select('time')->from(TABLE_REPOHISTORY)->alias('t1')
@@ -316,8 +334,12 @@ class repoModel extends model
{
$historyIdList = $this->dao->select('DISTINCT t2.id')->from(TABLE_REPOFILES)->alias('t1')
->leftJoin(TABLE_REPOHISTORY)->alias('t2')->on('t1.revision=t2.id')
->leftJoin(TABLE_REPOBRANCH)->alias('t3')->on('t2.id=t3.revision')
->where('1=1')
->andWhere('t1.repo')->eq($repo->id)
->andWhere('t2.`time`')->le($revisionTime)
->andWhere('left(t2.comment, 12)')->ne('Merge branch')
->beginIF($this->cookie->repoBranch)->andWhere('t3.branch')->eq($this->cookie->repoBranch)->fi()
->beginIF($type == 'dir')
->andWhere('t1.parent', true)->like(rtrim($entry, '/') . "/%")
->orWhere('t1.parent')->eq(rtrim($entry, '/'))
@@ -325,7 +347,7 @@ class repoModel extends model
->fi()
->beginIF($type == 'file')->andWhere('t1.path')->eq("$entry")->fi()
->orderBy('t2.`time` desc')
->page($pager)
->page($pager, 't2.id')
->fetchPairs('id', 'id');
}
@@ -408,115 +430,6 @@ class repoModel extends model
return $revisions;
}
/**
* Get history.
*
* @param int $repoID
* @param array $revisions
* @access public
* @return array
*/
public function getHistory($repoID, $revisions)
{
return $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
->where('t1.repo')->eq($repoID)
->andWhere('t1.revision')->in($revisions)
->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
->fetchAll('revision');
}
/**
* Get review.
*
* @param int $repoID
* @param string $entry
* @param string $revision
* @access public
* @return array
*/
public function getReview($repoID, $entry, $revision)
{
$reviews = array();
$bugs = $this->dao->select('t1.*, t2.realname')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')
->on('t1.openedBy = t2.account')
->where('t1.repo')->eq($repoID)
->andWhere('t1.entry')->eq($entry)
->andWhere('t1.v2')->eq($revision)
->andWhere('t1.deleted')->eq(0)
->fetchAll('id');
$comments = $this->dao->select('t1.*, t2.realname')->from(TABLE_ACTION)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')
->on('t1.actor = t2.account')
->where('t1.objectType')->eq('bug')
->andWhere('t1.objectID')->in(array_keys($bugs))
->andWhere('t1.action')->eq('commented')
->fetchGroup('objectID', 'id');
foreach($bugs as $bug)
{
if(common::hasPriv('bug', 'edit')) $bug->edit = true;
if(common::hasPriv('bug', 'delete')) $bug->delete = true;
$lines = explode(',', trim($bug->lines, ','));
$line = $lines[0];
$reviews[$line]['bugs'][$bug->id] = $bug;
if(isset($comments[$bug->id]))
{
foreach($comments[$bug->id] as $key => $comment)
{
if($comment->actor == $this->app->user->account) $comment->edit = true;
}
$reviews[$line]['comments'] = $comments;
}
}
return $reviews;
}
/**
* Get bugs by repo.
*
* @param int $repoID
* @param string $browseType
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getBugsByRepo($repoID, $browseType, $orderBy, $pager)
{
$bugs = $this->dao->select('*')->from(TABLE_BUG)
->where('repo')->eq($repoID)
->andWhere('deleted')->eq('0')
->beginIF($browseType == 'assigntome')->andWhere('assignedTo')->eq($this->app->user->account)->fi()
->beginIF($browseType == 'openedbyme')->andWhere('openedBy')->eq($this->app->user->account)->fi()
->beginIF($browseType == 'resolvedbyme')->andWhere('resolvedBy')->eq($this->app->user->account)->fi()
->beginIF($browseType == 'assigntonull')->andWhere('assignedTo')->eq('')->fi()
->beginIF($browseType == 'unresolved')->andWhere('resolvedBy')->eq('')->fi()
->beginIF($browseType == 'unclosed')->andWhere('status')->ne('closed')->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll();
return $bugs;
}
/**
* Get project pairs.
*
* @param int $product
* @param int $branch
* @access public
* @return array
*/
public function getProjectPairs($product, $branch = 0)
{
$pairs = array();
$projects = $this->loadModel('project')->getList('undone', 0, $product, $branch);
foreach($projects as $project) $pairs[$project->id] = $project->name;
return $pairs;
}
/**
* Get git revisionName.
*
@@ -584,49 +497,6 @@ class repoModel extends model
return $count;
}
/**
* Save bug.
*
* @param int $repoID
* @param string $file
* @param int $v1
* @param int $v2
* @access public
* @return array
*/
public function saveBug($repoID, $file, $v1, $v2)
{
$now = helper::now();
$data = fixer::input('post')
->add('severity', 3)
->add('openedBy', $this->app->user->account)
->add('openedDate', $now)
->add('openedBuild', 'trunk')
->add('assignedDate', $now)
->add('type', 'codeimprovement')
->add('repo', $repoID)
->add('entry', $file)
->add('lines', $this->post->begin . ',' . $this->post->end)
->add('v1', $v1)
->add('v2', $v2)
->remove('commentText,begin,end,uid')
->get();
$data->steps = $this->loadModel('file')->pasteImage($this->post->commentText, $this->post->uid);
$this->dao->insert(TABLE_BUG)->data($data)->exec();
if(!dao::isError())
{
$bugID = $this->dao->lastInsertID();
$this->file->updateObjectID($this->post->uid, $bugID, 'bug');
setcookie("repoPairs[$repoID]", $data->product);
return array('result' => 'success', 'id' => $bugID, 'realname' => $this->app->user->realname, 'openedDate' => substr($now, 5, 11), 'edit' => true, 'delete' => true, 'lines' => $data->lines, 'line' => $this->post->begin, 'steps' => $data->steps, 'title' => $data->title);
}
return array('result' => 'fail', 'message' => join("\n", dao::getError()));
}
/**
* Save exists log branch.
*
@@ -676,6 +546,7 @@ class repoModel extends model
$repoID = $repo->id;
$latestInDB = $this->getLatestComment($repoID);
$version = empty($latestInDB) ? 1 : $latestInDB->commit + 1;
$commits = 0;
$scm = $this->app->loadClass('scm');
$scm->setEngine($repo);
@@ -686,80 +557,13 @@ class repoModel extends model
$logs = $scm->getCommits($revision, $commitCount - $version + 1, $this->cookie->repoBranch);
$logs['commits'] = array_reverse($logs['commits'], true);
$commitCount = $this->saveCommit($repoID, $logs, $version, $this->cookie->repoBranch);
$commits = $this->saveCommit($repoID, $logs, $version, $this->cookie->repoBranch);
if($repo->SCM == 'Git' and empty($latestInDB)) $this->fixCommit($repo->id);
$this->updateCommitCount($repoID, $commitCount);
$this->updateCommitCount($repoID, $commits);
}
$this->dao->update(TABLE_REPO)->set('lastSync')->eq(helper::now())->where('id')->eq($repoID)->exec();
}
/**
* Update bug.
*
* @param int $bugID
* @param string $title
* @access public
* @return string
*/
public function updateBug($bugID, $title)
{
$this->dao->update(TABLE_BUG)->set('title')->eq($title)->where('id')->eq($bugID)->exec();
return $title;
}
/**
* Update comment.
*
* @param int $commentID
* @param string $comment
* @access public
* @return string
*/
public function updateComment($commentID, $comment)
{
$this->dao->update(TABLE_ACTION)->set('comment')->eq($comment)->where('id')->eq($commentID)->exec();
return $comment;
}
/**
* Delete comment.
*
* @param int $commentID
* @access public
* @return void
*/
public function deleteComment($commentID)
{
return $this->dao->delete()->from(TABLE_ACTION)->where('id')->eq($commentID)->exec();
}
/**
* Get cache file.
*
* @param int $repoID
* @param string $path
* @param int $revision
* @access public
* @return string
*/
public function getCacheFile($repoID, $path, $revision)
{
$cachePath = $this->app->getCacheRoot() . '/' . 'repo';
if(!is_dir($cachePath)) mkdir($cachePath, 0777, true);
if(!is_writable($cachePath)) return false;
return $cachePath . '/' . $repoID . '-' . md5("{$this->cookie->repoBranch}-$path-$revision");
}
/**
* Get last review info.
*
* @param string $entry
* @access public
* @return object
*/
public function getLastReviewInfo($entry)
{
return $this->dao->select('*')->from(TABLE_BUG)->where('entry')->eq($entry)->orderby('id_desc')->fetch();
return $commits;
}
/**
@@ -1062,7 +866,7 @@ class repoModel extends model
$stories = array();
$tasks = array();
$bugs = array();
$commonReg = "(?:\s){0,}((?:#|:|:){0,})([0-9, ]{1,})";
$commonReg = "(?:\s){0,}((?:#|:|£º){0,})([0-9, ]{1,})";
$taskReg = '/task' . $commonReg . '/i';
$storyReg = '/story' . $commonReg . '/i';
$bugReg = '/bug' . $commonReg . '/i';
+1 -1
View File
@@ -51,7 +51,7 @@ if(isset($entry)) $pathInfo .= '&type=file';
</table>
<div class='table-footer'>
<?php if(common::hasPriv('repo', 'diff')) echo html::submitButton($lang->repo->diff, '', count($revisions) < 2 ? 'disabled btn btn-primary' : 'btn btn-primary')?>
<?php echo html::a($this->repo->createLink('log', "repoID=$repoID&entry=&revision=HEAD&type=$logType", "entry=" . $this->repo->encodePath($path)), $lang->repo->allLog);?>
<?php echo html::a($this->repo->createLink('log', "repoID=$repoID&entry=&revision=HEAD&type=$logType", "entry=" . $this->repo->encodePath($path)), $lang->repo->allLog, '', "class='allLogs'");?>
<div class='pull-right'>
<div class='btn-group'>
<?php
-102
View File
@@ -1,102 +0,0 @@
<?php
/**
* The create view file of repo module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @author Wang Yidong, Zhu Jinyong
* @package repo
* @version $Id: blame.html.php $
*/
?>
<?php
include '../../common/view/header.html.php';
js::import($jsRoot . 'misc/highlight/highlight.pack.js');
css::import($jsRoot . 'misc/highlight/styles/github.css');
?>
<?php if(!isonlybody()):?>
<div id='mainMenu' class='clearfix'>
<div class="btn-toolbar pull-left">
<?php
$backURI = $this->session->repoView ? $this->session->repoView : $this->session->repoList;
if($backURI)
{
echo html::a($backURI, "<i class='icon icon-back icon-sm'></i>" . $lang->goback, '', "class='btn btn-link'");
}
else
{
echo html::backButton("<i class='icon icon-back icon-sm'></i>" . $lang->goback, '', 'btn btn-link');
}
?>
<div class="divider"></div>
<div class="page-title">
<strong>
<?php
echo html::a($this->repo->createLink('browse', "repoID=$repoID"), $repo->name);
$paths= explode('/', $entry);
$fileName = array_pop($paths);
$postPath = '';
foreach($paths as $pathName)
{
$postPath .= $pathName . '/';
echo '/' . ' ' . html::a($this->repo->createLink('browse', "repoID=$repoID", "path=" . $this->repo->encodePath($postPath)), trim($pathName, '/'));
}
echo '/' . ' ' . $fileName;
echo " <span class='label label-info'>" . $revisionName . '</span>';
?>
</strong>
</div>
</div>
</div>
<?php endif;?>
<div class="code panel">
<div class='panel-heading'>
<div class='panel-title'><?php echo $entry;?></div>
<?php $encodePath = $this->repo->encodePath($entry);?>
<div class='panel-actions'>
<div class='btn-group'>
<?php echo html::commonButton(zget($lang->repo->encodingList, $encoding, $lang->repo->encoding) . "<span class='caret'></span>", "id='encoding' data-toggle='dropdown'", 'btn dropdown-toggle')?>
<ul class='dropdown-menu' role='menu' aria-labelledby='encoding'>
<?php foreach($lang->repo->encodingList as $key => $val):?>
<li><?php echo html::a($this->repo->createLink('blame', "repoID=$repoID&entry=&revision=$revision&encoding=$key", "entry=$encodePath"), $val)?></li>
<?php endforeach;?>
</ul>
</div>
</div>
</div>
<div class="content">
<table class="blame table table-form table-fixed">
<thead>
<tr>
<td class='w-70px'><?php echo $lang->repo->revision?></td>
<?php if($repo->SCM == 'Git'):?>
<td class='w-50px'><?php echo $lang->repo->commit?></td>
<?php endif;?>
<td class='w-100px'><?php echo $lang->repo->committer?></td>
<td class="w-40px"><?php echo $lang->repo->line?></td>
<td><?php echo $lang->repo->code?></td>
</tr>
</thead>
<tbody>
<?php foreach($blames as $blame):?>
<tr<?php if(isset($blame['lines'])) echo " class='topLine'";?>>
<?php
if(isset($blame['lines']))
{
$rowspan = $blame['lines'];
echo '<td rowspan="' . $rowspan . '" class="info" title="' . $blame['revision'] . '">';
echo $repo->SCM == 'Git' ? substr($blame['revision'], 0, 10) : $blame['revision'];
echo '</td>';
if($repo->SCM == 'Git') echo '<td rowspan="' . $rowspan . '" class="info">' . zget($historys, $blame['revision'], '') . '</td>';
echo '<td rowspan="' . $rowspan . '" class="info">' . $blame['committer'] . '</td>';
}
?>
<td class="line"><?php echo $blame['line'];?></td>
<td><pre><?php echo htmlspecialchars($blame['content']);?></pre></td>
</tr>
<?php endforeach?>
</tbody>
</table>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
-80
View File
@@ -1,80 +0,0 @@
<?php
/**
* The browse view file of repo module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @author Wang Yidong, Zhu Jinyong
* @package repo
* @version $Id: browse.html.php $
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<div class="page-title">
<strong>
<?php
echo html::a($this->repo->createLink('browse', "repoID=$repoID"), $repo->name);
if(!empty($path))
{
$paths = explode('/', $path);
$postPath = '';
foreach($paths as $pathName)
{
$postPath .= $pathName . '/';
echo '/' . ' ' . html::a($this->repo->createLink('browse', "repoID=$repoID", "path=" . $this->repo->encodePath($postPath) . "&revision=$revision"), trim($pathName, '/'));
}
}
?>
</strong>
</div>
</div>
<div class="btn-toolbar pull-right">
<span class='last-sync-time'<?php echo $lang->repo->notice->lastSyncTime . $cacheTime?></span>
<?php echo html::a($this->repo->createLink('browse', "repoID=$repoID&path=&revision=$revision&refresh=1", "path=" . $this->repo->encodePath($path)), "<i class='icon icon-refresh'></i> ". $lang->refresh, '', "class='btn btn-primary'");?>
</div>
</div>
<div id="mainContent" class="main-row fade">
<div class="main-col main-table">
<table class='table table-fixed'>
<thead>
<tr>
<th width='30'></th>
<th style="min-width: 150px;"><?php echo $lang->repo->name?></th>
<th width='80'><?php echo $lang->repo->revisions?></th>
<th width='80'><?php echo $lang->repo->time?></th>
<th width='120'><?php echo $lang->repo->committer?></th>
<th><?php echo $lang->repo->comment?></th>
</tr>
</thead>
<tbody>
<?php foreach($infos as $info):?>
<?php if(empty($info->name)) continue;?>
<tr>
<td class="icon">
<span class="<?php echo $info->kind == 'dir'? 'directory': 'file';?> mini-icon"></span>
</td>
<td>
<?php
$infoPath = trim($path . '/' . $info->name, '/');
$link = $info->kind == 'dir' ? $this->repo->createLink('browse', "repoID=$repoID", "path=" . $this->repo->encodePath($infoPath)) : $this->repo->createLink('view', "repoID=$repoID&entry=", 'entry=' . $this->repo->encodePath($infoPath));
echo html::a($link, $info->name, '', "title='{$info->name}'");
?>
</td>
<td align='center'><?php echo $repo->SCM == 'Git' ? substr($info->revision, 0, 10) : $info->revision;?></td>
<td><?php echo substr($info->date, 0, 10)?></td>
<td><?php echo $info->committer?></td>
<?php $comment = htmlspecialchars($info->comment, ENT_QUOTES);?>
<td class='comment' title='<?php echo $comment?>'><?php echo $comment?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<div class="side-col" id="sidebar">
<div class="sidebar-toggle"><i class="icon icon-angle-right"></i></div>
<div class='side-body'><?php include 'ajaxsidelogs.html.php';?></div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+86 -82
View File
@@ -2,95 +2,99 @@
/**
* The create view file of repo module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Gang Liu <liugang@cnezsoft.com>
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @author Wang Yidong, Zhu Jinyong
* @package repo
* @version $Id$
* @link http://www.zentao.net
* @version $Id: create.html.php $
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php if(common::checkNotCN()):?>
<style>
.user-addon{padding-right: 16px; padding-left: 16px;}
</style>
<?php endif;?>
<?php js::set('scm', 'Git')?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->repo->create; ?></h2>
</div>
<form id='repoForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th class='thWidth'></th>
<td colspan="2"><?php echo $lang->repo->tips; ?></td>
</tr>
<tr>
<th class='thWidth'><?php echo $lang->repo->type; ?></th>
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, 'Git',
"onchange='scmChanged(this.value)' class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', '', "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->example->path;?></td>
</tr>
<tr>
<th><?php echo $lang->repo->encoding; ?></th>
<td class='required'><?php echo html::input('encoding', 'utf-8', "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', '', "class='form-control'")?></td>
<td class='muted'><?php echo $lang->repo->example->client;?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', '', "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->password;?></th>
<td><?php echo html::password('password', '', "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->repo->acl;?></th>
<td class='acl'>
<div class='input-group mgb-10'>
<span class='input-group-addon'><?php echo $lang->repo->group?></span>
<?php echo html::select('acl[groups][]', $groups, '', "class='form-control chosen' multiple")?>
</div>
<div class='input-group'>
<span class='input-group-addon user-addon'><?php echo $lang->repo->user?></span>
<?php echo html::select('acl[users][]', $users, '', "class='form-control chosen' multiple")?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->desc; ?></th>
<td><?php echo html::textarea('desc', '', "rows='3' class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton(); ?>
</td>
</tr>
</table>
</form>
</div>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->repo->create; ?></h2>
</div>
<form id='repoForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th class='thWidth'></th>
<td colspan="2"><?php echo $lang->repo->tips; ?></td>
</tr>
<tr>
<th class='thWidth'><?php echo $lang->repo->type; ?></th>
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, 'Git', "onchange='scmChanged(this.value)' class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', '', "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->example->path;?></td>
</tr>
<tr>
<th><?php echo $lang->repo->encoding; ?></th>
<td class='required'><?php echo html::input('encoding', 'utf-8', "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', '', "class='form-control'")?></td>
<td class='muted'><?php echo $lang->repo->example->client;?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', '', "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->password;?></th>
<td>
<div class='input-group'>
<?php echo html::password('password', '', "class='form-control'");?>
<span class='input-group-addon fix-border fix-padding'></span>
<?php echo html::select('encrypt', $lang->repo->encryptList, 'base64', "class='form-control'");?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->acl;?></th>
<td class='acl'>
<div class='input-group mgb-10'>
<span class='input-group-addon'><?php echo $lang->repo->group?></span>
<?php echo html::select('acl[groups][]', $groups, '', "class='form-control chosen' multiple")?>
</div>
<div class='input-group'>
<span class='input-group-addon user-addon'><?php echo $lang->repo->user?></span>
<?php echo html::select('acl[users][]', $users, '', "class='form-control chosen' multiple")?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->desc; ?></th>
<td colspan='2'><?php echo html::textarea('desc', '', "rows='3' class='form-control'"); ?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton(); ?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php'; ?>
-1
View File
@@ -11,7 +11,6 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/form.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php include 'header.review.html.php';?>
<?php if(!isonlybody()):?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
+84 -79
View File
@@ -11,87 +11,92 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php if(common::checkNotCN()):?>
<style>
.user-addon{padding-right: 16px; padding-left: 16px;}
</style>
<?php endif;?>
<?php js::set('scm', $repo->SCM)?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->repo->edit; ?></h2>
</div>
<form id='repoForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th class='thWidth'></th>
<td colspan="2"><?php echo $lang->repo->tips; ?></td>
</tr>
<tr>
<th class='thWidth'><?php echo $lang->repo->type; ?></th>
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, $repo->SCM,
"onchange='scmChanged(this.value)' class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', $repo->name, "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', $repo->path, "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->example->path;?></td>
</tr>
<tr>
<th><?php echo $lang->repo->encoding; ?></th>
<td class='required'><?php echo html::input('encoding', $repo->encoding, "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', $repo->client, "class='form-control'")?></td>
<td class='muted'><?php echo $lang->repo->example->client;?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', $repo->account, "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->password;?></th>
<td><?php echo html::password('password', $repo->password, "class='form-control'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->acl;?></th>
<td>
<div class='input-group mgb-10'>
<span class='input-group-addon'><?php echo $lang->repo->group?></span>
<?php echo html::select('acl[groups][]', $groups, empty($repo->acl->groups) ? '' : join(',', $repo->acl->groups), "class='form-control chosen' multiple")?>
</div>
<div class='input-group'>
<span class='input-group-addon user-addon'><?php echo $lang->repo->user?></span>
<?php echo html::select('acl[users][]', $users, empty($repo->acl->users) ? '' : join(',', $repo->acl->users), "class='form-control chosen' multiple")?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->desc; ?></th>
<td><?php echo html::textarea('desc', $repo->desc, "rows='3' class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton() ?>
</td>
</tr>
</table>
</form>
</div>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->repo->edit; ?></h2>
</div>
<form id='repoForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th class='thWidth'></th>
<td colspan="2"><?php echo $lang->repo->tips; ?></td>
</tr>
<tr>
<th class='thWidth'><?php echo $lang->repo->type; ?></th>
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, $repo->SCM, "onchange='scmChanged(this.value)' class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', $repo->name, "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', $repo->path, "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->example->path;?></td>
</tr>
<tr>
<th><?php echo $lang->repo->encoding; ?></th>
<td class='required'><?php echo html::input('encoding', $repo->encoding, "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', $repo->client, "class='form-control'")?></td>
<td class='muted'><?php echo $lang->repo->example->client;?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', $repo->account, "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<th><?php echo $lang->repo->password;?></th>
<td>
<div class='input-group'>
<?php echo html::password('password', $repo->password, "class='form-control'");?>
<span class='input-group-addon fix-border fix-padding'></span>
<?php echo html::select('encrypt', $lang->repo->encryptList, $repo->encrypt, "class='form-control'");?>
</div>
</td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->repo->acl;?></th>
<td>
<div class='input-group mgb-10'>
<span class='input-group-addon'><?php echo $lang->repo->group?></span>
<?php echo html::select('acl[groups][]', $groups, empty($repo->acl->groups) ? '' : join(',', $repo->acl->groups), "class='form-control chosen' multiple")?>
</div>
<div class='input-group'>
<span class='input-group-addon user-addon'><?php echo $lang->repo->user?></span>
<?php echo html::select('acl[users][]', $users, empty($repo->acl->users) ? '' : join(',', $repo->acl->users), "class='form-control chosen' multiple")?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->desc; ?></th>
<td colspan='2'><?php echo html::textarea('desc', $repo->desc, "rows='3' class='form-control'"); ?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton() ?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php'; ?>
-256
View File
@@ -1,256 +0,0 @@
<?php
/* get last review info in this file. */
$lastReview = $this->repo->getLastReviewInfo($file);
$repoModule = isset($lastReview) && isset($lastReview->module) ? $lastReview->module : '';
/* get product by cookie or last review in this file. */
$repoProduct = isset($_COOKIE['repoPairs'][$repoID]) ? $_COOKIE['repoPairs'][$repoID] : '';
$repoProduct = isset($lastReview) && isset($lastReview->product) ? $lastReview->product : $repoProduct;
$products = $this->loadModel('product')->getPairs();
$projects = $this->repo->getProjectPairs($repoProduct);
$modules = $this->loadModel('tree')->getOptionMenu($repoProduct, $viewType = 'bug', $startModuleID = 0);
$users = $this->loadModel('user')->getPairs('devfirst|nodeleted');
$products = array('' => '') + $products;
$projects = array('' => '') + $projects;
$cwd = getcwd();
$commiters = $this->user->getCommiters();
$blamePairs = array();
if($suffix and $suffix != 'binary' and strpos($this->config->repo->images, "|$suffix|") === false)
{
$blames = $this->scm->blame($entry, $info->revision);
foreach($blames as $line => $blame)
{
if(!isset($blame['committer']))
{
if(isset($blamePairs[$line - 1])) $blamePairs[$line] = $blamePairs[$line - 1];
continue;
}
$blamePairs[$line] = zget($commiters, $blame['committer'], $blame['committer']);
}
}
chdir($cwd);
$reviews = $this->repo->getReview($repoID, $file, $info->revision);
$v1 = isset($oldRevision) ? $oldRevision : 0;
$bugUrl = $this->repo->createLink('addBug', "repoID=$repoID&file=&v1=$v1&v2={$info->revision}", "file=$file");
$commentUrl = $this->repo->createLink('addComment');
$productSelect = html::select('product', $products, $repoProduct, 'class="product form-control chosen" onchange="changeProduct(this)"');
$branches = $this->loadModel('branch')->getPairs($repoProduct);
$moduleSelect = html::select('module', $modules, $repoModule, 'class="form-control chosen"');
$projectSelect = html::select('project', $projects, '', 'class="form-control chosen"');
$typeSelect = html::select('repoType', $lang->repo->typeList, '', 'class="form-control chosen"');
$userSelect = html::select('assignedTo', $users, '', 'class="form-control chosen assignedTo"');
$bugs = array();
foreach($reviews as $line => $lineReview)
{
$lineBugs = array();
foreach ($lineReview['bugs'] as $bugID => $bug)
{
$lineBug = array();
$lineBug['id'] = $bugID;
$lineBug['line'] = $line;
$lineBug['title'] = $bug->title;
$lineBug['steps'] = $bug->steps;
$lineBug['realname'] = $bug->realname;
$lineBug['openedDate'] = substr($bug->openedDate, 5, 11);
$lineBug['lines'] = $bug->lines;
if($bug->edit) $lineBug['edit'] = true;
if($bug->delete) $lineBug['delete'] = true;
if(isset($lineReview['comments']))
{
$comments = $lineReview['comments'][$bugID];
if(isset($comments))
{
$bugComments = array();
foreach ($comments as $commentID => $comment)
{
$bugComment = array(
'id' => $comment->id,
'edit' => $comment->edit,
'realname' => $comment->realname,
'date' => substr($comment->date, 5, 11),
'comment' => $comment->comment,
);
$bugComments[] = $bugComment;
}
$lineBug['comments'] = $bugComments;
}
}
$lineBugs[] = $lineBug;
}
$bugs[$line] = $lineBugs;
}
js::set('bugs', $bugs);
js::set('productError', $lang->repo->error->product);
js::set('contentError', $lang->repo->error->commentText);
js::set('titleError', $lang->repo->error->title);
js::set('commentError', $lang->repo->error->comment);
js::set('submit', $lang->repo->submit);
js::set('cancel', $lang->repo->cancel);
js::set('confirmDelete', $lang->repo->notice->deleteBug);
js::set('confirmDeleteComment', $lang->repo->notice->deleteComment);
js::set('repoID', $repoID);
js::set('revision', $info->revision);
js::set('file', $file);
js::set('blamePairs', $blamePairs);
?>
<?php if(common::hasPriv('repo', 'addBug')):?>
<form id="bugForm" class="bugForm main-form hide" method="post" action="<?php echo $bugUrl?>">
<div class="bugFormContainer">
<table class='table table-form'>
<tr>
<th><?php echo $lang->repo->product?></th>
<td class='w-p45'>
<div class='input-group'>
<?php echo $productSelect?>
<?php if($branches) echo html::select('branch', $branches, '', "class='form-control' style='width:65px'");?>
</div>
</td>
<th><?php echo $lang->repo->module?></th>
<td><?php echo $moduleSelect?></td>
</tr>
<tr>
<th><?php echo $lang->repo->project?></th>
<td><?php echo $projectSelect?></td>
<th><?php echo $lang->repo->type?></th>
<td><?php echo $typeSelect?></td>
</tr>
<tr>
<th><?php echo $lang->repo->assign?></th>
<td><?php echo $userSelect?></td>
<th><?php echo $lang->repo->lines?></th>
<td class='lines'>
<div class="input-group">
<input class="line form-control" type="number" min="1" name="begin">
<span class="input-group-addon fix-border">-</span>
<input class="line form-control" type="number" min="1" name="end">
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->title?></th>
<td colspan='3'>
<?php echo html::input('title', '', "class='form-control'");?>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->detile?></th>
<td colspan='3'><textarea id="commentText" name="commentText" class="commentInput form-control" spellcheck="false"></textarea></td>
</tr>
<tr>
<th></th>
<td colspan="3" class='form-actions'>
<?php echo html::submitButton($lang->repo->submit, '', 'btn btn-wide btn-primary bugSubmit');?>
<?php echo html::commonButton($lang->cancel, "onclick='hiddenForm()'", 'btn btn-wide');?>
</td>
</tr>
</table>
<div class="optional"></div>
</div>
</form>
<?php else:?>
<form id='bugForm' class='bugForm hide'>
<?php printf($lang->user->errorDeny, $lang->repo->common, $lang->repo->addBug);?>
</form>
<?php endif;?>
<div class='panel panel-sm hide panel-bug' id='bugPanel'>
<div class='panel-heading'>
<div class='panel-actions pull-right'>
<?php if(common::hasPriv('bug', 'view')):?>
<a href='javascript:;' class='view-bug'>Bug#<span class='bugid'></span></a>
<?php else:?>
Bug#<span class='bugid'></span>
<?php endif;?>
<?php if(common::hasPriv('bug', 'edit')):?>
<a href='javascript:;' class='edit bugEdit'><i class='icon-pencil'></i></a>
<?php endif;?>
<?php if(common::hasPriv('bug', 'delete')):?>
<a href='javascript:;' class='delete bugDelete'><i class='icon-remove'></i></a>
<?php endif;?>
<a href="javascript:;"><i class='icon-chevron-down'></i></a>
</div>
<i class='icon-bug text-muted'></i> <strong class='title'></strong>
</div>
<div class='panel-body'>
<p><?php echo $lang->repo->lines?> <strong class='code-lines'></strong> &nbsp; <i class='icon-user text-muted'></i> <strong class='realname'></strong> &nbsp;<span class='text-muted bug-date'><i class='icon-time'></i> <span class='openedDate'></span></span></p>
<form method='post' class='bug-edit-form' action>
<input type='text' name='commentText' class='commentInput form-control mgb-10'>
<button type='submit' class='btn btn-sm btn-primary bugEditSubmit'><?php echo $lang->repo->submit?></button>
<button type='button' class='btn btn-sm bugEditCancel'><?php echo $lang->repo->cancel?></button>
</form>
<p class='steps text-content'></p>
<div class='comments'></div>
<?php if(common::hasPriv('repo', 'addComment')):?>
<button class='btn btn-sm addComment' type='button'><?php echo $lang->repo->addComment?></button>
<form class='commentForm' method='post' action='<?php echo $commentUrl?>' id='commentForm'>
<textarea name='comment' class='commentText form-control mgb-10' spellcheck='false' placeholder='<?php echo $lang->repo->notice->commentContent?>'></textarea>
<input class='commentSubmit btn btn-sm btn-primary' type='submit' value='<?php echo $lang->repo->submit?>'>
<input class='commentCancel btn btn-sm' type='button' value='<?php echo $lang->repo->cancel?>'>
<input type='hidden' name='objectID' value=''>
<div class='optional'></div>
</form>
<?php endif;?>
</div>
</div>
<div class='comment hide' id='commentCell'>
<i class='icon-user text-muted'></i> <strong class='realname'></strong>: <span class='comment-content text-content'></span> <span class='text-muted comment-date'>&nbsp;<i class='icon-time'></i> <span class='date'></span></span> &nbsp;<a href='javascript:;' class='edit commentEdit pull-right'><i class='icon-pencil'></i></a>
<form method='post' class='comment-edit-form' action=''>
<textarea name='commentText' class='commentInput form-control mgb-10'></textarea>
<button type='submit' class='btn btn-sm btn-primary commentEditSubmit'><?php echo $lang->repo->submit?></button>
<button type='button' class='btn btn-sm commentEditCancel'><?php echo $lang->repo->cancel?></button>
</form>
</div>
<div class='dropdown' id="bugsPreview">
<ul class='dropdown-menu fade'>
<li class='dropdown-header'><?php echo $lang->repo->line?><strong class='code-line'></strong> &nbsp; <i class='icon-bug'></i> <strong class='bug-count'>0</strong> &nbsp; <i class='icon-comments-alt'></i> <strong class='comment-count'>0</strong></li>
</ul>
</div>
<div id='rowTip' class='hide'><div class='row-tip'><i class='icon-chat-dot preview-icon'></i><div class='on-expand tip'><span><?php echo $lang->repo->expand?> </span><i class='icon-chevron-down'></i></div><div class='on-collapse tip'><span><?php echo $lang->repo->collapse?> </span><i class='icon-chevron-up'></i></div></div></div>
<script>
function changeProduct(select)
{
loadProductBranches(select);
productID = $(select).children('option:selected').val();
link = createLink('repo', 'ajaxGetProjects', 'productID=' + productID);
$(select).closest('.bugFormContainer').find('select[name=project]').parent().load(link, '', function(){$('#project').chosen();});
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=0&rootModuleID=0&returnType=html');
$(select).closest('.bugFormContainer').find('select[name=module]').parent().load(moduleLink, '', function(){$('#module').chosen();});
}
function loadProductBranches(select)
{
$(select).closest('.input-group').find('#branch').remove();
productID = $(select).children('option:selected').val();
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data)
{
if(data)
{
$(select).closest('.input-group').append(data);
$(select).closest('.input-group').find('#branch').css('width', '65px');
}
});
}
function loadBranch(select)
{
branch = $(select).val();
productID = $(select).closest('.input-group').find('#product').val();
link = createLink('repo', 'ajaxGetProjects', 'productID=' + productID + '&branch=' + branch);
$(select).closest('.bugFormContainer').find('select[name=project]').parent().load(link, '', function(){$('#project').chosen();});
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html');
$(select).closest('.bugFormContainer').find('select[name=module]').parent().load(moduleLink, '', function(){$('#module').chosen();});
}
function hiddenForm()
{
$('.with-action-row').removeClass('with-action-row');
}
/* remove a function */
function loadModuleRelated(){}
</script>
+13 -11
View File
@@ -5,28 +5,26 @@
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @author Wang Yidong, Zhu Jinyong
* @package repo
* @version $Id: browse.html.php $
* @version $Id: log.html.php $
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('repoID', $repoID);?>
<div id='mainMenu' class='clearfix'>
<div class="btn-toolbar pull-left">
<?php echo html::backButton("<i class='icon icon-back icon-sm'></i>" . $lang->goback, '', 'btn btn-link');?>
<div class="divider"></div>
<div class="page-title">
<strong>
<?php
echo html::a($this->repo->createLink('browse', "repoID=$repoID"), $repo->name);
echo html::a($this->repo->createLink('log', "repoID=$repoID"), $repo->name);
$paths= explode('/', $entry);
$fileName = array_pop($paths);
$postPath = '';
foreach($paths as $pathName)
{
$postPath .= $pathName . '/';
echo '/' . ' ' . html::a($this->repo->createLink('browse', "repoID=$repoID", "path=" . $this->repo->encodePath($postPath)), trim($pathName, '/'));
echo '/' . ' ' . html::a($this->repo->createLink('log', "repoID=$repoID", "entry=" . $this->repo->encodePath($postPath)), trim($pathName, '/'));
}
echo '/' . ' ' . $fileName;
echo $repo->SCM == 'Git' ? " @ " . substr($revision, 0, 10) : " @ r" . $revision;;
?>
</strong>
</div>
@@ -38,8 +36,6 @@
<ul class="nav nav-default">
<?php $encodeEntry = $this->repo->encodePath($entry);?>
<li><a><?php echo $lang->repo->log;?></a></li>
<li><?php echo html::a($this->repo->createLink('view', "repoID=$repoID&entry=&revision=$revision", "entry=$encodeEntry"), $lang->repo->view);?></li>
<?php if($info->kind == 'file') echo '<li>' . html::a($this->repo->createLink('blame', "repoID=$repoID&entry=&revision=$revision", "entry=$encodeEntry"), $lang->repo->blame) . '</li>';?>
<?php if($info->kind == 'file') echo '<li>' . html::a($this->repo->createLink('download', "repoID=$repoID&path=&fromRevision=$revision", "path=$encodeEntry"), $lang->repo->download, 'hiddenwin') . '</li>';?>
</ul>
</nav>
@@ -48,9 +44,12 @@
<thead>
<tr>
<th class='w-40px'></th>
<th width='w-110px'><?php echo $lang->repo->revision?></th>
<th width='w-150px'><?php echo $lang->repo->date?></th>
<th width='w-80px'><?php echo $lang->repo->committer?></th>
<th class='w-110px'><?php echo $lang->repo->revision?></th>
<?php if($repo->SCM == 'Git'):?>
<th class='w-90px'><?php echo $lang->repo->commit?></th>
<?php endif;?>
<th class='w-150px'><?php echo $lang->repo->date?></th>
<th class='w-100px'><?php echo $lang->repo->committer?></th>
<th><?php echo $lang->repo->comment?></th>
</tr>
</thead>
@@ -64,6 +63,9 @@
</div>
</td>
<td class='versions'><?php echo html::a($this->repo->createLink('revision', "repoID=$repoID&revision=" . $log->revision), substr($log->revision, 0, 10));?></td>
<?php if($repo->SCM == 'Git'):?>
<td><?php echo $log->commit?></td>
<?php endif;?>
<td><?php echo $log->time;?></td>
<td><?php echo $log->committer;?></td>
<td class='comment'><?php echo $log->comment;?></td>
-70
View File
@@ -1,70 +0,0 @@
<?php include '../../common/view/header.html.php';?>
<?php js::set('browseType', $browseType);?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php echo html::a($this->repo->createLink('review', "repoID=$repoID&browseType=all"), "<span class='text'>{$lang->bug->allBugs}</span>", '', "id='allTab' class='btn btn-link'");?>
<?php echo html::a($this->repo->createLink('review', "repoID=$repoID&browseType=assignToMe"), "<span class='text'>{$lang->bug->assignToMe}</span>", '', "id='assigntomeTab' class='btn btn-link'");?>
<?php echo html::a($this->repo->createLink('review', "repoID=$repoID&browseType=openedByMe"), "<span class='text'>{$lang->bug->openedByMe}</span>", '', "id='openedbymeTab' class='btn btn-link'");?>
<?php echo html::a($this->repo->createLink('review', "repoID=$repoID&browseType=resolvedByMe"), "<span class='text'>{$lang->bug->resolvedByMe}</span>", '', "id='resolvedbymeTab' class='btn btn-link'");?>
<?php echo html::a($this->repo->createLink('review', "repoID=$repoID&browseType=assignToNull"), "<span class='text'>{$lang->bug->assignToNull}</span>", '', "id='assigntonullTab' class='btn btn-link'");?>
<?php echo html::a($this->repo->createLink('review', "repoID=$repoID&browseType=unResolved"), "<span class='text'>{$lang->bug->unResolved}</span>", '', "id='unresolvedTab' class='btn btn-link'");?>
<?php echo html::a($this->repo->createLink('review', "repoID=$repoID&browseType=unclosed"), "<span class='text'>{$lang->bug->unclosed}</span>", '', "id='unclosedTab' class='btn btn-link'");?>
</div>
</div>
<div id='mainContent' class='main-table' data-ride='table'>
<table class='table' id='bugList'>
<thead>
<tr class="colhead">
<th class="c-id"><?php echo 'ID';?></th>
<th><?php echo $lang->repo->title?></th>
<th><?php echo $lang->repo->file . '/' . $lang->repo->location?></th>
<th class='w-100px'><?php echo $lang->repo->revisionA?></th>
<th class='w-80px'><?php echo $lang->repo->type?></th>
<th class='w-80px'><?php echo $lang->repo->status?></th>
<th class='w-100px'><?php echo $lang->repo->openedBy?></th>
<th class='w-100px'><?php echo $lang->repo->assignedTo?></th>
<th class='w-120px'><?php echo $lang->repo->openedDate?></th>
</tr>
</thead>
<tbody>
<?php foreach($bugs as $bug):?>
<tr>
<td><?php echo sprintf('%03d', $bug->id);?></td>
<?php $lines = explode(',', trim($bug->lines, ','));?>
<td><?php echo html::a($this->createLink('bug', 'view', "bugID={$bug->id}"), $bug->title)?></td>
<td>
<?php
$entry = $repo->name . '/' . $this->repo->decodePath($bug->entry);
if(empty($bug->v1))
{
$revision = $repo->SCM == 'Git' ? $this->repo->getGitRevisionName($bug->v2, $historys[$bug->v2]) : $bug->v2;
$link = $this->repo->createLink('view', "repoID=$repoID&entry=&revision={$bug->v2}", "entry={$bug->entry}") . "#L$lines[0]";
}
else
{
$revision = $repo->SCM == 'Git' ? substr($bug->v1, 0, 10) : $bug->v1;
$revision .= ' : ';
$revision .= $repo->SCM == 'Git' ? substr($bug->v2, 0, 10) : $bug->v2;
if($repo->SCM == 'Git') $revision .= ' (' . $historys[$bug->v1] . ' : ' . $historys[$bug->v2] . ')';
$link = $this->repo->createLink('diff', "repoID=$repoID&entry=&oldRevision={$bug->v1}&newRevision={$bug->v2}", "entry={$bug->entry}") . "#L$lines[0]";
}
echo html::a($link, $entry);
echo "<span class='label label-info'>$bug->lines</span>";
?>
</td>
<td><?php echo $repo->SCM == 'Git' ? substr($bug->v2, 0, 10) : $bug->v2?></td>
<td><?php echo isset($lang->repo->typeList[$bug->repoType]) ? $lang->repo->typeList[$bug->repoType] : ''?></td>
<td class='bug-<?php echo $bug->status?>'><?php echo $lang->bug->statusList[$bug->status]?></td>
<td><?php echo zget($users, $bug->openedBy)?></td>
<td><?php echo zget($users, $bug->assignedTo)?></td>
<td><?php echo substr($bug->openedDate, 2, 14)?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if($bugs):?>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<?php endif;?>
</div>
<?php include '../../common/view/footer.html.php';?>
+2 -2
View File
@@ -12,14 +12,14 @@
session_start();
$_SESSION['repoList'] = $this->app->getURI(true);
session_write_close();
$pathInfo = empty($path) ? '' : '&root=' . $this->repo->encodePath($path);
$pathInfo = empty($path) ? '' : '&path=' . $this->repo->encodePath($path);
$preDir = empty($parentDir) ? $pathInfo : '&path=' . $this->repo->encodePath($parentDir);
$typeInfo = $type == 'file' ? '&type=file' : '';
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php echo html::a($this->repo->createLink('browse', "repoID=$repoID" . $preDir), "<i class='icon icon-back'></i>" . $lang->goback, '', "class='btn btn-link'");?>
<?php echo html::a($this->repo->createLink('browse', "repoID=$repoID", $preDir), "<i class='icon icon-back'></i>" . $lang->goback, '', "class='btn btn-link'");?>
<div class="divider"></div>
<div class="page-title">
<?php echo $lang->repo->revisionA . ' ' . ($repo->SCM == 'Git' ? $this->repo->getGitRevisionName($revision, $log->commit) : $revision);?>
-87
View File
@@ -1,87 +0,0 @@
<?php
/**
* The settings view file of repo module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @author Wang Yidong, Zhu Jinyong
* @package repo
* @version $Id: setting.html.php $
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php if(common::checkNotCN()):?>
<style>
.user-addon{padding-right: 16px; padding-left: 16px;}
</style>
<?php endif;?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->repo->settings;?></h2>
</div>
<form class='form-indicator main-form' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->repo->SCM;?></th>
<td><?php echo html::select('SCM', $lang->repo->scmList, $repo->SCM, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->repo->name;?></th>
<td><?php echo html::input('name', $repo->name, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->repo->path;?></th>
<td><?php echo html::input('path', $repo->path, "class='form-control'")?></td>
<td class='text-muted'><?php echo $lang->repo->example->path;?></td>
</tr>
<tr>
<th><?php echo $lang->repo->encoding;?></th>
<td><?php echo html::input('encoding', $repo->encoding, "class='form-control'")?></td>
<td class='text-muted'><?php echo $lang->repo->example->encoding;?></td>
</tr>
<tr>
<th><?php echo $lang->repo->client;?></th>
<td><?php echo html::input('client', $repo->client, "class='form-control'")?></td>
<td class='text-muted'><?php echo $lang->repo->example->client;?></td>
</tr>
<tr>
<th><?php echo $lang->repo->account;?></th>
<td>
<?php echo html::input('account', $repo->account, "class='form-control' autocomplete='off'");?>
<input type='text' style="display:none">
</td>
</tr>
<tr>
<th><?php echo $lang->repo->password;?></th>
<td>
<div class='input-group'>
<?php echo html::password('password', $repo->password, "class='form-control'");?>
<span class='input-group-addon fix-border fix-padding'></span>
<?php echo html::select('encrypt', $lang->repo->encryptList, $repo->encrypt, "class='form-control'");?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->repo->acl;?></th>
<td>
<div class='input-group mgb-10'>
<span class='input-group-addon'><?php echo $lang->repo->group?></span>
<?php echo html::select('acl[groups][]', $groups, empty($repo->acl->groups) ? '' : join(',', $repo->acl->groups), "class='form-control chosen' multiple")?>
</div>
<div class='input-group'>
<span class='input-group-addon user-addon'><?php echo $lang->repo->user?></span>
<?php echo html::select('acl[users][]', $users, empty($repo->acl->users) ? '' : join(',', $repo->acl->users), "class='form-control chosen' multiple")?>
</div>
</td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::backButton();?>
</td>
</tr>
</table>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
-2
View File
@@ -12,7 +12,6 @@
include '../../common/view/header.html.php';
include '../../common/view/form.html.php';
include '../../common/view/kindeditor.html.php';
include 'header.review.html.php';
js::import($jsRoot . 'misc/highlight/highlight.pack.js');
css::import($jsRoot . 'misc/highlight/styles/github.css');
$encodePath = $this->repo->encodePath($entry);
@@ -57,7 +56,6 @@ $version = " <span class=\"label label-info\">$revisionName</span>";
<div class='panel-actions'>
<?php if($suffix != 'binary' and strpos($config->repo->images, "|$suffix|") === false):?>
<?php
if(common::hasPriv('repo', 'blame')) echo html::a($this->repo->createLink('blame', "repoID=$repoID&entry=&revision=$revision&encoding=$encoding", "entry=$encodePath"), html::icon('random') . $lang->repo->blame, '', "class='btn btn-sm btn-primary'");
if(common::hasPriv('repo', 'download')) echo html::a($this->repo->createLink('download', "repoID=$repoID&path=&fromRevision=$revision", "path=$encodePath"), html::icon('download-alt') . $lang->repo->download, 'hiddenwin', "class='btn btn-sm btn-primary'");
?>
<?php endif;?>