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

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Fri Jun 1 12:06:57 MST 2007


Author: pari
Date: Fri Jun  1 14:06:56 2007
New Revision: 1020

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

Modified:
    trunk/config/backup.html
    trunk/config/iax.html
    trunk/config/incoming.html
    trunk/config/numberplan.html
    trunk/config/record.html
    trunk/config/ringgroups.html
    trunk/config/scripts/astman.js
    trunk/config/sip.html
    trunk/config/sysinfo.html
    trunk/config/timerules.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=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/backup.html (original)
+++ trunk/config/backup.html Fri Jun  1 14:06:56 2007
@@ -213,7 +213,7 @@
 </table>
 </div>
 <div id="newbkp_content" STYLE="display:none; position: absolute; left: 120; top: 144; width:350; height:125;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="startDrag(event , 'newbkp_content');">
+	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'newbkp_content');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD><font color="#FFFFFF">&nbsp;&nbsp;<B>Create New Backup</B></FONT></TD>
 		<TD Height="20" align="right" style="cursor: move">

Modified: trunk/config/iax.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/iax.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/iax.html (original)
+++ trunk/config/iax.html Fri Jun  1 14:06:56 2007
@@ -347,7 +347,7 @@
 </div>
 <div style='visibility:hidden;overflow:hidden;width:0px;height:0px'><select  size="5" id="hiddenfield" style="width:220px"></select></div>
 <div  id="div_setordercodecs" style="position:absolute; display:none; left: 120; top: 70; width:350; background-color:#F4EFE5; border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'div_setordercodecs');">
+	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="ASTGUI.startDrag(event , 'div_setordercodecs');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="center" style="cursor: move"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">Codec Preferences</font></TD>
 		<TD Height="20" align="right" style="cursor: move"><A href="#" onclick="cancel_ordercodecs();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A></TD>

Modified: trunk/config/incoming.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/incoming.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/incoming.html (original)
+++ trunk/config/incoming.html Fri Jun  1 14:06:56 2007
@@ -461,7 +461,7 @@
 	</div>
 	<center><input type="button" id="adddid" value="Add a Incoming Rule" onclick="add_incomingrule();" tip="en,incoming,0"></center>
 	<div id="userscontent" STYLE="display:none; position: absolute; left: 20; top: 40; width:475; height:190; background-color:#F4EFE5; border-width: 1px; border-color: #7E5538; border-style: solid;z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'userscontent');">
+	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="ASTGUI.startDrag(event , 'userscontent');">
 		<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 			<TD Height="20" align="right" style="cursor: move">
 				<A href="#" onclick="$('cancel_a').click();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A>

Modified: trunk/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/numberplan.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/numberplan.html (original)
+++ trunk/config/numberplan.html Fri Jun  1 14:06:56 2007
@@ -619,7 +619,7 @@
 	</center>
 	<BR>
 	<div id="npcontent" STYLE="display:none; position: absolute; left: 110; top: 40; width:320; height:110;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:6">
-	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="startDrag(event , 'npcontent');">
+	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'npcontent');">
 		<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 			<TD Height="20" align="center" style="cursor: move">
 				<font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">Create new Dial Plan </font>
@@ -665,7 +665,7 @@
 	</center>
 
 	<div id="userscontent" STYLE="display:none; position: absolute; left: 20; top: 144; width:500; height:290;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="startDrag(event , 'userscontent');">
+	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'userscontent');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="right" style="cursor: move">
 			<A href="#" onclick="$('cancel_a').click();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A>

Modified: trunk/config/record.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/record.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/record.html (original)
+++ trunk/config/record.html Fri Jun  1 14:06:56 2007
@@ -208,7 +208,7 @@
 </table>
 </div>
 <div id="recordnew_content" STYLE="display:none; position: absolute; left: 20; top: 125; width:475; height:150;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid;z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'recordnew_content');">
+	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="ASTGUI.startDrag(event , 'recordnew_content');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="center" style="cursor: move">
 			<font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">Record a new Voicemenu</font>

