diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-12-06 09:25:22 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-12-06 09:25:22 +0000 |
commit | a19acb219e249693357daeb037165eaf19a70b33 (patch) | |
tree | c7d04eacff376e51303c55e773153b8c898086a8 /misc | |
parent | e31f7abd42b4905ec0aa4961c7d920e373c012d9 (diff) | |
download | brdo-a19acb219e249693357daeb037165eaf19a70b33.tar.gz brdo-a19acb219e249693357daeb037165eaf19a70b33.tar.bz2 |
- Patch #35924 by Neil: improved the update system.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/drupal.js | 2 | ||||
-rw-r--r-- | misc/maintenance.css | 36 | ||||
-rw-r--r-- | misc/progress.js | 14 | ||||
-rw-r--r-- | misc/update.js | 20 |
4 files changed, 63 insertions, 9 deletions
diff --git a/misc/drupal.js b/misc/drupal.js index c2ee52332..f1af13be1 100644 --- a/misc/drupal.js +++ b/misc/drupal.js @@ -67,7 +67,7 @@ function HTTPGet(uri, callbackFunction, callbackParameter) { /** * Creates an HTTP POST request and sends the response to the callback function */ -function HTTPPost(uri, object, callbackFunction, callbackParameter) { +function HTTPPost(uri, callbackFunction, callbackParameter, object) { var xmlHttp = new XMLHttpRequest(); var bAsync = true; if (!callbackFunction) { diff --git a/misc/maintenance.css b/misc/maintenance.css index 8c6a5bbe6..2292550ce 100644 --- a/misc/maintenance.css +++ b/misc/maintenance.css @@ -9,8 +9,13 @@ body { } h1 { margin: 1.6em 0 1.1em 0; +} +h1, h2, h3, h4, h5, h6 { font-family: sans-serif; } +ul { + margin: 0; +} :link { color: #0073ba; font-weight: bold; @@ -20,13 +25,34 @@ h1 { font-weight: bold; } +div.messages { + border: 1px solid #ddd; + padding: 0.4em; + margin-top: 1em; +} + +div.error { + border: 1px solid #daa; +} + /* Update styles */ -h3.update { - font-size: 1em; +#update-results { + margin-top: 3em; + padding: 0.25em; + border: 1px solid #ccc; + background: #eee; + font-size: smaller; +} +#update-results h2 { + margin-top: 0.25em; +} +#update-results h4 { + margin-bottom: 0.25em; } -pre.update span.success { - color: #6bb521; +#update-results li.none { + color: #888; + font-style: italic; } -pre.update span.failure { +#update-results li.failure strong { color: #b63300; } diff --git a/misc/progress.js b/misc/progress.js index a2de44e80..b19cc08db 100644 --- a/misc/progress.js +++ b/misc/progress.js @@ -2,12 +2,17 @@ * A progressbar object. Initialized with the given id. Must be inserted into * the DOM afterwards through progressBar.element. * + * method is the function which will perform the HTTP request to get the + * progress bar status. Either HTTPGet or HTTPPost. + * * e.g. pb = new progressBar('myProgressBar'); * some_element.appendChild(pb.element); */ -function progressBar(id) { +function progressBar(id, callback, method) { var pb = this; this.id = id; + this.method = method ? method : HTTPGet; + this.callback = callback; this.element = document.createElement('div'); this.element.id = id; @@ -36,6 +41,9 @@ progressBar.prototype.setProgress = function (percentage, status) { divs[i].innerHTML = status; } } + if (this.callback) { + this.callback(percentage, status); + } } /** @@ -61,14 +69,14 @@ progressBar.prototype.sendPing = function () { if (this.timer) { clearTimeout(this.timer); } - HTTPGet(this.uri, this.receivePing, this); + this.method(this.uri, this.receivePing, this); } /** * HTTP callback function. Passes data back to the progressbar and sets a new * timer for the next ping. */ -progressBar.prototype.receivePing = function(string, xmlhttp, pb) { +progressBar.prototype.receivePing = function (string, xmlhttp, pb) { if (xmlhttp.status != 200) { return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ pb.uri); } diff --git a/misc/update.js b/misc/update.js new file mode 100644 index 000000000..e4358d269 --- /dev/null +++ b/misc/update.js @@ -0,0 +1,20 @@ +if (isJsEnabled()) { + addLoadEvent(function() { + if ($('edit-has_js')) { + $('edit-has_js').value = 1; + } + + if ($('progress')) { + updateCallback = function (progress, status) { + if (progress == 100) { + window.location = window.location.href.split('op=')[0] +'op=finished'; + } + } + + this.progress = new progressBar('updateprogress', updateCallback, HTTPPost); + this.progress.setProgress(-1, 'Starting updates...'); + $('progress').appendChild(this.progress.element); + this.progress.startMonitoring('update.php?op=do_update', 0); + } + }); +} |