From 6bdeb145eb10e793a4c393d67293bf190d65bf48 Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Fri, 8 Jun 2012 08:04:26 +0000 Subject: [PATCH] * Remove testcase-batchEdit as plugin. --- module/testcase/control.php | 68 ------------------------- module/testcase/lang/en.php | 1 - module/testcase/lang/zh-cn.php | 1 - module/testcase/model.php | 59 --------------------- module/testcase/view/batchedit.html.php | 57 --------------------- module/testcase/view/browse.html.php | 19 +------ module/testtask/view/cases.html.php | 7 +-- 7 files changed, 3 insertions(+), 209 deletions(-) delete mode 100755 module/testcase/view/batchedit.html.php diff --git a/module/testcase/control.php b/module/testcase/control.php index 37ed0b0a53..4457c5303a 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -400,74 +400,6 @@ class testcase extends control $this->display(); } - /** - * Batch edit case. - * - * @param string $from example:testcaseBrowse,testtaskCases,testcaseBatchEdit - * @param int $productID - * @param string $orderBy - * @access public - * @return void - */ - public function batchEdit($from = '', $productID = 0, $orderBy = '') - { - if($from == 'testcaseBrowse' or $from == 'testtaskCases') - { - /* Init vars. */ - $orderBy = $orderBy ? $orderBy : 'id_desc'; - $caseIDList = $this->post->caseIDList ? $this->post->caseIDList : array(); - $product = $this->product->getByID($productID); - $editedCases = array(); - $columns = 7; - $showSuhosinInfo = false; - - /* Get all cases. */ - $allCases = $this->dao->select('*')->from(TABLE_CASE)->alias('t1')->where($this->session->testcaseReport)->orderBy($orderBy)->fetchAll('id'); - - /* Set product menu. */ - $this->testcase->setMenu($this->products, $productID); - - /* Initialize the cases whose need to edited. */ - foreach($allCases as $case) if(in_array($case->id, $caseIDList)) $editedCases[$case->id] = $case; - - /* Judge whether the editedTasks is too large. */ - $showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($editedCases), $columns); - - /* Set the sessions. */ - $this->app->session->set('showSuhosinInfo', $showSuhosinInfo); - - /* Assign. */ - $this->view->header['title'] = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; - $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); - $this->view->position[] = $this->lang->testcase->common; - $this->view->position[] = $this->lang->testcase->batchEdit; - - if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0); - $this->view->productID = $productID; - $this->view->editedCases = $editedCases; - $this->view->users = $this->user->getPairs('noletter'); - - $this->display(); - } - elseif($from == 'testcaseBatchEdit') - { - if(!empty($_POST)) - { - $allChanges = $this->testcase->batchUpdate(); - if($allChanges) - { - foreach($allChanges as $caseID => $changes ) - { - $actionID = $this->loadModel('action')->create('case', $caseID, 'Edited'); - $this->action->logHistory($actionID, $changes); - } - } - } - die(js::locate($this->session->caseList, 'parent')); - } - } - /** * Delete a test case * diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index 2d1bbab426..fc8f08d47e 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -54,7 +54,6 @@ $lang->testcase->batchCreate = "Batch create"; $lang->testcase->delete = "Delete"; $lang->testcase->view = "Info"; $lang->testcase->edit = "Edit"; -$lang->testcase->batchEdit = "Batch edit"; $lang->testcase->delete = "Delete"; $lang->testcase->browse = "Browse"; $lang->testcase->export = "Export"; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 3c4c84b3c5..b62ac1c441 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -54,7 +54,6 @@ $lang->testcase->batchCreate = "批量添加"; $lang->testcase->delete = "删除用例"; $lang->testcase->view = "用例详情"; $lang->testcase->edit = "编辑用例"; -$lang->testcase->batchEdit = "批量编辑 "; $lang->testcase->delete = "删除用例"; $lang->testcase->browse = "用例列表"; $lang->testcase->export = "导出数据"; diff --git a/module/testcase/model.php b/module/testcase/model.php index 03fa836b62..93f9cc32e9 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -250,65 +250,6 @@ class testcaseModel extends model } } - /** - * Batch update case. - * - * @access public - * @return void - */ - public function batchUpdate() - { - $cases = array(); - $allChanges = array(); - $now = helper::now(); - $caseIDList = $this->post->caseIDList ? $this->post->caseIDList : array(); - - /* Adjust whether the post data is complete, if not, remove the last element of $caseIDList. */ - if($this->session->showSuhosinInfo) array_pop($caseIDList); - - if(!empty($caseIDList)) - { - /* Initialize cases from the post data.*/ - foreach($caseIDList as $caseID) - { - $case->lastEditedBy = $this->app->user->account; - $caee->lastEditedDate = $now; - $case->pri = $this->post->pris[$caseID]; - $case->status = $this->post->statuses[$caseID]; - $case->module = $this->post->modules[$caseID]; - $case->title = htmlspecialchars($this->post->titles[$caseID]); - $case->type = $this->post->types[$caseID]; - $case->stage = implode(',', $this->post->stages[$caseID]); - - $cases[$caseID] = $case; - unset($case); - } - - /* Update cases. */ - foreach($cases as $caseID => $case) - { - $oldCase = $this->getByID($caseID); - $this->dao->update(TABLE_CASE)->data($case) - ->autoCheck() - ->batchCheck($this->config->testcase->edit->requiredFields, 'notempty') - ->where('id')->eq($caseID) - ->exec(); - - if(!dao::isError()) - { - unset($oldCase->steps); - $allChanges[$caseID] = common::createChanges($oldCase, $case); - } - else - { - die(js::error('case#' . $caseID . dao::getError(true))); - } - } - } - - return $allChanges; - } - /** * Join steps to a string, thus can diff them. * diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php deleted file mode 100755 index 798bfb9556..0000000000 --- a/module/testcase/view/batchedit.html.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @package testcase - * @version $Id$ - * @link http://www.zentao.net - */ -?> - -
"> - - - - - - - - - - - - - - - - - - - - - - - - - - -
testcase->common . $lang->colon . $lang->testcase->batchEdit;?>
idAB;?>priAB;?>statusAB;?>testcase->module;?>testcase->title;?>testcase->type;?>testcase->stage;?>
id . html::hidden("caseIDList[$case->id]", $case->id);?>id]", $lang->testcase->priList, $case->pri, 'class=select-1');?>id]", (array)$lang->testcase->statusList, $case->status, 'class=select-1');?>id]", $moduleOptionMenu, $case->module, "class='select-1'");?>id]", $case->title, 'class=text-1'); echo "*";?>id]", $lang->testcase->typeList, $case->type, 'class=select-1');?> - testcase->stageListAB as $key => $stage) - { - if(in_array($key, explode(',', $case->stage))) - { - echo "$stage "; - } - else - { - echo "$stage "; - } - } - ?> -
-
- diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index cffd328709..09b30807c1 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -71,10 +71,7 @@ var moduleID = ''; id");?> - - - id));?> - + id));?> pri?> title);?> @@ -101,19 +98,7 @@ var moduleID = ''; - - - -
- testcase->batchEdit); - ?> -
- show();?> - - - + show();?> diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index 8b67a7feec..1c3c60d0a6 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -87,12 +87,7 @@ var moduleID = '';
- - ';casesform.submit();"> - + id");?>';casesform.submit();">