pari: trunk r266 - in /trunk/config: ./ setup/

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Wed Jan 17 11:50:45 MST 2007


Author: pari
Date: Wed Jan 17 12:50:44 2007
New Revision: 266

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=266
Log:
if the localextenlength is changed the userbase will automatically be recalculated

Modified:
    trunk/config/localexts.html
    trunk/config/setup/1.html
    trunk/config/setup/3.html
    trunk/config/setup/6.html
    trunk/config/voicemail.html

Modified: trunk/config/localexts.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/localexts.html?view=diff&rev=266&r1=265&r2=266
==============================================================================
--- trunk/config/localexts.html (original)
+++ trunk/config/localexts.html Wed Jan 17 12:50:44 2007
@@ -85,8 +85,24 @@
 				widgets[fieldnames[x]] = $(fieldnames[x]);
 				widgets[fieldnames[x]].disabled = true;
 			}
+			$('localextenlength').addEventListener("change", update_spae, false);
 			parent.astmanEngine.config2list("users.conf", $('devices'),widgets, usercallbacks);
 }
+
+
+function update_spae(){
+		if(	$('localextenlength').value == $('userbase').value.length ) return;
+		if(	$('localextenlength').value < $('userbase').value.length ){
+				$('userbase').value = $('userbase').value.substr(0,$('localextenlength').value);
+				return;
+		}
+		if(	$('localextenlength').value > $('userbase').value.length ){
+				while ( $('localextenlength').value != $('userbase').value.length  ){
+					$('userbase').value = $('userbase').value + "0" ; 
+				}
+		}
+}
+
 </script>
 <body id="foo" onload="localajaxinit()" bgcolor="EFEFEF">
 <div class="mainscreenTitleBar"><span style="margin-left: 4px;font-weight:bold">Admin Options - Local Extension Settings</span></div>
@@ -104,8 +120,7 @@
 					<select id="devices" style="display:none"></select> 
 					<p class="field_text">	Local Extensions are <select id="localextenlength"><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select> digits long&nbsp;</p>
 					<p class="field_text">	Starting point of Allocation of extensions : <input type=text id="userbase" size=5>	</p>
-					<p class="field_text"> <input type=checkbox id="disallow_aliasextns"> Donot Allow analog phones assigned to multiple extensions</p>
-
+					<p class="field_text"> <input type=checkbox id="disallow_aliasextns"> Do not allow analog phones assigned to multiple extensions</p>
 					<center>
 							<div style="height:15px" id='status'></div><BR>
 							<input type=button id="save" value="Save">

Modified: trunk/config/setup/1.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/setup/1.html?view=diff&rev=266&r1=265&r2=266
==============================================================================
--- trunk/config/setup/1.html (original)
+++ trunk/config/setup/1.html Wed Jan 17 12:50:44 2007
@@ -37,6 +37,7 @@
 		if ( originalRequest.responseText.match("Error") ) {
 			// User is not logged in , show him the login screen
 			$('loginform').style.display = "block";
+			$('username').focus();
 			return true;
 		}
 		if ( originalRequest.responseText.match("Pong") ) {
@@ -186,6 +187,14 @@
 		};
 		opt.parameters="action=login&reload=yes&username="+ $('username').value + "&secret=" + $('secret').value ;
 		var tmp = new Ajax.Request(rawman_url , opt);
+}
+
+
+function submitOnEnter(e){ 
+		if(e.keyCode == 13){ 
+			login();
+			return false;
+		}
 }
 
 //-->
@@ -215,7 +224,7 @@
 										<div class="heading">Pleae enter your admin Username and Password </div>
 										<table align="center">
 													<tr><td>Username:</td>										<td><input id="username"  size=12></td>							</tr>
-													<tr><td>Secret:</td>												<td><input type="password" id="secret" size=12></td>		</tr>
+													<tr><td>Password:</td>												<td><input type="password" id="secret" size=12 onKeyPress="submitOnEnter(event)"></td>		</tr>
 													<tr><td align='center' colspan='2' height=40 valign=bottom>
 																<input type="button" id="login" value="Login" onClick="login()" >
 															</td>

Modified: trunk/config/setup/3.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/setup/3.html?view=diff&rev=266&r1=265&r2=266
==============================================================================
--- trunk/config/setup/3.html (original)
+++ trunk/config/setup/3.html Wed Jan 17 12:50:44 2007
@@ -8,7 +8,7 @@
 <!--
 var rawman_url;
 var usercallbacks = new Object;
