فهرست منبع

2020-00-00 / ct_chen

Actions:
1. Webservice fix bug

Files:
1. as list
ct_chen 5 سال پیش
والد
کامیت
b6937b9398

+ 33 - 33
EVSE/Modularization/WebService.c

@@ -338,7 +338,7 @@ int main(int argc, char *argv[]) {
 //			int AcPhaseCount = 0;
 			int FactoryConfiguration = 0;
 			int AuthorisationMode = 0;
-			int DefaultLanguage = 0;
+			// int DefaultLanguage = 0;
 			int RfidCardNumEndian = 0;
 			int PsuAcInputType = 0;
 
@@ -357,9 +357,9 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "AuthorisationMode", &val_obj) ) {
 				AuthorisationMode = json_object_get_int(val_obj);
 			}
-			if( json_object_object_get_ex(jobj, "DefaultLanguage", &val_obj) ) {
-				DefaultLanguage = json_object_get_int(val_obj);
-			}
+			// if( json_object_object_get_ex(jobj, "DefaultLanguage", &val_obj) ) {
+				// DefaultLanguage = json_object_get_int(val_obj);
+			// }
 			if( json_object_object_get_ex(jobj, "RfidCardNumEndian", &val_obj) ) {
 				RfidCardNumEndian = json_object_get_int(val_obj);
 			}
@@ -370,7 +370,7 @@ int main(int argc, char *argv[]) {
 //			ShmSysConfigAndInfo->SysConfig.AcPhaseCount = AcPhaseCount;
 			ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
 			ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AuthorisationMode;
-			ShmSysConfigAndInfo->SysConfig.DefaultLanguage = DefaultLanguage;
+			// ShmSysConfigAndInfo->SysConfig.DefaultLanguage = DefaultLanguage;
 			ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = RfidCardNumEndian;
 			ShmSysConfigAndInfo->SysConfig.PsuAcInputType = PsuAcInputType;
 
@@ -466,19 +466,19 @@ int main(int argc, char *argv[]) {
 		if (strcmp(argv[1], "3") == 0) {
 			struct json_object *jobj = json_tokener_parse(argv[2]);
 			json_object *val_obj = NULL;
-			char *FtpServer=NULL;
+			// char *FtpServer=NULL;
 			int Eth0DhcpClient=0;
 			char *Eth0IpAddress=NULL;
 			char *Eth0SubmaskAddress=NULL;
 			char *Eth0GatewayAddress=NULL;
 			int Eth1DhcpClient=0;
-			char *Eth1IpAddress=NULL;
-			char *Eth1SubmaskAddress=NULL;
-			char *Eth1GatewayAddress=NULL;
+			// char *Eth1IpAddress=NULL;
+			// char *Eth1SubmaskAddress=NULL;
+			// char *Eth1GatewayAddress=NULL;
 			int WifiMode=0;
 			char *WifiSsid=NULL;
 			char *WifiPassword=NULL;
-			int WifiDhcpServer=0;
+			// int WifiDhcpServer=0;
 			int WifiDhcpClient=0;
 			char *WifiIpAddress=NULL;
 			char *WifiSubmaskAddress=NULL;
@@ -487,9 +487,9 @@ int main(int argc, char *argv[]) {
 			char *TelcomChapPapId=NULL;
 			char *TelcomChapPapPwd=NULL;
 			char *TelcomIpAddress=NULL;
-			if( json_object_object_get_ex(jobj, "FtpServer", &val_obj) ) {
-				FtpServer = (char*)json_object_get_string(val_obj);
-			}
+			// if( json_object_object_get_ex(jobj, "FtpServer", &val_obj) ) {
+				// FtpServer = (char*)json_object_get_string(val_obj);
+			// }
 			if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
 				Eth0DhcpClient = json_object_get_int(val_obj);
 			}
@@ -502,18 +502,18 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "Eth0GatewayAddress", &val_obj) ) {
 				Eth0GatewayAddress = (char*)json_object_get_string(val_obj);
 			}
-			if( json_object_object_get_ex(jobj, "Eth1DhcpClient", &val_obj) ) {
-				Eth1DhcpClient = json_object_get_int(val_obj);
-			}
-			if( json_object_object_get_ex(jobj, "Eth1IpAddress", &val_obj) ) {
-				Eth1IpAddress = (char*)json_object_get_string(val_obj);
-			}
-			if( json_object_object_get_ex(jobj, "Eth1SubmaskAddress", &val_obj) ) {
-				Eth1SubmaskAddress = (char*)json_object_get_string(val_obj);
-			}
-			if( json_object_object_get_ex(jobj, "Eth1GatewayAddress", &val_obj) ) {
-				Eth1GatewayAddress = (char*)json_object_get_string(val_obj);
-			}
+			// if( json_object_object_get_ex(jobj, "Eth1DhcpClient", &val_obj) ) {
+				// Eth1DhcpClient = json_object_get_int(val_obj);
+			// }
+			// if( json_object_object_get_ex(jobj, "Eth1IpAddress", &val_obj) ) {
+				// Eth1IpAddress = (char*)json_object_get_string(val_obj);
+			// }
+			// if( json_object_object_get_ex(jobj, "Eth1SubmaskAddress", &val_obj) ) {
+				// Eth1SubmaskAddress = (char*)json_object_get_string(val_obj);
+			// }
+			// if( json_object_object_get_ex(jobj, "Eth1GatewayAddress", &val_obj) ) {
+				// Eth1GatewayAddress = (char*)json_object_get_string(val_obj);
+			// }
 			if( json_object_object_get_ex(jobj, "WifiMode", &val_obj) ) {
 				WifiMode = json_object_get_int(val_obj);
 			}
@@ -523,9 +523,9 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "WifiPassword", &val_obj) ) {
 				WifiPassword = (char*)json_object_get_string(val_obj);
 			}
-			if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
-				WifiDhcpServer = json_object_get_int(val_obj);
-			}
+			// if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
+				// WifiDhcpServer = json_object_get_int(val_obj);
+			// }
 			if( json_object_object_get_ex(jobj, "WifiDhcpClient", &val_obj) ) {
 				WifiDhcpClient = json_object_get_int(val_obj);
 			}
@@ -551,19 +551,19 @@ int main(int argc, char *argv[]) {
 				TelcomIpAddress = (char*)json_object_get_string(val_obj);
 			}
 
-			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,FtpServer);
+			// strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,FtpServer);
 			ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,Eth0IpAddress);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,Eth0SubmaskAddress);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,Eth0GatewayAddress);
 			ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=Eth1DhcpClient;
-			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,Eth1IpAddress);
-			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,Eth1SubmaskAddress);
-			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,Eth1GatewayAddress);
+			// strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,Eth1IpAddress);
+			// strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,Eth1SubmaskAddress);
+			// strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,Eth1GatewayAddress);
 			ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=WifiMode;
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,WifiSsid);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,WifiPassword);
-			ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
+			// ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
 			ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=WifiDhcpClient;
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,WifiIpAddress);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,WifiSubmaskAddress);

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

@@ -147,6 +147,7 @@ img {
 					// 伺服器回應成功
 					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
 						alert("<?php echo $lang->showWord("done")?>");
+						location.href="set_backend.php";
 					} else {
 						alert(JSON.parse(request.responseText).message);
 					}

+ 24 - 3
EVSE/rootfs/var/www/set_charging.php

