diff --git a/module/api/control.php b/module/api/control.php index 233bd10464..224fc53a78 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -41,12 +41,12 @@ class api extends control */ public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 0, $release = 0, $appendLib = 0, $browseType = '', $param = 0) { - $objectType = $this->objectType; - $objectID = $this->objectID; + $objectType = $this->objectType; + $objectID = $this->objectID; + $isFirstLoad = $libID ? false : true; /* Get all api doc libraries. */ - $loadLib = false; - $libs = $this->doc->getApiLibs($appendLib, $objectType, $objectID); + $libs = $this->doc->getApiLibs($appendLib, $objectType, $objectID); if(empty($libs) and $objectType != 'nolink') { $objectType = 'nolink'; @@ -78,7 +78,6 @@ class api extends control $libID = $lib->id; $objectType = $lib->product ? 'product' : ($lib->project ? 'project' : ''); $objectID = $lib->product ? $lib->product : $lib->project; - if($loadLib) $libs = $this->doc->getApiLibs($appendLib); } /* Get an api doc. */ @@ -112,6 +111,7 @@ class api extends control $this->view->lib = $lib; $this->view->release = $release; + $this->view->isFirstLoad = $isFirstLoad; $this->view->title = $this->lang->api->pageTitle; $this->view->libID = $libID; $this->view->apiID = $apiID; diff --git a/module/doc/control.php b/module/doc/control.php index 7df038341b..3dadc4874e 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1194,7 +1194,7 @@ class doc extends control */ public function tableContents($type = 'custom', $objectID = 0, $libID = 0, $moduleID = 0, $browseType = 'all', $orderBy = 'status,id_desc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1) { - $this->view->isFirstLoad = $objectID == 0 ? 'true' : 'false'; + $isFirstLoad = $libID == 0 ? true : false; $this->session->set('createProjectLocate', $this->app->getURI(true), 'doc'); if(empty($browseType)) $browseType = 'all'; @@ -1252,6 +1252,7 @@ class doc extends control $this->view->type = $type; $this->view->objectType = $type; $this->view->browseType = $browseType; + $this->view->isFirstLoad = $isFirstLoad; $this->view->param = $queryID; $this->view->users = $this->user->getPairs('noletter'); $this->view->libTree = $libTree; diff --git a/module/doc/view/lefttree.html.php b/module/doc/view/lefttree.html.php index 812ba75605..782ea0aa93 100644 --- a/module/doc/view/lefttree.html.php +++ b/module/doc/view/lefttree.html.php @@ -253,7 +253,9 @@ $(function() if(item.active) $li.addClass('active'); } }); - if(isFirstLoad !== 'false') ele.data('zui.tree').collapse(); + + if(isFirstLoad) ele.data('zui.tree').collapse(); + var $leaf = ele.find('li.active'); if($leaf.length) $leaf[$leaf.length - 1].scrollIntoView(false);