openrat-cms

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

commit 68af186a1500f72c54d7651ae99a4636eff39cc2
parent 723bef24e81f6a137273d0701c0af975c91adbc4
Author: Jan Dankert <devnull@localhost>
Date:   Thu, 10 Jan 2019 22:27:13 +0100

Fix: Reihenfolge von Ordner-Inhalten lässt sich jetzt wieder setzen.

Diffstat:
modules/cms-ui/themes/default/html/views/folder/order.php | 76++++++++++++++++++++++++++++++----------------------------------------------
modules/cms-ui/themes/default/html/views/folder/order.tpl.src.xml | 78+++++++++++++++++++++++++++++++++---------------------------------------------
modules/cms-ui/themes/default/production/combined.min.js | 2+-
modules/cms-ui/themes/default/script/jquery.mjs.nestedSortable.js | 427-------------------------------------------------------------------------------
modules/cms-ui/themes/default/script/jquery.mjs.nestedSortable.min.js | 427-------------------------------------------------------------------------------
modules/template-engine/components/html/table/table.js | 52++++++++++++++++++++--------------------------------
modules/template-engine/components/html/table/table.min.js | 4++--
7 files changed, 86 insertions(+), 980 deletions(-)

diff --git a/modules/cms-ui/themes/default/html/views/folder/order.php b/modules/cms-ui/themes/default/html/views/folder/order.php @@ -1,57 +1,41 @@ - - - <input type="hidden" name="token" value="<?php echo $token ?>"/> - - <div class="table-wrapper"><div class="table-filter"><input type="search" name="filter" placeholder="<?php echo lang('SEARCH_FILTER') ?>" /></div><table class="sortable" width="100%"></div> - <tr class="headline"> - <td class="help clickable"> - <a title="<?php echo lang('FOLDER_FLIP') ?>" target="_self" data-type="post" data-action="folder" data-method="reorder" data-id="<?php echo OR_ID ?>" data-extra="{'type':'flip'}" data-data="{&quot;action&quot;:&quot;folder&quot;,&quot;subaction&quot;:&quot;reorder&quot;,&quot;id&quot;:&quot;<?php echo OR_ID ?>&quot;,&quot;token&quot;:&quot;<?php echo token() ?>&quot;,&quot;type&quot;:&quot;flip&quot;,&quot;none&quot;:&quot;0&quot;}"> + <form name="" target="_self" data-target="view" action="./" data-method="order" data-action="folder" data-id="<?php echo OR_ID ?>" method="POST" enctype="application/x-www-form-urlencoded" class="or-form folder" data-async="" data-autosave=""><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="folder" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="order" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" /> + <div class="table-wrapper"><div class="table-filter"><input type="search" name="filter" placeholder="<?php echo lang('SEARCH_FILTER') ?>" /></div><table class="or-table--sortable" width="100%"></div> + <tr class="headline"> + <td class="help clickable"> <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'FOLDER_ORDER'.'')))); ?></span> - </a> - - </td> - <td class="help clickable"> - <a title="<?php echo lang('FOLDER_ORDERBYTYPE') ?>" target="_self" data-type="post" data-action="folder" data-method="reorder" data-id="<?php echo OR_ID ?>" data-extra="{'type':'type'}" data-data="{&quot;action&quot;:&quot;folder&quot;,&quot;subaction&quot;:&quot;reorder&quot;,&quot;id&quot;:&quot;<?php echo OR_ID ?>&quot;,&quot;token&quot;:&quot;<?php echo token() ?>&quot;,&quot;type&quot;:&quot;type&quot;,&quot;none&quot;:&quot;0&quot;}"> - <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'GLOBAL_TYPE'.'')))); ?></span> - - </a> - - </td> - <td class="help clickable"> - <a title="<?php echo lang('FOLDER_ORDERBYNAME') ?>" target="_self" data-type="post" data-action="folder" data-method="reorder" data-id="<?php echo OR_ID ?>" data-extra="{'type':'name'}" data-data="{&quot;action&quot;:&quot;folder&quot;,&quot;subaction&quot;:&quot;reorder&quot;,&quot;id&quot;:&quot;<?php echo OR_ID ?>&quot;,&quot;token&quot;:&quot;<?php echo token() ?>&quot;,&quot;type&quot;:&quot;name&quot;,&quot;none&quot;:&quot;0&quot;}"> - <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'GLOBAL_NAME'.'')))); ?></span> - - </a> - - </td> - <td class="help clickable"> - <a title="<?php echo lang('FOLDER_ORDERBYLASTCHANGE') ?>" target="_self" data-type="post" data-action="folder" data-method="reorder" data-id="<?php echo OR_ID ?>" data-extra="{'type':'lastchange'}" data-data="{&quot;action&quot;:&quot;folder&quot;,&quot;subaction&quot;:&quot;reorder&quot;,&quot;id&quot;:&quot;<?php echo OR_ID ?>&quot;,&quot;token&quot;:&quot;<?php echo token() ?>&quot;,&quot;type&quot;:&quot;lastchange&quot;,&quot;none&quot;:&quot;0&quot;}"> - <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'GLOBAL_LASTCHANGE'.'')))); ?></span> - - </a> - - </td> - </tr> - <?php foreach($object as $list_key=>$list_value){ ?><?php extract($list_value) ?> - <tr class="data" data-id="<?php echo $id ?>"> - <td> - <span><?php echo nl2br('&nbsp;'); ?></span> - </td> - <td colspan="2"> - <img src="./modules/cms-ui/themes/default/images/icon_<?php echo $icon ?>.png" /> - - <span><?php echo nl2br(encodeHtml(htmlentities($name))); ?></span> + <td class="help clickable"> + <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'GLOBAL_NAME'.'')))); ?></span> </td> - <td> - <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($date) ?> + <td class="help clickable"> + <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'GLOBAL_LASTCHANGE'.'')))); ?></span> </td> </tr> - <?php } ?> - </table> + <?php foreach($object as $list_key=>$list_value){ ?><?php extract($list_value) ?> + <tr class="data" data-id="<?php echo $id ?>"> + <td> + <span><?php echo nl2br('&nbsp;'); ?></span> + + </td> + <td> + <img src="./modules/cms-ui/themes/default/images/icon_<?php echo $icon ?>.png" /> + + <span><?php echo nl2br(encodeHtml(htmlentities($name))); ?></span> + + </td> + <td> + <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($date) ?> + + </td> + </tr> + <?php } ?> + </table> + <input type="hidden" name="order" value=""/> + + <div class="or-form-actionbar"><input type="submit" class="or-form-btn or-form-btn--primary" value="OK" /></div></form> \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/folder/order.tpl.src.xml b/modules/cms-ui/themes/default/html/views/folder/order.tpl.src.xml @@ -1,47 +1,35 @@ <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"> - <header back="true"></header> - <hidden name="token" /> - <table class="sortable"> - <row class="headline"> - <column class="help clickable"> - <link type="post" action="folder" subaction="reorder" var1="type" - value1="flip" title="message:FOLDER_FLIP"> - <text key="FOLDER_ORDER"></text> - </link> - </column> - <column class="help clickable"> - <link type="post" action="folder" subaction="reorder" var1="type" - value1="type" title="message:FOLDER_ORDERBYTYPE"> - <text key="GLOBAL_TYPE"></text> - </link> - </column> - <column class="help clickable"> - <link type="post" action="folder" subaction="reorder" var1="type" - value1="name" title="message:FOLDER_ORDERBYNAME"> - <text key="GLOBAL_NAME"></text> - </link> - </column> - <column class="help clickable"> - <link type="post" action="folder" subaction="reorder" var1="type" - value1="lastchange" title="message:FOLDER_ORDERBYLASTCHANGE"> - <text key="GLOBAL_LASTCHANGE"></text> - </link> - </column> - </row> - <list list="object" extract="true"> - <row class="data" id="var:id"> - <column> - <text raw="_"></text> - </column> - <column colspan="2"> - <image type="var:icon"></image> - <text var="name"></text> - </column> - <column> - <date date="var:date"></date> - </column> - </row> - </list> - </table> + xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"> + <form> + <table class="or-table--sortable"> + + <row class="headline"> + <column class="help clickable"> + <text key="FOLDER_ORDER"></text> + </column> + <column class="help clickable"> + <text key="GLOBAL_NAME"></text> + </column> + <column class="help clickable"> + <text key="GLOBAL_LASTCHANGE"></text> + </column> + </row> + <list list="object" extract="true"> + <row class="data" id="var:id"> + <column> + <text raw="_"></text> + </column> + <column> + <image type="var:icon"></image> + <text var="name"></text> + </column> + <column> + <date date="var:date"></date> + </column> + </row> + </list> + </table> + + <hidden name="order" default=""/> + </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 @@ -11005,7 +11005,7 @@ jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",format /* ./modules//template-engine/components/html/editor/editor.min.js */;$(document).on('orViewLoaded',function(e,t){$(e.target).find('textarea').orAutoheight();$(e.target).find('textarea.editor.ace-editor').each(function(){var t=$(this),i=$('<div class="editor__code-editor" />').insertAfter(t),e=ace.edit(i.get(0)),a=t.data('mode');e.renderer.setShowGutter(!0);e.setTheme('ace/theme/github');e.getSession().setTabSize(4);e.getSession().setUseWrapMode(!0);e.setHighlightActiveLine(!0);e.getSession().setValue(t.val());e.getSession().setMode('ace/mode/'+a);e.getSession().on('change',function(i){t.val(e.getSession().getValue())});t.closest('form').submit(function(){t.val(e.getSession().getValue())})});$(e.target).find('textarea.editor.code-editor').each(function(){var t=$(this).data('mode'),i=$(this).data('mimetype');if(i.length>0)t=i;var a=CodeMirror.fromTextArea(this,{lineNumbers:!0,viewportMargin:Infinity,mode:t});var e=this;$(e).closest('form').submit(function(){var t=a.getValue();$(e).val(t)})});$(e.target).find('textarea.editor.markdown-editor').each(function(){var e=new SimpleMDE({element:$(this)[0]})});$(e.target).find('textarea.editor.html-editor').each(function(){$(this).trumbowyg()})}); /* ./modules//template-engine/components/html/link/link.min.js */;$(document).on('orViewLoaded',function(n,i){$(n.target).find('.clickable').orLinkify()});function submitLink(n,i){var t=jQuery.parseJSON(i),a='./api/';t.output='json';$.ajax({'type':'POST',url:a,data:t,success:function(i,t,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(i,t,n)}})}; /* ./modules//template-engine/components/html/qrcode/qrcode.min.js */;$(document).on('orViewLoaded',function(e,r){$(e.target).find('.qrcode').click(function(){let wrapper=$('<div class="qrcode-wrapper"></div>');$('div#dialog > .view').append(wrapper);$('div#dialog').removeClass('is-closed').addClass('is-open');var e=$(this).attr('data-qrcode');$(wrapper).qrcode({render:'div',text:e,fill:'currentColor'});wrapper.attr('title',e);$('div#dialog > .view').fadeIn()})}); -/* ./modules//template-engine/components/html/table/table.min.js */;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.sortable > tbody').sortable({update:function(a,t){$(t).addClass('loader');var o=[];$(t.item).closest('table.sortable').find('tbody > tr.data').each(function(){var t=$(this).data('id');o.push(t)});var r='./api/',e={};e.action='folder';e.subaction='order';e.token=$('div.action-folder.method-order input[name=token]').attr('value');e.order=o.join(',');e.id=$('div#dialog').data('id');e.output='json';$.ajax({'type':'POST',url:r,data:e,success:function(e,a,o){$(t).removeClass('loader');doResponse(e,a,t)},error:function(t,e,a){alert(a)}})}});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t.target).find('table > tbody > tr.headline > td').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(o(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function o(t){return function(e,o){let valA=a(e,t),valB=a(o,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function a(t,e){return $(t).children('td').eq(e).text()}}); +/* ./modules//template-engine/components/html/table/table.min.js */;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.or-table--sortable > tbody').sortable();$(t.target).find('table.or-table--sortable > tbody').closest('form').submit(function(){var t=[];$(this).find('table.or-table--sortable').find('tbody > tr.data').each(function(){let objectid=$(this).data('id');t.push(objectid)});$(this).find('input[name=order]').val(t.join(','))});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t.target).find('table > tbody > tr.headline > td').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(l(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function l(t){return function(e,l){let valA=a(e,t),valB=a(l,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function a(t,e){return $(t).children('td').eq(e).text()}}); /* ./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'))}); diff --git a/modules/cms-ui/themes/default/script/jquery.mjs.nestedSortable.js b/modules/cms-ui/themes/default/script/jquery.mjs.nestedSortable.js @@ -1,426 +0,0 @@ -/* - * jQuery UI Nested Sortable - * v 1.3.5 / 21 jun 2012 - * http://mjsarfatti.com/code/nestedSortable - * - * Depends on: - * jquery.ui.sortable.js 1.8+ - * - * Copyright (c) 2010-2012 Manuele J Sarfatti - * Licensed under the MIT License - * http://www.opensource.org/licenses/mit-license.php - */ - -(function($) { - - $.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, { - - options: { - tabSize: 20, - disableNesting: 'mjs-nestedSortable-no-nesting', - errorClass: 'mjs-nestedSortable-error', - listType: 'ol', - maxLevels: 0, - protectRoot: false, - rootID: null, - rtl: false, - isAllowed: function(item, parent) { return true; } - }, - - _create: function() { - this.element.data('sortable', this.element.data('nestedSortable')); - - if (!this.element.is(this.options.listType)) - throw new Error('nestedSortable: Please check the listType option is set to your actual list type'); - - return $.ui.sortable.prototype._create.apply(this, arguments); - }, - - destroy: function() { - this.element - .removeData("nestedSortable") - .unbind(".nestedSortable"); - return $.ui.sortable.prototype.destroy.apply(this, arguments); - }, - - _mouseDrag: function(event) { - - //Compute the helpers position - this.position = this._generatePosition(event); - this.positionAbs = this._convertPositionTo("absolute"); - - if (!this.lastPositionAbs) { - this.lastPositionAbs = this.positionAbs; - } - - //Do scrolling - if(this.options.scroll) { - var o = this.options, scrolled = false; - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { - - if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; - - if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; - - } else { - - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); - - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); - - } - - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - } - - //Regenerate the absolute position used for position checks - this.positionAbs = this._convertPositionTo("absolute"); - - // Find the top offset before rearrangement, - var previousTopOffset = this.placeholder.offset().top; - - //Set the helper position - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - - //Rearrange - for (var i = this.items.length - 1; i >= 0; i--) { - - //Cache variables and intersection, continue if no intersection - var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); - if (!intersection) continue; - - if(itemElement != this.currentItem[0] //cannot intersect with itself - && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before - && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked - && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) - //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container - ) { - - $(itemElement).mouseenter(); - - this.direction = intersection == 1 ? "down" : "up"; - - if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { - $(itemElement).mouseleave(); - this._rearrange(event, item); - } else { - break; - } - - // Clear emtpy ul's/ol's - this._clearEmpty(itemElement); - - this._trigger("change", event, this._uiHash()); - break; - } - } - - var parentItem = (this.placeholder[0].parentNode.parentNode && - $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length) - ? $(this.placeholder[0].parentNode.parentNode) - : null, - level = this._getLevel(this.placeholder), - childLevels = this._getChildLevels(this.helper); - - // To find the previous sibling in the list, keep backtracking until we hit a valid list item. - var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null; - if (previousItem != null) { - while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) { - if (previousItem[0].previousSibling) { - previousItem = $(previousItem[0].previousSibling); - } else { - previousItem = null; - break; - } - } - } - - // To find the next sibling in the list, keep stepping forward until we hit a valid list item. - var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null; - if (nextItem != null) { - while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) { - if (nextItem[0].nextSibling) { - nextItem = $(nextItem[0].nextSibling); - } else { - nextItem = null; - break; - } - } - } - - var newList = document.createElement(o.listType); - - this.beyondMaxLevels = 0; - - // If the item is moved to the left, send it to its parent's level unless there are siblings below it. - if (parentItem != null && nextItem == null && - (o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) || - !o.rtl && (this.positionAbs.left < parentItem.offset().left))) { - parentItem.after(this.placeholder[0]); - this._clearEmpty(parentItem[0]); - this._trigger("change", event, this._uiHash()); - } - // If the item is below a sibling and is moved to the right, make it a child of that sibling. - else if (previousItem != null && - (o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize) || - !o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))) { - this._isAllowed(previousItem, level, level+childLevels+1); - if (!previousItem.children(o.listType).length) { - previousItem[0].appendChild(newList); - } - // If this item is being moved from the top, add it to the top of the list. - if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) { - previousItem.children(o.listType).prepend(this.placeholder); - } - // Otherwise, add it to the bottom of the list. - else { - previousItem.children(o.listType)[0].appendChild(this.placeholder[0]); - } - this._trigger("change", event, this._uiHash()); - } - else { - this._isAllowed(parentItem, level, level+childLevels); - } - - //Post events to containers - this._contactContainers(event); - - //Interconnect with droppables - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); - - //Call callbacks - this._trigger('sort', event, this._uiHash()); - - this.lastPositionAbs = this.positionAbs; - return false; - - }, - - _mouseStop: function(event, noPropagation) { - - // If the item is in a position not allowed, send it back - if (this.beyondMaxLevels) { - - this.placeholder.removeClass(this.options.errorClass); - - if (this.domPosition.prev) { - $(this.domPosition.prev).after(this.placeholder); - } else { - $(this.domPosition.parent).prepend(this.placeholder); - } - - this._trigger("revert", event, this._uiHash()); - - } - - // Clean last empty ul/ol - for (var i = this.items.length - 1; i >= 0; i--) { - var item = this.items[i].item[0]; - this._clearEmpty(item); - } - - $.ui.sortable.prototype._mouseStop.apply(this, arguments); - - }, - - serialize: function(options) { - - var o = $.extend({}, this.options, options), - items = this._getItemsAsjQuery(o && o.connected), - str = []; - - $(items).each(function() { - var res = ($(o.item || this).attr(o.attribute || 'id') || '') - .match(o.expression || (/(.+)[-=_](.+)/)), - pid = ($(o.item || this).parent(o.listType) - .parent(o.items) - .attr(o.attribute || 'id') || '') - .match(o.expression || (/(.+)[-=_](.+)/)); - - if (res) { - str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']') - + '=' - + (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID)); - } - }); - - if(!str.length && o.key) { - str.push(o.key + '='); - } - - return str.join('&'); - - }, - - toHierarchy: function(options) { - - var o = $.extend({}, this.options, options), - sDepth = o.startDepthCount || 0, - ret = []; - - $(this.element).children(o.items).each(function () { - var level = _recursiveItems(this); - ret.push(level); - }); - - return ret; - - function _recursiveItems(item) { - var id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); - if (id) { - var currentItem = {"id" : id[2]}; - if ($(item).children(o.listType).children(o.items).length > 0) { - currentItem.children = []; - $(item).children(o.listType).children(o.items).each(function() { - var level = _recursiveItems(this); - currentItem.children.push(level); - }); - } - return currentItem; - } - } - }, - - toArray: function(options) { - - var o = $.extend({}, this.options, options), - sDepth = o.startDepthCount || 0, - ret = [], - left = 2; - - ret.push({ - "item_id": o.rootID, - "parent_id": 'none', - "depth": sDepth, - "left": '1', - "right": ($(o.items, this.element).length + 1) * 2 - }); - - $(this.element).children(o.items).each(function () { - left = _recursiveArray(this, sDepth + 1, left); - }); - - ret = ret.sort(function(a,b){ return (a.left - b.left); }); - - return ret; - - function _recursiveArray(item, depth, left) { - - var right = left + 1, - id, - pid; - - if ($(item).children(o.listType).children(o.items).length > 0) { - depth ++; - $(item).children(o.listType).children(o.items).each(function () { - right = _recursiveArray($(this), depth, right); - }); - depth --; - } - - id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/)); - - if (depth === sDepth + 1) { - pid = o.rootID; - } else { - var parentItem = ($(item).parent(o.listType) - .parent(o.items) - .attr(o.attribute || 'id')) - .match(o.expression || (/(.+)[-=_](.+)/)); - pid = parentItem[2]; - } - - if (id) { - ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right}); - } - - left = right + 1; - return left; - } - - }, - - _clearEmpty: function(item) { - - var emptyList = $(item).children(this.options.listType); - if (emptyList.length && !emptyList.children().length) { - emptyList.remove(); - } - - }, - - _getLevel: function(item) { - - var level = 1; - - if (this.options.listType) { - var list = item.closest(this.options.listType); - while (list && list.length > 0 && - !list.is('.ui-sortable')) { - level++; - list = list.parent().closest(this.options.listType); - } - } - - return level; - }, - - _getChildLevels: function(parent, depth) { - var self = this, - o = this.options, - result = 0; - depth = depth || 0; - - $(parent).children(o.listType).children(o.items).each(function (index, child) { - result = Math.max(self._getChildLevels(child, depth + 1), result); - }); - - return depth ? result + 1 : result; - }, - - _isAllowed: function(parentItem, level, levels) { - var o = this.options, - isRoot = $(this.domPosition.parent).hasClass('ui-sortable') ? true : false, - maxLevels = this.placeholder.closest('.ui-sortable').nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list - - // Is the root protected? - // Are we trying to nest under a no-nest? - // Are we nesting too deep? - if (!o.isAllowed(parentItem, this.placeholder) || - parentItem && parentItem.hasClass(o.disableNesting) || - o.protectRoot && (parentItem == null && !isRoot || isRoot && level > 1)) { - this.placeholder.addClass(o.errorClass); - if (maxLevels < levels && maxLevels != 0) { - this.beyondMaxLevels = levels - maxLevels; - } else { - this.beyondMaxLevels = 1; - } - } else { - if (maxLevels < levels && maxLevels != 0) { - this.placeholder.addClass(o.errorClass); - this.beyondMaxLevels = levels - maxLevels; - } else { - this.placeholder.removeClass(o.errorClass); - this.beyondMaxLevels = 0; - } - } - } - - })); - - $.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options); -})(jQuery);- \ No newline at end of file diff --git a/modules/cms-ui/themes/default/script/jquery.mjs.nestedSortable.min.js b/modules/cms-ui/themes/default/script/jquery.mjs.nestedSortable.min.js @@ -1,426 +0,0 @@ -/* - * jQuery UI Nested Sortable - * v 1.3.5 / 21 jun 2012 - * http://mjsarfatti.com/code/nestedSortable - * - * Depends on: - * jquery.ui.sortable.js 1.8+ - * - * Copyright (c) 2010-2012 Manuele J Sarfatti - * Licensed under the MIT License - * http://www.opensource.org/licenses/mit-license.php - */ - -(function($) { - - $.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, { - - options: { - tabSize: 20, - disableNesting: 'mjs-nestedSortable-no-nesting', - errorClass: 'mjs-nestedSortable-error', - listType: 'ol', - maxLevels: 0, - protectRoot: false, - rootID: null, - rtl: false, - isAllowed: function(item, parent) { return true; } - }, - - _create: function() { - this.element.data('sortable', this.element.data('nestedSortable')); - - if (!this.element.is(this.options.listType)) - throw new Error('nestedSortable: Please check the listType option is set to your actual list type'); - - return $.ui.sortable.prototype._create.apply(this, arguments); - }, - - destroy: function() { - this.element - .removeData("nestedSortable") - .unbind(".nestedSortable"); - return $.ui.sortable.prototype.destroy.apply(this, arguments); - }, - - _mouseDrag: function(event) { - - //Compute the helpers position - this.position = this._generatePosition(event); - this.positionAbs = this._convertPositionTo("absolute"); - - if (!this.lastPositionAbs) { - this.lastPositionAbs = this.positionAbs; - } - - //Do scrolling - if(this.options.scroll) { - var o = this.options, scrolled = false; - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { - - if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; - - if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; - - } else { - - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); - - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); - - } - - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - } - - //Regenerate the absolute position used for position checks - this.positionAbs = this._convertPositionTo("absolute"); - - // Find the top offset before rearrangement, - var previousTopOffset = this.placeholder.offset().top; - - //Set the helper position - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - - //Rearrange - for (var i = this.items.length - 1; i >= 0; i--) { - - //Cache variables and intersection, continue if no intersection - var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); - if (!intersection) continue; - - if(itemElement != this.currentItem[0] //cannot intersect with itself - && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before - && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked - && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) - //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container - ) { - - $(itemElement).mouseenter(); - - this.direction = intersection == 1 ? "down" : "up"; - - if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { - $(itemElement).mouseleave(); - this._rearrange(event, item); - } else { - break; - } - - // Clear emtpy ul's/ol's - this._clearEmpty(itemElement); - - this._trigger("change", event, this._uiHash()); - break; - } - } - - var parentItem = (this.placeholder[0].parentNode.parentNode && - $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length) - ? $(this.placeholder[0].parentNode.parentNode) - : null, - level = this._getLevel(this.placeholder), - childLevels = this._getChildLevels(this.helper); - - // To find the previous sibling in the list, keep backtracking until we hit a valid list item. - var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null; - if (previousItem != null) { - while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) { - if (previousItem[0].previousSibling) { - previousItem = $(previousItem[0].previousSibling); - } else { - previousItem = null; - break; - } - } - } - - // To find the next sibling in the list, keep stepping forward until we hit a valid list item. - var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null; - if (nextItem != null) { - while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) { - if (nextItem[0].nextSibling) { - nextItem = $(nextItem[0].nextSibling); - } else { - nextItem = null; - break; - } - } - } - - var newList = document.createElement(o.listType); - - this.beyondMaxLevels = 0; - - // If the item is moved to the left, send it to its parent's level unless there are siblings below it. - if (parentItem != null && nextItem == null && - (o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) || - !o.rtl && (this.positionAbs.left < parentItem.offset().left))) { - parentItem.after(this.placeholder[0]); - this._clearEmpty(parentItem[0]); - this._trigger("change", event, this._uiHash()); - } - // If the item is below a sibling and is moved to the right, make it a child of that sibling. - else if (previousItem != null && - (o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize) || - !o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))) { - this._isAllowed(previousItem, level, level+childLevels+1); - if (!previousItem.children(o.listType).length) { - previousItem[0].appendChild(newList); - } - // If this item is being moved from the top, add it to the top of the list. - if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) { - previousItem.children(o.listType).prepend(this.placeholder); - } - // Otherwise, add it to the bottom of the list. - else { - previousItem.children(o.listType)[0].appendChild(this.placeholder[0]); - } - this._trigger("change", event, this._uiHash()); - } - else { - this._isAllowed(parentItem, level, level+childLevels); - } - - //Post events to containers - this._contactContainers(event); - - //Interconnect with droppables - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); - - //Call callbacks - this._trigger('sort', event, this._uiHash()); - - this.lastPositionAbs = this.positionAbs; - return false; - - }, - - _mouseStop: function(event, noPropagation) { - - // If the item is in a position not allowed, send it back - if (this.beyondMaxLevels) { - - this.placeholder.removeClass(this.options.errorClass); - - if (this.domPosition.prev) { - $(this.domPosition.prev).after(this.placeholder); - } else { - $(this.domPosition.parent).prepend(this.placeholder); - } - - this._trigger("revert", event, this._uiHash()); - - } - - // Clean last empty ul/ol - for (var i = this.items.length - 1; i >= 0; i--) { - var item = this.items[i].item[0]; - this._clearEmpty(item); - } - - $.ui.sortable.prototype._mouseStop.apply(this, arguments); - - }, - - serialize: function(options) { - - var o = $.extend({}, this.options, options), - items = this._getItemsAsjQuery(o && o.connected), - str = []; - - $(items).each(function() { - var res = ($(o.item || this).attr(o.attribute || 'id') || '') - .match(o.expression || (/(.+)[-=_](.+)/)), - pid = ($(o.item || this).parent(o.listType) - .parent(o.items) - .attr(o.attribute || 'id') || '') - .match(o.expression || (/(.+)[-=_](.+)/)); - - if (res) { - str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']') - + '=' - + (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID)); - } - }); - - if(!str.length && o.key) { - str.push(o.key + '='); - } - - return str.join('&'); - - }, - - toHierarchy: function(options) { - - var o = $.extend({}, this.options, options), - sDepth = o.startDepthCount || 0, - ret = []; - - $(this.element).children(o.items).each(function () { - var level = _recursiveItems(this); - ret.push(level); - }); - - return ret; - - function _recursiveItems(item) { - var id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); - if (id) { - var currentItem = {"id" : id[2]}; - if ($(item).children(o.listType).children(o.items).length > 0) { - currentItem.children = []; - $(item).children(o.listType).children(o.items).each(function() { - var level = _recursiveItems(this); - currentItem.children.push(level); - }); - } - return currentItem; - } - } - }, - - toArray: function(options) { - - var o = $.extend({}, this.options, options), - sDepth = o.startDepthCount || 0, - ret = [], - left = 2; - - ret.push({ - "item_id": o.rootID, - "parent_id": 'none', - "depth": sDepth, - "left": '1', - "right": ($(o.items, this.element).length + 1) * 2 - }); - - $(this.element).children(o.items).each(function () { - left = _recursiveArray(this, sDepth + 1, left); - }); - - ret = ret.sort(function(a,b){ return (a.left - b.left); }); - - return ret; - - function _recursiveArray(item, depth, left) { - - var right = left + 1, - id, - pid; - - if ($(item).children(o.listType).children(o.items).length > 0) { - depth ++; - $(item).children(o.listType).children(o.items).each(function () { - right = _recursiveArray($(this), depth, right); - }); - depth --; - } - - id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/)); - - if (depth === sDepth + 1) { - pid = o.rootID; - } else { - var parentItem = ($(item).parent(o.listType) - .parent(o.items) - .attr(o.attribute || 'id')) - .match(o.expression || (/(.+)[-=_](.+)/)); - pid = parentItem[2]; - } - - if (id) { - ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right}); - } - - left = right + 1; - return left; - } - - }, - - _clearEmpty: function(item) { - - var emptyList = $(item).children(this.options.listType); - if (emptyList.length && !emptyList.children().length) { - emptyList.remove(); - } - - }, - - _getLevel: function(item) { - - var level = 1; - - if (this.options.listType) { - var list = item.closest(this.options.listType); - while (list && list.length > 0 && - !list.is('.ui-sortable')) { - level++; - list = list.parent().closest(this.options.listType); - } - } - - return level; - }, - - _getChildLevels: function(parent, depth) { - var self = this, - o = this.options, - result = 0; - depth = depth || 0; - - $(parent).children(o.listType).children(o.items).each(function (index, child) { - result = Math.max(self._getChildLevels(child, depth + 1), result); - }); - - return depth ? result + 1 : result; - }, - - _isAllowed: function(parentItem, level, levels) { - var o = this.options, - isRoot = $(this.domPosition.parent).hasClass('ui-sortable') ? true : false, - maxLevels = this.placeholder.closest('.ui-sortable').nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list - - // Is the root protected? - // Are we trying to nest under a no-nest? - // Are we nesting too deep? - if (!o.isAllowed(parentItem, this.placeholder) || - parentItem && parentItem.hasClass(o.disableNesting) || - o.protectRoot && (parentItem == null && !isRoot || isRoot && level > 1)) { - this.placeholder.addClass(o.errorClass); - if (maxLevels < levels && maxLevels != 0) { - this.beyondMaxLevels = levels - maxLevels; - } else { - this.beyondMaxLevels = 1; - } - } else { - if (maxLevels < levels && maxLevels != 0) { - this.placeholder.addClass(o.errorClass); - this.beyondMaxLevels = levels - maxLevels; - } else { - this.placeholder.removeClass(o.errorClass); - this.beyondMaxLevels = 0; - } - } - } - - })); - - $.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options); -})(jQuery);- \ No newline at end of file diff --git a/modules/template-engine/components/html/table/table.js b/modules/template-engine/components/html/table/table.js @@ -1,37 +1,25 @@ $(document).on('orViewLoaded',function(event, data) { -// Sortieren von Tabellen - $(event.target).find('table.sortable > tbody').sortable({ - update: function(event, ui) - { - $(ui).addClass('loader'); - var order = []; - $(ui.item).closest('table.sortable').find('tbody > tr.data').each( function() { - var objectid = $(this).data('id'); - order.push( objectid ); - }); - var url = './api/'; - var params = {}; - params.action = 'folder'; - params.subaction = 'order'; - params.token = $('div.action-folder.method-order input[name=token]').attr('value'); - params.order = order.join(','); - params.id = $('div#dialog').data('id'); - params.output = 'json'; - - $.ajax( { 'type':'POST',url:url, data:params, success:function(data, textStatus, jqXHR) - { - $(ui).removeClass('loader'); - doResponse(data,textStatus,ui); - }, - error:function(jqXHR, textStatus, errorThrown) { - alert( errorThrown ); - } - - } ); - } - }); - + // Manuelles Sortieren von Tabellen per Drag and drop. + $(event.target).find('table.or-table--sortable > tbody').sortable(); + + + $(event.target).find('table.or-table--sortable > tbody').closest('form').submit( function() { + + // Analyse the order of the objects in this folder. + var order = new Array(); + + $(this).find('table.or-table--sortable').find('tbody > tr.data').each(function () { + let objectid = $(this).data('id'); + order.push(objectid); + }); + + // Set the comma-separated list of objects into a input field. + $(this).find('input[name=order]').val(order.join(',')); + } + ); + + // Alle Checkboxen setzen oder nicht setzen. $(event.target).find('tr.headline > td > input.checkbox').click( function() { $(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean( $(this).attr('checked') ) ); diff --git a/modules/template-engine/components/html/table/table.min.js b/modules/template-engine/components/html/table/table.min.js @@ -1 +1 @@ -;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.sortable > tbody').sortable({update:function(a,t){$(t).addClass('loader');var o=[];$(t.item).closest('table.sortable').find('tbody > tr.data').each(function(){var t=$(this).data('id');o.push(t)});var r='./api/',e={};e.action='folder';e.subaction='order';e.token=$('div.action-folder.method-order input[name=token]').attr('value');e.order=o.join(',');e.id=$('div#dialog').data('id');e.output='json';$.ajax({'type':'POST',url:r,data:e,success:function(e,a,o){$(t).removeClass('loader');doResponse(e,a,t)},error:function(t,e,a){alert(a)}})}});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t.target).find('table > tbody > tr.headline > td').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(o(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function o(t){return function(e,o){let valA=a(e,t),valB=a(o,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function a(t,e){return $(t).children('td').eq(e).text()}});- \ No newline at end of file +;$(document).on('orViewLoaded',function(t,e){$(t.target).find('table.or-table--sortable > tbody').sortable();$(t.target).find('table.or-table--sortable > tbody').closest('form').submit(function(){var t=[];$(this).find('table.or-table--sortable').find('tbody > tr.data').each(function(){let objectid=$(this).data('id');t.push(objectid)});$(this).find('input[name=order]').val(t.join(','))});$(t.target).find('tr.headline > td > input.checkbox').click(function(){$(this).closest('table').find('tr.data > td > input.checkbox').attr('checked',Boolean($(this).attr('checked')))});$(t.target).find('.table-filter > input').keyup(function(){let filterExpression=$(this).val().toLowerCase();let table=$(this).parents('.table-wrapper').find('table');table.addClass('loader');setTimeout(()=>{table.find('tr').filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(filterExpression)>-1)});table.removeClass('loader')},50)});$(t.target).find('table > tbody > tr.headline > td').click(function(){let column=$(this);let table=column.parents('table');table.addClass('loader');let isAscending=!column.hasClass('sort-asc');table.find('tr.headline > td').removeClass('sort-asc sort-desc');if(isAscending)column.addClass('sort-asc');else column.addClass('sort-desc');setTimeout(function(){let rows=table.find('tr:gt(0)').toArray().sort(l(column.index()));if(!isAscending){rows=rows.reverse()};for(var t=0;t<rows.length;t++){table.append(rows[t])};table.removeClass('loader')},50)});function l(t){return function(e,l){let valA=a(e,t),valB=a(l,t);return $.isNumeric(valA)&&$.isNumeric(valB)?valA-valB:valA.toString().localeCompare(valB)}};function a(t,e){return $(t).children('td').eq(e).text()}});+ \ No newline at end of file