File modules/cms/ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js
Last commit: Fri Feb 11 01:28:51 2022 +0100 dankert Fixed some UI problems: The dialogs are now closed after submitting the data; Workbench is reloaded after login/logout.
1 import $ from "../jquery-global.min.js"; 2 import Workbench from "../openrat/workbench.min.js"; 3 import Api from "../openrat/api.min.js"; 4 export default function( options ) 5 { 6 var settings = $.extend( { 7 'openAction' : function(name,action,id) { 8 Workbench.getInstance().openNewAction( name,action,id ); 9 } 10 }, options); 11 $(this).addClass('linkified'); 12 if ( $(this).is('a') ) 13 $(this).addClass('act-prevented-link').click( function(event) { 14 event.preventDefault(); 15 } ); 16 else 17 $(this).find('a').addClass('act-prevented-sublink').click( function(event) { 18 event.preventDefault(); 19 } ); 20 return $(this).click(function(event) 21 { 22 let $el = $(this); 23 let $link; 24 if ( $el.is('a') ) 25 $link = $el; 26 else 27 $link = $el.find('a').first(); 28 let type = $link.attr('data-type'); 29 if ( $link.parent().hasClass('dropdown-entry--inactive') ) 30 return; 31 switch( type ) 32 { 33 case 'post': 34 let api = new Api(); 35 let formData = new FormData(); 36 let params = JSON.parse( $link.attr('data-data') ); 37 params.output = 'json'; 38 Object.keys( params ).forEach( (key) => { 39 formData.append( key, params[key] ); 40 } ); 41 if (!formData.get('id') ) 42 formData.set('id',Workbench.state.id); 43 if (!formData.get('action') ) 44 formData.set('action',Workbench.state.action); 45 api.sendData( formData ); 46 if ( $link.data('afterSuccess') === 'reload' ) 47 Workbench.getInstance().reloadViews(); 48 if ( $link.data('afterSuccess') === 'reloadAll' ) 49 Workbench.getInstance().reloadAll(); 50 break; 51 case 'edit': 52 case 'dialog': 53 let dialog = Workbench.getInstance().createDialog(); 54 let name = $link.attr('data-name'); 55 if ( !name ) 56 name = $link.text(); 57 let extraValue = Workbench.htmlDecode($link.attr('data-extra')); 58 let extraData = JSON.parse(extraValue); 59 dialog.start(name,$link.attr('data-action'),$link.attr('data-method'),$link.attr('data-id'),extraData ); 60 break; 61 case 'external': 62 window.open( $link.attr('data-url'),' _blank' ); 63 break; 64 case 'window': 65 window.location.href = View.createUrl($link.attr('data-action'), $link.attr('data-method'), $link.attr('data-id')); 66 break; 67 case 'popup': 68 Workbench.popupWindow = window.open( $link.attr('data-url'), 'Popup', 'location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes'); 69 break; 70 case 'help': 71 help($link,$link.attr('data-url'),$link.attr('data-suffix') ); 72 break; 73 case 'fullscreen': 74 fullscreen($link); 75 break; 76 case 'open': 77 settings.openAction( $link.text().trim(),$link.attr('data-action'),$link.attr('data-id') ); 78 break; 79 default: 80 throw "UI error: Unknown link type: "+type+" in link "+$link.html(); 81 } 82 }); 83 };
Downloadmodules/cms/ui/themes/default/script/plugin/jquery-plugin-orLinkify.min.js
History Fri, 11 Feb 2022 01:28:51 +0100 dankert Fixed some UI problems: The dialogs are now closed after submitting the data; Workbench is reloaded after login/logout. Sun, 6 Feb 2022 22:06:09 +0100 dankert Refactoring: Ommit unnecessary parameters. Sat, 18 Dec 2021 03:47:23 +0100 dankert New: Every ES6-Module should have a minified version for performance reasons. Bad: The Minifier "Jsqueeze" is unable to minify ES6-modules, so we had to implement a simple JS-Minifier which strips out all comments. Fri, 21 Aug 2020 00:22:13 +0200 Jan Dankert Refactoring: Collect all frontend compiler scripts in update.php. Compiling of CSS and JS was extracted to a new TemplateCompiler. JS and CSS is now collected in a new openrat.[min.][js|css]. Sun, 23 Feb 2020 04:01:30 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 1: moving.