Update filesystem GUI

This commit is contained in:
Theo Arends 2021-01-06 17:54:03 +01:00
parent ad7c27a65e
commit 9d0a7e9bc4
28 changed files with 157 additions and 32 deletions

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Laai op"
#define D_SCRIPT_UPLOAD_FILES "Laai lêers op"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "versterking:"
#define D_AS3935_ENERGY "energie:"

View File

@ -873,6 +873,11 @@
#define D_SCRIPT_UPLOAD "Изпращане"
#define D_SCRIPT_UPLOAD_FILES "Изпращане на файлове"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "усилване:"
#define D_AS3935_ENERGY "енергия:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload Dateien"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "Umgebung:"
#define D_AS3935_ENERGY "Energie:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Cargar"
#define D_SCRIPT_UPLOAD_FILES "Cargar Archivos"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "Ganancia:"
#define D_AS3935_ENERGY "Energía:"

View File

@ -854,6 +854,7 @@
#define D_SOLAX_ERROR_6 "Défaut Surchauffe"
#define D_SOLAX_ERROR_7 "Défaut Ventilateur"
#define D_SOLAX_ERROR_8 "Défaut Autre équipement"
//xdrv_10_scripter.ino
#define D_CONFIGURE_SCRIPT "Éditer le script"
#define D_SCRIPT "édition du script"
@ -866,6 +867,12 @@
#define D_SCRIPT_ENABLE "script actif"
#define D_SCRIPT_UPLOAD "Envoi"
#define D_SCRIPT_UPLOAD_FILES "Envoi de fichiers"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energie:"
@ -890,9 +897,11 @@
#define D_AS3935_OUTDOORS "Extérieur"
#define D_AS3935_CAL_FAIL "défaut de calibration"
#define D_AS3935_CAL_OK "calibration établie à :"
//xsns_68_opentherm.ino
#define D_SENSOR_BOILER_OT_RX "OpenTherm RX"
#define D_SENSOR_BOILER_OT_TX "OpenTherm TX"
// xnrg_15_teleinfo Denky (Teleinfo)
#define D_CONTRACT "Type contrat"
#define D_POWER_LOAD "Charge actuelle"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Carica"
#define D_SCRIPT_UPLOAD_FILES "Carica file"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "guadagno:"
#define D_AS3935_ENERGY "energia:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Bestandsbeheer"
#define D_FS_SIZE "Grootte"
#define D_FS_FREE "Vrij"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Încarcă"
#define D_SCRIPT_UPLOAD_FILES "Încarcă fișiere"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Завантажити"
#define D_SCRIPT_UPLOAD_FILES "Завантажити файли"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Tải lên"
#define D_SCRIPT_UPLOAD_FILES "Tệp tải lên"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "khuếch đại:"
#define D_AS3935_ENERGY "năng lượng:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "Upload"
#define D_SCRIPT_UPLOAD_FILES "Upload files"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "energy:"

View File

@ -874,6 +874,11 @@
#define D_SCRIPT_UPLOAD "上傳"
#define D_SCRIPT_UPLOAD_FILES "上傳檔案"
//xdrv_50_filesystem.ino
#define D_MANAGE_FILE_SYSTEM "Manage File system"
#define D_FS_SIZE "Size"
#define D_FS_FREE "Free"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"
#define D_AS3935_ENERGY "能量:"

View File

@ -276,7 +276,8 @@ enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_PIN_STATE, FUNC_MODULE_INIT, FU
FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY,
FUNC_ENERGY_EVERY_SECOND, FUNC_ENERGY_RESET,
FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED,
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON, FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS, FUNC_SET_SCHEME, FUNC_HOTPLUG_SCAN,
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_MANAGEMENT_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON,
FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS, FUNC_SET_SCHEME, FUNC_HOTPLUG_SCAN,
FUNC_DEVICE_GROUP_ITEM };
enum AddressConfigSteps { ADDR_IDLE, ADDR_RECEIVE, ADDR_SEND };

View File

@ -1302,6 +1302,9 @@ void HandleConfiguration(void)
WSContentButton(BUTTON_BACKUP);
WSContentButton(BUTTON_RESTORE);
WSContentSend_P(PSTR("<div></div>")); // 5px padding
XdrvCall(FUNC_WEB_ADD_MANAGEMENT_BUTTON);
WSContentSpaceButton(BUTTON_MAIN);
WSContentStop();
}

View File

