From f34e599ce1eed58d92b111f3dc4abc194f1b75e7 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 30 Mar 2023 16:54:36 +0800 Subject: [PATCH] * Modify left tree to common. --- module/api/css/common.css | 20 - module/api/css/index.css | 53 --- module/api/js/index.js | 281 -------------- module/api/view/index.html.php | 2 +- module/doc/css/showfiles.css | 49 --- module/doc/css/tablecontents.css | 52 --- module/doc/js/showfiles.js | 348 ------------------ .../lefttree.html.php} | 123 ++++++- module/doc/view/showfiles.html.php | 2 +- module/doc/view/tablecontents.html.php | 53 +-- 10 files changed, 123 insertions(+), 860 deletions(-) delete mode 100644 module/doc/js/showfiles.js rename module/doc/{js/tablecontents.js => view/lefttree.html.php} (66%) diff --git a/module/api/css/common.css b/module/api/css/common.css index beb4a1b668..c0f3690768 100644 --- a/module/api/css/common.css +++ b/module/api/css/common.css @@ -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%;} diff --git a/module/api/css/index.css b/module/api/css/index.css index 95539a3f09..d1a73d1e8a 100644 --- a/module/api/css/index.css +++ b/module/api/css/index.css @@ -46,57 +46,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;} diff --git a/module/api/js/index.js b/module/api/js/index.js index c5b6cb202c..e4f1642928 100644 --- a/module/api/js/index.js +++ b/module/api/js/index.js @@ -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 = ''; - 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 = $('
'); - $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.objectType == 'api' ? 'lib' : ''; - var hasChild = item.children ? !!item.children.length : false; - var $item = ''; - $item += '
'; - if(libClass == 'lib') $item += '
'; - $item += '
'; - $item += item.name - $item += '
'; - $item += ''; - $item += '
'; - $item += '
'; - - $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. * diff --git a/module/api/view/index.html.php b/module/api/view/index.html.php index 7e4864ea82..1632e88b73 100644 --- a/module/api/view/index.html.php +++ b/module/api/view/index.html.php @@ -43,7 +43,7 @@
diff --git a/module/doc/css/showfiles.css b/module/doc/css/showfiles.css index 8f12e83ed8..91f0a5bd94 100644 --- a/module/doc/css/showfiles.css +++ b/module/doc/css/showfiles.css @@ -49,52 +49,3 @@ span.dotted-line+a {display: block;} .is-sorting > li > .tree-group {opacity: 1; border-radius: 4px;} .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;} diff --git a/module/doc/css/tablecontents.css b/module/doc/css/tablecontents.css index b68abcd176..5f85727d1e 100644 --- a/module/doc/css/tablecontents.css +++ b/module/doc/css/tablecontents.css @@ -45,56 +45,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;} -#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;} - -.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;} diff --git a/module/doc/js/showfiles.js b/module/doc/js/showfiles.js deleted file mode 100644 index ab584802e8..0000000000 --- a/module/doc/js/showfiles.js +++ /dev/null @@ -1,348 +0,0 @@ -$(function() -{ - if(tab != 'doc') return; - - $('#navbar .nav li').removeClass('active'); - $("#navbar .nav li[data-id=" + type + ']').addClass('active'); - $('#leftBar .searchBox #title').keypress(function(e) - { - if(e.which == 13) - { - $(this).closest('form').attr('action', searchLink.replace('%s', $(this).val())); - } - }); - - $('#leftBar .searchBox #submit').click(function(e) - { - var searchTitle = $(this).prev('#title').val(); - $(this).closest('form').attr('action', searchLink.replace('%s', searchTitle)); - }) - - /** - * 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 = ''; - 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 = ''; - - $item += '
'; - if(libClass == 'lib' && item.type != 'execution') $item += '
'; - $item += ''; - $item += item.name - $item += ''; - $item += ''; - $item += '
'; - $item += '
'; - - $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-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}); - } - }); -}); diff --git a/module/doc/js/tablecontents.js b/module/doc/view/lefttree.html.php similarity index 66% rename from module/doc/js/tablecontents.js rename to module/doc/view/lefttree.html.php index 69f2c63e4f..6ee1eb47ad 100644 --- a/module/doc/js/tablecontents.js +++ b/module/doc/view/lefttree.html.php @@ -1,3 +1,114 @@ + + +
+ +
+
projectCommon?>
+
+
+
+
execution->common?>
+
+
+
+
files?>
+
+
+ +
+ + + + + + + diff --git a/module/doc/view/showfiles.html.php b/module/doc/view/showfiles.html.php index 900c0e25fd..d95fd05250 100644 --- a/module/doc/view/showfiles.html.php +++ b/module/doc/view/showfiles.html.php @@ -40,7 +40,7 @@
diff --git a/module/doc/view/tablecontents.html.php b/module/doc/view/tablecontents.html.php index 79db24b0e7..eed13b45dd 100644 --- a/module/doc/view/tablecontents.html.php +++ b/module/doc/view/tablecontents.html.php @@ -63,22 +63,7 @@
@@ -100,40 +85,4 @@
- - -