bkruse: branch bkruse/dahdi_integration r3991 - in /team/bkruse/dahdi_integra...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Oct 21 15:20:25 CDT 2008


Author: bkruse
Date: Tue Oct 21 15:20:24 2008
New Revision: 3991

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=3991
Log:
Merge all of Paris changes from branches/2.0 (since people are now testing this branch)

Modified:
    team/bkruse/dahdi_integration/config/asterisklogs.html
    team/bkruse/dahdi_integration/config/backup.html
    team/bkruse/dahdi_integration/config/bulkadd.html
    team/bkruse/dahdi_integration/config/dialplans.html
    team/bkruse/dahdi_integration/config/features.html
    team/bkruse/dahdi_integration/config/flashupdate.html
    team/bkruse/dahdi_integration/config/flipadvanced.html
    team/bkruse/dahdi_integration/config/followme.html
    team/bkruse/dahdi_integration/config/hardware.html
    team/bkruse/dahdi_integration/config/hardware_aa50.html
    team/bkruse/dahdi_integration/config/home.html
    team/bkruse/dahdi_integration/config/incoming.html
    team/bkruse/dahdi_integration/config/index.html
    team/bkruse/dahdi_integration/config/js/astman.js
    team/bkruse/dahdi_integration/config/js/index.js
    team/bkruse/dahdi_integration/config/js/pbx.js
    team/bkruse/dahdi_integration/config/menus.html
    team/bkruse/dahdi_integration/config/queues.html
    team/bkruse/dahdi_integration/config/sysinfo.html
    team/bkruse/dahdi_integration/config/timezone.html
    team/bkruse/dahdi_integration/config/trunks_providers.html
    team/bkruse/dahdi_integration/config/trunks_voip.html
    team/bkruse/dahdi_integration/config/upload_abe_overlay.html
    team/bkruse/dahdi_integration/config/upload_form.html
    team/bkruse/dahdi_integration/config/welcome.html

Modified: team/bkruse/dahdi_integration/config/asterisklogs.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/asterisklogs.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/asterisklogs.html (original)
+++ team/bkruse/dahdi_integration/config/asterisklogs.html Tue Oct 21 15:20:24 2008
@@ -38,7 +38,7 @@
 	var lm = sel_date.split(' ')[1]; lm = lm.trim();
 	var tmp_cmd = "/bin/grep /var/log/asterisk/messages -e '" + lm + space + ld + " ' " ;
 	parent.ASTGUI.dialog.waitWhile(' Loading Asterisk Logs ...');
-	ASTGUI.debugLog(tmp_cmd);
+	ASTGUI.Log.Debug(tmp_cmd);
 	ASTGUI.systemCmdWithOutput( tmp_cmd , function(output){
 		parent.ASTGUI.dialog.hide();
 		_$('todaylog').innerHTML = (output) ? "<PRE>" + output.escapeHTML() + "</PRE>" : "No log messages found on this Day" ;

Modified: team/bkruse/dahdi_integration/config/backup.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/backup.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/backup.html (original)
+++ team/bkruse/dahdi_integration/config/backup.html Tue Oct 21 15:20:24 2008
@@ -67,7 +67,7 @@
 		return;
 	}
 	if(!top.sessionData.httpConf.postmappings_defined || !top.sessionData.httpConf.uploadPaths['backups'] ){
-		ASTGUI.ErrorLog('AG102');
+		ASTGUI.Log.Error('AG102');
 		$('#uploadForm_container').hide();
 		return ;
 	}

Modified: team/bkruse/dahdi_integration/config/bulkadd.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/bulkadd.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/bulkadd.html (original)
+++ team/bkruse/dahdi_integration/config/bulkadd.html Tue Oct 21 15:20:24 2008
@@ -111,7 +111,6 @@
 		}
 	};
 
-	// ASTGUI.debugLog( NEW_USERS , 'parse');
 	create_NEW_USERS();
 };
 
@@ -131,7 +130,7 @@
 		}
 
 		newusers_list.push(tmp_nu);
-			ASTGUI.debugLog( 'adding user ' + tmp_nu , 'parse');
+			ASTGUI.Log.Debug( 'adding user ' + tmp_nu);
 			NEW_USERS[ tmp_nu ] = {} ;
 			NEW_USERS[ tmp_nu ]['fullname'] = 'User ' + tmp_nu;
 			NEW_USERS[ tmp_nu ]['cid_number'] = tmp_nu;

Modified: team/bkruse/dahdi_integration/config/dialplans.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/dialplans.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/dialplans.html (original)
+++ team/bkruse/dahdi_integration/config/dialplans.html Tue Oct 21 15:20:24 2008
@@ -194,7 +194,7 @@
 					}
 				}
 			}catch(err){
-				ASTGUI.ErrorLog(err.description);
+				ASTGUI.Log.Error(err.description);
 			}
 
 			addCell( newRow , { html: dr_woPfx.join(', ') } );

