* Add a productlist method.

This commit is contained in:
leiyong
2020-09-22 15:09:15 +08:00
parent 31de4972a5
commit 24cbde3b3d
8 changed files with 212 additions and 10 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ $lang->common->common = '公有模块';
$lang->mainNav = new stdclass();
$lang->mainNav->my = '<i class="icon icon-menu-my"></i> 地盘|my|index|';
$lang->mainNav->program = '<i class="icon icon-stack"></i> 项目集|program|pgmindex|';
$lang->mainNav->product = '<i class="icon icon-menu-project"></i> 产品|product|all|';
$lang->mainNav->product = '<i class="icon icon-menu-project"></i> 产品|product|productlist|';
$lang->mainNav->project = '<i class="icon icon-menu-doc"></i> 项目|program|prjbrowse|';
$lang->mainNav->system = '<i class="icon icon-menu-users"></i> 组织|custom|estimate|';
$lang->mainNav->admin = '<i class="icon icon-menu-backend"></i> 后台|admin|index|';
+40 -2
View File
@@ -30,8 +30,8 @@ class product extends control
$this->loadModel('user');
/* Get all products, if no, goto the create page. */
$this->products = $this->product->getPairs('nocode', $this->session->PRJ);
if(empty($this->products) and strpos(',create,index,showerrornone,', $this->methodName) === false and $this->app->getViewType() != 'mhtml') $this->locate($this->createLink('product', 'create'));
$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'));
$this->view->products = $this->products;
}
@@ -871,4 +871,42 @@ 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();
}
}
+35
View File
@@ -0,0 +1,35 @@
.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%;}
+13
View File
@@ -0,0 +1,13 @@
$("#" + 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});
});
});
-2
View File
@@ -30,8 +30,6 @@ $lang->product->orderAction = "{$lang->productCommon}排序";
$lang->product->all = "所有{$lang->productCommon}";
$lang->product->export = '导出数据';
$lang->product->exportAction = "导出{$lang->productCommon}";
$lang->product->stack = '项目集';
$lang->product->createstack = '创建项目集';
$lang->product->basicInfo = '基本信息';
$lang->product->otherInfo = '其他信息';
+3 -1
View File
@@ -912,7 +912,7 @@ class productModel extends model
$this->loadModel('story');
$this->loadModel('bug');
$products = $this->getList($this->session->PRJ, $status, $limit = 0, $line);
$products = $this->getList($this->session->program, $status, $limit = 0, $line);
$products = $this->dao->select('*')->from(TABLE_PRODUCT)
->where('id')->in(array_keys($products))
->orderBy($orderBy)
@@ -965,6 +965,7 @@ class productModel extends model
->andWhere('product')->in(array_keys($products))
->groupBy('product')
->fetchPairs();
$unResolved = $this->dao->select('product,count(*) AS count')
->from(TABLE_BUG)
->where('deleted')->eq(0)
@@ -972,6 +973,7 @@ class productModel extends model
->andWhere('product')->in(array_keys($products))
->groupBy('product')
->fetchPairs();
$assignToNull = $this->dao->select('product,count(*) AS count')
->from(TABLE_BUG)
->where('deleted')->eq(0)
+112
View File
@@ -0,0 +1,112 @@
<?php
/**
* The html productlist file of productlist method of product module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
* @package ZenTaoPMS
* @version $Id
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/sortable.html.php';?>
<div id="mainMenu" class="clearfix">
<div id="sidebarHeader">
<div class="title">
<?php echo empty($program) ? $lang->program->PGMCommon : $program->name;?>
<?php if($programID) echo html::a(inLink('productlist', 'programID=0'), "<i class='icon icon-sm icon-close'></i>", '', 'class="text-muted"');?>
</div>
</div>
<div class="btn-toolbar pull-left">
<?php foreach($lang->product->featureBar['all'] as $key => $label):?>
<?php echo html::a(inlink("productlist", "programID=$programID&browseType=$key&orderBy=$orderBy"), "<span class='text'>{$label}</span>", '', "class='btn btn-link' id='{$key}Tab'");?>
<?php endforeach;?>
</div>
<div class="btn-toolbar pull-right">
<?php common::printLink('product', 'create', "programID=$programID", '<i class="icon icon-plus"></i>' . $lang->product->create, '', 'class="btn btn-primary"');?>
</div>
</div>
<div id="mainContent" class="main-row fade">
<div id="sidebar" class="side-col">
<div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
<div class="cell">
<?php echo $programTree;?>
</div>
</div>
<div class="main-col">
<form class="main-table table-product" data-ride="table" id="productListForm" method="post" action='<?php echo inLink('batchEdit', "programID=$programID");?>'>
<?php $canOrder = common::hasPriv('product', 'updataOrder');?>
<?php $canBatchEdit = common::hasPriv('product', 'batchEdit');?>
<table id="productList" class="table has-sort-head table-fixed">
<?php $vars = "programID&$programID&browseType=$browseType&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<thead>
<tr>
<th class='c-id'>
<?php if($canBatchEdit):?>
<div class="checkbox-primary check-all" title="<?php echo $lang->selectAll;?>">
<label></label>
</div>
<?php endif;?>
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
</th>
<th><?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?></th>
<th class='w-110px text-left'><?php common::printOrderLink('line', $orderBy, $vars, $lang->product->line);?></th>
<th class='w-80px' title='<?php echo $lang->product->activeStoriesTitle;?>'><?php echo $lang->product->activeStories;?></th>
<th class='w-90px' title='<?php echo $lang->product->changedStoriesTitle;?>'><?php echo $lang->product->changedStories;?></th>
<th class='w-70px' title='<?php echo $lang->product->draftStoriesTitle;?>'><?php echo $lang->product->draftStories;?></th>
<th class='w-90px' title='<?php echo $lang->product->closedStoriesTitle;?>'><?php echo $lang->product->closedStories;?></th>
<th class='w-70px' title='<?php echo $lang->product->plans;?>'><?php echo $lang->product->plans;?></th>
<th class='w-70px' title='<?php echo $lang->product->releases;?>'><?php echo $lang->product->releases;?></th>
<th class='w-80px' title='<?php echo $lang->product->unResolvedBugsTitle;?>'><?php echo $lang->product->unResolvedBugs;?></th>
<th class='w-110px' title='<?php echo $lang->product->assignToNullBugsTitle;?>'><?php echo $lang->product->assignToNullBugs;?></th>
<?php if($canOrder):?>
<th class='w-70px sort-default'><?php common::printOrderLink('order', $orderBy, $vars, $lang->product->updateOrder);?></th>
<?php endif;?>
</tr>
</thead>
<tbody class="sortable" id="productTableList">
<?php foreach($productStats as $product):?>
<tr data-id='<?php echo $product->id ?>' data-order='<?php echo $product->code;?>'>
<td class='c-id'>
<?php if($canBatchEdit):?>
<?php echo html::checkbox('productIDList', array($product->id => sprintf('%03d', $product->id)));?>
<?php else:?>
<?php printf('%03d', $product->id);?>
<?php endif;?>
</td>
<td class="c-name" title='<?php echo $product->name?>'><?php echo html::a($this->createLink('product', 'view', 'product=' . $product->id), $product->name);?></td>
<td title='<?php echo zget($lines, $product->line, '')?>'><?php echo zget($lines, $product->line, '');?></td>
<td class='text-center'><?php echo $product->stories['active'];?></td>
<td class='text-center'><?php echo $product->stories['changed'];?></td>
<td class='text-center'><?php echo $product->stories['draft'];?></td>
<td class='text-center'><?php echo $product->stories['closed'];?></td>
<td class='text-center'><?php echo $product->plans;?></td>
<td class='text-center'><?php echo $product->releases;?></td>
<td class='text-center'><?php echo $product->unResolved;?></td>
<td class='text-center'><?php echo $product->assignToNull;?></td>
<?php if($canOrder):?>
<td class='c-actions sort-handler'><i class="icon icon-move"></i></td>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if($productStats):?>
<div class="table-footer">
<?php if($canBatchEdit):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<?php echo html::submitButton($lang->edit, '', 'btn');?>
</div>
<?php endif;?>
<?php $pager->show('right', 'pagerjs');?>
</div>
<?php endif;?>
</form>
</div>
</div>
<?php js::set('orderBy', $orderBy)?>
<?php js::set('programID', $programID)?>
<?php js::set('browseType', $browseType)?>
<?php include '../../common/view/footer.html.php';?>
+8 -4
View File
@@ -712,11 +712,12 @@ class programModel extends model
/**
* Get the treemenu of program.
*
* @param int $programID
* @param int $programID
* @param int $productList
* @access public
* @return string
*/
public function getPGMTreeMenu($programID = 0)
public function getPGMTreeMenu($programID = 0, $productList = false)
{
$programMenu = array();
$query = $this->dao->select('*')->from(TABLE_PROJECT)
@@ -727,7 +728,9 @@ class programModel extends model
while($program = $stmt->fetch())
{
$linkHtml = html::a(helper::createLink('program', 'pgmview', "programID=$program->id", '', '', $program->id), "<i class='icon icon-stack'></i> " . $program->name);
$link = helper::createLink('program', 'pgmview', "programID=$program->id", '', '', $program->id);
if($productList) $link = helper::createLink('product', 'productlist', "programID=$program->id", '', '', $program->id);
$linkHtml = html::a($link, "<i class='icon icon-stack'></i> " . $program->name, '', "id='program$program->id'");
if(isset($programMenu[$program->id]) and !empty($programMenu[$program->id]))
{
@@ -1084,7 +1087,8 @@ class programModel extends model
if($program) $path = $program->path;
return $this->dao->select('*')->from(TABLE_PROJECT)
->beginIF($projectID > 0)->where('path')->like($path . '%')->fi()
->where('type')->in('project,program')
->beginIF($projectID > 0)->andWhere('path')->like($path . '%')->fi()
->orderBy('grade desc, `order`')
->get();
}