openrat-cms

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

commit b4c5d7ca18b0e347f737dcdbbddb49cc36f3516e
parent 84e2041635b40598788e52beee80722b5fa762e3
Author: Jan Dankert <devnull@localhost>
Date:   Tue,  3 Jul 2018 01:44:16 +0200

Fix: popState darf nur 1x den State lesen :)

Diffstat:
modules/cms-core/action/FolderAction.class.php | 4++++
modules/cms-core/action/LanguageAction.class.php | 7++++++-
modules/cms-ui/themes/default/script/openrat.js | 9+++++----
modules/cms-ui/themes/default/script/openrat.min.js | 2+-
4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/modules/cms-core/action/FolderAction.class.php b/modules/cms-core/action/FolderAction.class.php @@ -1569,4 +1569,8 @@ class FolderAction extends ObjectAction return true; } } + + public function showView() { + $this->nextSubAction('edit'); + } } \ No newline at end of file diff --git a/modules/cms-core/action/LanguageAction.class.php b/modules/cms-core/action/LanguageAction.class.php @@ -208,7 +208,12 @@ class LanguageAction extends Action $this->setTemplateVar('isocodes' ,$countryList ); $this->setTemplateVar('isocode' ,strtoupper($this->language->isoCode) ); } - + + + + function showView() { + $this->nextSubAction('edit'); + } function advancedView() diff --git a/modules/cms-ui/themes/default/script/openrat.js b/modules/cms-ui/themes/default/script/openrat.js @@ -51,17 +51,16 @@ function initActualHistoryState() { var History = new function () { 'use strict'; - this.fromHistory = function(ev) { - var state = ev.state; + this.fromHistory = function(state) { Workbench.loadNewAction(state.action,state.id); } this.toHistory = function(obj) { - window.history.pushState(obj,obj.name,'./?action='+obj.action+'&id='+obj.subaction); + window.history.pushState(obj,obj.name,createUrl(obj.action,null,obj.id,obj.data,false) ); } this.toActualHistory = function(obj) { - window.history.replaceState(obj,obj.name,'./?action='+obj.action+'&id='+obj.subaction); + window.history.replaceState(obj,obj.name,createUrl(obj.action,null,obj.id,obj.data,false) ); } } @@ -984,7 +983,9 @@ else function createUrl(action,subaction,id,extraid,embed) { var url = './'; + url += '?action=' + action; + if (subaction != null) url += '&subaction='+subaction; diff --git a/modules/cms-ui/themes/default/script/openrat.min.js b/modules/cms-ui/themes/default/script/openrat.min.js @@ -1,4 +1,4 @@ -;var DEFAULT_CONTENT_ACTION='edit',OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');refreshAll();registerHeaderEvents();$('#workbench .view').each(function(e){registerViewEvents(this)});window.onpopstate=function(e){History.fromHistory(e.state)};initActualHistoryState();Workbench.initialize();loadTree()});function initActualHistoryState(){var e={};e.name=window.document.title;e.action=$('#editor').data('action');e.id=$('#editor').data('id');History.toActualHistory(e)};var History=new function(){'use strict';this.fromHistory=function(e){var i=e.state;Workbench.loadNewAction(i.action,i.id)};this.toHistory=function(e){window.history.pushState(e,e.name,'./?action='+e.action+'&id='+e.subaction)};this.toActualHistory=function(e){window.history.replaceState(e,e.name,'./?action='+e.action+'&id='+e.subaction)}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer();this.loadInitialViews()};this.loadInitialViews=function(){};this.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},i=5;window.setInterval(e,i*60*1000)};this.loadNewAction=function(e,i,t,a){var n={action:e,method:i,id:t,data:a};History.toHistory(n);$('#workbench .view-loader').each(function(i){var n=$(this),s=n.data('method'),o=createUrl(e,s,t,a,!0);n.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(e,i,t){n.fadeTo(350,1);if(i=='error'){$(n).html('');$(n).removeClass('loader');notify('error',e);return};$(n).removeClass('loader');registerViewEvents(n)})})}};function refreshAll(){refreshTitleBar();refreshWorkbench();$('div#filler').click(function(){if($('div#dialog').hasClass('modal')){} +;var DEFAULT_CONTENT_ACTION='edit',OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');refreshAll();registerHeaderEvents();$('#workbench .view').each(function(e){registerViewEvents(this)});window.onpopstate=function(e){History.fromHistory(e.state)};initActualHistoryState();Workbench.initialize();loadTree()});function initActualHistoryState(){var e={};e.name=window.document.title;e.action=$('#editor').data('action');e.id=$('#editor').data('id');History.toActualHistory(e)};var History=new function(){'use strict';this.fromHistory=function(e){Workbench.loadNewAction(e.action,e.id)};this.toHistory=function(e){window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.toActualHistory=function(e){window.history.replaceState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer();this.loadInitialViews()};this.loadInitialViews=function(){};this.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},i=5;window.setInterval(e,i*60*1000)};this.loadNewAction=function(e,i,t,a){var n={action:e,method:i,id:t,data:a};History.toHistory(n);$('#workbench .view-loader').each(function(i){var n=$(this),s=n.data('method'),o=createUrl(e,s,t,a,!0);n.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(e,i,t){n.fadeTo(350,1);if(i=='error'){$(n).html('');$(n).removeClass('loader');notify('error',e);return};$(n).removeClass('loader');registerViewEvents(n)})})}};function refreshAll(){refreshTitleBar();refreshWorkbench();$('div#filler').click(function(){if($('div#dialog').hasClass('modal')){} else{$('div#dialog').html('').hide();$('div#filler').fadeOut(500)}})};function refreshAllRefreshables(){$('#workbench div.panel > div.header > ul.views > li.active').each(function(){if($(this).hasClass('static'))return;var e=$(this).data('method'),i=$(this).data('action'),t=$(this).data('id'),a=$(this).data('extra');loadView($(this).closest('div.panel').find('div.content'),i,e,t,a)})};function refreshActualView(e){$(e).closest('div.panel').find('li.active').each(function(){var e=$(this).attr('data-method'),i=$(this).attr('data-action'),t=$(this).attr('data-id');loadView($(this).closest('div.panel').find('div.content'),i,e,t)})};function refreshWorkbench(){$('ul#history').empty();resizeWorkbench();$('div.modaldialog').fadeOut(500);$('#workbench').removeClass('modal');$('div#filler').fadeOut(500);$('#workbench').fadeIn(750).find('li.active').each(function(){var i=$(this).attr('data-method'),e=$(this).attr('data-action');if(e)loadView($(this).closest('div.panel').find('div.content'),e,i,0)});$('div.backward_link').click(function(){var e=$(this).closest('div.header').find('ul.views'),i=e.find('li.action.active').prev();e.scrollTo(i,500,{'axis':'x'});i.click()});$('div.forward_link').click(function(){var e=$(this).closest('div.header').find('ul.views'),i=e.find('li.action.active').next();e.scrollTo(i,500,{'axis':'x'});i.click()});registerWorkbenchEvents();$(window).resize(function(){resizeWorkbench()})};function registerWorkbenchEvents(){$('ul.views > li.action').draggable({cursor:'move',revert:'invalid'});$('ul.views').droppable({accept:'li.action',hoverClass:'drophover',activeClass:'dropactive',drop:function(e,i){var a=i.draggable,s=$(this),n=a.parent();if($(a).closest('div.panel').attr('id')==$(s).closest('div.panel').attr('id'))$(a).css({top:0,left:0});else $(a).detach().css({top:0,left:0}).appendTo(s).click();if(n.find('li').size()==0){var t=n.closest('div.container');n.closest('div.panel').remove();if(t.hasClass('autosize'))t.children('div.panel').addClass('autosize').removeClass('resizable');else t.children('div.panel').addClass('resizable').removeClass('autosize');t.replaceWith(t.children('div.panel'));resizeWorkbench()}}});$('div.content').droppable({accept:'li.action',hoverClass:'drophover',activeClass:'dropactive',drop:function(e,i){var n=i.draggable,s=$(this),d=n.parent(),o=n.offset(),r=s.offset(),f=o.left-r.left,v=r.left+s.width()-o.left,l=o.top-r.top,c=r.top+s.height()-o.top,t=$('<div class="container"><div class="first" /><div class="divider" /><div class="second"></div>');if(f<Math.min(v,Math.min(l,c))){t.addClass('axle-x');t.children('div.divider').addClass('to-right');t.children('div.first').removeClass('first').addClass('resizable');t.children('div.second').removeClass('first').addClass('autosize')} else if(v<Math.min(l,c)){t.addClass('axle-x');t.children('div.divider').addClass('to-left');t.children('div.first').removeClass('first').addClass('autosize');t.children('div.second').removeClass('first').addClass('resizable')} else if(l<c){t.addClass('axle-y');t.children('div.divider').addClass('to-bottom');t.children('div.first').removeClass('first').addClass('resizable');t.children('div.second').removeClass('first').addClass('autosize')}