From 1ae6587b9e9eacaa38c64394abf2f498524d112e Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 23 Mar 2021 10:24:11 +0800 Subject: [PATCH] * Unset doc set menu params. --- module/doc/control.php | 14 +++--- module/doc/model.php | 111 +---------------------------------------- 2 files changed, 9 insertions(+), 116 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 76114918ce..70161b2b2d 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -122,7 +122,7 @@ class doc extends control else { $menuType = (!$type && (in_array($browseType, array_keys($this->lang->doc->fastMenuList)) || $browseType == 'bysearch')) ? $browseType : $type; - $this->doc->setMenu($menuType, $libID, $moduleID, $productID, $executionID); + $this->doc->setMenu(); } $this->session->set('docList', $this->app->getURI(true)); @@ -348,7 +348,7 @@ class doc extends control } else { - $this->doc->setMenu($type, $libID, $moduleID, $lib->product, $lib->execution); + $this->doc->setMenu(); } $this->view->title = $lib->name . $this->lang->colon . $this->lang->doc->create; @@ -420,7 +420,7 @@ class doc extends control } else { - $this->doc->setMenu($type, $libID, $doc->module, $lib->product, $lib->execution); + $this->doc->setMenu(); } /* Set my menu. */ @@ -483,7 +483,7 @@ class doc extends control else { /* Set menu. */ - $this->doc->setMenu($type, $doc->lib, $doc->module, $lib->product, $lib->execution); + $this->doc->setMenu(); } $this->view->title = "DOC #$doc->id $doc->title - " . $lib->name; @@ -736,7 +736,7 @@ class doc extends control $this->view->title = $libName; $this->view->position[] = $libName; - $this->doc->setMenu($type, $libID = 0, $moduleID = 0, $productID = 0, $executionID = 0, $crumb); + $this->doc->setMenu(); /* Load pager. */ $this->app->loadClass('pager', $static = true); @@ -820,7 +820,7 @@ class doc extends control if(!$this->executionID->checkPriv($objectID)) $this->accessDenied(); } - $this->doc->setMenu($type, $libID = 0, $moduleID = 0, $productID, $executionID, $crumb); + $this->doc->setMenu(); } /* Load pager. */ @@ -887,7 +887,7 @@ class doc extends control $crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name); $productID = $type == 'product' ? $objectID : 0; $executionID = $type == 'execution' ? $objectID : 0; - $this->doc->setMenu($type, 0, 0, $productID, $executionID, $crumb); + $this->doc->setMenu(); } elseif($from == 'execution') diff --git a/module/doc/model.php b/module/doc/model.php index 6f68a293b9..29228a98dd 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -14,121 +14,14 @@ class docModel extends model { /** - * Set menus + * Set menu. * - * @param array $libs - * @param int $libID - * @param string $moduleID - * @param int $productID - * @param int $executionID - * @param string $crumb * @access public * @return void */ - public function setMenu($type = '', $libID = 0, $moduleID = 0, $productID = 0, $executionID = 0, $crumb = '') + public function setMenu() { - /* Set doc switcher menu. */ $this->lang->switcherMenu = "
" . html::a(helper::createLink('doc', 'index'), " {$this->lang->doc->common}", '', "class='btn'") . '
'; - - $btnStyle = $this->lang->navGroup->doc == 'doc' ? 'header-btn' : 'angle-btn'; - $isLimitWidth = $this->lang->navGroup->doc == 'doc' ? '' : 'btn-limit'; - $selectHtml = "
"; - $selectHtml .= html::a(helper::createLink('doc', 'index'), $this->lang->doc->index, '', "class='btn'"); - $selectHtml .= '
'; - - if($type) - { - $fastLib = in_array($type, array_keys($this->lang->doc->fastMenuList)) ? $this->lang->doc->fastMenuList[$type] : $this->lang->doc->fast; - - if($libID) - { - $lib = $this->getLibById($libID); - if(!$this->checkPrivLib($lib)) - { - echo(js::alert($this->lang->doc->accessDenied)); - $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; - if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index'))); - die(js::locate('back')); - } - - $type = $lib->type; - } - - if(isset($this->lang->doc->libTypeList[$type])) - { - $mainLib = $this->lang->doc->libTypeList[$type]; - $selectHtml .= "
"; - $selectHtml .= "
"; - $selectHtml .= "" . $mainLib . " "; - $selectHtml .= "
'; - } - - $currentLib = 0; - if(in_array($type, array_keys($this->lang->doc->libTypeList))) - { - if($type == 'product') $currentLib = $productID; - if($type == 'execution') $currentLib = $executionID; - if($type != 'product' and $type != 'execution') $currentLib = $libID; - - if($currentLib) - { - $allLibGroups = $this->getAllLibGroups($libID); - $currentGroups = $allLibGroups[$type]; - /* Append closed execution. */ - if(!isset($currentGroups[$currentLib]) and $type == 'execution') - { - $execution = $this->dao->select('id,name,status')->from(TABLE_EXECUTION)->where('id')->eq($currentLib)->fetch(); - $currentGroups[$currentLib] = (array)$execution; - } - $currentLibName = is_array($currentGroups[$currentLib]) ? $currentGroups[$currentLib]['name'] : $currentGroups[$currentLib]; - - $selectHtml .= "
"; - $selectHtml .= "
"; - $selectHtml .= "" . $currentLibName . ' '; - $selectHtml .='
'; - } - } - - /* Determines whether the doc lib is editable. */ - $docLib = new stdClass(); - $docLib->product = $productID; - $docLib->execution = $executionID; - $canBeChanged = common::canBeChanged('doc', $docLib); - - $lib = isset($lib) ? $lib : new stdClass(); - $actions = $this->setFastMenu($fastLib); - $actions .= ($canBeChanged and common::hasPriv('doc', 'createLib', $lib)) ? html::a(helper::createLink('doc', 'createLib', "type={$type}&objectID={$currentLib}"), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe'") : ''; - - $this->lang->TRActions = $actions; - } - - $this->lang->modulePageNav = $selectHtml; } /**