diff --git a/dbd/qq/SYS_SAIMOD_API_ADD.php b/dbd/qq/SYS_SAIMOD_API_ADD.php new file mode 100644 index 0000000..c858c26 --- /dev/null +++ b/dbd/qq/SYS_SAIMOD_API_ADD.php @@ -0,0 +1,11 @@ + +
Api Call: ${ID}
+
+ + + + + + + + + + + + + + + + + + + +
IDGroupTypeParentIDParentValueNameVerify
${ID}${group}${type}${parentID}${parentValue}${name}${verify}
+ + + diff --git a/sai/modules/saimod_sys_api/list_entry.tpl b/sai/modules/saimod_sys_api/list_entry.tpl index 895e5ce..b7d9845 100644 --- a/sai/modules/saimod_sys_api/list_entry.tpl +++ b/sai/modules/saimod_sys_api/list_entry.tpl @@ -1,4 +1,4 @@ - + ${ID} ${group} ${type} diff --git a/sai/modules/saimod_sys_api/saimod_sys_api.css b/sai/modules/saimod_sys_api/saimod_sys_api.css new file mode 100644 index 0000000..07df088 --- /dev/null +++ b/sai/modules/saimod_sys_api/saimod_sys_api.css @@ -0,0 +1,64 @@ +p { + font-size: 90%; +} +.tree { + min-height:20px; + padding:19px; + margin-bottom:20px; + background-color:#fbfbfb; + border:1px solid #999; + -webkit-border-radius:4px; + -moz-border-radius:4px; + border-radius:4px; + -webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05) +} +.tree li { + list-style-type:none; + margin:0; + padding:10px 5px 0 5px; + position:relative +} +.tree li::before, .tree li::after { + content:''; + left:-20px; + position:absolute; + right:auto +} +.tree li::before { + border-left:1px solid #999; + bottom:50px; + height:100%; + top:0; + width:1px +} +.tree li::after { + border-top:1px solid #999; + height:20px; + top:25px; + width:25px +} +.tree li span { + -moz-border-radius:5px; + -webkit-border-radius:5px; + border:1px solid #999; + border-radius:5px; + display:inline-block; + padding:3px 8px; + text-decoration:none +} +.tree li.parent_li>span { + cursor:pointer +} +.tree>ul>li::before, .tree>ul>li::after { + border:0 +} +.tree li:last-child::before { + height:30px +} +.tree li.parent_li>span:hover, .tree li.parent_li>span:hover+ul li span { + background:#eee; + border:1px solid #94a0b4; + color:#000 +} \ No newline at end of file diff --git a/sai/modules/saimod_sys_api/saimod_sys_api.js b/sai/modules/saimod_sys_api/saimod_sys_api.js index 7231266..c80b5a1 100644 --- a/sai/modules/saimod_sys_api/saimod_sys_api.js +++ b/sai/modules/saimod_sys_api/saimod_sys_api.js @@ -1,3 +1,98 @@ -function init__SYSTEM_SAI_saimod_sys_api() { +var currentID = ''; + +function init__SYSTEM_SAI_saimod_sys_api() { + saimod_sys_api_tree(); + saimod_sys_api_register_clickevents(); + +} + +function saimod_sys_api_loadcontent(){ + $('#api_wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_api', function(){ + console.log('api module loaded'); + saimod_sys_api_register_clickevents(); + }); + +} + +function saimod_sys_api_register_clickevents(){ + $('tr.api_entries').click(function() { + console.log("ahsf"); + currentID = $(this).attr("id"); + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', + action: 'deletedialog', + ID: currentID}, + type: 'GET', + success: function(data) { + console.log("works"); + $('#api_content').html(data); + $('#del_api_close').click(function() { + console.log("olenski"); + $('#del_api_description').hide(); + $('#del_api_del').show(); + saimod_sys_api_loadcontent(); + }); + $('#del_api_del').click(function() { + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', + action: 'deletecall', + ID: currentID}, + type: 'GET', + success: function(data) { + console.log("api call deleted"); + $('#api_deletedialog').html('

Api call deleted!

'); + $('#del_api_del').hide(); + }});});}});}); + + $('#addcall').click(function() { + var id = $('#new_call_id').val(); + var group = $('#new_call_group').val(); + var type = $('#new_call_type').val(); + var parentid = $('#new_call_parentid').val(); + var parentvalue = $('#new_call_parentvalue').val(); + var name = $('#new_call_name').val(); + var verify = $('#new_call_verify').val(); + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', + action: 'addcall', + ID: id, + group: group, + type: type, + parentID: parentid, + parentValue : parentvalue, + name: name, + verify: verify}, + type: 'GET', + success: function(data) { + console.log("new api call added"); + saimod_sys_api_loadcontent(); + } + }); + + }); + $('#del_api_close').click(function() { + console.log("olenski"); + $('#del_api_description').hide(); + $('#del_api_del').show(); + saimod_sys_api_loadcontent(); + }); $('#localetab a').click(function (e) {e.preventDefault(); $(this).tab('show');}); +} + +function saimod_sys_api_tree(){ + $('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch'); + $('.tree li.parent_li > span').on('click', function (e) { + var children = $(this).parent('li.parent_li').find(' > ul > li'); + if (children.is(":visible")) { + children.hide('fast'); + $(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign'); + } else { + children.show('fast'); + $(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign'); + } + e.stopPropagation(); + }); } \ No newline at end of file diff --git a/sai/modules/saimod_sys_api/saimod_sys_api.php b/sai/modules/saimod_sys_api/saimod_sys_api.php index ed9eaa4..0aa884e 100644 --- a/sai/modules/saimod_sys_api/saimod_sys_api.php +++ b/sai/modules/saimod_sys_api/saimod_sys_api.php @@ -50,6 +50,25 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { return $result;*/ } + public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){ + new \SYSTEM\LOG\WARNING("api call added"); + new \SYSTEM\LOG\WARNING(print_r($ID, true)); + $res = \SYSTEM\DBD\SYS_SAIMOD_API_SINGLE_SELECT::Q1(array($ID)); + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/delete_dialog.tpl'), $res); + } + + public static function sai_mod__system_sai_saimod_sys_api_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){ + new \SYSTEM\LOG\WARNING("api call added"); + $res = \SYSTEM\DBD\SYS_SAIMOD_API_ADD::QI(array($ID,$group,$type,$parentID,$parentValue,$name,$verify)); + return \SYSTEM\LOG\JsonResult::ok(); + } + + public static function sai_mod__system_sai_saimod_sys_api_action_deletecall($ID){ + new \SYSTEM\LOG\WARNING("api call deleted"); + $res = \SYSTEM\DBD\SYS_SAIMOD_API_DEL::QI(array($ID)); + return \SYSTEM\LOG\JsonResult::ok(); + } + private static function type_names($type){ switch($type){ case 0: return 'COMMAND'; @@ -74,7 +93,9 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} - public static function sai_mod__SYSTEM_SAI_saimod_sys_api_flag_css(){} + public static function sai_mod__SYSTEM_SAI_saimod_sys_api_flag_css(){ + return \SYSTEM\LOG\JsonResult::toString( + array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/saimod_sys_api.css')));} public static function sai_mod__SYSTEM_SAI_saimod_sys_api_flag_js(){ return \SYSTEM\LOG\JsonResult::toString( array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/saimod_sys_api.js')));} diff --git a/sai/modules/saimod_sys_api/tab.tpl b/sai/modules/saimod_sys_api/tab.tpl index 7b52a39..7e43161 100644 --- a/sai/modules/saimod_sys_api/tab.tpl +++ b/sai/modules/saimod_sys_api/tab.tpl @@ -10,5 +10,5 @@ Verify ${content} - + \ No newline at end of file diff --git a/sai/modules/saimod_sys_api/tabs.tpl b/sai/modules/saimod_sys_api/tabs.tpl index a042195..aa9102c 100644 --- a/sai/modules/saimod_sys_api/tabs.tpl +++ b/sai/modules/saimod_sys_api/tabs.tpl @@ -1,5 +1,7 @@ +

System API


+
\ No newline at end of file +
+ + + + + + + + + + + + + + + + + + + + +
IDGroupTypeParentIDParentValueNameVerify
+ +
+ diff --git a/sai/modules/saimod_sys_files/saimod_sys_files.js b/sai/modules/saimod_sys_files/saimod_sys_files.js index 264f45b..c2d2548 100644 --- a/sai/modules/saimod_sys_files/saimod_sys_files.js +++ b/sai/modules/saimod_sys_files/saimod_sys_files.js @@ -1,4 +1,5 @@ -function init__SYSTEM_SAI_saimod_sys_files() { +function init__SYSTEM_SAI_saimod_sys_files() { + $('.tooltip').tooltipster(); $('#filestab a').click(function (e) {e.preventDefault(); load_tab($(this).attr('tabname')); $(this).tab('show');}); register_controlls(); } diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.js b/sai/modules/saimod_sys_locale/saimod_sys_locale.js index 8e08acb..c5e1736 100644 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale.js +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.js @@ -1,9 +1,11 @@ //saving content data var cData = {group: '', lang: '', - id: ''}; + id: '', + editmode: false}; function init__SYSTEM_SAI_saimod_sys_locale() { + $('#addtext').show(); if(!cData.lang && !cData.group) { cData.group = $('.groups').first().attr('id'); cData.lang = $('.langli').first().attr('id'); @@ -16,8 +18,14 @@ function init__SYSTEM_SAI_saimod_sys_locale() { $('.content_add').click(function(){ saimod_sys_locale_newtext();}); + $('#edit_close').click(function(){ + $('#addtext').show(); + cData.editmode = false;}); + $('#newtext').click(function(){ - saimod_sys_locale_savenewcontent();}); + $('#addtext').show(); + saimod_sys_locale_savenewcontent(); + cData.editmode = false;}); $('.groups').click(function(){ if (cData.group){ @@ -26,29 +34,40 @@ function init__SYSTEM_SAI_saimod_sys_locale() { cData.group = $(this).attr('id'); saimod_sys_locale_loadcontent(cData.lang, cData.group);} cData.group = $(this).attr('id'); - $(this).addClass('active');}); - + $(this).addClass('active'); + }); + $('#langtabs_').click(function(){ + cData.editmode = true; + }); $('.langli').click(function(){ + console.log(cData.editmode); if (cData.group && cData.lang){ $('#langtabs_ li#'+cData.lang).removeClass('active'); $('#'+cData.lang).removeClass('active');} cData.lang = $(this).attr('id'); $('#langtabs_ li#'+cData.lang).addClass('active'); $('#'+cData.lang).addClass('active'); - saimod_sys_locale_loadcontent(cData.lang, cData.group);}); + saimod_sys_locale_loadcontent(cData.lang, cData.group); + if (cData.editmode === true){ + saimod_sys_locale_loadsinglecontent(cData.id, cData.lang); + cData.editmode = false; + }}); $('#changetext').click(function(){ saimod_sys_locale_savecontent(cData.id, cData.lang);}); $('#del_text').click(function(){ saimod_sys_locale_delete($('#modaltitle').html());}); - + $(document).keyup(function(e) { + if (e.keyCode === 27) { $('#addtext').show(); } // esc + }); } function saimod_sys_locale_newtext(){ $('#modaltitle').hide(); $('#modaltextarea').hide(); $('#del_text').hide(); + $('#addtext').hide(); $.ajax({ url: SAI_ENDPOINT, data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale', @@ -117,7 +136,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){ $('#modaltextarea').show(); $('#changetext').show(); $('#del_text').show(); - tinymce.init({selector:'textarea'}); + init_tinymce(); $.ajax({ url: SAI_ENDPOINT, @@ -141,6 +160,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){ function saimod_sys_locale_loadcontent(id, group){ $('#tab-content').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=load&id='+id+'&group='+group, function(){ $('.tableentry').click(function(){ + cData.editmode = true; saimod_sys_locale_loadsinglecontent($(this).attr('text_id'), cData.lang); }); }); @@ -155,3 +175,27 @@ function saimod_sys_locale_delete(buttonID){ saimod_sys_locale_loadcontent(cData.lang,cData.group); $('#modal').modal('hide'); } + +function init_tinymce(){ + tinymce.init({ // General options + mode : "textareas", + theme : "modern", + plugins : "anchor,bbcode,charmap,code,contextmenu,directionality,link,textcolor,table,hr,fullscreen,autolink,lists,spellchecker,pagebreak,layer,table,save,emoticons,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template", + + // Theme options + theme_modern_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", + theme_modern_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", + theme_modern_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", + theme_modern_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", + theme_modern_toolbar_location : "top", + theme_modern_toolbar_align : "left", + theme_modern_statusbar_location : "bottom", + theme_modern_resizing : true, + + width: "100%", + height: "250px", + + // Example content CSS (should be your site CSS) + content_css : "../../page/index.css" +}); +} diff --git a/sai/modules/saimod_sys_locale/tabs.tpl b/sai/modules/saimod_sys_locale/tabs.tpl index 32cd24e..1d787fd 100644 --- a/sai/modules/saimod_sys_locale/tabs.tpl +++ b/sai/modules/saimod_sys_locale/tabs.tpl @@ -10,13 +10,14 @@
-