/usr/share/horde/ingo/js/filters.js is in php-horde-ingo 3.2.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | /**
* Provides the javascript for the filters view.
*
* @author Michael Slusarz <slusarz@horde.org>
* @copyright 2014-2015 Horde LLC
* @license ASL (http://www.horde.org/licenses/apache)
*/
var IngoFilters = {
onDomLoad: function()
{
if ($('apply_filters')) {
$('apply_filters').observe('click', function(e) {
$('actionID').setValue('apply_filters');
$('filters').submit();
e.stop();
});
}
if (window.Sortable) {
Sortable.create('filterslist', {
onChange: function() {
Horde.stripeElement('filterslist');
},
onUpdate: function() {
$('filtersSave').clonePosition('filterslist').appear({
duration: 0.2
});
HordeCore.doAction(
'reSortFilters',
{
sort: Object.toJSON(Sortable.sequence('filterslist'))
},
{
callback: function() {
/* Need to re-label the IDs to reflect new
* sort order. */
var i = 0,
rows = $('filterslist').childElements();
rows.invoke('writeAttribute', 'id', null);
rows.each(function(r) {
var a = r.select('a');
r.writeAttribute('id', 'filtersrow_' + (i++));
a.each(function(l) {
var href_new = IngoFilters.replaceQueryParam('rulenumber', i - 1, l.href);
href_new = IngoFilters.replaceQueryParam('edit', i - 1, href_new);
l.setAttribute('href', href_new);
});
});
$('filtersSave').fade({ duration: 0.2 });
}
}
);
},
tag: 'div'
});
}
},
// Adapted from http://stackoverflow.com/questions/1090948/change-url-parameters
replaceQueryParam: function(param, newval, search) {
var regex = new RegExp("([?;&])" + param + "[^&;]*[;&]?");
var query = search.replace(regex, "$1").replace(/&$/, '');
return (query.length > 2 ? query + "&" : "?") + (param + "=" + newval);
}
};
document.observe('dom:loaded', IngoFilters.onDomLoad.bind(IngoFilters));
|