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

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Fri Dec 1 10:58:59 MST 2006


Author: pari
Date: Fri Dec  1 11:58:58 2006
New Revision: 141

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=141
Log:
New Feature: Local Extensions are x digits long and start from xxxx

Modified:
    trunk/config/meetme.html
    trunk/config/menus.html
    trunk/config/options.html
    trunk/config/queues.html
    trunk/config/scripts/astman.js
    trunk/config/users.html
    trunk/config/voicemail.html

Modified: trunk/config/meetme.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/meetme.html?view=diff&rev=141&r1=140&r2=141
==============================================================================
--- trunk/config/meetme.html (original)
+++ trunk/config/meetme.html Fri Dec  1 11:58:58 2006
@@ -34,6 +34,7 @@
 	var meetmes;
 	var callbacks = new Object;
 	var usercallbacks = new Object;
+	var localextenlength;
 	var fieldnames = new Array(
 				'name', 'delete', 'status', 'newitem', 
 				'music','menu', 'announce',
@@ -189,12 +190,27 @@
 		}
 		return tmp;
 	}
+	callbacks.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;
+		}
+		return true;
+	}
 	callbacks.identifier = "extension";
 	callbacks.eachline = true;
 	
 	usercallbacks.format = function(t) {
-		if ((t.name == 'general'))
+		if ((t.name == 'general')){
+			if (t.fieldbyname['localextenlength'] && t.fieldbyname['localextenlength'].length){
+				localextenlength =  t.fieldbyname['localextenlength'] ;
+			}else{
+				localextenlength = 4;
+			}
 			return null;
+		}
 		if (t.name.substring(0,6) == 'trunk_')
 			return null;
 		if (t.fieldbyname['fullname'] && t.fieldbyname['fullname'].length) {

Modified: trunk/config/menus.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/menus.html?view=diff&rev=141&r1=140&r2=141
==============================================================================
--- trunk/config/menus.html (original)
+++ trunk/config/menus.html Fri Dec  1 11:58:58 2006
@@ -39,7 +39,7 @@
 	var keys = new Array('0','1','2','3','4','5','6','7','8','9','*','#','t','i');
 	var extensions_array = new Array;
 	var answer_call_string = "s,1,Answer";
-
+	var localextenlength ;
 
 function format_step(this_step){
 	var temp = this_step.split(',');
@@ -371,6 +371,13 @@
 
 
 function save_vmenu(){
+
+	if( $('alias_exten').value.length > 0 && localextenlength !=  $('alias_exten').value.length){
+			alert("Sorry, An Extension must be  "+ localextenlength  + " digits !");
+			$('alias_exten').focus();
+			return false;
+	}
+
 	$('status_message').style.display="block";
 	var opt = {
 			method: 'get',
@@ -968,8 +975,14 @@
 
 // user callbacks
 usercallbacks.format = function (t,x){
-		if ((t.name == 'general'))
+		if ((t.name == 'general')){
+			if (t.fieldbyname['localextenlength'] && t.fieldbyname['localextenlength'].length){
+				localextenlength =  t.fieldbyname['localextenlength'] ;
+			}else{
+				localextenlength =  4 ;
+			}
 			return null;
+		}
 		if (t.name.substring(0,6) == 'trunk_')
 			return null;
 		else

Modified: trunk/config/options.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/options.html?view=diff&rev=141&r1=140&r2=141
==============================================================================
--- trunk/config/options.html (original)
+++ trunk/config/options.html Fri Dec  1 11:58:58 2006
@@ -249,6 +249,10 @@
 			</td>
 	</tr>
 	<tr valign="top" height="18">	<td></td></tr>
+	<tr valign="top" height="18">	<td align="center"><A href="localexts.html">Local Extension settings</A></td></tr>
+		<tr valign="top" height="18">	<td></td></tr>
+
+
 <!-- 	<tr valign="top" height="18">	<td align="center"><A href="#" onclick="tosetup();">Run Setup Wizard</A></td>
 	</tr>
 	<tr valign="top" height="18">	<td></td></tr> -->
@@ -258,7 +262,7 @@
 					<TR><TD colspan=2 align=center><B>GUI - access settings: </B></TD></TR>
 					<tr>	<td colspan=2 height=5></td></tr>
 									<tr  onmouseover="show_tooltip('en', 'options', 3);">
-													<td class="field_text">Bind Address:</td>		<td><input size=14 id='bindaddr' dfalt="127.0.0.1" onkeydown="$('save').disabled=false; $('cancel').disabled=false;"  class="input8"></td>
+											<td class="field_text">Bind Address:</td>		<td><input size=14 id='bindaddr' dfalt="127.0.0.1" onkeydown="$('save').disabled=false; $('cancel').disabled=false;"  class="input8"></td>
 									</tr>
 									<tr  onmouseover="show_tooltip('en', 'options', 4);"><td class="field_text">Port:</td>						<td><input size=14 id='bindport' dfalt=80  onkeydown="$('save').disabled=false; $('cancel').disabled=false;"  class="input8"></td></tr>
 									<tr  onmouseover="show_tooltip('en', 'options', 5);"><td class="field_text">HTTP Timeout:</td>	<td><input size=14 id='httptimeout'  onkeydown="$('save').disabled=false; $('cancel').disabled=false;"  class="input8"></td></tr>

Modified: trunk/config/queues.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/queues.html?view=diff&rev=141&r1=140&r2=141
==============================================================================
--- trunk/config/queues.html (original)
+++ trunk/config/queues.html Fri Dec  1 11:58:58 2006
@@ -39,6 +39,7 @@
 var k =0;
 var j = -1; 
 var extensions_conf_qs = new Array;
+var localextenlength ;
 
 function togglefeatures() {
 	if (adstatus == "shown") {
@@ -156,6 +157,11 @@
 				$('fullname').focus();
 				return;
 		}
+		if( localextenlength !=  $('name').value.length){
+				alert("Sorry, An Extension must be  "+ localextenlength  + " digits !");
+				$('name').focus();
+				return ;
+		}
 
 		$('status_message').style.display="block";
 		p = 0;
@@ -256,8 +262,10 @@
 callbacks.identifier = "extension";
 callbacks.postselect = function (){	 }
 callbacks.format = function (t,x){
-		if ((t.name == 'general'))
+		if ((t.name == 'general')){
+			if ( t.fieldbyname['localextenlength'] && t.fieldbyname['localextenlength'].length){ localextenlength =  t.fieldbyname['localextenlength'] ; }
 			return null;
+		}
 		if (t.name.substring(0,6) == 'trunk_')
 			return null;
 		if (t.fieldbyname['fullname'] && t.fieldbyname['fullname'].length) {

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=141&r1=140&r2=141
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Fri Dec  1 11:58:58 2006
@@ -23,6 +23,17 @@
  var asterisk_guitools = "asterisk_guitools";
  var asterisk_guitoolsversion = "0.7";
  var asterisk_guiversion = "0.7.140";
+
+function check_patternonfields(fields){
+	// for checking validity of field contents before form submitting 
+	for (var i=0; i < fields.length; i++){
+			x = document.getElementById(fields[i]);
+			if( x.getAttribute('pattern') && !check_pattern(x.getAttribute('pattern') , x.value)   ){
+						alert("Invalid Characters in "+ fields[i]);
+						return false;
+			}
+	}
+}
 
 function showdiv_statusmessage(){
 		document.write ("<div ID=\"status_message\"  STYLE=\"display:none; position: absolute; left: 170; top: 190; width:350; height:115;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid;\">");

Modified: trunk/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/users.html?view=diff&rev=141&r1=140&r2=141
==============================================================================
--- trunk/config/users.html (original)
+++ trunk/config/users.html Fri Dec  1 11:58:58 2006
@@ -34,6 +34,7 @@
 	var extencallbacks = new Object;
 	var numcallbacks = new Object;
 	var fieldnames = new Array( 'delete', 'status', 'new', 'save', 'cancel','name','fullname','secret','email','cid_number','zapchan','context', 'hasvoicemail','hasdirectory','hassip','hasiax','hasmanager','callwaiting','threewaycalling','mailbox','hasagent','group','host');
+	var localextenlength;
 
 	extencallbacks.format = function(t, x) {
 		if ((t.name != specialcontext))
@@ -49,8 +50,14 @@
 	extencallbacks.eachline = true;
 
 	callbacks.format = function(t) {
-		if ((t.name == 'general'))
-			return null;
+		if ((t.name == 'general')){
+			if (t.fieldbyname['localextenlength'] && t.fieldbyname['localextenlength'].length){
+				localextenlength =  t.fieldbyname['localextenlength'] ;
+			}else{
+				localextenlength = 4;
+			}
+			return null;
+		}
 		if (t.name.substring(0,6) == 'trunk_')
 			return null;
 		if (t.fieldbyname['fullname'] && t.fieldbyname['fullname'].length) {
@@ -85,13 +92,20 @@
 		return tmp;
 	}
 	callbacks.identifier = "extension";
+
 	callbacks.beforeSaving = function(){
+		//check_patternonfields(fieldnames);
 		if(!$('fullname').value.length){
 				alert("Sorry, a User Name must be specified !");
 				$('fullname').focus();
 				return false;
 		}
-
+		// check whether the length of extension is valid
+		if( localextenlength !=  $('name').value.length){
+				alert("Sorry, User Extension must be  "+ localextenlength  + " digits !");
+				$('name').focus();
+				return false;
+		}
 		return true;
 	}
 

Modified: trunk/config/voicemail.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/voicemail.html?view=diff&rev=141&r1=140&r2=141
==============================================================================
--- trunk/config/voicemail.html (original)
+++ trunk/config/voicemail.html Fri Dec  1 11:58:58 2006
@@ -36,6 +36,7 @@
 	var callbacks = new Object;
 	var usercallbacks = new Object;
 	var voicemailcallbacks = new Object;
+	var localextenlength;
 	var vmfields = new Array('status', 'save', 'cancel','attach','maxmsg','minmessage','maxmessage','saycid','sayduration', 'emailonly','review','attachfmt','maxgreet','operator','envelope');
 
 
@@ -58,7 +59,17 @@
 			return null;
 		return format_extension($('extensions'), t, x);
 	}
-	
+
+	callbacks.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;
+		}
+		return true;
+	}
+
 	callbacks.loaded = function() {
 		var whichexten = "";
 		merge_users($('extensions'), $('hiddenusers'));
@@ -151,8 +162,14 @@
 	callbacks.usesubfields = true;
 	
 	usercallbacks.format = function(t) {
-		if ((t.name == 'general'))
+		if ((t.name == 'general')){
+			if (t.fieldbyname['localextenlength'] && t.fieldbyname['localextenlength'].length){
+				localextenlength =  t.fieldbyname['localextenlength'] ;
+			}else{
+				localextenlength = 4;
+			}
 			return null;
+		}
 		if (t.name.substring(0,6) == 'trunk_')
 			return null;
 		if (t.fieldbyname['fullname'] && t.fieldbyname['fullname'].length) {



More information about the asterisk-gui-commits mailing list