2006-03-09 23:20:24 +00:00
// $Id$
2006-08-31 23:31:25 +00:00
if ( Drupal . jsEnabled ) {
$ ( document ) . ready ( function ( ) {
$ ( '#edit-has_js' ) . each ( function ( ) { this . value = 1 ; } ) ;
$ ( '#progress' ) . each ( function ( ) {
var holder = this ;
2005-12-06 09:25:22 +00:00
2006-03-28 09:29:23 +00:00
// Success: redirect to the summary.
var updateCallback = function ( progress , status , pb ) {
2005-12-06 09:25:22 +00:00
if ( progress == 100 ) {
2005-12-21 23:44:08 +00:00
pb . stopMonitoring ( ) ;
2005-12-06 09:25:22 +00:00
window . location = window . location . href . split ( 'op=' ) [ 0 ] + 'op=finished' ;
}
}
2006-03-28 09:29:23 +00:00
// Failure: point out error message and provide link to the summary.
var errorCallback = function ( pb ) {
var div = document . createElement ( 'p' ) ;
div . className = 'error' ;
2006-08-31 23:31:25 +00:00
$ ( div ) . html ( 'An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>' ) ;
$ ( holder ) . prepend ( div ) ;
$ ( '#wait' ) . hide ( ) ;
2006-03-01 22:19:24 +00:00
}
2006-08-31 23:31:25 +00:00
var progress = new Drupal . progressBar ( 'updateprogress' , updateCallback , "POST" , errorCallback ) ;
2006-02-05 19:04:58 +00:00
progress . setProgress ( - 1 , 'Starting updates' ) ;
2006-08-31 23:31:25 +00:00
$ ( holder ) . append ( progress . element ) ;
2005-12-21 23:44:08 +00:00
progress . startMonitoring ( 'update.php?op=do_update' , 0 ) ;
2006-08-31 23:31:25 +00:00
} ) ;
2005-12-06 09:25:22 +00:00
} ) ;
}