@@ -136,25 +136,6 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
136136 }
137137
138138 /////// HTTP GET: Print HTML ///////
139-
140- private String printChargePoints () {
141- StringBuilder builder = new StringBuilder (
142- "<b>Charge Points with OCPP v1.2</b><hr>\n "
143- + "<table>\n "
144- + "<tr><td style=\" vertical-align:top\" >\n "
145- + "<input type=\" button\" value=\" Select All\" onClick=\" selectAll(document.getElementById('cp_items'))\" >\n "
146- + "<input type=\" button\" value=\" Select None\" onClick=\" selectNone(document.getElementById('cp_items'))\" >\n "
147- + "</td><td>\n "
148- + "<select name=\" cp_items\" id=\" cp_items\" size=\" 5\" multiple>\n " );
149-
150- for (String key : chargePointsList .keySet ()) {
151- String value = chargePointsList .get (key );
152- builder .append ("<option value=\" " + key + ";" + value + "\" >" + key + " — " + value + "</option>\n " );
153- }
154-
155- builder .append ("</select>\n </td>\n </tr>\n </table>\n <br>\n " );
156- return builder .toString ();
157- }
158139
159140 private String printChangeAvail () {
160141 return
@@ -175,14 +156,15 @@ private String printChangeAvail() {
175156
176157 // Print the div on the right
177158 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/ChangeAvailability\" >\n "
178- + printChargePoints ()
159+ + Common . printChargePointsMultipleSelect ( chargePointsList , "1.2" )
179160 + "<b>Parameters</b><hr>\n "
180161 + "<table class=\" params\" >\n "
181162 + "<tr><td>Connector Id (integer):</td><td><input type=\" number\" min=\" 0\" name=\" connectorId\" placeholder=\" if empty, 0 = charge point as a whole\" ></td></tr>\n "
182163 + "<tr><td>Availability Type:</td><td><input type=\" radio\" name=\" availType\" value=\" Inoperative\" checked> Inoperative</td></tr>\n "
183164 + "<tr><td></td><td><input type=\" radio\" name=\" availType\" value=\" Operative\" > Operative</td></tr>\n "
184- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
185- + "</table>\n </form>\n </div>" ;
165+ + "</table>\n "
166+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
167+ + "</form>\n </div>\n " ;
186168 }
187169
188170 private String printChangeConf () {
@@ -204,7 +186,7 @@ private String printChangeConf() {
204186
205187 // Print the div on the right
206188 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/ChangeConfiguration\" >\n "
207- + printChargePoints ()
189+ + Common . printChargePointsMultipleSelect ( chargePointsList , "1.2" )
208190 + "<b>Parameters</b><hr>\n "
209191 + "<table class=\" params\" >\n "
210192 + "<tr><td>Configuration key:</td><td>\n "
@@ -221,8 +203,9 @@ private String printChangeConf() {
221203 + "</select>\n "
222204 + "</td></tr>\n "
223205 + "<tr><td>Value:</td><td><input type=\" text\" name=\" value\" ></td></tr>\n "
224- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
225- + "</table>\n </form>\n </div>" ;
206+ + "</table>\n "
207+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
208+ + "</form>\n </div>\n " ;
226209 }
227210
228211 private String printClearCache () {
@@ -244,13 +227,11 @@ private String printClearCache() {
244227
245228 // Print the div on the right
246229 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/ClearCache\" >\n "
247- + printChargePoints ()
230+ + Common . printChargePointsMultipleSelect ( chargePointsList , "1.2" )
248231 + "<b>Parameters</b><hr>\n "
249- + "<center>"
250- + "<i>No parameters required.</i>"
251- + "<br><br>"
252- + "<input type=\" submit\" value=\" Perform\" >"
253- + "</center>\n </form>\n </div>" ;
232+ + "<center><i>No parameters required.</i></center>"
233+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
234+ + "</form>\n </div>\n " ;
254235 }
255236
256237 private String printGetDiagnostics () {
@@ -272,16 +253,17 @@ private String printGetDiagnostics() {
272253
273254 // Print the div on the right
274255 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/GetDiagnostics\" >\n "
275- + printChargePoints ()
256+ + Common . printChargePointsMultipleSelect ( chargePointsList , "1.2" )
276257 + "<b>Parameters</b><hr>\n "
277258 + "<table class=\" params\" >\n "
278259 + "<tr><td>Location (directory URI):</td><td><input type=\" text\" name=\" location\" ></td></tr>\n "
279260 + "<tr><td>Retries (integer):</td><td><input type=\" number\" min=\" 0\" name=\" retries\" ></td></tr>\n "
280261 + "<tr><td>Retry Interval (integer):</td><td><input type=\" number\" min=\" 0\" name=\" retryInterval\" ></td></tr>\n "
281262 + "<tr><td>Start time (ex: 2011-12-21 11:33):</td><td><input type=\" datetime\" name=\" startTime\" ></td></tr>\n "
282263 + "<tr><td>Stop time (ex: 2011-12-21 11:33):</td><td><input type=\" datetime\" name=\" stopTime\" ></td></tr>\n "
283- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
284- + "</table>\n </form>\n </div>" ;
264+ + "</table>\n "
265+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
266+ + "</form>\n </div>\n " ;
285267 }
286268
287269 private String printRemoteStartTrans () {
@@ -303,13 +285,14 @@ private String printRemoteStartTrans() {
303285
304286 // Print the div on the right
305287 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/RemoteStartTransaction\" >\n "
306- + printChargePoints ()
288+ + Common . printChargePointsSingleSelect ( chargePointsList , "1.2" )
307289 + "<b>Parameters</b><hr>\n "
308290 + "<table class=\" params\" >\n "
309291 + "<tr><td>Connector Id (integer, not 0):</td><td><input type=\" number\" min=\" 1\" name=\" connectorId\" ></td></tr>\n "
310292 + "<tr><td>idTag (string):</td><td><input type=\" text\" name=\" idTag\" ></td></tr>\n "
311- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
312- + "</table>\n </form>\n </div>" ;
293+ + "</table>\n "
294+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
295+ + "</form>\n </div>\n " ;
313296 }
314297
315298 private String printRemoteStopTrans () {
@@ -331,12 +314,13 @@ private String printRemoteStopTrans() {
331314
332315 // Print the div on the right
333316 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/RemoteStopTransaction\" >\n "
334- + printChargePoints ()
317+ + Common . printChargePointsSingleSelect ( chargePointsList , "1.2" )
335318 + "<b>Parameters</b><hr>\n "
336319 + "<table class=\" params\" >\n "
337320 + "<tr><td>Transaction Id (integer):</td><td><input type=\" number\" name=\" transactionId\" ></td></tr>\n "
338- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
339- + "</table>\n </form>\n </div>" ;
321+ + "</table>\n "
322+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
323+ + "</form>\n </div>\n " ;
340324 }
341325
342326 private String printReset () {
@@ -358,13 +342,14 @@ private String printReset() {
358342
359343 // Print the div on the right
360344 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/Reset\" >\n "
361- + printChargePoints ()
345+ + Common . printChargePointsMultipleSelect ( chargePointsList , "1.2" )
362346 + "<b>Parameters</b><hr>\n "
363347 + "<table class=\" params\" >\n "
364348 + "<tr><td>Reset Type:</td><td><input type=\" radio\" name=\" resetType\" value=\" Hard\" checked> Hard</td></tr>\n "
365349 + "<tr><td></td><td><input type=\" radio\" name=\" resetType\" value=\" Soft\" > Soft</td></tr>\n "
366- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
367- + "</table>\n </form>\n </div>" ;
350+ + "</table>\n "
351+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
352+ + "</form>\n </div>\n " ;
368353 }
369354
370355 private String printUnlockConnector () {
@@ -386,12 +371,13 @@ private String printUnlockConnector() {
386371
387372 // Print the div on the right
388373 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/UnlockConnector\" >\n "
389- + printChargePoints ()
374+ + Common . printChargePointsSingleSelect ( chargePointsList , "1.2" )
390375 + "<b>Parameters</b><hr>\n "
391376 + "<table class=\" params\" >\n "
392377 + "<tr><td>Connector Id (integer, not 0):</td><td><input type=\" number\" min=\" 1\" name=\" connectorId\" ></td></tr>\n "
393- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
394- + "</table>\n </form>\n </div>" ;
378+ + "</table>\n "
379+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
380+ + "</form>\n </div>\n " ;
395381 }
396382
397383 private String printUpdateFirmware () {
@@ -413,15 +399,16 @@ private String printUpdateFirmware() {
413399
414400 // Print the div on the right
415401 + "<div class=\" op-content\" >\n <form method=\" POST\" action=\" " + contextPath + servletPath + "/UpdateFirmware\" >\n "
416- + printChargePoints ()
402+ + Common . printChargePointsMultipleSelect ( chargePointsList , "1.2" )
417403 + "<b>Parameters</b><hr>\n "
418404 + "<table class=\" params\" >\n "
419405 + "<tr><td>Location (URI):</td><td><input type=\" text\" name=\" location\" ></td></tr>\n "
420406 + "<tr><td>Retries (integer):</td><td><input type=\" number\" min=\" 0\" name=\" retries\" ></td></tr>\n "
421407 + "<tr><td>Retry Interval (integer):</td><td><input type=\" number\" min=\" 0\" name=\" retryInterval\" ></td></tr>\n "
422408 + "<tr><td>Retrieve Date (ex: 2011-12-21 11:33):</td><td><input type=\" datetime\" name=\" retrieveDate\" ></td></tr>\n "
423- + "<tr><td></td><td id=\" add_space\" ><input type=\" submit\" value=\" Perform\" ></td></tr>\n "
424- + "</table>\n </form>\n </div>" ;
409+ + "</table>\n "
410+ + "<div class=\" submit-button\" ><input type=\" submit\" value=\" Perform\" ></div>\n "
411+ + "</form>\n </div>\n " ;
425412 }
426413
427414 /////// HTTP POST: Process Request ///////
0 commit comments