openrat-cms

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

commit 8bbb3ba2b9ed87fc5a51cbb088a9b9e20b7ab873
parent f4773eeaccac5bac25e53812fb3f114fe6695830
Author: Jan Dankert <devnull@localhost>
Date:   Fri,  6 Jul 2018 00:24:39 +0200

Einfache Links sollen auch ein wirksames href-Attribut erhalten, damit das Öffnen in neuen Tabs klappt.

Diffstat:
modules/template-engine/components/html/form/form.js | 2+-
modules/template-engine/components/html/form/form.min.js | 4++--
modules/template-engine/components/html/link/Link.class.php | 4+++-
modules/template-engine/components/html/link/link.js | 11+++++++++--
modules/template-engine/components/html/link/link.min.js | 4++--
5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/modules/template-engine/components/html/form/form.js b/modules/template-engine/components/html/form/form.js @@ -223,7 +223,7 @@ function doResponse(data,status,element) if ( data.control.refresh ) // Views aktualisieren - refreshAll(); + ; //refreshAll(); else if ( data.control.next_view ) // Nächste View aufrufen 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.ok').click(function(){$(this).closest('form').submit()});$(e.target).find('input.submit.cancel').click(function(){});$(e.target).find('form').submit(function(e){formSubmit($(this));e.preventDefault()})});function formSubmit(e){if($('div.panel form input[type=password]').length>0){$('#uname').attr('value',$('div.panel form input[name=login_name]').attr('value'));$('#upassword').attr('value',$('div.panel form input[name=login_password]').attr('value'));$('#uname').closest('form').submit()};if($('#pageelement_edit_editor').length>0){var o=CKEDITOR.instances['pageelement_edit_editor'];if(o){var l=o.getData();$('#pageelement_edit_editor').html(l)}};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(),d=$(e).attr('method').toUpperCase();if(d=='GET'){var r=$(e).data('action'),n=$(e).data('method'),s=$(e).data('id');loadView($(e).closest('div.content'),r,n,s,a)} else{var i='./api/';$(e).closest('div.content').addClass('loader');i+='?output=json';a['output']='json';if($(e).data('async')||$(e).data('async')=='true'){$('div#dialog').html('').hide();$('div#filler').fadeOut(500)};$.ajax({'type':'POST',url:i,data:a,success:function(a,i,o){$(e).closest('div.content').removeClass('loader');$(t).remove();doResponse(a,i,e)},error:function(a,i,n){$(e).closest('div.content').removeClass('loader');$(t).remove();var r;try{var o=jQuery.parseJSON(a.responseText);r=o.error+'/'+o.description+': '+o.reason}catch(s){r=a.responseText};notify('error',r)}});$(e).fadeIn()}};function doResponse(e,t,a){if(t!='success'){alert('Server error: '+t);return};$.each(e['notices'],function(t,e){var i=$('<div class="notice '+e.status+'"><div class="text">'+e.text+'</div></div>');notifyBrowser(e.text);$.each(e.log,function(e,t){$(i).append('<div class="log">'+t+'</div>')});$('#noticebar').prepend(i);$(i).fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});var o;if(e.status=='ok'){o=3;if($(a).data('async')!='true'){$('div#dialog').html('').hide();$('div#filler').fadeOut(500);$(a).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')}} -else{o=8};setTimeout(function(){$(i).fadeOut('slow').remove()},o*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)refreshAll();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 +else{o=8};setTimeout(function(){$(i).fadeOut('slow').remove()},o*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 diff --git a/modules/template-engine/components/html/link/Link.class.php b/modules/template-engine/components/html/link/Link.class.php @@ -2,6 +2,8 @@ namespace template_engine\components; +use Html; + /** * Erzeugt einen HTML-Link. * @@ -156,7 +158,7 @@ class LinkComponent extends Component break; default: - echo ' href="' . 'javascript:void(0);' . '"'; + echo ' href="<?php echo Html::url('.$this->value($this->action).','.$this->value($this->subaction).','.$this->value($this->id).') ?>"'; } echo '>'; diff --git a/modules/template-engine/components/html/link/link.js b/modules/template-engine/components/html/link/link.js @@ -1,7 +1,10 @@ $(document).on('orViewLoaded',function(event, data) { // Links aktivieren... - $(event.target).closest('div.panel').find('.clickable').orLinkify(); + $(event.target).find('.clickable').orLinkify(); + $(event.target).find('.clickable a').click( function(event) { + event.preventDefault(); + } ); }); @@ -10,7 +13,11 @@ $(document).on('orHeaderLoaded',function(event, data) { // Links aktivieren... $('#title .clickable').orLinkify(); - + + $(event.target).find('.clickable a').click( function(event) { + event.preventDefault(); + } ); + }); diff --git a/modules/template-engine/components/html/link/link.min.js b/modules/template-engine/components/html/link/link.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(e,n){$(e.target).closest('div.panel').find('.clickable').orLinkify()});$(document).on('orHeaderLoaded',function(e,n){$('#title .clickable').orLinkify()});function submitLink(e,n){var i=jQuery.parseJSON(n),o='./api/';i.output='json';$.ajax({'type':'POST',url:o,data:i,success:function(n,i,o){$('div.panel div.status div.loader').html('&nbsp;');doResponse(n,i,e)}})};- \ No newline at end of file +;$(document).on('orViewLoaded',function(e,n){$(e.target).find('.clickable').orLinkify();$(e.target).find('.clickable a').click(function(e){e.preventDefault()})});$(document).on('orHeaderLoaded',function(e,n){$('#title .clickable').orLinkify();$(e.target).find('.clickable a').click(function(e){e.preventDefault()})});function submitLink(e,n){var t=jQuery.parseJSON(n),i='./api/';t.output='json';$.ajax({'type':'POST',url:i,data:t,success:function(n,t,i){$('div.panel div.status div.loader').html('&nbsp;');doResponse(n,t,e)}})};+ \ No newline at end of file