| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 // $Id: batch.js,v 1.4 2007/10/21 18:59:01 goba Exp $ 2 3 /** 4 * Attaches the batch behavior to progress bars. 5 */ 6 Drupal.behaviors.batch = function (context) { 7 // This behavior attaches by ID, so is only valid once on a page. 8 if ($('#progress.batch-processed').size()) { 9 return; 10 } 11 $('#progress', context).addClass('batch-processed').each(function () { 12 var holder = this; 13 var uri = Drupal.settings.batch.uri; 14 var initMessage = Drupal.settings.batch.initMessage; 15 var errorMessage = Drupal.settings.batch.errorMessage; 16 17 // Success: redirect to the summary. 18 var updateCallback = function (progress, status, pb) { 19 if (progress == 100) { 20 pb.stopMonitoring(); 21 window.location = uri+'&op=finished'; 22 } 23 }; 24 25 var errorCallback = function (pb) { 26 var div = document.createElement('p'); 27 div.className = 'error'; 28 $(div).html(errorMessage); 29 $(holder).prepend(div); 30 $('#wait').hide(); 31 }; 32 33 var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback); 34 progress.setProgress(-1, initMessage); 35 $(holder).append(progress.element); 36 progress.startMonitoring(uri+'&op=do', 10); 37 }); 38 };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |