* Adjust code style.
This commit is contained in:
+84
-80
@@ -1,97 +1,101 @@
|
||||
ALTER TABLE `zt_doclib`
|
||||
ADD COLUMN `desc` text NULL AFTER `collector`;
|
||||
ALTER TABLE `zt_doclib` ADD COLUMN `desc` text NULL AFTER `collector`;
|
||||
|
||||
-- DROP TABLE IF EXISTS `zt_api_lib_release`;
|
||||
CREATE TABLE `zt_api_lib_release`
|
||||
(
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doclib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`version` varchar(255) NOT NULL DEFAULT '',
|
||||
`snap` mediumtext NOT NULL,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doclib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`version` varchar(255) NOT NULL DEFAULT '',
|
||||
`snap` mediumtext NOT NULL,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS `zt_api`;
|
||||
CREATE TABLE `zt_api`
|
||||
(
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`product` varchar(255) NOT NULL DEFAULT '',
|
||||
`lib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`module` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`title` varchar(100) NOT NULL DEFAULT '',
|
||||
`path` varchar(255) NOT NULL DEFAULT '',
|
||||
`protocol` varchar(10) NOT NULL DEFAULT '',
|
||||
`method` varchar(10) NOT NULL DEFAULT '',
|
||||
`requestType` varchar(100) NOT NULL DEFAULT '',
|
||||
`responseType` varchar(100) NOT NULL DEFAULT '',
|
||||
`status` varchar(20) NOT NULL DEFAULT '',
|
||||
`owner` int UNSIGNED NOT NULl DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT '',
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`params` text NULL,
|
||||
`response` text NULL,
|
||||
`commonParams` text NULL,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL,
|
||||
`editEdBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`editedDate` datetime NOT NULL,
|
||||
`deleted` enum('0', '1') NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`product` varchar(255) NOT NULL DEFAULT '',
|
||||
`lib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`module` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`title` varchar(100) NOT NULL DEFAULT '',
|
||||
`path` varchar(255) NOT NULL DEFAULT '',
|
||||
`protocol` varchar(10) NOT NULL DEFAULT '',
|
||||
`method` varchar(10) NOT NULL DEFAULT '',
|
||||
`requestType` varchar(100) NOT NULL DEFAULT '',
|
||||
`responseType` varchar(100) NOT NULL DEFAULT '',
|
||||
`status` varchar(20) NOT NULL DEFAULT '',
|
||||
`owner` int UNSIGNED NOT NULl DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT '',
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`params` text NULL,
|
||||
`response` text NULL,
|
||||
`commonParams` text NULL,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL,
|
||||
`editEdBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`editedDate` datetime NOT NULL,
|
||||
`deleted` enum('0', '1') NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS `zt_apispec`;
|
||||
CREATE TABLE `zt_apispec`
|
||||
(
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doc` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`module` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`title` varchar(100) NOT NULL DEFAULT '',
|
||||
`path` varchar(255) NOT NULL DEFAULT '',
|
||||
`protocol` varchar(10) NOT NULL DEFAULT '',
|
||||
`method` varchar(10) NOT NULL DEFAULT '',
|
||||
`requestType` varchar(100) NOT NULL DEFAULT '',
|
||||
`responseType` varchar(100) NOT NULL DEFAULT '',
|
||||
`status` tinyint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`owner` varchar(255) NOT NULl DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT '',
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`params` text NULL,
|
||||
`response` text NULL,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doc` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`module` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`title` varchar(100) NOT NULL DEFAULT '',
|
||||
`path` varchar(255) NOT NULL DEFAULT '',
|
||||
`protocol` varchar(10) NOT NULL DEFAULT '',
|
||||
`method` varchar(10) NOT NULL DEFAULT '',
|
||||
`requestType` varchar(100) NOT NULL DEFAULT '',
|
||||
`responseType` varchar(100) NOT NULL DEFAULT '',
|
||||
`status` tinyint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`owner` varchar(255) NOT NULl DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT '',
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`params` text NULL,
|
||||
`response` text NULL,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS `zt_api_const`;
|
||||
create table `zt_api_const`
|
||||
(
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doclib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`field` varchar(50) NOT NULL DEFAULT '',
|
||||
`scope` varchar(50) NOT NULL DEFAULT '',
|
||||
`type` varchar(20) NOT NULL DEFAULT '',
|
||||
`default` varchar(1000) NOT NULL DEFAULT '',
|
||||
`required` tinyint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT 0,
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`editEdBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`editedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`deletedDate` datetime NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doclib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`field` varchar(50) NOT NULL DEFAULT '',
|
||||
`scope` varchar(50) NOT NULL DEFAULT '',
|
||||
`type` varchar(20) NOT NULL DEFAULT '',
|
||||
`default` varchar(1000) NOT NULL DEFAULT '',
|
||||
`required` tinyint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT 0,
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`editEdBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`editedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`deletedDate` datetime NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS `zt_api_const_spec`;
|
||||
create table `zt_api_const_spec`
|
||||
(
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doclib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`field` varchar(50) NOT NULL DEFAULT '',
|
||||
`scope` varchar(50) NOT NULL DEFAULT '',
|
||||
`type` varchar(20) NOT NULL DEFAULT '',
|
||||
`default` varchar(1000) NOT NULL DEFAULT '',
|
||||
`required` tinyint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT 0,
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`doclib` int UNSIGNED NOT NULL DEFAULT 0,
|
||||
`field` varchar(50) NOT NULL DEFAULT '',
|
||||
`scope` varchar(50) NOT NULL DEFAULT '',
|
||||
`type` varchar(20) NOT NULL DEFAULT '',
|
||||
`default` varchar(1000) NOT NULL DEFAULT '',
|
||||
`required` tinyint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`desc` varchar(255) NOT NULL DEFAULT 0,
|
||||
`version` smallint UNSIGNED NOT NULL DEFAULT 0,
|
||||
`addedBy` varchar(30) NOT NULL DEFAULT 0,
|
||||
`addedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
+46
-62
@@ -7,7 +7,7 @@
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package api
|
||||
* @version $Id: control.php 5143 2013-07-15 06:11:59Z zhujinyonging@gmail.com $
|
||||
* @version $Id: control.php 5143 2013-07-15 06:11:59Z thanatos thanatos915@163.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class api extends control
|
||||
@@ -25,39 +25,35 @@ class api extends control
|
||||
|
||||
/**
|
||||
* Api doc index page.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @param int $apiID
|
||||
* @access public
|
||||
* @return void
|
||||
* @author thanatos thanatos915@163.com
|
||||
*/
|
||||
public function index()
|
||||
public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 1)
|
||||
{
|
||||
$params = $_GET;
|
||||
$libID = $params['libID'];
|
||||
$module = $params['module'];
|
||||
$apiID = $params['apiID'];
|
||||
$version = $params['version'];
|
||||
|
||||
/* Get all api doc libraries */
|
||||
/* Get all api doc libraries. */
|
||||
$libs = $this->doc->getApiLibs();
|
||||
|
||||
/* generate bread crumbs dropMenu */
|
||||
/* Generate bread crumbs dropMenu. */
|
||||
if($libs)
|
||||
{
|
||||
if($libID == 0) $libID = key($libs);
|
||||
$this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID);
|
||||
$this->view->libID = $libID;
|
||||
}
|
||||
$this->setMenu($libID);
|
||||
|
||||
|
||||
/* Get an api doc */
|
||||
/* Get an api doc. */
|
||||
if($apiID > 0)
|
||||
{
|
||||
$api = $this->api->getLibById($apiID, $version);
|
||||
if($api)
|
||||
{
|
||||
$module = $api->module;
|
||||
$_GET['module'] = $module;
|
||||
$libID = $api->lib;
|
||||
$moduleID = $api->module;
|
||||
$libID = $api->lib;
|
||||
|
||||
$this->view->api = $api;
|
||||
$this->view->apiID = $apiID;
|
||||
$this->view->version = $version;
|
||||
@@ -66,36 +62,27 @@ class api extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get module api list */
|
||||
$apiList = $this->api->getListByModuleId($libID, $module);
|
||||
/* Get module api list. */
|
||||
$apiList = $this->api->getListByModuleId($libID, $moduleID);
|
||||
|
||||
$this->view->apiList = $apiList;
|
||||
$this->view->moudle = $module;
|
||||
}
|
||||
|
||||
/* Get module tree */
|
||||
$moduleTree = $this->doc->getApiModuleTree($libID, $apiID);
|
||||
|
||||
$this->view->title = $this->lang->api->title;
|
||||
$this->view->libID = $libID;
|
||||
$this->view->apiID = $apiID;
|
||||
$this->view->libs = $libs;
|
||||
$this->view->moduleTree = $moduleTree;
|
||||
$this->view->moduleTree = $libID ? $this->doc->getApiModuleTree($libID, $apiID) : '';
|
||||
$this->view->users = $this->user->getPairs('noclosed,noletter');
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an Api doc
|
||||
* @param $id
|
||||
* @author thanatos thanatos915@163.com
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a api doc library.
|
||||
* @author thanatos thanatos915@163.com
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createLib()
|
||||
{
|
||||
@@ -129,9 +116,15 @@ class api extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function edit()
|
||||
/**
|
||||
* Edit library.
|
||||
*
|
||||
* @param int $apiID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function edit($apiID)
|
||||
{
|
||||
$apiID = $_GET['apiID'];
|
||||
if(helper::isAjaxRequest() && !empty($_POST))
|
||||
{
|
||||
$this->loadModel('api');
|
||||
@@ -169,16 +162,15 @@ class api extends control
|
||||
$this->view->edit = true;
|
||||
}
|
||||
|
||||
$example = [
|
||||
'example' => 'type,description'
|
||||
];
|
||||
$this->view->example = json_encode($example, JSON_PRETTY_PRINT);
|
||||
$example = array('example' => 'type,description');
|
||||
$example = json_encode($example, JSON_PRETTY_PRINT);
|
||||
|
||||
$allUsers = $this->loadModel('user')->getPairs('devfirst|noclosed');
|
||||
$this->view->user = $this->app->user->account;
|
||||
$this->view->allUsers = $allUsers;
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($api->lib, 'api', $startModuleID = 0);
|
||||
$this->view->moduleID = $api->module ? (int)$api->module : (int)$this->cookie->lastDocModule;
|
||||
$this->view->example = $example;
|
||||
$this->view->title = $api->title . $this->lang->api->edit;
|
||||
|
||||
$this->display();
|
||||
@@ -187,16 +179,16 @@ class api extends control
|
||||
|
||||
/**
|
||||
* Create an api doc.
|
||||
* @author thanatos thanatos915@163.com
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create()
|
||||
public function create($libID, $moduleID = 0)
|
||||
{
|
||||
$libID = $_GET['libID'];
|
||||
$moduleID = $_GET['moduleID'];
|
||||
if(helper::isAjaxRequest() && !empty($_POST))
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->loadModel('api');
|
||||
|
||||
$now = helper::now();
|
||||
$userId = $this->app->user->account;
|
||||
$params = fixer::input('post')
|
||||
@@ -211,17 +203,10 @@ class api extends control
|
||||
->get();
|
||||
|
||||
$apiID = $this->api->create($params);
|
||||
if(empty($apiID))
|
||||
{
|
||||
$this->sendError(dao::getError());
|
||||
exit;
|
||||
}
|
||||
if(empty($apiID)) return $this->sendError(dao::getError());
|
||||
|
||||
$this->action->create('api', $apiID, 'Created');
|
||||
$this->sendSuccess([
|
||||
'locate' => helper::createLink('api', 'index', "apiID=$apiID"),
|
||||
]);
|
||||
exit;
|
||||
return $this->sendSuccess(array('locate' => helper::createLink('api', 'index', "apiID=$apiID")));
|
||||
}
|
||||
|
||||
$libs = $this->doc->getLibs('api', '', $libID);
|
||||
@@ -230,10 +215,8 @@ class api extends control
|
||||
$lib = $this->doc->getLibByID($libID);
|
||||
$libName = isset($lib->name) ? $lib->name . $this->lang->colon : '';
|
||||
|
||||
$example = [
|
||||
'example' => 'type,description'
|
||||
];
|
||||
$this->view->example = json_encode($example, JSON_PRETTY_PRINT);
|
||||
$example = array('example' => 'type,description');
|
||||
$example = json_encode($example, JSON_PRETTY_PRINT);
|
||||
|
||||
$allUsers = $this->loadModel('user')->getPairs('devfirst|noclosed');
|
||||
$this->view->user = $this->app->user->account;
|
||||
@@ -243,10 +226,11 @@ class api extends control
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'api', $startModuleID = 0);
|
||||
$this->view->moduleID = $moduleID ? (int)$moduleID : (int)$this->cookie->lastDocModule;
|
||||
$this->view->libs = $libs;
|
||||
$this->view->example = $example;
|
||||
$this->view->title = $libName . $this->lang->api->create;
|
||||
$this->view->users = $this->user->getPairs('nocode');
|
||||
|
||||
$this->display('api', 'create');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,83 +13,79 @@
|
||||
<?php include '../../common/view/header.html.php'; ?>
|
||||
<?php js::set('confirmDelete', $lang->api->confirmDelete);?>
|
||||
<div class="fade main-row split-row" id="mainRow">
|
||||
<?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">
|
||||
<div id='title'>
|
||||
<li class='menu-title'><?php echo $this->lang->api->apiDoc; ?></li>
|
||||
<?php
|
||||
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'>";
|
||||
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'") . '</li>';
|
||||
echo "<li class='divider'></li>";
|
||||
echo '<li>' . html::a($this->createLink('api', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->api->editLib, '', "class='iframe'") . '</li>';
|
||||
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">
|
||||
<div class="text-center text-muted tips">
|
||||
<?php echo $lang->api->noModule; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo $moduleTree; ?>
|
||||
<?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">
|
||||
<div id='title'>
|
||||
<li class='menu-title'><?php echo $this->lang->api->apiDoc; ?></li>
|
||||
<?php
|
||||
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'>";
|
||||
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'") . '</li>';
|
||||
echo "<li class='divider'></li>";
|
||||
echo '<li>' . html::a($this->createLink('api', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->api->editLib, '', "class='iframe'") . '</li>';
|
||||
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">
|
||||
<div class="text-center text-muted tips"><?php echo $lang->api->noModule; ?></div>
|
||||
<?php endif; ?>
|
||||
<?php echo $moduleTree; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
<?php if($apiID):?>
|
||||
<?php include './content.html.php';?>
|
||||
<?php else: ?>
|
||||
<?php if(empty($libs) || empty($apiList)): ?>
|
||||
<div class="cell">
|
||||
<div class="detail">
|
||||
<li class="detail-title"><?php echo intval($libID) > 0 ? $lang->api->module : $lang->api->title; ?></li>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<div class="no-content"><img src="<?php echo $config->webRoot . 'theme/default/images/main/no_content.png' ?>"/></div>
|
||||
<div class="notice text-muted"><?php echo (empty($libs)) ? $lang->api->noLib : $lang->api->noApi; ?></div>
|
||||
<div class="no-content-button">
|
||||
<?php
|
||||
$html = '';
|
||||
if($libID && common::hasPriv('api', 'create'))
|
||||
{
|
||||
$html = html::a(helper::createLink('api', 'create', "libID={$libID}"), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-info btn-wide"');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = html::a(helper::createLink('api', 'createLib'), '<i class="icon icon-plus"></i> ' . $lang->api->createLib, '', 'class="btn btn-info btn-wide iframe"');
|
||||
}
|
||||
echo $html;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($api):?>
|
||||
<?php include './content.html.php';?>
|
||||
<?php else: ?>
|
||||
<?php if(empty($libs) || empty($apiList)): ?>
|
||||
<?php else: ?>
|
||||
<div class="cell">
|
||||
<div class="detail">
|
||||
<li class="detail-title"><?php echo intval($libID) > 0 ? $lang->api->module : $lang->api->title; ?></li>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<div class="no-content"><img
|
||||
src="<?php echo $config->webRoot . 'theme/default/images/main/no_content.png' ?>"/></div>
|
||||
<div
|
||||
class="notice text-muted"><?php echo (empty($libs)) ? $lang->api->noLib : $lang->api->noApi; ?></div>
|
||||
<div class="no-content-button">
|
||||
<?php
|
||||
$html = '';
|
||||
if($libID && common::hasPriv('api', 'create'))
|
||||
{
|
||||
$html = html::a(helper::createLink('api', 'create', "libID={$libID}"), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-info btn-wide"');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = html::a(helper::createLink('api', 'createLib'), '<i class="icon icon-plus"></i> ' . $lang->api->createLib, '', 'class="btn btn-info btn-wide iframe"');
|
||||
}
|
||||
echo $html;
|
||||
?>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<ul class="list-group">
|
||||
<?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', 'apiID='. $api->id) ?>">
|
||||
<span class="label label-primary"><?php echo $api->method; ?></span>
|
||||
<span class="label label-warning"><?php echo apiModel::getApiStatusText($api->status); ?></span>
|
||||
<span class="path"><?php echo $api->path; ?></span>
|
||||
<span class="desc"><?php echo $api->title; ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
||||
<div class="cell">
|
||||
<div class="detail">
|
||||
<ul class="list-group">
|
||||
<?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', 'apiID='. $api->id) ?>">
|
||||
<span class="label label-primary"><?php echo $api->method; ?></span>
|
||||
<span
|
||||
class="label label-warning"><?php echo apiModel::getApiStatusText($api->status); ?></span>
|
||||
<span class="path"><?php echo $api->path; ?></span>
|
||||
<span class="desc"><?php echo $api->title; ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php'; ?>
|
||||
|
||||
@@ -2145,17 +2145,12 @@ EOT;
|
||||
$startModulePath = '';
|
||||
$currentMethod = $this->app->getMethodName();
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
if($startModule > 0)
|
||||
{
|
||||
$startModule = $this->tree->getById($startModule);
|
||||
if($startModule) $startModulePath = $startModule->path . '%';
|
||||
}
|
||||
|
||||
$docs = $this->dao->select('*')->from(TABLE_API)
|
||||
$docs = $this->dao->select('*')->from(TABLE_API)
|
||||
->where('lib')->eq($rootID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchAll();
|
||||
$moduleDocs = [];
|
||||
$moduleDocs = array();
|
||||
foreach($docs as $doc)
|
||||
{
|
||||
if(!$this->checkPrivDoc($doc)) continue;
|
||||
@@ -2163,7 +2158,7 @@ EOT;
|
||||
$moduleDocs[$doc->module][] = $doc;
|
||||
}
|
||||
|
||||
$treeMenu = [];
|
||||
$treeMenu = array();
|
||||
$query = $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
->andWhere('type')->eq('api')
|
||||
|
||||
Reference in New Issue
Block a user