diff --git a/module/action/model.php b/module/action/model.php index 672844e097..cd93cd03cf 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1366,7 +1366,7 @@ class actionModel extends model $appendLib = $docLib->deleted == '1' ? $action->objectID : 0; if($docLib->type == 'api') { - $action->objectLink = helper::createLink('api', 'index', "libID={$action->objectID}"); + $action->objectLink = helper::createLink('api', 'index', "libID={$action->objectID}&moduleID=0&apiID=0&version=0&release=0&appendLib={$appendLib}"); } else { diff --git a/module/api/control.php b/module/api/control.php index 3b788b81a7..c36f75a32d 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -22,18 +22,21 @@ class api extends control /** * Api doc index page. * - * @param int $libID - * @param int $moduleID - * @param int $apiID - * @param int $version - * @param int $release + * @param int $libID + * @param int $moduleID + * @param int $apiID + * @param int $version + * @param int $release + * @param int $appendLib * @access public * @return void */ - public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 0, $release = 0) + public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 0, $release = 0, $appendLib = 0) { /* Get all api doc libraries. */ - $libs = $this->doc->getApiLibs(); + $lib = $this->doc->getLibById($libID); + $appendLib = (!empty($lib) and $lib->deleted == '1') ? $libID : 0; + $libs = $this->doc->getApiLibs($appendLib); /* Generate bread crumbs dropMenu. */ if($libs) diff --git a/module/doc/control.php b/module/doc/control.php index a7dfce5c67..07028eae44 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -374,11 +374,11 @@ class doc extends control /** * Edit a doc. * - * @param int $docID - * @param bool $comment - * @param string $objectType - * @param int $objectID - * @param int $libID + * @param int $docID + * @param bool $comment + * @param string $objectType + * @param int $objectID + * @param int $libID * @access public * @return void */ @@ -466,7 +466,8 @@ class doc extends control } $objects = $this->doc->getOrderedObjects($objectType); - $libs = $this->doc->getLibsByObject($objectType, $objectID); + $appendLib = (!empty($lib) and $lib->deleted == '1') ? $libID : 0; + $libs = $this->doc->getLibsByObject($objectType, $objectID, '', $appendLib); $this->lang->modulePageNav = $this->doc->select($objectType, $objects, $objectID, $libs, $libID); $this->lang->TRActions = common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc($objectType, $objectID, $libID) : ''; @@ -1020,7 +1021,7 @@ class doc extends control /* Add the anchor to the element. */ $content[$index] = str_replace('<' . $includeHeadElement[0] . $headElement[2] . '>', '<' . $includeHeadElement[0] . $headElement[2] . " id='anchor{$index}'" . '>', $content[$index]); - $outline .= '
  • ' . html::a('#anchor' . $index, strip_tags($headElement[3]), '', "title='" . strip_tags($headElement[3]) . "'"); + $outline .= '
  • ' . html::a('#anchor' . $index, strip_tags($headElement[3]), '', "title='" . strip_tags($headElement[3]) . "'"); $preElement = $headElement[1]; } @@ -1031,7 +1032,7 @@ class doc extends control /* Add the anchor to the element. */ $content[$index] = str_replace('<' . $includeHeadElement[1] . $headElement[2] . '>', '<' . $includeHeadElement[1] . $headElement[2] . " id='anchor{$index}'" . '>', $content[$index]); - $outline .= '
  • ' . html::a('#anchor' . $index, strip_tags($headElement[3]), '', "title='" . strip_tags($headElement[3]) . "'") . '
  • '; + $outline .= '
  • ' . html::a('#anchor' . $index, strip_tags($headElement[3]), '', "title='" . strip_tags($headElement[3]) . "'") . '
  • '; $preElement = $includeHeadElement[1]; } diff --git a/module/doc/model.php b/module/doc/model.php index 0a74770059..b7890c1816 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -38,14 +38,16 @@ class docModel extends model /** * Get api Libraries. * + * @param int $appendLib * @return array * @author thanatos thanatos915@163.com */ - public function getApiLibs() + public function getApiLibs($appendLib = 0) { $libs = $this->dao->select('*')->from(TABLE_DOCLIB) ->where('deleted')->eq(0) ->andWhere('type')->eq('api') + ->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi() ->orderBy('id_desc') ->fetchAll('id'); $libs = array_filter($libs, array($this, 'checkPrivLib'));