mirror of
https://github.com/tag1consulting/d7_to_d10_migration.git
synced 2025-09-06 09:01:23 +00:00
Initial commit
This commit is contained in:
commit
c5e731d8ae
2773 changed files with 600767 additions and 0 deletions
35
drupal7/web/misc/batch.js
Normal file
35
drupal7/web/misc/batch.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
(function ($) {
|
||||
|
||||
/**
|
||||
* Attaches the batch behavior to progress bars.
|
||||
*/
|
||||
Drupal.behaviors.batch = {
|
||||
attach: function (context, settings) {
|
||||
$('#progress', context).once('batch', function () {
|
||||
var holder = $(this);
|
||||
// Remove HTML from no-js progress bar. The JS progress bar is created
|
||||
// later on.
|
||||
holder.empty();
|
||||
|
||||
// Success: redirect to the summary.
|
||||
var updateCallback = function (progress, status, pb) {
|
||||
if (progress == 100) {
|
||||
pb.stopMonitoring();
|
||||
window.location = settings.batch.uri + '&op=finished';
|
||||
}
|
||||
};
|
||||
|
||||
var errorCallback = function (pb) {
|
||||
holder.prepend($('<p class="error"></p>').html(settings.batch.errorMessage));
|
||||
$('#wait').hide();
|
||||
};
|
||||
|
||||
var progress = new Drupal.progressBar('updateprogress', updateCallback, 'POST', errorCallback);
|
||||
progress.setProgress(-1, settings.batch.initMessage);
|
||||
holder.append(progress.element);
|
||||
progress.startMonitoring(settings.batch.uri + '&op=do', 10);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue