File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/javascript/admin.upgrade.js
/**
* This object handles all the javascript related functions for the
* upgrade wizard in the control panel
*/
var Upgrade = {
BackupFileName: '',
TotalProcessCount: 0,
CurrentProcess: 1,
ProgressPercent: 0,
UpdateProcessProgress: function(status, percentage) {
$('#progressBarPercentage').css('width', parseInt(percentage) + "%");
$('#progressPercent').html(parseInt(percentage) + "%");
$('#progressBarStatus').html(status);
},
RequestNextUpgrade: function(){
$.getJSON('remote.php?section=upgrade&action=nextupgrade', function(json){
if(json['continue']){
Upgrade.CurrentProcess++;
Upgrade.ProgressPercent = ((Upgrade.CurrentProcess-1) / Upgrade.TotalProcessCount) * 100;
Upgrade.UpdateProcessProgress('(Running Process ' + Upgrade.CurrentProcess + ' of ' + Upgrade.TotalProcessCount + ')', Upgrade.ProgressPercent);
Upgrade.RequestNextUpgrade();
}else{
Upgrade.FinishUpgrade(json.hasErrors);
}
});
},
FinishUpgrade: function(hasErrors) {
$.iModal.close();
if(hasErrors){
$.iModal({type: 'ajax',close: false, url: 'remote.php?section=upgrade&action=finishupgrade', title: 'Upgrade Wizard', width: '500', buttons: '<input type="button" style="font-weight: bold" value="Finish" id="FinishedUpgradeButton" class="Button" disabled="disabled" />' });
}else{
$.iModal({type: 'ajax',close: true, url: 'remote.php?section=upgrade&action=finishupgrade', title: 'Upgrade Wizard', width: '500', buttons: '<input type="button" style="font-weight: bold" value="Finish" onclick="window.location.reload();" id="FinishedUpgradeButton" class="Button" />' });
}
},
SupportResolve: function() {
$.getJSON('remote.php?section=upgrade&action=forceresolve', function(json){
if(json.success){
$.iModal.close();
alert('Error messages cleared, version number updated.');
}
});
},
ErrorWindow: function(hasErrors) {
var extraButton = '';
var objURL = new Object();
window.location.search.replace( new RegExp( "([^?=&]+)(=([^&]*))?", "g" ), function( $0, $1, $2, $3 ){ objURL[ $1 ] = $3; } );
if(objURL['support'] == 'yes'){
extraButton = '<input type="button" style="font-weight: bold" value="Resolve Errors" id="ResolveUpgradeButton" onClick="Upgrade.SupportResolve();" class="Button" />';
}
$.iModal({type: 'ajax',close: false, url: 'remote.php?section=upgrade&action=showerrors', title: 'Upgrade Wizard', width: '500', buttons: extraButton + '<input type="button" style="font-weight: bold" value="Finish" id="FinishedUpgradeButton" class="Button" disabled="disabled" />' });
},
LaunchWizard: function () {
$.iModal({type: 'ajax',close: false, url: 'remote.php?section=upgrade&action=showupgrade', title: 'Upgrade Wizard', width: '500', buttons: '<input type="button" style="font-weight: bold" value="Continue" onclick="Upgrade.UpgradeStepTwo();" class="Button" />' });
},
UpgradeStepTwo: function () {
var sendStats = 'yes';
if(!$('#sendinfo:checked').exists()){
sendStats = 'no';
}
$.iModal.close();
$.iModal({type: 'ajax',close: false, url: 'remote.php?section=upgrade&action=showdbbackup&sendstats=' + sendStats, title: 'Upgrade Wizard', width: '500', buttons: '<input type="button" style="font-weight: bold" value="Continue" onclick="Upgrade.UpgradeStepThree();" disabled="disabled" class="Button" id="BackupContinueButton" />' });
},
UpgradeStepThree: function () {
$.iModal.close();
$.iModal({type: 'ajax',close: false, url: 'remote.php?section=upgrade&action=runprocesses', title: 'Upgrade Wizard', width: '500', buttons: '<input type="button" style="font-weight: bold" value="Finish" onclick="Upgrade.FinishUpgrade();" disabled="disabled" class="Button" id="FinishedUpgradeButton" />' });
},
CreateDBBackup: function () {
$('#CreateBackupButton').hide();
$('#CreateBackupStatus').show();
$('<iframe></iframe>').attr('id', 'progressiframe').attr('src', 'remote.php?section=upgrade&action=createdbbackup').appendTo('body').hide();
},
UpdateProgress: function (percent) {
$('#backupPercent').html(percent);
},
FinishedBackup: function () {
$('#CreateBackupStatus').hide();
$('#BackupFileLink').attr('href', '../tmp/' + Upgrade.BackupFileName);
$('#CreateBackupFinished').show();
$('#BackupContinueButton').removeAttr('disabled');
},
SetFileName: function (fileName) {
Upgrade.BackupFileName = fileName;
}
};