Przeglądaj źródła

2020-01-22 / ct_chen

Actions:
1. 網頁畫面增加"重啟"功能;System頁Authorisation Mode只保留OCPP backend & free mode;Backend頁增加欄位ChargeBoxId & chargePointVendor 長度檢查

Files:
1. 如列表
ct_chen 5 lat temu
rodzic
commit
95bde2f29d

+ 3 - 0
EVSE/Modularization/WebService.c

@@ -776,7 +776,10 @@ int main(int argc, char *argv[]) {
 			if(system("exec /root/logPackTools 'log'")==0){
 				system(cmd);
 			}
+		}
 
+		if (strcmp(argv[1], "restart") == 0) {
+			system("exec /usr/bin/run_evse_restart.sh");
 		}
 	}
 	//upgrade firmware

+ 6 - 0
EVSE/rootfs/var/www/head.php

@@ -228,6 +228,9 @@
 						<li>
 						  <a href="set_passwd.php"><?php echo $lang->showWord("passwd"); ?></a>
 						</li>
+						<li>
+						  <a href="set_restart.php"><?php echo $lang->showWord("restart"); ?></a>
+						</li>
 					</ul> 
 				</li>
 				<li<?php echo ($tag_header=='language'?' class="active"':''); ?>>
@@ -342,6 +345,9 @@
 						<li>
 						  <a href="set_passwd.php"><?php echo $lang->showWord("passwd"); ?></a>
 						</li>
+						<li>
+						  <a href="set_restart.php"><?php echo $lang->showWord("restart"); ?></a>
+						</li>
                       </ul>
                     </li>
 					<li<?php echo ($tag_header=='language'?' class="active"':''); ?>>

BIN
EVSE/rootfs/var/www/lang.db


+ 10 - 0
EVSE/rootfs/var/www/log_download.php

@@ -2,6 +2,13 @@
 	$tag_header = 'other';
 	include 'head.php';
 ?>
+<style>
+img {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+</style>
     <div class="envor-content">
       <!--
       Page Title start
@@ -21,6 +28,7 @@
       <!--
         Main Content start
       //-->
+		<div id="loading" style="display:none;"><img src="img/giphy.gif"/></div>
       <section class="envor-section">
         <div class="container">
           <div class="row">
@@ -57,6 +65,7 @@
 	}
 
 	function getInfo() {
+		document.getElementById("loading").style.display="block";
 		// 發送 Ajax 查詢請求並處理
 		var request = new XMLHttpRequest();
 		request.open("POST", "log_download_action.php");
@@ -71,6 +80,7 @@
 		request.onreadystatechange = function() {
 			// 伺服器請求完成
 			if (request.readyState == 4) {
+				 document.getElementById("loading").style.display="none";
 				// 伺服器回應成功
 				if (request.status == 200) {
 					document.getElementById("createResult").innerHTML = "";

+ 16 - 0
EVSE/rootfs/var/www/set_backend.php

@@ -158,6 +158,8 @@ img {
 	function formCheck()
 	{
 		var OcppServerURL = document.getElementById("OcppServerURL").value;
+		var ChargeBoxId = document.getElementById("ChargeBoxId").value;
+		var chargePointVendor = document.getElementById("chargePointVendor").value;
 		var tests=/^(ws|wss):\/\/((([0-9]{1,3}\.){3}[0-9]{1,3})|(([a-zA-Z0-9]+(([\-]?[a-zA-Z0-9]+)*\.)+)*[a-zA-Z]{2,}))+/;
 		if(OcppServerURL!=""){
 			if(OcppServerURL.match(tests)==null){
@@ -166,6 +168,20 @@ img {
 				return false;
 			}
 		}
+		if(ChargeBoxId!=""){
+			if(ChargeBoxId.length>25){
+				alert("Length of ChargeBoxId should be less than 25!");
+				document.getElementById("ChargeBoxId").focus();
+				return false;
+			}
+		}
+		if(chargePointVendor!=""){
+			if(chargePointVendor.length>20){
+				alert("Length of chargePointVendor should be less than 20!");
+				document.getElementById("chargePointVendor").focus();
+				return false;
+			}
+		}
 		return true;
 	}
 

+ 10 - 0
EVSE/rootfs/var/www/set_backend_action.php

@@ -22,6 +22,8 @@
 			}
 		}
 		checkValue("OfflinePolicy");
+		checkLength("ChargeBoxId",25);
+		checkLength("chargePointVendor",20);
 //		$json = json_decode(file_get_contents("charging.txt"), true);
 //		$json = string[];
 		$json['BackendConnTimeout']			= (int)$_POST['BackendConnTimeout'];
@@ -68,4 +70,12 @@
 				exit;
 		}
 	}
+	function checkLength($id,$value){
+		if(strlen($_POST[$id])>$value){
+				$jsone['result'] = "Fail";
+				$jsone['message'] = "Length of " . $id . " should be less than ".$value;
+				echo json_encode($jsone);
+				exit;
+		}
+	}
 ?>

+ 2 - 4
EVSE/rootfs/var/www/set_system.php

@@ -115,10 +115,8 @@ img {
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Authorisation Mode</label>
 											<select type="text" class="form-control" id="AuthorisationMode" name="AuthorisationMode">
-												<option value="0" <?php echo $obj->{'AuthorisationMode'}=="0"?"selected":""?>>Phihong RFID tag</option>
-												<option value="1" <?php echo $obj->{'AuthorisationMode'}=="1"?"selected":""?>>OCPP backend</option>
-												<option value="2" <?php echo $obj->{'AuthorisationMode'}=="2"?"selected":""?>>Phihong backend</option>
-												<option value="3" <?php echo $obj->{'AuthorisationMode'}=="3"?"selected":""?>>free mode</option>
+												<option value="0" <?php echo $obj->{'AuthorisationMode'}=="0"?"selected":""?>>OCPP backend</option>
+												<option value="1" <?php echo $obj->{'AuthorisationMode'}=="1"?"selected":""?>>free mode</option>
 											</select>
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">