Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms into sprint/tsj_uinttest

This commit is contained in:
caoyanyi
2023-01-29 10:24:01 +08:00
94 changed files with 556 additions and 435 deletions
+1 -1
View File
@@ -417,7 +417,7 @@ $config->pipelineTypeList = array('gitlab', 'gogs', 'gitea', 'jenkins', 'sonarqu
$config->programPriv = new stdclass();
$config->programPriv->noSprint = array('task', 'story', 'tree', 'project', 'execution', 'build', 'bug', 'testcase', 'testreport', 'doc', 'repo', 'stakeholder', 'projectrelease', 'requirement');
$config->programPriv->scrum = array('story', 'requirement', 'productplan', 'tree', 'projectplan', 'projectstory', 'projectrelease', 'project', 'execution', 'build', 'bug', 'testcase', 'testreport', 'doc', 'repo', 'meeting', 'stakeholder', 'testtask');
$config->programPriv->waterfall = array_merge($config->programPriv->scrum, array('task', 'workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'issue', 'risk', 'opportunity', 'measrecord', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport'));
$config->programPriv->waterfall = array_merge($config->programPriv->scrum, array('workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'issue', 'risk', 'opportunity', 'measrecord', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport'));
$config->waterfallModules = array('workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'opportunity', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport');
+18 -6
View File
@@ -1822,11 +1822,6 @@ class bug extends control
if(!isset($users[$assignedTo])) $assignedTo = $this->bug->getModuleOwner($bug->module, $productID);
unset($this->lang->bug->resolutionList['tostory']);
$product = $this->loadModel('product')->getById($productID);
$branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : '';
$productBugs = $this->bug->getProductBugPairs($productID, $branch);
unset($productBugs[$bugID]);
$this->bug->checkBugExecutionPriv($bug);
$this->qa->setMenu($this->products, $productID, $bug->branch);
@@ -1834,7 +1829,6 @@ class bug extends control
$this->view->bug = $bug;
$this->view->users = $users;
$this->view->assignedTo = $assignedTo;
$this->view->productBugs = $productBugs;
$this->view->executions = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID, 'stagefilter');
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $bug->branch, 'withbranch,noreleased');
$this->view->actions = $this->action->getList('bug', $bugID);
@@ -2476,6 +2470,24 @@ class bug extends control
return print(html::select('assignedTo', $productMembers, $selectedUser, 'class="form-control"'));
}
/**
* Ajax get product bugs.
*
* @param int $productID
* @param int $bugID
* @access public
* @return string
*/
public function ajaxGetProductBugs($productID, $bugID)
{
$product = $this->loadModel('product')->getById($productID);
$branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : '';
$productBugs = $this->bug->getProductBugPairs($productID, $branch);
unset($productBugs[$bugID]);
return print(html::select('duplicateBug', $productBugs, '', "class='form-control' placeholder='{$this->lang->bug->duplicateTip}'"));
}
/**
* Ajax get project team members.
*
+1 -1
View File
@@ -298,7 +298,7 @@ function loadProductModules(productID)
if(typeof(branch) == 'undefined') branch = 0;
if(typeof(moduleID) == 'undefined') moduleID = 0;
if(config.currentMethod == 'edit') moduleID = $('#module').val();
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=' + moduleID);
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=nodeleted&currentModuleID=' + moduleID);
$('#moduleIdBox').load(link, function()
{
$(this).find('select').chosen()
+12
View File
@@ -2,6 +2,18 @@ function setDuplicate(resolution)
{
if(resolution == 'duplicate')
{
$.ajaxSettings.async = false;
$.get(createLink('bug', 'ajaxGetProductBugs', 'projectID=' + productID + '&bugID=' + bugID),function(data)
{
$('#duplicateBug').replaceWith(data);
$('#pk_duplicateBug-search').parent().parent().remove();
$('#duplicateBug').picker(
{
disableEmptySearch : true,
dropWidth : 'auto'
});
});
$.ajaxSettings.async = true;
$('#duplicateBugBox').show();
}
else
+2
View File
@@ -1023,6 +1023,7 @@ class bugModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('assignedDate', $now)
->setDefault('mailto', '')
->stripTags($this->config->bug->editor->assignto['id'], $this->config->allowedTags)
->remove('comment,showModule')
->join('mailto', ',')
@@ -1060,6 +1061,7 @@ class bugModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('assignedDate', $now)
->setDefault('mailto', '')
->stripTags($this->config->bug->editor->confirmbug['id'], $this->config->allowedTags)
->remove('comment')
->join('mailto', ',')
+2 -1
View File
@@ -16,6 +16,7 @@
<?php
js::set('page', 'resolve');
js::set('productID', $bug->product);
js::set('bugID', $bug->id);
js::set('released', $lang->build->released);
?>
<div id='mainContent' class='main-content'>
@@ -39,7 +40,7 @@ js::set('released', $lang->build->released);
</tr>
<tr id='duplicateBugBox' class='hide'>
<th><?php echo $lang->bug->duplicateBug;?></th>
<td class='required'><?php echo html::select('duplicateBug', $productBugs, '', "class='form-control' placeholder='{$lang->bug->duplicateTip}'");?></td>
<td class='required'><?php echo html::select('duplicateBug', '', '', "class='form-control' placeholder='{$lang->bug->duplicateTip}'");?></td>
</tr>
<tr>
<th><?php echo $lang->bug->resolvedBuild;?></th>
-33
View File
@@ -1,33 +0,0 @@
<style>
#successModal #modalLink{color: #2e7fff;text-decoration: underline;}
#successModal .modal-dialog .modal-content{border: 2px solid #75e5c4; background-color: #f1fcf9; border-radius: 4px;}
#successModal .icon-check-circle{color: #17ce97; margin-right: 10px; font-size: 20px;}
#successModal .modal-dialog{width: fit-content;}
#successModal .modal-dialog{border-radius: 4px;}
#successModal .modal-header{padding:9px 15px 0px; margin:0px; border-bottom:0;}
#successModal .modal-dialog .modal-body{padding: 5px 15px 20px 15px;}
</style>
<div class="modal fade" id="successModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<?php echo html::a($closeLink, '×', '', 'class="close"');?>
</div>
<div class="modal-body">
<p>
<i class="icon-check-circle icon"></i><?php echo $notice;?>
<?php $modalLink = !empty($modalLink) ? $modalLink : '';?>
<?php $class = !empty($modalClass) ? $modalClass : '';?>
<?php echo html::a($modalLink, $buttonName, '', "id='modalLink' class='$class'");?>
</p>
</div>
</div>
</div>
</div>
<script>
function showModal(url = '')
{
if(url) $("#modalLink").attr('href', url);
$('#successModal').modal('show', 'center');
}
</script>
+2 -1
View File
@@ -282,7 +282,7 @@ class execution extends control
/* Get tasks and group them. */
if(empty($groupBy))$groupBy = 'story';
if(($groupBy == 'story') and ($execution->type == 'ops'))$groupBy = 'status';
if(($groupBy == 'story') and ($execution->lifetime == 'ops')) $groupBy = 'status';
$sort = common::appendOrder($groupBy);
$tasks = $this->loadModel('task')->getExecutionTasks($executionID, $productID = 0, $status = 'all', $modules = 0, $sort);
$groupBy = str_replace('`', '', $groupBy);
@@ -2657,6 +2657,7 @@ class execution extends control
unset($this->lang->kanban->type['story']);
unset($this->lang->kanban->type['bug']);
unset($this->lang->kanban->type['all']);
unset($this->lang->kanban->group->task['story']);
}
if($groupBy == 'story' and $browseType == 'task' and !isset($this->lang->kanban->orderList[$orderBy])) $orderBy = 'id_asc';
+26
View File
@@ -41,3 +41,29 @@ function adjustTableFooter()
$('.table-footer').css({'left': 0, 'bottom': 0, 'width': 'unset'});
}
}
/**
* Ajax refresh.
*
* @access public
* @return void
*/
function ajaxRefresh()
{
var $table = $('#executionTaskForm').closest('[data-ride="table"]');
if($table.length)
{
var table = $table.data('zui.table');
if(table)
{
table.options.replaceId = 'executionTaskForm';
table.reload();
}
}
$.get(location.href, function(data)
{
var $data = $(data);
$('#mainMenu > div.btn-toolbar.pull-left').html($data.find('#mainMenu > div.btn-toolbar.pull-left').html());
if($data.find('#mainContent .main-col .table-empty-tip').length) $('#mainContent .main-col').html($data.find('#mainContent .main-col'));
});
}
+1 -1
View File
@@ -103,7 +103,7 @@
<?php foreach($lang->execution->groups as $key => $value):?>
<?php
if(empty($key)) continue;
if($execution->type == 'ops' && $key == 'story') continue;
if($execution->lifetime == 'ops' && $key == 'story') continue;
$active = $key == $groupBy ? "class='active'" : '';
echo "<li $active>"; common::printLink('execution', 'groupTask', "execution=$executionID&groupBy=$key", $value); echo '</li>';
?>
+2 -2
View File
@@ -62,7 +62,7 @@ body {margin-bottom: 25px;}
common::sortFeatureMenu();
foreach(customModel::getFeatureMenu('execution', 'task') as $menuItem)
{
if($execution->type == 'ops' && $menuItem->name == 'needconfirm') continue;
if($execution->lifetime == 'ops' && $menuItem->name == 'needconfirm') continue;
if(isset($menuItem->hidden)) continue;
$menuType = $menuItem->name;
if($menuType == 'QUERY')
@@ -215,7 +215,7 @@ body {margin-bottom: 25px;}
if($useDatatable) include '../../common/view/datatable.html.php';
$customFields = $this->datatable->getSetting('execution');
if($execution->type == 'ops')
if($execution->lifetime == 'ops')
{
foreach($customFields as $id => $customField)
{
+2 -2
View File
@@ -28,7 +28,7 @@
foreach(customModel::getFeatureMenu('execution', 'task') as $menuItem)
{
if($execution->type == 'ops' && $menuItem->name == 'needconfirm') continue;
if($execution->lifetime == 'ops' && $menuItem->name == 'needconfirm') continue;
if(isset($menuItem->hidden)) continue;
$menuType = $menuItem->name;
if(strpos($menuType, 'QUERY') === 0)
@@ -74,7 +74,7 @@
foreach ($lang->execution->groups as $key => $value)
{
if($key == '') continue;
if($execution->type == 'ops' && $key == 'story') continue;
if($execution->lifetime == 'ops' && $key == 'story') continue;
echo '<li' . ($key == $groupBy ? " class='active'" : '') . '>';
common::printLink('execution', 'groupTask', "execution=$executionID&groupBy=$key", $value);
}
+1 -1
View File
@@ -45,7 +45,7 @@
<?php echo !empty($task->desc) ? $task->desc : "<div class='text-center text-muted'>" . $lang->noData . '</div>';?>
</div>
</div>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<?php if($task->fromBug != 0):?>
<div class="detail" open>
<div class="detail-title"><?php echo $lang->bug->steps;?></div>
+1
View File
@@ -1197,6 +1197,7 @@ class kanban extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
$productPairs = $this->product->getPairs('', 0, '', 'all');
$productPairs = array($this->lang->kanban->allProducts) + $productPairs;
$selectedProductID = empty($selectedProductID) ? key($productPairs) : $selectedProductID;
/* Waterfall project has no plan. */
+10 -2
View File
@@ -144,7 +144,7 @@ class messageModel extends model
$table = $this->config->objectTables[$objectType];
$field = $this->config->action->objectNameFields[$objectType];
$object = $this->dao->select('*')->from($table)->where('id')->eq($objectID)->fetch();
$toList = $this->getToList($object, $objectType);
$toList = $this->getToList($object, $objectType, $actionID);
if(empty($toList)) return false;
if($toList == $actor) return false;
@@ -181,10 +181,11 @@ class messageModel extends model
*
* @param object $object
* @param string $objectType
* @param int $actionID
* @access public
* @return string
*/
public function getToList($object, $objectType)
public function getToList($object, $objectType, $actionID = 0)
{
$toList = '';
if(!empty($object->assignedTo)) $toList = $object->assignedTo;
@@ -211,6 +212,13 @@ class messageModel extends model
if($toList == 'closed') $toList = '';
if($objectType == 'feedback' and $object->status == 'replied') $toList = ',' . $object->openedBy . ',';
if($objectType == 'story' and $actionID)
{
$action = $this->loadModel('action')->getById($actionID);
list($toList, $ccList) = $this->loadModel($objectType)->getToAndCcList($object, $action->action);
$toList = $toList . $ccList;
}
return $toList;
}
+1
View File
@@ -230,6 +230,7 @@ class misc extends control
*/
public function captcha($sessionVar = 'captcha', $uuid = '')
{
if($sessionVar == 'user') die('The string user is not allowed to be defined as a session field.');
$obLevel = ob_get_level();
for($i = 0; $i < $obLevel; $i++) ob_end_clean();
+13 -10
View File
@@ -1154,18 +1154,20 @@ EOF;
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'workFeedback');
$storyIdList = $bugIdList = $todoIdList = $taskIdList = array();
$storyIdList = $bugIdList = $todoIdList = $taskIdList = $ticketIdList = array();
foreach($feedbacks as $feedback)
{
if($feedback->solution == 'tobug') $bugIdList[] = $feedback->result;
if($feedback->solution == 'tostory') $storyIdList[] = $feedback->result;
if($feedback->solution == 'totodo') $todoIdList[] = $feedback->result;
if($feedback->solution == 'totask') $taskIdList[] = $feedback->result;
if($feedback->solution == 'tobug') $bugIdList[] = $feedback->result;
if($feedback->solution == 'tostory') $storyIdList[] = $feedback->result;
if($feedback->solution == 'totodo') $todoIdList[] = $feedback->result;
if($feedback->solution == 'totask') $taskIdList[] = $feedback->result;
if($feedback->solution == 'ticket') $ticketIdList[] = $feedback->result;
}
$bugs = $bugIdList ? $this->loadModel('bug')->getByList($bugIdList) : array();
$stories = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array();
$todos = $todoIdList ? $this->loadModel('todo')->getByList($todoIdList) : array();
$tasks = $taskIdList ? $this->loadModel('task')->getByList($taskIdList) : array();
$bugs = $bugIdList ? $this->loadModel('bug')->getByList($bugIdList) : array();
$stories = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array();
$todos = $todoIdList ? $this->loadModel('todo')->getByList($todoIdList) : array();
$tasks = $taskIdList ? $this->loadModel('task')->getByList($taskIdList) : array();
$tickets = $ticketIdList ? $this->loadModel('ticket')->getByList($ticketIdList) : array();
$products = $this->loadModel('product')->getPairs();
@@ -1199,9 +1201,10 @@ EOF;
$this->view->todos = $todos;
$this->view->stories = $stories;
$this->view->tasks = $tasks;
$this->view->tickets = $tickets;
$this->view->depts = $this->loadModel('dept')->getOptionMenu();
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed');
$this->view->projects = $this->loadModel('project')->getPairsByProgram(0, 'noclosed');
$this->view->projects = $this->loadModel('project')->getPairsByProgram('', 'noclosed');
$this->view->allProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->fetchPairs('id', 'name');
$this->view->modulePairs = $this->tree->getModulePairs(0, 'feedback');
$this->view->modules = $this->tree->getOptionMenu(0, $viewType = 'feedback', 0);
+8 -8
View File
@@ -54,14 +54,14 @@ class programplanModel extends model
{
if(empty($executionID)) return array();
$plans = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t2.type')->eq('stage')
->beginIF($productID)->andWhere('t1.product')->eq($productID)->fi()
->beginIF($browseType == 'all')->andWhere('t2.project')->eq($executionID)->fi()
->beginIF($browseType == 'parent')->andWhere('t2.parent')->eq($executionID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
->andWhere('t2.deleted')->eq('0')
$plans = $this->dao->select('t1.*')->from(TABLE_EXECUTION)->alias('t1')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id = t2.project')
->where('t1.type')->eq('stage')
->beginIF($productID)->andWhere('t2.product')->eq($productID)->fi()
->beginIF($browseType == 'all')->andWhere('t1.project')->eq($executionID)->fi()
->beginIF($browseType == 'parent')->andWhere('t1.parent')->eq($executionID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()
->andWhere('t1.deleted')->eq('0')
->orderBy($orderBy)
->fetchAll('id');
+2 -1
View File
@@ -827,7 +827,8 @@ class projectModel extends model
->where('type')->eq('project')
->andWhere('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->beginIF($programID !== '')->andWhere('path')->like("%,$programID,%")->fi()
->beginIF(!empty($programID))->andWhere('path')->like("%,$programID,%")->fi()
->beginIF($programID === 0)->andWhere('parent')->eq(0)->fi()
->beginIF($status != 'all' and $status != 'noclosed')->andWhere('status')->eq($status)->fi()
->beginIF($excludedModel)->andWhere('model')->ne($excludedModel)->fi()
->beginIF($model)->andWhere('model')->eq($model)->fi()
+21 -1
View File
@@ -1381,9 +1381,29 @@ class repo extends control
{
$content = file($logFile);
$lastLine = $content[count($content) - 1];
if(!strpos($lastLine, 'done'))
{
return print(1);
if(strpos($lastLine, 'empty repository') !== false)
{
@unlink($logFile);
}
elseif(strpos($lastLine, 'Total') !== false)
{
$logContent = file_get_contents($logFile);
if(strpos($logContent, 'Counting objects: 100%') !== false and strpos($logContent, 'Compressing objects: 100%') !== false)
{
@unlink($logFile);
}
else
{
return print(1);
}
}
else
{
return print(1);
}
}
elseif(strpos($lastLine, 'fatal') !== false)
{
+8 -4
View File
@@ -332,9 +332,13 @@ class repoModel extends model
if($type == 'bug') $links = $this->post->bugs;
if($type == 'task') $links = $this->post->tasks;
$revisionID = $this->dao->select('id')->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->andWhere('revision')->eq($revision)->fetch('id');
$revisionInfo = $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->andWhere('revision')->eq($revision)->fetch();
$committer = $this->dao->select('account')->from(TABLE_USER)->where('commiter')->eq($revisionInfo->committer)->fetch('account');
if(empty($committer)) $committer = $revisionInfo->committer;
foreach($links as $linkID)
{
$revisionID = $revisionInfo->id;
$relation = new stdclass;
$relation->AType = 'revision';
$relation->AID = $revisionID;
@@ -344,9 +348,9 @@ class repoModel extends model
$this->dao->replace(TABLE_RELATION)->data($relation)->exec();
if($type == 'story') $this->action->create('story', $linkID, 'linked2revision', '', $revisionID);
if($type == 'bug') $this->action->create('bug', $linkID, 'linked2revision', '', $revisionID);
if($type == 'task') $this->action->create('task', $linkID, 'linked2revision', '', $revisionID);
if($type == 'story') $this->action->create('story', $linkID, 'linked2revision', '', $revisionID, $committer);
if($type == 'bug') $this->action->create('bug', $linkID, 'linked2revision', '', $revisionID, $committer);
if($type == 'task') $this->action->create('task', $linkID, 'linked2revision', '', $revisionID, $committer);
}
}
+12 -10
View File
@@ -47,7 +47,7 @@ js::import($jsRoot . 'monaco-editor/min/vs/loader.js');
<div class="history"></div>
<div class="action-btn pull-right">
<div class="btn btn-close pull-right"><i class="icon icon-close"></i></div>
<?php if($canLinkStory or $canLinkBug or $canLinkTask or $canUnlinkObject):?>
<?php if($canLinkStory or $canLinkBug or $canLinkTask):?>
<div class="dropdown pull-right">
<button class="btn" type="button" data-toggle="context-dropdown"><i class="icon icon-ellipsis-v icon-rotate-90"></i></button>
<ul class="dropdown-menu">
@@ -55,7 +55,6 @@ js::import($jsRoot . 'monaco-editor/min/vs/loader.js');
if($canLinkStory) echo '<li id="linkStory">' . html::a('javascript:;', '<i class="icon icon-lightbulb"></i> ' . $lang->repo->linkStory) . '</li>';
if($canLinkBug) echo '<li id="linkBug">' . html::a('javascript:;', '<i class="icon icon-bug"></i> ' . $lang->repo->linkBug) . '</li>';
if($canLinkTask) echo '<li id="linkTask">' . html::a('javascript:;', '<i class="icon icon-todo"></i> ' . $lang->repo->linkTask) . '</li>';
if($canUnlinkObject) echo '<li id="unlink">' . html::a('javascript:;', '<i class="icon icon-unlink"></i> ' . $lang->repo->unlink) . '</li>';
?>
</ul>
</div>
@@ -135,12 +134,10 @@ function getRelation(commit)
}
$('.table-empty-tip').hide();
$('#unlink').show();
$('#related button').show();
}
else
{
$('#unlink').hide();
if(!canLinkStory && !canLinkBug && !canLinkTask) $('#related button').hide();
}
@@ -157,6 +154,16 @@ function getRelation(commit)
$('#related').show();
}
<?php if($canUnlinkObject):?>
$('#relationTabs').on('onLoad', function(event, tab) {
var objectInfo = tab.id.split('-');
objectID = objectInfo[0];
objectType = objectInfo[1];
unlink = createLink('repo', 'unlink', 'repoID=' + repoID + '&commit=' + globalCommit + '&objectID=' + objectID + '&objectType=' + objectType);
$('#relationTabs ul li[data-id=' + tab.id + '] span.title').after('<a title="<?php echo $lang->repo->unlink;?>" class="unlinks" data-link="' + unlink + '"><i class="icon-unlink"></i></a>');
});
<?php endif;?>
/**
* Set tab data.
*
@@ -331,7 +338,7 @@ $(function()
parent.loadLinkPage(link);
});
$('#unlink a').on('click', function()
$('#relationTabs').on('click', '.unlinks',function()
{
var link = $(this).attr('data-link');
$.post(link, function(data)
@@ -352,11 +359,6 @@ $(function()
{
$('#tab-nav-item-' + tab.id).attr('title', tab.title);
var objectInfo = tab.id.split('-');
objectID = objectInfo[0];
objectType = objectInfo[1];
$('#unlink a').attr('data-link', createLink('repo', 'unlink', 'repoID=' + repoID + '&commit=' + globalCommit + '&objectID=' + objectID + '&objectType=' + objectType));
var relatedHeight = codeHeight / 5 * 2 - $('#log').height() - 45;
$('#relationTabs iframe').css('height', relatedHeight);
});
+1
View File
@@ -15,6 +15,7 @@
<?php include '../../common/view/tablesorter.html.php';?>
<style>
#queryBox {padding-top: 25px;}
#queryBox.show {min-height: 66px;}
.search-form #bug-search .form-actions {width: 115px !important;}
</style>
<div class='main-content' id='mainContent'>
+1
View File
@@ -15,6 +15,7 @@
<?php include '../../common/view/tablesorter.html.php';?>
<style>
.search-form #story-search .form-actions {width: 115px !important;}
#queryBox.show {min-height: 66px;}
</style>
<div class='main-content' id='mainContent'>
<div class='main-header'>
+1
View File
@@ -15,6 +15,7 @@
<?php include '../../common/view/tablesorter.html.php';?>
<style>
#queryBox {padding-top: 25px;}
#queryBox.show {min-height: 66px;}
.search-form #task-search .form-actions {width: 115px !important;}
</style>
<div class='main-content' id='mainContent'>
+3 -1
View File
@@ -389,7 +389,7 @@ class story extends control
foreach($this->config->story->fromObjects[$fromObjectIDKey]['fields'] as $storyField => $fromObjectField)
{
$$storyField = $fromObject->{$fromObjectField};
$storyField = $fromObject->{$fromObjectField};
}
}
@@ -1052,6 +1052,7 @@ class story extends control
unset($stories[$id]);
}
if(!empty($twins)) echo js::alert(sprintf($this->lang->story->batchEditTip, $twins));
if(empty($stories)) return print(js::locate($this->session->storyList));
$this->loadModel('branch');
if($productID and !$executionID)
@@ -2457,6 +2458,7 @@ class story extends control
$this->view->type = $type;
$this->view->stories2Link = $stories2Link;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->storyType = $storyType;
$this->display();
}
+1 -1
View File
@@ -31,7 +31,7 @@ function loadBranches(product, branch, storyID)
if(!branch) branch = 0;
var currentModuleID = $('#modules' + storyID).val();
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + storyID + '&needManage=false&extra=&currentModuleID=' + currentModuleID);
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + storyID + '&needManage=false&extra=nodeleted&currentModuleID=' + currentModuleID);
$('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen();});
planID = $('#plans' + storyID).val();
+7 -1
View File
@@ -59,6 +59,12 @@ $(function()
return false;
});
$('#product').on('change', function(){
var productID = $('#product').val();
var viewLink = createLink('story', 'create', 'productID=' + productID + '&branch=all');
self.location.href = viewLink;
});
$('#module').on('change', function(){
loadURS();
});
@@ -287,7 +293,7 @@ function loadModuleForTwins(productID, branch, branchIndex)
{
/* Load module */
var currentModule = 0;
var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=false&extra=&currentModuleID=' + currentModule);
var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=false&extra=nodeleted&currentModuleID=' + currentModule);
if(branchIndex > 0)
{
var $moduleIDBox = $('.addBranchesBox'+ branchIndex +' #moduleIdBox');
+7 -2
View File
@@ -352,7 +352,7 @@ class storyModel extends model
if($executionID != 0)
{
$this->linkStory($executionID, $this->post->product, $storyID);
if($this->config->systemMode == 'new' and $executionID != $this->session->project) $this->linkStory($this->session->project, $this->post->product, $storyID);
if($this->config->systemMode == 'ALM' and $executionID != $this->session->project) $this->linkStory($this->session->project, $this->post->product, $storyID);
$this->loadModel('kanban');
@@ -603,6 +603,11 @@ class storyModel extends model
if(is_array($story->{$extendField->field})) $story->{$extendField->field} = join(',', $story->{$extendField->field});
$story->{$extendField->field} = htmlSpecialString($story->{$extendField->field});
if(empty($story->{$extendField->field}))
{
dao::$errors[] = sprintf($this->lang->error->notempty, $extendField->name);
return false;
}
}
foreach(explode(',', $this->config->story->create->requiredFields) as $field)
@@ -6039,7 +6044,7 @@ class storyModel extends model
if($result == 'reject')
{
$now = helper::now();
$reason = (empty($reason) and isset($story->closedReason)) ? $story->closedReason : $reason;
$reason = (!empty($story->closedReason)) ? $story->closedReason : $reason;
$story->status = 'closed';
$story->closedBy = $this->app->user->account;
+1 -1
View File
@@ -191,7 +191,7 @@ function loadProductModules(productID, branch)
currentModule = $('#module').val();
}
var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=' + currentModule);
var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=nodeleted&currentModuleID=' + currentModule);
var $moduleIDBox = $('#moduleIdBox');
$moduleIDBox.load(moduleLink, function()
{
+8
View File
@@ -24,6 +24,13 @@
</h2>
</div>
<div id='queryBox' data-module='story' class='show divider'></div>
<?php if(empty($stories2Link)):?>
<div class='table-empty-tip'>
<p>
<span class='text-muted'><?php echo $storyType == 'story' ? $lang->story->noRequirement : $lang->story->noStory;?></span>
</p>
</div>
<?php else:?>
<form method='post' target='hiddenwin' id='linkStoryForm' class='main-table table-story'>
<?php if($stories2Link):?>
<table class='table tablesorter table-bordered' id='storyList'>
@@ -83,6 +90,7 @@
</div>
<?php endif;?>
</form>
<?php endif;?>
</div>
<script>
$(function()
+1 -1
View File
@@ -35,7 +35,7 @@
<th><?php echo $lang->story->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, $story->assignedTo, "class='form-control picker-select'");?></td><td></td>
</tr>
<tr id='rejectedReasonBox' class='hide'>
<tr id='rejectedReasonBox' style="display:none">
<th><?php echo $lang->story->rejectedReason;?></th>
<td class='required'><?php echo html::select('closedReason', $lang->story->reasonList, '', 'class=form-control onchange="setStory(this.value)"');?></td><td></td>
</tr>
+1 -1
View File
@@ -2118,7 +2118,7 @@ class task extends control
{
$execution = $this->execution->getById($executionID);
$allExportFields = $this->config->task->exportFields;
if($execution->type == 'ops') $allExportFields = str_replace(' story,', '', $allExportFields);
if($execution->lifetime == 'ops') $allExportFields = str_replace(' story,', '', $allExportFields);
if($_POST)
{
+1 -1
View File
@@ -127,7 +127,7 @@ foreach(explode(',', $config->task->create->requiredFields) as $field)
</div>
</td>
</tr>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<tr id='testStoryBox' class='hidden'>
<th><?php echo $lang->task->selectTestStory;?></th>
<td colspan='3'>
+1 -1
View File
@@ -118,7 +118,7 @@ foreach(explode(',', $config->task->edit->requiredFields) as $field)
</div>
</td>
</tr>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<tr>
<th><?php echo $lang->task->story;?></th>
<td><span id="storyIdBox"><?php echo html::select('story', $stories, $task->story, "class='form-control chosen' data-drop_direction='down' data-max_drop_width='0'");?></span></td>
+2 -2
View File
@@ -60,7 +60,7 @@
<?php echo !empty($task->desc) ? $task->desc : "<div class='text-center text-muted'>" . $lang->noData . '</div>';?>
</div>
</div>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<?php if($task->fromBug != 0):?>
<div class="detail">
<div class="detail-title"><?php echo $lang->bug->steps;?></div>
@@ -227,7 +227,7 @@
?>
<td title='<?php echo $moduleTitle?>'><?php echo $printModule?></td>
</tr>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<tr class='nofixed'>
<th><?php echo $lang->task->story;?></th>
<td>
+1 -1
View File
@@ -548,7 +548,7 @@ class testcase extends control
$modules = $this->tree->getAllChildID($modules);
}
$stories = $this->story->getProductStoryPairs($productID, $branch, $modules, 'active', 'id_desc', 50, 'null', 'story', false);
$stories = $this->story->getProductStoryPairs($productID, $branch, $modules, 'active', 'id_desc', 50, 'full', 'story', false);
if($this->app->tab != 'qa' and $this->app->tab != 'product')
{
$projectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
+3 -1
View File
@@ -3,8 +3,10 @@ body {margin-bottom: 25px;}
.w-170px {width: 170px;}
#createActionMenu .dropdown-menu {width: 100%;}
#caseForm table tbody tr td {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
#caseForm table tbody tr td {overflow: hidden; white-space: nowrap;}
#caseForm .setting {height: 25px;}
#caseForm table tbody .c-name {overflow: hidden; padding-right: 65px;}
#caseForm table tbody .c-name a:first-child {overflow: hidden; display: inline-block; width: 100%;}
.dropdown-menu.with-search {padding: 0; min-width: 150px; overflow: hidden; max-height: 302px;}
.dropdown-menu > .menu-search .input-group {width: 100%;}
+1 -1
View File
@@ -67,7 +67,7 @@ function loadBranches(product, branch, caseID, oldBranch)
if(result)
{
var currentModuleID = $('#modules' + caseID).val();
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + caseID + '&needManage=false&extra=&currentModuleID=' + currentModuleID);
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + caseID + '&needManage=false&extra=nodeleted&currentModuleID=' + currentModuleID);
$('#modules' + caseID).parent('td').load(moduleLink, function()
{
$("#modules" + caseID).attr('onchange', "loadStories("+ product + ", this.value, " + caseID + ")").chosen();
+1 -1
View File
@@ -89,7 +89,7 @@ function loadProductModules(productID, branch)
if(typeof(branch) == 'undefined') branch = $('#branch').val();
if(!branch) branch = 0;
var currentModuleID = config.currentMethod == 'edit' ? $('#module').val() : 0;
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=' + currentModuleID);
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=nodeleted&currentModuleID=' + currentModuleID);
$('#moduleIdBox').load(link, function()
{
var $inputGroup = $(this);
+1 -1
View File
@@ -83,7 +83,7 @@ js::set('cancelURL', $this->createLink('testtask', 'batchRun', "productID=$
if($useDatatable) include '../../common/view/datatable.html.php';
else include '../../common/view/tablesorter.html.php';
if($config->testcase->needReview or !empty($config->testcase->forceReview)) $config->testcase->datatable->fieldList['actions']['width'] = '180';
if($config->testcase->needReview or !empty($config->testcase->forceReview)) $config->testcase->datatable->fieldList['actions']['width'] = '190';
$setting = $this->datatable->getSetting('testcase');
$widths = $this->datatable->setFixedFieldWidth($setting);
$columns = 0;
+2 -2
View File
@@ -3,7 +3,7 @@ $this->loadModel('file');
$filesName = 'scriptFile';
$labelsName = 'scriptName';
$maxUploadSize = strtoupper(ini_get('upload_max_filesize'));
$dangerFiles = 'zip';
$dangerFiles = 'php,py,js,go,sh,bat,lua,rb,tcl,pl';
js::set('scriptDangerExtensions', ',' . $dangerFiles . ',');
js::set('maxUploadSize', $maxUploadSize);
@@ -74,7 +74,7 @@ function checkDangerExtensions(file)
if(index >= 0)
{
extension = fileName.substr(index + 1);
if(scriptDangerExtensions.lastIndexOf(',' + extension + ',') >= 0)
if(scriptDangerExtensions.lastIndexOf(',' + extension + ',') < 0)
{
alert(<?php echo json_encode($this->lang->file->dangerFile);?>);
$(file).val('');
+1
View File
@@ -507,6 +507,7 @@ class transferModel extends model
$modelData = $this->getDatasByFile($tmpFile);
}
$this->mergeConfig($model);
$modelData = $this->processDate($modelData);
if(isset($fields['id'])) unset($fields['id']);
$this->session->set($model . 'TemplateFields', implode(',', array_keys($fields)));
+1 -1
View File
@@ -535,7 +535,7 @@ class tree extends control
* @access public
* @return string the html select string.
*/
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $branch = 0, $rootModuleID = 0, $returnType = 'html', $fieldID = '', $needManage = false, $extra = '', $currentModuleID = 0)
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $branch = 0, $rootModuleID = 0, $returnType = 'html', $fieldID = '', $needManage = false, $extra = 'nodeleted', $currentModuleID = 0)
{
if($viewType == 'task')
{
+2 -1
View File
@@ -1199,7 +1199,8 @@ class userModel extends model
*/
public function isLogon()
{
return ($this->session->user and $this->session->user->account != 'guest');
$user = $this->session->user;
return ($user and !empty($user->account) and $user->account != 'guest');
}
/**
+1 -1
View File
@@ -627,7 +627,7 @@ class webhookModel extends model
if(empty($table)) return false;
$object = $this->dao->select('*')->from($table)->where('id')->eq($action->objectID)->fetch();
$toList = $this->loadModel('message')->getToList($object, $action->objectType);
$toList = $this->loadModel('message')->getToList($object, $action->objectType, $actionID);
if(!empty($object->mailto)) $toList .= ',' . $object->mailto;
if(empty($toList)) return false;
+1 -1
View File
@@ -50,7 +50,7 @@ $config->zahost->search['params']['editedDate'] = array('operator' => '=',
$config->zahost->editor = new stdclass();
$config->zahost->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->zahost->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
$config->zahost->editor->view = array('id' => 'comment', 'tools' => 'simpleTools');
$config->zahost->editor->view = array('id' => 'comment,lastComment', 'tools' => 'simpleTools');
$config->zahost->automation = new stdclass();
$config->zahost->automation->zenAgentURL = 'https://github.com/easysoft/zenagent/blob/main/guide/deploy/index.md';
-23
View File
@@ -333,29 +333,6 @@ class zahost extends control
return $this->send(array('result' => 'fail', 'message' => array('imageName' => array($this->lang->zahost->notice->noImage))));
}
/*
* Init host.
*
* @param int $hostID
* @return void
*/
public function init($hostID)
{
$imageList = $this->zahost->getImagePairs($hostID);
$this->view->title = $this->lang->zahost->init->title;
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted');
$this->view->hostID = $hostID;
$this->view->host = $this->zahost->getById($hostID);
$this->view->initBash = sprintf($this->config->zahost->initBash, $this->view->host->secret, getWebRoot(true));
$this->view->notice = $imageList ? $this->lang->zahost->createZanodeNotice : $this->lang->zahost->downloadImageNotice;
$this->view->buttonName = $imageList ? $this->lang->zahost->createZanode : $this->lang->zahost->image->downloadImage;
$this->view->modalLink = $imageList ? $this->createLink('zanode', 'create', "hostID=$hostID") : $this->createLink('zahost', 'browseImage', "hostID=$hostID");
$this->view->closeLink = $this->createLink('zahost', 'browse');
$this->display();
}
/**
* Introduction.
*
+2
View File
@@ -1,2 +1,4 @@
.c-name,.c-status,.c-progress,.c-osName{width: 130px;}
.main-header-image{border:none;margin-left: 0!important;padding-left:0;}
.body-modal #mainContent{padding-top: 85px; padding-bottom: 50px;}
.dropdown-menu>li>a {margin: 1px 0;}
-6
View File
@@ -1,6 +0,0 @@
.dot-symbol {margin-right: 10px;}
#statusContainer h5 {line-height: 20px;}
.host-desc-container {margin-top: 20px;}
.host-action {margin-top: 60px;}
.host-action .btn {margin-left: 20px;min-width: 100px;}
.zahost-init-desc {display: inline-block;}
+2 -2
View File
@@ -6,8 +6,9 @@
.c-os {width: 200px;}
.c-memory, .c-diskSize, .c-status, .c-software, .c-instanceNum {width: 90px;}
.c-datetime {width: 150px;}
.status-wait {color: #f00;}
.c-actions {overflow: visible!important;}
.c-number {width: 120px;}
.status-wait {color: #f00;}
.zanode-mt-8{margin-top: 8px;}
.zahost-init{padding:15px;background: #f4f5f7;margin:10px 0;}
.fail{color:red;}
@@ -19,4 +20,3 @@
.btn-info {background-color: unset;}
.icon-refresh {font-size: 15px;}
.load-indicator:after {top: 33%;}
.c-number {width: 120px;}
+4 -4
View File
@@ -6,12 +6,12 @@ $('#hostList tr[data-status="wait"]').hover(function(){
if(showFeature)
{
/* Show features dialog. */
new $.zui.ModalTrigger({url: $.createLink('zahost', 'introduction'), type: 'iframe', width: 900, className: 'showFeatures', showHeader: false, backdrop: 'static'}).show();
$.apps.close('help');
$.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help');
}
$('#helpTab').click(function()
{
/* Show features dialog. */
new $.zui.ModalTrigger({url: $.createLink('zahost', 'introduction'), type: 'iframe', width: 900, className: 'showFeatures', showHeader: false, backdrop: 'static'}).show();
$.apps.close('help');
$.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help');
})
+1 -1
View File
@@ -21,7 +21,7 @@ function updateProgress() {
var hasInprogress = false;
for (var imageID in statusList) {
if (statusList[imageID].statusCode) {
if (statusList[imageID].statusCode == 'inprogress' || statusList[imageID].statusCode == 'created')
if (statusList[imageID].statusCode == 'inprogress' || statusList[imageID].statusCode == 'created' || statusList[imageID].statusCode == 'pending')
{
hasInprogress = true;
$('.image-download-' + imageID).addClass('disabled');
-47
View File
@@ -1,47 +0,0 @@
$('#checkServiceStatus').click(function(){
$.get(createLink('zahost', 'ajaxGetServiceStatus', 'hostID=' + hostID), function(response)
{
var resultData = JSON.parse(response);
let html = "<h4 style='margin-top: 20px;'>" + zahostLang.init.statusTitle + "</h4>";
let isSuccess = true
for (let key in resultData.data) {
if(resultData.data[key] == 'ready'){
html += "<div class='text-success'><span class='dot-symbol'>●</span><span>" + key + ' ' + zahostLang.init[resultData.data[key]] + "</span></div>"
}else{
isSuccess = false
html += "<div class='text-danger'><span class='dot-symbol'>●</span><span>" + key + ' ' + zahostLang.init[resultData.data[key]] + "</span></div>"
}
};
if(!isSuccess){
html += '<h4 style="margin-top:20px;">' + zahostLang.init.initFailNoticeTitle + '</h4>';
html += '<div><span class="dot-symbol">' + zahostLang.init.initFailNoticeDesc + '<a href="https://github.com/easysoft/zenagent/" target="_blank">https://github.com/easysoft/zenagent/</a></span></div>'
}
$('#statusContainer').html(html)
if(isSuccess) showModal();
});
return
})
$('.btn-init-copy').live('click', function()
{
var copyText = $('#initBash');
copyText.show();
copyText .select();
document.execCommand("Copy");
copyText.hide();
$('.btn-init-copy').tooltip({
trigger: 'click',
placement: 'bottom',
title: zahostLang.copied,
tipClass: 'tooltip-success'
});
$(this).tooltip('show');
var that = this;
setTimeout(function()
{
$(that).tooltip('hide')
}, 2000)
})
+15
View File
@@ -65,3 +65,18 @@ $('.btn-init-copy').live('click', function()
$(that).tooltip('hide')
}, 2000)
})
function setIframeHeight(iframe)
{
if (iframe)
{
var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
if (iframeWin.document.body)
{
var height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight
iframe.height = height+10;
console.log(1111, iframe.height)
}
}
}
+1
View File
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
$lang->zahost->image->statusList['created'] = 'Inprogress';
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
$lang->zahost->image->statusList['completed'] = 'Completed';
$lang->zahost->image->statusList['failed'] = 'Failed';
+1
View File
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
$lang->zahost->image->statusList['created'] = 'Inprogress';
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
$lang->zahost->image->statusList['completed'] = 'Completed';
$lang->zahost->image->statusList['failed'] = 'Failed';
+1
View File
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
$lang->zahost->image->statusList['created'] = 'Inprogress';
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
$lang->zahost->image->statusList['completed'] = 'Completed';
$lang->zahost->image->statusList['failed'] = 'Failed';
+1
View File
@@ -90,6 +90,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
$lang->zahost->image->statusList['created'] = 'Inprogress';
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
$lang->zahost->image->statusList['completed'] = 'Completed';
$lang->zahost->image->statusList['failed'] = 'Failed';
+1
View File
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = '可下载';
$lang->zahost->image->statusList['created'] = '下载中';
$lang->zahost->image->statusList['canceled'] = '可下载';
$lang->zahost->image->statusList['inprogress'] = '下载中';
$lang->zahost->image->statusList['pending'] = '排队下载中';
$lang->zahost->image->statusList['completed'] = '可使用';
$lang->zahost->image->statusList['failed'] = '下载失败';
+11 -1
View File
@@ -323,10 +323,13 @@ class zahostModel extends model
}
$currentTask = null;
$is_finish = false;
foreach($result->data as $status => $group)
{
if($is_finish) break;
foreach($group as $task)
{
if($is_finish) break;
if($task->task == $image->id)
{
$task->endDate = substr($task->endDate, 0, 19);
@@ -334,6 +337,12 @@ class zahostModel extends model
{
$currentTask = $task;
}
if($task->status == 'inprogress')
{
$currentTask = $task;
$is_finish = true;
break;
}
}
}
}
@@ -343,6 +352,8 @@ class zahostModel extends model
$image->rate = $currentTask->rate;
$image->status = $currentTask->status;
if(!empty($result->data->inprogress) && $currentTask->task != $result->data->inprogress[0]->task && $currentTask->status == 'created') $image->status = 'pending';
$this->dao->update(TABLE_IMAGE)
->set('status')->eq($image->status)
->set('path')->eq(!empty($currentTask->path) ? $currentTask->path : '')
@@ -372,7 +383,6 @@ class zahostModel extends model
$response = json_decode(commonModel::http($statusApi, array(), array(CURLOPT_CUSTOMREQUEST => 'GET'), array("Authorization:$host->tokenSN"), 'json'));
a($response);
if($response->code == 200) return true;
dao::$errors[] = $response->msg;
-44
View File
@@ -1,44 +0,0 @@
<?php
/**
* The view file of zahost module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Ke zhao <zhaoke@cnezsoft.com>
* @package automation
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php'; ?>
<?php js::set('hostID', $hostID) ?>
<?php js::set('zahostLang', $lang->zahost); ?>
<div id='mainContent' class='main-content'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->zahost->init->title; ?></h2>
</div>
<div class="host-desc-container">
<h4><?php echo $lang->zahost->init->descTitle; ?></h4>
<div>
<span class='dot-symbol'></span>
<span class='zahost-init-desc'>
<textarea style="display:none;" id="initBash"><?php echo $initBash; ?></textarea>
<?php echo sprintf($lang->zahost->init->initDesc, $initBash, "<button type='button' class='btn btn-info btn-mini btn-init-copy'><i class='icon-common-copy icon-copy' title='" . $lang->zahost->copy . "'></i></button>"); ?>
</span>
</div>
<div id="statusContainer">
</div>
</div>
<div class="text-center host-action">
<button type='button' id='checkServiceStatus' class='btn btn-info margin-top-18'><?php echo $lang->zahost->init->checkStatus; ?></button>
</div>
</div>
</div>
</div>
<?php include $app->getModuleRoot() . 'common/view/successmodal.html.php';?>
<?php include '../../common/view/footer.html.php'; ?>
+3 -2
View File
@@ -135,7 +135,8 @@
<div class="detail">
<div class="detail-title"><?php echo $lang->zahost->browseNode;?></div>
<div class="detail-content article-content">
<table class='table has-sort-head table-fixed' id='nodeList'>
<?php echo "<iframe width='100%' id='nodesIframe' src='" . $this->createLink('zanode', 'list', "hostID=$zahost->id", '', true) . "' frameborder='no' allowfullscreen='true' mozallowfullscreen='true' webkitallowfullscreen='true' allowtransparency='true' scrolling='auto' onload='setIframeHeight(this)' style='min-height:300px;'></iframe>";?>
<!-- <table class='table has-sort-head table-fixed' id='nodeList'>
<thead>
<tr>
<th class='c-name'><?php common::printOrderLink('name', $orderBy, $vars, $lang->zahost->name);?></th>
@@ -158,7 +159,7 @@
</tr>
<?php endforeach;?>
</tbody>
</table>
</table> -->
</div>
</div>
<?php endif; ?>
+1 -1
View File
@@ -49,4 +49,4 @@ $config->zanode->editor = new stdclass();
$config->zanode->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->zanode->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
$config->zanode->editor->createimage = array('id' => 'desc', 'tools' => 'simpleTools');
$config->zanode->editor->view = array('id' => 'comment', 'tools' => 'simpleTools');
$config->zanode->editor->view = array('id' => 'comment,lastComment', 'tools' => 'simpleTools');
+23 -22
View File
@@ -59,6 +59,29 @@ class zanode extends control
$this->display();
}
/**
* Browse ZenAgent Node list in zahost view.
*
* @param string $browseType
* @param string $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function list($hostID, $orderBy = 'id_desc')
{
$this->view->title = $this->lang->zanode->common;
$this->view->nodeList = $this->loadModel("zanode")->getListByHost($hostID, $orderBy);
$this->view->orderBy = $orderBy;
$this->view->hostID = $hostID;
$this->display();
}
/**
* Create node.
*
@@ -138,28 +161,6 @@ class zanode extends control
$this->display();
}
/*
* Init node.
*
* @param int $hostID
* @return void
*/
public function init($nodeID)
{
$this->view->title = $this->lang->zanode->initTitle;
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted');
$this->view->nodeID = $nodeID;
$this->view->node = $this->zanode->getNodeById($nodeID);
$this->view->initBash = sprintf($this->config->zanode->initBash, getWebRoot(true));
$this->view->notice = $this->lang->zanode->init->initSuccessNoticeTitle;
$this->view->buttonName = $this->lang->zanode->init->button;
$this->view->modalLink = $this->createLink('testcase', 'automation', 0, '', true);
$this->view->modalClass = 'iframe';
$this->view->closeLink = $this->createLink('zanode', 'browse');
$this->display();
}
/**
* start Node.
*
-7
View File
@@ -1,7 +0,0 @@
.dot-symbol{margin-right: 10px;}
#statusContainer h5{line-height: 20px;}
.host-desc-container{margin-top: 20px;}
.host-action{margin-top: 60px;}
.host-action .btn{margin-left: 20px;min-width: 100px;}
.zahost-init-desc{display: inline-block;}
.node-init-install{margin-left: 10px;color: #2463c7}
+8
View File
@@ -0,0 +1,8 @@
.c-cpu,.c-memory,.c-diskSize,.c-status {width: 90px;}
.c-os {width: 150px;}
.c-number {width: 120px;}
.desktop, .createImage{margin-right: 4px;}
#helpTab .icon-help {line-height: unset;}
#bysearchTab {margin-right: 0px;}
#main{min-width: 0!important;padding:0!important;}
body{background-color: #fff!important;}
+4 -4
View File
@@ -1,11 +1,11 @@
if(showFeature)
{
/* Show features dialog. */
new $.zui.ModalTrigger({url: $.createLink('zahost', 'introduction'), type: 'iframe', width: 900, className: 'showFeatures', showHeader: false, backdrop: 'static'}).show();
$.apps.close('help');
$.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help');
}
$('#helpTab').click(function()
{
/* Show features dialog. */
new $.zui.ModalTrigger({url: $.createLink('zahost', 'introduction'), type: 'iframe', width: 900, className: 'showFeatures', showHeader: false, backdrop: 'static'}).show();
$.apps.close('help');
$.apps.open('https://www.zentao.net/book/zentaopms/978.html?fullScreen=zentao', 'help');
})
-68
View File
@@ -1,68 +0,0 @@
$('#checkServiceStatus').click(function(){
$.get(createLink('zanode', 'ajaxGetServiceStatus', 'nodeID=' + nodeID), function(response)
{
var resultData = JSON.parse(response);
var html = "<h4 style='margin-top: 20px;'>" + zanodeLang.init.statusTitle + "</h4>";
var isSuccess = true
for (var key in resultData.data)
{
var installHtml = "";
if(key == "ZTF")
{
installHtml = "<a class='node-init-install' target='hiddenwin' herf='javascript:;' data-href='"+createLink('zanode', 'ajaxInstallService', 'nodeID=' + nodeID + '&service=' + key)+"'>"+zanodeLang.install+"</a>";
}
if(resultData.data[key] == 'ready')
{
html += "<div class='text-success'><span class='dot-symbol'>●</span><span>" + key + ' ' + zanodeLang.init[resultData.data[key]] + "</span>"+installHtml+"</div>"
}
else
{
isSuccess = false
html += "<div class='text-danger'><span class='dot-symbol'>●</span><span>" + key + ' ' + zanodeLang.init[resultData.data[key]] + "</span>"+installHtml+"</div>"
}
};
if(!isSuccess)
{
html += '<h4 style="margin-top:20px;">' + zanodeLang.init.initFailNoticeTitle + '</h4>';
html += '<div><span class="dot-symbol">' + zanodeLang.init.initFailNoticeDesc + '<a href="https://github.com/easysoft/zenagent/" target="_blank">https://github.com/easysoft/zenagent/</a></span></div>'
}
$('#statusContainer').html(html)
if(isSuccess) showModal();
});
return
})
$('#statusContainer').on('click', '.node-init-install', function(){
$(this).addClass('load-indicator loading');
var link = $(this).data('href')
$.get(link, function(response)
{
$(this).removeClass('load-indicator');
$(this).removeClass('loading');
$('#checkServiceStatus').trigger("click")
})
})
$('.btn-init-copy').live('click', function()
{
var copyText = $('#initBash');
copyText.show();
copyText .select();
document.execCommand("Copy");
copyText.hide();
$('.btn-init-copy').tooltip({
trigger: 'click',
placement: 'bottom',
title: zanodeLang.copied,
tipClass: 'tooltip-success'
});
$(this).tooltip('show');
var that = this;
setTimeout(function()
{
$(that).tooltip('hide')
}, 2000)
})
+1
View File
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = 'The system detects the presence of an automatio
$lang->zanode->createImage = 'Create Image';
$lang->zanode->createImaging = 'Creating';
$lang->zanode->pending = 'Waiting for create';
$lang->zanode->createImageNotice = 'The system will be created based on the current node,This process requires the ZenAgent Node to be shut down. Do you want to continue?';
$lang->zanode->createImageSuccess = 'Successed, You can use this image to create node.';
$lang->zanode->createImageFail = 'Failed to create';
+1
View File
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = 'The system detects the presence of an automatio
$lang->zanode->createImage = 'Create Image';
$lang->zanode->createImaging = 'Creating';
$lang->zanode->pending = 'Waiting for create';
$lang->zanode->createImageNotice = 'The system will be created based on the current node,This process requires the ZenAgent Node to be shut down. Do you want to continue?';
$lang->zanode->createImageSuccess = 'Successed, You can use this image to create node.';
$lang->zanode->createImageFail = 'Failed to create';
+1
View File
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = 'The system detects the presence of an automatio
$lang->zanode->createImage = 'Create Image';
$lang->zanode->createImaging = 'Creating';
$lang->zanode->pending = 'Waiting for create';
$lang->zanode->createImageNotice = 'The system will be created based on the current node,This process requires the ZenAgent Node to be shut down. Do you want to continue?';
$lang->zanode->createImageSuccess = 'Successed, You can use this image to create node.';
$lang->zanode->createImageFail = 'Failed to create';
+1
View File
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = '系统检测到选择的用例存在自动化
$lang->zanode->createImage = '导出镜像';
$lang->zanode->createImaging = '正在导出镜像';
$lang->zanode->pending = '等待导出镜像';
$lang->zanode->createImageNotice = '系统将基于当前执行节点导出镜像,该过程需要关闭该执行节点,确定要继续么?';
$lang->zanode->createImageSuccess = '镜像导出成功,您可以使用此镜像创建执行节点。';
$lang->zanode->createImageFail = '镜像导出失败';
+1
View File
@@ -675,6 +675,7 @@ class zanodemodel extends model
foreach($tasks as $task)
{
if(!empty($tasks['inprogress']) && $task->task != $tasks['inprogress'][0]->task && $task->status == 'created') $task->status = 'pending';
if($type == $task->type and $taskID == $task->task) return $task;
}
}
+29 -8
View File
@@ -15,6 +15,7 @@
<?php if($task):?>
<?php js::set('taskID', $task->task);?>
<?php js::set('nodeID', $node->id);?>
<?php js::set('zanodeLang', $lang->zanode); ?>
<style>.body-modal #mainContent{width:90%}
</style>
<?php endif;?>
@@ -26,13 +27,17 @@
</h2>
</div>
<?php if($task):?>
<h5 class='text-center'><?php echo $lang->zanode->createImaging;?></h5>
<h5 class='text-center status-title'><?php echo $lang->zanode->pending;?></h5>
<div class="progress progress-striped">
<div class="progress-bar progress-bar-success rate" role="progressbar" aria-valuenow="<?php echo $task->rate;?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $task->rate;?>%">
</div>
</div>
<?php helper::createLink('zanode', 'create');?>
<h6 class='hide text-center success'><?php echo $lang->zanode->createImageSuccess . html::a(inLink('create'), $lang->zanode->createImageButton, "_parent");?></h6>
<?php
$link = helper::createLink('zanode', 'create', "hostID={$node->parent}");
$link = str_replace('onlybody=yes', '', $link);
$link = trim($link, '?');
?>
<h6 class='hide text-center success'><?php echo $lang->zanode->createImageSuccess . html::a($link, $lang->zanode->createImageButton, "_parent", "style='color:#2e7fff;'");?></h6>
<h6 class='hide text-center fail'><?php echo $lang->zanode->createImageFail;?></h6>
<?php else:?>
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
@@ -48,7 +53,7 @@
</tr>
<tr>
<td colspan='3' class='text-center'>
<?php echo html::submitButton('', "onclick='if(confirm(\"{$lang->zanode->createImageNotice}\")==false) return false;'");?>
<?php echo in_array($node->status, array('shutdown', 'shutoff')) ? html::submitButton('', "") : html::submitButton('', "onclick='if(confirm(\"{$lang->zanode->createImageNotice}\")==false) return false;'");?>
</td>
</tr>
</table>
@@ -78,8 +83,17 @@ function getTaskProgress()
if(rate == 1 || status == 'completed') rate = 1;
if(status == 'inprogress' && rate >= 1) rate = 0.97;
if(status == 'pending')
{
$('.status-title').text(zanodeLang.pending)
}
else
{
$('.status-title').text(zanodeLang.createImaging)
}
$('.rate').css('width', rate*100 + '%');
if(rate == 1 || (status != 'inprogress' && status != 'created'))
if(rate == 1 || (status != 'inprogress' && status != 'created' && status != 'pending'))
{
updateStatus(data);
clearInterval(setProgress);
@@ -94,10 +108,17 @@ function updateStatus(data)
$.post(url, postData, function(result)
{
if(data.status == 'completed') $('.success').removeClass('hide');
else $('.fail').removeClass('hide');
if(data.status == 'completed')
{
$('.success').removeClass('hide');
$('.status-title').text('')
}
else
{
$('.status-title').text(zanodeLang.createImageFail)
}
}, 'json');
}
</script>
<?php endif;;?>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -12,7 +12,7 @@
?>
<?php include $app->getModuleRoot() . 'common/view/header.lite.html.php';?>
<div class='clearfix'>
<?php echo "<iframe width='100%' id='urlIframe' src='http://$url/novnc?port=6080&path=websockify/?token=$token&password=pass'></iframe>";?>
<?php echo "<iframe width='100%' id='urlIframe' src='http://$url/novnc/vnc.html?resize=scale&autoconnect=true&port=6080&path=websockify/?token=$token&password=pass&resize=scale&autoconnect=true'></iframe>";?>
</div>
<script>
$(function()
-45
View File
@@ -1,45 +0,0 @@
<?php
/**
* The view file of zanode module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Ke zhao <zhaoke@cnezsoft.com>
* @package automation
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php'; ?>
<?php js::set('nodeID', $nodeID) ?>
<?php js::set('zanodeLang', $lang->zanode); ?>
<div id='mainContent' class='main-content'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->zanode->init->title; ?></h2>
</div>
<div class="host-desc-container">
<h4><?php echo $lang->zanode->init->descTitle; ?></h4>
<div>
<span class='dot-symbol'></span>
<span class='zanode-init-desc'>
<textarea style="display:none;" id="initBash"><?php echo $initBash; ?></textarea>
<?php echo sprintf($lang->zanode->init->initDesc, $initBash, "<button type='button' class='btn btn-info btn-mini btn-init-copy'><i class='icon-common-copy icon-copy' title='" . $lang->zanode->copy . "'></i></button>"); ?>
</span>
</div>
<div id="statusContainer">
</div>
</div>
<div class="text-center host-action">
<button type='button' id='checkServiceStatus' class='btn btn-info margin-top-18'><?php echo $lang->zanode->init->checkStatus; ?></button>
<?php echo html::backButton('' . $lang->goback, "data-app='{$app->tab}'", 'btn'); ?>
</div>
</div>
</div>
</div>
<?php include '../../common/view/successmodal.html.php';?>
<?php include '../../common/view/footer.html.php'; ?>
+56
View File
@@ -0,0 +1,56 @@
<?php
/**
* The browse view file of zanode module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author xiawenlong <xiawenlong@cnezsoft.com>
* @package zanode
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'common/view/header.html.php'; ?>
<div id='mainContent' class='main-table'>
<?php $vars = "id={$hostID}&orderBy=%s"; ?>
<?php if (empty($nodeList)) : ?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->zanode->empty; ?></span>
<?php if (common::hasPriv('zanode', 'create')) common::printLink('zanode', 'create', '', '<i class="icon icon-plus"></i> ' . $lang->zanode->create, '', 'class="btn btn-info"'); ?>
</p>
</div>
<?php else : ?>
<table class='table has-sort-head table-fixed' id='nodeList'>
<thead>
<tr>
<th class='c-name'><?php common::printOrderLink('name', $orderBy, $vars, $lang->zahost->name);?></th>
<th class='c-cpu'><?php common::printOrderLink('cpuCores', $orderBy, $vars, $lang->zanode->cpuCores);?></th>
<th class='c-memory'><?php common::printOrderLink('memory', $orderBy, $vars, $lang->zanode->memory);?></th>
<th class='c-diskSize'><?php common::printOrderLink('diskSize', $orderBy, $vars, $lang->zanode->diskSize);?></th>
<th class='c-os'><?php common::printOrderLink('osName', $orderBy, $vars, $lang->zanode->osName);?></th>
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->zanode->status);?></th>
</tr>
</thead>
<tbody>
<?php foreach ($nodeList as $node) : ?>
<tr>
<td title='<?php echo $node->name ?>'><?php echo html::a($this->inlink('view', "id=$node->id"), $node->name, '', ""); ?></td>
<td><?php echo zget($config->zanode->os->cpuCores, $node->cpuCores); ?></td>
<td><?php echo $node->memory . $this->lang->zahost->unitList['GB']; ?></td>
<td><?php echo $node->diskSize . $this->lang->zahost->unitList['GB']; ?></td>
<td><?php echo $node->osName; ?></td>
<td><?php echo zget($lang->zanode->statusList, $node->status); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<?php include $app->getModuleRoot() . 'common/view/footer.html.php'; ?>
<script>
// $('body').addClass('body-modal')
</script>
+1 -1
View File
@@ -137,7 +137,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
</span>
</div>
<div class="status-notice">
<span class='init-success hide'><?php echo sprintf($lang->zanode->init->initSuccessNoticeTitle, "<a href='https://www.zentao.net/book/zentaopms/configure-environment-974.html' target='_blank'>{$lang->zanode->manual}</a>", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?></span>
<span class='init-success hide'><?php echo sprintf($lang->zanode->init->initSuccessNoticeTitle, "<a id='jumpManual' href='javascript:;'>{$lang->zanode->manual}</a>", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?></span>
<span class='init-fail hide'><?php echo $lang->zanode->init->initFailNoticeTitle . '<br/>' . $lang->zanode->init->initFailNoticeDesc;?></span>
</div>
</div>
+45 -8
View File
@@ -854,7 +854,7 @@ class userTest
* @access public
* @return void
*/
public function checkProductPrivTest($product, $account, $groups, $teams, $stakeholders, $whiteList)
public function checkProductPrivTest($product, $account, $groups = '', $teams = '', $stakeholders = '', $whiteList = '')
{
return $this->objectModel->checkProductPriv($product, $account, $groups, $teams, $stakeholders, $whiteList);
}
@@ -882,14 +882,33 @@ class userTest
* @param int $projectID
* @param array $stakeholders
* @param array $whiteList
* @param array $admins
* @access public
* @return void
*/
public function getProgramAuthedUsersTest($programID, $stakeholders, $whiteList)
public function getProgramAuthedUsersTest($programID, $stakeholders, $whiteList, $admins)
{
global $tester;
$program = $tester->loadModel('program')->getByID($programID);
return $this->objectModel->getProgramAuthedUsers($program, $stakeholders, $whiteList);
return $this->objectModel->getProgramAuthedUsers($program, $stakeholders, $whiteList, $admins);
}
/**
* getSprintAuthedUsersTest
*
* @param int $sprintID
* @param array $stakeholders
* @param array $teams
* @param array $whiteList
* @param array $admins
* @access public
* @return void
*/
public function getSprintAuthedUsersTest($sprintID, $stakeholders, $teams, $whiteList, $admins)
{
global $tester;
$sprint = $tester->loadModel('execution')->getByID($sprintID);
return $this->objectModel->getSprintAuthedUsers($sprint, $stakeholders, $teams, $whiteList, $admins);
}
/**
@@ -902,11 +921,11 @@ class userTest
* @access public
* @return void
*/
public function getProductViewListUsersTest($productID, $teams, $stakeholders, $whiteList)
public function getProductViewListUsersTest($productID, $teams, $stakeholders, $whiteList, $admins)
{
global $tester;
$product = $tester->loadModel('product')->getByID($productID);
return $this->objectModel->getProductViewListUsers($product, $teams, $stakeholders, $whiteList);
return $this->objectModel->getProductViewListUsers($product, $teams, $stakeholders, $whiteList, $admins);
}
/**
@@ -919,7 +938,7 @@ class userTest
* @access public
* @return void
*/
public function getTeamMemberPairsTest($objectID, $type, $params, $usersToAppended)
public function getTeamMemberPairsTest($objectID, $type, $params = '', $usersToAppended = array())
{
return $this->objectModel->getTeamMemberPairs($objectID, $type, $params, $usersToAppended);
}
@@ -945,9 +964,9 @@ class userTest
*
* @param string $type
* @access public
* @return void
* @return array
*/
public function getUserTemplates($type)
public function getUserTemplatesTest($type)
{
return $this->objectModel->getUserTemplates($type);
}
@@ -1104,4 +1123,22 @@ class userTest
{
return $this->objectModel->identifyByCookie();
}
/**
* test of isClickable.
*
* @param int $userID
* @param string $action
* @access public
* @return bool
*/
public function isClickableTest($userID, $action = '')
{
global $tester;
$user = $tester->loadModel('user')->getById($userID, 'id');
if($userID == 10) $user->ranzhi = '';
return $this->objectModel->isClickable($user, $action);
}
}
+4 -2
View File
@@ -253,11 +253,12 @@ class yaml
* Build yaml file and insert table.
*
* @param int $rows
* @param string $dataDirYaml The yaml file names in the data directory
* @param string $version
* @access public
* @return void
*/
public function gen($rows, $version = '1.0')
public function gen($rows, $dataDirYaml = '')
{
$runFileDir = dirname(getcwd() . DS . $_SERVER['SCRIPT_FILENAME']);
$runFileName = str_replace(strrchr($_SERVER['SCRIPT_FILENAME'], "."), "", $_SERVER['SCRIPT_FILENAME']);
@@ -270,11 +271,12 @@ class yaml
$yamlDataArr['title'] = "zt_{$this->tableName}";
$yamlDataArr['author'] = "auto_{$runFileName}";
$yamlDataArr['version'] = $version;
$yamlDataArr['version'] = '1.0';
if(empty($this->fields->fieldArr))
{
$yamlFile = dirname(dirname(__FILE__)) . "/data/{$this->tableName}.yaml";
if($dataDirYaml) $yamlFile = dirname(dirname(__FILE__)) . "/data/{$dataDirYaml}.yaml";
}
else
{
+4 -2
View File
@@ -2,6 +2,8 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('product')->gen(10);
zdTable('user')->gen(200);
su('admin');
/**
@@ -14,7 +16,7 @@ pid=1
传入产品、用户名,判断test3用户是否对此产品有权限 >> 0
传入产品、用户名,判断test2用户是否对此产品有权限 >> 1
传入产品、用户名、干系人、白名单,判断user10用户是否对此产品有权限 >> 1
传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限 >> 1
传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限 >> 0
*/
@@ -32,4 +34,4 @@ r($user->checkProductPrivTest('', 'admin')) && p() && e('1'); //传入admi
r($user->checkProductPrivTest($product, 'test3')) && p() && e('0'); //传入产品、用户名,判断test3用户是否对此产品有权限
r($user->checkProductPrivTest($product, 'test2')) && p() && e('1'); //传入产品、用户名,判断test2用户是否对此产品有权限
r($user->checkProductPrivTest($product, 'user10', array(), array(), $stakeholders)) && p() && e('1'); //传入产品、用户名、干系人、白名单,判断user10用户是否对此产品有权限
r($user->checkProductPrivTest($product, 'user60', array(), array(), $stakeholders, array(), $whiteList)) && p() && e('1'); //传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限
r($user->checkProductPrivTest($product, 'user60', array(), array(), $stakeholders, array(), $whiteList)) && p() && e('0'); //传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限
+3 -2
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('user')->gen(1000);
su('admin');
/**
@@ -10,9 +11,9 @@ title=测试 userModel->getCanCreateStoryUsers();
cid=1
pid=1
查找系统中有权限创建、批量创建需求的用户 >> A:admin;T:产品主管48
查找系统中有权限创建、批量创建需求的用户 >> A:admin;T:研发主管48
*/
$user = new userTest();
r($user->getCanCreateStoryUsersTest()) && p('admin;td48') && e('A:admin;T:产品主管48'); //查找系统中有权限创建、批量创建需求的用户
r($user->getCanCreateStoryUsersTest()) && p('admin;td48') && e('A:admin;T:研发主管48'); //查找系统中有权限创建、批量创建需求的用户
+9 -4
View File
@@ -2,6 +2,11 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('user')->gen(500);
zdTable('story')->gen(400);
zdTable('case')->gen(400);
zdTable('bug')->gen(300);
su('admin');
/**
@@ -10,9 +15,9 @@ title=测试 userModel::getPersonalData();
cid=1
pid=1
获取admin用户的createdBugs数量 >> 270
获取admin用户的createdBugs数量 >> 30
获取test2用户createdCases数量 >> 4
当获取一个空用户的数据时,系统默认返回当前登录用户的数据 >> 2
当获取一个空用户的数据时,系统默认返回当前登录用户的数据 >> 3
*/
$user = new userTest();
@@ -20,6 +25,6 @@ $adminData = $user->getPersonalDataTest('admin');
$test2Data = $user->getPersonalDataTest('test2');
$emptyData = $user->getPersonalDataTest('');
r($adminData) && p('createdBugs') && e('270'); //获取admin用户的createdBugs数量
r($adminData) && p('createdBugs') && e('30'); //获取admin用户的createdBugs数量
r($test2Data) && p('createdCases') && e('4'); //获取test2用户createdCases数量
r($emptyData) && p('createdTodos') && e('2'); //当获取一个空用户的数据时,系统默认返回当前登录用户的数据
r($emptyData) && p('createdTodos') && e('3'); //当获取一个空用户的数据时,系统默认返回当前登录用户的数据
+11 -4
View File
@@ -2,6 +2,8 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('product')->gen(10);
zdTable('user')->gen(100);
su('admin');
/**
@@ -14,6 +16,7 @@ pid=1
获取对ID为1的产品有权限的用户 >> test9
获取对ID为1的产品有权限的用户 >> admin
获取对ID为2的产品有权限的用户 >> astaw
获取对ID为2的产品有权限的用户 >> test20
*/
@@ -28,7 +31,11 @@ $whiteList['user35'] = 'user35';
$whiteList['user35'] = 'user35';
$whiteList['astaw'] = 'astaw';
r(count($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList))) && p() && e('11'); //获取对ID为1的产品有权限的用户
r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList)) && p('test9') && e('test9'); //获取对ID为1的产品有权限的用户
r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList)) && p('admin') && e('admin'); //获取对ID为1的产品有权限的用户
r($user->getProductViewListUsersTest(2, $stakeholders, $teams, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户
$admins['test20'] = 'test20';
$admins['test21'] = 'test21';
r(count($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList, array()))) && p() && e('11'); //获取对ID为1的产品有权限的用户
r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList, array())) && p('test9') && e('test9'); //获取对ID为1的产品有权限的用户
r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList, array())) && p('admin') && e('admin'); //获取对ID为1的产品有权限的用户
r($user->getProductViewListUsersTest(2, $stakeholders, $teams, $whiteList, array())) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户
r($user->getProductViewListUsersTest(2, $stakeholders, $teams, $whiteList, $admins)) && p('test20') && e('test20'); //获取对ID为2的产品有权限的用户
+11 -5
View File
@@ -2,6 +2,8 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('project')->gen(10, 'program');
zdTable('user')->gen(200);
su('admin');
/**
@@ -10,7 +12,7 @@ title=测试 userModel->getProgramAuthedUsers();
cid=1
pid=1
获取对ID为1的项目集有权限的用户数量 >> 6
获取对ID为1的项目集有权限的用户数量 >> 7
获取对ID为1的项目集有权限的用户 >> test9
获取对ID为1的项目集有权限的用户 >> admin
获取对ID为2的项目集有权限的用户 >> astaw
@@ -25,7 +27,11 @@ $whiteList['user35'] = 'user35';
$whiteList['user35'] = 'user35';
$whiteList['astaw'] = 'astaw';
r(count($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList))) && p() && e('6'); //获取对ID为1的项目集有权限的用户数量
r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList)) && p('test9') && e('test9'); //获取对ID为1的项目集有权限的用户
r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList)) && p('admin') && e('admin'); //获取对ID为1的项目集有权限的用户
r($user->getProgramAuthedUsersTest(2, $stakeholders, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的项目集有权限的用户
$admins['test20'] = 'test20';
$admins['test21'] = 'test21';
r(count($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList, array()))) && p() && e('7'); //获取对ID为1的项目集有权限的用户数量
r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList, array())) && p('test9') && e('test9'); //获取对ID为1的项目集有权限的用户
r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList, array())) && p('admin') && e('admin'); //获取对ID为1的项目集有权限的用户
r($user->getProgramAuthedUsersTest(2, $stakeholders, $whiteList, array())) && p('astaw') && e('astaw'); //获取对ID为2的项目集有权限的用户
r($user->getProgramAuthedUsersTest(2, $stakeholders, $whiteList, $admins)) && p('test21') && e('test21'); //获取对ID为2的项目集有权限的用户
+3 -1
View File
@@ -2,6 +2,8 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('product')->gen(10);
zdTable('user')->gen(200);
su('admin');
/**
@@ -29,4 +31,4 @@ $whiteList['astaw'] = 'astaw';
r($user->getProjectAuthedUsersTest(1, $stakeholders, $teams, $whiteList)) && p('test9') && e('test9'); //获取对ID为1的产品有权限的用户
r($user->getProjectAuthedUsersTest(1, $stakeholders, $teams, $whiteList)) && p('admin') && e('admin'); //获取对ID为1的产品有权限的用户
r($user->getProjectAuthedUsersTest(2, $stakeholders, $teams, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户
r($user->getProjectAuthedUsersTest(2, $stakeholders, $teams, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('project')->gen(300, 'execution');
zdTable('user')->gen(200);
su('admin');
/**
title=测试 userModel->getSprintAuthedUsers();
cid=1
pid=1
获取对ID为101的执行有权限的用户 >> test9
获取对ID为101的执行有权限的用户 >> admin
获取对ID为201的执行有权限的用户 >> astaw
获取对ID为201的执行有权限的用户 >> test21
*/
$user = new userTest();
$stakeholders['test9'] = 'test9';
$stakeholders['test10'] = 'test10';
$teams['pm7'] = 'pm7';
$teams['pm8'] = 'pm8';
$whiteList['user35'] = 'user35';
$whiteList['user35'] = 'user35';
$whiteList['astaw'] = 'astaw';
$admins['test20'] = 'test20';
$admins['test21'] = 'test21';
r($user->getSprintAuthedUsersTest(101, $stakeholders, $teams, $whiteList, array())) && p('test9') && e('test9'); //获取对ID为101的执行有权限的用户
r($user->getSprintAuthedUsersTest(101, $stakeholders, $teams, $whiteList, array())) && p('admin') && e('admin'); //获取对ID为101的执行有权限的用户
r($user->getSprintAuthedUsersTest(201, $stakeholders, $teams, $whiteList, array())) && p('astaw') && e('astaw'); //获取对ID为201的执行有权限的用户
r($user->getSprintAuthedUsersTest(201, $stakeholders, $teams, $whiteList, $admins)) && p('test21') && e('test21'); //获取对ID为201的执行有权限的用户
+7 -2
View File
@@ -2,6 +2,9 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('project')->gen(10);
zdTable('team')->gen(400);
zdTable('user')->gen(1000);
su('admin');
/**
@@ -12,6 +15,7 @@ pid=1
获取ID为11的项目的团队成员数量 >> 3
获取ID为11的项目的团队成员数量,追加用户test2 >> 4
获取ID为11的项目的团队成员数量,追加用户test2 >> project
获取ID为110的执行的团队成员成员 >> T:测试1
*/
@@ -19,5 +23,6 @@ pid=1
$user = new userTest();
r(count($user->getTeamMemberPairsTest(11, 'project'))) && p() && e('3'); //获取ID为11的项目的团队成员数量
r(count($user->getTeamMemberPairsTest(11, 'project', '', array('test2')))) && p() && e('4'); //获取ID为11的项目的团队成员数量,追加用户test2
r($user->getTeamMemberPairsTest(110, 'execution')) && p('test1') && e('T:测试1'); //获取ID为110的执行的团队成员成员
r(count($user->getTeamMemberPairsTest(11, 'project', '', array('test2')))) && p() && e('4') && zdTable('project')->gen(100, 'execution' );//获取ID为11的项目的团队成员数量,追加用户test2
zdTable('project')->gen(100, 'execution' );
r($user->getTeamMemberPairsTest(110, 'execution')) && p('test1') && e('T:测试1'); //获取ID为110的执行的团队成员成员
+3 -2
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('user')->gen(500);
su('admin');
/**
@@ -10,7 +11,7 @@ title=测试 userModel::getUserDetailsForAPI();
cid=1
pid=1
获取admin用户的url >> guser-profile-1.
获取admin用户的url >> getuserdetailsforapi
获取test2用户的真实姓名 >> 测试2
获取user10的头像信息 >> http:///home/z/tmp/10.png
@@ -19,6 +20,6 @@ $user = new userTest();
$userList = array('admin', 'test2', 'user10', '');
$users = $user->getUserDetailsForAPITest($userList);
r($users) && p('admin:url') && e('guser-profile-1.'); //获取admin用户的url
r($users) && p('admin:url') && e('getuserdetailsforapi'); //获取admin用户的url
r($users) && p('test2:realname') && e('测试2'); //获取test2用户的真实姓名
r($users) && p('user10:avatar') && e('http:///home/z/tmp/10.png'); //获取user10的头像信息
+12 -3
View File
@@ -2,6 +2,8 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('usertpl')->gen(10);
zdTable('user')->gen(1000);
su('admin');
/**
@@ -10,9 +12,16 @@ title=测试 userModel::getUserTemplates();
cid=1
pid=1
查询当前用户能够使用的exporttask类型的模板 >> admin
查询当前用户能够使用的story类型的模板 >> dev10
查询当前用户能够使用的exportbug类型的模板 >> 0
查询当前用户能够使用的exportstory类型的模板 >> test10
*/
$user = new userTest();
$typeList = array('exporttask', 'story', 'exportbug', 'exportstory');
//r() && p('') && e(''); //
$user = new userTest();
r($user->getUserTemplatesTest($typeList[0])) && p('0:account') && e('admin'); //查询当前用户能够使用的exporttask类型的模板
r($user->getUserTemplatesTest($typeList[1])) && p('0:account') && e('dev10'); //查询当前用户能够使用的story类型的模板
r($user->getUserTemplatesTest($typeList[2])) && p('0:account') && e('0'); //查询当前用户能够使用的exportbug类型的模板
r($user->getUserTemplatesTest($typeList[3])) && p('0:account') && e('test10'); //查询当前用户能够使用的exportstory类型的模板
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
zdTable('user')->gen(10);
/**
title=测试 userModel::getById();
cid=1
pid=1
判断用户id为1,action为空时,是否可点击 >> 1
判断用户id为1,action为unbind,是否可点击 >> 1
判断用户id为1,action为unlock,是否可点击 >> 0
判断用户id为1,action为undefind,是否可点击 >> 1
判断用户id为10,action为unbind,是否可点击 >> 0
判断用户id为10,action为unlock,是否可点击 >> 0
*/
$actionList[0] = 'unbind';
$actionList[1] = 'unlock';
$actionList[2] = 'undefind';
$user = new userTest();
r($user->isClickableTest(1)) && p() && e('1'); // 判断用户id为1,action为空时,是否可点击
r($user->isClickableTest(1, $actionList[0])) && p() && e('1'); // 判断用户id为1,action为unbind,是否可点击
r($user->isClickableTest(1, $actionList[1])) && p() && e('0'); // 判断用户id为1,action为unlock,是否可点击
r($user->isClickableTest(1, $actionList[2])) && p() && e('1'); // 判断用户id为1,action为undefind,是否可点击
r($user->isClickableTest(10,$actionList[0])) && p() && e('0'); // 判断用户id为10,action为unbind,是否可点击
r($user->isClickableTest(10,$actionList[1])) && p() && e('0'); // 判断用户id为10,action为unlock,是否可点击
+1 -1
View File
@@ -2,6 +2,7 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
zdTable('user')->gen(500);
su('admin');
/**
@@ -20,5 +21,4 @@ $admin = array(
'role' => 'qa',
'realname' => 'admin'
);
a($user->processAccountSortTest(array('admin'=>$admin)));exit;
r($user->processAccountSortTest(array('admin'=>$admin))) && p('admin:account,role') && e('admin,qa'); //获取当前用户信息
+3 -4
View File
@@ -2,7 +2,8 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
$db->switchDB();
zdTable('usertpl')->gen(10);
zdTable('user')->gen(500);
su('admin');
/**
@@ -42,6 +43,4 @@ $tpls3 = $user->saveUserTemplate('task');
r(count($tpls1)) && p() && e('1'); //插入一条Bug用户模板,查看数量
r(count($tpls3)) && p() && e('2'); //插入两条任务类型的用户模板,查看数量
r($tpls2) && p('0:title') && e('Admin的模板二'); //查看插入的模板二的名字
r($tpls2) && p('0:content') && e('<p>这是一段模板内容</p>'); //查看插入的模板二的内容
$db->restoreDB();
r($tpls2) && p('0:content') && e('<p>这是一段模板内容</p>'); //查看插入的模板二的内容