Modified: team/bkruse/dahdi_integration/config/features.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/features.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/features.html (original)
+++ team/bkruse/dahdi_integration/config/features.html Tue Oct 21 15:20:24 2008
@@ -53,10 +53,10 @@
 
 var do_new_ApplicationMap_row = function(){
 	var TBL = _$('Table_applicationMap_definitions');
-	create_new_AppMap_tr(TBL.rows.length, '');
-};
-
-var create_new_AppMap_tr = function( appNumber , featureName){
+	create_new_AppMap_tr('');
+};
+
+var create_new_AppMap_tr = function( featureName){
 	if(featureName){
 		var tmp_fields = ApplicationMap[featureName].split(',') ;
 	}else{
@@ -65,9 +65,24 @@
 	}
 
 	var TBL = _$('Table_applicationMap_definitions');
+
+	if( !TBL.rows.length || (TBL.rows.length && TBL.rows[0].className == 'noapps') ){
+		ASTGUI.domActions.removeAllChilds(TBL);
+		var addCell = ASTGUI.domActions.tr_addCell;
+		var newRow = TBL.insertRow(-1);
+		newRow.className = "frow";
+		addCell( newRow , { html:'Enabled' } );
+		addCell( newRow , { html:'Feature Name'} );
+		addCell( newRow , { html:'Digits'} );
+		addCell( newRow , { html:'ActiveOn/By'} );
+		addCell( newRow , { html:'App Name'} );
+		addCell( newRow , { html:'Arguments'} );
+		addCell( newRow , { html:''} );
+	}
+
 	var newRow = TBL.insertRow(-1);
 	newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
-	newRow.id = AP_MAP_TRID + String(appNumber) ;
+	newRow.id = AP_MAP_TRID + String(  Math.round(10000 * Math.random())  )  ;
 	
 	var C1 = document.createElement('input');
 	C1.type = 'checkbox';
@@ -121,28 +136,32 @@
 	ASTGUI.updateFieldToValue( CE , tmp_fields[3] );
 	var newcell = newRow.insertCell( newRow.cells.length );
 	newcell.appendChild( CE );
+
+	var DB = document.createElement('span'); DB.innerHTML = 'Delete' ; DB.className = 'guiButton';
+	var newcell = newRow.insertCell( newRow.cells.length );
+	ASTGUI.events.add( DB , 'click' , function(){
+		newRow.parentNode.removeChild(newRow);
+	});
+	newcell.appendChild( DB );
+
 };
 
 
 var generate_applicationMap_TRs = function(){
 	var TBL = _$('Table_applicationMap_definitions');
-	var addCell = ASTGUI.domActions.tr_addCell;
-	(function(){ // add first row
-		var newRow = TBL.insertRow(-1);
-		newRow.className = "frow";
-		
-		addCell( newRow , { html:'Enabled' } );
-		addCell( newRow , { html:'Feature Name'} );
-		addCell( newRow , { html:'Digits'} );
-		addCell( newRow , { html:'ActiveOn/By'} );
-		addCell( newRow , { html:'App Name'} );
-		addCell( newRow , { html:'Arguments'} );
-	})();
 
 	var apps = 0;
 	for(var featureName in ApplicationMap){
 		if( !ApplicationMap.hasOwnProperty(featureName) ){ continue}
-		create_new_AppMap_tr( TBL.rows.length , featureName);
+		create_new_AppMap_tr( featureName);
+	}
+
+	if( !TBL.rows.length ){
+		ASTGUI.domActions.removeAllChilds(TBL);
+		newRow = TBL.insertRow(-1);
+		newRow.className = 'noapps';
+		var newcell = newRow.insertCell( newRow.cells.length );
+		newcell.innerHTML = "No Applicaiton Maps defined !";
 	}
 };
 
@@ -282,15 +301,16 @@
 			u.new_action('delete', FM , 'parkcall', '');
 		}
 
-
 		u.new_action( 'delcat', 'applicationmap' , '', '');
 		u.new_action( 'newcat', 'applicationmap' , '', '');
 
-		for( var R = 1, RL = TBL.rows.length ; R < RL ; R++ ){
-			var thisrow_id = '#' + AP_MAP_TRID + String(R) ;
-			var this_featureName = $(thisrow_id + ' .textbox_featurename')[0].value.trim() ;
+		for( var R = 0, RL = TBL.rows.length ; R < RL ; R++ ){
+
+			if( TBL.rows[R].className == 'noapps' || TBL.rows[R].className == 'frow' ){ continue; }
+			var thisrow_id = '#' + String(TBL.rows[R].id) ;
+
+			var this_featureName = $( thisrow_id + ' .textbox_featurename')[0].value.trim() ;
 			if( !this_featureName )continue ;
-
 
 			var this_enabled = $(thisrow_id + ' .textbox_feature_CheckBox')[0].checked ;
 			if( this_enabled ) {
@@ -302,11 +322,10 @@
 			var this_args = $(thisrow_id + ' .textbox_appArgs')[0].value.trim() ;
 			var tmp_arr = [this_digits, this_activeOnBy, this_appName, this_args ];
 
-
 			u.new_action( 'append', 'applicationmap' , this_featureName , tmp_arr.join(',') );
 		}
 
-		u.callActions();
+	u.callActions();
 
 	var DIAL_OPS = '' ;
 

Modified: team/bkruse/dahdi_integration/config/flashupdate.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/flashupdate.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/flashupdate.html (original)
+++ team/bkruse/dahdi_integration/config/flashupdate.html Tue Oct 21 15:20:24 2008
@@ -226,7 +226,7 @@
 
 var onUploadForm_load = function(){
 	if(!top.sessionData.httpConf.postmappings_defined || !top.sessionData.httpConf.uploadPaths['backups'] ){
-		ASTGUI.ErrorLog('AG102');
+		ASTGUI.Log.Error('AG102');
 		$('#uploadForm_container').hide();
 		return ;
 	}

Modified: team/bkruse/dahdi_integration/config/flipadvanced.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/flipadvanced.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/flipadvanced.html (original)
+++ team/bkruse/dahdi_integration/config/flipadvanced.html Tue Oct 21 15:20:24 2008
@@ -52,9 +52,7 @@
 			parent.$(".debugWindow").hide();
 		}else{
 			parent.sessionData.DEBUG_MODE = true;
-			if ( !parent.sessionData.DEBUG_PROFILER_BEGIN ){
-				parent.miscFunctions.DEBUG_START();
-			}
+			parent.miscFunctions.DEBUG_START();
 			parent.$(".debugWindow").show();
 		}
 	});
