set_backend.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. <?php
  2. ini_set('error_reporting', E_ALL | E_STRICT);
  3. $tag_header = 'set';
  4. include 'head.php';
  5. $obj = json_decode(trim($output[3]));//var_dump($obj);
  6. $system = json_decode(trim($output[0]));
  7. $ModelName = $system->{'ModelName'};
  8. $OcppConnStatus='';
  9. switch ($obj->{'OcppConnStatus'}){
  10. case 0:
  11. $OcppConnStatus=$lang->showWord('disconnected');
  12. break;
  13. case 1:
  14. $OcppConnStatus=$lang->showWord('connected');
  15. break;
  16. }
  17. $MaintainServerConnStatus='';
  18. switch ($obj->{'MaintainServerConnStatus'}){
  19. case 0:
  20. $MaintainServerConnStatus=$lang->showWord('disconnected');
  21. break;
  22. case 1:
  23. $MaintainServerConnStatus=$lang->showWord('connected');
  24. break;
  25. }
  26. ?>
  27. <style>
  28. img {
  29. display: block;
  30. margin-left: auto;
  31. margin-right: auto;
  32. }
  33. <?php if(substr($ModelName,0,1)=="D" && substr($ModelName,3,1)=="C"){?>
  34. /* Colors: Default (blue) */
  35. .toggle-switchy {color:#fff;}
  36. .toggle-switchy > input + .toggle:before {content:'Yes';}
  37. .toggle-switchy > input + .toggle:after {content:'No';}
  38. .toggle-switchy > input + .toggle > .switch {background:#fff;}
  39. .toggle-switchy > input + .toggle + .label {color:#000;}
  40. .toggle-switchy > input:checked + .toggle {background:#3498db;}
  41. .toggle-switchy > input:not(:checked) + .toggle {background:#ccc;}
  42. .toggle-switchy > input:checked + .toggle > .switch {border:3px solid #3498db;}
  43. .toggle-switchy > input:not(:checked) + .toggle > .switch {border:3px solid #ccc;}
  44. .toggle-switchy > input:focus + .toggle,
  45. .toggle-switchy > input:active + .toggle {box-shadow:0 0 5px 3px rgba(0, 119, 200, 0.50);}
  46. /* Rounded switch corners */
  47. .toggle-switchy > input + .toggle {border-radius:4px;}
  48. .toggle-switchy > input + .toggle .switch {border-radius:6px;}
  49. /* //////////////////////////
  50. CORE STYLES BELOW - NO TOUCHY
  51. ////////////////////////// */
  52. .toggle-switchy {display:inline-flex; align-items:center; user-select:none; position:relative;}
  53. .toggle-switchy:hover {cursor:pointer;}
  54. .toggle-switchy > input {position:absolute; opacity:0;}
  55. .toggle-switchy > input + .toggle {align-items:center; position:relative;}
  56. .toggle-switchy > input + .toggle {overflow:hidden; position:relative; flex-shrink:0;}
  57. .toggle-switchy > input[disabled] + .toggle {opacity:0.5;}
  58. .toggle-switchy > input[disabled] + .toggle:hover {cursor:not-allowed;}
  59. .toggle-switchy > input + .toggle {width:100%; height:100%; margin:0; cursor:pointer;}
  60. .toggle-switchy > input + .toggle > .switch {display:block; height:100%; position:absolute; right:0; z-index:3;}
  61. /* Labels */
  62. .toggle-switchy > input + .toggle:before,
  63. .toggle-switchy > input + .toggle:after {display:flex; align-items:center; position:absolute; z-index:2; height:100%;}
  64. .toggle-switchy > input + .toggle:before {right:55%;}
  65. .toggle-switchy > input + .toggle:after {left:50%;}
  66. .toggle-switchy > input + .toggle + .label {margin-left:10px;}
  67. .toggle-switchy[data-label='left'] > input + .toggle {order:2;}
  68. .toggle-switchy[data-label='left'] > input + .toggle + .label {order:1; margin-left:0; margin-right:10px;}
  69. /* Show / Hide */
  70. .toggle-switchy > input + .toggle:before {opacity:0;}
  71. .toggle-switchy > input:checked + .toggle:before {opacity:1;}
  72. .toggle-switchy > input:checked + .toggle:after {opacity:0;}
  73. /* Transitions */
  74. .toggle-switchy > input + .toggle {transition:background 200ms linear, box-shadow 200ms linear;}
  75. .toggle-switchy > input + .toggle:before,
  76. .toggle-switchy > input + .toggle:after {transition:all 200ms linear;}
  77. .toggle-switchy > input + .toggle > .switch {transition:right 200ms linear, border-color 200ms linear;}
  78. /* //////////////////////////
  79. CORE STYLES ABOVE - NO TOUCHY
  80. ////////////////////////// */
  81. /* Size: Extra Large */
  82. .toggle-switchy[data-size='xl'] > input + .toggle {width:85px; height:40px;}
  83. .toggle-switchy[data-size='xl'] > input + .toggle > .switch {width:40px;}
  84. .toggle-switchy[data-size='xl'] > input + .toggle:before,
  85. .toggle-switchy[data-size='xl'] > input + .toggle:after {font-size:1.2rem;}
  86. .toggle-switchy[data-size='xl'] > input:not(:checked) + .toggle > .switch {right:calc(100% - 40px);}
  87. /* Size: Large */
  88. .toggle-switchy[data-size='lg'] > input + .toggle {width:75px; height:35px;}
  89. .toggle-switchy[data-size='lg'] > input + .toggle > .switch {width:35px;}
  90. .toggle-switchy[data-size='lg'] > input + .toggle:before,
  91. .toggle-switchy[data-size='lg'] > input + .toggle:after {font-size:1rem;}
  92. .toggle-switchy[data-size='lg'] > input:not(:checked) + .toggle > .switch {right:calc(100% - 35px);}
  93. /* Size: Default (Medium) */
  94. .toggle-switchy > input + .toggle {width:100px; height:30px;}
  95. .toggle-switchy > input + .toggle > .switch {width:30px;}
  96. .toggle-switchy > input + .toggle:before,
  97. .toggle-switchy > input + .toggle:after {font-size:0.8rem;}
  98. .toggle-switchy > input:not(:checked) + .toggle > .switch {right:calc(100% - 30px);}
  99. /* Size: Small */
  100. .toggle-switchy[data-size='sm'] > input + .toggle {width:55px; height:25px;}
  101. .toggle-switchy[data-size='sm'] > input + .toggle > .switch {width:25px;}
  102. .toggle-switchy[data-size='sm'] > input + .toggle:before,
  103. .toggle-switchy[data-size='sm'] > input + .toggle:after {font-size:0.7rem;}
  104. .toggle-switchy[data-size='sm'] > input:not(:checked) + .toggle > .switch {right:calc(100% - 25px);}
  105. /* Size: Extra Small */
  106. .toggle-switchy[data-size='xs'] > input + .toggle {width:45px; height:20px;}
  107. .toggle-switchy[data-size='xs'] > input + .toggle > .switch {width:20px;}
  108. .toggle-switchy[data-size='xs'] > input + .toggle:before,
  109. .toggle-switchy[data-size='xs'] > input + .toggle:after {font-size:0.5rem;}
  110. .toggle-switchy[data-size='xs'] > input:not(:checked) + .toggle > .switch {right:calc(100% - 20px);}
  111. /* Style: Rounded */
  112. .toggle-switchy[data-style='rounded'] > input + .toggle,
  113. .toggle-switchy[data-style='rounded'] > input + .toggle > .switch {border-radius:50px;}
  114. .toggle-switchy[data-style='rounded'] > input + .toggle:before {right:30%;}
  115. .toggle-switchy[data-style='rounded'] > input + .toggle:after {left:40%;}
  116. /* Style: Square */
  117. .toggle-switchy[data-style='square'] > input + .toggle {border-radius:0;}
  118. .toggle-switchy[data-style='square'] > input + .toggle .switch {border-radius:0;}
  119. /* Text: Off */
  120. .toggle-switchy[data-text='false'] > input + .toggle:before,
  121. .toggle-switchy[data-text='false'] > input + .toggle:after {content:'';}
  122. .toggle-switchy[data-text='false'][data-size='xl'] > input + .toggle {width:80px;}
  123. .toggle-switchy[data-text='false'][data-size='lg'] > input + .toggle {width:70px;}
  124. .toggle-switchy[data-text='false'] > input + .toggle {width:60px;}
  125. .toggle-switchy[data-text='false'][data-size='sm'] > input + .toggle {width:50px;}
  126. .toggle-switchy[data-text='false'][data-size='xs'] > input + .toggle {width:40px;}
  127. /* Color: Red */
  128. .toggle-switchy[data-color='red'] > input:checked + .toggle {background:#e74c3c;}
  129. .toggle-switchy[data-color='red'] > input:checked + .toggle > .switch {border-color:#e74c3c;}
  130. /* Color: Orange */
  131. .toggle-switchy[data-color='orange'] > input:checked + .toggle {background:#e67e22;}
  132. .toggle-switchy[data-color='orange'] > input:checked + .toggle > .switch {border-color:#e67e22;}
  133. /* Color: Yellow */
  134. .toggle-switchy[data-color='yellow'] > input:checked + .toggle {background:#f1c40f;}
  135. .toggle-switchy[data-color='yellow'] > input:checked + .toggle > .switch {border-color:#f1c40f;}
  136. /* Color: Green */
  137. .toggle-switchy[data-color='green'] > input:checked + .toggle {background:#2ecc71;}
  138. .toggle-switchy[data-color='green'] > input:checked + .toggle > .switch {border-color:#2ecc71;}
  139. /* Color: Blue */
  140. .toggle-switchy[data-color='blue'] > input:checked + .toggle {background:#3498db;}
  141. .toggle-switchy[data-color='blue'] > input:checked + .toggle > .switch {border-color:#3498db;}
  142. /* Color: Purple */
  143. .toggle-switchy[data-color='purple'] > input:checked + .toggle {background:#9b59b6;}
  144. .toggle-switchy[data-color='purple'] > input:checked + .toggle > .switch {border-color:#9b59b6;}
  145. /* Color: Gray */
  146. .toggle-switchy[data-color='gray'] > input:checked + .toggle {background:#555;}
  147. .toggle-switchy[data-color='gray'] > input:checked + .toggle > .switch {border-color:#555;}
  148. <?php } ?>
  149. </style>
  150. <div class="envor-content">
  151. <!--
  152. Page Title start
  153. //-->
  154. <section class="envor-page-title-1" data-stellar-background-ratio="0.5">
  155. <div class="container">
  156. <div class="row">
  157. <div class="col-lg-9 col-md-9 col-sm-9">
  158. <h1><?php echo $lang->showWord("backend"); ?></h1>
  159. </div>
  160. </div>
  161. </div>
  162. <!--
  163. Page Title end
  164. //-->
  165. </section>
  166. <!--
  167. Main Content start
  168. //-->
  169. <a id="loadinghref"><div id="loading" style="display:none;"><img src="img/giphy.gif"/></div></a>
  170. <section class="envor-section">
  171. <div class="container">
  172. <div class="row">
  173. <div class="col-lg-12">
  174. <div class="envor-sorting" id="faq-sorting">
  175. <div class="envor-toggle">
  176. <!--Common Information-->
  177. <article class="envor-sorting-item css">
  178. <header><?php echo $lang->showWord("common_information"); ?><i class="fa fa-plus"></i></header>
  179. <section>
  180. <div class="form-group" style="display:<?php echo $am101;?>">
  181. <label><?php echo $lang->showWord("backend_connection_timeout"); ?></label>
  182. <input type="number" name="BackendConnTimeout" id="BackendConnTimeout" class="form-control" value="<?php echo $obj->{'BackendConnTimeout'};?>">
  183. <small class="form-text text-muted-red">seconds</small>
  184. </div>
  185. <div class="form-group" style="display:<?php echo $am101;?>">
  186. <label><?php echo $lang->showWord("offline_policy"); ?></label>
  187. <select class="form-control" id="OfflinePolicy" name="OfflinePolicy">
  188. <option value="0" <?php echo $obj->{'OfflinePolicy'}=="0"?"selected":""?>><?php echo $lang->showWord("local_list"); ?></option>
  189. <?php /* <option value="1" <?php echo $obj->{'OfflinePolicy'}=="1"?"selected":""?>>Phihong RFID tag</option>*/?>
  190. <option value="2" <?php echo $obj->{'OfflinePolicy'}=="2"?"selected":""?>><?php echo $lang->showWord("free_charging"); ?></option>
  191. <option value="3" <?php echo $obj->{'OfflinePolicy'}=="3"?"selected":""?>><?php echo $lang->showWord("no_charging"); ?></option>
  192. </select>
  193. </div>
  194. <div class="form-group" style="display:<?php echo $am101;?>">
  195. <label><?php echo $lang->showWord("offline_max_charge_energy"); ?></label>
  196. <small class="form-text text-muted-red">kWh</small>
  197. <input type="number" name="OfflineMaxChargeEnergy" id="OfflineMaxChargeEnergy" class="form-control" value="<?php echo $obj->{'OfflineMaxChargeEnergy'};?>">
  198. </div>
  199. <div class="form-group" style="display:<?php echo $am101;?>">
  200. <label><?php echo $lang->showWord("offline_max_charge_duration"); ?></label>
  201. <small class="form-text text-muted-red">minutes</small>
  202. <input type="number" name="OfflineMaxChargeDuration" id="OfflineMaxChargeDuration" class="form-control" value="<?php echo $obj->{'OfflineMaxChargeDuration'};?>">
  203. </div>
  204. </section>
  205. </article>
  206. <!--OCPP Backend-->
  207. <article class="envor-sorting-item css">
  208. <header><?php echo $lang->showWord("OCPP_backend"); ?><i class="fa fa-plus"></i></header>
  209. <section>
  210. <div class="form-group" style="display:<?php echo $am101;?>">
  211. <label><?php echo $lang->showWord("ocpp_connection_status"); ?></label>
  212. <input type="text" readonly class="form-control" placeholder="<?php echo $OcppConnStatus;?>">
  213. <input type="hidden" name="OcppConnStatus" id="OcppConnStatus" value="<?php echo $obj->{'OcppConnStatus'};?>">
  214. </div>
  215. <div class="form-group" style="display:<?php echo $am101;?>">
  216. <label><?php echo $lang->showWord("central_system_url"); ?></label>
  217. <input type="text" name="OcppServerURL" id="OcppServerURL" class="form-control" value="<?php echo $obj->{'OcppServerURL'};?>">
  218. </div>
  219. <div class="form-group" style="display:<?php echo $am101;?>">
  220. <label>Charge Box Id</label>
  221. <input type="text" name="ChargeBoxId" id="ChargeBoxId" class="form-control" value="<?php echo htmlspecialchars($obj->{'ChargeBoxId'});?>">
  222. </div>
  223. <div class="form-group" style="display:<?php echo $am101;?>">
  224. <label><?php echo $lang->showWord("charge_point_vendor"); ?></label>
  225. <input type="text" name="chargePointVendor" id="chargePointVendor" class="form-control" value="<?php echo htmlspecialchars($obj->{'chargePointVendor'});?>">
  226. </div>
  227. <div class="form-group" style="display:<?php echo $am101;?>">
  228. <label><?php echo $lang->showWord("ocpp_security_profile"); ?></label>
  229. <select class="form-control" id="OcppSecurityProfile" name="OcppSecurityProfile" onchange="OcppSecurityProfile_changed()">
  230. <option value="0" <?php echo $obj->{'OcppSecurityProfile'}=="0"?"selected":""?>><?php echo $lang->showWord("none_security"); ?></option>
  231. <option value="1" <?php echo $obj->{'OcppSecurityProfile'}=="1"?"selected":""?>><?php echo $lang->showWord("unsecured_transport_with_basic_atuentication"); ?></option>
  232. <option value="2" <?php echo $obj->{'OcppSecurityProfile'}=="2"?"selected":""?>><?php echo $lang->showWord("tls_with_basic_authentication"); ?></option>
  233. <option value="3" <?php echo $obj->{'OcppSecurityProfile'}=="3"?"selected":""?>><?php echo $lang->showWord("tls_with_client_side_certificates"); ?></option>
  234. </select>
  235. </div>
  236. <div id="OcppSecurityPasswordDiv" class="form-group" style="display:<?php echo $am101;?>">
  237. <label><?php echo $lang->showWord("ocpp_security_password"); ?></label>
  238. <input type="text" name="OcppSecurityPassword" id="OcppSecurityPassword" class="form-control" value="<?php echo htmlspecialchars($obj->{'OcppSecurityPassword'});?>">
  239. </div>
  240. <div id="TLSwithClientSideCertificatesDiv" class="form-group file-upload" style="display:<?php echo $am101;?>">
  241. <div class="file-upload">
  242. <label><?php echo $lang->showWord("private_key_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'ChargePointPrivateKey'})>0?$obj->{'ChargePointPrivateKey'}:'File not found'?>)</font></label>
  243. <div class="file-loading">
  244. <input name="private_key" id="private_key" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".key">
  245. </div>
  246. </div>
  247. <div class="file-upload">
  248. <label><?php echo $lang->showWord("certificate_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'ChargePointCertificate'})>0?$obj->{'ChargePointCertificate'}:"File not found"?>)</font></label>
  249. <div class="file-loading">
  250. <input name="certificate" id="certificate" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".pem">
  251. </div>
  252. </div>
  253. <div class="file-upload">
  254. <label><?php echo $lang->showWord("V2GPrivateKey_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'V2GPrivateKey'})>0?$obj->{'V2GPrivateKey'}:'File not found'?>)</font></label>
  255. <div class="file-loading">
  256. <input name="V2GPrivateKey" id="V2GPrivateKey" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".key">
  257. </div>
  258. </div>
  259. <div class="file-upload">
  260. <label><?php echo $lang->showWord("V2GRootCertificate_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'V2GRootCertificate'})>0?$obj->{'V2GRootCertificate'}:"File not found"?>)</font></label>
  261. <div class="file-loading">
  262. <input name="V2GRootCertificate" id="V2GRootCertificate" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".pem">
  263. </div>
  264. </div>
  265. <div class="file-upload">
  266. <label><?php echo $lang->showWord("V2GCertificateChain_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'V2GCertificateChain'})>0?$obj->{'V2GCertificateChain'}:"File not found"?>)</font></label>
  267. <div class="file-loading">
  268. <input name="V2GCertificateChain" id="V2GCertificateChain" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".pem">
  269. </div>
  270. </div>
  271. <div class="file-upload">
  272. <label><?php echo $lang->showWord("MORootCertificate_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'MORootCertificate'})>0?$obj->{'MORootCertificate'}:"File not found"?>)</font></label>
  273. <div class="file-loading">
  274. <input name="MORootCertificate" id="MORootCertificate" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".pem">
  275. </div>
  276. </div>
  277. <div class="file-upload">
  278. <label><?php echo $lang->showWord("CSRootCertificate_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'CSRootCertificate'})>0?$obj->{'CSRootCertificate'}:"File not found"?>)</font></label>
  279. <div class="file-loading">
  280. <input name="CSRootCertificate" id="CSRootCertificate" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".pem">
  281. </div>
  282. </div>
  283. <div class="file-upload">
  284. <label><?php echo $lang->showWord("ManufacturerRootCertificate_file"); ?> sha256 hash: <font color="#ff0000">(<?php echo strlen($obj->{'ManufacturerRootCertificate'})>0?$obj->{'ManufacturerRootCertificate'}:"File not found"?>)</font></label>
  285. <div class="file-loading">
  286. <input name="ManufacturerRootCertificate" id="ManufacturerRootCertificate" type="file" class="file" data-show-preview="false" data-show-upload="false" accept=".pem">
  287. </div>
  288. </div>
  289. </div>
  290. <?php if(substr($ModelName,0,2)=="AX" || substr($ModelName,0,2)=="AW" || substr($ModelName,0,1)=="D"){?>
  291. <div class="form-group" style="display:block">
  292. <label><?php echo $lang->showWord("ocpp_receipt_url"); ?></label>
  293. <input type="text" name="OcppReceiptrURL" id="OcppReceiptrURL" class="form-control" value="<?php echo $obj->{'OcppReceiptrURL'};?>">
  294. </div>
  295. <div class="form-group" style="display:block">
  296. <label><?php echo $lang->showWord("local_loading_balance"); ?></label>
  297. <select class="form-control" id="isEnableLocalPowerSharging" name="isEnableLocalPowerSharging" onChange="isEnableLocalPowerSharging_changed()">
  298. <option value="0" <?php echo $obj->{'isEnableLocalPowerSharging'}=="0"?"selected":""?>><?php echo $lang->showWord("disable"); ?></option>
  299. <option value="1" <?php echo $obj->{'isEnableLocalPowerSharging'}=="1"?"selected":""?>><?php echo $lang->showWord("master"); ?></option>
  300. <option value="2" <?php echo $obj->{'isEnableLocalPowerSharging'}=="2"?"selected":""?>><?php echo $lang->showWord("slave"); ?></option>
  301. </select>
  302. </div>
  303. <div id="PowerSharingCapacityDiv" class="form-group" style="display:<?php echo $am101;?>">
  304. <label>Power Sharing Capacity</label><small class="form-text text-muted-red"> W</small>
  305. <input type="number" min="0" max="5000000" name="PowerSharingCapacity" id="PowerSharingCapacity" class="form-control" value="<?php echo $obj->{'PowerSharingCapacity'};?>">
  306. <small class="form-text text-muted-red">'0' means follow rating power from model name</small>
  307. </div>
  308. <div id="PowerSharingServerIPDiv" class="form-group" style="display:<?php echo $am101;?>">
  309. <label><?php echo $lang->showWord("power_sharing_server_ip"); ?></label>
  310. <input type="text" name="PowerSharingServerIP" id="PowerSharingServerIP" class="form-control" value="<?php echo $obj->{'PowerSharingServerIP'};?>">
  311. </div>
  312. <?php } ?>
  313. <div class="form-group" style="display:<?php echo $am101;?>">
  314. <label><?php echo $lang->showWord("maintain_server_connection_status"); ?></label>
  315. <input type="text" readonly class="form-control" placeholder="<?php echo $MaintainServerConnStatus;?>">
  316. <input type="hidden" name="MaintainServerConnStatus" id="MaintainServerConnStatus" value="<?php echo $obj->{'MaintainServerConnStatus'};?>">
  317. </div>
  318. <div class="form-group" style="display:<?php echo $am101;?>">
  319. <label><?php echo $lang->showWord("maintain_server_url"); ?></label>
  320. <input type="text" name="MaintainServerURL" id="MaintainServerURL" class="form-control" value="<?php echo $obj->{'MaintainServerURL'};?>">
  321. </div>
  322. <div class="form-group" style="display:<?php echo $am101;?>">
  323. <label><?php echo $lang->showWord("maintain_server_security_profile"); ?></label>
  324. <select class="form-control" id="MaintainServerSecurityProfile" name="MaintainServerSecurityProfile" onchange="MaintainServerSecurityProfile_changed()">
  325. <option value="0" <?php echo $obj->{'MaintainServerSecurityProfile'}=="0"?"selected":""?>><?php echo $lang->showWord("none_security"); ?></option>
  326. <option value="1" <?php echo $obj->{'MaintainServerSecurityProfile'}=="1"?"selected":""?>><?php echo $lang->showWord("unsecured_transport_with_basic_atuentication"); ?></option>
  327. <option value="2" <?php echo $obj->{'MaintainServerSecurityProfile'}=="2"?"selected":""?>><?php echo $lang->showWord("tls_with_basic_authentication"); ?></option>
  328. <!--<option value="3" <?php echo $obj->{'MaintainServerSecurityProfile'}=="3"?"selected":""?>><?php echo $lang->showWord("tls_with_client_side_certificates"); ?></option>-->
  329. </select>
  330. </div>
  331. <div id="MaintainServerSecurityPasswordDiv" class="form-group" style="display:<?php echo $am101;?>">
  332. <label><?php echo $lang->showWord("maintain_server_security_password"); ?></label>
  333. <input type="text" name="MaintainServerSecurityPassword" id="MaintainServerSecurityPassword" class="form-control" value="<?php echo htmlspecialchars($obj->{'MaintainServerSecurityPassword'});?>">
  334. </div>
  335. </section>
  336. </article>
  337. <?php if(substr($ModelName,0,1)=="D" && substr($ModelName,3,1)=="C"){ ?>
  338. <!--TTIA-->
  339. <article class="envor-sorting-item css">
  340. <header>TTIA<i class="fa fa-plus"></i></header>
  341. <section>
  342. <div class="form-group" style="display:<?php echo $am101;?>">
  343. <label>TTIA</label>
  344. <label class="toggle-switchy" for="isEnableTTIA" data-size="" data-style="rounded">
  345. <input type="checkbox" id="isEnableTTIA" <?php echo $obj->{'isEnableTTIA'}==1?"checked":"";?> onclick="isEnableTTIAChecked()">
  346. <span class="toggle">
  347. <span class="switch"></span>
  348. </span>
  349. </label>
  350. </div>
  351. <div id="server_addrDiv" class="form-group">
  352. <label>Server Address</label>
  353. <input type="text" name="server_addr" id="server_addr" class="form-control" value="<?php echo $obj->{'server_addr'};?>">
  354. </div>
  355. <div id="server_portDiv" class="form-group">
  356. <label>Server Port</label>
  357. <input type="text" name="server_port" id="server_port" class="form-control" value="<?php echo $obj->{'server_port'};?>">
  358. </div>
  359. <div id="busVenderIdDiv" class="form-group">
  360. <label>Bus Vender Id</label>
  361. <input type="text" name="busVenderId" id="busVenderId" class="form-control" value="<?php echo $obj->{'busVenderId'};?>">
  362. </div>
  363. <div id="EquipmentProviderDiv" class="form-group">
  364. <label>Equipment Provider</label>
  365. <input type="text" name="EquipmentProvider" id="EquipmentProvider" class="form-control" value="<?php echo $obj->{'EquipmentProvider'};?>">
  366. </div>
  367. <div id="TransportationCompanyNoDiv" class="form-group">
  368. <label>TransportationCompanyNo</label>
  369. <input type="text" name="TransportationCompanyNo" id="TransportationCompanyNo" class="form-control" value="<?php echo $obj->{'TransportationCompanyNo'};?>">
  370. </div>
  371. <div id="ChargeBoxIdDiv" class="form-group">
  372. <label>Charge Box Id</label>
  373. <input type="text" name="TTIAChargeBoxId" id="TTIAChargeBoxId" class="form-control" value="<?php echo $obj->{'TTIAChargeBoxId'};?>">
  374. </div>
  375. <div id="evseStationDiv" class="form-group">
  376. <label>EVSE Station</label>
  377. <input type="text" name="evseStation" id="evseStation" class="form-control" value="<?php echo $obj->{'evseStation'};?>">
  378. </div>
  379. </section>
  380. </article>
  381. <?php } ?>
  382. <article class="envor-sorting-item css">
  383. <div align="center"><button id="save"><?php echo $lang->showWord("set")?></button></div>
  384. </article>
  385. </div>
  386. </div>
  387. </div>
  388. </div>
  389. </div>
  390. </section>
  391. </div>
  392. <?php
  393. include 'foot.php';
  394. ?>
  395. <script type="text/JavaScript">
  396. <?php if(substr($ModelName,0,2)=="AX" || substr($ModelName,0,2)=="AW" || substr($ModelName,0,1)=="D"){?>
  397. $(document).ready(function(){
  398. isEnableLocalPowerSharging_changed();
  399. });
  400. <?php } ?>
  401. <?php if(substr($ModelName,0,1)=="D" && substr($ModelName,3,1)=="C"){?>
  402. $(document).ready(function(){
  403. isEnableTTIAChecked();
  404. });
  405. <?php } ?>
  406. OcppSecurityProfile_changed();
  407. MaintainServerSecurityProfile_changed();
  408. document.getElementById("save").onclick = function() {
  409. if(formCheck())
  410. {
  411. window.location="#loadinghref";
  412. document.getElementById("loading").style.display="block";
  413. // 發送 Ajax 查詢請求並處理
  414. var request = new XMLHttpRequest();
  415. request.open("POST", "set_backend_action.php");
  416. // POST 參數須使用 send() 發送
  417. var formData = new FormData();
  418. if(document.getElementById("private_key").value != ""){
  419. var fileInput = document.getElementById('private_key');
  420. var file = fileInput.files[0];
  421. formData.append("private_key", file);
  422. }
  423. if(document.getElementById("certificate").value != ""){
  424. var fileInput = document.getElementById('certificate');
  425. var file = fileInput.files[0];
  426. formData.append("certificate", file);
  427. }
  428. if(document.getElementById("V2GPrivateKey").value != ""){
  429. var fileInput = document.getElementById('V2GPrivateKey');
  430. var file = fileInput.files[0];
  431. formData.append("V2GPrivateKey", file);
  432. }
  433. if(document.getElementById("V2GRootCertificate").value != ""){
  434. var fileInput = document.getElementById('V2GRootCertificate');
  435. var file = fileInput.files[0];
  436. formData.append("V2GRootCertificate", file);
  437. }
  438. if(document.getElementById("V2GCertificateChain").value != ""){
  439. var fileInput = document.getElementById('V2GCertificateChain');
  440. var file = fileInput.files[0];
  441. formData.append("V2GCertificateChain", file);
  442. }
  443. if(document.getElementById("MORootCertificate").value != ""){
  444. var fileInput = document.getElementById('MORootCertificate');
  445. var file = fileInput.files[0];
  446. formData.append("MORootCertificate", file);
  447. }
  448. if(document.getElementById("CSRootCertificate").value != ""){
  449. var fileInput = document.getElementById('CSRootCertificate');
  450. var file = fileInput.files[0];
  451. formData.append("CSRootCertificate", file);
  452. }
  453. if(document.getElementById("ManufacturerRootCertificate").value != ""){
  454. var fileInput = document.getElementById('ManufacturerRootCertificate');
  455. var file = fileInput.files[0];
  456. formData.append("ManufacturerRootCertificate", file);
  457. }
  458. formData.append("BackendConnTimeout", document.getElementById("BackendConnTimeout").value);
  459. formData.append("OfflinePolicy", document.getElementById("OfflinePolicy").value);
  460. formData.append("OfflineMaxChargeEnergy", document.getElementById("OfflineMaxChargeEnergy").value);
  461. formData.append("OfflineMaxChargeDuration", document.getElementById("OfflineMaxChargeDuration").value);
  462. formData.append("OcppServerURL", escapeHtml(document.getElementById("OcppServerURL").value));
  463. formData.append("MaintainServerURL", escapeHtml(document.getElementById("MaintainServerURL").value));
  464. formData.append("ChargeBoxId", escapeHtml(document.getElementById("ChargeBoxId").value));
  465. formData.append("chargePointVendor", escapeHtml(document.getElementById("chargePointVendor").value));
  466. formData.append("OcppSecurityProfile", document.getElementById("OcppSecurityProfile").value);
  467. formData.append("OcppSecurityPassword", escapeHtml(document.getElementById("OcppSecurityPassword").value));
  468. //formData.append("file", file);
  469. formData.append("MaintainServerSecurityProfile", document.getElementById("MaintainServerSecurityProfile").value);
  470. formData.append("MaintainServerSecurityPassword", escapeHtml(document.getElementById("MaintainServerSecurityPassword").value));
  471. <?php if(substr($ModelName,0,2)=="AX" || substr($ModelName,0,2)=="AW" || substr($ModelName,0,1)=="D"){?>
  472. formData.append("isEnableLocalPowerSharging", document.getElementById("isEnableLocalPowerSharging").value);
  473. formData.append("PowerSharingServerIP", document.getElementById("PowerSharingServerIP").value);
  474. formData.append("PowerSharingCapacity", document.getElementById("PowerSharingCapacity").value);
  475. formData.append("OcppReceiptrURL", escapeHtml(document.getElementById("OcppReceiptrURL").value));
  476. <?php } ?>
  477. <?php if(substr($ModelName,0,1)=="D" && substr($ModelName,3,1)=="C"){?>
  478. formData.append("isEnableTTIA", (document.getElementById("isEnableTTIA").checked?"1":"0"));
  479. formData.append("server_addr", document.getElementById("server_addr").value);
  480. formData.append("server_port", document.getElementById("server_port").value);
  481. formData.append("busVenderId", document.getElementById("busVenderId").value);
  482. formData.append("EquipmentProvider", document.getElementById("EquipmentProvider").value);
  483. formData.append("TransportationCompanyNo", document.getElementById("TransportationCompanyNo").value);
  484. formData.append("TTIAChargeBoxId", document.getElementById("TTIAChargeBoxId").value);
  485. formData.append("evseStation", document.getElementById("evseStation").value);
  486. <?php } ?>
  487. // POST 請求必須設置表頭在 open() 下面,send() 上面
  488. // request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  489. request.send(formData);
  490. request.onreadystatechange = function() {
  491. // 伺服器請求完成
  492. if (request.readyState == 4) {
  493. document.getElementById("loading").style.display="none";
  494. // 伺服器回應成功
  495. if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
  496. alert("<?php echo $lang->showWord("done")?>");
  497. location.href="set_backend.php";
  498. } else {
  499. alert(JSON.parse(request.responseText).message);
  500. }
  501. request = null;
  502. }
  503. }
  504. }
  505. }
  506. function formCheck()
  507. {
  508. var OcppServerURL = document.getElementById("OcppServerURL").value;
  509. var MaintainServerURL = document.getElementById("MaintainServerURL").value;
  510. var ChargeBoxId = document.getElementById("ChargeBoxId").value;
  511. var chargePointVendor = document.getElementById("chargePointVendor").value;
  512. 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,}))+/;
  513. if(OcppServerURL!=""){
  514. if(OcppServerURL.match(tests)==null){
  515. alert("OcppServerURL format error!");
  516. document.getElementById("OcppServerURL").focus();
  517. return false;
  518. }
  519. }
  520. if(MaintainServerURL!=""){
  521. if(MaintainServerURL.match(tests)==null){
  522. alert("MaintainServerURL format error!");
  523. document.getElementById("MaintainServerURL").focus();
  524. return false;
  525. }
  526. }
  527. if(ChargeBoxId!=""){
  528. if(ChargeBoxId.length>25){
  529. alert("Length of ChargeBoxId should be less than 25!");
  530. document.getElementById("ChargeBoxId").focus();
  531. return false;
  532. }
  533. }
  534. if(chargePointVendor!=""){
  535. if(chargePointVendor.length>20){
  536. alert("Length of chargePointVendor should be less than 20!");
  537. document.getElementById("chargePointVendor").focus();
  538. return false;
  539. }
  540. }
  541. <?php if(substr($ModelName,0,1)=="D" && substr($ModelName,3,1)=="C"){?>
  542. var server_port = document.getElementById("server_port").value;
  543. if(server_port!=""){
  544. if(server_port>65535){
  545. alert("Value of Server Port should be less than 65535!");
  546. document.getElementById("server_port").focus();
  547. return false;
  548. }
  549. }
  550. var busVenderId = document.getElementById("busVenderId").value;
  551. if(busVenderId!=""){
  552. if(busVenderId>65535){
  553. alert("Value of Bus Vender Id should be less than 65535!");
  554. document.getElementById("busVenderId").focus();
  555. return false;
  556. }
  557. }
  558. var EquipmentProvider = document.getElementById("EquipmentProvider").value;
  559. if(EquipmentProvider!=""){
  560. if(UTF8Length(EquipmentProvider)>15){
  561. alert("Length of Equipment Provider should be less than 15(Chinese 5 words)!");
  562. document.getElementById("EquipmentProvider").focus();
  563. return false;
  564. }
  565. }
  566. var evseStation = document.getElementById("evseStation").value;
  567. if(evseStation!=""){
  568. if(UTF8Length(evseStation)>15){
  569. alert("Length of EVSE Station should be less than 15(Chinese 5 words)!");
  570. document.getElementById("evseStation").focus();
  571. return false;
  572. }
  573. }
  574. var TransportationCompanyNo = document.getElementById("TransportationCompanyNo").value;
  575. if(TransportationCompanyNo!=""){
  576. if(TransportationCompanyNo>255){
  577. alert("Value of Transportation Company No should be less than 255!");
  578. document.getElementById("TransportationCompanyNo").focus();
  579. return false;
  580. }
  581. }
  582. var TTIAChargeBoxId = document.getElementById("TTIAChargeBoxId").value;
  583. if(TTIAChargeBoxId!=""){
  584. if(TTIAChargeBoxId>255){
  585. alert("Value of Charge Box Id should be less than 255!");
  586. document.getElementById("TTIAChargeBoxId").focus();
  587. return false;
  588. }
  589. }
  590. <?php } ?>
  591. return true;
  592. }
  593. function OcppSecurityProfile_changed(){
  594. if(document.getElementById("OcppSecurityProfile").value == "1" || document.getElementById("OcppSecurityProfile").value == "2" || document.getElementById("OcppSecurityProfile").value == "3"){
  595. document.getElementById("OcppSecurityPasswordDiv").style.display="block";
  596. if(document.getElementById("OcppSecurityProfile").value == "3"){
  597. document.getElementById("TLSwithClientSideCertificatesDiv").style.display="block";
  598. }
  599. else{
  600. document.getElementById("TLSwithClientSideCertificatesDiv").style.display="none";
  601. }
  602. }
  603. else{
  604. document.getElementById("OcppSecurityPasswordDiv").style.display="none";
  605. document.getElementById("TLSwithClientSideCertificatesDiv").style.display="none";
  606. }
  607. }
  608. function MaintainServerSecurityProfile_changed(){
  609. if(document.getElementById("MaintainServerSecurityProfile").value == "1" || document.getElementById("MaintainServerSecurityProfile").value == "2" || document.getElementById("MaintainServerSecurityProfile").value == "3"){
  610. document.getElementById("MaintainServerSecurityPasswordDiv").style.display="block";
  611. }
  612. else{
  613. document.getElementById("MaintainServerSecurityPasswordDiv").style.display="none";
  614. }
  615. }
  616. <?php if(substr($ModelName,0,2)=="AX" || substr($ModelName,0,2)=="AW" || substr($ModelName,0,1)=="D"){?>
  617. function isEnableLocalPowerSharging_changed(){
  618. /*
  619. if(document.getElementById("isEnableLocalPowerSharging").selectedIndex!=0){
  620. document.getElementById("OcppServerURL").setAttribute("readOnly","true");
  621. document.getElementById("MaintainServerURL").setAttribute("readOnly","true");
  622. document.getElementById("ChargeBoxId").setAttribute("readOnly","true");
  623. document.getElementById("chargePointVendor").setAttribute("readOnly","true");
  624. }
  625. else{
  626. document.getElementById("OcppServerURL").removeAttribute("readOnly");
  627. document.getElementById("MaintainServerURL").removeAttribute("readOnly");
  628. document.getElementById("ChargeBoxId").removeAttribute("readOnly");
  629. document.getElementById("chargePointVendor").removeAttribute("readOnly");
  630. }*/
  631. if(document.getElementById("isEnableLocalPowerSharging").selectedIndex==1)
  632. {
  633. document.getElementById("PowerSharingCapacityDiv").style.display="block";
  634. document.getElementById("PowerSharingServerIPDiv").style.display="none";
  635. }
  636. else if(document.getElementById("isEnableLocalPowerSharging").selectedIndex==2)
  637. {
  638. document.getElementById("PowerSharingCapacityDiv").style.display="none";
  639. document.getElementById("PowerSharingServerIPDiv").style.display="block";
  640. }
  641. else
  642. {
  643. document.getElementById("PowerSharingCapacityDiv").style.display="none";
  644. document.getElementById("PowerSharingServerIPDiv").style.display="none";
  645. }
  646. }
  647. <?php } ?>
  648. <?php if(substr($ModelName,0,1)=="D" && substr($ModelName,3,1)=="C"){?>
  649. function isEnableTTIAChecked(){
  650. if(document.getElementById("isEnableTTIA").checked){
  651. document.getElementById("server_addrDiv").style.display="block";
  652. document.getElementById("server_portDiv").style.display="block";
  653. document.getElementById("busVenderIdDiv").style.display="block";
  654. document.getElementById("EquipmentProviderDiv").style.display="block";
  655. document.getElementById("TransportationCompanyNoDiv").style.display="block";
  656. document.getElementById("ChargeBoxIdDiv").style.display="block";
  657. document.getElementById("evseStationDiv").style.display="block";
  658. }
  659. else{
  660. document.getElementById("server_addrDiv").style.display="none";
  661. document.getElementById("server_portDiv").style.display="none";
  662. document.getElementById("busVenderIdDiv").style.display="none";
  663. document.getElementById("EquipmentProviderDiv").style.display="none";
  664. document.getElementById("TransportationCompanyNoDiv").style.display="none";
  665. document.getElementById("ChargeBoxIdDiv").style.display="none";
  666. document.getElementById("evseStationDiv").style.display="none";
  667. }
  668. }
  669. <?php } ?>
  670. function isNumberKey(evt)
  671. {
  672. var charCode = (evt.which) ? evt.which : event.keyCode
  673. if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
  674. return false;
  675. return true;
  676. }
  677. function UTF8Length(tx){
  678. var str = encodeURIComponent(tx);
  679. len = str.replace(/%[A-F\d]{2}/g, 'U').length;
  680. return len;
  681. }
  682. function escapeHtml(text) {
  683. var map = {
  684. '&': '&amp;',
  685. '<': '&lt;',
  686. '>': '&gt;',
  687. '"': '&quot;',
  688. "'": '&#039;'
  689. };
  690. return text.replace(/[&<>"']/g, function(m) { return map[m]; });
  691. }
  692. </script>
  693. </html>