From fed8bd6325c8e0262cf8580bd4567e3b15ce3b72 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 14 Dec 2020 01:26:26 +0100 Subject: [PATCH] automatically refresh css cache when switching skin and setting of default skin to current skin in selector --- htroot/ConfigAppearance_p.html | 53 ++++++++++++++++++++-------------- htroot/ConfigAppearance_p.java | 7 +++-- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/htroot/ConfigAppearance_p.html b/htroot/ConfigAppearance_p.html index 65f4e5f88..046b8fbb3 100644 --- a/htroot/ConfigAppearance_p.html +++ b/htroot/ConfigAppearance_p.html @@ -10,21 +10,33 @@ #%env/templates/submenuDesign.template%# -

Appearance and Integration

@@ -34,19 +46,19 @@ If you create a search portal with YaCy then you can change the appearance of the search page here.

- +
Skin Selection -

Select one of the default skins, download new skins, or create your own skin.

+

Select one of the default skins. After selection it might be required to reload the web page while holding the shift key to refresh cached style files.

:
#[currentskin]# 
- +
:
 
@@ -57,7 +69,7 @@
- +
Skin Color Definition @@ -90,7 +102,7 @@
- +
Skin Download @@ -98,7 +110,7 @@
:
- +
 
@@ -108,8 +120,7 @@ might overwrite existing data if a file of the same name exists already.

- - + #(status)# ::

Unable to get URL: #[url]#

::

Error saving the skin.

diff --git a/htroot/ConfigAppearance_p.java b/htroot/ConfigAppearance_p.java index 2051e2aec..ea5bae159 100644 --- a/htroot/ConfigAppearance_p.java +++ b/htroot/ConfigAppearance_p.java @@ -138,19 +138,22 @@ public class ConfigAppearance_p { } } + String currentSkin = env.getConfig("currentSkin", "default"); + prop.putHTML("currentskin", currentSkin); // reread skins skinFiles = FileUtils.getDirListing(skinPath, SKIN_FILENAME_FILTER); Collections.sort(skinFiles); int count = 0; for (final String skinFile : skinFiles) { if (skinFile.endsWith(".css")) { + String skinName = skinFile.substring(0, skinFile.length() - 4); prop.put("skinlist_" + count + "_file", skinFile); - prop.put("skinlist_" + count + "_name", skinFile.substring(0, skinFile.length() - 4)); + prop.put("skinlist_" + count + "_name", skinName); + prop.put("skinlist_" + count + "_selected", skinName.equals(currentSkin) ? 1 : 0); count++; } } prop.put("skinlist", count); - prop.putHTML("currentskin", env.getConfig("currentSkin", "default")); // write colors from generic skin Iterator i = env.configKeys();