📄 fdb.js
字号:
<script language="JavaScript">
<? include ../html/js/jsl.js ?>
<? include ../html/js/error.js ?>
var uiVarProtoPortCount = <? multiquerycount fdb:settings/$var:category/$var:rule/protocolportlist ?>;
function uiDoOnLoad()
{
<? if eq 1 <? query fdb:settings/$var:category/edit ?> `jslSetValue("uiViewRuleName", "uiPostRuleName");` `` ?>
//doShowPageErrors();
return true;
}
function uiDoValidate()
{
value = document.getElementById("uiViewRuleName").value;
if(value=="") {
alert("Empty rule name");
return false;
}
if(value.match("^[0-9]") != null) { alert("A name can not start with a number."); return false}
if(value.match("[^0-9a-zA-Z_-]") != null) { alert("A name can only have alpha-numeric characters"); return false}
else if((value.length == 0) || (value.length > 32)) { alert("A name must contain 1..32 characters"); return false}
return true;
}
function uiDoSave()
{
var i;
var del=false;
//Aids 050727 fixed the delete and add problem("Error found on page") for port forwarding {
for(i=0; i < uiVarProtoPortCount; i++ )
{
if (document.getElementById("uiViewDeletePPCheckBox"+i).value == "on")
{
del=true;
}
}
if (del==true)
{
jslDisable("uiPostRuleName");
jslDisable("uiPostProtocol");
jslDisable("uiPostPortStart");
jslDisable("uiPostPortEnd");
jslDisable("uiPostPortMap");
}
else
{
jslEnable("uiPostRuleName");
jslEnable("uiPostProtocol");
jslEnable("uiPostPortStart");
jslEnable("uiPostPortEnd");
jslEnable("uiPostPortMap");
if(uiDoValidate()==false) return false;
jslSetValue("uiPostRuleName", "uiViewRuleName");
jslSetValue("uiPostProtocol", "uiViewProtocol");
jslSetValue("uiPostPortStart", "uiViewPortStart");
jslSetValue("uiPostPortEnd", "uiViewPortEnd");
jslSetValue("uiPostPortMap", "uiViewPortMap");
if ((document.getElementById("uiViewPortStart").value.match("^[0-9]+\$") == null)||(parseInt(document.getElementById("uiViewPortStart").value) < 1) ||(parseInt(document.getElementById("uiViewPortStart").value) > 65535)||(document.getElementById("uiViewPortStart").value==""))
{
alert("Port Start must be an integer between 1 and 65535");
return false;
}
if ((document.getElementById("uiViewPortEnd").value.match("^[0-9]+\$") == null)||(parseInt(document.getElementById("uiViewPortEnd").value) < 1) ||(parseInt(document.getElementById("uiViewPortEnd").value) > 65535)||(document.getElementById("uiViewPortEnd").value==""))
{
alert("Port End must be an integer between 1 and 65535");
return false;
}
if ((document.getElementById("uiViewPortMap").value.match("^[0-9]+\$") == null)||(parseInt(document.getElementById("uiViewPortMap").value) < 1) ||(parseInt(document.getElementById("uiViewPortMap").value) > 65535)||(document.getElementById("uiViewPortMap").value==""))
{
alert("Port Map must be an integer between 1 and 65535");
return false;
}
}
//Aids 050727 fixed the delete and add problem("Error found on page") for port forwarding}
for(i=0; i < uiVarProtoPortCount; i++ )
document.getElementById("uiViewDeletePPCheckBox"+i).disabled = true;
//Aids 050727 conflict with widgets apply button id{
// document.getElementById("uiViewApplyButton").disabled = true;
document.getElementById("uiButtonApply").disabled = true;
//Aids 050727 conflict with widgets apply button id}
document.getElementById("uiViewCancelButton").disabled = true;
document.getElementById("uiPostForm").submit();
}
function uiDoCancel()
{
//rick, 050624,Fix Javascript error, then click cancel button in view page {
// var i = 0;
// var handle = null;
// <? if eq 1 <? query fdb:settings/$var:category/edit ?> `
// for(i=0; i < uiVarProtoPortCount; i++ )
// {
// handle = document.getElementById("uiViewDeletePPCheckBox"+i);
// if(handle!=null) handle.disabled=true;
// }
// document.getElementById("uiViewApplyButton").disabled = true;
// ` ?>
// document.getElementById("uiViewCancelButton").disabled = true;
// document.getElementById("uiPostForm").method="GET";
// jslSetValue("uiPostPageName","uiPostPageMaster");
// document.getElementById("uiPostForm").submit();
jslGoTo(null,"home");
//rick, 050624}
}
function uiDoToggleDelete(id)
{
if(document.getElementById(id).disabled==true)
{
document.getElementById(id).disabled = false;
}
else
{
document.getElementById(id).disabled = true;
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -