pari: trunk r1019 - in /trunk/config: ./ scripts/

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Fri Jun 1 11:43:38 MST 2007


Author: pari
Date: Fri Jun  1 13:43:37 2007
New Revision: 1019

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1019
Log:
Code cleanup(1) - Running all code through jslint and fixing any critical errors

Modified:
    trunk/config/cfgbasic.html
    trunk/config/cli.html
    trunk/config/feditor.html
    trunk/config/graphs.html
    trunk/config/iax.html
    trunk/config/incoming.html
    trunk/config/localexts.html
    trunk/config/meetme.html
    trunk/config/menus.html
    trunk/config/numberplan.html
    trunk/config/options.html
    trunk/config/queues.html
    trunk/config/record.html
    trunk/config/ringgroups.html
    trunk/config/scripts/astman.js
    trunk/config/sip.html
    trunk/config/status.html
    trunk/config/sysinfo.html
    trunk/config/syslog.html
    trunk/config/timerules.html
    trunk/config/trunks.html
    trunk/config/users.html
    trunk/config/voicemail.html

Modified: trunk/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/cfgbasic.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/cfgbasic.html (original)
+++ trunk/config/cfgbasic.html Fri Jun  1 13:43:37 2007
@@ -67,9 +67,9 @@
 	var t,u,v;
 	var a = _$('configpanel');
 
-//	add_event(a, 'mouseover', my_tooltip);
-//	add_event(a, 'mouseout', default_tooltip);
-	add_event(a, 'click', fghjhhs);
+//	ASTGUI.events.add(a, 'mouseover', my_tooltip);
+//	ASTGUI.events.add(a, 'mouseout', default_tooltip);
+	ASTGUI.events.add(a, 'click', fghjhhs);
 
 	var panels = returnpanels();
 	var this_id ;
@@ -223,7 +223,7 @@
 
 function registerajax() {
 	fit_toScreen();
-	add_event( window , 'resize', fit_toScreen );
+	ASTGUI.events.add( window , 'resize', fit_toScreen );
 	pao();
 	astmanEngine = new Astman();
 	astmanEngine.setURL(asterisk_rawmanPath );

Modified: trunk/config/cli.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/cli.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/cli.html (original)
+++ trunk/config/cli.html Fri Jun  1 13:43:37 2007
@@ -33,7 +33,7 @@
 		_$('cli_output').style.height = (i -60);
 	}
 	top._$('mainscreen').width= 798;
-	add_event( window , 'resize', adjust_toScreen);
+	ASTGUI.events.add( window , 'resize', adjust_toScreen);
 	setWindowTitle("Asterisk CLI Emulator");
 	parent.loadscreen(this);
 	_$('cli_cmd').value = "core show version";

Modified: trunk/config/feditor.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/feditor.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/feditor.html (original)
+++ trunk/config/feditor.html Fri Jun  1 13:43:37 2007
@@ -55,7 +55,7 @@
 	parent.astmanEngine.run_tool( "touch " + asterisk_configfolder + fn, callback = function() {
 		cancel_file();
 		gui_feedback("Created file: '" + fn + "'",'blue');
-		ASTGUI.selectbox_push(_$('filenames'),fn, fn);
+		ASTGUI.selectbox.append(_$('filenames'),fn, fn);
 		_$('filenames').selectedIndex = _$('filenames').options.length -1 ;
 		loadfile();
 	});
@@ -109,11 +109,11 @@
 		var i = ASTGUI.displayHeight(); 
 		_$('file_output').style.height = (i -75); 
 	}
-	add_event( window , 'resize', adjust_toScreen);
+	ASTGUI.events.add( window , 'resize', adjust_toScreen);
 	top._$('mainscreen').width= 798;
 	setWindowTitle("File Editor");
 	load_recordedfiles();
-	add_event( _$('filenames') , 'change' , loadfile ) ;
+	ASTGUI.events.add( _$('filenames') , 'change' , loadfile ) ;
 	parent.loadscreen(this);
 }
 
@@ -123,7 +123,7 @@
 		onComplete: function(originalRequest){
 			// Add config files to the list of files
 			var recfiles = originalRequest.responseText.split("\n") ;
-			ASTGUI.selectbox_push(_$('filenames'),"Config Files", "");
+			ASTGUI.selectbox.append(_$('filenames'),"Config Files", "");
 			_$('filenames').options[0].style.fontWeight = "bold";
 			var file_name;
 			for( var i =0 ; i < recfiles.length ; i++){
@@ -134,7 +134,7 @@
 				if( recfiles[i] == "" ){ continue; }
 				if( recfiles[i].substr( (recfiles[i].length - 5), recfiles[i].length) != ".conf") { continue; }
 				file_name = recfiles[i].stripTags() ;
-				ASTGUI.selectbox_push(_$('filenames'),file_name, file_name);
+				ASTGUI.selectbox.append(_$('filenames'),file_name, file_name);
 			}
 		},
 		onFailure: function(t) { alert("Config Error: " + t.status + ": " + t.statusText); }
@@ -262,7 +262,7 @@
 			h.innerHTML = "&nbsp;&nbsp;[" + d + "]";
 			zz.appendChild(h);
 			//Rico.Corner.round(h_id, {compact:true});
