This commit is contained in:
Catouse
2019-11-22 11:07:01 +08:00
10 changed files with 99 additions and 58 deletions
+3
View File
@@ -1419,6 +1419,9 @@ EOD;
if(isset($this->app->user))
{
if(!defined('IN_UPGRADE')) $this->session->user->view = $this->loadModel('user')->grantUserView();
$this->app->user = $this->session->user;
if(!commonModel::hasPriv($module, $method)) $this->deny($module, $method);
}
else
+7 -6
View File
@@ -3,6 +3,7 @@ $lang->dev->common = 'Develop';
$lang->dev->api = 'API';
$lang->dev->db = 'Database';
$lang->dev->editor = 'Editor';
$lang->dev->translate = 'Translate';
$lang->dev->dbList = 'Database';
$lang->dev->moduleList = 'Modules';
$lang->dev->params = 'Parameters';
@@ -11,10 +12,12 @@ $lang->dev->desc = 'Description';
$lang->dev->noParams = 'No Parameters';
$lang->dev->post = 'POST Parameter';
$lang->dev->paramRange = 'Parameter Range: %s';
$lang->dev->paramDate = 'Date format: YY-mm-dd, e.g 2019-01-01';
$lang->dev->paramColor = 'Color format: #RGB, e.g. #3da7f5';
$lang->dev->paramMailto = "User account. Separate accounts by ','.";
$lang->dev->paramRange = 'Parameter Range: %s';
$lang->dev->paramDate = 'Date format: YY-mm-dd, e.g 2019-01-01';
$lang->dev->paramColor = 'Color format: #RGB, e.g. #3da7f5';
$lang->dev->paramMailto = "User account. Separate accounts by ','.";
$lang->dev->noteEditor = "The editor is disabled for security reasons. To use this feature, please go to the official website to download and install the plugin of the editor.";
$lang->dev->noteTranslate = "The translation is disabled for security reasons. To use this feature, please go to the official website to download and install the plugin of translation.";
$lang->dev->fields = array();
$lang->dev->fields['id'] = 'ID';
@@ -71,7 +74,6 @@ $lang->dev->tableList['backup'] = 'Backup';
$lang->dev->tableList['common'] = 'Common';
$lang->dev->tableList['convert'] = 'Convert';
$lang->dev->tableList['dev'] = 'Develop';
$lang->dev->tableList['editor'] = 'Editor';
$lang->dev->tableList['git'] = 'GIT';
$lang->dev->tableList['index'] = 'Home';
$lang->dev->tableList['install'] = 'Install';
@@ -94,7 +96,6 @@ $lang->dev->tableList['block'] = 'Block';
$lang->dev->tableList['branch'] = 'Branch';
$lang->dev->tableList['doccontent'] = 'Doc Content';
$lang->dev->tableList['storystage'] = 'Story Phase';
$lang->dev->tableList['translate'] = 'Translate';
$lang->dev->tableList['tutorial'] = 'Tutorial';
$lang->dev->tableList['suitecase'] = 'Suite Case';
$lang->dev->tableList['score'] = 'Score';
+2 -2
View File
@@ -16,8 +16,8 @@ $lang->dev->paramRange = '取值范围:%s';
$lang->dev->paramDate = '日期格式:YY-mm-dd,如:2019-01-01';
$lang->dev->paramColor = '颜色格式:#RGB,如:#3da7f5';
$lang->dev->paramMailto = "填写帐号,多个账号用','分隔。";
$lang->dev->noteEditor = "编辑器功能因为安全原因被禁用。如果想用该功能,请到官网下载安装 扩展编辑器 插件。";
$lang->dev->noteTranslate = "翻译功能因为安全原因被禁用。如果想用该功能,请到官网下载安装 翻译 插件。";
$lang->dev->noteEditor = "编辑器功能因为安全原因被禁用。使用该功能,请到官网下载安装 扩展编辑器 插件。";
$lang->dev->noteTranslate = "翻译功能因为安全原因被禁用。使用该功能,请到官网下载安装 翻译 插件。";
$lang->dev->fields = array();
$lang->dev->fields['id'] = '序号';
+4 -2
View File
@@ -1416,8 +1416,10 @@ class projectModel extends model
$this->loadModel('task');
$this->loadModel('story');
$now = helper::now();
$modules = $this->loadModel('tree')->getTaskOptionMenu($projectID);
$now = helper::now();
$showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$modules = $this->loadModel('tree')->getTaskOptionMenu($projectID, 0, 0, $showAllModule ? 'allModule' : '');
$bugToTasks = fixer::input('post')->get();
$bugs = $this->bug->getByList(array_keys($bugToTasks->import));
+22 -13
View File
@@ -174,7 +174,8 @@ class task extends control
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID);
$showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID, 0, 0, $showAllModule ? 'allModule' : '');
/* Fix bug #2737. When moduleID is not story module. */
$moduleIdList = array();
@@ -194,8 +195,9 @@ class task extends control
foreach(explode(',', $this->config->task->customCreateFields) as $field) $customFields[$field] = $this->lang->task->$field;
if($project->type == 'ops') unset($customFields['story']);
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->task->custom->createFields;
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->task->custom->createFields;
$this->view->showAllModule = $showAllModule;
$this->view->title = $title;
$this->view->position = $position;
@@ -253,9 +255,13 @@ class task extends control
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->task->custom->batchCreateFields;
$stories = $this->story->getProjectStoryPairs($projectID, 0, 0, 0, 'short');
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$modules = $this->loadModel('tree')->getTaskOptionMenu($projectID);
$showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$modules = $this->loadModel('tree')->getTaskOptionMenu($projectID, 0, 0, $showAllModule ? 'allModule' : '');
$title = $project->name . $this->lang->colon . $this->lang->task->batchCreate;
$position[] = html::a($taskLink, $project->name);
$position[] = $this->lang->task->common;
@@ -359,13 +365,14 @@ class task extends control
if(isset($tasks[$taskID])) unset($tasks[$taskID]);
if(!isset($this->view->members[$this->view->task->assignedTo])) $this->view->members[$this->view->task->assignedTo] = $this->view->task->assignedTo;
$this->view->title = $this->lang->task->edit . 'TASK' . $this->lang->colon . $this->view->task->name;
$this->view->position[] = $this->lang->task->common;
$this->view->position[] = $this->lang->task->edit;
$this->view->stories = $this->story->getProjectStoryPairs($this->view->project->id);
$this->view->tasks = $tasks;
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', "{$this->view->task->openedBy},{$this->view->task->canceledBy},{$this->view->task->closedBy}");
$this->view->modules = $this->tree->getTaskOptionMenu($this->view->task->project);
$this->view->title = $this->lang->task->edit . 'TASK' . $this->lang->colon . $this->view->task->name;
$this->view->position[] = $this->lang->task->common;
$this->view->position[] = $this->lang->task->edit;
$this->view->stories = $this->story->getProjectStoryPairs($this->view->project->id);
$this->view->tasks = $tasks;
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', "{$this->view->task->openedBy},{$this->view->task->canceledBy},{$this->view->task->closedBy}");
$this->view->showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$this->view->modules = $this->tree->getTaskOptionMenu($this->view->task->project, 0, 0, $this->view->showAllModule ? 'allModule' : '');
$this->display();
}
@@ -420,8 +427,10 @@ class task extends control
$this->project->setMenu($this->project->getPairs(), $project->id);
/* Set modules and members. */
$modules = $this->tree->getTaskOptionMenu($projectID);
$modules = array('ditto' => $this->lang->task->ditto) + $modules;
$showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : '';
$modules = $this->tree->getTaskOptionMenu($projectID, 0, 0, $showAllModule ? 'allModule' : '');
$modules = array('ditto' => $this->lang->task->ditto) + $modules;
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$members = array('' => '', 'ditto' => $this->lang->task->ditto) + $members;
$members['closed'] = 'Closed';
+1 -1
View File
@@ -44,7 +44,7 @@
<td id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $task->module, "class='form-control chosen' onchange='setStories(this.value, $project->id)'");?></td>
<td>
<div class="checkbox-primary">
<input type="checkbox" id="showAllModule"><label for="showAllModule" class="no-margin"><?php echo $lang->task->allModule;?></label>
<input type="checkbox" id="showAllModule" <?php if($showAllModule) echo 'checked';?>><label for="showAllModule" class="no-margin"><?php echo $lang->task->allModule;?></label>
</div>
</td>
<td></td>
+1 -1
View File
@@ -101,7 +101,7 @@
<span class='table-col' id="moduleIdBox"><?php echo html::select('module', $modules, $task->module, 'class="form-control chosen" onchange="loadModuleRelated()"');?></span>
<span class='table-col w-100px text-middle pl-10px'>
<div class="checkbox-primary">
<input type="checkbox" id="showAllModule"><label for="showAllModule" class="no-margin"><?php echo $lang->task->allModule;?></label>
<input type="checkbox" id="showAllModule" <?php if($showAllModule) echo 'checked';?>><label for="showAllModule" class="no-margin"><?php echo $lang->task->allModule;?></label>
</div>
</span>
</div>
+1 -1
View File
@@ -25,7 +25,7 @@
<td><?php echo zget($users, $case->lastRunner);?></td>
<td><?php echo substr($case->lastRunDate, 2);?></td>
<td><?php echo zget($lang->testcase->resultList, $case->lastRunResult);?></td>
<?php $status = $this->processStatus('testcase', $case);?>
<?php $status = zget($lang->testtask->statusList, $case->status);?>
<td title='<?php echo $status;?>'>
<span class="status-case status-<?php echo $case->status?>"><?php echo $status;?></span>
</td>
+57 -31
View File
@@ -535,9 +535,10 @@ class upgradeModel extends model
$this->saveLogs('Execute 11_6_5');
$this->execSQL($this->getUpgradeFile('11.6.5'));
$this->fixGroupAcl();
$this->appendExec('11_6_5');
case '11_6_6':
$this->fixBugTypeList();
$this->adjustPriv11_6_6();
$this->rmEditorAndTranslateDir();
$this->appendExec('11_6_5');
}
$this->deletePatch();
@@ -687,6 +688,7 @@ class upgradeModel extends model
case '11_6_2' :
case '11_6_3' :
case '11_6_4' : $confirmContent .= file_get_contents($this->getUpgradeFile('11.6.4'));
case '11_6_5' : $confirmContent .= file_get_contents($this->getUpgradeFile('11.6.5'));
}
return str_replace('zt_', $this->config->db->prefix, $confirmContent);
}
@@ -3458,35 +3460,6 @@ class upgradeModel extends model
return true;
}
/**
* Save Logs.
*
* @param string $log
* @access public
* @return void
*/
public function saveLogs($log)
{
$logFile = $this->app->getTmpRoot() . 'log/upgrade.' . date('Ymd') . '.log.php';
$log = date('Y-m-d H:i:s') . ' ' . trim($log) . "\n";
if(!file_exists($logFile)) $log = "<?php\ndie();\n?" . ">\n" . $log;
static $fh;
if(empty($fh)) $fh = fopen($logFile, 'a');
fwrite($fh, $log);
}
/**
* Append execute for pro and biz.
*
* @param string $fromVersion
* @access public
* @return void
*/
public function appendExec($zentaoVersion)
{
}
/**
* Fix bug typeList.
*
@@ -3495,6 +3468,8 @@ class upgradeModel extends model
*/
public function fixBugTypeList()
{
$this->saveLogs('Run Method ' . __FUNCTION__);
foreach($this->config->upgrade->discardedBugTypes as $langCode => $types)
{
$bugs = $this->dao->select('type')->from(TABLE_BUG)->where('type')->in(array_keys($types))->fetchAll('type');
@@ -3530,4 +3505,55 @@ class upgradeModel extends model
}
return true;
}
/**
* Remove editor and translate.
*
* @access public
* @return bool
*/
public function rmEditorAndTranslateDir()
{
$this->saveLogs('Run Method ' . __FUNCTION__);
$zfile = $this->app->loadClass('zfile');
$moduleRoot = $this->app->getModuleRoot();
$editorDir = $moduleRoot . 'editor';
if(is_dir($editor)) $zfile->removeDir($editorDir);
$translateDir = $moduleRoot . 'translate';
if(is_dir($translateDir)) $zfile->removeDir($translateDir);
return true;
}
/**
* Save Logs.
*
* @param string $log
* @access public
* @return void
*/
public function saveLogs($log)
{
$logFile = $this->app->getTmpRoot() . 'log/upgrade.' . date('Ymd') . '.log.php';
$log = date('Y-m-d H:i:s') . ' ' . trim($log) . "\n";
if(!file_exists($logFile)) $log = "<?php\ndie();\n?" . ">\n" . $log;
static $fh;
if(empty($fh)) $fh = fopen($logFile, 'a');
fwrite($fh, $log);
}
/**
* Append execute for pro and biz.
*
* @param string $fromVersion
* @access public
* @return void
*/
public function appendExec($zentaoVersion)
{
}
}
+1 -1
View File
@@ -170,7 +170,7 @@ class webhook extends control
$response = $dingapi->getAllUsers();
if($response['result'] == 'fail')
{
echo js::error($response->message);
echo js::error($response['message']);
die(js::locate($this->createLink('webhook', 'browse')));
}