add method to build navigation button
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define nuki_hub_version "4.0"
|
#define nuki_hub_version "4.1"
|
||||||
@@ -357,31 +357,21 @@ void WebCfgServer::buildHtml(String& response)
|
|||||||
response.concat("</table><br><br>");
|
response.concat("</table><br><br>");
|
||||||
|
|
||||||
response.concat("<h3>MQTT and Network Configuration</h3>");
|
response.concat("<h3>MQTT and Network Configuration</h3>");
|
||||||
response.concat("<form method=\"get\" action=\"/mqttconfig\">");
|
buildNavigationButton(response, "Edit", "/mqttconfig");
|
||||||
response.concat("<button type=\"submit\">Edit</button>");
|
|
||||||
response.concat("</form>");
|
|
||||||
|
|
||||||
response.concat("<BR><BR><h3>NUKI Configuration</h3>");
|
response.concat("<BR><BR><h3>NUKI Configuration</h3>");
|
||||||
response.concat("<form method=\"get\" action=\"/nukicfg\">");
|
buildNavigationButton(response, "Edit", "/nukicfg");
|
||||||
response.concat("<button type=\"submit\">Edit</button>");
|
|
||||||
response.concat("</form>");
|
|
||||||
|
|
||||||
response.concat("<BR><BR><h3>Credentials</h3>");
|
response.concat("<BR><BR><h3>Credentials</h3>");
|
||||||
response.concat("<form method=\"get\" action=\"/cred\">");
|
buildNavigationButton(response, "Edit", "/cred");
|
||||||
response.concat("<button type=\"submit\">Edit</button>");
|
|
||||||
response.concat("</form>");
|
|
||||||
|
|
||||||
response.concat("<BR><BR><h3>Firmware update</h3>");
|
response.concat("<BR><BR><h3>Firmware update</h3>");
|
||||||
response.concat("<form method=\"get\" action=\"/ota\">");
|
buildNavigationButton(response, "Open", "/ota");
|
||||||
response.concat("<button type=\"submit\">Open</button>");
|
|
||||||
response.concat("</form>");
|
|
||||||
|
|
||||||
if(_allowRestartToPortal)
|
if(_allowRestartToPortal)
|
||||||
{
|
{
|
||||||
response.concat("<br><br><h3>WiFi</h3>");
|
response.concat("<br><br><h3>WiFi</h3>");
|
||||||
response.concat("<form method=\"get\" action=\"/wifi\">");
|
buildNavigationButton(response, "Restart and configure wifi", "/wifi");
|
||||||
response.concat("<button type=\"submit\">Restart and configure wifi</button>");
|
|
||||||
response.concat("</form>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
response.concat("</BODY></HTML>");
|
response.concat("</BODY></HTML>");
|
||||||
@@ -540,12 +530,9 @@ void WebCfgServer::buildConfigureWifiHtml(String &response)
|
|||||||
|
|
||||||
response.concat("<h3>WiFi</h3>");
|
response.concat("<h3>WiFi</h3>");
|
||||||
response.concat("Click confirm to restart ESP into WiFi configuration mode. After restart, connect to ESP access point to reconfigure WiFI.<br><br>");
|
response.concat("Click confirm to restart ESP into WiFi configuration mode. After restart, connect to ESP access point to reconfigure WiFI.<br><br>");
|
||||||
response.concat("<form method=\"get\" action=\"/wifimanager\">");
|
buildNavigationButton(response, "Confirm", "/wifimanager");
|
||||||
response.concat("<button type=\"submit\">Confirm</button>");
|
|
||||||
response.concat("</form>");
|
|
||||||
|
|
||||||
response.concat("</BODY>\n");
|
response.concat("</BODY></HTML>");
|
||||||
response.concat("</HTML>\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebCfgServer::processUnpair(bool opener)
|
void WebCfgServer::processUnpair(bool opener)
|
||||||
@@ -670,6 +657,17 @@ void WebCfgServer::printTextarea(String& response,
|
|||||||
response.concat("</td></tr>");
|
response.concat("</td></tr>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebCfgServer::buildNavigationButton(String &response, const char *caption, const char *targetPath)
|
||||||
|
{
|
||||||
|
response.concat("<form method=\"get\" action=\"");
|
||||||
|
response.concat(targetPath);
|
||||||
|
response.concat("\">");
|
||||||
|
response.concat("<button type=\"submit\">");
|
||||||
|
response.concat(caption);
|
||||||
|
response.concat("</button>");
|
||||||
|
response.concat("</form>");
|
||||||
|
}
|
||||||
|
|
||||||
void WebCfgServer::printParameter(String& response, const char *description, const char *value)
|
void WebCfgServer::printParameter(String& response, const char *description, const char *value)
|
||||||
{
|
{
|
||||||
response.concat("<tr>");
|
response.concat("<tr>");
|
||||||
@@ -731,5 +729,3 @@ void WebCfgServer::handleOtaUpload()
|
|||||||
Serial.print("handleFileUpload Size: "); Serial.println(upload.totalSize);
|
Serial.print("handleFileUpload Size: "); Serial.println(upload.totalSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ private:
|
|||||||
void printInputField(String& response, const char* token, const char* description, const int value, size_t maxLength);
|
void printInputField(String& response, const char* token, const char* description, const int value, size_t maxLength);
|
||||||
void printCheckBox(String& response, const char* token, const char* description, const bool value);
|
void printCheckBox(String& response, const char* token, const char* description, const bool value);
|
||||||
void printTextarea(String& response, const char *token, const char *description, const char *value, const size_t maxLength);
|
void printTextarea(String& response, const char *token, const char *description, const char *value, const size_t maxLength);
|
||||||
|
void buildNavigationButton(String& response, const char* caption, const char* targetPath);
|
||||||
|
|
||||||
void printParameter(String& response, const char* description, const char* value);
|
void printParameter(String& response, const char* description, const char* value);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user