pari: branch appliance r395 - in /branches/appliance: ./ config/ config/scrip...

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Thu Mar 1 16:21:19 MST 2007


Author: pari
Date: Thu Mar  1 17:21:18 2007
New Revision: 395

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=395
Log:
Merged revisions 377,379-394 via svnmerge from 
https://svn.digium.com/svn/asterisk-gui/trunk

........
r377 | pari | 2007-02-22 13:35:10 -0600 (Thu, 22 Feb 2007) | 1 line

toJSON() -- converts a asterisk config file to JSON. This function is not used anywhere in the GUI yet, but there are place where it could have been useful. For example, there were many places where we just wanted to read all the contexts in a config file - with this function it is no longer required to create a select box and use astmanEngine.config2list
........
r379 | pari | 2007-02-26 16:07:43 -0600 (Mon, 26 Feb 2007) | 1 line

appendChild instead of document.write - the proper way
........
r380 | pari | 2007-02-26 16:28:41 -0600 (Mon, 26 Feb 2007) | 1 line

defining the right event
........
r381 | pari | 2007-02-26 17:53:32 -0600 (Mon, 26 Feb 2007) | 1 line

cross browser functions for adding & removing events , moved showdiv_message to onpageload, removed numberplan_advanced.html
........
r382 | pari | 2007-02-26 23:47:41 -0600 (Mon, 26 Feb 2007) | 1 line

using toJSON() instead of config2list 
........
r383 | pari | 2007-02-27 10:16:00 -0600 (Tue, 27 Feb 2007) | 1 line

fixing some really bad code 
........
r384 | pari | 2007-02-27 11:13:50 -0600 (Tue, 27 Feb 2007) | 1 line

huh! substr() is broken in IE svn diff numberplan.html  
........
r385 | pari | 2007-02-27 11:41:10 -0600 (Tue, 27 Feb 2007) | 1 line

Upgraded to Prototype 1.5 (with patch described at http://forum.openrico.org/topic/2228)
........
r386 | pari | 2007-02-27 18:15:51 -0600 (Tue, 27 Feb 2007) | 1 line

This commit should fix most of the IE memory leaks in the GUI
........
r387 | pari | 2007-02-28 10:16:49 -0600 (Wed, 28 Feb 2007) | 1 line

minor html fixes for IE
........
r388 | pari | 2007-02-28 10:56:30 -0600 (Wed, 28 Feb 2007) | 1 line

updating providers.conf.sample with trunk_username field that was introduced a while back
........
r389 | pari | 2007-02-28 11:37:04 -0600 (Wed, 28 Feb 2007) | 1 line

New option to choose that 'Local Extensions can be any digits in length'
........
r390 | pari | 2007-02-28 19:26:51 -0600 (Wed, 28 Feb 2007) | 1 line

 alternative for browser's inbuilt alert box :) 
........
r391 | pari | 2007-02-28 21:59:07 -0600 (Wed, 28 Feb 2007) | 1 line

alert replaced by gui_alert function
........
r392 | pari | 2007-03-01 00:45:10 -0600 (Thu, 01 Mar 2007) | 1 line

the window of an iframe can be accessed by the contentWindow property - so reusing the same iframe for all alerts :)
........
r393 | pari | 2007-03-01 09:24:24 -0600 (Thu, 01 Mar 2007) | 1 line

gui_alert being executed before astman.js was loaded
........
r394 | pari | 2007-03-01 17:17:22 -0600 (Thu, 01 Mar 2007) | 1 line

Undoing the changes done in commit 311, the code in finally{} is being executed long before all the callbacks in the try{} are executed - my bad.
........

Added:
    branches/appliance/config/guialert.html
      - copied unchanged from r394, trunk/config/guialert.html
Removed:
    branches/appliance/config/numberplan_advanced.html
Modified:
    branches/appliance/   (props changed)
    branches/appliance/config/backup.html
    branches/appliance/config/cfgadvanced.html
    branches/appliance/config/cfgappliance.html
    branches/appliance/config/cfgbasic.html
    branches/appliance/config/home.html
    branches/appliance/config/incoming.html
    branches/appliance/config/localexts.html
    branches/appliance/config/meetme.html
    branches/appliance/config/menus.html
    branches/appliance/config/numberplan.html
    branches/appliance/config/options.html
    branches/appliance/config/queues.html
    branches/appliance/config/record.html
    branches/appliance/config/scripts/astman.js
    branches/appliance/config/scripts/prototype.js
    branches/appliance/config/setup/1.html
    branches/appliance/config/status.html
    branches/appliance/config/trunks.html
    branches/appliance/config/users.html
    branches/appliance/config/voicemail.html
    branches/appliance/configs/providers.conf.sample

