⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menus.html

📁 asterisk 的图形管理界面
💻 HTML
📖 第 1 页 / 共 3 页
字号:
				return false;
			case 'include':
				voicemenusdata[current_context].include=  t.fields[x];
				return false;
			case 'exten':
				exten_fields = t.fields[x].split (',');
				if(!voicemenusdata[current_context].extensions[exten_fields[0]]){
					voicemenusdata[current_context].extensions[exten_fields[0]] = new Array();
				}
				voicemenusdata[current_context].extensions[exten_fields[0]].push( t.fields[x] ) ;
				return false;
			default :
				return false;
		}
		return false;
	}else{
		return false;
	}
}


menuscallbacks.loaded = function(){
	var _vmenus = _$('vmenus') ;
	for (var x=0; x< _vmenus.options.length ; x++ ){
		_vmenus.options[x].text = "VoiceMenu - " + voicemenusdata[_vmenus.options[x].value].comment;
	}
	// Load the menus and extensions into corresponding fields
	for (var y=0;y < keys.length; y++){
		current_key_exts='keypress_'+ keys[y] + '_exts';
		current_key_menus='keypress_'+ keys[y] + '_menus';
		load_extensions(current_key_exts);
		load_menus(current_key_menus);
	}
	load_extensions('add_newstep_extensions');
	load_menus('add_newstep_menus');
	parent.loadscreen(this);
}

menuscallbacks.identifier = "extension";

menuscallbacks.eachline = true;

menuscallbacks.includecats = true;

menuscallbacks.cancelnewcategory =function(){
	_$('comment').disabled = true;
	_$('keypressoptions').style.display = "none";
}

menuscallbacks.oncategorydelete =function(){
	delete_vmenu_fromlistofmenus();
	_$('comment').disabled = true;
	_$('keypressoptions').style.display = "none";
	_$('savevmenu').disabled = true;
	_$('steps').options.length =0;
	_$('newstep_action').disabled = true;
	_$('newstep_var').disabled = true;
	_$('addstep').disabled = true;
	_$('steps').disabled = true;
	_$('stepUp').disabled = true;
	_$('stepDown').disabled = true;
	_$('alias_exten').value = "";
	_$('alias_exten').disabled = true;
}

menuscallbacks.cancelchanges =function(){
	_$('savevmenu').disabled = true;
}

menuscallbacks.newcategory = function(t) {
	// 1. Reset all Keyoptions
	// Load the menus and extensions into corresponding fields
	for (var y=0;y<keys.length; y++){
		current_key_exts='keypress_'+ keys[y] + '_exts';
		current_key_menus='keypress_'+ keys[y] + '_menus';
		current_key_text = 'keypress_'+ keys[y] + '_text' ;
		current_key_action='keypress_'+ keys[y] + '_action';
	
		load_extensions(current_key_exts);
		load_menus(current_key_menus);
		_$(current_key_action).selectedIndex = 0;
		_$(current_key_exts).style.display = "none";
		_$(current_key_menus).style.display = "none";
		_$(current_key_text).style.display = "none";
	}
	// 2. Reset Steps - only 1 step -> Answer
	var _steps = _$('steps') ;
	var _comment = _$('comment'); 
	var _allowexten = _$('allowexten') ;
	var _alias_exten = _$('alias_exten') ;
	_steps.options.length =0;
	var newoption = document.createElement("option");
	newoption.text = format_step(answer_call_string);
	newoption.value = answer_call_string;
	_steps.options.add ( newoption );
	// 3. Disable Steps - Add Step , Up , Down Arrows
	_$('stepUp').disabled = true;
	_$('stepDown').disabled = true;
	_allowexten.checked = false;
	_allowexten.disabled = false;
	_$('newstep_action').disabled = true;
	_$('newstep_var').disabled = true;
	_$('addstep').disabled = true;
	_steps.disabled = true;
	//  4. Reset Comment
	_$('keypressoptions').style.display = "";
	_alias_exten.disabled = false;
	_alias_exten.value = "";
	_comment.disabled = false;
	_comment.value = "";
	_comment.focus();
}