Modified: trunk/config/ringgroups.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/ringgroups.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/ringgroups.html (original)
+++ trunk/config/ringgroups.html Fri Jun  1 14:06:56 2007
@@ -467,7 +467,7 @@
 	<BR>
 </div>
 <div id="ringgroup_editdiv" STYLE="display:none; position: absolute; left: 20; top: 40; width:480; height:430; background-color:#F4EFE5; border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="startDrag(event , 'ringgroup_editdiv');">
+	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'ringgroup_editdiv');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD><font color="#FFFFFF">&nbsp;&nbsp;<span id="form_caption"></span></FONT></TD>
 		<TD Height="20" align="right" style="cursor: move">

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Fri Jun  1 14:06:56 2007
@@ -38,13 +38,55 @@
 var asterisk_configfolder = "/etc/asterisk/";
 var asterisk_guiListFiles = "sh " + asterisk_scriptsFolder + "listfiles" ;
 
-var dragdata = {};
 var asterisk_guiTDPrefix = "DID_";
 var TIMERULES_CATEGORY = 'timebasedrules';
 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.
+	startDrag : function(event, movethis ){
+		var initialcursorX, initialcursorY, initialwindowleft, initialwindowtop, maxleft, maxtop ;
+		var stopDrag = function(){
+			ASTGUI.events.remove( document , "mousemove" , movewindow ) ;
+			ASTGUI.events.remove( document , "mouseup" , stopDrag ) ;
+		};
+		var movewindow = function(event){
+			var x,y;
+			if(typeof window.scrollX != "undefined"){
+			x = event.clientX + window.scrollX;
+			y = event.clientY + window.scrollY;
+			}else{
+				x =  window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
+				y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
+			}
+			var tmp_top = initialwindowtop  + y - initialcursorY ; 
+			var tmp_left = initialwindowleft + x - initialcursorX;
+			if( tmp_left > 0 && tmp_left < maxleft ){ _$(movethis).style.left = tmp_left }
+			if( tmp_top > 0 && tmp_top < maxtop ){ _$(movethis).style.top  = tmp_top }
+		};
+	
+		if(typeof window.scrollX != "undefined"){
+			initialcursorX = event.clientX + window.scrollX;
+			initialcursorY = event.clientY + window.scrollY;
+		}else{
+			initialcursorX =  window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
+			initialcursorY = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
+		}
+	
+		initialwindowleft = parseInt( _$(movethis).style.left ,10 ) ;
+		initialwindowtop = parseInt(_$(movethis).style.top ,10) ;
+	
+		if(typeof window.innerWidth != "undefined"){
+			maxleft = window.innerWidth - parseInt(_$(movethis).style.width , 10) ;
+			maxtop = window.innerHeight - parseInt(_$(movethis).style.height , 10) ;
+		}else{
+			maxleft = document.body.offsetWidth - parseInt(_$(movethis).style.width , 10) ;
+			maxtop = document.body.offsetWidth- parseInt(_$(movethis).style.height , 10) ;
+		}
+		ASTGUI.events.add( document , "mousemove" , movewindow ) ;
+		ASTGUI.events.add( document , "mouseup" , stopDrag ) ;
+	},
+
 	events: {
 		getTarget: function(x){
 			x = x || window.event;
@@ -237,13 +279,14 @@
 	var a = [ ] ;
 	var  json_data = "";
 	var t = z.split("\n");
+	var f, h, catno, g, catname, j, subfield, v, subfield_a , subfield_b; 
 	for(var r=0; r < t.length ; r++){
-		var f = t[r].split("-") ;
-		var h = f[0].toLowerCase();
-		var catno = parseInt( f[1] ,10 );
+		f = t[r].split("-") ;
+		h = f[0].toLowerCase();
+		catno = parseInt( f[1] ,10 );
 		if( h == "category" ){
-			var g = t[r].indexOf(":") ; 
-			var catname = t[r].substr(g+1) ; // catogory 
+			g = t[r].indexOf(":") ; 
+			catname = t[r].substr(g+1) ; // category 
 			catname = catname.replace(/^\s*|\s*$/g,'') ; // trim 
 			if(!p){
 				a[catname] = [];
@@ -251,16 +294,16 @@
 				a[catname] = {};
 			}
 		}else if ( h == "line" ){
-			var j = t[r].indexOf(":") ;
-			var subfield = t[r].substr(j+1) ; // subfield
+			j = t[r].indexOf(":") ;
+			subfield = t[r].substr(j+1) ; // subfield
 			subfield = subfield.replace(/^\s*|\s*$/g,'') ; // trim 
 
 			if(!p){
 				a[catname].push(subfield);
 			}else{
-				var v = subfield.indexOf("=");
-				var subfield_a = subfield.substring(0,v);//subfield variable
-				var subfield_b =  subfield.substr(v+1) ;//subfield variable value
+				v = subfield.indexOf("=");
+				subfield_a = subfield.substring(0,v);//subfield variable
+				subfield_b =  subfield.substr(v+1) ;//subfield variable value
 				a[catname][subfield_a] = subfield_b;
 			}
 		}
@@ -270,48 +313,6 @@
 
 function setWindowTitle(a){
 	top.document.title = asterisk_guiappname + " -- " + a ;
-}
-
-function startDrag(event, movethis ){
-	dragdata.movethis = movethis ;
-	if(typeof window.scrollX != "undefined"){
-		dragdata.initialcursorX = event.clientX + window.scrollX;
-		dragdata.initialcursorY = event.clientY + window.scrollY;
-	}else{
-		dragdata.initialcursorX =  window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
-		dragdata.initialcursorY = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
-	}
-	dragdata.initialwindowleft = parseInt( $(dragdata.movethis).style.left) ;
-	dragdata.initialwindowtop = parseInt($(dragdata.movethis).style.top) ;
-	if(typeof window.innerWidth != "undefined"){
-		dragdata.maxleft = window.innerWidth - parseInt($(dragdata.movethis).style.width) ;
-		dragdata.maxtop = window.innerHeight - parseInt($(dragdata.movethis).style.height) ;
-	}else{
-		dragdata.maxleft = document.body.offsetWidth - parseInt($(dragdata.movethis).style.width) ;
-		dragdata.maxtop = document.body.offsetWidth- parseInt($(dragdata.movethis).style.height) ;
-	}
-	ASTGUI.events.add( document , "mousemove" , movewindow ) ;
-	ASTGUI.events.add( document , "mouseup" , stopDrag ) ;
-}
-
-
-function stopDrag(){
-	ASTGUI.events.remove( document , "mousemove" , movewindow ) ;
-	ASTGUI.events.remove( document , "mouseup" , stopDrag ) ;
-}
-
-function movewindow(event){
-	if(typeof window.scrollX != "undefined"){
-	  x = event.clientX + window.scrollX;
-	  y = event.clientY + window.scrollY;
-	}else{
-		x =  window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
-		y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
-	}
-	  var tmp_top = dragdata.initialwindowtop  + y - dragdata.initialcursorY ; 
-	  var tmp_left = dragdata.initialwindowleft + x - dragdata.initialcursorX;
-	  if( tmp_left > 0 && tmp_left < dragdata.maxleft ){ $(dragdata.movethis).style.left = tmp_left  + "px"; }
-	  if( tmp_top > 0 && tmp_top < dragdata.maxtop ){ $(dragdata.movethis).style.top  = tmp_top + "px"; }
 }
 
 function check_patternonfields(fields){

Modified: trunk/config/sip.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/sip.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/sip.html (original)
+++ trunk/config/sip.html Fri Jun  1 14:06:56 2007
@@ -567,7 +567,7 @@
 	</table>
 </div>
 <div style="position:absolute; display:none; left: 120; top: 70; width:350; background-color:#F4EFE5; border-width: 1px; border-color: #7E5538; border-style: solid;z-index:5" id="div_setordercodecs">
-	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'div_setordercodecs');">
+	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="ASTGUI.startDrag(event , 'div_setordercodecs');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="center" style="cursor: move"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">Codec Preferences</font></TD>
 		<TD Height="20" align="right" style="cursor: move"><A href="#" onclick="cancel_ordercodecs();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A></TD>

Modified: trunk/config/sysinfo.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/sysinfo.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/sysinfo.html (original)
+++ trunk/config/sysinfo.html Fri Jun  1 14:06:56 2007
@@ -129,7 +129,7 @@
 		<a href="#" class="tab" onclick="return show_window(3);" id="tab3" tip="en,sysinfo,2">Resources</a>&nbsp;&nbsp;
 		<div id="sysinfohtml" style="display:none"></div>
 
-		<div id="information" style=" border: solid 0px black; background: transparent; padding: 4px; height:440px; width:95%;">
+		<div id="information" style=" border: solid 0px black; background: transparent; padding: 4px; width:95%;">
 			<BR>
 			<div id="osversion_div" style="display:none">
 					OS Version: <div id="osversion" style="font-family:courier; font-size:10pt;"></div><BR>
@@ -146,8 +146,8 @@
 			<div id="hostname_div" style="display:none">
 					Hostname: <div id="hostname" style="font-family:courier; font-size:10pt;"></div><BR>
 			</div>
-			<div id="ifconfig_div" style="display:none; height:430px; ">
-					ifconfig:<PRE><div id="ifconfig" style="font-family:courier; font-size:8.5pt; height:410px; overflow :auto;"></div></PRE>
+			<div id="ifconfig_div" style="display:none;">
+					ifconfig:<PRE><div id="ifconfig" style="font-family:courier; font-size:8.5pt;overflow :auto;"></div></PRE>
 			</div>
 			<div id="df_div" style="display:none;">
 					Disk Usage:<PRE><div id="diskusage" style="font-family:courier; font-size:10pt;"></div></PRE>

Modified: trunk/config/timerules.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/timerules.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/timerules.html (original)
+++ trunk/config/timerules.html Fri Jun  1 14:06:56 2007
@@ -481,7 +481,7 @@
 	<BR>
 </div>
 <div id="timerule_editdiv" STYLE="display:none; position: absolute; left: 20; top: 40; width:480; height:320; background-color:#F4EFE5; border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="startDrag(event , 'timerule_editdiv');">
+	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'timerule_editdiv');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD><font color="#FFFFFF">&nbsp;&nbsp;<span id="form_caption"></span></FONT></TD>
 		<TD Height="20" align="right" style="cursor: move">

Modified: trunk/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/trunks.html?view=diff&rev=1020&r1=1019&r2=1020
==============================================================================
--- trunk/config/trunks.html (original)
+++ trunk/config/trunks.html Fri Jun  1 14:06:56 2007
@@ -976,7 +976,7 @@
 <div id="userscontent" STYLE="display:none; position: absolute; left: 20; top: 40; width:500; height:400;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
 	<table width="100%" cellpadding=0 cellspacing=0>
 		<TR bgcolor="#7E5538" style="background-image:url('images/title_gradient.gif');">
-		<TD  onmousedown="startDrag(event , 'userscontent');" id="userscontent_title" style="cursor: move;color:#FFFFFF; font-size: 12px; font-weight:bold;" align="center"></TD>
+		<TD  onmousedown="ASTGUI.startDrag(event , 'userscontent');" id="userscontent_title" style="cursor: move;color:#FFFFFF; font-size: 12px; font-weight:bold;" align="center"></TD>
 		<TD Height="20" width=15 align="center"  style="color:#FFFFFF; font-size: 12px; font-weight:bold;" onclick="$('cancel').click();">X</TD>
 		</TR>
 	</table>
@@ -1073,7 +1073,7 @@
 <!-- Users content DIV -->
 <!-- Codecs content DIV -->
 <div id="codecs_content" STYLE="display:none; position: absolute; left: 20; top: 125; width:350; height:245;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid;z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'codecs_content');">
+	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="ASTGUI.startDrag(event , 'codecs_content');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="center" style="cursor: move"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">Codec Preferences</font></TD>
 		<TD Height="20" align="right" style="cursor: move"><A href="#" onclick="hide_codecs();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A></TD>
@@ -1110,7 +1110,7 @@
 <!-- Codecs content DIV -->
 <!-- Advanced content DIV -->
 <div id="advanced_content" STYLE="display:none; position: absolute; left: 20; top: 125; width:350; height:197;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid;z-index:7">
-	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'advanced_content');">
+	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="ASTGUI.startDrag(event , 'advanced_content');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="center" style="cursor: move"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">Advanced Settings</font></TD>
 		<TD Height="20" align="right" style="cursor: move"><A href="#" onclick="advanced_cancel();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A></TD>



More information about the asterisk-gui-commits mailing list