|
From: <ma...@us...> - 2012-06-06 20:29:58
|
Revision: 862
http://openautomation.svn.sourceforge.net/openautomation/?rev=862&view=rev
Author: mayerch
Date: 2012-06-06 20:29:49 +0000 (Wed, 06 Jun 2012)
Log Message:
-----------
Better handling of invalid config files: show error message
Modified Paths:
--------------
CometVisu/trunk/visu/lib/templateengine.js
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2012-06-06 11:09:51 UTC (rev 861)
+++ CometVisu/trunk/visu/lib/templateengine.js 2012-06-06 20:29:49 UTC (rev 862)
@@ -43,9 +43,9 @@
}
visu.user = 'demo_user'; // example for setting a user
-var configSuffix = "";
+var configSuffix;
if ($.getUrlVar("config")) {
- configSuffix = "_" + $.getUrlVar("config");
+ configSuffix = $.getUrlVar("config");
}
var clientDesign = "";
@@ -83,8 +83,21 @@
$(document).ready(function() {
// get the data once the page was loaded
- $.ajaxSetup({cache: !forceReload});
- $.get( 'visu_config' + configSuffix + '.xml', parseXML );
+ $.ajax({
+ url: 'visu_config' + (configSuffix ? '_' + configSuffix : '' ) + '.xml',
+ cache: !forceReload,
+ success: parseXML,
+ error: function(jqXHR, textStatus, errorThrown){
+ var message = 'Config-File Error! ';
+ switch( textStatus )
+ {
+ case 'parsererror':
+ message += '<br />Invalid config file!<br /><a href="check_config.php?config=' + configSuffix + '">Please check!</a>';
+ }
+ $('#loading').html( message );
+ },
+ dataType: 'xml'
+});
} );
$(window).unload(function() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|