* Code for task #89910.

This commit is contained in:
tianshujie
2023-04-10 11:24:09 +08:00
parent 9bc7941349
commit a669f56285
9 changed files with 84 additions and 15 deletions
+12
View File
@@ -37,6 +37,18 @@ $config->doc->iconList['word'] = 'word';
$config->doc->iconList['ppt'] = 'ppt';
$config->doc->iconList['excel'] = 'excel';
$config->doc->objectIconList['product'] = 'icon-product';
$config->doc->objectIconList['project'] = 'icon-project';
$config->doc->objectIconList['execution'] = 'icon-run';
$config->doc->objectIconList['mine'] = 'icon-contacts';
$config->doc->objectIconList['custom'] = 'icon-groups';
$config->doc->spaceMethod['mine'] = 'mySpace';
$config->doc->spaceMethod['product'] = 'productSpace';
$config->doc->spaceMethod['project'] = 'projectSpace';
$config->doc->spaceMethod['execution'] = 'projectSpace';
$config->doc->spaceMethod['custom'] = 'tableContents';
$config->doc->search['module'] = 'doc';
$config->doc->search['fields']['title'] = $lang->doc->title;
$config->doc->search['fields']['id'] = $lang->doc->id;
+3 -2
View File
@@ -55,7 +55,7 @@ class doc extends control
/**
* My space.
*
* @param string $type mine
* @param string $type mine|view|collect|createBy
* @param int $libID
* @param int $moduleID
* @param string $browseType all|draft|bysearch
@@ -81,6 +81,7 @@ class doc extends control
/* Build the search form. */
$browseType = strtolower($browseType);
$type = strtolower($type);
$queryID = $browseType == 'bysearch' ? (int)$param : 0;
$params = "libID=$libID&moduleID=$moduleID&browseType=bySearch&param=myQueryID&orderBy=$orderBy";
if($this->app->rawMethod == 'mySpace') $param = "type=$type&" . $params;
@@ -110,7 +111,7 @@ class doc extends control
$this->view->pager = $pager;
$this->view->type = $type;
$this->view->objectID = 0;
$this->view->canExport = 0;
$this->view->canExport = common::hasPriv('doc', 'mine2export');
$this->view->libType = 'lib';
$this->display();
+1 -1
View File
@@ -47,7 +47,7 @@ span.dotted-line+a {display: block;}
.is-sorting > li ul {display: none!important;}
li.drag-shadow ul {display: none!important;}
.table .c-name > .doc-title {display: inline-block; max-width: 90%; overflow: hidden; background: transparent; padding-right:0px;}
.table .c-name > .doc-title {display: inline-block; max-width: calc(100% - 80px); overflow: hidden; background: transparent; padding-right:0px;}
.table .c-name > .draft {background-color:rgba(129, 102, 238, 0.12); color:#8166EE;}
.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: 0px;}
table.table > thead > tr {height: 32px;}
+2
View File
@@ -122,6 +122,8 @@ $lang->doc->closed = 'Closed';
$lang->doc->saveDraft = 'Save Draft';
$lang->doc->defaultSave = 'Default Save: ';
$lang->doc->position = 'Position';
$lang->doc->person = 'Person';
$lang->doc->team = 'Team';
$lang->doc->moduleDoc = 'Nach Modulen';
$lang->doc->searchDoc = 'Suche';
+2
View File
@@ -122,6 +122,8 @@ $lang->doc->closed = 'Closed';
$lang->doc->saveDraft = 'Save Draft';
$lang->doc->defaultSave = 'Default Save: ';
$lang->doc->position = 'Position';
$lang->doc->person = 'Person';
$lang->doc->team = 'Team';
$lang->doc->moduleDoc = 'By Module';
$lang->doc->searchDoc = 'Search';
+2
View File
@@ -122,6 +122,8 @@ $lang->doc->closed = 'Closed';
$lang->doc->saveDraft = 'Save Draft';
$lang->doc->defaultSave = 'Default Save: ';
$lang->doc->position = 'Position';
$lang->doc->person = 'Person';
$lang->doc->team = 'Team';
$lang->doc->moduleDoc = 'Par Module';
$lang->doc->searchDoc = 'Rechercher';
+3 -1
View File
@@ -83,7 +83,7 @@ $lang->doc->url = '文档URL';
$lang->doc->files = '附件';
$lang->doc->addedBy = '由谁添加';
$lang->doc->addedByAB = '创建者';
$lang->doc->addedDate = '创建时间';
$lang->doc->addedDate = '创建日期';
$lang->doc->editedBy = '修改者';
$lang->doc->editedDate = '修改日期';
$lang->doc->lastEditedBy = '最后更新者';
@@ -122,6 +122,8 @@ $lang->doc->closed = '已关闭';
$lang->doc->saveDraft = '存为草稿';
$lang->doc->defaultSave = '默认存入:';
$lang->doc->position = '所在位置';
$lang->doc->person = '个人';
$lang->doc->team = '团队';
$lang->doc->moduleDoc = '按模块浏览';
$lang->doc->searchDoc = '搜索';
+23 -8
View File
@@ -377,8 +377,9 @@ class docModel extends model
*/
public function getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager)
{
$allLibs = array_keys($this->getLibs('all'));
$docIdList = $this->getPrivDocs(0, $moduleID);
$allLibs = $this->getLibs('all');
$allLibIDList = array_keys($allLibs);
$docIdList = $this->getPrivDocs(0, $moduleID);
$files = $this->dao->select('*')->from(TABLE_FILE)
->where('objectType')->eq('doc')
@@ -418,7 +419,7 @@ class docModel extends model
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere($query)
->andWhere('lib')->in($allLibs)
->andWhere('lib')->in($allLibIDList)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('addedBy', 1)->eq($this->app->user->account)
->orWhere('id')->in(array_keys($docIDList))
@@ -431,7 +432,7 @@ class docModel extends model
{
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere('lib')->in($allLibs)
->andWhere('lib')->in($allLibIDList)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('addedBy')->eq($this->app->user->account)
->orderBy($sort)
@@ -448,7 +449,7 @@ class docModel extends model
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere('id')->in(array_keys($docIDList))
->andWhere('lib')->in($allLibs)
->andWhere('lib')->in($allLibIDList)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->orderBy($sort)
->page($pager)
@@ -460,7 +461,7 @@ class docModel extends model
->where('deleted')->eq(0)
->andWhere('id')->in($docIdList)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('lib')->in($allLibs)
->andWhere('lib')->in($allLibIDList)
->orderBy('editedDate_desc')
->page($pager)
->fetchAll('id');
@@ -470,7 +471,7 @@ class docModel extends model
$docs = $this->dao->select('t1.*')->from(TABLE_DOC)->alias('t1')
->leftJoin(TABLE_DOCACTION)->alias('t2')->on("t1.id=t2.doc && t2.action='collect'")
->where('t1.deleted')->eq(0)
->andWhere('t1.lib')->in($allLibs)
->andWhere('t1.lib')->in($allLibIDList)
->beginIF($this->config->doc->notArticleType)->andWhere('t1.type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('t2.actor')->eq($this->app->user->account)
->orderBy($sort)
@@ -482,7 +483,8 @@ class docModel extends model
/* Get projects, executions and products by docIdList. */
list($projects, $executions, $products) = $this->getObjectsByDoc(array_keys($docs));
$mineLibs = $this->getAllLibsByType('mine');
$customLibs = $this->getAllLibsByType('custom');
$docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc');
$modules = array();
@@ -493,6 +495,7 @@ class docModel extends model
if(!isset($modules[$doc->lib])) $modules[$doc->lib] = $this->tree->getOptionMenu($doc->lib, 'doc', 0, 0, 'nodeleted', 'all', ' > ');
$doc->moduleName = zget($modules[$doc->lib], $doc->module);
$doc->moduleName = ltrim($doc->moduleName, '/');
$doc->libName = zget($allLibs, $doc->lib);
foreach($objects as $type => $object)
{
if(!empty($doc->{$type}))
@@ -503,6 +506,18 @@ class docModel extends model
break;
}
}
if(isset($mineLibs[$doc->lib]))
{
$doc->objectID = 0;
$doc->objectName = $this->lang->doc->person;
$doc->objectType = 'mine';
}
elseif(isset($customLibs[$doc->lib]))
{
$doc->objectID = 0;
$doc->objectName = $this->lang->doc->team;
$doc->objectType = 'custom';
}
$docs[$index]->fileSize = 0;
if(isset($files[$index]))
+36 -3
View File
@@ -15,10 +15,16 @@ body {margin-bottom: 25px;}
#docListForm th.c-id {width: 72px;}
#docListForm th.c-user {width: 80px;}
#docListForm th.c-actions {width: 84px; padding-left: 15px;}
#docListForm .table .c-name > .doc-title {display: inline-block; max-width: 90%; overflow: hidden; background: transparent; padding-right:0px;}
#docListForm .c-module, #docListForm .c-object {width: 120px; overflow: hidden; white-space: nowrap; text-overflow: clip;}
#docListForm .table .c-name > .doc-title {display: inline-block; max-width: calc(100% - 80px); overflow: hidden; background: transparent; padding-right:0px;}
#docListForm .table .c-name > .draft {background-color:rgba(129, 102, 238, 0.12); color:#8166EE;}
#docListForm .table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: 0px;}
#docListForm table.table > thead > tr {height: 32px;}
#docListForm .checkbox-primary {line-height: 16px;}
#docListForm table .checkbox-primary {top: -2px;}
#docListForm .checkbox-primary > label {height: 16px; line-height: 16px; padding-left: 16px;}
#docListForm .checkbox-primary > label:before {left: -1px; font-size: 10px;}
#docListForm .checkbox-primary > label:after {width: 12px; height: 12px;}
</style>
<?php if(common::checkNotCN()):?>
<style>
@@ -55,8 +61,11 @@ body {margin-bottom: 25px;}
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
</th>
<th class="c-name"><?php common::printOrderLink('title', $orderBy, $vars, $lang->doc->title);?></th>
<th class="c-module"><?php common::printOrderLink('module', $orderBy, $vars, $lang->doc->position);?></th>
<?php if($type != 'mine'):?>
<th class='c-object'><?php echo $lang->doc->object;?></th>
<th class="c-module"><?php common::printOrderLink('module', $orderBy, $vars, $lang->doc->position);?></th>
<?php endif;?>
<?php if(!in_array($type, array('mine', 'createby'))):?>
<th class="c-user"><?php common::printOrderLink('addedBy', $orderBy, $vars, $lang->doc->addedByAB);?></th>
<?php endif;?>
<th class="c-date"><?php common::printOrderLink('addedDate', $orderBy, $vars, $lang->doc->addedDate);?></th>
@@ -101,8 +110,32 @@ body {margin-bottom: 25px;}
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><?php echo html::image("static/svg/{$star}.svg", "class='$star'");?></a>
<?php endif;?>
</td>
<td class="c-module"><?php echo $doc->moduleName;?></td>
<?php if($type != 'mine'):?>
<td class="c-object" title='<?php echo $doc->objectName;?>'>
<?php $objectIcon = zget($config->doc->objectIconList, $doc->objectType);?>
<?php echo "<i class='icon $objectIcon'></i> " . $doc->objectName;?>
</td>
<td class="c-module">
<?php
$moduleDivide = $doc->moduleName ? ' > ' : '';
$moduleName = $doc->libName . $moduleDivide . $doc->moduleName;
$spaceMethod = zget($config->doc->spaceMethod, $doc->objectType);
$spaceParams = "libID={$doc->lib}&moduleID={$doc->module}";
if(in_array($doc->objectType, array('product', 'project', 'execution', 'custom'))) $spaceParams = "objectID={$doc->objectID}&$spaceParams";
if(in_array($doc->objectType, array('mine', 'custom'))) $spaceParams = "type={$doc->objectType}&$spaceParams";
if(common::hasPriv('doc', $spaceMethod))
{
echo html::a($this->createLink('doc', $spaceMethod, $spaceParams), $moduleName, '', "title='$moduleName' data-app='{$this->app->tab}'");
}
else
{
echo "<span>$moduleName</span>";
}
?>
</td>
<?php endif;?>
<?php if(!in_array($type, array('mine', 'createby'))):?>
<td class="c-user"><?php echo zget($users, $doc->addedBy);?></td>
<?php endif;?>
<td class="c-datetime"><?php echo formatTime($doc->addedDate, 'Y-m-d');?></td>