diff --git a/module/bug/model.php b/module/bug/model.php index 28945b3b4e..e42d8450f7 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -28,7 +28,7 @@ class bugModel extends model /* 设置è�œå�•。*/ public function setMenu($products, $productID) { - $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'bug');\""); + $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'bug', 'browse');\""); common::setMenuVars($this->lang->bug->menu, 'product', $selectHtml . $this->lang->arrow); common::setMenuVars($this->lang->bug->menu, 'bug', $productID); common::setMenuVars($this->lang->bug->menu, 'testcase', $productID); diff --git a/module/build/model.php b/module/build/model.php index adc431315b..364603e650 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -102,6 +102,6 @@ class buildModel extends model /* 删除build。*/ public function delete($buildID) { - return $this->dao->delete()->from(TABLE_BUILD)->where('id')->eq((int)$buildID)->exec(); + return $this->dao->update(TABLE_BUILD)->set('deleted')->eq(1)->where('id')->eq((int)$buildID)->exec(); } } diff --git a/module/product/model.php b/module/product/model.php index 1c8baa45de..fea9843ad1 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -26,9 +26,13 @@ class productModel extends model { /* ÉèÖò˵¥¡£*/ - public function setMenu($products, $productID) + public function setMenu($products, $productID, $extra = '') { - $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'product');\""); + /* »ñµÃµ±Ç°µÄÄ£¿éºÍ·½·¨£¬´«µÝ¸øswitchProduct·½·¨£¬¹©Ò³ÃæÌø×ªÊ¹Óá£*/ + $currentModule = $this->app->getModuleName(); + $currentMethod = $this->app->getMethodName(); + + $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, '$currentModule', '$currentMethod', '$extra');\""); common::setMenuVars($this->lang->product->menu, 'list', $selectHtml . $this->lang->arrow); common::setMenuVars($this->lang->product->menu, 'story', $productID); common::setMenuVars($this->lang->product->menu, 'plan', $productID); @@ -77,7 +81,7 @@ class productModel extends model } /* ¸üвúÆ·¡£*/ - function update($productID) + public function update($productID) { /* ´¦ÀíÊý¾Ý¡£*/ $productID = (int)$productID; diff --git a/module/project/model.php b/module/project/model.php index 22e847fe56..a1f436a719 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -64,7 +64,9 @@ class projectModel extends model /* 设置è�œå�•。*/ public function setMenu($projects, $projectID) { - $selectHtml = html::select('projectID', $projects, $projectID, 'onchange="switchProject(this.value);"'); + $moduleName = $this->app->getModuleName(); + $methodName = $this->app->getMethodName(); + $selectHtml = html::select('projectID', $projects, $projectID, "onchange=\"switchProject(this.value, '$moduleName', '$methodName');\""); foreach($this->lang->project->menu as $key => $menu) { if($key == 'list') common::setMenuVars($this->lang->project->menu, 'list', $selectHtml . $this->lang->arrow); diff --git a/module/testcase/model.php b/module/testcase/model.php index ac9de31157..3a52e6ecc1 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -28,7 +28,7 @@ class testcaseModel extends model /* 设置è�œå�•。*/ public function setMenu($products, $productID) { - $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'case');\""); + $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'testcase', 'browse');\""); common::setMenuVars($this->lang->testcase->menu, 'product', $selectHtml . $this->lang->arrow); common::setMenuVars($this->lang->testcase->menu, 'bug', $productID); common::setMenuVars($this->lang->testcase->menu, 'testcase', $productID); diff --git a/module/testtask/model.php b/module/testtask/model.php index 07db214ba3..66e88f0377 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -28,7 +28,7 @@ class testtaskModel extends model /* 设置è�œå�•。*/ public function setMenu($products, $productID) { - $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'case');\""); + $selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'testtask', 'browse');\""); common::setMenuVars($this->lang->testtask->menu, 'product', $selectHtml . $this->lang->arrow); common::setMenuVars($this->lang->testtask->menu, 'bug', $productID); common::setMenuVars($this->lang->testtask->menu, 'testcase', $productID); diff --git a/module/tree/control.php b/module/tree/control.php index f3397392bd..9ab640ab65 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -49,7 +49,7 @@ class tree extends control if($viewType == 'product') { /* 设置è�œå�•。*/ - $this->product->setMenu($this->product->getPairs(), $productID); + $this->product->setMenu($this->product->getPairs(), $productID, 'product'); $this->lang->tree->menu = $this->lang->product->menu; $this->lang->set('menugroup.tree', 'product'); diff --git a/module/user/model.php b/module/user/model.php index ee4d6e3797..48e99d5cce 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -28,7 +28,8 @@ class userModel extends model /* ÉèÖò˵¥¡£*/ public function setMenu($users, $account) { - $selectHtml = html::select('account', $users, $account, "onchange=switchAccount(this.value)"); + $methodName = $this->app->getMethodName(); + $selectHtml = html::select('account', $users, $account, "onchange=\"switchAccount(this.value, '$methodName')\""); common::setMenuVars($this->lang->user->menu, 'account', $selectHtml); common::setMenuVars($this->lang->user->menu, 'todo', $account); common::setMenuVars($this->lang->user->menu, 'task', $account); diff --git a/www/js/my.js b/www/js/my.js index 415fee11db..e0df03b135 100644 --- a/www/js/my.js +++ b/www/js/my.js @@ -78,34 +78,43 @@ function setNowrapObjTitle() } /* 选择产å“�。*/ -function switchProduct(productID, type) +function switchProduct(productID, module, method, extra) { - if(type == 'product') + /* product, roadmap, bug, testcase, testtask,直接传递å�‚数。*/ + if(module == 'product' || module == 'roadmap' || module == 'bug' || module == 'testcase' || module == 'testtask') { - link = createLink('product', 'browse', 'productID=' + productID); + link = createLink(module, method, "productID=" + productID); } - else if(type == 'bug') + /* productplan, relase模å�—需è¦�处ç�†é�žbrowseå’Œcreate的方法。*/ + else if(module == 'productplan' || module == 'release') { - link = createLink('bug', 'browse', 'productID=' + productID + '&type=byModule¶m=0'); + if(method != 'browse' && method != 'create') method = 'browse'; + link = createLink(module, method, "productID=" + productID); } - else if(type == 'case') + /* tree,需è¦�å�•独传递å�‚数。*/ + else if(module == 'tree') { - link = createLink('testcase', 'browse', 'productID=' + productID + '&type=byModule¶m=0'); + link = createLink(module, method, "productID=" + productID + '&type=' + extra); } - location.href=link; } /* 选择项目。*/ -function switchProject(projectID) +function switchProject(projectID, module, method) { - link = createLink('project', 'browse', 'projectID=' + projectID); + /* 如果是build模å�—,而且是edit方法,跳转地å�€æ”¹ä¸ºproject-build-xx.html。*/ + if(module == 'build' && method == 'edit') + { + module = 'project'; + method = 'build'; + } + link = createLink(module, method, 'projectID=' + projectID); location.href=link; } /* 选择用户。*/ -function switchAccount(account) +function switchAccount(account, method) { - link = createLink('user', 'view', 'account=' + account); + link = createLink('user', method, 'account=' + account); location.href=link; }