diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index e0fc22d820..c70b6154c7 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -179,7 +179,7 @@ $lang->scrum->menu->execution = array('link' => "$lang->executionCommon|project| $lang->scrum->menu->story = array('link' => "$lang->SRCommon|projectstory|story|projectID=%s", 'subModule' => 'projectstory', 'alias' => 'story,track'); $lang->scrum->menu->doc = array('link' => "{$lang->doc->common}|doc|objectLibs|type=project&objectID=%s", 'subModule' => 'doc'); $lang->scrum->menu->qa = array('link' => "{$lang->qa->common}|project|qa|projectID=%s", 'subModule' => 'testcase,testtask,bug', 'alias' => 'bug,testtask,testcase'); -$lang->scrum->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); +$lang->scrum->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&branchID=&objectID=%s", 'subModule' => 'repo'); $lang->scrum->menu->build = array('link' => "{$lang->build->common}|project|build|project=%s"); $lang->scrum->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse|project=%s", 'subModule' => 'projectrelease'); $lang->scrum->menu->dynamic = array('link' => "$lang->dynamic|project|dynamic|project=%s"); @@ -222,7 +222,7 @@ $lang->waterfall->menu->programplan = array('link' => "{$lang->productplan->shor $lang->waterfall->menu->doc = array('link' => "{$lang->doc->common}|doc|objectLibs|type=project&objectID=%s"); $lang->waterfall->menu->story = array('link' => "$lang->SRCommon|projectstory|story|project=%s", 'subModule' => 'projectstory'); $lang->waterfall->menu->design = array('link' => "$lang->design|design|browse|project=%s"); -$lang->waterfall->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); +$lang->waterfall->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&branchID=&objectID=%s", 'subModule' => 'repo'); $lang->waterfall->menu->track = array('link' => "$lang->track|projectstory|track", 'alias' => 'track'); $lang->waterfall->menu->qa = array('link' => "{$lang->qa->common}|project|qa|projectID=%s", 'subModule' => 'testcase,testtask,bug', 'alias' => 'bug,testtask,testcase'); $lang->waterfall->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse|project=%s", 'subModule' => 'projectrelease'); @@ -256,9 +256,9 @@ $lang->waterfall->menu->qa['subMenu']->testcase = array('link' => "{$lang->testc $lang->waterfall->menu->qa['subMenu']->testtask = array('link' => "{$lang->testtask->common}|project|testtask|projectID=%s", 'subModule' => 'testtask', 'class' => 'dropdown dropdown-hover'); $lang->waterfall->menu->other['dropMenu'] = new stdclass(); -$lang->waterfall->menu->other['dropMenu']->estimation = array('link' => "$lang->estimation|workestimation|index|projectID=%s", 'subModule' => 'workestimation,durationestimation,budget'); -$lang->waterfall->menu->other['dropMenu']->issue = array('link' => "$lang->issue|issue|browse|projectID=%s", 'subModule' => 'issue'); -$lang->waterfall->menu->other['dropMenu']->risk = array('link' => "$lang->risk|risk|browse|projectID=%s", 'subModule' => 'risk'); +$lang->waterfall->menu->other['dropMenu']->estimation = array('link' => "$lang->estimation|workestimation|index|projectID=%s", 'subModule' => 'workestimation,durationestimation,budget'); +$lang->waterfall->menu->other['dropMenu']->issue = array('link' => "$lang->issue|issue|browse|projectID=%s", 'subModule' => 'issue'); +$lang->waterfall->menu->other['dropMenu']->risk = array('link' => "$lang->risk|risk|browse|projectID=%s", 'subModule' => 'risk'); $lang->waterfall->menu->devops = $lang->scrum->menu->devops; $lang->waterfall->menu->settings = $lang->scrum->menu->settings; @@ -275,7 +275,7 @@ $lang->execution->menu->burn = array('link' => "$lang->burn|execution|burn|e $lang->execution->menu->view = array('link' => "$lang->view|execution|grouptask|executionID=%s", 'alias' => 'grouptask,tree', 'class' => 'dropdown dropdown-hover'); $lang->execution->menu->story = array('link' => "$lang->SRCommon|execution|story|executionID=%s", 'subModule' => 'story', 'alias' => 'batchcreate,linkstory,storykanban'); $lang->execution->menu->qa = array('link' => "{$lang->qa->common}|execution|qa|executionID=%s", 'subModule' => 'bug,testcase,testtask,testreport', 'alias' => 'qa,bug,testcase,testtask,testreport'); -$lang->execution->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); +$lang->execution->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&branchID=&objectID=%s", 'subModule' => 'repo'); $lang->execution->menu->doc = array('link' => "{$lang->doc->common}|doc|objectLibs|type=execution&objectID=%s", 'subModule' => 'doc'); $lang->execution->menu->build = array('link' => "{$lang->build->common}|execution|build|executionID=%s", 'subModule' => 'build'); $lang->execution->menu->action = array('link' => "$lang->dynamic|execution|dynamic|executionID=%s"); diff --git a/module/repo/control.php b/module/repo/control.php index 9b2fc6eb74..82a94bfe1c 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -225,8 +225,6 @@ class repo extends control */ public function view($repoID, $objectID = 0, $entry = '', $revision = 'HEAD', $showBug = 'false', $encoding = '') { - $this->commonAction($repoID, $objectID); - if($this->get->repoPath) $entry = $this->get->repoPath; $this->repo->setBackSession('view', $withOtherModule = true); if($repoID == 0) $repoID = $this->session->repoID; @@ -239,11 +237,12 @@ class repo extends control $this->locate($this->repo->createLink('diff', "repoID=$repoID&entry=$entry&oldrevision=$oldRevision&newRevision=$newRevision")); } + $this->commonAction($repoID, $objectID); + $file = $entry; $repo = $this->repo->getRepoByID($repoID); $entry = $this->repo->decodePath($entry); - $this->commonAction($repoID); $this->scm->setEngine($repo); $info = $this->scm->info($entry, $revision); $path = $entry ? $info->path : ''; @@ -318,6 +317,7 @@ class repo extends control * Browse repo. * * @param int $repoID + * @param string $branchID * @param int $objectID * @param string $path * @param string $revision @@ -325,9 +325,8 @@ class repo extends control * @access public * @return void */ - public function browse($repoID = 0, $objectID = 0, $path = '', $revision = 'HEAD', $refresh = 0) + public function browse($repoID = 0, $branchID = '', $objectID = 0, $path = '', $revision = 'HEAD', $refresh = 0) { - if($this->get->repoPath) $path = $this->get->repoPath; $repoID = $this->repo->saveState($repoID, $objectID); $this->commonAction($repoID, $objectID); @@ -338,6 +337,13 @@ class repo extends control $this->repo->setMenu($this->repos, $repoID); $this->repo->setBackSession('list', $withOtherModule = true); + session_start(); + $this->session->set('revisionList', $this->app->getURI(true)); + session_write_close(); + + /* Use cookie to switch repo branch. */ + setcookie('repoBranch', $branchID); + /* Get repo and synchronous commit. */ $repo = $this->repo->getRepoByID($repoID); if(!$repo->synced) $this->locate($this->repo->createLink('showSyncCommit', "repoID=$repoID")); @@ -423,6 +429,7 @@ class repo extends control $this->view->revision = $revision; $this->view->infos = $infos; $this->view->repoID = $repoID; + $this->view->branchID = $this->cookie->branchID; $this->view->objectID = $objectID; $this->view->pager = $pager; $this->view->path = urldecode($path); @@ -547,13 +554,13 @@ class repo extends control $encodePath = $this->repo->encodePath($path); if($change['kind'] == '' or $change['kind'] == 'file') { - $change['view'] = $viewPriv ? html::a($this->repo->createLink('view', "repoID=$repoID&entry=$encodePath&revision=$revision"), $this->lang->repo->viewA) : ''; - if($change['action'] == 'M') $change['diff'] = $diffPriv ? html::a($this->repo->createLink('diff', "repoID=$repoID&entry=$encodePath&oldRevision=$oldRevision&newRevision=$revision"), $this->lang->repo->diffAB) : ''; + $change['view'] = $viewPriv ? html::a($this->repo->createLink('view', "repoID=$repoID&objectID=$objectID&entry=$encodePath&revision=$revision"), $this->lang->repo->viewA, '', "data-app='{$this->app->openApp}'") : ''; + if($change['action'] == 'M') $change['diff'] = $diffPriv ? html::a($this->repo->createLink('diff', "repoID=$repoID&objectID=$objectID&entry=$encodePath&oldRevision=$oldRevision&newRevision=$revision"), $this->lang->repo->diffAB, '', "data-app='{$this->app->openApp}'") : ''; } else { - $change['view'] = $viewPriv ? html::a($this->repo->createLink('browse', "repoID=$repoID&path=$encodePath&revision=$revision"), $this->lang->repo->browse) : ''; - if($change['action'] == 'M') $change['diff'] = $diffPriv ? html::a($this->repo->createLink('diff', "repoID=$repoID&entry=$encodePath&oldRevision=$oldRevision&newRevision=$revision"), $this->lang->repo->diffAB) : ''; + $change['view'] = $viewPriv ? html::a($this->repo->createLink('browse', "repoID=$repoID&objectID=$objectID&path=$encodePath&revision=$revision"), $this->lang->repo->browse, '', "data-app='{$this->app->openApp}'") : ''; + if($change['action'] == 'M') $change['diff'] = $diffPriv ? html::a($this->repo->createLink('diff', "repoID=$repoID&objectID=$objectID&entry=$encodePath&oldRevision=$oldRevision&newRevision=$revision"), $this->lang->repo->diffAB, '', "data-app='{$this->app->openApp}'") : ''; } $changes[$path] = $change; } @@ -1054,7 +1061,7 @@ class repo extends control foreach($repos as $id => $repoName) { $selected = $id == $repoID ? 'selected' : ''; - $reposHtml .= html::a($this->createLink('repo', 'browse', "repoID=$id"), $repoName, '', "class='$selected'"); + $reposHtml .= html::a($this->createLink('repo', 'browse', "repoID=$id&branchID=&objectID=$objectID"), $repoName, '', "class='$selected' data-app='{$this->app->openApp}'"); } $reposHtml .= ''; @@ -1065,11 +1072,12 @@ class repo extends control * Ajax get branch drop menu. * * @param int $repoID - * @param int $branchID + * @param string $branchID + * @param int $objectID * @access public * @return void */ - public function ajaxGetBranchDropMenu($repoID, $branchID) + public function ajaxGetBranchDropMenu($repoID, $branchID, $objectID) { $repo = $this->repo->getRepoByID($repoID); $branches = $this->repo->getBranches($repo); @@ -1078,7 +1086,7 @@ class repo extends control foreach($branches as $id => $branchName) { $selected = $id == $branchID ? 'selected' : ''; - $branchesHtml .= html::a($this->createLink('repo', 'browse', "repoID=$repoID&branchID=$branchID"), $branchName, '', "class='$selected'"); + $branchesHtml .= html::a($this->createLink('repo', 'browse', "repoID=$repoID&branchID=$branchID&objectID=$objectID"), $branchName, '', "class='$selected' data-app='{$this->app->openApp}'"); } $branchesHtml .= ''; diff --git a/module/repo/model.php b/module/repo/model.php index 6d75b918c4..d12b398bb3 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -97,7 +97,6 @@ class repoModel extends model */ common::setMenuVars('devops', $repoID); - session_start(); $this->session->set('repoID', $repoID); session_write_close(); @@ -145,7 +144,7 @@ class repoModel extends model $branchName = isset($branches[$branch]) ? $branches[$branch] : $branches[0]; - $dropMenuLink = helper::createLink('repo', 'ajaxGetBranchDropMenu', "repID=$repoID&branchID=$branchID"); + $dropMenuLink = helper::createLink('repo', 'ajaxGetBranchDropMenu', "repID=$repoID&branchID=$branchID&objectID=$objectID"); $output .= "