Propchange: branches/appliance/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar  1 17:21:18 2007
@@ -1,1 +1,1 @@
-/trunk:1-375
+/trunk:1-394

Modified: branches/appliance/config/backup.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/backup.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/backup.html (original)
+++ branches/appliance/config/backup.html Thu Mar  1 17:21:18 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: branches/appliance/config/cfgadvanced.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/cfgadvanced.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/cfgadvanced.html (original)
+++ branches/appliance/config/cfgadvanced.html Thu Mar  1 17:21:18 2007
@@ -21,7 +21,7 @@
 <script>
 var browser_alert = "Asterisk Configuration GUI is currently supported in Firefox (recommended 1.5 or above) \n SeaMonkey (1.0 or above), Netscape (8.0 or above) and Opera (9.0 or above) \n\n" +	"Support for other browsers is under development \n" + 	" and will be supported in future versions";
 if( navigator.userAgent.indexOf("MSIE") != -1 || navigator.userAgent.indexOf("Konqueror") != -1 || navigator.userAgent.indexOf("Safari") != -1 ){
-	alert(browser_alert);
+	gui_alert(browser_alert);
 }
 </script>
 <script src="scripts/prototype.js"></script>
@@ -205,7 +205,7 @@
 					window.location.href=window.location.href;
 			},
 			onFailure: function(t) {
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 		};
 		opt2.parameters ="action=logoff";

Modified: branches/appliance/config/cfgappliance.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/cfgappliance.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/cfgappliance.html (original)
+++ branches/appliance/config/cfgappliance.html Thu Mar  1 17:21:18 2007
@@ -20,9 +20,6 @@
 -->
 <script>
 var browser_alert = "Asterisk Configuration GUI is currently supported in Firefox (recommended 1.5 or above) \n SeaMonkey (1.0 or above), Netscape (8.0 or above) and Opera (9.0 or above) \n\n" +	"Support for other browsers is under development \n" + 	" and will be supported in future versions";
-if( navigator.userAgent.indexOf("MSIE") != -1 || navigator.userAgent.indexOf("Konqueror") != -1 || navigator.userAgent.indexOf("Safari") != -1 ){
-	alert(browser_alert);
-}
 </script>
 <script src="scripts/prototype.js"></script>
 <script src="scripts/rico.js"></script>
@@ -165,6 +162,9 @@
 	}
 
 	function registerajax() {
+		if( navigator.userAgent.indexOf("MSIE") != -1 || navigator.userAgent.indexOf("Konqueror") != -1 || navigator.userAgent.indexOf("Safari") != -1 ){
+			gui_alert(browser_alert);
+		}
 		var pnameheight = 22;
 		var pheight = (503  - (pnameheight*panels.length) )  ;
 		accordion = new Rico.Accordion( $('configpanel'), { panelHeight: pheight,onHideTab:fademainscreen,onShowTab:showmainscreen });
@@ -196,7 +196,7 @@
 					window.location.href=window.location.href;
 			},
 			onFailure: function(t) {
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 		};
 		opt2.parameters ="action=logoff";
@@ -208,7 +208,7 @@
 	<title>Asterisk Configuration GUI (Beta)</title>
 	<link rel="shortcut icon" href="images/favicon.ico" />
 </head>
-<body onload="javascript:registerajax()" topmargin=1>
+<body onload="registerajax()" topmargin=1>
 <table border="0" align="center" cellspacing="0" cellpadding="0" bgcolor="#dddddd" width=950 height=570>
 <tr height=47><td valign="bottom" align='right' bgcolor='white' height=47><img align='left' src="images/digiumlogo.gif" align="left"></td>
 							<td valign='bottom' align='right' bgcolor='white' colspan=2><a target='_extern' href="http://www.digium.com/en/company/profile/">About Digium</a>&nbsp;|&nbsp;

Modified: branches/appliance/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/cfgbasic.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/cfgbasic.html (original)
+++ branches/appliance/config/cfgbasic.html Thu Mar  1 17:21:18 2007
@@ -20,9 +20,6 @@
 -->
 <script>
 var browser_alert = "Asterisk Configuration GUI is currently supported in Firefox (recommended 1.5 or above) \n SeaMonkey (1.0 or above), Netscape (8.0 or above) and Opera (9.0 or above) \n\n" +	"Support for other browsers is under development \n" + 	" and will be supported in future versions";
