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

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Fri Nov 10 16:36:15 MST 2006


Author: pari
Date: Fri Nov 10 17:36:14 2006
New Revision: 126

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=126
Log:
Fixed Lots of issues in 'Calling Rules' page 

Modified:
    trunk/config/numberplan.html
    trunk/config/scripts/astman.js
    trunk/config/voicemail.html

Modified: trunk/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/numberplan.html?view=diff&rev=126&r1=125&r2=126
==============================================================================
--- trunk/config/numberplan.html (original)
+++ trunk/config/numberplan.html Fri Nov 10 17:36:14 2006
@@ -186,54 +186,64 @@
 	}
 
 	callbacks.postselect = function(box, val) {
-	// called "ON page load" and when the  extensions select box is clicked
-		var tmp;
-		tmp = val.split(']');
-		$('combobox_div').style.display = "none";
-
-		if (tmp.length > 1) {
-				/* Found an entry */
-				// Clicked on a SubMenu
-				$('priup').disabled = !matches(box, tmp[0], tmp[1], box.selectedIndex - 1)
-				$('pridown').disabled = !matches(box, tmp[0], tmp[1], box.selectedIndex + 1);
-				$('planident').disabled = true;
-				$('trunk').disabled = false;
-				$('planident').value =  '';
-				$('include').disabled = true;
-				$('comment').disabled = true;
-				$('newitem').disabled=true; // "Add new Pattern" is disabled
-		} else {
-				// Clicked a MainMenu - The blue ones
-				$('priup').disabled = true;
-				$('pridown').disabled = true;
-				$('trunk').disabled = true;
-				$('planident').value = $('name').value.substr(11);
-				$('name').disabled = true;
-				$('newitem').disabled=false; // "Add new Pattern" is Enabled
-				if ($('modplan').checked) {
-					$('planident').disabled = false;
-					$('comment').disabled = false;
-					$('include').disabled = false;
-					$('delete').disabled=false;
-					$('save').disabled=false;
-				}else{
-					$('delete').disabled=true;
-					$('save').disabled=true;
-					$('planident').disabled = true;
-					$('comment').disabled = true;
-					$('include').disabled = true;
+		callbacks_postselect(box, val);
+	}
+
+	function callbacks_postselect(box, val){
+			// called "ON page load" and when the  extensions select box is clicked
+				var tmp;
+				tmp = val.split(']');
+				$('combobox_div').style.display = "none";
+				$('advancedi').style.display = "" ;
+
+				if (tmp.length > 1) {
+						/* Found an entry */
+						// Clicked on a SubMenu
+						$('priup').disabled = !matches(box, tmp[0], tmp[1], box.selectedIndex - 1)
+						$('pridown').disabled = !matches(box, tmp[0], tmp[1], box.selectedIndex + 1);
+						$('planident').disabled = true;
+						$('trunk').disabled = false;
+						$('planident').value =  '';
+						$('include').disabled = true;
+						$('comment').disabled = true;
+						$('newitem').disabled=true; // "Add new Pattern" is disabled
+						$('advancedi').style.display = "none" ;
+							// Hide the Advanced Panel
+							adstatus = "hidden";
+							new Rico.Effect.Size('advancedw', null, 1, 120, 8, {complete:function() { $('advancedw').style.height=1;} } );
+
+				} else {
+						// Clicked a MainMenu - The blue ones
+						$('priup').disabled = true;
+						$('pridown').disabled = true;
+						$('trunk').disabled = true;
+						$('planident').value = $('name').value.substr(11);
+						$('name').disabled = true;
+						$('newitem').disabled=false; // "Add new Pattern" is Enabled
+
+						if ($('modplan').checked) {
+							$('planident').disabled = false;
+							$('comment').disabled = false;
+							$('include').disabled = false;
+							$('delete').disabled=false;
+							$('save').disabled=true;
+						}else{
+							$('delete').disabled=true;
+							$('save').disabled=true;
+							$('planident').disabled = true;
+							$('comment').disabled = true;
+							$('include').disabled = true;
+						}
 				}
-		}
-		$('new').disabled = !$('modplan').checked;
-		$('priority').disabled = true;
-		$('realpriority').disabled = true;
-	}
-
-
+				$('new').disabled = !$('modplan').checked;
+				$('priority').disabled = true;
+				$('realpriority').disabled = true;
+	}
 
 
 	function updateplandel() {
 	// called "onpage load" and when the  'Customize Plans' checkbox  is  flipped
+
 		var tmp;
 		var x;
 		for (x=0;x<$('extensions').options.length;x++) {
@@ -255,10 +265,8 @@
 
 	callbacks.savechanges = function() {
 	// called when a New Plan or new Pattern is added
+		callbacks_postselect($('extensions'), $('extensions').value  );
 		updateplandel();
-		//$('new').disabled=true;
-		$('newitem').disabled=true;
-		return false;
 	}
 
 
@@ -268,6 +276,7 @@
 		updateplandel();
 		parent.loadscreen(this);
 		$('newitem').disabled=true;
+		$('combosel').addEventListener('click', function(){	$('save').disabled = false; $('cancel').disabled = false; }, false);
 	}
 
 	
@@ -284,11 +293,17 @@
 		var gen;
 		tmp['name'] = $('combosel').options[0].value;
 		numplan = $('extensions').value ;
+							// Hide the Advanced Panel
+							adstatus = "hidden";
+							new Rico.Effect.Size('advancedw', null, 1, 120, 8, {complete:function() { $('advancedw').style.height=1;} } );
+							$('advancedi').style.display = "none" ;
+
 		return new Array(numplan, 'exten', tmp);
 	}
 	
 	
 	callbacks.newcategory = function() {
+		
 		var tmp = null;
 		var x;
 		if ($('extensions').stored_config.catbyname['general'])
@@ -301,6 +316,7 @@
 			tmp.fieldbyname['planident'] = 'custom-' + x;
 			tmp.fieldbyname['include'] = 'default';
 		}
