openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit bd22152bda94fc1791b7c103a854fda85448cb50
parent cbe59851971db6a46044c341b36012f5a0bfc443
Author: Jan Dankert <devnull@localhost>
Date:   Tue, 14 Aug 2018 00:00:06 +0200

Für Seiten kann der Quelltext angezeigt werden. Fix für Dialoge: Aufruf mit den richtigen Parametern.

Diffstat:
modules/cms-core/action/PageAction.class.php | 11+++++------
modules/cms-ui/action/IndexAction.class.php | 4++++
modules/cms-ui/themes/default/html/views/configuration/src.php | 2+-
modules/cms-ui/themes/default/html/views/configuration/src.tpl.src.xml | 4++--
modules/cms-ui/themes/default/html/views/page/src.php | 4++++
modules/cms-ui/themes/default/html/views/page/src.tpl.src.xml | 14++------------
modules/cms-ui/themes/default/script/openrat.js | 15++++++++++-----
modules/cms-ui/themes/default/script/openrat.min.js | 6+++---
modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.js | 8+++++---
modules/cms-ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js | 6+++---
modules/template-engine/components/html/editor/Editor.class.php | 18++++++++++--------
modules/template-engine/components/html/editor/editor.js | 63++++++---------------------------------------------------------
modules/template-engine/components/html/editor/editor.min.js | 4++--
13 files changed, 57 insertions(+), 102 deletions(-)

