* Add left doc menu.

This commit is contained in:
Yagami
2020-12-28 13:32:56 +08:00
parent 12993d94ca
commit ea890d584d
6 changed files with 27 additions and 31 deletions
+2 -1
View File
@@ -134,11 +134,12 @@ $lang->mainNav->program = '<i class="icon icon-folder-open-o"></i> 项目集|pro
$lang->mainNav->product = '<i class="icon icon-product"></i> 产品|product|index|';
$lang->mainNav->project = '<i class="icon icon-project"></i> 项目|program|prjbrowse|';
$lang->mainNav->repo = '<i class="icon icon-code1"></i> 代码|repo|browse|';
$lang->mainNav->doc = '<i class="icon icon-doc"></i> 文档|doc|index|';
$lang->mainNav->system = '<i class="icon icon-group"></i> 组织|subject|browse|';
$lang->mainNav->admin = '<i class="icon icon-cog-outline"></i> 后台|admin|index|';
$lang->reporting = new stdclass();
$lang->dividerMenu = ',admin,project,repo,';
$lang->dividerMenu = ',admin,project,doc,';
/* Program set menu. */
$lang->program = new stdclass();
+3 -1
View File
@@ -27,6 +27,8 @@ class doc extends control
$this->loadModel('project');
$this->from = $this->cookie->from ? $this->cookie->from : 'doc';
$this->productID = $this->cookie->product ? $this->cookie->product : '0';
$this->projectID = $this->session->PRJ;
if(!$this->projectID) $this->lang->navGroup->doc = 'doc';
}
/**
@@ -60,7 +62,7 @@ class doc extends control
$this->view->myDocs = $this->doc->getDocsByBrowseType(0, 'openedbyme', 0, 0, 'addedDate_desc', $pager);
$this->view->statisticInfo = $this->doc->getStatisticInfo();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->doingProjects = $this->loadModel('project')->getExecutionsByProject($this->session->PRJ, 'undone', 5);
$this->view->doingProjects = $this->loadModel('project')->getExecutionsByProject($this->projectID, 'undone', 5);
$this->display();
}
+7 -17
View File
@@ -524,13 +524,13 @@ class docModel extends model
* @access public
* @return void
*/
public function getPrivDocs($libID = 0, $module = 0, $mode = 'normal')
public function getPrivDocs($libIdList = array(), $module = 0, $mode = 'normal')
{
$stmt = $this->dao->select('*')->from(TABLE_DOC)
->where('1=1')
->beginIF($mode == 'normal')->andWhere('deleted')->eq(0)->fi()
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->beginIF($libID)->andWhere('lib')->in($libID)->fi()
->beginIF($libIdList)->andWhere('lib')->in($libIdList)->fi()
->beginIF(strpos($this->config->doc->custom->showLibs, 'children') === false)->andWhere('module')->in($module)->fi()
->beginIF(!empty($module) and strpos($this->config->doc->custom->showLibs, 'children') !== false)->andWhere('module')->in($module)->fi()
->query();
@@ -621,7 +621,6 @@ class docModel extends model
->add('editedDate', $now)
->add('version', 1)
->setDefault('product,project,module', 0)
->setDefault('PRJ', $this->session->PRJ)
->stripTags($this->config->doc->editor->create['id'], $this->config->allowedTags)
->cleanInt('product,project,module,lib')
->join('groups', ',')
@@ -999,7 +998,7 @@ class docModel extends model
if($type == 'project')
{
$project = $this->loadModel('program')->getPRJByID($this->session->PRJ);
$orderBy = $project->model == 'waterfall' ? 'begin_asc,id_asc' : 'begin_desc,id_desc';
$orderBy = (isset($project->model) and $project->model) == 'waterfall' ? 'begin_asc,id_asc' : 'begin_desc,id_desc';
}
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
@@ -1137,16 +1136,7 @@ class docModel extends model
->where('deleted')->eq(0)
->andWhere("$type")->in(array_keys($objectList))
->orderBy("`order` asc, id asc")
->fetchAll('project');
if($type == 'project')
{
foreach(array_keys($objectList) as $objectID)
{
$docLibs[] = $docLibs[$objectID];
unset($docLibs[$objectID]);
}
}
->fetchAll();
}
else
{
@@ -1532,9 +1522,9 @@ class docModel extends model
*/
public function getStatisticInfo()
{
$libID = 0;
if($this->session->PRJ) $libID = $this->getLibIdListByProject($this->session->PRJ);
$docIdList = $this->getPrivDocs($libID);
$libIdList = array();
$libIdList = $this->getLibIdListByProject($this->session->PRJ);
$docIdList = $this->getPrivDocs($libIdList);
$today = date('Y-m-d');
$lately = date('Y-m-d', strtotime('-3 day'));
+6 -3
View File
@@ -337,9 +337,9 @@ class productModel extends model
->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')
->on('t1.product = t2.id')
->where('t1.project')->eq($projectID)
->where('t2.deleted')->eq(0)
->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi()
->beginIF(strpos($status, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
->andWhere('t2.deleted')->eq(0)
->orderBy('t2.order desc')
->fetchAll('id');
}
@@ -354,7 +354,10 @@ class productModel extends model
*/
public function getProductIDByProject($projectID, $isFirst = true)
{
$products = $this->dao->select('product')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($projectID)->fetchPairs();
$products = $this->dao->select('product')->from(TABLE_PROJECTPRODUCT)
->beginIF($projectID)->where('project')->eq($projectID)->fi()
->fetchPairs();
if($isFirst === false) return $products;
return empty($products) ? 0 : current($products);
}
+1 -1
View File
@@ -21,7 +21,7 @@ class project extends control
public function __construct($moduleName = '', $methodName = '')
{
parent::__construct($moduleName, $methodName);
if(!in_array($this->methodName, array('computeburn', 'ajaxgetrecentexecutions')) && $this->session->PRJ)
if(!in_array($this->methodName, array('computeburn', 'ajaxgetrecentexecutions')))
{
$this->projects = $this->project->getExecutionPairs($this->session->PRJ, 'all', 'nocode');
if(!$this->projects and $this->methodName != 'index' and $this->methodName != 'create' and $this->app->getViewType() != 'mhtml') $this->locate($this->createLink('project', 'create'));
+8 -8
View File
@@ -1005,10 +1005,11 @@ class projectModel extends model
public function getExecutionIdList($projectID, $status = 'all')
{
return $this->dao->select('id')->from(TABLE_EXECUTION)
->where('project')->eq($projectID)
->where('deleted')->eq('0')
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
->beginIF($status == 'undone')->andWhere('status')->notIN('done,closed')->fi()
->beginIF($status != 'all' and $status != 'undone')->andWhere('status')->in($status)->fi()
->andWhere('deleted')->eq('0')
->andWhere('type')->in('sprint,stage')
->fetchPairs('id', 'id');
}
@@ -1024,22 +1025,21 @@ class projectModel extends model
*/
public function getExecutionsByProject($projectID, $status = 'all', $limit = 0, $pairs = false)
{
if(!$projectID) return array();
$project = $this->loadModel('program')->getPRJByID($projectID);
$orderBy = $project->model == 'waterfall' ? 'begin_asc,id_asc' : 'begin_desc,id_desc';
$orderBy = (isset($project->model) and $project->model == 'waterfall') ? 'begin_asc,id_asc' : 'begin_desc,id_desc';
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)
->where('project')->eq((int)$projectID)
->where('deleted')->eq('0')
->beginIF($projectID)->andWhere('project')->eq((int)$projectID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi()
->beginIF($status == 'undone')->andWhere('status')->notIN('done,closed')->fi()
->beginIF($status != 'all' and $status != 'undone')->andWhere('status')->in($status)->fi()
->andWhere('deleted')->eq('0')
->andWhere('type')->in('stage,sprint')
->orderBy($orderBy)
->beginIF($limit)->limit($limit)->fi()
->fetchAll('id');
if($project->model == 'waterfall')
if(isset($project->model) and $project->model == 'waterfall')
{
$executionList = array();
$executionProducts = $this->dao->select('t1.project,t1.product')->from(TABLE_PROJECTPRODUCT)->alias('t1')