pari: trunk r51 - /trunk/config/menus.html

asterisk-gui-commits at lists.digium.internal asterisk-gui-commits at lists.digium.internal
Thu Oct 5 16:03:14 CDT 2006


Author: pari
Date: Thu Oct  5 16:03:13 2006
New Revision: 51

URL: http://svn.digium.com/view/asterisk-gui?rev=51&view=rev
Log:
'Allow Dial Extensions' in voicemenus

Modified:
    trunk/config/menus.html

Modified: trunk/config/menus.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/menus.html?rev=51&r1=50&r2=51&view=diff
==============================================================================
--- trunk/config/menus.html (original)
+++ trunk/config/menus.html Thu Oct  5 16:03:13 2006
@@ -31,6 +31,7 @@
 	var menuscallbacks = new Object;
 	var extencallbacks = new Object;
 	var usercallbacks = new Object;
+	var numcallbacks = new Object;
 	var fieldnames = new Array('delete', 'status', 'new','save','cancel');
 	var voicemenusdata = new Object;
 	var current_context;
@@ -318,6 +319,8 @@
 			var current_vmenu = next_freevmenu();
 			uri += build_action('newcat', p, current_vmenu,"", ""); p = p+1;
 			uri += build_action('append', p, current_vmenu,"comment", $('comment').value); p = p+1;
+			if( $('allowexten').checked && $('context').value )
+				uri += build_action('append', p, current_vmenu,"include", $('context').value ); p = p+1;
 			uri += build_action('append', p, current_vmenu,"exten", answer_call_string); p = p+1;
 	}else{
 			// Updating existing Voicemenu
@@ -325,6 +328,20 @@
 			if(  voicemenusdata[current_vmenu].comment != $('comment').value ){
 					uri += build_action('update', p, current_vmenu ,"comment", $('comment').value ); p = p+1;
 			}
+			
+			if( typeof  $('vmenus').stored_config.catbyname[current_vmenu].fieldbyname['include'] == "string" && $('vmenus').stored_config.catbyname[current_vmenu].fieldbyname['include']!="" ){
+					if( $('allowexten').checked &&  $('context').value != $('vmenus').stored_config.catbyname[current_vmenu].fieldbyname['include']   &&  $('context').value ) {
+						uri += build_action('update', p, current_vmenu ,"include", $('context').value ); p = p+1;
+						$('vmenus').stored_config.catbyname[current_vmenu].fieldbyname['include'] = $('context').value ;
+					}else if ( ! $('allowexten').checked ){
+						uri += build_action('delete', p, current_vmenu ,"include",""); p = p+1;
+						$('vmenus').stored_config.catbyname[current_vmenu].fieldbyname['include'] = "" ;
+					}
+			}else if( $('allowexten').checked &&  $('context').value != $('vmenus').stored_config.catbyname[current_vmenu].fieldbyname['include']   &&  $('context').value ){
+						uri += build_action('append', p, current_vmenu ,"include", $('context').value ); p = p+1;
+						$('vmenus').stored_config.catbyname[current_vmenu].fieldbyname['include'] = $('context').value ;
+			}
+
 			for (var k=0; k< keys.length; k++){
 				if(voicemenusdata[current_vmenu].extensions[keys[k]]){
 					uri += build_action('delete', p, current_vmenu,"exten", "", voicemenusdata[current_vmenu].extensions[keys[k]][0] ); p = p+1;
@@ -521,6 +538,20 @@
 	current_context = $('vmenus').value;
 	var x, y, tmp;
 	var priority_1, priority_2, buffer;
+	
+	$('context').options[ $('context').length - 1 ].selected = true;
+	$('context').style.display="none";
+	$('allowexten').checked = false;
+
+	if ( typeof  $('vmenus').stored_config.catbyname[current_context].fieldbyname['include'] == "string"){
+		for(y=0; y< $('context').length ; y++ ){
+				if( $('context').options[y].value == $('vmenus').stored_config.catbyname[current_context].fieldbyname['include']){
+					$('context').options[y].selected = true;
+					$('context').style.display="";
+					$('allowexten').checked = true;
+				}
+		}
+	}
 
 	//$('keypressoptions').innerHTML = "";
 	$('steps').options.length =0;
@@ -657,9 +688,25 @@
 				load_extensions(current_key_exts);
 				load_menus(current_key_menus);
 			}
-			
-}
-
+
+			parent.astmanEngine.config2list("extensions.conf", $('context'), new Array(), numcallbacks);	
+}
+
+numcallbacks.format = function(t) {
+		if ((t.name.substr(0,11) != 'numberplan-'))
+			return null;
+		if (t.fieldbyname['comment'])
+			return t.fieldbyname['comment'];
+		return t.name;
+}
+
+numcallbacks.loaded = function(){
+		var newoption = document.createElement("option");
+			newoption.text = " - - ";
+			newoption.value = "";
+		$('context').options.add ( newoption );
+		$('context').options[ $('context').length - 1 ].selected = true;
+}
 
 
 menuscallbacks.identifier = "extension";
@@ -1050,7 +1097,10 @@
 								</td>
 						</tr>
 						
-						<tr><td colspan=2>&nbsp;<input type=checkbox id=allowexten disabled> Allow dialing Extensions ?</td></tr>
+						<tr><td colspan=2>&nbsp;<input type=checkbox id=allowexten disabled onchange=" $('context').style.display = ($('context').style.display=='none') ? '': 'none'; "> Allow dialing Extensions ?&nbsp;
+									<select size='1' id='context' style='width:120px; display: none'></select>
+								</td>
+						</tr>
 
 						<tr><td colspan=2 height=15></td></tr>
 						<tr><td colspan=2>'Keypress' Events</td></tr>



More information about the asterisk-gui-commits mailing list