From 9dc6bc2894482805f2407a3ca2a68a2fa10f9db1 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Thu, 1 Aug 2013 09:24:13 +0800 Subject: [PATCH] * code for task#1657. --- module/testtask/control.php | 21 ++++++++++++++++++--- module/testtask/lang/en.php | 4 +++- module/testtask/lang/zh-cn.php | 4 +++- module/testtask/view/cases.html.php | 9 +++++++-- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/module/testtask/control.php b/module/testtask/control.php index 1b4744eb05..7b3a1e7201 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -551,10 +551,25 @@ class testtask extends control * @access public * @return void */ - public function unlinkCase($rowID) + public function unlinkCase($rowID, $confirm = 'no') { - $this->dao->delete()->from(TABLE_TESTRUN)->where('id')->eq((int)$rowID)->exec(); - die(js::reload('parent')); + if($confirm == 'no') + { + die(js::confirm($this->lang->testtask->confirmUnlinkCase, $this->createLink('testtask', 'unlinkCase', "rowID=$rowID&confirm=yes"))); + } + else + { + $response['result'] = 'success'; + $response['message'] = ''; + + $this->dao->delete()->from(TABLE_TESTRUN)->where('id')->eq((int)$rowID)->exec(); + if(dao::isError()) + { + $response['result'] = 'fail'; + $response['message'] = dao::getError(); + } + $this->send($response); + } } /** diff --git a/module/testtask/lang/en.php b/module/testtask/lang/en.php index 6771461921..e94d47a590 100644 --- a/module/testtask/lang/en.php +++ b/module/testtask/lang/en.php @@ -68,11 +68,13 @@ $lang->testtask->unlinkedCases = 'Unlinked'; $lang->testtask->linkedCases = 'Linked'; $lang->testtask->linkByStory = 'Link by story'; $lang->testtask->linkByBug = 'Link by bug'; -$lang->testtask->confirmDelete = 'Are you sure to delete this test task?'; $lang->testtask->passAll = 'Pass all'; $lang->testtask->pass = 'Pass'; $lang->testtask->fail = 'Fail'; +$lang->testtask->confirmDelete = 'Are you sure to delete this test task?'; +$lang->testtask->confirmUnlinkCase = 'Are you sure to unlink this case?'; + $lang->testtask->byModule = 'By module'; $lang->testtask->assignedToMe = 'Assgined to me'; $lang->testtask->allCases = 'All Cases'; diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php index 15073b11a2..28759b3f58 100644 --- a/module/testtask/lang/zh-cn.php +++ b/module/testtask/lang/zh-cn.php @@ -68,11 +68,13 @@ $lang->testtask->unlinkedCases = '未关联'; $lang->testtask->linkedCases = '已关联'; $lang->testtask->linkByStory = '按需求关联'; $lang->testtask->linkByBug = '按Bug关联'; -$lang->testtask->confirmDelete = '您确认要删除该测试任务吗?'; $lang->testtask->passAll = '全部通过'; $lang->testtask->pass = '通过'; $lang->testtask->fail = '失败'; +$lang->testtask->confirmDelete = '您确认要删除该测试任务吗?'; +$lang->testtask->confirmUnlinkCase = '您确认要移除该用例吗?'; + $lang->testtask->byModule = '按模块'; $lang->testtask->assignedToMe = '指派给我'; $lang->testtask->allCases = '所有用例'; diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index 4393369b03..9c09ab0691 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -12,6 +12,8 @@ ?> + +testtask->confirmUnlinkCase)?>