* finish task #5031.

This commit is contained in:
wangyidong
2018-10-17 15:14:31 +08:00
parent d0981de17d
commit 84f178f3aa
9 changed files with 119 additions and 33 deletions
+17
View File
@@ -460,6 +460,23 @@ class custom extends control
die(js::reload('parent.parent'));
}
/**
* Ajax set doc setting.
*
* @access public
* @return void
*/
public function ajaxSetDoc()
{
if($this->server->request_method == 'POST')
{
$data = fixer::input('post')->join('showLibs', ',')->get();
if(isset($data->showLibs)) $data = $data->showLibs;
$this->loadModel('setting')->setItem("{$this->app->user->account}.doc.custom.showLibs", $data);
die(js::reload('parent.parent'));
}
}
/**
* Reset required.
*
+1
View File
@@ -16,6 +16,7 @@ $config->doc->customObjectLibs = 'files,customFiles';
$config->doc->custom = new stdclass();
$config->doc->custom->objectLibs = $config->doc->customObjectLibs;
$config->doc->custom->showLibs = 'zero,unclosed';
$config->doc->editor = new stdclass();
$config->doc->editor->create = array('id' => 'content', 'tools' => 'fullTools');
+3 -6
View File
@@ -104,8 +104,6 @@ class doc extends control
$this->lang->doc->menuOrder = $this->lang->product->menuOrder;
$this->product->setMenu($this->product->getPairs(), $lib->product);
$this->lang->set('menugroup.doc', 'product');
if(common::hasPriv('doc', 'create')) $this->lang->modulePageActions .= html::a(helper::createLink('doc', 'create', "libID=$libID"), "<i class='icon icon-plus'></i> " . $this->lang->doc->create, '', "class='btn btn-primary'");
}
elseif($from == 'project')
{
@@ -113,11 +111,10 @@ class doc extends control
$this->lang->doc->menuOrder = $this->lang->project->menuOrder;
$this->project->setMenu($this->project->getPairs('nocode'), $lib->project);
$this->lang->set('menugroup.doc', 'project');
if(common::hasPriv('doc', 'create')) $this->lang->modulePageActions .= html::a(helper::createLink('doc', 'create', "libID=$libID"), "<i class='icon icon-plus'></i> " . $this->lang->doc->create, '', "class='btn btn-primary'");
}
$menuType = (!$type && in_array($browseType, array_keys($this->lang->doc->fastMenuList))) ? $browseType : $type;
$this->doc->setMenu($menuType, $libID, $moduleID, $productID, $projectID);
$menuType = (!$type && in_array($browseType, array_keys($this->lang->doc->fastMenuList))) ? $browseType : $type;
$this->doc->setMenu($menuType, $libID, $moduleID, $productID, $projectID);
$this->session->set('docList', $this->app->getURI(true));
/* Set header and position. */
+4 -2
View File
@@ -19,6 +19,8 @@
.split-row > .main-col {width: 100%!important;}
}
.side-col .cell .nav a.setting {padding:8px;}
.side-footer{padding:8px; background:#fff;}
.col-sm-size .col-sm-5,
.col-sm-size .col-sm-7 {width: 100%;}
.col-sm-size .table .c-user,
@@ -63,8 +65,8 @@
.side-col > .cell {overflow: hidden auto; padding: 0; position: relative;}
.side-col > .cell > header {position: absolute; top: 10px; right: 10px; left: 10px;}
.side-col > .cell > header > .c-sm {padding-right: 20px; width: 60px;;}
.side-col #docsTree {position: absolute; top: 53px; left: 0; right: 0; bottom: 0; overflow: auto; padding: 0 10px 10px;}
.main-col .block-files > .panel-body {position: absolute; top: 45px; left: 0; right: 0; bottom: 0; overflow: auto;}
.side-col .docsTree {position: absolute; top: 53px; left: 0; right: 0; bottom: 0; overflow: auto; padding: 0 10px 10px;}
.main-col .block-files > .panel-body {top: 45px; left: 0; right: 0; bottom: 0; overflow: auto;}
td.c-name a{color: #0c60e1}
td.c-name a:visited{color: #082999}
+3 -3
View File
@@ -131,9 +131,9 @@ $(document).ready(function()
};
var resizeCols = function() {
var cellHeight = $(window).height() - $('#footer').outerHeight() - $('#header').outerHeight() - 40;
$cols.children('.panel').height(cellHeight).css('maxHeight', cellHeight);
$cols.find('.tab-content').height(cellHeight - $cols.find('.nav-tabs').height()).css('maxHeight', cellHeight - $cols.find('.nav-tabs').height()).css('overflow-y', 'auto');
var cellHeight = $(window).height() - $('#footer').outerHeight() - $('#header').outerHeight() - 42;
$cols.children('.panel').height(cellHeight).css('maxHeight', cellHeight).find('.panel-body').css('position', 'absolute');
$cols.find('.tab-content').height(cellHeight - $cols.find('.nav-tabs').height() - 35).css('maxHeight', cellHeight - $cols.find('.nav-tabs').height() - 35).css('overflow-y', 'auto');
};
$(window).on('resize', resizeCols);
+4
View File
@@ -136,6 +136,10 @@ $lang->doc->fastMenuIconList['collectedbyme'] = 'icon-folder-star';
$lang->doc->customObjectLibs['files'] = 'Show File Library';
$lang->doc->customObjectLibs['customFiles'] = 'Show Custom Library';
$lang->doc->customShowLibs = 'Library display settings';
$lang->doc->customShowLibsList['zero'] = 'Display zero document library';
$lang->doc->customShowLibsList['unclosed'] = 'Show only projects that are not closed.';
$lang->doc->confirmDelete = "Do you want to delete this document?";
$lang->doc->confirmDeleteLib = "Do you want to delete this Doc Lib?";
$lang->doc->errorEditSystemDoc = "Ssytem document library doesn't have to be changed.";
+4
View File
@@ -136,6 +136,10 @@ $lang->doc->fastMenuIconList['collectedbyme'] = 'icon-folder-star';
$lang->doc->customObjectLibs['files'] = '显示附件库';
$lang->doc->customObjectLibs['customFiles'] = '显示自定义文档库';
$lang->doc->customShowLibs = '文档库显示设置';
$lang->doc->customShowLibsList['zero'] = '显示零文档的库';
$lang->doc->customShowLibsList['unclosed'] = '只显示未关闭的项目';
$lang->doc->confirmDelete = "您确定删除该文档吗?";
$lang->doc->confirmDeleteLib = "您确定删除该文档库吗?";
$lang->doc->errorEditSystemDoc = "系统文档库无需修改。";
+34 -4
View File
@@ -148,7 +148,14 @@ class docModel extends model
}
}
$products = $productIdList ? $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('id')->in($productIdList)->fetchPairs('id', 'name') : array();
$projects = $projectIdList ? $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchPairs('id', 'name') : array();
$projects = array();
if($projectIdList)
{
$projects = $this->dao->select('id,name')->from(TABLE_PROJECT)
->where('id')->in($projectIdList)
->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('status')->notin('done,closed')->fi()
->fetchPairs('id', 'name');
}
foreach($menuLibIdList as $i => $menuLibID)
{
$lib = $libs[$menuLibID];
@@ -205,6 +212,7 @@ class docModel extends model
$stmt = $this->dao->select('t1.*')->from(TABLE_DOCLIB)->alias('t1')
->leftJoin($table)->alias('t2')->on("t1.$type=t2.id")
->where("t1.$type")->ne(0)
->beginIF($type == 'project' and strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy("t2.order desc, t1.order, t1.id")
->query();
@@ -967,7 +975,12 @@ class docModel extends model
{
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
$fields = $type == 'product' ? "createdBy, createdDate" : "openedBy AS createdBy, openedDate AS createdDate";
$libs = $this->dao->select("id, name, `order`, {$fields}")->from($table)->where('id')->in($idList)->orderBy('`order` desc, id desc')->page($pager, 'id')->fetchAll('id');
$libs = $this->dao->select("id, name, `order`, {$fields}")->from($table)
->where('id')->in($idList)
->beginIF($type == 'project' and strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('status')->notin('done,closed')->fi()
->orderBy('`order` desc, id desc')
->page($pager, 'id')
->fetchAll('id');
}
else
{
@@ -1021,6 +1034,7 @@ class docModel extends model
$hasProject = $this->dao->select('DISTINCT product')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.product')->in($productIdList)
->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi()
->andWhere('t2.deleted')->eq(0)
->fetchPairs('product', 'product');
}
@@ -1042,7 +1056,12 @@ class docModel extends model
if($hasFilesPriv) $productOrderLibs[$productID]['libs']['files'] = $this->lang->doclib->files;
}
}
$projects = $this->dao->select('id,name,status')->from(TABLE_PROJECT)->where('id')->in(array_keys($projectLibs))->andWhere('deleted')->eq('0')->orderBy('`order`_desc')->fetchAll();
$projects = $this->dao->select('id,name,status')->from(TABLE_PROJECT)
->where('id')->in(array_keys($projectLibs))
->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('status')->notin('done,closed')->fi()
->andWhere('deleted')->eq('0')
->orderBy('`order`_desc')
->fetchAll();
$projectOrderLibs = array();
foreach($projects as $project)
{
@@ -1076,10 +1095,18 @@ class docModel extends model
if($type == 'product' or $type == 'project')
{
$nonzeroLibs = array();
if(strpos($this->config->doc->custom->showLibs, 'zero') === false)
{
$nonzeroLibs = $this->dao->select('lib,count(*) as count')->from(TABLE_DOC)->where('deleted')->eq('0')->groupBy('lib')->having('count')->ne(0)->fetchPairs('lib', 'lib');
}
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
$stmt = $this->dao->select('t1.*')->from(TABLE_DOCLIB)->alias('t1')
->leftJoin($table)->alias('t2')->on("t1.$type=t2.id")
->where('t1.deleted')->eq(0)->andWhere("t1.$type")->ne(0)
->beginIF($type == 'project' and strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi()
->beginIF(strpos($this->config->doc->custom->showLibs, 'zero') === false)->andWhere('t1.id')->in($nonzeroLibs)->fi()
->orderBy("t2.`order` desc, t1.`order` asc, id desc")
->query();
}
@@ -1118,7 +1145,7 @@ class docModel extends model
public function getSubLibGroups($type, $idList)
{
if($type != 'product' and $type != 'project') return false;
$libGroups = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere($type)->in($idList)->orderBy('`order`, id')->fetchGroup($type, 'id');
$libGroups = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere($type)->in($idList)->orderBy('`order`, id')->fetchGroup($type, 'id');
if($type == 'product')
{
if($this->config->global->flow == 'onlyStory' or $this->config->global->flow == 'onlyTest')
@@ -1130,6 +1157,7 @@ class docModel extends model
$hasProject = $this->dao->select('DISTINCT product')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.product')->in($idList)
->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi()
->andWhere('t2.deleted')->eq(0)
->fetchPairs('product', 'product');
}
@@ -1172,6 +1200,7 @@ class docModel extends model
$hasProject = $this->dao->select('DISTINCT product, count(project) as projectCount')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.product')->eq($objectID)
->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi()
->andWhere('t2.deleted')->eq(0)
->groupBy('product')
->fetchPairs('product', 'projectCount');
@@ -1489,6 +1518,7 @@ class docModel extends model
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.root=t2.project')
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.root=t3.id')
->where('t2.product')->eq($objectID)
->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t3.status')->notin('done,closed')->fi()
->andWhere('t1.type')->eq('project')
->andWhere('t3.deleted')->eq('0')
->fetchPairs('account', 'account');
+49 -18
View File
@@ -15,7 +15,7 @@ if($this->methodName != 'browse')
}
if(!isset($type)) $type = 'product';
?>
<div class="side-col" style="width: 220px" data-min-width="220">
<div class="side-col" style="width: 230px" data-min-width="230">
<div class="cell">
<ul class='nav nav-tabs'>
<?php foreach($lang->doclib->tabList as $tabValue => $tabName):?>
@@ -34,23 +34,27 @@ if(!isset($type)) $type = 'product';
<ul data-name="docsTree" data-ride="tree" data-initial-state="preserve" class="tree no-margin">
<?php if(isset($sideSubLibs[$tabValue])):?>
<?php foreach($sideLibs[$tabValue] as $tabMenu):?>
<li <?php if($this->methodName == 'objectlibs' && $type == $tabValue && $object->id == $tabMenu->id) echo "class='active'";?>>
<?php
$customLibCount = 0;
$mainLibID = 0;
if(isset($sideSubLibs[$tabValue][$tabMenu->id]))
{
foreach($sideSubLibs[$tabValue][$tabMenu->id] as $subLibID => $subLibName)
{
if(is_numeric($subLibID) and !empty($mainLibID)) $customLibCount += 1;
if(is_numeric($subLibID) and empty($mainLibID)) $mainLibID = $subLibID;
}
}
?>
<?php
$customLibCount = 0;
$mainLibID = 0;
if(isset($sideSubLibs[$tabValue][$tabMenu->id]))
{
foreach($sideSubLibs[$tabValue][$tabMenu->id] as $subLibID => $subLibName)
{
if(is_numeric($subLibID) and !empty($mainLibID)) $customLibCount += 1;
if(is_numeric($subLibID) and empty($mainLibID)) $mainLibID = $subLibID;
}
}
$icon = $tabValue == 'product' ? "<i class='icon icon-cube'></i> " : "<i class='icon icon-stack'></i> ";
$activeClass = ($this->methodName == 'objectlibs' && $type == $tabValue && $object->id == $tabMenu->id) ? 'active' : '';
$activeClass = ($this->methodName == 'browse' && isset($currentLib) && $currentLib->id == $mainLibID) ? 'active' : $activeClass;
?>
<li <?php echo "class='$activeClass'";?>>
<?php if($customLibCount > 0):?>
<?php echo html::a($this->createLink('doc', 'objectLibs', "type=$tabValue&objectID=$tabMenu->id"), "<i class='icon icon-cube'></i> " . $tabMenu->name, '', "class='text-ellipsis' title='{$tabMenu->name}'");?>
<?php echo html::a($this->createLink('doc', 'objectLibs', "type=$tabValue&objectID=$tabMenu->id"), $icon . $tabMenu->name, '', "class='text-ellipsis' title='{$tabMenu->name}'");?>
<?php else:?>
<?php echo html::a($this->createLink('doc', 'browse', "libID=$mainLibID"), "<i class='icon icon-cube'></i> " . $tabMenu->name, '', "class='text-ellipsis' title='{$tabMenu->name}'");?>
<?php echo html::a($this->createLink('doc', 'browse', "libID=$mainLibID"), $icon . $tabMenu->name, '', "class='text-ellipsis' title='{$tabMenu->name}'");?>
<?php endif;?>
<?php if(isset($sideSubLibs[$tabValue][$tabMenu->id])):?>
<ul>
@@ -109,8 +113,12 @@ if(!isset($type)) $type = 'product';
<?php endforeach;?>
<?php else:?>
<?php foreach($sideLibs[$tabValue] as $sideLibID => $sideLibName):?>
<li <?php if($this->methodName == 'objectlibs' && $type == $tabValue && $object->id == $sideLibID) echo "class='active'";?>>
<?php echo html::a($this->createLink('doc', 'browse', "libID=$sideLibID"), "<i class='icon icon-cube'></i> " . $sideLibName, '', "class='text-ellipsis' title='{$sideLibName}'");?>
<?php
$activeClass = ($this->methodName == 'objectlibs' && $type == $tabValue && $object->id == $sideLibID) ? 'active' : '';
$activeClass = ($this->methodName == 'browse' && isset($currentLib) && $currentLib->id == $sideLibID) ? 'active' : $activeClass;
?>
<li <?php echo "class='$activeClass'";?>>
<?php echo html::a($this->createLink('doc', 'browse', "libID=$sideLibID"), "<i class='icon icon-folder-o'></i> " . $sideLibName, '', "class='text-ellipsis' title='{$sideLibName}'");?>
<ul>
<?php foreach($allModules[$sideLibID] as $module):?>
<?php if($module->parent != 0) continue;?>
@@ -128,4 +136,27 @@ if(!isset($type)) $type = 'product';
<?php endforeach;?>
</div>
</div>
<div class='side-footer'><?php echo html::a('###', "<i class='icon-cog'></i> {$lang->doc->customShowLibs}", '', "class='setting text-secondary small' data-target='#settingModal' data-toggle='modal'");?></div>
<div class='modal fade' id='settingModal' aria-hidden="true">
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only"><?php echo $lang->close;?></span></button>
<strong><?php echo $lang->doc->customShowLibs;?></strong>
</div>
<div class='modal-body'>
<form action='<?php echo $this->createLink('custom', 'ajaxSetDoc');?>' target='hiddenwin' method='post'>
<table class='table table-form'>
<tr>
<td><?php echo html::checkbox('showLibs', $lang->doc->customShowLibsList, $config->doc->custom->showLibs);?></td>
</tr>
<tr>
<td><?php echo html::submitButton();?></td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>