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

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Tue Feb 27 17:15:51 MST 2007


Author: pari
Date: Tue Feb 27 18:15:51 2007
New Revision: 386

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=386
Log:
This commit should fix most of the IE memory leaks in the GUI

Modified:
    trunk/config/incoming.html
    trunk/config/localexts.html
    trunk/config/meetme.html
    trunk/config/menus.html
    trunk/config/numberplan.html
    trunk/config/queues.html
    trunk/config/record.html
    trunk/config/scripts/astman.js
    trunk/config/status.html
    trunk/config/sysinfo.html
    trunk/config/trunks.html
    trunk/config/users.html
    trunk/config/voicemail.html

Modified: trunk/config/incoming.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/incoming.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/incoming.html (original)
+++ trunk/config/incoming.html Tue Feb 27 18:15:51 2007
@@ -463,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>

Modified: trunk/config/localexts.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/localexts.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/localexts.html (original)
+++ trunk/config/localexts.html Tue Feb 27 18:15:51 2007
@@ -109,8 +109,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;">

Modified: trunk/config/meetme.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/meetme.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/meetme.html (original)
+++ trunk/config/meetme.html Tue Feb 27 18:15:51 2007
@@ -383,11 +383,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>

Modified: trunk/config/menus.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/menus.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/menus.html (original)
+++ trunk/config/menus.html Tue Feb 27 18:15:51 2007
@@ -1023,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>

Modified: trunk/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/numberplan.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/numberplan.html (original)
+++ trunk/config/numberplan.html Tue Feb 27 18:15:51 2007
@@ -613,8 +613,20 @@
 	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>

Modified: trunk/config/queues.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/queues.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/queues.html (original)
+++ trunk/config/queues.html Tue Feb 27 18:15:51 2007
@@ -459,8 +459,19 @@
 mohcallbacks.loaded = function() {
 	parent.astmanEngine.config2list("extensions.conf", $('extensions'), new Array(), extencallbacks);
 }
+
+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;">Queue Extension 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>

Modified: trunk/config/record.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/record.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/record.html (original)
+++ trunk/config/record.html Tue Feb 27 18:15:51 2007
@@ -272,8 +272,14 @@
 	$('message_text').innerHTML = "Please wait while the system <BR> Calls the specified Extension ... ";
 }
 
+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;">Record a Custom VoiceMenu</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>

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Tue Feb 27 18:15:51 2007
@@ -27,6 +27,30 @@
 var sortbynames = false;
 var dragdata = new Object;
 var asterisk_guiTDPrefix = "DID_";
+
+// Douglas Crockford's purge function for IE Memory leaks
+// http://javascript.crockford.com/memory/leak.html
+// No details about copyrights or License mentioned - assumed to be in public domain
+function purge(d) {
+    var a = d.attributes, i, l, n;
+    if (a) {
+        l = a.length;
+        for (i = 0; i < l; i += 1) {
+            n = a[i].name;
+            if (typeof d[n] === 'function') {
+                d[n] = null;
+            }
+        }
+    }
+    a = d.childNodes;
+    if (a) {
+        l = a.length;
+        for (i = 0; i < l; i += 1) {
+            purge(d.childNodes[i]);
+        }
+    }
+}
+
 
 function add_event( a , b, c ){  
 	// cross browser function for adding events

Modified: trunk/config/status.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/status.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/status.html (original)
+++ trunk/config/status.html Tue Feb 27 18:15:51 2007
@@ -121,6 +121,9 @@
 
 function localajaxend(){
 		parent.astmanEngine.setEventCallback(parent.eventeater.eventcb );
+		if( navigator.userAgent.indexOf("MSIE") != -1 ){ 
+			try{ purge( document.body ); } catch(e){ }	
+		}
 }
 
 </script>

Modified: trunk/config/sysinfo.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/sysinfo.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/sysinfo.html (original)
+++ trunk/config/sysinfo.html Tue Feb 27 18:15:51 2007
@@ -158,8 +158,15 @@
 	update_sysinfo();
 }
 
+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;">System Information</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>

Modified: trunk/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/trunks.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/trunks.html (original)
+++ trunk/config/trunks.html Tue Feb 27 18:15:51 2007
@@ -665,8 +665,19 @@
 		$('registersip').value = 'no';
 	}
 }
+
+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;">Service Providers</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>

Modified: trunk/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/users.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/users.html (original)
+++ trunk/config/users.html Tue Feb 27 18:15:51 2007
@@ -319,8 +319,18 @@
 		parent.astmanEngine.config2list("zapscan.conf", $('zapchan'), new Array(), phonecallbacks);
 	}
 
+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;">User and Phone 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>

Modified: trunk/config/voicemail.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/voicemail.html?view=diff&rev=386&r1=385&r2=386
==============================================================================
--- trunk/config/voicemail.html (original)
+++ trunk/config/voicemail.html Tue Feb 27 18:15:51 2007
@@ -286,11 +286,17 @@
 		}
 		parent.astmanEngine.config2list("voicemail.conf", $('hiddenvoicemail'), vmwidgets, voicemailcallbacks);
 	}
+
+function free_mem( ){
+	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
+		try{
+			vmwidgets['save'].hostselectbox = null ;
+			vmwidgets['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;">Voicemail 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>



More information about the asterisk-gui-commits mailing list