Merge branch 'release/zentaopms_18.3' of https://gitlab.zcorp.cc/easycorp/zentaopms into release/zentaopms_18.3

This commit is contained in:
wangyidong
2023-03-31 08:27:31 +08:00
45 changed files with 752 additions and 1270 deletions
+3 -3
View File
File diff suppressed because one or more lines are too long
+3 -3
View File
File diff suppressed because one or more lines are too long
+6 -1
View File
@@ -171,7 +171,12 @@ class html extends baseHTML
$convertedPinYin = (empty($config->isINT) and class_exists('common')) ? common::convert2Pinyin($options) : array();
if(count($options) >= $config->maxCount or isset($config->moreLinks[$name]))
{
if(strpos($attrib, 'chosen') !== false) $attrib = str_replace('chosen', 'picker-select', $attrib);
if(strpos($attrib, 'chosen') !== false)
{
$attrib = str_replace('chosen', 'picker-select', $attrib);
$attrib = preg_replace('/data-drop[-_]?direction=([\'"]?)down([\'"]?)/i', 'data-drop-direction=$1bottom$2', $attrib);
$attrib = preg_replace('/data-drop[-_]?direction=([\'"]?)up([\'"]?)/i', 'data-drop-direction=$1top$2', $attrib);
}
if(isset($config->moreLinks[$name]))
{
$link = $config->moreLinks[$name];
+17 -6
View File
@@ -45,13 +45,21 @@ class api extends control
$objectID = $this->objectID;
/* Get all api doc libraries. */
$libs = $this->doc->getApiLibs($appendLib, $objectType, $objectID);
$loadLib = false;
$libs = $this->doc->getApiLibs($appendLib, $objectType, $objectID);
if(empty($libs))
{
$loadLib = true;
$libs = $this->doc->getApiLibs($appendLib);
}
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;
if($loadLib) $libs = $this->doc->getApiLibs($appendLib);
}
/* Get an api doc. */
@@ -75,11 +83,11 @@ class api extends control
/* 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&param=myQueryID");
$this->api->buildSearchForm($lib,$queryID, $actionURL);
$this->api->buildSearchForm($lib,$queryID, $actionURL, $libs);
if($browseType == 'bySearch')
{
$this->view->apiList = $this->api->getApiListBySearch($libID, $queryID);
$this->view->apiList = $this->api->getApiListBySearch($libID, $queryID, '', array_keys($libs));
$this->view->typeList = $this->api->getTypeList($libID);
}
@@ -94,7 +102,7 @@ class api extends control
$this->view->objectType = $objectType;
$this->view->objectID = $objectID;
$this->view->moduleID = $moduleID;
$this->view->libTree = $this->api->getLibTree($libID, $libs, $moduleID);
$this->view->libTree = $this->api->getLibTree($libID, $libs, $moduleID, $objectID, $browseType);
$this->view->users = $this->user->getPairs('noclosed,noletter');
$this->view->objectDropdown = isset($libs[$libID]) ? $this->generateLibsDropMenu($libs[$libID], $release) : '';
@@ -431,8 +439,11 @@ class api extends control
return $this->sendSuccess(array('message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "redirectParentWindow($id)"));
}
$type = !empty($lib->product) ? 'product' : 'project';
$this->lang->api->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
$type = 'nolink';
if(!empty($lib->product)) $type = 'product';
if(!empty($lib->project)) $type = 'project';
if($type != 'nolink') $this->lang->api->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
if($type == 'nolink') unset($this->lang->api->aclList['default']);
$this->view->lib = $lib;
$this->view->type = $type;
-20
View File
@@ -159,23 +159,3 @@ form .table-data, #content .table-data {border: 1px solid #e2e2e3;}
.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;}
#bysearchTab::before {display: none;}
#leftBar .selectBox #currentItem {width: 150px; display: flex; align-items: center;}
[lang^=zh] #leftBar .selectBox #currentItem {width: 180px;}
#leftBar .selectBox #currentItem > .text {overflow: hidden; text-align: left; flex: 0 1 100%;}
+3 -82
View File
@@ -1,32 +1,4 @@
.flex {display: flex;}
.flex-center {display: flex; justify-content: center; align-items: center;}
.flex-start {display: flex; align-items: center;}
#main {padding-bottom: 0;}
.selectBox > button {width: 180px;}
/* main-content */
#mainContent > #sideBar {flex: 0 0 180px; height: calc(100vh - 120px); overflow: auto;}
#mainContent > .sidebar-toggle {flex: 0 0 16px;}
#mainContent > .main-col {flex: auto; height: calc(100vh - 120px); overflow: auto;}
/* tree */
#sideBar {padding-left: 0; padding-right: 0;}
li.lib {width: unset;}
a.lib {margin-bottom: 0; width: unset;}
.tree-icon {position: absolute; right: 0;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a.show-icon > div {padding-right: 15px;}
.file-tree .tree-text {overflow: hidden;}
.tree li.has-input {overflow: hidden;}
.tree li.has-list.open:before {display: none;}
.img-lib {flex: 0 0 16px; height: 14px;}
/* sideBar */
.sidebar-toggle > .icon {width: 16px; height: 30px; margin-top: -10px; line-height: 30px; color: #fff; text-align: center; background: #7dcdfe; border-radius: 6px; cursor: pointer;}
.file-tree a {height: 30px;}
.lib {width: unset; margin-bottom: unset;}
.flex {display: flex;}
.flex-none {flex: none;}
.flex-auto {flex: auto;}
@@ -39,6 +11,7 @@ a.lib {margin-bottom: 0; width: unset;}
.overflow-visible {overflow: visible;}
.overflow-hidden {overflow: hidden;}
.img-lib {width: 14px; height: 14px; margin-bottom: 2px; flex: 0 0 14px;}
.cell {padding: 0;}
#mainContent {padding-top: 0; padding-bottom: 0;}
#mainContent #createDropdown {display: inline-block;}
#mainContent #createDropdown ul {position: absolute;}
@@ -74,56 +47,4 @@ span.dotted-line+a {display: block;}
.is-sorting > li ul {display: none!important;}
li.drag-shadow ul {display: none!important;}
.tree-group {position: relative;}
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
.tree li.has-list.open:before {left: 6px;}
.main-table-content {display: flex; gap: 20px;}
.main-table-content > .side {flex: 0 0 300px;}
.main-table-content > .content {flex: 1;}
/* css for mian */
#mainContent > #sideBar {flex: 0 0 150px; overflow-x: auto; padding-right: 5px;}
[lang^=zh] #mainContent > #sideBar {flex: 0 0 180px;}
/* css for tree */
.tree li.has-list.open:before {content: unset;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a {height: 30px;}
.flex-between {display: flex; align-items: center; justify-content: space-between;}
.flex-center {display: flex; align-items: center; justify-content: center;}
.flex-start {display: flex; align-items: center;}
.tree li > .list-toggle {top: 4px;}
.input-tree {width: 120px;}
.tree-icon {position: absolute; right: 0;}
.tree li.has-input {overflow: hidden;}
.img-lib {flex: 0 0 16px; height: 14px;}
.tree-icon {position: absolute; right: 0;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a.show-icon > div {padding-right: 15px;}
.tree li.has-input {overflow: hidden;}
/* css for sidebar */
.sidebar-toggle {flex: 0 0 16px;}
.sidebar-toggle > .icon {width: 12px; height: 30px; margin-top: -10px; line-height: 30px; color: #fff; text-align: center; background: #7dcdfe; border-radius: 6px; cursor: pointer;}
.spliter {flex: 0 0 12px;}
.spliter-btn {height: 28px; width: 10px; background: #fff; position: absolute; top: 30%; left: -1px; border: 1px solid #D9D9D9; border-radius: 2px;}
.spliter-btn > .spliter-inner {width: 4px; height: 12px; border-left: 1px solid #D9D9D9; border-right: 1px solid #D9D9D9;}
#mainContent .table-empty-tip > p, #createDocs {display: inline-block;}
.createDropdown a.btn-primary, .createDropdown a.btn-info {border-right: 1px solid rgba(255,255,255,0.2);}
.createDropdown button.dropdown-toggle.btn-primary, .createDropdown button.dropdown-toggle.btn-info {padding: 6px;}
.createDropdown ul > li {text-align: left;}
.createDropdown .btn.btn-info:hover {box-shadow: none;}
.table .c-name > a:first-child {display: inline-block; max-width: 90%; overflow: hidden;}
.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: -3px;}
table.table > thead > tr {height: 32px;}
#bysearchTab::before {display: none;}
#leftBar .selectBox #currentItem {width: 150px; display: flex; align-items: center;}
[lang^=zh] #leftBar .selectBox #currentItem {width: 180px;}
#leftBar .selectBox #currentItem > .text {overflow: hidden; text-align: left; flex: 0 1 100%;}
#queryBox #groupAndOr {min-width: 60px;}
+3 -3
View File
@@ -19,13 +19,13 @@ function loadDocModule(libID)
*/
function toggleAcl(acl, type)
{
if(acl == 'open')
if(acl == 'private')
{
$('#whiteListBox').addClass('hidden');
$('#whiteListBox').removeClass('hidden');
}
else
{
$('#whiteListBox').removeClass('hidden');
$('#whiteListBox').addClass('hidden');
}
}
-281
View File
@@ -1,284 +1,3 @@
$(document).ready(function()
{
/**
* Render Dropdown dom.
*
* @access public
* @return string
*/
function renderDropdown(option)
{
var libClass = '.libDorpdown';
if(option.type != 'dropDownLibrary') libClass = '.moduleDorpdown';
if($(libClass).find('li').length == 0) return '';
var dropdown = '<ul class="dropdown-menu dropdown-in-tree" id="' + option.type + '" style="display: unset; left:' + option.left + 'px; top:' + option.top + 'px;">';
dropdown += $(libClass).html().replace(/%libID%/g, option.libID).replace(/%moduleID%/g, option.moduleID).replace(/%hasChildren%/g, option.hasChildren);
dropdown += '</ul>';
return dropdown;
}
/* Update doc content silently on switch doc version, story #40503 */
$(document).on('click', '.api-version-menu a, #mainActions .container a', function(event)
{
var $tmpDiv = $('<div>');
$tmpDiv.load($(this).data('url') + ' #mainContent', function()
{
$('#content').html($tmpDiv.find('#content').html());
$('#sidebarContent').html($tmpDiv.find('#sidebarContent').html());
$('#actionbox .histories-list').html($tmpDiv.find('#actionbox .histories-list').html());
if($.cookie('isFullScreen') == 1) fullScreen();
$('#content [data-ride="tree"]').tree();
$('#outline li.has-list').addClass('open in');
$('#outline li.has-list>i+ul').prev('i').remove();
});
});
var moduleData = {
"name" : "",
"createType" : "",
"libID" : "",
"parentID" : "",
"objectID" : "",
"moduleType" : "",
"order" : "",
"isUpdate" : ""
};
$(document).on('click', '.sidebar-toggle > .icon', function()
{
var $icon = $(this);
if($icon.hasClass('icon-angle-left'))
{
$icon.removeClass('icon-angle-left');
$icon.addClass('icon-angle-right');
$('#sideBar').addClass('hidden');
}
else
{
$icon.removeClass('icon-angle-right');
$icon.addClass('icon-angle-left');
$('#sideBar').removeClass('hidden');
}
});
$('#fileTree').tree(
{
initialState: 'active',
data: treeData,
itemCreator: function($li, item)
{
var libClass = item.type == 'api' ? '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" style="background-image:url(static/svg/interface-doclib.svg)"></div>';
$item += '<div class="tree-text" style="padding-left: 5px;">';
$item += item.name
$item += '</div>';
$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)
{
libID = moduleID;
moduleID = 0;
}
else
{
libID = $(this).closest('.lib').data('id');
}
var linkParams = 'libID=' + libID + '&moduleID=' + moduleID;
location.href = createLink('api', 'index', linkParams);
}).on('click', '.icon-drop', function(e)
{
$('.dropdown-in-tree').css('display', 'none');
var isCatalogue = $(this).attr('data-isCatalogue') === 'false' ? false : true;
var dropDownID = isCatalogue ? 'dropDownCatalogue' : 'dropDownLibrary';
var libID = 0;
var moduleID = 0;
var parentID = 0;
var $module = $(this).closest('a');
var hasChildren = $module.data('has-children');
var moduleType = '';
if($module.hasClass('lib'))
{
libID = $module.data('id');
moduleType = $module.data('type');
parentID = libID;
}
else
{
moduleID = $module.data('id');
libID = $module.closest('.lib').data('id');
moduleType = $module.closest('.lib').data('type');
parentID = $module.closest('ul').closest('.lib').data('id');
}
moduleData = {
"libID" : libID,
"parentID" : parentID,
"objectID" : moduleID,
"moduleType": moduleType == 'lib' ? 'doc' : moduleType,
};
var option = {
left : e.pageX,
top : e.pageY,
type : dropDownID,
libID : libID,
moduleID : moduleID,
hasChildren : hasChildren
};
var dropDown = renderDropdown(option);
$(".m-api-index").append(dropDown);
e.stopPropagation();
}).on('blur', 'input.input-tree', function()
{
var $input = $(this);
var value = $input.val();
if(!value)
{
$input.closest('[data-id=insert]').remove();
return;
}
moduleData.name = value;
$.post(createLink('tree', 'ajaxCreateModule'), moduleData, function(result)
{
result = JSON.parse(result);
if(result.result == 'fail')
{
bootbox.alert(
result.message[0],
function()
{
setTimeout(function()
{
$('.file-tree .input-tree').focus()
}, 10)
}
);
return false;
}
var module = result.module;
var resultDom = $('[data-id=aTreeModal]').html().replace(/%name%/g, module.name).replace(/%id%/g, module.id).replace('insert', module.id);
$input.closest('ul').find('.has-input').css('padding-left', '15px');
$input.after(resultDom);
$input.remove();
if(moduleData.isUpdate)
{
$.getJSON(createLink('api', 'index', 'json'), function(data){
var treeData = JSON.parse(data.data);
$('#fileTree').data('zui.tree').reload(treeData.libTree);
$('li.has-list > ul').addClass("menu-active-primary menu-hover-primary");
});
}
});
});
$('body').on('click', '.dropdown-in-tree li', function(e)
{
var item = $(this).data();
if($(this).hasClass('edit-module'))
{
new $.zui.ModalTrigger({
keyboard : true,
type : 'ajax',
url : $(this).find('a').data('href')
}).show();
}
if(item.type !== 'add') return;
var $item = $(this);
moduleData.parentID = 0;
moduleData.isUpdate = false;
moduleData.createType = 'child';
switch(item.method)
{
case 'addCataLib' :
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('[data-id=' + item.libid + ']a + ul');
$rootDom.append($input);
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('[data-id=' + item.libid + ']a');
var $li = $rootDom.parent();
moduleData.isUpdate = true;
$rootDom.after($input);
$li.addClass('open in has-list');
}
$('#fileTree').data('zui.tree').expand($('li[data-id="' + item.libid + '"]'));
$rootDom.parent().find('input').focus();
break;
case 'addCataBro' :
moduleData.createType = 'same';
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree li[data-id=' + item.id + ']');
$rootDom.after($input);
$rootDom.closest('ul').find('.has-input').css('padding-left', '0');
$('#fileTree').find('input').focus();
break;
case 'addCataChild' :
moduleData.parentID = item.id;
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']a + ul ');
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']li');
moduleData.isUpdate = true;
$rootDom.addClass('open in has-list');
}
$('#fileTree').data('zui.tree').expand($('li[data-id="' + item.id + '"]'));
$rootDom.append($input);
$rootDom.find('input').focus();
break;
}
}).on('click', function()
{
$('.dropdown-in-tree').remove();
});
});
/**
* Ajax delete api doc.
*
+1 -2
View File
@@ -39,7 +39,6 @@ $lang->api->noModule = 'No directory in the API library. Please add the
$lang->api->post = 'Auf Seiten Liste beziehen bei POST Debug';
$lang->api->noUniqueName = 'The API library name exists.';
$lang->api->noUniqueVersion = 'The version exists.';
$lang->api->version = 'Version';
$lang->api->createStruct = 'Create Data Structure';
$lang->api->editStruct = 'Edit Data Structure';
$lang->api->deleteStruct = 'Delete Data Structure';
@@ -66,7 +65,7 @@ $lang->api->noLinked = "No Linked";
/* Common access control lang. */
$lang->api->whiteList = 'Whitelist';
$lang->api->aclList['open'] = "Public <span class='acl-tip'>(Users who can access doccan access it)</span>";
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s or users in the whiltelist can access it)</span>";
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s can access it)</span>";
$lang->api->aclList['private'] = "Private <span class='acl-tip'> (Only the one who created it or users in the whiltelist can access it)</span>";
$lang->api->group = 'Group';
$lang->api->user = 'User';
+1 -2
View File
@@ -39,7 +39,6 @@ $lang->api->noModule = 'No directory in the API library. Please add the
$lang->api->post = 'Please refer to the page form for post debugging';
$lang->api->noUniqueName = 'The API library name exists.';
$lang->api->noUniqueVersion = 'The version exists.';
$lang->api->version = 'Version';
$lang->api->createStruct = 'Create Data Structure';
$lang->api->editStruct = 'Edit Data Structure';
$lang->api->deleteStruct = 'Delete Data Structure';
@@ -66,7 +65,7 @@ $lang->api->noLinked = "No Linked";
/* Common access control lang. */
$lang->api->whiteList = 'Whitelist';
$lang->api->aclList['open'] = "Public <span class='acl-tip'>(Users who can access doccan access it)</span>";
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s or users in the whiltelist can access it)</span>";
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s can access it)</span>";
$lang->api->aclList['private'] = "Private <span class='acl-tip'> (Only the one who created it or users in the whiltelist can access it)</span>";
$lang->api->group = 'Group';
$lang->api->user = 'User';
+1 -2
View File
@@ -39,7 +39,6 @@ $lang->api->noModule = 'No directory in the API library. Please add the
$lang->api->post = 'Se référer à la liste si POST Debug';
$lang->api->noUniqueName = 'The API library name exists.';
$lang->api->noUniqueVersion = 'The version exists.';
$lang->api->version = 'Version';
$lang->api->createStruct = 'Create Data Structure';
$lang->api->editStruct = 'Edit Data Structure';
$lang->api->deleteStruct = 'Delete Data Structure';
@@ -66,7 +65,7 @@ $lang->api->noLinked = "No Linked";
/* Common access control lang. */
$lang->api->whiteList = 'Whitelist';
$lang->api->aclList['open'] = "Public <span class='acl-tip'>(Users who can access doccan access it)</span>";
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s or users in the whiltelist can access it)</span>";
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s can access it)</span>";
$lang->api->aclList['private'] = "Private <span class='acl-tip'> (Only the one who created it or users in the whiltelist can access it)</span>";
$lang->api->group = 'Group';
$lang->api->user = 'User';
+2 -3
View File
@@ -39,7 +39,6 @@ $lang->api->noModule = '库下没有目录,请先维护目录';
$lang->api->post = 'POST方式调试请参照页面表单';
$lang->api->noUniqueName = '库名已存在。';
$lang->api->noUniqueVersion = '版本已存在。';
$lang->api->version = '版本';
$lang->api->createStruct = '创建数据结构';
$lang->api->editStruct = '编辑数据结构';
$lang->api->deleteStruct = '删除数据结构';
@@ -66,7 +65,7 @@ $lang->api->noLinked = "无关联";
/* Common access control lang. */
$lang->api->whiteList = '白名单';
$lang->api->aclList['open'] = "公开 <span class='acl-tip'>(有文档视图权限即可访问)</span>";
$lang->api->aclList['default'] = "默认 <span class='acl-tip'>(有所选%s访问权限用户和白名单用户可以访问)</span>";
$lang->api->aclList['default'] = "默认 <span class='acl-tip'>(有所选%s访问权限用户可以访问)</span>";
$lang->api->aclList['private'] = "私有 <span class='acl-tip'>(仅创建者和白名单用户可访问)</span>";
$lang->api->group = '分组';
$lang->api->user = '用户';
@@ -220,7 +219,7 @@ $lang->apistruct = new stdClass();
$lang->apistruct->name = '结构名';
$lang->api_lib_release = new stdClass();
$lang->api_lib_release->version = '版本';
$lang->api_lib_release->version = '版本号';
$lang->api->error = new stdclass();
$lang->api->error->onlySelect = 'SQL查询接口只允许SELECT查询';
+21 -11
View File
@@ -916,14 +916,13 @@ class apiModel extends model
$this->config->api->search['module'] = 'api';
if(!empty($libs))
{
$queryName = $type . 'apiDoc';
foreach($libs as $lib)
{
if(empty($lib)) continue;
if($lib->type != 'api') continue;
$libPairs[$lib->id] = $lib->name;
}
$this->config->api->search['module'] = $queryName;
$this->config->api->search['module'] = !empty($type) ? $type . 'apiDoc' : 'api';
}
$this->config->api->search['queryID'] = $queryID;
@@ -966,15 +965,14 @@ class apiModel extends model
}
$apiQuery = $this->session->$queryName;
if(strpos($apiQuery, "`lib` = 'all'") === false and !$objectType) $apiQuery = "$apiQuery and lib = $libID";
if(strpos($apiQuery, "`lib` = 'all'") !== false) $apiQuery = str_replace("`lib` = 'all'", '1', $apiQuery);
$list = $this->dao->select('*')
->from(TABLE_API)
->where('deleted')->eq(0)
->andWhere($apiQuery)
->beginIF(!empty($libs))->andWhere('`lib`')->in($libs)->fi()
->fetchAll();
->from(TABLE_API)
->where('deleted')->eq(0)
->andWhere($apiQuery)
->beginIF(!empty($libs))->andWhere('`lib`')->in($libs)->fi()
->fetchAll();
return $list;
}
@@ -996,7 +994,11 @@ class apiModel extends model
->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()
->beginIF(!$this->app->user->admin)
->andWhere('(t2.acl')->eq('open')
->orWhere('t1.id')->in($this->app->user->view->products)
->markRight(1)
->fi()
->fetchAll('id');
foreach($products as $id => $product)
@@ -1019,6 +1021,11 @@ class apiModel extends model
->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()
->beginIF(!$this->app->user->admin)
->andWhere('(t2.acl')->eq('open')
->orWhere('t1.id')->in($this->app->user->view->projects)
->markRight(1)
->fi()
->orderBy('t1.hasProduct_asc')
->fetchAll('id');
@@ -1042,13 +1049,16 @@ class apiModel extends model
*
* @param int $libID
* @param int $libs
* @param int $moduleID
* @param int $objectID
* @param string $browseType bySearch
* @access public
* @return array
*/
public function getLibTree($libID, $libs, $objectID = 0)
public function getLibTree($libID, $libs, $moduleID, $objectID = 0, $browseType = '')
{
$libTree = $this->loadModel('doc')->getLibTree($libID, $libs, 'api', $objectID);
$libTree = $this->loadModel('doc')->getLibTree($libID, $libs, 'api', $moduleID, $objectID, $browseType);
$releases = $this->getReleaseByQuery(array_keys($libs), null, 'lib_asc, id_desc');
foreach($libTree as &$tree)
+10 -10
View File
@@ -22,12 +22,12 @@
</div>
<div class="btn-toolbar pull-right">
<?php
if(common::hasPriv('api', 'struct')) echo html::a($this->createLink('api', 'struct', "libID=$libID"), "<i class='icon-treemap muted'> </i>" . $lang->api->struct, '', "class='btn btn-link'");
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 iframe' data-width='800px'");
if(common::hasPriv('api', 'createRelease')) echo html::a($this->createLink('api', 'createRelease', "libID=$libID"), "<i class='icon-publish muted'> </i>" . $lang->api->createRelease, '', "class='btn btn-link iframe' data-width='800px'");
//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($libTree and common::hasPriv('api', 'struct')) echo html::a($this->createLink('api', 'struct', "libID=$libID"), "<i class='icon-treemap muted'> </i>" . $lang->api->struct, '', "class='btn btn-link'");
if($libTree and 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 iframe' data-width='800px'");
if($libTree and common::hasPriv('api', 'createRelease')) echo html::a($this->createLink('api', 'createRelease', "libID=$libID"), "<i class='icon-publish muted'> </i>" . $lang->api->createRelease, '', "class='btn btn-link iframe' data-width='800px'");
//if($config->edition != 'open' and $libTree and 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', "type=" . ($objectType == 'project' ? 'project' : 'product') . "&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', "libID=$libID&moduleID=$moduleID"), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-primary"');
if($libTree and common::hasPriv('api', 'create')) echo html::a($this->createLink('api', 'create', "libID=$libID&moduleID=$moduleID"), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-primary"');
?>
</div>
</div>
@@ -43,11 +43,11 @@
</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>
<?php include '../../doc/view/lefttree.html.php';?>
</div>
<div class="sidebar-toggle flex-center"><i class="icon icon-angle-left"></i></div>
<div class="main-col flex-full 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>
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" style="min-width: 400px" id="queryBox" data-module='api'></div>
<?php include 'apilist.html.php';?>
</div>
<?php endif;?>
@@ -55,7 +55,7 @@
<div class='hidden' id='dropDownData'>
<ul 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>
<li data-method="addCataLib" data-has-children='%hasChildren%' data-libid='%libID%' data-moduleid="%moduleID%" data-type="add"><a><i class="icon icon-icon-add-directory"></i><?php echo $lang->doc->libDropdown['addModule'];?></a></li>
<?php endif;?>
<?php if(common::hasPriv('api', '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>
@@ -66,8 +66,8 @@
</ul>
<ul 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="addCataBro" data-type="add" data-id="%moduleID%"><a><i class="icon icon-icon-add-directory"></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-icon-add-directory"></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;?>
+6 -6
View File
@@ -154,7 +154,7 @@ class doc extends control
$objects = $this->project->getPairsByProgram();
if($this->app->tab == 'doc')
{
$this->view->executionPairs = $this->execution->getPairs($objectID, 'all', 'multiple,leaf,noprefix,empty');
$this->view->executionPairs = array(0 => '') + $this->execution->getPairs($objectID, 'all', 'multiple,leaf,noprefix');
$this->view->project = $this->project->getById($objectID);
}
}
@@ -1033,7 +1033,6 @@ class doc extends control
$table = $this->config->objectTables[$type];
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
if(!empty($_POST)) $searchTitle = $this->post->title;
if(empty($_POST) and !empty($searchTitle)) $this->post->title = $searchTitle;
/* Load pager. */
@@ -1043,7 +1042,7 @@ class doc extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->app->rawMethod = $rawMethod;
$files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager);
$files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager);
$this->view->title = $object->name;
$this->view->position[] = $object->name;
@@ -1323,7 +1322,8 @@ class doc extends control
}
else
{
$this->session->set('objectName', $this->lang->doc->common, 'admin');
if(in_array($type, array('product', 'project'))) $this->session->set('objectName', $this->lang->doc->common, 'admin');
if($this->config->vision == 'lite' or in_array($type, array('execution', 'custom'))) $this->session->set('objectName', '', 'admin');
$this->view->docs = $browseType == 'bySearch' ? $this->doc->getDocsBySearch($type, $objectID, $libID, $queryID, $orderBy, $pager) : $this->doc->getDocs($libID, $moduleID, $browseType, $orderBy, $pager);
}
@@ -1441,10 +1441,10 @@ class doc extends control
public function ajaxGetExecution($projectID)
{
$executions = $this->execution->getList($projectID);
$executionPairs = array(0 => '') + $this->execution->getPairs($projectID, 'all', 'multiple,leaf,noprefix,empty');
$executionPairs = array(0 => '') + $this->execution->getPairs($projectID, 'all', 'multiple,leaf,noprefix');
$project = $this->project->getById($projectID);
$disabled = $project->multiple ? '' : 'disabled';
return print(html::select('execution', $executionPairs, 0, "class='form-control' data-placeholder='{$this->lang->doclib->tip->selectExecution}' $disabled data-drop_direction='down' data-dropDirection='down'"));
return print(html::select('execution', $executionPairs, 0, "class='form-control' data-placeholder='{$this->lang->doclib->tip->selectExecution}' $disabled data-drop_direction='down' data-drop-direction='down'"));
}
}
+2
View File
@@ -1 +1,3 @@
#mainContent .c-id > a {color: #0c60e1;}
.btn.ajaxCollect {width: 20px; padding: 0px;}
.btn.ajaxCollect > img {width: 20px;}
+2 -45
View File
@@ -1,7 +1,7 @@
.c-id {width: 80px;}
.c-source {width: 300px;}
.c-size {width: 100px;}
.c-type {width: 70px;}
.c-type {width: 90px;}
.flex {display: flex;}
.flex-none {flex: none;}
@@ -50,51 +50,8 @@ span.dotted-line+a {display: block;}
.is-sorting > li ul {display: none!important;}
li.drag-shadow ul {display: none!important;}
.tree-group {position: relative;}
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
.tree li.has-list.open:before {left: 6px;}
.main-table-content {display: flex; gap: 20px;}
.main-table-content > .side {flex: 0 0 300px;}
.main-table-content > .content {flex: 1;}
/* css for mian */
#mainContent > #sideBar {flex: 0 0 150px; overflow-x: auto; padding-right: 5px;}
[lang^=zh] #mainContent > #sideBar {flex: 0 0 180px;}
/* css for tree */
.tree li.has-list.open:before {content: unset;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a {height: 30px;}
.file-tree a.show-icon {padding-right: 15px;}
.flex-between {display: flex; align-items: center; justify-content: space-between;}
.flex-center {display: flex; align-items: center; justify-content: center;}
.flex-start {display: flex; align-items: center;}
.tree li > .list-toggle {top: 4px;}
.input-tree {width: 120px;}
.tree-icon {position: absolute; right: 0;}
.tree li.has-input {overflow: hidden;}
/* css for sidebar */
.sidebar-toggle {flex: 0 0 16px;}
.sidebar-toggle > .icon {width: 12px; height: 30px; margin-top: -10px; line-height: 30px; color: #fff; text-align: center; background: #7dcdfe; border-radius: 6px; cursor: pointer;}
.spliter {flex: 0 0 12px;}
.spliter-btn {height: 28px; width: 10px; background: #fff; position: absolute; top: 30%; left: -1px; border: 1px solid #D9D9D9; border-radius: 2px;}
.spliter-btn > .spliter-inner {width: 4px; height: 12px; border-left: 1px solid #D9D9D9; border-right: 1px solid #D9D9D9;}
#mainContent .table-empty-tip > p, #createDocs {display: inline-block;}
.createDropdown a.btn-primary, .createDropdown a.btn-info {border-right: 1px solid rgba(255,255,255,0.2);}
.createDropdown button.dropdown-toggle.btn-primary, .createDropdown button.dropdown-toggle.btn-info {padding: 6px;}
.createDropdown ul > li {text-align: left;}
.createDropdown .btn.btn-info:hover {box-shadow: none;}
.table .c-name > a:first-child {display: inline-block; max-width: 90%; overflow: hidden;}
.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: -3px;}
table.table > thead > tr {height: 32px;}
#bysearchTab::before {display: none;}
#leftBar .selectBox #currentItem {width: 150px; display: flex; align-items: center;}
[lang^=zh] #leftBar .selectBox #currentItem {width: 180px;}
#leftBar .selectBox #currentItem > .text {overflow: hidden; text-align: left; flex: 0 1 100%;}
#leftBar .searchBox {padding-left: 5px;}
#leftBar .selectBox + .searchBox {padding-left: 5px;}
+2 -48
View File
@@ -9,6 +9,7 @@
.overflow-auto {overflow: auto;}
.overflow-visible {overflow: visible;}
.overflow-hidden {overflow: hidden;}
#main {padding-bottom: 0;}
.img-lib {width: 14px; height: 14px; margin-bottom: 2px; flex: 0 0 14px;}
#mainContent {padding-top: 0; padding-bottom: 0;}
#mainContent #createDropdown {display: inline-block;}
@@ -45,57 +46,10 @@ span.dotted-line+a {display: block;}
.is-sorting > li ul {display: none!important;}
li.drag-shadow ul {display: none!important;}
.tree-group {position: relative;}
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
.tree li.has-list.open:before {left: 6px;}
.main-table-content {display: flex; gap: 20px;}
.main-table-content > .side {flex: 0 0 300px;}
.main-table-content > .content {flex: 1;}
/* css for mian */
#mainContent > #sideBar {flex: 0 0 150px; overflow-x: auto; padding-right: 5px;}
[lang^=zh] #mainContent > #sideBar {flex: 0 0 180px;}
/* css for tree */
.tree li.has-list.open:before {content: unset;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a {height: 30px;}
.flex-between {display: flex; align-items: center; justify-content: space-between;}
.flex-center {display: flex; align-items: center; justify-content: center;}
.flex-start {display: flex; align-items: center;}
.tree li > .list-toggle {top: 4px;}
.input-tree {width: 120px;}
.tree-icon {position: absolute; right: 0;}
.tree li.has-input {overflow: hidden;}
.img-lib {flex: 0 0 16px; height: 14px;}
.tree-icon {position: absolute; right: 0;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a.show-icon > div {padding-right: 15px;}
.tree li.has-input {overflow: hidden;}
/* css for sidebar */
.sidebar-toggle {flex: 0 0 16px;}
.sidebar-toggle > .icon {width: 12px; height: 30px; margin-top: -10px; line-height: 30px; color: #fff; text-align: center; background: #7dcdfe; border-radius: 6px; cursor: pointer;}
.spliter {flex: 0 0 12px;}
.spliter-btn {height: 28px; width: 10px; background: #fff; position: absolute; top: 30%; left: -1px; border: 1px solid #D9D9D9; border-radius: 2px;}
.spliter-btn > .spliter-inner {width: 4px; height: 12px; border-left: 1px solid #D9D9D9; border-right: 1px solid #D9D9D9;}
#mainContent .table-empty-tip > p, #createDocs {display: inline-block;}
.createDropdown a.btn-primary, .createDropdown a.btn-info {border-right: 1px solid rgba(255,255,255,0.2);}
.createDropdown button.dropdown-toggle.btn-primary, .createDropdown button.dropdown-toggle.btn-info {padding: 6px;}
.createDropdown ul > li {text-align: left;}
.createDropdown .btn.btn-info:hover {box-shadow: none;}
.table .c-name > .doc-title {display: inline-block; max-width: 90%; overflow: hidden; background: transparent; padding-right:0px;}
.table .c-name > .draft {background-color:rgba(129, 102, 238, 0.12); color:#8166EE;}
.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: -3px;}
table.table > thead > tr {height: 32px;}
#bysearchTab::before {display: none;}
#leftBar .selectBox #currentItem {width: 150px; display: flex; align-items: center;}
[lang^=zh] #leftBar .selectBox #currentItem {width: 180px;}
#leftBar .selectBox #currentItem > .text {overflow: hidden; text-align: left; flex: 0 1 100%;}
#queryBox #groupAndOr {min-width: 60px;}
+2 -2
View File
@@ -297,13 +297,13 @@ $(document).ready(function()
{
if(response.status == 'yes')
{
obj.children('i').removeClass().addClass('icon icon-star text-yellow');
obj.children('img').attr('src', 'static/svg/star.svg');
obj.parent().prev().children('.file-name').children('i').remove('.icon');
obj.parent().prev().children('.file-name').prepend('<i class="icon icon-star text-yellow"></i> ');
}
else
{
obj.children('i').removeClass().addClass('icon icon-star-empty');
obj.children('img').attr('src', 'static/svg/star-empty.svg');
obj.parent().prev().children('.file-name').children('i').remove(".icon");
}
}, 'json');
+4
View File
@@ -18,12 +18,16 @@ function changeDoclibAcl(libType)
$('.apilib').removeClass('hidden');
$('#mainContent table th').css('width', '100px');
$('#aclBox').find('td').html($('#aclAPIBox td').html());
$('.executionBox').addClass('hidden');
}
else
{
$('.apilib').addClass('hidden');
$('#mainContent table th').css('width', '70px');
$('#aclBox').find('td').html($('#aclOtherBox td').html());
$('.executionBox').removeClass('hidden');
}
$('#whiteListBox').addClass('hidden');
}
+7 -326
View File
@@ -1,335 +1,16 @@
$(function()
{
if(tab != 'doc') return;
$('#navbar .nav li').removeClass('active');
$("#navbar .nav li[data-id=" + type + ']').addClass('active');
/**
* Render Dropdown dom.
*
* @access public
* @return string
*/
function renderDropdown(option)
$('#leftBar .searchBox #title').keypress(function(e)
{
var libClass = '.libDorpdown';
if(option.type != 'dropDownLibrary') libClass = '.moduleDorpdown';
if($(libClass).find('li').length == 0) return '';
var dropdown = '<ul class="dropdown-menu dropdown-in-tree" id="' + option.type + '" style="display: unset; left:' + option.left + 'px; top:' + option.top + 'px;">';
dropdown += $(libClass).html().replace(/%libID%/g, option.libID).replace(/%moduleID%/g, option.moduleID).replace(/%hasChildren%/g, option.hasChildren);
dropdown += '</ul>';
return dropdown;
}
var imgObj = {
'annex': 'annex',
'lib': 'wiki-file-lib',
'api': 'interface'
}
$('#fileTree').tree(
{
initialState: 'active',
data: treeData,
itemCreator: function($li, item)
if(e.which == 13)
{
var libClass = ['lib', 'annex', 'api', 'execution'].indexOf(item.type) !== -1 ? 'lib' : '';
var hasChild = item.children ? !!item.children.length : false;
var link = item.hasAction ? '###' : '#';
var $item = '<a href="' + link + '" style="position: relative" data-has-children="' + hasChild + '" title="' + item.name + '" data-id="' + item.id + '" class="' + libClass + '" data-type="' + item.type + '" data-action="' + item.hasAction + '">';
$item += '<div class="text h-full w-full flex-start overflow-hidden">';
if(libClass == 'lib' && item.type != 'execution') $item += '<div class="img-lib" style="background-image:url(static/svg/' + imgObj[item.type || 'lib'] + '.svg)"></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');
$(this).closest('form').attr('action', searchLink.replace('%s', $(this).val()));
}
});
$('li.has-list > ul, #fileTree').addClass("menu-active-primary menu-hover-primary");
$('#fileTree').on('mousemove', 'a', function()
$('#leftBar .searchBox #submit').click(function(e)
{
if($(this).data('type') == 'annex') return;
if(!$(this).data('action')) return;
var libClass = '.libDorpdown';
if(!$(this).hasClass('lib')) libClass = '.moduleDorpdown';
$(this).find('.icon').removeClass('hidden');
$(this).addClass('show-icon'); if($(libClass).find('li').length == 0) return false;
}).on('mouseout', 'a', function()
{
$(this).find('.icon').addClass('hidden');
$(this).removeClass('show-icon');
}).on('click', 'a', function(e)
{
if(!$(this).data('action')) return;
var isLib = $(this).hasClass('lib');
var moduleID = $(this).data('id');
var libID = 0;
var params = '';
if(isLib)
{
if($(this).data('type') == 'annex' && !canViewFiles) return false;
libID = moduleID;
moduleID = 0;
}
else
{
libID = $(this).closest('.lib').data('id');
}
linkParams = linkParams.replace('%s', '&libID=' + libID + '&moduleID=' + moduleID);
var link = $(this).data('type') == 'annex' ? createLink('doc', 'showFiles', 'type=' + objectType + '&objectID=' + objectID) : createLink('doc', 'tableContents', linkParams);
location.href = link
var searchTitle = $(this).prev('#title').val();
$(this).closest('form').attr('action', searchLink.replace('%s', searchTitle));
});
var moduleData = {
"name" : "",
"createType" : "",
"libID" : "",
"parentID" : "",
"objectID" : "",
"moduleType" : "",
"order" : "",
"isUpdate" : ""
};
$('#fileTree').on('click', '.icon-drop', function(e)
{
$('.dropdown-in-tree').css('display', 'none');
var isCatalogue = $(this).attr('data-isCatalogue') === 'false' ? false : true;
var dropDownID = isCatalogue ? 'dropDownCatalogue' : 'dropDownLibrary';
var libID = 0;
var moduleID = 0;
var parentID = 0;
var $module = $(this).closest('a');
var hasChildren = $module.data('has-children');
var moduleType = '';
if($module.hasClass('lib'))
{
libID = $module.data('id');
moduleType = $module.data('type');
parentID = libID;
}
else
{
moduleID = $module.data('id');
libID = $module.closest('.lib').data('id');
moduleType = $module.closest('.lib').data('type');
parentID = $module.closest('ul').closest('.lib').data('id');
}
moduleData = {
"libID" : libID,
"parentID" : parentID,
"objectID" : moduleID,
"moduleType": moduleType == 'lib' ? 'doc' : moduleType,
};
var option = {
left : e.pageX,
top : e.pageY,
type : dropDownID,
libID : libID,
moduleID : moduleID,
hasChildren : hasChildren
};
var dropDown = renderDropdown(option);
$(".m-doc-showfiles").append(dropDown);
e.stopPropagation();
}).on('blur', '.file-tree input.input-tree', function()
{
var $input = $(this);
var value = $input.val();
if(!value)
{
$input.closest('[data-id=insert]').remove();
return;
}
moduleData.name = value;
$.post(createLink('tree', 'ajaxCreateModule'), moduleData, function(result)
{
result = JSON.parse(result);
if(result.result == 'fail')
{
bootbox.alert(
result.message[0],
function()
{
setTimeout(function()
{
$('.file-tree .input-tree').focus()
}, 10)
}
);
return false;
}
var module = result.module;
var resultDom = $('[data-id=aTreeModal]').html().replace(/%name%/g, module.name).replace(/%id%/g, module.id).replace('insert', module.id);
$input.closest('ul').find('.has-input').css('padding-left', '15px');
$input.after(resultDom);
$input.remove();
if(moduleData.isUpdate)
{
$.getJSON(createLink('doc', 'tableContents', 'type=' + objectType + '&objectID=' + objectID , 'json'), function(data){
var treeData = JSON.parse(data.data);
$('#fileTree').data('zui.tree').reload(treeData.libTree);
$('li.has-list > ul').addClass("menu-active-primary menu-hover-primary");
});
}
});
});
$('body').on('click', function()
{
$('.dropdown-in-tree').remove();
}).on('click', '.sidebar-toggle', function()
{
var $icon = $(this).find('.icon');
if($('#sideBar').hasClass('hidden'))
{
$icon.addClass('icon-angle-left');
$icon.removeClass('icon-angle-right');
$('#sideBar').removeClass('hidden');
}
else
{
$icon.addClass('icon-angle-right');
$icon.removeClass('icon-angle-left');
$('#sideBar').addClass('hidden');
}
}).on('click', '.dropdown-in-tree li', function(e)
{
var item = $(this).data();
if($(this).hasClass('edit-module'))
{
new $.zui.ModalTrigger({
keyboard : true,
type : 'ajax',
url : $(this).find('a').data('href')
}).show();
}
if(item.type !== 'add') return;
var $item = $(this);
moduleData.parentID = 0;
moduleData.isUpdate = false;
moduleData.createType = 'child';
switch(item.method)
{
case 'addCataLib' :
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('[data-id=' + item.libid + ']a + ul');
$rootDom.append($input);
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('[data-id=' + item.libid + ']a');
var $li = $rootDom.parent();
moduleData.isUpdate = true;
$rootDom.after($input);
$li.addClass('open in has-list');
}
$('#fileTree').data('zui.tree').expand($('li[data-id="' + item.libid + '"]'));
$rootDom.parent().find('input').focus();
break;
case 'addCataBro' :
moduleData.createType = 'same';
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree li[data-id=' + item.id + ']');
$rootDom.after($input);
$rootDom.closest('ul').find('.has-input').css('padding-left', '0');
$('#fileTree').find('input').focus();
break;
case 'addCataChild' :
moduleData.parentID = item.id;
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']a + ul ');
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']li');
moduleData.isUpdate = true;
$rootDom.addClass('open in has-list');
}
$('#fileTree').data('zui.tree').expand($('li[data-id="' + item.id + '"]'));
$rootDom.append($input);
$rootDom.find('input').focus();
break;
}
}).on('blur', '.file-tree input.input-tree', function()
{
var $input = $(this);
var value = $input.val();
if(!value)
{
$input.closest('[data-id=insert]').remove();
return;
}
moduleData.name = value;
$.post(createLink('tree', 'ajaxCreateModule'), moduleData, function(result)
{
result = JSON.parse(result);
if(result.result == 'fail')
{
bootbox.alert(
result.message[0],
function()
{
setTimeout(function()
{
$('.file-tree .input-tree').focus()
}, 10)
}
);
return false;
}
var module = result.module;
var resultDom = $('[data-id=aTreeModal]').html().replace(/%name%/g, module.name).replace(/%id%/g, module.id).replace('insert', module.id);
$input.closest('ul').find('.has-input').css('padding-left', '15px');
$input.after(resultDom);
$input.remove();
if(moduleData.isUpdate)
{
$.getJSON(createLink('doc', 'tableContents', 'type=' + objectType + '&objectID=' + objectID , 'json'), function(data){
var treeData = JSON.parse(data.data);
$('#fileTree').data('zui.tree').reload(treeData.libTree);
$('li.has-list > ul').addClass("menu-active-primary menu-hover-primary");
});
}
});
}).on('keydown', '.file-tree input.input-tree', function(e)
{
if(e.keyCode == 13) $(this).trigger('blur');
}).on('click', '#mainMenu .btn-toolbar a, .no-content-button a', function()
{
if(libType == 'api')
{
$.cookie('objectType', objectType, {expires: config.cookieLife, path: config.webRoot});
$.cookie('objectID', objectID, {expires: config.cookieLife, path: config.webRoot});
}
});
});
})
-327
View File
@@ -8,331 +8,4 @@ $(function()
$this.find('.doc-title').css('max-width', parseInt($this.width()) - parseInt($this.find('.draft').width()) - parseInt($this.find('.ajaxCollect').width()) - parseInt($this.find('.file-icon').width()) - 24);
}
});
/**
* Render Dropdown dom.
*
* @access public
* @return string
*/
function renderDropdown(option)
{
var libClass = '.libDorpdown';
if(option.type != 'dropDownLibrary') libClass = '.moduleDorpdown';
if($(libClass).find('li').length == 0) return '';
var dropdown = '<ul class="dropdown-menu dropdown-in-tree" id="' + option.type + '" style="display: unset; left:' + option.left + 'px; top:' + option.top + 'px;">';
dropdown += $(libClass).html().replace(/%libID%/g, option.libID).replace(/%moduleID%/g, option.moduleID).replace(/%hasChildren%/g, option.hasChildren);
dropdown += '</ul>';
return dropdown;
}
var imgObj = {
'annex': 'annex',
'lib': 'wiki-file-lib',
'api': 'interface'
}
$('#fileTree').tree(
{
initialState: 'active',
data: treeData,
itemCreator: function($li, item)
{
var libClass = ['lib', 'annex', 'api', 'execution'].indexOf(item.type) !== -1 ? 'lib' : '';
var hasChild = item.children ? !!item.children.length : false;
var link = item.hasAction ? '###' : '#';
var $item = '<a href="' + link + '" style="position: relative" data-has-children="' + hasChild + '" title="' + item.name + '" data-id="' + item.id + '" class="' + libClass + '" data-type="' + item.type + '" data-action="' + item.hasAction + '">';
$item += '<div class="text h-full w-full flex-start overflow-hidden">';
if(libClass == 'lib' && item.type != 'execution') $item += '<div class="img-lib" style="background-image:url(static/svg/' + imgObj[item.type || 'lib'] + '.svg)"></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="' + (libClass ? 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;
if(!$(this).data('action')) return;
var libClass = '.libDorpdown';
if(!$(this).hasClass('lib')) libClass = '.moduleDorpdown';
$(this).find('.icon').removeClass('hidden');
$(this).addClass('show-icon'); if($(libClass).find('li').length == 0) return false;
}).on('mouseout', 'a', function()
{
$(this).find('.icon').addClass('hidden');
$(this).removeClass('show-icon');
}).on('click', 'a', function(e)
{
if(!$(this).data('action')) return;
var isLib = $(this).hasClass('lib');
var moduleID = $(this).data('id');
var libID = 0;
var params = '';
if(isLib)
{
if($(this).data('type') == 'annex' && !canViewFiles) return false;
libID = moduleID;
moduleID = 0;
}
else
{
libID = $(this).closest('.lib').data('id');
}
linkParams = linkParams.replace('%s', '&libID=' + libID + '&moduleID=' + moduleID);
var link = $(this).data('type') == 'annex' ? createLink('doc', 'showFiles', 'type=' + objectType + '&objectID=' + objectID) : createLink('doc', 'tableContents', linkParams);
location.href = link
});
var moduleData = {
"name" : "",
"createType" : "",
"libID" : "",
"parentID" : "",
"objectID" : "",
"moduleType" : "",
"order" : "",
"isUpdate" : ""
};
$('#fileTree').on('click', '.icon-drop', function(e)
{
$('.dropdown-in-tree').css('display', 'none');
var isCatalogue = $(this).attr('data-isCatalogue') === 'false' ? false : true;
var dropDownID = isCatalogue ? 'dropDownCatalogue' : 'dropDownLibrary';
var libID = 0;
var moduleID = 0;
var parentID = 0;
var $module = $(this).closest('a');
var hasChildren = $module.data('has-children');
var moduleType = '';
if($module.hasClass('lib'))
{
libID = $module.data('id');
moduleType = $module.data('type');
parentID = libID;
}
else
{
moduleID = $module.data('id');
libID = $module.closest('.lib').data('id');
moduleType = $module.closest('.lib').data('type');
parentID = $module.closest('ul').closest('.lib').data('id');
}
moduleData = {
"libID" : libID,
"parentID" : parentID,
"objectID" : moduleID,
"moduleType": moduleType == 'lib' ? 'doc' : moduleType,
};
var option = {
left : e.pageX,
top : e.pageY,
type : dropDownID,
libID : libID,
moduleID : moduleID,
hasChildren : hasChildren
};
var dropDown = renderDropdown(option);
$(".m-doc-tablecontents").append(dropDown);
e.stopPropagation();
}).on('blur', '.file-tree input.input-tree', function()
{
var $input = $(this);
var value = $input.val();
if(!value)
{
$input.closest('[data-id=insert]').remove();
return;
}
moduleData.name = value;
$.post(createLink('tree', 'ajaxCreateModule'), moduleData, function(result)
{
result = JSON.parse(result);
if(result.result == 'fail')
{
bootbox.alert(
result.message[0],
function()
{
setTimeout(function()
{
$('.file-tree .input-tree').focus()
}, 10)
}
);
return false;
}
var module = result.module;
var resultDom = $('[data-id=aTreeModal]').html().replace(/%name%/g, module.name).replace(/%id%/g, module.id).replace('insert', module.id);
$input.closest('ul').find('.has-input').css('padding-left', '15px');
$input.after(resultDom);
$input.remove();
if(moduleData.isUpdate)
{
$.getJSON(createLink('doc', 'tableContents', 'type=' + objectType + '&objectID=' + objectID , 'json'), function(data){
var treeData = JSON.parse(data.data);
$('#fileTree').data('zui.tree').reload(treeData.libTree);
$('li.has-list > ul').addClass("menu-active-primary menu-hover-primary");
});
}
});
});
$('body').on('click', function()
{
$('.dropdown-in-tree').remove();
}).on('click', '.sidebar-toggle', function()
{
var $icon = $(this).find('.icon');
if($('#sideBar').hasClass('hidden'))
{
$icon.addClass('icon-angle-left');
$icon.removeClass('icon-angle-right');
$('#sideBar').removeClass('hidden');
}
else
{
$icon.addClass('icon-angle-right');
$icon.removeClass('icon-angle-left');
$('#sideBar').addClass('hidden');
}
var $docListForm = $('#docListForm').data('zui.table');
$docListForm.fixHeader();
$docListForm.fixFooter();
}).on('click', '.dropdown-in-tree li', function(e)
{
var item = $(this).data();
if($(this).hasClass('edit-module'))
{
new $.zui.ModalTrigger({
keyboard : true,
type : 'ajax',
url : $(this).find('a').data('href')
}).show();
}
if(item.type !== 'add') return;
var $item = $(this);
moduleData.parentID = 0;
moduleData.isUpdate = false;
moduleData.createType = 'child';
switch(item.method)
{
case 'addCataLib' :
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('[data-id=' + item.moduleid+ ']a + ul');
$rootDom.append($input);
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('[data-id=' + item.libid + ']a');
var $li = $rootDom.parent();
moduleData.isUpdate = true;
$rootDom.after($input);
$li.addClass('open in has-list');
}
$('#fileTree').data('zui.tree').expand($('li[data-id="' + item.libid + '"]'));
$rootDom.parent().find('input').focus();
break;
case 'addCataBro' :
moduleData.createType = 'same';
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree li[data-id=' + item.id + ']');
$rootDom.after($input);
$rootDom.closest('ul').find('.has-input').css('padding-left', '0');
$('#fileTree').find('input').focus();
break;
case 'addCataChild' :
moduleData.parentID = item.id;
console.log(item);
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']a + ul');
var $rootDom = $('#fileTree [data-id=' + item.id + ']a + ul');
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']li');
moduleData.isUpdate = true;
$rootDom.addClass('open in has-list');
}
$('#fileTree').data('zui.tree').expand($('li[data-id="' + item.id + '"]'));
$rootDom.append($input);
$rootDom.find('input').focus();
break;
}
}).on('blur', '.file-tree input.input-tree', function()
{
var $input = $(this);
var value = $input.val();
if(!value)
{
$input.closest('[data-id=insert]').remove();
return;
}
moduleData.name = value;
$.post(createLink('tree', 'ajaxCreateModule'), moduleData, function(result)
{
result = JSON.parse(result);
if(result.result == 'fail')
{
bootbox.alert(
result.message[0],
function()
{
setTimeout(function()
{
$('.file-tree .input-tree').focus()
}, 10)
}
);
return false;
}
var module = result.module;
var resultDom = $('[data-id=aTreeModal]').html().replace(/%name%/g, module.name).replace(/%id%/g, module.id).replace('insert', module.id);
$input.closest('ul').find('.has-input').css('padding-left', '15px');
$input.after(resultDom);
$input.remove();
if(moduleData.isUpdate)
{
$.getJSON(createLink('doc', 'tableContents', 'type=' + objectType + '&objectID=' + objectID , 'json'), function(data){
var treeData = JSON.parse(data.data);
$('#fileTree').data('zui.tree').reload(treeData.libTree);
$('li.has-list > ul').addClass("menu-active-primary menu-hover-primary");
});
}
});
}).on('keydown', '.file-tree input.input-tree', function(e)
{
if(e.keyCode == 13) $(this).trigger('blur');
});
});
+6 -1
View File
@@ -19,7 +19,7 @@ $lang->doclib->all = 'Alle Bibliotheken';
$lang->doclib->select = 'Auswahl';
$lang->doclib->execution = $lang->executionCommon . ' Bibliothek';
$lang->doclib->product = $lang->productCommon . ' Bibliothek';
$lang->doclib->apiLibName = 'Api Library Name';
$lang->doclib->apiLibName = 'Library Name';
$lang->doclib->privateACL = "Private <span class='acl-tip'>(Only creators and whitelisted users with %s permissions can access it)</span>";
$lang->doclib->tip = new stdclass();
@@ -55,6 +55,11 @@ $lang->doclib->tabList['custom'] = 'Custom';
$lang->doclib->nameList['custom'] = 'Custom Name';
$lang->doclib->apiNameUnique = array();
$lang->doclib->apiNameUnique['product'] = 'In the api library of the same ' . $lang->productCommon . ', ';
$lang->doclib->apiNameUnique['project'] = 'In the api library of the same ' . $lang->projectCommon . ', ';
$lang->doclib->apiNameUnique['nolink'] = 'In the no linked api library, ';
/* Fields. */
$lang->doc->common = 'Dok';
$lang->doc->id = 'ID';
+6 -1
View File
@@ -19,7 +19,7 @@ $lang->doclib->all = 'All Libraries';
$lang->doclib->select = 'Select';
$lang->doclib->execution = $lang->executionCommon . ' Library';
$lang->doclib->product = $lang->productCommon . ' Library';
$lang->doclib->apiLibName = 'Api Library Name';
$lang->doclib->apiLibName = 'Library Name';
$lang->doclib->privateACL = "Private <span class='acl-tip'>(Only creators and whitelisted users with %s permissions can access it)</span>";
$lang->doclib->tip = new stdclass();
@@ -55,6 +55,11 @@ $lang->doclib->tabList['custom'] = 'Custom';
$lang->doclib->nameList['custom'] = 'Custom Name';
$lang->doclib->apiNameUnique = array();
$lang->doclib->apiNameUnique['product'] = 'In the api library of the same ' . $lang->productCommon . ', ';
$lang->doclib->apiNameUnique['project'] = 'In the api library of the same ' . $lang->projectCommon . ', ';
$lang->doclib->apiNameUnique['nolink'] = 'In the no linked api library, ';
/* Fields. */
$lang->doc->common = 'Document';
$lang->doc->id = 'ID';
+6 -1
View File
@@ -19,7 +19,7 @@ $lang->doclib->all = 'Toutes les Libraries';
$lang->doclib->select = 'Sélect.';
$lang->doclib->execution = 'Bibliothèque ' . $lang->executionCommon;
$lang->doclib->product = $lang->productCommon . ' Library';
$lang->doclib->apiLibName = 'Api Library Name';
$lang->doclib->apiLibName = 'Library Name';
$lang->doclib->privateACL = "Private <span class='acl-tip'>(Only creators and whitelisted users with %s permissions can access it)</span>";
$lang->doclib->tip = new stdclass();
@@ -55,6 +55,11 @@ $lang->doclib->tabList['custom'] = 'Personnelle';
$lang->doclib->nameList['custom'] = 'Nom personnalisé';
$lang->doclib->apiNameUnique = array();
$lang->doclib->apiNameUnique['product'] = 'In the api library of the same ' . $lang->productCommon . ', ';
$lang->doclib->apiNameUnique['project'] = 'In the api library of the same ' . $lang->projectCommon . ', ';
$lang->doclib->apiNameUnique['nolink'] = 'In the no linked api library, ';
/* Fields. */
$lang->doc->common = 'Gestion Documentaire';
$lang->doc->id = 'ID';
+6 -1
View File
@@ -19,7 +19,7 @@ $lang->doclib->all = '所有文档库';
$lang->doclib->select = '选择文档库';
$lang->doclib->execution = $lang->executionCommon . '库';
$lang->doclib->product = $lang->productCommon . '库';
$lang->doclib->apiLibName = '接口库名称';
$lang->doclib->apiLibName = '库名称';
$lang->doclib->privateACL = "私有 <span class='acl-tip'>(仅创建者和有%s权限的白名单用户可访问)</span>";
$lang->doclib->tip = new stdclass();
@@ -55,6 +55,11 @@ $lang->doclib->tabList['custom'] = '自定义';
$lang->doclib->nameList['custom'] = '自定义文档库名称';
$lang->doclib->apiNameUnique = array();
$lang->doclib->apiNameUnique['product'] = '同一' . $lang->productCommon . '下的接口库中';
$lang->doclib->apiNameUnique['project'] = '同一' . $lang->projectCommon . '下的接口库中';
$lang->doclib->apiNameUnique['nolink'] = '无关联接口库中';
/* 字段列表。*/
$lang->doc->common = '文档';
$lang->doc->id = 'ID';
+63 -16
View File
@@ -194,9 +194,9 @@ class docModel extends model
public function createLib()
{
$lib = fixer::input('post')
->setForce('product', $this->post->type == 'product' ? $this->post->product : 0)
->setForce('project', $this->post->type == 'project' ? $this->post->project : 0)
->setForce('execution', $this->post->type == 'execution' || $this->post->execution ? $this->post->execution : 0)
->setForce('product', ($this->post->type == 'product' and !empty($_POST['product'])) ? $this->post->product : 0)
->setForce('project', ($this->post->type == 'project' and !empty($_POST['project'])) ? $this->post->project : 0)
->setForce('execution', ($this->post->libType != 'api' and !empty($_POST['execution'])) ? $this->post->execution : 0)
->join('groups', ',')
->join('users', ',')
->add('addedBy', $this->app->user->account)
@@ -210,7 +210,11 @@ class docModel extends model
$execution = $this->loadModel('execution')->getByID($lib->execution);
$lib->project = $execution->project;
}
if($this->post->libType == 'api') $lib->type = 'api';
if($this->post->libType == 'api')
{
$lib->type = 'api';
$this->checkApiLibName($lib, $this->post->type);
}
$lib->name = trim($lib->name); //Temporary treatment: Code for bug #15528.
$this->dao->insert(TABLE_DOCLIB)->data($lib)->autoCheck()
@@ -228,13 +232,15 @@ class docModel extends model
*/
public function createApiLib()
{
$libType = $this->post->libType;
$data = fixer::input('post')
->trim('name')
->join('groups', ',')
->join('users', ',')
->setForce('product', $this->post->libType == 'product' ? $this->post->product : 0)
->setForce('project', $this->post->libType == 'project' ? $this->post->project : 0)
->setForce('execution', $this->post->libType == 'project' ? $this->post->execution : 0)
->setForce('product', ($libType == 'product' and !empty($_POST['product'])) ? $this->post->product : 0)
->setForce('project', ($libType == 'project' and !empty($_POST['project'])) ? $this->post->project : 0)
->setForce('execution', ($libType == 'project' and !empty($_POST['execution'])) ? $this->post->execution : 0)
->add('addedBy', $this->app->user->account)
->add('addedDate', helper::now())
->remove('uid,contactListMenu,libType')
@@ -248,13 +254,16 @@ class docModel extends model
$this->lang->doclib->project = $this->lang->api->project;
$this->lang->doclib->product = $this->lang->api->product;
if($this->post->libType == 'product') $this->config->api->createlib->requiredFields .= ',product';
if($this->post->libType == 'project') $this->config->api->createlib->requiredFields .= ',project';
if($libType == 'product') $this->config->api->createlib->requiredFields .= ',product';
if($libType == 'project') $this->config->api->createlib->requiredFields .= ',project';
$this->checkApiLibName($data, $libType);
if(dao::isError()) return false;
$data->type = static::DOC_TYPE_API;
$this->dao->insert(TABLE_DOCLIB)->data($data)->autoCheck()
->batchCheck($this->config->api->createlib->requiredFields, 'notempty')
->check('name', 'unique', "`type` = '" . static::DOC_TYPE_API . "'")
->exec();
return $this->dao->lastInsertID();
@@ -269,14 +278,15 @@ class docModel extends model
*/
public function updateApiLib($id)
{
$oldLib = $this->getLibById($id);
$oldLib = $this->getLibById($id);
$libType = $this->post->libType;
$data = fixer::input('post')
->trim('name')
->join('groups', ',')
->join('users', ',')
->setForce('product', $this->post->libType == 'product' ? $this->post->product : 0)
->setForce('project', $this->post->libType == 'project' ? $this->post->project : 0)
->setForce('product', $libType == 'product' ? $this->post->product : 0)
->setForce('project', $libType == 'project' ? $this->post->project : 0)
->remove('uid,contactListMenu,libType')
->get();
@@ -288,8 +298,12 @@ class docModel extends model
$this->lang->doclib->project = $this->lang->api->project;
$this->lang->doclib->product = $this->lang->api->product;
if($this->post->libType == 'product') $this->config->api->createlib->requiredFields .= ',product';
if($this->post->libType == 'project') $this->config->api->createlib->requiredFields .= ',project';
if($libType == 'product') $this->config->api->createlib->requiredFields .= ',product';
if($libType == 'project') $this->config->api->createlib->requiredFields .= ',project';
$this->checkApiLibName($data, $libType, $id);
if(dao::isError()) return false;
$data->type = static::DOC_TYPE_API;
$this->dao->update(TABLE_DOCLIB)->data($data)->autoCheck()
@@ -336,6 +350,16 @@ class docModel extends model
}
if($oldLib->acl != $lib->acl and $lib->acl == 'open') $lib->users = '';
if($oldLib->type == 'api')
{
$type = 'nolink';
if(!empty($oldLib->product)) $type = 'product';
if(!empty($oldLib->project)) $type = 'project';
$lib->product = $oldLib->product;
$lib->project = $oldLib->project;
$this->checkApiLibName($lib, $type, $libID);
}
$lib->name = trim($lib->name); //Temporary treatment: Code for bug #15528.
$this->dao->update(TABLE_DOCLIB)->data($lib)->autoCheck()
->batchCheck($this->config->doc->editlib->requiredFields, 'notempty')
@@ -2670,7 +2694,7 @@ class docModel extends model
}
$tab = strpos(',doc,product,project,execution,', ",{$this->app->tab},") !== false ? $this->app->tab : 'doc';
if($tab != 'doc') $this->loadModel($type)->setMenu($objectID);
if($tab != 'doc' and method_exists($type . 'Model', 'setMenu')) $this->loadModel($type)->setMenu($objectID);
return array($libs, $libID, $object, $objectID, $objectDropdown);
}
@@ -2985,4 +3009,27 @@ class docModel extends model
}
return $modules;
}
/**
* Check api library name.
*
* @param object $lib
* @param string $libType
* @access public
* @return void
*/
public function checkApiLibName($lib, $libType, $libID = 0)
{
$sameNames = $this->dao->select('*')
->from(TABLE_DOCLIB)
->where('`product`')->eq($lib->product)
->andWhere('`project`')->eq($lib->project)
->andWhere('`name`')->eq($lib->name)
->andWhere('`type`')->eq('api')
->beginIF(!empty($libID))->andWhere('`id`')->ne($libID)->fi()
->fetchAll();
if(count($sameNames) > 0 and $libType == 'product') dao::$errors['name'] = $this->lang->doclib->apiNameUnique[$libType] . sprintf($this->lang->error->unique, $this->lang->doclib->name, $lib->name);
if(count($sameNames) > 0 and $libType == 'project') dao::$errors['name'] = $this->lang->doclib->apiNameUnique[$libType] . sprintf($this->lang->error->unique, $this->lang->doclib->name, $lib->name);
if(count($sameNames) > 0 and $libType == 'nolink') dao::$errors['name'] = $this->lang->doclib->apiNameUnique[$libType] . sprintf($this->lang->error->unique, $this->lang->doclib->name, $lib->name);
}
}
+2 -2
View File
@@ -47,7 +47,7 @@
</thead>
<tbody>
<?php foreach($docs as $doc):?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'star' : 'star-empty';?>
<?php $collectTitle = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<tr>
<?php if($browseType !== 'bySearch'):?>
@@ -82,7 +82,7 @@
<td class="c-actions">
<?php if(common::canBeChanged('doc', $doc)):?>
<?php if(common::hasPriv('doc', 'collect')):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><?php echo html::image("static/svg/{$star}.svg");?></a>
<?php endif;?>
<?php common::printLink('doc', 'edit', "docID=$doc->id&comment=false", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link'", true, false)?>
<?php common::printLink('doc', 'delete', "docID=$doc->id&confirm=no", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
+2 -2
View File
@@ -40,8 +40,8 @@
}
?>
<?php if(common::hasPriv('doc', 'collect')):?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $lang->doc->collect;?>" class='ajaxCollect btn btn-link'><i class='icon <?php echo $star;?>'></i></a>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'star' : 'star-empty';?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $lang->doc->collect;?>" class='ajaxCollect btn btn-link'><?php echo html::image("static/svg/{$star}.svg");?></a>
<?php endif;?>
<?php if($this->config->edition == 'max' and $this->app->tab == 'project'):?>
+8 -2
View File
@@ -13,6 +13,12 @@
<?php include '../../common/view/header.lite.html.php';?>
<?php include '../../common/view/chosen.html.php';?>
<?php js::set('libType', $type);?>
<?php if($type == 'project'):?>
<style> tr > td.form-actions {padding-bottom: 30px !important;}</style>
<?php endif;?>
<?php if($type == 'execution'):?>
<style> tr > td.form-actions {padding-bottom: 60px !important;}</style>
<?php endif;?>
<div id="main">
<div class="container">
<div id='mainContent' class='main-content'>
@@ -25,14 +31,14 @@
<?php if(in_array($type, array('product', 'project', 'execution'))):?>
<tr class='objectBox'>
<th><?php echo $lang->doc->{$type}?></th>
<td class='required'><?php echo html::select($type, $objects, $objectID, "class='form-control chosen' data-dropDirection='down' data-drop_direction='down'")?></td>
<td class='required'><?php echo html::select($type, $objects, $objectID, "class='form-control chosen' data-drop-direction='down'")?></td>
</tr>
<?php if($app->tab == 'doc' and $type == 'project'):?>
<tr class='executionBox'>
<th><?php echo $lang->doc->execution?></th>
<td>
<?php $disabled = $project->multiple ? '' : 'disabled';?>
<?php echo html::select('execution', $executionPairs, 0, "class='form-control chosen' data-drop_direction='down' data-dropDirection='down' data-placeholder='{$lang->doclib->tip->selectExecution}' $disabled")?>
<?php echo html::select('execution', $executionPairs, 0, "class='form-control chosen' data-drop-direction='down' data-placeholder='{$lang->doclib->tip->selectExecution}' $disabled")?>
</td>
</tr>
<?php endif;?>
+2 -2
View File
@@ -64,7 +64,7 @@ body {margin-bottom: 25px;}
</thead>
<tbody>
<?php foreach($docs as $doc):?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'star' : 'star-empty';?>
<?php $collectTitle = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<tr>
<?php $objectID = isset($doc->{$type}) ? $doc->{$type} : 0;?>
@@ -93,7 +93,7 @@ body {margin-bottom: 25px;}
?>
<?php if($doc->status == 'draft') echo "<span class='label label-badge draft'>{$lang->doc->draft}</span>";?>
<?php if(common::canBeChanged('doc', $doc) and common::hasPriv('doc', 'collect') and $libType and $libType != 'api'):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><?php echo html::image("static/svg/{$star}.svg");?></a>
<?php endif;?>
</td>
<td class="c-user"><?php echo zget($users, $doc->addedBy);?></td>
+480
View File
@@ -0,0 +1,480 @@
<style>
.tree-group {position: relative;}
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
.tree li.has-list.open:before {left: 6px;}
.main-table-content {display: flex; gap: 20px;}
.main-table-content > .side {flex: 0 0 300px;}
.main-table-content > .content {flex: 1;}
#main {margin-bottom: 0;}
/* css for mian */
#mainContent > #sideBar {flex: 0 0 150px; overflow-x: auto; padding-right: 5px;}
[lang^=zh] #mainContent > #sideBar {flex: 0 0 180px;}
/* css for tree */
.tree li.has-list.open:before {content: unset;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a {height: 30px;}
.flex-between {display: flex; align-items: center; justify-content: space-between;}
.flex-center {display: flex; align-items: center; justify-content: center;}
.flex-start {display: flex; align-items: center;}
.tree li > .list-toggle {top: 4px;}
.input-tree {width: 120px;}
.tree-icon {position: absolute; right: 0;}
.tree li.has-input {overflow: hidden;}
.img-lib {flex: 0 0 14px; height: 14px;}
.tree-icon {position: absolute; right: 0;}
.tree li > a {max-width: 100%; padding: 2px;}
.file-tree a.show-icon > div {padding-right: 15px;}
.tree li.has-input {overflow: hidden;}
#fileTree .icon {font-size: 14px; margin-right: 5px;}
#fileTree .title {font-size: 16px; height: 20px; margin-top: 5px; margin-bottom: 5px;}
/* css for sidebar */
.sidebar-toggle {flex: 0 0 16px;}
.sidebar-toggle > .icon {width: 12px; height: 30px; margin-top: -10px; line-height: 30px; color: #fff; text-align: center; background: #7dcdfe; border-radius: 6px; cursor: pointer;}
.spliter {flex: 0 0 12px;}
.spliter-btn {height: 28px; width: 10px; background: #fff; position: absolute; top: 30%; left: -1px; border: 1px solid #D9D9D9; border-radius: 2px;}
.spliter-btn > .spliter-inner {width: 4px; height: 12px; border-left: 1px solid #D9D9D9; border-right: 1px solid #D9D9D9;}
#mainContent .table-empty-tip > p, #createDocs {display: inline-block;}
.createDropdown a.btn-primary, .createDropdown a.btn-info {border-right: 1px solid rgba(255,255,255,0.2);}
.createDropdown button.dropdown-toggle.btn-primary, .createDropdown button.dropdown-toggle.btn-info {padding: 6px;}
.createDropdown ul > li {text-align: left;}
.createDropdown .btn.btn-info:hover {box-shadow: none;}
#leftBar .selectBox #currentItem {width: 150px; display: flex; align-items: center;}
[lang^=zh] #leftBar .selectBox #currentItem {width: 180px;}
#leftBar .selectBox #currentItem > .text {overflow: hidden; text-align: left; flex: 0 1 100%;}
</style>
<div id="fileTree" class="file-tree">
<?php if($type == 'project'):?>
<div class="project-tree">
<div class="title"><i class="icon icon-project text-primary"></i><?php echo $lang->projectCommon?></div>
<div id="projectTree" data-id="project"></div>
</div>
<div class="execution-tree">
<div class="title"><i class="icon icon-run text-primary"></i><?php echo $lang->execution->common?></div>
<div id="executionTree" data-id="execution"></div>
</div>
<div class="annex-tree">
<div class="title"><i class="icon icon-paper-clip text-primary"></i><?php echo $lang->files?></div>
<div id="annexTree" data-id="annex"></div>
</div>
<?php endif;?>
</div>
<!-- Code for dropdown menu. -->
<div class='hidden' id='dropDownData'>
<ul 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-icon-add-directory"></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;?>
</ul>
<ul class='moduleDorpdown'>
<?php if(common::hasPriv('tree', 'browse')):?>
<li data-method="addCataBro" data-type="add" data-id="%moduleID%"><a><i class="icon icon-icon-add-directory"></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-icon-add-directory"></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;?>
</ul>
</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="###" style="position: relative" data-has-children="false" data-action="true" title="%name%" data-id="%id%">
<div class="text h-full w-full flex-between overflow-hidden" style="position: relative;">
<div style="padding-left: 5px;">%name%</div>
<i class="icon icon-drop icon-ellipsis-v tree-icon hidden" data-iscatalogue="true"></i>
</div>
</a>
</div>
<script>
$(function()
{
var moduleData = {
"name" : "",
"createType" : "",
"libID" : "",
"parentID" : "",
"objectID" : "",
"moduleType" : "",
"order" : "",
"isUpdate" : ""
};
/**
* Render Dropdown dom.
*
* @access public
* @return string
*/
function renderDropdown(option)
{
var libClass = '.libDorpdown';
if(option.type != 'dropDownLibrary') libClass = '.moduleDorpdown';
if($(libClass).find('li').length == 0) return '';
var dropdown = '<ul class="dropdown-menu dropdown-in-tree" id="' + option.type + '" style="display: unset; left:' + option.left + 'px; top:' + option.top + 'px;">';
dropdown += $(libClass).html().replace(/%libID%/g, option.libID).replace(/%moduleID%/g, option.moduleID).replace(/%hasChildren%/g, option.hasChildren);
dropdown += '</ul>';
return dropdown;
}
/**
* Render tree dom.
*
* @param string treee
* @param array treeeData
* @access public
* @return void
*/
function initTree(ele, treeData)
{
var imgObj = {
'annex': 'annex',
'lib': 'wiki-file-lib',
'api': 'interface',
'execution': 'wiki-file-lib',
};
ele.tree(
{
initialState: 'active',
data: treeData,
itemCreator: function($li, item)
{
var objectType = config.currentModule == 'api' ? item.objectType : item.type;
var libClass = ['lib', 'annex', 'api', 'execution'].indexOf(objectType) !== -1 ? 'lib' : '';
var hasChild = item.children ? !!item.children.length : false;
var link = item.type != 'execution' || item.hasAction ? '###' : '#';
var $item = '<a href="' + link + '" style="position: relative" data-has-children="' + hasChild + '" title="' + item.name + '" data-id="' + item.id + '" class="' + libClass + '" data-type="' + item.type + '" data-action="' + item.hasAction + '">';
$item += '<div class="text h-full w-full flex-start overflow-hidden">';
if(libClass == 'lib') $item += '<div class="img-lib" style="background-image:url(static/svg/' + imgObj[item.type || 'lib'] + '.svg)"></div>';
$item += '<div style="padding-left: 5px;">';
$item += item.name
$item += '</div>';
$item += '<i class="icon icon-drop icon-ellipsis-v hidden tree-icon" data-isCatalogue="' + (libClass ? false : true) + '"></i>';
$item += '</div>';
$item += '</a>';
$li.append($item);
$li.addClass(libClass);
if(item.active) $li.addClass('active open in');
}
});
ele.on('click', '.icon-drop', function(e)
{
$('.dropdown-in-tree').css('display', 'none');
var isCatalogue = $(this).attr('data-isCatalogue') === 'false' ? false : true;
var dropDownID = isCatalogue ? 'dropDownCatalogue' : 'dropDownLibrary';
var libID = 0;
var moduleID = 0;
var parentID = 0;
var $module = $(this).closest('a');
var hasChildren = $module.data('has-children');
var moduleType = '';
if($module.hasClass('lib'))
{
libID = $module.data('id');
parentID = libID;
moduleID = libID;
moduleType = $module.data('type');
}
else
{
moduleID = $module.data('id');
libID = $module.closest('.lib').data('id');
moduleType = $module.closest('.lib').data('type');
parentID = $module.closest('ul').closest('.lib').data('id');
}
moduleData = {
"libID" : libID,
"parentID" : parentID,
"objectID" : moduleID,
"moduleType": ['lib', 'execution'].indexOf(moduleType) !== -1 ? 'doc' : moduleType,
};
var option = {
left : e.pageX,
top : e.pageY,
type : dropDownID,
libID : libID,
moduleID : moduleID,
hasChildren : hasChildren
};
var dropDown = renderDropdown(option);
$(this).closest('body').append(dropDown);
e.stopPropagation();
}).on('blur', '.file-tree input.input-tree', function()
{
var $input = $(this);
var value = $input.val();
if(!value)
{
$input.closest('[data-id=insert]').remove();
return;
}
moduleData.name = value;
$.post(createLink('tree', 'ajaxCreateModule'), moduleData, function(result)
{
result = JSON.parse(result);
if(result.result == 'fail')
{
bootbox.alert(
result.message[0],
function()
{
setTimeout(function()
{
$('.file-tree .input-tree').focus()
}, 10)
}
);
return false;
}
var module = result.module;
var resultDom = $('[data-id=aTreeModal]').html().replace(/%name%/g, module.name).replace(/%id%/g, module.id).replace('insert', module.id);
$input.closest('ul').find('.has-input').css('padding-left', '15px');
$input.after(resultDom);
$input.remove();
if(moduleData.isUpdate)
{
$.getJSON(createLink('doc', 'tableContents', 'type=' + objectType + '&objectID=' + objectID , 'json'), function(data){
var treeData = JSON.parse(data.data);
$('#fileTree').data('zui.tree').reload(treeData.libTree);
$('li.has-list > ul').addClass("menu-active-primary menu-hover-primary");
});
}
});
});
}
if(Array.isArray(treeData))
{
initTree($('#fileTree'), treeData);
}
else
{
initTree($('#projectTree'), treeData.project);
initTree($('#annexTree'), treeData.annex);
if(treeData.execution&& treeData.execution.length)
{
initTree($('#executionTree'), treeData.execution);
}
else
{
$('.execution-tree').remove();
}
}
$('li.has-list > ul, #fileTree').addClass("menu-active-primary menu-hover-primary");
$('#fileTree').on('mousemove', 'a', function()
{
if($(this).data('type') == 'annex') return;
if(!$(this).data('action')) return;
var libClass = '.libDorpdown';
if(!$(this).hasClass('lib')) libClass = '.moduleDorpdown';
$(this).find('.icon').removeClass('hidden');
$(this).addClass('show-icon'); if($(libClass).find('li').length == 0) return false;
}).on('mouseout', 'a', function()
{
$(this).find('.icon').addClass('hidden');
$(this).removeClass('show-icon');
}).on('click', 'a', function(e)
{
if(!$(this).data('action')) return;
var isLib = $(this).hasClass('lib');
var moduleID = $(this).data('id');
var libID = 0;
var params = '';
if(isLib)
{
if($(this).data('type') == 'annex' && !canViewFiles) return false;
libID = moduleID;
moduleID = 0;
}
else
{
libID = $(this).closest('.lib').data('id');
}
if(typeof linkParams == 'undefined') linkParams = '%s';
linkParams = linkParams.replace('%s', '&libID=' + libID + '&moduleID=' + moduleID);
if(config.currentModule == 'api') linkParams = linkParams.substring(1);
var link = $(this).data('type') == 'annex' ? createLink(config.currentModule, 'showFiles', 'type=' + objectType + '&objectID=' + objectID) : createLink(config.currentModule, config.currentModule == 'api' ? 'index' : 'tableContents', linkParams);
location.href = link
});
$('body').on('click', function()
{
$('.dropdown-in-tree').remove();
}).on('click', '.sidebar-toggle', function()
{
var $icon = $(this).find('.icon');
if($('#sideBar').hasClass('hidden'))
{
$icon.addClass('icon-angle-left');
$icon.removeClass('icon-angle-right');
$('#sideBar').removeClass('hidden');
}
else
{
$icon.addClass('icon-angle-right');
$icon.removeClass('icon-angle-left');
$('#sideBar').addClass('hidden');
}
var $docListForm = $('#docListForm').data('zui.table');
$docListForm.fixHeader();
$docListForm.fixFooter();
}).on('click', '.dropdown-in-tree li', function(e)
{
var item = $(this).data();
if($(this).hasClass('edit-module'))
{
new $.zui.ModalTrigger({
keyboard : true,
type : 'ajax',
url : $(this).find('a').data('href')
}).show();
}
if(item.type !== 'add') return;
var $item = $(this);
moduleData.parentID = 0;
moduleData.isUpdate = false;
moduleData.createType = 'child';
switch(item.method)
{
case 'addCataLib' :
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('[data-id=' + item.moduleid + ']a + ul');
$rootDom.append($input);
$rootDom.closest('.tree').data('zui.tree').expand($('li[data-id="' + item.libid + '"]'));
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('[data-id=' + item.libid + ']a');
var $li = $rootDom.parent();
moduleData.isUpdate = true;
$rootDom.after($input);
$li.addClass('open in has-list');
}
$rootDom.parent().find('input').focus();
break;
case 'addCataBro' :
moduleData.createType = 'same';
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree li[data-id=' + item.id + ']');
$rootDom.after($input);
$rootDom.closest('ul').find('.has-input').css('padding-left', '0');
$('#fileTree').find('input').focus();
break;
case 'addCataChild' :
moduleData.parentID = item.id;
if(item.hasChildren)
{
var $input = $('[data-id=liTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']a + ul');
var $rootDom = $('#fileTree [data-id=' + item.id + ']a + ul');
$rootDom.closest('.tree').data('zui.tree').expand($('li[data-id="' + item.id + '"]'));
}
else
{
var $input = $('[data-id=ulTreeModal]').html();
var $rootDom = $('#fileTree [data-id=' + item.id + ']li');
moduleData.isUpdate = true;
$rootDom.addClass('open in has-list');
}
$rootDom.append($input);
$rootDom.find('input').focus();
break;
}
}).on('blur', '.file-tree input.input-tree', function()
{
var $input = $(this);
var $tree = $input.closest('.tree');
var value = $input.val();
if(!value)
{
$input.closest('[data-id=insert]').remove();
return;
}
moduleData.name = value;
$.post(createLink('tree', 'ajaxCreateModule'), moduleData, function(result)
{
result = JSON.parse(result);
if(result.result == 'fail')
{
bootbox.alert(
result.message[0],
function()
{
setTimeout(function()
{
$('.file-tree .input-tree').focus()
}, 10)
}
);
return false;
}
var module = result.module;
var resultDom = $('[data-id=aTreeModal]').html().replace(/%name%/g, module.name).replace(/%id%/g, module.id).replace('insert', module.id);
$input.closest('ul').find('.has-input').css('padding-left', '15px');
$input.after(resultDom);
$input.remove();
if(moduleData.isUpdate)
{
$.getJSON(createLink('doc', 'tableContents', 'type=' + objectType + '&objectID=' + objectID , 'json'), function(data){
var treeData = JSON.parse(data.data);
if(Array.isArray(treeData.libTree))
{
$('#fileTree').data('zui.tree').reload(treeData.libTree);
$('li.has-list > ul').addClass("menu-active-primary menu-hover-primary");
}
else
{
$tree.data('zui.tree').reload(treeData.libTree[$tree.data('id')]);
}
});
}
});
}).on('keydown', '.file-tree input.input-tree', function(e)
{
if(e.keyCode == 13) $(this).trigger('blur');
});
})
</script>
+4 -3
View File
@@ -20,12 +20,13 @@
<?php js::set('canViewFiles', common::hasPriv('doc', 'showfiles'));?>
<?php js::set('type', $type);?>
<?php js::set('tab', $this->app->tab);?>
<?php js::set('searchLink', helper::createLink('doc', 'showFiles', "type=$type&objectID=$objectID&viewType=$viewType&orderBy=id_desc&recTotal=0&recPerPage=20&pageID=1&searchTitle=%s"));?>
<div id="mainMenu" class="clearfix">
<div id="leftBar" class="btn-toolbar pull-left">
<?php echo $objectDropdown;?>
<div class='btn-group searchBox'>
<form class="input-control has-icon-right table-col" method="post">
<?php echo html::input('title', $this->post->title, "class='form-control' placeholder='{$lang->doc->fileTitle}'");?>
<form class="input-control has-icon-right table-col not-watch" method="post">
<?php echo html::input('title', $searchTitle, "class='form-control' placeholder='{$lang->doc->fileTitle}'");?>
<?php echo html::submitButton("<i class='icon icon-search'></i>", '', "btn btn-icon btn-link input-control-icon-right");?>
</form>
</div>
@@ -39,7 +40,7 @@
</div>
<div class="main-row fade <?php if(!empty($libTree)) echo 'flex';?>" id="mainContent">
<div id='sideBar' class="panel side side-col col overflow-auto" data-min-width="150">
<div id="fileTree" class="file-tree"></div>
<?php include 'lefttree.html.php';?>
</div>
<div class="sidebar-toggle flex-center"><i class="icon icon-angle-left"></i></div>
<div class="main-col flex-full overflow-visible flex-auto" data-min-width="500">
+1 -37
View File
@@ -67,7 +67,7 @@
</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>
<?php include 'lefttree.html.php';?>
</div>
<div class="sidebar-toggle flex-center"><i class="icon icon-angle-left"></i></div>
<div class="main-col flex-full overflow-visible flex-auto" data-min-width="500">
@@ -89,40 +89,4 @@
</div>
<?php endif;?>
</div>
<div class='hidden' id='dropDownData'>
<ul 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;?>
</ul>
<ul 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;?>
</ul>
</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="###" style="position: relative" data-has-children="false" data-action="true" title="%name%" data-id="%id%">
<div class="text h-full w-full flex-between overflow-hidden" style="position: relative;">
<span style="padding-left: 5px;">%name%</span>
<i class="icon icon-drop icon-ellipsis-v tree-icon hidden" data-iscatalogue="true"></i>
</div>
</a>
</div>
<?php include '../../common/view/footer.html.php';?>
+4 -4
View File
@@ -133,7 +133,7 @@ function getDiffs(fileName)
function createTab(filename, filepath)
{
$('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected');
var tabID = Base64.encode(filepath).replaceAll('=', '-');
var tabID = Base64.encode(filepath).replace(/=/g, '-');
return {
title: filename,
id: tabID,
@@ -200,7 +200,7 @@ $(document).ready(function()
/* Remove file path for opened files. */
$('#fileTabs').on('onClose', function(event, tab) {
var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '=')));
var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '=')));
var index = openedFiles.indexOf(filepath);
if(index > -1)
{
@@ -213,7 +213,7 @@ $(document).ready(function()
/* Append file path into the title. */
$('#fileTabs').on('onLoad', function(event, tab) {
var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '=')));
var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '=')));
$('#tab-nav-item-' + tab.id).attr('title', filepath);
document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose);
@@ -221,7 +221,7 @@ $(document).ready(function()
});
$('#fileTabs').on('onOpen', function(event, tab) {
var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '=')));
var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '=')));
var index = openedFiles.indexOf(filepath);
if(index > -1) document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose);
});
+1
View File
@@ -1 +1,2 @@
.fullscreen-close {top: 8px !important;}
.btn.ajaxCollect > img {width: 20px;}
+2 -5
View File
@@ -5,14 +5,11 @@ $('.ajaxCollect').click(function (event) {
{
if(response.status == 'yes')
{
obj.children('i').removeClass().addClass('icon icon-star text-yellow');
obj.parent().prev().children('.file-name').children('i').remove('.icon');
obj.parent().prev().children('.file-name').prepend('<i class="icon icon-star text-yellow"></i> ');
obj.children('img').attr('src', 'static/svg/star.svg');
}
else
{
obj.children('i').removeClass().addClass('icon icon-star-empty');
obj.parent().prev().children('.file-name').children('i').remove(".icon");
obj.children('img').attr('src', 'static/svg/star-empty.svg');
}
}, 'json');
return false;
+2 -2
View File
@@ -55,7 +55,7 @@
</thead>
<tbody id='docTableList'>
<?php foreach($docs as $doc):?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'star' : 'star-empty';?>
<?php $collectTitle = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<tr>
<td class="c-id"><?php echo $doc->id;?></td>
@@ -80,7 +80,7 @@
<td class="c-actions">
<?php if(common::canBeChanged('doc', $doc)):?>
<?php if(common::hasPriv('doc', 'collect')):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><?php echo html::image("static/svg/{$star}.svg");?></a>
<?php endif;?>
<?php common::printLink('doc', 'edit', "docID=$doc->id&comment=false&from={$lang->navGroup->doc}", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link' data-app='doc'", true, false)?>
<?php common::printLink('doc', 'delete', "docID=$doc->id&confirm=no&from={$lang->navGroup->doc}", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
+1
View File
@@ -20,6 +20,7 @@
#guideDialog .project-type.active img {border-color: #006AF1; border-width: 2px; margin-top: 0}
#guideDialog .col:nth-child(-n+3) {margin-bottom: 15px;}
@media screen and (max-width: 1366px){#guideDialog {width: 640px} #guideDialog .project-type-img.more-type {height: 108px;}}
@media screen and (max-width: 1366px){[lang^='en'] #guideDialog .row .col-xs-4 {height: 200px;} [lang^='de'] #guideDialog .row .col-xs-4 {height: 200px;} [lang^='fr'] #guideDialog .row .col-xs-4 {height: 200px;}}
</style>
<div class='modal-content'>
<div class='modal-body'>
+4 -4
View File
@@ -84,7 +84,7 @@ function getDiffs(fileName)
function createTab(filename, filepath)
{
$('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected');
var tabID = Base64.encode(filepath).replaceAll('=', '-');
var tabID = Base64.encode(filepath).replace(/=/g, '-');
return {
id: tabID,
url: createLink('repo', 'ajaxGetDiffEditorContent', urlParams.replace('%s', Base64.encode(encodeURIComponent(filepath)))),
@@ -141,7 +141,7 @@ $(document).ready(function()
/* Remove file path for opened files. */
$('#fileTabs').on('onClose', function(event, tab) {
var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '=')));
var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '=')));
var index = openedFiles.indexOf(filepath);
if(index > -1)
{
@@ -154,7 +154,7 @@ $(document).ready(function()
/* Append file path into the title. */
$('#fileTabs').on('onLoad', function(event, tab) {
var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '=')));
var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '=')));
$('#tab-nav-item-' + tab.id).attr('title', filepath);
document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose);
@@ -162,7 +162,7 @@ $(document).ready(function()
});
$('#fileTabs').on('onOpen', function(event, tab) {
var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '=')));
var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '=')));
var index = openedFiles.indexOf(filepath);
if(index > -1) document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose);
});
+3 -3
View File
@@ -10,7 +10,7 @@ function createTab(filename, filepath)
{
$('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected');
/* encode twice for resolving chinese character. */
var tabID = Base64.encode(Base64.encode(filepath).replaceAll('=', '-')).replaceAll('=', '-');
var tabID = Base64.encode(Base64.encode(filepath).replace(/=/g, '-')).replace(/=/g, '-');
return {
id: tabID,
url: createLink('repo', 'ajaxGetEditorContent', urlParams.replace('%s', Base64.encode(encodeURIComponent(filepath)))),
@@ -58,7 +58,7 @@ $(function()
/* Remove file path for opened files. */
$('#fileTabs').on('onClose', function(event, tab) {
/* encode twice for resolving chinese character. */
var filepath = decodeURIComponent(Base64.decode(Base64.decode(tab.id.replaceAll('-', '=')).replaceAll('-', '=')));
var filepath = decodeURIComponent(Base64.decode(Base64.decode(tab.id.replace(/-/g, '=')).replace(/-/g, '=')));
var index = openedFiles.indexOf(filepath);
if(index > -1)
{
@@ -71,7 +71,7 @@ $(function()
/* Append file path into the title. */
$('#fileTabs').on('onLoad', function(event, tab) {
var filepath = Base64.decode(tab.id.replaceAll('-', '='));
var filepath = Base64.decode(tab.id.replace(/-/g, '='));
$('#tab-nav-item-' + tab.id).attr('title', decodeURIComponent(filepath));
});
-1
View File
@@ -1396,7 +1396,6 @@ class story extends control
if($tab == 'product' and !empty($product->shadow))
{
$backLink = $this->session->productList ? $this->session->productList : inlink('product', 'all');
$viewLink = $this->createLink('story', 'view', "storyID=$storyID&version=$version&param=$param&storyType=$storyType") . '#app=project';
$js = js::start();
$js .= "setTimeout(\"parent.$.apps.open('$uri#app=project')\", 100)";
$js .= js::end();
+46
View File
@@ -8236,4 +8236,50 @@ class upgradeModel extends model
return true;
}
/**
* Change book to custom lib.
*
* @access public
* @return void
*/
public function changeBookToCustomLib()
{
$libs = $this->dao->select('id,id')->from(TABLE_DOCLIB)->where('`type`')->eq('book')->fetchPairs();
foreach($libs as $libID)
{
$chapterModulePairs = array();
$chapters = $this->dao->select('*')->from(TABLE_DOC)->where('lib')->eq($libID)->andWhere('`type`')->eq('chapter')->orderBy('`grade` asc, `order` asc')->fetchGroup('grade', 'id');
foreach($chapters as $grade => $gradeChapters)
{
foreach($gradeChapters as $id => $chapter)
{
$module = new stdclass();
$module->root = $chapter->lib;
$module->name = $chapter->title;
$module->parent = zget($chapterModulePairs, $chapter->parent);
$module->grade = $chapter->grade;
$module->order = $chapter->order;
$module->type = 'doc';
$module->deleted = $chapter->deleted;
$this->dao->insert(TABLE_MODULE)->data($module)->exec();
$moduleID = $this->dao->lastInsertID();
$chapterModulePairs[$id] = $moduleID;
$path = explode(',', $chapter->path);
$path = array_filter($path);
foreach($path as $index => $chapterID) $path[$index] = zget($chapterModulePairs, $chapterID);
$path = implode(',', $path);
$this->dao->update(TABLE_MODULE)->set('`path`')->eq(",{$path},")->where('id')->eq($moduleID)->exec();
$this->dao->update(TABLE_DOC)->set('`module`')->eq($moduleID)->set('`parent`')->eq($moduleID)->set("`path` = REPLACE(`path`, '{$chapter->path}', ',{$path},')")->set('`type`')->eq('text')->where('`parent`')->eq($id)->andWhere('`type`')->eq('article')->exec();
}
}
$this->dao->update(TABLE_DOCLIB)->set('`type`')->eq('custom')->where('id')->eq($libID)->exec();
$this->dao->update(TABLE_DOC)->set('`type`')->eq('text')->where('`lib`')->eq($libID)->andWhere('grade')->eq(1)->andWhere('`type`')->eq('article')->exec();
}
return true;
}
}
+3
View File
@@ -0,0 +1,3 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.0915 4.30365L7.13335 2L6.17521 4.30365C5.8872 4.99612 5.23598 5.46926 4.4884 5.52919L2.00141 5.72857L3.89623 7.35169C4.46581 7.83959 4.71455 8.60515 4.54054 9.33466L3.96164 11.7615L6.09085 10.461C6.73088 10.0701 7.53583 10.0701 8.17586 10.461L10.3051 11.7615L9.72617 9.33465C9.55215 8.60514 9.8009 7.83959 10.3705 7.35169L12.2653 5.72857L9.77831 5.52919C9.03073 5.46926 8.37951 4.99612 8.0915 4.30365ZM8.05667 1.61597C7.71508 0.794676 6.55163 0.794678 6.21003 1.61597L5.25189 3.91962C5.10788 4.26585 4.78227 4.50242 4.40848 4.53239L1.9215 4.73177C1.03485 4.80285 0.675322 5.90936 1.35086 6.48803L3.24568 8.11114C3.53047 8.3551 3.65484 8.73787 3.56783 9.10263L2.98893 11.5295C2.78254 12.3947 3.7238 13.0786 4.4829 12.6149L6.6121 11.3144C6.93212 11.119 7.33459 11.119 7.65461 11.3144L9.78381 12.6149C10.5429 13.0786 11.4842 12.3947 11.2778 11.5295L10.6989 9.10263C10.6119 8.73787 10.7362 8.3551 11.021 8.11114L12.9159 6.48803C13.5914 5.90936 13.2319 4.80285 12.3452 4.73177L9.85822 4.53239C9.48443 4.50242 9.15882 4.26585 9.01482 3.91962L8.05667 1.61597Z" fill="#C4C4C4"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

+4
View File
@@ -0,0 +1,4 @@
<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.16999 1.73316C6.51159 0.911865 7.67504 0.911864 8.01664 1.73316L8.97478 4.0368C9.11878 4.38304 9.44439 4.61961 9.81818 4.64958L12.3052 4.84896C13.1918 4.92004 13.5513 6.02655 12.8758 6.60522L10.981 8.22833C10.6962 8.47228 10.5718 8.85506 10.6588 9.21982L11.2377 11.6467C11.4441 12.5119 10.5029 13.1958 9.74377 12.7321L7.61457 11.4316C7.29455 11.2361 6.89208 11.2361 6.57206 11.4316L4.44286 12.7321C3.68376 13.1958 2.7425 12.5119 2.94889 11.6467L3.52779 9.21982C3.6148 8.85506 3.49043 8.47228 3.20564 8.22833L1.31082 6.60522C0.635283 6.02655 0.994808 4.92004 1.88146 4.84896L4.36844 4.64958C4.74223 4.61961 5.06785 4.38304 5.21185 4.03681L6.16999 1.73316Z" fill="#FFBC7E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.05146 4.42084L7.09332 2.11719L6.13517 4.42084C5.84716 5.11331 5.19594 5.58645 4.44836 5.64638L1.96138 5.84576L3.85619 7.46887C4.42577 7.95678 4.67451 8.72233 4.5005 9.45184L3.9216 11.8787L6.05081 10.5782C6.69084 10.1873 7.49579 10.1873 8.13582 10.5782L10.265 11.8787L9.68613 9.45184C9.51211 8.72233 9.76086 7.95678 10.3304 7.46887L12.2253 5.84576L9.73827 5.64638C8.99069 5.58645 8.33947 5.11331 8.05146 4.42084ZM8.01664 1.73316C7.67504 0.911864 6.51159 0.911865 6.16999 1.73316L5.21185 4.03681C5.06785 4.38304 4.74223 4.61961 4.36844 4.64958L1.88146 4.84896C0.994808 4.92004 0.635283 6.02655 1.31082 6.60522L3.20564 8.22833C3.49043 8.47228 3.6148 8.85506 3.52779 9.21982L2.94889 11.6467C2.7425 12.5119 3.68376 13.1958 4.44286 12.7321L6.57206 11.4316C6.89208 11.2361 7.29455 11.2361 7.61457 11.4316L9.74377 12.7321C10.5029 13.1958 11.4441 12.5119 11.2377 11.6467L10.6588 9.21982C10.5718 8.85506 10.6962 8.47228 10.981 8.22833L12.8758 6.60522C13.5513 6.02655 13.1918 4.92004 12.3052 4.84896L9.81818 4.64958C9.4444 4.61961 9.11878 4.38304 8.97478 4.0368L8.01664 1.73316Z" fill="#FF9F46"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB