From 452ab148f00e7722f88c5d7edfab751ec54c07d2 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 13 Dec 2017 13:11:20 +0800 Subject: [PATCH 1/6] * remove test code. --- module/cron/control.php | 1 - 1 file changed, 1 deletion(-) 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); } From 22f4518437df60985ce26d35fc49cba9208f52e5 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 13 Dec 2017 13:38:46 +0800 Subject: [PATCH 2/6] * finish task #3383. --- module/git/control.php | 4 ++++ module/git/model.php | 23 ++++++++++++++++++++--- module/git/view/diff.html.php | 2 +- module/svn/control.php | 4 ++++ module/svn/model.php | 23 ++++++++++++++++++++--- module/svn/view/diff.html.php | 2 +- 6 files changed, 50 insertions(+), 8 deletions(-) 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/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;?>
From 526dad43d3a478df6212c7511e465af87a6e5f12 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 13 Dec 2017 14:07:25 +0800 Subject: [PATCH 3/6] * finish task #3394. --- module/story/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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') From 6006f3e93a5fe76f6ced9a20059fa390971f9ba3 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 13 Dec 2017 14:22:09 +0800 Subject: [PATCH 4/6] * finish task #3397. --- config/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); From 221291c0f3142663653dac749eaafb898474e246 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 13 Dec 2017 15:52:36 +0800 Subject: [PATCH 5/6] * finish task #3429. --- module/bug/control.php | 28 ++++++++++++++++++++++++++ module/bug/model.php | 29 +++++++++++++++++++++++++++ module/bug/view/browse.html.php | 17 ++++++++++++++++ module/testcase/control.php | 27 +++++++++++++++++++++++++ module/testcase/model.php | 30 ++++++++++++++++++++++++++++ module/testcase/view/browse.html.php | 17 ++++++++++++++++ 6 files changed, 148 insertions(+) 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/testcase/control.php b/module/testcase/control.php index b4d14ed56b..f0b26653a1 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -842,6 +842,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 276b169a29..6bcd2e5f27 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -817,6 +817,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; From 5fc4f0dadb26c058299098dcdf2cce88490deac0 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 13 Dec 2017 16:06:00 +0800 Subject: [PATCH 6/6] * finish task #3433. --- module/doc/view/showfiles.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@