pari: trunk r390 - in /trunk/config: guialert.html scripts/astman.js users.html

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Wed Feb 28 18:26:52 MST 2007


Author: pari
Date: Wed Feb 28 19:26:51 2007
New Revision: 390

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=390
Log:
 alternative for browser's inbuilt alert box :) 

Added:
    trunk/config/guialert.html
Modified:
    trunk/config/scripts/astman.js
    trunk/config/users.html

Added: trunk/config/guialert.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/guialert.html?view=auto&rev=390
==============================================================================
--- trunk/config/guialert.html (added)
+++ trunk/config/guialert.html Wed Feb 28 19:26:51 2007
@@ -1,0 +1,41 @@
+<script>
+function update( ){
+	if(  navigator.userAgent.indexOf("MSIE") != -1 ){
+		document.body.style.backgroundColor ="#F4EFE5";
+	}
+	if(top.alertmsgtype == 1 ){
+		document.getElementById('message').innerHTML = top.alertmsg ;
+		document.getElementById('div_alert').style.display = "" ;
+	}
+}
+
+function close_guialert( ){
+	top.document.body.removeChild( top.document.getElementById( top.alertframename ) );
+}
+</script>
+<head>
+</head>
+<body onload="update( )" topmargin=0 leftmargin=0 style="background-color: transparent">
+			<div id="div_alert" STYLE="display:none; position: absolute; left: 260; top: 180; width:320; height:130;  background-color:#FFFFFF;   border-width: 2px; border-color: #7E5538; border-style: solid; background-style: solid;">
+					<table width="100%" cellpadding=0 cellspacing=0>
+					<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
+							<TD Height="20" align="center">
+							<font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">Alert !</font>
+							</TD>
+							<TD Height="20" align="right">
+								<A href="#" onclick="close_guialert();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A>
+							</TD>
+							<TD width=4></TD>
+					</TR>
+					</table>
+					<TABLE cellpadding=0 cellspacing=3 border=0 width="100%">
+					<TR><TD colspan=2 height=10></TD></TR>
+					<TR><TD align="right"></TD>
+								<TD align="center" bgcolor="#FFFFFF"><div id='message'></div> </TD>
+					</TR>
+					<TR><TD colspan=2 height=10></TD></TR>
+					<TR> <TD align="center" colspan=2> <input type="button" id="ok" onclick="close_guialert()" value="Ok"> </TD>
+					</TR>
+					</TABLE>
+			</div>
+</body>

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=390&r1=389&r2=390
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Wed Feb 28 19:26:51 2007
@@ -27,6 +27,31 @@
 var sortbynames = false;
 var dragdata = new Object;
 var asterisk_guiTDPrefix = "DID_";
+
+
+function gui_alert( msgtype, msg ){
+		// Alternative to javascript's alert box - the native alert boxes are stopping the background XHRs
+		//  usage - msgtype could be 1 or 2 or 3 , msg is the alert message
+		top.alertframename = "alertiframe";
+		top.alertmsg = msg ;
+		top.alertmsgtype = msgtype ;
+        var h= top.document.createElement("IFRAME");
+		h.setAttribute("id", top.alertframename );
+		h.setAttribute("ALLOWTRANSPARENCY", "true");
+		h.style.position="absolute";
+		h.style.left= 0;
+		h.style.top= 0;
+		h.style.width= '100%';
+		h.style.height= '100%';
+		h.style.zIndex = 9999 ;
+		h.src = "guialert.html" ;
+		h.frameBorder="0";
+		h.scrolling="no";
+		h.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=90)';
+		//h.style.MozOpacity = .90;
+		top.document.body.appendChild(h);
+}
+
 
 // Douglas Crockford's purge function for IE Memory leaks
 // http://javascript.crockford.com/memory/leak.html

Modified: trunk/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/users.html?view=diff&rev=390&r1=389&r2=390
==============================================================================
--- trunk/config/users.html (original)
+++ trunk/config/users.html Wed Feb 28 19:26:51 2007
@@ -131,8 +131,7 @@
 		}
 		// check whether the length of extension is valid
 		if( localextenlength !=0 && (allow_an_extns == "no" && localextenlength !=  $('name').value.length) ){
-				alert("Sorry, User Extension must be  "+ localextenlength  + " digits !");
-				$('name').focus();
+				gui_alert( 1, "Sorry, User Extension must be "+ localextenlength  + " digits !" );
 				return false;
 		}
 		if (!check_patternonfields( ['name', 'fullname', 'secret','email', 'cid_number'] ) ){



More information about the asterisk-gui-commits mailing list