FINAL suepr merge step : added all modules to this super repos

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 16:46:59 +02:00
7585 changed files with 1723356 additions and 18 deletions

View File

@@ -0,0 +1,211 @@
/* ===============================
| TABLESORT.JS
| Copyright, Andy Croxall (mitya@mitya.co.uk)
| For documentation and demo see http://mitya.co.uk/scripts/Animated-table-sort-REGEXP-friendly-111
|
| USAGE
| This script may be used, distributed and modified freely but this header must remain in tact.
| For usage info and demo, including info on args and params, see www.mitya.co.uk/scripts
=============================== */
jQuery.fn.sortTable = function(params) {
/*-----------
| STOP right now if anim already in progress
-----------*/
if ($(this).find(':animated').length > 0) return;
/*-----------
| VALIDATE TABLE & PARAMS
| - if no col to sort on passed, complain and return
| - if table doesn't contain requested col, complain and return
| If !sortType or invalid sortType, assume ascii sort
-----------*/
var error = null;
var complain = null;
if (!params.onCol) { error = "No column specified to search on"; complain = true; }
else if ($(this).find('td:nth-child('+params.onCol+')').length == 0) { error = "The requested column wasn't found in the table"; complain = true; }
if (error) { if (complain) alert(error); return; }
if (!params.sortType || params.sortType != 'numeric') params.sortType = 'ascii';
/*-----------
| PREP
| - declare array to store the contents of each <td>, or, if sorting on regexp, the pattern match of the regexp in each <td>
| - Give the <table> position: relative to aid animation
| - Mark the col we're sorting on with an identifier class
-----------*/
var valuesToSort = [];
$(this).css('position', 'relative');
var doneAnimating = 0;
var tdSelectorText = 'td'+(!params.onCol ? '' : ':nth-child('+params.onCol+')');
$(this).find('td:nth-child('+params.onCol+')').addClass('sortOnThisCol');
var thiss = this;
/*-----------
| Iterate over table and. For each:
| - append its content / regexp match (see above) to valuesToSort[]
| - create a new <div>, give it position: absolute and copy over the <td>'s content into it
| - fix the <td>'s width/height to its offset width/height so that, when we remove its html, it won't change shape
| - clear the <td>'s content
| - clear the <td>'s content
| There is no visual effect in this. But it means each <td>'s content is now 'animatable', since it's position: absolute.
-----------*/
var counter = 0;
$(this).find('td').each(function() {
if ($(this).is('.sortOnThisCol') || (!params.onCol && !params.keepRelationships)) {
var valForSort = !params.child ? $(this).text() : (params.child != 'input' ? $(this).find(params.child).text() : $(this).find(params.child).val());
if (params.regexp) {
valForSort = valForSort.match(new RegExp(params.regexp))[!params.regexpIndex ? 0 : params.regexpIndex];
}
valuesToSort.push(valForSort);
}
var thisTDHTMLHolder = document.createElement('div');
with($(thisTDHTMLHolder)) {
html($(this).html());
if (params.child && params.child == 'input') html(html().replace(/<input /, "<input value='"+$(this).find(params.child).val()+"'", html()));
css({position: 'relative', left: 0, top: 0});
}
$(this).html('');
$(this).append(thisTDHTMLHolder);
counter++;
});
/*-----------
| Sort values array.
| - Sort (either simply, on ascii, or numeric if sortNumeric == true)
| - If descending == true, reverse after sort
-----------*/
params.sortType == 'numeric' ? valuesToSort.sort(function(a, b) { return (a.replace(/[^\d\.]/g, '', a)-b.replace(/[^\d\.]/g, '', b)); }) : valuesToSort.sort();
if (params.sortDesc) {
valuesToSort_tempCopy = [];
for(var u=valuesToSort.length; u--; u>=0) valuesToSort_tempCopy.push(valuesToSort[u]);
valuesToSort = valuesToSort_tempCopy;
delete(valuesToSort_tempCopy)
}
/*-----------
| Now, for each:
-----------*/
for(var k in valuesToSort) {
//establish current <td> relating to this value of the array
var currTD = $($(this).find(tdSelectorText).filter(function() {
return (
(
!params.regexp
&&
(
(
params.child
&&
(
(
params.child != 'input'
&&
valuesToSort[k] == $(this).find(params.child).text()
)
||
params.child == 'input'
&&
valuesToSort[k] == $(this).find(params.child).val()
)
)
||
(
!params.child
&&
valuesToSort[k] == $(this).children('div').html()
)
)
)
||
(
params.regexp
&&
$(this).children('div').html().match(new RegExp(params.regexp))[!params.regexpIndex ? 0 : params.regexpIndex] == valuesToSort[k]
)
)
&&
!$(this).hasClass('tableSort_TDRepopulated');
}).get(0));
//give current <td> a class to mark it as having been used, so we don't get confused with duplicate values
currTD.addClass('tableSort_TDRepopulated');
//establish target <td> for this value and store as a node reference on this <td>
var targetTD = $($(this).find(tdSelectorText).get(k));
currTD.get(0).toTD = targetTD;
//if we're sorting on a particular column and maintaining relationships, also give the other <td>s in rows a node reference
//denoting ITS target, so they move with their lead siibling
if (params.keepRelationships) {
var counter = 0;
$(currTD).parent().children('td').each(function() {
$(this).get(0).toTD = $(targetTD.parent().children().get(counter));
counter++;
});
}
//establish current relative positions for the current and target <td>s and use this to calculate how far each <div> needs to move
var currPos = currTD.position();
var targetPos = targetTD.position();
var moveBy_top = targetPos.top - currPos.top;
//invert values if going backwards/upwards
if (targetPos.top > currPos.top) moveBy_top = Math.abs(moveBy_top);
/*-----------
| ANIMATE
| - work out what to animate on.
| - if !keepRelationships, animate only <td>s in the col we're sorting on (identified by .sortOnThisCol)
| - if keepRelationships, animate all cols but <td>s that aren't .sortOnThisCol follow lead sibiling with .sortOnThisCol
| - run animation. On callback, update each <td> with content of <div> that just moved into it and remove <div>s
| - If noAnim, we'll still run aniamte() but give it a low duration so it appears instant
-----------*/
var animateOn = params.keepRelationships ? currTD.add(currTD.siblings()) : currTD;
var done = 0;
animateOn.children('div').animate({top: moveBy_top}, !params.noAnim ? 500 : 0, null, function() {
if ($(this).parent().is('.sortOnThisCol') || !params.keepRelationships) {
done++;
if (done == valuesToSort.length-1) thiss.tableSort_cleanUp();
}
});
}
};
jQuery.fn.tableSort_cleanUp = function() {
/*-----------
| AFTER ANIM
| - assign each <td> its new content as property of it (DON'T populate it yet - this <td> may still need to be read by
| other <td>s' toTD node references
| - once new contents for each <td> gathered, populate
| - remove some identifier classes and properties
-----------*/
$(this).find('td').each(function() {
if($(this).get(0).toTD) $($(this).get(0).toTD).get(0).newHTML = $(this).children('div').html();
});
$(this).find('td').each(function() { $(this).html($(this).get(0).newHTML); });
$('td.tableSort_TDRepopulated').removeClass('tableSort_TDRepopulated');
$(this).find('.sortOnThisCol').removeClass('sortOnThisCol');
$(this).find('td[newHTML]').attr('newHTML', '');
$(this).find('td[toTD]').attr('toTD', '');
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,170 @@
(function ($) {
$(function() {
// Ping Drupal for initial status of processes.
$.ajax({
type: 'GET',
url: '/admin/ultimate-cron/service/process-status',
data: '',
dataType: 'json',
success: function (result) {
// Drupal.settings.ultimate_cron.initial_processes = result.processes;
// Drupal.settings.ultimate_cron.processes = result.processes;
// setTimeout(&ultimateCronInitialProcess, 100);
}
});
// Setup progress counter
setInterval(function() {
var time = (new Date()).getTime() / 1000;
$.each(Drupal.settings.ultimate_cron.processes, function (name, process) {
if (process.exec_status == 2) {
var row = 'row-' + name;
var seconds = Math.round((time - Drupal.settings.ultimate_cron.skew) - process.start_stamp);
seconds = seconds < 0 ? 0 : seconds;
var formatted = (new Date(seconds * 1000)).toISOString().substring(11, 19);
if (process.progress > 0) {
var progress = Math.round(process.progress * 100);
formatted += ' (' + progress + '%)';
}
$('tr.' + row + ' td.ultimate-cron-admin-status-running').closest('tr.' + row).find('td.ultimate-cron-admin-end').html(formatted);
}
});
}, 1000);
});
Drupal.Nodejs.callbacks.nodejsBackgroundProcess = {
updateSkew: function (time) {
jsTime = (new Date()).getTime() / 1000;
Drupal.settings.ultimate_cron.skew = jsTime - time;
},
callback: function (message) {
var action = message.data.action;
if (
// action != 'locked' &&
action != 'claimed' &&
action != 'dispatch' &&
// action != 'remove' &&
action != 'setProgress' &&
action != 'ultimateCronStatus'
) {
return;
}
var process = message.data.background_process;
var ultimate_cron = message.data.ultimate_cron;
var regex = new RegExp('^' + Drupal.settings.ultimate_cron.handle_prefix);
var name = process.handle.replace(regex, '');
if (name == process.handle) {
return;
}
name = encodeURIComponent(name).replace(/%/, '_');
Drupal.settings.ultimate_cron.processes[name] = process;
var row = 'row-' + name;
switch (action) {
case 'dispatch':
this.updateSkew(message.data.timestamp);
$('tr.' + row + ' td.ultimate-cron-admin-status').attr('class', 'ultimate-cron-admin-status ultimate-cron-admin-status-running');
$('tr.' + row + ' td.ultimate-cron-admin-start').html(ultimate_cron.start_stamp);
$('tr.' + row + ' td.ultimate-cron-admin-end').html(Drupal.t('Starting'));
$('tr.' + row + ' td.ultimate-cron-admin-status').html('<span>' + Drupal.t('Starting') + '</span>');
$('tr.' + row + ' td.ultimate-cron-admin-status').attr('title', Drupal.t('Running on !service_host', {'!service_host': process.service_host ? process.service_host : Drupal.t('N/A')}));
var link = $('tr.' + row + ' td.ultimate-cron-admin-execute a');
link.attr('href', ultimate_cron.unlockURL);
link.attr('title', Drupal.t('Unlock'));
link.html('<span>' + Drupal.t('Unlock') + '</span>');
$('tr.' + row + ' td.ultimate-cron-admin-execute').attr('class', 'ultimate-cron-admin-unlock');
break;
case 'claimed':
$('tr.' + row + ' td.ultimate-cron-admin-status').attr('class', 'ultimate-cron-admin-status ultimate-cron-admin-status-running');
$('tr.' + row + ' td.ultimate-cron-admin-start').html(ultimate_cron.start_stamp);
$('tr.' + row + ' td.ultimate-cron-admin-end').html('00:00:00');
$('tr.' + row + ' td.ultimate-cron-admin-status').html('<span>' + Drupal.t('Running') + '</span>');
$('tr.' + row + ' td.ultimate-cron-admin-status').attr('title', Drupal.t('Running on !service_host', {'!service_host': process.service_host ? process.service_host : Drupal.t('N/A')}));
var link = $('tr.' + row + ' td.ultimate-cron-admin-execute a');
link.attr('href', ultimate_cron.unlockURL);
link.attr('title', Drupal.t('Unlock'));
link.html('<span>' + Drupal.t('Unlock') + '</span>');
$('tr.' + row + ' td.ultimate-cron-admin-execute').attr('class', 'ultimate-cron-admin-unlock');
break;
case 'setProgress':
this.updateSkew(message.data.timestamp);
$('tr.' + row + ' td.ultimate-cron-admin-status').attr('class', 'ultimate-cron-admin-status ultimate-cron-admin-status-running');
$('tr.' + row + ' td.ultimate-cron-admin-start').html(ultimate_cron.start_stamp);
// $('tr.' + row + ' td.ultimate-cron-admin-end').html(ultimate_cron.progress);
$('tr.' + row + ' td.ultimate-cron-admin-status').html('<span>' + Drupal.t('Running') + '</span>');
// $('tr.' + row + ' td.ultimate-cron-admin-status').attr('title', Drupal.t('Running on !service_host', {'!service_host': process.service_host ? process.service_host : Drupal.t('N/A')}));
var link = $('tr.' + row + ' td.ultimate-cron-admin-execute a');
link.attr('href', ultimate_cron.unlockURL);
link.attr('title', Drupal.t('Unlock'));
link.html('<span>' + Drupal.t('Unlock') + '</span>');
$('tr.' + row + ' td.ultimate-cron-admin-execute').attr('class', 'ultimate-cron-admin-unlock');
break;
case 'ultimateCronStatus':
switch (parseInt(process.exec_status)) {
case 1:
message.data.action = 'dispatch';
return this.callback(message);
case 2:
message.data.action = 'setProgress';
return this.callback(message);
}
return;
default:
return;
}
var sel = location.hash.substring(1);
sel = sel ? sel : 'show-all';
$('a#ultimate-cron-' + sel).trigger('click');
}
};
Drupal.Nodejs.callbacks.nodejsProgress = {
callback: function (message) {
switch (message.data.action) {
case 'setProgress':
return Drupal.Nodejs.callbacks.nodejsBackgroundProcess.callback(message);
}
}
}
Drupal.Nodejs.callbacks.nodejsUltimateCron = {
callback: function (message) {
var action = message.data.action;
switch (action) {
case 'log':
var log = message.data.log;
var name = encodeURIComponent(log.name).replace(/%/, '_');
delete Drupal.settings.ultimate_cron.processes[name];
var row = 'row-' + name;
$('tr.' + row + ' td.ultimate-cron-admin-status').attr('class', 'ultimate-cron-admin-status ultimate-cron-admin-status-' + log.formatted.severity);
$('tr.' + row + ' td.ultimate-cron-admin-status').html('<span>' + log.severity + '</span>');
$('tr.' + row + ' td.ultimate-cron-admin-status').attr('title', log.formatted.msg ? log.formatted.msg : Drupal.t('No errors'));
$('tr.' + row + ' td.ultimate-cron-admin-start').html(log.formatted.start_stamp);
$('tr.' + row + ' td.ultimate-cron-admin-start').attr('title', Drupal.t('Previous run started @ !timestamp', {'!timestamp': log.formatted.start_stamp}));
$('tr.' + row + ' td.ultimate-cron-admin-end').html(log.formatted.duration);
$('tr.' + row + ' td.ultimate-cron-admin-end').attr('title', Drupal.t('Previous run finished @ !timestamp', {'!timestamp': log.formatted.end_stamp}));
var link = $('tr.' + row + ' td.ultimate-cron-admin-unlock a');
link.attr('href', log.formatted.executeURL);
link.attr('title', Drupal.t('Run'));
link.html('<span>' + Drupal.t('Run') + '</span>');
$('tr.' + row + ' td.ultimate-cron-admin-unlock').attr('class', 'ultimate-cron-admin-execute');
break;
default:
return;
}
var sel = location.hash.substring(1);
sel = sel ? sel : 'show-all';
$('a#ultimate-cron-' + sel).trigger('click');
}
};
}(jQuery));

View File

@@ -0,0 +1,46 @@
jQuery(document).ready(function($) {
// @todo Make client side status switch work on all themes?
return;
$('a[href$="admin/config/system/cron"]').click(function() {
$(".ultimate-cron-admin-status").parent().show();
$(this).parent().siblings().removeClass('active');
$(this).parent().addClass('active');
return false;
});
$('a[href$="admin/config/system/cron/overview/error"]').click(function() {
$("tr .ultimate-cron-admin-status:not(.ultimate-cron-admin-status-error)").parent().hide();
$("tr .ultimate-cron-admin-status-error").parent().show();
$(this).parent().siblings().removeClass('active');
$(this).parent().addClass('active');
return false;
});
$('a[href$="admin/config/system/cron/overview/warning"]').click(function() {
$("tr .ultimate-cron-admin-status:not(.ultimate-cron-admin-status-warning)").parent().hide();
$("tr .ultimate-cron-admin-status-warning").parent().show();
$(this).parent().siblings().removeClass('active');
$(this).parent().addClass('active');
return false;
});
$('a[href$="admin/config/system/cron/overview/info"]').click(function() {
$("tr .ultimate-cron-admin-status:not(.ultimate-cron-admin-status-info)").parent().hide();
$("tr .ultimate-cron-admin-status-info").parent().show();
$(this).parent().siblings().removeClass('active');
$(this).parent().addClass('active');
return false;
});
$('a[href$="admin/config/system/cron/overview/success"]').click(function() {
$("tr .ultimate-cron-admin-status:not(.ultimate-cron-admin-status-success)").parent().hide();
$("tr .ultimate-cron-admin-status-success").parent().show();
$(this).parent().siblings().removeClass('active');
$(this).parent().addClass('active');
return false;
});
$('a[href$="admin/config/system/cron/overview/running"]').click(function() {
$("tr .ultimate-cron-admin-status:not(.ultimate-cron-admin-status-running)").parent().hide();
$("tr .ultimate-cron-admin-status-running").parent().show();
$(this).parent().siblings().removeClass('active');
$(this).parent().addClass('active');
return false;
});
});