* Modify api doc style.
This commit is contained in:
@@ -22,6 +22,8 @@ class api extends control
|
||||
/**
|
||||
* Api doc index page.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @param int $apiID
|
||||
@@ -33,28 +35,23 @@ class api extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 0, $release = 0, $appendLib = 0, $browseType = '', $param = 0)
|
||||
public function index($objectType = 'nolink', $objectID = 0, $libID = 0, $moduleID = 0, $apiID = 0, $version = 0, $release = 0, $appendLib = 0, $browseType = '', $param = 0)
|
||||
{
|
||||
/* Get all api doc libraries. */
|
||||
$libs = $this->doc->getApiLibs($appendLib);
|
||||
if($libID == 0 and !empty($libs)) $libID = key($libs);
|
||||
$libs = $this->doc->getApiLibs($appendLib, $objectType, $objectID);
|
||||
if($libID == 0 and !empty($libs))
|
||||
{
|
||||
$lib = current($libs);
|
||||
$libID = $lib->id;
|
||||
$objectType = $lib->product ? 'product' : ($lib->project ? 'project' : '');
|
||||
$objectID = $lib->product ? $lib->product : $lib->project;
|
||||
}
|
||||
|
||||
/* Get an api doc. */
|
||||
if($apiID > 0)
|
||||
{
|
||||
$api = $this->api->getLibById($apiID, $version, $release);
|
||||
if($api)
|
||||
{
|
||||
$moduleID = $api->module;
|
||||
$libID = $api->lib;
|
||||
$api->desc = htmlspecialchars_decode($api->desc);
|
||||
|
||||
$this->view->api = $api;
|
||||
$this->view->apiID = $apiID;
|
||||
$this->view->version = $version;
|
||||
$this->view->typeList = $this->api->getTypeList($api->lib);
|
||||
$this->view->actions = $apiID ? $this->action->getList('api', $apiID) : array();
|
||||
}
|
||||
echo $this->fetch('api', 'view', "libID=$libID&apiID=$apiID&moduleID=$moduleID&release=$release&version=$version");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -68,15 +65,9 @@ class api extends control
|
||||
$lib = $this->doc->getLibById($libID);
|
||||
$appendLib = (!empty($lib) and $lib->deleted == '1') ? $libID : 0;
|
||||
|
||||
/* Generate bread crumbs dropMenu. */
|
||||
if($libs) $this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID, $release);
|
||||
|
||||
$this->setMenu($libID, $moduleID);
|
||||
$this->lang->TRActions = '<a class="btn btn-link querybox-toggle" id="bysearchTab"><i class="icon icon-search muted"></i> ' . $this->lang->api->search . '</a>' . $this->lang->TRActions;
|
||||
|
||||
/* Build the search form. */
|
||||
$queryID = $browseType == 'bySearch' ? (int)$param : 0;
|
||||
$actionURL = $this->createLink('api', 'index', "libID=$libID&moduleID=0&apiID=0&version=0&release=0&appendLib=0&browseType=bySearch¶m=myQueryID");
|
||||
$actionURL = $this->createLink('api', 'index', "objectType=$objectType&objectID=$objectID&libID=$libID&moduleID=0&apiID=0&version=0&release=0&appendLib=0&browseType=bySearch¶m=myQueryID");
|
||||
$this->api->buildSearchForm($lib,$queryID, $actionURL);
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
@@ -93,12 +84,46 @@ class api extends control
|
||||
$this->view->apiID = $apiID;
|
||||
$this->view->libs = $libs;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->moduleTree = $libID ? $this->doc->getApiModuleTree($libID, $apiID, $release, $moduleID) : '';
|
||||
$this->view->objectType = $objectType;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->libTree = $this->loadModel('doc')->getLibTree($libID, $libs, 'api', $objectID);
|
||||
$this->view->users = $this->user->getPairs('noclosed,noletter');
|
||||
$this->view->objectDropdown = $this->generateLibsDropMenu($libs[$libID], $release);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function view($libID, $apiID, $moduleID = 0, $release = 0, $version = 0)
|
||||
{
|
||||
/* Get all api doc libraries. */
|
||||
$libs = $this->doc->getApiLibs($libID);
|
||||
|
||||
$api = $this->api->getLibById($apiID, $version, $release);
|
||||
if($api)
|
||||
{
|
||||
$moduleID = $api->module;
|
||||
$libID = $api->lib;
|
||||
$api->desc = htmlspecialchars_decode($api->desc);
|
||||
|
||||
$this->view->api = $api;
|
||||
$this->view->apiID = $apiID;
|
||||
$this->view->version = $version;
|
||||
$this->view->typeList = $this->api->getTypeList($api->lib);
|
||||
$this->view->actions = $apiID ? $this->action->getList('api', $apiID) : array();
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->api->pageTitle;
|
||||
$this->view->libs = $libs;
|
||||
$this->view->isRelease = $release > 0;
|
||||
$this->view->release = $release;
|
||||
$this->view->libID = $libID;
|
||||
$this->view->apiID = $apiID;
|
||||
$this->view->users = $this->user->getPairs('noclosed,noletter');
|
||||
$this->view->moduleTree = $this->doc->getApiModuleTree($libID, $apiID, $release, $moduleID);
|
||||
$this->view->objectDropdown = $this->generateLibsDropMenu($libs[$libID], $release);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Release list.
|
||||
*
|
||||
@@ -110,7 +135,7 @@ class api extends control
|
||||
{
|
||||
$libs = $this->doc->getApiLibs();
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID);
|
||||
$this->lang->modulePageNav = $this->generateLibsDropMenu($libs[$libID]);
|
||||
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
@@ -198,7 +223,7 @@ class api extends control
|
||||
{
|
||||
$libs = $this->doc->getApiLibs();
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID, $releaseID);
|
||||
$this->lang->modulePageNav = $this->generateLibsDropMenu($libs[$libID], $releaseID);
|
||||
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
@@ -615,7 +640,7 @@ class api extends control
|
||||
*/
|
||||
private function setMenu($libID = 0, $moduleID = 0)
|
||||
{
|
||||
common::setMenuVars('doc', $libID);
|
||||
common::setMenuVars('doc', '');
|
||||
|
||||
/* Global struct link. */
|
||||
$menu = '';
|
||||
@@ -658,76 +683,38 @@ class api extends control
|
||||
/**
|
||||
* Generate api doc index page dropMenu
|
||||
*
|
||||
* @param array $libs
|
||||
* @param int $libID
|
||||
* @param object $lib
|
||||
* @param int $version
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
private function generateLibsDropMenu($libs, $libID, $version = 0)
|
||||
private function generateLibsDropMenu($lib, $version = 0)
|
||||
{
|
||||
if(empty($libs)) return '';
|
||||
if(!isset($libs[$libID])) return '';
|
||||
if(empty($lib)) return '';
|
||||
|
||||
$methodName = $this->app->rawMethod;
|
||||
|
||||
$libName = $libs[$libID]->name;
|
||||
$output = <<<EOT
|
||||
<div class='btn-group angle-btn'>
|
||||
<div class='btn-group'>
|
||||
<button id='currentBranch' data-toggle='dropdown' type='button' class='btn btn-limit'><div class='nobr'>{$libName}</div> <span class='caret'></span>
|
||||
</button>
|
||||
<div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>
|
||||
<div class="input-control search-box has-icon-left has-icon-right search-example">
|
||||
<input type="search" class="form-control search-input" />
|
||||
<label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
|
||||
<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>
|
||||
</div>
|
||||
<div class='table-col'>
|
||||
<div class='list-group'>
|
||||
EOT;
|
||||
foreach($libs as $key => $lib)
|
||||
$objectTitle = $this->lang->api->noLinked;
|
||||
$objectType = 'nolink';
|
||||
$objectID = 0;
|
||||
if($lib->product)
|
||||
{
|
||||
$selected = $key == $libID ? 'selected' : '';
|
||||
$output .= html::a(inlink($methodName, "libID=$key"), $lib->name, '', "class='$selected' data-app='{$this->app->tab}'");
|
||||
$objectType = 'product';
|
||||
$objectID = $lib->product;
|
||||
$product = $this->loadModel('product')->getByID($objectID);
|
||||
$objectTitle = zget($product, 'name', '');
|
||||
}
|
||||
if(count($libs) >= 2 and common::hasPriv('doc', 'sortLibs'))
|
||||
elseif($lib->project)
|
||||
{
|
||||
$output .= '<li class="divider"></li>';
|
||||
$output .= html::a($this->createLink('doc', 'sortLibs', "type=api&objectID=0", '', true), "<i class='icon-move'></i> {$this->lang->doc->sortLibs}", '', "data-title='{$this->lang->doc->sortLibs}' data-toggle='modal' data-type='iframe' data-width='400px' data-app='{$this->app->tab}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
|
||||
/* Get lib version */
|
||||
$versions = $this->api->getReleaseListByApi($libID);
|
||||
if(!empty($versions))
|
||||
{
|
||||
$versionName = $version > 0 ? $versions[$version]->version : $this->lang->api->defaultVersion;
|
||||
$output .= <<<EOT
|
||||
<div class='btn-group angle-btn'>
|
||||
<div class='btn-group'>
|
||||
<button id='currentBranch' data-toggle='dropdown' type='button' class='btn btn-limit'><div class='nobr'>{$versionName}</div> <span class='caret'></span>
|
||||
</button>
|
||||
<div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>
|
||||
<div class="input-control search-box has-icon-left has-icon-right search-example">
|
||||
<input type="search" class="form-control search-input" />
|
||||
<label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
|
||||
<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>
|
||||
</div>
|
||||
<div class='table-col'>
|
||||
<div class='list-group'>
|
||||
EOT;
|
||||
$params = $methodName == 'index' ? "libID=$libID&moduleID=0&apiID=0&version=0" : "libID=$libID";
|
||||
$selected = $version > 0 ? '' : 'selected';
|
||||
$output .= html::a(inlink($methodName, $params . "&release=0"), $this->lang->api->defaultVersion, '', "class='$selected'");
|
||||
foreach($versions as $key => $item)
|
||||
{
|
||||
$selected = $key == $version ? 'selected' : '';
|
||||
$output .= html::a(inlink($methodName, $params . "&release=$key"), $item->version, '', "class='$selected' data-app='{$this->app->tab}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
$objectType = 'project';
|
||||
$objectID = $lib->project;
|
||||
$project = $this->loadModel('project')->getByID($objectID);
|
||||
$objectTitle = zget($project, 'name', '');
|
||||
}
|
||||
|
||||
$dropMenuLink = helper::createLink('api', 'ajaxGetDropMenu', "objectType=$objectType&objectID=$objectID&libID=$lib->id&version=$version");
|
||||
|
||||
$output = "<div class='btn-group selectBox' id='swapper'><button data-toggle='dropdown' type='button' class='btn' id='currentItem' title='{$objectTitle}'><span class='text'>{$objectTitle}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "</div></div>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -862,4 +849,35 @@ EOT;
|
||||
}
|
||||
$this->view->typeOptions = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get objectType drop menu.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetDropMenu($objectType, $objectID, $module, $method)
|
||||
{
|
||||
list($normalObjects, $closedObjects) = $this->api->getOrderedObjects($objectType, 'nomerge', 'api');
|
||||
|
||||
$titleList = array($this->lang->api->noLinked);
|
||||
$titleList += array_values($normalObjects['product']);
|
||||
$titleList += array_values($normalObjects['project']);
|
||||
$titleList += array_values($closedObjects['product']);
|
||||
$titleList += array_values($closedObjects['project']);
|
||||
|
||||
$this->view->objectType = $objectType;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->module = $module;
|
||||
$this->view->method = $method;
|
||||
$this->view->normalObjects = array($this->lang->api->noLinked) + $normalObjects;
|
||||
$this->view->closedObjects = $closedObjects;
|
||||
$this->view->objectsPinYin = common::convert2Pinyin($titleList);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,3 +102,75 @@ form .table-data, #content .table-data {border: 1px solid #e2e2e3;}
|
||||
.table-data thead {background: #f9f9f9;}
|
||||
|
||||
#aclBox .acl-tip {color: #838a9d;}
|
||||
.lib {width: 130px; margin-bottom: 10px;}
|
||||
.addbtn {padding-top: 22px; height: 63px; border: 1px dashed #ddd; width: 60px;}
|
||||
.addbtn .icon-plus {font-size: 18px; display: block; opacity: 0.5; transition: opacity .2s; text-shadow: 1px 1px 3px rgba(0,0,0,.2);}
|
||||
.addbtn:hover .icon-plus {opacity: .9; animation: flash-icon 1s linear alternate infinite;}
|
||||
#subHeader #dropMenu {min-width: 250px; box-sizing: inhert; max-height: inherit;}
|
||||
#subHeader #dropMenu .table-col .list-group {padding-top: 10px;}
|
||||
.main-col .block-files .panel-heading {padding-right: 20px;}
|
||||
.main-col .block-files .panel-heading .panel-title {height: 35px; line-height: 30px;}
|
||||
.side-col .action a {margin: 0 auto 3px; display: block; max-width: 200px;}
|
||||
.side-col .tips {padding: 0 10px;}
|
||||
.main-col .doc-title {display: flex; font-size: 16px; margin-bottom: 15px;}
|
||||
.main-col .doc-title .title {margin: 0; line-height: 30px; font-size: 25px;}
|
||||
.main-col .doc-title .http-method {line-height: 27px; height: 27px; font-size: 13px; margin-right: 10px; padding: 0 10px;}
|
||||
.main-col .doc-title .path {line-height: 30px; font-size: 20px; margin-right: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
|
||||
.main-col .doc-title .info {flex: 1 1 0;}
|
||||
.main-col .doc-title .version a {font-size: 13px; color: #8c8c8c;}
|
||||
.main-col .doc-title .version .dropdown-menu a:hover {color: #ffffff;}
|
||||
.main-col .doc-title .actions {min-width: 120px; display: inline-block;}
|
||||
.main-col .doc-title .actions a + a {margin-left: 8px;}
|
||||
.main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;}
|
||||
#content h2.title {margin: 0; font-size: 17px;}
|
||||
#content h3.title {font-weight: 500; font-size: 17px!important;}
|
||||
#content .desc {margin: 10px 0; color: #57585b; word-wrap: break-word;}
|
||||
#content .detail-content {padding-left: 10px;}
|
||||
#mainContent .scrollbar-hover {max-height: 2000px; overflow: scroll;}
|
||||
#sidebar {width: 275px;}
|
||||
#sidebar>.cell {width: 100%;}
|
||||
#sidebar>.sidebar-toggle {left: 3px; right: auto;}
|
||||
.hide-sidebar #sidebar>.cell {display: none;}
|
||||
.hide-sidebar #sidebar>.sidebar-toggle>.icon:before {content: "\e314";}
|
||||
.detail.empty {line-height: 200px;}
|
||||
.main-col+.side-col {padding-left: 16px;}
|
||||
.main-col iframe {min-height: 380px;}
|
||||
.article-content .keywords {margin-bottom: 15px;}
|
||||
|
||||
.article-content {width: 100%; display: inline-block;}
|
||||
.outline {position: relative;}
|
||||
.outline .outline-toggle i.icon-angle-right, i.icon-angle-left {width: 18px; height: 18px; border-radius: 50%; position: absolute; padding-left: 2px; padding-top: 1px;}
|
||||
.outline .outline-toggle i.icon-angle-right:before {content: "\e314"; cursor: pointer;}
|
||||
.outline .outline-toggle i.icon-angle-left:before {content: "\e315"; cursor: pointer;}
|
||||
.outline ul li {list-style: none;}
|
||||
.outline-content {display: none; padding-top: 18px;}
|
||||
.outline-content a {color: #838A9D;}
|
||||
.outline-content li.text-ellipsis.active>a {font-weight: 700; color: #0c64eb;}
|
||||
#outline li.has-list.open:before {content: unset;}
|
||||
|
||||
.article-content.comment {width: 100% !important;}
|
||||
|
||||
.cell .detail .detail-title {padding-left: 5px; list-style: none;}
|
||||
.menu-actions {top: 5px!important; right: 45px;}
|
||||
.no-content {width: 100px; height: 100px; margin: 0 auto;}
|
||||
.notice {text-align: center; padding-left: 15px; padding-top: 20px;}
|
||||
.no-content-button {text-align: center; padding-top: 20px;}
|
||||
.no-content-button a:nth-child(2) {margin-left: 20px;}
|
||||
|
||||
.paramsTable th {text-align: left!important; font-size: 14px;}
|
||||
.paramsTable td {text-align: left;}
|
||||
|
||||
.tree-group {position: relative;}
|
||||
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
|
||||
.tree li.active > .tree-group a {font-weight: 700; color: #0c64eb;}
|
||||
.tree-actions {display: inline-block; margin-left: 5px; vertical-align: middle;}
|
||||
.tree-group .tree-actions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
|
||||
.tree-group:hover .tree-actions {display: block}
|
||||
.tree-actions a {display: inline-block; margin-left: 5px; font-size: 13px; opacity: .6;}
|
||||
.tree li.active > .tree-group a {font-weight: 700; color: #0c64eb;}
|
||||
|
||||
.base-url {margin: 0; border-bottom: 1px solid #eee;}
|
||||
.base-url > p {margin: 0; padding-left: 20px; color: black;}
|
||||
.detail+.detail {border-top: 0px;}
|
||||
.menu-title {display: flex; align-items: center; justify-content: space-between;}
|
||||
.vision-drop.dropdown {padding-right: 35px;}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
.lib {width: 130px; margin-bottom: 10px;}
|
||||
.addbtn {padding-top: 22px; height: 63px; border: 1px dashed #ddd; width: 60px;}
|
||||
.addbtn .icon-plus {font-size: 18px; display: block; opacity: 0.5; transition: opacity .2s; text-shadow: 1px 1px 3px rgba(0,0,0,.2);}
|
||||
.addbtn:hover .icon-plus {opacity: .9; animation: flash-icon 1s linear alternate infinite;}
|
||||
#subHeader #dropMenu {min-width: 250px; box-sizing: inhert; max-height: inherit;}
|
||||
#subHeader #dropMenu .table-col .list-group {padding-top: 10px;}
|
||||
.main-col .block-files .panel-heading {padding-right: 20px;}
|
||||
.main-col .block-files .panel-heading .panel-title {height: 35px; line-height: 30px;}
|
||||
.side-col .action a {margin: 0 auto 3px; display: block; max-width: 200px;}
|
||||
.side-col .tips {padding: 0 10px;}
|
||||
.main-col .doc-title {display: flex; font-size: 16px; margin-bottom: 15px;}
|
||||
.main-col .doc-title .title {margin: 0; line-height: 30px; font-size: 25px;}
|
||||
.main-col .doc-title .http-method {line-height: 27px; height: 27px; font-size: 13px; margin-right: 10px; padding: 0 10px;}
|
||||
.main-col .doc-title .path {line-height: 30px; font-size: 20px; margin-right: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
|
||||
.main-col .doc-title .info {flex: 1 1 0;}
|
||||
.main-col .doc-title .version a {font-size: 13px; color: #8c8c8c;}
|
||||
.main-col .doc-title .version .dropdown-menu a:hover {color: #ffffff;}
|
||||
.main-col .doc-title .actions {min-width: 120px; display: inline-block;}
|
||||
.main-col .doc-title .actions a + a {margin-left: 8px;}
|
||||
.main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;}
|
||||
#content h2.title {margin: 0; font-size: 17px;}
|
||||
#content h3.title {font-weight: 500; font-size: 17px!important;}
|
||||
#content .desc {margin: 10px 0; color: #57585b; word-wrap: break-word;}
|
||||
#content .detail-content {padding-left: 10px;}
|
||||
#mainContent .scrollbar-hover {max-height: 2000px; overflow: scroll;}
|
||||
#sidebar {width: 275px;}
|
||||
#sidebar>.cell {width: 100%;}
|
||||
#sidebar>.sidebar-toggle {left: 3px; right: auto;}
|
||||
.hide-sidebar #sidebar>.cell {display: none;}
|
||||
.hide-sidebar #sidebar>.sidebar-toggle>.icon:before {content: "\e314";}
|
||||
.detail.empty {line-height: 200px;}
|
||||
.main-col+.side-col {padding-left: 16px;}
|
||||
.main-col iframe {min-height: 380px;}
|
||||
.article-content .keywords {margin-bottom: 15px;}
|
||||
|
||||
.article-content {width: 100%; display: inline-block;}
|
||||
.outline {position: relative;}
|
||||
.outline .outline-toggle i.icon-angle-right, i.icon-angle-left {width: 18px; height: 18px; border-radius: 50%; position: absolute; padding-left: 2px; padding-top: 1px;}
|
||||
.outline .outline-toggle i.icon-angle-right:before {content: "\e314"; cursor: pointer;}
|
||||
.outline .outline-toggle i.icon-angle-left:before {content: "\e315"; cursor: pointer;}
|
||||
.outline ul li {list-style: none;}
|
||||
.outline-content {display: none; padding-top: 18px;}
|
||||
.outline-content a {color: #838A9D;}
|
||||
.outline-content li.text-ellipsis.active>a {font-weight: 700; color: #0c64eb;}
|
||||
#outline li.has-list.open:before {content: unset;}
|
||||
|
||||
.article-content.comment {width: 100% !important;}
|
||||
|
||||
.cell .detail .detail-title {padding-left: 5px; list-style: none;}
|
||||
.menu-actions {top: 5px!important; right: 45px;}
|
||||
.no-content {width: 100px; height: 100px; margin: 0 auto;}
|
||||
.notice {text-align: center; padding-left: 15px; padding-top: 20px;}
|
||||
.no-content-button {text-align: center; padding-top: 20px;}
|
||||
.no-content-button a:nth-child(2) {margin-left: 20px;}
|
||||
|
||||
.paramsTable th {text-align: left!important; font-size: 14px;}
|
||||
.paramsTable td {text-align: left;}
|
||||
|
||||
.tree-group {position: relative;}
|
||||
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
|
||||
.tree li.active > .tree-group a {font-weight: 700; color: #0c64eb;}
|
||||
.tree-actions {display: inline-block; margin-left: 5px; vertical-align: middle;}
|
||||
.tree-group .tree-actions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
|
||||
.tree-group:hover .tree-actions {display: block}
|
||||
.tree-actions a {display: inline-block; margin-left: 5px; font-size: 13px; opacity: .6;}
|
||||
.tree li.active > .tree-group a {font-weight: 700; color: #0c64eb;}
|
||||
|
||||
.base-url {margin: 0; border-bottom: 1px solid #eee;}
|
||||
.base-url > p {margin: 0; padding-left: 20px; color: black;}
|
||||
.detail+.detail {border-top: 0px;}
|
||||
.menu-title {display: flex; align-items: center; justify-content: space-between;}
|
||||
.vision-drop.dropdown {padding-right: 35px;}
|
||||
@@ -15,6 +15,68 @@ $(document).ready(function()
|
||||
$('#outline li.has-list>i+ul').prev('i').remove();
|
||||
});
|
||||
});
|
||||
|
||||
$('#fileTree').tree(
|
||||
{
|
||||
initialState: 'active',
|
||||
data: treeData,
|
||||
itemCreator: function($li, item)
|
||||
{
|
||||
var libClass = 'lib';
|
||||
var hasChild = item.children ? !!item.children.length : false;
|
||||
var $item = '<a href="###" style="position: relative" data-has-children="' + hasChild + '" title="' + item.name + '" data-id="' + item.id + '" class="' + libClass + '" data-type="' + item.type + '">';
|
||||
$item += '<div class="text h-full w-full flex-start overflow-hidden">';
|
||||
if(libClass == 'lib') $item += '<div class="img-lib"></div>';
|
||||
$item += '<span style="padding-left: 5px;">';
|
||||
$item += item.name
|
||||
$item += '</span>';
|
||||
$item += '<i class="icon icon-drop icon-ellipsis-v hidden tree-icon" data-isCatalogue="' + (item.type ? false : true) + '"></i>';
|
||||
$item += '</div>';
|
||||
$item += '</a>';
|
||||
|
||||
$li.append($item);
|
||||
$li.addClass(libClass);
|
||||
if(item.active) $li.addClass('active open in');
|
||||
}
|
||||
});
|
||||
|
||||
$('li.has-list > ul, #fileTree').addClass("menu-active-primary menu-hover-primary");
|
||||
|
||||
$('#fileTree').on('mousemove', 'a', function()
|
||||
{
|
||||
if($(this).data('type') == 'annex') return;
|
||||
|
||||
var libClass = '.libDorpdown';
|
||||
if(!$(this).hasClass('lib')) libClass = '.moduleDorpdown';
|
||||
if($(libClass).find('li').length == 0) return false;
|
||||
|
||||
$(this).find('.icon').removeClass('hidden');
|
||||
$(this).addClass('show-icon');
|
||||
}).on('mouseout', 'a', function()
|
||||
{
|
||||
$(this).find('.icon').addClass('hidden');
|
||||
$(this).removeClass('show-icon');
|
||||
}).on('click', 'a', function(e)
|
||||
{
|
||||
var isLib = $(this).hasClass('lib');
|
||||
var moduleID = $(this).data('id');
|
||||
var libID = 0;
|
||||
var params = '';
|
||||
|
||||
if(isLib)
|
||||
{
|
||||
if($(this).data('type') == 'annex') return false;
|
||||
|
||||
libID = moduleID;
|
||||
moduleID = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
libID = $(this).closest('.lib').data('id');
|
||||
}
|
||||
linkParams = linkParams.replace('%s', '&libID=' + libID + '&moduleID=' + moduleID);
|
||||
location.href = createLink('doc', 'tableContents', linkParams);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,6 +61,7 @@ $lang->api->defaultVersion = "Current Version";
|
||||
$lang->api->zentaoAPI = "Zentao API v1";
|
||||
$lang->api->search = "Search";
|
||||
$lang->api->allLibs = "AllLibs";
|
||||
$lang->api->noLinked = "No Linked";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = 'Whitelist';
|
||||
|
||||
@@ -61,6 +61,7 @@ $lang->api->defaultVersion = "Current Version";
|
||||
$lang->api->zentaoAPI = "Zentao API v1";
|
||||
$lang->api->search = "Search";
|
||||
$lang->api->allLibs = "AllLibs";
|
||||
$lang->api->noLinked = "No Linked";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = 'Whitelist';
|
||||
|
||||
@@ -61,6 +61,7 @@ $lang->api->defaultVersion = "Current Version";
|
||||
$lang->api->zentaoAPI = "Zentao API v1";
|
||||
$lang->api->search = "Search";
|
||||
$lang->api->allLibs = "AllLibs";
|
||||
$lang->api->noLinked = "No Linked";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = 'Whitelist';
|
||||
|
||||
@@ -13,13 +13,13 @@ $lang->api->common = 'API接口';
|
||||
$lang->api->getModel = '超级model调用接口';
|
||||
$lang->api->sql = 'SQL查询接口';
|
||||
|
||||
$lang->api->index = '接口库主页';
|
||||
$lang->api->editLib = '编辑接口库';
|
||||
$lang->api->index = '库主页';
|
||||
$lang->api->editLib = '编辑库';
|
||||
$lang->api->releases = '版本管理';
|
||||
$lang->api->deleteRelease = '删除版本';
|
||||
$lang->api->deleteLib = '删除接口库';
|
||||
$lang->api->deleteLib = '删除库';
|
||||
$lang->api->createRelease = '发布接口';
|
||||
$lang->api->createLib = '创建接口库';
|
||||
$lang->api->createLib = '创建库';
|
||||
$lang->api->createApi = '创建接口';
|
||||
$lang->api->createAB = '创建';
|
||||
$lang->api->createDemo = '导入禅道API';
|
||||
@@ -35,9 +35,9 @@ $lang->api->result = '返回结果';
|
||||
$lang->api->status = '状态';
|
||||
$lang->api->data = '内容';
|
||||
$lang->api->noParam = 'GET方式调试不需要输入参数,';
|
||||
$lang->api->noModule = '接口库下没有目录,请先维护目录';
|
||||
$lang->api->noModule = '库下没有目录,请先维护目录';
|
||||
$lang->api->post = 'POST方式调试请参照页面表单';
|
||||
$lang->api->noUniqueName = '接口库名已存在。';
|
||||
$lang->api->noUniqueName = '库名已存在。';
|
||||
$lang->api->noUniqueVersion = '版本已存在。';
|
||||
$lang->api->version = '版本';
|
||||
$lang->api->createStruct = '创建数据结构';
|
||||
@@ -45,7 +45,7 @@ $lang->api->editStruct = '编辑数据结构';
|
||||
$lang->api->deleteStruct = '删除数据结构';
|
||||
$lang->api->create = '创建接口';
|
||||
$lang->api->title = '接口名称';
|
||||
$lang->api->pageTitle = '接口库';
|
||||
$lang->api->pageTitle = '库';
|
||||
$lang->api->module = '目录';
|
||||
$lang->api->apiDoc = '接口';
|
||||
$lang->api->manageType = '维护目录';
|
||||
@@ -55,12 +55,13 @@ $lang->api->done = '开发完成';
|
||||
$lang->api->basicInfo = '基本信息';
|
||||
$lang->api->apiDesc = '接口说明';
|
||||
$lang->api->confirmDelete = "您确定删除该接口吗?";
|
||||
$lang->api->confirmDeleteLib = "您确定删除该接口库吗?";
|
||||
$lang->api->confirmDeleteLib = "您确定删除该库吗?";
|
||||
$lang->api->filterStruct = "使用数据结构填充";
|
||||
$lang->api->defaultVersion = "当前版本";
|
||||
$lang->api->zentaoAPI = "禅道API文档v1";
|
||||
$lang->api->search = "搜索";
|
||||
$lang->api->allLibs = "全部接口库";
|
||||
$lang->api->allLibs = "全部库";
|
||||
$lang->api->noLinked = "无关联";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = '白名单';
|
||||
@@ -107,7 +108,7 @@ $lang->api->baseUrl = '请求基础路径';
|
||||
$lang->api->baseUrlDesc = '网址或者路径,比如 test.zentao.net 或者 /v1';
|
||||
$lang->api->desc = '描述';
|
||||
$lang->api->control = '访问控制';
|
||||
$lang->api->noLib = '暂时没有接口库。';
|
||||
$lang->api->noLib = '暂时没有库。';
|
||||
$lang->api->noApi = '暂时没有接口。';
|
||||
$lang->api->noStruct = '暂时没有数据结构。';
|
||||
$lang->api->lib = '所属库';
|
||||
|
||||
@@ -978,4 +978,62 @@ class apiModel extends model
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ordered objects for dic.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getOrderedObjects()
|
||||
{
|
||||
$normalObjects = $closedObjects = array('product' => array(), 'project' => array());
|
||||
|
||||
$products = $this->dao->select('t1.id, t1.name, t1.status')->from(TABLE_PRODUCT)->alias('t1')
|
||||
->leftjoin(TABLE_DOCLIB)->alias('t2')->on('t2.product=t1.id')
|
||||
->where('t2.id')->gt(0)
|
||||
->andWhere('t1.vision')->eq($this->config->vision)
|
||||
->andWhere('t2.vision')->eq($this->config->vision)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.type')->eq('api')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->products)->fi()
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($products as $id => $product)
|
||||
{
|
||||
if($product->status == 'normal')
|
||||
{
|
||||
$normalObjects['product'][$id] = $product->name;
|
||||
}
|
||||
elseif($product->status == 'closed')
|
||||
{
|
||||
$closedObjects['product'][$id] = $product->name;
|
||||
}
|
||||
}
|
||||
|
||||
$projects = $this->dao->select('t1.id, t1.name, t1.status')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftjoin(TABLE_DOCLIB)->alias('t2')->on('t2.project=t1.id')
|
||||
->where('t2.id')->gt(0)
|
||||
->andWhere('t1.vision')->eq($this->config->vision)
|
||||
->andWhere('t2.vision')->eq($this->config->vision)
|
||||
->andWhere('t2.type')->eq('api')
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->projects)->fi()
|
||||
->orderBy('t1.hasProduct_asc')
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($projects as $id => $project)
|
||||
{
|
||||
if($project->status != 'done' and $project->status != 'closed')
|
||||
{
|
||||
$normalObjects['project'][$id] = $project->name;
|
||||
}
|
||||
else if($project->status == 'done' or $project->status == 'closed')
|
||||
{
|
||||
$closedObjects['project'][$id] = $project->name;
|
||||
}
|
||||
}
|
||||
|
||||
return array($normalObjects, $closedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
140
module/api/view/ajaxgetdropmenu.html.php
Normal file
140
module/api/view/ajaxgetdropmenu.html.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<style>
|
||||
#tabContent {margin-top: 5px; max-width: 220px}
|
||||
.objectTree ul {list-style: none; margin: 0}
|
||||
.objectTree .objects>ul>li>div {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center;}
|
||||
.objectTree li>a, div.hide-in-search>a {display: block; padding: 2px 10px 2px 5px; overflow: hidden; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px;}
|
||||
.objectTree .tree li>.list-toggle {line-height: 24px;}
|
||||
.objectTree .tree li.has-list.open:before {content: unset;}
|
||||
|
||||
#swapper li>div.hide-in-search>a:focus, #swapper li>div.hide-in-search>a:hover {color: #838a9d; cursor: default;}
|
||||
#swapper li > a {margin-top: 4px; margin-bottom: 4px;}
|
||||
#swapper li {padding-top: 0; padding-bottom: 0;}
|
||||
#swapper .tree li>.list-toggle {top: -1px;}
|
||||
|
||||
#closed {width: 90px; height: 25px; line-height: 25px; background-color: #ddd; color: #3c495c; text-align: center; margin-left: 15px; border-radius: 2px;}
|
||||
#gray-line {width: 230px;height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;}
|
||||
#dropMenu.has-search-text .hide-in-search {display: flex;}
|
||||
#swapper li>.selected {color: #0c64eb!important; background: #e9f2fb!important;}
|
||||
.tree-product:last-child {border-bottom: 1px solid #eee;}
|
||||
</style>
|
||||
<?php
|
||||
$normalObjectsHtml = '<ul class="tree noProgram">';
|
||||
$closedObjectsHtml = '<ul class="tree noProgram">';
|
||||
$link = $this->createLink('api', 'index', "obejctType=%s&objectID=%s");
|
||||
$selected = $objectType == 'nolink' ? 'selected' : '';
|
||||
|
||||
$normalObjectsHtml .= "<li>" . html::a(sprintf($link, 'nolink', 0), $lang->api->noLinked, '', "class='clickable $selected' title='{$lang->api->noLinked}' data-key='" . zget($objectsPinYin, $lang->api->noLinked, '') . "'") . '</li>';
|
||||
$normalObjectsHtml .= '<li class="divider"></li>';
|
||||
foreach(array('product', 'project') as $moduleType)
|
||||
{
|
||||
foreach($normalObjects[$moduleType] as $normalObjectID => $normalObjectName)
|
||||
{
|
||||
$selected = $normalObjectID == $objectID ? 'selected' : '';
|
||||
$normalObjectsHtml .= "<li>" . html::a(sprintf($link, $moduleType, $normalObjectID), "<i class='icon icon-$moduleType'></i> $normalObjectName", '', "class='$selected clickable' title='{$normalObjectName}' data-key='" . zget($objectsPinYin, $normalObjectName, '') . "'") . '</li>';
|
||||
}
|
||||
|
||||
foreach($closedObjects[$moduleType] as $closedObjectID => $closedObjectName)
|
||||
{
|
||||
$selected = $closedObjectID == $objectID ? 'selected' : '';
|
||||
$closedObjectsHtml .= '<li>' . html::a(sprintf($link, $moduleType, $closedObjectID), "<i class='icon icon-$moduleType'></i> $closedObjectName", '', "class='$selected clickable' title='{$closedObjectName}' data-key='" . zget($objectsPinYin, $closedObjectName, '') . "'") . '</li>';
|
||||
}
|
||||
if($moduleType == 'product')
|
||||
{
|
||||
if($normalObjects['project']) $normalObjectsHtml .= '<li class="divider"></li>';
|
||||
if($closedObjects['project']) $closedObjectsHtml .= '<li class="divider"></li>';
|
||||
}
|
||||
}
|
||||
$normalObjectsHtml .= '</ul>';
|
||||
$closedObjectsHtml .= '</ul>';
|
||||
?>
|
||||
|
||||
<div class="table-row">
|
||||
<div class="table-col <?php if($closedObjects['product'] or $closedObjects['project']) echo 'col-left'?>">
|
||||
<div class='list-group'>
|
||||
<div class="tab-content objectTree" id="tabContent">
|
||||
<div class="tab-pane objects active">
|
||||
<?php echo $normalObjectsHtml;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($closedObjects['product'] or $closedObjects['project']):?>
|
||||
<div class="col-footer">
|
||||
<a class='pull-right toggle-right-col not-list-item'><?php echo $lang->doc->closed?><i class='icon icon-angle-right'></i></a>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<div id="gray-line" hidden></div>
|
||||
<div id="closed" hidden><?php echo $lang->doc->closed?></div>
|
||||
<div class="table-col col-right objectTree">
|
||||
<div class='list-group objects'><?php echo $closedObjectsHtml;?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#swapper [data-ride="tree"]').tree('expand');
|
||||
|
||||
<?php if(isset($closedObjects[$objectID])):?>
|
||||
$('.col-footer .toggle-right-col').click(function(){ scrollToSelected(); })
|
||||
<?php else:?>
|
||||
scrollToSelected();
|
||||
<?php endif;?>
|
||||
|
||||
$('.nav-tabs li span').hide();
|
||||
$('.nav-tabs li.active').find('span').show();
|
||||
|
||||
$('.nav-tabs>li a').click(function()
|
||||
{
|
||||
if($('#swapper input[type="search"]').val() == '')
|
||||
{
|
||||
$(this).siblings().show();
|
||||
$(this).parent().siblings('li').find('span').hide();
|
||||
}
|
||||
})
|
||||
|
||||
$('#swapper #dropMenu .search-box').on('onSearchChange', function(event, value)
|
||||
{
|
||||
if(value != '')
|
||||
{
|
||||
$('div.hide-in-search').siblings('i').addClass('hide-in-search');
|
||||
$('.nav-tabs li span').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('div.hide-in-search').siblings('i').removeClass('hide-in-search');
|
||||
$('li.has-list div.hide-in-search').removeClass('hidden');
|
||||
$('.nav-tabs li.active').find('span').show();
|
||||
}
|
||||
|
||||
if($('.form-control.search-input').val().length > 0)
|
||||
{
|
||||
$('#closed').attr("hidden", false);
|
||||
$('#gray-line').attr("hidden", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#closed').attr("hidden", true);
|
||||
$('#gray-line').attr("hidden", true);
|
||||
}
|
||||
});
|
||||
|
||||
$('#swapper #dropMenu').on('onSearchComplete', function()
|
||||
{
|
||||
var listItem = $(this).find('.has-list');
|
||||
listItem.each(function()
|
||||
{
|
||||
$(this).css('display','')
|
||||
var $hidden = $(this).find('.hidden');
|
||||
var $item = $(this).find('.search-list-item');
|
||||
if($hidden.length == $item.length) $(this).css('display','none');
|
||||
});
|
||||
|
||||
if($('.list-group.objects').height() == 0)
|
||||
{
|
||||
$('#closed').attr("hidden", true);
|
||||
$('#gray-line').attr("hidden", true);
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@@ -103,7 +103,7 @@
|
||||
<?php foreach($apiList as $api):?>
|
||||
<li class="list-group-item">
|
||||
<div class="heading <?php echo $api->method;?>">
|
||||
<a href="<?php echo helper::createLink('api', 'index', "libID={$api->lib}&moduleID=0&apiID={$api->id}&version=0&release=$release");?>">
|
||||
<a href="<?php echo helper::createLink('api', 'index', "objectType=$objectType&objectID=$objectID&libID={$api->lib}&moduleID=0&apiID={$api->id}&version=0&release=$release");?>">
|
||||
<span class="label label-primary"><?php echo $api->method;?></span>
|
||||
<span class="path" title="<?php echo $api->path;?>"><?php echo $api->path;?></span>
|
||||
<span class="desc" title="<?php echo $api->title;?>"><?php echo $api->title;?></span>
|
||||
|
||||
@@ -12,54 +12,80 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::set('confirmDelete', $lang->api->confirmDelete);?>
|
||||
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo 'api';?>></div>
|
||||
<div class="fade main-row split-row" id="mainRow">
|
||||
<?php if($libID):?>
|
||||
<?php $sideWidth = common::checkNotCN() ? '270' : '238';?>
|
||||
<div class="side-col" style="width:<?php echo $sideWidth;?>px" data-min-width="<?php echo $sideWidth;?>">
|
||||
<div class="cell" style="min-height: 286px; overflow: visible;">
|
||||
<div id='title'>
|
||||
<li class='menu-title'>
|
||||
<div class="title"><?php echo $this->lang->api->module;?></div>
|
||||
<div class="dropdown vision-drop">
|
||||
<button data-toggle="dropdown" class="btn btn-link">v-1.43</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a>1.43</a></li>
|
||||
<li><a>1.44</a></li>
|
||||
</ul>
|
||||
<?php js::set('treeData', $libTree);?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div id="leftBar" class="btn-toolbar pull-left">
|
||||
<?php echo $objectDropdown;?>
|
||||
<?php if(!empty($libTree)):?>
|
||||
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->doc->searchDoc;?></a>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</li>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php
|
||||
$canTreeBrowse = common::hasPriv('tree', 'browse');
|
||||
$canViewReleases = common::hasPriv('api', 'releases');
|
||||
$canEditLib = common::hasPriv('api', 'editLib');
|
||||
$canDeleteLib = common::hasPriv('api', 'deleteLib');
|
||||
$haveMoreButton = ($canTreeBrowse or $canViewReleases or $canEditLib or $canDeleteLib);
|
||||
|
||||
if(!$isRelease and $haveMoreButton)
|
||||
{
|
||||
echo "<div class='menu-actions'>";
|
||||
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
|
||||
echo "<ul class='dropdown-menu pull-right'>";
|
||||
if($canTreeBrowse) echo '<li>' . html::a($this->createLink('tree', 'browse', "rootID=$libID&view=api", '', true), '<i class="icon-cog-outline"></i> ' . $this->lang->api->manageType, '', "class='iframe' data-width='1200px'") . '</li>';
|
||||
if($canViewReleases) echo '<li>' . html::a($this->createLink('api', 'releases', "libID=$libID", '', true), '<i class="icon-version"></i> ' . $this->lang->api->managePublish, '', "class='iframe'") . '</li>';
|
||||
echo "<li class='divider'></li>";
|
||||
if($canEditLib) echo '<li>' . html::a($this->createLink('api', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->api->editLib, '', "class='iframe'") . '</li>';
|
||||
if($canDeleteLib) echo '<li>' . html::a($this->createLink('api', 'deleteLib', "rootID=$libID"), '<i class="icon-trash"></i> ' . $lang->api->deleteLib, 'hiddenwin') . '</li>';
|
||||
echo '</ul></div>';
|
||||
}
|
||||
if(common::hasPriv('api', 'struct')) echo html::a($this->createLink('api', 'struct', "libID=$libID", 'html', true), "<i class='icon-treemap muted'> </i>" . $lang->api->struct, '', "class='btn btn-link export' id='export'");
|
||||
if(common::hasPriv('api', 'releases')) echo html::a($this->createLink('api', 'releases', "libID=$libID", 'html', true), "<i class='icon-version muted'> </i>" . $lang->api->releases, '', "class='btn btn-link export' id='export'");
|
||||
if(common::hasPriv('api', 'createRelease')) echo html::a($this->createLink('api', 'createRelease', "libID=$libID", 'html', true), "<i class='icon-publish muted'> </i>" . $lang->api->createRelease, '', "class='btn btn-link export' id='export'");
|
||||
if(common::hasPriv('api', 'export')) echo html::a($this->createLink('api', 'export', "libID=$libID", 'html', true), "<i class='icon-export muted'> </i>" . $lang->export, '', "class='btn btn-link export' id='export'");
|
||||
if(common::hasPriv('api', 'createLib')) echo html::a($this->createLink('api', 'createLib', "objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $lang->api->createLib, '', 'class="btn btn-secondary iframe" data-width="800px"');
|
||||
if(common::hasPriv('api', 'create')) echo html::a($this->createLink('api', 'create', "objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-primary"');
|
||||
?>
|
||||
</div>
|
||||
<?php if(!$moduleTree):?>
|
||||
<hr class="space">
|
||||
<?php if(!$isRelease):?>
|
||||
<div class="text-center text-muted tips"><?php echo $lang->api->noModule;?></div>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<?php echo $moduleTree;?>
|
||||
</div>
|
||||
<div id='mainContent'class="fade <?php if(!empty($libTree)) echo 'flex';?>">
|
||||
<?php if(empty($libTree)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->doc->noLib;?></span>
|
||||
<?php
|
||||
echo html::a(helper::createLink('doc', 'createLib', "type=$objectType&objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $this->lang->doc->createLib, '', 'class="btn btn-info iframe"');
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div id='sideBar' class="panel side side-col col overflow-auto" data-min-width="150">
|
||||
<div id="fileTree" class="file-tree"></div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class="sidebar-toggle flex-center"><i class="icon icon-angle-left"></i></div>
|
||||
<div class="main-col flex-full col overflow-visible flex-auto overflow-visible" data-min-width="500">
|
||||
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" style="min-width: 400px" id="queryBox" data-module=<?php echo $type . $libType . 'Doc';?>></div>
|
||||
<?php include 'apilist.html.php';?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<div class='hidden' id='dropDownData'>
|
||||
<div class='libDorpdown'>
|
||||
<?php if(common::hasPriv('tree', 'browse')):?>
|
||||
<li data-method="addCataLib" data-has-children='%hasChildren%' data-libid='%libID%' data-moduleid="%moduleID%" data-type="add"><a><i class="icon icon-controls"></i><?php echo $lang->doc->libDropdown['addModule'];?></a></li>
|
||||
<?php endif;?>
|
||||
<?php if(common::hasPriv('doc', 'editLib')):?>
|
||||
<li data-method="editLib"><a href='<?php echo inlink('editLib', 'libID=%libID%');?>' data-toggle='modal' data-type='iframe'><i class="icon icon-edit"></i><?php echo $lang->doc->libDropdown['editLib'];?></a></li>
|
||||
<?php endif;?>
|
||||
<?php if(common::hasPriv('doc', 'deleteLib')):?>
|
||||
<li data-method="deleteLib"><a href='<?php echo inlink('deleteLib', 'libID=%libID%');?>' target='hiddenwin'><i class="icon icon-trash"></i><?php echo $lang->doc->libDropdown['deleteLib'];?></a></li>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<div class='moduleDorpdown'>
|
||||
<?php if(common::hasPriv('tree', 'browse')):?>
|
||||
<li data-method="addCataBro" data-type="add" data-id="%moduleID%"><a><i class="icon icon-controls"></i><?php echo $lang->doc->libDropdown['addSameModule'];?></a></li>
|
||||
<li data-method="addCataChild" data-type="add" data-id="%moduleID%" data-has-children='%hasChildren%'><a><i class="icon icon-edit"></i><?php echo $lang->doc->libDropdown['addSubModule'];?></a></li>
|
||||
<li data-method="editCata" class='edit-module'><a data-href='<?php echo helper::createLink('tree', 'edit', 'moduleID=%moduleID%&type=doc');?>'><i class="icon icon-edit"></i><?php echo $lang->doc->libDropdown['editModule'];?></a></li>
|
||||
<li data-method="deleteCata"><a href='<?php echo helper::createLink('tree', 'delete', 'rootID=%libID%&moduleID=%moduleID%');?>' target='hiddenwin'><i class="icon icon-trash"></i><?php echo $lang->doc->libDropdown['delModule'];?></a></li>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='hidden' data-id="ulTreeModal">
|
||||
<ul data-id="liTreeModal" class="menu-active-primary menu-hover-primary has-input">
|
||||
<li data-id="insert" class="has-input">
|
||||
<input data-target="%target%" class="form-control input-tree"></input>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hidden" data-id="aTreeModal">
|
||||
<a href="###" data-has-children="false" title="%name%" data-id="%id%">
|
||||
<div class="text h-full w-full flex-between overflow-hidden" style="position: relative;">
|
||||
<span>%name%</span>
|
||||
<i class="icon icon-drop icon-ellipsis-v hidden file-drop-icon" data-iscatalogue="true"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
58
module/api/view/view.html.php
Normal file
58
module/api/view/view.html.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* The index view file of doc module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package doc
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::set('confirmDelete', $lang->api->confirmDelete);?>
|
||||
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo 'api';?>></div>
|
||||
<div class="fade main-row split-row" id="mainRow">
|
||||
<?php if($libID):?>
|
||||
<?php $sideWidth = common::checkNotCN() ? '270' : '238';?>
|
||||
<div class="side-col" style="width:<?php echo $sideWidth;?>px" data-min-width="<?php echo $sideWidth;?>">
|
||||
<div class="cell" style="min-height: 286px; overflow: visible;">
|
||||
<div id='title'>
|
||||
<li class='menu-title'>
|
||||
<div class="title"><?php echo $this->lang->api->module;?></div>
|
||||
</li>
|
||||
<?php
|
||||
$canTreeBrowse = common::hasPriv('tree', 'browse');
|
||||
$canViewReleases = common::hasPriv('api', 'releases');
|
||||
$canEditLib = common::hasPriv('api', 'editLib');
|
||||
$canDeleteLib = common::hasPriv('api', 'deleteLib');
|
||||
$haveMoreButton = ($canTreeBrowse or $canViewReleases or $canEditLib or $canDeleteLib);
|
||||
|
||||
if(!$isRelease and $haveMoreButton)
|
||||
{
|
||||
echo "<div class='menu-actions'>";
|
||||
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
|
||||
echo "<ul class='dropdown-menu pull-right'>";
|
||||
if($canTreeBrowse) echo '<li>' . html::a($this->createLink('tree', 'browse', "rootID=$libID&view=api", '', true), '<i class="icon-cog-outline"></i> ' . $this->lang->api->manageType, '', "class='iframe' data-width='1200px'") . '</li>';
|
||||
if($canViewReleases) echo '<li>' . html::a($this->createLink('api', 'releases', "libID=$libID", '', true), '<i class="icon-version"></i> ' . $this->lang->api->managePublish, '', "class='iframe'") . '</li>';
|
||||
echo "<li class='divider'></li>";
|
||||
if($canEditLib) echo '<li>' . html::a($this->createLink('api', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->api->editLib, '', "class='iframe'") . '</li>';
|
||||
if($canDeleteLib) echo '<li>' . html::a($this->createLink('api', 'deleteLib', "rootID=$libID"), '<i class="icon-trash"></i> ' . $lang->api->deleteLib, 'hiddenwin') . '</li>';
|
||||
echo '</ul></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php if(!$moduleTree):?>
|
||||
<hr class="space">
|
||||
<?php if(!$isRelease):?>
|
||||
<div class="text-center text-muted tips"><?php echo $lang->api->noModule;?></div>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<?php echo $moduleTree;?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php include 'apilist.html.php';?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -515,10 +515,6 @@ $lang->doc->menuOrder[20] = 'project';
|
||||
$lang->doc->menuOrder[25] = 'api';
|
||||
$lang->doc->menuOrder[30] = 'custom';
|
||||
|
||||
$lang->doc->menu->api['subMenu'] = new stdclass();
|
||||
$lang->doc->menu->api['subMenu']->index = array('link' => "{$lang->doc->apiDoc}|api|index|libID=%s", 'alias' => 'create,edit');
|
||||
$lang->doc->menu->api['subMenu']->struct = array('link' => "{$lang->doc->apiStruct}|api|struct|libID=%s", 'alias' => 'createstruct,editstruct');
|
||||
|
||||
/* Report menu.*/
|
||||
$lang->report->menu = new stdclass();
|
||||
$lang->report->menu->screen = array('link' => "{$lang->screen->common}|screen|browse");
|
||||
|
||||
@@ -1325,6 +1325,7 @@ class doc extends control
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->type = $type;
|
||||
$this->view->objectType = $type;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $queryID;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
|
||||
@@ -47,7 +47,11 @@ class docModel extends model
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('type')->eq('api')
|
||||
->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi()
|
||||
->beginIF(!empty($objectType))->andWhere($objectType)->eq($objectID)->fi()
|
||||
->beginIF(!empty($objectType) && $objectID > 0)->andWhere($objectType)->eq($objectID)->fi()
|
||||
->beginIF($objectType == 'nolink')
|
||||
->andWhere('product')->eq(0)
|
||||
->andWhere('project')->eq(0)
|
||||
->fi()
|
||||
->orderBy('`order`_asc, id_desc')
|
||||
->fetchAll('id');
|
||||
|
||||
@@ -2903,6 +2907,10 @@ class docModel extends model
|
||||
|
||||
$libTree[$type][] = $annex;
|
||||
}
|
||||
elseif($type == 'api')
|
||||
{
|
||||
$libTree[$type] = array_merge($libTree[$type], $apiLibs);
|
||||
}
|
||||
|
||||
$libTree = array_values($libTree[$type]);
|
||||
return $libTree;
|
||||
|
||||
@@ -29,7 +29,7 @@ foreach($normalObjects as $normalObjectID => $normalObjectName)
|
||||
foreach($closedObjects as $closedObjectID => $closedObjectName)
|
||||
{
|
||||
$selected = $closedObjectID == $objectID ? 'selected' : '';
|
||||
$closedObjectsHtml .= '<li>' . html::a(sprintf($link, $closedObjectID), $closedObjectName, '', "class='$selected clickable' title='{$normalObjectName}' data-key='" . zget($objectsPinYin, $closedObjectName, '') . "'") . '</li>';
|
||||
$closedObjectsHtml .= '<li>' . html::a(sprintf($link, $closedObjectID), $closedObjectName, '', "class='$selected clickable' title='{$closedObjectName}' data-key='" . zget($objectsPinYin, $closedObjectName, '') . "'") . '</li>';
|
||||
}
|
||||
|
||||
$normalObjectsHtml .= '</ul>';
|
||||
|
||||
Reference in New Issue
Block a user