@@ -365,7 +365,7 @@ img {
 <?php if($obj['ChargingInfo1']){ $idx++;?>
 								<!--Charging Information-->
 								<article class="envor-sorting-item css">
-									<header><?php echo $connectorType1." ".$lang->showWord("charging_information").$idx; ?><i class="fa fa-plus"></i></header>
+									<header><?php echo $connectorType1." ".$lang->showWord("charging_information")."(connector".$idx.")"; ?><i class="fa fa-plus"></i></header>
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>User Id</label>
@@ -448,7 +448,7 @@ img {
 <?php if($obj['ChargingInfo2']){ $idx++;?>
 								<!--Charging Information-->
 								<article class="envor-sorting-item css">
-									<header><?php echo $connectorType2." ".$lang->showWord("charging_information").$idx; ?><i class="fa fa-plus"></i></header>
+									<header><?php echo $connectorType2." ".$lang->showWord("charging_information")."(connector".$idx.")"; ?><i class="fa fa-plus"></i></header>
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>User Id</label>
@@ -531,7 +531,7 @@ img {
 <?php if($obj['ChargingInfo3']){ $idx++;?>
 								<!--Charging Information-->
 								<article class="envor-sorting-item css">
-									<header><?php echo $connectorType3." ".$lang->showWord("charging_information").$idx; ?><i class="fa fa-plus"></i></header>
+									<header><?php echo $connectorType3." ".$lang->showWord("charging_information")."(connector".$idx.")"; ?><i class="fa fa-plus"></i></header>
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>User Id</label>
@@ -667,6 +667,7 @@ img {
 					// 伺服器回應成功
 					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
 						alert("<?php echo $lang->showWord("done")?>");
+						location.href="set_charging.php";
 					} else {
 						alert(JSON.parse(request.responseText).message);
 					}
@@ -698,51 +699,71 @@ img {
 		if(LocalWhiteCard0 != ""){
 			if(LocalWhiteCard0.length>32){
 				alert("Local White Card0 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard0").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard1 != ""){
 			if(LocalWhiteCard1.length>32){
 				alert("Local White Card1 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard1").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard2 != ""){
 			if(LocalWhiteCard2.length>32){
 				alert("Local White Card2 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard2").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard3 != ""){
 			if(LocalWhiteCard3.length>32){
 				alert("Local White Card3 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard3").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard4 != ""){
 			if(LocalWhiteCard4.length>32){
 				alert("Local White Card4 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard4").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard5 != ""){
 			if(LocalWhiteCard5.length>32){
 				alert("Local White Card5 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard5").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard6 != ""){
 			if(LocalWhiteCard6.length>32){
 				alert("Local White Card6 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard6").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard7 != ""){
 			if(LocalWhiteCard7.length>32){
 				alert("Local White Card7 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard7").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard8 != ""){
 			if(LocalWhiteCard8.length>32){
 				alert("Local White Card8 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard8").focus();
+				return false;
 			}
 		}
 		if(LocalWhiteCard9 != ""){
 			if(LocalWhiteCard9.length>32){
 				alert("Local White Card9 must be less than 32 bytes!");
+				document.getElementById("LocalWhiteCard9").focus();
+				return false;
 			}
 		}
 		if(MaxChargingEnergy >65535)

+ 18 - 17
EVSE/rootfs/var/www/set_network.php

@@ -271,7 +271,7 @@ img {
 											<input type="hidden" name="TelcomSimImsi" id="TelcomSimImsi" value="<?php echo $obj->{'TelcomSimImsi'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am101;?>">
-											<label>Sim Iccid</label>
+											<label>Sim ICCID</label>
 											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'TelcomSimIccid'};?>">
 											<input type="hidden" name="TelcomSimIccid" id="TelcomSimIccid" value="<?php echo $obj->{'TelcomSimIccid'};?>">
 										</div>
@@ -349,19 +349,19 @@ img {
 			request.open("POST", "set_network_action.php");
 
 			// POST 參數須使用 send() 發送
-			var data =  "FtpServer=" + document.getElementById("FtpServer").value +
-						"&Eth0DhcpClient=" + document.getElementById("Eth0DhcpClient").value+
+//			var data =  "FtpServer=" + document.getElementById("FtpServer").value +
+			var data =  "Eth0DhcpClient=" + document.getElementById("Eth0DhcpClient").value+
 						"&Eth0IpAddress=" + document.getElementById("Eth0IpAddress").value+
 						"&Eth0SubmaskAddress=" + document.getElementById("Eth0SubmaskAddress").value+
 						"&Eth0GatewayAddress=" + document.getElementById("Eth0GatewayAddress").value+
-						"&Eth1DhcpClient=" + document.getElementById("Eth1DhcpClient").value+
-						"&Eth1IpAddress=" + document.getElementById("Eth1IpAddress").value+
-						"&Eth1SubmaskAddress=" + document.getElementById("Eth1SubmaskAddress").value+
-						"&Eth1GatewayAddress=" + document.getElementById("Eth1GatewayAddress").value+
+						// "&Eth1DhcpClient=" + document.getElementById("Eth1DhcpClient").value+
+						// "&Eth1IpAddress=" + document.getElementById("Eth1IpAddress").value+
+						// "&Eth1SubmaskAddress=" + document.getElementById("Eth1SubmaskAddress").value+
+						// "&Eth1GatewayAddress=" + document.getElementById("Eth1GatewayAddress").value+
 						"&WifiMode=" + document.getElementById("WifiMode").value+
 						"&WifiSsid=" + document.getElementById("WifiSsid").value+
 						"&WifiPassword=" + document.getElementById("WifiPassword").value+
-						"&WifiDhcpServer=" + document.getElementById("WifiDhcpServer").value+
+						// "&WifiDhcpServer=" + document.getElementById("WifiDhcpServer").value+
 						"&WifiDhcpClient=" + document.getElementById("WifiDhcpClient").value+
 						"&WifiIpAddress=" + document.getElementById("WifiIpAddress").value+
 						"&WifiSubmaskAddress=" + document.getElementById("WifiSubmaskAddress").value+
@@ -382,6 +382,7 @@ img {
 					// 伺服器回應成功
 					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
 						alert("<?php echo $lang->showWord("done")?>");
+						location.href="set_network.php";
 					} else {
 						alert(JSON.parse(request.responseText).message);
 					}
@@ -402,15 +403,15 @@ img {
 		if(document.getElementById("Eth0GatewayAddress").value != ""){
 			if(!ValidateIPaddress("Eth0GatewayAddress")) return false;
 		}
-		if(document.getElementById("Eth1IpAddress").value != ""){
-			if(!ValidateIPaddress("Eth1IpAddress")) return false;
-		}
-		if(document.getElementById("Eth1SubmaskAddress").value != ""){
-			if(!ValidateIPaddress("Eth1SubmaskAddress")) return false;
-		}
-		if(document.getElementById("Eth1GatewayAddress").value != ""){
-			if(!ValidateIPaddress("Eth1GatewayAddress")) return false;
-		}
+		// if(document.getElementById("Eth1IpAddress").value != ""){
+			// if(!ValidateIPaddress("Eth1IpAddress")) return false;
+		// }
+		// if(document.getElementById("Eth1SubmaskAddress").value != ""){
+			// if(!ValidateIPaddress("Eth1SubmaskAddress")) return false;
+		// }
+		// if(document.getElementById("Eth1GatewayAddress").value != ""){
+			// if(!ValidateIPaddress("Eth1GatewayAddress")) return false;
+		// }
 		if(document.getElementById("WifiIpAddress").value != ""){
 			if(!ValidateIPaddress("WifiIpAddress")) return false;
 		}

+ 11 - 11
EVSE/rootfs/var/www/set_network_action.php

@@ -15,33 +15,33 @@
 		checkip("Eth0IpAddress");
 		checkip("Eth0SubmaskAddress");
 		checkip("Eth0GatewayAddress");
-		checkip("Eth1IpAddress");
-		checkip("Eth1SubmaskAddress");
-		checkip("Eth1GatewayAddress");
+		// checkip("Eth1IpAddress");
+		// checkip("Eth1SubmaskAddress");
+		// checkip("Eth1GatewayAddress");
 		checkip("WifiIpAddress");
 		checkip("WifiSubmaskAddress");
 		checkip("WifiGatewayAddress");
 		checkip("TelcomIpAddress");
 		checkValue("Eth0DhcpClient");
-		checkValue("Eth1DhcpClient");
+		// checkValue("Eth1DhcpClient");
 		checkValue("WifiMode");
-		checkValue("WifiDhcpServer");
+		// checkValue("WifiDhcpServer");
 		checkValue("WifiDhcpClient");
 //		$json = json_decode(file_get_contents("charging.txt"), true);
 //		$json = string[];
-		$json['FtpServer']				= $_POST['FtpServer'];
+//		$json['FtpServer']				= $_POST['FtpServer'];
 		$json['Eth0DhcpClient']			= $_POST['Eth0DhcpClient'];
 		$json['Eth0IpAddress']			= $_POST['Eth0IpAddress'];
 		$json['Eth0SubmaskAddress']		= $_POST['Eth0SubmaskAddress'];
 		$json['Eth0GatewayAddress']		= $_POST['Eth0GatewayAddress'];
-		$json['Eth1DhcpClient']			= $_POST['Eth1DhcpClient'];
-		$json['Eth1IpAddress']			= $_POST['Eth1IpAddress'];
-		$json['Eth1SubmaskAddress']		= $_POST['Eth1SubmaskAddress'];
-		$json['Eth1GatewayAddress']		= $_POST['Eth1GatewayAddress'];
+		// $json['Eth1DhcpClient']			= $_POST['Eth1DhcpClient'];
+		// $json['Eth1IpAddress']			= $_POST['Eth1IpAddress'];
+		// $json['Eth1SubmaskAddress']		= $_POST['Eth1SubmaskAddress'];
+		// $json['Eth1GatewayAddress']		= $_POST['Eth1GatewayAddress'];
 		$json['WifiMode']				= $_POST['WifiMode'];
 		$json['WifiSsid']				= $_POST['WifiSsid'];
 		$json['WifiPassword']			= $_POST['WifiPassword'];
-		$json['WifiDhcpServer']			= $_POST['WifiDhcpServer'];
+		// $json['WifiDhcpServer']			= $_POST['WifiDhcpServer'];
 		$json['WifiDhcpClient']			= $_POST['WifiDhcpClient'];
 		$json['WifiIpAddress']			= $_POST['WifiIpAddress'];
 		$json['WifiSubmaskAddress']		= $_POST['WifiSubmaskAddress'];

+ 20 - 14
EVSE/rootfs/var/www/set_system.php

@@ -69,7 +69,7 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>System DateTime</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo date('Y-m-d H:i:s');?>" id="SystemDateTime"><br>
+											<input type="text" readonly class="form-control" placeholder="<?php echo date('Y-m-d H:i:s');?>" id="SystemDateTime0"><br>
 											<div class='input-group date' id='datetimepicker1'>
 												<input type='text' class="form-control" name="SystemDateTime" id='SystemDateTime' />
 												<span class="input-group-addon">
@@ -91,7 +91,7 @@ img {
 										</div>*/?>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>
-											<input type="checkbox" id="FactoryConfiguration" name="FactoryConfiguration" checked="<?php echo $obj->{'FactoryConfiguration'}=="1"?"checked":"";?>">
+											<input type="checkbox" id="FactoryConfiguration" name="FactoryConfiguration" <?php echo $obj->{'FactoryConfiguration'}==1?"checked":"";?>>
 											Factory Default Configuration</label>
 <?php /*											<select class="form-control" id="FactoryConfiguration" name="FactoryConfiguration">
 												<option value="0" <?php echo $obj->{'FactoryConfiguration'}=="0"?"selected":""?>>Normal</option>
@@ -100,11 +100,11 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Authorisation Mode</label>
-											<select type="text" class="form-control" id="AuthorisationMode" name="AuthorisationMode" onchange="AuthorisationMode_changed(this.id);">
+											<select type="text" class="form-control" id="AuthorisationMode" name="AuthorisationMode" onchange="AuthorisationMode_changed();">
 												<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>
-											<label id="AuthorisationModeText" style="display:none;">You should set parameter about OCPP after this setting</label>
+											<small class="form-text text-muted-red"><label id="AuthorisationModeText" style="display:none;">You should set parameter about OCPP after this setting</label></small>
 										</div>
 <?php /*										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Default Language</label>
@@ -361,17 +361,19 @@ img {
 ?>
 
 <script type="text/JavaScript">
-   $(document).ready(function(){
-        $("#datetimepicker1").datetimepicker({
+	$(document).ready(function(){
+		$("#datetimepicker1").datetimepicker({
 			format:"YYYY-MM-DD HH:mm:ss"
 		});
 //		var t = new Date(document.getElementById("SystemDateTime").placeholder);
 //		var t_s = t.getTime();
 //		t.setTime(t_s + 1000 );//設定新時間比舊時間多一分鐘
 	//	alert(t);
-		setInterval(function(){var t = new Date(document.getElementById("SystemDateTime").placeholder);var t_s = t.getTime();t.setTime(t_s + 1000 );document.getElementById("SystemDateTime").placeholder= t.Format("yyyy-MM-dd hh:mm:ss");}, 1000);
-		
-    });
+		setInterval(function(){var t = new Date(document.getElementById("SystemDateTime0").placeholder);var t_s = t.getTime();t.setTime(t_s + 1000 );document.getElementById("SystemDateTime0").placeholder= t.Format("yyyy-MM-dd hh:mm:ss");}, 1000);
+		if(document.getElementById("AuthorisationMode").value=="0"){
+			document.getElementById("AuthorisationModeText").style.display="block";
+		}
+	});
 
 	document.getElementById("save").onclick = function() {
 		if(formCheck())
@@ -386,9 +388,9 @@ img {
 			var data =  "SystemId=" + document.getElementById("SystemId").value+
 						"&SystemDateTime=" + document.getElementById("SystemDateTime").value+
 //						"&AcPhaseCount=" + document.getElementById("AcPhaseCount").value+
-						"&FactoryConfiguration=" + document.getElementById("FactoryConfiguration").value+
+						"&FactoryConfiguration=" + (document.getElementById("FactoryConfiguration").checked?1:0)+
 						"&AuthorisationMode=" + document.getElementById("AuthorisationMode").value+
-						"&DefaultLanguage=" + document.getElementById("DefaultLanguage").value+
+//						"&DefaultLanguage=" + document.getElementById("DefaultLanguage").value+
 						"&RfidCardNumEndian=" + document.getElementById("RfidCardNumEndian").value+
 						"&PsuAcInputType=" + document.getElementById("PsuAcInputType").value;
 			
@@ -403,6 +405,7 @@ img {
 					// 伺服器回應成功
 					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
 						alert("<?php echo $lang->showWord("done")?>");
+						location.href="set_system.php";
 					} else {
 						alert(JSON.parse(request.responseText).message);
 					}
@@ -435,9 +438,12 @@ img {
 		return result;
 	}
 
-	function AuthorisationMode_changed(id){
-		if(document.getElementById(x).value == "0"){
-			document.getElementById(AuthorisationModeText).style.display="block";
+	function AuthorisationMode_changed(){
+		if(document.getElementById("AuthorisationMode").value == "0"){
+			document.getElementById("AuthorisationModeText").style.display="block";
+		}
+		else{
+			document.getElementById("AuthorisationModeText").style.display="none";
 		}
 	}
 

+ 3 - 3
EVSE/rootfs/var/www/set_system_action.php

@@ -21,9 +21,9 @@
 			}
 		}
 //		checkValue("AcPhaseCount",1);
-		checkValue("FactoryConfiguration",1);
+//		checkValue("FactoryConfiguration",1);
 		checkValue("AuthorisationMode",1);
-		checkValue("DefaultLanguage",2);
+//		checkValue("DefaultLanguage",2);
 		checkValue("RfidCardNumEndian",1);
 		checkValue("PsuAcInputType",1);
 //		$json = json_decode(file_get_contents("system.txt"), true);
@@ -32,7 +32,7 @@
 //		$json['AcPhaseCount'] 			= $_POST['AcPhaseCount'];
 		$json['FactoryConfiguration']	= $_POST['FactoryConfiguration'];
 		$json['AuthorisationMode']	 	= $_POST['AuthorisationMode'];
-		$json['DefaultLanguage']		= $_POST['DefaultLanguage'];
+//		$json['DefaultLanguage']		= $_POST['DefaultLanguage'];
 		$json['RfidCardNumEndian']		= $_POST['RfidCardNumEndian'];
 		$json['PsuAcInputType']			= $_POST['PsuAcInputType'];