From 45be42a13ba5b40e7b6e81238dd08d3b93d9c041 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Aug 2014 06:08:48 +0000 Subject: [PATCH 1/3] * finish task #1934. --- module/bug/control.php | 2 +- module/bug/model.php | 6 ++- module/common/control.php | 1 - module/testcase/control.php | 36 +++++++++++++++++ module/testcase/lang/en.php | 1 + module/testcase/lang/zh-cn.php | 1 + module/testcase/view/browse.html.php | 2 +- module/testcase/view/createbug.html.php | 53 +++++++++++++++++++++++++ module/testcase/view/view.html.php | 2 +- module/testtask/model.php | 1 + module/testtask/view/cases.html.php | 2 +- 11 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 module/testcase/view/createbug.html.php diff --git a/module/bug/control.php b/module/bug/control.php index 0fa39b530c..6958859aa7 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -214,7 +214,7 @@ class bug extends control if(empty($this->products)) $this->locate($this->createLink('product', 'create')); $this->app->loadLang('release'); - if(!empty($_POST)) + if(!empty($_POST) and !isset($_POST['stepIDList'])) { $response['result'] = 'success'; $response['message'] = ''; diff --git a/module/bug/model.php b/module/bug/model.php index 4ff8d00aac..8bacca4ece 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -724,6 +724,7 @@ class bugModel extends model { $title = ''; $bugSteps = ''; + $steps = $this->post->stepIDList; $result = $this->dao->findById($resultID)->from(TABLE_TESTRESULT)->fetch(); if($caseID > 0) @@ -749,13 +750,15 @@ class bugModel extends model { foreach($caseSteps as $key => $step) { + if(!in_array($step->id, $steps)) continue; $bugSteps .= ($key + 1) . '. ' . $step->desc . "
"; } $bugSteps .= $this->lang->bug->tplResult; foreach($caseSteps as $key => $step) { - if(!$stepResults[$step->id]['real']) continue; + if(empty($stepResults[$step->id]['real'])) continue; + if(!in_array($step->id, $steps)) continue; $bugSteps .= ($key + 1) . '. ' . $stepResults[$step->id]['real'] . "
"; } @@ -763,6 +766,7 @@ class bugModel extends model foreach($caseSteps as $key => $step) { if(!$step->expect) continue; + if(!in_array($step->id, $steps)) continue; $bugSteps .= ($key + 1) . '. ' . $step->expect . "
"; } diff --git a/module/common/control.php b/module/common/control.php index af47345f04..43a485199d 100644 --- a/module/common/control.php +++ b/module/common/control.php @@ -259,7 +259,6 @@ class common extends control } /* Set module and method, then create link to it. */ - if(strtolower($module) == 'testcase' and strtolower($method) == 'createbug') ($module = 'bug') and ($method = 'create'); if(strtolower($module) == 'story' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create'); if(strtolower($module) == 'bug' and strtolower($method) == 'tostory') ($module = 'story') and ($method = 'create'); if(strtolower($module) == 'bug' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create'); diff --git a/module/testcase/control.php b/module/testcase/control.php index 35e1822f93..4a2a4cdb07 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -379,6 +379,42 @@ class testcase extends control $this->display(); } + /** + * Create bug. + * + * @param int $productID + * @param string $extras + * @access public + * @return void + */ + public function createBug($productID, $extras = '') + { + parse_str(str_replace(array(',', ' '), array('&', ''), $extras)); + + $this->loadModel('testtask'); + $case = ''; + if($runID) + { + $case = $this->testtask->getRunById($runID)->case; + $results = $this->testtask->getResults($runID); + } + elseif($caseID) + { + $case = $this->testcase->getById($caseID); + $results = $this->testtask->getResults(0, $caseID); + } + + if(!$case) die(js::error($this->lang->notFound) . js::locate('back', 'parent')); + if(empty($case->steps)) die(js::locate($this->createLink('bug', 'create', "product=$productID&extras=$extras"))); + + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->createBug; + $this->view->case = $case; + $this->view->result = reset($results); + $this->view->extras = $extras; + $this->view->productID = $productID; + $this->display(); + } + /** * View a test case. * diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index f9bad8cf0f..48d38f5faa 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -45,6 +45,7 @@ $lang->testcase->allProduct = 'All product'; $lang->testcase->fromBug = 'From bug'; $lang->testcase->toBug = 'To bug'; $lang->testcase->changed = 'Changed'; +$lang->testcase->createBug = 'Create bug'; $lang->case = $lang->testcase; // For dao checking using. Because 'case' is a php keywords, so the module name is testcase, table name is still case. $lang->testcase->stepID = 'ID'; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 56e92dba67..37a0834bb9 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -45,6 +45,7 @@ $lang->testcase->allProduct = '所有产品'; $lang->testcase->fromBug = '来源Bug'; $lang->testcase->toBug = '生成Bug'; $lang->testcase->changed = '用例变更'; +$lang->testcase->createBug = '创建Bug'; $lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。 $lang->testcase->stepID = '编号'; diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index 7fa8df6b48..67949a6e1e 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -89,7 +89,7 @@ js::set('confirmDelete', $lang->testcase->confirmDelete); echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '', '', "title='{$lang->testcase->delete}' class='btn-icon'"); } - common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug'); + common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe'); ?> diff --git a/module/testcase/view/createbug.html.php b/module/testcase/view/createbug.html.php new file mode 100644 index 0000000000..84cdbef581 --- /dev/null +++ b/module/testcase/view/createbug.html.php @@ -0,0 +1,53 @@ + + * @package testcase + * @version $Id$ + * @link http://www.zentao.net + */ +?> + +
' target='_parent' method='post'> + + + + + + + + + + + + + stepResults as $stepID => $stepResult):?> + + + + + + + + + + + + + + + +
testcase->stepID;?>testcase->stepDesc;?>testcase->stepExpect;?>testcase->result;?>testcase->real;?>
+ + + text-center'>testcase->resultList, zget($stepResult, 'result'));?>
+ " . html::selectButton() . ''; + echo html::submitButton(); + ?> +
+
+ diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index 0b65fd788e..b5e6614653 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -46,7 +46,7 @@ common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->currentVersion", '', 'button', '', '', 'runCase'); common::printIcon('testtask', 'results', "runID=0&caseID=$case->id&version=$case->version", '', 'button', '', '', 'results'); - if($case->lastRunResult == 'fail') common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", '', 'button', 'bug'); + if($case->lastRunResult == 'fail') common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", '', 'button', 'bug', '', 'iframe'); echo ''; echo "
"; diff --git a/module/testtask/model.php b/module/testtask/model.php index 894efb6d1e..35f410dfc0 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -337,6 +337,7 @@ class testtaskModel extends model ->setForce('stepResults', serialize($stepResults)) ->add('lastRunner', $this->app->user->account) ->add('date', $now) + ->skipSpecial('stepResults') ->remove('steps,reals,result') ->get(); $this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec(); diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index a0e224b496..854d3c8809 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -82,7 +82,7 @@ var moduleID = ''; echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"caseList\",confirmUnlink)", '', '', "title='{$lang->testtask->unlinkCase}' class='btn-icon'"); } - common::printIcon('testcase', 'createBug', "product=$productID&extra=projectID=$task->project,buildID=$task->build,caseID=$run->case,version=$run->version,runID=$run->id,testtask=$taskID", $run, 'list', 'bug'); + common::printIcon('testcase', 'createBug', "product=$productID&extra=projectID=$task->project,buildID=$task->build,caseID=$run->case,version=$run->version,runID=$run->id,testtask=$taskID", $run, 'list', 'bug', '', 'iframe'); ?> From 4b48e14895cc5d5358a01a9154a49d08656c6f5d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Aug 2014 06:37:51 +0000 Subject: [PATCH 2/3] * finish task #2002. --- framework/helper.class.php | 2 +- framework/router.class.php | 2 +- module/common/model.php | 2 +- module/report/model.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/helper.class.php b/framework/helper.class.php index d4b882c8e4..0f16b098bc 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -583,7 +583,7 @@ function isLocalIP() function getWebRoot() { $path = $_SERVER['SCRIPT_NAME']; - if(defined('IN_SHELL')) + if(PHP_SAPI == 'cli') { $url = parse_url($_SERVER['argv'][1]); $path = empty($url['path']) ? '/' : rtrim($url['path'], '/'); diff --git a/framework/router.class.php b/framework/router.class.php index 28a1e23099..4c482fa6b9 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -1597,7 +1597,7 @@ class router $errorLog .= "when visiting " . $this->getURI() . "\n"; /* If the ip is pulic, hidden the full path of scripts. */ - if(!defined('IN_SHELL') and !($this->server->server_addr == '127.0.0.1' or filter_var($this->server->server_addr, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) === false)) + if(PHP_SAPI != 'cli' and !($this->server->server_addr == '127.0.0.1' or filter_var($this->server->server_addr, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) === false)) { $errorLog = str_replace($this->getBasePath(), '', $errorLog); } diff --git a/module/common/model.php b/module/common/model.php index 9971e4babf..3f2ace4de6 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -73,7 +73,7 @@ class commonModel extends model { $this->app->user = $this->session->user; } - elseif($this->app->company->guest or defined('IN_SHELL')) + elseif($this->app->company->guest or PHP_SAPI == 'cli') { $user = new stdClass(); $user->id = 0; diff --git a/module/report/model.php b/module/report/model.php index 1fa7c53172..61161c9484 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -519,7 +519,7 @@ EOT; public function getSysURL() { /* Ger URL when run in shell. */ - if(defined('IN_SHELL')) + if(PHP_SAPI == 'cli') { $url = parse_url(trim($this->server->argv[1])); $port = (empty($url['port']) or $url['port'] == 80) ? '' : $url['port']; From b961d910383dbfcb2002543c94774c4a2935d74f Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Aug 2014 07:48:04 +0000 Subject: [PATCH 3/3] * finish task #2033. --- Makefile | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 7d545491b8..41cc4ecec2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION=$(shell head -n 1 VERSION) -all: prepare pms +all: pms clean: rm -fr zentaopms rm -fr zentaostory @@ -11,7 +11,7 @@ clean: rm -fr api* rm -fr build/linux/lampp rm -fr lampp -prepare: +pms: mkdir zentaopms cp -fr bin zentaopms/ cp -fr config zentaopms/ && rm -fr zentaopms/config/my.php @@ -37,7 +37,7 @@ prepare: find zentaopms -name tests |xargs rm -fr # notify.zip. mkdir zentaopms/www/data/notify/ - wget http://192.168.1.99/release/notify.zip -O zentaopms/www/data/notify/notify.zip + #wget http://192.168.1.99/release/notify.zip -O zentaopms/www/data/notify/notify.zip # change mode. chmod 777 -R zentaopms/tmp/ chmod 777 -R zentaopms/www/data @@ -45,42 +45,8 @@ prepare: chmod 777 zentaopms/module chmod a+rx zentaopms/bin/* find zentaopms/ -name ext |xargs chmod -R 777 -pms: echo full > zentaopms/.flow zip -r -9 ZenTaoPMS.$(VERSION).zip zentaopms -zstory: - cp -frp zentaopms zentaostory - svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/zentaostory storyext - cp -fr storyext/module/* zentaostory/module/ - find zentaostory/ -name ext |xargs chmod -R 777 - echo zentaostory > zentaostory/.flow - sed -e 's/zentao/story/g' zentaostory/www/.ztaccess > .ztaccess.bak - mv .ztaccess.bak zentaostory/www/.ztaccess - zip -r -9 ZenTaoStory.$(VERSION).zip zentaostory - rm -fr storyext - rm -fr zentaostory -ztask: - cp -frp zentaopms zentaotask - svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/zentaotask taskext - cp -fr taskext/module/* zentaotask/module/ - find zentaotask/ -name ext |xargs chmod -R 777 - echo zentaotask > zentaotask/.flow - sed -e 's/zentao/task/g' zentaotask/www/.ztaccess > .ztaccess.bak - mv .ztaccess.bak zentaotask/www/.ztaccess - zip -r -9 ZenTaoTask.$(VERSION).zip zentaotask - rm -fr taskext - rm -fr zentaotask -ztest: - cp -frp zentaopms zentaotest - svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/zentaotest testext - cp -fr testext/module/* zentaotest/module/ - find zentaotest/ -name ext |xargs chmod -R 777 - echo zentaotest > zentaotest/.flow - sed -e 's/zentao/test/g' zentaotest/www/.ztaccess > .ztaccess.bak - mv .ztaccess.bak zentaotest/www/.ztaccess - zip -r -9 ZenTaoTest.$(VERSION).zip zentaotest - rm -fr testext - rm -fr zentaotest rm -fr zentaopms patchphpdoc: sudo cp misc/doc/phpdoc/*.tpl /usr/share/php/data/PhpDocumentor/phpDocumentor/Converters/HTML/frames/templates/phphtmllib/templates/