-var fieldnames = new Array( 'save','userbase','localextenlength');
+var fieldnames = new Array( 'save','userbase','localextenlength','disallow_aliasextns');
 var widgets = new Array;
 var go = "";
 var nextpage = "4.html";
@@ -35,6 +35,7 @@
 	};
 	rawman_url = parent.rawman_url ;
 	parent.astmanEngine.setURL(rawman_url);
+	$('localextenlength').addEventListener("change", update_spae, false);
 	ping();
 }
 
@@ -109,7 +110,18 @@
 	parent.localextenlength = $('localextenlength').value ;
 }
 
-
+function update_spae(){
+		if(	$('localextenlength').value == $('userbase').value.length ) return;
+		if(	$('localextenlength').value < $('userbase').value.length ){
+				$('userbase').value = $('userbase').value.substr(0,$('localextenlength').value);
+				return;
+		}
+		if(	$('localextenlength').value > $('userbase').value.length ){
+				while ( $('localextenlength').value != $('userbase').value.length  ){
+					$('userbase').value = $('userbase').value + "0" ; 
+				}
+		}
+}
 //-->
 </SCRIPT>
 <BODY bgcolor="#FFFFFF" onload="localinit()" topmargin=0 leftmargin=0 onunload="store_extlength()">
@@ -137,7 +149,8 @@
 					<p class="subheading">	Local Extensions are <select id="localextenlength">
 																	<option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select> digits long&nbsp;
 					</p>
-					<p class="subheading">	Starting point of Allocation of extensions : <input type=text id="userbase" size=5>	</p>
+					<p class="subheading">Starting point of Allocation of extensions : <input type=text id="userbase" size=5>	</p>
+					<p class="subheading"><input type=checkbox id="disallow_aliasextns"> Do not allow analog phones assigned to multiple extensions</p>
 			<!--  this page -->
 			</td>
 		</tr>

Modified: trunk/config/setup/6.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/setup/6.html?view=diff&rev=266&r1=265&r2=266
==============================================================================
--- trunk/config/setup/6.html (original)
+++ trunk/config/setup/6.html Wed Jan 17 12:50:44 2007
@@ -26,9 +26,12 @@
 function localinit(){
 		//parent.$('next').disabled = true;
 		parent.$('next').onclick = function(){	 
+					if ( $('name').value.length==0 ){
+						alert("Looks like a default Voicemail Extension is not yet configured \n\n Please set an \'Extension for Checking messages\'");
+						return false;
+					}
 					if( parent.localextenlength != $('name').value.length ){
-						$('name').focus();
-						alert("The Extension must be " + parent.localextenlength + " digits long" );
+						alert("The Voicemail Extension has to be " + parent.localextenlength + " digits long" );
 						return false;
 					}
 					if( !$('save').disabled ){
@@ -176,7 +179,19 @@
 	$('name').onkeydown = newexten;
 	$('name').disabled = false;
 	if (whichexten.length ==0 ){
-		alert("Looks like a default Voicemail Extension is not yet configured \n\n Please set an \'Extension for Checking messages\'  and \n click on 'save' button");
+		alert("Looks like a default Voicemail Extension is not yet configured \n\n Please set an \'Extension for Checking messages\'");
+	}else{
+					if( parent.localextenlength != $('name').value.length ){
+							if(	parent.localextenlength < $('name').value.length ){
+									$('name').value = $('name').value.substr(0,parent.localextenlength);
+									$('save').disabled = false;
+							}else if(	parent.localextenlength > $('name').value.length ){
+									while ( parent.localextenlength != $('name').value.length  ){
+										$('name').value = $('name').value + "0" ; 
+										$('save').disabled = false;
+									}
+							}
+					}
 	}
 }
 

Modified: trunk/config/voicemail.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/voicemail.html?view=diff&rev=266&r1=265&r2=266
==============================================================================
--- trunk/config/voicemail.html (original)
+++ trunk/config/voicemail.html Wed Jan 17 12:50:44 2007
@@ -202,6 +202,18 @@
 		$('name').value = vmexten ; 
 	}
 
+	voicemailcallbacks.beforeSaving = function(){
+		// check whether the length of extension is valid
+		if( localextenlength !=  $('name').value.length){
+				alert("Sorry, An Extension must be  "+ localextenlength  + " digits !");
+				$('name').focus();
+				return false;
+		}
+		if (!check_patternonfields( ['name', 'maxgreet'] ) ){
+			return false;
+		}
+		return true;
+	}
 
 	voicemailcallbacks.savechanges = function() {
 		if (vmexten != $('name').value) {



More information about the asterisk-gui-commits mailing list