diff --git a/config/config.php b/config/config.php index 60180e1c8d..b01c02e9c7 100644 --- a/config/config.php +++ b/config/config.php @@ -38,7 +38,7 @@ $config->langs['zh-tw'] = '繁體'; $config->langs['en'] = 'English'; /* 设备类型视图文件前缀。The prefix for view file for different device. */ -$config->devicePrefix['mhtml'] = 'm.'; +$config->devicePrefix['mhtml'] = ''; /* 默认值设置。Default settings. */ $config->default = new stdclass(); diff --git a/module/bug/control.php b/module/bug/control.php index 07473775d2..428b3c4b45 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -766,6 +766,34 @@ class bug extends control $this->display(); } + /** + * Batch change branch. + * + * @param int $branchID + * @access public + * @return void + */ + public function batchChangeBranch($branchID) + { + if($this->post->bugIDList) + { + $bugIDList = $this->post->bugIDList; + $bugIDList = array_unique($bugIDList); + unset($_POST['bugIDList']); + $allChanges = $this->bug->batchChangeBranch($bugIDList, $branchID); + if(dao::isError()) die(js::error(dao::getError())); + foreach($allChanges as $bugID => $changes) + { + $this->loadModel('action'); + $actionID = $this->action->create('bug', $bugID, 'Edited'); + $this->action->logHistory($actionID, $changes); + $this->bug->sendmail($bugID, $actionID); + } + } + $this->loadModel('score')->create('ajax', 'batchOther'); + die(js::locate($this->session->bugList, 'parent')); + } + /** * Batch change the module of bug. * diff --git a/module/bug/model.php b/module/bug/model.php index 65e926525f..b6802cef13 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -869,6 +869,35 @@ class bugModel extends model $this->linkBugToBuild($bugID, $bug->resolvedBuild); } + /** + * Batch change branch. + * + * @param array $bugIDList + * @param int $branchID + * @access public + * @return array + */ + public function batchChangeBranch($bugIDList, $branchID) + { + $now = helper::now(); + $allChanges = array(); + $oldBugs = $this->getByList($bugIDList); + foreach($bugIDList as $bugID) + { + $oldBug = $oldBugs[$bugID]; + if($branchID == $oldBug->branch) continue; + + $bug = new stdclass(); + $bug->lastEditedBy = $this->app->user->account; + $bug->lastEditedDate = $now; + $bug->branch = $branchID; + + $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); + if(!dao::isError()) $allChanges[$bugID] = common::createChanges($oldBug, $bug); + } + return $allChanges; + } + /** * Batch change the module of bug. * diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 01e27a1313..d96aed6646 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -237,6 +237,23 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow $misc = common::hasPriv('bug', 'batchActivate') ? "onclick=\"setFormAction('$actionLink')\"" : $class; if($misc) echo "
  • " . html::a('javascript:;', $lang->bug->activate, '', $misc) . "
  • "; + if(common::hasPriv('bug', 'batchChangeBranch') and $this->session->currentProductType != 'normal') + { + $withSearch = count($branches) > 8; + echo "'; + } + if(common::hasPriv('bug', 'batchChangeModule')) { $withSearch = count($modules) > 8; diff --git a/module/cron/control.php b/module/cron/control.php index 0bd99db7a2..81fbe3592c 100644 --- a/module/cron/control.php +++ b/module/cron/control.php @@ -214,7 +214,6 @@ class cron extends control $log = ''; $time = $now->format('G:i:s'); $log = "$time task " . $id . " executed,\ncommand: $cron[command].\nreturn : $return.\noutput : $output\n"; - $log .= $this->app->company->name . "\n"; $this->cron->logCron($log); unset($log); } diff --git a/module/doc/view/showfiles.html.php b/module/doc/view/showfiles.html.php index 2a024e0daf..0d190921c9 100644 --- a/module/doc/view/showfiles.html.php +++ b/module/doc/view/showfiles.html.php @@ -133,7 +133,7 @@
    - objectID");?>'>title . '.' . $file->extension . ' [' . strtoupper($file->objectType) . ' #' . $file->objectID . ']';?> + objectID");?>' title='addedDate, 0, 10)?>'>title . '.' . $file->extension . ' [' . strtoupper($file->objectType) . ' #' . $file->objectID . ']';?> id"); ?>' target='hiddenwin' title='delete?>' class='delete pull-right'> diff --git a/module/git/control.php b/module/git/control.php index 88f37ce641..e513d6432f 100644 --- a/module/git/control.php +++ b/module/git/control.php @@ -32,7 +32,9 @@ class git extends control */ public function diff($path, $revision) { + if(isset($_GET['repoUrl'])) $path = $this->get->repoUrl; $path = helper::safe64Decode($path); + $this->view->path = $path; $this->view->revision = $revision; $this->view->diff = $this->git->diff($path, $revision); @@ -50,7 +52,9 @@ class git extends control */ public function cat($path, $revision) { + if(isset($_GET['repoUrl'])) $path = $this->get->repoUrl; $path = helper::safe64Decode($path); + $this->view->path = $path; $this->view->revision = $revision; $this->view->code = $this->git->cat($path, $revision); diff --git a/module/git/model.php b/module/git/model.php index ee564f1356..1932bc00b5 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -643,9 +643,8 @@ class gitModel extends model { foreach($actionFiles as $file) { - $param = array('url' => helper::safe64Encode($repoRoot . $file), 'revision' => $log->revision); - $catLink = trim(html::a(helper::createLink('git', 'cat', $param, 'html'), 'view', '', "class='repolink'")); - $diffLink = trim(html::a(helper::createLink('git', 'diff', $param, 'html'), 'diff', '', "class='repolink'")); + $catLink = trim(html::a($this->buildURL('cat', $repoRoot . $file, $log->revision), 'view', '', "class='repolink'")); + $diffLink = trim(html::a($this->buildURL('diff', $repoRoot . $file, $log->revision), 'diff', '', "class='repolink'")); $diff .= $action . " " . $file . " $catLink "; $diff .= $action == 'M' ? "$diffLink\n" : "\n" ; } @@ -747,4 +746,22 @@ class gitModel extends model { echo helper::now() . " $log\n"; } + + /** + * Build URL. + * + * @param string $methodName + * @param string $url + * @param int $revision + * @access public + * @return string + */ + public function buildURL($methodName, $url, $revision) + { + $buildedURL = helper::createLink('git', $methodName, "path=&revision=$revision", 'html'); + $buildedURL .= strpos($buildURL, '?') === false ? '?' : '&'; + $buildedURL .= 'repoUrl=' . helper::safe64Encode($url); + + return $buildedURL; + } } diff --git a/module/git/view/diff.html.php b/module/git/view/diff.html.php index 20c035297d..3c710254db 100644 --- a/module/git/view/diff.html.php +++ b/module/git/view/diff.html.php @@ -11,7 +11,7 @@ */ ?> - +git->buildURL('cat', $path, $revision);?>
    <?php echo $diff;?>
    diff --git a/module/story/control.php b/module/story/control.php index c7fbf2c8db..7b699d8107 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -673,7 +673,7 @@ class story extends control $this->story->review($storyID); if(dao::isError()) die(js::error(dao::getError())); $result = $this->post->result; - if($this->post->closedReason != '' and strpos('done,postponed,subdivided', $this->post->closedReason) === false) $result = 'pass'; + if($this->post->closedReason != '' and strpos('done,postponed,subdivided,willnotdo', $this->post->closedReason) === false) $result = 'pass'; $actionID = $this->action->create('story', $storyID, 'Reviewed', $this->post->comment, ucfirst($result)); $this->story->sendmail($storyID, $actionID); if($this->post->result == 'reject') diff --git a/module/svn/control.php b/module/svn/control.php index 78eb9cf9c9..1319e3c69c 100644 --- a/module/svn/control.php +++ b/module/svn/control.php @@ -32,7 +32,9 @@ class svn extends control */ public function diff($url, $revision) { + if(isset($_GET['repoUrl'])) $url = $this->get->repoUrl; $url = helper::safe64Decode($url); + $this->view->url = $url; $this->view->revision = $revision; $this->view->diff = $this->svn->diff($url, $revision); @@ -50,7 +52,9 @@ class svn extends control */ public function cat($url, $revision) { + if(isset($_GET['repoUrl'])) $url = $this->get->repoUrl; $url = helper::safe64Decode($url); + $this->view->url = $url; $this->view->revision = $revision; $this->view->code = $this->svn->cat($url, $revision); diff --git a/module/svn/model.php b/module/svn/model.php index 161337527c..1d8c2d8469 100644 --- a/module/svn/model.php +++ b/module/svn/model.php @@ -611,9 +611,8 @@ class svnModel extends model { foreach($actionFiles as $file) { - $param = array('url' => helper::safe64Encode($repoRoot . $file), 'revision' => $log->revision); - $catLink = trim(html::a(helper::createLink('svn', 'cat', $param, 'html'), 'view', '', "class='repolink'")); - $diffLink = trim(html::a(helper::createLink('svn', 'diff', $param, 'html'), 'diff', '', "class='repolink'")); + $catLink = trim(html::a($this->buildURL('cat', $repoRoot . $file, $log->revision), 'view', '', "class='repolink'")); + $diffLink = trim(html::a($this->buildURL('diff', $repoRoot . $file, $log->revision), 'diff', '', "class='repolink'")); $diff .= $action . " " . $file . " $catLink "; $diff .= $action == 'M' ? "$diffLink\n" : "\n" ; } @@ -715,4 +714,22 @@ class svnModel extends model { echo helper::now() . " $log\n"; } + + /** + * Build URL. + * + * @param string $methodName + * @param string $url + * @param int $revision + * @access public + * @return string + */ + public function buildURL($methodName, $url, $revision) + { + $buildedURL = helper::createLink('svn', $methodName, "url=&revision=$revision", 'html'); + $buildedURL .= strpos($buildedURL, '?') === false ? '?' : '&'; + $buildedURL .= 'repoUrl=' . helper::safe64Encode($url); + + return $buildedURL; + } } diff --git a/module/svn/view/diff.html.php b/module/svn/view/diff.html.php index e1ef71b6ee..a95e312446 100644 --- a/module/svn/view/diff.html.php +++ b/module/svn/view/diff.html.php @@ -11,7 +11,7 @@ */ ?> - +svn->buildURL('cat', $url, $revision);?>
    <?php echo $diff;?>
    diff --git a/module/testcase/control.php b/module/testcase/control.php index 8af632b6c3..457986003a 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -843,6 +843,33 @@ class testcase extends control die(js::locate($this->session->caseList)); } + /** + * Batch change branch. + * + * @param int $branchID + * @access public + * @return void + */ + public function batchChangeBranch($branchID) + { + if($this->post->caseIDList) + { + $caseIDList = $this->post->caseIDList; + $caseIDList = array_unique($caseIDList); + unset($_POST['caseIDList']); + $allChanges = $this->testcase->batchChangeBranch($caseIDList, $branchID); + if(dao::isError()) die(js::error(dao::getError())); + foreach($allChanges as $caseID => $changes) + { + $this->loadModel('action'); + $actionID = $this->action->create('case', $caseID, 'Edited'); + $this->action->logHistory($actionID, $changes); + } + } + + die(js::locate($this->session->caseList, 'parent')); + } + /** * Batch change the module of case. * diff --git a/module/testcase/model.php b/module/testcase/model.php index 71c96cdc83..41f9e6d163 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -819,6 +819,36 @@ class testcaseModel extends model return $allChanges; } + /** + * Batch change branch. + * + * @param array $caseIDList + * @param int $branchID + * @access public + * @return array + */ + public function batchChangeBranch($caseIDList, $branchID) + { + $now = helper::now(); + $allChanges = array(); + $oldCases = $this->getByList($caseIDList); + foreach($caseIDList as $caseID) + { + $oldCase = $oldCases[$caseID]; + if($branchID == $oldCase->branch) continue; + + $case = new stdclass(); + $case->lastEditedBy = $this->app->user->account; + $case->lastEditedDate = $now; + $case->branch = $branchID; + + $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->where('id')->eq((int)$caseID)->exec(); + if(!dao::isError()) $allChanges[$caseID] = common::createChanges($oldCase, $case); + } + + return $allChanges; + } + /** * Batch change the module of case. * diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index 7a2d74378d..5568136d72 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -128,6 +128,23 @@ js::set('branch', $branch); $misc = common::hasPriv('testtask', 'batchRun') ? "onclick=\"setFormAction('$actionLink')\"" : $class; echo "
  • " . html::a('#', $lang->testtask->runCase, '', $misc) . "
  • "; + if(common::hasPriv('testcase', 'batchChangeBranch') and $this->session->currentProductType != 'normal') + { + $withSearch = count($branches) > 8; + echo "'; + } + if(common::hasPriv('testcase', 'batchChangeModule')) { $withSearch = count($modules) > 8;