openrat-cms

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

commit 5a5cba047e6c3c53631eb921fdc5ccd65b4c24f1
parent 7d485428005e9e5bbf0c94b288f1091f102b7ba5
Author: Jan Dankert <devnull@localhost>
Date:   Sat, 22 Sep 2018 00:36:13 +0200

Mehrseitige Formulare funktionieren wieder. Das Ändern der E-Mail-Adresse funktioniert leider anders, da beim 1. Formular ein POST erfolgen muss.

Diffstat:
modules/cms-ui/themes/default/html/views/page/changetemplateselectelements.php | 20++++++++++++++++++++
modules/cms-ui/themes/default/html/views/page/changetemplateselectelements.tpl.src.xml | 2+-
modules/cms-ui/themes/default/html/views/profile/confirmmail.php | 32++++++++++++++++++++++++++++++++
modules/cms-ui/themes/default/html/views/profile/confirmmail.tpl.src.xml | 21++++++++++++++++++---
modules/cms-ui/themes/default/html/views/profile/mail.php | 11+++++++++--
modules/cms-ui/themes/default/html/views/profile/mail.tpl.src.xml | 43++++++++++++++++++++++++++-----------------
modules/cms-ui/themes/default/production/combined.min.js | 26+++++++++++++-------------
modules/cms-ui/themes/default/script/openrat.js | 5++++-
modules/cms-ui/themes/default/script/openrat.min.js | 20++++++++++----------
modules/template-engine/components/html/form/form.js | 31++++++++++++++++---------------
modules/template-engine/components/html/form/form.min.js | 8++++----
11 files changed, 153 insertions(+), 66 deletions(-)

