openrat-cms

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

commit 938e4f91ad8542e48e97d98be24b023a2bb12ee8
parent f912ac20d9c3e38e0ab825c815227e1945b9ee9a
Author: Jan Dankert <develop@jandankert.de>
Date:   Sun, 27 Sep 2020 00:48:43 +0200

Fix: Treeaction is an UI action, so ist is not available via the API. Now there is an ugly workaround for that, we have to create a template for this calls.

Diffstat:
api/index.php | 1-
modules/cms/Dispatcher.class.php | 6+++---
modules/cms/ui/action/TreeAction.class.php | 34+++++++++++++++++++++++++---------
modules/cms/ui/themes/ThemeCompiler.class.php | 3---
modules/cms/ui/themes/default/script/openrat.js | 4++--
modules/cms/ui/themes/default/script/openrat.min.js | 4++--
modules/cms/ui/themes/default/script/openrat/common.js | 2+-
modules/cms/ui/themes/default/script/plugin/jquery-plugin-orTree.js | 2+-
8 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/api/index.php b/api/index.php @@ -2,7 +2,6 @@ // Excecuting the CMS application programming interface (API) require('../modules/autoload.php'); -require('../modules/cms/ui/require.php'); use cms\api\API; use cms\base\Startup; diff --git a/modules/cms/Dispatcher.class.php b/modules/cms/Dispatcher.class.php @@ -185,8 +185,8 @@ class Dispatcher Logger::$dateFormat = $logConfig['date_format']; Logger::$nsLookup = $logConfig['ns_lookup']; - Logger::$outputType = (int) constant('\\logger\\Logger::OUTPUT_' . strtoupper($logConfig['output'])); - Logger::$level = (int) constant('\\logger\\Logger::LEVEL_' . strtoupper($logConfig['level' ])); + Logger::$outputType = (int) @constant('\\logger\\Logger::OUTPUT_' . strtoupper($logConfig['output'])); + Logger::$level = (int) @constant('\\logger\\Logger::LEVEL_' . strtoupper($logConfig['level' ])); Logger::$messageCallback = function ( $key ) { @@ -280,7 +280,7 @@ class Dispatcher $actionClassNameWithNamespace = 'cms\\'.($this->request->isUIAction?'ui\\':'').'action\\' . $actionClassName; if ( !class_exists($actionClassNameWithNamespace) ) - throw new LogicException("Action '$this->request->action' is not available"); + throw new LogicException('Action \''.$this->request->action.'\' is not available, class not found: '.$actionClassNameWithNamespace); // Erzeugen der Action-Klasse /* @type $do \cms\action\Action */ diff --git a/modules/cms/ui/action/TreeAction.class.php b/modules/cms/ui/action/TreeAction.class.php @@ -64,6 +64,8 @@ class TreeAction extends BaseAction $branch = $this->loadTreeBranch( $type ); + $this->outputAsJSON( ['output'=>['branch'=>$branch]]); + $this->setTemplateVar( 'branch',$branch ); } @@ -124,20 +126,24 @@ class TreeAction extends BaseAction /** * The path to an object. */ - public function pathView() { + public function pathView() + { - $type = $this->getRequestVar('type'); - $id = $this->getRequestVar('id',OR_FILTER_ALPHANUM); + $type = $this->getRequestVar('type'); + $id = $this->getRequestVar('id', OR_FILTER_ALPHANUM); - $result = $this->calculatePath( $type, $id ); - $this->setTemplateVar('path' ,$result ); + $result = $this->calculatePath($type, $id); + $this->setTemplateVar('path', $result); - $name = $this->calculateName($type, $id); - $this->setTemplateVar('actual',$this->pathItem($type,$id,$name) ); - } + $name = $this->calculateName($type, $id); + $this->setTemplateVar('actual', $this->pathItem($type, $id, $name)); + $this->outputAsJSON($this->templateVars); + } - /** + + + /** * The path to an object. */ private function calculatePath($type, $id) { @@ -354,4 +360,14 @@ class TreeAction extends BaseAction } + /** + * @param array $output + */ + protected function outputAsJSON( $output ) + { + $json = new JSON(); + header('Content-Type: application/json'); + echo $json->encode($output); + exit; + } } diff --git a/modules/cms/ui/themes/ThemeCompiler.class.php b/modules/cms/ui/themes/ThemeCompiler.class.php @@ -7,9 +7,6 @@ use logger\Logger; use template_engine\TemplateEngineInfo; use util\Less; -require (__DIR__.'/../../../util/require.php'); - - /** * Theme-Compiler. * diff --git a/modules/cms/ui/themes/default/script/openrat.js b/modules/cms/ui/themes/default/script/openrat.js @@ -297,7 +297,7 @@ jQuery.fn.orTree = function () var id = $(node).data('id'); var extraId = $(node).data('extra'); - var loadBranchUrl = './api/?action=tree&subaction=loadBranch&id=' + id + '&type=' + type + '&output=json'; + var loadBranchUrl = './?action=tree&subaction=loadBranch&id=' + id + '&type=' + type + '&output=json'; // Extra-Id ergänzen. if (typeof extraId === 'string') { @@ -2532,7 +2532,7 @@ $( function() { Openrat.Workbench.afterNewActionHandler.add( function() { - let url = './api/?action=tree&subaction=path&id=' + Openrat.Workbench.state.id + '&type=' + Openrat.Workbench.state.action + '&output=json'; + let url = './?action=tree&subaction=path&id=' + Openrat.Workbench.state.id + '&type=' + Openrat.Workbench.state.action + '&output=json'; // Die Inhalte des Zweiges laden. $.getJSON(url, function (json) { diff --git a/modules/cms/ui/themes/default/script/openrat.min.js b/modules/cms/ui/themes/default/script/openrat.min.js @@ -117,7 +117,7 @@ else{this.currentItem.show()};if(this.fromOutside&&!e){s.push(function(t){this._ else{$(dropdownEl).empty()}})}; ;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()}})})}; ;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{$(e).closest('div.view').addClass('loader');var i=$(a).data('type'),o=$(a).data('id'),t=$(a).data('extra'),n='./?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})} else{};$.getJSON(n,function(a){let ul=$('<ul class="or-navtree-list" />');$(e).append(ul);let output=a['output'];$.each(output['branch'],function(a,e){let new_li=$('<li class="or-navtree-node or-navtree-node--is-closed or-draggable or-draggable--type-'+e.type+'" data-name="'+e.text+'" data-id="'+e.internalId+'" data-type="'+e.type+'" data-extra="'+JSON.stringify(e.extraId).replace(/"/g,'\'')+'"><div class="tree or-navtree-node-control"><i class="tree-icon image-icon image-icon--node-closed"></i></div><div class="clickable"><a href="'+Openrat.Navigator.createShortUrl(e.action,e.internalId)+'" class="entry" data-extra="'+JSON.stringify(e.extraId).replace(/"/g,'\'')+'" data-id="'+e.internalId+'" data-action="'+e.action+'" data-type="open" title="'+e.description+'"><i class="image-icon image-icon--action-'+e['icon']+'"></i> '+e.text+'</a></div></li>');$(ul).append(new_li);$(new_li).orTree();$(new_li).find('.clickable').orLinkify();$(new_li).find('.clickable a').click(function(e){e.preventDefault()});registerTreeBranchEvents(ul)});$(ul).slideDown('fast')}).fail(function(){Openrat.Workbench.notify('','','ERROR','failed to load subtree',[],!1)}).always(function(){$(e).closest('div.view').removeClass('loader')});$(a).addClass('or-navtree-node--is-open').removeClass('or-navtree-node--is-closed').find('.tree-icon').addClass('image-icon--node-open').removeClass('image-icon--node-closed')}})})}; ;jQuery.fn.orAutoheight=function(){var t=function(t){var n=$(t).val().split('\n').length;$(t).attr('rows',n+3)};$(this).each(function(n){t(this)});return $(this).keypress(function(){t(this)})}; @@ -1183,7 +1183,7 @@ else{}})};let timeoutMinutes=5;window.setInterval(ping,timeoutMinutes*60*1000)}; else if(Notification.permission==='granted'){let notification=new Notification(t)} else if(Notification.permission!=='denied'){Notification.requestPermission(function(e){if(e==='granted'){let notification=new Notification(t)}})}};this.notify=function(t,i,e,n,log=[],notifyTheBrowser=!1){if(notifyTheBrowser)notifyBrowser(n);let notice=$('<div class="notice '+e+'"></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(i)$(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> '+i+'</a></div>');$(notice).append('<div class="text">'+htmlEntities(n)+'</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(e=='ok')timeout=20;if(e=='info')timeout=60;if(e=='warning')timeout=120;if(e=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)};this.dataChangedHandler=$.Callbacks();this.dataChangedHandler.add(function(){if(popupWindow!==undefined)popupWindow.location.reload()});this.afterViewLoadedHandler=$.Callbacks();let afterViewFunctions=[];this.registerAfterViewLoaded=function(t){afterViewFunctions.push(t)};this.afterViewLoaded=function(t){afterViewFunctions.forEach(function(e){e(t)})}}; ;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:'')}}; -;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(){$('.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();let closeMenu=function(){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')})};closeMenu();Openrat.Workbench.afterNewActionHandler.add(function(){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(){})})});let filterMenus=function(){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)};$('#title.view').data('afterViewLoaded',function(){filterMenus()});Openrat.Workbench.afterNewActionHandler.add(function(){filterMenus()});Openrat.Workbench.afterViewLoadedHandler.add(function(e){if(typeof popupWindow!='undefined')$(e).find('a[data-type=\'popup\']').each(function(){popupWindow.location.href=$(this).attr('data-url')})});Openrat.Workbench.afterViewLoadedHandler.add(function(e){var t=$(e).closest('section');t.toggleClass('is-empty',$(e).is(':empty'));if(!$(e).is(':empty'))t.slideDown('fast');else t.slideUp('fast');$(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)}})});n(e);$(e).find('input,select,textarea').change(function(){$(this).closest('.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){Openrat.Workbench.setUserStyle(this.value)});function a(e){$(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 n(e){registerDraggable(e);registerDroppable(e)};n(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').removeClass('dirty');$('#dialog .view').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 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(){$('.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();let closeMenu=function(){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')})};closeMenu();Openrat.Workbench.afterNewActionHandler.add(function(){let url='./?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(){})})});let filterMenus=function(){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)};$('#title.view').data('afterViewLoaded',function(){filterMenus()});Openrat.Workbench.afterNewActionHandler.add(function(){filterMenus()});Openrat.Workbench.afterViewLoadedHandler.add(function(e){if(typeof popupWindow!='undefined')$(e).find('a[data-type=\'popup\']').each(function(){popupWindow.location.href=$(this).attr('data-url')})});Openrat.Workbench.afterViewLoadedHandler.add(function(e){var t=$(e).closest('section');t.toggleClass('is-empty',$(e).is(':empty'));if(!$(e).is(':empty'))t.slideDown('fast');else t.slideUp('fast');$(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)}})});n(e);$(e).find('input,select,textarea').change(function(){$(this).closest('.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){Openrat.Workbench.setUserStyle(this.value)});function a(e){$(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 n(e){registerDraggable(e);registerDroppable(e)};n(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').removeClass('dirty');$('#dialog .view').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 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/common.js b/modules/cms/ui/themes/default/script/openrat/common.js @@ -112,7 +112,7 @@ $( function() { Openrat.Workbench.afterNewActionHandler.add( function() { - let url = './api/?action=tree&subaction=path&id=' + Openrat.Workbench.state.id + '&type=' + Openrat.Workbench.state.action + '&output=json'; + let url = './?action=tree&subaction=path&id=' + Openrat.Workbench.state.id + '&type=' + Openrat.Workbench.state.action + '&output=json'; // Die Inhalte des Zweiges laden. $.getJSON(url, function (json) { diff --git a/modules/cms/ui/themes/default/script/plugin/jquery-plugin-orTree.js b/modules/cms/ui/themes/default/script/plugin/jquery-plugin-orTree.js @@ -28,7 +28,7 @@ jQuery.fn.orTree = function () var id = $(node).data('id'); var extraId = $(node).data('extra'); - var loadBranchUrl = './api/?action=tree&subaction=loadBranch&id=' + id + '&type=' + type + '&output=json'; + var loadBranchUrl = './?action=tree&subaction=loadBranch&id=' + id + '&type=' + type + '&output=json'; // Extra-Id ergänzen. if (typeof extraId === 'string') {