-if( navigator.userAgent.indexOf("MSIE") != -1 || navigator.userAgent.indexOf("Konqueror") != -1 || navigator.userAgent.indexOf("Safari") != -1 ){
-	alert(browser_alert);
-}
 </script>
 <script src="scripts/prototype.js"></script>
 <script src="scripts/rico.js"></script>
@@ -171,6 +168,9 @@
 	}
 
 	function registerajax() {
+		if( navigator.userAgent.indexOf("MSIE") != -1 || navigator.userAgent.indexOf("Konqueror") != -1 || navigator.userAgent.indexOf("Safari") != -1 ){
+			gui_alert(browser_alert);
+		}
 		var pnameheight = 22;
 		var pheight = (503  - (pnameheight*panels.length) ) ;
 		accordion = new Rico.Accordion( $('configpanel'), { panelHeight: pheight,onHideTab:fademainscreen,onShowTab:showmainscreen });
@@ -205,7 +205,7 @@
 					window.location.href=window.location.href;
 			},
 			onFailure: function(t) {
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 		};
 		opt2.parameters ="action=logoff";
@@ -222,7 +222,7 @@
 	<title>Asterisk Configuration GUI (Beta)</title>
 	<link rel="shortcut icon" href="images/favicon.ico" />
 </head>
-<body onload="javascript:registerajax()" topmargin=1>
+<body onload="registerajax( )" topmargin=1>
 <table border="0" align="center" cellspacing="0" cellpadding="0" bgcolor="#dddddd" width=950 height=570>
 <tr height=47><td valign="bottom" align='right' bgcolor='white' height=47><img align='left' src="images/digiumlogo.gif" align="left"></td>
 							<td valign='bottom' align='right' bgcolor='white' colspan=2>

Modified: branches/appliance/config/home.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/home.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/home.html (original)
+++ branches/appliance/config/home.html Thu Mar  1 17:21:18 2007
@@ -51,7 +51,7 @@
 			localloggedon = 1;
 			parent.document.getElementById('logoutlink').innerHTML = "Logout";
 			parent.document.getElementById('logoutlink').onclick = parent.Logoff ;
-			alert("You are using the default password provided by AsteriskNOW !! \n\n It is strongly recommended that you chnage your default password ");
+			parent.gui_alert("You are using the default password provided by AsteriskNOW !! \n\n It is strongly recommended that you change your default password ");
 			window.location.href="options.html";
 			return;
 		}
@@ -117,13 +117,13 @@
 
 	function doLogin() {
 		if( $('username').value == "" ){
-				alert("Please enter a Username");
+				parent.gui_alert("Please enter a Username");
 				$('username').focus();
 				return true;			
 		}
 
 		if( $('secret').value == "" ){
-				alert("Please enter a password");
+				parent.gui_alert("Please enter a password");
 				$('secret').focus();
 				return true;			
 		}
@@ -143,6 +143,11 @@
 		parent.astmanEngine.sendRequest('action=ping', demo.pongs);
 	}
 	function localinit() {
+			$('username').onfocus = function(){this.className = 'input9_hilight';}
+			$('username').onblur = function(){this.className = 'input9';}
+			$('secret').onfocus = function(){this.className = 'input9_hilight';}
+			$('secret').onblur = function(){this.className = 'input9';}
+
 		top.document.title = "Asterisk GUI (Beta) -- Home";
 		localajaminit();
 	}

Modified: branches/appliance/config/incoming.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/incoming.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/incoming.html (original)
+++ branches/appliance/config/incoming.html Thu Mar  1 17:21:18 2007
@@ -105,7 +105,7 @@
 	// load list of trunks to 'fromprovider'
 	var t ;
 	for ( t in didtrunks){
-		if( t == "extend")continue ;
+	if(  didtrunks.hasOwnProperty(t) ){
 		  var a = document.createElement('option');
 		  a.text = didtrunks[t].trunkname ;
 		  a.value = t ;
@@ -116,6 +116,7 @@
 		  catch(ex) {
 			b.add(a); 
 		  }
+	  }
 	}
 	// load the object didtrunks into the table callingRulesTable
 	refreshtable();
