diff --git a/module/repo/control.php b/module/repo/control.php index 7b2ee1892e..2aceddb69f 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -421,6 +421,7 @@ class repo extends control */ public function view($repoID, $objectID = 0, $entry = '', $revision = 'HEAD', $showBug = 'false', $encoding = '') { + set_time_limit(0); $browser = helper::getBrowser(); if($this->get->repoPath) $entry = $this->get->repoPath; $this->repo->setBackSession('view', $withOtherModule = true); @@ -641,7 +642,7 @@ class repo extends control $this->view->path = urldecode($path); $this->view->logType = $logType; $this->view->cloneUrl = $this->repo->getCloneUrl($repo); - $this->view->cacheTime = date('m-d H:i', strtotime($lastRevision->time)); + $this->view->cacheTime = isset($lastRevision->time) ? date('m-d H:i', strtotime($lastRevision->time)) : date('m-d H:i'); $this->view->branchOrTag = $branchOrTag; $this->view->syncedRF = strpos(",{$this->config->repo->synced},", ",$repoID,") !== false; //Check has synced rename files. diff --git a/module/repo/js/monaco.js b/module/repo/js/monaco.js index 26df5dd680..16015dc2aa 100644 --- a/module/repo/js/monaco.js +++ b/module/repo/js/monaco.js @@ -9,7 +9,8 @@ function createTab(filename, filepath) { $('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected'); - var tabID = Base64.encode(filepath).replaceAll('=', '-'); + /* encode twice for resolving chinese character. */ + var tabID = Base64.encode(Base64.encode(filepath).replaceAll('=', '-')).replaceAll('=', '-'); return { id: tabID, url: createLink('repo', 'ajaxGetEditorContent', urlParams.replace('%s', Base64.encode(encodeURIComponent(filepath)))), @@ -56,7 +57,8 @@ $(function() /* Remove file path for opened files. */ $('#fileTabs').on('onClose', function(event, tab) { - var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '='))); + /* encode twice for resolving chinese character. */ + var filepath = decodeURIComponent(Base64.decode(Base64.decode(tab.id.replaceAll('-', '=')).replaceAll('-', '='))); var index = openedFiles.indexOf(filepath); if(index > -1) { diff --git a/module/repo/model.php b/module/repo/model.php index a7d7a7f06d..895cab255f 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -333,11 +333,11 @@ class repoModel extends model if($type == 'task') $links = $this->post->tasks; $revisionInfo = $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->andWhere('revision')->eq($revision)->fetch(); + $revisionID = $revisionInfo->id; $committer = $this->dao->select('account')->from(TABLE_USER)->where('commiter')->eq($revisionInfo->committer)->fetch('account'); if(empty($committer)) $committer = $revisionInfo->committer; foreach($links as $linkID) { - $revisionID = $revisionInfo->id; $relation = new stdclass; $relation->AType = 'revision'; @@ -1106,6 +1106,7 @@ class repoModel extends model $log->files = array(); foreach($log->change as $file => $info) $log->files[$info['action']][] = $file; } + return $logs; } @@ -2275,13 +2276,13 @@ class repoModel extends model /* Get file commits by repo. */ if($repo->SCM != 'Subversion' and empty($branch)) $branch = $this->cookie->repoBranch; - $fileCommits = $this->dao->select('t1.path,t1.type,t1.action,t1.oldPath,t1.parent,t2.revision,t2.comment,t2.committer,t2.time')->from(TABLE_REPOFILES)->alias('t1') + $fileCommits = $this->dao->select('t1.id,t1.path,t1.type,t1.action,t1.oldPath,t1.parent,t2.revision,t2.comment,t2.committer,t2.time')->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('t1.repo')->eq($repo->id) ->andWhere('left(t2.comment, 12)')->ne('Merge branch') ->beginIF($repo->SCM != 'Subversion' and $branch)->andWhere('t3.branch')->eq($branch)->fi() - ->andWhere('t1.parent')->like("$parent%")->fi() + ->andWhere('t1.parent')->eq("$parent") ->orderBy('t2.`time` asc') ->fetchAll('path'); @@ -2346,11 +2347,12 @@ class repoModel extends model */ public function getFileTree($repo, $branch = '', $diffs = null) { + set_time_limit(0); $allFiles = array(); if(is_null($diffs)) { if($repo->SCM != 'Subversion' and empty($branch)) $branch = $this->cookie->repoBranch; - $files = $this->dao->select('t1.path,t1.action')->from(TABLE_REPOFILES)->alias('t1') + $files = $this->dao->select('t1.path,t2.time,t1.action')->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('t1.repo')->eq($repo->id) @@ -2358,11 +2360,33 @@ class repoModel extends model ->andWhere('left(t2.comment, 12)')->ne('Merge branch') ->beginIF($repo->SCM != 'Subversion' and $branch)->andWhere('t3.branch')->eq($branch)->fi() ->orderBy('t2.`time` asc') - ->fetchPairs(); + ->fetchAll('path'); - foreach($files as $file => $action) + $removeDirs = array(); + if($repo->SCM == 'Subversion') { - if($action != 'D') $allFiles[] = $file; + $removeDirs = $this->dao->select('t2.time,t1.path')->from(TABLE_REPOFILES)->alias('t1') + ->leftJoin(TABLE_REPOHISTORY)->alias('t2')->on('t1.revision=t2.id') + ->where('t1.repo')->eq($repo->id) + ->andWhere('t1.type')->eq('dir') + ->andWhere('t1.action')->eq('D') + ->fetchPairs(); + + } + foreach($files as $file) + { + foreach($removeDirs as $removeTime => $dir) + { + if(strpos($file->path, $dir . '/') === 0 and $file->time <= $removeTime) + { + $file->action = 'D'; + break; + } + } + if($file->action != 'D') + { + $allFiles[] = $file->path; + } } } else @@ -2426,6 +2450,7 @@ class repoModel extends model $html .= ''; } $html .= ''; + return $html; } @@ -2443,6 +2468,7 @@ class repoModel extends model $key = 0; $pathName = array(); $fileName = array(); + foreach($files as $key => $file) { if ($file['parent'] == $parent) @@ -2453,6 +2479,7 @@ class repoModel extends model $pathName[$key] = '~'; $children = $this->buildTree($files, $file['id']); + if($children) { $treeList[$key]['children'] = $children; diff --git a/module/report/zen.php b/module/report/zen.php index df91d9e8a4..5016628b36 100644 --- a/module/report/zen.php +++ b/module/report/zen.php @@ -21,7 +21,7 @@ class reportZen extends report if(!$module || !$method) list($module, $method, $params) = $this->getDefaultMethod($dimension, $group); if(!empty($module) && !empty($method) && !common::hasPriv($module, $method)) common::deny('report', $method); - + $this->view->sidebar = $this->getSidebar($dimension, $group, $module, $method, $params); $this->view->dimension = $dimension; $this->view->group = $group; diff --git a/module/svn/control.php b/module/svn/control.php index 9514eccd65..c4e99d6efb 100644 --- a/module/svn/control.php +++ b/module/svn/control.php @@ -19,6 +19,7 @@ class svn extends control */ public function run() { + set_time_limit(0); $this->svn->run(); }