From 0dd5f366c93aa23d317d52819e22ef368bcf1a79 Mon Sep 17 00:00:00 2001 From: sunhao Date: Tue, 15 Oct 2024 22:39:16 +0800 Subject: [PATCH] * [story #68106, doing] add noSpace param to doc app. --- module/doc/control.php | 48 +++++++++++++++++++++++--------------- module/doc/js/app.ui.js | 8 +++---- module/doc/ui/app.html.php | 2 +- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index a05fcf8381..358e2b32a4 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1366,30 +1366,40 @@ class doc extends control * @access public * @return void */ - public function app(string $type = 'mine', int $spaceID = 0, int $libID = 0, int $moduleID = 0, int $docID = 0, string $mode = 'list', string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $filterType = '', string $search = '', string $params = '') + public function app(string $type = 'mine', int $spaceID = 0, int $libID = 0, int $moduleID = 0, int $docID = 0, string $mode = 'list', string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $filterType = '', string $search = '', bool $noSpace = false) { $this->app->loadLang('file'); - $menuType = $type == 'mine' ? 'my' : ($type == 'custom' ? 'team' : $type); - $this->lang->doc->menu->{$menuType}['alias'] .= ',' . $this->app->rawMethod; + $this->docZen->setSpacePageStorage($type, 'all', $spaceID, $libID, $moduleID, 0); + $libData = $this->doc->setMenuByType($type, $spaceID, $libID); + if(is_string($libData)) return $this->locate($libData); + list($libs, $libID, $object, $objectID, $objectDropdown) = $libData; - $this->view->type = $type; - $this->view->spaceID = $spaceID; - $this->view->libID = $libID; - $this->view->moduleID = $moduleID; - $this->view->docID = $docID; - $this->view->mode = $mode; - $this->view->filterType = $filterType; - $this->view->search = $search; - $this->view->recTotal = $recTotal; - $this->view->recPerPage = $recPerPage; - $this->view->pageID = $pageID; - $this->view->orderBy = $orderBy; - $this->view->params = $params; - $this->view->users = $this->loadModel('user')->getPairs('noclosed,noletter'); - $this->view->activeMenuID = $menuType; + /* For product drop menu. */ + if(in_array($type, array('product', 'project', 'execution'))) + { + $objectKey = $type . 'ID'; + $this->view->$objectKey = $spaceID; + } - if(empty($this->view->title)) $this->view->title = $this->lang->doc->spaceList[$type]; + $this->view->type = $type; + $this->view->spaceID = $spaceID; + $this->view->libID = $libID; + $this->view->moduleID = $moduleID; + $this->view->docID = $docID; + $this->view->mode = $mode; + $this->view->filterType = $filterType; + $this->view->search = $search; + $this->view->recTotal = $recTotal; + $this->view->recPerPage = $recPerPage; + $this->view->pageID = $pageID; + $this->view->orderBy = $orderBy; + $this->view->objectType = $type; + $this->view->noSpace = $noSpace; + $this->view->objectID = $spaceID; + $this->view->object = $object; + $this->view->users = $this->loadModel('user')->getPairs('noclosed,noletter'); + $this->view->title = $type == 'custom' ? $this->lang->doc->tableContents : $object->name . $this->lang->hyphen . $this->lang->doc->tableContents; $this->display(); } diff --git a/module/doc/js/app.ui.js b/module/doc/js/app.ui.js index b49c2ec965..ea39eecf4f 100644 --- a/module/doc/js/app.ui.js +++ b/module/doc/js/app.ui.js @@ -107,15 +107,15 @@ function handleSwitchView(mode, location, info) let url; const pager = $.extend({recTotal: 0, recPerPage: 20, pageID: 1}, location.pager); const search = encodeURIComponent(location.search || ''); - const params = encodeURIComponent(location.params || ''); + const noSpace = location.noSpace || 0; const filterType = encodeURIComponent(location.filterType || ''); - if(rawModule === 'doc' && ['myspace', 'teamspace', 'productspace', 'projectspace'].includes(rawMethod)) + if (rawModule === 'doc' && rawMethod === 'app') { - url = $.createLink('doc', config.rawMethod, `objectID=${location.spaceID}&libID=${location.libID}&moduleID=${location.moduleID}&browseType=${filterType}¶m=${params}&orderBy=${location.orderBy}&recTotal=${pager.recTotal}&recPerPage=${pager.recPerPage}&pageID=${pager.pageID}&mode=${mode}&docID=${location.docID}&search=${search}`).replace('&libID=0&moduleID=0&browseType=all¶m=&orderBy=&recTotal=0&recPerPage=20&pageID=1&mode=home&docID=0&search=', ''); + url = $.createLink('doc', 'app', `type=${location.spaceType}&spaceID=${spaceID}&libID=${location.libID}&moduleID=${location.moduleID}&docID=${location.docID}&mode=${mode}&orderBy=${location.orderBy}&recTotal=${pager.recTotal}&recPerPage=${pager.recPerPage}&pageID=${pager.pageID}&filterType=${filterType}&search=${search}&noSpace=${noSpace}`).replace('&libID=0&moduleID=0&docID=0&mode=home&orderBy=id_desc&recTotal=0&recPerPage=0&pageID=1&filterType=&search=&noSpace=false', ''); } else { - url = $.createLink('doc', 'app', `type=${location.spaceType}&spaceID=${spaceID}&libID=${location.libID}&moduleID=${location.moduleID}&docID=${location.docID}&mode=${mode}&orderBy=${location.orderBy}&recTotal=${pager.recTotal}&recPerPage=${pager.recPerPage}&pageID=${pager.pageID}&filterType=${filterType}&search=${search}¶ms=${params}`).replace('&libID=0&moduleID=0&docID=0&mode=home&orderBy=id_desc&recTotal=0&recPerPage=0&pageID=1&filterType=&search=¶ms=', ''); + url = $.createLink(config.rawModule, config.rawMethod, `objectID=${location.spaceID}&libID=${location.libID}&moduleID=${location.moduleID}&browseType=${filterType}¶m=0&orderBy=${location.orderBy}&recTotal=${pager.recTotal}&recPerPage=${pager.recPerPage}&pageID=${pager.pageID}&mode=${mode}&docID=${location.docID}&search=${search}`).replace('&libID=0&moduleID=0&browseType=all¶m=&orderBy=&recTotal=0&recPerPage=20&pageID=1&mode=home&docID=0&search=', ''); } if(url === lastAppUrl) return; if(lastAppUrl && !$.apps.getAppUrl().endsWith(url)) $.apps.updateAppUrl(url, info.title ? (info.title + documentTitleSuffix) : originalDocumentTitle); diff --git a/module/doc/ui/app.html.php b/module/doc/ui/app.html.php index 1f3fc830a4..f76a0a7c23 100644 --- a/module/doc/ui/app.html.php +++ b/module/doc/ui/app.html.php @@ -154,8 +154,8 @@ zui::docApp set::filterType($filterType), set::search($search), set::orderBy($orderBy), - set::params($params), set::homeName($lang->doc->spaceList[$type]), + set::noSpace($noSpace), set::pager(array('recTotal' => $recTotal, 'recPerPage' => $recPerPage, 'pageID' => $pageID)), set::fetcher($fetcher), set::docFetcher($docFetcher),