source: sipes/cord/misc/batch.js @ b9d4e2e

stableversion-3.0
Last change on this file since b9d4e2e was b354002, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio del cord

  • Propiedad mode establecida a 100755
File size: 1.1 KB
Línea 
1
2/**
3 * Attaches the batch behavior to progress bars.
4 */
5Drupal.behaviors.batch = function (context) {
6  // This behavior attaches by ID, so is only valid once on a page.
7  if ($('#progress.batch-processed').size()) {
8    return;
9  }
10  $('#progress', context).addClass('batch-processed').each(function () {
11    var holder = this;
12    var uri = Drupal.settings.batch.uri;
13    var initMessage = Drupal.settings.batch.initMessage;
14    var errorMessage = Drupal.settings.batch.errorMessage;
15
16    // Success: redirect to the summary.
17    var updateCallback = function (progress, status, pb) {
18      if (progress == 100) {
19        pb.stopMonitoring();
20        window.location = uri+'&op=finished';
21      }
22    };
23
24    var errorCallback = function (pb) {
25      var div = document.createElement('p');
26      div.className = 'error';
27      $(div).html(errorMessage);
28      $(holder).prepend(div);
29      $('#wait').hide();
30    };
31
32    var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback);
33    progress.setProgress(-1, initMessage);
34    $(holder).append(progress.element);
35    progress.startMonitoring(uri+'&op=do', 10);
36  });
37};
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.