bkruse: branch 1.4 r1346 - in /branches/1.4/config: ./ scripts/

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


Author: bkruse
Date: Wed Aug 15 15:29:51 2007
New Revision: 1346

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1346
Log:
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:
    branches/1.4/config/digital.html
    branches/1.4/config/scripts/astman.js

Modified: branches/1.4/config/digital.html
URL: http://svn.digium.com/view/asterisk-gui/branches/1.4/config/digital.html?view=diff&rev=1346&r1=1345&r2=1346
==============================================================================
--- branches/1.4/config/digital.html (original)
+++ branches/1.4/config/digital.html Wed Aug 15 15:29:51 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: branches/1.4/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/1.4/config/scripts/astman.js?view=diff&rev=1346&r1=1345&r2=1346
==============================================================================
--- branches/1.4/config/scripts/astman.js (original)
+++ branches/1.4/config/scripts/astman.js Wed Aug 15 15:29:51 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