@@ -1272,22 +1272,23 @@ void WiFiManager::startWPS() {
1272
1272
}
1273
1273
#endif
1274
1274
1275
- String WiFiManager::getHTTPHead (String title){
1275
+ String WiFiManager::getHTTPHead (String title, String classes ){
1276
1276
String page;
1277
1277
page += FPSTR (HTTP_HEAD_START);
1278
1278
page.replace (FPSTR (T_v), title);
1279
1279
page += FPSTR (HTTP_SCRIPT);
1280
1280
page += FPSTR (HTTP_STYLE);
1281
1281
page += _customHeadElement;
1282
1282
1283
- if (_bodyClass != " " ){
1284
- String p = FPSTR (HTTP_HEAD_END);
1285
- p.replace (FPSTR (T_c), _bodyClass); // add class str
1286
- page += p;
1283
+ String p = FPSTR (HTTP_HEAD_END);
1284
+ if (_bodyClass != " " ) {
1285
+ if (classes != " " ) {
1286
+ classes += " " ; // add spacing, if necessary
1287
+ }
1288
+ classes += _bodyClass; // add class str
1287
1289
}
1288
- else {
1289
- page += FPSTR (HTTP_HEAD_END);
1290
- }
1290
+ p.replace (FPSTR (T_c), classes);
1291
+ page += p;
1291
1292
1292
1293
return page;
1293
1294
}
@@ -1332,7 +1333,7 @@ void WiFiManager::handleRoot() {
1332
1333
#endif
1333
1334
if (captivePortal ()) return ; // If captive portal redirect instead of displaying the page
1334
1335
handleRequest ();
1335
- String page = getHTTPHead (_title); // @token options @todo replace options with title
1336
+ String page = getHTTPHead (_title, FPSTR (C_root) ); // @token options @todo replace options with title
1336
1337
String str = FPSTR (HTTP_ROOT_MAIN); // @todo custom title
1337
1338
str.replace (FPSTR (T_t),_title);
1338
1339
str.replace (FPSTR (T_v),configPortalActive ? _apName : (getWiFiHostname () + " - " + WiFi.localIP ().toString ())); // use ip if ap is not active for heading @todo use hostname?
@@ -1357,7 +1358,7 @@ void WiFiManager::handleWifi(boolean scan) {
1357
1358
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Wifi" ));
1358
1359
#endif
1359
1360
handleRequest ();
1360
- String page = getHTTPHead (FPSTR (S_titlewifi)); // @token titlewifi
1361
+ String page = getHTTPHead (FPSTR (S_titlewifi), FPSTR (C_wifi) ); // @token titlewifi
1361
1362
if (scan) {
1362
1363
#ifdef WM_DEBUG_LEVEL
1363
1364
// DEBUG_WM(WM_DEBUG_DEV,"refresh flag:",server->hasArg(F("refresh")));
@@ -1413,7 +1414,7 @@ void WiFiManager::handleParam(){
1413
1414
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Param" ));
1414
1415
#endif
1415
1416
handleRequest ();
1416
- String page = getHTTPHead (FPSTR (S_titleparam)); // @token titlewifi
1417
+ String page = getHTTPHead (FPSTR (S_titleparam), FPSTR (C_param) ); // @token titlewifi
1417
1418
1418
1419
String pitem = " " ;
1419
1420
@@ -1878,11 +1879,11 @@ void WiFiManager::handleWifiSave() {
1878
1879
String page;
1879
1880
1880
1881
if (_ssid == " " ){
1881
- page = getHTTPHead (FPSTR (S_titlewifisettings)); // @token titleparamsaved
1882
+ page = getHTTPHead (FPSTR (S_titlewifisettings), FPSTR (C_wifi) ); // @token titleparamsaved
1882
1883
page += FPSTR (HTTP_PARAMSAVED);
1883
1884
}
1884
1885
else {
1885
- page = getHTTPHead (FPSTR (S_titlewifisaved)); // @token titlewifisaved
1886
+ page = getHTTPHead (FPSTR (S_titlewifisaved), FPSTR (C_wifi) ); // @token titlewifisaved
1886
1887
page += FPSTR (HTTP_SAVED);
1887
1888
}
1888
1889
@@ -1911,7 +1912,7 @@ void WiFiManager::handleParamSave() {
1911
1912
1912
1913
doParamSave ();
1913
1914
1914
- String page = getHTTPHead (FPSTR (S_titleparamsaved)); // @token titleparamsaved
1915
+ String page = getHTTPHead (FPSTR (S_titleparamsaved), FPSTR (C_param) ); // @token titleparamsaved
1915
1916
page += FPSTR (HTTP_PARAMSAVED);
1916
1917
if (_showBack) page += FPSTR (HTTP_BACKBTN);
1917
1918
page += FPSTR (HTTP_END);
@@ -1977,7 +1978,7 @@ void WiFiManager::handleInfo() {
1977
1978
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Info" ));
1978
1979
#endif
1979
1980
handleRequest ();
1980
- String page = getHTTPHead (FPSTR (S_titleinfo)); // @token titleinfo
1981
+ String page = getHTTPHead (FPSTR (S_titleinfo), FPSTR (C_info) ); // @token titleinfo
1981
1982
reportStatus (page);
1982
1983
1983
1984
uint16_t infos = 0 ;
@@ -2322,7 +2323,7 @@ void WiFiManager::handleExit() {
2322
2323
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Exit" ));
2323
2324
#endif
2324
2325
handleRequest ();
2325
- String page = getHTTPHead (FPSTR (S_titleexit)); // @token titleexit
2326
+ String page = getHTTPHead (FPSTR (S_titleexit), FPSTR (C_exit) ); // @token titleexit
2326
2327
page += FPSTR (S_exiting); // @token exiting
2327
2328
// ('Logout', 401, {'WWW-Authenticate': 'Basic realm="Login required"'})
2328
2329
server->sendHeader (F (" Cache-Control" ), F (" no-cache, no-store, must-revalidate" )); // @HTTPHEAD send cache
@@ -2339,7 +2340,7 @@ void WiFiManager::handleReset() {
2339
2340
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Reset" ));
2340
2341
#endif
2341
2342
handleRequest ();
2342
- String page = getHTTPHead (FPSTR (S_titlereset)); // @token titlereset
2343
+ String page = getHTTPHead (FPSTR (S_titlereset), FPSTR (C_restart) ); // @token titlereset
2343
2344
page += FPSTR (S_resetting); // @token resetting
2344
2345
page += FPSTR (HTTP_END);
2345
2346
@@ -2364,7 +2365,7 @@ void WiFiManager::handleErase(boolean opt) {
2364
2365
DEBUG_WM (WM_DEBUG_NOTIFY,F (" <- HTTP Erase" ));
2365
2366
#endif
2366
2367
handleRequest ();
2367
- String page = getHTTPHead (FPSTR (S_titleerase)); // @token titleerase
2368
+ String page = getHTTPHead (FPSTR (S_titleerase), FPSTR (C_erase) ); // @token titleerase
2368
2369
2369
2370
bool ret = erase (opt);
2370
2371
@@ -2469,7 +2470,7 @@ void WiFiManager::handleClose(){
2469
2470
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP close" ));
2470
2471
#endif
2471
2472
handleRequest ();
2472
- String page = getHTTPHead (FPSTR (S_titleclose)); // @token titleclose
2473
+ String page = getHTTPHead (FPSTR (S_titleclose), FPSTR (C_close) ); // @token titleclose
2473
2474
page += FPSTR (S_closing); // @token closing
2474
2475
HTTPSend (page);
2475
2476
}
@@ -3874,7 +3875,7 @@ void WiFiManager::handleUpdate() {
3874
3875
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- Handle update" ));
3875
3876
#endif
3876
3877
if (captivePortal ()) return ; // If captive portal redirect instead of displaying the page
3877
- String page = getHTTPHead (_title); // @token options
3878
+ String page = getHTTPHead (_title, FPSTR (C_update) ); // @token options
3878
3879
String str = FPSTR (HTTP_ROOT_MAIN);
3879
3880
str.replace (FPSTR (T_t), _title);
3880
3881
str.replace (FPSTR (T_v), configPortalActive ? _apName : (getWiFiHostname () + " - " + WiFi.localIP ().toString ())); // use ip if ap is not active for heading
@@ -3984,7 +3985,7 @@ void WiFiManager::handleUpdateDone() {
3984
3985
DEBUG_WM (WM_DEBUG_VERBOSE, F (" <- Handle update done" ));
3985
3986
// if (captivePortal()) return; // If captive portal redirect instead of displaying the page
3986
3987
3987
- String page = getHTTPHead (FPSTR (S_options)); // @token options
3988
+ String page = getHTTPHead (FPSTR (S_options), FPSTR (C_update) ); // @token options
3988
3989
String str = FPSTR (HTTP_ROOT_MAIN);
3989
3990
str.replace (FPSTR (T_t),_title);
3990
3991
str.replace (FPSTR (T_v), configPortalActive ? _apName : WiFi.localIP ().toString ()); // use ip if ap is not active for heading
0 commit comments