Commit d194c884 authored by Penny Leach's avatar Penny Leach
Browse files

tidied up the installer/upgrader and added icons

parent 1cc9db14
...@@ -32,6 +32,15 @@ require(dirname(dirname(__FILE__)).'/init.php'); ...@@ -32,6 +32,15 @@ require(dirname(dirname(__FILE__)).'/init.php');
$upgrades = check_upgrades(); $upgrades = check_upgrades();
$js = 'var todo = ' . json_encode(array_keys($upgrades)) . ";\n"; $js = 'var todo = ' . json_encode(array_keys($upgrades)) . ";\n";
$loadingicon = theme_get_image_path('loading.gif');
$successicon = theme_get_image_path('success.gif');
$failureicon = theme_get_image_path('failure.gif');
$loadingstring = get_string('upgradeloading','admin');
$successstring = get_string('upgradesuccess','admin');
$failurestring = get_string('upgradefailure','admin');
$js .= <<< EOJS $js .= <<< EOJS
function processNext() { function processNext() {
var element = todo.shift(); var element = todo.shift();
...@@ -43,14 +52,22 @@ $js .= <<< EOJS ...@@ -43,14 +52,22 @@ $js .= <<< EOJS
var d = loadJSONDoc('upgrade.json.php', { 'name': element }); var d = loadJSONDoc('upgrade.json.php', { 'name': element });
$(element).innerHTML = 'working... '; $(element).innerHTML = '<img src="{$loadingicon}" alt="{$loadingstring}" />';
d.addCallback(function (data) { d.addCallback(function (data) {
if ( data.success ) { if ( data.success ) {
$(data.key).innerHTML = 'Done! Upgraded to version ' + data.newversion; var message = '{$successstring}' + data.newversion;
$(data.key).innerHTML = '<img src="{$successicon}" alt="' + message + '" /> ' + message;
} }
else { else {
$(data.key).innerHTML = 'Poo, Error: ' + data.errormessage; var message = '';
if (data.errormessage) {
message = data.errormessage;
}
else {
message = '{$failurestring}';
}
$(data.key).innerHTML = '<img src="{$failureicon}" alt="' + message + '" /> ' + message;
} }
processNext(); processNext();
}); });
......
...@@ -5,4 +5,7 @@ $string['fromversion'] = 'From version'; ...@@ -5,4 +5,7 @@ $string['fromversion'] = 'From version';
$string['toversion'] = 'To version'; $string['toversion'] = 'To version';
$string['notinstalled'] = 'Not installed'; $string['notinstalled'] = 'Not installed';
$string['nothingtoupgrade'] = 'Nothing to upgrade'; $string['nothingtoupgrade'] = 'Nothing to upgrade';
$string['upgradeloading'] = 'Loading...';
$string['upgradesuccess'] = 'Successfully upgraded to version ';
$string['upgradefailure'] = 'Failed to upgrade!';
?> ?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment