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

📄 5.html

📁 asterisk 的图形管理界面
💻 HTML
📖 第 1 页 / 共 2 页
字号:
		}
	}
	_$('pattern').value = a;
	_$('strip').value = default_np_data[a][b].digits2strip;
	_$('save_a').disabled = 1;

	if(default_np_data[a][b].ruledesc == 'custom' ){
		// if this is a custom pattern then donot try to parse the pattern
		iscustom = true;
		_$('define_advanced').style.display="";
		_$('define_usual').style.display="none";
	}else{
		// if this is standard pattern then parse the pattern into 'beginswith', 'followedby'
		var temp = parsepattern(a,1);
		iscustom = false;
		_$('define_advanced').style.display="none";
		_$('define_usual').style.display="";
	}

	_$('userscontent').style.display="";
	_$('bg_transparent').style.display='';
	_$('addrule').disabled =1;
}

function parsepattern(a,e){
	returnstring="";
	// Parsing into fields
	// if first character is underscore (always) - remove it 
	var temp = a.substr(1);
	// if there is a dot at the end 
	//		check ormore and remove the trailing dot
	if( temp.substr(-1,1) == "." ){
		temp = temp.slice(0, -1);
		returnstring = "or more";
		if(e == 1)
		_$('ormore').checked = true;
	}
	var posofx = temp.indexOf('X');
	//alert("position of X in " + temp + " is " + posofx );
	// if X does not occur anywhere followedby is = 0
	// if X happens somewhere then beginswith = string till somewhere
	//		and followedby = length of string from somewhere till end
	if(posofx == -1){ 	
		if(returnstring == "or more"){
			returnstring = "Begins with " + temp + " and followed by 0 or more digits" ;
		}else{
			returnstring = "Exactly macthes " + temp  ;
		}
		if(e == 1){
			_$('beginswith').value = temp;
			_$('followedby').value = 0;
		}
	}else{
		if(returnstring == "or more"){
			returnstring = "Begins with " + temp.substr(0,posofx) + " and followed by "+(temp.length - posofx)+" or more digits" ;
		}else{
			returnstring = "Begins with " + temp.substr(0,posofx) + " and followed by "+(temp.length - posofx) + " digits";
		}
		if(e == 1){
			_$('beginswith').value = temp.substr(0,posofx);
			_$('followedby').value = (temp.length - posofx);
		}
	}

return returnstring;
}

function ownpattern(){
	iscustom = true;
	_$('define_advanced').style.display="";
	_$('define_usual').style.display="none";
}

function enablesave(){
	_$('save_a').disabled = 0;
	return true;
}

function add_callingrule(){
	isnewrule = true;
	_$('rulename').value = "";
	_$('trunks').selectedIndex = -1 ;
	_$('pattern').value = "";
	_$('strip').value = "0" ;
	_$('save_a').disabled = 1;
	_$('define_advanced').style.display="none";
	_$('define_usual').style.display="";
	_$('userscontent').style.display="";
	_$('bg_transparent').style.display='';
	_$('addrule').disabled =1;
	_$('beginswith').value = "";
	_$('followedby').value ="";
	_$('ormore').checked = false;
}

function add_rule_fromeditform( this_priority, oncomplete ){
	if( iscustom ){ // custom - take pattern as is
		var commentstring = "custom";
	}else{
		var commentstring = "standard";
		//build a pattern into $('pattern').value
		buildpatternstring();
	}
		
	var rule_string = _$('pattern').value + ',' + this_priority + ',Macro(trunkdial,${' + $('trunks').value + '}/${EXTEN:' + $('strip').value + '})' ;
	var uri = build_action('append', 0 , "numberplan-custom-1" ,"exten", rule_string );
	commentstring = _$('pattern').value + ',' + this_priority + ',' + _$('rulename').value + "," + commentstring ;
	uri += build_action('append', 1 , "numberplan-custom-1" ,"comment", commentstring );

	var opt = {
		method: 'get',
		asynchronous: true,
		onSuccess: function(t) { oncomplete(); },
		onFailure: function(t) {
			alert("Config Error: " + t.status + ": " + t.statusText);
		}
	};
	opt.parameters= "action=updateconfig&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri;
	_$('userscontent').style.display="none";
	_$('bg_transparent').style.display='none';
	_$('status_message').style.display='';
	var tmp = new Ajax.Request(rawman_url, opt);
}


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" ){
			var  t = _$('pattern').value;
			for ( var y in default_np_data[t] ){
				if(default_np_data[t].hasOwnProperty(y) ){ newpriority++; }
			}
		}
		add_rule_fromeditform( newpriority, oncomplete = function(){location.reload();}  );
	 }else{	// update exiting rule
		// delete existing rule
		// add rule with new values
		delete_callingrule(pattern_beingedited,pattern_beingedited_priority, oncomplete = function(){location.reload();} );
		add_rule_fromeditform( pattern_beingedited_priority, oncomplete = function(){location.reload();} );

		//$('userscontent').style.display='none';
		//$('addrule').disabled =0;
		//return true;
	 }
}