@@ -253,18 +254,18 @@
 function save_new_incomingrule(){
 	// field validation 
 	if($('incomingrule').value == "frompattern" && $('frompattern').value == "" ){
-		alert("Please define an incoming call pattern !");
+		gui_alert("Please define an incoming call pattern !");
 		$('frompattern').focus();
 		$('frompattern').select();
 		return false;
 	}
 	if( $('fromprovider').selectedIndex == -1 ){
-		alert("Please select a service provider !");
+		gui_alert("Please select a service provider !");
 		$('fromprovider').focus();
 		return false;
 	}
 	if( $('toextension').selectedIndex == -1 ){
-		alert("Please select an extension to which an incoming call should be routed to !");
+		gui_alert("Please select an extension to which an incoming call should be routed to !");
 		$('toextension').focus();
 		return false;
 	}
@@ -295,7 +296,7 @@
 
 	// check whether there is an existing entry with this pattern 
 	if( typeof didtrunks[temp_provider][newpattern] != "undefined" ){
-		alert("An incoming call rule is already defined \n on this trunk for the selcted pattern !! ");
+		gui_alert("An incoming call rule is already defined \n on this trunk for the selcted pattern !! ");
 		return false;
 	}
 	
@@ -313,7 +314,7 @@
 				$('bg_transparent').style.display ='none';
 			},
 			onFailure: function(t) {
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 		};
 
@@ -326,13 +327,13 @@
 function update_incomingrule(){
 	// field validation 
 	if($('incomingrule').value == "frompattern" && $('frompattern').value == "" ){
-		alert("Please define an incoming call pattern !");
+		gui_alert("Please define an incoming call pattern !");
 		$('frompattern').focus();
 		$('frompattern').select();
 		return false;
 	}
 	if( $('toextension').selectedIndex == -1 ){
-		alert("Please select an extension to which an incoming call should be routed to !");
+		gui_alert("Please select an extension to which an incoming call should be routed to !");
 		$('toextension').focus();
 		return false;
 	}
@@ -367,7 +368,7 @@
 	}
 
 	if( typeof didtrunks[temp_provider][newpattern] != "undefined" && ( temp_provider != edit_DIDtrunk || newpattern != edit_pattern ) ){
-		alert("An incoming call rule is already defined \n on this trunk for the selcted pattern !! ");
+		gui_alert("An incoming call rule is already defined \n on this trunk for the selcted pattern !! ");
 		return false;
 	}
 
@@ -385,7 +386,7 @@
 			refreshtable();
 		},
 		onFailure: function(t) {
-			alert("Config Error: " + t.status + ": " + t.statusText);
+			gui_alert("Config Error: " + t.status + ": " + t.statusText);
 		}
 	};
 	opt.parameters="action=updateconfig&reload=yes&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri;
@@ -439,7 +440,7 @@
 				refreshtable();
 			},
 			onFailure: function(t) {
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 		};
 		var uri = build_action('delete',0, b, "exten" ,"", tmp_match);
@@ -454,6 +455,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';}
@@ -461,8 +463,16 @@
 	}
 	parent.astmanEngine.config2list("users.conf", $('users'), new Array(), user_callbacks);
 }
+
+
+function free_mem( ){
+	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
+		try{
+			purge( document.body );
+		}catch(e){ }
+}
 </script>
-<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF">
+<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF"  onunload="free_mem()">
 <div class="mainscreenTitleBar">
 	<span style="margin-left: 4px;font-weight:bold;">Incoming Calls</span>
 	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
@@ -520,9 +530,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: branches/appliance/config/localexts.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/localexts.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/localexts.html (original)
+++ branches/appliance/config/localexts.html Thu Mar  1 17:21:18 2007
@@ -46,8 +46,8 @@
 }
 
 usercallbacks.beforeSaving= function(){
-		if(	$('localextenlength').value != $('userbase').value.length ){
-			alert("'length of Local Extensions' does not match \n the 'length of the Starting point of Allocation'");
+		if(	$('localextenlength').value !=0 && $('localextenlength').value != $('userbase').value.length ){
+			gui_alert("'length of Local Extensions' does not match \n the 'length of the Starting point of Allocation'");
 			return false;
 		}
 
@@ -67,7 +67,7 @@
 										parent.loadscreen(this);
 						},
 						onFailure: function(t) {
-							alert("Config Error: " + t.status + ": " + t.statusText);
+							gui_alert("Config Error: " + t.status + ": " + t.statusText);
 						}
 					};
 					opt.parameters="action=updateconfig&reload=yes&srcfilename=" + encodeURIComponent("users.conf") + "&dstfilename=" + encodeURIComponent("users.conf") + "&Action-000000=update&Cat-000000=general&Var-000000=localextenlength&Value-000000=4"; ;
