Make iDempiere themes definable on different levels
Description
Environment
Attachments
- 04 Feb 2015, 11:55 AM
- 03 Feb 2015, 11:02 AM
- 03 Feb 2015, 10:58 AM
Activity
Carlos Ruiz January 28, 2022 at 1:02 PM
@Anozi Mada contributed a plugin that implements a user theme selector at
https://wiki.idempiere.org/en/Plugin:_Theme_Pack#How_to_switch_theme.3F
I think is worthy to check if is interesting for core
Tomáš Švikruha March 19, 2015 at 7:39 AM
Hi @Hiep Lq, just tried variant no 2 (java+java script way) and it work! Don't know if it is the best solution, but as temporary fix it's enough.
Many thanks, you just made my day
Hiep Lq March 19, 2015 at 3:31 AM
find out it.
two way:
1. java + config way:
in project org.adempiere.ui.zk see
org.zkforge.keylistener in
web.js.zkforge
detail document: http://books.zkoss.org/wiki/ZK%20Client-side%20Reference
read part: Language Definition and Widget Package Descriptor
2. java + java script way
in method doCreatePart class DefaultDesktop
add below code (modify for suitable with you)
String link = ThemeManager.getThemeResource("css/themeTest.css.dsp");
link = link.substring(1, link.length()); // remove "/" to define relate path
Clients.response("loadNewCss", new AuScript(null, String.format("zk.loadCSS ('%s', '%s')", link , "newTheme")));
Tomáš Švikruha March 18, 2015 at 7:02 PM
I will attach next patch after changing it into Preference Dialog - seems it logical...
Currently I am wondering of usability this theme concept per Client. Thats mean login page will have some general UI loaded from default theme defined in system config. After successful login, default theme for client will be loaded (theme which is defined in AD_Theme with IsDefault=Y).
I've just tested this use case and looks like it is on a good way...BUT discovered one stopper which I was not able to solve. Default desktop is messed up, GUI components loaded by java classes are with correct client theme, but some CSS styles are loaded with previous default theme used when user is not logged (looks like css is loaded by login page and still used after login), css styles are not re-loaded with client theme....Desktop is loaded with correct client css styles and images only after manual refreshing of browser window.
Just need to find out way how to refresh browser window after login/change role from code, or css styles should be re-loaded after login/change role.
@Hiep Lq please write down some notes based on our discussion.
Carlos Ruiz February 8, 2015 at 1:12 AM
Thanks @Tomáš Švikruha,
Q1 - I prefer that into Preference Dialog - seems less clogged UI
Q2 - Not important for me - at this moment we can define those images in sysconfig keys
Current version support only one theme per iDempiere instalation. Me with @Norbert Bede discussed about possibility to change / extend this concept to support multiple themes per Client / Organisation / Role / User.
Current tasks
1. Create Table & Window AD_Theme
2. Implement Value Preference support for theme management (actual theme will be stored in Value Preference)
If anybody is interested in this topic, feel free to share your ideas. @Norbert Bede please write some useful notes about our discussion related to this topic.