pari: trunk r286 - in /trunk/config: numberplan.html setup/5.html

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Mon Jan 22 18:03:54 MST 2007


Author: pari
Date: Mon Jan 22 19:03:54 2007
New Revision: 286

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=286
Log:
Field validations for outbound calling Rules

Modified:
    trunk/config/numberplan.html
    trunk/config/setup/5.html

Modified: trunk/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/numberplan.html?view=diff&rev=286&r1=285&r2=286
==============================================================================
--- trunk/config/numberplan.html (original)
+++ trunk/config/numberplan.html Mon Jan 22 19:03:54 2007
@@ -409,6 +409,7 @@
 
 
 function saverule(){
+	if ( !checkfields() ) return false;
 	 if(isnewrule){ // add this rule to the default plan and reload the page
 					var newpriority=1;
 					if( typeof default_np_data[$('pattern').value] !="undefined" ){
@@ -449,6 +450,29 @@
 function localajaxinit(){
 	$('message_text').innerHTML ="Saving Changes...";
 	parent.astmanEngine.config2list("users.conf", $('trunks'), new Array(), trunkcallbacks);
+}
+
+function checkfields(){
+	if( $('rulename').value.length == 0 ){
+		alert("Please enter a Rule Name");
+		$('rulename').focus();
+		return false;
+	}
+	if($('trunks').selectedIndex == -1){
+		alert("Please select a service provider to place this call through");
+		return false;
+	}
+	if($('define_advanced').style.display=="none" && $('beginswith').value.length==0 ){
+		alert("Please Enter the beginning pattern of the number");
+		$('beginswith').focus();
+		return false;
+	}
+	if($('define_usual').style.display=="none" && $('pattern').value.length == 0 ){
+		alert("Please Enter a custom pattern");
+		$('pattern').focus();
+		return false;
+	}
+return true;
 }
 </script>
 <body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF">

Modified: trunk/config/setup/5.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/setup/5.html?view=diff&rev=286&r1=285&r2=286
==============================================================================
--- trunk/config/setup/5.html (original)
+++ trunk/config/setup/5.html Mon Jan 22 19:03:54 2007
@@ -416,6 +416,7 @@
 
 
 function saverule(){
+	if ( !checkfields() ) return false;
 	 if(isnewrule){ // add this rule to the default plan and reload the page
 					var newpriority=1;
 					if( typeof default_np_data[$('pattern').value] !="undefined" ){
@@ -453,6 +454,28 @@
 	$('pattern').value = pattern;
 }
 
+function checkfields(){
+	if( $('rulename').value.length == 0 ){
+		alert("Please enter a Rule Name");
+		$('rulename').focus();
+		return false;
+	}
+	if($('trunks').selectedIndex == -1){
+		alert("Please select a service provider to place this call through");
+		return false;
+	}
+	if($('define_advanced').style.display=="none" && $('beginswith').value.length==0 ){
+		alert("Please Enter the beginning pattern of the number");
+		$('beginswith').focus();
+		return false;
+	}
+	if($('define_usual').style.display=="none" && $('pattern').value.length == 0 ){
+		alert("Please Enter a custom pattern");
+		$('pattern').focus();
+		return false;
+	}
+return true;
+}
 //-->
 </SCRIPT>
 <BODY bgcolor="#FFFFFF" onload="localinit()" topmargin=0 leftmargin=0>



More information about the asterisk-gui-commits mailing list