diff --git a/Arduino/CanGrow/include/Webserver/Page_system.h b/Arduino/CanGrow/include/Webserver/Page_system.h index b0c4a01..f815382 100644 --- a/Arduino/CanGrow/include/Webserver/Page_system.h +++ b/Arduino/CanGrow/include/Webserver/Page_system.h @@ -30,6 +30,23 @@ #include "Page_system_HTML.h" +/* global runtime variables */ + +/* VERY VERY DIRTY WORKAROUND + * I have the problem, that I cannot pass a parameter I receive from a http + * request to it's template processor. In my case i want to edit an output, + * the user should click an edit button on the system/output overview page. + * I am lazy so i want to reuse the output_add page, because it is quite + * kinda exactly the same. so i want to call GET /system/output/add?edit=ID + * I have searched and came to the conclusion, that at this point i see no + * other way then giving the parameter I need, the outputId, to an global + * variable, so the template processor can read it. + */ +byte tmpParam_editOutputId = 255; + + + + /* subnav processor */ bool Test_WebPage_system_SUBNAV(const String& var) { @@ -391,7 +408,12 @@ void WebPage_system_output(AsyncWebServerRequest *request) { } else { - request->send_P(200, "text/html", Page_system_output_HTML, Proc_WebPage_system_output); + if(request->hasParam("success")) { + // when GET param success is present, we use the _POST processor for the save message + request->send_P(200, "text/html", Page_system_output_HTML, Proc_WebPage_system_output_POST); + } else { + request->send_P(200, "text/html", Page_system_output_HTML, Proc_WebPage_system_output); + } } } @@ -401,7 +423,7 @@ void WebPage_system_output(AsyncWebServerRequest *request) { */ /* returns select