Display: reset dashboard tiles when switching language

This commit is contained in:
bergware
2023-10-17 14:55:03 +02:00
parent 9a97d3087d
commit 75c1c8a7a0
2 changed files with 19 additions and 2 deletions
+11 -2
View File
@@ -26,6 +26,7 @@ require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php"
<script>
var path = '/boot/config/plugins/dynamix';
var filename = '';
var locale = "<?=$locale?>";
function restore() {
// restore original image and activate APPLY button
@@ -33,13 +34,21 @@ function restore() {
$('select[name="banner"]').trigger('change');
filename = 'reset';
}
function upload() {
function upload(lang) {
// save or delete upload when APPLY is pressed
if (filename=='reset') {
$.post("/webGui/include/FileUpload.php",{cmd:'delete',path:path,filename:'banner.png'});
} else if (filename) {
$.post("/webGui/include/FileUpload.php",{cmd:'save',path:path,filename:filename,output:'banner.png'});
}
// reset dashboard tiles when switching language
if (lang != locale) {
$.removeCookie('db-box1');
$.removeCookie('db-box2');
$.removeCookie('db-box3');
$.removeCookie('inactive_content');
$.removeCookie('hidden_content');
}
}
function presetTime(form) {
var system = form.date.selectedIndex==0;
@@ -119,7 +128,7 @@ $(function() {
:display_settings_help:
<form markdown="1" name="display_settings" method="POST" action="/update.php" target="progressFrame" onsubmit="upload()">
<form markdown="1" name="display_settings" method="POST" action="/update.php" target="progressFrame" onsubmit="upload(this.locale.value)">
<input type="hidden" name="#file" value="dynamix/dynamix.cfg">
<input type="hidden" name="#section" value="display">
<input type="hidden" name="rtl" value="<?=$display['rtl']?>">
@@ -30,6 +30,14 @@ function LanguageButton() {
switchLanguage($.cookie('locale'));
$.removeCookie('locale');
}
// reset dashboard tiles when switching language
if (locale != ($.cookie('locale')||'')) {
$.removeCookie('db-box1');
$.removeCookie('db-box2');
$.removeCookie('db-box3');
$.removeCookie('inactive_content');
$.removeCookie('hidden_content');
}
}
function switchLanguage(lang) {