Merge pull request #68 from Hieromon/master

Fixed the value of AutoConnectElements not reflected. Issue #64
pull/69/head^2
Hieromon Ikasamo 6 years ago committed by GitHub
commit a458e23bfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      README.md
  2. 28
      src/AutoConnect.cpp
  3. 24
      src/AutoConnectAux.cpp

@ -105,6 +105,7 @@ Full documentation is available on https://Hieromon.github.io/AutoConnect, some
- Supports a **format attribute** with the AutoConnectText element.
- Supports a **AutoConnectSelect::selected** attribute.
- Fixed blank page responds with Configure new.
- Fixed the value of AutoConnectElements not reflected.
- Changed menu labels placement in source files structure.
### [0.9.7] Feb. 25, 2019

@ -794,20 +794,20 @@ bool AutoConnect::_classifyHandle(HTTPMethod method, String uri) {
// If the current request argument contains AutoConnectElement, it is
// the form data of the AutoConnectAux page and with this timing save
// the value of each element.
if (_webServer->hasArg(String(F(AUTOCONNECT_AUXURI_PARAM)))) {
_auxUri = _webServer->arg(AUTOCONNECT_AUXURI_PARAM);
_auxUri.replace("/", "/");
AutoConnectAux* aux = _aux.get();
while (aux) {
if (aux->_uriStr == _auxUri) {
// Save the value owned by each element contained in the POST body
// of a current HTTP request to AutoConnectElements.
aux->_storeElements(_webServer.get());
break;
}
aux = aux->_next.get();
}
}
// if (_webServer->hasArg(String(F(AUTOCONNECT_AUXURI_PARAM)))) {
// _auxUri = _webServer->arg(AUTOCONNECT_AUXURI_PARAM);
// _auxUri.replace("/", "/");
// AutoConnectAux* aux = _aux.get();
// while (aux) {
// if (aux->_uriStr == _auxUri) {
// // Save the value owned by each element contained in the POST body
// // of a current HTTP request to AutoConnectElements.
// aux->_storeElements(_webServer.get());
// break;
// }
// aux = aux->_next.get();
// }
// }
// Here, classify requested uri
if (uri == _uri) {

@ -370,6 +370,28 @@ const String AutoConnectAux::_indicateEncType(PageArgument& args) {
const String AutoConnectAux::_insertElement(PageArgument& args) {
String body = String("");
// When WebServerClass::handleClient calls RequestHandler, the parsed
// http argument has been prepared.
// If the current request argument contains AutoConnectElement, it is
// the form data of the AutoConnectAux page and with this timing save
// the value of each element.
WebServerClass* _webServer = _ac->_webServer.get();
if (_webServer->hasArg(String(F(AUTOCONNECT_AUXURI_PARAM)))) {
_ac->_auxUri = _webServer->arg(String(F(AUTOCONNECT_AUXURI_PARAM)));
_ac->_auxUri.replace("/", "/");
AutoConnectAux* aux = _ac->_aux.get();
while (aux) {
if (aux->_uriStr == _ac->_auxUri) {
// Save the value owned by each element contained in the POST body
// of a current HTTP request to AutoConnectElements.
aux->_storeElements(_webServer);
break;
}
aux = aux->_next.get();
}
}
// Call user handler before HTML generation.
if (_handler) {
if (_order & AC_EXIT_AHEAD) {
AC_DBG("CB in AHEAD %s\n", uri());
@ -377,9 +399,11 @@ const String AutoConnectAux::_insertElement(PageArgument& args) {
}
}
// Generate HTML for all AutoConnectElements contained in the page.
for (AutoConnectElement& addon : _addonElm)
body += addon.toHTML();
// Call user handler after HTML generation.
if (_handler) {
if (_order & AC_EXIT_LATER) {
AC_DBG("CB in LATER %s\n", uri());

Loading…
Cancel
Save