@@ -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
if (_customBodyHeader) {
1293
1294
page += _customBodyHeader;
@@ -1346,7 +1347,7 @@ void WiFiManager::handleRoot() {
1346
1347
#endif
1347
1348
if (captivePortal ()) return ; // If captive portal redirect instead of displaying the page
1348
1349
handleRequest ();
1349
- String page = getHTTPHead (_title); // @token options @todo replace options with title
1350
+ String page = getHTTPHead (_title, FPSTR (C_root) ); // @token options @todo replace options with title
1350
1351
String str = FPSTR (HTTP_ROOT_MAIN); // @todo custom title
1351
1352
str.replace (FPSTR (T_t),_title);
1352
1353
str.replace (FPSTR (T_v),configPortalActive ? _apName : (getWiFiHostname () + " - " + WiFi.localIP ().toString ())); // use ip if ap is not active for heading @todo use hostname?
@@ -1371,7 +1372,7 @@ void WiFiManager::handleWifi(boolean scan) {
1371
1372
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Wifi" ));
1372
1373
#endif
1373
1374
handleRequest ();
1374
- String page = getHTTPHead (FPSTR (S_titlewifi)); // @token titlewifi
1375
+ String page = getHTTPHead (FPSTR (S_titlewifi), FPSTR (C_wifi) ); // @token titlewifi
1375
1376
if (scan) {
1376
1377
#ifdef WM_DEBUG_LEVEL
1377
1378
// DEBUG_WM(WM_DEBUG_DEV,"refresh flag:",server->hasArg(F("refresh")));
@@ -1427,7 +1428,7 @@ void WiFiManager::handleParam(){
1427
1428
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Param" ));
1428
1429
#endif
1429
1430
handleRequest ();
1430
- String page = getHTTPHead (FPSTR (S_titleparam)); // @token titlewifi
1431
+ String page = getHTTPHead (FPSTR (S_titleparam), FPSTR (C_param) ); // @token titlewifi
1431
1432
1432
1433
String pitem = " " ;
1433
1434
@@ -1892,11 +1893,11 @@ void WiFiManager::handleWifiSave() {
1892
1893
String page;
1893
1894
1894
1895
if (_ssid == " " ){
1895
- page = getHTTPHead (FPSTR (S_titlewifisettings)); // @token titleparamsaved
1896
+ page = getHTTPHead (FPSTR (S_titlewifisettings), FPSTR (C_wifi) ); // @token titleparamsaved
1896
1897
page += FPSTR (HTTP_PARAMSAVED);
1897
1898
}
1898
1899
else {
1899
- page = getHTTPHead (FPSTR (S_titlewifisaved)); // @token titlewifisaved
1900
+ page = getHTTPHead (FPSTR (S_titlewifisaved), FPSTR (C_wifi) ); // @token titlewifisaved
1900
1901
page += FPSTR (HTTP_SAVED);
1901
1902
}
1902
1903
@@ -1925,7 +1926,7 @@ void WiFiManager::handleParamSave() {
1925
1926
1926
1927
doParamSave ();
1927
1928
1928
- String page = getHTTPHead (FPSTR (S_titleparamsaved)); // @token titleparamsaved
1929
+ String page = getHTTPHead (FPSTR (S_titleparamsaved), FPSTR (C_param) ); // @token titleparamsaved
1929
1930
page += FPSTR (HTTP_PARAMSAVED);
1930
1931
if (_showBack) page += FPSTR (HTTP_BACKBTN);
1931
1932
page += getHTTPEnd ();
@@ -1991,7 +1992,7 @@ void WiFiManager::handleInfo() {
1991
1992
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Info" ));
1992
1993
#endif
1993
1994
handleRequest ();
1994
- String page = getHTTPHead (FPSTR (S_titleinfo)); // @token titleinfo
1995
+ String page = getHTTPHead (FPSTR (S_titleinfo), FPSTR (C_info) ); // @token titleinfo
1995
1996
reportStatus (page);
1996
1997
1997
1998
uint16_t infos = 0 ;
@@ -2336,7 +2337,7 @@ void WiFiManager::handleExit() {
2336
2337
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Exit" ));
2337
2338
#endif
2338
2339
handleRequest ();
2339
- String page = getHTTPHead (FPSTR (S_titleexit)); // @token titleexit
2340
+ String page = getHTTPHead (FPSTR (S_titleexit), FPSTR (C_exit) ); // @token titleexit
2340
2341
page += FPSTR (S_exiting); // @token exiting
2341
2342
page += getHTTPEnd ();
2342
2343
// ('Logout', 401, {'WWW-Authenticate': 'Basic realm="Login required"'})
@@ -2354,7 +2355,7 @@ void WiFiManager::handleReset() {
2354
2355
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Reset" ));
2355
2356
#endif
2356
2357
handleRequest ();
2357
- String page = getHTTPHead (FPSTR (S_titlereset)); // @token titlereset
2358
+ String page = getHTTPHead (FPSTR (S_titlereset), FPSTR (C_restart) ); // @token titlereset
2358
2359
page += FPSTR (S_resetting); // @token resetting
2359
2360
page += getHTTPEnd ();
2360
2361
@@ -2379,7 +2380,7 @@ void WiFiManager::handleErase(boolean opt) {
2379
2380
DEBUG_WM (WM_DEBUG_NOTIFY,F (" <- HTTP Erase" ));
2380
2381
#endif
2381
2382
handleRequest ();
2382
- String page = getHTTPHead (FPSTR (S_titleerase)); // @token titleerase
2383
+ String page = getHTTPHead (FPSTR (S_titleerase), FPSTR (C_erase) ); // @token titleerase
2383
2384
2384
2385
bool ret = erase (opt);
2385
2386
@@ -2484,7 +2485,7 @@ void WiFiManager::handleClose(){
2484
2485
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP close" ));
2485
2486
#endif
2486
2487
handleRequest ();
2487
- String page = getHTTPHead (FPSTR (S_titleclose)); // @token titleclose
2488
+ String page = getHTTPHead (FPSTR (S_titleclose), FPSTR (C_close) ); // @token titleclose
2488
2489
page += FPSTR (S_closing); // @token closing
2489
2490
page += getHTTPEnd ();
2490
2491
HTTPSend (page);
@@ -3001,7 +3002,7 @@ void WiFiManager::setShowStaticFields(boolean alwaysShow){
3001
3002
*/
3002
3003
void WiFiManager::setShowDnsFields (boolean alwaysShow){
3003
3004
if (_disableIpFields) _staShowDns = alwaysShow ? 1 : -1 ;
3004
- _staShowDns = alwaysShow ? 1 : 0 ;
3005
+ else _staShowDns = alwaysShow ? 1 : 0 ;
3005
3006
}
3006
3007
3007
3008
/* *
@@ -3910,7 +3911,7 @@ void WiFiManager::handleUpdate() {
3910
3911
DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- Handle update" ));
3911
3912
#endif
3912
3913
if (captivePortal ()) return ; // If captive portal redirect instead of displaying the page
3913
- String page = getHTTPHead (_title); // @token options
3914
+ String page = getHTTPHead (_title, FPSTR (C_update) ); // @token options
3914
3915
String str = FPSTR (HTTP_ROOT_MAIN);
3915
3916
str.replace (FPSTR (T_t), _title);
3916
3917
str.replace (FPSTR (T_v), configPortalActive ? _apName : (getWiFiHostname () + " - " + WiFi.localIP ().toString ())); // use ip if ap is not active for heading
@@ -4020,7 +4021,7 @@ void WiFiManager::handleUpdateDone() {
4020
4021
DEBUG_WM (WM_DEBUG_VERBOSE, F (" <- Handle update done" ));
4021
4022
// if (captivePortal()) return; // If captive portal redirect instead of displaying the page
4022
4023
4023
- String page = getHTTPHead (FPSTR (S_options)); // @token options
4024
+ String page = getHTTPHead (FPSTR (S_options), FPSTR (C_update) ); // @token options
4024
4025
String str = FPSTR (HTTP_ROOT_MAIN);
4025
4026
str.replace (FPSTR (T_t),_title);
4026
4027
str.replace (FPSTR (T_v), configPortalActive ? _apName : WiFi.localIP ().toString ()); // use ip if ap is not active for heading
0 commit comments