@@ -90,17 +90,14 @@
 				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);
 }
 
 
 function update_spae(){
+		if( $('localextenlength').value == 0 ) return;
 		if(	$('localextenlength').value == $('userbase').value.length ) return;
 		if(	$('localextenlength').value < $('userbase').value.length ){
 				$('userbase').value = $('userbase').value.substr(0,$('localextenlength').value);
@@ -113,8 +110,16 @@
 		}
 }
 
+function free_mem( ){
+	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
+	try{
+		widgets['save'].hostselectbox = null ;
+		widgets['cancel'].hostselectbox = null ;
+		purge( document.body );
+	} catch(e){ }
+}
 </script>
-<body id="foo" onload="localajaxinit()" bgcolor="EFEFEF">
+<body id="foo" onload="localajaxinit()" bgcolor="EFEFEF"  onunload="free_mem( )">
 <div class="mainscreenTitleBar"><span style="margin-left: 4px;font-weight:bold">Admin Options - Local Extension Settings</span></div>
 <div class="mainscreenContentBox" id="userscontent">
 <TABLE align=center width="520" cellpadding=0 cellspacing=0 style="margin: 5px 0 0 0;">
@@ -134,8 +139,9 @@
 				<tr ><td class="field_text" align=left>
 							Local Extensions are 
 							<select id="localextenlength" class="input9">
-								<option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option>
-							</select> digits long&nbsp;</td>
+								<option value="2">2 digits</option><option value="3">3 digits</option><option value="4">4 digits</option><option value="5">5 digits</option>
+								<option value="0">Varying</option>
+							</select>&nbsp;</td>
 				</tr>
 				<tr ><td class="field_text" align=left>Starting point of Allocation of extensions : <input type=text id="userbase" size=5  class="input9"></td></tr>
 				<tr ><td class="field_text" align="left"><input type=checkbox id="allow_aliasextns">Allow analog phones to be assigned to multiple extensions</td></tr>

Modified: branches/appliance/config/meetme.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/meetme.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/meetme.html (original)
+++ branches/appliance/config/meetme.html Thu Mar  1 17:21:18 2007
@@ -25,7 +25,6 @@
 <script src="scripts/tooltip.js"></script>
 <link href="stylesheets/rico.css" media="all" rel="Stylesheet" type="text/css" />
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
-
 <script>
 	var origwidth;
 	var widgets = new Array;
@@ -178,26 +177,26 @@
 					//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Call Queues\' panel to edit call queues </font>";
 					box.selectedIndex = -1;
 					 enable_disable_fields(0);
-					alert(" You can not edit the selected entry from here.\n Please click on the \'Call Queues\' panel to edit the selected entry");
+					gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Call Queues\' panel to edit the selected entry");
 					return true;
 				}
 				if( box.options[box.selectedIndex].text.toLowerCase().match("-- check voicemail")     ){
 					//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Voicemail\' panel to edit Voicemail Preferences</font>";
 					box.selectedIndex = -1;
 				   enable_disable_fields(0);
-					alert(" You can not edit the selected entry from here.\n Please click on the \'Voicemail\' panel to edit the selected entry");
+					gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Voicemail\' panel to edit the selected entry");
 					return true;
 				}
 				if( box.options[box.selectedIndex].text.toLowerCase().match("-- voice menu")     ){
 					box.selectedIndex = -1;
 					//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Voicemail\' panel to edit Voicemail Preferences</font>";
 					 enable_disable_fields(0);
-					alert(" You can not edit the selected entry from here.\n Please click on the \'Voice Menus\' panel to edit the selected entry");
+					gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Voice Menus\' panel to edit the selected entry");
 					return true;
 				}
 				box.selectedIndex = -1;
 				 enable_disable_fields(0);
-				alert(" You can not edit the selected entry from here.\n Please click on the \'Users\' panel to edit the selected entry");
+				gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Users\' panel to edit the selected entry");
 				return true;
 		}
 		temp_selectedexten = $('name').value;
@@ -233,8 +232,10 @@
 		}
 
 		// check whether the length of extension is valid