+
 		return tmp;
 	}
 	

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=126&r1=125&r2=126
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Fri Nov 10 17:36:14 2006
@@ -50,60 +50,61 @@
 		combo_selectdiv.style.left = "0px";
 //		combo_selectdiv.style.z-index = 10000;
 		combo_selectdiv.style.display = "none";
-		combo_text.onkeychange = function(){
-			combobox_activate();
-		};
-		combo_text.onfocus = function(){
-			combobox_activate();
-		};
-		combo_text.onfocusout = function(){
-			combo_selectdiv.style.display ='none';
-		};
-		combo_text.onkeypress = function(event){
-				if( event.keyCode == ENTER || event.keyCode == ESC || event.keyCode == TAB){
-						combo_selectdiv.style.display = "none";
+
+		combo_text.addEventListener('keychange',combobox_activate,false);
+		combo_text.addEventListener('focus',combobox_activate,false);
+		combo_text.addEventListener('focusout', function(){ combo_selectdiv.style.display ='none'; } ,false);
+		combo_text.addEventListener('keypress',  function(event){
+							if( event.keyCode == ENTER || event.keyCode == ESC || event.keyCode == TAB){
+									combo_selectdiv.style.display = "none";
+									return false;
+							}else if( event.keyCode == KEYDN ||  event.keyCode == KEYUP ){
+									combo_selectbox.focus();
+									return false;
+							}else if( event.keyCode == BKSPACE && combo_text.value.length ==0 ){
+									combo_selectdiv.style.display = "none";
+									return false;
+							}else{
+									combo_selectdiv.style.display = "";
+									return true;
+							}
+				}, false);
+		combo_text.addEventListener('keyup', function(event){
+						if( event.keyCode == ENTER || event.keyCode == ESC || event.keyCode == TAB){
 						return false;
-				}else if( event.keyCode == KEYDN ||  event.keyCode == KEYUP ){
-						combo_selectbox.focus();
-						return false;
-				}else if( event.keyCode == BKSPACE && combo_text.value.length ==0 ){
-						combo_selectdiv.style.display = "none";
-						return false;
-				}else{
-						combo_selectdiv.style.display = "";
-						return true;
-				}
-		};
-		combo_text.onkeyup = function(event){
-				if( event.keyCode == ENTER || event.keyCode == ESC || event.keyCode == TAB){
-				return false;
-				}
-				for (var i=0; i < combo_selectbox.options.length; i++){
-						if(	combo_selectbox.options[i].value.toLowerCase().match(combo_text.value.toLowerCase()) ){
-							combo_selectbox.selectedIndex = i;
+						}
+						for (var i=0; i < combo_selectbox.options.length; i++){
+								if(	combo_selectbox.options[i].value.toLowerCase().match(combo_text.value.toLowerCase()) ){
+									combo_selectbox.selectedIndex = i;
+									return true;
+								}
+						}
+						combo_selectdiv.style.display = "none";				
+				},false);
+
+
+
+		combo_selectbox.addEventListener('keypress', function(event) {
+					if( event.keyCode == ENTER ){
+							combo_text.value = combo_selectbox.value;
+							combo_text.focus();
+							combo_selectdiv.style.display = "none";
+							return false;
+					}else if( event.keyCode == ESC ){
+							combo_text.focus();
+							combo_selectdiv.style.display = "none";
+					}else{
 							return true;
-						}
-				}
-				combo_selectdiv.style.display = "none";				
-		};
-		combo_selectbox.onkeypress= function(event) {
-				if( event.keyCode == ENTER ){
+					}
+			},false);
+
+
+		combo_selectbox.addEventListener('click', function(event) {
 						combo_text.value = combo_selectbox.value;
 						combo_text.focus();
 						combo_selectdiv.style.display = "none";
-						return false;
-				}else if( event.keyCode == ESC ){
-						combo_text.focus();
-						combo_selectdiv.style.display = "none";
-				}else{
-						return true;
-				}
-		};
-		combo_selectbox.onclick= function() {
-					combo_text.value = combo_selectbox.value;
-					combo_text.focus();
-					combo_selectdiv.style.display = "none";
-		};
+			},false);
+
 		function combobox_activate(){
 				var tmp_left = combo_text.offsetLeft;
 				var tmp_top = combo_text.offsetTop + combo_text.offsetHeight;
@@ -283,14 +284,23 @@
 			box.oldselect = -1;
 			box.stored_config.catbyname[tmp[0]].subfields.splice(tmp[1], 1);
 			box.stored_config.catbyname[tmp[0]].names.splice(tmp[1], 1);
+			try{
 			box.stored_config.catbyname[tmp[0]].values.splice(tmp[1], 1);
+			}
+			catch(err){
+			
+			}
 		} else if (box.options[box.oldselect].value == "") {
 			box.remove(box.oldselect);
 			box.oldselect = -1;
 			box.stored_config.catbyname[""] = null;
 			box.stored_config.categories[--box.stored_config.catcnt] = null;
-		}
-	}
+		} else if (box.options[box.oldselect].text == "New Entry") {
+			box.remove(box.oldselect);
+			box.oldselect = -1;
+		}
+	}
+
 	if (tmp.length > 1) {
 		category = box.stored_config.catbyname[tmp[0]].subfields[tmp[1]];
 	} else {
@@ -333,8 +343,10 @@
 	var tmp = box.options[box.selectedIndex].value.split(']');
 	if (tmp.length > 1) {
 		if (box.stored_config.catbyname[tmp[0]].subfields[tmp[1]].name.length < 1) {
-			if (select_item(box,"Discard new entry?") && box.widgets['status'])
+			if (select_item(box,"Discard new entry?") && box.widgets['status']){
 				box.widgets['status'].innerHTML = "<i>New entry cancelled!</i>";
+				box.selectedIndex = -1;
+			}
 		} else {
 			if (select_item(box) && box.widgets['status'])
 				box.widgets['status'].innerHTML = "<i>Changes cancelled!</i>";
@@ -343,6 +355,7 @@
 		if (box.options[box.selectedIndex].value == "") {
 			if (select_item(box,"Discard new entry?") && box.widgets['status']){
 					box.widgets['status'].innerHTML = "<i>New entry cancelled!</i>";
+					//box.selectedIndex = -1;
 					if (box.callbacks.cancelnewcategory) 
 							box.callbacks.cancelnewcategory();
 			}
@@ -543,21 +556,27 @@
 	var category = null;
 	var name = null;
 
+	if (box.widgets['save'] && box.widgets['save'].disabled == false){
+			if (!confirm( "Discard changes?")) {
+				box.selectedIndex = box.oldselect;
+				return false;
+			}
+	}
+	if (box.callbacks.newcategory) {
+		category = box.callbacks.newcategory();
+	}
+	if (!category) {
+		category = new Object;
+		category.fieldbyname = new Array;
+		category.fields = new Array;
+	}
+
 	var newoption = document.createElement("option");
 	newoption.text = "New Entry";
 	newoption.value = "";
 	box.options.add(newoption);
 	box.selectedIndex = box.options.length - 1;
 	box.oldselect = box.options.length - 1;
-
-	if (box.callbacks.newcategory) {
-		category = box.callbacks.newcategory();
-	}
-	if (!category) {
-		category = new Object;
-		category.fieldbyname = new Array;
-		category.fields = new Array;
-	}
 	box.stored_config.catbyname[""] = category;
 	box.stored_config.categories[box.stored_config.catcnt++] = category;
 	name = category.name;

Modified: trunk/config/voicemail.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/voicemail.html?view=diff&rev=126&r1=125&r2=126
==============================================================================
--- trunk/config/voicemail.html (original)
+++ trunk/config/voicemail.html Fri Nov 10 17:36:14 2006
@@ -85,7 +85,6 @@
 			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");
 		}
 		parent.loadscreen(this);
-		$('extensions').selectedIndex = -1;
 	}
 	
 	callbacks.fields2val = function() {
@@ -104,7 +103,7 @@
 	}
 	
 	callbacks.postselect = function(box, val) {
-		var fields_to_disable  = new Array(attach, saycid, sayduration, emailonly, maxmsg, maxmessage, minmessage, operator, attachfmt, review, envelope, maxgreet);
+		var fields_to_disable  = new Array('attach', 'saycid', 'sayduration', 'emailonly', 'maxmsg', 'maxmessage', 'minmessage', 'operator', 'attachfmt', 'review', 'envelope', 'maxgreet');
 		parent.$('tooltip').innerHTML = parent.tooltip_default ; 
 		if( box.selectedIndex == -1)
 			return true;
@@ -250,7 +249,7 @@
 										<table cellspacing='0' cellpadding='0'>
 											<tr valign="top"><td>
 																			<table>
-																					<tr onmouseover="show_tooltip('en', 'voicemail', 0);" ><td class="field_text">Extension for checking messages:</td><td>&nbsp;<input size='5' id='name' pattern='^\d*$' class="input8" ></td></tr>
+																					<tr onmouseover="show_tooltip('en', 'voicemail', 0);" ><td class="field_text">Extension for checking messages:</td><td>&nbsp;<input size='5' id='name' pattern='^\d*$' onKeyUp="$('cancel').disabled=false;"  class="input8" ></td></tr>
 																					<tr onmouseover="show_tooltip('en', 'voicemail', 1);" ><td class="field_text">Attach recordings to e-mail:</td><td><input type='checkbox' id='attach'></td></tr>
 																					<tr onmouseover="show_tooltip('en', 'voicemail', 2);" ><td class="field_text">Say message Caller-ID:</td><td><input type='checkbox' id='saycid'></td></tr>
 																					<tr onmouseover="show_tooltip('en', 'voicemail', 3);" ><td class="field_text">Say message duration:</td><td><input type='checkbox' id='sayduration'></td></tr>



More information about the asterisk-gui-commits mailing list