function localajaxinit() {
	showdiv_statusmessage();
	setWindowTitle("Voice Menus");
	_$('message_text').innerHTML ="Saving Changes...";
	for (x =0 ; x<fieldnames.length; x++){
		widgets[fieldnames[x]] = _$(fieldnames[x]);
		widgets[fieldnames[x]].disabled = true;
	}
	//parent.loadscreen(this);
	parent.astmanEngine.config2list("extensions.conf", _$('extensions'), new Array(), extencallbacks);
}

//extencallbacks
extencallbacks.format = function(t, x) {
	var res;
	var qname;
	if ((t.name != specialcontext))
	return null;

	// check whether the extension is an alias to a custom voice menu
	try{
		var temp = t.fields[x].split(',') ;
		if ( temp[2].match("Goto") && temp[2].match("voicemenu-custom-" )  ){ return null ; }
	}
	catch(e){

	}

	res = format_extension(_$('extensions'), t, x);
	return res;
}

extencallbacks.loaded = function() {
	parent.astmanEngine.run_tool(asterisk_guiListFiles + " " + asterisk_Sounds_path, callback = function() { 
	var opt = { method: 'get', asynchronous: true,
		onComplete: function(originalRequest){
			_$('sysinfohtml').innerHTML = originalRequest.responseText;
			// Add Default sound files to the list of sound files
			var j = _$('list_files').innerHTML ;
			var sndfiles = j.split("\n") ;
			var New_OPTION = document.createElement('option');
			New_OPTION.text = "Default Sounds"  ;
			New_OPTION.value = ""  ;
			New_OPTION.style.fontWeight = "bold";
			try {
				_$('combosel_sounds').add(New_OPTION, null); // W3C way
			}catch(ex) {
				_$('combosel_sounds').add(New_OPTION); // IE way
			}
			var file_name;
			for( var i =0 ; i < sndfiles.length ; i++){
				if( typeof sndfiles[i] == "undefined"  || sndfiles[i] == "" ){
					continue;
				}
				sndfiles[i] = sndfiles[i].replace(/^\s*|\s*$/g,'') ;
				if( sndfiles[i] == "" ){ continue; }
				file_name = sndfiles[i].stripTags() ;
				file_name = file_name.substr(0,(file_name.length - 4) ) ;
				New_OPTION = document.createElement('option');
				New_OPTION.text =  file_name  ;
				New_OPTION.value = file_name ;
				try {
					_$('combosel_sounds').add(New_OPTION, null); // W3C way
				}catch(ex) {
					_$('combosel_sounds').add(New_OPTION); // IE way
				}
			}
			load_recordedfiles();
		},
		onFailure: function(t) { alert("Config Error: " + t.status + ": " + t.statusText); }
	};
	opt.parameters="";
	var tmp = new Ajax.Request(asterisk_guiSysInfo_output , opt);
	});
}


function load_recordedfiles(){
	parent.astmanEngine.run_tool(asterisk_guiListFiles + " " + asterisk_menusRecord_path, callback = function() { 
	var opt = { method: 'get', asynchronous: true,
		onComplete: function(originalRequest){
			// Add Recorded Voiemenus to the list of sound files
			_$('sysinfohtml').innerHTML = originalRequest.responseText;
			var k = _$('list_files').innerHTML ;
			var recfiles = k.split("\n") ;
			New_OPTION = document.createElement('option');
			New_OPTION.text = "Recorded Voicemenus"  ;
			New_OPTION.value = ""  ;
			New_OPTION.style.fontWeight = "bold";
			try {
				_$('combosel_sounds').add(New_OPTION, null); // W3C way
			}catch(ex) {
				_$('combosel_sounds').add(New_OPTION); // IE way
			}
			var file_name;
			for( var i =0 ; i < recfiles.length ; i++){
				if( typeof recfiles[i] == "undefined"  || recfiles[i] == "" ){
					continue;
				}
				recfiles[i] = recfiles[i].replace(/^\s*|\s*$/g,'') ;
				if( recfiles[i] == "" ){ continue; }
				file_name = recfiles[i].stripTags() ;
				file_name = file_name.substr(0,(file_name.length - 4) ) ;
				New_OPTION = document.createElement('option');
				New_OPTION.text =  file_name  ;
				New_OPTION.value = file_name ;
				try {
					_$('combosel_sounds').add(New_OPTION, null); // W3C way
				}catch(ex) {
					_$('combosel_sounds').add(New_OPTION); // IE way
				}
			}
			parent.astmanEngine.config2list("users.conf", _$('users'), new Array(), usercallbacks);
		},
		onFailure: function(t) { alert("Config Error: " + t.status + ": " + t.statusText); }
	};
	opt.parameters="";
	var tmp = new Ajax.Request(asterisk_guiSysInfo_output , opt);
	});
}





