* Add search function for files of doclib.

This commit is contained in:
daitingting
2017-04-26 10:56:04 +08:00
parent 04c93ad7ef
commit 9de09fa830
4 changed files with 37 additions and 6 deletions
+2
View File
@@ -35,6 +35,7 @@ $lang->doc->fileObject = 'The Object';
$lang->doc->whiteList = 'White List';
$lang->doc->contentType = 'Document Format';
$lang->doc->separator = "<i class='icon-angle-right'></i>";
$lang->doc->fileTitle = 'File Title';
$lang->doc->moduleDoc = 'By Module';
$lang->doc->searchDoc = 'By Search';
@@ -68,6 +69,7 @@ $lang->doc->editLib = 'Edit';
$lang->doc->deleteLib = 'Delete';
$lang->doc->fixedMenu = 'Fixed In Menu';
$lang->doc->removeMenu = 'Remove From Menu';
$lang->doc->search = 'Search';
/* 查询条件列表 */
$lang->doc->allProduct = 'All' . $lang->productCommon;
+2
View File
@@ -35,6 +35,7 @@ $lang->doc->fileObject = '所属对象';
$lang->doc->whiteList = '白名单';
$lang->doc->contentType = '文档格式';
$lang->doc->separator = "<i class='icon-angle-right'></i>";
$lang->doc->fileTitle = '附件名';
$lang->doc->moduleDoc = '按模块浏览';
$lang->doc->searchDoc = '搜索';
@@ -68,6 +69,7 @@ $lang->doc->editLib = '编辑文档库';
$lang->doc->deleteLib = '删除文档库';
$lang->doc->fixedMenu = '固定到菜单栏';
$lang->doc->removeMenu = '从菜单栏移除';
$lang->doc->search = '搜索';
/* 查询条件列表 */
$lang->doc->allProduct = '所有' . $lang->productCommon;
+10 -5
View File
@@ -862,7 +862,8 @@ class docModel extends model
{
if($type != 'project' and $type != 'product') return true;
$this->loadModel('file');
$docIdList = $this->dao->select('id')->from(TABLE_DOC)->where($type)->eq($objectID)->get();
$docIdList = $this->dao->select('id')->from(TABLE_DOC)->where($type)->eq($objectID)->get();
$searchTitle = $this->get->title;
if($type == 'product')
{
$storyIdList = $this->dao->select('id')->from(TABLE_STORY)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->get();
@@ -870,13 +871,15 @@ class docModel extends model
$releaseIdList = $this->dao->select('id')->from(TABLE_RELEASE)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->get();
$planIdList = $this->dao->select('id')->from(TABLE_PRODUCTPLAN)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->get();
$files = $this->dao->select('*')->from(TABLE_FILE)->alias('t1')
->where("(objectType = 'product' and objectID = $objectID)")
->where('size')->gt('0')
->andWhere("(objectType = 'product' and objectID = $objectID)", true)
->orWhere("(objectType = 'doc' and objectID in ($docIdList))")
->orWhere("(objectType = 'story' and objectID in ($storyIdList))")
->orWhere("(objectType = 'bug' and objectID in ($bugIdList))")
->orWhere("(objectType = 'release' and objectID in ($releaseIdList))")
->orWhere("(objectType = 'productplan' and objectID in ($planIdList))")
->andWhere('size')->gt('0')
->markRight(1)
->beginIF($searchTitle)->andWhere('title')->like("%{$searchTitle}%")->fi()
->page($pager)
->fetchAll('id');
}
@@ -885,11 +888,13 @@ class docModel extends model
$taskIdList = $this->dao->select('id')->from(TABLE_TASK)->where('project')->eq($objectID)->andWhere('deleted')->eq('0')->get();
$buildIdList = $this->dao->select('id')->from(TABLE_BUILD)->where('project')->eq($objectID)->andWhere('deleted')->eq('0')->get();
$files = $this->dao->select('*')->from(TABLE_FILE)->alias('t1')
->where("(objectType = 'project' and objectID = $objectID)")
->where('size')->gt('0')
->andWhere("(objectType = 'project' and objectID = $objectID)", true)
->orWhere("(objectType = 'doc' and objectID in ($docIdList))")
->orWhere("(objectType = 'task' and objectID in ($taskIdList))")
->orWhere("(objectType = 'build' and objectID in ($buildIdList))")
->andWhere('size')->gt('0')
->markRight(1)
->beginIF($searchTitle)->andWhere('title')->like("%{$searchTitle}%")->fi()
->page($pager)
->fetchAll('id');
}
+23 -1
View File
@@ -13,7 +13,29 @@
<?php include '../../common/view/header.html.php';?>
<div id='featurebar'>
<strong><?php echo $lang->doclib->files?></strong>
<div class='actions'><?php echo html::backButton();?></div>
<div class='actions'>
<form class='pull-left' method='get'>
<?php
if($this->config->requestType == 'GET')
{
echo html::hidden('m', 'doc');
echo html::hidden('f', 'showFiles');
echo html::hidden('type', $type);
echo html::hidden('objectID', $object->id);
echo html::hidden('recTotal', isset($this->get->recTotal) ? $this->get->recTotal : 0);
echo html::hidden('recPerPage', isset($this->get->recPerPage) ? $this->get->recPerPage : 0);
echo html::hidden('pageID', isset($this->get->pageID) ? $this->get->pageID : 0);
}
?>
<div class='input-group input-group-sm'>
<?php echo html::input('title', $this->get->title, "class='form-control search-query' placeholder='{$lang->doc->fileTitle}'");?>
<span class='input-group-btn'>
<?php echo html::submitButton($lang->doc->search);?>
</span>
</div>
</form>
<?php echo html::backButton();?>
</div>
</div>
<div class='lib-files cards'>
<?php foreach($files as $file):?>