function	buildpatternstring(){
	var pattern = _$('beginswith').value;
	// Add an underscore
	pattern = "_" + pattern;
	// append 'followedby' number of X's 
	for (var r=0; r < _$('followedby').value ; r++){
		pattern = pattern + "X" ;
	}
	// append a '.' if 'ormore' is checked
	if( _$('ormore').checked ){
		pattern = pattern + "." ;
	}
	// assign this to the field 'pattern'
	_$('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>
<table width="100%" height="100%" border=0 cellpadding=0 cellspacing=0>
<tr>
<td width="170" valign=top align=left>
	<div id="menu">
	<table cellpadding=3 cellspacing=2 border=0 id="sidelist">
		<tr><td width=3></td><td>Start</td></tr>
		<tr><td></td><td>Verify Analog Ports</td></tr>
		<!-- <tr><td></td><td>Date & Time</td></tr> -->
		<tr><td></td><td>Local Extension Settings</td></tr>
		<tr><td></td><td>Service Providers</td></tr>
		<tr><td></td><td class="slselected">Calling Rules</td></tr>
		<tr><td></td><td>VoiceMail Settings</td></tr>
		<tr><td></td><td>User Extensions</td></tr>
		<tr><td></td><td>Incoming Calls</td></tr>
		<!-- <tr><td></td><td>VoiceMenus</td></tr> -->
		<tr><td></td><td>Finish</td></tr>
	</table>
	</div>
</td>
<td valign=top align=center>
<!--  this page -->
	<select id="extensions" style="display:none"></select>
	<div class="heading">Step 4 of <script>document.write(parent.numberofsteps);</script>&nbsp;&nbsp;-  Outbound Calling Rules</div>
	<table class="table_blacksm" cellpadding=2 cellspacing=2 border=0 align=center width=500 id="table_one">
		<tr>	<td width=35>S.No</td>
			<td width=90>RuleName</td>
			<td>Dial Pattern</td>
			<td width=85 align=center>Call Using</td>
			<td width=75 align=center>Options</td>
		</tr>
	</table>
	
	<div id="callingRulesTable_div" style="height:250px;width=100%; overflow :auto; padding : 0px 0px 0px 0px;">
		<table id="callingRulesTable" cellpadding=2 cellspacing=1 border=0 align=center width=500></table>
	</div>

	<center><div style="height:25px;color: #FF0000;" id='status'  class="field_text9"></div></center>
	<BR>
	<center><input type="button" id="addrule" value="Add a Calling Rule" onclick="add_callingrule();"></center>
	
	<div id="userscontent" STYLE="display:none; position: absolute; left: 225; top: 40; width:500; height:290;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'userscontent');">
	<TR bgcolor="#7E5538" >
		<TD Height="20" align="right" style="cursor: move">
			<A href="#" onclick="$('cancel_a').click();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A>
		</TD>
		<TD width=4></TD>
	</TR>
	</table>

	<TABLE	align=center cellpadding=2 cellspacing=2 border=0 width="480">
	<TR>	<TD align="right" width=175  class="field_text">Rule Name:</TD>
		<TD><input type="text" id="rulename" size="" onChange="enablesave();" onkeyup="enablesave();"></TD>
	</TR>
	<TR>	<TD  align="right" height=40  class="field_text"> Place this call through :</TD>
		<TD><select id="trunks"></select></TD>
	</TR>
	<TR id="define_usual" height=100>
		<TD valign="top" align=right  class="field_text">Dialing Rules :</TD>
		<TD valign="top"  class="field_text">
		If the number begins with <input id="beginswith" type='text' size=6 onChange="enablesave();" onkeyup="enablesave();"> 
		and followed by <input id="followedby" type='text' size=1  onChange="enablesave();" onkeyup="enablesave();"> 
		digits <input type="checkbox" id="ormore" onChange="enablesave();"> or more 
		<BR> <A href="#" onclick="ownpattern();">(define a custom pattern)</A>
		</TD>
	</TR>
	
	<TR id="define_advanced"  height=100>
		<TD valign="top" align=right  class="field_text"> Custom Pattern: </TD>
		<TD valign=top>
			<input type="text" id="pattern" size="" onChange="enablesave();" onkeyup="enablesave();"><BR>
			<table align='left' cellpadding=0 cellspacing=0>
			<tr>	<td class="field_text"><b>N&nbsp;&nbsp;</b></td>
				<td class="field_text">Any digit from 2 to 9</td>
			</tr>
			<tr>	<td class="field_text"><b>X&nbsp;&nbsp;</b></td>
				<td class="field_text">Any digit from 0 to 9</td>
			</tr>
			<tr>	<td class="field_text"><b>.&nbsp;&nbsp;</b></td>
				<td class="field_text">Any number of additional digits</td>
			</tr>
			</table>
		</TD>
	</TR>

	<TR>	<TD colspan=2 align=center  class="field_text">
		Strip <input type="text" id="strip" size="1"  onChange="enablesave();" onkeyup="enablesave();"> 
		digits from the front before dialing:
		</TD>
	</TR>
	<TR>	<TD colspan=2 align=center height=50 valign=middle>  
			<input type="button" id="save_a" value="Save" onclick="saverule();">&nbsp;&nbsp;
			<input type="button" id="cancel_a" value="Cancel" onclick="$('userscontent').style.display='none'; $('bg_transparent').style.display='none'; $('addrule').disabled =0; " >
		</TD>
	</TR>
	</TABLE>
	</div>
<!--  this page -->
</td>
</tr>
</table>
<div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 0; width:100%; height:100%;  background-color:#FFFFFF; filter:alpha(opacity=50); -moz-opacity:.50;opacity:.50; border-width: 0px; z-index:4">
</div>
</BODY>
</HTML>

⌨️ 快捷键说明

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