openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

commit 1d9dece1282977b2f9337dab597934174f18cb4f
parent 7c8985dc1c46a95118248dd630fe576aa5de824d
Author: Jan Dankert <develop@jandankert.de>
Date:   Sat,  9 Nov 2019 03:56:56 +0100

Refactoring: The event 'orViewLoaded' is not needed anymore.

Diffstat:
modules/cms-ui/action/IndexAction.class.php | 16++++++++--------
modules/cms-ui/themes/default/production/combined.min.js | 30+++++++++++++++---------------
modules/cms-ui/themes/default/script/openrat/common.js | 16+++++++++++-----
modules/cms-ui/themes/default/script/openrat/common.min.js | 2+-
modules/cms-ui/themes/default/script/openrat/view.js | 3+--
modules/cms-ui/themes/default/script/openrat/view.min.js | 2+-
modules/cms-ui/themes/default/script/openrat/workbench.js | 13+++++++++++++
modules/cms-ui/themes/default/script/openrat/workbench.min.js | 4++--
modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.js | 10----------
modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js | 4++--
modules/template-engine/components/html/column/column.js | 3++-
modules/template-engine/components/html/column/column.min.js | 4++--
modules/template-engine/components/html/editor/editor.js | 12+++++-------
modules/template-engine/components/html/editor/editor.min.js | 4++--
modules/template-engine/components/html/group/group.js | 5+++--
modules/template-engine/components/html/group/group.min.js | 4++--
modules/template-engine/components/html/link/link.js | 6+++---
modules/template-engine/components/html/link/link.min.js | 4++--
modules/template-engine/components/html/qrcode/qrcode.js | 5+++--
modules/template-engine/components/html/qrcode/qrcode.min.js | 4++--
modules/template-engine/components/html/table/table.js | 15++++++++-------
modules/template-engine/components/html/table/table.min.js | 4++--
modules/template-engine/components/html/tree/tree.js | 3++-
modules/template-engine/components/html/tree/tree.min.js | 4++--
modules/template-engine/components/html/upload/upload.js | 11++++++-----
modules/template-engine/components/html/upload/upload.min.js | 4++--
modules/template-engine/components/html/window/Window.class.php | 2--
27 files changed, 102 insertions(+), 92 deletions(-)

