From bc6888da5e766335f467fa1a8d93f39e155ac14d Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Fri, 14 Apr 2023 14:36:10 +0800 Subject: [PATCH] * Add edited by me doc list. --- module/doc/control.php | 6 ++++-- module/doc/lang/de.php | 1 + module/doc/lang/en.php | 1 + module/doc/lang/fr.php | 1 + module/doc/lang/zh-cn.php | 1 + module/doc/model.php | 26 ++++++++++++++++++++++++-- module/doc/view/lefttree.html.php | 4 ++-- module/doc/view/view.html.php | 1 + 8 files changed, 35 insertions(+), 6 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 6e5a6ee814..19067ff842 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -63,6 +63,7 @@ class doc extends control if(empty($orderBy) and $type == 'mine') $orderBy = 'status,editedDate_desc'; if(empty($orderBy) and ($type == 'view' or $type == 'collect')) $orderBy = 'status,date_desc'; if(empty($orderBy) and ($type == 'createdby')) $orderBy = 'status,addedDate_desc'; + if(empty($orderBy) and ($type == 'editedby')) $orderBy = 'status,editedDate_desc'; /* Save session, load module. */ $uri = $this->app->getURI(true); @@ -81,13 +82,14 @@ class doc extends control if($type == 'view') $objectTitle = $this->lang->doc->myView; if($type == 'collect') $objectTitle = $this->lang->doc->myCollection; if($type == 'createdby') $objectTitle = $this->lang->doc->myCreation; + if($type == 'editedby') $objectTitle = $this->lang->doc->myEdited; if($objectTitle) $objectDropdown = "
{$objectTitle}
"; } /* Build the search form. */ $queryID = $browseType == 'bysearch' ? (int)$param : 0; $params = "libID=$libID&moduleID=$moduleID&browseType=bySearch¶m=myQueryID&orderBy=$orderBy"; - if($this->app->rawMethod == 'myspace') $params = "type=$type&" . $params; + if($this->app->rawMethod == 'myspace') $params = "type=$type&$params"; $actionURL = $this->createLink('doc', $this->app->rawMethod, $params); $this->doc->buildSearchForm($libID, $libs, $queryID, $actionURL, $type); @@ -110,7 +112,7 @@ class doc extends control $docs = $browseType == 'bysearch' ? $this->doc->getDocsBySearch('mine', 0, $libID, $queryID, $orderBy, $pager) : $this->doc->getDocs($libID, $moduleID, $browseType, $orderBy, $pager); } } - elseif($type == 'view' or $type == 'collect' or $type == 'createdby') + elseif($type == 'view' or $type == 'collect' or $type == 'createdby' or $type == 'editedby') { $docs = $this->doc->getMineList($type, $browseType, $orderBy, $pager, $queryID); } diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index 0724128f51..842b920098 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -141,6 +141,7 @@ $lang->doc->myDoc = 'Meine Dokumente'; $lang->doc->myView = 'Recently Viewed'; $lang->doc->myCollection = 'Meine Favoriten'; $lang->doc->myCreation = 'Created By'; +$lang->doc->myEdited = 'Edited By'; $lang->doc->myLib = 'My Library'; $lang->doc->tableContents = 'Catalog'; $lang->doc->addCatalog = 'Add Catalog'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index bdf898ff1b..8da8c26eff 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -141,6 +141,7 @@ $lang->doc->myDoc = 'My Documents'; $lang->doc->myView = 'Recently Viewed'; $lang->doc->myCollection = 'My Favorites'; $lang->doc->myCreation = 'Created By'; +$lang->doc->myEdited = 'Edited By'; $lang->doc->myLib = 'My Library'; $lang->doc->tableContents = 'Directory'; $lang->doc->addCatalog = 'Add Catalog'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 1ec69993c0..da3a1ec203 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -141,6 +141,7 @@ $lang->doc->myDoc = 'Mes Documents'; $lang->doc->myView = 'Recently Viewed'; $lang->doc->myCollection = 'Mes Favoris'; $lang->doc->myCreation = 'Created By'; +$lang->doc->myEdited = 'Edited By'; $lang->doc->myLib = 'My Library'; $lang->doc->tableContents = 'Catalog'; $lang->doc->addCatalog = 'Add Catalog'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 67c72d83d2..87be150799 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -141,6 +141,7 @@ $lang->doc->myDoc = '我的文档'; $lang->doc->myView = '最近浏览'; $lang->doc->myCollection = '我的收藏'; $lang->doc->myCreation = '我创建的'; +$lang->doc->myEdited = '我编辑的'; $lang->doc->myLib = '我的个人库'; $lang->doc->tableContents = '目录'; $lang->doc->addCatalog = '添加目录'; diff --git a/module/doc/model.php b/module/doc/model.php index 1493bc528a..b20f3b21ec 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -657,13 +657,26 @@ class docModel extends model ->page($pager, 't1.id') ->fetchAll('id'); } - elseif($type == 'createdby') + elseif($type == 'createdby' || $type == 'editedby') { + $docIDList = array_keys($docIDList); + if($type == 'editedby') + { + $editDocs = $this->dao->select('objectID')->from(TABLE_ACTION) + ->where('objectType')->eq('doc') + ->andWhere('action')->eq('edited') + ->andWhere('actor')->eq($this->app->user->account) + ->andWhere('vision')->eq($this->config->vision) + ->fetchPairs(); + + $docIDList = array_intersect($docIDList, $editDocs); + } + $docs = $this->dao->select('t1.*,t2.name as libName,t2.type as objectType')->from(TABLE_DOC)->alias('t1') ->leftJoin(TABLE_DOCLIB)->alias('t2')->on("t1.lib=t2.id") ->where('t1.deleted')->eq(0) ->andWhere('t1.lib')->ne('') - ->andWhere('t1.id')->in(array_keys($docIDList)) + ->andWhere('t1.id')->in($docIDList) ->andWhere('t1.vision')->eq($this->config->vision) ->andWhere('t1.addedBy')->eq($this->app->user->account) ->beginIF(!common::hasPriv('doc', 'productSpace'))->andWhere('t2.type')->ne('product')->fi() @@ -3119,6 +3132,15 @@ class docModel extends model $myCreation->hasAction = false; $myCreation->active = $libType == 'createdby' ? 1 : 0; + $myCreation = new stdclass(); + $myCreation->id = 0; + $myCreation->name = $this->lang->doc->myEdited; + $myCreation->type = 'editedBy'; + $myCreation->objectType = 'doc'; + $myCreation->objectID = 0; + $myCreation->hasAction = false; + $myCreation->active = $libType == 'editedby' ? 1 : 0; + $libTree = array(); $libTree[] = $myLib; if(common::hasPriv('doc', 'myView')) $libTree[] = $myView; diff --git a/module/doc/view/lefttree.html.php b/module/doc/view/lefttree.html.php index 9670122757..381650cd6c 100644 --- a/module/doc/view/lefttree.html.php +++ b/module/doc/view/lefttree.html.php @@ -462,9 +462,9 @@ $(function() else { methodName = spaceMethod[objectType] ? spaceMethod[objectType] : 'teamSpace'; - if(['mine', 'view', 'collect', 'createdby'].indexOf(objectType) !== -1) + if(['mine', 'view', 'collect', 'createdby', 'editedby'].indexOf(objectType) !== -1) { - type = ['view', 'collect', 'createdby'].indexOf(type.toLowerCase()) !== -1 ? type.toLowerCase() : 'mine'; + type = ['view', 'collect', 'createdby', 'editedby'].indexOf(type.toLowerCase()) !== -1 ? type.toLowerCase() : 'mine'; linkParams = 'type=' + type + '&' + linkParams; } } diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php index abc9efb63c..b10fc079de 100644 --- a/module/doc/view/view.html.php +++ b/module/doc/view/view.html.php @@ -30,6 +30,7 @@
createLink('doc', $exportMethod, "libID=$libID&moduleID=0&docID=$docID"), " " . $lang->export, 'hiddenwin', "class='btn btn-link' id='docExport'"); + if(common::hasPriv('api', 'createLib')) echo html::a($this->createLink('api', 'createLib', "type=" . ($objectType ? $objectType : 'nolink') . "&objectID=$objectID"), ' ' . $lang->api->createLib, '', 'class="btn btn-secondary iframe" data-width="800px"'); if(common::hasPriv('doc', 'create')) echo $this->doc->printCreateBtn($lib, $moduleID); ?>