openrat-cms

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

commit a37cf2e795bd6da71849fb0e3349432e9f8cb0dd
parent dc6ed7fa3e5f539a8b249ce817ba89bf7875ca21
Author: Jan Dankert <devnull@localhost>
Date:   Tue,  6 Mar 2018 21:21:15 +0100

Neue Methode getActiveView(), um DOM-Logik zu kapseln.

Diffstat:
modules/cms-ui/themes/default/script/openrat.js | 49+++++++++++++++++++++++++++++++------------------
modules/cms-ui/themes/default/script/openrat.min.js | 26+++++++++++++-------------
2 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/modules/cms-ui/themes/default/script/openrat.js b/modules/cms-ui/themes/default/script/openrat.js @@ -401,9 +401,12 @@ function loadViewByName(viewName, url ) /** * Laden einer View. - * - * @param jo - * @param url URL, von der der Inhalt geladen wird. + * + * @param contentEl + * @param action + * @param method + * @param id + * @param params */ function loadView(contentEl,action,method,id,params ) { @@ -682,19 +685,32 @@ function postUrl(url,element) } +/** + * Ermittelt die aktuelle, ausgewählte View. + * + * @returns JSON + */ +function getActiveView() +{ + var element = $('#panel-content').find('li.active'); + + return{ + 'action' : $(element).data('action'), + 'id' : $(element).data('id' ), + 'extraid' : $(element).data('extra' ) + }; +} + /** * Setzt neue View und aktualisiert alle Fenster. * @param element - * @param action Action - * @param id Id + * @param method */ function startView( element,method ) { - var action = $('#panel-content').find('li.active').data('action'); - var id = $('#panel-content').find('li.active').data('id' ); - - loadView( $(element).closest('div.panel').find('div.content'), action,method,id ); + var active = getActiveView(); + loadView( $(element).closest('div.panel').find('div.content'), active.action,method,active.id,active.extraid ); // Alle refresh-fähigen Views mit dem neuen Objekt laden. // refreshAllRefreshables(); @@ -703,9 +719,11 @@ function startView( element,method ) /** * Setzt neuen modalen Dialog und aktualisiert alle Fenster. - * @param element + * @param name * @param action Action + * @param method * @param id Id + * @param params */ function startDialog( name,action,method,id,params ) { @@ -713,21 +731,16 @@ function startDialog( name,action,method,id,params ) action = $('#panel-content').find('li.active').data('action'); if (id==null || id.length ==0) id = $('#panel-content').find('li.active').data('id' ); -// if (params==null) -// params = {}; - + if (typeof params === "undefined") + params = $('#panel-content').find('li.active').data('extra'); + $('div#filler').fadeTo(500,0.5); $('div#dialog').html('<div class="header"><ul class="views"><li class="action active"><img class="icon" title="" src="./themes/default/images/icon/'+method+'.png" /><div class="tabname" style="width:100px;">'+name+'</div></li></ul></div><div class="content" />'); $('div#dialog').data('id',id); $('div#dialog').show(); - //alert("neuer Dialog2: "+name+" action: "+action+" method: "+method+ " id:"+id + " params:"+params); - loadView( $('div#dialog div.content'), action,method,id,params ); - //$('#workbench div.panel.modal').parent().addClass('modal'); - //$('#workbench').addClass('modal'); - // Alle refresh-fähigen Views mit dem neuen Objekt laden. // refreshAllRefreshables(); } diff --git a/modules/cms-ui/themes/default/script/openrat.min.js b/modules/cms-ui/themes/default/script/openrat.min.js @@ -1,19 +1,19 @@ ;var DEFAULT_CONTENT_ACTION='edit',OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');refreshAll();window.setInterval(function(){ping()},300000)});function ping(){$.ajax(createUrl('title','ping',0))};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,n=$(this),s=a.parent();if($(a).closest('div.panel').attr('id')==$(n).closest('div.panel').attr('id'))$(a).css({top:0,left:0});else $(a).detach().css({top:0,left:0}).appendTo(n).click();if(s.find('li').size()==0){var t=s.closest('div.container');s.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 s=i.draggable,n=$(this),o=s.parent(),d=s.offset(),l=n.offset(),h=d.left-l.left,v=l.left+n.width()-d.left,r=d.top-l.top,c=l.top+n.height()-d.top,t=$('<div class="container"><div class="first" /><div class="divider" /><div class="second"></div>');if(h<Math.min(v,Math.min(r,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{$('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),o=n.parent(),d=n.offset(),l=s.offset(),h=d.left-l.left,v=l.left+s.width()-d.left,r=d.top-l.top,c=l.top+s.height()-d.top,t=$('<div class="container"><div class="first" /><div class="divider" /><div class="second"></div>');if(h<Math.min(v,Math.min(r,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(r,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(r<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')} -else{t.addClass('axle-y');t.children('div.divider').addClass('to-top');t.children('div.first').removeClass('first').addClass('autosize');t.children('div.second').removeClass('first').addClass('resizable')};t.children('div.resizable').addClass('bar').data('size-factor',0.4);$(s).closest('div.panel').clone().addClass('resizable').removeClass('autosize').replaceAll(t.children('div.resizable'));t.find('ul.views > li').remove();$(s).detach().css({top:0,left:0}).appendTo(t.find('ul.views')).click();var a=$(n).closest('div.panel').replaceWith(t);t.children('div.autosize').replaceWith(a);if(a.hasClass('autosize')){t.addClass('autosize').removeClass('resizable')};if(a.hasClass('resizable')){t.addClass('resizable').removeClass('autosize')};a.addClass('autosize').removeClass('resizable');if(o.find('li').length==0){var a=o.closest('div.container');o.closest('div.panel').remove();if(a.hasClass('autosize'))a.children('div.panel').addClass('autosize').removeClass('resizable');else a.children('div.panel').addClass('resizable').removeClass('autosize');a.replaceWith(a.children('div.panel'));resizeWorkbench()};resizeWorkbench();registerWorkbenchEvents()}});if($('#workbench div.panel.modal').length>0){$('#workbench div.panel.modal').parent().addClass('modal');$('div#filler').fadeTo(500,0.5);$('#workbench').addClass('modal')};$('div.container.axle-x > div.divider').draggable({stop:function(e,i){var t=i.position.left,a=$(this).hasClass('to-right')?1:-1;$(this).parent().children('div.resizable').each(function(){var e=((a*t)+$(this).width())/($(this).parent().width());e=Math.min(0.5,Math.max(0.1,e));$(this).data('size-factor',e)});resizeWorkbenchContainer($(this).parent())},axis:'x',revert:!0,revertDuration:0});$('div.container.axle-y > div.divider').draggable({stop:function(e,i){var t=i.position.top,a=$(this).hasClass('to-bottom')?1:-1;$(this).parent().children('div.resizable').each(function(){var e=((a*t)+$(this).height())/($(this).parent().height());e=Math.min(0.5,Math.max(0.1,e));$(this).data('size-factor',e)});resizeWorkbenchContainer($(this).parent())},axis:'y',revert:!0,revertDuration:0});$('ul.views > li.action').click(function(){$(this).orLoadView()});$('div.header').dblclick(function(){fullscreen(this)});loadTree()};function refreshTitleBar(){$('#header').load(createUrl('title','show',0),function(){$(this).fadeIn('slow');registerHeaderEvents()})};function loadViewByName(e,i){alert('loadViewByName');loadView($('div#'+e),i)};function loadView(e,i,t,s,n){var a=$(e).children('div.sheet.action-'+i+'.method-'+t+'.id-'+s);if(a.length==0){$(e).children('div.sheet').hide();a=$('<div class="sheet action-'+i+' method-'+t+' id-'+s+'" />');$(e).append(a)} +else{t.addClass('axle-y');t.children('div.divider').addClass('to-top');t.children('div.first').removeClass('first').addClass('autosize');t.children('div.second').removeClass('first').addClass('resizable')};t.children('div.resizable').addClass('bar').data('size-factor',0.4);$(n).closest('div.panel').clone().addClass('resizable').removeClass('autosize').replaceAll(t.children('div.resizable'));t.find('ul.views > li').remove();$(n).detach().css({top:0,left:0}).appendTo(t.find('ul.views')).click();var a=$(s).closest('div.panel').replaceWith(t);t.children('div.autosize').replaceWith(a);if(a.hasClass('autosize')){t.addClass('autosize').removeClass('resizable')};if(a.hasClass('resizable')){t.addClass('resizable').removeClass('autosize')};a.addClass('autosize').removeClass('resizable');if(o.find('li').length==0){var a=o.closest('div.container');o.closest('div.panel').remove();if(a.hasClass('autosize'))a.children('div.panel').addClass('autosize').removeClass('resizable');else a.children('div.panel').addClass('resizable').removeClass('autosize');a.replaceWith(a.children('div.panel'));resizeWorkbench()};resizeWorkbench();registerWorkbenchEvents()}});if($('#workbench div.panel.modal').length>0){$('#workbench div.panel.modal').parent().addClass('modal');$('div#filler').fadeTo(500,0.5);$('#workbench').addClass('modal')};$('div.container.axle-x > div.divider').draggable({stop:function(e,i){var t=i.position.left,a=$(this).hasClass('to-right')?1:-1;$(this).parent().children('div.resizable').each(function(){var e=((a*t)+$(this).width())/($(this).parent().width());e=Math.min(0.5,Math.max(0.1,e));$(this).data('size-factor',e)});resizeWorkbenchContainer($(this).parent())},axis:'x',revert:!0,revertDuration:0});$('div.container.axle-y > div.divider').draggable({stop:function(e,i){var t=i.position.top,a=$(this).hasClass('to-bottom')?1:-1;$(this).parent().children('div.resizable').each(function(){var e=((a*t)+$(this).height())/($(this).parent().height());e=Math.min(0.5,Math.max(0.1,e));$(this).data('size-factor',e)});resizeWorkbenchContainer($(this).parent())},axis:'y',revert:!0,revertDuration:0});$('ul.views > li.action').click(function(){$(this).orLoadView()});$('div.header').dblclick(function(){fullscreen(this)});loadTree()};function refreshTitleBar(){$('#header').load(createUrl('title','show',0),function(){$(this).fadeIn('slow');registerHeaderEvents()})};function loadViewByName(e,i){alert('loadViewByName');loadView($('div#'+e),i)};function loadView(e,i,t,n,s){var a=$(e).children('div.sheet.action-'+i+'.method-'+t+'.id-'+n);if(a.length==0){$(e).children('div.sheet').hide();a=$('<div class="sheet action-'+i+' method-'+t+' id-'+n+'" />');$(e).append(a)} else{if(a.is(':visible')){return} -else{$(e).children('div.sheet').hide();a.show();return}};var d=createUrl(i,t,s,n);$(a).empty().fadeTo(1,0.7).addClass('loader').html('').load(d,function(e,i,t){$(a).fadeTo(350,1);if(i=='error'){$(a).html('');$(a).removeClass('loader');notify('error',e);return};$(a).removeClass('loader');registerViewEvents(a)})};function registerViewEvents(e){$(e).trigger('orViewLoaded');$(e).find('input[data-hint]').orHint();$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('div.headermenu > a').each(function(e,i){});$(e).find('div.header > a.back').each(function(i,t){$(t).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(i,t,a){var s=$(e).parent();$(s).find('input[type=text]').attr('value',i);$(s).find('input[type=hidden]').attr('value',a)}})});$('div.content li.object').draggable({cursor:'move',revert:'invalid'});$('div.content li.object > div.entry[data-type=\'folder\']').droppable({accept:'li.object',hoverClass:'drophover',activeClass:'dropactive',drop:function(e,i){var t=i.draggable,a=$(this).parent();startDialog($(this).text(),$(t).attr('data-type'),'copy',$(a).attr('data-id'),{'action':$(t).attr('data-type'),'subaction':'copy','id':$(t).attr('data-id'),'targetFolderId':$(a).attr('data-id')});$(t).detach().css({top:0,left:0}).appendTo(a).click()}});$(e).find('input').change(function(){$(this).closest('div.panel').find('ul.views li.action.active').addClass('dirty')})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#header .toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parent().toggleClass('open')});$('#header .toolbar-icon.menu').mouseover(function(){$(this).parent().find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#header').trigger('orHeaderLoaded');$('div.search input').blur(function(){$('div.search input div.dropdown').fadeOut()});$('div.search input').orHint();$('div.search input').orSearch({dropdown:'div.search div.dropdown'})};function fullscreen(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){if($('div#panel-tree li.action').data('action')=='tree'){$('div#panel-tree div.content > div.sheet.action-tree.method-tree').html('&nbsp;');$('div#panel-tree div.content > div.sheet.action-tree.method-tree').orTree({type:'root',id:0,onSelect:function(e,i,t,a){openNewAction(e,i,t,a)}});$('div#panel-tree div.content > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click();$('div#panel-tree div.content > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click()}};function submitUrl(e,i){postUrl(i,e);refreshAllRefreshables()};function postUrl(e,i){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,t,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(e,t,i)}})};function startView(e,i){var t=$('#panel-content').find('li.active').data('action'),a=$('#panel-content').find('li.active').data('id');loadView($(e).closest('div.panel').find('div.content'),t,i,a)};function startDialog(e,i,t,a,s){if(i==null||i.length==0)i=$('#panel-content').find('li.active').data('action');if(a==null||a.length==0)a=$('#panel-content').find('li.active').data('id');$('div#filler').fadeTo(500,0.5);$('div#dialog').html('<div class="header"><ul class="views"><li class="action active"><img class="icon" title="" src="./themes/default/images/icon/'+t+'.png" /><div class="tabname" style="width:100px;">'+e+'</div></li></ul></div><div class="content" />');$('div#dialog').data('id',a);$('div#dialog').show();loadView($('div#dialog div.content'),i,t,a,s)};function modalView(e,i){var t=$(e).closest('div.panel').find('li.active').attr('data-action'),a=$(e).closest('div.panel').find('li.active').attr('data-method'),s=$(e).closest('div.panel').find('li.active').attr('data-id');$(e).closest('div.content').modal({'overlayClose':'true','xxxonClose':function(){alert('close)')}});loadView($(e).closest('div.content'),t,a,s)};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,i,t,a){setTitle(e);$('ul#history li.active').removeClass('active');if($('ul#history li.'+i+'.id'+t).length>0){$('ul#history li.'+i+'.id'+t).addClass('active')} +else{$(e).children('div.sheet').hide();a.show();return}};var d=createUrl(i,t,n,s);$(a).empty().fadeTo(1,0.7).addClass('loader').html('').load(d,function(e,i,t){$(a).fadeTo(350,1);if(i=='error'){$(a).html('');$(a).removeClass('loader');notify('error',e);return};$(a).removeClass('loader');registerViewEvents(a)})};function registerViewEvents(e){$(e).trigger('orViewLoaded');$(e).find('input[data-hint]').orHint();$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('div.headermenu > a').each(function(e,i){});$(e).find('div.header > a.back').each(function(i,t){$(t).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(i,t,a){var n=$(e).parent();$(n).find('input[type=text]').attr('value',i);$(n).find('input[type=hidden]').attr('value',a)}})});$('div.content li.object').draggable({cursor:'move',revert:'invalid'});$('div.content li.object > div.entry[data-type=\'folder\']').droppable({accept:'li.object',hoverClass:'drophover',activeClass:'dropactive',drop:function(e,i){var t=i.draggable,a=$(this).parent();startDialog($(this).text(),$(t).attr('data-type'),'copy',$(a).attr('data-id'),{'action':$(t).attr('data-type'),'subaction':'copy','id':$(t).attr('data-id'),'targetFolderId':$(a).attr('data-id')});$(t).detach().css({top:0,left:0}).appendTo(a).click()}});$(e).find('input').change(function(){$(this).closest('div.panel').find('ul.views li.action.active').addClass('dirty')})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#header .toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parent().toggleClass('open')});$('#header .toolbar-icon.menu').mouseover(function(){$(this).parent().find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#header').trigger('orHeaderLoaded');$('div.search input').blur(function(){$('div.search input div.dropdown').fadeOut()});$('div.search input').orHint();$('div.search input').orSearch({dropdown:'div.search div.dropdown'})};function fullscreen(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){if($('div#panel-tree li.action').data('action')=='tree'){$('div#panel-tree div.content > div.sheet.action-tree.method-tree').html('&nbsp;');$('div#panel-tree div.content > div.sheet.action-tree.method-tree').orTree({type:'root',id:0,onSelect:function(e,i,t,a){openNewAction(e,i,t,a)}});$('div#panel-tree div.content > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click();$('div#panel-tree div.content > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click()}};function submitUrl(e,i){postUrl(i,e);refreshAllRefreshables()};function postUrl(e,i){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,t,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(e,t,i)}})};function getActiveView(){var e=$('#panel-content').find('li.active');return{'action':$(e).data('action'),'id':$(e).data('id'),'extraid':$(e).data('extra')}};function startView(e,i){var t=getActiveView();loadView($(e).closest('div.panel').find('div.content'),t.action,i,t.id,t.extraid)};function startDialog(e,i,t,a,n){if(i==null||i.length==0)i=$('#panel-content').find('li.active').data('action');if(a==null||a.length==0)a=$('#panel-content').find('li.active').data('id');if(typeof n==='undefined')n=$('#panel-content').find('li.active').data('extra');$('div#filler').fadeTo(500,0.5);$('div#dialog').html('<div class="header"><ul class="views"><li class="action active"><img class="icon" title="" src="./themes/default/images/icon/'+t+'.png" /><div class="tabname" style="width:100px;">'+e+'</div></li></ul></div><div class="content" />');$('div#dialog').data('id',a);$('div#dialog').show();loadView($('div#dialog div.content'),i,t,a,n)};function modalView(e,i){var t=$(e).closest('div.panel').find('li.active').attr('data-action'),a=$(e).closest('div.panel').find('li.active').attr('data-method'),n=$(e).closest('div.panel').find('li.active').attr('data-id');$(e).closest('div.content').modal({'overlayClose':'true','xxxonClose':function(){alert('close)')}});loadView($(e).closest('div.content'),t,a,n)};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,i,t,a){setTitle(e);$('ul#history li.active').removeClass('active');if($('ul#history li.'+i+'.id'+t).length>0){$('ul#history li.'+i+'.id'+t).addClass('active')} else{$('ul#history').append('<li class="action active '+i+' id'+t+'"><img src="'+OR_THEMES_EXT_DIR+'default/images/icon_'+i+'.png" title="" />'+e+'</li>');$('ul#history li.active').click(function(){$('ul#history li.active').removeClass('active');$(this).addClass('active');setNewAction(i,t,a)})};$('div#panel-content > div.header > ul.views li.active').removeClass('active');if($('div#panel-content > div.header > ul.views > li.'+i+'.id'+t).length>0){$('div#panel-content > div.header > ul.views > li.'+i+'.id'+t).addClass('active')} -else{$('div#panel-content > div.header > ul.views > li.active').removeClass('active');var n=7;if($('div#panel-content > div.header > ul.views > li.action').length>=n)$('div#panel-content > div.header > ul.views > li.action').first().remove();var s=$('<li class="action active '+i+' id'+t+'" title="'+e+'"><img class="icon" src="'+OR_THEMES_EXT_DIR+'default/images/icon_'+i+'.png" title="" /><div class="tabname">'+e+'</div><img class="close icon" src="'+OR_THEMES_EXT_DIR+'default/images/icon/close.gif" title="" /></li>');$('div#panel-content > div.header > ul.views').append(s);s.data('action',i);s.data('id',t);s.data('extra',a);s.data('method',DEFAULT_CONTENT_ACTION);resizeTabs($('div#contentbar'),!0);$('div#panel-content > div.header > ul.views').scrollLeft(9999);$('div#panel-content > div.header > ul.views img.close').click(function(){setTitle('');var i=$(this).closest('li.action').data('action'),t=$(this).closest('li.action').data('id');$('#workbench div.content > div.sheet.action-'+i+'.id-'+t).remove();if($(this).closest('li.action').hasClass('active')){$('#workbench div.refreshable div.content').html('');var e=$(this).closest('ul.views');$(this).parent().remove();$(e).find('li.action').last().click()} +else{$('div#panel-content > div.header > ul.views > li.active').removeClass('active');var s=7;if($('div#panel-content > div.header > ul.views > li.action').length>=s)$('div#panel-content > div.header > ul.views > li.action').first().remove();var n=$('<li class="action active '+i+' id'+t+'" title="'+e+'"><img class="icon" src="'+OR_THEMES_EXT_DIR+'default/images/icon_'+i+'.png" title="" /><div class="tabname">'+e+'</div><img class="close icon" src="'+OR_THEMES_EXT_DIR+'default/images/icon/close.gif" title="" /></li>');$('div#panel-content > div.header > ul.views').append(n);n.data('action',i);n.data('id',t);n.data('extra',a);n.data('method',DEFAULT_CONTENT_ACTION);resizeTabs($('div#contentbar'),!0);$('div#panel-content > div.header > ul.views').scrollLeft(9999);$('div#panel-content > div.header > ul.views img.close').click(function(){setTitle('');var i=$(this).closest('li.action').data('action'),t=$(this).closest('li.action').data('id');$('#workbench div.content > div.sheet.action-'+i+'.id-'+t).remove();if($(this).closest('li.action').hasClass('active')){$('#workbench div.refreshable div.content').html('');var e=$(this).closest('ul.views');$(this).parent().remove();$(e).find('li.action').last().click()} else{$(this).parent().remove()};resizeTabs($('div#panel-content'),!0)});$('div#panel-content > div.header > ul.views > li.active').click(function(){$('div#panel-content > div.header > ul.views li.active').removeClass('active');$(this).addClass('active');setTitle($(this).children('div.tabname').text());setNewAction(i,t,a)});resizeTabs($('div#panel-content '))};setNewAction(i,t,a)};function filterMenus(e){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+e).addClass('active').removeClass('inactive')};function setNewAction(e,i,t){filterMenus(e);$('#workbench ul.views > li.action.dependent').data('action',e).data('id',i).data('extra',t);refreshAllRefreshables()};function setNewId(e){$('#workbench div.refreshable').attr('data-id',e);refreshAllRefreshables()};function notifyBrowser(e){if(!('Notification' in window)){return} else if(Notification.permission==='granted'){var i=new Notification(e)} -else if(Notification.permission!=='denied'){Notification.requestPermission(function(i){if(i==='granted'){var t=new Notification(e)}})}};function setUserStyle(e){var i=$('html'),t=i.attr('class').split(/\s+/);$.each(t,function(e,t){if(t.startsWith('theme-')){i.removeClass(t)}});i.addClass('theme-'+e.toLowerCase())};function insert(e,i,t){var a=document.forms[0].elements[e];a.focus();if(typeof document.selection!='undefined'){var d=document.selection.createRange(),s=d.text;d.text=i+s+t;d=document.selection.createRange();if(s.length==0){d.move('character',-t.length)} -else{d.moveStart('character',i.length+s.length+t.length)};d.select()} -else if(typeof a.selectionStart!='undefined'){var l=a.selectionStart,o=a.selectionEnd,s=a.value.substring(l,o);a.value=a.value.substr(0,l)+i+s+t+a.value.substr(o);var n;if(s.length==0){n=l+i.length} -else{n=l+i.length+s.length+t.length};a.selectionStart=n;a.selectionEnd=n} -else{n=a.value.length;var s=prompt('Text');a.value=a.value.substr(0,n)+i+s+t+a.value.substr(n)}};function loadSubaction(e,i,t,a){alert('nobody should call loadSubaction()');var n={skin:'v2',baseHref:OR_THEMES_EXT_DIR+'../editor/editor/',customConfig:'config-openrat.js',filebrowserUploadUrl:'./dispatcher.php?action=filebrowser&subaction=directupload&name=upload',filebrowserBrowseUrl:'./dispatcher.php?action=filebrowser&subaction=browse'};var s=$(e).parent().parent().parent('div.panel').children('div.content').first();$(s).load(createUrl(i,t,a)+' div.content',null,function(){var e=CKEDITOR.instances[$('textarea.editor').attr('name')];if(e)e.destroy();CKEDITOR.replace('text',{customConfig:'config-openrat.js'})});$(e).parent().parent().find('.active').removeClass('active');$(e).parent().addClass('active')};function createUrl(e,i,t,a){var s='./';if(typeof a==='string'){s+='?action='+e+'&subaction='+i+'&id='+t;jQuery.each(jQuery.parseJSON(a),function(e,i){s=s+'&'+e+'='+i})} -else if(typeof a==='object'){s+='?action='+e+'&subaction='+i+'&id='+t;jQuery.each(a,function(e,i){s=s+'&'+e+'='+value})} -else{s+='?action='+e+'&subaction='+i+'&id='+t};console.log('URL='+s);return s};function resizeWorkbenchContainer(e){var t=e.width(),a=e.height(),s=e.children('div.resizable').data('size-factor');if(!s)s=0.3;var n=e.hasClass('axle-x');if(n){var i=Math.floor(t*s);e.find('div.panel.resizable').css('width',''+i+'px');e.find('div.panel.resizable > div.content').css('height',''+(a-26)+'px');e.find('div.panel.autosize ').css('width',''+(t-i-9)+'px');e.find('div.panel.autosize > div.content').css('height',''+(a-26)+'px');e.children('div.resizable').css('width',''+i+'px');e.children('div.resizable').css('height',''+a+'px');e.children('div.autosize').css('width',''+(t-i-9)+'px');e.children('div.autosize').css('height',''+a+'px');e.children('div.divider').css('height',''+a+'px')} -else{var i=Math.floor(a*s);e.find('div.panel.resizable ').css('width',''+t+'px');e.find('div.panel.resizable > div.content').css('height',''+(i-26)+'px');e.find('div.panel.autosize ').css('width',''+t+'px');e.find('div.panel.autosize > div.content').css('height',''+(a-i-26)+'px');e.children('div.resizable').css('width',''+t+'px');e.children('div.resizable').css('height',''+i+'px');e.children('div.autosize').css('width',''+t+'px');e.children('div.autosize').css('height',''+(a-i-5)+'px');e.children('div.divider').css('width',''+t+'px')};e.children('div.panel').each(function(){resizeTabs($(this))});$(e).children('div.container').each(function(){resizeWorkbenchContainer($(this))})};function resizeWorkbench(){var i=$(window).width(),t=$(window).height(),a=40,e=$('#workbench > div.container');e.css('width',''+(i-6)+'px');e.css('height',''+(t-a-6)+'px');resizeWorkbenchContainer(e)};function resizeTabs(e){var t=$(e).find('div.header li.action').length,i=Math.floor((($(e).width()-18)/t)-39);if($(e).is('#panel-content'))i-=24;i=Math.min(90,Math.max(5,i));$(e).find('li.action div.tabname').width(i)};function help(e,i,t){var a=$(e).closest('div.panel').find('li.action.active').attr('data-action'),s=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(i+a+'/'+s+t,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,i){var t=$('<div class="notice '+e+'"><div class="text">'+i+'</div></div>');$('#noticebar').prepend(t);notifyBrowser(i);$(t).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})})};- \ No newline at end of file +else if(Notification.permission!=='denied'){Notification.requestPermission(function(i){if(i==='granted'){var t=new Notification(e)}})}};function setUserStyle(e){var i=$('html'),t=i.attr('class').split(/\s+/);$.each(t,function(e,t){if(t.startsWith('theme-')){i.removeClass(t)}});i.addClass('theme-'+e.toLowerCase())};function insert(e,i,t){var a=document.forms[0].elements[e];a.focus();if(typeof document.selection!='undefined'){var d=document.selection.createRange(),n=d.text;d.text=i+n+t;d=document.selection.createRange();if(n.length==0){d.move('character',-t.length)} +else{d.moveStart('character',i.length+n.length+t.length)};d.select()} +else if(typeof a.selectionStart!='undefined'){var l=a.selectionStart,o=a.selectionEnd,n=a.value.substring(l,o);a.value=a.value.substr(0,l)+i+n+t+a.value.substr(o);var s;if(n.length==0){s=l+i.length} +else{s=l+i.length+n.length+t.length};a.selectionStart=s;a.selectionEnd=s} +else{s=a.value.length;var n=prompt('Text');a.value=a.value.substr(0,s)+i+n+t+a.value.substr(s)}};function loadSubaction(e,i,t,a){alert('nobody should call loadSubaction()');var s={skin:'v2',baseHref:OR_THEMES_EXT_DIR+'../editor/editor/',customConfig:'config-openrat.js',filebrowserUploadUrl:'./dispatcher.php?action=filebrowser&subaction=directupload&name=upload',filebrowserBrowseUrl:'./dispatcher.php?action=filebrowser&subaction=browse'};var n=$(e).parent().parent().parent('div.panel').children('div.content').first();$(n).load(createUrl(i,t,a)+' div.content',null,function(){var e=CKEDITOR.instances[$('textarea.editor').attr('name')];if(e)e.destroy();CKEDITOR.replace('text',{customConfig:'config-openrat.js'})});$(e).parent().parent().find('.active').removeClass('active');$(e).parent().addClass('active')};function createUrl(e,i,t,a){var n='./';if(typeof a==='string'){n+='?action='+e+'&subaction='+i+'&id='+t;jQuery.each(jQuery.parseJSON(a),function(e,i){n=n+'&'+e+'='+i})} +else if(typeof a==='object'){n+='?action='+e+'&subaction='+i+'&id='+t;jQuery.each(a,function(e,i){n=n+'&'+e+'='+i})} +else{n+='?action='+e+'&subaction='+i+'&id='+t};console.log('URL='+n);return n};function resizeWorkbenchContainer(e){var t=e.width(),a=e.height(),n=e.children('div.resizable').data('size-factor');if(!n)n=0.3;var s=e.hasClass('axle-x');if(s){var i=Math.floor(t*n);e.find('div.panel.resizable').css('width',''+i+'px');e.find('div.panel.resizable > div.content').css('height',''+(a-26)+'px');e.find('div.panel.autosize ').css('width',''+(t-i-9)+'px');e.find('div.panel.autosize > div.content').css('height',''+(a-26)+'px');e.children('div.resizable').css('width',''+i+'px');e.children('div.resizable').css('height',''+a+'px');e.children('div.autosize').css('width',''+(t-i-9)+'px');e.children('div.autosize').css('height',''+a+'px');e.children('div.divider').css('height',''+a+'px')} +else{var i=Math.floor(a*n);e.find('div.panel.resizable ').css('width',''+t+'px');e.find('div.panel.resizable > div.content').css('height',''+(i-26)+'px');e.find('div.panel.autosize ').css('width',''+t+'px');e.find('div.panel.autosize > div.content').css('height',''+(a-i-26)+'px');e.children('div.resizable').css('width',''+t+'px');e.children('div.resizable').css('height',''+i+'px');e.children('div.autosize').css('width',''+t+'px');e.children('div.autosize').css('height',''+(a-i-5)+'px');e.children('div.divider').css('width',''+t+'px')};e.children('div.panel').each(function(){resizeTabs($(this))});$(e).children('div.container').each(function(){resizeWorkbenchContainer($(this))})};function resizeWorkbench(){var i=$(window).width(),t=$(window).height(),a=40,e=$('#workbench > div.container');e.css('width',''+(i-6)+'px');e.css('height',''+(t-a-6)+'px');resizeWorkbenchContainer(e)};function resizeTabs(e){var t=$(e).find('div.header li.action').length,i=Math.floor((($(e).width()-18)/t)-39);if($(e).is('#panel-content'))i-=24;i=Math.min(90,Math.max(5,i));$(e).find('li.action div.tabname').width(i)};function help(e,i,t){var a=$(e).closest('div.panel').find('li.action.active').attr('data-action'),n=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(i+a+'/'+n+t,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,i){var t=$('<div class="notice '+e+'"><div class="text">'+i+'</div></div>');$('#noticebar').prepend(t);notifyBrowser(i);$(t).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})})};+ \ No newline at end of file