@ -338,18 +338,19 @@ void UFS_free(void) {
const char UFS_WEB_DIR[] PROGMEM =
"<p><form action='" "ufsd" "' method='get'><button>" "%s" "</button></form></p>";
const char UFS_FILE_UPLOAD[] PROGMEM = D_UFSDIR;
const char UFS_FORM_FILE_UPLOAD[] PROGMEM =
"<div id='f1' name='f1' style='display:block;'>"
"<fieldset><legend><b>&nbsp;%s" "&nbsp;</b></legend>";
"<fieldset><legend><b>&nbsp;" D_MANAGE_FILE_SYSTEM "&nbsp;</b></legend>";
const char UFS_FORM_FILE_UPGc[] PROGMEM =
"<div style='text-align:left;color:#%06x;'>" D_FS_SIZE " %s kB - " D_FS_FREE " %s kB</div>";
const char UFS_FORM_FILE_UPG[] PROGMEM =
"<form method='post' action='ufsu' enctype='multipart/form-data'>"
"<br/><input type='file' name='ufsu'><br/>"
"<br/><button type='submit' onclick='eb(\"f1\").style.display=\"none\";eb(\"f2\").style.display=\"block\";this.form.submit();'>" D_START " %s</button></form>";
const char UFS_FORM_FILE_UPGc[] PROGMEM =
"<div style='text-align:left;color:green;'>total size: %s kB - free: %s kB</div>";
"<br><input type='file' name='ufsu'><br>"
"<br><button type='submit' onclick='eb(\"f1\").style.display=\"none\";eb(\"f2\").style.display=\"block\";this.form.submit();'>" D_START " %s</button></form>"
"<br>";
const char UFS_FORM_SDC_DIRa[] PROGMEM =
"<div style='text-align:left;overflow:scroll;height:400px;'>";
"<div style='text-align:left;overflow:auto;height:250px;'>";
const char UFS_FORM_SDC_DIRc[] PROGMEM =
"</div>";
const char UFS_FORM_FILE_UPGb[] PROGMEM =
@ -359,7 +360,7 @@ const char UFS_FORM_FILE_UPGb[] PROGMEM =
const char UFS_FORM_SDC_DIRd[] PROGMEM =
"<pre><a href='%s' file='%s'>%s</a></pre>";
const char UFS_FORM_SDC_DIRb[] PROGMEM =
"<pre><a href='%s' file='%s'>%s</a> %s : %8d</pre>";
"<pre><a href='%s' file='%s'>%s</a> %s %8d</pre>";
const char UFS_FORM_SDC_HREF[] PROGMEM =
"http://%s/ufsd?download=%s/%s";
@ -378,15 +379,18 @@ void UFSdirectory(void) {
}
}
WSContentStart_P(UFS_FILE_UPLOAD);
WSContentStart_P(PSTR(D_MANAGE_FILE_SYSTEM));
WSContentSendStyle();
WSContentSend_P(UFS_FORM_FILE_UPLOAD, D_UFSDIR);
WSContentSend_P(UFS_FORM_FILE_UPG, D_SCRIPT_UPLOAD);
WSContentSend_P(UFS_FORM_FILE_UPLOAD);
char ts[16];
char fs[16];
UFS_form1000(ufs_fsinfo(0), ts, '.');
UFS_form1000(ufs_fsinfo(1), fs, '.');
WSContentSend_P(UFS_FORM_FILE_UPGc, ts, fs);
WSContentSend_P(UFS_FORM_FILE_UPGc, WebColor(COL_TEXT), ts, fs);
WSContentSend_P(UFS_FORM_FILE_UPG, D_SCRIPT_UPLOAD);
WSContentSend_P(UFS_FORM_SDC_DIRa);
if (ufs_type) {
UFS_ListDir(ufs_path, depth);
@ -434,9 +438,9 @@ void UFS_ListDir(char *path, uint8_t depth) {
if (lcp) {
ep = lcp + 1;
}
time_t tm = entry.getLastWrite();
char tstr[24];
strftime(tstr, 22, "%d-%m-%Y - %H:%M:%S ", localtime(&tm)); // Theo note to me. Isn't strftime expensive? SHould use ISO Date/Time
uint32_t tm = entry.getLastWrite();
String tstr = GetDT(tm);
char *pp = path;
if (!*(pp + 1)) { pp++; }
@ -461,7 +465,7 @@ void UFS_ListDir(char *path, uint8_t depth) {
path[plen] = 0;
} else {
snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp, ep);
WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr, entry.size());
WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr.c_str(), entry.size());
}
}
entry.close();
@ -556,18 +560,6 @@ void UFS_Upload(void) {
}
}
void UFSFileUploadSuccess(void) {
WSContentStart_P(PSTR(D_INFORMATION));
WSContentSendStyle();
WSContentSend_P(PSTR("<div style='text-align:center;'><b>" D_UPLOAD " <font color='#"));
WSContentSend_P(PSTR("%06x'>" D_SUCCESSFUL "</font></b><br/>"), WebColor(COL_TEXT_SUCCESS));
WSContentSend_P(PSTR("</div><br/>"));
WSContentSend_P(PSTR("<p><form action='%s' method='get'><button>%s</button></form></p>"), "/ufsd", D_UPL_DONE);
WSContentStop();
}
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
@ -583,14 +575,14 @@ bool Xdrv50(uint8_t function) {
result = DecodeCommand(kUFSCommands, kUFSCommand);
break;
#ifdef USE_WEBSERVER
case FUNC_WEB_ADD_BUTTON:
case FUNC_WEB_ADD_MANAGEMENT_BUTTON:
if (ufs_type) {
WSContentSend_PD(UFS_WEB_DIR,D_UFSDIR);
WSContentSend_PD(UFS_WEB_DIR, D_MANAGE_FILE_SYSTEM);
}
break;
case FUNC_WEB_ADD_HANDLER:
Webserver->on("/ufsd", UFSdirectory);
Webserver->on("/ufsu", HTTP_GET, UFSFileUploadSuccess);
Webserver->on("/ufsu", HTTP_GET, UFSdirectory);
Webserver->on("/ufsu", HTTP_POST,[]() {
Webserver->sendHeader("Location","/ufsu");
Webserver->send(303);