-			add_event( _$(h_id) , 'click', showeditcontext );
+			ASTGUI.events.add( _$(h_id) , 'click', showeditcontext );
 
 			var i = document.createElement("div");
 			var i_id = "contextContent_" + d;
@@ -290,7 +290,7 @@
 			i.CONTEXTCONTENT_ROWS = rows ;
 			zz.appendChild(i);
 			//Rico.Corner.round("contextContent_" + d, {compact:true});
-			add_event( _$(i_id) , 'click', showeditcontextContent );
+			ASTGUI.events.add( _$(i_id) , 'click', showeditcontextContent );
 
 		}
 	}

Modified: trunk/config/graphs.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/graphs.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/graphs.html (original)
+++ trunk/config/graphs.html Fri Jun  1 13:43:37 2007
@@ -114,7 +114,7 @@
 
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("Resource and Monitoring Graphs");
 	var date = new Date() ; 
 	parent.loadscreen(this);

Modified: trunk/config/iax.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/iax.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/iax.html (original)
+++ trunk/config/iax.html Fri Jun  1 13:43:37 2007
@@ -82,7 +82,7 @@
 	}
 
 	function addtosel(a,b,c){ // a is text, b is value, c is the select box id
-          ASTGUI.selectbox_push(_$(c),a, b);
+          ASTGUI.selectbox.append(_$(c),a, b);
 	}
 }
 function 	selectbox_remove(selectbox_id,codec){

Modified: trunk/config/incoming.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/incoming.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/incoming.html (original)
+++ trunk/config/incoming.html Fri Jun  1 13:43:37 2007
@@ -31,7 +31,7 @@
 var editstatus , edit_pattern, edit_DIDtrunk, edit_action, edit_priority ;
 
 function add_toext(a,b){ // a is value, b is text
-	ASTGUI.selectbox_push(_$('toextension'),b,a);
+	ASTGUI.selectbox.append(_$('toextension'),b,a);
 }
 
 user_callbacks.format = function(t, x) {
@@ -104,7 +104,7 @@
 	// load list of trunks to 'fromprovider'
 	var t ;
 	for (t in didtrunks){	if(  didtrunks.hasOwnProperty(t) ){
-		ASTGUI.selectbox_push(_$('fromprovider'),didtrunks[t].trunkname, t);
+		ASTGUI.selectbox.append(_$('fromprovider'),didtrunks[t].trunkname, t);
 	}}
 	// load the object didtrunks into the table callingRulesTable
 	refreshtable();
@@ -425,7 +425,7 @@
 
 
 function localajaxinit() {
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	showdiv_statusmessage();
 	setWindowTitle("Incoming Calls");
 

Modified: trunk/config/localexts.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/localexts.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/localexts.html (original)
+++ trunk/config/localexts.html Fri Jun  1 13:43:37 2007
@@ -35,7 +35,7 @@
 
 	if( !t.fieldbyname['trunkstyle'] ){ // all entries from users.conf other than trunks
 		var ht = (t.fieldbyname['fullname'])? unescape(t.fieldbyname['fullname'])+" ("+t.name+")" : "Local Extension ("+t.name+")";
-		ASTGUI.selectbox_push(_$('operatorExtension'),ht, t.name);
+		ASTGUI.selectbox.append(_$('operatorExtension'),ht, t.name);
 	}
 
 	return null;
@@ -110,7 +110,7 @@
 
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	if (top._$('AdvancedOptions').style.display == "none"){
 		_$('advbasic').innerHTML = '(Show Advanced Options)';
 	}else{
@@ -123,7 +123,7 @@
 		widgets[fieldnames[x]].disabled = true;
 	}
 
-	add_event( _$('localextenlength') , 'change' , update_spae ) ;
+	ASTGUI.events.add( _$('localextenlength') , 'change' , update_spae ) ;
 	parent.astmanEngine.config2list("users.conf", _$('devices'),widgets, usercallbacks);
 }
 

Modified: trunk/config/meetme.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/meetme.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/meetme.html (original)
+++ trunk/config/meetme.html Fri Jun  1 13:43:37 2007
@@ -338,7 +338,7 @@
 }
 
 function localajaxinit() {
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("Conferencing");
 
 	_$('extensions').contentEditable = 'false';
@@ -349,10 +349,10 @@
 
 	enable_disable_fields(0);
 
-	add_event( _$('pin') , 'keyup', enable_save_cancel );
-	add_event( _$('pinadmin') , 'keyup', enable_save_cancel );
-	add_event( _$('pin') , 'change', enable_save_cancel );
-	add_event( _$('pinadmin') , 'change', enable_save_cancel );
+	ASTGUI.events.add( _$('pin') , 'keyup', enable_save_cancel );
+	ASTGUI.events.add( _$('pinadmin') , 'keyup', enable_save_cancel );
+	ASTGUI.events.add( _$('pin') , 'change', enable_save_cancel );
+	ASTGUI.events.add( _$('pinadmin') , 'change', enable_save_cancel );
 
 	parent.astmanEngine.config2list("meetme.conf", $('meetme_conf'), new Array(), meetmecallbacks);
 }

Modified: trunk/config/menus.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/menus.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/menus.html (original)
+++ trunk/config/menus.html Fri Jun  1 13:43:37 2007
@@ -966,7 +966,7 @@
 
 
 function localajaxinit() {
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	showdiv_statusmessage();
 	setWindowTitle("Voice Menus");
 	_$('message_text').innerHTML ="Saving Changes...";

Modified: trunk/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/numberplan.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/numberplan.html (original)
+++ trunk/config/numberplan.html Fri Jun  1 13:43:37 2007
@@ -458,7 +458,7 @@
 
 numplan_callbacks.loaded = function() {
 	var _extns = _$('extensions') ;
-	add_event( _extns , 'change', select_differentplan );
+	ASTGUI.events.add( _extns , 'change', select_differentplan );
 	if( _extns.options.length ==0 ){
 		parent.loadscreen(this);
 		addthe_default_callingplan();
@@ -518,7 +518,7 @@
 numplan_callbacks.includecats = true;
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	showdiv_statusmessage();
 	setWindowTitle("Calling Rules");
 	for (var x =0; x < fieldnames.length; x++ ) {

Modified: trunk/config/options.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/options.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/options.html (original)
+++ trunk/config/options.html Fri Jun  1 13:43:37 2007
@@ -65,7 +65,7 @@
 }
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	showdiv_statusmessage();
 	setWindowTitle("Options");
 

Modified: trunk/config/queues.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/queues.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/queues.html (original)
+++ trunk/config/queues.html Fri Jun  1 13:43:37 2007
@@ -361,7 +361,7 @@
 ////////
 
 function localajaxinit() {
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	showdiv_statusmessage();
 	setWindowTitle("Call Queues");
 	$('queues').style.height = "415px";

Modified: trunk/config/record.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/record.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/record.html (original)
+++ trunk/config/record.html Fri Jun  1 13:43:37 2007
@@ -28,7 +28,7 @@
 var callbacks = {};
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	showdiv_statusmessage();
 	setWindowTitle("Record a Menu");
 	_$('message_text').innerHTML = "Please wait while the system <BR> Calls the specified Extension ... ";

Modified: trunk/config/ringgroups.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/ringgroups.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/ringgroups.html (original)
+++ trunk/config/ringgroups.html Fri Jun  1 13:43:37 2007
@@ -88,15 +88,15 @@
 
 	var r = _$('select_ringthesechannels');
 	var s = _$('select_listofchannels');
-	ASTGUI.selectbox_clear(s);
-	ASTGUI.selectbox_clear(r);
+	ASTGUI.selectbox.clear(s);
+	ASTGUI.selectbox.clear(r);
 	for (var y=0; y < this_ringgroup.rgchannels.length ; y++ ){
-		ASTGUI.selectbox_push(r,this_ringgroup.rgchannels[y], this_ringgroup.rgchannels[y]);
+		ASTGUI.selectbox.append(r,this_ringgroup.rgchannels[y], this_ringgroup.rgchannels[y]);
 	}
 
 	for( var u in LISTOFCHANNELS ){ if(LISTOFCHANNELS.hasOwnProperty(u)) {
 		if( !InArray(this_ringgroup.rgchannels, u) ){
-			ASTGUI.selectbox_push(s,u,u);
+			ASTGUI.selectbox.append(s,u,u);
 		}
 	}}
 
@@ -257,22 +257,22 @@
 
 function a2b(a,b){
 	if(a.selectedIndex < 0){return false;}
-	ASTGUI.selectbox_push(b,a.options[a.selectedIndex].text, a.options[a.selectedIndex].value);
+	ASTGUI.selectbox.append(b,a.options[a.selectedIndex].text, a.options[a.selectedIndex].value);
 	a.remove(a.selectedIndex);
 }
 
 function localajaxinit(){
 
-	add_event( _$('radio_fbvm') , 'click', switch_fb_selects );
-	add_event( _$('radio_fbivr') , 'click', switch_fb_selects );
-	add_event( _$('radio_fbhgp') , 'click', switch_fb_selects );
-	add_event( _$('button_add_toringlist') , 'click', function(){
+	ASTGUI.events.add( _$('radio_fbvm') , 'click', switch_fb_selects );
+	ASTGUI.events.add( _$('radio_fbivr') , 'click', switch_fb_selects );
+	ASTGUI.events.add( _$('radio_fbhgp') , 'click', switch_fb_selects );
+	ASTGUI.events.add( _$('button_add_toringlist') , 'click', function(){
 		a2b(_$('select_listofchannels'),_$('select_ringthesechannels'));
 	});
-	add_event( _$('button_remove_fromringlist') , 'click', function(){
+	ASTGUI.events.add( _$('button_remove_fromringlist') , 'click', function(){
 		a2b(_$('select_ringthesechannels'),_$('select_listofchannels'));
 	});
-	add_event( _$('button_removeall_fromringlist') , 'click', function(){
+	ASTGUI.events.add( _$('button_removeall_fromringlist') , 'click', function(){
 		var y = _$('select_ringthesechannels');
 		var z = _$('select_listofchannels');
 		while (y.options.length){
@@ -309,7 +309,7 @@
 			UserExtensions.push(l);
 			if( n[l]['hassip']=='yes'){LISTOFCHANNELS['SIP/' + l] = true;}
 			if( n[l]['hasiax']=='yes'){LISTOFCHANNELS['IAX2/' + l] = true;}
-			ASTGUI.selectbox_push(el, l + " -- " + n[l]['fullname'] , 'Voicemail(' + l + ',b)');
+			ASTGUI.selectbox.append(el, l + " -- " + n[l]['fullname'] , 'Voicemail(' + l + ',b)');
 		}
 	}}
 	config2json('extensions.conf', 0, read_extensions) ;
@@ -356,7 +356,7 @@
 
 		t = l.substr(0,17);
 		if( t =='voicemenu-custom-' ){ // if is a Voice Menu
-			ASTGUI.selectbox_push(el,get_menuname(n[l]), 'Goto('+ n[l] + '|s|1)' );
+			ASTGUI.selectbox.append(el,get_menuname(n[l]), 'Goto('+ n[l] + '|s|1)' );
 		}
 	}}
 	config2json('zapscan.conf', 1, read_zapchannels) ;
@@ -436,11 +436,11 @@
 	var r = _$('select_ringthesechannels');
 	var y = _$('select_listofchannels');
 
-	ASTGUI.selectbox_clear(r);
-	ASTGUI.selectbox_clear(y);
+	ASTGUI.selectbox.clear(r);
+	ASTGUI.selectbox.clear(y);
 
 	for( var u in LISTOFCHANNELS ){ if(LISTOFCHANNELS.hasOwnProperty(u)) {
-		ASTGUI.selectbox_push(y,u,u);
+		ASTGUI.selectbox.append(y,u,u);
 	}}
 }
 

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Fri Jun  1 13:43:37 2007
@@ -38,18 +38,23 @@
 var asterisk_configfolder = "/etc/asterisk/";
 var asterisk_guiListFiles = "sh " + asterisk_scriptsFolder + "listfiles" ;
 
-var sortbynames = false;
-var dragdata = new Object;
+var dragdata = {};
 var asterisk_guiTDPrefix = "DID_";
 var TIMERULES_CATEGORY = 'timebasedrules';
-
-if(document.attachEvent){ var isIE = true; }else{ var isIE = false; }
+var isIE = false;
+if(document.attachEvent){ isIE= true; }
 
 var ASTGUI = { // the idea is to eventually move all the global variables and functions into this one object so that the global name space is not as cluttered as it is now.
 	events: {
 		getTarget: function(x){
 			x = x || window.event;
 			return x.target || x.srcElement;
+		},
+		add: function(a,b,c){ // a is element , b is event (string) , c is the function 
+			if(isIE) { a.attachEvent('on'+b, c); }else{ a.addEventListener(b, c, false); }
+		},
+		remove: function(a,b,c){
+			if(isIE) { a.detachEvent('on'+b, c); }else{ a.removeEventListener(b, c, false); }
 		}
 	},
 
@@ -86,49 +91,51 @@
 		}
 	},
 
-	selectbox_insert_before: function(el,txt, val, i){
-		if(isIE){ 
-			el.add(new Option (txt,val), i ); 
-		}else{ 
-			el.add(new Option (txt,val), el.options[i] );
-		} 
-	},
-
-	selectbox_insertOption_before: function(el,opt, i){
-		if(isIE){ 
-			el.add(opt, i ); 
-		}else{ 
-			el.add(opt, el.options[i] );
-		} 
-	},
-
-	selectbox_push: function(el,txt, val){
-		el.options[el.options.length] = new Option (txt,val);
-	},
-
-	selectbox_push_option: function(el,opt){
-		if(isIE){
-			el.add(opt);
-		} else{ 
-			el.add(opt,null);
-		}
-	},
-
-	selectbox_remove_i: function(el, i){
-		el.options[i] = null;
-	},
-
-	selectbox_clear: function(el){
-		el.options.length = 0;
-	}
-
-};
+	selectbox: {
+		insert_before: function(el,txt, val, i){
+			if(isIE){ 
+				el.add(new Option (txt,val), i ); 
+			}else{ 
+				el.add(new Option (txt,val), el.options[i] );
+			} 
+		},
+
+		insertOption_before: function(el,opt, i){
+			if(isIE){ 
+				el.add(opt, i ); 
+			}else{ 
+				el.add(opt, el.options[i] );
+			} 
+		},
+
+		append: function(el,txt, val){
+			el.options[el.options.length] = new Option (txt,val);
+		},
+
+		append_option: function(el,opt){
+			if(isIE){
+				el.add(opt);
+			} else{ 
+				el.add(opt,null);
+			}
+		},
+
+		remove_i: function(el, i){
+			el.options[i] = null;
+		},
+	
+		clear: function(el){
+			el.options.length = 0;
+		}
+	}
+
+}; // AstGUI
 
 
 function gui_feedback(a,b,c){ 
 // a is msg, b is color (optional ), c is display time in milliseconds(optional, default to asterisk_guifbt)
 	if(!b || b=='default'){
-		var b = "#DA2804"; // dark reddish brown
+		b = "#DA2804"; // dark reddish brown
 	}
 	if(b=='blue'){ 
 		b = "#303BCA"; // dark blue
@@ -164,19 +171,16 @@
 	tmp = new Ajax.Request( asterisk_rawmanPath, opt);
 }
 
-function gui_alert(msg){ gui_alertmsg( 1, msg );}
-
-function gui_alertmsg( msgtype, msg ){
-	// Alternative to javascript's alert box - the native alert boxes are stopping the background XHRs
-	//  usage - msgtype could be 1 or 2 or 3 , msg is the alert message
+function gui_alert(msg){ 
 	top.alertframename = "alertiframe";
 	top.alertmsg = msg ;
-	top.alertmsgtype = msgtype ;
+	top.alertmsgtype = 1 ;
+	var h,_hs;
 	if( !top.document.getElementById(top.alertframename)){
-		var h= top.document.createElement("IFRAME");
+		h= top.document.createElement("IFRAME");
 		h.setAttribute("id", top.alertframename );
 		h.setAttribute("ALLOWTRANSPARENCY", "true");
-		var _hs = h.style ;
+		_hs = h.style ;
 		_hs.position="absolute";
 		_hs.left= 0;
 		_hs.top= 0;
@@ -194,7 +198,6 @@
 		top.document.getElementById( top.alertframename ).style.display = "";
 	}
 }
-
 
 // Douglas Crockford's purge function for IE Memory leaks
 // http://javascript.crockford.com/memory/leak.html
@@ -217,17 +220,6 @@
             purge(d.childNodes[i]);
         }
     }
-}
-
-
-// cross browser function for adding/removing events to elements
-// a is element , b is event (string) , c is the function 
-if(document.addEventListener){
-	add_event = function( a , b, c ){ a.addEventListener(b, c, false); }
-	remove_event = function(a,b,c){ a.removeEventListener( b, c , false); }
-}else if(document.attachEvent){
-	add_event = function( a , b, c ){ a.attachEvent('on'+b, c); }
-	remove_event = function(a,b,c){ a.detachEvent("on"+b, c); }
 }
 
 
@@ -298,14 +290,14 @@
 		dragdata.maxleft = document.body.offsetWidth - parseInt($(dragdata.movethis).style.width) ;
 		dragdata.maxtop = document.body.offsetWidth- parseInt($(dragdata.movethis).style.height) ;
 	}
-	add_event( document , "mousemove" , movewindow ) ;
-	add_event( document , "mouseup" , stopDrag ) ;
+	ASTGUI.events.add( document , "mousemove" , movewindow ) ;
+	ASTGUI.events.add( document , "mouseup" , stopDrag ) ;
 }
 
 
 function stopDrag(){
-	remove_event( document , "mousemove" , movewindow ) ;
-	remove_event( document , "mouseup" , stopDrag ) ;
+	ASTGUI.events.remove( document , "mousemove" , movewindow ) ;
+	ASTGUI.events.remove( document , "mouseup" , stopDrag ) ;
 }
 
 function movewindow(event){
@@ -418,13 +410,13 @@
 //	combo_selectdiv.style.z-index = 10000;
 	combo_selectdiv.style.display = "none";
 
-	add_event( combo_text , 'keychange' , combobox_activate ) ;
-	add_event( combo_text , 'focus' , combobox_activate ) ;
-	add_event( combo_text , 'focusout' , function(){ combo_selectdiv.style.display ='none'; } ) ;
-	add_event( combo_text , 'keypress' , xyz) ;
-	add_event( combo_text , 'keyup' , abcd ) ;
-	add_event( combo_selectbox, 'keypress' , efgh ) ;
-	add_event( combo_selectbox, 'click' , ijkl ) ;
+	ASTGUI.events.add( combo_text , 'keychange' , combobox_activate ) ;
+	ASTGUI.events.add( combo_text , 'focus' , combobox_activate ) ;
+	ASTGUI.events.add( combo_text , 'focusout' , function(){ combo_selectdiv.style.display ='none'; } ) ;
+	ASTGUI.events.add( combo_text , 'keypress' , xyz) ;
+	ASTGUI.events.add( combo_text , 'keyup' , abcd ) ;
+	ASTGUI.events.add( combo_selectbox, 'keypress' , efgh ) ;
+	ASTGUI.events.add( combo_selectbox, 'click' , ijkl ) ;
 
 	function combobox_activate(){
 		var tmp_left = combo_text.offsetLeft;
@@ -488,10 +480,10 @@
 		for ( var g=0; g < box.options.length  ; g++) {
 			if(	opt_new.text < box.options[g].text  ){ // add before this element in box
 				add = 1;
-				ASTGUI.selectbox_insertOption_before(box,opt_new, g);
-			}
-		}
-		if ( add ==0 ){ ASTGUI.selectbox_push_option(box,opt_new);}
+				ASTGUI.selectbox.insertOption_before(box,opt_new, g);
+			}
+		}
+		if ( add ==0 ){ ASTGUI.selectbox.append_option(box,opt_new);}
 	}
 }
 
@@ -794,7 +786,7 @@
 		category.fields = new Array;
 	}
 