-		if( localextenlength !=  $('name').value.length){
-				alert("Sorry, An Extension must be  "+ localextenlength  + " digits !");
+		if(  !$('name').value.length ) { gui_alert("Please enter an extension !"); $('name').focus(); return false; }
+
+		if(  localextenlength !=0 && (localextenlength !=  $('name').value.length) ){
+				gui_alert("Sorry, An Extension must be  "+ localextenlength  + " digits !");
 				$('name').focus();
 				return false;
 		}
@@ -246,7 +247,7 @@
 			for(var k=0; k<$('extensions').length; k++ ){
 				var tmp = $('extensions').options[k].innerHTML.split(' -- '); 
 				if( tmp[0] ==  $('name').value   ){
-					alert("Sorry, an entry named " + $('name').value + " already exists!");
+					gui_alert("Sorry, an entry named " + $('name').value + " already exists!");
 					return false;
 				}
 			}
@@ -369,19 +370,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);
 	}
@@ -391,11 +384,19 @@
 	meetmecallbacks.loaded = function() {
 		parent.astmanEngine.config2list("users.conf", $('hiddenusers'), new Array(), usercallbacks);
 	}
+
+function free_mem( ){
+	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
+		try{
+		widgets['save'].hostselectbox = null ;
+		widgets['cancel'].hostselectbox = null ;
+		widgets['newitem'].hostselectbox = null ;
+		widgets['delete'].hostselectbox = null ;
+		purge( document.body );
+		} catch(e) { }
+}
 </script>
-
-
-<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF">
-
+<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF"  onunload="free_mem()">
 <div class="mainscreenTitleBar">
 	<span style="margin-left: 4px;font-weight:bold;">Conference Bridge Extensions Configuration</span>
 	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
@@ -407,7 +408,7 @@
 		<td><select disabled size="25" id="extensions" style="width:220px;" class="input10">	
 							<option>Loading...</option>	
 				</select>
-				<div style='visibility:hidden;overflow:hidden;width:0px;height:0px'>	<select id='hiddenusers'>	</select><select id='meetme_conf'></select></div>
+				<select id='hiddenusers' style='display:none;'></select><select id='meetme_conf' style='display:none;'></select>
 		</td>
 		<td style="width:311px;height: 415px">
 					<div id='adjustments'>

Modified: branches/appliance/config/menus.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/menus.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/menus.html (original)
+++ branches/appliance/config/menus.html Thu Mar  1 17:21:18 2007
@@ -193,7 +193,7 @@
 						delete voicemenusdata[deleted_voicmenu];
 					},
 					onFailure: function(t) {
-						alert("Config Error: " + t.status + ": " + t.statusText);
+						gui_alert("Config Error: " + t.status + ": " + t.statusText);
 					}
 				};
 			var existing_alias_string = voicemenusdata[deleted_voicmenu].alias_exten + ",1,Goto(" + deleted_voicmenu + "|s|1)"  ;
@@ -258,13 +258,13 @@
 
 function add_newstep(){
 	if( !$('newstep_action').value ){
-		alert("Please select an action for this step");
+		gui_alert("Please select an action for this step");
 		$('newstep_action').focus();
 		return;
 	}
 
 	if( $('newstep_action').value != "Answer" &&   $('newstep_action').value != "Hangup" && !$('newstep_var').value ){
-		alert("Please enter a value for '" + $('newstep_action').value +"'");
+		gui_alert("Please enter a value for '" + $('newstep_action').value +"'");
 		$('newstep_var').focus();
 		return;
 	}
@@ -306,7 +306,7 @@
 			},
 			onFailure: function(t) {
 				$('status_message').style.display='none';
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 	};
 	var uri = "";
@@ -367,8 +367,8 @@
 
 function save_vmenu(){
 
-	if( $('alias_exten').value.length > 0 && localextenlength !=  $('alias_exten').value.length){
-			alert("Sorry, An Extension must be  "+ localextenlength  + " digits !");
+	if( $('alias_exten').value.length > 0 && localextenlength !=0 && localextenlength !=  $('alias_exten').value.length){
+			gui_alert("Sorry, An Extension must be  "+ localextenlength  + " digits !");
 			$('alias_exten').focus();
 			return false;
 	}
@@ -424,7 +424,7 @@
 			},
 			onFailure: function(t) {
 				$('status_message').style.display='none';
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 	};
 	var uri = "" ;
@@ -608,7 +608,7 @@
 
 			},
 			onFailure: function(t) {
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 	};	
 	var uri = "";
@@ -644,7 +644,7 @@
 			},
 			onFailure: function(t) {
 				$('status_message').style.display='none';
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 	};	
 	var uri = "";
