Make iDempiere themes definable on different levels

Description

Current version support only one theme per iDempiere instalation. Me with 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. please write some useful notes about our discussion related to this topic.

Environment

None

Activity

Show:
Tomáš Švikruha
February 4, 2015, 11:55 AM

Hi ,

thanks for your notes, it's always appreciated

I've just made some changes based on your notes and attached patch v2:

  • added column IsDefault on AD_Theme

  • in ThemeManager is loaded default theme from table AD_Theme (system and client themes, ordered by client and org descending)

  • sys config for ZK Theme is no more used

  • access level on table changed to All

  • themes in right top user panel are filtered by access filter (Query.setApplyAccessFilter(true, false))

Q1: Is OK to have dropdown to change themes as in attached image, or changing of themes has to be in Preference dialog (like MJMcKay solution)?
Q2: Do you see as important to replace sys config values like HEADER_LOGO_IMAGE, LOGIN_LOGO_IMAGE etc. by columns in Theme table? (like MJMcKay solution)

If you see some issues which blocks applying this patch to community version, please let me know.

Carlos Ruiz
February 8, 2015, 1:12 AM

Thanks ,

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

Tomáš Švikruha
March 18, 2015, 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.

please write down some notes based on our discussion.

Hiep Lq
March 19, 2015, 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 19, 2015, 7:39 AM

Hi , 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

Assignee

Tomáš Švikruha

Reporter

Tomáš Švikruha

Labels

Tested By

None

Due date

2015/02/28

Priority

Minor
Configure