From ff435621c33380249bef1439e150faeb5d6a9f2d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 15 Nov 2016 11:19:16 +0800 Subject: [PATCH] * finish task #2800,2799. --- module/doc/control.php | 44 ++++++++++++++++---------------- module/doc/model.php | 42 +++++++++++++++--------------- module/doc/view/alllibs.html.php | 1 - module/tree/control.php | 2 +- 4 files changed, 43 insertions(+), 46 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 547d0357f2..6e232092a5 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -38,7 +38,7 @@ class doc extends control { $products[] = $this->lang->doc->systemLibs['product']; - $this->doc->setMenu(array($this->lang->doclib->select)); + $this->doc->setMenu(); $products = $this->doc->getLimitLibs('product', '9'); $projects = $this->doc->getLimitLibs('project', '9'); @@ -114,7 +114,7 @@ class doc extends control } else { - $this->doc->setMenu($this->libs, $libID, $moduleID); + $this->doc->setMenu($libID, $moduleID); } $this->session->set('docList', $this->app->getURI(true)); @@ -291,7 +291,6 @@ class doc extends control $lib = $this->doc->getLibByID($libID); $type = $lib->product ? 'product' : ($lib->project ? 'project' : 'custom'); - $this->libs = $this->doc->getLibs($type); /* According the from, set menus. */ if($this->from == 'product') @@ -310,11 +309,11 @@ class doc extends control } else { - $this->doc->setMenu($this->libs, $libID, $moduleID); + $this->doc->setMenu($libID, $moduleID); } - $this->view->title = $this->libs[$libID] . $this->lang->colon . $this->lang->doc->create; - $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $this->libs[$libID]); + $this->view->title = $lib->name . $this->lang->colon . $this->lang->doc->create; + $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $lib->name); $this->view->position[] = $this->lang->doc->create; $this->view->libID = $libID; @@ -364,15 +363,13 @@ class doc extends control $lib = $this->doc->getLibByID($libID); $type = $lib->product ? 'product' : ($lib->project ? 'project' : 'custom'); - $this->libs = $this->doc->getLibs($type); - $this->doc->setMenu($this->libs, $libID, $doc->module); + $this->doc->setMenu($libID, $doc->module); - $this->view->title = $this->libs[$libID] . $this->lang->colon . $this->lang->doc->edit; - $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $this->libs[$libID]); + $this->view->title = $lib->name . $this->lang->colon . $this->lang->doc->edit; + $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $lib->name); $this->view->position[] = $this->lang->doc->edit; $this->view->doc = $doc; - $this->view->libs = $this->libs; $this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0); $this->view->type = $type; $this->view->groups = $this->loadModel('group')->getPairs(); @@ -403,13 +400,12 @@ class doc extends control /* Check priv when lib is product or project. */ $lib = $this->doc->getLibByID($doc->lib); $type = $lib->product ? 'product' : ($lib->project ? 'project' : 'custom'); - $this->libs = $this->doc->getLibs($type); /* Set menu. */ - $this->doc->setMenu($this->libs, $doc->lib, $doc->module); + $this->doc->setMenu($doc->lib, $doc->module); - $this->view->title = "DOC #$doc->id $doc->title - " . $this->libs[$doc->lib]; - $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $this->libs[$doc->lib]); + $this->view->title = "DOC #$doc->id $doc->title - " . $lib->name; + $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $lib->name); $this->view->position[] = $this->lang->doc->view; $this->view->doc = $doc; @@ -478,13 +474,12 @@ class doc extends control /* Check priv when lib is product or project. */ $lib = $this->doc->getLibByID($newDoc->lib); $type = $lib->product ? 'product' : ($lib->project ? 'project' : 'custom'); - $this->libs = $this->doc->getLibs($type); /* Set menu. */ - $this->doc->setMenu($this->libs, $newDoc->lib, $newDoc->module); + $this->doc->setMenu($newDoc->lib, $newDoc->module); - $this->view->title = "DOC #$newDoc->id $newDoc->title - " . $this->libs[$newDoc->lib]; - $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$newDoc->lib"), $this->libs[$newDoc->lib]); + $this->view->title = "DOC #$newDoc->id $newDoc->title - " . $lib->name; + $this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$newDoc->lib"), $lib->name); $this->view->position[] = $this->lang->doc->view; $this->view->newDoc = $newDoc; @@ -617,16 +612,19 @@ class doc extends control public function allLibs($type, $product = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $libName = isset($this->lang->doc->systemLibs[$type]) ? $this->lang->doc->systemLibs[$type] : $this->lang->doc->custom; + $crumb = html::a(inlink('allLibs', "type=$type&product=$product"), $this->lang->doc->libTypeList[$type]); if($product) { $this->view->product = $this->product->getById($product); $libName = $this->view->product->name; + $crumb = html::a(inlink('objectLibs', "type=product&objectID=$product"), $this->view->product->name); + $crumb .= $this->lang->arrow . html::a(inlink('allLibs', "type=$type&product=$product"), $this->lang->doclib->main[$type]); } $this->view->title = $libName; $this->view->position[] = $libName; - $this->doc->setMenu(array($product ? $libName : $this->lang->doclib->select), 0); + $this->doc->setMenu($libID = 0, $moduleID = 0, $crumb); /* Load pager. */ $this->app->loadClass('pager', $static = true); @@ -679,7 +677,8 @@ class doc extends control } else { - $this->doc->setMenu(array($object->name), 0); + $crumb = html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name); + $this->doc->setMenu($libID = 0, $moduleID = 0, $crumb); } /* Load pager. */ @@ -728,7 +727,8 @@ class doc extends control } else { - $this->doc->setMenu(array($this->lang->doclib->select), 0); + $crumb = html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name); + $this->doc->setMenu($libID = 0, $moduleID = 0, $crumb); } $this->view->title = $object->name; diff --git a/module/doc/model.php b/module/doc/model.php index 4a4951b57f..1f05963dac 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -22,28 +22,10 @@ class docModel extends model * @access public * @return void */ - public function setMenu($libs, $libID = 0, $moduleID = 0) + public function setMenu($libID = 0, $moduleID = 0, $crumb = '') { - if($libID) - { - $lib = $this->getLibById($libID); - if(!$this->checkPriv($lib)) - { - echo(js::alert($this->lang->doc->accessDenied)); - die(js::locate('back')); - } - - if($lib->product or $lib->project) - { - $table = $lib->product ? TABLE_PRODUCT : TABLE_PROJECT; - $objectID = $lib->product ? $lib->product : $lib->project; - $object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch(); - if($object) $libs[$libID] = $object->name . ' / ' . $lib->name; - } - } - $this->app->loadLang('project'); - $selectHtml = "{$libs[$libID]} "; + $selectHtml = "{$this->lang->doclib->all} "; $selectHtml .= "
"; $selectHtml .= ""; $selectHtml .= "
"; @@ -54,7 +36,7 @@ class docModel extends model $selectHtml .= "
{$this->lang->doc->libTypeList['custom']}
"; $selectHtml .= "
"; common::setMenuVars($this->lang->doc->menu, 'list', $selectHtml); - common::setMenuVars($this->lang->doc->menu, 'crumb', $this->getCrumbs($libID, $moduleID)); + common::setMenuVars($this->lang->doc->menu, 'crumb', $crumb ? $crumb : $this->getCrumbs($libID, $moduleID)); } /** @@ -1155,8 +1137,24 @@ class docModel extends model { if(empty($libID)) return ''; + $lib = $this->getLibById($libID); + if(!$this->checkPriv($lib)) + { + echo(js::alert($this->lang->doc->accessDenied)); + die(js::locate('back')); + } + + if($lib->product or $lib->project) + { + $table = $lib->product ? TABLE_PRODUCT : TABLE_PROJECT; + $objectID = $lib->product ? $lib->product : $lib->project; + $object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch(); + $lib->name = $object->name . ' / ' . $lib->name; + } + + $parents = $moduleID ? $this->loadModel('tree')->getParents($moduleID) : array(); - $crumb = html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=all¶m=0&orderBy=id_desc"), ' / '); + $crumb = html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=all¶m=0&orderBy=id_desc"), $lib->name); foreach($parents as $module) $crumb .= $this->lang->arrow . html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=byModule¶m=$module->id&orderBy=id_desc"), $module->name); return $crumb; } diff --git a/module/doc/view/alllibs.html.php b/module/doc/view/alllibs.html.php index f89de48e48..ab7456473f 100644 --- a/module/doc/view/alllibs.html.php +++ b/module/doc/view/alllibs.html.php @@ -11,7 +11,6 @@ */ ?> -
doc->systemLibs[$type]) ? $lang->doc->systemLibs[$type] : $lang->doc->custom?>
diff --git a/module/tree/control.php b/module/tree/control.php index 636d0071a1..51e7473d44 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -94,7 +94,7 @@ class tree extends control elseif(strpos($viewType, 'doc') !== false) { $type = $lib->product ? 'product' : ($lib->project ? 'project' : 'custom'); - $this->doc->setMenu($this->doc->getLibs($type), $rootID, $currentModuleID); + $this->doc->setMenu($rootID, $currentModuleID); $this->lang->tree->menu = $this->lang->doc->menu; $this->lang->tree->menuOrder = $this->lang->doc->menuOrder; $this->lang->set('menugroup.tree', 'doc');