@@ -63,7 +61,8 @@
 
 var update_status = function(){
 
-	if(parent.sessionData.advancedmode == true ){
+	var am = ASTGUI.cookies.getCookie('advancedmode');
+	if( am && am == 'yes' ){
 		_$('flip_button').innerHTML = 'Hide Advanced Options';
 		_$('flip_decsription').innerHTML = "Clicking the 'Hide Advanced Options' button below removes the advanced menu items on the left hand sidebar"
 		+ "<BR><BR><B>Notice!</B>  Digium does not provide support for the options configurable in the Advanced menu items. "

Modified: team/bkruse/dahdi_integration/config/followme.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/followme.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/followme.html (original)
+++ team/bkruse/dahdi_integration/config/followme.html Tue Oct 21 15:20:24 2008
@@ -301,8 +301,6 @@
 
 
 var save_FollowMeUser = function(){
- // we do not have seperate edit/new cases here, we just have to save the chosen preferences
-
 	// update follow me status of the user in extensions.conf
 	// update followme.conf with all other chosen preferences
 	// reload the page
@@ -320,6 +318,13 @@
 	for( var t=0; t < CURRENT_DESTINATIONS.length ; t++ ){
 		u.new_action( 'append', EDIT_USER , 'number', CURRENT_DESTINATIONS[t] );
 	}
+
+	var uinfo = parent.sessionData.pbxinfo.users[EDIT_USER];
+	if( !uinfo.getProperty('hasvoicemail').isAstTrue() ){
+		ASTGUI.updateaValue({file:'users.conf', context : EDIT_USER, variable :'hasvoicemail', value :'yes'});
+		parent.sessionData.pbxinfo.users[EDIT_USER].hasvoicemail = 'yes';
+	}
+
 	u.callActions( function(){
 		window.location.reload();
 	});

Modified: team/bkruse/dahdi_integration/config/hardware.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/hardware.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/hardware.html (original)
+++ team/bkruse/dahdi_integration/config/hardware.html Tue Oct 21 15:20:24 2008
@@ -207,14 +207,14 @@
 	if(configured_devices.length == detected_devices.length){
 		for(var l=0; l < configured_devices.length; l++){
 			if(configured_devices[l] != detected_devices[l]){ // devices does not match - but the number of devices match
-				ASTGUI.debugLog("DEVICES or basechans does not MATCHED");
+				ASTGUI.Log.Debug("DEVICES or basechans does not MATCHED");
 				return true;
 			}
 		}
-		ASTGUI.debugLog("DEVICES and basechans MATCH");
+		ASTGUI.Log.Debug("DEVICES and basechans MATCH");
 		return false;
 	}else{	
-		ASTGUI.debugLog("DEVICES or basechans does not MATCHED");
+		ASTGUI.Log.Debug("DEVICES or basechans does not MATCHED");
 		return true;
 	}
 }
@@ -420,7 +420,7 @@
 	//   check if the channels in zapchan are within max and min
 	//   if yes then set the current range values
 	load_hwcfgfile: function(){ // read hwcfgfile (if exists) into CONFIGUREDHARDWARE 
-		ASTGUI.debugLog("load last configured hardware information, start function: loadConfigFiles.load_hwcfgfile()" , 'parse');
+		ASTGUI.Log.Debug("load last configured hardware information, start function: loadConfigFiles.load_hwcfgfile()");
 		var n = config2json({filename:hwcfgfile, usf:1});
 		if( n.getOwnProperties().length == 0 ){ // if file not found or no previous hardware detected
 				hwchanged = -1;
@@ -436,11 +436,11 @@
 			}}
 			loadConfigFiles.runZtscan();
 		}
-		ASTGUI.debugLog("end of function: loadConfigFiles.load_hwcfgfile()" , 'parse');
+		ASTGUI.Log.Debug("end of function: loadConfigFiles.load_hwcfgfile()");
 	},
 
 	runZtscan: function(){
-		ASTGUI.debugLog("start function: loadConfigFiles.runZtscan()" , 'parse');
+		ASTGUI.Log.Debug("start function: loadConfigFiles.runZtscan()");
 
 		var config_file = "";
 		if (parent.sessionData.PLATFORM.isAST_1_6) {
@@ -460,12 +460,12 @@
 			parent.ASTGUI.systemCmd( path , function(){ // run ztscan/dahdi_scan and then try loading ztscan.conf (both output to ztscan.conf)
 				window.setTimeout( loadConfigFiles.readZtscanConf , 700 ); // leave some time for ztscan to generate ztscan.conf
 			});
-			ASTGUI.debugLog("end of function: loadConfigFiles.runZtscan()" , 'parse');
+			ASTGUI.Log.Debug("end of function: loadConfigFiles.runZtscan()");
 		});
 	},
 
 	readZtscanConf: function(){
-		ASTGUI.debugLog("start function: loadConfigFiles.readZtscanConf()" , 'parse');
+		ASTGUI.Log.Debug("start function: loadConfigFiles.readZtscanConf()");
 		var ztsc = $.ajax({ url: ASTGUI.paths.rawman+'?action=getconfig&filename=ztscan.conf', async: false }).responseText;
 		var ztsc_Lower = ztsc.toLowerCase();
 		if( ztsc_Lower.contains('response: error') && ztsc_Lower.contains('message: config file not found') ){
@@ -530,12 +530,12 @@
 			}}
 		}}
 		if(hwchanged != -1){ hwchanged = detectHwChanges(); }
-		ASTGUI.debugLog("end of function: loadConfigFiles.readZtscanConf()" , 'parse');
+		ASTGUI.Log.Debug("end of function: loadConfigFiles.readZtscanConf()");
 		loadConfigFiles.readUsersConf(); // read span_x (where T1/E1 trunks are defined)
 	},
 
 	readUsersConf: function(){
-		ASTGUI.debugLog("start function: loadConfigFiles.readUsersConf()" , 'parse');
+		ASTGUI.Log.Debug("start function: loadConfigFiles.readUsersConf()");
 
 		var usrs = $.ajax({ url: ASTGUI.paths.rawman+'?action=getconfig&filename=users.conf', async: false }).responseText;
 		var usrs_Lower = usrs.toLowerCase();
@@ -609,12 +609,12 @@
 				}
 			}}
 		})();
