From 22fb4f59fc925b854782e26cf001c4e879717c33 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 3 May 2017 10:33:50 +0800 Subject: [PATCH] =?UTF-8?q?Finish=20task#2982=20=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=BA=93=E5=A2=9E=E5=8A=A0=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=92=8C=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD,cost:5=20left:0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/testsuite/control.php | 340 +++++++++++++++++- module/testsuite/css/batchcreatecase.css | 2 + module/testsuite/css/library.css | 2 + module/testsuite/css/showimport.css | 2 + module/testsuite/lang/zh-cn.php | 2 + module/testsuite/model.php | 249 +++++++++++++ .../testsuite/view/batchcreatecase.html.php | 93 +++++ module/testsuite/view/exporttemplet.html.php | 49 +++ module/testsuite/view/import.html.php | 19 + module/testsuite/view/library.html.php | 19 + module/testsuite/view/showimport.html.php | 121 +++++++ 11 files changed, 897 insertions(+), 1 deletion(-) create mode 100644 module/testsuite/css/batchcreatecase.css create mode 100644 module/testsuite/css/showimport.css create mode 100644 module/testsuite/view/batchcreatecase.html.php create mode 100644 module/testsuite/view/exporttemplet.html.php create mode 100644 module/testsuite/view/import.html.php create mode 100644 module/testsuite/view/showimport.html.php diff --git a/module/testsuite/control.php b/module/testsuite/control.php index de4113f002..5aa421adc3 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -432,7 +432,7 @@ class testsuite extends control $this->view->orderBy = $orderBy; $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); $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->moduleTree = $this->tree->getTreeMenu($libID, $viewType = 'caselib', $startModuleID = 0, array('treeModel', 'createCaseLibLink')); $this->view->pager = $pager; $this->view->browseType = $browseType; $this->view->moduleID = $moduleID; @@ -554,6 +554,47 @@ class testsuite extends control $this->display(); } + /** + * Batch create case. + * + * @param int $libID + * @param int $moduleID + * @access public + * @return void + */ + public function batchCreateCase($libID, $moduleID = 0) + { + $this->loadModel('testcase'); + if(!empty($_POST)) + { + $caseID = $this->testsuite->batchCreateCase($libID); + if(dao::isError()) die(js::error(dao::getError())); + if(isonlybody()) die(js::closeModal('parent.parent', 'this')); + die(js::locate($this->createLink('testsuite', 'library', "libID=$libID&browseType=byModule¶m=$moduleID"), 'parent')); + } + + $libraries = $this->testsuite->getLibraries(); + if(empty($libraries)) $this->locate(inlink('createLib')); + + /* Set lib menu. */ + $this->testsuite->setLibMenu($libraries, $libID); + + $currentModuleID = (int)$moduleID; + + /* Set module option menu. */ + $moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0); + $moduleOptionMenu['ditto'] = $this->lang->testcase->ditto; + + $this->view->title = $libraries[$libID] . $this->lang->colon . $this->lang->testcase->batchCreate; + $this->view->position[] = html::a($this->createLink('testsuite', 'library', "libID=$libID"), $libraries[$libID]); + $this->view->position[] = $this->lang->testcase->batchCreate; + $this->view->libID = $libID; + $this->view->moduleOptionMenu = $moduleOptionMenu; + $this->view->currentModuleID = $currentModuleID; + + $this->display(); + } + /** * View library * @@ -623,4 +664,301 @@ class testsuite extends control $this->view->keywords = $keywords; $this->display(); } + + /** + * Export templet. + * + * @param int $libID + * @access public + * @return void + */ + public function exportTemplet($libID) + { + $this->loadModel('testcase'); + if($_POST) + { + if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']); + + $fields['module'] = $this->lang->testcase->module; + $fields['title'] = $this->lang->testcase->title; + $fields['stepDesc'] = $this->lang->testcase->stepDesc; + $fields['stepExpect'] = $this->lang->testcase->stepExpect; + $fields['keywords'] = $this->lang->testcase->keywords; + $fields['type'] = $this->lang->testcase->type; + $fields['pri'] = $this->lang->testcase->pri; + $fields['status'] = $this->lang->testcase->status; + $fields['stage'] = $this->lang->testcase->stage; + $fields['precondition'] = $this->lang->testcase->precondition; + + $fields[''] = ''; + $fields['typeValue'] = $this->lang->testcase->lblTypeValue; + $fields['stageValue'] = $this->lang->testcase->lblStageValue; + $fields['statusValue'] = $this->lang->testcase->lblStatusValue; + + $modules = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0); + $rows = array(); + foreach($modules as $moduleID => $module) + { + $row = new stdclass(); + $row->module = $module . "(#$moduleID)"; + $row->stepDesc = "1. \n2. \n3."; + $row->stepExpect = "1. \n2. \n3."; + + if(empty($rows)) + { + $row->typeValue = join("\n", $this->lang->testcase->typeList); + $row->stageValue = join("\n", $this->lang->testcase->stageList); + $row->statusValue = join("\n", $this->lang->testcase->statusList); + } + $rows[] = $row; + } + + $this->post->set('fields', $fields); + $this->post->set('kind', 'testcase'); + $this->post->set('rows', $rows); + $this->post->set('extraNum', $this->post->num); + $this->post->set('fileName', 'templet'); + $this->fetch('file', 'export2csv', $_POST); + } + + $this->display(); + } + + /** + * Import case csv file. + * + * @param int $libID + * @access public + * @return void + */ + public function import($libID) + { + $this->loadModel('testcase'); + if($_FILES) + { + $file = $this->loadModel('file')->getUpload('file'); + $file = $file[0]; + + move_uploaded_file($file['tmpname'], $this->file->savePath . $file['pathname']); + + $fileName = $this->file->savePath . $file['pathname']; + $rows = $this->file->parseCSV($fileName); + $fields = $this->testcase->getImportFields($productID); + $fields = array_flip($fields); + $header = array(); + foreach($rows[0] as $i => $rowValue) + { + if(empty($rowValue)) break; + $header[$i] = $rowValue; + } + unset($rows[0]); + + $columnKey = array(); + foreach($header as $title) + { + if(!isset($fields[$title])) continue; + $columnKey[] = $fields[$title]; + } + + if(count($columnKey) != count($header) or $this->post->encode != 'utf-8') + { + $fc = file_get_contents($fileName); + $encode = $this->post->encode != "utf-8" ? $this->post->encode : 'gbk'; + $fc = helper::convertEncoding($fc, $encode, 'utf-8'); + file_put_contents($fileName, $fc); + + $rows = $this->file->parseCSV($fileName); + $columnKey = array(); + $header = array(); + foreach($rows[0] as $i => $rowValue) + { + if(empty($rowValue)) break; + $header[$i] = $rowValue; + } + unset($rows[0]); + foreach($header as $title) + { + if(!isset($fields[$title])) continue; + $columnKey[] = $fields[$title]; + } + if(count($columnKey) != count($header)) die(js::alert($this->lang->testcase->errorEncode)); + } + + $this->session->set('importFile', $fileName); + + die(js::locate(inlink('showImport', "libID=$libID"), 'parent.parent')); + } + $this->display(); + } + + /** + * Show import case. + * + * @param int $libID + * @access public + * @return void + */ + public function showImport($libID) + { + $this->loadModel('testcase'); + if($_POST) + { + $this->testsuite->createFromImport($libID); + die(js::locate(inlink('library', "libID=$libID"), 'parent')); + } + + $libraries = $this->testsuite->getLibraries(); + if(empty($libraries)) $this->locate(inlink('createLib')); + + $this->testsuite->setMenu($libraries, $libID); + + $file = $this->session->importFile; + $caseLang = $this->lang->testcase; + $caseConfig = $this->config->testcase; + $modules = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0); + + $fields = explode(',', $caseConfig->exportFields); + foreach($fields as $key => $fieldName) + { + $fieldName = trim($fieldName); + $fields[$fieldName] = isset($caseLang->$fieldName) ? $caseLang->$fieldName : $fieldName; + unset($fields[$key]); + } + + $fields = array_flip($fields); + $rows = $this->loadModel('file')->parseCSV($file); + $header = array(); + foreach($rows[0] as $i => $rowValue) + { + if(empty($rowValue)) break; + $header[$i] = $rowValue; + } + unset($rows[0]); + + foreach($header as $title) + { + if(!isset($fields[$title])) continue; + $columnKey[] = $fields[$title]; + } + + $endField = end($fields); + $caseData = array(); + $stepData = array(); + $stepVars = 0; + foreach($rows as $row => $data) + { + $case = new stdclass(); + foreach($columnKey as $key => $field) + { + if(!isset($data[$key])) continue; + $cellValue = $data[$key]; + if($field == 'module') + { + $case->$field = 0; + if(strrpos($cellValue, '(#') !== false) + { + $id = trim(substr($cellValue, strrpos($cellValue,'(#') + 2), ')'); + $case->$field = $id; + } + } + elseif(in_array($field, $caseConfig->export->listFields)) + { + if($field == 'stage') + { + $stages = explode("\n", $cellValue); + foreach($stages as $stage) $case->stage[] = array_search($stage, $caseLang->{$field . 'List'}); + $case->stage = join(',', $case->stage); + } + else + { + $case->$field = array_search($cellValue, $caseLang->{$field . 'List'}); + } + } + elseif($field != 'stepDesc' and $field != 'stepExpect') + { + $case->$field = $cellValue; + } + else + { + $steps = explode("\n", $cellValue); + $stepKey = str_replace('step', '', strtolower($field)); + $caseStep = array(); + + foreach($steps as $step) + { + $step = trim($step); + if(empty($step)) continue; + if(preg_match('/^(([0-9]+)\.[0-9]+)([.、]{1})/U', $step, $out)) + { + $num = $out[1]; + $parent = $out[2]; + $sign = $out[3]; + $signbit = $sign == '.' ? 1 : 3; + $step = trim(substr($step, strlen($num) + $signbit)); + if(!empty($step)) $caseStep[$num]['content'] = $step; + $caseStep[$num]['type'] = 'item'; + $caseStep[$parent]['type'] = 'group'; + } + elseif(preg_match('/^([0-9]+)([.、]{1})/U', $step, $out)) + { + $num = $out[1]; + $sign = $out[2]; + $signbit = $sign == '.' ? 1 : 3; + $step = trim(substr($step, strlen($num) + $signbit)); + if(!empty($step)) $caseStep[$num]['content'] = $step; + $caseStep[$num]['type'] = 'step'; + } + elseif(isset($num)) + { + $caseStep[$num]['content'] .= "\n" . $step; + } + else + { + if($field == 'stepDesc') + { + $num = 1; + $caseStep[$num]['content'] = $step; + $caseStep[$num]['type'] = 'step'; + } + if($field == 'stepExpect' and isset($stepData[$row]['desc'])) + { + end($stepData[$row]['desc']); + $num = key($stepData[$row]['desc']); + $caseStep[$num]['content'] = $step; + } + } + } + unset($num); + unset($sign); + $stepVars += count($caseStep, COUNT_RECURSIVE) - count($caseStep); + $stepData[$row][$stepKey] = $caseStep; + } + } + + $caseData[$row] = $case; + unset($case); + } + + if(empty($caseData)) + { + echo js::alert($this->lang->error->noData); + die(js::locate($this->createLink('testsuite', 'library', "libID=$libID"))); + } + if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']); + + /* Judge whether the editedTasks is too large and set session. */ + $countInputVars = count($caseData) * 9 + $stepVars; + $showSuhosinInfo = common::judgeSuhosinSetting($countInputVars); + if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars); + + $this->view->title = $this->lang->caselib->common . $this->lang->colon . $this->lang->testcase->showImport; + $this->view->position[] = $this->lang->testcase->showImport; + + $this->view->modules = $modules; + $this->view->cases = $this->dao->select('id,module,stage,status,pri,type')->from(TABLE_CASE)->where('lib')->eq($libID)->andWhere('deleted')->eq(0)->andWhere('product')->eq(0)->fetchAll('id'); + $this->view->caseData = $caseData; + $this->view->stepData = $stepData; + $this->view->libID = $libID; + $this->display(); + } } diff --git a/module/testsuite/css/batchcreatecase.css b/module/testsuite/css/batchcreatecase.css new file mode 100644 index 0000000000..97107bc0d1 --- /dev/null +++ b/module/testsuite/css/batchcreatecase.css @@ -0,0 +1,2 @@ +.w-180px{width:180px} +.chosen-container[id^="module"] .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important} diff --git a/module/testsuite/css/library.css b/module/testsuite/css/library.css index 2c188e386f..6e9a99e6c1 100644 --- a/module/testsuite/css/library.css +++ b/module/testsuite/css/library.css @@ -1,5 +1,7 @@ .w-220px{width:220px} +#createActionMenu .dropdown-menu {width: 100%;} + .dropdown-menu.with-search {padding: 0; min-width: 150px; overflow: hidden; max-height: 302px;} .dropdown-menu > .menu-search .input-group {width:100%;} .dropdown-menu > .menu-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666} diff --git a/module/testsuite/css/showimport.css b/module/testsuite/css/showimport.css new file mode 100644 index 0000000000..496c95dba6 --- /dev/null +++ b/module/testsuite/css/showimport.css @@ -0,0 +1,2 @@ +.table table td,.outer .table table tbody > tr:last-child td {padding: 2px 0 2px 5px!important; border: none!important;} +.chosen-container-single .chosen-drop {min-width: 300px; border-top: 1px solid #ddd!important} diff --git a/module/testsuite/lang/zh-cn.php b/module/testsuite/lang/zh-cn.php index be6e650cce..2f4f981bd5 100644 --- a/module/testsuite/lang/zh-cn.php +++ b/module/testsuite/lang/zh-cn.php @@ -20,6 +20,8 @@ $lang->testsuite->linkVersion = "版本"; $lang->testsuite->unlinkCase = "移除"; $lang->testsuite->batchUnlinkCases = "批量移除用例"; $lang->testsuite->deleted = '已删除'; +$lang->testsuite->exportTemplet = '导出模板'; +$lang->testsuite->importFile = '导入CSV'; $lang->testsuite->common = '套件'; $lang->testsuite->product = '所属' . $lang->productCommon; diff --git a/module/testsuite/model.php b/module/testsuite/model.php index 174bec7dfe..f709bf6f8d 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -509,4 +509,253 @@ class testsuiteModel extends model } return $link; } + + /** + * Create from import. + * + * @param int $libID + * @access public + * @return void + */ + public function createFromImport($libID) + { + $this->loadModel('action'); + $this->loadModel('testcase'); + $this->loadModel('file'); + $now = helper::now(); + $data = fixer::input('post')->get(); + + if(!empty($_POST['id'])) + { + $oldSteps = $this->dao->select('t2.*')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_CASESTEP)->alias('t2')->on('t1.id = t2.case') + ->where('t1.id')->in(($_POST['id'])) + ->andWhere('t1.version=t2.version') + ->orderBy('t2.id') + ->fetchGroup('case'); + $oldCases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($_POST['id'])->fetchAll('id'); + } + + $cases = array(); + foreach($data->lib as $key => $lib) + { + $caseData = new stdclass(); + + $caseData->lib = $lib; + $caseData->module = $data->module[$key]; + $caseData->title = $data->title[$key]; + $caseData->pri = (int)$data->pri[$key]; + $caseData->type = $data->type[$key]; + $caseData->status = $data->status[$key]; + $caseData->stage = join(',', $data->stage[$key]); + $caseData->keywords = $data->keywords[$key]; + $caseData->frequency = 1; + $caseData->precondition = $data->precondition[$key]; + + if(isset($this->config->testcase->create->requiredFields)) + { + $requiredFields = explode(',', $this->config->testcase->create->requiredFields); + foreach($requiredFields as $requiredField) + { + $requiredField = trim($requiredField); + if(empty($caseData->$requiredField)) die(js::alert(sprintf($this->lang->testcase->noRequire, $key, $this->lang->testcase->$requiredField))); + } + } + + $cases[$key] = $caseData; + } + + $forceReview = $this->testcase->forceReview(); + foreach($cases as $key => $caseData) + { + if(!empty($_POST['id'][$key]) and empty($_POST['insert'])) + { + $caseID = $data->id[$key]; + $stepChanged = false; + $steps = array(); + $oldStep = isset($oldSteps[$caseID]) ? $oldSteps[$caseID] : array(); + $oldCase = $oldCases[$caseID]; + + /* Remove the empty setps in post. */ + $steps = array(); + if(isset($_POST['desc'][$key])) + { + foreach($data->desc[$key] as $id => $desc) + { + $desc = trim($desc); + if(empty($desc))continue; + $step = new stdclass(); + $step->type = $data->stepType[$key][$id]; + $step->desc = $desc; + $step->expect = trim($data->expect[$key][$id]); + + $steps[] = $step; + } + } + + /* If step count changed, case changed. */ + if((!$oldStep != !$steps) or (count($oldStep) != count($steps))) + { + $stepChanged = true; + } + else + { + /* Compare every step. */ + foreach($oldStep as $id => $oldStep) + { + if(trim($oldStep->desc) != trim($steps[$id]->desc) or trim($oldStep->expect) != $steps[$id]->expect) + { + $stepChanged = true; + break; + } + } + } + + $version = $stepChanged ? $oldCase->version + 1 : $oldCase->version; + $caseData->version = $version; + $changes = common::createChanges($oldCase, $caseData); + if(!$changes and !$stepChanged) continue; + + if($changes or $stepChanged) + { + $caseData->lastEditedBy = $this->app->user->account; + $caseData->lastEditedDate = $now; + if($stepChanged and $forceReview) $caseData->status = 'wait'; + $this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->exec(); + if($stepChanged) + { + $parentStepID = 0; + foreach($steps as $id => $step) + { + $step = (array)$step; + if(empty($step['desc'])) continue; + $stepData = new stdclass(); + $stepData->type = ($step['type'] == 'item' and $parentStepID == 0) ? 'step' : $step['type']; + $stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0; + $stepData->case = $caseID; + $stepData->version = $version; + $stepData->desc = htmlspecialchars($step['desc']); + $stepData->expect = htmlspecialchars($step['expect']); + $this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec(); + if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID(); + if($stepData->type == 'step') $parentStepID = 0; + } + } + $oldCase->steps = $this->joinStep($oldStep); + $caseData->steps = $this->joinStep($steps); + $changes = common::createChanges($oldCase, $caseData); + $actionID = $this->action->create('case', $caseID, 'Edited'); + $this->action->logHistory($actionID, $changes); + } + } + else + { + $caseData->version = 1; + $caseData->openedBy = $this->app->user->account; + $caseData->openedDate = $now; + $caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch; + if($forceReview) $caseData->status = 'wait'; + $this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec(); + + if(!dao::isError()) + { + $caseID = $this->dao->lastInsertID(); + $parentStepID = 0; + foreach($data->desc[$key] as $id => $desc) + { + $desc = trim($desc); + if(empty($desc)) continue; + $stepData = new stdclass(); + $stepData->type = ($data->stepType[$key][$id] == 'item' and $parentStepID == 0) ? 'step' : $data->stepType[$key][$id]; + $stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0; + $stepData->case = $caseID; + $stepData->version = 1; + $stepData->desc = htmlspecialchars($desc); + $stepData->expect = htmlspecialchars($data->expect[$key][$id]); + $this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec(); + if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID(); + if($stepData->type == 'step') $parentStepID = 0; + } + $this->action->create('case', $caseID, 'Opened'); + } + } + } + + unlink($this->session->importFile); + unset($_SESSION['importFile']); + } + + /** + * Batch create case for lib. + * + * @param int $libID + * @access public + * @return void + */ + public function batchCreateCase($libID) + { + $this->loadModel('testcase'); + $this->loadModel('action'); + + $now = helper::now(); + $cases = fixer::input('post')->get(); + $batchNum = count(reset($cases)); + + $result = $this->loadModel('common')->removeDuplicate('case', $cases, "lib={$libID}"); + $cases = $result['data']; + + for($i = 0; $i < $batchNum; $i++) + { + if(!empty($cases->title[$i]) and empty($cases->type[$i])) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->testcase->type))); + } + + $module = 0; + $type = ''; + $pri = 3; + for($i = 0; $i < $batchNum; $i++) + { + $module = $cases->module[$i] == 'ditto' ? $module : $cases->module[$i]; + $type = $cases->type[$i] == 'ditto' ? $type : $cases->type[$i]; + $pri = $cases->pri[$i] == 'ditto' ? $pri : $cases->pri[$i]; + $cases->module[$i] = (int)$module; + $cases->type[$i] = $type; + $cases->pri[$i] = $pri; + } + + $forceReview = $this->testcase->forceReview(); + for($i = 0; $i < $batchNum; $i++) + { + if($cases->type[$i] != '' and $cases->title[$i] != '') + { + $data[$i] = new stdclass(); + $data[$i]->lib = $libID; + $data[$i]->module = $cases->module[$i]; + $data[$i]->type = $cases->type[$i]; + $data[$i]->pri = $cases->pri[$i]; + $data[$i]->stage = empty($cases->stage[$i]) ? '' : implode(',', $cases->stage[$i]); + $data[$i]->color = $cases->color[$i]; + $data[$i]->title = $cases->title[$i]; + $data[$i]->precondition = $cases->precondition[$i]; + $data[$i]->keywords = $cases->keywords[$i]; + $data[$i]->openedBy = $this->app->user->account; + $data[$i]->openedDate = $now; + $data[$i]->status = $forceReview ? 'wait' : 'normal'; + $data[$i]->version = 1; + + $this->dao->insert(TABLE_CASE)->data($data[$i]) + ->autoCheck() + ->batchCheck($this->config->testcase->create->requiredFields, 'notempty') + ->exec(); + + if(dao::isError()) + { + echo js::error(dao::getError()); + die(js::reload('parent')); + } + + $caseID = $this->dao->lastInsertID(); + $actionID = $this->action->create('case', $caseID, 'Opened'); + } + } + } } diff --git a/module/testsuite/view/batchcreatecase.html.php b/module/testsuite/view/batchcreatecase.html.php new file mode 100644 index 0000000000..1c089d2ea9 --- /dev/null +++ b/module/testsuite/view/batchcreatecase.html.php @@ -0,0 +1,93 @@ + + * @package testsuite + * @version $Id$ + * @link http://www.zentao.net + */ +?> + +testcase->batchCreate);?> + +
+
+ icons['testcase']);?> + + icons['batchCreate']);?> + testcase->batchCreate;?> + +
+ pasteText, "data-toggle='myModal' ")?> +
+
+
+
+ + + + + + + + + + + + + + + testcase->typeList['']);?> + testcase->batchCreate; $i++):?> + testcase->typeList['ditto'] = $lang->testcase->ditto; + if($i != 0) $lang->testcase->priList['ditto'] = $lang->testcase->ditto; + $type = $i == 0 ? 'feature' : 'ditto'; + $pri = $i == 0 ? 3 : 'ditto'; + ?> + + + + + + + + + + + + + + +
idAB;?>testcase->module;?>testcase->title;?> testcase->type;?> testcase->pri;?>testcase->precondition;?>testcase->keywords;?>testcase->stage;?>
+
+ testcase->colorTag}' data-update-text='#title\\[{$i}\\]'");?> + +
+
testcase->typeList, $type, "class=form-control");?>testcase->priList, $pri, "class=form-control");?>testcase->stageList, '', "class='form-control chosen' multiple");?>
+
+ + + + + + + + + + + + + + + +
%s +
+ testcase->colorTag}' data-update-text='#title\\[%s\\]'");?> +
testcase->typeList, $type, "class=form-control");?>testcase->priList, $pri, "class=form-control");?>testcase->stageList, '', "class='form-control' multiple");?>
+ + diff --git a/module/testsuite/view/exporttemplet.html.php b/module/testsuite/view/exporttemplet.html.php new file mode 100644 index 0000000000..80e5e9e311 --- /dev/null +++ b/module/testsuite/view/exporttemplet.html.php @@ -0,0 +1,49 @@ + + +
+
+ icons['export']);?> + testcase->exportTemplet;?> +
+
+ +
+ + + + + + +
+
+ testcase->num;?> + +
+
+ charsets[$this->cookie->lang], 'utf-8', "class='form-control'");?> + + +
+
+ diff --git a/module/testsuite/view/import.html.php b/module/testsuite/view/import.html.php new file mode 100644 index 0000000000..00c7543f75 --- /dev/null +++ b/module/testsuite/view/import.html.php @@ -0,0 +1,19 @@ + +
+
+ + + + + + +
+ + + charsets[$this->cookie->lang], 'utf-8', "class='form-control'");?> + + +
+
+
+ diff --git a/module/testsuite/view/library.html.php b/module/testsuite/view/library.html.php index fa1a57be4e..15b4db4b76 100644 --- a/module/testsuite/view/library.html.php +++ b/module/testsuite/view/library.html.php @@ -45,6 +45,15 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete); ?>
+
+ createLink('testsuite', 'exportTemplet', "libID=$libID") : '#'; + if(common::hasPriv('testsuite', 'exportTemplet')) echo html::a($link, " " . $lang->testsuite->exportTemplet, '', "class='btn export'"); + + $link = common::hasPriv('testsuite', 'import') ? $this->createLink('testsuite', 'import', "libID=$libID") : '#'; + if(common::hasPriv('testsuite', 'import')) echo html::a($link, " " . $lang->testsuite->importFile, '', "class='btn export'"); + ?> +
testcase->confirmBatchDelete); $link = common::hasPriv('testsuite', 'createCase') ? $this->createLink('testsuite', 'createCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0)) : '#'; echo html::a($link, "" . $lang->testcase->create, '', $misc); ?> + +
diff --git a/module/testsuite/view/showimport.html.php b/module/testsuite/view/showimport.html.php new file mode 100644 index 0000000000..79f04a1ae3 --- /dev/null +++ b/module/testsuite/view/showimport.html.php @@ -0,0 +1,121 @@ + + + +
+ +
+ + + + + + + + + + + + + + + + + + $case):?> + title)) continue;?> + id) and !isset($cases[$case->id])) $case->id = 0;?> + + + + + + + + + + + + + + + + + + + +
testcase->id?>testcase->title?>testcase->module?>testcase->pri?>testcase->type?>testcase->status?>testcase->stage?>testcase->keywords?>testcase->precondition?> + + + + + +
testcase->stepDesc?>testcase->stepExpect?>
+
+ id)) + { + echo $case->id . html::hidden("id[$key]", $case->id); + $insert = false; + } + else + { + echo $key . " {$lang->testcase->new}"; + } + echo html::hidden("lib[$key]", $libID); + ?> + title, "class='form-control' style='margin-top:2px' autocomplete='off'")?>module) ? $case->module : (!empty($case->id) ? $cases[$case->id]->module : ''), "class='form-control chosen'")?>testcase->priList, isset($case->pri) ? $case->pri : (!empty($case->id) ? $cases[$case->id]->pri : ''), "class='form-control'")?>testcase->typeList, isset($case->type) ? $case->type : (!empty($case->id) ? $cases[$case->id]->type : ''), "class='form-control'")?>testcase->statusList, isset($case->status) ? $case->status : (!empty($case->id) ? $cases[$case->id]->status : 'normal'), "class='form-control'")?>testcase->stageList, !empty($case->stage) ? $case->stage : (!empty($case->id) ? $cases[$case->id]->stage : ''), "multiple='multiple' class='form-control chosen'")?>keywords) ? $case->keywords : "", "class='form-control' autocomplete='off'")?>precondition) ? htmlspecialchars($case->precondition) : "", "class='form-control'")?> + + + $desc):?> + + + + + + + +
+ +
+ {$lang->save}"; + } + else + { + echo html::submitButton(); + } + echo '   ' . html::backButton() + ?> +
+
+ + +