From c1d1d71eafe303e8f11d945877beb8528d816d09 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 22 Sep 2020 15:44:05 +0800 Subject: [PATCH] * Add menu active. --- module/common/lang/zh-cn.php | 6 +- module/product/control.php | 75 ++++----------- module/product/css/all.css | 36 +++++++- module/product/css/productlist.css | 35 ------- module/product/js/all.js | 4 + module/product/js/productlist.js | 13 --- module/product/model.php | 2 +- module/product/view/all.html.php | 56 ++++++------ module/product/view/productlist.html.php | 112 ----------------------- module/program/model.php | 14 +-- 10 files changed, 95 insertions(+), 258 deletions(-) delete mode 100644 module/product/css/productlist.css delete mode 100644 module/product/js/productlist.js delete mode 100644 module/product/view/productlist.html.php diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 5e9a4885be..4fbdc10e5d 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -123,7 +123,7 @@ $lang->common->common = '公有模块'; $lang->mainNav = new stdclass(); $lang->mainNav->my = ' 地盘|my|index|'; $lang->mainNav->program = ' 项目集|program|pgmindex|'; -$lang->mainNav->product = ' 产品|product|productlist|'; +$lang->mainNav->product = ' 产品|product|index|'; $lang->mainNav->project = ' 项目|program|prjbrowse|'; $lang->mainNav->system = ' 组织|custom|estimate|'; $lang->mainNav->admin = ' 后台|admin|index|'; @@ -135,7 +135,7 @@ $lang->dividerMenu = ',admin,'; $lang->program = new stdclass(); $lang->program->menu = new stdclass(); $lang->program->menu->index = '主页|program|pgmindex|'; -$lang->program->menu->browse = array('link' => '项目集|program|pgmbrowse|', 'alias' => 'pgmcreate,pgmedit'); +$lang->program->menu->browse = array('link' => '项目集|program|pgmbrowse|', 'alias' => 'pgmcreate,pgmedit,pgmgroup,pgmmanagepriv,pgmmanageview,pgmmanagemembers'); $lang->program->viewMenu = new stdclass(); $lang->program->viewMenu->view = '概况|program|pgmview|program=%s'; @@ -146,7 +146,7 @@ $lang->program->viewMenu->project = array('link' => "$lang->projectCommon|progra $lang->product = new stdclass(); $lang->product->menu = new stdclass(); $lang->product->menu->home = '主页|product|index|'; -$lang->product->menu->list = $lang->productCommon . '|product|productlist|'; +$lang->product->menu->list = $lang->productCommon . '|product|all|'; /* System menu. */ $lang->system = new stdclass(); diff --git a/module/product/control.php b/module/product/control.php index b25e469808..83410a7e85 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -31,7 +31,7 @@ class product extends control /* Get all products, if no, goto the create page. */ $this->products = $this->product->getPairs('nocode', $this->session->program); - if(empty($this->products) and strpos(',productlist,create,index,showerrornone,', $this->methodName) === false and $this->app->getViewType() != 'mhtml') $this->locate($this->createLink('product', 'create')); + if(empty($this->products) and strpos(',all,create,index,showerrornone,', $this->methodName) === false and $this->app->getViewType() != 'mhtml') $this->locate($this->createLink('product', 'create')); $this->view->products = $this->products; } @@ -718,11 +718,11 @@ class product extends control } /** - * All product. + * Products under project set. * - * @param int $productID - * @param int $line - * @param string $status + * @param int $programID + * @param string $browseType + * @param int $param * @param string $orderBy * @param int $recTotal * @param int $recPerPage @@ -730,31 +730,28 @@ class product extends control * @access public * @return void */ - public function all($productID = 0, $line = 0, $status = 'noclosed', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 10, $pageID = 1) + public function all($programID = 0, $browseType = 'noclosed', $param = 0, $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) { - $this->session->set('productList', $this->app->getURI(true)); - $productID = $this->product->saveState($productID, $this->products); - $this->product->setMenu($this->products, $productID); + $this->session->set('program', $programID); + $this->loadModel('program'); /* Load pager and get tasks. */ $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - /* Save this url to session. */ - $uri = $this->app->getURI(true); - $this->app->session->set('lineList', $uri); + $program = $programID ? $this->program->getPGMByID($programID) : 0; - $this->app->loadLang('my'); - $this->view->title = $this->lang->product->allProduct; - $this->view->position[] = $this->lang->product->allProduct; - $this->view->productStats = $this->product->getStats($orderBy, $pager, $status, $line); - $this->view->lineTree = $this->loadModel('tree')->getTreeMenu(0, $viewType = 'line', $startModuleID = 0, array('treeModel', 'createLineLink'), array('productID' => $productID, 'status' => $status)); + $this->view->title = $this->lang->product->common; + $this->view->position[] = $this->lang->product->common; + + $this->view->productStats = $this->product->getStats($orderBy, $pager, $browseType); $this->view->lines = array('') + $this->tree->getLinePairs(); - $this->view->productID = $productID; - $this->view->line = $line; - $this->view->status = $status; $this->view->orderBy = $orderBy; $this->view->pager = $pager; + $this->view->programTree = $this->program->getPGMTreeMenu($programID, 'product'); + $this->view->programID = $programID; + $this->view->program = $program; + $this->view->browseType = $browseType; $this->display(); } @@ -871,42 +868,4 @@ class product extends control $this->session->set('product', (int)$productID); $this->send(array('result' => 'success', 'productID' => $this->session->product)); } - - /** - * Products under project set. - * - * @param int $programID - * @param string $browseType - * @param int $param - * @param string $orderBy - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID - * @access public - * @return void - */ - public function productList($programID = 0, $browseType = 'all', $param = 0, $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) - { - $this->session->set('program', $programID); - $this->loadModel('program'); - - /* Load pager and get tasks. */ - $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage, $pageID); - - $program = $programID ? $this->program->getPGMByID($programID) : 0; - - $this->view->title = $this->lang->product->common; - $this->view->position[] = $this->lang->product->common; - - $this->view->productStats = $this->product->getStats($orderBy, $pager, $browseType); - $this->view->lines = array('') + $this->tree->getLinePairs(); - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; - $this->view->programTree = $this->program->getPGMTreeMenu($programID, true); - $this->view->programID = $programID; - $this->view->program = $program; - $this->view->browseType = $browseType; - $this->display(); - } } diff --git a/module/product/css/all.css b/module/product/css/all.css index 0cf8b873ef..eb3cf03202 100644 --- a/module/product/css/all.css +++ b/module/product/css/all.css @@ -1 +1,35 @@ -.alert>[class*="icon-"]+.content {padding-left: 20px;} +.side-col .detail-content{padding-left: 10px; margin-top: 0px} +.tree li.has-list.open:before {border-left: none;} +#programTree li {padding: 0 0 0 8px;} +#programTree li.has-list {padding-left: 20px;} +#programTree li > a {display: block; padding: 5px 0; border-radius: 2px; padding-left: 6px; height: 30px;} +#programTree li > a > span {display: inline-block;} +#programTree li > a > span + span {margin-left: 8px;} +#programTree li.selected > a {background-color: #E8F3FC;} +#programTree li.selected > a > span.title {color: #006AF1;} +#programTree .label-id {border-color: #cbd0db; color: #7d8599} +#programTree .label.label-type {background: #fff; border: 1px solid #7d8599; color:#7d8599} + +#programTree li > a > span.title {color: #3C4353; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;} +#programTree li > a > span.user {color: #838a9d;} +#programTree li > a > span.user > .icon-person {font-size: 14px; position: relative; top: -1px; color: #a6aab8} + +#programTree li > .list-toggle {transform: rotate(0deg); width: 16px; height: 16px; border: 4px solid #a6aab8; border-radius: 2px; top: 7px;} +#programTree li > .list-toggle:before {content: ' '; display: block; position: absolute; border: 1px solid #a6aab8; top: 2px; left: -3px; right: -3px; bottom: 2px; min-width: 0; transition: all .2s;} +#programTree li > .list-toggle:hover:before, +#programTree li > .list-toggle:hover {border-color: #006AF1;} +#programTree li.open > .list-toggle {width: 12px; height: 12px; top: 9px; background-color: #a6aab8; border-width: 3px; left: 3px;} +#programTree li.open > .list-toggle:before {border: none; height: 2px; width: 6px; left: 0; top: 2px; background: #fff;} +#programTree li.open > .list-toggle:hover {background: #006AF1;} + +#programTree ul > li:after {display: block; position: absolute; content: ' '; border-top: 2px solid #cbd0db; top: 14px; left: -12px; z-index: 1; width: 10px;} +#programTree ul > li:before, +#programTree ul > li.has-list:before {background: none; content: ' '; display: block; position: absolute; width: auto; height: auto; border: none; border-left: 2px solid #cbd0db; top: -13px; bottom: 12px; left: -12px;} +#programTree ul > li:last-child:before {bottom: auto; height: 29px;} +#programTree ul > li:first-child:before {top: -9px;} +#programTree ul > li.has-list:first-child:before {top: -13px;} +#programTree ul > li.tree-single-item:before {height: 23px;} +#programTree ul > li.has-list:after {width: 14px;} +#programTree ul > li.item-meas a.selected{color: #0c64eb;} +.side-col {padding-right: 20px; width: 18%} +#sidebar>.cell {width: 100%;} diff --git a/module/product/css/productlist.css b/module/product/css/productlist.css deleted file mode 100644 index eb3cf03202..0000000000 --- a/module/product/css/productlist.css +++ /dev/null @@ -1,35 +0,0 @@ -.side-col .detail-content{padding-left: 10px; margin-top: 0px} -.tree li.has-list.open:before {border-left: none;} -#programTree li {padding: 0 0 0 8px;} -#programTree li.has-list {padding-left: 20px;} -#programTree li > a {display: block; padding: 5px 0; border-radius: 2px; padding-left: 6px; height: 30px;} -#programTree li > a > span {display: inline-block;} -#programTree li > a > span + span {margin-left: 8px;} -#programTree li.selected > a {background-color: #E8F3FC;} -#programTree li.selected > a > span.title {color: #006AF1;} -#programTree .label-id {border-color: #cbd0db; color: #7d8599} -#programTree .label.label-type {background: #fff; border: 1px solid #7d8599; color:#7d8599} - -#programTree li > a > span.title {color: #3C4353; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;} -#programTree li > a > span.user {color: #838a9d;} -#programTree li > a > span.user > .icon-person {font-size: 14px; position: relative; top: -1px; color: #a6aab8} - -#programTree li > .list-toggle {transform: rotate(0deg); width: 16px; height: 16px; border: 4px solid #a6aab8; border-radius: 2px; top: 7px;} -#programTree li > .list-toggle:before {content: ' '; display: block; position: absolute; border: 1px solid #a6aab8; top: 2px; left: -3px; right: -3px; bottom: 2px; min-width: 0; transition: all .2s;} -#programTree li > .list-toggle:hover:before, -#programTree li > .list-toggle:hover {border-color: #006AF1;} -#programTree li.open > .list-toggle {width: 12px; height: 12px; top: 9px; background-color: #a6aab8; border-width: 3px; left: 3px;} -#programTree li.open > .list-toggle:before {border: none; height: 2px; width: 6px; left: 0; top: 2px; background: #fff;} -#programTree li.open > .list-toggle:hover {background: #006AF1;} - -#programTree ul > li:after {display: block; position: absolute; content: ' '; border-top: 2px solid #cbd0db; top: 14px; left: -12px; z-index: 1; width: 10px;} -#programTree ul > li:before, -#programTree ul > li.has-list:before {background: none; content: ' '; display: block; position: absolute; width: auto; height: auto; border: none; border-left: 2px solid #cbd0db; top: -13px; bottom: 12px; left: -12px;} -#programTree ul > li:last-child:before {bottom: auto; height: 29px;} -#programTree ul > li:first-child:before {top: -9px;} -#programTree ul > li.has-list:first-child:before {top: -13px;} -#programTree ul > li.tree-single-item:before {height: 23px;} -#programTree ul > li.has-list:after {width: 14px;} -#programTree ul > li.item-meas a.selected{color: #0c64eb;} -.side-col {padding-right: 20px; width: 18%} -#sidebar>.cell {width: 100%;} diff --git a/module/product/js/all.js b/module/product/js/all.js index 71d1772bca..3fca145aad 100644 --- a/module/product/js/all.js +++ b/module/product/js/all.js @@ -1,3 +1,7 @@ +$("#" + browseType + "Tab").addClass('btn-active-text'); +$('#programTree').tree(); +$('#program' + programID).addClass('active'); +$(".tree .active").parent('li').addClass('active'); $(function() { $('#productTableList').on('sort.sortable', function(e, data) diff --git a/module/product/js/productlist.js b/module/product/js/productlist.js deleted file mode 100644 index 3fca145aad..0000000000 --- a/module/product/js/productlist.js +++ /dev/null @@ -1,13 +0,0 @@ -$("#" + browseType + "Tab").addClass('btn-active-text'); -$('#programTree').tree(); -$('#program' + programID).addClass('active'); -$(".tree .active").parent('li').addClass('active'); -$(function() -{ - $('#productTableList').on('sort.sortable', function(e, data) - { - var list = ''; - for(i = 0; i < data.list.length; i++) list += $(data.list[i].item).attr('data-id') + ','; - $.post(createLink('product', 'updateOrder'), {'products' : list, 'orderBy' : orderBy}); - }); -}); diff --git a/module/product/model.php b/module/product/model.php index 3b38bd1c3d..3c90e41089 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -92,7 +92,7 @@ class productModel extends model } else { - if($project->product == 'multiple') + if(isset($project->product) and $project->product == 'multiple') { $label = $this->lang->product->index; $pageNav = '
'; diff --git a/module/product/view/all.html.php b/module/product/view/all.html.php index d5f6fc6be7..3ab6abf8e1 100644 --- a/module/product/view/all.html.php +++ b/module/product/view/all.html.php @@ -1,54 +1,52 @@ * @package ZenTaoPMS - * @version $Id$ + * @version $Id */ ?>
+
-
'> - - - - recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?> + '> + + +
+ recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?> @@ -109,4 +107,6 @@ + + diff --git a/module/product/view/productlist.html.php b/module/product/view/productlist.html.php deleted file mode 100644 index b9ca401a68..0000000000 --- a/module/product/view/productlist.html.php +++ /dev/null @@ -1,112 +0,0 @@ - - * @package ZenTaoPMS - * @version $Id - */ -?> - - - -
- -
- '> - - -
-
- -
+
+ +
idAB);?>
- recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - idAB);?> -
product->name);?>product->line);?>product->activeStories;?>product->changedStories;?>product->draftStories;?>product->closedStories;?>product->plans;?>product->releases;?>product->unResolvedBugs;?>product->assignToNullBugs;?>product->updateOrder);?>
- - id => sprintf('%03d', $product->id)));?> - - id);?> - - createLink('product', 'index', 'locate=no&product=' . $product->id), $product->name);?>'>line, '');?>stories['active'];?>stories['changed'];?>stories['draft'];?>stories['closed'];?>plans;?>releases;?>unResolved;?>assignToNull;?>
- - - -
-
-
- - - - diff --git a/module/program/model.php b/module/program/model.php index 19eb2ded78..168cf762ad 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -703,8 +703,7 @@ class programModel extends model $dropMenuLink = helper::createLink('program', 'ajaxGetPGMDropMenu', "objectID=$programID&module=$currentModule&method=$currentMethod"); $output = "
"; + $output .= ''; $output .= "
"; return $output; } @@ -717,19 +716,20 @@ class programModel extends model * @access public * @return string */ - public function getPGMTreeMenu($programID = 0, $productList = false) + public function getPGMTreeMenu($programID = 0, $from = 'program') { $programMenu = array(); $query = $this->dao->select('*')->from(TABLE_PROJECT) - ->where('type')->eq('program') + ->where('deleted')->eq('0') + ->beginIF($from == 'program')->andWhere('type')->in('program,project')->fi() + ->beginIF($from == 'product')->andWhere('type')->eq('program')->fi() ->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi() ->orderBy('grade desc, `order`')->get(); - $stmt = $this->dbh->query($query); + $stmt = $this->dbh->query($query); while($program = $stmt->fetch()) { - $link = helper::createLink('program', 'pgmview', "programID=$program->id", '', '', $program->id); - if($productList) $link = helper::createLink('product', 'productlist', "programID=$program->id", '', '', $program->id); + $link = $from == 'program' ? helper::createLink('program', 'pgmview', "programID=$program->id", '', '', $program->id) : helper::createLink('product', 'all', "programID=$program->id", '', '', $program->id); $linkHtml = html::a($link, " " . $program->name, '', "id='program$program->id'"); if(isset($programMenu[$program->id]) and !empty($programMenu[$program->id]))