-	ASTGUI.selectbox_push(box,"New Entry", "");
+	ASTGUI.selectbox.append(box,"New Entry", "");
 	box.selectedIndex = box.options.length - 1;
 	box.oldselect = box.options.length - 1;
 	box.stored_config.catbyname[""] = category;
@@ -844,7 +836,7 @@
 	if (!subcat || !subcat.length || !subname || !subname.length)
 		return;
 
-	ASTGUI.selectbox_push_option(box,newoption);
+	ASTGUI.selectbox.append_option(box,newoption);
 	box.selectedIndex = box.options.length - 1;
 	box.oldselect = box.options.length - 1;
 	category = box.stored_config.catbyname[subcat];
@@ -1473,12 +1465,12 @@
 
 				if (savewidget) {
 					widgets[x].savewidget = savewidget;
-					add_event( widgets[x] , 'click', function(event) { 
+					ASTGUI.events.add( widgets[x] , 'click', function(event) { 
 						var t = (event.srcElement)?event.srcElement:this;
 						t.oldvalue = t.value;
 						return true; 
 					});
-					add_event( widgets[x] , 'change', function(event) {
+					ASTGUI.events.add( widgets[x] , 'change', function(event) {
 						var t = (event.srcElement)?event.srcElement:this;
 						t.savewidget.activateSave();
 					});
@@ -1525,18 +1517,18 @@
 				if (savewidget) {
 					widgets[x].savewidget = savewidget;
 					if ((widgets[x].type == 'checkbox') || (widgets[x].type == 'radio')) {
-						add_event( widgets[x] , 'click', function(event) {
+						ASTGUI.events.add( widgets[x] , 'click', function(event) {
 							var t = (event.srcElement)?event.srcElement:this;
 							t.savewidget.activateSave();
 						});
 					} else {
 
-						add_event( widgets[x] , 'keydown', function(event) {
+						ASTGUI.events.add( widgets[x] , 'keydown', function(event) {
 							var t = (event.srcElement)?event.srcElement:this;
 							t.oldvalue = t.value; return true; 
 						});
 
-						add_event( widgets[x] , 'keyup', function(event) {
+						ASTGUI.events.add( widgets[x] , 'keyup', function(event) {
 							var t = (event.srcElement)?event.srcElement:this; 
 							if (t.oldvalue == t.value){return true;}
 							pattern = t.getAttribute('pattern');
@@ -1733,30 +1725,30 @@
 		if (widgets['save']) {
 			widgets['save'].hostselectbox = box;
 
-			add_event( widgets['save'] , 'click', function(event) { var t = (event.srcElement)?event.srcElement:this; save_item(t.hostselectbox); });
+			ASTGUI.events.add( widgets['save'] , 'click', function(event) { var t = (event.srcElement)?event.srcElement:this; save_item(t.hostselectbox); });
 
 		}
 		if (widgets['cancel']) {
 			widgets['cancel'].hostselectbox = box;
-			add_event( widgets['cancel'] , 'click', function(event) { var t = (event.srcElement)?event.srcElement:this; cancel_item(t.hostselectbox); });
+			ASTGUI.events.add( widgets['cancel'] , 'click', function(event) { var t = (event.srcElement)?event.srcElement:this; cancel_item(t.hostselectbox); });
 		}
 
 		if (widgets['new']) {
 			widgets['new'].hostselectbox = box;
 			widgets['new'].disabled = false;
-			add_event( widgets['new'] , 'click', function(event) { var t = (event.srcElement)?event.srcElement:this; new_item(t.hostselectbox); });
+			ASTGUI.events.add( widgets['new'] , 'click', function(event) { var t = (event.srcElement)?event.srcElement:this; new_item(t.hostselectbox); });
 
 		}
 		if (widgets['newitem']) {
 			widgets['newitem'].hostselectbox = box;
 			widgets['newitem'].disabled = false;
-			add_event( widgets['newitem'] , 'click', function(event) {var t = (event.srcElement)?event.srcElement:this; new_subitem(t.hostselectbox); });
+			ASTGUI.events.add( widgets['newitem'] , 'click', function(event) {var t = (event.srcElement)?event.srcElement:this; new_subitem(t.hostselectbox); });
 
 		}
 		if (widgets['delete']) {
 			widgets['delete'].hostselectbox = box;
 			widgets['delete'].disabled = true;
-			add_event( widgets['delete'] , 'click', function(event) {var t = (event.srcElement)?event.srcElement:this; delete_item(t.hostselectbox); });
+			ASTGUI.events.add( widgets['delete'] , 'click', function(event) {var t = (event.srcElement)?event.srcElement:this; delete_item(t.hostselectbox); });
 		}
 		tmp = new Ajax.Request(this.url, opt);
 	};
@@ -1827,11 +1819,7 @@
 			box.calcname = tmp[0];
 			box.calccontext = t.name;
 			box.calcpriority = priority;
-			if( sortbynames ){
-				return " Voice Menu ("  + tmp[0] + ")" ;
-			}else{
-				return tmp[0] + " -- Voice Menu"  ;
-			}
+			return tmp[0] + " -- Voice Menu"  ;
 		}
 		//
 
@@ -1871,11 +1859,7 @@
 		t.subfields[x]['realpriority'] = box.calcpriority;
 		box.calcname = exten;
 		box.calccontext = t.name;
-		if( sortbynames ){
-			return label+" ("  + exten + ")" ;
-		}else{
-			return exten + " -- " + label;
-		}
+		return exten + " -- " + label;
 	}	
 
 function merge_users(e, u) { // read u and add into e according to sort order
@@ -1897,12 +1881,12 @@
 		for ( var g=0; g < u.options.length  ; g++) {
 			if(	opt_new.text < u.options[g].text  ){ // add before this element in u 
 				add = 1;
-				ASTGUI.selectbox_insertOption_before(u,opt_new,g);
+				ASTGUI.selectbox.insertOption_before(u,opt_new,g);
 				break;
 			}
 		}
-		if ( add ==0 ){ ASTGUI.selectbox_push_option(u,opt_new);}
-	}
-}
-
-
+		if ( add ==0 ){ ASTGUI.selectbox.append_option(u,opt_new);}
+	}
+}
+
+

Modified: trunk/config/sip.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/sip.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/sip.html (original)
+++ trunk/config/sip.html Fri Jun  1 13:43:37 2007
@@ -43,7 +43,7 @@
 }
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("SIP");
 	for (var x =0; x < fieldnames.length; x++ ) {
 		widgets[fieldnames[x]] = _$(fieldnames[x]);

Modified: trunk/config/status.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/status.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/status.html (original)
+++ trunk/config/status.html Fri Jun  1 13:43:37 2007
@@ -112,7 +112,7 @@
 
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("Active Channels");
 	refreshChannelsList() ;
 	parent.astmanEngine.setEventCallback(parent.eventeater.eventcd );

Modified: trunk/config/sysinfo.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/sysinfo.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/sysinfo.html (original)
+++ trunk/config/sysinfo.html Fri Jun  1 13:43:37 2007
@@ -97,7 +97,7 @@
 
 
 function localajaxinit(){
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("System Info");
 	// call the tool (sysinfo)
 	showdiv_statusmessage();

Modified: trunk/config/syslog.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/syslog.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/syslog.html (original)
+++ trunk/config/syslog.html Fri Jun  1 13:43:37 2007
@@ -61,7 +61,7 @@
 		var i = ASTGUI.displayHeight();
 		_$('todaylog').style.height = (i - 35); 
 	}
-	add_event( window , 'resize', adjust_toScreen);
+	ASTGUI.events.add( window , 'resize', adjust_toScreen);
 	top._$('mainscreen').width= 798;
 	setWindowTitle("System Log");
 	// call the tool (sysinfo)

Modified: trunk/config/timerules.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/timerules.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/timerules.html (original)
+++ trunk/config/timerules.html Fri Jun  1 13:43:37 2007
@@ -137,8 +137,8 @@
 				continue;
 			}
 			if( d.substr(0,17) == 'ringroups-custom-'){
-				ASTGUI.selectbox_push(_$('dest_match'), get_ringGroupName(c[d]) , d+",s,1");
-				ASTGUI.selectbox_push(_$('dest_nomatch'), get_ringGroupName(c[d]) , d+",s,1");
+				ASTGUI.selectbox.append(_$('dest_match'), get_ringGroupName(c[d]) , d+",s,1");
+				ASTGUI.selectbox.append(_$('dest_nomatch'), get_ringGroupName(c[d]) , d+",s,1");
 			}
 		}
 	}
@@ -254,7 +254,7 @@
 	var updateselect = function( el,start,end ){
 		for( var s =start; s< end; s++){
 			s = tostring(s);
-			ASTGUI.selectbox_push(el,s,s);
+			ASTGUI.selectbox.append(el,s,s);
 		}
 		el.selectedIndex = -1;
 	}
@@ -262,14 +262,14 @@
 	var update_select_menus = function(el){
 		var g;
 		for ( g=0; g <voicemenus.length; g++){
-			ASTGUI.selectbox_push(el,voicemenus[g].menuname,voicemenus[g].menucontextstring);
+			ASTGUI.selectbox.append(el,voicemenus[g].menuname,voicemenus[g].menucontextstring);
 		}
 		for ( g=0 ; g <user_extens.length; g++){
-			ASTGUI.selectbox_push(el,user_extens[g].username,user_extens[g].usercontextstring);
+			ASTGUI.selectbox.append(el,user_extens[g].username,user_extens[g].usercontextstring);
 		}
 
 		for( g in timebasedrules ){ if(timebasedrules.hasOwnProperty(g)){
-			ASTGUI.selectbox_push( el, "TimeRule -- " + timebasedrules[g].rulename , TIMERULES_CATEGORY + ',' + g + ',1' );
+			ASTGUI.selectbox.append( el, "TimeRule -- " + timebasedrules[g].rulename , TIMERULES_CATEGORY + ',' + g + ',1' );
 		}}
 	}
 

Modified: trunk/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/trunks.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/trunks.html (original)
+++ trunk/config/trunks.html Fri Jun  1 13:43:37 2007
@@ -109,9 +109,9 @@
 }
 
 callbacks.cancelnewcategory = function(){
-	remove_event( _$('trunkstyleanalog') , 'click' , activateanalogvoip );
-	remove_event( _$('trunkstylevoip') , 'click' , activateanalogvoip );
-	remove_event( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip );
+	ASTGUI.events.remove( _$('trunkstyleanalog') , 'click' , activateanalogvoip );
+	ASTGUI.events.remove( _$('trunkstylevoip') , 'click' , activateanalogvoip );
+	ASTGUI.events.remove( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip );
 	hideSPdetails();
 }
 
@@ -123,7 +123,7 @@
 	var _devices = _$('devices');
 	_devices.contentEditable = 'true';
 	_devices.disabled = 0;
-	add_event( _$('new') , "click", showSPdetails ) ;
+	ASTGUI.events.add( _$('new') , "click", showSPdetails ) ;
 	loadServiceProvidersintotable();
 	preparemenus();
 	parent.loadscreen(this);
@@ -422,9 +422,9 @@
 	_$('userscontent_title').innerHTML = "Add Service Provider";
 	isnewtrunk = 1;
 
-	add_event( _$('trunkstyleanalog') , 'click' , activateanalogvoip );
-	add_event( _$('trunkstylevoip') , 'click' , activateanalogvoip );
-	add_event( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip );
+	ASTGUI.events.add( _$('trunkstyleanalog') , 'click' , activateanalogvoip );
+	ASTGUI.events.add( _$('trunkstylevoip') , 'click' , activateanalogvoip );
+	ASTGUI.events.add( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip );
 
 	return tmp;
 }
@@ -492,7 +492,7 @@
 }
 
 function localajaxinit() {
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("Service Providers");
 	_$('devices').contentEditable = 'false';
 	_$('zapchan').splitchar=',';
@@ -505,7 +505,7 @@
 	var _trunkstylecustomvoip = _$('trunkstylecustomvoip');
 	_trunkstylecustomvoip.onclick = null;
 
-	add_event( _$('custom_trunkname') , 'change' , function(){ 
+	ASTGUI.events.add( _$('custom_trunkname') , 'change' , function(){ 
 		_$('name').value = _$('custom_trunkname').value;
 			_$('save').disabled = false; 
 		}
@@ -613,7 +613,7 @@
 	var menu_div = document.getElementById('mymenu') ;
 	menu_div.style.width="80";
 	menu_div.style.borderColor = "#eee #bbb #bbb #ddd";
-	add_event( document.body , "click", function(){ _$('mymenu').style.display="none"; } );
+	ASTGUI.events.add( document.body , "click", function(){ _$('mymenu').style.display="none"; } );
 
 	var menuitem1 = document.createElement('div');
 	menuitem1.innerHTML = "Edit" ;

Modified: trunk/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/users.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/users.html (original)
+++ trunk/config/users.html Fri Jun  1 13:43:37 2007
@@ -198,7 +198,7 @@
 
 	for( var d in c ){
 		if ( c.hasOwnProperty(d) && c[d]['port'] && (c[d]['port'] == 'fxo' ) ) {
-			ASTGUI.selectbox_push(_zapchan,"Analog Port #" + d, d);
+			ASTGUI.selectbox.append(_zapchan,"Analog Port #" + d, d);
 		}
 	}
 	
@@ -206,7 +206,7 @@
 		_zapchan.style.display="none";
 		_$('noanaloglines').style.display="";
 	}
-	ASTGUI.selectbox_insert_before(_zapchan,"None", "", 0);
+	ASTGUI.selectbox.insert_before(_zapchan,"None", "", 0);
 	config2json('extensions.conf', 1, dialplans_loaded ) ;
 	//parent.astmanEngine.config2list("extensions.conf", _$('context'), new Array(), numcallbacks);
 }
@@ -218,7 +218,7 @@
 	for( var d in c ){
 		if ( c.hasOwnProperty(d) && d.substr(0,11) == 'numberplan-'  ) {
 			var txt = (c[d]['plancomment'])?unescape(c[d]['plancomment']) : d;
-			ASTGUI.selectbox_push(_context,txt, d);
+			ASTGUI.selectbox.append(_context,txt, d);
 		}
 	}
 
@@ -226,7 +226,7 @@
 }
 
 function localajaxinit() {
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 
 	/*
 	// Automatically open the related panel - like when this page is called using a back button

Modified: trunk/config/voicemail.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/voicemail.html?view=diff&rev=1019&r1=1018&r2=1019
==============================================================================
--- trunk/config/voicemail.html (original)
+++ trunk/config/voicemail.html Fri Jun  1 13:43:37 2007
@@ -90,9 +90,9 @@
 	$('extensions').disabled = 0;
 	$('extensions').current_category = specialcontext;
 
-	add_event( $('name') , 'keydown', function(){ this.oldvalue = this.value ;} );
-
-	add_event( $('name') , 'keyup', function(){
+	ASTGUI.events.add( $('name') , 'keydown', function(){ this.oldvalue = this.value ;} );
+
+	ASTGUI.events.add( $('name') , 'keyup', function(){
 		if(this.oldvalue == this.value){return true;}
 		$('save').disabled = false;
 		$('cancel').disabled = false;
@@ -264,7 +264,7 @@
 
 
 function localajaxinit() {
-	add_event(document, 'mouseover', show_tooltip);
+	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("Voicemail");
 	//$('advancedi').style.width = $('split').width - 60;
 



More information about the asterisk-gui-commits mailing list