bkruse: trunk r1348 - in /trunk: ./ config/digital.html config/scripts/astman.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Aug 15 15:32:56 CDT 2007


Author: bkruse
Date: Wed Aug 15 15:32:55 2007
New Revision: 1348

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1348
Log:
Merged revisions 1346 via svnmerge from 
https://origsvn.digium.com/svn/asterisk-gui/branches/1.4

........
r1346 | bkruse | 2007-08-15 15:29:51 -0500 (Wed, 15 Aug 2007) | 1 line

Added some support to astman.js for config2json. Now when you use config to json, you can use its return value as a conditional statement, eg, if(!config2json(doesnotexist.conf, 1, function(t) { do_something(); }) { alert('config file not found'); }); An example of this is included in the commit, as the first attempt at it, in digital.html
........

Modified:
    trunk/   (props changed)
    trunk/config/digital.html
    trunk/config/scripts/astman.js

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Wed Aug 15 15:32:55 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-1291,1293,1298-1300,1326,1332,1336-1338,1342
+/branches/1.4:1-1291,1293,1298-1300,1326,1332,1336-1338,1342,1346

Modified: trunk/config/digital.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/digital.html?view=diff&rev=1348&r1=1347&r2=1348
==============================================================================
--- trunk/config/digital.html (original)
+++ trunk/config/digital.html Wed Aug 15 15:32:55 2007
@@ -107,7 +107,6 @@
 //		}
 	}}
 
-	alert("just did parentloadd screen");
 	_$('status_message').style.display='none';
 
 	return "span: " + t.name + " Mode: " + mode;
@@ -161,7 +160,13 @@
 	_$('message_text').innerHTML = "Detecting Digital Cards ... (Beta)";
 	setWindowTitle("Digital Setup Wizard");
 	parent.loadscreen(this);
-	parent.astmanEngine.run_tool(asterisk_guiZtscan, onSuccess = function() { config2json("ztscan.conf", 1, digitalparse); }); 
+	parent.astmanEngine.run_tool(asterisk_guiZtscan, onSuccess = function() { 
+		if(!config2json("ztscan.conf", 1, digitalparse)) {
+			alert("Have you properly installed ztscan to /sbin/ztscan?\n/etc/asterisk/ztscan.conf does not exist.");
+			_$('error_txt').style.display="";
+			_$('error_txt').innerHTML="<br><br>Problem Detecting/No Cards(or spans) Found!<br><br>  Error: No Config File";		
+		}
+	}); 
 }
 
 function free_mem(){

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=1348&r1=1347&r2=1348
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Wed Aug 15 15:32:55 2007
@@ -466,7 +466,15 @@
 
 
 function config2json(a, b, c){		// a is filename (string) , b is 0 or 1 , c is callback function
-	makerequest('g',a,'', function(t){var f = toJSO(t, b) ;  c(f) ;});
+	makerequest('g',a,'', function(t){
+	var response = t.split("\n");
+	if(response[1].match("Message: Config file not found")) {
+		//alert( "Asterisk says it cannot find a required config file (" + a + ") \n!" );
+		return false;
+	}
+	var f = toJSO(t, b) ;  c(f) ;
+	});
+	return true; /* If our previous case of config file not found does not return already, we must have found the config file */
 }
 
 function toJSO(z, p){




More information about the asterisk-gui-commits mailing list