diff --git a/modules/cms-core/action/PageAction.class.php b/modules/cms-core/action/PageAction.class.php @@ -678,15 +678,14 @@ class PageAction extends ObjectAction * * Alle HTML-Sonderzeichen werden maskiert */ - function src() + function srcView() { - $this->page->languageid = $this->getRequestId(REQ_PARAM_LANGUAGE_ID ); - $this->page->modelid = $this->getRequestId(REQ_PARAM_MODEL_ID ); + $project = new Project( $this->page->projectid ); - $this->page->withLanguage = config('publish','filename_language') == 'always' || count(Language::count()) > 1; - $this->page->withModel = config('publish','filename_type' ) == 'always' || count(Model::count() ) > 1; + $this->page->withLanguage = config('publish','filename_language') == 'always' || count($project->getLanguageIds()) > 1; + $this->page->withModel = config('publish','filename_type' ) == 'always' || count($project->getModelIds() ) > 1; - $this->page->public = true; + $this->page->public = true; // $this->page->load(); $src = $this->page->generate(); diff --git a/modules/cms-ui/action/IndexAction.class.php b/modules/cms-ui/action/IndexAction.class.php @@ -75,6 +75,10 @@ class IndexAction extends Action $user = Session::getUser(); + // Gewünschten Dialog direkt öffnen. + if($this->hasRequestVar('dialogMethod') ) + $this->setTemplateVar(array('dialogAction'=>$this->actionName,'dialogMethod'=>$this->getRequestVar('dialogMethod'))); + // Is a user logged in? if ( !is_object($user) ) { diff --git a/modules/cms-ui/themes/default/html/views/configuration/src.php b/modules/cms-ui/themes/default/html/views/configuration/src.php @@ -1,3 +1,3 @@ - <textarea name="source" class="editor__text-editor"><?php echo ${'source'} ?></textarea> + <textarea name="source" data-extension="" data-mimetype="" data-mode="yaml" class="editor code-editor"><?php echo ${'source'} ?></textarea> \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/configuration/src.tpl.src.xml b/modules/cms-ui/themes/default/html/views/configuration/src.tpl.src.xml @@ -1 +1 @@ -<editor type="raw" name="source" />- \ No newline at end of file +<editor type="code" mode="yaml" name="source" />+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/page/src.php b/modules/cms-ui/themes/default/html/views/page/src.php @@ -0,0 +1,3 @@ + + <textarea name="src" data-extension="" data-mimetype="" data-mode="html" class="editor code-editor"><?php echo ${'src'} ?></textarea> + + \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/page/src.tpl.src.xml b/modules/cms-ui/themes/default/html/views/page/src.tpl.src.xml @@ -1,11 +1 @@ -<output xmlns="http://www.openrat.de/template" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.openrat.de/template ../template.xsd"> - <hidden name="templateid" /> - <hidden name="modelid" /> - <row> - <column> - <text var="src" escape="false" type="preformatted"></text> - </column> - </row> -</output>- \ No newline at end of file +<editor type="code" mode="html" name="src" />+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/script/openrat.js b/modules/cms-ui/themes/default/script/openrat.js @@ -18,9 +18,6 @@ $( function() registerHeaderEvents(); registerWorkbenchEvents(); - var action = $('#editor').data('action'); - filterMenus(action); - $('.view').each( function(index) { registerViewEvents(this); @@ -76,6 +73,8 @@ function initActualHistoryState() { }; Navigator.toActualHistory( state ); + + filterMenus(state.action,state.id,state.data); } } @@ -180,7 +179,7 @@ var Workbench = new function() Workbench.loadViewIntoElement(targetDOMElement,action,method,id,params) }); - filterMenus(action); + filterMenus(action, id, params); } @@ -508,11 +507,17 @@ function openNewAction( name,action,id,extraId ) } -function filterMenus(action) +function filterMenus(action,id,params) { $('div.clickable').addClass('active'); $('div.clickable.filtered').removeClass('active').addClass('inactive'); $('div.clickable.filtered.on-action-'+action).addClass('active').removeClass('inactive'); + + // Jeder Menüeintrag bekommt die Id und Parameter. + $('div.clickable.filtered a').attr('data-action',action); + $('div.clickable.filtered a').attr('data-id' ,id ); + $('div.clickable.filtered a').attr('data-extra' ,JSON.stringify(params) ); + } diff --git a/modules/cms-ui/themes/default/script/openrat.min.js b/modules/cms-ui/themes/default/script/openrat.min.js @@ -1,9 +1,9 @@ -;var DEFAULT_CONTENT_ACTION='edit',OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();var t=$('#editor').data('action');filterMenus(t);$('.view').each(function(t){registerViewEvents(this)});window.onpopstate=function(t){Navigator.navigateTo(t.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(t){if(t.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}})});function initActualHistoryState(){var e={};e.name=window.document.title;var t=new URLSearchParams(window.location.search);if(t.has('action')){e.action=t.get('action');e.id=t.get('id');e.name=window.document.title;e.data={};var t=Array.from(t.entries());for(var i in t){e.data[t[i][0]]=t[i][1]};Navigator.toActualHistory(e)}};var Navigator=new function(){'use strict';this.navigateTo=function(t){Workbench.loadNewActionState(t)};this.navigateToNew=function(t){Workbench.loadNewActionState(t);window.history.pushState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))};this.navigateToNewAction=function(t,e,i,a){var n={action:t,method:e,id:i,data:a};this.navigateToNew(n)};this.toActualHistory=function(t){window.history.replaceState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var t=function(){$.ajax(createUrl('title','ping',0))},e=5;window.setInterval(t,e*60*1000)};this.loadNewActionState=function(t){Workbench.loadNewAction(t.action,t.id,t.data)};this.loadNewAction=function(t,e,i){$('#editor').attr('data-action',t);$('#editor').attr('data-id',e);$('#workbench .view-loader').each(function(a){var n=$(this),o=n.data('method');Workbench.loadViewIntoElement(n,t,o,e,i)});filterMenus(t)};this.loadViewIntoElement=function(t,e,i,a,n){var o=createUrl(e,i,a,n,!0);t.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(e,i,a){t.fadeTo(350,1);$(t).removeClass('loader');if(i=='error'){$(t).html('');notify('error',e);return};registerViewEvents(t)})}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)});$('div#filler').click(function(){if($('div#dialog').hasClass('modal')){} -else{$('div#dialog').removeClass('is-open').addClass('is-closed');$('div#dialog > .view').html('')}})};function loadView(t,e,i,a,n){Navigator.navigateToNewAction(e,i,a,n)};function registerViewEvents(t){$(t).trigger('orViewLoaded');$(t).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(t).find('div.headermenu > a').each(function(t,e){});$(t).find('div.header > a.back').each(function(e,i){$(i).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(t).closest('div.panel').find('div.header div.dropdown').first())});$(t).find('div.selector.tree').each(function(){var t=this;$(this).orTree({type:'project',selectable:$(t).attr('data-types').split(','),id:$(t).attr('data-init-folderid'),onSelect:function(e,i,a){var n=$(t).parent();$(n).find('input[type=text]').attr('value',e);$(n).find('input[type=hidden]').attr('value',a)}})});$('div.content li.object').draggable({cursor:'move',revert:'invalid'});$('div.content li.object > .entry[data-type=\'folder\']').droppable({accept:'li.object',hoverClass:'drophover',activeClass:'dropactive',drop:function(t,e){var i=e.draggable,a=$(this).parent();startDialog($(this).text(),$(i).attr('data-type'),'copy',$(a).attr('data-id'),{'action':$(i).attr('data-type'),'subaction':'copy','id':$(i).attr('data-id'),'targetFolderId':$(a).attr('data-id')});$(i).detach().css({top:0,left:0}).appendTo(a).click()}});$(t).find('input').change(function(){$('#editor').find('header').addClass('dirty')})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#title .toolbar-icon.menu').click(function(t){t.stopPropagation();$(this).parent().toggleClass('open')});$('#title .toolbar-icon.menu').mouseover(function(){$(this).parent().find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#title div.search input').blur(function(){$('div.search input div.dropdown').fadeOut()});$('#title div.search input').orSearch({dropdown:'#title div.search div.dropdown'})};function fullscreen(t){$(t).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('#navigation').html('&nbsp;');$('#navigation').orTree({type:'root',id:0,onSelect:function(t,e,i,a){openNewAction(t,e,i,a)}});$('#navigation > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click();$('#navigation > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click()};function submitUrl(t,e){postUrl(e,t)};function postUrl(t,e){t+='&output=json';$.ajax({'type':'POST',url:t,data:{},success:function(t,i,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(t,i,e)}})};function startDialog(t,e,i,a,n){if(!e)e=$('#editor').attr('data-action');a=$('#editor').attr('data-id');$('div#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+i+'.png" />'+t+'</div>');$('div#dialog > .view').data('id',a);$('div#dialog').removeClass('is-closed').addClass('is-open');Workbench.loadViewIntoElement($('div#dialog > .view'),e,i,a,n)};function modalView(t,e){var i=$(t).closest('div.panel').find('li.active').attr('data-action'),a=$(t).closest('div.panel').find('li.active').attr('data-method'),n=$(t).closest('div.panel').find('li.active').attr('data-id');$(t).closest('div.content').modal({'overlayClose':'true','xxxonClose':function(){alert('close)')}});loadView($(t).closest('div.content'),i,a,n)};function setTitle(t){if(t)$('head > title').text(t+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(t,e,i,a){setTitle(t);setNewAction(e,i,a)};function filterMenus(t){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+t).addClass('active').removeClass('inactive')};function setNewAction(t,e,i){Navigator.navigateToNewAction(t,'edit',e,i)};function setNewId(t){};function notifyBrowser(t){if(!('Notification' in window)){return} +;var DEFAULT_CONTENT_ACTION='edit',OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(t){registerViewEvents(this)});window.onpopstate=function(t){Navigator.navigateTo(t.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(t){if(t.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}})});function initActualHistoryState(){var t={};t.name=window.document.title;var e=new URLSearchParams(window.location.search);if(e.has('action')){t.action=e.get('action');t.id=e.get('id');t.name=window.document.title;t.data={};var e=Array.from(e.entries());for(var i in e){t.data[e[i][0]]=e[i][1]};Navigator.toActualHistory(t);filterMenus(t.action,t.id,t.data)}};var Navigator=new function(){'use strict';this.navigateTo=function(t){Workbench.loadNewActionState(t)};this.navigateToNew=function(t){Workbench.loadNewActionState(t);window.history.pushState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))};this.navigateToNewAction=function(t,e,i,a){var n={action:t,method:e,id:i,data:a};this.navigateToNew(n)};this.toActualHistory=function(t){window.history.replaceState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var t=function(){$.ajax(createUrl('title','ping',0))},e=5;window.setInterval(t,e*60*1000)};this.loadNewActionState=function(t){Workbench.loadNewAction(t.action,t.id,t.data)};this.loadNewAction=function(t,e,i){$('#editor').attr('data-action',t);$('#editor').attr('data-id',e);$('#workbench .view-loader').each(function(a){var n=$(this),o=n.data('method');Workbench.loadViewIntoElement(n,t,o,e,i)});filterMenus(t,e,i)};this.loadViewIntoElement=function(t,e,i,a,n){var o=createUrl(e,i,a,n,!0);t.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(e,i,a){t.fadeTo(350,1);$(t).removeClass('loader');if(i=='error'){$(t).html('');notify('error',e);return};registerViewEvents(t)})}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)});$('div#filler').click(function(){if($('div#dialog').hasClass('modal')){} +else{$('div#dialog').removeClass('is-open').addClass('is-closed');$('div#dialog > .view').html('')}})};function loadView(t,e,i,a,n){Navigator.navigateToNewAction(e,i,a,n)};function registerViewEvents(t){$(t).trigger('orViewLoaded');$(t).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(t).find('div.headermenu > a').each(function(t,e){});$(t).find('div.header > a.back').each(function(e,i){$(i).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(t).closest('div.panel').find('div.header div.dropdown').first())});$(t).find('div.selector.tree').each(function(){var t=this;$(this).orTree({type:'project',selectable:$(t).attr('data-types').split(','),id:$(t).attr('data-init-folderid'),onSelect:function(e,i,a){var n=$(t).parent();$(n).find('input[type=text]').attr('value',e);$(n).find('input[type=hidden]').attr('value',a)}})});$('div.content li.object').draggable({cursor:'move',revert:'invalid'});$('div.content li.object > .entry[data-type=\'folder\']').droppable({accept:'li.object',hoverClass:'drophover',activeClass:'dropactive',drop:function(t,e){var i=e.draggable,a=$(this).parent();startDialog($(this).text(),$(i).attr('data-type'),'copy',$(a).attr('data-id'),{'action':$(i).attr('data-type'),'subaction':'copy','id':$(i).attr('data-id'),'targetFolderId':$(a).attr('data-id')});$(i).detach().css({top:0,left:0}).appendTo(a).click()}});$(t).find('input').change(function(){$('#editor').find('header').addClass('dirty')})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#title .toolbar-icon.menu').click(function(t){t.stopPropagation();$(this).parent().toggleClass('open')});$('#title .toolbar-icon.menu').mouseover(function(){$(this).parent().find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#title div.search input').blur(function(){$('div.search input div.dropdown').fadeOut()});$('#title div.search input').orSearch({dropdown:'#title div.search div.dropdown'})};function fullscreen(t){$(t).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('#navigation').html('&nbsp;');$('#navigation').orTree({type:'root',id:0,onSelect:function(t,e,i,a){openNewAction(t,e,i,a)}});$('#navigation > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click();$('#navigation > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click()};function submitUrl(t,e){postUrl(e,t)};function postUrl(t,e){t+='&output=json';$.ajax({'type':'POST',url:t,data:{},success:function(t,i,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(t,i,e)}})};function startDialog(t,e,i,a,n){if(!e)e=$('#editor').attr('data-action');a=$('#editor').attr('data-id');$('div#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+i+'.png" />'+t+'</div>');$('div#dialog > .view').data('id',a);$('div#dialog').removeClass('is-closed').addClass('is-open');Workbench.loadViewIntoElement($('div#dialog > .view'),e,i,a,n)};function modalView(t,e){var i=$(t).closest('div.panel').find('li.active').attr('data-action'),a=$(t).closest('div.panel').find('li.active').attr('data-method'),n=$(t).closest('div.panel').find('li.active').attr('data-id');$(t).closest('div.content').modal({'overlayClose':'true','xxxonClose':function(){alert('close)')}});loadView($(t).closest('div.content'),i,a,n)};function setTitle(t){if(t)$('head > title').text(t+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(t,e,i,a){setTitle(t);setNewAction(e,i,a)};function filterMenus(t,e,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+t).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',t);$('div.clickable.filtered a').attr('data-id',e);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(t,e,i){Navigator.navigateToNewAction(t,'edit',e,i)};function setNewId(t){};function notifyBrowser(t){if(!('Notification' in window)){return} else if(Notification.permission==='granted'){var e=new Notification(t)} else if(Notification.permission!=='denied'){Notification.requestPermission(function(e){if(e==='granted'){var i=new Notification(t)}})}};function setUserStyle(t){var e=$('html'),i=e.attr('class').split(/\s+/);$.each(i,function(t,i){if(i.startsWith('theme-')){e.removeClass(i)}});e.addClass('theme-'+t.toLowerCase())};function insert(t,e,i){var a=document.forms[0].elements[t];a.focus();if(typeof document.selection!='undefined'){var r=document.selection.createRange(),n=r.text;r.text=e+n+i;r=document.selection.createRange();if(n.length==0){r.move('character',-i.length)} else{r.moveStart('character',e.length+n.length+i.length)};r.select()} -else if(typeof a.selectionStart!='undefined'){var d=a.selectionStart,s=a.selectionEnd,n=a.value.substring(d,s);a.value=a.value.substr(0,d)+e+n+i+a.value.substr(s);var o;if(n.length==0){o=d+e.length} +else if(typeof a.selectionStart!='undefined'){var d=a.selectionStart,c=a.selectionEnd,n=a.value.substring(d,c);a.value=a.value.substr(0,d)+e+n+i+a.value.substr(c);var o;if(n.length==0){o=d+e.length} else{o=d+e.length+n.length+i.length};a.selectionStart=o;a.selectionEnd=o} else{o=a.value.length;var n=prompt('Text');a.value=a.value.substr(0,o)+e+n+i+a.value.substr(o)}};function createUrl(t,e,i,a,o){var n='./';n+='?action='+t;if(e!=null)n+='&subaction='+e;n+='&id='+i;if(o)n+='&embed=1';if(typeof a==='string'){a=a.replace(/'/g,'"');jQuery.each(jQuery.parseJSON(a),function(t,e){if(t=='action'||t=='subaction'||t=='id')return;n=n+'&'+t+'='+e})} else if(typeof a==='object'){jQuery.each(a,function(t,e){if(t=='action'||t=='subaction'||t=='id')return;n=n+'&'+t+'='+e})} 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 @@ -23,17 +23,19 @@ jQuery.fn.orLinkify = function() { //startView(this, $(this).attr('data-method') ); // gibt es so nicht mehr, kann wohl raus. - ; + alert('Error: Link type = view not supported.'); } else if ( type == 'modal' ) { - startDialog($(this).attr('data-name'),null,$(this).attr('data-method') ); + alert('Error: Link type = modal not supported.'); + + startDialog($(this).attr('data-name'),null,$(this).attr('data-method') ); } else if ( type == 'dialog' ) { - startDialog($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-method') ); + startDialog($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-method'),$(this).attr('data-id'),$(this).attr('data-extra') ); } else if ( type == 'url' ) 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,7 +1,7 @@ ;jQuery.fn.orLinkify=function(){return $(this).click(function(){$(this).find('a').first().each(function(){var t=$(this).attr('data-type');if($(this).parent().hasClass('inactive'))return;if(t=='post'){submitLink(this,$(this).attr('data-data'))} -else if(t=='view'){} -else if(t=='modal'){startDialog($(this).attr('data-name'),null,$(this).attr('data-method'))} -else if(t=='dialog'){startDialog($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-method'))} +else if(t=='view'){alert('Error: Link type = view not supported.')} +else if(t=='modal'){alert('Error: Link type = modal not supported.');startDialog($(this).attr('data-name'),null,$(this).attr('data-method'))} +else if(t=='dialog'){startDialog($(this).attr('data-name'),$(this).attr('data-action'),$(this).attr('data-method'),$(this).attr('data-id'),$(this).attr('data-extra'))} else if(t=='url'){submitUrl(this,$(this).attr('data-url'))} else if(t=='external'){window.open($(this).attr('data-url'),' _blank')} else if(t=='popup'){window.open($(this).attr('data-url'),'Popup','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')} diff --git a/modules/template-engine/components/html/editor/Editor.class.php b/modules/template-engine/components/html/editor/Editor.class.php @@ -14,27 +14,29 @@ class EditorComponent extends Component { switch( $this->type ) { - case 'fckeditor': case 'html': - echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor__html-editor" id="pageelement_edit_editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor html-editor" id="pageelement_edit_editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; break; case 'wiki': - echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor__wiki-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor wiki-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; break; case 'text': case 'raw': - echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor__text-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor text-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; break; - case 'ace': - case 'code': - echo '<textarea name="'.$this->htmlvalue($this->name).'" data-extension="'.$this->htmlvalue($this->extension).'" data-mimetype="'.$this->htmlvalue($this->mimetype).'" data-mode="'.$this->htmlvalue($this->mode).'" class="editor__code-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + case 'markdown': + echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor markdown-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; break; - + case 'code': + echo '<textarea name="'.$this->htmlvalue($this->name).'" data-extension="'.$this->htmlvalue($this->extension).'" data-mimetype="'.$this->htmlvalue($this->mimetype).'" data-mode="'.$this->htmlvalue($this->mode).'" class="editor code-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + break; + + case 'dom': case 'tree': echo '<?php '; diff --git a/modules/template-engine/components/html/editor/editor.js b/modules/template-engine/components/html/editor/editor.js @@ -1,64 +1,12 @@ $(document).on('orViewLoaded',function(event, data) { - if ( $(event.target).find('textarea#pageelement_edit_editor').length > 0 ) - { - var instance = CKEDITOR.instances['pageelement_edit_editor']; - if(instance) - { - CKEDITOR.remove(instance); - } - CKEDITOR.replace( 'pageelement_edit_editor',{customConfig:'config-openrat.js'} ); - } - - // Wiki-Editor - var markitupSettings = { markupSet: [ - {name:'Bold', key:'B', openWith:'*', closeWith:'*' }, - {name:'Italic', key:'I', openWith:'_', closeWith:'_' }, - {name:'Stroke through', key:'S', openWith:'--', closeWith:'--' }, - {separator:'-----------------' }, - {name:'Bulleted List', openWith:'*', closeWith:'', multiline:true, openBlockWith:'\n', closeBlockWith:'\n'}, - {name:'Numeric List', openWith:'#', closeWith:'', multiline:true, openBlockWith:'\n', closeBlockWith:'\n'}, - {separator:'---------------' }, - {name:'Picture', key:'P', replaceWith:'{[![Source:!:http://]!]" alt="[![Alternative text]!]" }' }, - {name:'Link', key:'L', openWith:'""->"[![Link:!:http://]!]"', closeWith:'"', placeHolder:'Your text to link...' }, - {separator:'---------------' }, - {name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }, - {name:'Preview', className:'preview', call:'preview'} - ]}; - //$(event.target).find('.wikieditor').markItUp(markitupSettings); - - // HTML-Editor - var wymSettings = {lang: 'de',basePath: 'modules/cms-ui/editor/wymeditor/wymeditor/', - toolsItems: [ - {'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}, - {'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}, - {'name': 'Superscript', 'title': 'Superscript', 'css': 'wym_tools_superscript'}, - {'name': 'Subscript', 'title': 'Subscript', 'css': 'wym_tools_subscript'}, - {'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'}, - {'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'}, - {'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}, - {'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}, - {'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'}, - {'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}, - {'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'}, - {'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'}, - {'name': 'InsertImage', 'title': 'Image', 'css': 'wym_tools_image'}, - {'name': 'InsertTable', 'title': 'Table', 'css': 'wym_tools_table'}, - {'name': 'Paste', 'title': 'Paste_From_Word', 'css': 'wym_tools_paste'}, - {'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'}, - {'name': 'Preview', 'title': 'Preview', 'css': 'wym_tools_preview'} - ] - }; - - + + $(event.target).find('textarea').orAutoheight(); - - - // ACE-Editor anzeigen - $(event.target).find("textarea.editor__ace-editor").each( function() { + $(event.target).find("textarea.editor.ace-editor").each( function() { var textareaEl = $(this); var aceEl = $("<div class=\"editor__code-editor\" />").insertAfter(textareaEl); var editor = ace.edit( aceEl.get(0) ); @@ -82,9 +30,10 @@ $(document).on('orViewLoaded',function(event, data) { textareaEl.val( editor.getSession().getValue() ); }) } ); - + + // Codemirror-Editor anzeigen - $(event.target).find("textarea.editor__code-editor").each( function() { + $(event.target).find("textarea.editor.code-editor").each( function() { var mode = $(this).data('mode'); 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,i){if($(e.target).find('textarea#pageelement_edit_editor').length>0){var t=CKEDITOR.instances['pageelement_edit_editor'];if(t){CKEDITOR.remove(t)};CKEDITOR.replace('pageelement_edit_editor',{customConfig:'config-openrat.js'})};var o={markupSet:[{name:'Bold',key:'B',openWith:'*',closeWith:'*'},{name:'Italic',key:'I',openWith:'_',closeWith:'_'},{name:'Stroke through',key:'S',openWith:'--',closeWith:'--'},{separator:'-----------------'},{name:'Bulleted List',openWith:'*',closeWith:'',multiline:!0,openBlockWith:'\n',closeBlockWith:'\n'},{name:'Numeric List',openWith:'#',closeWith:'',multiline:!0,openBlockWith:'\n',closeBlockWith:'\n'},{separator:'---------------'},{name:'Picture',key:'P',replaceWith:'{[![Source:!:http://]!]" alt="[![Alternative text]!]" }'},{name:'Link',key:'L',openWith:'""->"[![Link:!:http://]!]"',closeWith:'"',placeHolder:'Your text to link...'},{separator:'---------------'},{name:'Clean',className:'clean',replaceWith:function(e){return e.selection.replace(/<(.*?)>/g,'')}},{name:'Preview',className:'preview',call:'preview'}]};var s={lang:'de',basePath:'modules/cms-ui/editor/wymeditor/wymeditor/',toolsItems:[{'name':'Bold','title':'Strong','css':'wym_tools_strong'},{'name':'Italic','title':'Emphasis','css':'wym_tools_emphasis'},{'name':'Superscript','title':'Superscript','css':'wym_tools_superscript'},{'name':'Subscript','title':'Subscript','css':'wym_tools_subscript'},{'name':'InsertOrderedList','title':'Ordered_List','css':'wym_tools_ordered_list'},{'name':'InsertUnorderedList','title':'Unordered_List','css':'wym_tools_unordered_list'},{'name':'Indent','title':'Indent','css':'wym_tools_indent'},{'name':'Outdent','title':'Outdent','css':'wym_tools_outdent'},{'name':'Undo','title':'Undo','css':'wym_tools_undo'},{'name':'Redo','title':'Redo','css':'wym_tools_redo'},{'name':'CreateLink','title':'Link','css':'wym_tools_link'},{'name':'Unlink','title':'Unlink','css':'wym_tools_unlink'},{'name':'InsertImage','title':'Image','css':'wym_tools_image'},{'name':'InsertTable','title':'Table','css':'wym_tools_table'},{'name':'Paste','title':'Paste_From_Word','css':'wym_tools_paste'},{'name':'ToggleHtml','title':'HTML','css':'wym_tools_html'},{'name':'Preview','title':'Preview','css':'wym_tools_preview'}]};$(e.target).find('textarea').orAutoheight();$(e.target).find('textarea.editor__ace-editor').each(function(){var t=$(this),i=$('<div class="editor__code-editor" />').insertAfter(t),e=ace.edit(i.get(0)),s=t.data('mode');e.renderer.setShowGutter(!0);e.setTheme('ace/theme/github');e.getSession().setTabSize(4);e.getSession().setUseWrapMode(!0);e.setHighlightActiveLine(!0);e.getSession().setValue(t.val());e.getSession().setMode('ace/mode/'+s);e.getSession().on('change',function(i){t.val(e.getSession().getValue())});t.closest('form').submit(function(){t.val(e.getSession().getValue())})});$(e.target).find('textarea.editor__code-editor').each(function(){var t=$(this).data('mode'),i=$(this).data('mimetype');if(i.length>0)t=i;var s=CodeMirror.fromTextArea(this,{lineNumbers:!0,viewportMargin:Infinity,mode:t});var e=this;$(e).closest('form').submit(function(){var t=s.getValue();$(e).val(t)})})});- \ No newline at end of file +;$(document).on('orViewLoaded',function(e,t){$(e.target).find('textarea').orAutoheight();$(e.target).find('textarea.editor.ace-editor').each(function(){var t=$(this),i=$('<div class="editor__code-editor" />').insertAfter(t),e=ace.edit(i.get(0)),o=t.data('mode');e.renderer.setShowGutter(!0);e.setTheme('ace/theme/github');e.getSession().setTabSize(4);e.getSession().setUseWrapMode(!0);e.setHighlightActiveLine(!0);e.getSession().setValue(t.val());e.getSession().setMode('ace/mode/'+o);e.getSession().on('change',function(i){t.val(e.getSession().getValue())});t.closest('form').submit(function(){t.val(e.getSession().getValue())})});$(e.target).find('textarea.editor.code-editor').each(function(){var t=$(this).data('mode'),i=$(this).data('mimetype');if(i.length>0)t=i;var o=CodeMirror.fromTextArea(this,{lineNumbers:!0,viewportMargin:Infinity,mode:t});var e=this;$(e).closest('form').submit(function(){var t=o.getValue();$(e).val(t)})})});+ \ No newline at end of file