diff --git a/modules/cms-ui/themes/default/html/views/page/changetemplateselectelements.php b/modules/cms-ui/themes/default/html/views/page/changetemplateselectelements.php @@ -0,0 +1,19 @@ + + + <form name="" target="_self" data-target="view" action="./" data-method="changetemplateselectelements" data-action="page" data-id="<?php echo OR_ID ?>" method="POST" enctype="application/x-www-form-urlencoded" class="page" data-async="" data-autosave=""><input type="submit" class="invisible" /><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="page" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="changetemplateselectelements" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" /> + <input type="hidden" name="newtemplateid" value="<?php echo $newtemplateid ?>"/> + + <?php foreach($elements as $list_key=>$list_value){ ?><?php extract($list_value) ?> + <div class="line"> + <div class="label"> + <span class="text"><?php echo nl2br(encodeHtml(htmlentities($name))); ?></span> + + </div> + <div class="input"> + <div class="inputholder"><select id="<?php echo REQUEST_ID ?>_<?php echo $newElementsName ?>" name="<?php echo $newElementsName ?>" title="" class=""<?php if (count($newElementsList)<=1) echo ' disabled="disabled"'; ?> size=1"><?php include_once( 'modules/template-engine/components/html/selectbox/component-select-box.php') ?><?php component_select_option_list($newElementsList,'',0,0) ?><?php if (count($newElementsList)==0) { ?><input type="hidden" name="<?php echo $newElementsName ?>" value="" /><?php } ?><?php if (count($newElementsList)==1) { ?><input type="hidden" name="<?php echo $newElementsName ?>" value="<?php echo array_keys($newElementsList)[0] ?>" /><?php } ?> + </select></div> + </div> + </div> + <?php } ?> + <div class="bottom"><div class="command 1"><input type="submit" class="submit ok" value="<?php echo lang('MENU_CHANGETEMPLATE') ?>" /><input type="button" class="submit cancel" value="<?php echo lang("CANCEL") ?>" /></div></div></form> + + \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/page/changetemplateselectelements.tpl.src.xml b/modules/cms-ui/themes/default/html/views/page/changetemplateselectelements.tpl.src.xml @@ -8,7 +8,7 @@ <text var="name"></text> </part> <part class="input"> - <selectbox name="var:newElementsName" list="newElementsList"></selectbox> + <selectbox name="var:newElementsName" default="" list="newElementsList"></selectbox> </part> </part> </list> diff --git a/modules/cms-ui/themes/default/html/views/profile/confirmmail.php b/modules/cms-ui/themes/default/html/views/profile/confirmmail.php @@ -0,0 +1,31 @@ + + + <div class="line logo"> + <div class="label"> + <img src="themes/default/images/logo_changemail.png ?>" + border="0" /> + </div> + <div class="input"> + <h2> + <?php echo langHtml('logo_changemail') ?> + </h2> + <p> + <?php echo langHtml('logo_changemail_text') ?> + </p> + + </div> +</div> + </div> + <form name="" target="_self" data-target="view" action="./" data-method="confirmmail" data-action="profile" data-id="<?php echo OR_ID ?>" method="POST" enctype="application/x-www-form-urlencoded" class="profile" data-async="" data-autosave=""><input type="submit" class="invisible" /><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="profile" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="confirmmail" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" /> + <div class="line"> + <div class="label"> + <label for="<?php echo REQUEST_ID ?>_code" class="label"><?php echo lang('mail_code') ?> + </label> + </div> + <div class="input"> + <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_code" name="code<?php if ('') echo '_disabled' ?>" required="required" autofocus="autofocus" type="text" maxlength="256" class="text" value="<?php echo Text::encodeHtml(@$code) ?>" /><?php if ('') { ?><input type="hidden" name="code" value="<?php $code ?>"/><?php } ?></div> + + </div> + </div> + <div class="bottom"><div class="command "><input type="submit" class="submit ok" value="OK" /></div></div></form> + + \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/profile/confirmmail.tpl.src.xml b/modules/cms-ui/themes/default/html/views/profile/confirmmail.tpl.src.xml @@ -1,3 +1,18 @@ <output xmlns="http://www.openrat.de/template" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"><dummy><form><window title="GLOBAL_password" name="login" icon="user" widths="50%,50%"><row><column class="logo" colspan="2"><logo name="changemail"></logo></column></row><row><column><text text="mail_code"></text></column><column><input type="text" name="code" size="30"></input></column></row><row><column colspan="2" class="act"><button type="ok"></button></column></row></window></form><focus field="code"></focus></dummy></output>- \ No newline at end of file + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"> + + <logo name="changemail"></logo> + <form> + + <part class="line"> + <part class="label"> + <label for="code" key="mail_code"></label> + </part> + + <part class="input"> + <input type="text" name="code" size="30" focus="true" required="true"></input> + </part> + </part> + </form> +</output>+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/profile/mail.php b/modules/cms-ui/themes/default/html/views/profile/mail.php @@ -17,7 +17,7 @@ </div> </div> </div> - <fieldset class="<?php echo '1'?" open":" closed" ?><?php echo '1'?" show":"" ?>"><legend><div class="arrow arrow-right on-closed"></div><div class="arrow arrow-down on-open"></div><?php echo lang('user_mail') ?></legend><div> + <fieldset class="toggle-open-close<?php echo '1'?" open":" closed" ?><?php echo '1'?" show":"" ?>"><legend class="on-click-open-close"><div class="arrow arrow-right on-closed"></div><div class="arrow arrow-down on-open"></div><?php echo lang('user_mail') ?></legend><div> <div class="line"> <div class="label"> <label for="<?php echo REQUEST_ID ?>_mail" class="label"> @@ -26,10 +26,17 @@ </label> </div> <div class="input"> - <div class="inputholder"><input<?php if ('') echo ' disabled="true"' ?> id="<?php echo REQUEST_ID ?>_mail" name="mail<?php if ('') echo '_disabled' ?>" type="text" maxlength="256" class="text" value="<?php echo Text::encodeHtml(@$mail) ?>" /><?php if ('') { ?><input type="hidden" name="mail" value="<?php $mail ?>"/><?php } ?></div> + <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_mail" name="mail<?php if ('') echo '_disabled' ?>" type="text" maxlength="256" class="text" value="<?php echo Text::encodeHtml(@$mail) ?>" /><?php if ('') { ?><input type="hidden" name="mail" value="<?php $mail ?>"/><?php } ?></div> </div> </div> </div></fieldset> + <div class="clickable"> + <a target="_self" data-type="dialog" data-action="profile" data-method="confirmmail" data-id="<?php echo OR_ID ?>" data-extra="{'dialogAction':'profile','dialogMethod':'confirmmail'}" href="<?php echo Html::url('profile','confirmmail','',array('dialogAction'=>'profile','dialogMethod'=>'confirmmail')) ?>"> + <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'mail_code'.'')))); ?></span> + + </a> + + </div> <div class="bottom"><div class="command "><input type="submit" class="submit ok" value="OK" /></div></div></form> \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/profile/mail.tpl.src.xml b/modules/cms-ui/themes/default/html/views/profile/mail.tpl.src.xml @@ -1,19 +1,28 @@ <output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"> - <form method="post"> - <logo name="changemail" /> - - <group title="message:user_mail"> - <part class="line"> - <part class="label"> - <label for="mail"> - <text text="user_new_mail"></text> - </label> - </part> - <part class="input"> - <input name="mail"></input> - </part> - </part> - </group> - </form> + xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"> + <form method="post"> + <logo name="changemail"/> + + <group title="message:user_mail"> + <part class="line"> + <part class="label"> + <label for="mail"> + <text text="user_new_mail"></text> + </label> + </part> + <part class="input"> + <input name="mail"></input> + </part> + </part> + </group> + + <part class="clickable"> + + <link action="profile" subaction="confirmmail" type="dialog"> + <text + key="mail_code"/> + </link> + </part> + + </form> </output> \ No newline at end of file diff --git a/modules/cms-ui/themes/default/production/combined.min.js b/modules/cms-ui/themes/default/production/combined.min.js @@ -11020,18 +11020,18 @@ $(document).on('orViewLoaded',function(event, data) { /* ./modules//template-engine/components/html/column/column.min.js */;$(document).on('orViewLoaded',function(o,n){}); /* ./modules//template-engine/components/html/image/image.min.js */;$(document).on('orViewLoaded',function(o,n){var e=document.querySelectorAll('img.image-icon');SVGInjector(e)}); /* ./modules//template-engine/components/html/group/group.min.js */;$(document).on('orViewLoaded',function(e,o){registerOpenClose($(e.target).find('fieldset.toggle-open-close'))}); -/* ./modules//template-engine/components/html/form/form.min.js */;$(document).on('orViewLoaded',function(e,t){if($('div.panel form input[type=password]').length>0&&$('#uname').attr('value')!=''){$('div.panel form input[name=login_name] ').attr('value',$('#uname').attr('value'));$('div.panel form input[name=login_password]').attr('value',$('#upassword').attr('value'))};$(e.target).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){$(this).closest('form').submit()});$(e.target).find('input.submit.cancel').click(function(){});$(e.target).find('form').submit(function(e){if($(this).data('target')=='view'){formSubmit($(this));e.preventDefault()}})});function formSubmit(e){var t=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(t);$(t).show();$(e).find('.error').removeClass('error');var a=$(e).serializeArray(),n=$(e).attr('method').toUpperCase();if(n=='GET'){var r=$(e).data('action'),s=$(e).data('method'),i=$(e).data('id');loadView($(e).closest('div.content'),r,s,i,a)} -else{var o='./api/';$(e).closest('div.content').addClass('loader');o+='?output=json';a['output']='json';if($(e).data('async')||$(e).data('async')=='true'){$('#dialog > .view').html('');$('#dialog').removeClass('is-open').addClass('is-closed')};$.ajax({'type':'POST',url:o,data:a,success:function(a,o,r){$(e).closest('div.content').removeClass('loader');$(t).remove();doResponse(a,o,e)},error:function(a,o,i){$(e).closest('div.content').removeClass('loader');$(t).remove();var s;try{var r=jQuery.parseJSON(a.responseText);s=r.error+'/'+r.description+': '+r.reason}catch(n){s=a.responseText};notify('error',s)}});$(e).fadeIn()}};function doResponse(e,t,a){if(t!='success'){alert('Server error: '+t);return};$.each(e['notices'],function(t,e){var o=$('<div class="notice '+e.status+'"><div class="text">'+e.text+'</div></div>');if($(a).data('async')=='true')notifyBrowser(e.text);$.each(e.log,function(e,t){$(o).append('<div class="log">'+t+'</div>')});$('#noticebar').prepend(o);$(o).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});var r;if(e.status=='ok'){r=3;if($(a).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(a).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')}} -else{r=8};setTimeout(function(){$(o).fadeOut('slow').remove()},r*1000)});$.each(e['errors'],function(e,t){$('input[name='+t+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect;if(e.control.new_style)setUserStyle(e.control.new_style);if(e.control.refresh);else if(e.control.next_view);else if(e.errors.length==0)$(a).closest('div.panel').find('li.action.active').orLoadView()}; +/* ./modules//template-engine/components/html/form/form.min.js */;$(document).on('orViewLoaded',function(e,t){if($('div.panel form input[type=password]').length>0&&$('#uname').attr('value')!=''){$('div.panel form input[name=login_name] ').attr('value',$('#uname').attr('value'));$('div.panel form input[name=login_password]').attr('value',$('#upassword').attr('value'))};$(e.target).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){$(this).closest('form').submit()});$(e.target).find('input.submit.cancel').click(function(){});$(e.target).find('form').submit(function(e){if($(this).data('target')=='view'){formSubmit($(this));e.preventDefault()}})});function formSubmit(e){var a=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(a);$(a).show();$(e).find('.error').removeClass('error');var o=$(e).serializeArray(),t={};$(o).each(function(e,a){t[a.name]=a.value});var i=$(e).attr('method').toUpperCase();if(i=='GET'){Workbench.loadViewIntoElement($(e).parent('.view'),t.action,t.subaction,t.id,t)} +else{var r='./api/';$(e).closest('div.content').addClass('loader');r+='?output=json';o['output']='json';if($(e).data('async')||$(e).data('async')=='true'){$('#dialog > .view').html('');$('#dialog').removeClass('is-open').addClass('is-closed')};$.ajax({'type':'POST',url:r,data:o,success:function(t,o,r){$(e).closest('div.content').removeClass('loader');$(a).remove();doResponse(t,o,e)},error:function(t,o,s){$(e).closest('div.content').removeClass('loader');$(a).remove();var i;try{var r=jQuery.parseJSON(t.responseText);i=r.error+'/'+r.description+': '+r.reason}catch(n){i=t.responseText};notify('error',i)}});$(e).fadeIn()}};function doResponse(e,t,a){if(t!='success'){alert('Server error: '+t);return};$.each(e['notices'],function(t,e){var o=$('<div class="notice '+e.status+'"><div class="text">'+e.text+'</div></div>');if($(a).data('async')=='true')notifyBrowser(e.text);$.each(e.log,function(e,t){$(o).append('<div class="log">'+t+'</div>')});$('#noticebar').prepend(o);$(o).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});var r;if(e.status=='ok'){r=3;if($(a).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(a).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')}} +else{r=8};setTimeout(function(){$(o).fadeOut('slow').remove()},r*1000)});$.each(e['errors'],function(e,t){$('input[name='+t+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect}; /* ./modules//template-engine/components/html/upload/upload.min.js */;$(document).on('orViewLoaded',function(e,n){var t=$(e.target).find('form'),o=$(e.target).find('div.filedropzone > div.input');o.on('dragenter',function(e){e.stopPropagation();e.preventDefault();$(this).css('border','1px dotted gray')});o.on('dragover',function(e){e.stopPropagation();e.preventDefault()});o.on('drop',function(e){$(this).css('border','1px dotted red');e.preventDefault();var n=e.originalEvent.dataTransfer.files;handleFileUpload(t,n)});$(e.target).find('input[type=file]').change(function(){var e=$(this).prop('files');handleFileUpload(t,e)})});function handleFileUpload(e,o){for(var a=0,r;r=o[a];a++){var n=new FormData();n.append('file',r);n.append('action','folder');n.append('subaction','createfile');n.append('output','json');n.append('token',$(e).find('input[name=token]').val());n.append('id',$(e).find('input[name=id]').val());var t=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(t);$(t).show();$.ajax({'type':'POST',url:'./api/',cache:!1,contentType:!1,processData:!1,data:n,success:function(n,o,a){$(t).remove();doResponse(n,o,e)},error:function(n,o,i){$(e).closest('div.content').removeClass('loader');$(t).remove();var r;try{var a=jQuery.parseJSON(n.responseText);r=a.error+'/'+a.description+': '+a.reason}catch(d){r=n.responseText};notify('error',r)}})}}; /* ./modules//template-engine/components/html/tree/tree.min.js */;$(document).on('orViewLoaded',function(o,n){}); -/* ./modules/cms-ui/themes/default/script/openrat.min.js */;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(e){if(e.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}});$('#noticebar .notice').fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});registerOpenClose($('section.toggle-open-close'));$('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)Workbench.loadNewActionIntoElement(e)})});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);filterMenus(e.action,e.id,e.data)}};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,a){var n={action:e,method:t,id:i,data:a};this.navigateToNew(n)};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.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.loadNewAction(e.action,e.id,e.data)};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();$('#workbench section.open .view-loader').each(function(e){var t=$(this);Workbench.loadNewActionIntoElement(t)});filterMenus(e,t,i)};this.loadNewActionIntoElement=function(e){var t=$('#editor').attr('data-action'),i=$('#editor').attr('data-id'),a=$('#editor').attr('data-extra'),n=e.data('method');Workbench.loadViewIntoElement(e,t,n,i,a)};this.loadViewIntoElement=function(e,t,i,a,n){var o=createUrl(t,i,a,n,!0);e.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(t,i,a){e.fadeTo(350,1);$(e).removeClass('loader');if(i=='error'){$(e).html('');notify('error',t);return};afterViewLoaded(e)})}};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(e,t,i,a,n){Navigator.navigateToNewAction(t,i,a,n)};function afterViewLoaded(e){var t=$(e).closest('section'),i=$(e).children().length>0;t.toggleClass('disabled',!i);$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).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,i,a){var n=$(e).parent();$(n).find('input[type=text]').attr('value',t);$(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(e,t){var i=t.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()}});$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('select.theme-chooser').change(function(){setUserStyle(this.value)})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.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(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(e,i,t)}})};function startDialog(e,t,i,a,n){if(!t)t=$('#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" />'+e+'</div>');$('div#dialog > .view').data('id',a);$('div#dialog').removeClass('is-closed').addClass('is-open');Workbench.loadViewIntoElement($('div#dialog > .view'),t,i,a,n)};function modalView(e,t){var i=$(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'),i,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,t,i,a){$('nav').removeClass('open');setTitle(e);setNewAction(t,i,a)};function filterMenus(e,t,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+e).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',e);$('div.clickable.filtered a').attr('data-id',t);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(e,t,i){Navigator.navigateToNewAction(e,'edit',t,i)};function setNewId(e){};function notifyBrowser(e){if(!('Notification' in window)){return} +/* ./modules/cms-ui/themes/default/script/openrat.min.js */;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(e){if(e.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}});$('#noticebar .notice').fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});registerOpenClose($('section.toggle-open-close'));$('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)Workbench.loadNewActionIntoElement(e)})});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);filterMenus(e.action,e.id,e.data)}};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,n){var a={action:e,method:t,id:i,data:n};this.navigateToNew(a)};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.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.loadNewAction(e.action,e.id,e.data)};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();$('#workbench section.open .view-loader').each(function(e){var t=$(this);Workbench.loadNewActionIntoElement(t)});filterMenus(e,t,i)};this.loadNewActionIntoElement=function(e){var t=$('#editor').attr('data-action'),i=$('#editor').attr('data-id'),n=$('#editor').attr('data-extra'),a=e.data('method');Workbench.loadViewIntoElement(e,t,a,i,n)};this.loadViewIntoElement=function(e,t,i,n,a){var o=createUrl(t,i,n,a,!0);e.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(t,i,n){e.fadeTo(350,1);$(e).removeClass('loader');if(i=='error'){$(e).html('');notify('error',t);return};afterViewLoaded(e)})}};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(e,t,i,n,a){Navigator.navigateToNewAction(t,i,n,a)};function afterViewLoaded(e){var t=$(e).closest('section'),i=$(e).children().length>0;t.toggleClass('disabled',!i);$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).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,i,n){var a=$(e).parent();$(a).find('input[type=text]').attr('value',t);$(a).find('input[type=hidden]').attr('value',n)}})});$('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(e,t){var i=t.draggable,n=$(this).parent();startDialog($(this).text(),$(i).attr('data-type'),'copy',$(n).attr('data-id'),{'action':$(i).attr('data-type'),'subaction':'copy','id':$(i).attr('data-id'),'targetFolderId':$(n).attr('data-id')});$(i).detach().css({top:0,left:0}).appendTo(n).click()}});$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('select.theme-chooser').change(function(){setUserStyle(this.value)})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.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(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,n){$('div.panel div.status div.loader').html('&nbsp;');doResponse(e,i,t)}})};function startDialog(e,t,i,n,a){if(!t)t=$('#editor').attr('data-action');n=$('#editor').attr('data-id');$('div#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+i+'.png" />'+e+'</div>');$('div#dialog > .view').data('id',n);$('div#dialog').removeClass('is-closed').addClass('is-open');Workbench.loadViewIntoElement($('div#dialog > .view'),t,i,n,a)};function modalView(e,t){alert('modalView() called');return};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,i,n){$('nav').removeClass('open');setTitle(e);setNewAction(t,i,n)};function filterMenus(e,t,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+e).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',e);$('div.clickable.filtered a').attr('data-id',t);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(e,t,i){Navigator.navigateToNewAction(e,'edit',t,i)};function setNewId(e){};function notifyBrowser(e){if(!('Notification' in window)){return} else if(Notification.permission==='granted'){var t=new Notification(e)} -else if(Notification.permission!=='denied'){Notification.requestPermission(function(t){if(t==='granted'){var i=new Notification(e)}})}};function setUserStyle(e){var t=$('html'),i=t.attr('class').split(/\s+/);$.each(i,function(e,i){if(i.startsWith('theme-')){t.removeClass(i)}});t.addClass('theme-'+e.toLowerCase())};function insert(e,t,i){var a=document.forms[0].elements[e];a.focus();if(typeof document.selection!='undefined'){var c=document.selection.createRange(),n=c.text;c.text=t+n+i;c=document.selection.createRange();if(n.length==0){c.move('character',-i.length)} -else{c.moveStart('character',t.length+n.length+i.length)};c.select()} -else if(typeof a.selectionStart!='undefined'){var r=a.selectionStart,l=a.selectionEnd,n=a.value.substring(r,l);a.value=a.value.substr(0,r)+t+n+i+a.value.substr(l);var o;if(n.length==0){o=r+t.length} -else{o=r+t.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)+t+n+i+a.value.substr(o)}};function createUrl(e,t,i,a,o){var n='./';n+='?action='+e;if(t!=null)n+='&subaction='+t;n+='&id='+i;if(o)n+='&embed=1';if(typeof a==='string'){a=a.replace(/'/g,'"');var c=jQuery.parseJSON(a);jQuery.each(c,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;n=n+'&'+e+'='+t})} -else if(typeof a==='object'){jQuery.each(a,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;n=n+'&'+e+'='+t})} -else{};return n};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){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(t+a+'/'+n+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t){var i=$('<div class="notice '+e+'"><div class="text">'+t+'</div></div>');$('#noticebar').prepend(i);$(i).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})})};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};- \ No newline at end of file +else if(Notification.permission!=='denied'){Notification.requestPermission(function(t){if(t==='granted'){var i=new Notification(e)}})}};function setUserStyle(e){var t=$('html'),i=t.attr('class').split(/\s+/);$.each(i,function(e,i){if(i.startsWith('theme-')){t.removeClass(i)}});t.addClass('theme-'+e.toLowerCase())};function insert(e,t,i){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var r=document.selection.createRange(),a=r.text;r.text=t+a+i;r=document.selection.createRange();if(a.length==0){r.move('character',-i.length)} +else{r.moveStart('character',t.length+a.length+i.length)};r.select()} +else if(typeof n.selectionStart!='undefined'){var c=n.selectionStart,l=n.selectionEnd,a=n.value.substring(c,l);n.value=n.value.substr(0,c)+t+a+i+n.value.substr(l);var o;if(a.length==0){o=c+t.length} +else{o=c+t.length+a.length+i.length};n.selectionStart=o;n.selectionEnd=o} +else{o=n.value.length;var a=prompt('Text');n.value=n.value.substr(0,o)+t+a+i+n.value.substr(o)}};function createUrl(e,t,i,n,o){var a='./';a+='?action='+e;if(t!=null)a+='&subaction='+t;a+='&id='+i;if(o)a+='&embed=1';if(typeof n==='string'){n=n.replace(/'/g,'"');var r=jQuery.parseJSON(n);jQuery.each(r,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;a=a+'&'+e+'='+t})} +else if(typeof n==='object'){jQuery.each(n,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;a=a+'&'+e+'='+t})} +else{};return a};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){var n=$(e).closest('div.panel').find('li.action.active').attr('data-action'),a=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+n+'/'+a+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t){var i=$('<div class="notice '+e+'"><div class="text">'+t+'</div></div>');$('#noticebar').prepend(i);$(i).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})})};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/script/openrat.js b/modules/cms-ui/themes/default/script/openrat.js @@ -514,12 +514,15 @@ function startDialog( name,action,method,id,params ) */ function modalView( element,view ) { + alert('modalView() called'); + return; + /* var action = $(element).closest('div.panel').find('li.active').attr('data-action'); var method = $(element).closest('div.panel').find('li.active').attr('data-method'); var id = $(element).closest('div.panel').find('li.active').attr('data-id' ); $(element).closest('div.content').modal( { "overlayClose":"true","xxxonClose":function(){alert("close)");} } ); loadView( $(element).closest('div.content'), action, method,id ); - + */ // 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,10 +1,10 @@ -;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(e){if(e.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}});$('#noticebar .notice').fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});registerOpenClose($('section.toggle-open-close'));$('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)Workbench.loadNewActionIntoElement(e)})});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);filterMenus(e.action,e.id,e.data)}};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,a){var n={action:e,method:t,id:i,data:a};this.navigateToNew(n)};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.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.loadNewAction(e.action,e.id,e.data)};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();$('#workbench section.open .view-loader').each(function(e){var t=$(this);Workbench.loadNewActionIntoElement(t)});filterMenus(e,t,i)};this.loadNewActionIntoElement=function(e){var t=$('#editor').attr('data-action'),i=$('#editor').attr('data-id'),a=$('#editor').attr('data-extra'),n=e.data('method');Workbench.loadViewIntoElement(e,t,n,i,a)};this.loadViewIntoElement=function(e,t,i,a,n){var o=createUrl(t,i,a,n,!0);e.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(t,i,a){e.fadeTo(350,1);$(e).removeClass('loader');if(i=='error'){$(e).html('');notify('error',t);return};afterViewLoaded(e)})}};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(e,t,i,a,n){Navigator.navigateToNewAction(t,i,a,n)};function afterViewLoaded(e){var t=$(e).closest('section'),i=$(e).children().length>0;t.toggleClass('disabled',!i);$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).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,i,a){var n=$(e).parent();$(n).find('input[type=text]').attr('value',t);$(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(e,t){var i=t.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()}});$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('select.theme-chooser').change(function(){setUserStyle(this.value)})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.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(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(e,i,t)}})};function startDialog(e,t,i,a,n){if(!t)t=$('#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" />'+e+'</div>');$('div#dialog > .view').data('id',a);$('div#dialog').removeClass('is-closed').addClass('is-open');Workbench.loadViewIntoElement($('div#dialog > .view'),t,i,a,n)};function modalView(e,t){var i=$(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'),i,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,t,i,a){$('nav').removeClass('open');setTitle(e);setNewAction(t,i,a)};function filterMenus(e,t,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+e).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',e);$('div.clickable.filtered a').attr('data-id',t);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(e,t,i){Navigator.navigateToNewAction(e,'edit',t,i)};function setNewId(e){};function notifyBrowser(e){if(!('Notification' in window)){return} +;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(e){if(e.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}});$('#noticebar .notice').fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});registerOpenClose($('section.toggle-open-close'));$('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)Workbench.loadNewActionIntoElement(e)})});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);filterMenus(e.action,e.id,e.data)}};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,n){var a={action:e,method:t,id:i,data:n};this.navigateToNew(a)};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.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.loadNewAction(e.action,e.id,e.data)};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();$('#workbench section.open .view-loader').each(function(e){var t=$(this);Workbench.loadNewActionIntoElement(t)});filterMenus(e,t,i)};this.loadNewActionIntoElement=function(e){var t=$('#editor').attr('data-action'),i=$('#editor').attr('data-id'),n=$('#editor').attr('data-extra'),a=e.data('method');Workbench.loadViewIntoElement(e,t,a,i,n)};this.loadViewIntoElement=function(e,t,i,n,a){var o=createUrl(t,i,n,a,!0);e.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(t,i,n){e.fadeTo(350,1);$(e).removeClass('loader');if(i=='error'){$(e).html('');notify('error',t);return};afterViewLoaded(e)})}};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(e,t,i,n,a){Navigator.navigateToNewAction(t,i,n,a)};function afterViewLoaded(e){var t=$(e).closest('section'),i=$(e).children().length>0;t.toggleClass('disabled',!i);$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).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,i,n){var a=$(e).parent();$(a).find('input[type=text]').attr('value',t);$(a).find('input[type=hidden]').attr('value',n)}})});$('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(e,t){var i=t.draggable,n=$(this).parent();startDialog($(this).text(),$(i).attr('data-type'),'copy',$(n).attr('data-id'),{'action':$(i).attr('data-type'),'subaction':'copy','id':$(i).attr('data-id'),'targetFolderId':$(n).attr('data-id')});$(i).detach().css({top:0,left:0}).appendTo(n).click()}});$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('select.theme-chooser').change(function(){setUserStyle(this.value)})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.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(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,n){$('div.panel div.status div.loader').html('&nbsp;');doResponse(e,i,t)}})};function startDialog(e,t,i,n,a){if(!t)t=$('#editor').attr('data-action');n=$('#editor').attr('data-id');$('div#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+i+'.png" />'+e+'</div>');$('div#dialog > .view').data('id',n);$('div#dialog').removeClass('is-closed').addClass('is-open');Workbench.loadViewIntoElement($('div#dialog > .view'),t,i,n,a)};function modalView(e,t){alert('modalView() called');return};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,i,n){$('nav').removeClass('open');setTitle(e);setNewAction(t,i,n)};function filterMenus(e,t,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+e).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',e);$('div.clickable.filtered a').attr('data-id',t);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(e,t,i){Navigator.navigateToNewAction(e,'edit',t,i)};function setNewId(e){};function notifyBrowser(e){if(!('Notification' in window)){return} else if(Notification.permission==='granted'){var t=new Notification(e)} -else if(Notification.permission!=='denied'){Notification.requestPermission(function(t){if(t==='granted'){var i=new Notification(e)}})}};function setUserStyle(e){var t=$('html'),i=t.attr('class').split(/\s+/);$.each(i,function(e,i){if(i.startsWith('theme-')){t.removeClass(i)}});t.addClass('theme-'+e.toLowerCase())};function insert(e,t,i){var a=document.forms[0].elements[e];a.focus();if(typeof document.selection!='undefined'){var c=document.selection.createRange(),n=c.text;c.text=t+n+i;c=document.selection.createRange();if(n.length==0){c.move('character',-i.length)} -else{c.moveStart('character',t.length+n.length+i.length)};c.select()} -else if(typeof a.selectionStart!='undefined'){var r=a.selectionStart,l=a.selectionEnd,n=a.value.substring(r,l);a.value=a.value.substr(0,r)+t+n+i+a.value.substr(l);var o;if(n.length==0){o=r+t.length} -else{o=r+t.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)+t+n+i+a.value.substr(o)}};function createUrl(e,t,i,a,o){var n='./';n+='?action='+e;if(t!=null)n+='&subaction='+t;n+='&id='+i;if(o)n+='&embed=1';if(typeof a==='string'){a=a.replace(/'/g,'"');var c=jQuery.parseJSON(a);jQuery.each(c,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;n=n+'&'+e+'='+t})} -else if(typeof a==='object'){jQuery.each(a,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;n=n+'&'+e+'='+t})} -else{};return n};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){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(t+a+'/'+n+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t){var i=$('<div class="notice '+e+'"><div class="text">'+t+'</div></div>');$('#noticebar').prepend(i);$(i).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})})};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};- \ No newline at end of file +else if(Notification.permission!=='denied'){Notification.requestPermission(function(t){if(t==='granted'){var i=new Notification(e)}})}};function setUserStyle(e){var t=$('html'),i=t.attr('class').split(/\s+/);$.each(i,function(e,i){if(i.startsWith('theme-')){t.removeClass(i)}});t.addClass('theme-'+e.toLowerCase())};function insert(e,t,i){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var r=document.selection.createRange(),a=r.text;r.text=t+a+i;r=document.selection.createRange();if(a.length==0){r.move('character',-i.length)} +else{r.moveStart('character',t.length+a.length+i.length)};r.select()} +else if(typeof n.selectionStart!='undefined'){var c=n.selectionStart,l=n.selectionEnd,a=n.value.substring(c,l);n.value=n.value.substr(0,c)+t+a+i+n.value.substr(l);var o;if(a.length==0){o=c+t.length} +else{o=c+t.length+a.length+i.length};n.selectionStart=o;n.selectionEnd=o} +else{o=n.value.length;var a=prompt('Text');n.value=n.value.substr(0,o)+t+a+i+n.value.substr(o)}};function createUrl(e,t,i,n,o){var a='./';a+='?action='+e;if(t!=null)a+='&subaction='+t;a+='&id='+i;if(o)a+='&embed=1';if(typeof n==='string'){n=n.replace(/'/g,'"');var r=jQuery.parseJSON(n);jQuery.each(r,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;a=a+'&'+e+'='+t})} +else if(typeof n==='object'){jQuery.each(n,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;a=a+'&'+e+'='+t})} +else{};return a};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){var n=$(e).closest('div.panel').find('li.action.active').attr('data-action'),a=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+n+'/'+a+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t){var i=$('<div class="notice '+e+'"><div class="text">'+t+'</div></div>');$('#noticebar').prepend(i);$(i).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})})};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};+ \ No newline at end of file diff --git a/modules/template-engine/components/html/form/form.js b/modules/template-engine/components/html/form/form.js @@ -76,17 +76,18 @@ function formSubmit(form) $(form).find('.error').removeClass('error'); var params = $(form).serializeArray(); + var data = {}; + $(params).each(function(index, obj){ + data[obj.name] = obj.value; + }); var formMethod = $(form).attr('method').toUpperCase(); if ( formMethod == 'GET' ) { - // GET-Request - var action = $(form).data('action'); - var method = $(form).data('method'); - var id = $(form).data('id' ); - - loadView( $(form).closest('div.content'),action,method,id,params); + // Mehrseitiges Formular + // Die eingegebenen Formulardaten werden zur nächsten Action geschickt. + Workbench.loadViewIntoElement( $(form).parent('.view'),data.action, data.subaction,data.id,data ); } else { @@ -228,24 +229,24 @@ function doResponse(data,status,element) if ( data.control.redirect ) // Redirect window.location.href = data.control.redirect; - + + /* nein, das ist Dialoglogik. if ( data.control.new_style ) // CSS-Datei setzen setUserStyle( data.control.new_style ); - - if ( data.control.refresh ) - // Views aktualisieren - ; //refreshAll(); - + */ + +/* nein, das ist Dialoglogik. + else if ( data.control.next_view ) // Nächste View aufrufen //startView( $(element).closest('div.content'),data.control.next_view ); ; // Views gibt es so nicht mehr. Rauswerfen? - - else if ( data.errors.length==0 ) +*/ + //if ( data.errors.length==0 ) // Aktuelle View neu laden - $(element).closest('div.panel').find('li.action.active').orLoadView(); + // $(element).closest('div.panel').find('li.action.active').orLoadView(); } diff --git a/modules/template-engine/components/html/form/form.min.js b/modules/template-engine/components/html/form/form.min.js @@ -1,3 +1,3 @@ -;$(document).on('orViewLoaded',function(e,t){if($('div.panel form input[type=password]').length>0&&$('#uname').attr('value')!=''){$('div.panel form input[name=login_name] ').attr('value',$('#uname').attr('value'));$('div.panel form input[name=login_password]').attr('value',$('#upassword').attr('value'))};$(e.target).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){$(this).closest('form').submit()});$(e.target).find('input.submit.cancel').click(function(){});$(e.target).find('form').submit(function(e){if($(this).data('target')=='view'){formSubmit($(this));e.preventDefault()}})});function formSubmit(e){var t=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(t);$(t).show();$(e).find('.error').removeClass('error');var a=$(e).serializeArray(),n=$(e).attr('method').toUpperCase();if(n=='GET'){var r=$(e).data('action'),s=$(e).data('method'),i=$(e).data('id');loadView($(e).closest('div.content'),r,s,i,a)} -else{var o='./api/';$(e).closest('div.content').addClass('loader');o+='?output=json';a['output']='json';if($(e).data('async')||$(e).data('async')=='true'){$('#dialog > .view').html('');$('#dialog').removeClass('is-open').addClass('is-closed')};$.ajax({'type':'POST',url:o,data:a,success:function(a,o,r){$(e).closest('div.content').removeClass('loader');$(t).remove();doResponse(a,o,e)},error:function(a,o,i){$(e).closest('div.content').removeClass('loader');$(t).remove();var s;try{var r=jQuery.parseJSON(a.responseText);s=r.error+'/'+r.description+': '+r.reason}catch(n){s=a.responseText};notify('error',s)}});$(e).fadeIn()}};function doResponse(e,t,a){if(t!='success'){alert('Server error: '+t);return};$.each(e['notices'],function(t,e){var o=$('<div class="notice '+e.status+'"><div class="text">'+e.text+'</div></div>');if($(a).data('async')=='true')notifyBrowser(e.text);$.each(e.log,function(e,t){$(o).append('<div class="log">'+t+'</div>')});$('#noticebar').prepend(o);$(o).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});var r;if(e.status=='ok'){r=3;if($(a).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(a).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')}} -else{r=8};setTimeout(function(){$(o).fadeOut('slow').remove()},r*1000)});$.each(e['errors'],function(e,t){$('input[name='+t+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect;if(e.control.new_style)setUserStyle(e.control.new_style);if(e.control.refresh);else if(e.control.next_view);else if(e.errors.length==0)$(a).closest('div.panel').find('li.action.active').orLoadView()};- \ No newline at end of file +;$(document).on('orViewLoaded',function(e,t){if($('div.panel form input[type=password]').length>0&&$('#uname').attr('value')!=''){$('div.panel form input[name=login_name] ').attr('value',$('#uname').attr('value'));$('div.panel form input[name=login_password]').attr('value',$('#upassword').attr('value'))};$(e.target).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){$(this).closest('form').submit()});$(e.target).find('input.submit.cancel').click(function(){});$(e.target).find('form').submit(function(e){if($(this).data('target')=='view'){formSubmit($(this));e.preventDefault()}})});function formSubmit(e){var a=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(a);$(a).show();$(e).find('.error').removeClass('error');var o=$(e).serializeArray(),t={};$(o).each(function(e,a){t[a.name]=a.value});var i=$(e).attr('method').toUpperCase();if(i=='GET'){Workbench.loadViewIntoElement($(e).parent('.view'),t.action,t.subaction,t.id,t)} +else{var r='./api/';$(e).closest('div.content').addClass('loader');r+='?output=json';o['output']='json';if($(e).data('async')||$(e).data('async')=='true'){$('#dialog > .view').html('');$('#dialog').removeClass('is-open').addClass('is-closed')};$.ajax({'type':'POST',url:r,data:o,success:function(t,o,r){$(e).closest('div.content').removeClass('loader');$(a).remove();doResponse(t,o,e)},error:function(t,o,s){$(e).closest('div.content').removeClass('loader');$(a).remove();var i;try{var r=jQuery.parseJSON(t.responseText);i=r.error+'/'+r.description+': '+r.reason}catch(n){i=t.responseText};notify('error',i)}});$(e).fadeIn()}};function doResponse(e,t,a){if(t!='success'){alert('Server error: '+t);return};$.each(e['notices'],function(t,e){var o=$('<div class="notice '+e.status+'"><div class="text">'+e.text+'</div></div>');if($(a).data('async')=='true')notifyBrowser(e.text);$.each(e.log,function(e,t){$(o).append('<div class="log">'+t+'</div>')});$('#noticebar').prepend(o);$(o).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});var r;if(e.status=='ok'){r=3;if($(a).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(a).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')}} +else{r=8};setTimeout(function(){$(o).fadeOut('slow').remove()},r*1000)});$.each(e['errors'],function(e,t){$('input[name='+t+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect};+ \ No newline at end of file