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

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Mon Feb 26 16:53:33 MST 2007


Author: pari
Date: Mon Feb 26 17:53:32 2007
New Revision: 381

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=381
Log:
cross browser functions for adding & removing events , moved showdiv_message to onpageload, removed numberplan_advanced.html

Removed:
    trunk/config/numberplan_advanced.html
Modified:
    trunk/config/backup.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/scripts/astman.js
    trunk/config/sysinfo.html
    trunk/config/trunks.html

Modified: trunk/config/backup.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/backup.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/backup.html (original)
+++ trunk/config/backup.html Mon Feb 26 17:53:32 2007
@@ -28,6 +28,7 @@
 var bkpfile ;
 
 function localajaxinit() {
+	showdiv_statusmessage();
 	setWindowTitle("Backup");
 	parent.loadscreen(this);
 	$('status_message').style.top  = 	100;
@@ -100,9 +101,4 @@
 	</tr>
 </table>
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/incoming.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/incoming.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/incoming.html (original)
+++ trunk/config/incoming.html Mon Feb 26 17:53:32 2007
@@ -454,6 +454,7 @@
 
 
 function localajaxinit() {
+	showdiv_statusmessage();
 	setWindowTitle("Incoming Calls");
 	for (var x =0; x < focus_fields.length; x++ ) {
 		$(focus_fields[x]).onfocus = function(){this.className = 'input9_hilight';}
@@ -520,9 +521,4 @@
 </div>
 <div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 24; width:100%; height:100%;  background-color:#EFEFEF; -moz-opacity:.50;opacity:.50; border-width: 1px; border-color: #EFEFEF; border-style: solid; z-index:4">
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/localexts.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/localexts.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/localexts.html (original)
+++ trunk/config/localexts.html Mon Feb 26 17:53:32 2007
@@ -90,11 +90,7 @@
 				widgets[focus_fields[x]].onblur = function(){this.className = 'input9';}
 			}
 
-			if ($('localextenlength').addEventListener){
-				  $('localextenlength').addEventListener('change', update_spae, false); 
-			} else if ($('localextenlength').attachEvent){
-				  $('localextenlength').attachEvent('onchange', update_spae);
-			}
+			add_event( $('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=381&r1=380&r2=381
==============================================================================
--- trunk/config/meetme.html (original)
+++ trunk/config/meetme.html Mon Feb 26 17:53:32 2007
@@ -369,19 +369,11 @@
 			$( focus_fields[x] ).onblur = function(){this.className = 'input8';}
 		}
 		 enable_disable_fields(0);
-		if ( $('pin').addEventListener	){
-					$('pin').addEventListener('keyup', function(){ $('save').disabled = false; $('cancel').disabled = false; } , false);
-					$('pinadmin').addEventListener('keyup', function(){ $('save').disabled = false; $('cancel').disabled = false; } , false);
-					$('pin').addEventListener('change', function(){ $('save').disabled = false; $('cancel').disabled = false; } , false);
-					$('pinadmin').addEventListener('change', function(){ $('save').disabled = false; $('cancel').disabled = false; } , false);
-		}else if( $('pin').attachEvent ){
-					$('pin').attachEvent('onkeyup', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
-					$('pinadmin').attachEvent('onkeyup', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
-					$('pin').attachEvent('onchange', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
-					$('pinadmin').attachEvent('onchange', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
-		}
-
-
+
+		add_event( $('pin') , 'keyup', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
+		add_event( $('pinadmin') , 'keyup', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
+		add_event( $('pin') , 'change', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
+		add_event( $('pinadmin') , 'change', function(){ $('save').disabled = false; $('cancel').disabled = false; }  );
 
 		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=381&r1=380&r2=381
==============================================================================
--- trunk/config/menus.html (original)
+++ trunk/config/menus.html Mon Feb 26 17:53:32 2007
@@ -934,6 +934,7 @@
 
 
 function localajaxinit() {
+		showdiv_statusmessage();
 		setWindowTitle("Voice Menus");
 		$('message_text').innerHTML ="Saving Changes...";
 		for (x =0 ; x<fieldnames.length; x++){
@@ -1350,9 +1351,4 @@
 	</tr>
 </table>
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/numberplan.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/numberplan.html (original)
+++ trunk/config/numberplan.html Mon Feb 26 17:53:32 2007
@@ -480,11 +480,9 @@
 }
 
 numplan_callbacks.loaded = function() {
-	if ($('extensions').addEventListener){
-		$('extensions').addEventListener("change", select_differentplan, false);
-	} else if ($('extensions').attachEvent){
-		$('extensions').attachEvent('onchange', select_differentplan);
-	}
+
+	add_event( $('extensions') , 'change', select_differentplan );
+
 	if($('extensions').options.length ==0 ){
 			parent.loadscreen(this);
 			addthe_default_callingplan();
@@ -559,15 +557,12 @@
 }
 
 trunkcallbacks.loaded = function(){
-	if ($('trunks').addEventListener){
-		$('trunks').addEventListener('click',hackenablesave,false);
-	} else if ($('trunks').attachEvent){
-		$('trunks').attachEvent('onclick', hackenablesave );
-	}
+	add_event( $('trunks') , 'click', hackenablesave ) ;
 	parent.astmanEngine.config2list("extensions.conf", $('extensions'), widgets , numplan_callbacks);
 }
 
 function localajaxinit(){
+	showdiv_statusmessage();
 	setWindowTitle("Calling Rules");
 	for (var x =0; x < fieldnames.length; x++ ) {
 		widgets[fieldnames[x]] = $(fieldnames[x]);
@@ -738,9 +733,4 @@
 </div>
 <div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 24; width:100%; height:100%;  background-color:#EFEFEF; -moz-opacity:.50;opacity:.50; border-width: 1px; border-color: #EFEFEF; border-style: solid; z-index:4">
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/options.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/options.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/options.html (original)
+++ trunk/config/options.html Mon Feb 26 17:53:32 2007
@@ -214,6 +214,7 @@
 }
 
 function localajaxinit(){
+	showdiv_statusmessage();
 	setWindowTitle("Options");
 	for (var x =0; x < fieldnames.length; x++) {
 		widgets[fieldnames[x]] = $(fieldnames[x]);
@@ -284,9 +285,4 @@
 	<tr><td></td></tr>
 </table>
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/queues.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/queues.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/queues.html (original)
+++ trunk/config/queues.html Mon Feb 26 17:53:32 2007
@@ -424,6 +424,7 @@
 ////////
 
 function localajaxinit() {
+	showdiv_statusmessage();
 	setWindowTitle("Call Queues");
 //	$('advancedi').style.width = $('split').width - 60;
 	if( navigator.userAgent.indexOf("MSIE") != -1){
@@ -533,9 +534,4 @@
 	</tr>
 </table>
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/record.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/record.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/record.html (original)
+++ trunk/config/record.html Mon Feb 26 17:53:32 2007
@@ -246,6 +246,7 @@
 }
 
 function localajaxinit() {
+	showdiv_statusmessage();
 	setWindowTitle("Record a Menu");
 	for (var x =0; x < focus_fields.length; x++ ) {
 		$(focus_fields[x]).onfocus = function(){this.className = 'input8_hilight';}
@@ -355,9 +356,4 @@
 </div>
 <div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 24; width:100%; height:100%;  background-color:#EFEFEF; -moz-opacity:.50;opacity:.50; border-width: 1px; border-color: #EFEFEF; border-style: solid; z-index:4">
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Mon Feb 26 17:53:32 2007
@@ -27,6 +27,26 @@
 var sortbynames = false;
 var dragdata = new Object;
 var asterisk_guiTDPrefix = "DID_";
+
+function add_event( a , b, c ){  
+	// cross browser function for adding events
+	// a is element , b is event (string) , c is the function 
+	if ( a.addEventListener){
+		a.addEventListener(b, c, false);
+	} else if (a.attachEvent){
+		a.attachEvent('on'+b, c);
+	}
+}
+
+function remove_event(a,b,c){ 
+	// cross browser function for removing events
+	// a is element , b is event (string) , c is the function 
+	if(a.removeEventListener){
+		a.removeEventListener( b, c , false);
+	}else if(a.detachEvent){
+		a.detachEvent("on"+b, c);
+	}
+}
 
 function toJSON(z, p){
 	// This function converts z,  the asterisk config file as read using 'action=getconfig' to a JSON string 
@@ -111,25 +131,14 @@
 		dragdata.maxleft = document.body.offsetWidth - parseInt($(dragdata.movethis).style.width) ;
 		dragdata.maxtop = document.body.offsetWidth- parseInt($(dragdata.movethis).style.height) ;
 	}
-
-	if (document.addEventListener){
-		document.addEventListener("mousemove", movewindow, false);
-		document.addEventListener("mouseup", stopDrag, false);
-	} else if (document.attachEvent){
-		document.attachEvent('onmousemove', movewindow);
-		document.attachEvent('onmouseup', stopDrag);
-	}
+	add_event( document , "mousemove" , movewindow ) ;
+	add_event( document , "mouseup" , stopDrag ) ;
 }
 
 
 function stopDrag(){
-	if(document.removeEventListener){
-		document.removeEventListener("mousemove", movewindow, false);
-		document.removeEventListener("mouseup", stopDrag, false);
-	}else if(document.detachEvent){
-		document.detachEvent("onmousemove", movewindow);
-		document.detachEvent("onmouseup", stopDrag);
-	}
+	remove_event( document , "mousemove" , movewindow ) ;
+	remove_event( document , "mouseup" , stopDrag ) ;
 }
 
 function movewindow(event){
@@ -162,7 +171,7 @@
 
 function showdiv_statusmessage(){
         var h= document.createElement("div");
-		h.setAttribute("ID","status_message");
+		h.setAttribute("id","status_message");
 		h.style.display="none";
 		h.style.position="absolute";
 		h.style.left= 170;
@@ -245,23 +254,14 @@
 //		combo_selectdiv.style.z-index = 10000;
 		combo_selectdiv.style.display = "none";
 
-		if (combo_text.addEventListener){
-				combo_text.addEventListener('keychange',combobox_activate,false);
-				combo_text.addEventListener('focus',combobox_activate,false);
-				combo_text.addEventListener('focusout', function(){ combo_selectdiv.style.display ='none'; } ,false);
-				combo_text.addEventListener('keypress',  xyz , false);
-				combo_text.addEventListener('keyup', abcd ,false);
-				combo_selectbox.addEventListener('keypress', efgh ,false);
-				combo_selectbox.addEventListener('click', ijkl ,false);
-		} else if (combo_text.attachEvent){
-				combo_text.attachEvent('onkeychange',combobox_activate);
-				combo_text.attachEvent('onfocus',combobox_activate);
-				combo_text.attachEvent('onfocusout', function(){ combo_selectdiv.style.display ='none'; } );
-				combo_text.attachEvent('onkeypress',  xyz );
-				combo_text.attachEvent('onkeyup', abcd );
-				combo_selectbox.attachEvent('onkeypress', efgh );
-				combo_selectbox.attachEvent('onclick', ijkl );
-		}
+	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 ) ;
+
 
 		function combobox_activate(){
 				var tmp_left = combo_text.offsetLeft;

Modified: trunk/config/sysinfo.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/sysinfo.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/sysinfo.html (original)
+++ trunk/config/sysinfo.html Mon Feb 26 17:53:32 2007
@@ -149,6 +149,7 @@
 	setWindowTitle("System Info");
 	// call the tool (sysinfo)
 	var date = new Date() ; 
+	showdiv_statusmessage();
 	$('log_month').selectedIndex = date.getMonth() ;
 	$('log_day').selectedIndex = date.getDate()  - 1 ;
 	$('status_message').style.display="block";
@@ -215,9 +216,4 @@
 	<tr><td></td></tr>
 </table>
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: trunk/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/trunks.html?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/config/trunks.html (original)
+++ trunk/config/trunks.html Mon Feb 26 17:53:32 2007
@@ -148,11 +148,7 @@
 	callbacks.loaded = function() {
 		$('devices').contentEditable = 'true';
 		$('devices').disabled = 0;
-		if ($('new').addEventListener){
-				$('new').addEventListener("click", showSPdetails, false); 
-		} else if ($('new').attachEvent){
-		  $('new').attachEvent('onclick', showSPdetails);
-		}
+		add_event( $('new') , "click", showSPdetails ) ;
 		loadServiceProvidersintotable();
 		parent.loadscreen(this);
 	}



More information about the asterisk-gui-commits mailing list