From ced89c0a0d9fb933e29fcda7ab67977df5fed769 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 10 Apr 2023 11:04:57 +0800 Subject: [PATCH] * code for task #89909. --- module/doc/control.php | 2 +- 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 | 41 ++++++++++++++++++++++++++++--- module/doc/view/lefttree.html.php | 9 +++++-- 7 files changed, 50 insertions(+), 6 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 1a9218b5b0..19e7ce81fb 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -106,7 +106,7 @@ class doc extends control $this->view->param = $param; $this->view->libID = $libID; $this->view->lib = $this->doc->getLibById($libID); - $this->view->libTree = $this->doc->getLibTree($libID, $libs, 'mine', 0); + $this->view->libTree = $this->doc->getLibTree($type != 'mine' ? 0 : $libID, $libs, 'mine', 0); $this->view->pager = $pager; $this->view->type = $type; $this->view->objectID = 0; diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index e6d2accdf2..f5ea435d7d 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -138,6 +138,7 @@ $lang->doc->myDoc = 'Meine Dokumente'; $lang->doc->myView = 'Recently Viewed'; $lang->doc->myCollection = 'Meine Favoriten'; $lang->doc->myCreation = 'Created By'; +$lang->doc->myLib = 'My Library'; $lang->doc->tableContents = 'Catalog'; $lang->doc->addCatalog = 'Add Catalog'; $lang->doc->editCatalog = 'Edit Catalog'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index c8b6ac9d88..568b6e12be 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -138,6 +138,7 @@ $lang->doc->myDoc = 'My Documents'; $lang->doc->myView = 'Recently Viewed'; $lang->doc->myCollection = 'My Favorites'; $lang->doc->myCreation = 'Created By'; +$lang->doc->myLib = 'My Library'; $lang->doc->tableContents = 'Directory'; $lang->doc->addCatalog = 'Add Catalog'; $lang->doc->editCatalog = 'Edit Catalog'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 18bd797704..aacd0e804a 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -138,6 +138,7 @@ $lang->doc->myDoc = 'Mes Documents'; $lang->doc->myView = 'Recently Viewed'; $lang->doc->myCollection = 'Mes Favoris'; $lang->doc->myCreation = 'Created By'; +$lang->doc->myLib = 'My Library'; $lang->doc->tableContents = 'Catalog'; $lang->doc->addCatalog = 'Add Catalog'; $lang->doc->editCatalog = 'Edit Catalog'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index d55bc43115..cbc116a00c 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -138,6 +138,7 @@ $lang->doc->myDoc = '我的文档'; $lang->doc->myView = '最近浏览'; $lang->doc->myCollection = '我的收藏'; $lang->doc->myCreation = '我创建的'; +$lang->doc->myLib = '我的个人库'; $lang->doc->tableContents = '目录'; $lang->doc->addCatalog = '添加目录'; $lang->doc->editCatalog = '编辑目录'; diff --git a/module/doc/model.php b/module/doc/model.php index 1c838ca42b..61e26771ea 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2884,9 +2884,7 @@ class docModel extends model $executionLibs[$lib->execution][$lib->id] = $lib; } - $executionPairs = $this->dao->select('id,name')->from(TABLE_EXECUTION) - ->where('id')->in(array_keys($executionLibs)) - ->fetchPairs(); + $executionPairs = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(array_keys($executionLibs))->fetchPairs(); } $release = null; @@ -3011,6 +3009,43 @@ class docModel extends model } if($type != 'project') $libTree = array_values($libTree[$type]); + if($type == 'mine') + { + $myLib = new stdclass(); + $myLib->id = 0; + $myLib->name = $this->lang->doc->myLib; + $myLib->type = 'lib'; + $myLib->objectType = 'mine'; + $myLib->objectID = 0; + $myLib->active = 0; + $myLib->children = $libTree; + + $myView = new stdclass(); + $myView->id = 0; + $myView->name = $this->lang->doc->myView; + $myView->type = 'view'; + $myView->objectType = 'doc'; + $myView->objectID = 0; + $myView->active = zget($this->app->rawParams, 'type', '') == 'view' ? 1 : 0; + + $myCollection = new stdclass(); + $myCollection->id = 0; + $myCollection->name = $this->lang->doc->myCollection; + $myCollection->type = 'collect'; + $myCollection->objectType = 'doc'; + $myCollection->objectID = 0; + $myCollection->active = zget($this->app->rawParams, 'type', '') == 'collect' ? 1 : 0; + + $myCreation = new stdclass(); + $myCreation->id = 0; + $myCreation->name = $this->lang->doc->myCreation; + $myCreation->type = 'createdBy'; + $myCreation->objectType = 'doc'; + $myCreation->objectID = 0; + $myCreation->active = zget($this->app->rawParams, 'type', '') == 'createdBy' ? 1 : 0; + + $libTree = array($myLib, $myView, $myCollection, $myCreation); + } return $libTree; } diff --git a/module/doc/view/lefttree.html.php b/module/doc/view/lefttree.html.php index 834edeee15..333731354b 100644 --- a/module/doc/view/lefttree.html.php +++ b/module/doc/view/lefttree.html.php @@ -431,6 +431,8 @@ $(function() */ function locatePage(libID, moduleID, type) { + if(!libID) libID = 0; + if(!moduleID) moduleID = 0; linkParams = linkParams.replace('%s', 'libID=' + libID + '&moduleID=' + moduleID); var methodName = ''; if(config.currentModule == 'api') @@ -443,10 +445,13 @@ $(function() methodName = 'showFiles'; linkParams = 'type=' + objectType + '&objectID=' + objectID; } - else if(objectType == 'mine') + else if(objectType == 'mine' || objectType == 'view' || objectType == 'collect' || objectType == 'createdBy') { + var mySpaceType = 'mine'; + if(type == 'view' || type == 'collect' || type == 'createdBy') mySpaceType = type; + methodName = 'mySpace'; - linkParams = 'type=mine&libID=' + libID; + linkParams = 'type='+ mySpaceType + '&libID=' + libID + '&moduleID=' + moduleID; } else if(['text', 'word', 'ppt', 'excel'].indexOf(type) !== -1) {