diff --git a/trunk/module/action/control.php b/trunk/module/action/control.php index 774f2cdc54..faadf5d381 100644 --- a/trunk/module/action/control.php +++ b/trunk/module/action/control.php @@ -28,11 +28,16 @@ class action extends control { /* 登记session。*/ $uri = $this->app->getURI(true); - $this->session->set('bugList', $uri); - $this->session->set('caseList', $uri); - $this->session->set('storyList', $uri); - $this->session->set('taskList', $uri); - $this->session->set('buildList', $uri); + $this->session->set('productList', $uri); + $this->session->set('productPlanList', $uri); + $this->session->set('releaseList', $uri); + $this->session->set('storyList', $uri); + $this->session->set('projectList', $uri); + $this->session->set('taskList', $uri); + $this->session->set('buildList', $uri); + $this->session->set('bugList', $uri); + $this->session->set('caseList', $uri); + $this->session->set('testtaskList', $uri); /* 设置标题和导航条。*/ $this->view->header->title = $this->lang->action->trash; diff --git a/trunk/module/build/control.php b/trunk/module/build/control.php index afd9cee8ab..b8abcf6907 100644 --- a/trunk/module/build/control.php +++ b/trunk/module/build/control.php @@ -30,7 +30,7 @@ class build extends control { $buildID = $this->build->create($projectID); if(dao::isError()) die(js::error(dao::getError())); - $this->loadModel('action')->create('build', $buildID, 'Opened'); + $this->loadModel('action')->create('build', $buildID, 'opened'); die(js::locate($this->createLink('project', 'build', "project=$projectID"), 'parent')); } diff --git a/trunk/module/common/lang/zh-cn.php b/trunk/module/common/lang/zh-cn.php index 923a8cddd1..0ed51f9a5b 100644 --- a/trunk/module/common/lang/zh-cn.php +++ b/trunk/module/common/lang/zh-cn.php @@ -104,6 +104,7 @@ $lang->product->menu->story = array('link' => '需求列表|product|browse|prod $lang->product->menu->plan = array('link' => '计划列表|productplan|browse|productID=%s', 'subModule' => 'productplan'); $lang->product->menu->release= array('link' => '发布列表|release|browse|productID=%s', 'subModule' => 'release'); $lang->product->menu->roadmap= '路线图|product|roadmap|productID=%s'; +$lang->product->menu->view = '基本信息|product|view|productID=%s'; $lang->product->menu->edit = '编辑产品|product|edit|productID=%s'; $lang->product->menu->module = '维护模块|tree|browse|productID=%s&view=product'; $lang->product->menu->delete = array('link' => '删除产品|product|delete|productID=%s', 'target' => 'hiddenwin'); diff --git a/trunk/module/group/lang/zh-cn.php b/trunk/module/group/lang/zh-cn.php index cb242f1832..45ffe894b6 100644 --- a/trunk/module/group/lang/zh-cn.php +++ b/trunk/module/group/lang/zh-cn.php @@ -74,6 +74,7 @@ $lang->resource->todo->import2Today = 'import2Today'; $lang->resource->product->index = 'index'; $lang->resource->product->browse = 'browse'; $lang->resource->product->create = 'create'; +$lang->resource->product->view = 'view'; $lang->resource->product->edit = 'edit'; $lang->resource->product->delete = 'delete'; $lang->resource->product->roadmap= 'roadmap'; diff --git a/trunk/module/product/control.php b/trunk/module/product/control.php index bca5c3a102..50fcc845cc 100644 --- a/trunk/module/product/control.php +++ b/trunk/module/product/control.php @@ -38,7 +38,7 @@ class product extends control /* 获取所有的产品列表。如果还没有产品,则跳转到产品的添加页面。*/ $this->products = $this->product->getPairs(); - if(empty($this->products) and $this->methodName != 'create') $this->locate($this->createLink('product', 'create')); + if(empty($this->products) and strpos('create|view', $this->methodName) === false) $this->locate($this->createLink('product', 'create')); $this->assign('products', $this->products); } @@ -60,7 +60,8 @@ class product extends control $browseType = strtolower($browseType); /* 设置当前的产品id和模块id。*/ - $this->session->set('storyList', $this->app->getURI(true)); + $this->session->set('storyList', $this->app->getURI(true)); + $this->session->set('productList', $this->app->getURI(true)); $productID = common::saveProductState($productID, key($this->products)); $moduleID = ($browseType == 'bymodule') ? (int)$param : 0; @@ -113,6 +114,7 @@ class product extends control { $productID = $this->product->create(); if(dao::isError()) die(js::error(dao::getError())); + $this->loadModel('action')->create('product', $productID, 'opened'); die(js::locate($this->createLink($this->moduleName, 'browse', "productID=$productID"), 'parent')); } @@ -129,9 +131,11 @@ class product extends control { if(!empty($_POST)) { - $this->product->update($productID); + $changes = $this->product->update($productID); if(dao::isError()) die(js::error(dao::getError())); - die(js::locate($this->createLink('product', 'browse', "product=$productID"), 'parent')); + $actionID = $this->loadModel('action')->create('product', $productID, 'edited'); + $this->action->logHistory($actionID, $changes); + die(js::locate(inlink('view', "product=$productID"), 'parent')); } /* 设置菜单。*/ @@ -146,19 +150,35 @@ class product extends control $this->display(); } + /* 查看详情。*/ + public function view($productID) + { + /* 设置菜单。*/ + $this->product->setMenu($this->products, $productID); + + $product = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch(); + $this->view->header->title = $this->lang->product->view . $this->lang->colon . $product->name; + $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name); + $this->view->position[] = $this->lang->product->view; + $this->view->product = $product; + $this->view->actions = $this->loadModel('action')->getList('product', $productID); + $this->view->users = $this->user->getPairs(); + + $this->display(); + } + /* 删除产品。*/ public function delete($productID, $confirm = 'no') { if($confirm == 'no') { - echo js::confirm($this->lang->product->confirmDelete, $this->createLink('product', 'delete', "productID=$productID&confirm=yes")); - exit; + die(js::confirm($this->lang->product->confirmDelete, $this->createLink('product', 'delete', "productID=$productID&confirm=yes"))); } else { - $this->product->delete($productID); - echo js::locate($this->createLink('product', 'browse'), 'parent'); - exit; + $this->product->delete(TABLE_PRODUCT, $productID); + $this->session->set('product', ''); // 清除session。 + die(js::locate($this->createLink('product', 'browse'), 'parent')); } } diff --git a/trunk/module/product/lang/zh-cn.php b/trunk/module/product/lang/zh-cn.php index 5c4a9524d9..a9037653dc 100644 --- a/trunk/module/product/lang/zh-cn.php +++ b/trunk/module/product/lang/zh-cn.php @@ -24,6 +24,7 @@ $lang->product->common = '产品视图'; $lang->product->index = "产品首页"; $lang->product->browse = "浏览产品"; +$lang->product->view = "产品信息"; $lang->product->edit = "编辑产品"; $lang->product->create = "新增产品"; $lang->product->read = "产品详情"; diff --git a/trunk/module/product/model.php b/trunk/module/product/model.php index 43d6bb86a6..9eeb8dec18 100644 --- a/trunk/module/product/model.php +++ b/trunk/module/product/model.php @@ -53,13 +53,13 @@ class productModel extends model /* ȡƷб*/ public function getList() { - return $this->dao->select('*')->from(TABLE_PRODUCT)->where('company')->eq($this->app->company->id)->fetchAll('id'); + return $this->dao->select('*')->from(TABLE_PRODUCT)->where('deleted')->eq(0)->fetchAll('id'); } /* ȡƷid=>nameб*/ public function getPairs() { - return $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('company')->eq($this->app->company->id)->fetchPairs(); + return $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('deleted')->eq(0)->fetchPairs(); } /* Ʒ*/ @@ -86,6 +86,7 @@ class productModel extends model { /* ݡ*/ $productID = (int)$productID; + $oldProduct = $this->getById($productID); $product = fixer::input('post') ->stripTags('name,code') ->specialChars('desc') @@ -98,14 +99,9 @@ class productModel extends model ->check('code', 'unique', "id != $productID") ->where('id')->eq($productID) ->exec(); + if(!dao::isError()) return common::createChanges($oldProduct, $product); } - /* ɾijһƷ*/ - public function delete($productID) - { - return $this->dao->delete()->from(TABLE_PRODUCT)->where('id')->eq((int)$productID)->andWhere('company')->eq($this->app->company->id)->limit(1)->exec(); - } - /* ȡƷĿid=>valueб*/ public function getProjectPairs($productID) { diff --git a/trunk/module/product/view/create.html.php b/trunk/module/product/view/create.html.php index 3abf58cb19..6aa97e075a 100644 --- a/trunk/module/product/view/create.html.php +++ b/trunk/module/product/view/create.html.php @@ -25,7 +25,7 @@