You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

582 lines
24 KiB

<!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 http-equiv="refresh" content="300" />--> <!--Refresh each 5s-->
<meta charset="utf-8" />
<style>
body, html {
font-family: "Arial";
}
.titlebox {
float: left;
padding: 0 5px;
margin: -30px 0 0 20px;
background: #fff;
}
</style>
<title>LPR MAPPING</title>
<script src="./js_3_5_1.js"></script>
<script src="./jquery.form.min.js"></script>
<script src="./config.js"></script>
<script src="./cgi.js"></script>
<script src="./chirun_min.js"></script>
<script src="./cookie.min.js"></script>
<script src="./lang.js"></script>
<script src="./lang_cookie.js"></script>
<script>
func_get_lang_cookie();
var g_map_count = 0;
var g_del_count = 0;
var g_luck_map_ui = 300;
var g_map_max_value = 1000;
var g_mapping_ary = new Array();
var g_chkNumEnMark = "return /[0-9a-zA-Z-_. ]/.test(String.fromCharCode(event.keyCode))";
var Ctrl_MAP_DEL_All = new Ctrl_Check("Ctrl_MAP_DEL_All", "", "", "action_map_del_all()");
function Ctrl_MAPPING(INDEX, LPR_DETECT, LPR, oLPR) {
this.INDEX = INDEX;
this.LPR_DETECT = LPR_DETECT;
this.LPR = LPR;
this.oLPR = oLPR;
}
function onluckBlock() {
if (g_del_count) {
$.blockUI({ message: "Waiting For Delete Data" });
}
else {
$.blockUI({ message: 'Waiting For Loading Data' });
}
var l_interval = setInterval(function () {
if (--g_luck_map_ui <= 0) {
$.unblockUI();
clearInterval(l_interval);
}
else {
if (g_del_count) {
$.blockUI({ message: 'Waiting For Delete Data', fadeIn: 0 });
}
else
$.blockUI({ message: 'Waiting For Loading Data', fadeIn: 0 });
}
}, 1000);
};
var g_UpdateLPRLISTUICount = 300;
var g_RebooTime;
var g_POWERON = null;
function UnUIBlock() {
$.blockUI({ message: 'Waiting For System Reboot ' + g_UpdateLPRLISTUICount + ' sec' });
var interval = setInterval(function () {
if (g_POWERON == 200) {
$.unblockUI();
clearTimeout(g_RebooTime);
clearInterval(interval);
if (window.location.protocol == "http:") {
if (window.location.port != parseInt(myport, 10))
window.location = 'http://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'http://' + window.location.hostname;
}
else {
if (window.location.port != 443)
window.location = 'https://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'https://' + window.location.hostname;
}
}
else if (--g_UpdateLPRLISTUICount <= 0) {
$.unblockUI();
clearTimeout(g_RebooTime);
clearInterval(interval);
if (window.location.protocol == "http:") {
if (window.location.port != parseInt(myport, 10))
window.location = 'http://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'http://' + window.location.hostname;
}
else {
if (window.location.port != 443)
window.location = 'https://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'https://' + window.location.hostname;
}
}
else {
$.blockUI({ message: 'Waiting For System Reboot ' + g_UpdateLPRLISTUICount + ' sec', fadeIn: 0 });
}
}, 1000);
};
function UpdateUIBlock_innerHTML() {
if (g_UploadTime <= 98) {
var percentVal = g_UploadTime + '%';
g_UploadTime++;
bar.width(percentVal);
percent.html(percentVal);
clearTimeout(g_UpdateUIBlock_innerHTMLID);
g_UpdateUIBlock_innerHTMLID = setTimeout(UpdateUIBlock_innerHTML, 1000);
}
};
function alertUnLuck() {
if (g_SubmitHttpEx.readyState == 4) {
if (g_SubmitHttpEx.status == 200) {
g_POWERON = g_SubmitHttpEx.status;
clearTimeout(g_RebooTime);
$.unblockUI();
}
else {
GetIPCAMOnline();
}
}
}
function CheckLoopTime() {
setTimeout("GetIPCAMOnline()", 10000);
}
function GetIPCAMOnline() {
g_RebooTime = setTimeout("GetIPCAMOnline()", 60000);
//SendHttpEx('/signin',false,alertUnLuck);
}
function RebootTime(times, _ip, _port) {
$.blockUI({ message: 'Waiting For System Reboot ' + times + ' sec' });
var interval = setInterval(function () {
if (g_POWERON == 200) {
$.unblockUI();
clearTimeout(g_RebooTime);
clearInterval(interval);
if (window.location.protocol == "http:") {
if (window.location.port != parseInt(myport, 10))
window.location = 'http://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'http://' + window.location.hostname;
}
else {
if (window.location.port != 443)
window.location = 'https://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'https://' + window.location.hostname;
}
}
else if (--times <= 0) {
$.unblockUI();
clearTimeout(g_RebooTime);
clearInterval(interval);
if (window.location.protocol == "http:") {
if (window.location.port != parseInt(myport, 10))
window.location = 'http://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'http://' + window.location.hostname;
}
else {
if (window.location.port != 443)
window.location = 'https://' + window.location.hostname + ':' + window.location.port;
else
window.location = 'https://' + window.location.hostname;
}
}
else {
$.blockUI({ message: 'Waiting For System Reboot ' + times + ' sec', fadeIn: 0 });
}
}, 1000);
};
function SendReset() {
setTimeout("GetIPCAMOnline()", 10000);
}
function get_mapping_info() {
var l_map_cgi = '/get_search_info?list=mapping';
get_cgi({
cmd: l_map_cgi, async: false, get_response: function (result) {
alert_map_table(result);
}
});
}
function alert_map_table(res) {
var l_mapping_info = JSON.parse(res);
var l_LPR_COUNT = l_mapping_info.LPR_COUNT;
g_map_count = l_LPR_COUNT;
var i = 0;
if (l_LPR_COUNT > 0) {
inforamtion = l_mapping_info.INFORMATION;
for (i = 0; i < l_LPR_COUNT; i++) {
var l_INDEX = inforamtion[i].MAP_INDEX;
var l_LPR_DETECT = inforamtion[i].LPR_DETECT;
var l_LPR = inforamtion[i].LPR;
g_mapping_ary[i] = new Ctrl_MAPPING(l_INDEX, l_LPR_DETECT, l_LPR, l_LPR_DETECT);
}
}
create_map_ctrl_tmp();
}
function action_map_del_all() {
var _setall = Ctrl_MAP_DEL_All.GV();
for (var i = 0; i < g_map_count; i++) {
eval('Ctrl_Select_MAP_LPR_' + g_mapping_ary[i].INDEX + '.SV(' + _setall + ')');
}
}
function action_map_del_select() {
if (Ctrl_MAP_DEL_All.GV() == 1) {
Ctrl_MAP_DEL_All.SV(0);
}
else {
var tmpSelectAll = 1;
for (var i = 0; i < g_map_count; i++) {
if (eval('Ctrl_Select_MAP_LPR_' + g_mapping_ary[i].INDEX + '.GV(' + g_mapping_ary[i].INDEX + ')') != 1) {
tmpSelectAll = 0;
break;
}
}
if (tmpSelectAll)
Ctrl_MAP_DEL_All.SV(1);
}
}
function reloadUIWAIT() {
//my_sleep(60000);
g_del_count = 0;
g_luck_map_ui = -1;
get_mapping_info();
}
function reloadUI() {
g_del_count = 0;
g_luck_map_ui = -1;
get_mapping_info();
}
function action_del_map() {
var req = '/set_search_info?';
if (Ctrl_MAP_DEL_All.GV() == 1)
req += 'clean=';
else
req += 'delete=';
req += 'mapping';
g_del_count = 0;
if (Ctrl_MAP_DEL_All.GV() == 1) {
get_cgi({
cmd: req, async: false, get_response: function (result) {
reloadUI();
}
});
}
else {
var o = '&lpr_map_oplate=';
for (var i = 0; i < g_map_count; i++) {
if (eval('Ctrl_Select_MAP_LPR_' + g_mapping_ary[i].INDEX + '.GV()') == 1) {
o += g_mapping_ary[i].LPR_DETECT + ':';
g_del_count++;
}
}
var Muchcount = Number(100);
var l_Range = Muchcount - 1;
if (g_del_count > Muchcount) {
g_luck_map_ui = 300;
onluckBlock();
var l_startIndex = 0;
var sendIndex = Math.ceil(g_del_count / Muchcount);
var g_MSGBOX_ARY = new Array();
while (l_startIndex < sendIndex) {
var sendMsg = req;
var l_msg = '&lpr_map_oplate=';
var l_count = 0;
//var l_s=((l_startIndex*Muchcount)+1);
var l_s = ((l_startIndex * Muchcount));
if (l_startIndex == sendIndex)
var l_e = g_del_count;
else
var l_e = l_s + l_Range;
for (var q = l_s; q <= l_e; q++) {
if (eval('Ctrl_Select_MAP_LPR_' + g_mapping_ary[q].INDEX + '.GV()') == 1) {
l_msg += g_mapping_ary[q].LPR_DETECT + ':';
l_count++;
}
}
var s = '&lprcount=' + l_count;
sendMsg += s + l_msg;
g_MSGBOX_ARY[l_startIndex] = sendMsg.slice(0, -1);
l_startIndex++;
}
for (var msgIndex = 0; msgIndex < sendIndex; msgIndex++) {
get_cgi({
cmd: g_MSGBOX_ARY[msgIndex], async: false, get_response: function (result) {
reloadUIWAIT();
}
});
}
}
else {
var s = '&lprcount=' + g_del_count;
req += s + o;
if (g_del_count) {
g_luck_map_ui = 300;
onluckBlock();
get_cgi({
cmd: req.slice(0, -1), async: false, get_response: function (result) {
reloadUI();
}
});
} else {
g_luck_map_ui = 1;
onluckBlock();
}
}
}
}
function action_add_map() {
if (g_map_count < g_map_max_value) {
var l_index = 0;
if (g_map_count > 0)
l_index = parseInt(g_mapping_ary[g_map_count - 1].INDEX + 1);
else
l_index = 1;
g_map_count++;
var n_index = g_map_count - 1;
g_mapping_ary[n_index] = new Ctrl_MAPPING(l_index, "", "", "");
}
create_map_ctrl_tmp();
}
function action_edit(index) {
var l_index = index;
var l_ary_index = index - 1;
var l_send_cgi = 1;
if (!(/^[0-9a-zA-Z-_. /]+$/.test(eval('Ctrl_MAP_LPR_DETECT_' + l_index + '.GV()')))) {
ShowMessage(' License Plate Mapping: Only characters and numerical values are allowed');
//l_send_cgi = 0;
return false;
}
if (!(/^[0-9a-zA-Z-_. /]+$/.test(eval('Ctrl_MAP_LPR_' + l_index + '.GV()')))) {
ShowMessage('License Plate : Only characters and numerical values are allowed');
//l_send_cgi = 0;
return false;
}
if (g_mapping_ary[l_ary_index].oLPR == "") {
for (var i = 0; i < g_mapping_ary.length; i++) {
var tmpStr = eval('Ctrl_MAP_LPR_DETECT_' + l_index + '.GV()');
var tmpStr1 = g_mapping_ary[i].LPR_DETECT;
if (tmpStr == tmpStr1) {
//ShowMessage("License plate cannot be repeated.");
return false;
}
}
} else {
for (var i = 0; i < g_mapping_ary.length; i++) {
var tmpStr = eval('Ctrl_MAP_LPR_DETECT_' + l_index + '.GV()');
var tmpStr1 = g_mapping_ary[i].LPR_DETECT;
if ((tmpStr == tmpStr1) && ((i + 1) != index)) {
//ShowMessage("License plate cannot be repeated.");
return false;
}
}
}
g_mapping_ary[l_ary_index] = new Ctrl_MAPPING(l_index, eval('Ctrl_MAP_LPR_DETECT_' + l_index + '.GV()'), eval('Ctrl_MAP_LPR_' + l_index + '.GV()'), g_mapping_ary[l_ary_index].oLPR);
var req = '/set_search_info?';
if (g_mapping_ary[l_ary_index].oLPR == "")
req += 'add=';
else
req += 'update=';
req += 'mapping';
req += '&lprcount=1';
req += '&lpr_map_det_plate=' + g_mapping_ary[l_ary_index].LPR_DETECT;
req += '&lpr_map_plate=' + g_mapping_ary[l_ary_index].LPR;
if (!(g_mapping_ary[l_ary_index].oLPR == ""))
req += '&lpr_map_oplate=' + g_mapping_ary[l_ary_index].oLPR;
if (l_send_cgi) {
get_cgi({ cmd: req.slice(0, -1), async: false });
g_mapping_ary[l_ary_index] = new Ctrl_MAPPING(l_index, eval('Ctrl_MAP_LPR_DETECT_' + l_index + '.GV()'), eval('Ctrl_MAP_LPR_' + l_index + '.GV()'), eval('Ctrl_MAP_LPR_DETECT_' + l_index + '.GV()'));
}
}
function create_map_ctrl_tmp() {
var i = 0;
for (i = 0; i < g_map_count; i++) {
tmp = 'Ctrl_Select_MAP_LPR_' + g_mapping_ary[i].INDEX + ' = new Ctrl_Check("Ctrl_Select_MAP_LPR_' + g_mapping_ary[i].INDEX + '","","","action_map_del_select()")';
eval(tmp);
tmp = 'Ctrl_MAP_LPR_DETECT_' + g_mapping_ary[i].INDEX + ' = new Ctrl_Text("Ctrl_MAP_LPR_DETECT_' + g_mapping_ary[i].INDEX + '","9","25","' + g_mapping_ary[i].LPR_DETECT + '","Ctrl_MAP_LPR_DETECT_' + g_mapping_ary[i].INDEX + '",null,null,null,null,null,g_chkNumEnMark)';
eval(tmp);
tmp = 'Ctrl_MAP_LPR_' + g_mapping_ary[i].INDEX + ' = new Ctrl_Text("Ctrl_MAP_LPR_' + g_mapping_ary[i].INDEX + '","9","25","' + g_mapping_ary[i].LPR + '","Ctrl_MAP_LPR_' + g_mapping_ary[i].INDEX + '",null,null,null,null,null,g_chkNumEnMark)';
eval(tmp);
}
create_map_table();
}
function create_map_table() {
var o = '';
o += '<table class="item" width="450px" align="left" border="0" cellspacing="0" cellpadding="0" ><tr><td>';
o += '<table class="item" width="450px" align="left" border="0" cellspacing="0" cellpadding="0" ><tr>';
o += '<td height="30">';
o += '<input type="button" id="btn_add" name="btn_add" onClick="action_add_map()" value="' + IDC_STATIC_ADD + '">';
o += '&nbsp;';
o += '<input type="button" id="btn_delete" name="btn_delete" onClick="action_del_map()" value="' + IDC_STATIC_DELETE + '">';
o += '</td>';
o += '</tr><tr>';
if (g_map_count >= 2)
o += '<td width="80" align="left">' + Ctrl_MAP_DEL_All.html + '&nbsp;Select All</td>';
o += '</tr></table>';
if (g_map_count > 0) {
for (var i = 0; i < g_map_count; i++) {
o += '<table class="item" width="350px" align="left" style="border:2px #cccccc solid;" cellpadding="0" border="0">';
o += '<tr>';
o += '<td rowspan="2" width="20px">' + eval('Ctrl_Select_MAP_LPR_' + g_mapping_ary[i].INDEX + '.html') + '</td>';
o += '<td bgcolor="#cccccc">&nbsp;License Plate Mapping</td>';
o += '<td bgcolor="#cccccc">&nbsp;License Plate</td>';
o += '<td rowspan="2" width="60px"><input type="button" id="Edit_' + g_mapping_ary[i].INDEX + '" name="Edit_' + g_mapping_ary[i].INDEX + '" onClick="action_edit(' + g_mapping_ary[i].INDEX + ')" value="Save" /></td>';
o += '</tr><tr>';
o += '<td>&nbsp;' + eval('Ctrl_MAP_LPR_DETECT_' + g_mapping_ary[i].INDEX + '.html') + '</td>';
o += '<td>&nbsp;' + eval('Ctrl_MAP_LPR_' + g_mapping_ary[i].INDEX + '.html') + '</td>';
o += '</tr>';
o += '</table>';
}
}
o += '</td></tr></table>';
GE('map_list').innerHTML = o;
g_luck_map_ui = -1;
}
function My_map_export() {
document.location.href = "/get_search_info?download=mapping";
}
function CreateTableBlock() {
var o = '';
o += '<div style = "border:1px gray solid;padding:20px;margin:15px 15px 15px 15px;">';
o += '<div class="titlebox">' + TITLEBOX_PAGE03 + '</div>';
o += '<div style = "margin-left: 35%">';
o += '<div>' + IDC_STATIC_NOTE + '</div>';
o += '<div>' + IDC_STATIC_FILE_FORMAT_MAPPING_TABLE + '</div>';
o += '<div>&nbsp;</div>';
o += '<div>' + IDC_STATIC_CSV_CONTENT_FORMAT + '</div>';
o += '<br>';
o += '<div>&nbsp;&nbsp;' + IDC_STATIC_COLUMN_A_MAPPING_TABLE + '</div>';
o += '<div>&nbsp;&nbsp;' + IDC_STATIC_COLUMN_B_MAPPING_TABLE + '</div>';
o += '</div>';
o += '</div>';
o += '<br>';
o += '<div style = "margin-left: 35%">';
o += '<nobr><img src="./images/icon_export.png"/></nobr>';
o += '<nobr>' + IDC_STATIC_EXPORT_LPR_MAPPING_LIST + '&nbsp;</nobr>';
o += '<nobr><input type="button" class="Content_stybtn" onClick="My_map_export()" value="' + IDC_STATIC_EXPORT + '"></nobr>';
o += '<br>';
o += '<br>';
o += '<nobr><img src="./images/icon_import.png"/></nobr>';
o += '<nobr>' + IDC_STATIC_IMPORT_LPR_MAPPING_LIST + '&nbsp;</nobr>';
o += '<form name="form_import" action="/import_lpr_map_list" method="POST" id="form_import" enctype="multipart/form-data">';
o += '<input type="file" name="file"/>';
o += '<input type="submit" value="' + IDC_STATIC_UPLOAD + '">';
o += '</form>'
o += '<br>';
o += '<div id="map_list" />';
o += '</div>';
o += '</div>';
//<div style="border:1px gray solid;padding:20px;margin:5px 15px 5px 15px">
// o += '<div style="border:1px gray solid;padding:20px;margin:5px 15px 5px 15px">';
//</div>
return o;
}
$(document).ready(function () {
var o = CreateTableBlock();
$("#list-content-show").html(o);
//Update_web_item();
(function () {
$('#form_import').ajaxForm({
beforeSend: function () {
//alert(document.form_import.file.value);
if (document.form_import.file.value == "") {
alert("File name is empty.");
form.abort();
return false;
}
else {
if (document.form_import.file.value.indexOf("mapping_info.csv") == -1)
// if (document.form_import.file.value.indexOf("exportnvram.bin") == -1)
{
alert("File name is incorrect.");
form.abort();
return false;
}
//RebootTime(g_UpdateLPRLISTUICount);
//CheckLoopTime();
}
},
complete: function (xhr) {
window.location.reload();
}
});
})();
get_mapping_info();
}
);
</script>
</head>
<body>
<div id="list-content-show" class="list-content-show" ></div>
</body>
</html>