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.
420 lines
15 KiB
420 lines
15 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 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/pythonR.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="column" style="width:35%;"> |
|
<div class="titlebox"> |
|
<nobr id="TITLEBOX_PAGE05"></nobr> |
|
</div> |
|
<td> |
|
<ul> |
|
<li> List Object 1 </li> |
|
<li> List Object 2 </li> |
|
<li> List Object 3 </li> |
|
</ul> |
|
</td> |
|
</div> |
|
|
|
<div class="column" style="width:62%;"> |
|
<div class="row"> |
|
<!--<div class="column" style="width:15%;">--> |
|
<!--<input align="right" id="BTN_RUN_PYTHON" type="button" value="Run" onclick="func_setPYdata()" style="background-color:#6c87d4;color:white;height:36px;width:45px;" />--> |
|
<input align="right" id="BTN_PYTHON_RUN" type="button" value="Run" onclick="func_setPYdata()" |
|
style="background-color:#6c87d4;color:white;height:36px;width:45px;" /> |
|
<!--</div>--> |
|
|
|
<!--<div class="column" style="width:15%;">--> |
|
<!--<input align="right" id="BTN_RUN_PYTHON" type="button" value="Run" onclick="func_setPYdata()" style="background-color:#6c87d4;color:white;height:36px;width:45px;" />--> |
|
<input align="right" id="BTN_PYTHON_FILELIST" type="button" value="FileList" |
|
onclick="func_getFileList()" style="background-color:#6c87d4;color:white;height:36px;width:90px;" /> |
|
<!--</div>--> |
|
|
|
<!--<div class="column" style="width:15%;">--> |
|
<!--<input align="right" id="BTN_RUN_PYTHON" type="button" value="Run" onclick="func_setPYdata()" style="background-color:#6c87d4;color:white;height:36px;width:45px;" />--> |
|
<input align="right" id="BTN_PYTHON_UPLOAD" type="button" value="Upload" onclick="func_FileUpload()" |
|
style="background-color:#6c87d4;color:white;height:36px;width:72px;" /> |
|
<!--</div>--> |
|
|
|
<!--<div class="column" style="width:15%;">--> |
|
<!--<input align="right" id="BTN_RUN_PYTHON" type="button" value="Run" onclick="func_setPYdata()" style="background-color:#6c87d4;color:white;height:36px;width:45px;" />--> |
|
<input align="right" id="BTN_PYTHON_DELETE" type="button" value="Delete" onclick="func_FileDelete()" |
|
style="background-color:#6c87d4;color:white;height:36px;width:72px;" /> |
|
<!--</div>--> |
|
|
|
<!--<div class="column" style="width:15%;">--> |
|
<!--<input align="right" id="BTN_RUN_PYTHON" type="button" value="Run" onclick="func_setPYdata()" style="background-color:#6c87d4;color:white;height:36px;width:45px;" />--> |
|
<input align="right" id="BTN_PYTHON_GET" type="button" value="Get" onclick="func_FileGet()" |
|
style="background-color:#6c87d4;color:white;height:36px;width:45px;" /> |
|
<!--</div>--> |
|
</div> |
|
|
|
|
|
|
|
<div class="row"> |
|
<td> |
|
<textarea style="width: 450px; height: 200px; background-color:white;" |
|
id="text_python_content"></textarea> |
|
</td> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<script> |
|
function waitSeconds(iMilliSeconds) { |
|
|
|
var counter = 0 |
|
|
|
, start = new Date().getTime() |
|
|
|
, end = 0; |
|
|
|
while (counter < iMilliSeconds) { |
|
|
|
end = new Date().getTime(); |
|
|
|
counter = end - start; |
|
|
|
} |
|
|
|
} |
|
|
|
//func_get_lang_cookie(); |
|
//document.getElementById("TITLEBOX_PAGE05").innerHTML = TITLEBOX_PAGE05; |
|
//$('#IDC_STATIC_CREATE_SMARTEVENT_BUTTON').val(IDC_STATIC_CREATE_SMARTEVENT_BUTTON); |
|
var k_index = -1; |
|
var python_content = ''; |
|
var file_name = 'ABC_PYTHON'; |
|
|
|
/* |
|
function func_setPYdata_upload() { |
|
k_index = 0; |
|
|
|
python_content = $('#text_python_content').val(); |
|
|
|
//var json_data = '{"file_name": "' + file_name + '","python_code": "' + python_content + '"}'; |
|
var data_buf = "lifile_liname="+file_name+",lipython_licontent="+python_content; |
|
|
|
func_FileUpload(data_buf); |
|
} |
|
*/ |
|
|
|
function func_setPYdata() { |
|
k_index = 0; |
|
|
|
python_content = $('#text_python_content').val(); |
|
|
|
//var json_data = '{"file_name": "' + file_name + '","python_code": "' + python_content + '"}'; |
|
var data_buf = "lifile_liname=" + file_name + ",lipython_licontent=" + python_content; |
|
|
|
func_sendPYcode(data_buf); |
|
} |
|
|
|
function func_FileDelete() { |
|
var pyFileNmae = file_name; |
|
|
|
$.ajax({ |
|
url: "/pythondelete?file=" + pyFileNmae, |
|
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 () { |
|
//console.info(); |
|
}, |
|
error: function () { |
|
console.warn(); |
|
} |
|
}); |
|
return false; |
|
} |
|
|
|
function func_FileUpload() { |
|
var pyFileNmae = file_name; |
|
var pythoncode = $('#text_python_content').val(); |
|
|
|
var encoded = encodeURIComponent(pythoncode); |
|
|
|
$.ajax({ |
|
url: "/pythonupload?file=" + pyFileNmae + "&code=" + encoded, |
|
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 () { |
|
//console.info(); |
|
}, |
|
error: function () { |
|
console.warn(); |
|
} |
|
}); |
|
return false; |
|
} |
|
/* |
|
function func_FileUpload(json_data) { |
|
k_index = 0; |
|
|
|
$.ajax({ |
|
//url: "/pythonupload", |
|
//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_FileUpload(json_data); |
|
} |
|
} |
|
}); |
|
return false; |
|
} |
|
*/ |
|
function func_FileGet() { |
|
var reqFileNmae = file_name; |
|
|
|
$.ajax({ |
|
url: "/pythonget?file=" + reqFileNmae, |
|
type: "GET", |
|
async: true, |
|
beforeSend: function (xmlHttp) { |
|
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
}, |
|
success: function (retdata) { |
|
}, |
|
error: function (retdata) { |
|
//setTimeout(func_getAlarmData(),3000); |
|
console.warn(retdata); |
|
} |
|
}); |
|
} |
|
|
|
function func_getFileList() { |
|
$.ajax({ |
|
url: "/python?getfilelist=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) { |
|
|
|
}, |
|
error: function (retdata) { |
|
//setTimeout(func_getAlarmData(),3000); |
|
console.warn(retdata); |
|
} |
|
}); |
|
} |
|
|
|
function func_sendPYcode(json_data) { |
|
$.ajax({ |
|
url: "/sendpycode", |
|
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_sendPYcode(json_data); |
|
} |
|
} |
|
}); |
|
return false; |
|
} |
|
|
|
</script> |
|
</body> |
|
</html> |