extencallbacks.eachline = true;

// user callbacks
usercallbacks.format = function (t,x){
	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['context'] == asterisk_guiTDPrefix + t.name ) {
		return null;
	}else{
		return t.name;
	}
}

usercallbacks.identifier = "extension";

usercallbacks.loaded = function (){
	var _exts = _$('extensions') ;
	var _users = _$('users') ;

	for(var p=0; p < _exts.length; p++){
		var tmp = _exts.options[p].text.split (" -- ");
		extensions_array.push (tmp[0]);
	}
	for(var p=0; p < _users.length; p++){
		extensions_array.push (_users.options[p].text);
	}
	extensions_array = extensions_array.sort(); // or extensions_array.sort(sortNumber);
	parent.astmanEngine.config2list("extensions.conf", _$('vmenus'), widgets, menuscallbacks);
}

function free_mem(){
	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
	try{
		widgets['save'].hostselectbox = null ;
		widgets['cancel'].hostselectbox = null ;
		widgets['new'].hostselectbox = null ;
		widgets['delete'].hostselectbox = null ;
		purge( document.body );
	} catch(e){ }
}
</script>
<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF" onunload="free_mem()">
<div class="mainscreenTitleBar">
	<span style="margin-left: 4px;font-weight:bold;">Voice Menus Configuration</span>
	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
