|
|
|
|
|
<!DOCTYPE html> |
|
|
<html> |
|
|
<head> |
|
|
<meta http-equiv="cache-control" |
|
|
content="max-age=0" /> |
|
|
<meta http-equiv="cache-control" |
|
|
content="no-store" /> |
|
|
<meta http-equiv="expires" |
|
|
content="-1" /> |
|
|
<meta http-equiv="expires" |
|
|
content="Tue, 01 Jan 1980 1:00:00 GMT" /> |
|
|
<meta http-equiv="pragma" |
|
|
content="no-cache" /> |
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
|
|
|
|
|
<meta charset="utf-8" /> |
|
|
|
|
|
<!--meta http-equiv="refresh" content="300" />--> <!--Refresh each 5s--> |
|
|
<script src="jquery_3_2_1.min.js"></script> |
|
|
<script src="fabric_jquery.easyui.min_compressed_on_nvr.js"></script> |
|
|
<script src="config.js"></script> |
|
|
<script> |
|
|
window.onerror = function (message, url, linenumber) { |
|
|
|
|
|
console.log('JavaScript error: ' + message + ' on line ' + linenumber + ' for ' + url); |
|
|
|
|
|
if (url.search("fabric_jquery.easyui.min_compressed_on_nvr.js") >= 1) { |
|
|
loadScript("fabric_jquery.easyui.min_compressed_on_nvr.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (url.search("jquery_3_2_1.min.js") >= 1) { |
|
|
loadScript("jquery_3_2_1.min.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (url.search("config.js") >= 1) { |
|
|
loadScript("config.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (url.search("cookie.min.js") >= 1) { |
|
|
loadScript("cookie.min.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (url.search("lang.js") >= 1) { |
|
|
loadScript("lang.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (url.search("lang_cookie.js") >= 1) { |
|
|
loadScript("lang_cookie.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (message.search("slider") >= 1) { |
|
|
loadScript("fabric_jquery.easyui.min_compressed_on_nvr.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (message.search("myport") >= 1) { |
|
|
loadScript("config.js", function () { |
|
|
}); |
|
|
} |
|
|
else if (message.search("cookie") >= 1) { |
|
|
loadScript("cookie.min.js", function () { |
|
|
}); |
|
|
} |
|
|
else { |
|
|
//location.reload(); |
|
|
var replaceUrl = 'http://' + window.location.hostname + ':' + GetUrlPort() + '/Aida/output.html'; |
|
|
//alert(replaceUrl); |
|
|
window.location.replace(replaceUrl); |
|
|
} |
|
|
} |
|
|
function GetUrlPort() { |
|
|
var url_href = window.location.href; |
|
|
var arr_url = url_href.split(":")[2].split("/")[0]; |
|
|
|
|
|
return arr_url; |
|
|
} |
|
|
if (window.history.replaceState) { |
|
|
window.history.replaceState(null, null, window.location.href); |
|
|
} |
|
|
</script> |
|
|
<script src="cookie.min.js"></script> |
|
|
<script src="lang.js"></script> |
|
|
<script src="lang_cookie.js"></script> |
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="bootstrap.min.css"> |
|
|
<link rel="stylesheet" type="text/css" href="easyui.css"> |
|
|
|
|
|
<style> |
|
|
|
|
|
body, html { |
|
|
font-family: "Arial"; |
|
|
} |
|
|
|
|
|
ul { |
|
|
list-style-type: none; |
|
|
/*height: 400px;*/ |
|
|
margin: 0px; |
|
|
/*overflow: hidden;*/ |
|
|
/*overflow-y: scroll;*/ |
|
|
} |
|
|
|
|
|
li { |
|
|
margin-left: -40px; |
|
|
} |
|
|
|
|
|
.titlebox { |
|
|
float: left; |
|
|
padding: 0 5px; |
|
|
margin: -30px 0 0 20px; |
|
|
background: #fff; |
|
|
} |
|
|
|
|
|
li.selected { |
|
|
background-color: #6c87d4; |
|
|
color: white; |
|
|
} |
|
|
|
|
|
.column { |
|
|
float: left; |
|
|
overflow: hidden; |
|
|
/*width: 33%;*/ |
|
|
padding-left: 10px; |
|
|
/*height: 300px;*/ |
|
|
/*margin: auto;*/ |
|
|
/* Should be removed. Only for demonstration */ |
|
|
} |
|
|
/* Clear floats after the columns */ |
|
|
|
|
|
.row:after { |
|
|
content: ""; |
|
|
display: table; |
|
|
clear: both; |
|
|
} |
|
|
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */ |
|
|
@media screen and (max-width: 400px) { |
|
|
.column { |
|
|
width: 100%; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</head> |
|
|
<body> |
|
|
|
|
|
|
|
|
<!-- |
|
|
<a href="#" id="lnkSuccess"> Test Ajax Success </a> | |
|
|
<a href="#" id="lnkError"> Test Ajax Error</a> |
|
|
|
|
|
<br> |
|
|
<br> |
|
|
<br> |
|
|
<div class='wrapper'> |
|
|
<ul id='post'>Please make an ajax call by clicking above...</ul> |
|
|
</div> |
|
|
--> |
|
|
<!-- <table valign="center" style="border-collapse: collapse; width: 300px; height: 160px;" border="0"> --> |
|
|
<div class="progress" style="background-color:white"> |
|
|
<div class="progress-bar progress-bar-striped" style="min-width: 20px;visibility:hidden;"></div> |
|
|
</div> |
|
|
<div style="border:1px gray solid;padding:20px;margin:15px 15px 15px 15px;height: 560px;"> |
|
|
<div class="titlebox"><nobr id="TITLEBOX_PAGE05"></nobr></div> |
|
|
<div class="row"> |
|
|
<div class="column" style="width:35%;"> |
|
|
<input id="enable_http_notification" type="checkbox" /> <nobr id="IDC_CHECK_HTTP_NOTIFICATION"></nobr> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_POST_EVENTS"></nobr> |
|
|
<br> |
|
|
<div class="test2" style="width: 93%; border:1px gray solid;"> |
|
|
<ul id="CHECKED_CAMERA_VIRTUAL_INPUT_LIST"> |
|
|
<li id="li_checked_camera_virtual_input_1"><nobr id="checked_camera_virtual_input_1_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_2"><nobr id="checked_camera_virtual_input_2_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_3"><nobr id="checked_camera_virtual_input_3_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_4"><nobr id="checked_camera_virtual_input_4_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_5"><nobr id="checked_camera_virtual_input_5_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_6"><nobr id="checked_camera_virtual_input_6_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_7"><nobr id="checked_camera_virtual_input_7_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_8"><nobr id="checked_camera_virtual_input_8_text"></nobr><br></li> |
|
|
<li id="li_checked_camera_virtual_input_9"><nobr id="checked_camera_virtual_input_9_text"></nobr><br></li> |
|
|
</ul> |
|
|
</div> |
|
|
<br> |
|
|
<textarea style="width: 93%; height: 80px; background-color:#F3F1F1;" id="test_result" readonly></textarea> |
|
|
<br> |
|
|
<input id="button_test_current_post" type="button" onclick="func_Test_Current_Post()" value="Testing" style="background-color:#6c87d4;color:white;" /> |
|
|
<input id="button_clean" type="button" onclick="func_clean_test_result()" value="Clear" style="background-color:#6c87d4;color:white;" /> |
|
|
<br> |
|
|
<input id="ENABLE_HEARTBEAT" type="checkbox" /> <nobr id="IDC_ENABLE_HEARTBEAT"></nobr> |
|
|
<br> |
|
|
<nobr id="IDC_DWELL_HEARTBEAT"></nobr> |
|
|
<br><br> |
|
|
<input class="easyui-slider" style="width:90%;" id="HEARTBEAT_DWELL" /> |
|
|
<nobr id="IDC_HEARTBEAT_OUTPUT"></nobr> |
|
|
<select id="heartbeat_link_to_post_event_name" onchange=""> |
|
|
<option value="-1">None</option> |
|
|
<option value="0"></option> |
|
|
<option value="1"></option> |
|
|
<option value="2"></option> |
|
|
<option value="3"></option> |
|
|
<option value="4"></option> |
|
|
<option value="5"></option> |
|
|
<option value="6"></option> |
|
|
<option value="7"></option> |
|
|
<option value="8"></option> |
|
|
</select> |
|
|
<br> |
|
|
<div id="ptz_autotracking_border"> |
|
|
<input id="enable_check_ptz_start_autotracking" type="checkbox" /> <nobr id="IDC_ENABLE_CHECK_PTZ_START_AUTOTRACKING"></nobr> |
|
|
<br> |
|
|
<nobr id="IDC_PTZ_START_AUTOTRACKING_OUTPUT"></nobr> |
|
|
<select id="ptz_start_autotracking_link_to_post_event_name" onchange=""> |
|
|
<option value="-1">None</option> |
|
|
<option value="0"></option> |
|
|
<option value="1"></option> |
|
|
<option value="2"></option> |
|
|
<option value="3"></option> |
|
|
<option value="4"></option> |
|
|
<option value="5"></option> |
|
|
<option value="6"></option> |
|
|
<option value="7"></option> |
|
|
<option value="8"></option> |
|
|
</select> |
|
|
<br> |
|
|
<input id="enable_check_ptz_end_autotracking" type="checkbox" /> <nobr id="IDC_ENABLE_CHECK_PTZ_END_AUTOTRACKING"></nobr> |
|
|
<br> |
|
|
<nobr id="IDC_PTZ_END_AUTOTRACKING_OUTPUT"></nobr> |
|
|
<select id="ptz_end_autotracking_link_to_post_event_name" onchange=""> |
|
|
<option value="-1">None</option> |
|
|
<option value="0"></option> |
|
|
<option value="1"></option> |
|
|
<option value="2"></option> |
|
|
<option value="3"></option> |
|
|
<option value="4"></option> |
|
|
<option value="5"></option> |
|
|
<option value="6"></option> |
|
|
<option value="7"></option> |
|
|
<option value="8"></option> |
|
|
</select> |
|
|
</div> |
|
|
</div> |
|
|
<div class="column" style="width:62%;"> |
|
|
<nobr id="IDC_STATIC_HTTP_PROTOCOL"></nobr> |
|
|
<label><input id="HTTP_PROTOCOL_HTTP" type="radio" name="HTTP_PROTOCOL" value="HTTP" checked> HTTP</label> |
|
|
<label><input id="HTTP_PROTOCOL_HTTPS" type="radio" name="HTTP_PROTOCOL" value="HTTPS" checked> <nobr id="text_https">HTTPS</nobr></label> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_METHOD"></nobr> |
|
|
<label><input id="POST_METHOD_GET" type="radio" name="POST_METHOD" value="GET" checked> GET</label> |
|
|
<label><input id="POST_METHOD_POST" type="radio" name="POST_METHOD" value="POST"> <nobr id="text_post">POST</nobr></label> |
|
|
<br> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_EVENT_NAME"></nobr> |
|
|
<input id="post_event_name" type="text" value="" style="width: 399px" /> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_POST_HOST_NAME"></nobr> |
|
|
<input id="post_host_name" type="text" value="" style="width: 200px" /> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_HOST_PORT"></nobr> |
|
|
<input id="post_host_port" type="text" value="80" style="width: 61px" /> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_TIMEOUT"></nobr> |
|
|
<input id="post_timeout" type="text" value="5" style="width: 31px" /> |
|
|
<br> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_URL"></nobr> |
|
|
<input id="post_url" type="text" value="" style="width: 453px" /> |
|
|
|
|
|
<input type="button" onclick="window.open('posttoken.html', '_blank', 'resizable=yes,top=0,left=0,width=450,height=500');" value="?" style="background:#6c87d4;border-color:#6c87d4;color:white" /> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_POST_USER_NAME"></nobr> |
|
|
<input id="post_user_name" type="text" value="" style="width: 152px" /> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_PASSWORD"></nobr> |
|
|
<input id="post_password" type="password" value="" style="width: 152px" autocomplete="current-password" /> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_POST_CONTENT_TYPE"></nobr> |
|
|
<select name="select_post_content_type" id="select_post_content_type" onchange="" style="width: 200px"> |
|
|
<option value="multipart/form-data">multipart/form-data</option> |
|
|
</select> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_CUSTOMIZED_HTTP_HEADER">Customized HTTP header</nobr> |
|
|
<br> |
|
|
<textarea style="width: 800px; height: 80px; background-color:white;" id="customized_http_header"></textarea> |
|
|
<br> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_CONTENT"></nobr> |
|
|
<input id="help_posttoken" type="button" onclick="window.open('posttoken.html', '_blank', 'resizable=yes,top=0,left=0,width=450,height=500');" value="?" style="background:#6c87d4;border-color:#6c87d4;color:white" /> |
|
|
<br> |
|
|
<textarea style="width: 800px; height: 140px; background-color:white;" id="post_content"></textarea> |
|
|
<br> |
|
|
|
|
|
<nobr id="IDC_STATIC_FILE_FORMAT"></nobr> |
|
|
<label><input id="FILE_FORMAT_JPEG" type="radio" name="FILE_FORMAT" value="jpeg" checked /> <nobr id="file_jpeg"></nobr></label> |
|
|
<label><input id="FILE_FORMAT_TEXT" type="radio" name="FILE_FORMAT" value="text" /> <nobr id="file_text"></nobr></label> |
|
|
|
|
|
|
|
|
<nobr id="IDC_STATIC_JPEG_FILE_NAME_FORMAT"></nobr> |
|
|
<label><input id="FILE_FORMAT_NAME_FIXED" type="radio" name="FILE_FORMAT_NAME" value="fixed" checked /> <nobr id="file_name_fixed"></nobr></label> |
|
|
<label><input id="FILE_FORMAT_NAME_DATE" type="radio" name="FILE_FORMAT_NAME" value="date" /> <nobr id="file_name_date"></nobr></label> |
|
|
<br> |
|
|
|
|
|
<nobr id="JPEG_FILE_NAME"></nobr> |
|
|
<input id="file_name" type="text" name="file_name" value="snap" style="width:200px" /> |
|
|
|
|
|
<nobr id="IDC_STATIC_POST_SEQUENCE"></nobr> |
|
|
<select name="post_sequence" id="post_sequence" onchange=""> |
|
|
<option value="NULL">None</option> |
|
|
<option value="<|space_zone|><|space_id|>"><|space_zone|><|space_id|></option> |
|
|
<option value="<|space_id|>"><|space_id|></option> |
|
|
</select> |
|
|
<br> |
|
|
<!--<nobr id="IDC_STATIC_NOTE_1" style="color:red;font-weight:bold;"></nobr>--> |
|
|
<img src="images/info-2-32X32.png" style="vertical-align:middle;" /> |
|
|
|
|
|
<nobr id="Note_post_event_name"></nobr> |
|
|
|
|
|
<br> |
|
|
<img src="images/info-2-32X32.png" style="vertical-align:middle;" /> |
|
|
|
|
|
<nobr id="Note_post_user_name_and_password"></nobr> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<div align="center"> |
|
|
<input align="center" id="IDOK" type="button" value=" Set " onclick="func_setEventsData()" style="background-color:#6c87d4;color:white;height:36px;width:300px;" /> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<div align="center" style="margin:5px 0px 0px 0px"> |
|
|
<input id="IDC_STATIC_CREATE_SMARTEVENT_BUTTON" align="center" type="button" value=" Create SmartEvent " onclick="func_setSmartEvent()" style="background-color:#6c87d4;color:white;height:36px;width:300px;" /> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div id="SNMP_border" style="border:1px gray solid;padding:20px;margin:15px 15px 15px 15px;height: 400px;"> |
|
|
<div class="titlebox"><nobr id="TITLEBOX_PAGE19"></nobr></div> |
|
|
<div class="row"> |
|
|
<div class="column" style="width:35%;"> |
|
|
<input id="enable_snmp_post" type="checkbox" /> <nobr id="IDC_CHECK_SNMP_NOTIFICATION"></nobr> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_POST_EVENTS_2"></nobr> |
|
|
<br> |
|
|
<div class="test2" style="width: 93%; border:1px gray solid;"> |
|
|
<ul id="CHECKED_SNMP_INPUT_LIST"> |
|
|
<li id="li_checked_snmp_input_1"><nobr id="checked_snmp_input_1_text"></nobr><br></li> |
|
|
<li id="li_checked_snmp_input_2"><nobr id="checked_snmp_input_2_text"></nobr><br></li> |
|
|
<li id="li_checked_snmp_input_3"><nobr id="checked_snmp_input_3_text"></nobr><br></li> |
|
|
<li id="li_checked_snmp_input_4"><nobr id="checked_snmp_input_4_text"></nobr><br></li> |
|
|
<li id="li_checked_snmp_input_5"><nobr id="checked_snmp_input_5_text"></nobr><br></li> |
|
|
</ul> |
|
|
</div> |
|
|
<br> |
|
|
<textarea style="width: 93%; height: 80px; background-color:#F3F1F1;" id="snmp_result" readonly></textarea> |
|
|
<br> |
|
|
<input id="button_snmp_current_post" type="button" onclick="func_SNMP_Current_Post()" value="Testing" style="background-color:#6c87d4;color:white;" /> |
|
|
<input id="button_snmp_clean" type="button" onclick="func_clean_snmp_result()" value="Clear" style="background-color:#6c87d4;color:white;" /> |
|
|
<br> |
|
|
<input id="enable_snmp_heartbeat" type="checkbox" /> <nobr id="IDC_ENABLE_SNMP_HEARTBEAT"></nobr> |
|
|
<br> |
|
|
<nobr id="IDC_DWELL_SNMP_HEARTBEAT"></nobr> |
|
|
<br><br> |
|
|
<input class="easyui-slider" style="width:90%;" id="snmp_heartbeat_dwell" /> |
|
|
<nobr id="IDC_SNMP_HEARTBEAT_OUTPUT"></nobr> |
|
|
<select id="snmp_heartbeat_link_to_post_event_name" onchange=""> |
|
|
<option value="-1">None</option> |
|
|
<option value="0"></option> |
|
|
<option value="1"></option> |
|
|
<option value="2"></option> |
|
|
<option value="3"></option> |
|
|
<option value="4"></option> |
|
|
</select> |
|
|
</div> |
|
|
<div class="column" style="width:62%;"> |
|
|
<nobr id="IDC_STATIC_SNMP_VERSION"></nobr> |
|
|
<label><input id="snmp_version_v1" type="radio" name="snmp_version" value="v1" checked> v1</label> |
|
|
<label><input id="snmp_version_v2c" type="radio" name="snmp_version" value="v2c" checked> v2c</label> |
|
|
<br> |
|
|
|
|
|
<nobr id="IDC_STATIC_SNMP_EVENT_NAME"></nobr> |
|
|
<input id="snmp_event_name" type="text" value="" style="width: 399px" /> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_SNMP_HOST_IP"></nobr> |
|
|
<input id="snmp_host_ip" type="text" value="" style="width: 200px" /> |
|
|
|
|
|
<nobr id="IDC_STATIC_SNMP_HOST_PORT"></nobr> |
|
|
<input id="snmp_host_port" type="text" value="" style="width: 131px" /> |
|
|
<br> |
|
|
|
|
|
<nobr id="IDC_STATIC_SNMP_OID"></nobr> |
|
|
<input id="snmp_oid" type="text" value="" style="width: 453px" /> |
|
|
<br> |
|
|
|
|
|
<nobr id="IDC_STATIC_SNMP_GROUP_NAME"></nobr> |
|
|
<input id="snmp_group_name" type="text" value="" style="width: 395px" /> |
|
|
<br> |
|
|
<nobr id="IDC_STATIC_SNMP_TYPE"></nobr> |
|
|
<select name="snmp_type" id="snmp_type" onchange=""> |
|
|
<option value="integer">integer</option> |
|
|
<!--<option value="unsigned integer">unsigned integer</option> |
|
|
<option value="timeticks">timeticks</option> |
|
|
<option value="ipaddress">ipaddress</option> |
|
|
<option value="objid">objid</option>--> |
|
|
<option value="string">string</option> |
|
|
<!--<option value="hex string">hex string</option> |
|
|
<option value="decimal string">decimal string</option> |
|
|
<option value="bits">bits</option> |
|
|
<option value="unsigned int64">unsigned int64</option> |
|
|
<option value="signed int64">signed int64</option> |
|
|
<option value="float">float</option> |
|
|
<option value="double">double</option>--> |
|
|
</select> |
|
|
<nobr id="IDC_STATIC_SNMP_VALUE"></nobr> |
|
|
<input id="snmp_value" type="text" value="" style="width: 330px" /> |
|
|
|
|
|
<input type="button" onclick="window.open('snmptoken.html', '_blank', 'resizable=yes,top=0,left=0,width=450,height=500');" value="?" style="background:#6c87d4;border-color:#6c87d4;color:white" /> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<div align="center"> |
|
|
<input align="center" id="IDOK_SNMP" type="button" value=" Set " onclick="func_setSNMPData()" style="background-color:#6c87d4;color:white;height:36px;width:300px;" /> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<script> |
|
|
/* |
|
|
loadScript("jquery_3_2_1.min.js", function () { |
|
|
loadScript("config.js", function () { |
|
|
loadScript("cookie.min.js", function () { |
|
|
loadScript("lang.js", function () { |
|
|
loadScript("lang_cookie.js", function () { |
|
|
//alert("all load"); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
});*/ |
|
|
|
|
|
function loadScript(url, callback) { |
|
|
var script = document.createElement("Script"); |
|
|
script.type = "text/javascript"; |
|
|
|
|
|
//IE 验证脚本是否下载完成 |
|
|
if (script.readyState) { |
|
|
script.onreadystatechange = function () { |
|
|
//readyState属性有5种取值 |
|
|
//uninitialized:初始状态 |
|
|
//loading:开始下载 |
|
|
//interactive:数据完成下载但尚不可用 |
|
|
//complete:数据已经准备就绪 |
|
|
//实际使用时,readyState的值并不像我们预想的那样有规律,实践发现使用readyState |
|
|
//最靠谱的方式是同时检查以下2个状态,只要其中1个触发,就认为脚本下载完成。 |
|
|
if (script.readyState == "loaded" || script.readyState == "complete") { |
|
|
//移除事件处理器,确保事件不会处理2次 |
|
|
script.onreadystatechange = null; |
|
|
callback(); |
|
|
} |
|
|
}; |
|
|
} |
|
|
|
|
|
//其他浏览器 |
|
|
else { |
|
|
script.onload = function () { |
|
|
callback(); |
|
|
}; |
|
|
} |
|
|
|
|
|
script.src = url; |
|
|
//把新建的<Script>添加到<head>里比添加到<body>里更保险。 |
|
|
document.getElementsByTagName("head")[0].appendChild(script); |
|
|
} |
|
|
|
|
|
func_get_lang_cookie(); |
|
|
document.getElementById("IDC_ENABLE_CHECK_PTZ_START_AUTOTRACKING").innerHTML = IDC_ENABLE_CHECK_PTZ_START_AUTOTRACKING; |
|
|
document.getElementById("IDC_ENABLE_CHECK_PTZ_END_AUTOTRACKING").innerHTML = IDC_ENABLE_CHECK_PTZ_END_AUTOTRACKING; |
|
|
|
|
|
document.getElementById("IDC_ENABLE_HEARTBEAT").innerHTML = IDC_ENABLE_HEARTBEAT; |
|
|
document.getElementById("IDC_DWELL_HEARTBEAT").innerHTML = IDC_DWELL_HEARTBEAT; |
|
|
document.getElementById("IDC_HEARTBEAT_OUTPUT").innerHTML = IDC_HEARTBEAT_OUTPUT; |
|
|
|
|
|
document.getElementById("IDC_ENABLE_SNMP_HEARTBEAT").innerHTML = IDC_ENABLE_HEARTBEAT; |
|
|
document.getElementById("IDC_DWELL_SNMP_HEARTBEAT").innerHTML = IDC_STATIC_NO_PARKING_TIME; |
|
|
document.getElementById("IDC_SNMP_HEARTBEAT_OUTPUT").innerHTML = IDC_HEARTBEAT_OUTPUT; |
|
|
|
|
|
document.getElementById("IDC_CHECK_HTTP_NOTIFICATION").innerHTML = IDC_CHECK_HTTP_NOTIFICATION; |
|
|
document.getElementById("IDC_CHECK_SNMP_NOTIFICATION").innerHTML = IDC_CHECK_SNMP_NOTIFICATION; |
|
|
document.getElementById("IDC_STATIC_POST_EVENTS").innerHTML = IDC_STATIC_POST_EVENTS; |
|
|
document.getElementById("IDC_STATIC_POST_EVENTS_2").innerHTML = IDC_STATIC_POST_EVENTS; |
|
|
document.getElementById("IDC_STATIC_HTTP_PROTOCOL").innerHTML = IDC_STATIC_HTTP_PROTOCOL; |
|
|
document.getElementById("IDC_STATIC_POST_METHOD").innerHTML = IDC_STATIC_POST_METHOD; |
|
|
document.getElementById("IDC_STATIC_POST_EVENT_NAME").innerHTML = IDC_STATIC_POST_EVENT_NAME; |
|
|
document.getElementById("Note_post_event_name").innerHTML = MESSAGE73; |
|
|
document.getElementById("Note_post_user_name_and_password").innerHTML = MESSAGE81; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_HOST_NAME").innerHTML = IDC_STATIC_POST_HOST_NAME; |
|
|
document.getElementById("IDC_STATIC_POST_HOST_PORT").innerHTML = IDC_STATIC_POST_HOST_PORT; |
|
|
document.getElementById("IDC_STATIC_POST_TIMEOUT").innerHTML = IDC_STATIC_POST_TIMEOUT; |
|
|
document.getElementById("IDC_STATIC_POST_URL").innerHTML = IDC_STATIC_POST_URL; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT_TYPE").innerHTML = IDC_STATIC_POST_CONTENT_TYPE; |
|
|
document.getElementById("IDC_STATIC_POST_USER_NAME").innerHTML = IDC_STATIC_POST_USER_NAME; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").innerHTML = IDC_STATIC_POST_PASSWORD; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").innerHTML = IDC_STATIC_POST_CONTENT; |
|
|
|
|
|
document.getElementById("IDC_STATIC_SNMP_EVENT_NAME").innerHTML = IDC_STATIC_SNMP_EVENT_NAME; |
|
|
document.getElementById("IDC_STATIC_SNMP_VERSION").innerHTML = IDC_STATIC_SNMP_VERSION; |
|
|
document.getElementById("IDC_STATIC_SNMP_GROUP_NAME").innerHTML = IDC_STATIC_SNMP_GROUP_NAME; |
|
|
document.getElementById("IDC_STATIC_SNMP_HOST_IP").innerHTML = IDC_STATIC_SNMP_HOST_IP; |
|
|
document.getElementById("IDC_STATIC_SNMP_HOST_PORT").innerHTML = IDC_STATIC_SNMP_HOST_PORT; |
|
|
document.getElementById("IDC_STATIC_SNMP_OID").innerHTML = IDC_STATIC_SNMP_OID; |
|
|
document.getElementById("IDC_STATIC_SNMP_VALUE").innerHTML = IDC_STATIC_SNMP_VALUE; |
|
|
document.getElementById("IDC_STATIC_SNMP_TYPE").innerHTML = IDC_STATIC_SNMP_TYPE; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_SEQUENCE").innerHTML = IDC_STATIC_POST_SEQUENCE; |
|
|
|
|
|
document.getElementById("IDC_STATIC_FILE_FORMAT").innerHTML = IDC_STATIC_FILE_FORMAT; |
|
|
document.getElementById("file_jpeg").innerHTML = file_jpeg; |
|
|
document.getElementById("file_text").innerHTML = file_text; |
|
|
document.getElementById("IDC_STATIC_JPEG_FILE_NAME_FORMAT").innerHTML = IDC_STATIC_JPEG_FILE_NAME_FORMAT; |
|
|
document.getElementById("file_name_fixed").innerHTML = file_name_fixed; |
|
|
document.getElementById("file_name_date").innerHTML = file_name_date; |
|
|
document.getElementById("JPEG_FILE_NAME").innerHTML = JPEG_FILE_NAME; |
|
|
|
|
|
document.getElementById("snmp_event_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("snmp_event_name").readOnly = true; |
|
|
|
|
|
//document.getElementById("IDC_STATIC_NOTE_1").innerHTML = IDC_STATIC_NOTE + " 1"; |
|
|
//document.getElementById("IDC_STATIC_NOTE_2").innerHTML = IDC_STATIC_NOTE + " 2"; |
|
|
|
|
|
$('#IDOK').val(IDOK); |
|
|
$('#IDOK_SNMP').val(IDOK); |
|
|
$('#button_test_current_post').val(IDC_BTN_TAB_TESTING); |
|
|
$('#button_clean').val(IDC_STATIC_CLEAN); |
|
|
|
|
|
$('#button_snmp_current_post').val(IDC_BTN_TAB_TESTING); |
|
|
$('#button_snmp_clean').val(IDC_STATIC_CLEAN); |
|
|
|
|
|
|
|
|
document.getElementById("TITLEBOX_PAGE05").innerHTML = TITLEBOX_PAGE05; |
|
|
document.getElementById("TITLEBOX_PAGE19").innerHTML = TITLEBOX_PAGE19; |
|
|
$('#IDC_STATIC_CREATE_SMARTEVENT_BUTTON').val(IDC_STATIC_CREATE_SMARTEVENT_BUTTON); |
|
|
|
|
|
var message_alert = IDC_STATIC_TEXT_CHANGE_SMART_EVENT; |
|
|
|
|
|
var current_post = "pevents1"; |
|
|
var current_snmp_post = "psnmp1"; |
|
|
var enable_post = "Yes"; |
|
|
var enable_snmp_post = "No"; |
|
|
var enable_heartbeat = "No"; |
|
|
|
|
|
var enable_snmp_heartbeat = "No"; |
|
|
|
|
|
var enable_check_ptz_start_autotracking = "No"; |
|
|
var enable_check_ptz_end_autotracking = "No"; |
|
|
|
|
|
var snmp_heartbeat_dwell = "5"; |
|
|
var snmp_heartbeat_link_to_post_event_name = -1; |
|
|
|
|
|
var heartbeat_dwell = "10"; |
|
|
var heartbeat_link_to_post_event_name = -1; |
|
|
var ptz_start_autotracking_link_to_post_event_name = -1; |
|
|
var ptz_end_autotracking_link_to_post_event_name = -1; |
|
|
|
|
|
var current_verify = "NULL"; |
|
|
var current_snmp_verify = "NULL"; |
|
|
|
|
|
var value_luckalarmui = 300; |
|
|
var MAX_SIZE_POST = 9; |
|
|
|
|
|
var MAX_SIZE_SNMP_POST = 5; |
|
|
|
|
|
var post_protocol = new Array(MAX_SIZE_POST); |
|
|
var post_event_method = new Array(MAX_SIZE_POST); |
|
|
var post_event_name = new Array(MAX_SIZE_POST); |
|
|
var post_host_ip = new Array(MAX_SIZE_POST); |
|
|
var post_host_port = new Array(MAX_SIZE_POST); |
|
|
var post_timeout = new Array(MAX_SIZE_POST); |
|
|
var post_url = new Array(MAX_SIZE_POST); |
|
|
var post_username = new Array(MAX_SIZE_POST); |
|
|
var post_password = new Array(MAX_SIZE_POST); |
|
|
var post_customized_header = new Array(MAX_SIZE_POST); |
|
|
var post_content = new Array(MAX_SIZE_POST); |
|
|
var post_sequence = new Array(MAX_SIZE_POST); |
|
|
var file_format = new Array(MAX_SIZE_POST); |
|
|
var file_format_name = new Array(MAX_SIZE_POST); |
|
|
var file_name = new Array(MAX_SIZE_POST); |
|
|
|
|
|
var snmp_event_name = new Array(MAX_SIZE_POST); |
|
|
var snmp_version = new Array(MAX_SIZE_POST); |
|
|
var snmp_group_name = new Array(MAX_SIZE_POST); |
|
|
var snmp_host_ip = new Array(MAX_SIZE_POST); |
|
|
var snmp_host_port = new Array(MAX_SIZE_POST); |
|
|
var snmp_oid = new Array(MAX_SIZE_POST); |
|
|
var snmp_value = new Array(MAX_SIZE_POST); |
|
|
var snmp_type = new Array(MAX_SIZE_POST); |
|
|
|
|
|
var enable_cloud = "No"; |
|
|
|
|
|
|
|
|
$("#HEARTBEAT_DWELL").slider({ |
|
|
//width: 300, |
|
|
//height: 300, |
|
|
value: 10, |
|
|
mode: 'h',//v,h |
|
|
showTip: true, |
|
|
//将最大最小值对调 |
|
|
// reversed:true, |
|
|
// disabled:true, |
|
|
min: 1, |
|
|
max: 30, |
|
|
// step:2.5, |
|
|
//提示格式函数 |
|
|
tipFormatter: function (value) { |
|
|
// return '['+value+']'; |
|
|
return value; |
|
|
}, |
|
|
onChange: function (newValue, oldValue) { |
|
|
// alert(newValue+" | "+oldValue); |
|
|
}, |
|
|
onSlideStart: function (value) { |
|
|
// alert(value); |
|
|
}, |
|
|
onSlideEnd: function (value) { |
|
|
// alert(value); |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
$("#snmp_heartbeat_dwell").slider({ |
|
|
//width: 300, |
|
|
//height: 300, |
|
|
value: 5, |
|
|
mode: 'h',//v,h |
|
|
showTip: true, |
|
|
//将最大最小值对调 |
|
|
// reversed:true, |
|
|
// disabled:true, |
|
|
min: 0.1, |
|
|
max: 10, |
|
|
step: 0.1, |
|
|
//提示格式函数 |
|
|
tipFormatter: function (value) { |
|
|
// return '['+value+']'; |
|
|
return value; |
|
|
}, |
|
|
onChange: function (newValue, oldValue) { |
|
|
// alert(newValue+" | "+oldValue); |
|
|
}, |
|
|
onSlideStart: function (value) { |
|
|
// alert(value); |
|
|
}, |
|
|
onSlideEnd: function (value) { |
|
|
// alert(value); |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
setInputFilter(document.getElementById("post_host_port"), function (value) { |
|
|
return /^\d*$/.test(value) && (value == "" || (value[0] != '0' && parseInt(value) > 0 && parseInt(value) <= 65535) || value == "0"); |
|
|
}); |
|
|
|
|
|
setInputFilter(document.getElementById("post_timeout"), function (value) { |
|
|
return /^\d*$/.test(value) && (value == "" || (value[0] != '0' && parseInt(value) > 0 && parseInt(value) <= 60) || value == "0"); |
|
|
}); |
|
|
|
|
|
setInputFilter(document.getElementById("snmp_host_port"), function (value) { |
|
|
return /^\d*$/.test(value) && (value == "" || (value[0] != '0' && parseInt(value) > 0 && parseInt(value) <= 65535) || value == "0"); |
|
|
}); |
|
|
|
|
|
func_getCloudData(); |
|
|
|
|
|
|
|
|
function func_get_current_heartbeat() { |
|
|
if ($('#ENABLE_HEARTBEAT').is(":checked")) { |
|
|
enable_heartbeat = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_heartbeat = "No"; |
|
|
} |
|
|
|
|
|
if ($('#enable_snmp_heartbeat').is(":checked")) { |
|
|
enable_snmp_heartbeat = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_snmp_heartbeat = "No"; |
|
|
} |
|
|
|
|
|
|
|
|
if ($('#enable_check_ptz_start_autotracking').is(":checked")) { |
|
|
enable_check_ptz_start_autotracking = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_check_ptz_start_autotracking = "No"; |
|
|
} |
|
|
|
|
|
if ($('#enable_check_ptz_end_autotracking').is(":checked")) { |
|
|
enable_check_ptz_end_autotracking = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_check_ptz_end_autotracking = "No"; |
|
|
} |
|
|
|
|
|
heartbeat_dwell = $('#HEARTBEAT_DWELL').slider('getValue'); |
|
|
heartbeat_link_to_post_event_name = $('#heartbeat_link_to_post_event_name').val(); |
|
|
ptz_start_autotracking_link_to_post_event_name = $('#ptz_start_autotracking_link_to_post_event_name').val(); |
|
|
ptz_end_autotracking_link_to_post_event_name = $('#ptz_end_autotracking_link_to_post_event_name').val(); |
|
|
|
|
|
snmp_heartbeat_dwell = $('#snmp_heartbeat_dwell').slider('getValue'); |
|
|
snmp_heartbeat_link_to_post_event_name = $('#snmp_heartbeat_link_to_post_event_name').val(); |
|
|
} |
|
|
|
|
|
function func_showHeartbeatData() { |
|
|
if (enable_heartbeat === 'Yes') |
|
|
$('#ENABLE_HEARTBEAT').prop("checked", true); |
|
|
else { |
|
|
$('#ENABLE_HEARTBEAT').prop("checked", false); |
|
|
} |
|
|
|
|
|
if (enable_snmp_heartbeat === 'Yes') |
|
|
$('#enable_snmp_heartbeat').prop("checked", true); |
|
|
else { |
|
|
$('#enable_snmp_heartbeat').prop("checked", false); |
|
|
} |
|
|
|
|
|
if (enable_check_ptz_start_autotracking === 'Yes') |
|
|
$('#enable_check_ptz_start_autotracking').prop("checked", true); |
|
|
else { |
|
|
$('#enable_check_ptz_start_autotracking').prop("checked", false); |
|
|
} |
|
|
|
|
|
if (enable_check_ptz_end_autotracking === 'Yes') |
|
|
$('#enable_check_ptz_end_autotracking').prop("checked", true); |
|
|
else { |
|
|
$('#enable_check_ptz_end_autotracking').prop("checked", false); |
|
|
} |
|
|
|
|
|
|
|
|
$('#HEARTBEAT_DWELL').slider('setValue', heartbeat_dwell); |
|
|
|
|
|
$('#snmp_heartbeat_dwell').slider('setValue', snmp_heartbeat_dwell); |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
$('select[id="heartbeat_link_to_post_event_name"] option[value="' + (i).toString() + '"]').text(post_event_name[i]); |
|
|
} |
|
|
$("#heartbeat_link_to_post_event_name").val(heartbeat_link_to_post_event_name); |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) { |
|
|
$('select[id="snmp_heartbeat_link_to_post_event_name"] option[value="' + (i).toString() + '"]').text(snmp_event_name[i]); |
|
|
} |
|
|
$("#snmp_heartbeat_link_to_post_event_name").val(snmp_heartbeat_link_to_post_event_name); |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
$('select[id="ptz_start_autotracking_link_to_post_event_name"] option[value="' + (i).toString() + '"]').text(post_event_name[i]); |
|
|
} |
|
|
$("#ptz_start_autotracking_link_to_post_event_name").val(ptz_start_autotracking_link_to_post_event_name); |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
$('select[id="ptz_end_autotracking_link_to_post_event_name"] option[value="' + (i).toString() + '"]').text(post_event_name[i]); |
|
|
} |
|
|
$("#ptz_end_autotracking_link_to_post_event_name").val(ptz_end_autotracking_link_to_post_event_name); |
|
|
} |
|
|
|
|
|
|
|
|
function func_get_current_post(current_checked_id) { |
|
|
if (current_checked_id === 'li_checked_camera_virtual_input_1') { |
|
|
current_post = "pevents1"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_2') { |
|
|
current_post = "pevents2"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_3') { |
|
|
current_post = "pevents3"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_4') { |
|
|
current_post = "pevents4"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_5') { |
|
|
current_post = "pevents5"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_6') { |
|
|
current_post = "pevents6"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_7') { |
|
|
current_post = "pevents7"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_8') { |
|
|
current_post = "pevents8"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_camera_virtual_input_9') { |
|
|
current_post = "pevents9"; |
|
|
} |
|
|
else { |
|
|
current_post = "pevents1"; |
|
|
} |
|
|
} |
|
|
|
|
|
function func_get_current_snmp_post(current_checked_id) { |
|
|
if (current_checked_id === 'li_checked_snmp_input_1') { |
|
|
current_snmp_post = "psnmp1"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_snmp_input_2') { |
|
|
current_snmp_post = "psnmp2"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_snmp_input_3') { |
|
|
current_snmp_post = "psnmp3"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_snmp_input_4') { |
|
|
current_snmp_post = "psnmp4"; |
|
|
} |
|
|
else if (current_checked_id === 'li_checked_snmp_input_5') { |
|
|
current_snmp_post = "psnmp5"; |
|
|
} |
|
|
else { |
|
|
current_snmp_post = "psnmp1"; |
|
|
} |
|
|
} |
|
|
|
|
|
function func_getCurrentSNMPData() { |
|
|
var index_snmp = 0; |
|
|
if (current_snmp_post == "psnmp1") { |
|
|
index_snmp = 0; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp2") { |
|
|
index_snmp = 1; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp3") { |
|
|
index_snmp = 2; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp4") { |
|
|
index_snmp = 3; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp5") { |
|
|
index_snmp = 4; |
|
|
} |
|
|
|
|
|
if ($('#enable_snmp_post').is(":checked")) { |
|
|
enable_snmp_post = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_snmp_post = "No"; |
|
|
} |
|
|
|
|
|
snmp_event_name[index_snmp] = $('#snmp_event_name').val(); |
|
|
|
|
|
if ($('#snmp_version_v1').is(":checked")) { |
|
|
snmp_version[index_snmp] = "v1"; |
|
|
} |
|
|
else { |
|
|
snmp_version[index_snmp] = "v2c"; |
|
|
} |
|
|
|
|
|
snmp_group_name[index_snmp] = $('#snmp_group_name').val(); |
|
|
snmp_host_ip[index_snmp] = $('#snmp_host_ip').val(); |
|
|
snmp_host_port[index_snmp] = $('#snmp_host_port').val(); |
|
|
snmp_oid[index_snmp] = $('#snmp_oid').val(); |
|
|
snmp_value[index_snmp] = $('#snmp_value').val(); |
|
|
snmp_type[index_snmp] = $('#snmp_type').val(); |
|
|
} |
|
|
|
|
|
function func_getCurrentEventsData() { |
|
|
var index_events = 0; |
|
|
if (current_post == "pevents1") { |
|
|
index_events = 0; |
|
|
} |
|
|
else if (current_post == "pevents2") { |
|
|
index_events = 1; |
|
|
} |
|
|
else if (current_post == "pevents3") { |
|
|
index_events = 2; |
|
|
} |
|
|
else if (current_post == "pevents4") { |
|
|
index_events = 3; |
|
|
} |
|
|
else if (current_post == "pevents5") { |
|
|
index_events = 4; |
|
|
} |
|
|
else if (current_post == "pevents6") { |
|
|
index_events = 5; |
|
|
} |
|
|
else if (current_post == "pevents7") { |
|
|
index_events = 6; |
|
|
} |
|
|
else if (current_post == "pevents8") { |
|
|
index_events = 7; |
|
|
} |
|
|
else if (current_post == "pevents9") { |
|
|
index_events = 8; |
|
|
} |
|
|
|
|
|
if ($('#enable_http_notification').is(":checked")) { |
|
|
enable_post = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_post = "No"; |
|
|
} |
|
|
|
|
|
if ($('#HTTP_PROTOCOL_HTTP').is(":checked")) { |
|
|
post_protocol[index_events] = "HTTP"; |
|
|
} |
|
|
else { |
|
|
post_protocol[index_events] = "HTTPS"; |
|
|
} |
|
|
if ($('#POST_METHOD_GET').is(":checked")) { |
|
|
post_event_method[index_events] = "GET"; |
|
|
} |
|
|
else { |
|
|
post_event_method[index_events] = "POST"; |
|
|
} |
|
|
|
|
|
if ($('#FILE_FORMAT_JPEG').is(":checked")) { |
|
|
file_format[index_events] = "jpeg"; |
|
|
} |
|
|
else { |
|
|
file_format[index_events] = "text"; |
|
|
} |
|
|
|
|
|
if ($('#FILE_FORMAT_NAME_FIXED').is(":checked")) { |
|
|
file_format_name[index_events] = "fixed"; |
|
|
} |
|
|
else { |
|
|
file_format_name[index_events] = "date"; |
|
|
} |
|
|
|
|
|
post_sequence[index_events] = $('#post_sequence').val(); |
|
|
post_event_name[index_events] = $('#post_event_name').val(); |
|
|
post_host_ip[index_events] = $('#post_host_name').val(); |
|
|
post_host_port[index_events] = $('#post_host_port').val(); |
|
|
post_timeout[index_events] = $('#post_timeout').val(); |
|
|
post_url[index_events] = $('#post_url').val(); |
|
|
post_username[index_events] = $('#post_user_name').val(); |
|
|
post_password[index_events] = $('#post_password').val(); |
|
|
|
|
|
post_customized_header[index_events] = $('#customized_http_header').val(); |
|
|
if (post_customized_header[index_events] == ";") { |
|
|
post_customized_header[index_events] = ""; |
|
|
} |
|
|
//post_customized_header = replace(post_customized_header, " ", Server.HtmlEncode(" ")); |
|
|
|
|
|
post_content[index_events] = $('#post_content').val(); |
|
|
if (post_content[index_events] == ";") { |
|
|
post_content[index_events] = ""; |
|
|
} |
|
|
|
|
|
file_name[index_events] = $('#file_name').val(); |
|
|
|
|
|
//post_content = replace(post_content, vbCrLf, "<br>"); |
|
|
} |
|
|
|
|
|
|
|
|
function func_setEventsData() { |
|
|
k_index = 0; |
|
|
makeProgress(); |
|
|
|
|
|
} |
|
|
|
|
|
function func_setSNMPData() { |
|
|
k_index = 0; |
|
|
makeProgress_SNMP(); |
|
|
} |
|
|
|
|
|
function func_setSmartEvent_EnableMotion() { |
|
|
func_set_ipcam_smartevent("event0000", "1"); |
|
|
func_set_ipcam_smartevent("name0000", "Test"); |
|
|
|
|
|
func_set_ipcam_smartevent("c_name00000000", "Test_CN1"); |
|
|
func_set_ipcam_smartevent("c_time00000000", "1,1500,0,0,1"); |
|
|
func_set_ipcam_smartevent("c_trigger00000000", "motion/0/0/0/1/1"); |
|
|
func_set_ipcam_smartevent("c_schedule00000000", "0,7/0/86400,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,"); |
|
|
func_set_ipcam_smartevent("c_action00000000", "do/0/1000/active/0/0/0,"); |
|
|
|
|
|
parent.window.location.reload(); |
|
|
} |
|
|
|
|
|
function func_setSmartEvent_DisableMotion() { |
|
|
func_set_ipcam_smartevent("event0000", "0"); |
|
|
|
|
|
parent.window.location.reload(); |
|
|
} |
|
|
var g_setSmartEvent = 0; |
|
|
function func_setSmartEvent() { |
|
|
var r = confirm(message_alert); |
|
|
if (r == true) { |
|
|
k_index = 0; |
|
|
g_setSmartEvent = 1; |
|
|
makeProgress(); |
|
|
//makeProgress2(); |
|
|
} else { |
|
|
|
|
|
} |
|
|
} |
|
|
//setsmartevent?event.name0000=hello |
|
|
//"/setsmartevent?event." + name_ + "=" + value_ |
|
|
function func_set_ipcam_smartevent(name_, value_) { |
|
|
$.ajax({ |
|
|
url: "/setsmartevent?event." + name_ + "=" + value_, |
|
|
method: "GET", |
|
|
async: true, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function () { |
|
|
//alert("Success to create smart event."); |
|
|
//console.info(); |
|
|
}, |
|
|
error: function () { |
|
|
//alert("[Error]create error event."); |
|
|
console.warn(); |
|
|
} |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function waitSeconds(iMilliSeconds) { |
|
|
|
|
|
var counter = 0 |
|
|
|
|
|
, start = new Date().getTime() |
|
|
|
|
|
, end = 0; |
|
|
|
|
|
while (counter < iMilliSeconds) { |
|
|
|
|
|
end = new Date().getTime(); |
|
|
|
|
|
counter = end - start; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
function func_seteventsfile(json_data) { |
|
|
$.ajax({ |
|
|
url: "/seteventsfile", |
|
|
method: "POST", |
|
|
async: false, |
|
|
data: json_data, |
|
|
contentType: false, |
|
|
processData: false, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function () { |
|
|
//console.info(); |
|
|
}, |
|
|
error: function () { |
|
|
console.warn(); |
|
|
|
|
|
k_index++; |
|
|
|
|
|
if (k_index <= 94) { |
|
|
|
|
|
waitSeconds(500); |
|
|
func_seteventsfile(json_data); |
|
|
} |
|
|
} |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function func_set_http_post_events(name_, value_, event_id) { |
|
|
$.ajax({ |
|
|
url: "/setevents?ch=all&http_post_events=" + event_id + "&" + name_ + "=" + value_, |
|
|
method: "GET", |
|
|
async: false, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function () { |
|
|
//console.info(); |
|
|
}, |
|
|
error: function () { |
|
|
console.warn(); |
|
|
} |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function func_setelement(name_, value_) { |
|
|
$.ajax({ |
|
|
url: "/setevents?ch=all&" + name_ + "=" + value_, |
|
|
method: "GET", |
|
|
async: false, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function () { |
|
|
//console.info(); |
|
|
}, |
|
|
error: function () { |
|
|
console.warn(); |
|
|
} |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
|
|
|
function func_storeEventsData() { |
|
|
var index_events = 0; |
|
|
if (current_post == "pevents1") { |
|
|
index_events = 0; |
|
|
} |
|
|
else if (current_post == "pevents2") { |
|
|
index_events = 1; |
|
|
} |
|
|
else if (current_post == "pevents3") { |
|
|
index_events = 2; |
|
|
} |
|
|
else if (current_post == "pevents4") { |
|
|
index_events = 3; |
|
|
} |
|
|
else if (current_post == "pevents5") { |
|
|
index_events = 4; |
|
|
} |
|
|
else if (current_post == "pevents6") { |
|
|
index_events = 5; |
|
|
} |
|
|
else if (current_post == "pevents7") { |
|
|
index_events = 6; |
|
|
} |
|
|
else if (current_post == "pevents8") { |
|
|
index_events = 7; |
|
|
} |
|
|
else if (current_post == "pevents9") { |
|
|
index_events = 8; |
|
|
} |
|
|
|
|
|
if ($('#enable_http_notification').is(":checked")) { |
|
|
enable_post = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_post = "No"; |
|
|
} |
|
|
|
|
|
if ($('#enable_snmp_post').is(":checked")) { |
|
|
enable_snmp_post = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_snmp_post = "No"; |
|
|
} |
|
|
|
|
|
if ($('#HTTP_PROTOCOL_HTTP').is(":checked")) { |
|
|
post_protocol[index_events] = "HTTP"; |
|
|
} |
|
|
else { |
|
|
post_protocol[index_events] = "HTTPS"; |
|
|
} |
|
|
|
|
|
if ($('#POST_METHOD_GET').is(":checked")) { |
|
|
post_event_method[index_events] = "GET"; |
|
|
} |
|
|
else { |
|
|
post_event_method[index_events] = "POST"; |
|
|
} |
|
|
|
|
|
if ($('#FILE_FORMAT_JPEG').is(":checked")) { |
|
|
file_format[index_events] = "jpeg"; |
|
|
} |
|
|
else { |
|
|
file_format[index_events] = "text"; |
|
|
} |
|
|
|
|
|
if ($('#FILE_FORMAT_NAME_FIXED').is(":checked")) { |
|
|
file_format_name[index_events] = "fixed"; |
|
|
} |
|
|
else { |
|
|
file_format_name[index_events] = "date"; |
|
|
} |
|
|
|
|
|
post_sequence[index_events] = $('#post_sequence').val(); |
|
|
|
|
|
post_event_name[index_events] = $('#post_event_name').val(); |
|
|
post_host_ip[index_events] = $('#post_host_name').val(); |
|
|
post_host_port[index_events] = $('#post_host_port').val(); |
|
|
post_timeout[index_events] = $('#post_timeout').val(); |
|
|
post_url[index_events] = $('#post_url').val(); |
|
|
post_username[index_events] = $('#post_user_name').val(); |
|
|
post_password[index_events] = $('#post_password').val(); |
|
|
post_customized_header[index_events] = $('#customized_http_header').val(); |
|
|
post_content[index_events] = $('#post_content').val(); |
|
|
|
|
|
file_name[index_events] = $('#file_name').val(); |
|
|
} |
|
|
|
|
|
function func_storeSNMPData() { |
|
|
var index_snmp = 0; |
|
|
if (current_snmp_post == "psnmp1") { |
|
|
index_snmp = 0; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp2") { |
|
|
index_snmp = 1; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp3") { |
|
|
index_snmp = 2; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp4") { |
|
|
index_snmp = 3; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp5") { |
|
|
index_snmp = 4; |
|
|
} |
|
|
|
|
|
if ($('#enable_snmp_post').is(":checked")) { |
|
|
enable_snmp_post = "Yes"; |
|
|
} |
|
|
else { |
|
|
enable_snmp_post = "No"; |
|
|
} |
|
|
|
|
|
|
|
|
snmp_event_name[index_snmp] = $('#snmp_event_name').val(); |
|
|
|
|
|
if ($('#snmp_version_v1').is(":checked")) { |
|
|
snmp_version[index_snmp] = "v1"; |
|
|
} |
|
|
else { |
|
|
snmp_version[index_snmp] = "v2c"; |
|
|
} |
|
|
|
|
|
snmp_group_name[index_snmp] = $('#snmp_group_name').val(); |
|
|
snmp_host_ip[index_snmp] = $('#snmp_host_ip').val(); |
|
|
snmp_host_port[index_snmp] = $('#snmp_host_port').val(); |
|
|
snmp_oid[index_snmp] = $('#snmp_oid').val(); |
|
|
snmp_value[index_snmp] = $('#snmp_value').val(); |
|
|
snmp_type[index_snmp] = $('#snmp_type').val(); |
|
|
} |
|
|
|
|
|
function func_showSNMPData() { |
|
|
var index_snmp = 0; |
|
|
if (current_snmp_post == "psnmp1") { |
|
|
index_snmp = 0; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp2") { |
|
|
index_snmp = 1; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp3") { |
|
|
index_snmp = 2; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp4") { |
|
|
index_snmp = 3; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp5") { |
|
|
index_snmp = 4; |
|
|
} |
|
|
|
|
|
if (enable_snmp_post === 'Yes') |
|
|
$('#enable_snmp_post').prop("checked", true); |
|
|
else { |
|
|
$('#enable_snmp_post').prop("checked", false); |
|
|
} |
|
|
|
|
|
$('#snmp_event_name').val(snmp_event_name[index_snmp]); |
|
|
|
|
|
if (snmp_version[index_snmp] === "v1") { |
|
|
$('#snmp_version_v1').prop("checked", true); |
|
|
$('#snmp_version_v2c').prop("checked", false); |
|
|
} |
|
|
else { |
|
|
$('#snmp_version_v1').prop("checked", false); |
|
|
$('#snmp_version_v2c').prop("checked", true); |
|
|
} |
|
|
|
|
|
$('#snmp_group_name').val(snmp_group_name[index_snmp]); |
|
|
$('#snmp_host_ip').val(snmp_host_ip[index_snmp]); |
|
|
$('#snmp_host_port').val(snmp_host_port[index_snmp]); |
|
|
$('#snmp_oid').val(snmp_oid[index_snmp]); |
|
|
$('#snmp_value').val(snmp_value[index_snmp]); |
|
|
$('#snmp_type').val(snmp_type[index_snmp]); |
|
|
|
|
|
document.getElementById("checked_snmp_input_1_text").innerHTML = snmp_event_name[0]; |
|
|
document.getElementById("checked_snmp_input_2_text").innerHTML = snmp_event_name[1]; |
|
|
document.getElementById("checked_snmp_input_3_text").innerHTML = snmp_event_name[2]; |
|
|
document.getElementById("checked_snmp_input_4_text").innerHTML = snmp_event_name[3]; |
|
|
document.getElementById("checked_snmp_input_5_text").innerHTML = snmp_event_name[4]; |
|
|
|
|
|
if (localStorage.getItem('check_PTZ') == 1) { |
|
|
|
|
|
} |
|
|
else { |
|
|
document.getElementById("ptz_autotracking_border").style.display = "none"; |
|
|
} |
|
|
|
|
|
//if (enable_cloud == "Yes") { |
|
|
//document.getElementById("SNMP_border").style.display = "block"; |
|
|
//document.getElementById("IDOK_SNMP").style.display = "block"; |
|
|
//} |
|
|
//else { |
|
|
//document.getElementById("SNMP_border").style.display = "none"; |
|
|
//document.getElementById("IDOK_SNMP").style.display = "none"; |
|
|
//} |
|
|
} |
|
|
|
|
|
function func_showEventsData() { |
|
|
var index_events = 0; |
|
|
if (current_post == "pevents1") { |
|
|
index_events = 0; |
|
|
document.getElementById("post_password").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "hidden"; |
|
|
document.getElementById("customized_http_header").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "hidden"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "hidden"; |
|
|
document.getElementById("text_https").style.visibility = "hidden"; |
|
|
document.getElementById("post_content").style.visibility = "hidden"; |
|
|
document.getElementById("help_posttoken").style.visibility = "hidden"; |
|
|
document.getElementById("post_user_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_user_name").readOnly = true; |
|
|
document.getElementById("post_host_port").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_port").readOnly = true; |
|
|
document.getElementById("post_timeout").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_timeout").readOnly = true; |
|
|
document.getElementById("post_host_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_name").readOnly = true; |
|
|
document.getElementById("post_event_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_event_name").readOnly = true; |
|
|
|
|
|
} |
|
|
else if (current_post == "pevents2") { |
|
|
index_events = 1; |
|
|
document.getElementById("post_password").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "hidden"; |
|
|
document.getElementById("customized_http_header").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "hidden"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "hidden"; |
|
|
document.getElementById("text_https").style.visibility = "hidden"; |
|
|
document.getElementById("post_content").style.visibility = "hidden"; |
|
|
document.getElementById("help_posttoken").style.visibility = "hidden"; |
|
|
document.getElementById("post_user_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_user_name").readOnly = true; |
|
|
document.getElementById("post_host_port").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_port").readOnly = true; |
|
|
document.getElementById("post_timeout").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_timeout").readOnly = true; |
|
|
document.getElementById("post_host_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_name").readOnly = true; |
|
|
document.getElementById("post_event_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_event_name").readOnly = true; |
|
|
|
|
|
} |
|
|
else if (current_post == "pevents3") { |
|
|
index_events = 2; |
|
|
document.getElementById("post_password").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "hidden"; |
|
|
document.getElementById("customized_http_header").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "hidden"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "hidden"; |
|
|
document.getElementById("text_https").style.visibility = "hidden"; |
|
|
document.getElementById("post_content").style.visibility = "hidden"; |
|
|
document.getElementById("help_posttoken").style.visibility = "hidden"; |
|
|
document.getElementById("post_user_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_user_name").readOnly = true; |
|
|
document.getElementById("post_host_port").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_port").readOnly = true; |
|
|
document.getElementById("post_timeout").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_timeout").readOnly = true; |
|
|
document.getElementById("post_host_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_name").readOnly = true; |
|
|
document.getElementById("post_event_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_event_name").readOnly = true; |
|
|
|
|
|
} |
|
|
else if (current_post == "pevents4") { |
|
|
index_events = 3; |
|
|
document.getElementById("post_password").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "hidden"; |
|
|
document.getElementById("customized_http_header").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "hidden"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "hidden"; |
|
|
document.getElementById("text_https").style.visibility = "hidden"; |
|
|
document.getElementById("post_content").style.visibility = "hidden"; |
|
|
document.getElementById("help_posttoken").style.visibility = "hidden"; |
|
|
document.getElementById("post_user_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_user_name").readOnly = true; |
|
|
document.getElementById("post_host_port").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_port").readOnly = true; |
|
|
document.getElementById("post_timeout").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_timeout").readOnly = true; |
|
|
document.getElementById("post_host_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_host_name").readOnly = true; |
|
|
document.getElementById("post_event_name").style.background = "#F3F1F1"; |
|
|
document.getElementById("post_event_name").readOnly = true; |
|
|
|
|
|
} |
|
|
else if (current_post == "pevents5") { |
|
|
index_events = 4; |
|
|
document.getElementById("post_password").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "visible"; |
|
|
document.getElementById("customized_http_header").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "visible"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "visible"; |
|
|
document.getElementById("text_https").style.visibility = "visible"; |
|
|
document.getElementById("post_content").style.visibility = "visible"; |
|
|
document.getElementById("help_posttoken").style.visibility = "visible"; |
|
|
document.getElementById("post_user_name").style.background = ""; |
|
|
document.getElementById("post_user_name").readOnly = false; |
|
|
document.getElementById("post_host_port").style.background = ""; |
|
|
document.getElementById("post_host_port").readOnly = false; |
|
|
document.getElementById("post_timeout").style.background = ""; |
|
|
document.getElementById("post_timeout").readOnly = false; |
|
|
document.getElementById("post_host_name").style.background = ""; |
|
|
document.getElementById("post_host_name").readOnly = false; |
|
|
document.getElementById("post_event_name").style.background = ""; |
|
|
document.getElementById("post_event_name").readOnly = false; |
|
|
|
|
|
} |
|
|
else if (current_post == "pevents6") { |
|
|
index_events = 5; |
|
|
document.getElementById("post_password").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "visible"; |
|
|
document.getElementById("customized_http_header").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "visible"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "visible"; |
|
|
document.getElementById("text_https").style.visibility = "visible"; |
|
|
document.getElementById("post_content").style.visibility = "visible"; |
|
|
document.getElementById("help_posttoken").style.visibility = "visible"; |
|
|
document.getElementById("post_user_name").style.background = ""; |
|
|
document.getElementById("post_user_name").readOnly = false; |
|
|
document.getElementById("post_host_port").style.background = ""; |
|
|
document.getElementById("post_host_port").readOnly = false; |
|
|
document.getElementById("post_timeout").style.background = ""; |
|
|
document.getElementById("post_timeout").readOnly = false; |
|
|
document.getElementById("post_host_name").style.background = ""; |
|
|
document.getElementById("post_host_name").readOnly = false; |
|
|
document.getElementById("post_event_name").style.background = ""; |
|
|
document.getElementById("post_event_name").readOnly = false; |
|
|
|
|
|
} |
|
|
else if (current_post == "pevents7") { |
|
|
index_events = 6; |
|
|
document.getElementById("post_password").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "visible"; |
|
|
document.getElementById("customized_http_header").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "visible"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "visible"; |
|
|
document.getElementById("text_https").style.visibility = "visible"; |
|
|
document.getElementById("post_content").style.visibility = "visible"; |
|
|
document.getElementById("help_posttoken").style.visibility = "visible"; |
|
|
document.getElementById("post_user_name").style.background = ""; |
|
|
document.getElementById("post_user_name").readOnly = false; |
|
|
document.getElementById("post_host_port").style.background = ""; |
|
|
document.getElementById("post_host_port").readOnly = false; |
|
|
document.getElementById("post_timeout").style.background = ""; |
|
|
document.getElementById("post_timeout").readOnly = false; |
|
|
document.getElementById("post_host_name").style.background = ""; |
|
|
document.getElementById("post_host_name").readOnly = false; |
|
|
document.getElementById("post_event_name").style.background = ""; |
|
|
document.getElementById("post_event_name").readOnly = false; |
|
|
} |
|
|
else if (current_post == "pevents8") { |
|
|
index_events = 7; |
|
|
document.getElementById("post_password").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "visible"; |
|
|
document.getElementById("customized_http_header").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "visible"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "visible"; |
|
|
document.getElementById("text_https").style.visibility = "visible"; |
|
|
document.getElementById("post_content").style.visibility = "visible"; |
|
|
document.getElementById("help_posttoken").style.visibility = "visible"; |
|
|
document.getElementById("post_user_name").style.background = ""; |
|
|
document.getElementById("post_user_name").readOnly = false; |
|
|
document.getElementById("post_host_port").style.background = ""; |
|
|
document.getElementById("post_host_port").readOnly = false; |
|
|
document.getElementById("post_timeout").style.background = ""; |
|
|
document.getElementById("post_timeout").readOnly = false; |
|
|
document.getElementById("post_host_name").style.background = ""; |
|
|
document.getElementById("post_host_name").readOnly = false; |
|
|
document.getElementById("post_event_name").style.background = ""; |
|
|
document.getElementById("post_event_name").readOnly = false; |
|
|
} |
|
|
else if (current_post == "pevents9") { |
|
|
index_events = 8; |
|
|
document.getElementById("post_password").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_CUSTOMIZED_HTTP_HEADER").style.visibility = "visible"; |
|
|
document.getElementById("customized_http_header").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "visible"; |
|
|
document.getElementById("HTTP_PROTOCOL_HTTPS").style.visibility = "visible"; |
|
|
document.getElementById("text_https").style.visibility = "visible"; |
|
|
document.getElementById("post_content").style.visibility = "visible"; |
|
|
document.getElementById("help_posttoken").style.visibility = "visible"; |
|
|
document.getElementById("post_user_name").style.background = ""; |
|
|
document.getElementById("post_user_name").readOnly = false; |
|
|
document.getElementById("post_host_port").style.background = ""; |
|
|
document.getElementById("post_host_port").readOnly = false; |
|
|
document.getElementById("post_timeout").style.background = ""; |
|
|
document.getElementById("post_timeout").readOnly = false; |
|
|
document.getElementById("post_host_name").style.background = ""; |
|
|
document.getElementById("post_host_name").readOnly = false; |
|
|
document.getElementById("post_event_name").style.background = ""; |
|
|
document.getElementById("post_event_name").readOnly = false; |
|
|
} |
|
|
|
|
|
if (enable_post === 'Yes') |
|
|
$('#enable_http_notification').prop("checked", true); |
|
|
else { |
|
|
$('#enable_http_notification').prop("checked", false); |
|
|
} |
|
|
|
|
|
if (post_protocol[index_events] === "HTTP") { |
|
|
$('#HTTP_PROTOCOL_HTTP').prop("checked", true); |
|
|
$('#HTTP_PROTOCOL_HTTPS').prop("checked", false); |
|
|
} |
|
|
else { |
|
|
$('#HTTP_PROTOCOL_HTTP').prop("checked", false); |
|
|
$('#HTTP_PROTOCOL_HTTPS').prop("checked", true); |
|
|
} |
|
|
|
|
|
if (file_format[index_events] === "jpeg") { |
|
|
$('#FILE_FORMAT_JPEG').prop("checked", true); |
|
|
$('#FILE_FORMAT_TEXT').prop("checked", false); |
|
|
} |
|
|
else { |
|
|
$('#FILE_FORMAT_JPEG').prop("checked", false); |
|
|
$('#FILE_FORMAT_TEXT').prop("checked", true); |
|
|
} |
|
|
|
|
|
if (file_format_name[index_events] === "fixed") { |
|
|
$('#FILE_FORMAT_NAME_FIXED').prop("checked", true); |
|
|
$('#FILE_FORMAT_NAME_DATE').prop("checked", false); |
|
|
} |
|
|
else { |
|
|
$('#FILE_FORMAT_NAME_FIXED').prop("checked", false); |
|
|
$('#FILE_FORMAT_NAME_DATE').prop("checked", true); |
|
|
} |
|
|
|
|
|
if (post_event_method[index_events] === "GET") { |
|
|
$('#POST_METHOD_GET').prop("checked", true); |
|
|
$('#POST_METHOD_POST').prop("checked", false); |
|
|
|
|
|
document.getElementById("IDC_STATIC_FILE_FORMAT").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_JPEG").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_TEXT").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_JPEG_FILE_NAME_FORMAT").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_NAME_FIXED").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_NAME_DATE").style.visibility = "hidden"; |
|
|
document.getElementById("JPEG_FILE_NAME").style.visibility = "hidden"; |
|
|
document.getElementById("file_name").style.visibility = "hidden"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_SEQUENCE").style.visibility = "hidden"; |
|
|
document.getElementById("post_sequence").style.visibility = "hidden"; |
|
|
|
|
|
document.getElementById("file_jpeg").style.visibility = "hidden"; |
|
|
document.getElementById("file_text").style.visibility = "hidden"; |
|
|
document.getElementById("file_name_fixed").style.visibility = "hidden"; |
|
|
document.getElementById("file_name_date").style.visibility = "hidden"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "hidden"; |
|
|
document.getElementById("help_posttoken").style.visibility = "hidden"; |
|
|
document.getElementById("post_content").style.visibility = "hidden"; |
|
|
} |
|
|
else { |
|
|
$('#POST_METHOD_GET').prop("checked", false); |
|
|
$('#POST_METHOD_POST').prop("checked", true); |
|
|
|
|
|
document.getElementById("IDC_STATIC_FILE_FORMAT").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_JPEG").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_TEXT").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_JPEG_FILE_NAME_FORMAT").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_NAME_FIXED").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_NAME_DATE").style.visibility = "visible"; |
|
|
document.getElementById("JPEG_FILE_NAME").style.visibility = "visible"; |
|
|
document.getElementById("file_name").style.visibility = "visible"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_SEQUENCE").style.visibility = "visible"; |
|
|
document.getElementById("post_sequence").style.visibility = "visible"; |
|
|
|
|
|
document.getElementById("file_jpeg").style.visibility = "visible"; |
|
|
document.getElementById("file_text").style.visibility = "visible"; |
|
|
document.getElementById("file_name_fixed").style.visibility = "visible"; |
|
|
document.getElementById("file_name_date").style.visibility = "visible"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "visible"; |
|
|
document.getElementById("help_posttoken").style.visibility = "visible"; |
|
|
document.getElementById("post_content").style.visibility = "visibles"; |
|
|
} |
|
|
|
|
|
if (index_events <= 3) { |
|
|
document.getElementById("POST_METHOD_POST").style.visibility = "hidden"; |
|
|
document.getElementById("text_post").style.visibility = "hidden"; |
|
|
//document.getElementById("POST_METHOD_POST").style.visibility = "visible"; |
|
|
//document.getElementById("text_post").style.visibility = "visible"; |
|
|
} |
|
|
else { |
|
|
document.getElementById("POST_METHOD_POST").style.visibility = "visible"; |
|
|
document.getElementById("text_post").style.visibility = "visible"; |
|
|
} |
|
|
|
|
|
$('#post_event_name').val(post_event_name[index_events]); |
|
|
$('#post_host_name').val(post_host_ip[index_events]); |
|
|
$('#post_host_port').val(post_host_port[index_events]); |
|
|
$('#post_timeout').val(post_timeout[index_events]); |
|
|
$('#post_url').val(post_url[index_events]); |
|
|
$('#post_user_name').val(post_username[index_events]); |
|
|
$('#post_password').val(post_password[index_events]); |
|
|
|
|
|
if (post_sequence[index_events].length == 0) { |
|
|
post_sequence[index_events] = "NULL"; |
|
|
} |
|
|
$('#post_sequence').val(post_sequence[index_events]); |
|
|
$('#file_name').val(file_name[index_events]); |
|
|
|
|
|
if (post_customized_header[index_events] == ";") { |
|
|
$('#customized_http_header').val(""); |
|
|
} |
|
|
else { |
|
|
$('#customized_http_header').val(post_customized_header[index_events]); |
|
|
} |
|
|
if (post_content[index_events] == ";") { |
|
|
$('#post_content').val(""); |
|
|
} |
|
|
else { |
|
|
$('#post_content').val(post_content[index_events]); |
|
|
} |
|
|
|
|
|
document.getElementById("checked_camera_virtual_input_1_text").innerHTML = post_event_name[0]; |
|
|
document.getElementById("checked_camera_virtual_input_2_text").innerHTML = post_event_name[1]; |
|
|
document.getElementById("checked_camera_virtual_input_3_text").innerHTML = post_event_name[2]; |
|
|
document.getElementById("checked_camera_virtual_input_4_text").innerHTML = post_event_name[3]; |
|
|
document.getElementById("checked_camera_virtual_input_5_text").innerHTML = post_event_name[4]; |
|
|
document.getElementById("checked_camera_virtual_input_6_text").innerHTML = post_event_name[5]; |
|
|
document.getElementById("checked_camera_virtual_input_7_text").innerHTML = post_event_name[6]; |
|
|
document.getElementById("checked_camera_virtual_input_8_text").innerHTML = post_event_name[7]; |
|
|
document.getElementById("checked_camera_virtual_input_9_text").innerHTML = post_event_name[8]; |
|
|
} |
|
|
|
|
|
function check_if_post_password_is_all_the_star(post_pass_temp) { |
|
|
for (var i = 0; i < post_pass_temp.length; i++) { |
|
|
if (post_pass_temp[i] == '*') { } |
|
|
else |
|
|
return 0; |
|
|
} |
|
|
return 1; |
|
|
} |
|
|
|
|
|
function validatingJSON(json) { |
|
|
|
|
|
var checkedjson; |
|
|
try { |
|
|
checkedjson = JSON.parse(json); //JSON parse only for try catch |
|
|
//console.log("json OK"); |
|
|
//console.log(json); |
|
|
} catch (e) { |
|
|
checkedjson = null; |
|
|
console.log(e);//the character would be drop sometimes, for example the label "class_id" may be "clas_id". |
|
|
//console.log(json); |
|
|
} |
|
|
return checkedjson; |
|
|
} |
|
|
|
|
|
function func_clean_test_result() { |
|
|
$('#test_result').val(""); |
|
|
current_verify = "clean"; |
|
|
change_color_of_button_verify(); |
|
|
} |
|
|
|
|
|
function func_clean_snmp_result() { |
|
|
$('#snmp_result').val(""); |
|
|
current_snmp_verify = "clean"; |
|
|
change_color_of_button_verify_snmp(); |
|
|
} |
|
|
|
|
|
function func_Test_Current_Post() { |
|
|
var index_events = 0; |
|
|
if (current_post == "pevents1") { |
|
|
index_events = 0; |
|
|
} |
|
|
else if (current_post == "pevents2") { |
|
|
index_events = 1; |
|
|
} |
|
|
else if (current_post == "pevents3") { |
|
|
index_events = 2; |
|
|
} |
|
|
else if (current_post == "pevents4") { |
|
|
index_events = 3; |
|
|
} |
|
|
else if (current_post == "pevents5") { |
|
|
index_events = 4; |
|
|
} |
|
|
else if (current_post == "pevents6") { |
|
|
index_events = 5; |
|
|
} |
|
|
else if (current_post == "pevents7") { |
|
|
index_events = 6; |
|
|
} |
|
|
else if (current_post == "pevents8") { |
|
|
index_events = 7; |
|
|
} |
|
|
else if (current_post == "pevents9") { |
|
|
index_events = 8; |
|
|
} |
|
|
func_getCurrentPostRequestResponse(index_events); |
|
|
current_verify = "verify"; |
|
|
change_color_of_button_verify(); |
|
|
} |
|
|
|
|
|
function func_SNMP_Current_Post() { |
|
|
var index_snmp = 0; |
|
|
if (current_snmp_post == "psnmp1") { |
|
|
index_snmp = 0; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp2") { |
|
|
index_snmp = 1; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp3") { |
|
|
index_snmp = 2; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp4") { |
|
|
index_snmp = 3; |
|
|
} |
|
|
else if (current_snmp_post == "psnmp5") { |
|
|
index_snmp = 4; |
|
|
} |
|
|
|
|
|
func_getCurrentPostRequestResponse_snmp(index_snmp); |
|
|
current_snmp_verify = "verify"; |
|
|
change_color_of_button_verify_snmp(); |
|
|
} |
|
|
|
|
|
function change_color_of_button_verify() { |
|
|
if (current_verify === "verify") { |
|
|
document.getElementById("button_test_current_post").style.background = "#6c87d4"; |
|
|
document.getElementById("button_clean").style.background = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_test_current_post").style.borderColor = "#6c87d4"; |
|
|
document.getElementById("button_clean").style.borderColor = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_test_current_post").style.color = "white"; |
|
|
document.getElementById("button_clean").style.color = "black"; |
|
|
} |
|
|
else if (current_verify === "clean") { |
|
|
document.getElementById("button_test_current_post").style.background = "#BABABA"; |
|
|
document.getElementById("button_clean").style.background = "#6c87d4"; |
|
|
|
|
|
document.getElementById("button_test_current_post").style.borderColor = "#BABABA"; |
|
|
document.getElementById("button_clean").style.borderColor = "#6c87d4"; |
|
|
|
|
|
document.getElementById("button_test_current_post").style.color = "black"; |
|
|
document.getElementById("button_clean").style.color = "white"; |
|
|
} |
|
|
else { |
|
|
document.getElementById("button_test_current_post").style.background = "#BABABA"; |
|
|
document.getElementById("button_clean").style.background = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_test_current_post").style.borderColor = "#BABABA"; |
|
|
document.getElementById("button_clean").style.borderColor = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_test_current_post").style.color = "black"; |
|
|
document.getElementById("button_clean").style.color = "black"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function change_color_of_button_verify_snmp() { |
|
|
if (current_snmp_verify === "verify") { |
|
|
document.getElementById("button_snmp_current_post").style.background = "#6c87d4"; |
|
|
document.getElementById("button_snmp_clean").style.background = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_snmp_current_post").style.borderColor = "#6c87d4"; |
|
|
document.getElementById("button_snmp_clean").style.borderColor = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_snmp_current_post").style.color = "white"; |
|
|
document.getElementById("button_snmp_clean").style.color = "black"; |
|
|
} |
|
|
else if (current_snmp_verify === "clean") { |
|
|
document.getElementById("button_snmp_current_post").style.background = "#BABABA"; |
|
|
document.getElementById("button_snmp_clean").style.background = "#6c87d4"; |
|
|
|
|
|
document.getElementById("button_snmp_current_post").style.borderColor = "#BABABA"; |
|
|
document.getElementById("button_snmp_clean").style.borderColor = "#6c87d4"; |
|
|
|
|
|
document.getElementById("button_snmp_current_post").style.color = "black"; |
|
|
document.getElementById("button_snmp_clean").style.color = "white"; |
|
|
} |
|
|
else { |
|
|
document.getElementById("button_snmp_current_post").style.background = "#BABABA"; |
|
|
document.getElementById("button_snmp_clean").style.background = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_snmp_current_post").style.borderColor = "#BABABA"; |
|
|
document.getElementById("button_snmp_clean").style.borderColor = "#BABABA"; |
|
|
|
|
|
document.getElementById("button_snmp_current_post").style.color = "black"; |
|
|
document.getElementById("button_snmp_clean").style.color = "black"; |
|
|
} |
|
|
} |
|
|
|
|
|
function func_getCurrentPostRequestResponse(index_post) { |
|
|
$.ajax({ |
|
|
url: "/do_a_test_to_post&index=" + index_post.toString(), |
|
|
type: "GET", |
|
|
async: false, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function (retdata) { |
|
|
//console.log(retdata); |
|
|
$('#test_result').val(retdata); |
|
|
}, |
|
|
error: function (retdata) { |
|
|
console.warn(retdata); |
|
|
$('#test_result').val("Testing Error."); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
function func_getCurrentPostRequestResponse_snmp(index_post) { |
|
|
$.ajax({ |
|
|
url: "/do_a_snmp_to_post&index=" + index_post.toString(), |
|
|
type: "GET", |
|
|
async: true, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function (retdata) { |
|
|
//console.log(retdata); |
|
|
$('#snmp_result').val(retdata); |
|
|
}, |
|
|
error: function (retdata) { |
|
|
console.warn(retdata); |
|
|
$('#snmp_result').val("SNMP Error."); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
function func_getCloudData() { |
|
|
$.ajax({ |
|
|
url: "/getconfig?ch=system_setting", |
|
|
type: "GET", |
|
|
async: true, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function (retdata) { |
|
|
var jsonbuf = JSON.parse(retdata); |
|
|
|
|
|
|
|
|
enable_cloud = jsonbuf["enable_cloud"]; |
|
|
func_getEventsData(); |
|
|
}, |
|
|
error: function (retdata) { |
|
|
console.warn(retdata); |
|
|
setTimeout(func_getCloudData(), 3000); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
function func_getEventsData() { |
|
|
|
|
|
$.ajax({ |
|
|
url: "/geteventsfile?ch=all", |
|
|
type: "GET", |
|
|
async: true, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function (retdata) { |
|
|
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}'); |
|
|
var jsonbuf = validatingJSON(retdata); |
|
|
|
|
|
if (jsonbuf != null) { |
|
|
enable_post = jsonbuf["notification"]["enable_post"]; |
|
|
enable_snmp_post = jsonbuf["notification"]["enable_snmp_post"]; |
|
|
enable_heartbeat = jsonbuf["notification"]["enable_heartbeat"]; |
|
|
enable_snmp_heartbeat = jsonbuf["notification"]["enable_snmp_heartbeat"]; |
|
|
enable_check_ptz_start_autotracking = jsonbuf["notification"]["enable_check_ptz_start_autotracking"]; |
|
|
enable_check_ptz_end_autotracking = jsonbuf["notification"]["enable_check_ptz_end_autotracking"]; |
|
|
heartbeat_dwell = jsonbuf["notification"]["heartbeat_dwell"]; |
|
|
snmp_heartbeat_dwell = jsonbuf["notification"]["snmp_heartbeat_dwell"]; |
|
|
|
|
|
localStorage.setItem("enable_only_once_to_post", jsonbuf["notification"]["enable_only_once_to_post"]); |
|
|
localStorage.setItem("events_default_version", jsonbuf["notification"]["events_default_version"]); |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
|
|
|
post_protocol[i] = jsonbuf["notification"]["http_post_events"][i]["post_protocol"]; |
|
|
post_event_method[i] = jsonbuf["notification"]["http_post_events"][i]["post_event_method"]; |
|
|
post_event_name[i] = jsonbuf["notification"]["http_post_events"][i]["post_event_name"]; |
|
|
localStorage.setItem("post_event_name_" + i.toString(), post_event_name[i]); |
|
|
post_host_ip[i] = jsonbuf["notification"]["http_post_events"][i]["post_host_ip"]; |
|
|
post_host_port[i] = jsonbuf["notification"]["http_post_events"][i]["post_host_port"]; |
|
|
post_timeout[i] = jsonbuf["notification"]["http_post_events"][i]["post_timeout"]; |
|
|
post_url[i] = jsonbuf["notification"]["http_post_events"][i]["post_url"]; |
|
|
post_username[i] = jsonbuf["notification"]["http_post_events"][i]["post_username"]; |
|
|
post_password[i] = jsonbuf["notification"]["http_post_events"][i]["post_password"]; |
|
|
|
|
|
post_customized_header[i] = jsonbuf["notification"]["http_post_events"][i]["post_customized_header"]; |
|
|
post_content[i] = jsonbuf["notification"]["http_post_events"][i]["post_content"]; |
|
|
|
|
|
post_sequence[i] = jsonbuf["notification"]["http_post_events"][i]["post_sequence"]; |
|
|
|
|
|
file_format[i] = jsonbuf["notification"]["http_post_events"][i]["post_file_format"]; |
|
|
file_format_name[i] = jsonbuf["notification"]["http_post_events"][i]["post_jpeg_file_name_format"]; |
|
|
file_name[i] = jsonbuf["notification"]["http_post_events"][i]["post_jpeg_file_name"]; |
|
|
|
|
|
if (post_customized_header[i] == ";") |
|
|
post_customized_header[i] = ""; |
|
|
if (post_content[i] == ";") |
|
|
post_content[i] = ""; |
|
|
} |
|
|
|
|
|
heartbeat_link_to_post_event_name = -1; |
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
if (post_url[i].search("space") >= 1) { |
|
|
post_url[i] = post_url[i].replace(/space/g, "%20"); |
|
|
} |
|
|
if (jsonbuf["notification"]["heartbeat_link_to_post_event_name"] == post_event_name[i]) { |
|
|
heartbeat_link_to_post_event_name = i; |
|
|
} |
|
|
} |
|
|
|
|
|
ptz_start_autotracking_link_to_post_event_name = -1; |
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
if (post_url[i].search("space") >= 1) { |
|
|
post_url[i] = post_url[i].replace(/space/g, "%20"); |
|
|
} |
|
|
if (jsonbuf["notification"]["ptz_start_autotracking_link_to_post_event_name"] == post_event_name[i]) { |
|
|
ptz_start_autotracking_link_to_post_event_name = i; |
|
|
} |
|
|
} |
|
|
|
|
|
ptz_end_autotracking_link_to_post_event_name = -1; |
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
if (post_url[i].search("space") >= 1) { |
|
|
post_url[i] = post_url[i].replace(/space/g, "%20"); |
|
|
} |
|
|
if (jsonbuf["notification"]["ptz_end_autotracking_link_to_post_event_name"] == post_event_name[i]) { |
|
|
ptz_end_autotracking_link_to_post_event_name = i; |
|
|
} |
|
|
} |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) { |
|
|
|
|
|
snmp_event_name[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_event_name"]; |
|
|
localStorage.setItem("snmp_event_name_" + i.toString(), snmp_event_name[i]); |
|
|
snmp_version[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_version"]; |
|
|
snmp_group_name[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_group_name"]; |
|
|
snmp_host_ip[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_host_ip"]; |
|
|
snmp_host_port[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_host_port"]; |
|
|
snmp_oid[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_oid"]; |
|
|
snmp_value[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_value"]; |
|
|
snmp_type[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_type"]; |
|
|
} |
|
|
|
|
|
snmp_heartbeat_link_to_post_event_name = -1; |
|
|
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) { |
|
|
if (jsonbuf["notification"]["snmp_heartbeat_link_to_post_event_name"] == snmp_event_name[i]) { |
|
|
snmp_heartbeat_link_to_post_event_name = i; |
|
|
} |
|
|
} |
|
|
|
|
|
if (typeof (post_event_name[0]) == "undefined" || typeof (snmp_event_name[0]) == "undefined") { |
|
|
setTimeout(func_getEventsData(), 3000); |
|
|
} |
|
|
else { |
|
|
func_showEventsData(); |
|
|
func_showHeartbeatData(); |
|
|
func_showSNMPData(); |
|
|
change_color_of_button_verify(); |
|
|
change_color_of_button_verify_snmp(); |
|
|
|
|
|
$("#POST_METHOD_POST").change(function () { |
|
|
if ($('#POST_METHOD_POST').is(":checked")) { |
|
|
document.getElementById("IDC_STATIC_FILE_FORMAT").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_JPEG").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_TEXT").style.visibility = "visible"; |
|
|
document.getElementById("IDC_STATIC_JPEG_FILE_NAME_FORMAT").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_NAME_FIXED").style.visibility = "visible"; |
|
|
document.getElementById("FILE_FORMAT_NAME_DATE").style.visibility = "visible"; |
|
|
document.getElementById("JPEG_FILE_NAME").style.visibility = "visible"; |
|
|
document.getElementById("file_name").style.visibility = "visible"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_SEQUENCE").style.visibility = "visible"; |
|
|
document.getElementById("post_sequence").style.visibility = "visible"; |
|
|
|
|
|
document.getElementById("file_jpeg").style.visibility = "visible"; |
|
|
document.getElementById("file_text").style.visibility = "visible"; |
|
|
document.getElementById("file_name_fixed").style.visibility = "visible"; |
|
|
document.getElementById("file_name_date").style.visibility = "visible"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "visible"; |
|
|
document.getElementById("help_posttoken").style.visibility = "visible"; |
|
|
document.getElementById("post_content").style.visibility = "visible"; |
|
|
} |
|
|
}); |
|
|
|
|
|
$("#POST_METHOD_GET").change(function () { |
|
|
if ($('#POST_METHOD_GET').is(":checked")) { |
|
|
document.getElementById("IDC_STATIC_FILE_FORMAT").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_JPEG").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_TEXT").style.visibility = "hidden"; |
|
|
document.getElementById("IDC_STATIC_JPEG_FILE_NAME_FORMAT").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_NAME_FIXED").style.visibility = "hidden"; |
|
|
document.getElementById("FILE_FORMAT_NAME_DATE").style.visibility = "hidden"; |
|
|
document.getElementById("JPEG_FILE_NAME").style.visibility = "hidden"; |
|
|
document.getElementById("file_name").style.visibility = "hidden"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_SEQUENCE").style.visibility = "hidden"; |
|
|
document.getElementById("post_sequence").style.visibility = "hidden"; |
|
|
|
|
|
document.getElementById("file_jpeg").style.visibility = "hidden"; |
|
|
document.getElementById("file_text").style.visibility = "hidden"; |
|
|
document.getElementById("file_name_fixed").style.visibility = "hidden"; |
|
|
document.getElementById("file_name_date").style.visibility = "hidden"; |
|
|
|
|
|
document.getElementById("IDC_STATIC_POST_CONTENT").style.visibility = "hidden"; |
|
|
document.getElementById("help_posttoken").style.visibility = "hidden"; |
|
|
document.getElementById("post_content").style.visibility = "hidden"; |
|
|
} |
|
|
}); |
|
|
|
|
|
$("#CHECKED_CAMERA_VIRTUAL_INPUT_LIST li").click(function () { |
|
|
$("#CHECKED_CAMERA_VIRTUAL_INPUT_LIST li").each(function () { $(this).removeClass("selected") }); |
|
|
$(this).addClass("selected"); |
|
|
//alert($(this).attr('id')); |
|
|
|
|
|
func_storeEventsData(); |
|
|
func_get_current_post($(this).attr('id')); |
|
|
func_showEventsData(); |
|
|
}); |
|
|
|
|
|
$("#CHECKED_SNMP_INPUT_LIST li").click(function () { |
|
|
$("#CHECKED_SNMP_INPUT_LIST li").each(function () { $(this).removeClass("selected") }); |
|
|
$(this).addClass("selected"); |
|
|
//alert($(this).attr('id')); |
|
|
|
|
|
func_storeSNMPData(); |
|
|
func_get_current_snmp_post($(this).attr('id')); |
|
|
console.log($(this).attr('id')); |
|
|
func_showSNMPData(); |
|
|
}); |
|
|
} |
|
|
} |
|
|
else { |
|
|
setTimeout(func_getEventsData(), 3000); |
|
|
} |
|
|
//console.info(retdata); |
|
|
}, |
|
|
error: function (retdata) { |
|
|
setTimeout(func_getEventsData(), 3000); |
|
|
console.warn(retdata); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
var count_reload = 0; |
|
|
function func_getreload() { |
|
|
$.ajax({ |
|
|
url: "/getevents?reload=1", |
|
|
method: "GET", |
|
|
async: false, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
//data : JSON.stringify(data), |
|
|
success: function (retdata) { |
|
|
//console.info(); |
|
|
count_reload++; |
|
|
if (retdata === "Reload OK.") { |
|
|
count_reload = 0; |
|
|
//console.log("Reload OK."); |
|
|
} |
|
|
else { |
|
|
if (count_reload <= 3) { |
|
|
setTimeout(func_getreload(), 2000); |
|
|
} |
|
|
else { |
|
|
count_reload = 0; |
|
|
} |
|
|
} |
|
|
}, |
|
|
error: function () { |
|
|
console.warn(); |
|
|
} |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
|
|
|
/* |
|
|
function func_getVirtualInput() { |
|
|
//var virtual_input_Url = 'http://' + window.location.hostname + ':80/event?get=all'; |
|
|
//var virtual_input_Url = 'http://192.168.3.57:80/getimage_ori?1234526'; |
|
|
var virtual_input_Url = 'http://' + window.location.hostname + ':' + myport + '/event?get=all'; |
|
|
alert(virtual_input_Url); |
|
|
$.ajax({ |
|
|
url: virtual_input_Url, |
|
|
type: "GET", |
|
|
async: false, |
|
|
|
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function (retdata) { |
|
|
|
|
|
alert(retdata.responseText); |
|
|
|
|
|
//console.info(retdata); |
|
|
}, |
|
|
error: function (jqXHR, exception) { |
|
|
var msg = ''; |
|
|
if (jqXHR.status === 0) { |
|
|
msg = 'Not connect.\n Verify Network.'; |
|
|
} else if (jqXHR.status == 404) { |
|
|
msg = 'Requested page not found. [404]'; |
|
|
} else if (jqXHR.status == 500) { |
|
|
msg = 'Internal Server Error [500].'; |
|
|
} else if (exception === 'parsererror') { |
|
|
msg = 'Requested JSON parse failed.'; |
|
|
} else if (exception === 'timeout') { |
|
|
msg = 'Time out error.'; |
|
|
} else if (exception === 'abort') { |
|
|
msg = 'Ajax request aborted.'; |
|
|
} else { |
|
|
msg = 'Uncaught Error.\n' + jqXHR.responseText; |
|
|
} |
|
|
alert(msg); |
|
|
}, |
|
|
}); |
|
|
return false; |
|
|
}*/ |
|
|
|
|
|
/* |
|
|
$('#lnkSuccess').click(function (e) { |
|
|
e.preventDefault(); |
|
|
getSuccessOutput(); |
|
|
}); |
|
|
|
|
|
$('#lnkError').click(function (e) { |
|
|
e.preventDefault(); |
|
|
getFailOutput(); |
|
|
}); |
|
|
*/ |
|
|
|
|
|
|
|
|
// On click, get the ajax success output |
|
|
function getSuccessOutput() { |
|
|
$.ajax({ |
|
|
//url: 'http://' + window.location.hostname + ':80/event?get=all', |
|
|
url: 'http://' + window.location.hostname + ':' + myport + '/event?get=all', |
|
|
type: "GET", |
|
|
dataType: 'text', |
|
|
contentType: "application/text", |
|
|
headers: { |
|
|
"Access-Control-Allow-Origin": "*", |
|
|
"Access-Control-Allow-Headers": "origin, content-type, accept" |
|
|
}, |
|
|
complete: function (response) { |
|
|
//console.log(response); |
|
|
$('#post').html(response.responseText); |
|
|
}, |
|
|
error: function (jqXHR, exception) { |
|
|
getErrorMessage(jqXHR, exception); |
|
|
}, |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
|
|
|
// On click, get the ajax error output |
|
|
function getFailOutput() { |
|
|
$.ajax({ |
|
|
url: 'some_unknown_page.html', |
|
|
success: function (response) { |
|
|
$('#post').html(response.responseText); |
|
|
}, |
|
|
error: function (jqXHR, exception) { |
|
|
//console.log(jqXHR); |
|
|
getErrorMessage(jqXHR, exception); |
|
|
}, |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
|
|
|
// This function is used to get error message for all ajax calls |
|
|
function getErrorMessage(jqXHR, exception) { |
|
|
var msg = ''; |
|
|
if (jqXHR.status === 0) { |
|
|
msg = 'Not connect.\n Verify Network.'; |
|
|
} else if (jqXHR.status == 404) { |
|
|
msg = 'Requested page not found. [404]'; |
|
|
} else if (jqXHR.status == 500) { |
|
|
msg = 'Internal Server Error [500].'; |
|
|
} else if (exception === 'parsererror') { |
|
|
msg = 'Requested JSON parse failed.'; |
|
|
} else if (exception === 'timeout') { |
|
|
msg = 'Time out error.'; |
|
|
} else if (exception === 'abort') { |
|
|
msg = 'Ajax request aborted.'; |
|
|
} else { |
|
|
msg = 'Uncaught Error.\n' + jqXHR.responseText; |
|
|
} |
|
|
$('#post').html(msg); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var k_index = -1; |
|
|
$(".progress-bar").css("visibility", "hidden"); |
|
|
function makeProgress() { |
|
|
if (k_index < 100 && k_index >= 0) { |
|
|
k_index = k_index + 1; |
|
|
$(".progress-bar").css("visibility", "visible"); |
|
|
//$(".progress-bar").css("width", k_index + "%").text(k_index + " %"); |
|
|
$(".progress-bar").css("width", k_index + "%"); |
|
|
|
|
|
console.log("k_index:" + k_index.toString()); |
|
|
|
|
|
if (k_index == 1) { |
|
|
$('html, body').scrollTop(0); |
|
|
|
|
|
func_getCurrentEventsData(); |
|
|
func_get_current_heartbeat(); |
|
|
|
|
|
//func_setelement("enable_post", enable_post); |
|
|
|
|
|
var check_if_correctly_formed_ip = 1; |
|
|
var check_if_post_content_too_large = 0; |
|
|
var check_if_correct_username_password = 1; |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
/* |
|
|
if (post_customized_header[i] === "") { |
|
|
post_customized_header[i] = ';'; |
|
|
}*/ |
|
|
|
|
|
/* |
|
|
if (post_content[i] === "") { |
|
|
post_content[i] = ';'; |
|
|
}*/ |
|
|
|
|
|
//console.log(post_customized_header[i]); |
|
|
|
|
|
post_customized_header[i] = post_customized_header[i].replace(/\r?\n/g, "\\r\\n"); |
|
|
post_content[i] = post_content[i].replace(/\\"/g, '"'); |
|
|
post_content[i] = post_content[i].replace(/\\\\/g, '\\'); |
|
|
post_content[i] = post_content[i].replace(/\r?\n/g, ""); |
|
|
post_content[i] = post_content[i].replace(/"/g, '\\"'); |
|
|
|
|
|
post_host_ip[i] = post_host_ip[i].replace(/\\\\/g, '\/\/'); |
|
|
//console.log(post_customized_header[i]); |
|
|
|
|
|
if (post_host_ip[i] === "127.0.0.1") { |
|
|
post_host_ip[i] = "localhost"; |
|
|
} |
|
|
else if (post_host_ip[i].search("p://") >= 1 || post_host_ip[i].search("ps://") >= 1) { |
|
|
post_host_ip[i] = post_host_ip[i].replace(/http:\/\//, ""); |
|
|
post_host_ip[i] = post_host_ip[i].replace(/https:\/\//, ""); |
|
|
check_if_correctly_formed_ip = 0; |
|
|
} |
|
|
|
|
|
if (post_content[i].length > 1500) { |
|
|
check_if_post_content_too_large = 1; |
|
|
post_content[i] = ""; |
|
|
} |
|
|
|
|
|
if (post_sequence[i].length == 0) { |
|
|
post_sequence[i] = "NULL"; |
|
|
} |
|
|
|
|
|
/* |
|
|
if (post_username[i].includes("?") || |
|
|
post_username[i].includes(":") || |
|
|
post_username[i].includes("/") || |
|
|
post_username[i].includes(" ") || |
|
|
post_username[i].includes("@") || |
|
|
post_username[i].includes("#") || |
|
|
post_password[i].includes("?") || |
|
|
post_password[i].includes(":") || |
|
|
post_password[i].includes("/") || |
|
|
post_password[i].includes(" ") || |
|
|
post_password[i].includes("@") || |
|
|
post_password[i].includes("#")) { |
|
|
check_if_correct_username_password = 0; |
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
if (post_password[i] === "") { |
|
|
post_password[i] = ';'; |
|
|
}*/ |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (check_if_correctly_formed_ip == 0) { |
|
|
alert(MESSAGE72); |
|
|
} |
|
|
|
|
|
if (check_if_post_content_too_large == 1) { |
|
|
alert(MESSAGE74); |
|
|
} |
|
|
|
|
|
if (check_if_correct_username_password == 0) { |
|
|
alert(MESSAGE81); |
|
|
} |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
if (post_url[i].search("%20") >= 1) { |
|
|
post_url[i] = post_url[i].replace(/%20/g, "space"); |
|
|
} |
|
|
} |
|
|
|
|
|
var text_heartbeat_link_to_post_event_name = ""; |
|
|
if (heartbeat_link_to_post_event_name >= 0) |
|
|
text_heartbeat_link_to_post_event_name = post_event_name[heartbeat_link_to_post_event_name]; |
|
|
else |
|
|
text_heartbeat_link_to_post_event_name = "NULL"; |
|
|
|
|
|
var text_ptz_start_autotracking_link_to_post_event_name = ""; |
|
|
if (ptz_start_autotracking_link_to_post_event_name >= 0) |
|
|
text_ptz_start_autotracking_link_to_post_event_name = post_event_name[ptz_start_autotracking_link_to_post_event_name]; |
|
|
else |
|
|
text_ptz_start_autotracking_link_to_post_event_name = "NULL"; |
|
|
|
|
|
var text_ptz_end_autotracking_link_to_post_event_name = ""; |
|
|
if (ptz_end_autotracking_link_to_post_event_name >= 0) |
|
|
text_ptz_end_autotracking_link_to_post_event_name = post_event_name[ptz_end_autotracking_link_to_post_event_name]; |
|
|
else |
|
|
text_ptz_end_autotracking_link_to_post_event_name = "NULL"; |
|
|
|
|
|
var json_data_events = '{"notification":{"enable_post":"' + enable_post + '","enable_heartbeat":"' + enable_heartbeat + '","enable_check_ptz_start_autotracking":"' + enable_check_ptz_start_autotracking + '","enable_check_ptz_end_autotracking":"' + enable_check_ptz_end_autotracking + '","heartbeat_dwell":"' + heartbeat_dwell + '","heartbeat_link_to_post_event_name":"' + text_heartbeat_link_to_post_event_name + '","ptz_start_autotracking_link_to_post_event_name":"' + text_ptz_start_autotracking_link_to_post_event_name + '","ptz_end_autotracking_link_to_post_event_name":"' + text_ptz_end_autotracking_link_to_post_event_name + '","http_post_events":['; |
|
|
var json_data_post_content = '{"notification":{"http_post_events":['; |
|
|
|
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
json_data_events += '{"post_protocol":"' + post_protocol[i] + '","post_event_method": "' + post_event_method[i] + '","post_event_name": "' + post_event_name[i] + '","post_host_ip": "' + post_host_ip[i] + '","post_host_port": "' + post_host_port[i] + '","post_timeout": "' + post_timeout[i] + '","post_url": "' + post_url[i] + '","post_username": "' + post_username[i] + '",'; |
|
|
if (check_if_post_password_is_all_the_star(post_password[i]) != 1 || post_password[i].length == 0) { |
|
|
json_data_events += '"post_password": "' + post_password[i] + '",'; |
|
|
} |
|
|
|
|
|
json_data_events += '"post_customized_header": "' + post_customized_header[i] /*+ '","post_content": "' + post_content[i]*/ + '","post_sequence": "' + post_sequence[i] + '","post_file_format": "' + file_format[i] + '","post_jpeg_file_name_format": "' + file_format_name[i] + '","post_jpeg_file_name": "' + file_name[i] + '"'; |
|
|
json_data_post_content += '{"post_content": "' + post_content[i]; |
|
|
|
|
|
if (i == MAX_SIZE_POST - 1) { |
|
|
json_data_events += '}'; |
|
|
json_data_post_content += '"}'; |
|
|
} |
|
|
else { |
|
|
json_data_events += '},'; |
|
|
json_data_post_content += '"},'; |
|
|
} |
|
|
} |
|
|
|
|
|
json_data_events += ']}}'; |
|
|
json_data_post_content += ']}}'; |
|
|
//console.log(json_data_events); |
|
|
func_seteventsfile(json_data_events); |
|
|
//console.log(json_data_post_content); |
|
|
func_seteventsfile(json_data_post_content); |
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
post_content[i] = post_content[i].replace(/\\"/g, '"'); |
|
|
} |
|
|
|
|
|
k_index = 94; |
|
|
} |
|
|
else if (k_index == 95) { |
|
|
//waitSeconds(500); |
|
|
|
|
|
func_showHeartbeatData(); |
|
|
func_showEventsData(); |
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
localStorage.setItem("post_event_name_" + i.toString(), post_event_name[i]); |
|
|
} |
|
|
|
|
|
localStorage.setItem('alarm_success', 'Null'); |
|
|
//localStorage.setItem('alarm_success','Null'); |
|
|
|
|
|
//func_getreload(); |
|
|
//parent.window.location.reload(); |
|
|
} |
|
|
else if (k_index == 100) { |
|
|
|
|
|
if (g_setSmartEvent == 1) { |
|
|
g_setSmartEvent = 0; |
|
|
|
|
|
func_set_ipcam_smartevent_auto(); |
|
|
|
|
|
} |
|
|
|
|
|
$(".progress-bar").css("visibility", "hidden"); |
|
|
//$(".progress-bar").css("width", "0%").text("0 %"); |
|
|
$(".progress-bar").css("width", "0%"); |
|
|
k_index = -1; |
|
|
} |
|
|
// Wait for sometime before running this script again |
|
|
setTimeout("makeProgress()", 200); |
|
|
} |
|
|
} |
|
|
|
|
|
function makeProgress_SNMP() { |
|
|
if (k_index < 100 && k_index >= 0) { |
|
|
k_index = k_index + 1; |
|
|
$(".progress-bar").css("visibility", "visible"); |
|
|
//$(".progress-bar").css("width", k_index + "%").text(k_index + " %"); |
|
|
$(".progress-bar").css("width", k_index + "%"); |
|
|
|
|
|
console.log("k_index:" + k_index.toString()); |
|
|
|
|
|
if (k_index == 1) { |
|
|
$('html, body').scrollTop(0); |
|
|
|
|
|
func_getCurrentSNMPData(); |
|
|
func_get_current_heartbeat(); |
|
|
|
|
|
var text_snmp_heartbeat_link_to_post_event_name = ""; |
|
|
if (snmp_heartbeat_link_to_post_event_name >= 0) |
|
|
text_snmp_heartbeat_link_to_post_event_name = snmp_event_name[snmp_heartbeat_link_to_post_event_name]; |
|
|
else |
|
|
text_snmp_heartbeat_link_to_post_event_name = "NULL"; |
|
|
|
|
|
var json_data_events = '{"notification":{"enable_snmp_post":"' + enable_snmp_post + '","enable_snmp_heartbeat":"' + enable_snmp_heartbeat + '","snmp_heartbeat_dwell":"' + snmp_heartbeat_dwell + '","snmp_heartbeat_link_to_post_event_name":"' + text_snmp_heartbeat_link_to_post_event_name + '"'; |
|
|
json_data_events += '}}'; |
|
|
func_seteventsfile(json_data_events); |
|
|
|
|
|
var json_data_event_setting = '{"event_counter_setting":{'; |
|
|
json_data_event_setting += '"snmp_management":['; |
|
|
|
|
|
|
|
|
for (var index_snmp = 0; index_snmp < MAX_SIZE_SNMP_POST; index_snmp++) { |
|
|
json_data_event_setting += '{'; |
|
|
json_data_event_setting += '"snmp_event_name":"' + snmp_event_name[index_snmp] + '",'; |
|
|
json_data_event_setting += '"snmp_version":"' + snmp_version[index_snmp] + '",'; |
|
|
json_data_event_setting += '"snmp_group_name":"' + snmp_group_name[index_snmp] + '",'; |
|
|
json_data_event_setting += '"snmp_host_ip":"' + snmp_host_ip[index_snmp] + '",'; |
|
|
json_data_event_setting += '"snmp_host_port":"' + snmp_host_port[index_snmp] + '",'; |
|
|
json_data_event_setting += '"snmp_oid":"' + snmp_oid[index_snmp] + '",'; |
|
|
json_data_event_setting += '"snmp_value":"' + snmp_value[index_snmp] + '",'; |
|
|
json_data_event_setting += '"snmp_type":"' + snmp_type[index_snmp] + '"'; |
|
|
|
|
|
json_data_event_setting += '}'; |
|
|
if (index_snmp < MAX_SIZE_SNMP_POST - 1) |
|
|
json_data_event_setting += ','; |
|
|
} |
|
|
|
|
|
json_data_event_setting += ']}}'; |
|
|
//console.log(json_data_event_setting); |
|
|
func_seteventsfile(json_data_event_setting); |
|
|
|
|
|
k_index = 94; |
|
|
} |
|
|
else if (k_index == 95) { |
|
|
//waitSeconds(500); |
|
|
func_showSNMPData(); |
|
|
/* |
|
|
func_showHeartbeatData(); |
|
|
func_showEventsData(); |
|
|
for (var i = 0; i < MAX_SIZE_POST; i++) { |
|
|
localStorage.setItem("post_event_name_" + i.toString(), post_event_name[i]); |
|
|
}*/ |
|
|
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) { |
|
|
localStorage.setItem("snmp_event_name_" + i.toString(), snmp_event_name[i]); |
|
|
} |
|
|
|
|
|
localStorage.setItem('alarm_success', 'Null'); |
|
|
//localStorage.setItem('alarm_success','Null'); |
|
|
|
|
|
//func_getreload(); |
|
|
//parent.window.location.reload(); |
|
|
} |
|
|
else if (k_index == 100) { |
|
|
$(".progress-bar").css("visibility", "hidden"); |
|
|
//$(".progress-bar").css("width", "0%").text("0 %"); |
|
|
$(".progress-bar").css("width", "0%"); |
|
|
k_index = -1; |
|
|
} |
|
|
// Wait for sometime before running this script again |
|
|
setTimeout("makeProgress_SNMP()", 200); |
|
|
} |
|
|
} |
|
|
|
|
|
function func_set_ipcam_smartevent_auto() { |
|
|
|
|
|
$.ajax({ |
|
|
url: "/setsmartevent?", |
|
|
method: "GET", |
|
|
async: true, |
|
|
beforeSend: function (xmlHttp) { |
|
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
|
|
}, |
|
|
success: function () { |
|
|
//alert("Success to create smart event."); |
|
|
//console.info(); |
|
|
}, |
|
|
error: function () { |
|
|
//alert("[Error]create error event."); |
|
|
console.warn(); |
|
|
} |
|
|
}); |
|
|
|
|
|
//var replaceUrl = 'http://' + window.location.hostname + ':' + GetUrlPort() + '/Aida/countdown_output.html'; |
|
|
//window.location.replace(replaceUrl); |
|
|
|
|
|
return false; |
|
|
} |
|
|
|
|
|
function makeProgress2() { |
|
|
if (k_index < 100 && k_index >= 0) { |
|
|
k_index = k_index + 1; |
|
|
$(".progress-bar").css("visibility", "visible"); |
|
|
$(".progress-bar").css("width", k_index + "%"); |
|
|
|
|
|
if (k_index == 10) { |
|
|
func_set_ipcam_smartevent_auto(); |
|
|
|
|
|
/* |
|
|
func_set_ipcam_smartevent("event0000", "1"); |
|
|
|
|
|
|
|
|
func_set_ipcam_smartevent("name0000", "Aida Event 1"); |
|
|
|
|
|
func_set_ipcam_smartevent("c_name00000000", "Aida Triggering 1"); |
|
|
|
|
|
func_set_ipcam_smartevent("c_time00000000", "1,1500,0,0,1"); |
|
|
|
|
|
func_set_ipcam_smartevent("c_trigger00000000", "virtual_in/0/0/0/1/1"); |
|
|
|
|
|
func_set_ipcam_smartevent("c_schedule00000000", "0,7/0/86400,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,"); |
|
|
|
|
|
func_set_ipcam_smartevent("c_action00000000", "do/0/1000/active/0/0/0,");*/ |
|
|
|
|
|
//waitSeconds(3000); |
|
|
|
|
|
|
|
|
k_index = 90; |
|
|
} |
|
|
else if (k_index == 20) { |
|
|
|
|
|
|
|
|
k_index = 29; |
|
|
} |
|
|
else if (k_index == 30) { |
|
|
/* |
|
|
func_set_ipcam_smartevent("event0001", "1"); |
|
|
func_set_ipcam_smartevent("name0001", "Aida Event 2"); |
|
|
func_set_ipcam_smartevent("c_name00010000", "Aida Triggering 2"); |
|
|
func_set_ipcam_smartevent("c_time00010000", "1,1500,0,0,1"); |
|
|
func_set_ipcam_smartevent("c_trigger00010000", "virtual_in/1/0/0/1/1"); |
|
|
func_set_ipcam_smartevent("c_schedule00010000", "0,7/0/86400,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,"); |
|
|
func_set_ipcam_smartevent("c_action00010000", "do/0/1000/active/0/0/0,");*/ |
|
|
|
|
|
//waitSeconds(3000); |
|
|
|
|
|
k_index = 39; |
|
|
} |
|
|
else if (k_index == 40) { |
|
|
|
|
|
|
|
|
k_index = 49; |
|
|
} |
|
|
else if (k_index == 50) { |
|
|
/* |
|
|
func_set_ipcam_smartevent("event0002", "1"); |
|
|
func_set_ipcam_smartevent("name0002", "Aida Event 3"); |
|
|
func_set_ipcam_smartevent("c_name00020000", "Aida Triggering 3"); |
|
|
func_set_ipcam_smartevent("c_time00020000", "1,1500,0,0,1"); |
|
|
func_set_ipcam_smartevent("c_trigger00020000", "virtual_in/2/0/0/1/1"); |
|
|
func_set_ipcam_smartevent("c_schedule00020000", "0,7/0/86400,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,"); |
|
|
func_set_ipcam_smartevent("c_action00020000", "do/0/1000/active/0/0/0,");*/ |
|
|
|
|
|
//waitSeconds(3000); |
|
|
|
|
|
k_index = 59; |
|
|
} |
|
|
else if (k_index == 60) { |
|
|
|
|
|
|
|
|
k_index = 69; |
|
|
} |
|
|
else if (k_index == 70) { |
|
|
/* |
|
|
func_set_ipcam_smartevent("event0003", "1"); |
|
|
func_set_ipcam_smartevent("name0003", "Aida Event 4"); |
|
|
func_set_ipcam_smartevent("c_name00030000", "Aida Triggering 4"); |
|
|
func_set_ipcam_smartevent("c_time00030000", "1,1500,0,0,1"); |
|
|
func_set_ipcam_smartevent("c_trigger00030000", "virtual_in/3/0/0/1/1"); |
|
|
func_set_ipcam_smartevent("c_schedule00030000", "0,7/0/86400,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,-1/0/0,"); |
|
|
func_set_ipcam_smartevent("c_action00030000", "do/0/1000/active/0/0/0,");*/ |
|
|
|
|
|
//waitSeconds(10000); |
|
|
|
|
|
k_index = 79; |
|
|
} |
|
|
else if (k_index == 80) { |
|
|
|
|
|
|
|
|
k_index = 89; |
|
|
} |
|
|
else if (k_index == 90) { |
|
|
//var replaceUrl = 'http://' + window.location.hostname + '/setup.htm'; |
|
|
//parent.window.location.replace(replaceUrl); |
|
|
//parent.window.location.reload(); |
|
|
} |
|
|
else if (k_index == 100) { |
|
|
$(".progress-bar").css("visibility", "hidden"); |
|
|
$(".progress-bar").css("width", "0%"); |
|
|
k_index = -1; |
|
|
} |
|
|
// Wait for sometime before running this script again |
|
|
setTimeout("makeProgress2()", 200); |
|
|
} |
|
|
} |
|
|
|
|
|
function setInputFilter(textbox, inputFilter) { |
|
|
["input", "keydown", "keyup", "mousedown", "mouseup", "select", "contextmenu", "drop"].forEach(function (event) { |
|
|
textbox.addEventListener(event, function () { |
|
|
if (inputFilter(this.value)) { |
|
|
this.oldValue = this.value; |
|
|
this.oldSelectionStart = this.selectionStart; |
|
|
this.oldSelectionEnd = this.selectionEnd; |
|
|
} else if (this.hasOwnProperty("oldValue")) { |
|
|
this.value = this.oldValue; |
|
|
this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd); |
|
|
} else { |
|
|
this.value = ""; |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
localStorage.setItem('output_success', 'OK'); |
|
|
</script> |
|
|
</body> |
|
|
</html> |