@@ -934,6 +934,7 @@
 
 
 function localajaxinit() {
+		showdiv_statusmessage();
 		setWindowTitle("Voice Menus");
 		$('message_text').innerHTML ="Saving Changes...";
 		for (x =0 ; x<fieldnames.length; x++){
@@ -1022,8 +1023,18 @@
 	parent.astmanEngine.config2list("extensions.conf", $('vmenus'), widgets, menuscallbacks);
 }
 
+function free_mem(){
+	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
+	try{
+		widgets['save'].hostselectbox = null ;
+		widgets['cancel'].hostselectbox = null ;
+		widgets['new'].hostselectbox = null ;
+		widgets['delete'].hostselectbox = null ;
+		purge( document.body );
+	} catch(e){ }
+}
 </script>
-<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF">
+<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF" onunload="free_mem()">
 <div class="mainscreenTitleBar">
 	<span style="margin-left: 4px;font-weight:bold;">Voice Menus Configuration</span>
 	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
@@ -1350,9 +1361,4 @@
 	</tr>
 </table>
 </div>
-<SCRIPT LANGUAGE="JavaScript">
-<!--
-showdiv_statusmessage();
-//-->
-</SCRIPT>
 </body>

Modified: branches/appliance/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/branches/appliance/config/numberplan.html?view=diff&rev=395&r1=394&r2=395
==============================================================================
--- branches/appliance/config/numberplan.html (original)
+++ branches/appliance/config/numberplan.html Thu Mar  1 17:21:18 2007
@@ -38,14 +38,7 @@
 var iscustom ;
 var pattern_beingedited ;
 var pattern_beingedited_priority ;
-var oldselect;
 var np_oldselect;
-
-function hackenablesave(){
-	if( oldselect != $('trunks').value ){
-		enablesave();
-	}
-}
 
 function ownpattern(){
 		iscustom = true;
@@ -79,21 +72,21 @@
 
 function checkfields(){
 	if( $('rulename').value.length == 0 ){
-		alert("Please enter a Rule Name");
+		gui_alert("Please enter a Rule Name");
 		$('rulename').focus();
 		return false;
 	}
 	if($('trunks').selectedIndex == -1){
-		alert("Please select a service provider to place this call through");
+		gui_alert("Please select a service provider to place this call through");
 		return false;
 	}
 	if($('define_advanced').style.display=="none" && $('beginswith').value.length==0 ){
-		alert("Please Enter the beginning pattern of the number");
+		gui_alert("Please Enter the beginning pattern of the number");
 		$('beginswith').focus();
 		return false;
 	}
 	if($('define_usual').style.display=="none" && $('pattern').value.length == 0 ){
-		alert("Please Enter a custom pattern");
+		gui_alert("Please Enter a custom pattern");
 		$('pattern').focus();
 		return false;
 	}
@@ -143,7 +136,7 @@
 									oncomplete(); 
 						},
 						onFailure: function(t) {
-							alert("Config Error: " + t.status + ": " + t.statusText);
+							gui_alert("Config Error: " + t.status + ": " + t.statusText);
 						}
 					};
 					opt.parameters= "action=updateconfig&reload=yes&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri;
@@ -163,7 +156,7 @@
 					var m = numberplansdata[$('extensions').value]['npdata'];
 
 					if(  m.hasOwnProperty($('pattern').value)  && m[$('pattern').value].hasOwnProperty(''+newpriority)  ) { 
-						alert("A rule for this pattern is already defined !") ; 
+						gui_alert("A rule for this pattern is already defined !") ; 
 						return ;
 					}
 
@@ -395,7 +388,7 @@
 							oncomplete(); 
 			},
 			onFailure: function(t) {
-				alert("Config Error: " + t.status + ": " + t.statusText);
+				gui_alert("Config Error: " + t.status + ": " + t.statusText);
 			}
 		};
 		opt.parameters= "action=updateconfig&reload=yes&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri;
@@ -408,7 +401,7 @@
 function editcallingrule(a,b){	// a is pattern, b is priority
 		pattern_beingedited = a ;
 		pattern_beingedited_priority = b ;
-		oldselect = $('trunks').value;
+//		oldselect = $('trunks').value;
 		isnewrule = false ;
 		var m = numberplansdata[$('extensions').value]['npdata'];
 		$('rulename').value = m[a][b].rulename;
@@ -480,11 +473,9 @@
 }
 
 numplan_callbacks.loaded = function() {
-	if (document.addEventListener){
-		document.addEventListener("change", select_differentplan, false);
-	} else if (document.attachEvent){
-		document.attachEvent('onchange', select_differentplan);
-	}
+
+	add_event( $('extensions') , 'change', select_differentplan );
+
 	if($('extensions').options.length ==0 ){
 			parent.loadscreen(this);
 			addthe_default_callingplan();
@@ -541,33 +532,8 @@
 numplan_callbacks.eachline = true;
 numplan_callbacks.includecats = true;
 
-trunkcallbacks.format = function(t) {
-	//if (t.name.substr(0,6) != 'trunk_')
-	//	return null;
-	if ( t.fieldbyname['context'] != asterisk_guiTDPrefix + t.name ) {
-		return null;
-	}
-	if (t.fieldbyname['trunkname'] && t.fieldbyname['trunkname'].length) {
-		trunks_desc[t.name] = new Object();
-		trunks_desc[t.name].comment = t.fieldbyname['trunkname'] ;
-		return t.fieldbyname['trunkname'];
-	} else{
-		trunks_desc[t.name] = new Object();
-		trunks_desc[t.name].comment = t.name ;
-		return t.name;
-	}
-}
-
-trunkcallbacks.loaded = function(){
-	if ($('trunks').addEventListener){
-		$('trunks').addEventListener('click',hackenablesave,false);
-	} else if ($('trunks').attachEvent){
-		$('trunks').attachEvent('onclick', 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]);
@@ -578,7 +544,28 @@
 		$(focus_fields[x]).onblur = function(){this.className = 'input9';}
 	}
 	$('message_text').innerHTML ="Saving Changes...";
-	parent.astmanEngine.config2list("users.conf", $('trunks'), new Array(), trunkcallbacks);
+
+	config2json('users.conf', 1, trunks_loaded ) ;
+	//parent.astmanEngine.config2list("users.conf", $('trunks'), new Array(), trunkcallbacks);
+}
+
+function trunks_loaded(b){
+	var c = eval('(' + b + ')');
+	for( var d in c ){
+		if ( c.hasOwnProperty(d) && c[d]['context'] && (c[d]['context'] == asterisk_guiTDPrefix + d ) ) {
+			trunks_desc[d] = new Object();
+			trunks_desc[d].comment = (c[d]['trunkname']) ? c[d]['trunkname'] : d ;
+			var New_OPTION = document.createElement('option');
+			New_OPTION.text =  trunks_desc[d].comment ;
+			New_OPTION.value =d ;
+			try {
+				$('trunks').add(New_OPTION, null); // W3C way
+			}catch(ex) {
+				$('trunks').add(New_OPTION); // IE way
+			}
+		}
+	}
+	parent.astmanEngine.config2list("extensions.conf", $('extensions'), widgets , numplan_callbacks);
 }
 
 function select_differentplan(){
@@ -620,14 +607,26 @@
 		asynchronous: true,
 		onSuccess: function(t) { location.reload(); },
 		onFailure: function(t) {
-			alert("Config Error: " + t.status + ": " + t.statusText);
+			gui_alert("Config Error: " + t.status + ": " + t.statusText);
 		}
 	};
 	opt.parameters= "action=updateconfig&reload=yes&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri;
 	var tmp = new Ajax.Request("../../rawman", opt);
 }
+
+
+function free_mem( ){
+	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
+		try{
+			widgets['save'].hostselectbox = null ;
+			widgets['cancel'].hostselectbox = null ;
+			widgets['new'].hostselectbox = null ;
+			widgets['delete'].hostselectbox = null ;
+			purge( document.body );
+		}catch(e){ }
+}
 </script>
-<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF">
+<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF" onunload="free_mem()">
 <div class="mainscreenTitleBar">
 	<span style="margin-left: 4px;font-weight:bold;">Calling Rules</span>
 	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
@@ -667,7 +666,7 @@
 	</center>
 <BR>
 	<center>
-	<fieldset  style="height: 390px; width: 500px"  id="fieldset2">
+	<fieldset  style="height: 390px; "  id="fieldset2">
 			<legend>&nbsp;List of Calling Rules in the selected DialPlan&nbsp;</legend>
 				<table class="table_blacksm" cellpadding=2 cellspacing=2 border=0 align=center width=500 id="table_one">
 					<tr>	<td width=35>S.No</td>
@@ -701,7 +700,7 @@
 		</TR>
 		<TR>

[... 3516 lines stripped ...]


More information about the asterisk-gui-commits mailing list