This commit is contained in:
Rick Falkvinge
2012-11-14 23:35:30 +00:00
parent 4076ff59cd
commit 7ccc1b2cf0
+30 -21
View File
@@ -96,6 +96,8 @@
} else {
// Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds.
alert('setting first timeout function');
setTimeout('recheckConfigurationWritability();', 5000); // 5s until first re-check
}
}
@@ -131,29 +133,36 @@
return isValid;
}
function recheckConfigurationWritability() {
$.ajax({
type: "POST",
url: "Default.aspx/IsConfigurationFileWritable",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false, // blocks until function returns - race conditions otherwise
success: function (msg) {
if (msg.d == true) {
// Yes, config is writable. Hide "unwritable" div, show "writable" div, all is nice
$('#DivDatabaseUnwritable').slideUp('fast').fadeOut('fast');
$('#DivDatabaseWritable').fadeIn('fast');
} else {
// Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds.
setTimeout('recheckConfigurationWritability();', 2000); // 5s until first re-check
}
}
});
}
});
function recheckConfigurationWritability() {
alert('In timeout function');
$.ajax({
type: "POST",
url: "Default.aspx/IsConfigurationFileWritable",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false, // blocks until function returns - race conditions otherwise
success: function (msg) {
if (msg.d == true) {
alert('yes, writable');
// Yes, config is writable. Hide "unwritable" div, show "writable" div, all is nice
$('#DivDatabaseUnwritable').slideUp('fast').fadeOut('fast');
$('#DivDatabaseWritable').fadeIn('fast');
} else {
// Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds.
setTimeout('recheckConfigurationWritability();', 2000);
}
}
});
}
</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>