diff --git a/config/config.php b/config/config.php index 0d7871a2a1..f9404b042d 100644 --- a/config/config.php +++ b/config/config.php @@ -195,7 +195,7 @@ $config->objectTables['todo'] = TABLE_TODO; $config->objectTables['custom'] = TABLE_LANG; $config->objectTables['branch'] = TABLE_BRANCH; $config->objectTables['module'] = TABLE_MODULE; -$config->objectTables['testlib'] = TABLE_TESTSUITE; +$config->objectTables['caselib'] = TABLE_TESTSUITE; /* Include extension config files. */ $extConfigFiles = glob($configRoot . 'ext/*.php'); diff --git a/db/update9.0.1.sql b/db/update9.0.1.sql index 7b93fc65f2..854788f016 100644 --- a/db/update9.0.1.sql +++ b/db/update9.0.1.sql @@ -46,4 +46,4 @@ CREATE TABLE `zt_testreport` ( `deleted` enum('0','1') NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -ALTER TABLE `zt_bug` ADD `deadline` date NOT NULL; +ALTER TABLE `zt_bug` ADD `deadline` date NOT NULL AFTER `assignedDate`; diff --git a/module/action/config.php b/module/action/config.php index 73e54fb298..99d917c4bb 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -17,7 +17,7 @@ $config->action->objectNameFields['todo'] = 'name'; $config->action->objectNameFields['branch'] = 'name'; $config->action->objectNameFields['module'] = 'name'; $config->action->objectNameFields['testsuite'] = 'name'; -$config->action->objectNameFields['testlib'] = 'name'; +$config->action->objectNameFields['caselib'] = 'name'; $config->action->objectNameFields['testreport'] = 'title'; $config->action->commonImgSize = 870; diff --git a/module/action/lang/en.php b/module/action/lang/en.php index ac0911370a..57622d63d4 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -62,7 +62,7 @@ $lang->action->objectTypes['todo'] = 'To-Dos'; $lang->action->objectTypes['branch'] = 'Branch'; $lang->action->objectTypes['module'] = 'Module'; $lang->action->objectTypes['testsuite'] = 'Suite'; -$lang->action->objectTypes['testlib'] = 'Library'; +$lang->action->objectTypes['caselib'] = 'Library'; $lang->action->objectTypes['testreport'] = 'Report'; /* 用来描述操作历史记录。*/ @@ -200,7 +200,7 @@ $lang->action->search->objectTypeList['release'] = 'Release'; $lang->action->search->objectTypeList['productplan'] = 'Plan'; $lang->action->search->objectTypeList['branch'] = 'Branch'; $lang->action->search->objectTypeList['testsuite'] = 'Suite'; -$lang->action->search->objectTypeList['testlib'] = 'Library'; +$lang->action->search->objectTypeList['caselib'] = 'Library'; /* 用来在动态显示中显示动作 */ $lang->action->search->label[''] = ''; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index ef46205b0b..6a64d2e249 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -62,8 +62,8 @@ $lang->action->objectTypes['todo'] = '待办'; $lang->action->objectTypes['branch'] = '分支'; $lang->action->objectTypes['module'] = '模块'; $lang->action->objectTypes['testsuite'] = '套件'; -$lang->action->objectTypes['testlib'] = '公共库'; -$lang->action->objectTypes['testreport'] = '总结报告'; +$lang->action->objectTypes['caselib'] = '用例库'; +$lang->action->objectTypes['testreport'] = '测试报告'; /* 用来描述操作历史记录。*/ $lang->action->desc = new stdclass(); @@ -200,7 +200,7 @@ $lang->action->search->objectTypeList['release'] = '发布'; $lang->action->search->objectTypeList['productplan'] = '计划'; $lang->action->search->objectTypeList['branch'] = '分支'; $lang->action->search->objectTypeList['testsuite'] = '套件'; -$lang->action->search->objectTypeList['testlib'] = '公共库'; +$lang->action->search->objectTypeList['caselib'] = '公共库'; /* 用来在动态显示中显示动作 */ $lang->action->search->label[''] = ''; diff --git a/module/action/model.php b/module/action/model.php index 35a9537750..33fe30dac8 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -373,7 +373,7 @@ class actionModel extends model ->andWhere('extra')->eq($extra) ->orderBy($orderBy)->page($pager)->fetchAll(); if(!$trashes) return array(); - + /* Group trashes by objectType, and get there name field. */ foreach($trashes as $object) { @@ -529,7 +529,7 @@ class actionModel extends model $condition = "(product =',0,' AND project = '0')"; if($projectCondition) $condition .= ' OR ' . $projectCondition; if($productCondition) $condition .= ' OR ' . $productCondition; - if(strpos($this->app->company->admins, ',' . $this->app->user->account . ',') !== false) $condition = 1; + if($this->app->user->admin) $condition = 1; } $this->loadModel('doc'); @@ -627,7 +627,7 @@ class actionModel extends model */ public function getBySQL($sql, $orderBy, $pager = null) { - return $actions = $this->dao->select('*')->from(TABLE_ACTION) + return $actions = $this->dao->select('*')->from(TABLE_ACTION) ->where($sql) ->orderBy($orderBy) ->page($pager) @@ -669,11 +669,11 @@ class actionModel extends model if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); if($todo->private == 1 and $todo->account != $this->app->user->account) { - $objectNames[$objectType][$id] = $this->lang->todo->thisIsPrivate; + $objectNames[$objectType][$id] = $this->lang->todo->thisIsPrivate; } else { - $objectNames[$objectType][$id] = $todo->name; + $objectNames[$objectType][$id] = $todo->name; } } } diff --git a/module/action/view/trash.html.php b/module/action/view/trash.html.php index 6eb6811366..ede973a7a6 100755 --- a/module/action/view/trash.html.php +++ b/module/action/view/trash.html.php @@ -37,7 +37,13 @@ action->objectTypes, $action->objectType, '');?> objectID;?> - createLink($module, $module == 'testlib' ? 'libview' : 'view', $action->objectType == 'user' ? "account={$action->objectName}" : "id={$action->objectID}"), $action->objectName);?> + + objectType == 'user' ? "account={$action->objectName}" : "id={$action->objectID}"; + echo html::a($this->createLink($module, $moduleName, $params), $action->objectName); + ?> + actor];?> date;?> diff --git a/module/block/lang/en.php b/module/block/lang/en.php index b7ea542c7a..382e6cbd92 100644 --- a/module/block/lang/en.php +++ b/module/block/lang/en.php @@ -31,8 +31,8 @@ $lang->block->createBlock = 'Create Widget'; $lang->block->editBlock = 'Edit'; $lang->block->ordersSaved = 'Ranking is saved.'; $lang->block->confirmRemoveBlock = 'Do you want to remove Widget【{0}】?'; -$lang->block->foreverClose = '永久关闭'; -$lang->block->confirmClose = '确定永久关闭该区块吗?关闭后,所有人将都不会显示该区块'; +$lang->block->closeForever = '永久关闭'; +$lang->block->confirmClose = '确定永久关闭该区块吗?闭后所有人都将无法使用该区块,可以在后台自定义中打开'; $lang->block->remove = '移除'; $lang->block->refresh = 'Refresh'; $lang->block->hidden = 'Hide'; diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php index 4543084732..d0167df7f2 100644 --- a/module/block/lang/zh-cn.php +++ b/module/block/lang/zh-cn.php @@ -31,8 +31,8 @@ $lang->block->createBlock = '添加区块'; $lang->block->editBlock = '编辑区块'; $lang->block->ordersSaved = '排序已保存'; $lang->block->confirmRemoveBlock = '确定移除区块【{0}】吗?'; -$lang->block->foreverClose = '永久关闭'; -$lang->block->confirmClose = '确定永久关闭该区块吗?关闭后,所有人将都不会显示该区块'; +$lang->block->closeForever = '永久关闭'; +$lang->block->confirmClose = '确定永久关闭该区块吗?闭后所有人都将无法使用该区块,可以在后台自定义中打开'; $lang->block->remove = '移除'; $lang->block->refresh = '刷新'; $lang->block->hidden = '隐藏'; @@ -230,7 +230,7 @@ $lang->block->typeList->project['isdoing'] = '进行中'; $lang->block->typeList->project['all'] = '全部'; $lang->block->typeList->testtask['wait'] = '待测版本'; -$lang->block->typeList->testtask['doing'] = '进行中版本'; +$lang->block->typeList->testtask['doing'] = '测试中版本'; $lang->block->typeList->testtask['blocked'] = '阻塞版本'; $lang->block->typeList->testtask['done'] = '已测版本'; $lang->block->typeList->testtask['all'] = '全部'; diff --git a/module/block/view/dashboard.html.php b/module/block/view/dashboard.html.php index 7d6cec9add..51e62394e1 100644 --- a/module/block/view/dashboard.html.php +++ b/module/block/view/dashboard.html.php @@ -45,8 +45,8 @@ $useGuest = $this->app->user->account == 'guest';
  • block->remove; ?>
  • - app->company->admins, ",{$this->app->user->account},") !== false):?> -
  • createLink('block', 'close', "blockID={$block->id}"), " {$lang->block->foreverClose}", 'hiddenwin', "class='close-block' onclick=\"return confirm('{$lang->block->confirmClose}')\"")?> + app->user->admin):?> +
  • createLink('block', 'close', "blockID={$block->id}"), " {$lang->block->closeForever}", 'hiddenwin', "class='close-block' onclick=\"return confirm('{$lang->block->confirmClose}')\"")?> diff --git a/module/bug/config.php b/module/bug/config.php index d87903e5ef..0818cbe1c4 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -36,9 +36,9 @@ $config->bug->list->exportFields = 'id, product, branch, module, project, story, lastEditedBy, lastEditedDate, files'; -$config->bug->list->customCreateFields = 'project,story,task,pri,severity,os,browser,mailto,keywords'; +$config->bug->list->customCreateFields = 'project,story,task,pri,severity,os,browser,deadline,mailto,keywords'; $config->bug->list->customBatchCreateFields = 'module,project,steps,type,pri,severity,os,browser,keywords'; -$config->bug->list->customBatchEditFields = 'type,severity,pri,productplan,assignedTo,status,resolvedBy,resolution,os,browser,keywords'; +$config->bug->list->customBatchEditFields = 'type,severity,pri,productplan,assignedTo,deadline,status,resolvedBy,resolution,os,browser,keywords'; $config->bug->custom = new stdclass(); $config->bug->custom->createFields = $config->bug->list->customCreateFields; @@ -207,6 +207,11 @@ $config->bug->datatable->fieldList['assignedDate']['fixed'] = 'no'; $config->bug->datatable->fieldList['assignedDate']['width'] = '90'; $config->bug->datatable->fieldList['assignedDate']['required'] = 'no'; +$config->bug->datatable->fieldList['deadline']['title'] = 'deadline'; +$config->bug->datatable->fieldList['deadline']['fixed'] = 'no'; +$config->bug->datatable->fieldList['deadline']['width'] = '90'; +$config->bug->datatable->fieldList['deadline']['required'] = 'no'; + $config->bug->datatable->fieldList['resolvedBy']['title'] = 'resolvedByAB'; $config->bug->datatable->fieldList['resolvedBy']['fixed'] = 'no'; $config->bug->datatable->fieldList['resolvedBy']['width'] = '80'; diff --git a/module/bug/control.php b/module/bug/control.php index 0a582a7947..5dd2352835 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -250,6 +250,7 @@ class bug extends control $os = ''; $browser = ''; $assignedTo = ''; + $deadline = ''; $mailto = ''; $keywords = ''; $severity = 3; @@ -283,6 +284,7 @@ class bug extends control $severity = $bug->severity; $type = $bug->type; $assignedTo = $bug->assignedTo; + $deadline = $bug->deadline; } /* If projectID is setted, get builds and stories of this project. */ @@ -338,6 +340,7 @@ class bug extends control $this->view->browser = $browser; $this->view->projectMembers = $projectMembers; $this->view->assignedTo = $assignedTo; + $this->view->deadline = $deadline; $this->view->mailto = $mailto; $this->view->keywords = $keywords; $this->view->severity = $severity; diff --git a/module/bug/js/create.js b/module/bug/js/create.js index 621cc197f5..3cba627bb1 100644 --- a/module/bug/js/create.js +++ b/module/bug/js/create.js @@ -75,7 +75,7 @@ function setTemplate(templateID) function deleteTemplate(templateID) { if(!templateID) return; - if (confirm(TemplateDelete)){ + if (confirm(templateDelete)){ hiddenwin.location.href = createLink('bug', 'deleteTemplate', 'templateID=' + templateID); $('#tplBox' + templateID).addClass('hidden'); } diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index 7cc3996407..bca7373e1f 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -367,5 +367,5 @@ $lang->bug->featureBar['browse']['unresolved'] = $lang->bug->unResolved; $lang->bug->featureBar['browse']['toclosed'] = $lang->bug->toClosed; $lang->bug->featureBar['browse']['longlifebugs'] = $lang->bug->longLifeBugs; $lang->bug->featureBar['browse']['postponedbugs'] = $lang->bug->postponedBugs; -$lang->bug->featureBar['browse']['overdueBugs'] = $lang->bug->overdueBugs; +$lang->bug->featureBar['browse']['overduebugs'] = $lang->bug->overdueBugs; $lang->bug->featureBar['browse']['needconfirm'] = $lang->bug->needConfirm; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index a86d3a4c91..314f4c9d51 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -145,7 +145,7 @@ $lang->bug->setTemplateTitle = '请输入bug模板标题'; $lang->bug->remindTask = '该Bug已经转化为任务,是否更新任务(编号:%s)状态 ?'; $lang->bug->skipClose = 'Bug %s 不是已解决状态,不能关闭。'; $lang->bug->applyTemplate = '应用模板'; -$lang->bug->TemplateDelete = '您确认要删除该模板吗?'; +$lang->bug->templateDelete = '您确认要删除该模板吗?'; /* 模板。*/ $lang->bug->tplStep = "

    [步骤]

    \n"; @@ -367,5 +367,5 @@ $lang->bug->featureBar['browse']['unresolved'] = $lang->bug->unResolved; $lang->bug->featureBar['browse']['toclosed'] = $lang->bug->toClosed; $lang->bug->featureBar['browse']['longlifebugs'] = $lang->bug->longLifeBugs; $lang->bug->featureBar['browse']['postponedbugs'] = $lang->bug->postponedBugs; -$lang->bug->featureBar['browse']['overdueBugs'] = $lang->bug->overdueBugs; +$lang->bug->featureBar['browse']['overduebugs'] = $lang->bug->overdueBugs; $lang->bug->featureBar['browse']['needconfirm'] = $lang->bug->needConfirm; diff --git a/module/bug/model.php b/module/bug/model.php index abbb422b14..b6878d45cb 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -46,6 +46,7 @@ class bugModel extends model ->add('openedDate', $now) ->setDefault('project,story,task', 0) ->setDefault('openedBuild', '') + ->setDefault('deadline', '0000-00-00') ->setIF($this->post->assignedTo != '', 'assignedDate', $now) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->stripTags($this->config->bug->editor->create['id'], $this->config->allowedTags) @@ -465,6 +466,7 @@ class bugModel extends model ->setDefault('project,module,project,story,task,duplicateBug,branch', 0) ->setDefault('openedBuild', '') ->setDefault('plan', 0) + ->setDefault('deadline', '0000-00-00') ->add('lastEditedBy', $this->app->user->account) ->add('lastEditedDate', $now) ->join('openedBuild', ',') @@ -563,6 +565,7 @@ class bugModel extends model $bug->title = $data->titles[$bugID]; $bug->plan = empty($data->plans[$bugID]) ? 0 : $data->plans[$bugID]; $bug->assignedTo = $data->assignedTos[$bugID]; + $bug->deadline = $data->deadlines[$bugID]; $bug->resolvedBy = $data->resolvedBys[$bugID]; $bug->keywords = $data->keywords[$bugID]; $bug->os = $data->os[$bugID]; @@ -1188,6 +1191,7 @@ class bugModel extends model $bugs = $this->dao->select('*')->from(TABLE_BUG) ->where($bugQuery) ->andWhere('project')->eq((int)$projectID) + ->andWhere('deleted')->eq(0) ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); @@ -1330,15 +1334,17 @@ class bugModel extends model * Get counts of some stories' bugs. * * @param array $stories + * @param int $projectID * @access public * @return int */ - public function getStoryBugCounts($stories) + public function getStoryBugCounts($stories, $projectID = 0) { $bugCounts = $this->dao->select('story, COUNT(*) AS bugs') ->from(TABLE_BUG) ->where('story')->in($stories) ->andWhere('deleted')->eq(0) + ->beginIF($projectID)->andWhere('project')->eq($projectID)->fi() ->groupBy('story') ->fetchPairs(); foreach($stories as $storyID) if(!isset($bugCounts[$storyID])) $bugCounts[$storyID] = 0; @@ -2264,6 +2270,8 @@ class bugModel extends model case 'assignedDate': echo substr($bug->assignedDate, 5, 11); break; + case 'deadline': + echo $bug->deadline; case 'resolvedBy': echo zget($users, $bug->resolvedBy, $bug->resolvedBy); break; diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index 9c7140bb75..ac50c3929b 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -11,6 +11,7 @@ */ ?> + lang->bug->dittoNotice);?>
    @@ -40,6 +41,7 @@ $columns = count($visibleFields) + 2; = 10) echo "class='w-150px'"?>>bug->title;?> '>bug->productplan;?> '>bug->assignedTo;?> + '>bug->deadline;?> '>bug->status;?> '>bug->os;?> '>bug->browser;?> @@ -77,6 +79,7 @@ $columns = count($visibleFields) + 2; ' style='overflow:visible'>plan, "class='form-control chosen'");?> ' style='overflow:visible'>assignedTo, "class='form-control chosen'");?> + ' style='overflow:visible'>deadline, "class='form-control form-date'");?> >status, 'class=form-control');?> >os, 'class=form-control');?> >browser, 'class=form-control');?> diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index 793e49bbef..f72a4aae2d 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -14,12 +14,13 @@ include '../../common/view/header.html.php'; include '../../common/view/form.html.php'; include '../../common/view/kindeditor.html.php'; +include '../../common/view/datepicker.html.php'; js::set('holders', $lang->bug->placeholder); js::set('page', 'create'); js::set('createRelease', $lang->release->create); js::set('createBuild', $lang->build->create); js::set('refresh', $lang->refresh); -js::set('TemplateDelete',$lang->bug->TemplateDelete); +js::set('templateDelete',$lang->bug->templateDelete); ?>
    @@ -84,6 +85,15 @@ js::set('TemplateDelete',$lang->bug->TemplateDelete); bug->allUsers, "class='btn btn-default' onclick='loadAllUsers()' data-toggle='tooltip'");?>
    + + + +
    + bug->deadline?> + +
    + + diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index c30025a883..7584d014ab 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -143,6 +143,10 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild); bug->assignedTo;?> assignedTo, "class='form-control chosen'");?> + + bug->deadline;?> + deadline, "class='form-control form-date'");?> + bug->os;?> bug->osList, $bug->os, "class='form-control'");?> diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 47b5a4cabb..f66ab4649e 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -238,7 +238,7 @@ $lang->qa->menu->testcase = array('link' => 'Case|testcase|browse|productID=%s' $lang->qa->menu->testtask = array('link' => 'Build|testtask|browse|productID=%s'); $lang->qa->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); $lang->qa->menu->report = array('link' => '总结报告|testreport|browse|productID=%s'); -$lang->qa->menu->testlib = array('link' => '公共库|testsuite|library'); +$lang->qa->menu->caselib = array('link' => '公共库|testsuite|library'); $lang->qa->menu->index = array('link' => "TestingHomepage|qa|index|locate=no&productID=%s", 'float' => 'right'); $lang->bug = new stdclass(); @@ -250,7 +250,7 @@ $lang->bug->menu->testcase = array('link' => 'Case|testcase|browse|productID=%s $lang->bug->menu->testtask = array('link' => 'Build|testtask|browse|productID=%s'); $lang->bug->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); $lang->bug->menu->report = array('link' => '总结报告|testreport|browse|productID=%s'); -$lang->bug->menu->testlib = array('link' => '公共库|testsuite|library'); +$lang->bug->menu->caselib = array('link' => '公共库|testsuite|library'); $lang->bug->menu->index = array('link' => "TestingHomepage|qa|index|locate=no&productID=%s", 'float' => 'right'); $lang->testcase = new stdclass(); @@ -262,7 +262,7 @@ $lang->testcase->menu->testcase = array('link' => 'Case|testcase|browse|product $lang->testcase->menu->testtask = array('link' => 'Build|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun,groupcase'); $lang->testcase->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s', 'alias' => 'view,create,edit,linkcase'); $lang->testcase->menu->report = array('link' => '总结报告|testreport|browse|productID=%s', 'alias' => 'view,create'); -$lang->testcase->menu->testlib = array('link' => '公共库|testsuite|library'); +$lang->testcase->menu->caselib = array('link' => '公共库|testsuite|library'); $lang->testcase->menu->index = array('link' => "TestingHomepage|qa|index|locate=no&productID=%s", 'float' => 'right'); $lang->testtask = new stdclass(); @@ -272,16 +272,16 @@ $lang->testsuite->menu = $lang->testcase->menu; $lang->testreport = new stdclass(); $lang->testreport->menu = $lang->testcase->menu; -$lang->testlib = new stdclass(); -$lang->testlib->menu = new stdclass(); -$lang->testlib->menu->lib = array('link' => '%s', 'fixed' => true); -$lang->testlib->menu->bug = array('link' => 'Bug|bug|browse|productID=%s'); -$lang->testlib->menu->testcase = array('link' => '用例|testcase|browse|productID=%s'); -$lang->testlib->menu->testtask = array('link' => '版本|testtask|browse|productID=%s'); -$lang->testlib->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); -$lang->testlib->menu->testlib = array('link' => '公共库|testsuite|library', 'alias' => 'createlib,createcase,libview,edit', 'subModule' => 'tree,testcase'); -$lang->testlib->menu->create = array('link' => "创建库|testsuite|createLib|", 'float' => 'right'); -$lang->testlib->menu->index = array('link' => "测试主页|qa|index|locate=no&productID=%s", 'float' => 'right'); +$lang->caselib = new stdclass(); +$lang->caselib->menu = new stdclass(); +$lang->caselib->menu->lib = array('link' => '%s', 'fixed' => true); +$lang->caselib->menu->bug = array('link' => 'Bug|bug|browse|productID=%s'); +$lang->caselib->menu->testcase = array('link' => '用例|testcase|browse|productID=%s'); +$lang->caselib->menu->testtask = array('link' => '版本|testtask|browse|productID=%s'); +$lang->caselib->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); +$lang->caselib->menu->caselib = array('link' => '公共库|testsuite|library', 'alias' => 'createlib,createcase,libview,edit', 'subModule' => 'tree,testcase'); +$lang->caselib->menu->create = array('link' => "创建库|testsuite|createLib|", 'float' => 'right'); +$lang->caselib->menu->index = array('link' => "测试主页|qa|index|locate=no&productID=%s", 'float' => 'right'); /* 文档视图菜单设置。*/ $lang->doc = new stdclass(); diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index bea944905a..623f6aa2ef 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -237,8 +237,8 @@ $lang->qa->menu->bug = array('link' => 'Bug|bug|browse|productID=%s'); $lang->qa->menu->testcase = array('link' => '用例|testcase|browse|productID=%s'); $lang->qa->menu->testtask = array('link' => '版本|testtask|browse|productID=%s'); $lang->qa->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); -$lang->qa->menu->report = array('link' => '总结报告|testreport|browse|productID=%s'); -$lang->qa->menu->testlib = array('link' => '公共库|testsuite|library'); +$lang->qa->menu->report = array('link' => '测试报告|testreport|browse|productID=%s'); +$lang->qa->menu->caselib = array('link' => '用例库|testsuite|library'); $lang->qa->menu->index = array('link' => "测试主页|qa|index|locate=no&productID=%s", 'float' => 'right'); $lang->bug = new stdclass(); @@ -249,8 +249,8 @@ $lang->bug->menu->bug = array('link' => 'Bug|bug|browse|productID=%s', 'al $lang->bug->menu->testcase = array('link' => '用例|testcase|browse|productID=%s'); $lang->bug->menu->testtask = array('link' => '版本|testtask|browse|productID=%s'); $lang->bug->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); -$lang->bug->menu->report = array('link' => '总结报告|testreport|browse|productID=%s'); -$lang->bug->menu->testlib = array('link' => '公共库|testsuite|library'); +$lang->bug->menu->report = array('link' => '测试报告|testreport|browse|productID=%s'); +$lang->bug->menu->caselib = array('link' => '用例库|testsuite|library'); $lang->bug->menu->index = array('link' => "测试主页|qa|index|locate=no&productID=%s", 'float' => 'right'); $lang->testcase = new stdclass(); @@ -261,8 +261,8 @@ $lang->testcase->menu->bug = array('link' => 'Bug|bug|browse|productID=%s' $lang->testcase->menu->testcase = array('link' => '用例|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase,importlib,report', 'subModule' => 'tree'); $lang->testcase->menu->testtask = array('link' => '版本|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases,start,close,batchrun,groupcase'); $lang->testcase->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s', 'alias' => 'view,create,edit,linkcase'); -$lang->testcase->menu->report = array('link' => '总结报告|testreport|browse|productID=%s', 'alias' => 'view,create'); -$lang->testcase->menu->testlib = array('link' => '公共库|testsuite|library'); +$lang->testcase->menu->report = array('link' => '测试报告|testreport|browse|productID=%s', 'alias' => 'view,create'); +$lang->testcase->menu->caselib = array('link' => '用例库|testsuite|library'); $lang->testcase->menu->index = array('link' => "测试主页|qa|index|locate=no&productID=%s", 'float' => 'right'); $lang->testtask = new stdclass(); @@ -272,16 +272,16 @@ $lang->testsuite->menu = $lang->testcase->menu; $lang->testreport = new stdclass(); $lang->testreport->menu = $lang->testcase->menu; -$lang->testlib = new stdclass(); -$lang->testlib->menu = new stdclass(); -$lang->testlib->menu->lib = array('link' => '%s', 'fixed' => true); -$lang->testlib->menu->bug = array('link' => 'Bug|bug|browse|productID=%s'); -$lang->testlib->menu->testcase = array('link' => '用例|testcase|browse|productID=%s'); -$lang->testlib->menu->testtask = array('link' => '版本|testtask|browse|productID=%s'); -$lang->testlib->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); -$lang->testlib->menu->testlib = array('link' => '公共库|testsuite|library', 'alias' => 'createlib,createcase,libview,edit', 'subModule' => 'tree,testcase'); -$lang->testlib->menu->create = array('link' => "创建库|testsuite|createLib|", 'float' => 'right'); -$lang->testlib->menu->index = array('link' => "测试主页|qa|index|locate=no&productID=%s", 'float' => 'right'); +$lang->caselib = new stdclass(); +$lang->caselib->menu = new stdclass(); +$lang->caselib->menu->lib = array('link' => '%s', 'fixed' => true); +$lang->caselib->menu->bug = array('link' => 'Bug|bug|browse|productID=%s'); +$lang->caselib->menu->testcase = array('link' => '用例|testcase|browse|productID=%s'); +$lang->caselib->menu->testtask = array('link' => '版本|testtask|browse|productID=%s'); +$lang->caselib->menu->testsuite = array('link' => '套件|testsuite|browse|productID=%s'); +$lang->caselib->menu->caselib = array('link' => '用例库|testsuite|library', 'alias' => 'createlib,createcase,libview,edit', 'subModule' => 'tree,testcase'); +$lang->caselib->menu->create = array('link' => "创建库|testsuite|createLib|", 'float' => 'right'); +$lang->caselib->menu->index = array('link' => "测试主页|qa|index|locate=no&productID=%s", 'float' => 'right'); /* 文档视图菜单设置。*/ $lang->doc = new stdclass(); diff --git a/module/common/model.php b/module/common/model.php index f1b12724d9..25f17805b9 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1182,8 +1182,7 @@ class commonModel extends model global $app, $lang; /* Check is the super admin or not. */ - $account = ',' . $app->user->account . ','; - if(strpos($app->company->admins, $account) !== false) return true; + if($app->user->admin) return true; /* If not super admin, check the rights. */ $rights = $app->user->rights['rights']; diff --git a/module/company/view/browse.html.php b/module/company/view/browse.html.php index 6374de980f..d4fef3f35d 100644 --- a/module/company/view/browse.html.php +++ b/module/company/view/browse.html.php @@ -78,7 +78,7 @@ js::set('confirmDelete', $lang->user->confirmDelete); id&from=company", '', 'list'); - if(strpos($this->app->company->admins, ",{$user->account},") === false and common::hasPriv('user', 'delete')) + if($this->app->user->admin and common::hasPriv('user', 'delete')) { echo html::a($this->createLink('user', 'delete', "userID=$user->id"), '', '', "title='{$lang->user->delete}' class='btn-icon iframe'"); } diff --git a/module/doc/model.php b/module/doc/model.php index f65d4b0321..3d1ed020ec 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -604,7 +604,7 @@ class docModel extends model $account = ',' . $this->app->user->account . ','; if(isset($object->addedBy) and $object->addedBy == $this->app->user->account) return true; - if(strpos($this->app->company->admins, $account) !== false) return true; + if($this->app->user->admin) return true; if($object->acl == 'private' and strpos(",$object->users,", $account) !== false) return true; if($object->acl == 'custom') { @@ -915,7 +915,7 @@ class docModel extends model if($table) $table .= '.'; $condition = ''; $account = ',' . $this->app->user->account . ','; - if(strpos($this->app->company->admins, $account) === false) + if(!$this->app->user->admin) { $condition .= "{$table}acl='open'"; if($type == 'doc') $condition .= " OR {$table}addedBy = '{$this->app->user->account}'"; diff --git a/module/product/model.php b/module/product/model.php index a991fdc4fa..3d91d4530a 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -128,7 +128,7 @@ class productModel extends model { /* Is admin? */ $account = ',' . $this->app->user->account . ','; - if(strpos($this->app->company->admins, $account) !== false) return true; + if($this->app->user->admin) return true; $acls = $this->app->user->rights['acls']; if(!empty($acls['products']) and !in_array($product->id, $acls['products'])) return false; @@ -746,8 +746,8 @@ class productModel extends model ->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id = t2.product') ->leftJoin(TABLE_TEAM)->alias('t3')->on('t2.project = t3.project') ->leftJoin(TABLE_PROJECT)->alias('t4')->on('t2.project = t4.id') - ->beginIF(strpos($this->app->company->admins, $account) !== false)->where('t1.deleted')->eq(0)->fi() - ->beginIF(strpos($this->app->company->admins, $account) === false) + ->beginIF($this->app->user->admin)->where('t1.deleted')->eq(0)->fi() + ->beginIF(!$this->app->user->admin) ->where('t1.acl')->eq('open') ->orWhere("(t1.acl = 'custom' AND $groupSql)") ->orWhere('t1.PO')->eq($this->app->user->account) diff --git a/module/project/control.php b/module/project/control.php index a35f88cafd..47817bc0db 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -585,8 +585,8 @@ class project extends control /* Count T B C */ $storyIdList = array(); foreach($stories as $story) $storyIdList[$story->id] = $story->id; - $storyTasks = $this->loadModel('task')->getStoryTaskCounts($storyIdList); - $storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList); + $storyTasks = $this->loadModel('task')->getStoryTaskCounts($storyIdList,$projectID); + $storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList,$projectID); $storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList); /* Assign. */ diff --git a/module/project/model.php b/module/project/model.php index 40aa7703e4..fc8b36cf99 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -26,8 +26,7 @@ class projectModel extends model public function checkPriv($project) { /* If is admin, return true. */ - $account = ',' . $this->app->user->account . ','; - if(strpos($this->app->company->admins, $account) !== false) return true; + if($this->app->user->admin) return true; $acls = $this->app->user->rights['acls']; if(!empty($acls['projects']) and !in_array($project->id, $acls['projects'])) return false; diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index 6ade73d38a..f984f4a756 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -150,7 +150,7 @@ - +
    project->productStories, inlink('linkStory', "project={$project->id}")); diff --git a/module/report/control.php b/module/report/control.php index 819b34bf2f..b73e895cab 100644 --- a/module/report/control.php +++ b/module/report/control.php @@ -128,7 +128,7 @@ class report extends control $this->app->loadConfig('project'); $begin = $begin ? strtotime($begin) : time(); $end = $end ? strtotime($end) : time() + (7 * 24 * 3600); - $end += 24 * 2600; + $end += 24 * 3600; $beginWeekDay = date('w', $begin); $begin = date('Y-m-d', $begin); $end = date('Y-m-d', $end); diff --git a/module/sso/control.php b/module/sso/control.php index 06469f98b7..e577a8c83c 100644 --- a/module/sso/control.php +++ b/module/sso/control.php @@ -128,7 +128,7 @@ class sso extends control */ public function ajaxSetConfig() { - if(strpos($this->app->company->admins, $this->app->user->account) === false) die('deny'); + if(!$this->app->user->admin) die('deny'); if($_POST) { diff --git a/module/testcase/config.php b/module/testcase/config.php index 8de53999a5..8a4c99efa3 100644 --- a/module/testcase/config.php +++ b/module/testcase/config.php @@ -25,7 +25,7 @@ $config->testcase->exportFields = ' $config->testcase->customCreateFields = 'story,stage,pri,keywords'; $config->testcase->customBatchCreateFields = 'module,stage,story,pri,precondition,keywords'; -$config->testcase->customBatchEditFields = 'module,stage,precondition,status,pri,keywords'; +$config->testcase->customBatchEditFields = 'module,story,stage,precondition,status,pri,keywords'; $config->testcase->custom = new stdclass(); $config->testcase->custom->createFields = $config->testcase->customCreateFields; diff --git a/module/testcase/control.php b/module/testcase/control.php index 2e3210042a..8c20cfd08b 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -119,7 +119,7 @@ class testcase extends control $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule, $linkedLibs) : array(); $moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch); - $libModuleTree = $this->tree->getTestLibTreeInCase('case', $productID, array('treeModel', 'createCaseLink')); + $libModuleTree = $this->tree->getCaseLibTreeInCase('case', $productID, array('treeModel', 'createCaseLink')); if($libModuleTree) $moduleTree = substr($moduleTree, 0, strrpos($moduleTree, '')) . $libModuleTree . ''; /* Assign. */ @@ -190,6 +190,7 @@ class testcase extends control $this->view->users = $this->user->getPairs('noletter'); $this->view->browseType = 'group'; $this->view->groupBy = $groupBy; + $this->view->orderBy = $groupBy; $this->view->groupByList = $groupByList; $this->view->cases = $groupCases; $this->view->suiteList = $this->loadModel('testsuite')->getSuites($productID); @@ -620,7 +621,7 @@ class testcase extends control $this->view->libID = $case->lib; $this->view->libName = $libraries[$case->lib]; $this->view->libraries = $libraries; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($case->lib, $viewType = 'testlib', $startModuleID = 0); + $this->view->moduleOptionMenu = $this->tree->getOptionMenu($case->lib, $viewType = 'caselib', $startModuleID = 0); } else { @@ -635,7 +636,7 @@ class testcase extends control if($case->lib and $case->fromLib) { $libName = $this->loadModel('testsuite')->getById($case->lib)->name; - $libModules = $this->tree->getOptionMenu($case->lib, 'testlib'); + $libModules = $this->tree->getOptionMenu($case->lib, 'caselib'); foreach($libModules as $moduleID => $moduleName) { if($moduleID == 0) continue; @@ -693,7 +694,7 @@ class testcase extends control $caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList)); /* Get the edited cases. */ - $cases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($caseIDList)->fetchAll('id'); + $cases = $this->testcase->getByList($caseIDList); /* The cases of a product. */ if($productID) @@ -706,7 +707,7 @@ class testcase extends control $this->lang->testcase->menu = $this->lang->testsuite->menu; /* Set modules. */ - $modules = $this->tree->getOptionMenu($libID, $viewType = 'testlib', $startModuleID = 0, $branch); + $modules = $this->tree->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0, $branch); $modules = array('ditto' => $this->lang->testcase->ditto) + $modules; $this->view->modules = $modules; @@ -744,8 +745,29 @@ class testcase extends control $this->loadModel('my')->setMenu(); $this->view->position[] = html::a($this->server->http_referer, $this->lang->my->testCase); $this->view->title = $this->lang->testcase->batchEdit; + + /* Set modules. */ + $productIdList = array(); + $libs = array(); + $existModules = array(); + foreach($cases as $case) + { + if($case->lib and $case->fromLib) $libs[$case->lib] = $case->lib; + $productIdList[$case->product] = $case->product; + $existModules[$case->module] = $case->module; + } + + $products = $this->product->getByIdList($productIdList); + $modules = array(); + foreach($products as $product) + { + $productModules = $this->tree->getOptionMenu($product->id, $viewType = 'case', $startModuleID = 0); + foreach($productModules as $moduleID => $moduleName) $modules[$moduleID] = '/' . $product->name . $moduleName; + } + if($libs) $modules += $this->tree->getExistLibModules($libs, $existModules); + $this->view->modules = array('ditto' => $this->lang->testcase->ditto) + $modules; } - + if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']); /* Judge whether the editedTasks is too large and set session. */ $showSuhosinInfo = false; @@ -754,7 +776,7 @@ class testcase extends control if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? $this->lang->suhosinInfo : $this->lang->maxVarsInfo; $this->loadModel('story'); - $this->view->stories = $this->story->getProductStoryPairs($productID, $case->branch); + $this->view->stories = $this->story->getProductStoryPairs($productID, $branch); /* Set custom. */ foreach(explode(',', $this->config->testcase->customBatchEditFields) as $field) $customFields[$field] = $this->lang->testcase->$field; @@ -1536,7 +1558,7 @@ class testcase extends control $modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch); $libName = $libraries[$libID]; - $libModules = $this->tree->getOptionMenu($libID, 'testlib'); + $libModules = $this->tree->getOptionMenu($libID, 'caselib'); foreach($libModules as $moduleID => $moduleName) { if($moduleID == 0) continue; diff --git a/module/testcase/css/batchedit.css b/module/testcase/css/batchedit.css index df6b376c7a..4c4be58690 100644 --- a/module/testcase/css/batchedit.css +++ b/module/testcase/css/batchedit.css @@ -1,3 +1,4 @@ .w-340px {width:340px} .chosen {z-index:99} .chosen-container[id^="module"] .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important} +.chosen-container[id^="stories"] .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important} diff --git a/module/testcase/css/report.css b/module/testcase/css/report.css new file mode 100644 index 0000000000..83f749b531 --- /dev/null +++ b/module/testcase/css/report.css @@ -0,0 +1,3 @@ +.table-bordered caption {border: 1px solid #ddd;} +.table-bordered tr > th:first-child, .table-bordered tr > td:first-child {border-left: 1px solid #ddd!important} +.table-bordered tr > th:last-child, .table-bordered tr > td:last-child {border-right: 1px solid #ddd!important} diff --git a/module/testcase/css/view.css b/module/testcase/css/view.css index 45e75cea5a..9371ee4e3e 100644 --- a/module/testcase/css/view.css +++ b/module/testcase/css/view.css @@ -1 +1,5 @@ #steps {margin-bottom: 15px} +.outer .col-side{transition: all 0.1s;position: relative;} +.outer.hide-side .col-side{width:0px;} +.outer .col-side .side-handle{right:0px;top:10px;} +.outer.hide-side .main-side{display:none;} diff --git a/module/testcase/js/edit.js b/module/testcase/js/edit.js index 25970fb19a..602030e67c 100644 --- a/module/testcase/js/edit.js +++ b/module/testcase/js/edit.js @@ -53,7 +53,7 @@ function loadLinkCases(caseID) function loadLibModules(libID) { - link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=testlib&branch=0&rootModuleID=0&returnType=html&needManage=true'); + link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&needManage=true'); $('#moduleIdBox').load(link, function() { $(this).find('select').chosen(defaultChosenOptions) diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 66cd242575..6c5f269115 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -147,7 +147,7 @@ $lang->testcase->stageList['bvt'] = '版本验证阶段'; $lang->testcase->reviewResultList[''] = ''; $lang->testcase->reviewResultList['pass'] = '确认通过'; -$lang->testcase->reviewResultList['clarify'] = '有待明确'; +$lang->testcase->reviewResultList['clarify'] = '继续完善'; $lang->testcase->groups[''] = '分组查看'; $lang->testcase->groups['story'] = '需求分组'; diff --git a/module/testcase/model.php b/module/testcase/model.php index 7f3334febc..c7d9fb47ce 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -382,7 +382,7 @@ class testcaseModel extends model $cases = $this->dao->select('*')->from(TABLE_CASE)->where($caseQuery) ->beginIF($queryProductID != 'all')->andWhere('product')->eq($productID)->fi() ->andWhere('deleted')->eq(0) - ->orderBy($orderBy)->page($pager)->fetchAll(); + ->orderBy($orderBy)->page($pager)->fetchAll('id'); return $cases; } @@ -401,7 +401,7 @@ class testcaseModel extends model return $this->dao->select('t1.assignedTo AS assignedTo, t2.*')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->leftJoin(TABLE_TESTTASK)->alias('t3')->on('t1.task = t3.id') - ->Where('t1.assignedTo')->eq($account) + ->where('t1.assignedTo')->eq($account) ->andWhere('t1.status')->ne('done') ->andWhere('t3.status')->ne('done') ->andWhere('t3.deleted')->eq(0) @@ -421,6 +421,7 @@ class testcaseModel extends model public function getByOpenedBy($account, $orderBy = 'id_desc', $pager = null) { return $this->dao->findByOpenedBy($account)->from(TABLE_CASE) + ->andWhere('product')->ne(0) ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); } @@ -720,6 +721,7 @@ class testcaseModel extends model if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3; if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0; if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : ''; + if($data->stories[$caseID] == '') $data->stories[$caseID] = 0; $prev['pri'] = $data->pris[$caseID]; $prev['module'] = $data->modules[$caseID]; @@ -1264,7 +1266,7 @@ class testcaseModel extends model { $caseBugs = $this->dao->select('count(*) as count, `case`')->from(TABLE_BUG)->where('`case`')->in($caseIdList)->andWhere('deleted')->eq(0)->groupBy('`case`')->fetchPairs('case', 'count'); $results = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT)->where('`case`')->in($caseIdList)->groupBy('`case`')->fetchPairs('case', 'count'); - $caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->in($caseIdList)->groupBy('name')->orderBy('value DESC')->fetchAll('name'); + $caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->in($caseIdList)->groupBy('name')->orderBy('value DESC')->fetchPairs('name','value'); $stepNumber = $this->dao->select('count(distinct t1.id) as count, t1.`case`')->from(TABLE_CASESTEP)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.`case`=t2.`id`') ->where('t1.`case`')->in($caseIdList) @@ -1284,13 +1286,13 @@ class testcaseModel extends model ->fetchPairs('case', 'count'); } - foreach($cases as $case) + foreach($cases as $key => $case) { $caseID = $type == 'case' ? $case->id : $case->case; - $case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0; - $case->results = isset($results[$caseID]) ? $results[$caseID] : 0; - $case->caseFailCount = isset($results[$caseID]) ? $caseFailCount[$caseID]->value : 0; - $case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0; + $case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0; + $case->results = isset($results[$caseID]) ? $results[$caseID] : 0; + $case->caseFailCount = isset($caseFailCount[$caseID])? $caseFailCount[$caseID] : 0; + $case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0; } return $cases; diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index 01e8dd07bb..f3fa234c67 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -36,7 +36,7 @@ foreach(explode(',', $showFields) as $field) '> priAB;?> '>statusAB;?> '>testcase->module;?> - testcase->story;?> + '>testcase->story;?> testcase->title;?> testcase->type;?> '> testcase->precondition;?> diff --git a/module/testcase/view/createbug.html.php b/module/testcase/view/createbug.html.php index bb5433aa15..dce1e2c1e6 100644 --- a/module/testcase/view/createbug.html.php +++ b/module/testcase/view/createbug.html.php @@ -11,7 +11,7 @@ */ ?> -
    product&branch=$case->branch&extras=caseID=$case->id,version=$case->version,runID=")?>' target='_parent' method='post'> +
    @@ -29,6 +29,17 @@ $(function() $this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show);; }); + $(".step-group input[type='checkbox']").click(function() + { + var $next = $(this).closest('tr').next(); + while($next.length && $next.hasClass('step-item')) + { + var isChecked = $(this).prop('checked'); + $next.find("input[type='checkbox']").prop('checked', isChecked); + $next = $next.next(); + } + }); + $('#casesResults table caption .result-tip').html($('#resultTip').html()); $('tr').remove('#result-success'); diff --git a/module/testcase/view/importlib.html.php b/module/testcase/view/importlib.html.php index 1aa64836d1..e07cad654b 100644 --- a/module/testcase/view/importlib.html.php +++ b/module/testcase/view/importlib.html.php @@ -17,7 +17,7 @@ icons['import']);?> testcase->importFromLib;?>
    testcase->selectLib;?> - +
    diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index 5ef1a1ff58..a554d9365d 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -48,7 +48,7 @@ common::printIcon('testtask', 'runCase', "runID=$runID&caseID=$case->id&version=$case->currentVersion", '', 'button', '', '', 'runCase', false, "data-width='95%'"); common::printIcon('testtask', 'results', "runID=$runID&caseID=$case->id&version=$case->version", '', 'button', '', '', 'results', false, "data-width='95%'"); - if($caseFailCount > 0) common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", '', 'button', 'bug', '', 'iframe'); + if($caseFailCount > 0) common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", '', 'button', 'bug', '', 'iframe', '', "data-width='90%'"); } if($config->testcase->needReview) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'button', 'review', '', 'iframe'); echo '
    '; @@ -127,6 +127,7 @@
    +
    testcase->legendBasicInfo;?> diff --git a/module/testreport/control.php b/module/testreport/control.php index 6a8eaac2a0..37cb35f49c 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -31,6 +31,7 @@ class testreport extends control $this->loadModel('testcase'); $this->loadModel('testtask'); $this->loadModel('user'); + $this->app->loadLang('report'); } /** @@ -190,15 +191,9 @@ class testreport extends control $this->view->cases = $cases; $this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases); - $this->view->legacyBugs = $bugInfo['legacyBugs']; - $this->view->bugSeverityGroups = $bugInfo['bugSeverityGroups']; - $this->view->bugStatusGroups = $bugInfo['bugStatusGroups']; - $this->view->bugOpenedByGroups = $bugInfo['bugOpenedByGroups']; - $this->view->bugResolvedByGroups = $bugInfo['bugResolvedByGroups']; - $this->view->bugResolutionGroups = $bugInfo['bugResolutionGroups']; - $this->view->bugModuleGroups = $bugInfo['bugModuleGroups']; - $this->view->bugConfirmedRate = $bugInfo['bugConfirmedRate']; - $this->view->bugCreateByCaseRate = $bugInfo['bugCreateByCaseRate']; + $this->view->legacyBugs = $bugInfo['legacyBugs']; + unset($bugInfo['legacyBugs']); + $this->view->bugInfo = $bugInfo; $this->view->objectID = $objectID; $this->view->objectType = $objectType; @@ -212,22 +207,22 @@ class testreport extends control * @access public * @return void */ - public function view($reportID) + public function view($reportID, $from = 'product') { $report = $this->testreport->getById($reportID); $project = $this->project->getById($report->project); - if($report->objectType == 'testtask') + if($from == 'product' and is_numeric($report->product)) { - $task = $this->testtask->getById($report->objectID); - $productID = $this->commonAction($task->product, 'product'); - if($productID != $task->product) die('deny access'); + $product = $this->product->getById($report->product); + $productID = $this->commonAction($report->product, 'product'); + if($productID != $report->product) die('deny access'); - $browseLink = inlink('browse', "objectID=$productID&objectType=product&extra={$report->objectID}"); - $this->view->position[] = html::a($browseLink, $task->name); + $browseLink = inlink('browse', "objectID=$productID&objectType=product"); + $this->view->position[] = html::a($browseLink, $product->name); } - elseif($report->objectType == 'project') + else { - $projectID = $this->commonAction($report->objectID, 'project'); + $projectID = $this->commonAction($report->project, 'project'); if($projectID != $report->objectID) die('deny access'); $browseLink = inlink('browse', "objectID=$projectID&objectType=project"); @@ -268,15 +263,9 @@ class testreport extends control $this->view->storySummary = $this->product->summary($stories); $this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases); - $this->view->legacyBugs = $bugInfo['legacyBugs']; - $this->view->bugSeverityGroups = $bugInfo['bugSeverityGroups']; - $this->view->bugStatusGroups = $bugInfo['bugStatusGroups']; - $this->view->bugOpenedByGroups = $bugInfo['bugOpenedByGroups']; - $this->view->bugResolvedByGroups = $bugInfo['bugResolvedByGroups']; - $this->view->bugResolutionGroups = $bugInfo['bugResolutionGroups']; - $this->view->bugModuleGroups = $bugInfo['bugModuleGroups']; - $this->view->bugConfirmedRate = $bugInfo['bugConfirmedRate']; - $this->view->bugCreateByCaseRate = $bugInfo['bugCreateByCaseRate']; + $this->view->legacyBugs = $bugInfo['legacyBugs']; + unset($bugInfo['legacyBugs']); + $this->view->bugInfo = $bugInfo; $this->display(); } @@ -318,23 +307,10 @@ class testreport extends control $this->session->set('notHead', true); $output = $this->fetch('testreport', 'view', array('reportID' =>$reportID)); $this->session->set('notHead', false); - $style = << -body{font-size:14px}h1{font-size:16px;text-align:center} -.w-100px{width:100px}.w-p50{width:50%}.w-id{width:70px}.w-pri{width:40px}.w-user{width:80px}.w-80px{width:80px}.w-70px{width:70px}.w-hour[width:57px].w-status{width:60px}.w-130px{width:130px;}.w-type{width:80px}.w-150px{width:150px;} -.text-center{text-align:center}.text-top{vertical-align:top;}.text-left{text-align:left}.text-right{text-align:right;} -.table{width:100%;margin-bottom:5px;border:1px solid #ddd;border-collapse:collapse;border-spacing:0;} -.table caption{padding:8px 20px;border:1px solid #DDD;border-bottom:0;background:#fafafa;text-align:left}.table td, .table th{border-bottom:1px solid #ddd;padding:5px;} -.table>thead>tr>th{text-align:center;vertical-align:middle;background-color:#f1f1f1;border-bottom:1px solid #ddd;} -.table-form{border: none;}.table-form>tbody>tr>th,.table-form>tbody>tr>td{border-bottom:none;}.table-form>tbody>tr>th{text-align:right;} -.input-group{width:100%;}.input-group{position:relative;display:table;border-collapse:separate;} -.input-group-addon:first-child {border-right:0;} -.input-group-addon{background-color:#f5f5f5;padding:6px 12px;font-size:13px;font-weight:400;line-height:1;color:#222;text-align:center;background-color:#e5e5e5;border:1px solid #ccc;border-radius:0;display:table-cell;} -.input-group-addon:first-child{border-top-right-radius:0;border-bottom-right-radius:0;} -fieldset{margin-bottom:15px;border:1px solid #e5e5e5;padding:10px 15px 15px;}fieldset>legend{width:auto;margin:0 0 0 -5px;font-weight:bold;border-bottom:none;padding:0 5px;display:block;} - -EOD; - $content = "\n\n\n\n{$report->title}\n$style\n\n

    {$report->title}

    \n$output"; + $css = ''; + $js = ''; + $exportNotice = "

    " . $this->lang->testreport->exportNotice . '

    '; + $content = "\n\n\n\n{$report->title}\n$css\n$js\n\n\n

    {$report->title}

    \n$output\n$exportNotice"; $this->fetch('file', 'sendDownHeader', array('fileName' => $data->fileName, 'fileType' => $data->fileType, 'content' =>$content)); } $this->view->customExport = false; diff --git a/module/testreport/css/common.css b/module/testreport/css/common.css new file mode 100644 index 0000000000..9292beb5a8 --- /dev/null +++ b/module/testreport/css/common.css @@ -0,0 +1,3 @@ +.none-data{padding:8px !important;} +.main #stories{margin-bottom:10px} +.main .table-report{border:0px;} diff --git a/module/testreport/css/export.css b/module/testreport/css/export.css new file mode 100644 index 0000000000..47a973d389 --- /dev/null +++ b/module/testreport/css/export.css @@ -0,0 +1,13 @@ +body{font-size:14px}h1{font-size:16px;text-align:center} +.w-100px{width:100px}.w-p50{width:50%}.w-p70{width:70%}.w-id{width:70px}.w-pri{width:40px}.w-user{width:80px}.w-80px{width:80px}.w-70px{width:70px}.w-hour[width:57px].w-status{width:60px}.w-130px{width:130px;}.w-type{width:80px}.w-150px{width:150px;} +.text-center{text-align:center}.text-top{vertical-align:top;}.text-left{text-align:left}.text-right{text-align:right;} +.table{width:100%;margin-bottom:5px;border:1px solid #ddd;border-collapse:collapse;border-spacing:0;} +.table caption{padding:8px 20px;border:1px solid #DDD;border-bottom:0;background:#fafafa;text-align:left}.table td, .table th{border-bottom:1px solid #ddd;padding:5px;} +.table>thead>tr>th{text-align:center;vertical-align:middle;background-color:#f1f1f1;border-bottom:1px solid #ddd;} +.main .nav-tabs{padding-left: 20px;padding-top:10px;margin-bottom:0;list-style:none;} +.main .nav-tabs:after{clear:both;display:table;content:" ";} +.nav-tabs > li{float:left;margin-bottom:-1px;position:relative;display:block;} +.nav-tabs > li > a{padding:5px 10px;color:#333;line-height:20px;max-height:32px;margin-right:2px;border:1px solid transparent;border-radius:0;position:relative;display:block;text-decoration:none;outline:none;} +.nav-tabs > li.active > a,.nav-tabs > li.active > a:hover,.nav-tabs > li.active > a:focus{color:#333;font-weight:bold;line-height: 20px;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent;} +.tab-pane{display:none} +.tab-pane.active{display:block} diff --git a/module/testreport/css/view.css b/module/testreport/css/view.css new file mode 100644 index 0000000000..3ac466dc33 --- /dev/null +++ b/module/testreport/css/view.css @@ -0,0 +1,4 @@ +.main{padding:0px !important;} +.main .nav-tabs{padding-left:20px; padding-top:10px;} +.main .tab-content{border:0px;} +.tab-content #builds tr:last-child td, .tab-content #cases tr:last-child td,.tab-content #bugs tr:last-child td,.tab-content #legacyBugs tr:last-child td{border-bottom:0px;} diff --git a/module/testreport/js/create.js b/module/testreport/js/create.js new file mode 100644 index 0000000000..4c34ff1682 --- /dev/null +++ b/module/testreport/js/create.js @@ -0,0 +1,16 @@ +$(function() +{ + var resizeChartTable = function() + { + $('.table-wrapper').each(function() + { + var $this = $(this); + $this.css('max-height', $this.closest('.table').find('.chart-wrapper').outerHeight()); + }); + }; + resizeChartTable(); + fixedTableHead('.table-wrapper'); + + $('.tab-pane').removeClass('active'); + $('.tab-pane:first').addClass('active'); +}); diff --git a/module/testreport/js/export.js b/module/testreport/js/export.js new file mode 100644 index 0000000000..559f3952cf --- /dev/null +++ b/module/testreport/js/export.js @@ -0,0 +1,33 @@ +function tab() +{ + tabContent = new Array(); + var divTags=document.getElementsByTagName("div"); + for(var divKey in divTags) + { + if(typeof(divTags[divKey]) == 'object' && divTags[divKey].getAttribute('class').indexOf('tab-pane') >= 0) + { + tabContent.push(divTags[divKey]); + divTags[divKey].setAttribute('class', 'tab-pane'); + } + } + tabContent[0].setAttribute('class', 'tab-pane active'); + + var aTags=document.getElementsByTagName("a"); + for(var i = 0;itestreport->report = '总结'; $lang->testreport->legacyBugs = '遗留的Bug'; $lang->testreport->createdDate = '创建时间'; $lang->testreport->objectID = '所属对象'; +$lang->testreport->profile = '概况'; $lang->testreport->value = '值'; $lang->testreport->none = '无'; $lang->testreport->all = '所有报告'; $lang->testreport->legendBasic = '基本信息'; -$lang->testreport->legendStoryAndBug = '测试的需求和Bug'; -$lang->testreport->legendBuild = '版本信息'; -$lang->testreport->legendCase = '执行的用例的信息'; -$lang->testreport->legendBug = '缺陷信息'; +$lang->testreport->legendStoryAndBug = '测试范围'; +$lang->testreport->legendBuild = '测试轮次'; +$lang->testreport->legendCase = '执行的用例'; +$lang->testreport->legendLegacyBugs = '遗留的Bug'; +$lang->testreport->legendReport = '报表'; +$lang->testreport->legendMore = '更多功能'; -$lang->testreport->bugSeverityGroups = '产生Bug严重级别分布'; -$lang->testreport->bugStatusGroups = '产生Bug状态分布'; -$lang->testreport->bugOpenedByGroups = '产生Bug创建者分布'; -$lang->testreport->bugResolvedByGroups = '产生Bug解决者分布'; -$lang->testreport->bugResolutionGroups = '产生Bug解决方案分布'; -$lang->testreport->bugModuleGroups = '产生Bug模块分布'; +$lang->testreport->bugSeverityGroups = 'Bug严重级别分布'; +$lang->testreport->bugStatusGroups = 'Bug状态分布'; +$lang->testreport->bugOpenedByGroups = 'Bug创建者分布'; +$lang->testreport->bugResolvedByGroups = 'Bug解决者分布'; +$lang->testreport->bugResolutionGroups = 'Bug解决方案分布'; +$lang->testreport->bugModuleGroups = 'Bug模块分布'; $lang->testreport->legacyBugs = '遗留的Bug'; $lang->testreport->bugConfirmedRate = '有效Bug率 (确认的Bug / 测试创建的Bug)'; $lang->testreport->bugCreateByCaseRate = '用例发现Bug率 (用例创建的Bug / 时间区间中新增的Bug)'; -$lang->testreport->caseSummary = '共有%s个用例,共执行%s个用例,产生了%s个结果,失败的用例有%s个'; +$lang->testreport->caseSummary = '共有%s个用例,共执行%s个用例,产生了%s个结果,失败的用例有%s个。'; +$lang->testreport->buildSummary = '共测试了%s个版本。'; +$lang->testreport->bugSummary = '共产生%s个Bug,遗留%s个Bug。有效Bug率(确认的Bug / 产生的Bug):%s,用例发现Bug率(用例创建的Bug / 时间区间中新增的Bug):%s'; $lang->testreport->confirmDelete = '是否删除该报告?'; +$lang->testreport->exportNotice = "由禅道项目管理软件导出"; diff --git a/module/testreport/model.php b/module/testreport/model.php index 852b7515a9..982d9317e6 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -93,7 +93,7 @@ class testreportModel extends model return $this->dao->select('*')->from(TABLE_TESTREPORT)->where('deleted')->eq(0) ->beginIF($objectType == 'project')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->fi() ->beginIF($objectType == 'product' and $extra)->andWhere('objectID')->eq((int)$extra)->andWhere('objectType')->eq('testtask')->fi() - ->beginIF($objectType == 'product' and empty($extra))->andWhere("CONCAT(',', product, ',') like '%,$objectID,%'")->fi() + ->beginIF($objectType == 'product' and empty($extra))->andWhere('product')->eq($objectID)->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); @@ -136,12 +136,13 @@ class testreportModel extends model if($bug->case) $byCaseNum ++; } $bugInfo['legacyBugs'] = $legacyBugs; + $bugInfo['countBugByTask'] = count($bugsByTask); $bugInfo['bugSeverityGroups'] = $severityGroups; $bugInfo['bugStatusGroups'] = $statusGroups; - $bugInfo['bugOpenedByGroups'] = $openedByGroups; - $bugInfo['bugResolvedByGroups'] = $resolvedByGroups; $bugInfo['bugResolutionGroups'] = $resolutionGroups; + $bugInfo['bugOpenedByGroups'] = $openedByGroups; $bugInfo['bugModuleGroups'] = $moduleGroups; + $bugInfo['bugResolvedByGroups'] = $resolvedByGroups; $bugInfo['bugConfirmedRate'] = round($confirmedNum / count($bugsByTask) * 100, 2); $bugInfo['bugCreateByCaseRate'] = empty($byCaseNum) ? 0 : round($byCaseNum / count($newBugs) * 100, 2); return $bugInfo; @@ -175,15 +176,19 @@ class testreportModel extends model */ public function getResultSummary($tasks, $cases) { - $results = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('run')->in(array_keys($tasks))->andWhere('`case`')->in(array_keys($cases))->fetchAll(); + $results = $this->dao->select('t1.*')->from(TABLE_TESTRESULT)->alias('t1') + ->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.run=t2.id') + ->where('t2.task')->in(array_keys($tasks)) + ->andWhere('t1.`case`')->in(array_keys($cases)) + ->fetchAll(); $failResults = array(); $runCasesNum = array(); foreach($results as $result) { - $runCases[$result->case] = $result->case; + $runCasesNum[$result->case] = $result->case; if($result->caseResult == 'fail') $failResults[$result->case] = $result->case; } - return sprintf($this->lang->testreport->caseSummary, count($cases), count($results), count($runCasesNum), count($failResults)); + return sprintf($this->lang->testreport->caseSummary, count($cases), count($runCasesNum), count($results), count($failResults)); } /** diff --git a/module/testreport/view/blockbuginfo.html.php b/module/testreport/view/blockbuginfo.html.php deleted file mode 100644 index 31d3213673..0000000000 --- a/module/testreport/view/blockbuginfo.html.php +++ /dev/null @@ -1,109 +0,0 @@ - - testreport->bugInfo?> - -
    - testreport->bugConfirmedRate?> - - testreport->bugCreateByCaseRate?> - -
    - - - - - - - - - - - -
    - - - - - - - bug->severityList as $severityKey => $severityValue):?> - - - - - -
    testreport->bugSeverityGroups?>
    bug->severity?>testreport->value?>
    -
    - - - - - - - bug->statusList as $statusKey => $statusValue):?> - - - - - - -
    testreport->bugStatusGroups?>
    bug->status?>testreport->value?>
    -
    - - - - - - - bug->resolutionList as $resolutionKey => $resolutionValue):?> - - - - - -
    testreport->bugResolutionGroups?>
    bug->resolution?>testreport->value?>
    -
    - - - - - - - $num):?> - - - - - -
    testreport->bugOpenedByGroups?>
    bug->openedBy?>testreport->value?>
    -
    - - - - - - - - $num):?> - - - - - -
    testreport->bugModuleGroups?>
    bug->module?>testreport->value?>
    -
    - - - - - - - $num):?> - - - - - -
    testreport->bugResolvedByGroups?>
    bug->resolvedBy?>testreport->value?>
    -
    - - diff --git a/module/testreport/view/blockbugreport.html.php b/module/testreport/view/blockbugreport.html.php new file mode 100644 index 0000000000..ebaa0219ec --- /dev/null +++ b/module/testreport/view/blockbugreport.html.php @@ -0,0 +1,70 @@ + + + $infoValue):?> + ';?> + + + ';?> + +
    + + + + + + + + + + + + +
    +
    testreport->$infoKey?>
    + testreport->none;?> +
    +
    +
    testreport->$infoKey?>
    +
    + + + + + +
    +
    +
    +
    + + + + + + + + + bug->severityList; + if($infoKey == 'bugStatusGroups') $list = $lang->bug->statusList; + if($infoKey == 'bugResolutionGroups') $list = $lang->bug->resolutionList; + ?> + $listValue):?> + + + + + + + + +
    report->item;?>report->value;?>report->percent;?>
    +
    +
    +
    diff --git a/module/testreport/view/blockbugs.html.php b/module/testreport/view/blockbugs.html.php index e3c75c13f0..67925c47ea 100644 --- a/module/testreport/view/blockbugs.html.php +++ b/module/testreport/view/blockbugs.html.php @@ -1,35 +1,30 @@ - - testreport->bugs?> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    idAB;?> priAB;?> bug->title;?> openedByAB;?>bug->resolvedBy;?>bug->resolvedDate;?> statusAB;?>
    id . html::hidden('bugs[]', $bug->id)?>bug->priList, $bug->pri);?>title?>openedBy);?>resolvedBy);?>resolvedDate != '0000-00-00 00:00:00') echo substr($bug->resolvedDate, 2);?>bug->statusList, $bug->status);?>
    - - testreport->none;?> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    idAB;?> priAB;?> bug->title;?> openedByAB;?>bug->resolvedBy;?>bug->resolvedDate;?> statusAB;?>
    id . html::hidden('bugs[]', $bug->id)?>bug->priList, $bug->pri);?>title?>openedBy);?>resolvedBy);?>resolvedDate != '0000-00-00 00:00:00') echo substr($bug->resolvedDate, 2);?>bug->statusList, $bug->status);?>
    testreport->none;?>
    diff --git a/module/testreport/view/blockbuilds.html.php b/module/testreport/view/blockbuilds.html.php index ec7051ad3e..17ec7c063a 100644 --- a/module/testreport/view/blockbuilds.html.php +++ b/module/testreport/view/blockbuilds.html.php @@ -1,4 +1,3 @@ - @@ -8,6 +7,7 @@ + @@ -18,7 +18,7 @@ + + +
    build->date;?>
    - - - diff --git a/module/testreport/view/blockcases.html.php b/module/testreport/view/blockcases.html.php index 1ceb5b1bb5..881616253f 100644 --- a/module/testreport/view/blockcases.html.php +++ b/module/testreport/view/blockcases.html.php @@ -1,4 +1,3 @@ - @@ -13,6 +12,7 @@ + @@ -28,8 +28,7 @@ - + + +
    statusAB;?>
    testreport->none;?>
    - -testreport->none;?> - diff --git a/module/testreport/view/blocklegacybugs.html.php b/module/testreport/view/blocklegacybugs.html.php index bc9fa651aa..523a4dfd17 100644 --- a/module/testreport/view/blocklegacybugs.html.php +++ b/module/testreport/view/blocklegacybugs.html.php @@ -1,35 +1,30 @@ - - testreport->legacyBugs?> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    idAB;?> priAB;?> bug->title;?> openedByAB;?>bug->resolvedBy;?>bug->resolvedDate;?> statusAB;?>
    id?>bug->priList, $bug->pri);?>title?>openedBy);?>resolvedBy);?>resolvedDate != '0000-00-00 00:00:00') echo substr($bug->resolvedDate, 2);?>bug->statusList, $bug->status);?>
    - - testreport->none;?> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    idAB;?> priAB;?> bug->title;?> openedByAB;?>bug->resolvedBy;?>bug->resolvedDate;?> statusAB;?>
    id?>bug->priList, $bug->pri);?>title?>openedBy);?>resolvedBy);?>resolvedDate != '0000-00-00 00:00:00') echo substr($bug->resolvedDate, 2);?>bug->statusList, $bug->status);?>
    testreport->none;?>
    diff --git a/module/testreport/view/blockstories.html.php b/module/testreport/view/blockstories.html.php index afb7b2fa51..1eb2afe1d9 100644 --- a/module/testreport/view/blockstories.html.php +++ b/module/testreport/view/blockstories.html.php @@ -1,38 +1,32 @@ - - testreport->stories?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    idAB;?> priAB;?> story->title;?>openedByAB;?>assignedToAB;?>story->estimateAB;?>statusAB;?>story->stageAB;?>
    id . html::hidden('stories[]', $story->id)?>story->priList, $story->pri);?>title?>openedBy);?>assignedTo);?>estimate?>story->statusList, $story->status);?>story->stageList, $story->stage);?>
    - - testreport->none;?> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    idAB;?> priAB;?> story->title;?>openedByAB;?>assignedToAB;?>story->estimateAB;?>statusAB;?>story->stageAB;?>
    id . html::hidden('stories[]', $story->id)?>story->priList, $story->pri);?>title?>openedBy);?>assignedTo);?>estimate?>story->statusList, $story->status);?>story->stageList, $story->stage);?>
    testreport->none;?>
    diff --git a/module/testreport/view/browse.html.php b/module/testreport/view/browse.html.php index 7611fd2e36..83cc25c448 100644 --- a/module/testreport/view/browse.html.php +++ b/module/testreport/view/browse.html.php @@ -34,7 +34,7 @@ id?> - id"), $report->title)?> + id&from=$objectType"), $report->title)?> createdBy);?> createdDate, 2);?> +
    @@ -35,47 +36,64 @@
    testreport->legendBasic?> - - - - - - - - - - - - - - - - - - +
    testreport->startEnd?> -
    - - ~ - - id) . html::hidden('tasks', $tasks); - echo html::hidden('objectID', $objectID) . html::hidden('objectType', $objectType); - ?> -
    -
    -
    - testreport->owner?> - -
    -
    testreport->member?>
    testreport->title?>
    testreport->goal?>desc?>
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    testreport->startEnd?> +
    + + ~ + + id) . html::hidden('tasks', $tasks); + echo html::hidden('objectID', $objectID) . html::hidden('objectType', $objectType); + ?> +
    +
    +
    + testreport->owner?> + +
    +
    testreport->member?>
    testreport->title?>
    testreport->goal?>desc?>
    testreport->profile?> + ' . $storySummary . '

    '; + echo '

    ' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '

    '; + echo '

    ' . sprintf($lang->testreport->bugSummary, $bugInfo['countBugByTask'], count($legacyBugs), $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '

    '; + unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); + ?> +
    testreport->report?>
    files?>fetch('file', 'buildform');?>
    testreport->legendStoryAndBug?> - -
    testreport->legendBuild?> @@ -86,19 +104,12 @@
    - testreport->legendBug?> - + testreport->legendLegacyBugs?> - -
    - testreport->report?> - -
    -
    - files?> - fetch('file', 'buildform');?> + testreport->legendReport?> +
    diff --git a/module/testreport/view/export.html.php b/module/testreport/view/export.html.php index 96740ee99d..807f6be5cd 100644 --- a/module/testreport/view/export.html.php +++ b/module/testreport/view/export.html.php @@ -10,8 +10,65 @@ * @link http://www.zentao.net */ ?> + exportFileTypeList); $lang->exportFileTypeList['html'] = 'html'; -include '../../file/view/export.html.php'; ?> + +
    +
    + icons['export']);?> + export;?> +
    +
    +
    + + + + + + +
    +
    + setFileName;?> + +
    +
    + exportFileTypeList, '', 'onchange=switchEncode(this.value) class="form-control"');?> + +
    + export, "onclick='setDownloading();' ");?> +
    +
    +
    + diff --git a/module/testreport/view/view.html.php b/module/testreport/view/view.html.php index 6adb111498..4dd6945347 100644 --- a/module/testreport/view/view.html.php +++ b/module/testreport/view/view.html.php @@ -12,6 +12,7 @@ ?> session->notHead):?> +
    @@ -26,6 +27,9 @@ echo "
    "; common::printIcon('testreport', 'export', "reportID=$report->id", '', 'button', 'download-alt', '', 'iframe'); + echo '
    '; + + echo "
    "; if(common::hasPriv('testreport', 'create')) echo html::a(inLink('create', "objectID=$report->objectID&objectType=$report->objectType"), "", '', "class='btn' title='{$lang->testreport->recreate}'"); common::printIcon('testreport', 'delete', "reportID=$report->id", '', 'button', '', 'hiddenwin'); echo '
    '; @@ -42,57 +46,66 @@
    -
    - testreport->legendBasic?> - - - - - - - - - - - - - - - - - - -
    testreport->startEnd?> begin . ' ~ ' . $report->end;?>
    testreport->owner?>owner);?>
    testreport->member?>members) as $member)echo zget($users, $member) . '   ';?>
    testreport->goal?>desc?>
    -
    -
    - testreport->legendStoryAndBug?> - + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + session->notHead):?> + + + + + +
    testreport->startEnd?> begin . ' ~ ' . $report->end;?>
    testreport->owner?>owner);?>
    testreport->member?>members) as $member)echo zget($users, $member) . '   ';?>
    testreport->goal?>desc?>
    testreport->profile?> + ' . $storySummary . '

    '; + echo '

    ' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '

    '; + echo '

    ' . sprintf($lang->testreport->bugSummary, $bugInfo['countBugByTask'], count($legacyBugs), $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '

    '; + unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); + ?> +
    testreport->report?>report;?>
    files?>fetch('file', 'printFiles', array('files' => $report->files, 'fieldset' => 'false'));?>
    +
    +
    - -
    -
    - testreport->legendBuild?> - -
    -
    - testreport->legendCase?> - -
    -
    - testreport->legendBug?> - - - -
    -
    -
    - testreport->report?> -
    report;?>
    -
    - session->notHead):?> - fetch('file', 'printFiles', array('files' => $report->files, 'fieldset' => 'true'));?> - +
    +
    +
    +
    +
    +
    session->notHead):?> diff --git a/module/testsuite/control.php b/module/testsuite/control.php index 0e7a55d24d..f71dec65b3 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -161,7 +161,7 @@ class testsuite extends control if(dao::isError()) die(js::error(dao::getError())); if($changes) { - $objectType = $suite->type == 'library' ? 'testlib' : 'testsuite'; + $objectType = $suite->type == 'library' ? 'caselib' : 'testsuite'; $actionID = $this->loadModel('action')->create($objectType, $suiteID, 'edited'); $this->action->logHistory($actionID, $changes); } @@ -178,7 +178,7 @@ class testsuite extends control $this->view->title = $libraries[$suiteID] . $this->lang->colon . $this->lang->testsuite->edit; $this->view->position[] = html::a($this->createLink('testsuite', 'library', "libID=$suiteID"), $libraries[$suiteID]); - $this->view->position[] = $this->lang->testlib->common; + $this->view->position[] = $this->lang->caselib->common; } else { @@ -381,8 +381,8 @@ class testsuite extends control /* Set menu. */ $libID = $this->testsuite->saveLibState($libID, $libraries); - setcookie('preTestLibID', $libID, $this->config->cookieLife, $this->config->webRoot); - if($this->cookie->preTestLibID != $libID) + setcookie('preCaseLibID', $libID, $this->config->cookieLife, $this->config->webRoot); + if($this->cookie->preCaseLibID != $libID) { $_COOKIE['libCaseModule'] = 0; setcookie('libCaseModule', 0, $this->config->cookieLife, $this->config->webRoot); @@ -415,9 +415,9 @@ class testsuite extends control $this->loadModel('datatable'); $this->loadModel('tree'); $showModule = !empty($this->config->datatable->testsuiteLibrary->showModule) ? $this->config->datatable->testsuiteLibrary->showModule : ''; - $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($libID, 'testlib', $showModule) : array(); + $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($libID, 'caselib', $showModule) : array(); - $this->view->title = $this->lang->testlib->common . $this->lang->colon . $libraries[$libID]; + $this->view->title = $this->lang->caselib->common . $this->lang->colon . $libraries[$libID]; $this->view->position[] = html::a($this->createLink('testsuite', 'library', "libID=$libID"), $libraries[$libID]); $this->view->libID = $libID; @@ -425,8 +425,8 @@ class testsuite extends control $this->view->cases = $cases; $this->view->orderBy = $orderBy; $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); - $this->view->modules = $this->tree->getOptionMenu($libID, $viewType = 'testlib', $startModuleID = 0); - $this->view->moduleTree = $this->tree->getTreeMenu($libID, $viewType = 'testlib', $startModuleID = 0, array('treeModel', 'createTestLibLink'), ''); + $this->view->modules = $this->tree->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0); + $this->view->moduleTree = $this->tree->getTreeMenu($libID, $viewType = 'caselib', $startModuleID = 0, array('treeModel', 'createCaseLibLink'), ''); $this->view->pager = $pager; $this->view->browseType = $browseType; $this->view->moduleID = $moduleID; @@ -449,7 +449,7 @@ class testsuite extends control { $libID = $this->testsuite->createLib(); if(dao::isError()) die(js::error(dao::getError())); - $this->loadModel('action')->create('testlib', $libID, 'opened'); + $this->loadModel('action')->create('caselib', $libID, 'opened'); die(js::locate($this->createLink('testsuite', 'library', "libID=$libID"), 'parent')); } @@ -458,9 +458,9 @@ class testsuite extends control $libID = $this->testsuite->saveLibState(0, $libraries); $this->testsuite->setLibMenu($libraries, $libID); - $this->view->title = $this->lang->testlib->common . $this->lang->colon . $this->lang->testlib->create; - $this->view->position[] = $this->lang->testlib->common; - $this->view->position[] = $this->lang->testlib->create; + $this->view->title = $this->lang->caselib->common . $this->lang->colon . $this->lang->caselib->create; + $this->view->position[] = $this->lang->caselib->common; + $this->view->position[] = $this->lang->caselib->create; $this->display(); } @@ -544,7 +544,7 @@ class testsuite extends control $this->view->precondition = $precondition; $this->view->keywords = $keywords; $this->view->steps = $steps; - $this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'testlib', $startModuleID = 0); + $this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0); $this->display(); } @@ -570,7 +570,7 @@ class testsuite extends control $this->view->position[] = $this->lang->testsuite->view; $this->view->lib = $lib; - $this->view->actions = $this->loadModel('action')->getList('testlib', $libID); + $this->view->actions = $this->loadModel('action')->getList('caselib', $libID); $this->display(); } diff --git a/module/testsuite/js/createcase.js b/module/testsuite/js/createcase.js index 5941fc3bbc..6bc99c2bb1 100644 --- a/module/testsuite/js/createcase.js +++ b/module/testsuite/js/createcase.js @@ -2,7 +2,7 @@ var newRowID = 0; function loadLibModules(libID) { - link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=testlib&branch=0&rootModuleID=0&returnType=html&needManage=true'); + link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&needManage=true'); $('#moduleIdBox').load(link, function() { $(this).find('select').chosen(defaultChosenOptions) diff --git a/module/testsuite/lang/en.php b/module/testsuite/lang/en.php index 2c064f3f25..5b36b5d5a5 100644 --- a/module/testsuite/lang/en.php +++ b/module/testsuite/lang/en.php @@ -43,7 +43,7 @@ $lang->testsuite->lblUnlinkCase = 'Unlink Case'; $lang->testsuite->authorList['private'] = 'Private'; $lang->testsuite->authorList['public'] = 'Public'; -$lang->testlib->common = 'Test Library'; -$lang->testlib->create = 'Create'; -$lang->testlib->edit = 'Edit'; -$lang->testlib->all = 'All'; +$lang->caselib->common = 'Test Library'; +$lang->caselib->create = 'Create'; +$lang->caselib->edit = 'Edit'; +$lang->caselib->all = 'All'; diff --git a/module/testsuite/lang/zh-cn.php b/module/testsuite/lang/zh-cn.php index 9be9039107..817e38144f 100644 --- a/module/testsuite/lang/zh-cn.php +++ b/module/testsuite/lang/zh-cn.php @@ -43,7 +43,7 @@ $lang->testsuite->lblUnlinkCase = '移除用例'; $lang->testsuite->authorList['private'] = '私有'; $lang->testsuite->authorList['public'] = '公开'; -$lang->testlib->common = '公共用例库'; -$lang->testlib->create = '创建库'; -$lang->testlib->edit = '编辑'; -$lang->testlib->all = '所有公共库'; +$lang->caselib->common = '公共用例库'; +$lang->caselib->create = '创建库'; +$lang->caselib->edit = '编辑'; +$lang->caselib->all = '所有公共库'; diff --git a/module/testsuite/model.php b/module/testsuite/model.php index 9860954c70..a09aacc008 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -76,26 +76,26 @@ class testsuiteModel extends model { $currentLibName = zget($libraries, $libID, ''); $selectHtml = empty($libraries) ? '' : "{$currentLibName}
    "; - setCookie("lastTestLib", $libID, $this->config->cookieLife, $this->config->webRoot); - foreach($this->lang->testlib->menu as $key => $value) + setCookie("lastCaseLib", $libID, $this->config->cookieLife, $this->config->webRoot); + foreach($this->lang->caselib->menu as $key => $value) { $replace = ($key == 'lib') ? $selectHtml : ''; - common::setMenuVars($this->lang->testlib->menu, $key, $replace); + common::setMenuVars($this->lang->caselib->menu, $key, $replace); } - $this->lang->testsuite->menu = $this->lang->testlib->menu; + $this->lang->testsuite->menu = $this->lang->caselib->menu; } public function saveLibState($libID = 0, $libraries = array()) { - if($libID > 0) $this->session->set('testLib', (int)$libID); - if($libID == 0 and $this->cookie->lastTestLib) $this->session->set('testLib', $this->cookie->lastTestLib); - if($libID == 0 and $this->session->testLib == '') $this->session->set('testLib', key($libraries)); - if(!isset($libraries[$this->session->testLib])) + if($libID > 0) $this->session->set('caseLib', (int)$libID); + if($libID == 0 and $this->cookie->lastCaseLib) $this->session->set('caseLib', $this->cookie->lastCaseLib); + if($libID == 0 and $this->session->caseLib == '') $this->session->set('caseLib', key($libraries)); + if(!isset($libraries[$this->session->caseLib])) { - $this->session->set('testLib', key($libraries)); - $libID = $this->session->testLib; + $this->session->set('caseLib', key($libraries)); + $libID = $this->session->caseLib; } - return $this->session->testLib; + return $this->session->caseLib; } /** @@ -292,7 +292,7 @@ class testsuiteModel extends model parent::delete(TABLE_TESTSUITE, $suiteID); if($suite->type == 'library') { - $this->dao->update(TABLE_ACTION)->set('objectType')->eq('testlib')->where('objectID')->eq($suiteID)->andWhere('objectType')->eq('testsuite')->exec(); + $this->dao->update(TABLE_ACTION)->set('objectType')->eq('caselib')->where('objectID')->eq($suiteID)->andWhere('objectType')->eq('testsuite')->exec(); } else { @@ -339,7 +339,7 @@ class testsuiteModel extends model if(!dao::isError()) { $libID = $this->dao->lastInsertID(); - $this->file->updateObjectID($this->post->uid, $libID, 'testlib'); + $this->file->updateObjectID($this->post->uid, $libID, 'caselib'); return $libID; } return false; @@ -379,22 +379,22 @@ class testsuiteModel extends model if($queryID) { $query = $this->loadModel('search')->getQuery($queryID); - $this->session->set('testlibQuery', ' 1 = 1'); + $this->session->set('caselibQuery', ' 1 = 1'); if($query) { - $this->session->set('testlibQuery', $query->sql); - $this->session->set('testlibForm', $query->form); + $this->session->set('caselibQuery', $query->sql); + $this->session->set('caselibForm', $query->form); } } else { - if($this->session->testlibQuery == false) $this->session->set('testlibQuery', ' 1 = 1'); + if($this->session->caselibQuery == false) $this->session->set('caselibQuery', ' 1 = 1'); } $queryLibID = $libID; $allLib = "`lib` = 'all'"; - $caseQuery = '(' . $this->session->testlibQuery; - if(strpos($this->session->testlibQuery, $allLib) !== false) + $caseQuery = '(' . $this->session->caselibQuery; + if(strpos($this->session->caselibQuery, $allLib) !== false) { $caseQuery = str_replace($allLib, '1', $caseQuery); $queryLibID = 'all'; @@ -452,10 +452,10 @@ class testsuiteModel extends model public function buildSearchForm($libID, $libraries, $queryID, $actionURL) { $this->config->testcase->search['fields']['lib'] = $this->lang->testcase->lib; - $this->config->testcase->search['params']['lib']['values'] = array('' => '', $libID => $libraries[$libID], 'all' => $this->lang->testlib->all); + $this->config->testcase->search['params']['lib']['values'] = array('' => '', $libID => $libraries[$libID], 'all' => $this->lang->caselib->all); $this->config->testcase->search['params']['lib']['operator'] = '='; $this->config->testcase->search['params']['lib']['control'] = 'select'; - $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'testlib'); + $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib'); if(!$this->config->testcase->needReview) unset($this->config->testcase->search['params']['status']['values']['wait']); unset($this->config->testcase->search['fields']['product']); unset($this->config->testcase->search['params']['product']); @@ -468,7 +468,7 @@ class testsuiteModel extends model unset($this->config->testcase->search['fields']['lastRunDate']); unset($this->config->testcase->search['params']['lastRunDate']); - $this->config->testcase->search['module'] = 'testlib'; + $this->config->testcase->search['module'] = 'caselib'; $this->config->testcase->search['actionURL'] = $actionURL; $this->config->testcase->search['queryID'] = $queryID; @@ -500,7 +500,7 @@ class testsuiteModel extends model } else if($module == 'tree') { - $link = helper::createLink($module, $method, "libID=%s&type=testlib¤tModuleID=0"); + $link = helper::createLink($module, $method, "libID=%s&type=caselib¤tModuleID=0"); } else { diff --git a/module/testsuite/view/createcase.html.php b/module/testsuite/view/createcase.html.php index aed3e03533..ab314e65f7 100644 --- a/module/testsuite/view/createcase.html.php +++ b/module/testsuite/view/createcase.html.php @@ -38,7 +38,7 @@ if(count($moduleOptionMenu) == 1) { echo ""; - echo html::a($this->createLink('tree', 'browse', "rootID=$libID&view=testlib¤tModuleID=0"), "", '_blank', "data-toggle='tooltip' class='btn' title='{$lang->tree->manage}'"); + echo html::a($this->createLink('tree', 'browse', "rootID=$libID&view=caselib¤tModuleID=0"), "", '_blank', "data-toggle='tooltip' class='btn' title='{$lang->tree->manage}'"); echo ''; echo ""; echo html::a("javascript:loadLibModules($libID)", "", '', "data-toggle='tooltip' class='btn' title='{$lang->refresh}'"); diff --git a/module/testsuite/view/createlib.html.php b/module/testsuite/view/createlib.html.php index 3a7f7f74f8..2cf8a6c12a 100644 --- a/module/testsuite/view/createlib.html.php +++ b/module/testsuite/view/createlib.html.php @@ -16,7 +16,7 @@
    - icons['create']);?> testlib->create;?> + icons['create']);?> caselib->create;?>
    diff --git a/module/testsuite/view/library.html.php b/module/testsuite/view/library.html.php index f5f3f14ad0..fa1a57be4e 100644 --- a/module/testsuite/view/library.html.php +++ b/module/testsuite/view/library.html.php @@ -65,7 +65,7 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
    - tree->manage);?> + tree->manage);?>
    diff --git a/module/testsuite/view/libview.html.php b/module/testsuite/view/libview.html.php index 8c072e2aad..9dba052611 100644 --- a/module/testsuite/view/libview.html.php +++ b/module/testsuite/view/libview.html.php @@ -13,7 +13,7 @@
    - id;?> + id;?> name;?> deleted):?> testsuite->deleted;?> diff --git a/module/testtask/control.php b/module/testtask/control.php index 5ab46a4e8e..6164760290 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -270,7 +270,7 @@ class testtask extends control $runs = $this->testcase->appendBugAndResults($runs, 'run'); $moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID); - $libModuleTree = $this->tree->getTestLibTreeInCase('testtask', $taskID, array('treeModel', 'createTestTaskLink')); + $libModuleTree = $this->tree->getCaseLibTreeInCase('testtask', $taskID, array('treeModel', 'createTestTaskLink')); if($libModuleTree) $moduleTree = substr($moduleTree, 0, strrpos($moduleTree, '')) . $libModuleTree . ''; $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; @@ -438,19 +438,19 @@ class testtask extends control } /** - * doing testtask. + * activate testtask. * * @param int $taskID * @access public * @return void */ - public function doing($taskID) + public function activate($taskID) { $actions = $this->loadModel('action')->getList('testtask', $taskID); if(!empty($_POST)) { - $changes = $this->testtask->doing($taskID); + $changes = $this->testtask->activate($taskID); if(dao::isError()) die(js::error(dao::getError())); if($this->post->comment != '' or !empty($changes)) @@ -473,7 +473,7 @@ class testtask extends control $this->view->testtask = $testtask; $this->view->title = $testtask->name . $this->lang->colon . $this->lang->testtask->start; $this->view->position[] = $this->lang->testtask->common; - $this->view->position[] = $this->lang->testtask->doing; + $this->view->position[] = $this->lang->testtask->activate; $this->view->actions = $actions; $this->display(); } @@ -655,75 +655,15 @@ class testtask extends control $this->view->position[] = $this->lang->testtask->common; $this->view->position[] = $this->lang->testtask->linkCase; + $testTask = $this->testtask->getRelatedTestTasks($productID, $param); + /* Get cases. */ - if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1'); - $query = $this->session->testcaseQuery; - $allProduct = "`product` = 'all'"; - if(strpos($query, '`product` =') === false) $query .= " AND `product` = $productID"; - if(strpos($query, $allProduct) !== false) $query = str_replace($allProduct, '1', $query); + $cases = $this->testtask->getLinkableCases($productID, $task, $taskID, $type, $param, $pager); - $linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case'); - if($type == 'all') - { - $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) - ->andWhere('id')->notIN($linkedCases) - ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi() - ->andWhere('deleted')->eq(0) - ->orderBy('id desc') - ->page($pager) - ->fetchAll(); - } - elseif($type == 'bystory') - { - $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories'); - $cases = array(); - if($stories) - { - $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) - ->andWhere('product')->eq($productID) - ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi() - ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi() - ->andWhere('story')->in(trim($stories, ',')) - ->andWhere('deleted')->eq(0) - ->orderBy('id desc') - ->page($pager) - ->fetchAll(); - } - } - elseif($type == 'bybug') - { - $bugs = $this->dao->select('bugs')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('bugs'); - $cases = array(); - if($bugs) - { - $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) - ->andWhere('product')->eq($productID) - ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi() - ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi() - ->andWhere('fromBug')->in(trim($bugs, ',')) - ->andWhere('deleted')->eq(0) - ->orderBy('id desc') - ->page($pager) - ->fetchAll(); - } - } - if($type == 'bysuite') - { - $cases = $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1') - ->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case') - ->where($query) - ->andWhere('t2.suite')->eq((int)$param) - ->andWhere('t1.product')->eq($productID) - ->beginIF($linkedCases)->andWhere('t1.id')->notIN($linkedCases)->fi() - ->beginIF($task->branch)->andWhere('t1.branch')->in("0,$task->branch")->fi() - ->andWhere('deleted')->eq(0) - ->orderBy('id_desc') - ->page($pager) - ->fetchAll(); - } $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->cases = $cases; $this->view->taskID = $taskID; + $this->view->testTask = $testTask; $this->view->pager = $pager; $this->view->task = $task; $this->view->type = $type; diff --git a/module/testtask/js/results.js b/module/testtask/js/results.js index 18b41c6425..a02a644633 100644 --- a/module/testtask/js/results.js +++ b/module/testtask/js/results.js @@ -9,5 +9,16 @@ $(function() $this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show);; }); + $(".step-group input[type='checkbox']").click(function() + { + var $next = $(this).closest('tr').next(); + while($next.length && $next.hasClass('step-item')) + { + var isChecked = $(this).prop('checked'); + $next.find("input[type='checkbox']").prop('checked', isChecked); + $next = $next.next(); + } + }); + $('#casesResults table caption .result-tip').html($('#resultTip').html()); }); diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php index e31031c13f..5e4127b86f 100644 --- a/module/testtask/lang/zh-cn.php +++ b/module/testtask/lang/zh-cn.php @@ -16,6 +16,7 @@ $lang->testtask->view = "概况"; $lang->testtask->edit = "编辑版本"; $lang->testtask->browse = "版本列表"; $lang->testtask->linkCase = "关联用例"; +$lang->testtask->selectVersion = "选择版本"; $lang->testtask->unlinkCase = "移除"; $lang->testtask->batchUnlinkCases = "批量移除用例"; $lang->testtask->batchAssign = "批量指派"; @@ -32,8 +33,8 @@ $lang->testtask->start = "开始"; $lang->testtask->close = "关闭"; $lang->testtask->wait = "待测版本"; $lang->testtask->blocked = "阻塞"; -$lang->testtask->doing = "激活"; -$lang->testtask->doingA = "进行中版本"; +$lang->testtask->activate = "激活"; +$lang->testtask->testing = "测试中版本"; $lang->testtask->blockedA = "被阻塞版本"; $lang->testtask->done = "已测版本"; @@ -73,6 +74,7 @@ $lang->testtask->priList[2] = '2'; $lang->testtask->priList[4] = '4'; $lang->testtask->unlinkedCases = '未关联'; +$lang->testtask->linkByVersion = '按版本复制'; $lang->testtask->linkByStory = '按需求关联'; $lang->testtask->linkByBug = '按Bug关联'; $lang->testtask->linkBySuite = '按套件关联'; diff --git a/module/testtask/model.php b/module/testtask/model.php index e899ab4f55..bb01874172 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -141,31 +141,6 @@ class testtaskModel extends model return $task; } - /** - * Bet tasks by project. - * - * @param int $projectID - * @access public - * @return array - */ - public function getByProject($projectID) - { - return $this->dao->select('*')->from(TABLE_TESTTASK)->where('project')->eq((int)$projectID)->andWhere('deleted')->eq(0)->fetchAll('id'); - } - - /** - * Get taskrun by case id. - * - * @param int $taskID - * @param int $caseID - * @access public - * @return void - */ - public function getRunByCase($taskID, $caseID) - { - return $this->dao->select('*')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->andWhere('`case`')->eq($caseID)->fetch(); - } - /** * Get test tasks by user. * @@ -188,6 +163,198 @@ class testtaskModel extends model ->fetchAll(); } + + + /** + * Get taskrun by case id. + * + * @param int $taskID + * @param int $caseID + * @access public + * @return void + */ + public function getRunByCase($taskID, $caseID) + { + return $this->dao->select('*')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->andWhere('`case`')->eq($caseID)->fetch(); + } + + /** + * Get linkable casses. + * + * @param int $productID + * @param object $task + * @param int $taskID + * @param string $type + * @param string $param + * @param object $pager + * @access public + * @return array + */ + public function getLinkableCases($productID, $task, $taskID, $type, $param, $pager) + { + if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1'); + $query = $this->session->testcaseQuery; + $allProduct = "`product` = 'all'"; + if(strpos($query, '`product` =') === false && $type != 'bysuite') $query .= " AND `product` = $productID"; + if(strpos($query, $allProduct) !== false) $query = str_replace($allProduct, '1', $query); + + $cases = array(); + $linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case'); + if($type == 'all') $cases = $this->getAllLinkableCases($task, $query, $linkedCases, $pager); + if($type == 'bystory') $cases = $this->getLinkableCasesByStory($productID, $task, $query, $linkedCases, $pager); + if($type == 'bybug') $cases = $this->getLinkableCasesByBug($productID, $task, $query, $linkedCases, $pager); + if($type == 'bysuite') $cases = $this->getLinkableCasesBySuite($productID, $query, $param, $linkedCases, $pager); + if($type == 'bybuild') $cases = $this->getLinkableCasesByTestTask($param, $linkedCases, $pager); + + return $cases; + } + + /** + * Get all linkable cases. + * + * @param object $task + * @param string $query + * @param array $linkedCases + * @param object $pager + * @access public + * @return array + */ + public function getAllLinkableCases($task, $query, $linkedCases, $pager) + { + return $this->dao->select('*')->from(TABLE_CASE)->where($query) + ->andWhere('id')->notIN($linkedCases) + ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi() + ->andWhere('deleted')->eq(0) + ->orderBy('id desc') + ->page($pager) + ->fetchAll(); + } + + /** + * Get linkable cases by story. + * + * @param int $productID + * @param object $task + * @param string $query + * @param array $linkedCases + * @param object $pager + * @access public + * @return array + */ + public function getLinkableCasesByStory($productID, $task, $query, $linkedCases, $pager) + { + $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories'); + $cases = array(); + if($stories) + { + $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) + ->andWhere('product')->eq($productID) + ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi() + ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi() + ->andWhere('story')->in(trim($stories, ',')) + ->andWhere('deleted')->eq(0) + ->orderBy('id desc') + ->page($pager) + ->fetchAll(); + } + + return $cases; + } + + /** + * Get linkable cases by bug. + * + * @param int $productID + * @param object $task + * @param string $query + * @param array $linkedCases + * @param object $pager + * @access public + * @return array + */ + public function getLinkableCasesByBug($productID, $task, $query, $linkedCases, $pager) + { + $bugs = $this->dao->select('bugs')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('bugs'); + $cases = array(); + if($bugs) + { + $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) + ->andWhere('product')->eq($productID) + ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi() + ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi() + ->andWhere('fromBug')->in(trim($bugs, ',')) + ->andWhere('deleted')->eq(0) + ->orderBy('id desc') + ->page($pager) + ->fetchAll(); + } + + return $cases; + } + + /** + * Get linkable cases by suite. + * + * @param int $productID + * @param string $query + * @param string $suite + * @param array $linkedCases + * @param object $pager + * @access public + * @return array + */ + public function getLinkableCasesBySuite($productID, $query, $suite, $linkedCases, $pager) + { + return $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case') + ->where($query) + ->andWhere('t2.suite')->eq((int)$suite) + ->andWhere('t1.product')->eq($productID) + ->beginIF($linkedCases)->andWhere('t1.id')->notIN($linkedCases)->fi() + ->beginIF($task->branch)->andWhere('t1.branch')->in("0,$task->branch")->fi() + ->andWhere('deleted')->eq(0) + ->orderBy('id desc') + ->page($pager) + ->fetchAll(); + } + + /** + * Get linkeable cases by test task. + * + * @param string $testTask + * @param array $linkedCases + * @param object $pager + * @access public + * @return array + */ + public function getLinkableCasesByTestTask($testTask, $linkedCases, $pager) + { + $caseList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where('task')->eq($testTask)->andWhere('id')->notin($linkedCases)->fetchPairs('case'); + + return $this->dao->select("*")->from(TABLE_CASE)->where('id')->in($caseList)->page($pager)->fetchAll(); + } + + /** + * Get related test tasks. + * + * @param int $productID + * @param int $taskID + * @access public + * @return array + */ + public function getRelatedTestTasks($productID, $testTaskID) + { + $beginDate = $this->dao->select('begin')->from(TABLE_TESTTASK)->where('id')->eq($testTaskID)->fetch('begin'); + + return $this->dao->select('id, name')->from(TABLE_TESTTASK) + ->where('product')->eq($productID) + ->beginIF($beginDate)->andWhere('begin')->le($beginDate)->fi() + ->andWhere('deleted')->eq('0') + ->andWhere('id')->notin($testTaskID) + ->orderBy('begin desc') + ->fetchPairs('id', 'name'); + } + /** * Update a test task. * @@ -265,13 +432,13 @@ class testtaskModel extends model } /** - * blocked testtask. + * update block testtask. * * @param int $taskID - * @access public + * @access public * @return void */ - public function blocked($taskID) + public function block($taskID) { $oldTesttask = $this->getById($taskID); $testtask = fixer::input('post') @@ -287,13 +454,13 @@ class testtaskModel extends model } /** - * doing testtask. + * update activate testtask. * * @param int $taskID * @access public * @return void */ - public function doing($taskID) + public function activate($taskID) { $oldTesttask = $this->getById($taskID); $testtask = fixer::input('post') @@ -560,7 +727,7 @@ class testtaskModel extends model { $runs = $this->dao->select('id, `case`')->from(TABLE_TESTRUN) ->where('`case`')->in($caseIdList) - ->beginIF($taskID)->andWhere('task')->eq($taskID) + ->beginIF($taskID)->andWhere('task')->eq($taskID)->fi() ->fetchPairs('case', 'id'); } diff --git a/module/testtask/view/blocked.html.php b/module/testtask/view/blocked.html.php new file mode 100644 index 0000000000..3aabb0eefb --- /dev/null +++ b/module/testtask/view/blocked.html.php @@ -0,0 +1,42 @@ + + * @package testtask + * @version $Id: start.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $ + * @link http://www.zentao.net + */ +?> + + + +
    +
    +
    + icons['testtask']);?> id;?> + createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?> + testtask->blocked;?> icons['pause']);?> +
    +
    + + + + + + + + + + + + +
    comment;?>
    goback, $this->session->taskList); ?>
    + +
    + +
    +
    + diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php index 7be7773e9d..1fcc72fa00 100644 --- a/module/testtask/view/browse.html.php +++ b/module/testtask/view/browse.html.php @@ -15,7 +15,7 @@
    diff --git a/module/testtask/view/caseheader.html.php b/module/testtask/view/caseheader.html.php index 417c0a54cd..a1f3ba4f44 100644 --- a/module/testtask/view/caseheader.html.php +++ b/module/testtask/view/caseheader.html.php @@ -48,7 +48,7 @@
    "; - common::printIcon('testtask', 'linkCase', "taskID=$task->id", '', 'button', 'link'); + common::printIcon('testtask', 'linkCase', "taskID=$task->id&type=all¶m=$taskID", '', 'button', 'link'); common::printIcon('testcase', 'export', "productID=$productID&orderBy=`case`_desc&taskID=$task->id", '', 'button', '', '', 'iframe export'); echo '
    '; echo "
    "; diff --git a/module/testtask/view/doing.html.php b/module/testtask/view/doing.html.php new file mode 100644 index 0000000000..a85479b10d --- /dev/null +++ b/module/testtask/view/doing.html.php @@ -0,0 +1,42 @@ + + * @package testtask + * @version $Id: start.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $ + * @link http://www.zentao.net + */ +?> + + + +
    +
    +
    + icons['testtask']);?> id;?> + createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?> + testtask->doing;?> icons['start']);?> +
    +
    + +
    + + + + + + + + + + +
    comment;?>
    goback, $this->session->taskList); ?>
    +
    +
    + +
    +
    + diff --git a/module/testtask/view/linkcase.html.php b/module/testtask/view/linkcase.html.php index bba5e65937..ccefeb7ac9 100644 --- a/module/testtask/view/linkcase.html.php +++ b/module/testtask/view/linkcase.html.php @@ -21,6 +21,17 @@
    "; + + echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo ""; + $lang->testtask->linkCase = $lang->testtask->linkByStory; common::printIcon('testtask', 'linkCase', "taskID=$taskID&type=bystory", '', 'button', 'link'); + + //Temporary hiding, add 'hidden'. 暂时隐藏 $lang->testtask->linkCase = $lang->testtask->linkByBug; - common::printIcon('testtask', 'linkCase', "taskID=$taskID&type=bybug", '', 'button', 'link'); + common::printIcon('testtask', 'linkCase', "taskID=$taskID&type=bybug", '', 'button', 'link', '', 'hidden'); + echo '
    '; echo "
    "; common::printRPN($this->session->testtaskList); @@ -57,6 +72,9 @@ testcase->title;?> testcase->type;?> openedByAB;?> + testtask->lastRunAccount;?> + testtask->lastRunTime;?> + testtask->lastRunResult;?> statusAB;?> @@ -81,13 +99,16 @@ testcase->typeList[$case->type];?> openedBy];?> + lastRunner;?> + lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));?> + lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?> testcase->statusList[$case->status];?> - +
    diff --git a/module/testtask/view/results.html.php b/module/testtask/view/results.html.php index 77e6cfa8ee..398bd6508a 100644 --- a/module/testtask/view/results.html.php +++ b/module/testtask/view/results.html.php @@ -82,7 +82,8 @@ caseResult == 'fail'):?> - + + diff --git a/module/testtask/view/view.html.php b/module/testtask/view/view.html.php index b1692e79e9..d22c17471a 100644 --- a/module/testtask/view/view.html.php +++ b/module/testtask/view/view.html.php @@ -32,7 +32,7 @@ common::printIcon('testtask', 'start', "taskID=$task->id", $task, 'button', '', '', 'iframe', true); common::printIcon('testtask', 'close', "taskID=$task->id", $task, 'button', '', '', 'iframe', true); common::printIcon('testtask', 'blocked', "taskID=$task->id", $task, 'button', 'pause', '', 'iframe', true); - common::printIcon('testtask', 'doing', "taskID=$task->id", $task, 'button', 'magic', '', 'iframe', true); + common::printIcon('testtask', 'activate', "taskID=$task->id", $task, 'button', 'magic', '', 'iframe', true); common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'button', 'sitemap'); common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'button', 'link'); echo '
    '; diff --git a/module/tree/control.php b/module/tree/control.php index ff0f73f19d..c81df458a0 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -49,7 +49,7 @@ class tree extends control $lib = $this->doc->getLibById($rootID); $this->view->root = $lib; } - elseif(strpos($viewType, 'testlib') !== false) + elseif(strpos($viewType, 'caselib') !== false) { $this->loadModel('testsuite'); $lib = $this->testsuite->getById($rootID); @@ -97,16 +97,16 @@ class tree extends control $position[] = html::a($this->createLink('testcase', 'browse', "product=$rootID"), $product->name); $position[] = $this->lang->tree->manageCase; } - elseif($viewType == 'testlib') + elseif($viewType == 'caselib') { $this->testsuite->setLibMenu($this->testsuite->getLibraries(), $rootID); $this->lang->tree->menu = $this->lang->testsuite->menu; $this->lang->tree->menuOrder = $this->lang->testsuite->menuOrder; $this->lang->set('menugroup.tree', 'qa'); - $title = $lib->name . $this->lang->colon . $this->lang->tree->manageTestLib; + $title = $lib->name . $this->lang->colon . $this->lang->tree->manageCaseLib; $position[] = html::a($this->createLink('testsuite', 'library', "libID=$rootID"), $lib->name); - $position[] = $this->lang->tree->manageTestLib; + $position[] = $this->lang->tree->manageCaseLib; } elseif(strpos($viewType, 'doc') !== false) { diff --git a/module/tree/lang/en.php b/module/tree/lang/en.php index 37bc85914e..7fc99a02ed 100644 --- a/module/tree/lang/en.php +++ b/module/tree/lang/en.php @@ -21,14 +21,14 @@ $lang->tree->manageProduct = "Manage {$lang->productCommon}"; $lang->tree->manageProject = "Manage {$lang->projectCommon}"; $lang->tree->manageBug = 'Manage Bug'; $lang->tree->manageCase = 'Manage Case'; -$lang->tree->manageTestLib = 'Manage Library'; +$lang->tree->manageCaseLib = 'Manage Library'; $lang->tree->manageCustomDoc = 'Manage DocLib'; $lang->tree->updateOrder = 'Update Order'; $lang->tree->manageChild = 'Manage Child Module'; $lang->tree->manageStoryChild = 'Manage Child Story'; $lang->tree->manageBugChild = 'Manage Child Bug'; $lang->tree->manageCaseChild = 'Manage Child Case'; -$lang->tree->manageTestlibChild = 'Manage Child Library'; +$lang->tree->manageCaselibChild = 'Manage Child Library'; $lang->tree->manageTaskChild = "Manage Child {$lang->projectCommon}"; $lang->tree->syncFromProduct = 'Copy'; $lang->tree->dragAndSort = "Drag and Sort"; diff --git a/module/tree/lang/zh-cn.php b/module/tree/lang/zh-cn.php index b9a3fda2fe..4ae7a63213 100644 --- a/module/tree/lang/zh-cn.php +++ b/module/tree/lang/zh-cn.php @@ -21,14 +21,14 @@ $lang->tree->manageProduct = "维护{$lang->productCommon}视图模块"; $lang->tree->manageProject = "维护{$lang->projectCommon}视图模块"; $lang->tree->manageBug = '维护测试视图模块'; $lang->tree->manageCase = '维护用例视图模块'; -$lang->tree->manageTestLib = '维护公共库模块'; +$lang->tree->manageCaseLib = '维护测试库模块'; $lang->tree->manageCustomDoc = '维护文档库分类'; $lang->tree->updateOrder = '更新排序'; $lang->tree->manageChild = '维护子模块'; $lang->tree->manageStoryChild = '维护子模块'; $lang->tree->manageBugChild = '维护Bug子模块'; $lang->tree->manageCaseChild = '维护用例子模块'; -$lang->tree->manageTestlibChild = '维护公共库子模块'; +$lang->tree->manageCaselibChild = '维护测试库子模块'; $lang->tree->manageTaskChild = "维护{$lang->projectCommon}子模块"; $lang->tree->syncFromProduct = '复制'; $lang->tree->dragAndSort = "拖放排序"; diff --git a/module/tree/model.php b/module/tree/model.php index 35ce895ac5..24a004619c 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -155,7 +155,7 @@ class treeModel extends model $modules = array(); if($viewType == 'case' and $extra) { - $modules += $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->in($extra)->andWhere('type')->eq('testlib')->andWhere('deleted')->eq(0)->fetchAll('id'); + $modules += $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->in($extra)->andWhere('type')->eq('caselib')->andWhere('deleted')->eq(0)->fetchAll('id'); } if($this->isMergeModule($rootID, $viewType)) $viewType .= ',story'; $modules += $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->andWhere('deleted')->eq(0)->fetchAll('id'); @@ -886,12 +886,30 @@ class treeModel extends model return $linkHtml; } - public function createTestlibLink($type, $module) + /** + * Create case lib link + * + * @param string $type + * @param string $module + * @access public + * @return string + */ + public function createCaseLibLink($type, $module) { $linkHtml = html::a(helper::createLink('testsuite', 'library', "root={$module->root}&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'"); return $linkHtml; } + /** + * Create branch link + * + * @param string $type + * @param int $rootID + * @param int $branchID + * @param string $branch + * @access public + * @return string + */ public function createBranchLink($type, $rootID, $branchID, $branch) { if($type == 'story') return html::a(helper::createLink('product', 'browse', "productID={$rootID}&branch=$branchID"), $branch, '_self', "id='branch{$branchID}'"); @@ -1498,7 +1516,7 @@ class treeModel extends model } /** - * Get testlib tree in case view. + * Get caselib tree in case view. * * @param string $objectType * @param int $objectID @@ -1506,7 +1524,7 @@ class treeModel extends model * @access public * @return string */ - public function getTestLibTreeInCase($objectType, $objectID, $userFunc) + public function getCaseLibTreeInCase($objectType, $objectID, $userFunc) { if($objectType == 'case') { @@ -1530,7 +1548,7 @@ class treeModel extends model if(empty($libs)) return null; $libs = $this->dao->select('*')->from(TABLE_TESTSUITE)->where('type')->eq('library')->andWhere('id')->in($libs)->andWhere('deleted')->eq(0)->fetchAll('id'); - $moduleGroup = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->in(array_keys($libs))->andWhere('type')->eq('testlib')->andWhere('deleted')->eq(0)->orderBy('grade desc, `order`')->fetchGroup('root'); + $moduleGroup = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->in(array_keys($libs))->andWhere('type')->eq('caselib')->andWhere('deleted')->eq(0)->orderBy('grade desc, `order`')->fetchGroup('root'); $lastMenu = ''; $keepModules = array(); foreach($libs as $lib) @@ -1576,7 +1594,7 @@ class treeModel extends model public function getExistLibModules($libs, $modules) { $libs = $this->dao->select('*')->from(TABLE_TESTSUITE)->where('type')->eq('library')->andWhere('id')->in($libs)->andWhere('deleted')->eq(0)->fetchAll('id'); - $libModules = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->in(array_keys($libs))->andWhere('type')->eq('testlib')->andWhere('deleted')->eq(0)->andWhere('id')->in($modules)->orderBy('grade,`order`')->fetchAll(); + $libModules = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->in(array_keys($libs))->andWhere('type')->eq('caselib')->andWhere('deleted')->eq(0)->andWhere('id')->in($modules)->orderBy('grade,`order`')->fetchAll(); $modulePath = array(); foreach($libModules as $module) { diff --git a/module/user/control.php b/module/user/control.php index e5b7b9911c..ca6af39a75 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -537,7 +537,7 @@ class user extends control public function delete($userID) { $user = $this->user->getByID($userID, 'id'); - if(strpos($this->app->company->admins, ",{$this->app->user->account},") !== false and $this->app->user->account == $user->account) return; + if($this->app->user->admin and $this->app->user->account == $user->account) return; if($_POST) { if(md5($this->post->verifyPassword) != $this->app->user->password) die(js::alert($this->lang->user->error->verifyPassword)); diff --git a/module/user/model.php b/module/user/model.php index dcf336c640..c1bae872a3 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -612,8 +612,10 @@ class userModel extends model { $ip = $this->server->remote_addr; $last = $this->server->request_time; - $user->last = date(DT_DATETIME1, $last); + $user->last = date(DT_DATETIME1, $last); + $user->admin = strpos($this->app->company->admins, ",{$user->account},") !== false; $user->modifyPassword = ($user->visits == 0 and !empty($this->config->safe->modifyPasswordFirstLogin)); + $this->dao->update(TABLE_USER)->set('visits = visits + 1')->set('ip')->eq($ip)->set('last')->eq($last)->where('account')->eq($account)->exec(); } return $user; diff --git a/www/js/my.full.js b/www/js/my.full.js index 0704388591..427fd0b3c2 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -368,7 +368,8 @@ function hideTreeBox(treeType) { $.cookie(treeType, 'hide', {expires:config.cookieLife, path:config.webRoot}); $('.outer').addClass('hide-side'); - $('.side-handle .icon-caret-left').removeClass('icon-caret-left').addClass('icon-caret-right'); + var direction = $('.side-handle .icon-caret-left').size() > 0 ? 'left' : 'right'; + $('.side-handle .icon-caret-' + direction).removeClass('icon-caret-' + direction).addClass('icon-caret-' + (direction == 'left' ? 'right' : 'left')); } /** @@ -382,7 +383,8 @@ function showTreeBox(treeType) { $.cookie(treeType, 'show', {expires:config.cookieLife, path:config.webRoot}); $('.outer').removeClass('hide-side'); - $('.side-handle .icon-caret-right').removeClass('icon-caret-right').addClass('icon-caret-left'); + var direction = $('.side-handle .icon-caret-left').size() > 0 ? 'left' : 'right'; + $('.side-handle .icon-caret-' + direction).removeClass('icon-caret-' + direction).addClass('icon-caret-' + (direction == 'left' ? 'right' : 'left')); } /** @@ -659,7 +661,8 @@ function checkTable($table) { var $checkbox = $(this); var $datatable = $checkbox.closest('.datatable'); - if($datatable.length) { + if($datatable.length) + { var $checkAll = $datatable.find('.check-all.check-btn:first').trigger('click'); $checkbox.prop('checked', $checkAll.hasClass('checked')) return;