This commit is contained in:
滔哥
2017-12-13 16:41:43 +08:00
16 changed files with 201 additions and 12 deletions
+1 -1
View File
@@ -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();
+28
View File
@@ -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.
*
+29
View File
@@ -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.
*
+17
View File
@@ -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 "<li>" . html::a('javascript:;', $lang->bug->activate, '', $misc) . "</li>";
if(common::hasPriv('bug', 'batchChangeBranch') and $this->session->currentProductType != 'normal')
{
$withSearch = count($branches) > 8;
echo "<li class='dropdown-submenu'>";
echo html::a('javascript:;', $lang->product->branchName[$this->session->currentProductType], '', "id='branchItem'");
echo "<div class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
echo "<ul class='dropdown-list'>";
foreach($branches as $branchID => $branchName)
{
$actionLink = $this->createLink('bug', 'batchChangeBranch', "branchID=$branchID");
echo "<li class='option' data-key='$branchID'>" . html::a('#', $branchName, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"") . "</li>";
}
echo '</ul>';
if($withSearch) echo "<div class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></div>";
echo '</div></li>';
}
if(common::hasPriv('bug', 'batchChangeModule'))
{
$withSearch = count($modules) > 8;
-1
View File
@@ -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);
}
+1 -1
View File
@@ -133,7 +133,7 @@
<i class='icon icon-download'></i>
</a>
<div class='card-heading'>
<a href='<?php echo $this->createLink($file->objectType, 'view', "objectID=$file->objectID");?>'><?php echo $file->title . '.' . $file->extension . ' [' . strtoupper($file->objectType) . ' #' . $file->objectID . ']';?></a>
<a href='<?php echo $this->createLink($file->objectType, 'view', "objectID=$file->objectID");?>' title='<?php echo substr($file->addedDate, 0, 10)?>'><?php echo $file->title . '.' . $file->extension . ' [' . strtoupper($file->objectType) . ' #' . $file->objectID . ']';?></a>
<?php if(common::hasPriv('file', 'delete')): ?>
<a href='<?php echo $this->createLink('file', 'delete', "fileID=$file->id"); ?>' target='hiddenwin' title='<?php echo $lang->delete?>' class='delete pull-right'><i class='icon icon-remove'></i></a>
<?php endif?>
+4
View File
@@ -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);
+20 -3
View File
@@ -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;
}
}
+1 -1
View File
@@ -11,7 +11,7 @@
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<?php $catLink = inlink('cat', 'url=' . helper::safe64Encode($path) . "&revision=$revision");?>
<?php $catLink = $this->git->buildURL('cat', $path, $revision);?>
<div class='box-title'><?php echo html::a($catLink, "$path@$revision");?></div>
<div class='box-content'><xmp><?php echo $diff;?></xmp></div>
<?php include '../../common/view/footer.lite.html.php';?>
+1 -1
View File
@@ -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')
+4
View File
@@ -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);
+20 -3
View File
@@ -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;
}
}
+1 -1
View File
@@ -11,7 +11,7 @@
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<?php $catLink = inlink('cat', 'url=' . helper::safe64Encode($url) . "&revision=$revision");?>
<?php $catLink = $this->svn->buildURL('cat', $url, $revision);?>
<div class='box-title'><?php echo html::a($catLink, "$url@$revision");?></div>
<div class='box-content'><xmp><?php echo $diff;?></xmp></div>
<?php include '../../common/view/footer.lite.html.php';?>
+27
View File
@@ -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.
*
+30
View File
@@ -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.
*
+17
View File
@@ -128,6 +128,23 @@ js::set('branch', $branch);
$misc = common::hasPriv('testtask', 'batchRun') ? "onclick=\"setFormAction('$actionLink')\"" : $class;
echo "<li>" . html::a('#', $lang->testtask->runCase, '', $misc) . "</li>";
if(common::hasPriv('testcase', 'batchChangeBranch') and $this->session->currentProductType != 'normal')
{
$withSearch = count($branches) > 8;
echo "<li class='dropdown-submenu'>";
echo html::a('javascript:;', $lang->product->branchName[$this->session->currentProductType], '', "id='branchItem'");
echo "<div class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
echo "<ul class='dropdown-list'>";
foreach($branches as $branchID => $branchName)
{
$actionLink = $this->createLink('testcase', 'batchChangeBranch', "branchID=$branchID");
echo "<li class='option' data-key='$branchID'>" . html::a('#', $branchName, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"") . "</li>";
}
echo '</ul>';
if($withSearch) echo "<div class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></div>";
echo '</div></li>';
}
if(common::hasPriv('testcase', 'batchChangeModule'))
{
$withSearch = count($modules) > 8;