pari: branch asterisknow r1898 - /branches/asterisknow/config/
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Tue Dec 4 17:23:36 CST 2007
Author: pari
Date: Tue Dec 4 17:23:35 2007
New Revision: 1898
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1898
Log:
Just load the list of FXO,FXS ports on login so that we can use them where ever
Modified:
branches/asterisknow/config/cfgbasic.html
branches/asterisknow/config/home.html
branches/asterisknow/config/users.html
Modified: branches/asterisknow/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/cfgbasic.html?view=diff&rev=1898&r1=1897&r2=1898
==============================================================================
--- branches/asterisknow/config/cfgbasic.html (original)
+++ branches/asterisknow/config/cfgbasic.html Tue Dec 4 17:23:35 2007
@@ -26,6 +26,8 @@
<script src="scripts/astman.js"></script>
<link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
<script>
+var FXO_PORTS_DETECTED = []; // so that we donot have to parse ztscan output each time where we want this list
+var FXS_PORTS_DETECTED = []; // so that we donot have to parse ztscan output each time where we want this list
var eventeater = new Object;
var loggedon = -1;
var accordion;
@@ -45,6 +47,27 @@
MainScreenPanels.push(r);
};
+
+function get_FXOFXSPORTS(c){
+ var y;
+ FXO_PORTS_DETECTED = [];
+ FXS_PORTS_DETECTED = [];
+
+ for( var d in c ){ if (c.hasOwnProperty(d) ) {
+ c[d].each(
+ function( item ) {
+ if( item.beginsWith('port') && item.contains('FXO') ){ // we are looking for item if it is in the format 'port=4,FXO'
+ y = item.split('=')[1].split(',')[0];
+ FXO_PORTS_DETECTED.push(y);
+ }
+ if( item.beginsWith('port') && item.contains('FXS') ){ // we are looking for item if it is in the format 'port=4,FXO'
+ y = item.split('=')[1].split(',')[0];
+ FXS_PORTS_DETECTED.push(y);
+ }
+ }
+ );
+ }}
+}
function fit_toScreen(){
var t = ASTGUI.displayHeight();
@@ -241,40 +264,6 @@
}
-function check_digital(n) {
-
- var l, h;
- if( n == "ERROR: CONFIG FILE NOT FOUND"){
- return false;
- }
- for( l in n ){ if(n.hasOwnProperty(l)){
- if( l =='general') {
- if(n[l]['continue'] == "no") {
- has_digital = 0; /* ztscan.conf was NOT found */
- /* Maybe check to see if isnew is set to one, then redirect them on a setup wizard about modprobing the drivers and what not */
- return false;
- }
- if(n[l]['continue'] == "yes") {
- has_digital = 1;
- var tot_spans = n[l]['totalspans'];
- if(n[l]['isnew'] == "yes") {
- _$('status_message').style.display="block";
- _$('status_message').innerHTML = '<TABLE border=0 cellpadding=0 cellspacing=4 align=center>' +
- '<TR><TD><img src="./images/loading.gif"></TD>' +
- '<TD><div id=message_text></div></TD></TR></TABLE>';
- _$('message_text').innerHTML = "Time: <div id='counter'>10</div> Digital Cards Detected! Total Spans: " + tot_spans + "<BR>Options:<br>1. <A href=\"#\" class=\"splbutton\" onclick=\"_$('status_message').style.display='none'; _$('mainscreen').src = 'digital.html';\">Digital Card Setup Wizard</A><br>2. <A href=\"#\" class=\"splbutton\" onclick=\"_$('status_message').style.display='none';>Continue<br></a>";
- setTimeout("_$('status_message').style.display='none';", 10000);
- int_handle = setInterval("_$('counter').innerHTML = (_$('counter').innerHTML - 1);", 1000);
- setTimeout("clearInterval(int_handle);", 10000);
- return true;
- }
- }
- }
-
- }}
- return true;
-
-}
function registerajax() {
showdiv_statusmessage();
fit_toScreen();
@@ -282,13 +271,7 @@
pao();
astmanEngine = new Astman();
astmanEngine.setURL(asterisk_rawmanPath );
-
createpanels();
- /* If ztscan is not installed, the config file will not be generated. */
- if(!config2json("ztscan.conf", 1, check_digital)) {
- has_digital = 0; /* ztscan.conf was NOT found */
- }
-
_$('mainscreen').src = "home.html" ;
if( navigator.userAgent.indexOf("MSIE") != -1 || navigator.userAgent.indexOf("Konqueror") != -1 || navigator.userAgent.indexOf("Safari") != -1 ){
gui_feedback(browser_alert, 'green');
Modified: branches/asterisknow/config/home.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/home.html?view=diff&rev=1898&r1=1897&r2=1898
==============================================================================
--- branches/asterisknow/config/home.html (original)
+++ branches/asterisknow/config/home.html Tue Dec 4 17:23:35 2007
@@ -103,6 +103,9 @@
_ll.onclick = parent.Logoff ;
_ll.style.display = "" ;
+ parent.astmanEngine.run_tool(asterisk_guiZtscan, function(t) { // run ztscan and then try loading ztscan.conf
+ setTimeout( function(){config2json('ztscan.conf', 0, parent.get_FXOFXSPORTS);} , 500); // leave some time for ztscan to generate ztscan.conf
+ });
}
function loggedOff() {
@@ -136,47 +139,12 @@
parent.astmanEngine.sendRequest('action=login&username=' + encodeURIComponent( _$('username').value ) + "&secret=" + encodeURIComponent(_$('secret').value), afterlogin);
}
-function check_digital(n) {
-
- var l, h;
- for( l in n ){ if(n.hasOwnProperty(l)){
- if( l =='general') {
- if(n[l]['continue'] == "no") {
- has_digital = 0; /* ztscan.conf was NOT found */
- /* Maybe check to see if isnew is set to one, then redirect them on a setup wizard about modprobing the drivers and what not */
- return false;
- }
- if(n[l]['continue'] == "yes") {
- has_digital = 1;
- var tot_spans = n[l]['totalspans'];
- if(n[l]['isnew'] == "yes") {
- _$('status_message').style.display="block";
- _$('status_message').innerHTML = '<TABLE border=0 cellpadding=0 cellspacing=4 align=center>' +
- '<TR><TD><img src="./images/loading.gif"></TD>' +
- '<TD><div id=message_text></div></TD></TR></TABLE>';
- _$('message_text').innerHTML = "Time: <div id='counter'>10</div> Digital Cards Detected! Total Spans: " + tot_spans + "<BR>Options:<br>1. <A href=\"#\" class=\"splbutton\" onclick=\"_$('status_message').style.display='none'; parent._$('mainscreen').src = 'digital.html';\">Digital Card Setup Wizard</A><br>2. <A href=\"#\" class=\"splbutton\" onclick=\"_$('status_message').style.display='none';>Continue<br></a>";
- setTimeout("_$('status_message').style.display='none';", 10000);
- int_handle = setInterval("_$('counter').innerHTML = (_$('counter').innerHTML - 1);", 1000);
- setTimeout("clearInterval(int_handle);", 10000);
- return true;
- }
- }
- }
-
- }}
- return true;
-
-}
-
afterlogin = function(msgs) {
_$('statusbar').innerHTML = msgs[0].headers['message'];
if ( msgs[0].headers['response'] == "Success" ){
parent.gui_feedback("Login Successful",'blue',6000);
_$('statusbar').innerHTML = "<img src='images/tick.gif'><i>Connected!</i>";
//parent.astmanEngine.pollEvents();
- if(!config2json("ztscan.conf", 1, check_digital)) {
- has_digital = 0; /* ztscan.conf was NOT found */
- }
loggedOn();
}else if( msgs[0].headers['message'] == "Authentication failed" ){
parent.gui_feedback("Invalid Username/Password",'default',6000);
Modified: branches/asterisknow/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/users.html?view=diff&rev=1898&r1=1897&r2=1898
==============================================================================
--- branches/asterisknow/config/users.html (original)
+++ branches/asterisknow/config/users.html Tue Dec 4 17:23:35 2007
@@ -270,26 +270,6 @@
}
-function analoglines_loaded(c){
- var _zapchan = _$('zapchan') ;
- var y;
-
- for( var d in c ){ if (c.hasOwnProperty(d) ) {
- c[d].each(
- function( item ) {
- if( item.beginsWith('port') && item.contains('FXO') ){ // we are looking for item if it is in the format 'port=4,FXO'
- y = item.split('=')[1].split(',')[0];
- ASTGUI.selectbox.append( _zapchan,"Analog Port #" + y , y );
- }
- }
- );
- }}
-
- ASTGUI.selectbox.insert_before(_zapchan,"None", "", 0);
- config2json('extensions.conf', 1, dialplans_loaded ) ;
- //parent.astmanEngine.config2list("extensions.conf", _$('context'), new Array(), numcallbacks);
-}
-
function dialplans_loaded(b){
var c = b ;
var _context = _$('context') ;
@@ -351,11 +331,13 @@
}
}
}
-
- parent.astmanEngine.run_tool(asterisk_guiZtscan, function(t) { // run ztscan and then try loading ztscan.conf
- setTimeout( function(){ config2json('ztscan.conf', 0, analoglines_loaded ) ; } , 500); // leave some time for ztscan to generate ztscan.conf
+ var _zapchan = _$('zapchan') ;
+ parent.FXO_PORTS_DETECTED.each( function(y) {
+ ASTGUI.selectbox.append( _zapchan,"Analog Port #" + y , y );
});
-
+
+ ASTGUI.selectbox.insert_before(_zapchan,"None", "", 0);
+ config2json('extensions.conf', 1, dialplans_loaded ) ;
return true;
});
}
More information about the asterisk-gui-commits
mailing list