</div>
<div class="mainscreenContentBox" id="userscontent">
<table class="mainscreenTable" align="center">
	<tr valign="top">
		<td colspan='2'> Voice Menus: </td>
	</tr>
	<tr valign="top">
		<td>	<select size="25" id="vmenus" style="width:180px;" class="input10"><option>Loading...</option></select>	</td>
		<td valign=top align="right" width=346 height=415>
			<select id='extensions' style='display:none;width:0px;height:0px'></select><select id='users' style='display:none;width:0px;height:0px'></select><select id='recorded_files' style='display:none;width:0px;height:0px'></select>
			<table align="center" width="346">
			<tr>
				<td width="50" align=left class="field_text" onmouseover="show_tooltip('en', 'menus', 0);">Name:</td>
				<td align=left class="field_text">
					<input id='comment'  size=15 onKeyUp="enable_savecancel()"  pattern='^[a-zA-Z_0-9 ]*$' disabled  class="input8">&nbsp;
					<span onmouseover="show_tooltip('en', 'menus', 5);">
					Extension: <input id="alias_exten"  onKeyUp="enable_savecancel()"  size=4 disabled class="input8" onmouseover="show_tooltip('en', 'menus', 5);">
					</span>
				</td>
			</tr>
			<tr onmouseover="show_tooltip('en', 'menus', 1);">
				<td class="field_text">Steps:<BR>
					<input  style='width:45'  type="button" id="stepUp" value="Up" disabled onClick="step_up()" class="buttonbold"><BR><BR>
					<input  style='width:45' type="button" id="stepDown" value="Down" disabled onClick="step_down()" class="buttonbold">
				</td>
				<td rowspan=2><select id='steps' size=5  style="width:280px;" onClick="step_onselect()" disabled class="input8"></select></td>
			</tr>
			<tr  onmouseover="show_tooltip('en', 'menus',2);"><td colspan=2 class="field_text" height=4></td></tr>
			<tr  onmouseover="show_tooltip('en', 'menus',2);"><td colspan=2 class="field_text">Add a new Step:</td></tr>
			<tr><td colspan=2>

				<NOBR>
				<select id='newstep_action' disabled onChange="update_newstep_var()" class="input8">
					<option value=""> -- Select --</option>
					<option value="Answer">Answer</option>
					<option value="Authenticate">Authenticate</option>
					<option value="Background">Background</option>
					<!-- <option value="SetMusicOnHold">SetMusicOnHold</option> -->
					<option value="DigitTimeout">DigitTimeout</option>
					<option value="ResponseTimeout">ResponseTimeout</option>
					<option value="Playback">Playback</option>
					<option value="Wait">Wait</option>
					<option value="WaitExten">WaitExten</option>
					<option value="GotoMenu">Goto Menu</option>
					<option value="GotoExtension">Goto Extension</option>
					<option value="Hangup">Hangup</option>
				</select>&nbsp;
				<input type=text id="newstep_var" style="display:none" size=4 disabled class="input8">
				<select id='add_newstep_extensions' style="display:none"   onChange=" $('newstep_var').value = $('add_newstep_extensions').value;"   class="input8"></select>
				<select id='add_newstep_menus' style="display:none"    onChange=" $('newstep_var').value = $('add_newstep_menus').value;"   class="input8"></select>
				<div id="combodiv_sounds">
					<select size=5 id="combosel_sounds" style="font-family: Verdana, Arial, Helvetica, Sans-Serif;font-size: 11px;" class="input8"></select>
				</div>
				<input type=text id="newstep_var_digit" size=3 style="display:none;" onChange=" $('newstep_var').value = $('newstep_var_digit').value;"  pattern='^\d*$' class="input8">&nbsp;
				<SCRIPT LANGUAGE="JavaScript">combo_box('newstep_var', "combodiv_sounds","combosel_sounds"); </SCRIPT>
				<input type=button style='width:45' id='addstep' onclick="add_newstep()"  value="Add" disabled  class="buttonbold">
				&nbsp;<input type=button style='width:50' id='deletestep' onclick="delete_step()"  value="Delete" disabled  class="buttonbold">
				</NOBR>
			</td>
			</tr>
			<tr onmouseover="show_tooltip('en', 'menus', 3);">
				<td colspan=2 class="field_text">
				<label FOR="allowexten">
					&nbsp;<input type=checkbox id=allowexten disabled onclick="enable_savecancel()"> Dial other Extensions?
				</label>&nbsp;</td>
			</tr>
			<tr>	<td colspan=2 height=6></td></tr>
			<tr onmouseover="show_tooltip('en', 'menus', 4);">
				<td colspan=2 class="field_text">'Keypress' Events</td>
			</tr>
			<tr><td colspan=2>
				<div  style="width=340px;">
					<table cellpadding=3 cellspacing=0 width="100%">
					<TR bgcolor='#B8B8B8'>
						<TD width=35 class="field_text">Key</TD><TD class="field_text">Action</TD>
					</TR>
					</table>
				</div>
				<div id="keypressoptions" style="height:155px;width=340px; overflow :auto;display :none;">
					<table cellpadding=3 cellspacing=0 width="100%">
					<script>
					for (var k=0; k< keys.length; k++){
						var p =  generate_fields( keys[k] )  ; 
						switch(keys[k]){
							case 't': var omo =  "onmouseover=\"show_tooltip('en', 'menus', 6 );\" " ; break;
							case 'i': var omo =  "onmouseover=\"show_tooltip('en', 'menus', 7 );\" " ; break;
							default: var omo =  "" ;
						}
						document.write("<TR bgcolor='#FFFFFF' " + omo + ">\n"
						+ "<TD width=35 align=center><font style=\"font-size: 10pt\">"+keys[k]+"</font></TD>\n"
						+ "<TD>" 
						+ p
						+ "\n </TD></TR>\n\n" );
					}
					</script>
					</table>
				</div>
				</td>
			</tr>
			</table>
		</td>
	</tr>
	<tr>
	<td align='center'>
		<input style='width:80' type='button' id='new' value='New' class="buttonbold">&nbsp;
		<input style='width:80' type='button' id='delete' value='Delete' class="buttonbold">&nbsp;
	</td>
	<td align='right'>
		<input type="hidden" id="save">
		<input type='button' id='savevmenu' onClick="save_vmenu()" value='Save' disabled class="buttonbold">&nbsp;
		<input type='button' id='cancel' value='Cancel' class="buttonbold">&nbsp;
	</td>
	</tr>
</table>
</div>
<div id="sysinfohtml" style="display:none"></div>
</body>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -