#pragma once #include #include #include #include "../Global/GlobalDataController.h" /** * Webpage form items for reuse */ static const char FORM_ITEM_ROW_START[] PROGMEM = "
"; static const char FORM_ITEM_ROW_EXT[] PROGMEM = "bx--col bx--col--auto"; static const char FORM_ITEM_ROW_END[] PROGMEM = "
"; static const char FORM_ITEM_CHECKBOX[] PROGMEM = "
" "" "" "
"; static const char FORM_ITEM_CHECKBOX_ON[] PROGMEM = " activated"; static const char FORM_ITEM_CHECKBOX_OFF[] PROGMEM = " deactivated"; static const char FORM_ITEM_INPUT[] PROGMEM = "
" "" "" "
"; static const char FORM_ITEM_SELECT_START[] PROGMEM = "
" "" "
" "" "" "
" "
"; static const char FORM_ITEM_SUBMIT[] PROGMEM = "
" "" "
"; static const char ICON32_TEMP[] PROGMEM = "" "" ""; static const char ICON16_WIND[] PROGMEM = "" "" ""; static const char ICON16_HUMIDITY[] PROGMEM = "" "" ""; static const char ICON16_PRESSURE[] PROGMEM = "" "" ""; /** * Webpage side menu right for main items */ static const char MENUE_ITEMS[] PROGMEM = "
  • " "Home" "" "
  • " "
  • " "Configure Printers" "" "
  • " "
  • " "Configure Station" "" "
  • " "
  • " "Configure Weather" "" "
  • " "
  • " "Configure Sensor" "" "
  • " "
  • " "Reset Settings" "" "
  • " "
  • " "Forget WiFi" "" "
  • " "
  • " "Firmware Update" "" "
  • " "
  • " "About" "" "
  • "; /** * Basic header/footer blocks */ static const char HEADER_BLOCK1[] PROGMEM = "" "PrintBuddy" "" ""; static const char HEADER_BLOCK2[] PROGMEM = "" "" "" "" "" "" "" "" "" "" "" "" "
    " ""; static const char HEADER_BLOCK3[] PROGMEM = "" "" "
    " "" "" "
    " "" "" "
    " "" "
    " "" "" "" "" "" ""; /** * Global Text */ static const char GLOBAL_TEXT_WARNING[] PROGMEM = "WARNING"; static const char GLOBAL_TEXT_ABORT[] PROGMEM = "Abort"; static const char GLOBAL_TEXT_RESET[] PROGMEM = "Reset"; static const char GLOBAL_TEXT_DELETE[] PROGMEM = "Delete"; static const char GLOBAL_TEXT_TRESET[] PROGMEM = "Reset settings"; static const char GLOBAL_TEXT_CRESET[] PROGMEM = "Do you want to reset to default settings?"; static const char GLOBAL_TEXT_TFWIFI[] PROGMEM = "Reset wifi"; static const char GLOBAL_TEXT_CFWIFI[] PROGMEM = "Do you want to reset wifi to default settings?"; static const char GLOBAL_TEXT_TDPRINTER[] PROGMEM = "Delete printer"; static const char GLOBAL_TEXT_CDPRINTER[] PROGMEM = "Do you want to delete the printer configuration "%PRINTERNAME%"?"; /** * Controls for update firmware/filesystem */ static const char UPDATE_FORM[] PROGMEM = "
    " "
    " "
    " "
    " "Update Firmware" "

    Select the firmware you want to upload

    " "
    " "" "
    " "
    " "
    " "" "
    " "
    " "
    " "
    " "
    " "Update FileSystem" "

    Select the filesystem you want to upload

    " "
    " "" "
    " "
    " "
    " "" "
    " "
    " "
    "; /** * Controls for weather configuration */ static const char WEATHER_FORM_START[] PROGMEM = "
    "; static const char WEATHER_FORM1_ID[] PROGMEM = "isWeatherEnabled"; static const char WEATHER_FORM1_LABEL[] PROGMEM = "Display Weather when printer is off"; static const char WEATHER_FORM2_ID[] PROGMEM = "metric"; static const char WEATHER_FORM2_LABEL_ON[] PROGMEM = "Show in Celsius"; static const char WEATHER_FORM2_LABEL_OFF[] PROGMEM = "Show in Fahrenheit"; static const char WEATHER_FORM3_ID[] PROGMEM = "openWeatherMapApiKey"; static const char WEATHER_FORM3_LABEL[] PROGMEM = "OpenWeatherMap API Key (get from here)"; static const char WEATHER_FORM4_ID[] PROGMEM = "city1"; static const char WEATHER_FORM4_LABEL[] PROGMEM = "( Search for City ID)"; static const char WEATHER_FORM5_ID[] PROGMEM = "language"; static const char WEATHER_FORM5_LABEL[] PROGMEM = "Weather Language"; static const char WEATHER_FORM5_OPTIONS[] PROGMEM = "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""; static const char WEATHER_FORM_END[] PROGMEM = "
    "; /** * Controls for station configuration */ static const char STATION_CONFIG_FORM_START[] PROGMEM = "
    "; static const char STATION_CONFIG_FORM1_ID[] PROGMEM = "isClockEnabled"; static const char STATION_CONFIG_FORM1_LABEL[] PROGMEM = "Display Clock when printer is off"; static const char STATION_CONFIG_FORM2_ID[] PROGMEM = "is24hour"; static const char STATION_CONFIG_FORM2_LABEL[] PROGMEM = "Use 24 Hour Clock (military time)"; static const char STATION_CONFIG_FORM3_ID[] PROGMEM = "invDisp"; static const char STATION_CONFIG_FORM3_LABEL[] PROGMEM = "Flip display orientation"; static const char STATION_CONFIG_FORM4_ID[] PROGMEM = "useFlash"; static const char STATION_CONFIG_FORM4_LABEL[] PROGMEM = "Flash System LED on Service Call"; static const char STATION_CONFIG_FORM5_ID[] PROGMEM = "refresh"; static const char STATION_CONFIG_FORM5_LABEL[] PROGMEM = "Clock Sync / Weather Refresh (minutes)"; static const char STATION_CONFIG_FORM5_OPTIONS[] PROGMEM = "" "" "" "" ""; static const char STATION_CONFIG_FORM6_ID[] PROGMEM = "utcoffset"; static const char STATION_CONFIG_FORM6_LABEL[] PROGMEM = "UTC Time Offset"; static const char STATION_CONFIG_FORM7_ID[] PROGMEM = "isBasicAuth"; static const char STATION_CONFIG_FORM7_LABEL[] PROGMEM = "Use Security Credentials for Configuration Changes"; static const char STATION_CONFIG_FORM8_ID[] PROGMEM = "userid"; static const char STATION_CONFIG_FORM8_LABEL[] PROGMEM = "User ID (for this interface)"; static const char STATION_CONFIG_FORM9_ID[] PROGMEM = "stationpassword"; static const char STATION_CONFIG_FORM9_LABEL[] PROGMEM = "Password (for this interface)"; static const char STATION_CONFIG_FORM_END[] PROGMEM = "
    "; /** * Controls for printer configuration */ static const char CONFPRINTER_FORM_START[] PROGMEM = "
    " "
    " "
    " "

    Printers to monitor

    " "

    Configurationdata

    " "
    " "
    " "
    " "" "
    " "
    " "" "" "" "" "" "" "" "" "" ""; static const char CONFPRINTER_FORM_ROW_ERROR[] PROGMEM = "
    " "%STATUS%" "
    "; static const char CONFPRINTER_FORM_ROW_OK[] PROGMEM = "
    " "%STATUS%" "
    "; static const char CONFPRINTER_FORM_ROW[] PROGMEM = "" "" "" "" "" ""; static const char CONFPRINTER_FORM_END[] PROGMEM = "" "
    NameTypeState
    %NAME%%TYPE%%STATE%" "" "
    " "
    " "
    " ""; static const char CONFPRINTER_FORM_ADDEDIT_TA[] PROGMEM = "Create new printer"; static const char CONFPRINTER_FORM_ADDEDIT_TE[] PROGMEM = "Edit data for printer"; static const char CONFPRINTER_FORM_ADDEDIT_START[] PROGMEM = "" "
    "; /** * Danger modal */ static const char MODAL_DANGER[] PROGMEM = ""; /** * Controls for main page */ static const char MAINPAGE_ROW_WEATHER_AND_SENSOR_START[] PROGMEM = "
    " "
    " "
    " "" "
    " "
    " "
    "; static const char MAINPAGE_ROW_WEATHER_ERROR_BLOCK[] PROGMEM = "
    " "
    " "
    " "
    " "
    " "

    Please Configure Weather

    " "

    %ERRORMSG%

    " "
    " "
    " "
    " "
    " "
    "; static const char MAINPAGE_ROW_WEATHER_AND_SENSOR_BLOCK[] PROGMEM = "
    " "
    " "
    " "
    " "

    %BTITLE%
    %BLABEL%

    " "
    " "
    " "
    " "
    " "

    %TEMPICON% %TEMPERATURE%

    " "
    " "
    " "
    " "
    " "%EXTRABLOCK%" "
    " "
    " "
    " "
    " "%ICONA% %TEXTA%" "%ICONB% %TEXTB%" "
    " "
    " "
    " "
    "; static const char MAINPAGE_ROW_WEATHER_AND_SENSOR_END[] PROGMEM = "
    " "
    " "
    " "
    " "
    " "
    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_S_PRINTING[] PROGMEM = "
    " "
    " "
    " "" "
    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_S_ERROROFFLINE[] PROGMEM = "
    " "
    " "
    " "" "
    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_S_STANDBY[] PROGMEM = "
    " "
    " "
    " "" "
    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_TITLE[] PROGMEM = "

    %NAME% %API%

    " "

    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_LINE[] PROGMEM = "

    %T%: %V%
    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_PROG[] PROGMEM = "
    %P%
    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_HR[] PROGMEM = "
    "; static const char MAINPAGE_ROW_PRINTER_BLOCK_E[] PROGMEM = "

    "; /** * @brief Class to generate HTML content from Memory */ class WebserverMemoryVariables { private: static String rowExtraClass; public: static void sendHeader(ESP8266WebServer *server, GlobalDataController *globalDataController, String pageLabel, String pageTitle); static void sendHeader(ESP8266WebServer *server, GlobalDataController *globalDataController, String pageLabel, String pageTitle, boolean refresh); static void sendFooter(ESP8266WebServer *server, GlobalDataController *globalDataController); static void sendMainPage(ESP8266WebServer *server, GlobalDataController *globalDataController); static void sendUpdateForm(ESP8266WebServer *server, GlobalDataController *globalDataController); static void sendWeatherConfigForm(ESP8266WebServer *server, GlobalDataController *globalDataController); static void sendStationConfigForm(ESP8266WebServer *server, GlobalDataController *globalDataController); static void sendPrinterConfigForm(ESP8266WebServer *server, GlobalDataController *globalDataController); private: static void sendFormCheckbox(ESP8266WebServer *server, String formId, bool isChecked, String label, bool inRow, String uniqueId); static void sendFormCheckbox(ESP8266WebServer *server, String formId, bool isChecked, String labelOn, String labelOff, bool inRow, String uniqueId); static void sendFormCheckboxEvent(ESP8266WebServer *server, String formId, bool isChecked, String label, String onChange, bool inRow, String uniqueId); static void sendFormCheckboxEvent(ESP8266WebServer *server, String formId, bool isChecked, String labelOn, String labelOff, String onChange, bool inRow, String uniqueId); static void sendFormInput(ESP8266WebServer *server, String formId, String label, String value, String placeholder, int maxLen, String events, bool isPassword, bool inRow, String uniqueId); static void sendFormSelect(ESP8266WebServer *server, String formId, String label, String value, String events, String options, bool inRow, String uniqueId); static void sendFormSubmitButton(ESP8266WebServer *server, bool inRow); static void sendForm(ESP8266WebServer *server, String formId, String formElement, bool inRow, String uniqueId); static void sendPrinterConfigFormAEModal(ESP8266WebServer *server, int id, PrinterDataStruct *forPrinter, GlobalDataController *globalDataController); static void sendModalDanger(ESP8266WebServer *server, String formId, String label, String title, String content, String secActionTitle, String primActionTitle, String primActionEvent); };