diff --git a/modules/cms-ui/action/IndexAction.class.php b/modules/cms-ui/action/IndexAction.class.php @@ -533,14 +533,6 @@ class IndexAction extends Action $js[] = OR_HTML_MODULES_DIR . 'editor/trumbowyg/trumbowyg'; - // Komponentenbasiertes Javascript - foreach ( TemplateEngineInfo::getComponentList() as $c) - { - $componentJsFile = OR_HTML_MODULES_DIR . '/template-engine/components/html/' . $c . '/' . $c; - if (is_file($componentJsFile . '.js')) - $js[] = $componentJsFile; - } - // OpenRat internal JS - als letztes, damit die vorigen bereits geladen sind. $js[] = OR_THEMES_DIR . 'default/script/openrat/init'; $js[] = OR_THEMES_DIR . 'default/script/openrat/view'; @@ -549,6 +541,14 @@ class IndexAction extends Action $js[] = OR_THEMES_DIR . 'default/script/openrat/navigator'; $js[] = OR_THEMES_DIR . 'default/script/openrat/common'; + // Komponentenbasiertes Javascript + foreach ( TemplateEngineInfo::getComponentList() as $c) + { + $componentJsFile = OR_HTML_MODULES_DIR . '/template-engine/components/html/' . $c . '/' . $c; + if (is_file($componentJsFile . '.js')) + $js[] = $componentJsFile; + } + $outDevJsFiles = array(); $outProJsFiles = array(); diff --git a/modules/cms-ui/themes/default/production/combined.min.js b/modules/cms-ui/themes/default/production/combined.min.js @@ -275,7 +275,7 @@ else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseIn else{this.currentItem.show()};if(this.fromOutside&&!e){s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))})};if((this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!e){s.push(function(t){this._trigger("update",t,this._uiHash())})};if(this!==this.currentContainer){if(!e){s.push(function(t){this._trigger("remove",t,this._uiHash())});s.push((function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}).call(this,this.currentContainer));s.push((function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}).call(this,this.currentContainer))}};function o(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}};for(i=this.containers.length-1;i>=0;i--){if(!e){s.push(o("deactivate",this,this.containers[i]))};if(this.containers[i].containerCache.over){s.push(o("out",this,this.containers[i]));this.containers[i].containerCache.over=0}};if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove()};if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)};if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex)};this.dragging=!1;if(!e){this._trigger("beforeStop",t,this._uiHash())};this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(!this.cancelHelperRemoval){if(this.helper[0]!==this.currentItem[0]){this.helper.remove()};this.helper=null};if(!e){for(i=0;i<s.length;i++){s[i].call(this,t)};this._trigger("stop",t,this._uiHash())};this.fromOutside=!1;return!this.cancelHelperRemoval},_trigger:function(){if(t.Widget.prototype._trigger.apply(this,arguments)===!1){this.cancel()}},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})})); /* ./modules/cms-ui/themes/default/script/plugin/jquery-plugin-orSearch.min.js */;jQuery.fn.orSearch=function(e){var t=$.extend({'dropdown':$(),'select':function(e){}},e);return $(this).on('input',function(){let searchArgument=$(this).val();let dropdownEl=$(t.dropdown);if(searchArgument.length>3){$(dropdownEl).empty();$.ajax({'type':'GET',url:'./api/?action=search&subaction=quicksearch&output=json&search='+searchArgument,data:null,success:function(e,n,r){for(id in e.output.result){let result=e.output.result[id];let div=$('<div class="entry or-search-result" title="'+result.desc+'"></div>');div.data('object',{'name':result.name,'action':result.type,'id':result.id});let link=$('<a />').attr('href',Openrat.Navigator.createShortUrl(result.type,result.id));link.click(function(e){e.preventDefault()});$(link).append('<i class="image-icon image-icon--action-'+result.type+'" />');$(link).append('<span>'+result.name+'</span>');$(div).append(link);$(dropdownEl).append(div)};$(dropdownEl).closest('.or-menu').addClass('open');$(dropdownEl).find('.or-search-result').click(function(e){t.select($(this).data('object'))})}})} else{$(dropdownEl).empty()}})}; -/* ./modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js */;var popupWindow;jQuery.fn.orLinkify=function(){$(this).find("a").click(function(t){t.preventDefault()});return $(this).click(function(){$(this).find("a").first().each(function(){let type=$(this).attr("data-type");if($(this).parent().hasClass("inactive"))return;switch(type){case"post":$form=$("<form />").attr("method","POST").addClass("invisible");$form.data("afterSuccess",$(this).data("afterSuccess"));let params=jQuery.parseJSON($(this).attr("data-data"));params.output="json";$.each(params,function(t,a){let $input=$("<input />").attr("type","hidden").attr("name",t).attr("value",a);$form.append($input)});let form=new Openrat.Form();form.initOnElement($form);form.submit();break;case"edit":case"dialog":startDialog($(this).attr("data-name"),$(this).attr("data-action"),$(this).attr("data-method"),$(this).attr("data-id"),$(this).attr("data-extra"));break;case"external":window.open($(this).attr("data-url")," _blank");break;case"popup":popupWindow=window.open($(this).attr("data-url"),"Popup","location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes");break;case"help":help(this,$(this).attr("data-url"),$(this).attr("data-suffix"));break;case"fullscreen":fullscreen(this);break;case"open":openNewAction($(this).attr("data-name"),$(this).attr("data-action"),$(this).attr("data-id"));break;default:throw"UI error: Unknown link type: "+type+" in link "+$(this).html()}})})};$(document).on("orViewLoaded",function(t,a){if(typeof popupWindow!="undefined")$(t.target).find("a[data-type='popup']").each(function(){popupWindow.location.href=$(this).attr("data-url")})});$(document).on("orDataChanged",function(t,a){if(typeof popupWindow!="undefined")popupWindow.location.reload()}); +/* ./modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js */;var popupWindow;jQuery.fn.orLinkify=function(){$(this).find('a').click(function(t){t.preventDefault()});return $(this).click(function(){$(this).find('a').first().each(function(){let type=$(this).attr('data-type');if($(this).parent().hasClass('inactive'))return;switch(type){case'post':$form=$('<form />').attr('method','POST').addClass('invisible');$form.data('afterSuccess',$(this).data('afterSuccess'));let params=jQuery.parseJSON($(this).attr('data-data'));params.output='json';$.each(params,function(t,a){let $input=$('<input />').attr('type','hidden').attr('name',t).attr('value',a);$form.append($input)});let form=new Openrat.Form();form.initOnElement($form);form.submit();break;case'edit':case'dialog':startDialog($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-method'),$(this).attr('data-id'),$(this).attr('data-extra'));break;case'external':window.open($(this).attr('data-url'),' _blank');break;case'popup':popupWindow=window.open($(this).attr('data-url'),'Popup','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes');break;case'help':help(this,$(this).attr('data-url'),$(this).attr('data-suffix'));break;case'fullscreen':fullscreen(this);break;case'open':openNewAction($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-id'));break;default:throw'UI error: Unknown link type: '+type+' in link '+$(this).html()}})})};$(document).on('orDataChanged',function(t,a){if(typeof popupWindow!='undefined')popupWindow.location.reload()}); /* ./modules/cms-ui/themes/default/script/plugin/jquery-plugin-orTree.min.js */;jQuery.fn.orTree=function(){$(this).each(function(a,e){$(e).children('.or-navtree-node-control').click(function(){var a=$(this).parent('.or-navtree-node');if($(a).is('.or-navtree-node--is-open')){$(a).children('ul').slideUp('fast').remove();$(a).removeClass('or-navtree-node--is-open').addClass('or-navtree-node--is-closed').find('.tree-icon').removeClass('image-icon--node-open').addClass('image-icon--node-closed')} else{$(e).closest('div.view').addClass('loader');var i=$(a).data('type'),o=$(a).data('id'),t=$(a).data('extra'),n='./api/?action=tree&subaction=loadBranch&id='+o+'&type='+i+'&output=json';if(typeof t==='string'){jQuery.each(jQuery.parseJSON(t.replace(/'/g,'"')),function(e,a){n=n+'&'+e+'='+a})} else if(typeof t==='object'){jQuery.each(t,function(e,a){n=n+'&'+e+'='+a})} @@ -10980,17 +10980,8 @@ header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\ }(navigator.userAgent||navigator.vendor||window.opera),e},V="",K={bold:{name:"bold",action:c,className:"fa fa-bold",title:"Bold","default":!0},italic:{name:"italic",action:u,className:"fa fa-italic",title:"Italic","default":!0},strikethrough:{name:"strikethrough",action:f,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:p,className:"fa fa-header",title:"Heading","default":!0},"heading-smaller":{name:"heading-smaller",action:p,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:m,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:g,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:v,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:y,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:h,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:d,className:"fa fa-quote-left",title:"Quote","default":!0},"unordered-list":{name:"unordered-list",action:x,className:"fa fa-list-ul",title:"Generic List","default":!0},"ordered-list":{name:"ordered-list",action:b,className:"fa fa-list-ol",title:"Numbered List","default":!0},"clean-block":{name:"clean-block",action:w,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:k,className:"fa fa-link",title:"Create Link","default":!0},image:{name:"image",action:S,className:"fa fa-picture-o",title:"Insert Image","default":!0},table:{name:"table",action:C,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:L,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:A,className:"fa fa-eye no-disable",title:"Toggle Preview","default":!0},"side-by-side":{name:"side-by-side",action:N,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side","default":!0},fullscreen:{name:"fullscreen",action:s,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen","default":!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide","default":!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:T,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:M,className:"fa fa-repeat no-disable",title:"Redo"}},X={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},Z={link:"URL for the link:",image:"URL of the image:"},J={bold:"**",code:"```",italic:"*"};B.prototype.markdown=function(e){if(j){var t={};return this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?t.breaks=!1:t.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0&&window.hljs&&(t.highlight=function(e){return window.hljs.highlightAuto(e).value}),j.setOptions(t),j(e)}},B.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e;var t=this.options,n=this,i={};for(var o in t.shortcuts)null!==t.shortcuts[o]&&null!==q[o]&&!function(e){i[r(t.shortcuts[e])]=function(){q[e](n)}}(o);i.Enter="newlineAndIndentContinueMarkdownList",i.Tab="tabAndIndentMarkdownList",i["Shift-Tab"]="shiftTabAndUnindentMarkdownList",i.Esc=function(e){e.getOption("fullScreen")&&s(n)},document.addEventListener("keydown",function(e){e=e||window.event,27==e.keyCode&&n.codemirror.getOption("fullScreen")&&s(n)},!1);var a,l;if(t.spellChecker!==!1?(a="spell-checker",l=t.parsingConfig,l.name="gfm",l.gitHubSpice=!1,z({codeMirrorInstance:F})):(a=t.parsingConfig,a.name="gfm",a.gitHubSpice=!1),this.codemirror=F.fromTextArea(e,{mode:a,backdrop:l,theme:"paper",tabSize:void 0!=t.tabSize?t.tabSize:2,indentUnit:void 0!=t.tabSize?t.tabSize:2,indentWithTabs:t.indentWithTabs!==!1,lineNumbers:!1,autofocus:t.autofocus===!0,extraKeys:i,lineWrapping:t.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:t.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:void 0!=t.styleSelectedText?t.styleSelectedText:!0}),t.forceSync===!0){var c=this.codemirror;c.on("change",function(){c.save()})}this.gui={},t.toolbar!==!1&&(this.gui.toolbar=this.createToolbar()),t.status!==!1&&(this.gui.statusbar=this.createStatusbar()),void 0!=t.autosave&&t.autosave.enabled===!0&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element;var u=this.codemirror;setTimeout(function(){u.refresh()}.bind(u),0)}},B.prototype.autosave=function(){if(_()){var e=this;if(void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to use the autosave feature");null!=e.element.form&&void 0!=e.element.form&&e.element.form.addEventListener("submit",function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)}),this.options.autosave.loaded!==!0&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value());var t=document.getElementById("autosaved");if(null!=t&&void 0!=t&&""!=t){var n=new Date,r=n.getHours(),i=n.getMinutes(),o="am",a=r;a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=10>i?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout(function(){e.autosave()},this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.clearAutosavedValue=function(){if(_()){if(void 0==this.options.autosave||void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value");localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;n&&/editor-preview-side/.test(n.className)||(n=document.createElement("div"),n.className="editor-preview-side",t.parentNode.insertBefore(n,t.nextSibling));var r=!1,i=!1;return e.on("scroll",function(e){if(r)return void(r=!1);i=!0;var t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,o=parseFloat(e.getScrollInfo().top)/t,a=(n.scrollHeight-n.clientHeight)*o;n.scrollTop=a}),n.onscroll=function(){if(i)return void(i=!1);r=!0;var t=n.scrollHeight-n.clientHeight,o=parseFloat(n.scrollTop)/t,a=(e.getScrollInfo().height-e.getScrollInfo().clientHeight)*o;e.scrollTo(0,a)},n},B.prototype.createToolbar=function(e){if(e=e||this.options.toolbar,e&&0!==e.length){var t;for(t=0;t<e.length;t++)void 0!=K[e[t]]&&(e[t]=K[e[t]]);var n=document.createElement("div");n.className="editor-toolbar";var r=this,a={};for(r.toolbar=e,t=0;t<e.length;t++)if(("guide"!=e[t].name||r.options.toolbarGuideIcon!==!1)&&!(r.options.hideIcons&&-1!=r.options.hideIcons.indexOf(e[t].name)||("fullscreen"==e[t].name||"side-by-side"==e[t].name)&&$())){if("|"===e[t]){for(var s=!1,c=t+1;c<e.length;c++)"|"===e[c]||r.options.hideIcons&&-1!=r.options.hideIcons.indexOf(e[c].name)||(s=!0);if(!s)continue}!function(e){var t;t="|"===e?o():i(e,r.options.toolbarTips,r.options.shortcuts),e.action&&("function"==typeof e.action?t.onclick=function(t){t.preventDefault(),e.action(r)}:"string"==typeof e.action&&(t.href=e.action,t.target="_blank")),a[e.name||e]=t,n.appendChild(t)}(e[t])}r.toolbarElements=a;var u=this.codemirror;u.on("cursorActivity",function(){var e=l(u);for(var t in a)!function(t){var n=a[t];e[t]?n.className+=" active":"fullscreen"!=t&&"side-by-side"!=t&&(n.className=n.className.replace(/\s*active\s*/g,""))}(t)});var f=u.getWrapperElement();return f.parentNode.insertBefore(n,f),n}},B.prototype.createStatusbar=function(e){e=e||this.options.status;var t=this.options,n=this.codemirror;if(e&&0!==e.length){var r,i,o,a=[];for(r=0;r<e.length;r++)if(i=void 0,o=void 0,"object"==typeof e[r])a.push({className:e[r].className,defaultValue:e[r].defaultValue,onUpdate:e[r].onUpdate});else{var l=e[r];"words"===l?(o=function(e){e.innerHTML=W(n.getValue())},i=function(e){e.innerHTML=W(n.getValue())}):"lines"===l?(o=function(e){e.innerHTML=n.lineCount()},i=function(e){e.innerHTML=n.lineCount()}):"cursor"===l?(o=function(e){e.innerHTML="0:0"},i=function(e){var t=n.getCursor();e.innerHTML=t.line+":"+t.ch}):"autosave"===l&&(o=function(e){void 0!=t.autosave&&t.autosave.enabled===!0&&e.setAttribute("id","autosaved")}),a.push({className:l,defaultValue:o,onUpdate:i})}var s=document.createElement("div");for(s.className="editor-statusbar",r=0;r<a.length;r++){var c=a[r],u=document.createElement("span");u.className=c.className,"function"==typeof c.defaultValue&&c.defaultValue(u),"function"==typeof c.onUpdate&&this.codemirror.on("update",function(e,t){return function(){t.onUpdate(e)}}(u,c)),s.appendChild(u)}var f=this.codemirror.getWrapperElement();return f.parentNode.insertBefore(s,f.nextSibling),s}},B.prototype.value=function(e){return void 0===e?this.codemirror.getValue():(this.codemirror.getDoc().setValue(e),this)},B.toggleBold=c,B.toggleItalic=u,B.toggleStrikethrough=f,B.toggleBlockquote=d,B.toggleHeadingSmaller=p,B.toggleHeadingBigger=m,B.toggleHeading1=g,B.toggleHeading2=v,B.toggleHeading3=y,B.toggleCodeBlock=h,B.toggleUnorderedList=x,B.toggleOrderedList=b,B.cleanBlock=w,B.drawLink=k,B.drawImage=S,B.drawTable=C,B.drawHorizontalRule=L,B.undo=T,B.redo=M,B.togglePreview=A,B.toggleSideBySide=N,B.toggleFullScreen=s,B.prototype.toggleBold=function(){c(this)},B.prototype.toggleItalic=function(){u(this)},B.prototype.toggleStrikethrough=function(){f(this)},B.prototype.toggleBlockquote=function(){d(this)},B.prototype.toggleHeadingSmaller=function(){p(this)},B.prototype.toggleHeadingBigger=function(){m(this)},B.prototype.toggleHeading1=function(){g(this)},B.prototype.toggleHeading2=function(){v(this)},B.prototype.toggleHeading3=function(){y(this)},B.prototype.toggleCodeBlock=function(){h(this)},B.prototype.toggleUnorderedList=function(){x(this)},B.prototype.toggleOrderedList=function(){b(this)},B.prototype.cleanBlock=function(){w(this)},B.prototype.drawLink=function(){k(this)},B.prototype.drawImage=function(){S(this)},B.prototype.drawTable=function(){C(this)},B.prototype.drawHorizontalRule=function(){L(this)},B.prototype.undo=function(){T(this)},B.prototype.redo=function(){M(this)},B.prototype.togglePreview=function(){A(this)},B.prototype.toggleSideBySide=function(){N(this)},B.prototype.toggleFullScreen=function(){s(this)},B.prototype.isPreviewActive=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.lastChild;return/editor-preview-active/.test(n.className)},B.prototype.isSideBySideActive=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;return/editor-preview-active-side/.test(n.className)},B.prototype.isFullscreenActive=function(){var e=this.codemirror;return e.getOption("fullScreen")},B.prototype.getState=function(){var e=this.codemirror;return l(e)},B.prototype.toTextArea=function(){var e=this.codemirror,t=e.getWrapperElement();t.parentNode&&(this.gui.toolbar&&t.parentNode.removeChild(this.gui.toolbar),this.gui.statusbar&&t.parentNode.removeChild(this.gui.statusbar),this.gui.sideBySide&&t.parentNode.removeChild(this.gui.sideBySide)),e.toTextArea(),this.autosaveTimeoutId&&(clearTimeout(this.autosaveTimeoutId),this.autosaveTimeoutId=void 0,this.clearAutosavedValue())},t.exports=B},{"./codemirror/tablist":19,codemirror:10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen.js":5,"codemirror/addon/display/placeholder.js":6,"codemirror/addon/edit/continuelist.js":7,"codemirror/addon/mode/overlay.js":8,"codemirror/addon/selection/mark-selection.js":9,"codemirror/mode/gfm/gfm.js":11,"codemirror/mode/markdown/markdown.js":12,"codemirror/mode/xml/xml.js":14,marked:17}]},{},[20])(20)}); /* ./modules/editor/trumbowyg/trumbowyg.min.js *//** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Stroke",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,prefix:"trumbowyg-",semantic:!0,resetCss:!1,removeformatPasted:!1,tagsToRemove:[],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1},writable:!1,enumerable:!0,configurable:!1}),function(e,t,n,a){"use strict";var o="tbwconfirm",r="tbwcancel";a.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){a(this).data(n)||a(this).data(n,new i(this,e))});if(1===this.length)try{var o=a(this).data(n);switch(e){case"execCmd":return o.execCmd(t.cmd,t.param,t.forceCss);case"openModal":return o.openModal(t.title,t.content);case"closeModal":return o.closeModal();case"openModalInsert":return o.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return o.saveRange();case"getRange":return o.range;case"getRangeText":return o.getRangeText();case"restoreRange":return o.restoreRange();case"enable":return o.setDisabled(!1);case"disable":return o.setDisabled(!0);case"toggle":return o.toggle();case"destroy":return o.destroy();case"empty":return o.empty();case"html":return o.html(t)}}catch(r){}return!1};var i=function(o,r){var i=this,s="trumbowyg-icons",l=a.trumbowyg;i.doc=o.ownerDocument||n,i.$ta=a(o),i.$c=a(o),r=r||{},null!=r.lang||null!=l.langs[r.lang]?i.lang=a.extend(!0,{},l.langs.en,l.langs[r.lang]):i.lang=l.langs.en,i.hideButtonTexts=null!=l.hideButtonTexts?l.hideButtonTexts:r.hideButtonTexts;var d=null!=l.svgPath?l.svgPath:r.svgPath;if(i.hasSvg=d!==!1,i.svgPath=i.doc.querySelector("base")?t.location.href.split("#")[0]:"",0===a("#"+s,i.doc).length&&d!==!1){if(null==d){for(var c=n.getElementsByTagName("script"),u=0;u<c.length;u+=1){var g=c[u].src,f=g.match("trumbowyg(.min)?.js");null!=f&&(d=g.substring(0,g.indexOf(f[0]))+"ui/icons.svg")}null==d&&console.warn("You must define svgPath: https://goo.gl/CfTY9U")}var h=i.doc.createElement("div");h.id=s,i.doc.body.insertBefore(h,i.doc.body.childNodes[0]),a.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:d,data:null,beforeSend:null,complete:null,success:function(e){h.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})}var p=i.lang.header,m=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&"CSS"in t};i.btnsDef={viewHTML:{fn:"toggle"},undo:{isSupported:m,key:"Z"},redo:{isSupported:m,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:p+" 1"},h2:{fn:"formatBlock",title:p+" 2"},h3:{fn:"formatBlock",title:p+" 3"},h4:{fn:"formatBlock",title:p+" 4"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{"class":"trumbowyg-not-disable"},close:{fn:"destroy","class":"trumbowyg-not-disable"},formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},i.o=a.extend(!0,{},l.defaultOptions,r),i.o.hasOwnProperty("imgDblClickHandler")||(i.o.imgDblClickHandler=i.getDefaultImgDblClickHandler()),i.urlPrefix=i.setupUrlPrefix(),i.disabled=i.o.disabled||"TEXTAREA"===o.nodeName&&o.disabled,r.btns?i.o.btns=r.btns:i.o.semantic||(i.o.btns[3]=["bold","italic","underline","strikethrough"]),a.each(i.o.btnsDef,function(e,t){i.addBtnDef(e,t)}),i.eventNamespace="trumbowyg-event",i.keys=[],i.tagToButton={},i.tagHandlers=[],i.pasteHandlers=[].concat(i.o.pasteHandlers),i.isIE=e.userAgent.indexOf("MSIE")!==-1||e.appVersion.indexOf("Trident/")!==-1,i.init()};i.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(t){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=t},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":/:\/\/$/.test(e)?e:e+"://"},buildEditor:function(){var e=this,n=e.o.prefix,o="";e.$box=a("<div/>",{"class":n+"box "+n+"editor-visible "+n+e.o.lang+" trumbowyg"}),e.isTextarea=e.$ta.is("textarea"),e.isTextarea?(o=e.$ta.val(),e.$ed=a("<div/>"),e.$box.insertAfter(e.$ta).append(e.$ed,e.$ta)):(e.$ed=e.$ta,o=e.$ed.html(),e.$ta=a("<textarea/>",{name:e.$ta.attr("id"),height:e.height}).val(o),e.$box.insertAfter(e.$ed).append(e.$ta,e.$ed),e.syncCode()),e.$ta.addClass(n+"textarea").attr("tabindex",-1),e.$ed.addClass(n+"editor").attr({contenteditable:!0,dir:e.lang._dir||"ltr"}).html(o),e.o.tabindex&&e.$ed.attr("tabindex",e.o.tabindex),e.$c.is("[placeholder]")&&e.$ed.attr("placeholder",e.$c.attr("placeholder")),e.$c.is("[spellcheck]")&&e.$ed.attr("spellcheck",e.$c.attr("spellcheck")),e.o.resetCss&&e.$ed.addClass(n+"reset-css"),e.o.autogrow||e.$ta.add(e.$ed).css({height:e.height}),e.semanticCode(),e.o.autogrowOnEnter&&e.$ed.addClass(n+"autogrow-on-enter");var r,i=!1,s=!1,l="keyup";e.$ed.on("dblclick","img",e.o.imgDblClickHandler).on("keydown",function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey){i=!0;var n=e.keys[String.fromCharCode(t.which).toUpperCase()];try{return e.execCmd(n.fn,n.param),!1}catch(a){}}}).on("compositionstart compositionupdate",function(){s=!0}).on(l+" compositionend",function(t){if("compositionend"===t.type)s=!1;else if(s)return;var n=t.which;if(!(n>=37&&n<=40)){if(!t.ctrlKey&&!t.metaKey||89!==n&&90!==n)if(i||17===n)"undefined"==typeof t.which&&e.semanticCode(!1,!1,!0);else{var a=!e.isIE||"compositionend"===t.type;e.semanticCode(!1,a&&13===n),e.$c.trigger("tbwchange")}else e.$c.trigger("tbwchange");setTimeout(function(){i=!1},50)}}).on("mouseup keydown keyup",function(t){(!t.ctrlKey&&!t.metaKey||t.altKey)&&setTimeout(function(){i=!1},50),clearTimeout(r),r=setTimeout(function(){e.updateButtonPaneStatus()},50)}).on("focus blur",function(t){if(e.$c.trigger("tbw"+t.type),"blur"===t.type&&a("."+n+"active-button",e.$btnPane).removeClass(n+"active-button "+n+"active"),e.o.autogrowOnEnter){if(e.autogrowOnEnterDontClose)return;"focus"===t.type?(e.autogrowOnEnterWasFocused=!0,e.autogrowEditorOnEnter()):e.o.autogrow||(e.$ed.css({height:e.$ed.css("min-height")}),e.$c.trigger("tbwresize"))}}).on("cut",function(){setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(e.o.removeformatPasted){n.preventDefault(),t.getSelection&&t.getSelection().deleteFromDocument&&t.getSelection().deleteFromDocument();try{var o=t.clipboardData.getData("Text");try{e.doc.selection.createRange().pasteHTML(o)}catch(r){e.doc.getSelection().getRangeAt(0).insertNode(e.doc.createTextNode(o))}e.$c.trigger("tbwchange",n)}catch(i){e.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}a.each(e.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwpaste",n)},0)}),e.$ta.on("keyup",function(){e.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){e.$c.trigger("tbwchange")},0)}),e.$box.on("keydown",function(t){if(27===t.which&&1===a("."+n+"modal-box",e.$box).length)return e.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var e=this,t=e.o.prefix,n=e.$btnPane=a("<div/>",{"class":t+"button-pane"});a.each(e.o.btns,function(o,r){a.isArray(r)||(r=[r]);var i=a("<div/>",{"class":t+"button-group "+(r.indexOf("fullscreen")>=0?t+"right":"")});a.each(r,function(t,n){try{e.isSupportedBtn(n)&&i.append(e.buildBtn(n))}catch(a){}}),i.html().trim().length>0&&n.append(i)}),e.$box.prepend(n)},buildBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=t.lang[e]||e,l=a("<button/>",{type:"button","class":n+e+"-button "+(o["class"]||"")+(i?"":" "+n+"textual-button"),html:t.hasSvg&&i?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':t.hideButtonTexts?"":o.text||o.title||t.lang[e]||e,title:(o.title||o.text||s)+(o.key?" (Ctrl + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!a("."+e+"-"+n+"dropdown",t.$box).is(":hidden")||a("body",t.doc).trigger("mousedown"),!((t.$btnPane.hasClass(n+"disable")||t.$box.hasClass(n+"disabled"))&&!a(this).hasClass(n+"active")&&!a(this).hasClass(n+"not-disable"))&&(t.execCmd(!!r&&"dropdown"||o.fn||e,o.param||e,o.forceCss),!1)}});if(r){l.addClass(n+"open-dropdown");var d=n+"dropdown",c={"class":d+"-"+e+" "+d+" "+n+"fixed-top"};c["data-"+d]=e;var u=a("<div/>",c);a.each(r,function(e,n){t.btnsDef[n]&&t.isSupportedBtn(n)&&u.append(t.buildSubBtn(n))}),t.$box.append(u.hide())}else o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e});return r||(t.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=null==o.hasIcon||o.hasIcon;return o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e}),t.tagToButton[(o.tag||e).toLowerCase()]=e,a("<button/>",{type:"button","class":n+e+"-dropdown-button"+(o.ico?" "+n+o.ico+"-button":""),html:t.hasSvg&&r?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(o.text||o.title||t.lang[e]||e):o.text||o.title||t.lang[e]||e,title:o.key?" (Ctrl + "+o.key+")":null,style:o.style||null,mousedown:function(){return a("body",t.doc).trigger("mousedown"),t.execCmd(o.fn||e,o.param||e,o.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(t){}return!0},buildOverlay:function(){var e=this;return e.$overlay=a("<div/>",{"class":e.o.prefix+"overlay"}).appendTo(e.$box),e.$overlay},showOverlay:function(){var e=this;a(t).trigger("scroll"),e.$overlay.fadeIn(200),e.$box.addClass(e.o.prefix+"box-blur")},hideOverlay:function(){var e=this;e.$overlay.fadeOut(50),e.$box.removeClass(e.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var e=this,n=e.o.fixedFullWidth,o=e.$box;e.o.fixedBtnPane&&(e.isFixed=!1,a(t).on("scroll."+e.eventNamespace+" resize."+e.eventNamespace,function(){if(o){e.syncCode();var r=a(t).scrollTop(),i=o.offset().top+1,s=e.$btnPane,l=s.outerHeight()-2;r-i>0&&r-i-e.height<0?(e.isFixed||(e.isFixed=!0,s.css({position:"fixed",top:0,left:n?"0":"auto",zIndex:7}),a([e.$ta,e.$ed]).css({marginTop:s.height()})),s.css({width:n?"100%":o.width()-1+"px"}),a("."+e.o.prefix+"fixed-top",o).css({position:n?"fixed":"absolute",top:n?l:l+(r-i)+"px",zIndex:15})):e.isFixed&&(e.isFixed=!1,s.removeAttr("style"),a([e.$ta,e.$ed]).css({marginTop:0}),a("."+e.o.prefix+"fixed-top",o).css({position:"absolute",top:l}))}}))},setDisabled:function(e){var t=this,n=t.o.prefix;t.disabled=e,e?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,n=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(n+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(n+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),a("body").removeClass(n+"body-fullscreen"),e.$c.trigger("tbwclose"),a(t).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),a("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},dropdown:function(e){var n=this,o=n.doc,r=n.o.prefix,i=a("[data-"+r+"dropdown="+e+"]",n.$box),s=a("."+r+e+"-button",n.$btnPane),l=i.is(":hidden");if(a("body",o).trigger("mousedown"),l){var d=s.offset().left;s.addClass(r+"active"),i.css({position:"absolute",top:s.offset().top-n.$btnPane.offset().top+s.outerHeight(),left:n.o.fixedFullWidth&&n.isFixed?d+"px":d-n.$btnPane.offset().left+"px"}).show(),a(t).trigger("scroll"),a("body",o).on("mousedown."+n.eventNamespace,function(e){i.is(e.target)||(a("."+r+"dropdown",n.$box).hide(),a("."+r+"active",n.$btnPane).removeClass(r+"active"),a("body",o).off("mousedown."+n.eventNamespace))})}},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(e.$ed.text().trim().length>0||e.$ed.find("hr,img,embed,iframe,input").length>0?e.$ed.html():"")},syncCode:function(e){var t=this;if(!e&&t.$ed.is(":visible"))t.syncTextarea();else{var n=a("<div>").html(t.$ta.val()),o=a("<div>").append(n);a(t.o.tagsToRemove.join(","),o).remove(),t.$ed.html(o.contents().html())}if(t.o.autogrow&&(t.height=t.$ed.height(),t.height!==t.$ta.css("height")&&(t.$ta.css({height:t.height}),t.$c.trigger("tbwresize"))),t.o.autogrowOnEnter){t.$ed.height("auto");var r=t.autogrowOnEnterWasFocused?t.$ed[0].scrollHeight:t.$ed.css("min-height");r!==t.$ta.css("height")&&(t.$ed.css({height:r}),t.$c.trigger("tbwresize"))}},semanticCode:function(e,t,n){var o=this;if(o.saveRange(),o.syncCode(e),o.o.semantic){if(o.semanticTag("b"),o.semanticTag("i"),o.semanticTag("s"),o.semanticTag("strike"),t){var r=o.o.inlineElementsSelector,i=":not("+r+")";o.$ed.contents().filter(function(){return 3===this.nodeType&&this.nodeValue.trim().length>0}).wrap("<span data-tbw/>");var s=function(e){if(0!==e.length){var t=e.nextUntil(i).addBack().wrapAll("<p/>").parent(),n=t.nextAll(r).first();t.next("br").remove(),s(n)}};s(o.$ed.children(r).first()),o.semanticTag("div",!0),o.$ed.find("p").filter(function(){return(!o.range||this!==o.range.startContainer)&&(0===a(this).text().trim().length&&0===a(this).children().not("br,span").length)}).contents().unwrap(),a("[data-tbw]",o.$ed).contents().unwrap(),o.$ed.find("p:empty").remove()}n||o.restoreRange(),o.syncTextarea()}},semanticTag:function(e,t){var n;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))n=this.o.semantic[e];else{if(this.o.semantic!==!0||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;n=this.DEFAULT_SEMANTIC_MAP[e]}a(e,this.$ed).each(function(){var e=a(this);e.wrap("<"+n+"/>"),t&&a.each(e.prop("attributes"),function(){e.parent().attr(this.name,this.value)}),e.contents().unwrap()})},createLink:function(){for(var e,t,n,o=this,r=o.doc.getSelection(),i=r.focusNode,s=(new XMLSerializer).serializeToString(r.getRangeAt(0).cloneContents());["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;if(i&&"A"===i.nodeName){var l=a(i);s=l.text(),e=l.attr("href"),o.o.minimalLinks||(t=l.attr("title"),n=l.attr("target"));var d=o.doc.createRange();d.selectNode(i),r.removeAllRanges(),r.addRange(d)}o.saveRange();var c={url:{label:"URL",required:!0,value:e},text:{label:o.lang.text,value:s}};o.o.minimalLinks||Object.assign(c,{title:{label:o.lang.title,value:t},target:{label:o.lang.target,value:n}}),o.openModalInsert(o.lang.createLink,c,function(e){var t=o.prependUrlPrefix(e.url);if(!t.length)return!1;var n=a(['<a href="',e.url,'">',e.text||e.url,"</a>"].join(""));return o.o.minimalLinks||(e.title.length>0&&n.attr("title",e.title),e.target.length>0&&n.attr("target",e.target)),o.range.deleteContents(),o.range.insertNode(n[0]),o.syncCode(),o.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){var t=this;if(!t.urlPrefix)return e;const n=/^([a-z][-+.a-z0-9]*:|\/|#)/i;if(n.test(e))return e;const a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return a.test(e)?"mailto:"+e:t.urlPrefix+e},unlink:function(){var e=this,t=e.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;if(n&&"A"===n.nodeName){var a=e.doc.createRange();a.selectNode(n),t.removeAllRanges(),t.addRange(a)}}e.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var e=this;e.saveRange();var t={url:{label:"URL",required:!0},alt:{label:e.lang.description,value:e.getRangeText()}};e.o.imageWidthModalEdit&&(t.width={}),e.openModalInsert(e.lang.insertImage,t,function(t){e.execCmd("insertImage",t.url);var n=a('img[src="'+t.url+'"]:not([alt])',e.$box);return n.attr("alt",t.alt),e.o.imageWidthModalEdit&&n.attr({width:t.width}),e.syncCode(),e.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e,n=this,o=n.o.prefix,r=o+"fullscreen";n.$box.toggleClass(r),e=n.$box.hasClass(r),a("body").toggleClass(o+"body-fullscreen",e),a(t).trigger("scroll"),n.$c.trigger("tbw"+(e?"open":"close")+"fullscreen")},execCmd:function(e,t,n,a){var o=this;a=!!a||"","dropdown"!==e&&o.$ed.focus();try{o.doc.execCommand("styleWithCSS",!1,n||!1)}catch(r){}try{o[e+a](t)}catch(r){try{e(t)}catch(i){"insertHorizontalRule"===e?t=void 0:"formatBlock"===e&&o.isIE&&(t="<"+t+">"),o.doc.execCommand(e,!1,t),o.syncCode(),o.semanticCode(!1,!0)}"dropdown"!==e&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,n){var i=this,s=i.o.prefix;if(a("."+s+"modal-box",i.$box).length>0)return!1;i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!0),i.saveRange(),i.showOverlay(),i.$btnPane.addClass(s+"disable");var l=a("<div/>",{"class":s+"modal "+s+"fixed-top"}).css({top:i.$btnPane.height()}).appendTo(i.$box);i.$overlay.one("click",function(){return l.trigger(r),!1});var d=a("<form/>",{action:"",html:n}).on("submit",function(){return l.trigger(o),!1}).on("reset",function(){return l.trigger(r),!1}).on("submit reset",function(){i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!1)}),c=a("<div/>",{"class":s+"modal-box",html:d}).css({top:"-"+i.$btnPane.outerHeight()+"px",opacity:0}).appendTo(l).animate({top:0,opacity:1},100);return a("<span/>",{text:e,"class":s+"modal-title"}).prependTo(c),l.height(c.outerHeight()+10),a("input:first",c).focus(),i.buildModalBtn("submit",c),i.buildModalBtn("reset",c),a(t).trigger("scroll"),l},buildModalBtn:function(e,t){var n=this,o=n.o.prefix;return a("<button/>",{"class":o+"modal-button "+o+"modal-"+e,type:e,text:n.lang[e]||e}).appendTo(a("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=a("."+t+"modal-box",e.$box);n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay()}),e.restoreRange()},openModalInsert:function(e,t,n){var i=this,s=i.o.prefix,l=i.lang,d="";return a.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},r=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");d+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+r+'><span class="'+s+'input-infos"><span>'+(l[n]?l[n]:n)+"</span></span></label>"}),i.openModal(e,d).on(o,function(){var e=a("form",a(this)),r=!0,s={};a.each(t,function(t,n){var o=n.name||t,l=a('input[name="'+o+'"]',e),d=l.attr("type");switch(d.toLowerCase()){case"checkbox":s[o]=l.is(":checked");break;case"radio":s[o]=l.filter(":checked").val();break;default:s[o]=a.trim(l.val())}n.required&&""===s[o]?(r=!1,i.addErrorOnModalField(l,i.lang.required)):n.pattern&&!n.pattern.test(s[o])&&(r=!1,i.addErrorOnModalField(l,n.patternError))}),r&&(i.restoreRange(),n(s,t)&&(i.syncCode(),i.$c.trigger("tbwchange"),i.closeModal(),a(this).off(o)))}).one(r,function(){a(this).off(o),i.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error")}),o.addClass(n+"input-error").find("input+span").append(a("<span/>",{"class":n+"msg-error",text:t}))},getDefaultImgDblClickHandler:function(){var e=this;return function(){var t=a(this),n=t.attr("src"),o="(Base64)";0===n.indexOf("data:image")&&(n=o);var r={url:{label:"URL",value:n,required:!0},alt:{label:e.lang.description,value:t.attr("alt")}};return e.o.imageWidthModalEdit&&(r.width={value:t.attr("width")?t.attr("width"):""}),e.openModalInsert(e.lang.insertImage,r,function(n){return n.src!==o&&t.attr({src:n.url}),t.attr({alt:n.alt}),e.o.imageWidthModalEdit&&(parseInt(n.width)>0?t.attr({width:n.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e=this,t=e.doc.getSelection();if(e.range=null,t.rangeCount){var n,a=e.range=t.getRangeAt(0),o=e.doc.createRange();o.selectNodeContents(e.$ed[0]),o.setEnd(a.startContainer,a.startOffset),n=(o+"").length,e.metaRange={start:n,end:n+(a+"").length}}},restoreRange:function(){var e,t=this,n=t.metaRange,a=t.range,o=t.doc.getSelection();if(a){if(n&&n.start!==n.end){var r,i=0,s=[t.$ed[0]],l=!1,d=!1;for(e=t.doc.createRange();!d&&(r=s.pop());)if(3===r.nodeType){var c=i+r.length;!l&&n.start>=i&&n.start<=c&&(e.setStart(r,n.start-i),l=!0),l&&n.end>=i&&n.end<=c&&(e.setEnd(r,n.end-i),d=!0),i=c}else for(var u=r.childNodes,g=u.length;g>0;)g-=1,s.push(u[g])}o.removeAllRanges(),o.addRange(e||a)}},getRangeText:function(){return this.range+""},updateButtonPaneStatus:function(){var e=this,t=e.o.prefix,n=e.getTagsRecursive(e.doc.getSelection().focusNode),o=t+"active-button "+t+"active";a("."+t+"active-button",e.$btnPane).removeClass(o),a.each(n,function(n,r){var i=e.tagToButton[r.toLowerCase()],s=a("."+t+i+"-button",e.$btnPane);if(s.length>0)s.addClass(o);else try{s=a("."+t+"dropdown ."+t+i+"-dropdown-button",e.$box);var l=s.parent().data("dropdown");a("."+t+l+"-button",e.$box).addClass(o)}catch(d){}})},getTagsRecursive:function(e,t){var n=this;if(t=t||(e&&e.tagName?[e.tagName]:[]),!e||!e.parentNode)return t;e=e.parentNode;var o=e.tagName;return"DIV"===o?t:("P"===o&&""!==e.style.textAlign&&t.push(e.style.textAlign),a.each(n.tagHandlers,function(a,o){t=t.concat(o(e,n))}),t.push(o),n.getTagsRecursive(e,t).filter(function(e){return null!=e}))},initPlugins:function(){var e=this;e.loadedPlugins=[],a.each(a.trumbowyg.plugins,function(t,n){n.shouldInit&&!n.shouldInit(e)||(n.init(e),n.tagHandler&&e.tagHandlers.push(n.tagHandler),e.loadedPlugins.push(n))})},destroyPlugins:function(){a.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy()})}}}(navigator,window,document,jQuery); -/* ./modules//template-engine/components/html/editor/editor.min.js */;$(document).on('orViewLoaded',function(e,t){$(e.target).find('textarea').orAutoheight();$(e.target).find('textarea.editor.code-editor').each(function(){let mode=$(this).data('mode');let mimetype=$(this).data('mimetype');if(mimetype.length>0)mode=mimetype;let textareaEl=this;let editor=CodeMirror.fromTextArea(textareaEl,{lineNumbers:!0,viewportMargin:Infinity,mode:mode});editor.on('change',function(){let newValue=editor.getValue();$(textareaEl).val(newValue)});$(editor.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(t,e){let dropped=e.draggable;let pos=editor.getCursor();editor.setSelection(pos,pos);let insertText=dropped.data('id');let toInsert=''+insertText;editor.replaceSelection(toInsert)}})});$(e.target).find('textarea.editor.markdown-editor').each(function(){let textarea=this;let toolbar=[{name:'bold',action:SimpleMDE.toggleBold,className:'image-icon image-icon--editor-bold',title:'Bold',},{name:'italic',action:SimpleMDE.toggleItalic,className:'image-icon image-icon--editor-italic',title:'Italic',},{name:'heading',action:SimpleMDE.toggleHeadingBigger,className:'image-icon image-icon--editor-headline',title:'Headline',},'|',{name:'quote',action:SimpleMDE.toggleBlockquote,className:'image-icon image-icon--editor-quote',title:'Quote',},{name:'code',action:SimpleMDE.toggleCodeBlock,className:'image-icon image-icon--editor-code',title:'Code',},'|',{name:'generic list',action:SimpleMDE.toggleUnorderedList,className:'image-icon image-icon--editor-unnumberedlist',title:'Unnumbered list',},{name:'numbered list',action:SimpleMDE.toggleOrderedList,className:'image-icon image-icon--editor-numberedlist',title:'Numbered list',},'|',{name:'table',action:SimpleMDE.drawTable,className:'image-icon image-icon--editor-table',title:'Table',},{name:'horizontalrule',action:SimpleMDE.drawHorizontalRule,className:'image-icon image-icon--editor-horizontalrule',title:'Horizontal rule',},'|',{name:'undo',action:SimpleMDE.undo,className:'image-icon image-icon--editor-undo',title:'Undo',},{name:'redo',action:SimpleMDE.redo,className:'image-icon image-icon--editor-redo',title:'Redo',},'|',{name:'link',action:SimpleMDE.drawLink,className:'image-icon image-icon--editor-link',title:'Link',},{name:'image',action:SimpleMDE.drawImage,className:'image-icon image-icon--editor-image',title:'Image',},'|',{name:'guide',action:'https://simplemde.com/markdown-guide',className:'image-icon image-icon--editor-help',title:'Howto markdown',},];let mde=new SimpleMDE({element:$(this)[0],toolbar:toolbar,autoDownloadFontAwesome:!1});let codemirror=mde.codemirror;$(codemirror.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(t,e){let dropped=e.draggable;let insertText='';let id=dropped.data('id');let url='__OID__'+id+'__';if(dropped.data('type')=='image')insertText='![]('+url+')';else insertText='['+id+']('+url+')';let pos=codemirror.getCursor();codemirror.setSelection(pos,pos);codemirror.replaceSelection(insertText)}});codemirror.on('change',function(){let newValue=codemirror.getValue();$(textarea).val(newValue)})});$(e.target).find('textarea.editor.html-editor').each(function(){let textarea=this;$.trumbowyg.svgPath='./modules/editor/trumbowyg/ui/icons.svg';$(textarea).trumbowyg();$(textarea).closest('form').find('.trumbowyg-editor').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(t,e){let dropped=e.draggable;let id=dropped.data('id');let url='./?_='+dropped.data('type')+'-'+id+'&subaction=show&embed=1&__OID__'+id+'__='+id;let insertText='';if(dropped.data('type')=='image')insertText='<img src="'+url+'" alt="" />';else insertText='<a href="'+url+'" />'+id+'</a>';$(textarea).trumbowyg('execCmd',{cmd:'insertHTML',param:insertText,forceCss:!1,})}})})}); -/* ./modules//template-engine/components/html/link/link.min.js */;$(document).on('orViewLoaded',function(i,n){$(i.target).find('.clickable').orLinkify()}); -/* ./modules//template-engine/components/html/qrcode/qrcode.min.js */;$(document).on('orViewLoaded',function(e,r){$(e.target).find('.or-qrcode').mouseover(function(){let element=this;if($(element).children().length>0)return;let wrapper=$('<div class="or-info-popup"></div>');$(element).append(wrapper);var e=$(element).attr('data-qrcode');$(wrapper).qrcode({render:'div',text:e,fill:'currentColor'});wrapper.attr('title','')})}); -/* ./modules//template-engine/components/html/table/table.min.js */;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.or-table--sortable > tbody').sortable();$(t.target).find('table.or-table--sortable > tbody').closest('form').submit(function(){var t=[];$(this).find('table.or-table--sortable').find('tbody > tr.data').each(function(){let objectid=$(this).data('id');t.push(objectid)});$(this).find('input[name=order]').val(t.join(','))});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.or-table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.or-table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr:not(.headline)').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t.target).find('table > tbody > tr.headline > td, table > tbody > tr > th').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td, tr > th').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(l(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function l(t){return function(e,l){let valA=a(e,t),valB=a(l,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function a(t,e){return $(t).children('td').eq(e).text()}}); -/* ./modules//template-engine/components/html/column/column.min.js */;$(document).on('orViewLoaded',function(o,n){}); -/* ./modules//template-engine/components/html/image/image.min.js */; -/* ./modules//template-engine/components/html/group/group.min.js */;$(document).on('orViewLoaded',function(e,o){registerOpenClose($(e.target).find('fieldset.toggle-open-close'))}); -/* ./modules//template-engine/components/html/upload/upload.min.js */;$(document).on('orViewLoaded',function(e,o){var a=$(e.target).find('form'),n=$(e.target).find('div.or-dropzone-upload > div.input');n.on('dragenter',function(e){e.stopPropagation();e.preventDefault();$(this).css('border','1px dotted gray')});n.on('dragover',function(e){e.stopPropagation();e.preventDefault()});n.on('drop',function(e){$(this).css('border','1px dotted red');e.preventDefault();var o=e.originalEvent.dataTransfer.files;handleFileUpload(a,o)});$(e.target).find('input[type=file]').change(function(){var e=$(this).prop('files');handleFileUpload(a,e)})});function handleFileUpload(e,n){for(var t=0,r;r=n[t];t++){var o=new FormData();o.append('file',r);o.append('action','folder');o.append('subaction',$(e).data('method'));o.append('output','json');o.append('token',$(e).find('input[name=token]').val());o.append('id',$(e).find('input[name=id]').val());var a=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(a);$(a).show();$.ajax({'type':'POST',url:'./api/',cache:!1,contentType:!1,processData:!1,data:o,success:function(o,n,t){$(a).remove();let oform=new Openrat.Form();oform.doResponse(o,n,e)},error:function(o,n,d){$(e).closest('div.content').removeClass('loader');$(a).remove();var r;try{var t=jQuery.parseJSON(o.responseText);r=t.error+'/'+t.description+': '+t.reason}catch(i){r=o.responseText};Openrat.Workbench.notify('Upload error',r)}})}}; -/* ./modules//template-engine/components/html/tree/tree.min.js */;$(document).on('orViewLoaded',function(o,n){}); /* ./modules/cms-ui/themes/default/script/openrat/init.min.js */;window.Openrat={}; -/* ./modules/cms-ui/themes/default/script/openrat/view.min.js */;Openrat.View=function(t,r,i,n){this.action=t;this.method=r;this.id=i;this.params=n;this.before=function(){};this.start=function(e){this.before();this.element=e;this.loadView()};this.afterLoad=function(){};this.close=function(){};function a(e){afterViewLoaded(e)};this.loadView=function(){let e=Openrat.View.createUrl(this.action,this.method,this.id,this.params);let element=this.element;let view=this;$(this.element).empty().fadeTo(1,0.7).addClass('loader').html('').load(e,function(t,i,r){$(element).fadeTo(350,1);$(element).removeClass('loader');$(element).find('form').each(function(){let form=new Openrat.Form();form.close=function(){view.close()};form.initOnElement(this)});if(i=='error'){$(element).html('');Openrat.Workbench.notify('','','error','Server Error',['Server Error while requesting url '+e,t]);return};a(element)})};Openrat.View.createUrl=function(t,subaction,i,extraid={}){var e='./';e+='?';if(t)e+='&action='+t;if(subaction)e+='&subaction='+subaction;if(i)e+='&id='+i;if(typeof extraid==='string'){extraid=extraid.replace(/'/g,'"');var o=jQuery.parseJSON(extraid);jQuery.each(o,function(t,i){e=e+'&'+t+'='+i})} +/* ./modules/cms-ui/themes/default/script/openrat/view.min.js */;Openrat.View=function(t,r,i,n){this.action=t;this.method=r;this.id=i;this.params=n;this.before=function(){};this.start=function(e){this.before();this.element=e;this.loadView()};this.afterLoad=function(){};this.close=function(){};function a(e){Openrat.Workbench.afterViewLoaded(e)};this.loadView=function(){let e=Openrat.View.createUrl(this.action,this.method,this.id,this.params);let element=this.element;let view=this;$(this.element).empty().fadeTo(1,0.7).addClass('loader').html('').load(e,function(t,i,r){$(element).fadeTo(350,1);$(element).removeClass('loader');$(element).find('form').each(function(){let form=new Openrat.Form();form.close=function(){view.close()};form.initOnElement(this)});if(i=='error'){$(element).html('');Openrat.Workbench.notify('','','error','Server Error',['Server Error while requesting url '+e,t]);return};a(element)})};Openrat.View.createUrl=function(t,subaction,i,extraid={}){var e='./';e+='?';if(t)e+='&action='+t;if(subaction)e+='&subaction='+subaction;if(i)e+='&id='+i;if(typeof extraid==='string'){extraid=extraid.replace(/'/g,'"');var o=jQuery.parseJSON(extraid);jQuery.each(o,function(t,i){e=e+'&'+t+'='+i})} else if(typeof extraid==='object'){jQuery.each(extraid,function(t,i){e=e+'&'+t+'='+i})} else{};return e}}; /* ./modules/cms-ui/themes/default/script/openrat/form.min.js */;Openrat.Form=function(){this.setLoadStatus=function(e){$(this.element).closest('div.content').toggleClass('loader',e)};this.initOnElement=function(e){this.element=e;let form=this;if($(this.element).data('autosave')){$(this.element).find('input[type="checkbox"]').click(function(){form.submit()});$(this.element).find('select').change(function(){form.submit()})};$(e).find('.or-form-btn--cancel').click(function(){form.cancel()});$(e).find('.or-form-btn--reset').click(function(){form.rollback()});$(e).submit(function(e){if($(this).data('target')=='view'){form.submit();e.preventDefault()}})};this.cancel=function(){this.close()};this.rollback=function(){this.element.trigger('reset')};this.close=function(){};this.forwardTo=function(e,t,r,s){let view=new Openrat.View(e,t,r,s);view.start($(this.element).closest('.view'))};this.submit=function(){let status=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(status);$(status).show();$(this.element).find('.error').removeClass('error');var t=$(this.element).serializeArray(),e={};$(t).each(function(t,r){e[r.name]=r.value});if(!e.id)e.id=Openrat.Workbench.state.id;if(!e.action)e.action=Openrat.Workbench.state.action;let formMethod=$(this.element).attr('method').toUpperCase();if(formMethod=='GET'){this.forwardTo(e.action,e.subaction,e.id,e);$(status).remove()} @@ -10999,10 +10990,19 @@ else{if(async);else Openrat.Workbench.reloadViews()};$(document).trigger('orData else{}});$.each(e['errors'],function(e,t){$('input[name='+t+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(e.control.redirect)window.location.href=e.control.redirect}}; /* ./modules/cms-ui/themes/default/script/openrat/workbench.min.js */;Openrat.Workbench=new function(){'use strict';this.state={};this.initialize=function(){this.initializePingTimer();this.initializeState();this.openModalDialog()};this.openModalDialog=function(){if($('#dialog').data('action')){startDialog('',$('#dialog').data('action'),$('#dialog').data('action'),0,{})}};this.initializeState=function(){let parts=window.location.hash.split('/');let state={action:'index',id:0};if(parts.length>=2)state.action=parts[1].toLowerCase();if(parts.length>=3)state.id=parts[2].replace(/[^0-9_]/gim,'');Openrat.Workbench.state=state;$('#editor').attr('data-action',state.action);$('#editor').attr('data-id',state.id);$('#editor').attr('data-extra','{}');Openrat.Navigator.toActualHistory(state)};this.initializePingTimer=function(){var t=function(){$.ajax(Openrat.View.createUrl('title','ping',0))},i=5;window.setInterval(t,i*60*1000)};this.loadNewActionState=function(t){Openrat.Workbench.state=t;Openrat.Workbench.loadNewAction(t.action,t.id,t.data);this.afterViewsLoaded()};this.loadNewAction=function(t,i,e){$('#editor').attr('data-action',t);$('#editor').attr('data-id',i);$('#editor').attr('data-extra',JSON.stringify(e));this.reloadViews()};this.afterViewsLoaded=function(){$(document).trigger('orNewAction')};this.reloadViews=function(){$('#workbench section.closed .view-loader').empty();Openrat.Workbench.loadViews($('#workbench section.open .view-loader'))};this.reloadAll=function(){$('#workbench .view').empty();Openrat.Workbench.loadViews($('#workbench .view.view-loader, #workbench .view.view-static'));this.loadUserStyle()};this.loadUserStyle=function(){let url=Openrat.View.createUrl('index','userinfo',0);$.getJSON(url,function(t){let style=t['style'];Openrat.Workbench.setUserStyle(style);let color=t['theme-color'];Openrat.Workbench.setThemeColor(color)})};this.loadViews=function(t){t.each(function(t){let $targetDOMElement=$(this);Openrat.Workbench.loadNewActionIntoElement($targetDOMElement)})};this.loadNewActionIntoElement=function(t){let action;if(t.is('.view-static'))action=t.attr('data-action');else action=$('#editor').attr('data-action');let id=$('#editor').attr('data-id');let params=$('#editor').attr('data-extra');let method=t.data('method');let view=new Openrat.View(action,method,id,params);view.start(t)};this.setUserStyle=function(t){var i=$('html'),e=i.attr('class').split(/\s+/);$.each(e,function(t,e){if(e.startsWith('theme-')){i.removeClass(e)}});i.addClass('theme-'+t.toLowerCase())};this.setThemeColor=function(t){$('#theme-color').attr('content',t)};let notifyBrowser=function(t){if(!('Notification' in window)){return} else if(Notification.permission==='granted'){let notification=new Notification(t)} -else if(Notification.permission!=='denied'){Notification.requestPermission(function(i){if(i==='granted'){let notification=new Notification(t)}})}};this.notify=function(t,e,i,o,log=[],notifyTheBrowser=!1){if(notifyTheBrowser)notifyBrowser(o);let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);let id=0;if(e)$(notice).append('<div class="name clickable"><a href="" data-type="open" data-action="'+t+'" data-id="'+id+'"><i class="or-action-full image-icon image-icon--action-'+t+'"></i> '+e+'</a></div>');$(notice).append('<div class="text">'+htmlEntities(o)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).orLinkify();$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)}}; +else if(Notification.permission!=='denied'){Notification.requestPermission(function(i){if(i==='granted'){let notification=new Notification(t)}})}};this.notify=function(t,e,i,o,log=[],notifyTheBrowser=!1){if(notifyTheBrowser)notifyBrowser(o);let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);let id=0;if(e)$(notice).append('<div class="name clickable"><a href="" data-type="open" data-action="'+t+'" data-id="'+id+'"><i class="or-action-full image-icon image-icon--action-'+t+'"></i> '+e+'</a></div>');$(notice).append('<div class="text">'+htmlEntities(o)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).orLinkify();$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)};let afterViewFunctions=[];this.registerAfterViewLoaded=function(t){afterViewFunctions.push(t)};this.afterViewLoaded=function(t){afterViewFunctions.forEach(function(i){i(t)})}}; /* ./modules/cms-ui/themes/default/script/openrat/navigator.min.js */;Openrat.Navigator=new function(){'use strict';this.navigateTo=function(t){Openrat.Workbench.loadNewActionState(t)};this.navigateToNew=function(t){this.navigateTo(t);window.history.pushState(t,t.name,this.createShortUrl(t.action,t.id))};this.toActualHistory=function(t){window.history.replaceState(t,t.name,this.createShortUrl(t.action,t.id))};this.createShortUrl=function(t,i){return'./#/'+t+(i?'/'+i:'')}}; -/* ./modules/cms-ui/themes/default/script/openrat/common.min.js */;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');function e(){function e(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};$('div.header').dblclick(function(){e(this)})};e();window.onpopstate=function(e){Openrat.Navigator.navigateTo(e.state)};Openrat.Workbench.initialize();Openrat.Workbench.reloadAll();let registerWorkbenchGlobalEvents=function(){function e(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Openrat.Workbench.state.id+'&type='+Openrat.Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected');let $breadcrumb=$('.or-breadcrumb').empty();let items=[];$.each(output.path.concat(output.actual),function(e,t){items.push('<li class="or-breadcrumb-item clickable" tabindex="0"><a href="'+Openrat.Navigator.createShortUrl(t.action,t.id)+'" data-type="open" data-action="'+t.action+'" data-id="'+t.id+'"><i class="image-icon image-icon--action-'+t.action+'" />'+t.name+'</a></li>')});$breadcrumb.append(items.join('<li><i class="tree-icon image-icon image-icon--node-closed"></i></li>'));$('.or-breadcrumb .clickable').orLinkify()}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};e();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Openrat.Workbench.loadNewActionIntoElement(e)})};$('.or-initial-notice').each(function(){Openrat.Workbench.notify('','','info',$(this).text());$(this).remove()});registerWorkbenchGlobalEvents();Openrat.Workbench.afterViewsLoaded()});function afterViewLoaded(e){filterMenus();var n=$(e).closest('section');n.toggleClass('is-empty',$(e).is(':empty'));$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,n){$(n).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,n,a){var i=$(e).parent();$(i).find('input[type=text]').attr('value',t);$(i).find('input[type=hidden]').attr('value',a)}})});t(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){Openrat.Workbench.setUserStyle(this.value)});function a(e){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$(e).find('.toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$(e).find('.toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')})};function i(e){$(e).find('.search input').orSearch({dropdown:'#title div.search div.dropdown',select:function(e){openNewAction(e.name,e.action,e.id)}})};function o(e){$(e).find('.selector input').orSearch({dropdown:'.dropdown',select:function(t){$(e).find('.or-selector-link-value').val(t.id);$(e).find('.or-selector-link-name').val(t.name).attr('placeholder',t.name)}})};function l(e){$(e).find('.or-navtree-node').orTree()};a(e);i(e);o(e);l(e);function t(e){registerDraggable(e);registerDroppable(e)};t(e)};function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let id=dropped.data('id');let name=dropped.data('name');if(!name)name=id;$(this).find('.or-selector-link-value').val(id);$(this).find('.or-selector-link-name').val(name).attr('placeholder',name)}})};function startDialog(e,t,n,a,i){if(!t)t=$('#editor').attr('data-action');if(!a)a=$('#editor').attr('data-id');let view=new Openrat.View(t,n,a,i);view.before=function(){$('#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+n+'.png" />'+e+'</div>');$('#dialog > .view').data('id',a);$('#dialog').removeClass('is-closed').addClass('is-open');let view=this;this.escapeKeyClosingHandler=function(e){if(e.keyCode==27){view.close();$(document).off('keyup')}};$(document).keyup(this.escapeKeyClosingHandler);$('#dialog .filler').click(function(){view.close()})};view.close=function(){if($('div#dialog').hasClass('modal'))return;$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed');$(document).unbind('keyup',this.escapeKeyClosingHandler)};view.start($('div#dialog > .view'))};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,t,n){$('nav').removeClass('open');setTitle(e);Openrat.Navigator.navigateToNew({'action':t,'id':n})};function filterMenus(){let action=Openrat.Workbench.state.action;let id=Openrat.Workbench.state.id;$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+action).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-id',id)};function insert(e,t,a){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var l=document.selection.createRange(),i=l.text;l.text=t+i+a;l=document.selection.createRange();if(i.length==0){l.move('character',-a.length)} +/* ./modules/cms-ui/themes/default/script/openrat/common.min.js */;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');function e(){function e(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};$('div.header').dblclick(function(){e(this)})};e();window.onpopstate=function(e){Openrat.Navigator.navigateTo(e.state)};Openrat.Workbench.initialize();Openrat.Workbench.reloadAll();let registerWorkbenchGlobalEvents=function(){function e(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Openrat.Workbench.state.id+'&type='+Openrat.Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected');let $breadcrumb=$('.or-breadcrumb').empty();let items=[];$.each(output.path.concat(output.actual),function(e,t){items.push('<li class="or-breadcrumb-item clickable" tabindex="0"><a href="'+Openrat.Navigator.createShortUrl(t.action,t.id)+'" data-type="open" data-action="'+t.action+'" data-id="'+t.id+'"><i class="image-icon image-icon--action-'+t.action+'" />'+t.name+'</a></li>')});$breadcrumb.append(items.join('<li><i class="tree-icon image-icon image-icon--node-closed"></i></li>'));$('.or-breadcrumb .clickable').orLinkify()}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};e();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Openrat.Workbench.loadNewActionIntoElement(e)})};$('.or-initial-notice').each(function(){Openrat.Workbench.notify('','','info',$(this).text());$(this).remove()});registerWorkbenchGlobalEvents();Openrat.Workbench.afterViewsLoaded()});Openrat.Workbench.registerAfterViewLoaded(function(e){if(typeof popupWindow!='undefined')$(e).find('a[data-type=\'popup\']').each(function(){popupWindow.location.href=$(this).attr('data-url')})});Openrat.Workbench.registerAfterViewLoaded(function(e){filterMenus();var n=$(e).closest('section');n.toggleClass('is-empty',$(e).is(':empty'));$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,n){$(n).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,n,a){var i=$(e).parent();$(i).find('input[type=text]').attr('value',t);$(i).find('input[type=hidden]').attr('value',a)}})});t(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){Openrat.Workbench.setUserStyle(this.value)});function a(e){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$(e).find('.toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$(e).find('.toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')})};function i(e){$(e).find('.search input').orSearch({dropdown:'#title div.search div.dropdown',select:function(e){openNewAction(e.name,e.action,e.id)}})};function o(e){$(e).find('.selector input').orSearch({dropdown:'.dropdown',select:function(t){$(e).find('.or-selector-link-value').val(t.id);$(e).find('.or-selector-link-name').val(t.name).attr('placeholder',t.name)}})};function l(e){$(e).find('.or-navtree-node').orTree()};a(e);i(e);o(e);l(e);function t(e){registerDraggable(e);registerDroppable(e)};t(e)});function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let id=dropped.data('id');let name=dropped.data('name');if(!name)name=id;$(this).find('.or-selector-link-value').val(id);$(this).find('.or-selector-link-name').val(name).attr('placeholder',name)}})};function startDialog(e,t,n,a,i){if(!t)t=$('#editor').attr('data-action');if(!a)a=$('#editor').attr('data-id');let view=new Openrat.View(t,n,a,i);view.before=function(){$('#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+n+'.png" />'+e+'</div>');$('#dialog > .view').data('id',a);$('#dialog').removeClass('is-closed').addClass('is-open');let view=this;this.escapeKeyClosingHandler=function(e){if(e.keyCode==27){view.close();$(document).off('keyup')}};$(document).keyup(this.escapeKeyClosingHandler);$('#dialog .filler').click(function(){view.close()})};view.close=function(){if($('div#dialog').hasClass('modal'))return;$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed');$(document).unbind('keyup',this.escapeKeyClosingHandler)};view.start($('div#dialog > .view'))};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,t,n){$('nav').removeClass('open');setTitle(e);Openrat.Navigator.navigateToNew({'action':t,'id':n})};function filterMenus(){let action=Openrat.Workbench.state.action;let id=Openrat.Workbench.state.id;$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+action).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-id',id)};function insert(e,t,a){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var l=document.selection.createRange(),i=l.text;l.text=t+i+a;l=document.selection.createRange();if(i.length==0){l.move('character',-a.length)} else{l.moveStart('character',t.length+i.length+a.length)};l.select()} else if(typeof n.selectionStart!='undefined'){var r=n.selectionStart,c=n.selectionEnd,i=n.value.substring(r,c);n.value=n.value.substr(0,r)+t+i+a+n.value.substr(c);var o;if(i.length==0){o=r+t.length} else{o=r+t.length+i.length+a.length};n.selectionStart=o;n.selectionEnd=o} -else{o=n.value.length;var i=prompt('Text');n.value=n.value.substr(0,o)+t+i+a+n.value.substr(o)}};function help(e,t,n){var a=$(e).closest('div.panel').find('li.action.active').attr('data-action'),i=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+a+'/'+i+n,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function htmlEntities(e){return String(e).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;')};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};- \ No newline at end of file +else{o=n.value.length;var i=prompt('Text');n.value=n.value.substr(0,o)+t+i+a+n.value.substr(o)}};function help(e,t,n){var a=$(e).closest('div.panel').find('li.action.active').attr('data-action'),i=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+a+'/'+i+n,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function htmlEntities(e){return String(e).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;')};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})}; +/* ./modules//template-engine/components/html/editor/editor.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(e){$(e).find('textarea').orAutoheight();$(e).find('textarea.editor.code-editor').each(function(){let mode=$(this).data('mode');let mimetype=$(this).data('mimetype');if(mimetype.length>0)mode=mimetype;let textareaEl=this;let editor=CodeMirror.fromTextArea(textareaEl,{lineNumbers:!0,viewportMargin:Infinity,mode:mode});editor.on('change',function(){let newValue=editor.getValue();$(textareaEl).val(newValue)});$(editor.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let pos=editor.getCursor();editor.setSelection(pos,pos);let insertText=dropped.data('id');let toInsert=''+insertText;editor.replaceSelection(toInsert)}})});$(e).find('textarea.editor.markdown-editor').each(function(){let textarea=this;let toolbar=[{name:'bold',action:SimpleMDE.toggleBold,className:'image-icon image-icon--editor-bold',title:'Bold',},{name:'italic',action:SimpleMDE.toggleItalic,className:'image-icon image-icon--editor-italic',title:'Italic',},{name:'heading',action:SimpleMDE.toggleHeadingBigger,className:'image-icon image-icon--editor-headline',title:'Headline',},'|',{name:'quote',action:SimpleMDE.toggleBlockquote,className:'image-icon image-icon--editor-quote',title:'Quote',},{name:'code',action:SimpleMDE.toggleCodeBlock,className:'image-icon image-icon--editor-code',title:'Code',},'|',{name:'generic list',action:SimpleMDE.toggleUnorderedList,className:'image-icon image-icon--editor-unnumberedlist',title:'Unnumbered list',},{name:'numbered list',action:SimpleMDE.toggleOrderedList,className:'image-icon image-icon--editor-numberedlist',title:'Numbered list',},'|',{name:'table',action:SimpleMDE.drawTable,className:'image-icon image-icon--editor-table',title:'Table',},{name:'horizontalrule',action:SimpleMDE.drawHorizontalRule,className:'image-icon image-icon--editor-horizontalrule',title:'Horizontal rule',},'|',{name:'undo',action:SimpleMDE.undo,className:'image-icon image-icon--editor-undo',title:'Undo',},{name:'redo',action:SimpleMDE.redo,className:'image-icon image-icon--editor-redo',title:'Redo',},'|',{name:'link',action:SimpleMDE.drawLink,className:'image-icon image-icon--editor-link',title:'Link',},{name:'image',action:SimpleMDE.drawImage,className:'image-icon image-icon--editor-image',title:'Image',},'|',{name:'guide',action:'https://simplemde.com/markdown-guide',className:'image-icon image-icon--editor-help',title:'Howto markdown',},];let mde=new SimpleMDE({element:$(this)[0],toolbar:toolbar,autoDownloadFontAwesome:!1});let codemirror=mde.codemirror;$(codemirror.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let insertText='';let id=dropped.data('id');let url='__OID__'+id+'__';if(dropped.data('type')=='image')insertText='![]('+url+')';else insertText='['+id+']('+url+')';let pos=codemirror.getCursor();codemirror.setSelection(pos,pos);codemirror.replaceSelection(insertText)}});codemirror.on('change',function(){let newValue=codemirror.getValue();$(textarea).val(newValue)})});$(e).find('textarea.editor.html-editor').each(function(){let textarea=this;$.trumbowyg.svgPath='./modules/editor/trumbowyg/ui/icons.svg';$(textarea).trumbowyg();$(textarea).closest('form').find('.trumbowyg-editor').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let id=dropped.data('id');let url='./?_='+dropped.data('type')+'-'+id+'&subaction=show&embed=1&__OID__'+id+'__='+id;let insertText='';if(dropped.data('type')=='image')insertText='<img src="'+url+'" alt="" />';else insertText='<a href="'+url+'" />'+id+'</a>';$(textarea).trumbowyg('execCmd',{cmd:'insertHTML',param:insertText,forceCss:!1,})}})})}); +/* ./modules//template-engine/components/html/link/link.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(e){$(e).find('.clickable').orLinkify()}); +/* ./modules//template-engine/components/html/qrcode/qrcode.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(r){$(r).find('.or-qrcode').mouseover(function(){let r=this;if($(r).children().length>0)return;let wrapper=$('<div class="or-info-popup"></div>');$(r).append(wrapper);var e=$(r).attr('data-qrcode');$(wrapper).qrcode({render:'div',text:e,fill:'currentColor'});wrapper.attr('title','')})}); +/* ./modules//template-engine/components/html/table/table.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(t){$(t).find('table.or-table--sortable > tbody').sortable();$(t).find('table.or-table--sortable > tbody').closest('form').submit(function(){var t=[];$(this).find('table.or-table--sortable').find('tbody > tr.data').each(function(){let objectid=$(this).data('id');t.push(objectid)});$(this).find('input[name=order]').val(t.join(','))});$(t).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t).find('.or-table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.or-table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr:not(.headline)').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t).find('table > tbody > tr.headline > td, table > tbody > tr > th').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td, tr > th').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(a(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function a(t){return function(a,l){let valA=e(a,t),valB=e(l,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function e(t,e){return $(t).children('td').eq(e).text()}}); +/* ./modules//template-engine/components/html/column/column.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(e){}); +/* ./modules//template-engine/components/html/image/image.min.js */; +/* ./modules//template-engine/components/html/group/group.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(e){registerOpenClose($(e).find('fieldset.toggle-open-close'))}); +/* ./modules//template-engine/components/html/upload/upload.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(e){var o=$(e).find('form'),n=$(e).find('div.or-dropzone-upload > div.input');n.on('dragenter',function(e){e.stopPropagation();e.preventDefault();$(this).css('border','1px dotted gray')});n.on('dragover',function(e){e.stopPropagation();e.preventDefault()});n.on('drop',function(e){$(this).css('border','1px dotted red');e.preventDefault();var n=e.originalEvent.dataTransfer.files;handleFileUpload(o,n)});$(e).find('input[type=file]').change(function(){var e=$(this).prop('files');handleFileUpload(o,e)})});function handleFileUpload(e,r){for(var a=0,t;t=r[a];a++){var n=new FormData();n.append('file',t);n.append('action','folder');n.append('subaction',$(e).data('method'));n.append('output','json');n.append('token',$(e).find('input[name=token]').val());n.append('id',$(e).find('input[name=id]').val());var o=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(o);$(o).show();$.ajax({'type':'POST',url:'./api/',cache:!1,contentType:!1,processData:!1,data:n,success:function(n,r,a){$(o).remove();let oform=new Openrat.Form();oform.doResponse(n,r,e)},error:function(n,t,d){$(e).closest('div.content').removeClass('loader');$(o).remove();var a;try{var r=jQuery.parseJSON(n.responseText);a=r.error+'/'+r.description+': '+r.reason}catch(i){a=n.responseText};Openrat.Workbench.notify('Upload error',a)}})}}; +/* ./modules//template-engine/components/html/tree/tree.min.js */;Openrat.Workbench.registerAfterViewLoaded(function(e){});+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/script/openrat/common.js b/modules/cms-ui/themes/default/script/openrat/common.js @@ -145,6 +145,15 @@ $( function() { +Openrat.Workbench.registerAfterViewLoaded( function(element) { + + // Refresh already opened popup windows. + if ( typeof popupWindow != "undefined" ) + $(element).find("a[data-type='popup']").each( function() { + popupWindow.location.href = $(this).attr('data-url'); + }); + +}); /** @@ -152,8 +161,7 @@ $( function() { * * @param viewEl DOM-Element der View */ -function afterViewLoaded(viewEl ) -{ +Openrat.Workbench.registerAfterViewLoaded( function(viewEl ) { filterMenus(); // Die Section deaktivieren, wenn die View keinen Inhalt hat. @@ -163,8 +171,6 @@ function afterViewLoaded(viewEl ) //section.toggleClass('disabled',!viewHasContent); section.toggleClass('is-empty',$(viewEl).is(':empty')); - $(viewEl).trigger('orViewLoaded'); - // Untermenüpunkte aus der View in das Fenstermenü kopieren... $(viewEl).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove(); // Alte Einträge löschen @@ -300,7 +306,7 @@ function afterViewLoaded(viewEl ) registerDragAndDrop(viewEl); -} +} ); diff --git a/modules/cms-ui/themes/default/script/openrat/common.min.js b/modules/cms-ui/themes/default/script/openrat/common.min.js @@ -1,4 +1,4 @@ -;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');function e(){function e(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};$('div.header').dblclick(function(){e(this)})};e();window.onpopstate=function(e){Openrat.Navigator.navigateTo(e.state)};Openrat.Workbench.initialize();Openrat.Workbench.reloadAll();let registerWorkbenchGlobalEvents=function(){function e(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Openrat.Workbench.state.id+'&type='+Openrat.Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected');let $breadcrumb=$('.or-breadcrumb').empty();let items=[];$.each(output.path.concat(output.actual),function(e,t){items.push('<li class="or-breadcrumb-item clickable" tabindex="0"><a href="'+Openrat.Navigator.createShortUrl(t.action,t.id)+'" data-type="open" data-action="'+t.action+'" data-id="'+t.id+'"><i class="image-icon image-icon--action-'+t.action+'" />'+t.name+'</a></li>')});$breadcrumb.append(items.join('<li><i class="tree-icon image-icon image-icon--node-closed"></i></li>'));$('.or-breadcrumb .clickable').orLinkify()}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};e();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Openrat.Workbench.loadNewActionIntoElement(e)})};$('.or-initial-notice').each(function(){Openrat.Workbench.notify('','','info',$(this).text());$(this).remove()});registerWorkbenchGlobalEvents();Openrat.Workbench.afterViewsLoaded()});function afterViewLoaded(e){filterMenus();var n=$(e).closest('section');n.toggleClass('is-empty',$(e).is(':empty'));$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,n){$(n).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,n,a){var i=$(e).parent();$(i).find('input[type=text]').attr('value',t);$(i).find('input[type=hidden]').attr('value',a)}})});t(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){Openrat.Workbench.setUserStyle(this.value)});function a(e){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$(e).find('.toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$(e).find('.toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')})};function i(e){$(e).find('.search input').orSearch({dropdown:'#title div.search div.dropdown',select:function(e){openNewAction(e.name,e.action,e.id)}})};function o(e){$(e).find('.selector input').orSearch({dropdown:'.dropdown',select:function(t){$(e).find('.or-selector-link-value').val(t.id);$(e).find('.or-selector-link-name').val(t.name).attr('placeholder',t.name)}})};function l(e){$(e).find('.or-navtree-node').orTree()};a(e);i(e);o(e);l(e);function t(e){registerDraggable(e);registerDroppable(e)};t(e)};function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let id=dropped.data('id');let name=dropped.data('name');if(!name)name=id;$(this).find('.or-selector-link-value').val(id);$(this).find('.or-selector-link-name').val(name).attr('placeholder',name)}})};function startDialog(e,t,n,a,i){if(!t)t=$('#editor').attr('data-action');if(!a)a=$('#editor').attr('data-id');let view=new Openrat.View(t,n,a,i);view.before=function(){$('#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+n+'.png" />'+e+'</div>');$('#dialog > .view').data('id',a);$('#dialog').removeClass('is-closed').addClass('is-open');let view=this;this.escapeKeyClosingHandler=function(e){if(e.keyCode==27){view.close();$(document).off('keyup')}};$(document).keyup(this.escapeKeyClosingHandler);$('#dialog .filler').click(function(){view.close()})};view.close=function(){if($('div#dialog').hasClass('modal'))return;$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed');$(document).unbind('keyup',this.escapeKeyClosingHandler)};view.start($('div#dialog > .view'))};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,t,n){$('nav').removeClass('open');setTitle(e);Openrat.Navigator.navigateToNew({'action':t,'id':n})};function filterMenus(){let action=Openrat.Workbench.state.action;let id=Openrat.Workbench.state.id;$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+action).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-id',id)};function insert(e,t,a){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var l=document.selection.createRange(),i=l.text;l.text=t+i+a;l=document.selection.createRange();if(i.length==0){l.move('character',-a.length)} +;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');function e(){function e(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};$('div.header').dblclick(function(){e(this)})};e();window.onpopstate=function(e){Openrat.Navigator.navigateTo(e.state)};Openrat.Workbench.initialize();Openrat.Workbench.reloadAll();let registerWorkbenchGlobalEvents=function(){function e(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Openrat.Workbench.state.id+'&type='+Openrat.Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected');let $breadcrumb=$('.or-breadcrumb').empty();let items=[];$.each(output.path.concat(output.actual),function(e,t){items.push('<li class="or-breadcrumb-item clickable" tabindex="0"><a href="'+Openrat.Navigator.createShortUrl(t.action,t.id)+'" data-type="open" data-action="'+t.action+'" data-id="'+t.id+'"><i class="image-icon image-icon--action-'+t.action+'" />'+t.name+'</a></li>')});$breadcrumb.append(items.join('<li><i class="tree-icon image-icon image-icon--node-closed"></i></li>'));$('.or-breadcrumb .clickable').orLinkify()}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};e();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Openrat.Workbench.loadNewActionIntoElement(e)})};$('.or-initial-notice').each(function(){Openrat.Workbench.notify('','','info',$(this).text());$(this).remove()});registerWorkbenchGlobalEvents();Openrat.Workbench.afterViewsLoaded()});Openrat.Workbench.registerAfterViewLoaded(function(e){if(typeof popupWindow!='undefined')$(e).find('a[data-type=\'popup\']').each(function(){popupWindow.location.href=$(this).attr('data-url')})});Openrat.Workbench.registerAfterViewLoaded(function(e){filterMenus();var n=$(e).closest('section');n.toggleClass('is-empty',$(e).is(':empty'));$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,n){$(n).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,n,a){var i=$(e).parent();$(i).find('input[type=text]').attr('value',t);$(i).find('input[type=hidden]').attr('value',a)}})});t(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){Openrat.Workbench.setUserStyle(this.value)});function a(e){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$(e).find('.toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$(e).find('.toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')})};function i(e){$(e).find('.search input').orSearch({dropdown:'#title div.search div.dropdown',select:function(e){openNewAction(e.name,e.action,e.id)}})};function o(e){$(e).find('.selector input').orSearch({dropdown:'.dropdown',select:function(t){$(e).find('.or-selector-link-value').val(t.id);$(e).find('.or-selector-link-name').val(t.name).attr('placeholder',t.name)}})};function l(e){$(e).find('.or-navtree-node').orTree()};a(e);i(e);o(e);l(e);function t(e){registerDraggable(e);registerDroppable(e)};t(e)});function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let id=dropped.data('id');let name=dropped.data('name');if(!name)name=id;$(this).find('.or-selector-link-value').val(id);$(this).find('.or-selector-link-name').val(name).attr('placeholder',name)}})};function startDialog(e,t,n,a,i){if(!t)t=$('#editor').attr('data-action');if(!a)a=$('#editor').attr('data-id');let view=new Openrat.View(t,n,a,i);view.before=function(){$('#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+n+'.png" />'+e+'</div>');$('#dialog > .view').data('id',a);$('#dialog').removeClass('is-closed').addClass('is-open');let view=this;this.escapeKeyClosingHandler=function(e){if(e.keyCode==27){view.close();$(document).off('keyup')}};$(document).keyup(this.escapeKeyClosingHandler);$('#dialog .filler').click(function(){view.close()})};view.close=function(){if($('div#dialog').hasClass('modal'))return;$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed');$(document).unbind('keyup',this.escapeKeyClosingHandler)};view.start($('div#dialog > .view'))};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,t,n){$('nav').removeClass('open');setTitle(e);Openrat.Navigator.navigateToNew({'action':t,'id':n})};function filterMenus(){let action=Openrat.Workbench.state.action;let id=Openrat.Workbench.state.id;$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+action).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-id',id)};function insert(e,t,a){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var l=document.selection.createRange(),i=l.text;l.text=t+i+a;l=document.selection.createRange();if(i.length==0){l.move('character',-a.length)} else{l.moveStart('character',t.length+i.length+a.length)};l.select()} else if(typeof n.selectionStart!='undefined'){var r=n.selectionStart,c=n.selectionEnd,i=n.value.substring(r,c);n.value=n.value.substr(0,r)+t+i+a+n.value.substr(c);var o;if(i.length==0){o=r+t.length} else{o=r+t.length+i.length+a.length};n.selectionStart=o;n.selectionEnd=o} diff --git a/modules/cms-ui/themes/default/script/openrat/view.js b/modules/cms-ui/themes/default/script/openrat/view.js @@ -34,8 +34,7 @@ Openrat.View = function( action,method,id,params ) { function registerViewEvents(element) { - afterViewLoaded ( element ); - + Openrat.Workbench.afterViewLoaded(element); } diff --git a/modules/cms-ui/themes/default/script/openrat/view.min.js b/modules/cms-ui/themes/default/script/openrat/view.min.js @@ -1,3 +1,3 @@ -;Openrat.View=function(t,r,i,n){this.action=t;this.method=r;this.id=i;this.params=n;this.before=function(){};this.start=function(e){this.before();this.element=e;this.loadView()};this.afterLoad=function(){};this.close=function(){};function a(e){afterViewLoaded(e)};this.loadView=function(){let e=Openrat.View.createUrl(this.action,this.method,this.id,this.params);let element=this.element;let view=this;$(this.element).empty().fadeTo(1,0.7).addClass('loader').html('').load(e,function(t,i,r){$(element).fadeTo(350,1);$(element).removeClass('loader');$(element).find('form').each(function(){let form=new Openrat.Form();form.close=function(){view.close()};form.initOnElement(this)});if(i=='error'){$(element).html('');Openrat.Workbench.notify('','','error','Server Error',['Server Error while requesting url '+e,t]);return};a(element)})};Openrat.View.createUrl=function(t,subaction,i,extraid={}){var e='./';e+='?';if(t)e+='&action='+t;if(subaction)e+='&subaction='+subaction;if(i)e+='&id='+i;if(typeof extraid==='string'){extraid=extraid.replace(/'/g,'"');var o=jQuery.parseJSON(extraid);jQuery.each(o,function(t,i){e=e+'&'+t+'='+i})} +;Openrat.View=function(t,r,i,n){this.action=t;this.method=r;this.id=i;this.params=n;this.before=function(){};this.start=function(e){this.before();this.element=e;this.loadView()};this.afterLoad=function(){};this.close=function(){};function a(e){Openrat.Workbench.afterViewLoaded(e)};this.loadView=function(){let e=Openrat.View.createUrl(this.action,this.method,this.id,this.params);let element=this.element;let view=this;$(this.element).empty().fadeTo(1,0.7).addClass('loader').html('').load(e,function(t,i,r){$(element).fadeTo(350,1);$(element).removeClass('loader');$(element).find('form').each(function(){let form=new Openrat.Form();form.close=function(){view.close()};form.initOnElement(this)});if(i=='error'){$(element).html('');Openrat.Workbench.notify('','','error','Server Error',['Server Error while requesting url '+e,t]);return};a(element)})};Openrat.View.createUrl=function(t,subaction,i,extraid={}){var e='./';e+='?';if(t)e+='&action='+t;if(subaction)e+='&subaction='+subaction;if(i)e+='&id='+i;if(typeof extraid==='string'){extraid=extraid.replace(/'/g,'"');var o=jQuery.parseJSON(extraid);jQuery.each(o,function(t,i){e=e+'&'+t+'='+i})} else if(typeof extraid==='object'){jQuery.each(extraid,function(t,i){e=e+'&'+t+'='+i})} else{};return e}}; \ No newline at end of file diff --git a/modules/cms-ui/themes/default/script/openrat/workbench.js b/modules/cms-ui/themes/default/script/openrat/workbench.js @@ -314,6 +314,19 @@ Openrat.Workbench = new function() + let afterViewFunctions = []; + + this.registerAfterViewLoaded = function( f ) { + afterViewFunctions.push( f ); + } + + this.afterViewLoaded = function( element ) { + + afterViewFunctions.forEach( function( f ) { + f(element); + }); + } + } diff --git a/modules/cms-ui/themes/default/script/openrat/workbench.min.js b/modules/cms-ui/themes/default/script/openrat/workbench.min.js @@ -1,3 +1,3 @@ ;Openrat.Workbench=new function(){'use strict';this.state={};this.initialize=function(){this.initializePingTimer();this.initializeState();this.openModalDialog()};this.openModalDialog=function(){if($('#dialog').data('action')){startDialog('',$('#dialog').data('action'),$('#dialog').data('action'),0,{})}};this.initializeState=function(){let parts=window.location.hash.split('/');let state={action:'index',id:0};if(parts.length>=2)state.action=parts[1].toLowerCase();if(parts.length>=3)state.id=parts[2].replace(/[^0-9_]/gim,'');Openrat.Workbench.state=state;$('#editor').attr('data-action',state.action);$('#editor').attr('data-id',state.id);$('#editor').attr('data-extra','{}');Openrat.Navigator.toActualHistory(state)};this.initializePingTimer=function(){var t=function(){$.ajax(Openrat.View.createUrl('title','ping',0))},i=5;window.setInterval(t,i*60*1000)};this.loadNewActionState=function(t){Openrat.Workbench.state=t;Openrat.Workbench.loadNewAction(t.action,t.id,t.data);this.afterViewsLoaded()};this.loadNewAction=function(t,i,e){$('#editor').attr('data-action',t);$('#editor').attr('data-id',i);$('#editor').attr('data-extra',JSON.stringify(e));this.reloadViews()};this.afterViewsLoaded=function(){$(document).trigger('orNewAction')};this.reloadViews=function(){$('#workbench section.closed .view-loader').empty();Openrat.Workbench.loadViews($('#workbench section.open .view-loader'))};this.reloadAll=function(){$('#workbench .view').empty();Openrat.Workbench.loadViews($('#workbench .view.view-loader, #workbench .view.view-static'));this.loadUserStyle()};this.loadUserStyle=function(){let url=Openrat.View.createUrl('index','userinfo',0);$.getJSON(url,function(t){let style=t['style'];Openrat.Workbench.setUserStyle(style);let color=t['theme-color'];Openrat.Workbench.setThemeColor(color)})};this.loadViews=function(t){t.each(function(t){let $targetDOMElement=$(this);Openrat.Workbench.loadNewActionIntoElement($targetDOMElement)})};this.loadNewActionIntoElement=function(t){let action;if(t.is('.view-static'))action=t.attr('data-action');else action=$('#editor').attr('data-action');let id=$('#editor').attr('data-id');let params=$('#editor').attr('data-extra');let method=t.data('method');let view=new Openrat.View(action,method,id,params);view.start(t)};this.setUserStyle=function(t){var i=$('html'),e=i.attr('class').split(/\s+/);$.each(e,function(t,e){if(e.startsWith('theme-')){i.removeClass(e)}});i.addClass('theme-'+t.toLowerCase())};this.setThemeColor=function(t){$('#theme-color').attr('content',t)};let notifyBrowser=function(t){if(!('Notification' in window)){return} else if(Notification.permission==='granted'){let notification=new Notification(t)} -else if(Notification.permission!=='denied'){Notification.requestPermission(function(i){if(i==='granted'){let notification=new Notification(t)}})}};this.notify=function(t,e,i,o,log=[],notifyTheBrowser=!1){if(notifyTheBrowser)notifyBrowser(o);let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);let id=0;if(e)$(notice).append('<div class="name clickable"><a href="" data-type="open" data-action="'+t+'" data-id="'+id+'"><i class="or-action-full image-icon image-icon--action-'+t+'"></i> '+e+'</a></div>');$(notice).append('<div class="text">'+htmlEntities(o)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).orLinkify();$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)}};- \ No newline at end of file +else if(Notification.permission!=='denied'){Notification.requestPermission(function(i){if(i==='granted'){let notification=new Notification(t)}})}};this.notify=function(t,e,i,o,log=[],notifyTheBrowser=!1){if(notifyTheBrowser)notifyBrowser(o);let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);let id=0;if(e)$(notice).append('<div class="name clickable"><a href="" data-type="open" data-action="'+t+'" data-id="'+id+'"><i class="or-action-full image-icon image-icon--action-'+t+'"></i> '+e+'</a></div>');$(notice).append('<div class="text">'+htmlEntities(o)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).orLinkify();$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)};let afterViewFunctions=[];this.registerAfterViewLoaded=function(t){afterViewFunctions.push(t)};this.afterViewLoaded=function(t){afterViewFunctions.forEach(function(i){i(t)})}};+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.js b/modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.js @@ -80,16 +80,6 @@ jQuery.fn.orLinkify = function() }; -$(document).on('orViewLoaded',function(event, data) { - - // Refresh already opened popup windows. - if ( typeof popupWindow != "undefined" ) - $(event.target).find("a[data-type='popup']").each( function() { - popupWindow.location.href = $(this).attr('data-url'); - }); - -}); - $(document).on('orDataChanged',function(event, data) { if ( typeof popupWindow != "undefined" ) popupWindow.location.reload(); diff --git a/modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js b/modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js @@ -1 +1 @@ -;var popupWindow;jQuery.fn.orLinkify=function(){$(this).find("a").click(function(t){t.preventDefault()});return $(this).click(function(){$(this).find("a").first().each(function(){let type=$(this).attr("data-type");if($(this).parent().hasClass("inactive"))return;switch(type){case"post":$form=$("<form />").attr("method","POST").addClass("invisible");$form.data("afterSuccess",$(this).data("afterSuccess"));let params=jQuery.parseJSON($(this).attr("data-data"));params.output="json";$.each(params,function(t,a){let $input=$("<input />").attr("type","hidden").attr("name",t).attr("value",a);$form.append($input)});let form=new Openrat.Form();form.initOnElement($form);form.submit();break;case"edit":case"dialog":startDialog($(this).attr("data-name"),$(this).attr("data-action"),$(this).attr("data-method"),$(this).attr("data-id"),$(this).attr("data-extra"));break;case"external":window.open($(this).attr("data-url")," _blank");break;case"popup":popupWindow=window.open($(this).attr("data-url"),"Popup","location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes");break;case"help":help(this,$(this).attr("data-url"),$(this).attr("data-suffix"));break;case"fullscreen":fullscreen(this);break;case"open":openNewAction($(this).attr("data-name"),$(this).attr("data-action"),$(this).attr("data-id"));break;default:throw"UI error: Unknown link type: "+type+" in link "+$(this).html()}})})};$(document).on("orViewLoaded",function(t,a){if(typeof popupWindow!="undefined")$(t.target).find("a[data-type='popup']").each(function(){popupWindow.location.href=$(this).attr("data-url")})});$(document).on("orDataChanged",function(t,a){if(typeof popupWindow!="undefined")popupWindow.location.reload()});- \ No newline at end of file +;var popupWindow;jQuery.fn.orLinkify=function(){$(this).find('a').click(function(t){t.preventDefault()});return $(this).click(function(){$(this).find('a').first().each(function(){let type=$(this).attr('data-type');if($(this).parent().hasClass('inactive'))return;switch(type){case'post':$form=$('<form />').attr('method','POST').addClass('invisible');$form.data('afterSuccess',$(this).data('afterSuccess'));let params=jQuery.parseJSON($(this).attr('data-data'));params.output='json';$.each(params,function(t,a){let $input=$('<input />').attr('type','hidden').attr('name',t).attr('value',a);$form.append($input)});let form=new Openrat.Form();form.initOnElement($form);form.submit();break;case'edit':case'dialog':startDialog($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-method'),$(this).attr('data-id'),$(this).attr('data-extra'));break;case'external':window.open($(this).attr('data-url'),' _blank');break;case'popup':popupWindow=window.open($(this).attr('data-url'),'Popup','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes');break;case'help':help(this,$(this).attr('data-url'),$(this).attr('data-suffix'));break;case'fullscreen':fullscreen(this);break;case'open':openNewAction($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-id'));break;default:throw'UI error: Unknown link type: '+type+' in link '+$(this).html()}})})};$(document).on('orDataChanged',function(t,a){if(typeof popupWindow!='undefined')popupWindow.location.reload()});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/column/column.js b/modules/template-engine/components/html/column/column.js @@ -1,5 +1,6 @@ // View loaded... -$(document).on('orViewLoaded',function(event, data) { +Openrat.Workbench.registerAfterViewLoaded( function( element ) { + // Clickable Columns. // done by orLinkify-Plugin in link.js diff --git a/modules/template-engine/components/html/column/column.min.js b/modules/template-engine/components/html/column/column.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(o,n){});- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(e){});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/editor/editor.js b/modules/template-engine/components/html/editor/editor.js @@ -1,12 +1,10 @@ -$(document).on('orViewLoaded',function(event, data) { - - +Openrat.Workbench.registerAfterViewLoaded( function( element ) { - $(event.target).find('textarea').orAutoheight(); + $(element).find('textarea').orAutoheight(); // Codemirror-Editor anzeigen - $(event.target).find("textarea.editor.code-editor").each( function() { + $(element).find("textarea.editor.code-editor").each( function() { let mode = $(this).data('mode'); @@ -53,7 +51,7 @@ $(document).on('orViewLoaded',function(event, data) { } ); // Markdown-Editor anzeigen - $(event.target).find("textarea.editor.markdown-editor").each( function() { + $(element).find("textarea.editor.markdown-editor").each( function() { let textarea = this; let toolbar = [{ @@ -212,7 +210,7 @@ $(document).on('orViewLoaded',function(event, data) { } ); // HTML-Editor anzeigen - $(event.target).find("textarea.editor.html-editor").each( function() { + $(element).find("textarea.editor.html-editor").each( function() { let textarea = this; diff --git a/modules/template-engine/components/html/editor/editor.min.js b/modules/template-engine/components/html/editor/editor.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(e,t){$(e.target).find('textarea').orAutoheight();$(e.target).find('textarea.editor.code-editor').each(function(){let mode=$(this).data('mode');let mimetype=$(this).data('mimetype');if(mimetype.length>0)mode=mimetype;let textareaEl=this;let editor=CodeMirror.fromTextArea(textareaEl,{lineNumbers:!0,viewportMargin:Infinity,mode:mode});editor.on('change',function(){let newValue=editor.getValue();$(textareaEl).val(newValue)});$(editor.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(t,e){let dropped=e.draggable;let pos=editor.getCursor();editor.setSelection(pos,pos);let insertText=dropped.data('id');let toInsert=''+insertText;editor.replaceSelection(toInsert)}})});$(e.target).find('textarea.editor.markdown-editor').each(function(){let textarea=this;let toolbar=[{name:'bold',action:SimpleMDE.toggleBold,className:'image-icon image-icon--editor-bold',title:'Bold',},{name:'italic',action:SimpleMDE.toggleItalic,className:'image-icon image-icon--editor-italic',title:'Italic',},{name:'heading',action:SimpleMDE.toggleHeadingBigger,className:'image-icon image-icon--editor-headline',title:'Headline',},'|',{name:'quote',action:SimpleMDE.toggleBlockquote,className:'image-icon image-icon--editor-quote',title:'Quote',},{name:'code',action:SimpleMDE.toggleCodeBlock,className:'image-icon image-icon--editor-code',title:'Code',},'|',{name:'generic list',action:SimpleMDE.toggleUnorderedList,className:'image-icon image-icon--editor-unnumberedlist',title:'Unnumbered list',},{name:'numbered list',action:SimpleMDE.toggleOrderedList,className:'image-icon image-icon--editor-numberedlist',title:'Numbered list',},'|',{name:'table',action:SimpleMDE.drawTable,className:'image-icon image-icon--editor-table',title:'Table',},{name:'horizontalrule',action:SimpleMDE.drawHorizontalRule,className:'image-icon image-icon--editor-horizontalrule',title:'Horizontal rule',},'|',{name:'undo',action:SimpleMDE.undo,className:'image-icon image-icon--editor-undo',title:'Undo',},{name:'redo',action:SimpleMDE.redo,className:'image-icon image-icon--editor-redo',title:'Redo',},'|',{name:'link',action:SimpleMDE.drawLink,className:'image-icon image-icon--editor-link',title:'Link',},{name:'image',action:SimpleMDE.drawImage,className:'image-icon image-icon--editor-image',title:'Image',},'|',{name:'guide',action:'https://simplemde.com/markdown-guide',className:'image-icon image-icon--editor-help',title:'Howto markdown',},];let mde=new SimpleMDE({element:$(this)[0],toolbar:toolbar,autoDownloadFontAwesome:!1});let codemirror=mde.codemirror;$(codemirror.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(t,e){let dropped=e.draggable;let insertText='';let id=dropped.data('id');let url='__OID__'+id+'__';if(dropped.data('type')=='image')insertText='![]('+url+')';else insertText='['+id+']('+url+')';let pos=codemirror.getCursor();codemirror.setSelection(pos,pos);codemirror.replaceSelection(insertText)}});codemirror.on('change',function(){let newValue=codemirror.getValue();$(textarea).val(newValue)})});$(e.target).find('textarea.editor.html-editor').each(function(){let textarea=this;$.trumbowyg.svgPath='./modules/editor/trumbowyg/ui/icons.svg';$(textarea).trumbowyg();$(textarea).closest('form').find('.trumbowyg-editor').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(t,e){let dropped=e.draggable;let id=dropped.data('id');let url='./?_='+dropped.data('type')+'-'+id+'&subaction=show&embed=1&__OID__'+id+'__='+id;let insertText='';if(dropped.data('type')=='image')insertText='<img src="'+url+'" alt="" />';else insertText='<a href="'+url+'" />'+id+'</a>';$(textarea).trumbowyg('execCmd',{cmd:'insertHTML',param:insertText,forceCss:!1,})}})})});- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(e){$(e).find('textarea').orAutoheight();$(e).find('textarea.editor.code-editor').each(function(){let mode=$(this).data('mode');let mimetype=$(this).data('mimetype');if(mimetype.length>0)mode=mimetype;let textareaEl=this;let editor=CodeMirror.fromTextArea(textareaEl,{lineNumbers:!0,viewportMargin:Infinity,mode:mode});editor.on('change',function(){let newValue=editor.getValue();$(textareaEl).val(newValue)});$(editor.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let pos=editor.getCursor();editor.setSelection(pos,pos);let insertText=dropped.data('id');let toInsert=''+insertText;editor.replaceSelection(toInsert)}})});$(e).find('textarea.editor.markdown-editor').each(function(){let textarea=this;let toolbar=[{name:'bold',action:SimpleMDE.toggleBold,className:'image-icon image-icon--editor-bold',title:'Bold',},{name:'italic',action:SimpleMDE.toggleItalic,className:'image-icon image-icon--editor-italic',title:'Italic',},{name:'heading',action:SimpleMDE.toggleHeadingBigger,className:'image-icon image-icon--editor-headline',title:'Headline',},'|',{name:'quote',action:SimpleMDE.toggleBlockquote,className:'image-icon image-icon--editor-quote',title:'Quote',},{name:'code',action:SimpleMDE.toggleCodeBlock,className:'image-icon image-icon--editor-code',title:'Code',},'|',{name:'generic list',action:SimpleMDE.toggleUnorderedList,className:'image-icon image-icon--editor-unnumberedlist',title:'Unnumbered list',},{name:'numbered list',action:SimpleMDE.toggleOrderedList,className:'image-icon image-icon--editor-numberedlist',title:'Numbered list',},'|',{name:'table',action:SimpleMDE.drawTable,className:'image-icon image-icon--editor-table',title:'Table',},{name:'horizontalrule',action:SimpleMDE.drawHorizontalRule,className:'image-icon image-icon--editor-horizontalrule',title:'Horizontal rule',},'|',{name:'undo',action:SimpleMDE.undo,className:'image-icon image-icon--editor-undo',title:'Undo',},{name:'redo',action:SimpleMDE.redo,className:'image-icon image-icon--editor-redo',title:'Redo',},'|',{name:'link',action:SimpleMDE.drawLink,className:'image-icon image-icon--editor-link',title:'Link',},{name:'image',action:SimpleMDE.drawImage,className:'image-icon image-icon--editor-image',title:'Image',},'|',{name:'guide',action:'https://simplemde.com/markdown-guide',className:'image-icon image-icon--editor-help',title:'Howto markdown',},];let mde=new SimpleMDE({element:$(this)[0],toolbar:toolbar,autoDownloadFontAwesome:!1});let codemirror=mde.codemirror;$(codemirror.getWrapperElement()).droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let insertText='';let id=dropped.data('id');let url='__OID__'+id+'__';if(dropped.data('type')=='image')insertText='![]('+url+')';else insertText='['+id+']('+url+')';let pos=codemirror.getCursor();codemirror.setSelection(pos,pos);codemirror.replaceSelection(insertText)}});codemirror.on('change',function(){let newValue=codemirror.getValue();$(textarea).val(newValue)})});$(e).find('textarea.editor.html-editor').each(function(){let textarea=this;$.trumbowyg.svgPath='./modules/editor/trumbowyg/ui/icons.svg';$(textarea).trumbowyg();$(textarea).closest('form').find('.trumbowyg-editor').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;let id=dropped.data('id');let url='./?_='+dropped.data('type')+'-'+id+'&subaction=show&embed=1&__OID__'+id+'__='+id;let insertText='';if(dropped.data('type')=='image')insertText='<img src="'+url+'" alt="" />';else insertText='<a href="'+url+'" />'+id+'</a>';$(textarea).trumbowyg('execCmd',{cmd:'insertHTML',param:insertText,forceCss:!1,})}})})});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/group/group.js b/modules/template-engine/components/html/group/group.js @@ -1,4 +1,5 @@ -$(document).on('orViewLoaded',function(event, data) { +Openrat.Workbench.registerAfterViewLoaded( function( element ) { + + registerOpenClose( $(element).find('fieldset.toggle-open-close') ); - registerOpenClose( $(event.target).find('fieldset.toggle-open-close') ); }); diff --git a/modules/template-engine/components/html/group/group.min.js b/modules/template-engine/components/html/group/group.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(e,o){registerOpenClose($(e.target).find('fieldset.toggle-open-close'))});- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(e){registerOpenClose($(e).find('fieldset.toggle-open-close'))});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/link/link.js b/modules/template-engine/components/html/link/link.js @@ -1,7 +1,7 @@ -$(document).on('orViewLoaded',function(event, data) { - +Openrat.Workbench.registerAfterViewLoaded( function( element ) { + // Links aktivieren... - $(event.target).find('.clickable').orLinkify(); + $(element).find('.clickable').orLinkify(); }); diff --git a/modules/template-engine/components/html/link/link.min.js b/modules/template-engine/components/html/link/link.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(i,n){$(i.target).find('.clickable').orLinkify()});- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(e){$(e).find('.clickable').orLinkify()});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/qrcode/qrcode.js b/modules/template-engine/components/html/qrcode/qrcode.js @@ -1,8 +1,9 @@ -$(document).on('orViewLoaded',function(event, data) { +Openrat.Workbench.registerAfterViewLoaded( function( element ) { + // Show QR-Code - $(event.target).find('.or-qrcode').mouseover( function() { + $(element).find('.or-qrcode').mouseover( function() { let element = this; if ( $(element).children().length > 0 ) diff --git a/modules/template-engine/components/html/qrcode/qrcode.min.js b/modules/template-engine/components/html/qrcode/qrcode.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(e,r){$(e.target).find('.or-qrcode').mouseover(function(){let element=this;if($(element).children().length>0)return;let wrapper=$('<div class="or-info-popup"></div>');$(element).append(wrapper);var e=$(element).attr('data-qrcode');$(wrapper).qrcode({render:'div',text:e,fill:'currentColor'});wrapper.attr('title','')})});- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(r){$(r).find('.or-qrcode').mouseover(function(){let r=this;if($(r).children().length>0)return;let wrapper=$('<div class="or-info-popup"></div>');$(r).append(wrapper);var e=$(r).attr('data-qrcode');$(wrapper).qrcode({render:'div',text:e,fill:'currentColor'});wrapper.attr('title','')})});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/table/table.js b/modules/template-engine/components/html/table/table.js @@ -1,10 +1,11 @@ -$(document).on('orViewLoaded',function(event, data) { +Openrat.Workbench.registerAfterViewLoaded( function( element ) { - // Manuelles Sortieren von Tabellen per Drag and drop. - $(event.target).find('table.or-table--sortable > tbody').sortable(); + // Manuelles Sortieren von Tabellen per Drag and drop. + $(element).find('table.or-table--sortable > tbody').sortable(); - $(event.target).find('table.or-table--sortable > tbody').closest('form').submit( function() { + + $(element).find('table.or-table--sortable > tbody').closest('form').submit( function() { // Analyse the order of the objects in this folder. var order = new Array(); @@ -21,14 +22,14 @@ $(document).on('orViewLoaded',function(event, data) { // Alle Checkboxen setzen oder nicht setzen. - $(event.target).find('tr.headline > td > input.checkbox').click( function() { + $(element).find('tr.headline > td > input.checkbox').click( function() { $(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean( $(this).attr('checked') ) ); }); /** * Table-Filter. */ - $(event.target).find('.or-table-filter > input').keyup( function() { + $(element).find('.or-table-filter > input').keyup( function() { let filterExpression = $(this).val().toLowerCase(); @@ -48,7 +49,7 @@ $(document).on('orViewLoaded',function(event, data) { /** * Table-Sortierung. */ - $(event.target).find('table > tbody > tr.headline > td, table > tbody > tr > th').click( function() { + $(element).find('table > tbody > tr.headline > td, table > tbody > tr > th').click( function() { let column = $(this); let table = column.parents('table'); diff --git a/modules/template-engine/components/html/table/table.min.js b/modules/template-engine/components/html/table/table.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.or-table--sortable > tbody').sortable();$(t.target).find('table.or-table--sortable > tbody').closest('form').submit(function(){var t=[];$(this).find('table.or-table--sortable').find('tbody > tr.data').each(function(){let objectid=$(this).data('id');t.push(objectid)});$(this).find('input[name=order]').val(t.join(','))});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.or-table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.or-table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr:not(.headline)').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t.target).find('table > tbody > tr.headline > td, table > tbody > tr > th').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td, tr > th').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(l(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function l(t){return function(e,l){let valA=a(e,t),valB=a(l,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function a(t,e){return $(t).children('td').eq(e).text()}});- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(t){$(t).find('table.or-table--sortable > tbody').sortable();$(t).find('table.or-table--sortable > tbody').closest('form').submit(function(){var t=[];$(this).find('table.or-table--sortable').find('tbody > tr.data').each(function(){let objectid=$(this).data('id');t.push(objectid)});$(this).find('input[name=order]').val(t.join(','))});$(t).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t).find('.or-table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.or-table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr:not(.headline)').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t).find('table > tbody > tr.headline > td, table > tbody > tr > th').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td, tr > th').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(a(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function a(t){return function(a,l){let valA=e(a,t),valB=e(l,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function e(t,e){return $(t).children('td').eq(e).text()}});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/tree/tree.js b/modules/template-engine/components/html/tree/tree.js @@ -1,5 +1,6 @@ // View loaded... -$(document).on('orViewLoaded',function(event, data) { +Openrat.Workbench.registerAfterViewLoaded( function( element ) { + // Clickable. // done by link.js diff --git a/modules/template-engine/components/html/tree/tree.min.js b/modules/template-engine/components/html/tree/tree.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(o,n){});- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(e){});+ \ No newline at end of file diff --git a/modules/template-engine/components/html/upload/upload.js b/modules/template-engine/components/html/upload/upload.js @@ -1,9 +1,10 @@ -$(document).on('orViewLoaded',function(event, data) { - - var form = $(event.target).find('form'); +Openrat.Workbench.registerAfterViewLoaded( function( element ) { + + + var form = $(element).find('form'); // Dateiupload über Drag and Drop - var dropzone = $(event.target).find('div.or-dropzone-upload > div.input'); + var dropzone = $(element).find('div.or-dropzone-upload > div.input'); dropzone.on('dragenter', function (e) { e.stopPropagation(); @@ -27,7 +28,7 @@ $(document).on('orViewLoaded',function(event, data) { // Dateiupload über File-Input-Button - $(event.target).find('input[type=file]').change( function() { + $(element).find('input[type=file]').change( function() { var files = $(this).prop('files'); diff --git a/modules/template-engine/components/html/upload/upload.min.js b/modules/template-engine/components/html/upload/upload.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(e,o){var a=$(e.target).find('form'),n=$(e.target).find('div.or-dropzone-upload > div.input');n.on('dragenter',function(e){e.stopPropagation();e.preventDefault();$(this).css('border','1px dotted gray')});n.on('dragover',function(e){e.stopPropagation();e.preventDefault()});n.on('drop',function(e){$(this).css('border','1px dotted red');e.preventDefault();var o=e.originalEvent.dataTransfer.files;handleFileUpload(a,o)});$(e.target).find('input[type=file]').change(function(){var e=$(this).prop('files');handleFileUpload(a,e)})});function handleFileUpload(e,n){for(var t=0,r;r=n[t];t++){var o=new FormData();o.append('file',r);o.append('action','folder');o.append('subaction',$(e).data('method'));o.append('output','json');o.append('token',$(e).find('input[name=token]').val());o.append('id',$(e).find('input[name=id]').val());var a=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(a);$(a).show();$.ajax({'type':'POST',url:'./api/',cache:!1,contentType:!1,processData:!1,data:o,success:function(o,n,t){$(a).remove();let oform=new Openrat.Form();oform.doResponse(o,n,e)},error:function(o,n,d){$(e).closest('div.content').removeClass('loader');$(a).remove();var r;try{var t=jQuery.parseJSON(o.responseText);r=t.error+'/'+t.description+': '+t.reason}catch(i){r=o.responseText};Openrat.Workbench.notify('Upload error',r)}})}};- \ No newline at end of file +;Openrat.Workbench.registerAfterViewLoaded(function(e){var o=$(e).find('form'),n=$(e).find('div.or-dropzone-upload > div.input');n.on('dragenter',function(e){e.stopPropagation();e.preventDefault();$(this).css('border','1px dotted gray')});n.on('dragover',function(e){e.stopPropagation();e.preventDefault()});n.on('drop',function(e){$(this).css('border','1px dotted red');e.preventDefault();var n=e.originalEvent.dataTransfer.files;handleFileUpload(o,n)});$(e).find('input[type=file]').change(function(){var e=$(this).prop('files');handleFileUpload(o,e)})});function handleFileUpload(e,r){for(var a=0,t;t=r[a];a++){var n=new FormData();n.append('file',t);n.append('action','folder');n.append('subaction',$(e).data('method'));n.append('output','json');n.append('token',$(e).find('input[name=token]').val());n.append('id',$(e).find('input[name=id]').val());var o=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(o);$(o).show();$.ajax({'type':'POST',url:'./api/',cache:!1,contentType:!1,processData:!1,data:n,success:function(n,r,a){$(o).remove();let oform=new Openrat.Form();oform.doResponse(n,r,e)},error:function(n,t,d){$(e).closest('div.content').removeClass('loader');$(o).remove();var a;try{var r=jQuery.parseJSON(n.responseText);a=r.error+'/'+r.description+': '+r.reason}catch(i){a=n.responseText};Openrat.Workbench.notify('Upload error',a)}})}};+ \ No newline at end of file diff --git a/modules/template-engine/components/html/window/Window.class.php b/modules/template-engine/components/html/window/Window.class.php @@ -7,4 +7,3 @@ class WindowComponent extends Component } -?>- \ No newline at end of file