-		ASTGUI.debugLog("end of function: loadConfigFiles.readUsersConf()" , 'parse');
+		ASTGUI.Log.Debug("end of function: loadConfigFiles.readUsersConf()");
 		showtable();
 	},
 
 	load_zaptel_conf: function(){
-		ASTGUI.debugLog("start function: loadConfigFiles.load_zaptel_conf()" , 'parse');
+		ASTGUI.Log.Debug("start function: loadConfigFiles.load_zaptel_conf()");
 		// we parse zaptel.conf to get the loadzone and syncsrc for each span
 		var tmp_file = ASTGUI.globals.zaptelIncludeFile;
 		var parseZaptelconf = function(zp){
@@ -672,7 +672,7 @@
 				parseZaptelconf(q);
 			}
 		}
-		ASTGUI.debugLog("end of function: loadConfigFiles.load_zaptel_conf()" , 'parse');
+		ASTGUI.Log.Debug("end of function: loadConfigFiles.load_zaptel_conf()");
 	}
 };
 
@@ -1147,7 +1147,7 @@
 
 
 var localajaxinit = function(){
-	ASTGUI.debugLog("Starting Loading Page digital.html .. start function: window.onload()" , 'parse');
+	ASTGUI.Log.Debug("Starting Loading Page digital.html .. start function: window.onload()");
 	portsSignalling = ASTGUI.cloneObject(parent.sessionData.PORTS_SIGNALLING);
 
 	ASTGUI.domActions.enableDisableByCheckBox ('enable_disable_checkbox_opermode', 'opermode') ;
@@ -1235,7 +1235,7 @@
 
 	ASTGUI.events.add( _$('edit_DefinedChans'), "change", edit_DefinedChans_changed );
 
-	ASTGUI.debugLog("end of function: window.onload()" , 'parse');
+	ASTGUI.Log.Debug("end of function: window.onload()");
 
 	(function(){ // load modprobe settings
 		var c = context2json ({ filename: ASTGUI.globals.configfile , context: 'general', usf: 1 });

Modified: team/bkruse/dahdi_integration/config/hardware_aa50.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/hardware_aa50.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/hardware_aa50.html (original)
+++ team/bkruse/dahdi_integration/config/hardware_aa50.html Tue Oct 21 15:20:24 2008
@@ -249,11 +249,11 @@
 
 
 var localajaxinit = function(){
-	ASTGUI.debugLog("Starting Loading Page hardware_aa50.html .. start function: window.onload()" , 'parse');
+	ASTGUI.Log.Debug("Starting Loading Page hardware_aa50.html .. start function: window.onload()");
 	ASTGUI.dialog.waitWhile('Detecting Hardware ...');
 	top.document.title = "Analog Hardware Setup & Configuration";
 	load_currentAnalogSettings();
-	ASTGUI.debugLog("end of function: window.onload()" , 'parse');
+	ASTGUI.Log.Debug("end of function: window.onload()");
 };
 
 
@@ -377,7 +377,7 @@
 				parseZaptelconf(q);
 			}
 		}
-		ASTGUI.debugLog("end of function: loadConfigFiles.load_zaptel_conf()" , 'parse');
+		ASTGUI.Log.Debug("end of function: loadConfigFiles.load_zaptel_conf()");
 	})();
 
 	(function(){ // load modprobe settings

Modified: team/bkruse/dahdi_integration/config/home.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/home.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/home.html (original)
+++ team/bkruse/dahdi_integration/config/home.html Tue Oct 21 15:20:24 2008
@@ -70,7 +70,7 @@
 	var f = makeSyncRequest({ action :'login', username: DOM_username.value, secret: DOM_secret.value });
 	f = f.toLowerCase();
 	if(f.match('authentication accepted')){
-		ASTGUI.debugLog("Login Success result: " + f , 'update');
+		ASTGUI.Log.Debug("Login Success result: " + f);
 		setLoggedIn( { welcome_redirect: false } );
 		DOM_secret.blur();
 		parent.ASTGUI.dialog.waitWhile(' <font color=#005119><b>Login Success</b></font>');
@@ -93,7 +93,7 @@
 
 		return;
 	}else if(f.match('authentication failed') ) {
-		ASTGUI.debugLog("Login failure result: " + f , 'update');
+		ASTGUI.Log.Debug("Login failure result: " + f);
 		ASTGUI.feedback({msg:'Invalid Username or Password', showfor: 4, color:'#c42421'}) ;
 		DOM_secret.focus();
 		DOM_secret.select();

Modified: team/bkruse/dahdi_integration/config/incoming.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/incoming.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/incoming.html (original)
+++ team/bkruse/dahdi_integration/config/incoming.html Tue Oct 21 15:20:24 2008
@@ -386,7 +386,7 @@
 		}
 
 		if( isNewIR == true ){ // create new Incoming Rule
-			ASTGUI.debugLog("create New Incoming Rule" , 'parse');
+			ASTGUI.Log.Debug("create New Incoming Rule");
 			parent.ASTGUI.dialog.waitWhile('Creating Incoming Rule ...');
 
 			if( ASTGUI.getFieldValue('edit_itrl_dest') == 'ByDID' ){
@@ -411,7 +411,7 @@
 
 				var TMP_MYCALLBACK = function(){
 					if( !EX_CF.hasOwnProperty( thisRule_context ) ){
-						ASTGUI.debugLog("creating [time interval did context]" , 'parse');
+						ASTGUI.Log.Debug("creating [time interval did context]");
 						x.new_action ( 'newcat', thisRule_context , '' , '' );
 					}
 	
@@ -422,7 +422,7 @@
 						x.new_action( 'append', thisRule_context, 'exten', ASTGUI.globals.sbcid_2 );
 						x.new_action( 'append', thisRule_context, 'exten', this_ActualRule );
 					}else{
-						ASTGUI.debugLog("NewRule is exten=" + this_ActualRule + 'in context [' + thisRule_context + ']' , 'parse');
+						ASTGUI.Log.Debug("NewRule is exten=" + this_ActualRule + 'in context [' + thisRule_context + ']');
 						x.new_action( 'append', thisRule_context, 'exten', this_ActualRule );
 					}
 
@@ -434,10 +434,10 @@
 				};
 	
 				if( PREVIOUS.contains(NEWTF_INCLUDE_STR) ){
-					ASTGUI.debugLog("No need to include time interval did context in DID_trunk_x" , 'parse');
+					ASTGUI.Log.Debug("No need to include time interval did context in DID_trunk_x");
 					TMP_MYCALLBACK();
 				}else{
-					ASTGUI.debugLog("adding 'include = time interval did context' in [DID_trunk_x]" , 'parse');
+					ASTGUI.Log.Debug("adding 'include = time interval did context' in [DID_trunk_x]");
 					PREVIOUS.splice(0,0,NEWTF_INCLUDE_STR);
 					ASTGUI.miscFunctions.empty_context({ filename: 'extensions.conf', context : ASTGUI.contexts.TrunkDIDPrefix + this_trunk, cb : function(){
 						PREVIOUS.each( function( this_newPreviousLine ){

Modified: team/bkruse/dahdi_integration/config/index.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/index.html?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/index.html (original)
+++ team/bkruse/dahdi_integration/config/index.html Tue Oct 21 15:20:24 2008
@@ -22,13 +22,7 @@
 
 </style>
 <link href="stylesheets/cfgbasic.css" media="all" rel="Stylesheet" type="text/css" />
-<script src="js/jquery.js"></script>
-<script src="js/astman.js"></script>
-<script src="js/pbx.js"></script>
-<script src="js/index.js"></script>
-<script src="js/tooltip.js"></script>
 <script>
-
 // Store any run time data in this Object - ex: detected platform, has compact flash, FXO/FXS ports, etc etc.
 var sessionData = {
 	finishedParsing : false,
@@ -76,7 +70,7 @@
 				// and NOT the channels on a digital span with FXS or FXO signalling
 	DEBUG_LOG : [], // all the debug log messages will be stored in this array (If debug mode is enabled)
 	DEBUG_MODE : false, // set to true when debugging -- parent.sessionData.DEBUG_MODE
-	DEBUG_PROFILER_BEGIN : 0 , // store the timestamp when you start profiling
+	DEBUG_WHICH: { Ajax: true, Debug: true, Error: true, Console: true, Info: true, Warn: true } , // parent.sessionData.DEBUG_WHICH.Ajax/Debug/Error/Console/Info/Warn
 	REQUIRE_RESTART : false, // this flag is used to know if there are any updates in zapchan settings
 				// like if a FXS is assigned to a user or an analog trunk is created or something 
 				// if this flag is true - we want to throw alert 'on ApplySettings' saying that a restart is required
@@ -90,6 +84,11 @@
 };
 
 </script>
+<script src="js/jquery.js"></script>
+<script src="js/astman.js"></script>
+<script src="js/pbx.js"></script>
+<script src="js/index.js"></script>
+<script src="js/tooltip.js"></script>
 <head>
 	<title>Asterisk Configuration GUI</title>
 	<link rel="shortcut icon" href="images/favicon.ico" />
@@ -270,6 +269,24 @@
 				<span id="dbw_flip" class='dbw_flip_show'>Hide debug messages</span>
 			</td>
 			<td align=right>
+				<input type='checkbox' id='debugWindow_which_Ajax'> 
+				<label for='debugWindow_which_Ajax'> Ajax Requests </label>
+
+				<input type='checkbox' id='debugWindow_which_Debug'> 
+				<label for='debugWindow_which_Debug'> Debug  </label>
+
+				<input type='checkbox' id='debugWindow_which_Error'> 
+				<label for='debugWindow_which_Error'> Error </label>
+
+				<input type='checkbox' id='debugWindow_which_Console'> 
+				<label for='debugWindow_which_Console'> Console </label>
+
+				<input type='checkbox' id='debugWindow_which_Info'> 
+				<label for='debugWindow_which_Info'> Info </label>
+
+				<input type='checkbox' id='debugWindow_which_Warnings'> 
+				<label for='debugWindow_which_Warnings'> Warnings </label>
+
 				<span class='guiButton' onclick='miscFunctions.DEBUG_CLEAR();'>Clear</span>
 			</td>
 		</tr>

Modified: team/bkruse/dahdi_integration/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/astman.js?view=diff&rev=3991&r1=3990&r2=3991
==============================================================================
--- team/bkruse/dahdi_integration/config/js/astman.js (original)
+++ team/bkruse/dahdi_integration/config/js/astman.js Tue Oct 21 15:20:24 2008
@@ -22,10 +22,9 @@
 
 _$ = function(x){
 	if ( typeof x != 'string' ){ return null ;}
-	if(document.getElementById(x)){
+	try{
 		return document.getElementById(x); 
-	}
-	return null;
+	}catch(err){ return null; }
 };
 
 // Some custom methods to Array Objects
@@ -43,9 +42,7 @@
 
 	Array.prototype.lastValue = function(){
 		// [0,1,2]
-		if( this.length )
-			return this[this.length - 1] ;
-		return null;
+		return (this.length)? this[this.length - 1] : null;
 	};
 
 	Array.prototype.replaceLastWith = function(a){
@@ -54,10 +51,7 @@
 	}
 
 	Array.prototype.contains = function(str) {
-		for(var i=0, j = this.length ; i < j; i++ ){
-			if( this[i] === str )return true;
-		}
-		return false;
+		return this.indexOf(str) != -1 ;
 	};
 
 	Array.prototype.containsLike = function(str) {
@@ -71,7 +65,8 @@
 	};
 
 	Array.prototype.forEach = function(iterator) { // call a function on each element and update the element with the returned value
-		for(var i=0 , j = this.length; i < j ; i++ ){
+		var i = this.length;
+		while (i--) {
 			this[i] = iterator(this[i] , i);
 		}
 	};
@@ -92,7 +87,8 @@
 	
 	if(!Array.indexOf){
 		Array.prototype.indexOf = function(a){
-			for(var i=0; i<this.length; i++){
+			var i = this.length;
+			while (i--) {
 				if( this[i] === a ){
 					return i;
 				}
@@ -108,10 +104,12 @@
 	};
 
 	Array.prototype.lastIndexOfLike = function( searchString ){
-		var lastindex = -1;
-		if(!searchString.length){ return lastindex; }
-		for(var i=0; i < this.length; i++ ){ if( this[i].beginsWith(searchString) ){ lastindex = i; } }
-		return lastindex ;
+		if(!searchString.length){ return -1;}
+		var i = this.length;
+		while (i--) {
+			if( typeof this[i] == 'string' && this[i].beginsWith(searchString) ){ return i; }
+		}
+		return -1 ;
 	};
 
 	Array.prototype.push_IfNotPresent = function( a ){
@@ -224,7 +222,7 @@
 	};
 
 	String.prototype.isAstTrue = function () {
-		return ( this == 'yes' || this == 'true' || this == 'y' || this == 't' || this == '1' || this == 'on' ) ? true : false;
+		return ["yes", "true", "y", "t", "1", "on"].contains(this.toLowerCase().trim());
 	};
 
 	String.prototype.getNoOp = function(){
@@ -442,7 +440,7 @@
 	},
 
 	cliCommand : function(cmd) { // ASTGUI.cliCommand(cmd);
-		ASTGUI.debugLog("Executing manager command : '" + cmd + "'" , 'manager');
+		ASTGUI.Log.Debug("Executing manager command : '" + cmd + "'");
 		return makeSyncRequest ( { action :'command', command: cmd } );
 	},
 
@@ -497,12 +495,12 @@
 	},
 
 	doTransfer : function(from, to) {
-		ASTGUI.debugLog("About to transfer " + from + " to " + to, 'manager');
+		ASTGUI.Log.Debug("About to transfer " + from + " to " + to);
 		return makeSyncRequest ( { action :'redirect', channel :from, exten :to, context :'default', priority :'1' } );
 	},
 
 	doHangup : function(chan) {
-		ASTGUI.debugLog("Executing hangup on channel : '" + chan + "'" , 'manager');
+		ASTGUI.Log.Debug("Executing hangup on channel : '" + chan + "'");
 		return makeSyncRequest ( { action :'hangup', channel: chan } );
 	},
 
@@ -525,6 +523,10 @@
 		setCookie: function(x , y){ // ASTGUI.cookies.setCookie( 'something' , 'valueofSomething' );
 			var tmp = x + '=' + y + '; path = /' ;
 			top.document.cookie = tmp;
+		},
+
+		removeCookie: function(x){
+			top.document.cookie = x + '=somevalue; expires=Fri, 22 Oct 1999 00:00:00 UTC; path=/' ;
 		},
 
 		clearCookies: function(){  // ASTGUI.cookies.clearCookies()
@@ -684,38 +686,49 @@
 		return b;
 	},
 
-	debugLog: function(msg, color){ // Ex:		ASTGUI.debugLog('Some debug message', 'get');
-		if(!top.sessionData.DEBUG_MODE ){ return true; }
-
-		if( typeof msg == 'object' ){
-			msg = 'OBJECT : ' + ASTGUI.getObjectPropertiesAsString(msg) ;
-		}
-
-		if(!color){ color = '#324176'; }
-		switch(color){
-			case 'get':	// for getconfig and reading html files
-				color = '#9A9A9A';
-				break;
-			case 'update': // for updateconfig messages
-				color = '#CC0066';
-				break;
-			case 'manager': // for manager commands
-				color = '#2B6C36';
-				break;
-			case 'system': // for system commands
-				color = '#F47A00';
-				break;
-			case 'parse': // for logging parse errors
-				color = '#4C9996';
-				//msg = '<b>' + msg + '</b>' ;
-				break;
-		}
-		var now = new Date();
-		var h = now.getHours().addZero() + ':' + now.getMinutes().addZero() + ':' + now.getSeconds().addZero() ;
-		if( top.sessionData.DEBUG_LOG.length > 250){
-			top.sessionData.DEBUG_LOG = top.sessionData.DEBUG_LOG.slice(0,50);
-		}
-		top.sessionData.DEBUG_LOG.unshift( h + ' <font color='+ color +'>' + msg + '</font>' );
+	Log: {
+		doLog: function(msg, color){
+			if(!top.sessionData.DEBUG_MODE ){ return true; }
+			if( typeof msg == 'object' ){
+				msg = 'OBJECT : ' + ASTGUI.getObjectPropertiesAsString(msg) ;
+			}
+
+			var now = new Date();
+			var h = now.getHours().addZero() + ':' + now.getMinutes().addZero() + ':' + now.getSeconds().addZero() ;
+			if( top.sessionData.DEBUG_LOG.length > 250 ){
+				top.sessionData.DEBUG_LOG = top.sessionData.DEBUG_LOG.slice(0,50);
+			}
+			top.sessionData.DEBUG_LOG.unshift( h + ' <font color='+ color +'>' + msg + '</font>' );
+		},
+
+		Ajax: function(msg){ // ASTGUI.Log.Ajax(msg);
+			if ( top.sessionData.DEBUG_WHICH.Ajax == true ) this.doLog( msg , '#96997C' );
+		},
+
+		Debug: function( msg ){ // ASTGUI.Log.Debug();
+			if ( top.sessionData.DEBUG_WHICH.Debug == true ) this.doLog( msg , '#4C9996' );
+		},
+
+		Error: function( msg ){ // ASTGUI.Log.Error();
+			if( !top.sessionData || !top.sessionData.DEBUG_WHICH.Error ) return;
+			if( msg.length <=5 && ASTGUI.errorCodes[msg] ){
+				this.doLog( '<B>' + ASTGUI.errorCodes[msg] + '</B>' , '#992b23' );
+			}else{
+				this.doLog( '<B>' + msg + '</B>' , '#992b23' );
+			}
+		},
+
+		Console: function( msg ){ // ASTGUI.Log.Console();
+			if( top.sessionData.DEBUG_WHICH.Console == true && window.console && window.console.firebug ) console.log ( msg );
+		},
+
+		Info: function( msg ){ // ASTGUI.Log.Info(msg);
+			if( top.sessionData.DEBUG_WHICH.Info == true ) this.doLog( msg , '#9A9A9A' );
+		},
+
+		Warn: function( msg ){ // ASTGUI.Log.Warn( msg );
+			if( top.sessionData.DEBUG_WHICH.Warn == true ) this.doLog( msg , '#F47A00' );
+		}
 	},
 
 	dialog : {
@@ -1055,48 +1068,10 @@
 		}
 	},
 
-	ErrorLog: function( Code ){// Ex: ASTGUI.ErrorLog('AG102');
-		if( Code.length <=5 && ASTGUI.errorCodes[Code] ){
-			ASTGUI.debugLog( '<B>' + ASTGUI.errorCodes[Code] + '</B>' , '#990033' );
-		}else{
-			ASTGUI.debugLog( '<B>' + Code + '</B>' , '#990033' );
-		}
-	},
-
 	feedback : function( fb ){
 		// usage  ::  ASTGUI.feedback( { msg:'your message here', showfor:2, color:'#000000', bgcolor:'#FFFFFF' } );
 		top.miscFunctions.setFeedback(fb);
 	},
-
-// 	generateGraph : function( DATA ){ // generates bar graph into table DATA.TBL for array DATA.VALS
-// 		// ASTGUI.generateGraph( {TBL: 'DIV_Graph', VALS: gr_vals, HEIGHT: 150, WIDTH: 9 });
-// 		// WIDTH is width of each cell
-// 		var TBL = DATA.TBL;
-// 		var VALS = DATA.VALS ;
-// 		var HEIGHT = Number(DATA.HEIGHT) || 100 ;
-// 		var WIDTH = DATA.WIDTH || 5 ;
-// 
-// 		var table_ofHeight = function(h, color){
-// 			h = Math.floor((HEIGHT * Number(h))/100) ;
-// 			var uh = HEIGHT - h ;
-// 			if(!color){ color = '#a8b6e5';}
-// 			return "<TABLE cellpadding=0 cellspacing=0><TR><TD bgcolor='#FFFFFF' height=" + uh + " width=" + WIDTH + "></TD></TR>"
-// 				+ "<TR><TD bgcolor='"+ color +"' height=" + h + " width=" + WIDTH + "></TD></TR></TABLE>" ;
-// 		};
-// 
-// 		if ( typeof TBL == 'string'){ TBL = _$(TBL); }
-// 		ASTGUI.domActions.clear_table(TBL);
-// 		var newRow = TBL.insertRow(-1);
-// 		VALS.each( function( this_val ){
-// 			var newcell = newRow.insertCell( newRow.cells.length );
-// 			newcell.align = 'center' ;
-// 			newcell.valign = 'bottom' ;
-// 			newcell.width = WIDTH + 'px' ;
-// 			newcell.height = HEIGHT ;
-// 			var clr = ((newRow.cells.length)%2==1) ? '#a8b6e5' : '#dce5f6' ;
-// 			newcell.innerHTML = table_ofHeight( this_val , clr );
-// 		});
-// 	},
 
 	getFieldValue : function(el){ // ASTGUI.getFieldValue(el)
 		if ( typeof el == 'string'){ el = _$(el) ; }
@@ -1566,7 +1541,7 @@
 					return q.substring(l+1);
 				}
 			}
-			ASTGUI.ErrorLog( "ASTGUI.parseContextLine.getAppWithArgs() could not parse \"" + q + "\" " );
+			ASTGUI.Log.Error( "ASTGUI.parseContextLine.getAppWithArgs() could not parse \"" + q + "\" " );
 			return '';
 		},
 
@@ -1584,7 +1559,7 @@
 
 			q = q.trim();
 			if ( !q.endsWith(')') || !q.contains('(') ){
-				ASTGUI.ErrorLog( "ASTGUI.parseContextLine.getArgs() - No Argument found for \"" + q + "\" " );
+				ASTGUI.Log.Error( "ASTGUI.parseContextLine.getArgs() - No Argument found for \"" + q + "\" " );
 				return [];
 			}
 			var y = ASTGUI.parseContextLine.getAppWithArgs(q);
@@ -1853,23 +1828,6 @@
 			return cr;
 		}
 	},
-
-// 	profiling : {
-// 		start: function(){
-// 			if(!top.sessionData.DEBUG_MODE ){ return true; }
-// 			var now = new Date();
-// 			top.sessionData.DEBUG_PROFILER_BEGIN = now.getTime() ;
-// 		},
-// 
-// 		snapShot: function(a){
-// 			if(!top.sessionData.DEBUG_MODE ){ return true; }
-// 			if ( !a || (typeof a != 'string') ){ a = ''; }
-// 			var now = new Date();
-// 			var diff = now.getTime() - top.sessionData.DEBUG_PROFILER_BEGIN ;
-// 			ASTGUI.debugLog( '<B> Profiler Time : '+ diff +' ms</B> ' + a , '#990033');
-// 			top.sessionData.DEBUG_PROFILER_BEGIN = now.getTime() ;
-// 		}
-// 	},
 
 	resetTheseFields : function( flds ){ // ASTGUI.resetTheseFields(arr) , flds = [ el1, el2 , el_3 ] ; - sets each element to blank value
 		if(!ASTGUI.isArray(flds)){ return; }
@@ -2065,127 +2023,6 @@
 		}
 	}, // { selectbox }
 
-// 	selectRange_populate : function(g , els){
-// 		/* 	TODO
-// 			The 'selectRange_populate function' is right now a bit heavy, ugly and relies extensively on closures.
-// 			this function should in future be replaced with a prototype based object
-// 		*/
-// 		if(typeof g == 'string'){ g = _$(g); }
-// 		g.startRange = '';
-// 		g.stopRange = '';
-// 		var range_documentCatch = function(){
-// 			try{
-// 				var children = g.childNodes;
-// 				for (var i = 0; i < children.length; i++) {
-// 					var tmp = children[i] ;
-// 					ASTGUI.events.remove( tmp , 'mousemove' , update_range ) ;
-// 				};
-// 			}catch(err){
-// 			
-// 			}finally{
-// 				ASTGUI.events.remove( document , 'mouseup' , range_documentCatch ) ;
-// 			}
-// 		};
-// 		var range_start = function(event){
-// 			g.startRange = g.stopRange = this.innerHTML;
-// 			//console.log( 'Range is : ' + g.startRange + ' to ' + g.stopRange );
-// 			if($.browser.msie){
-// 				event.returnValue = false;
-// 			} else{
-// 				event.preventDefault();
-// 			}
-// 	
-// 			var children = g.childNodes ;
-// 			for (var i = 0; i < children.length; i++) {
-// 				var tmp = children[i] ;
-// 				ASTGUI.events.add( tmp , 'mousemove' , update_range ) ;
-// 				//$(tmp).css({backgroundColor : '#FFFFFF' });
-// 				tmp.className = 'selectRange_notselected';
-// 			};
-// 			ASTGUI.events.add( document , 'mouseup' , range_documentCatch ) ;
-// 			//$(this).css({backgroundColor :'#EFEFEF' });
-// 			$(this).addClass('selectRange_selected');
-// 		};
-// 		var update_range = function(event){
-// 			if($.browser.msie){
-// 				event.returnValue = false;
-// 			} else{
-// 				event.preventDefault();
-// 			}
-// 			try{
-// 				g.stopRange = this.innerHTML;
-// 			}catch(err){
-// 				var p = ASTGUI.events.getTarget(event) ;
-// 				g.stopRange = p.innerHTML;
-// 			}
-// 			//console.log( 'Range is : ' + g.startRange + ' to ' + g.stopRange );
-// 			var x = els.indexOf(g.startRange) ;
-// 			var y = els.indexOf(g.stopRange) ; 
-// 			var start_index = Math.min(x,y);
-// 			var stop_index = Math.max(x,y);
-// 	
-// 			var children = g.childNodes;
-// 			for (var i = 0; i < children.length; i++) {
-// 				var tmp = children[i] ;
-// 				var tmp_html = tmp.innerHTML;
-// 				var tmp_index = els.indexOf(tmp_html) ;
-// 				tmp.className = ( tmp_index <= stop_index && tmp_index >= start_index ) ? 'selectRange_selected' : 'selectRange_notselected' ;
-// 				//$(tmp).css({backgroundColor : ( tmp_index <= stop_index && tmp_index >= start_index ) ? '#EFEFEF' : '#FFFFFF' });
-// 			};
-// 		};
-// 		var range_stop = function(){
-// 			//console.log( 'Range is : ' + g.startRange + ' to ' + g.stopRange );
-// 			var x = els.indexOf(g.startRange) ;
-// 			var y = els.indexOf(g.stopRange) ; 
-// 			var start_index = Math.min(x,y);
-// 			var stop_index = Math.max(x,y);
-// 			g.startRange = els[start_index];
-// 			g.stopRange = els[stop_index];
-// 	
-// 			var children = g.childNodes;
-// 			for (var i = 0; i < children.length; i++) {
-// 				var tmp = children[i] ;
-// 				var tmp_html = tmp.innerHTML;
-// 				var tmp_index = els.indexOf(tmp_html) ;
-// 				ASTGUI.events.remove( tmp , 'mousemove' , update_range ) ;
-// 				//$(tmp).css({backgroundColor : ( tmp_index <= stop_index && tmp_index >= start_index ) ? '#EFEFEF' : '#FFFFFF' });
-// 				tmp.className = ( tmp_index <= stop_index && tmp_index >= start_index ) ? 'selectRange_selected' : 'selectRange_notselected' ;
-// 			};
-// 			ASTGUI.events.remove( document , 'mouseup' , range_documentCatch ) ;
-// 		};
-// 	
-// 		els.each(function(elm){
-// 			var tmp = document.createElement('SPAN'); 
-// 			tmp.innerHTML = elm ;
-// 			tmp.className = 'selectRange_notselected';
-// 			$(tmp).mousedown( range_start );
-// 			$(tmp).mouseup( range_stop );
-// 			g.appendChild( tmp );
-// 		});
-// 	
-// 		$(g).css({cursor:'pointer'});
-// 
-// 		g.reset_range = function(){
-// 			g.startRange = g.stopRange = '';
-// 			var children = g.childNodes;
-// 			for ( var i = 0; i < children.length; i++ ) { children[i].className = 'selectRange_notselected' ; }
-// 		};
-// 
-// 		g.set_range = function(a,b){
-// 			var x = els.indexOf(a) ;
-// 			var y = els.indexOf(b) ; 
-// 			g.startRange = Math.min(x,y) ;
-// 			g.stopRange = Math.max(x,y);
-// 			var children = g.childNodes;
-// 			for ( var i = 0; i < children.length; i++ ) {
-// 				var tmp = children[i] ;
-// 				var tmp_html = tmp.innerHTML;
-// 				var tmp_index = els.indexOf(tmp_html) ;

[... 985 lines stripped ...]



More information about the asterisk-gui-commits mailing list