- Implemented basic theme support, added new ZK_THEME key
- Added content for www.testadempiere.com
- default css move from default.css.dsp to /theme/default/css/theme.css.dsp
- load calc.js and layout.js using lang-addon.xml instead
- Implemented gradient background for selected window tab ( the vertical tab )
- Fixed combobox look and feel
- Vertical tab will take less space now if the label is short, for e.g the tab for sales order window.
This commit is contained in:
Heng Sin Low 2009-05-14 08:38:37 +00:00
parent 82347ac0da
commit 7f24893ba3
29 changed files with 760 additions and 285 deletions

View File

@ -2,9 +2,9 @@
<!-- lang.xml <!-- lang.xml
Purpose: Purpose:
Description: Description:
History: History:
Saturday Mar 10 23:43:11 2007, Created by Ashley G Ramdass Saturday Mar 10 23:43:11 2007, Created by Ashley G Ramdass
@ -12,15 +12,16 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
--> -->
<language> <language>
<addon-name>ADempiere WebUI</addon-name> <addon-name>ADempiere WebUI</addon-name>
<language-name>xul/html</language-name> <language-name>xul/html</language-name>
<version> <version>
<version-class>org.adempiere.webui.AdempiereWebUI</version-class> <version-class>org.adempiere.webui.AdempiereWebUI</version-class>
<version-uid>1.0</version-uid> <version-uid>3.5</version-uid>
</version> </version>
<javascript src="/js/calc.js" charset="UTF-8"/> <javascript src="/js/calc.js" charset="UTF-8"/>
<javascript src="/js/layout.js" charset="UTF-8"/>
</language> </language>

View File

@ -64,7 +64,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWebClient
public static final String APP_NAME = "Adempiere"; public static final String APP_NAME = "Adempiere";
public static final String UID = "1.0"; public static final String UID = "3.5";
private WLogin loginDesktop; private WLogin loginDesktop;

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* Product: Posterita Ajax UI * * Copyright (C) 2008 Low Heng Sin *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * * Copyright (C) 2009 Idalica Corporation *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope * * by the Free Software Foundation. This program is distributed in the hope *
@ -10,18 +10,23 @@
* You should have received a copy of the GNU General Public License along * * You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui; package org.adempiere.webui;
import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.part.AbstractUIPart;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.window.LoginWindow; import org.adempiere.webui.window.LoginWindow;
import org.compiere.model.MSysConfig;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.metainfo.PageDefinition;
import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center; import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.East;
import org.zkoss.zkex.zul.North;
import org.zkoss.zkex.zul.South;
import org.zkoss.zkex.zul.West;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/** /**
@ -33,41 +38,84 @@ import org.zkoss.zul.Vbox;
*/ */
public class WLogin extends AbstractUIPart public class WLogin extends AbstractUIPart
{ {
private IWebClient app;
private IWebClient app;
private Borderlayout layout; private Borderlayout layout;
public WLogin(IWebClient app) public WLogin(IWebClient app)
{ {
this.app = app; this.app = app;
} }
protected Component doCreatePart(Component parent) protected Component doCreatePart(Component parent)
{ {
String theme = MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
layout = new Borderlayout(); layout = new Borderlayout();
if (parent != null) if (parent != null)
layout.setParent(parent); layout.setParent(parent);
else else
layout.setPage(page); layout.setPage(page);
Center c = new Center(); LayoutUtils.addSclass(ITheme.LOGIN_WINDOW_CLASS, layout);
c.setParent(layout);
c.setBorder("none"); Center center = new Center();
c.setFlex(true); center.setParent(layout);
c.setAutoscroll(true); center.setBorder("none");
center.setFlex(true);
center.setAutoscroll(true);
center.setStyle("border: none; background-color: transparent;");
Vbox vb = new Vbox(); Vbox vb = new Vbox();
vb.setParent(c); vb.setParent(center);
vb.setHeight("100%"); vb.setHeight("100%");
vb.setWidth("100%"); vb.setWidth("100%");
vb.setPack("center"); vb.setPack("center");
vb.setAlign("center"); vb.setAlign("center");
LayoutUtils.addSclass("login", vb); vb.setStyle("background-color: transparent;");
LoginWindow loginWindow = new LoginWindow(app); LoginWindow loginWindow = new LoginWindow(app);
loginWindow.setParent(vb); loginWindow.setParent(vb);
try {
String right = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_RIGHT_PANEL_ZUL;
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(right);
East east = new East();
east.setSclass(ITheme.LOGIN_EAST_PANEL_CLASS);
addContent(east, pageDefintion);
} catch (Exception e) {}
try {
String left = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_LEFT_PANEL_ZUL;
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(left);
West west = new West();
west.setSclass(ITheme.LOGIN_WEST_PANEL_CLASS);
addContent(west, pageDefintion);
} catch (Exception e){}
try {
String top = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_TOP_PANEL_ZUL;
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(top);
North north = new North();
north.setSclass(ITheme.LOGIN_NORTH_PANEL_CLASS);
addContent(north, pageDefintion);
} catch (Exception e) {}
try {
String bottom = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_BOTTOM_PANEL_ZUL;
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(bottom);
South south = new South();
south.setSclass(ITheme.LOGIN_SOUTH_PANEL_CLASS);
addContent(south, pageDefintion);
} catch (Exception e) {}
return layout; return layout;
} }
private void addContent(Component parent, PageDefinition page) {
layout.appendChild(parent);
Executions.createComponents(page, parent, null);
}
public void detach() { public void detach() {
layout.detach(); layout.detach();
layout = null; layout = null;

View File

@ -1,5 +1,6 @@
/****************************************************************************** /******************************************************************************
* Copyright (C) 2008 Low Heng Sin * * Copyright (C) 2008 Low Heng Sin *
* Copyright (C) 2009 Idalica Corporation *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope * * by the Free Software Foundation. This program is distributed in the hope *
@ -60,12 +61,14 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
} }
public synchronized void refresh() { public synchronized void refresh() {
List childs = getChildren(); List<?> childs = getChildren();
int childCount = childs.size(); int childCount = childs.size();
for (int c = childCount - 1; c >=0; c--) { for (int c = childCount - 1; c >=0; c--) {
removeChild((Component) childs.get(c)); removeChild((Component) childs.get(c));
} }
Object[] items = listItems.toArray(); Object[] items = listItems.toArray();
int tabWidth = 100;
List<Button> btnList = new ArrayList<Button>();
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
ADTabLabel tabLabel = (ADTabLabel) items[i]; ADTabLabel tabLabel = (ADTabLabel) items[i];
Button button = new Button(); Button button = new Button();
@ -92,13 +95,29 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
} }
String style = (tabPlacement == IADTab.LEFT ? "margin-left:" : "margin-right:") + (tabLabel.tabLevel*15+5) + "px"; String style = (tabPlacement == IADTab.LEFT ? "margin-left:" : "margin-right:") + (tabLabel.tabLevel*15+5) + "px";
String width = (195 - tabLabel.tabLevel*15)+"px"; if (button.isVisible()) {
style = style + "; width:" + width; int width = tabLabel.label.length() * 10 + 20;
if (width > tabWidth)
tabWidth = width;
}
btnList.add(button);
button.setStyle(style); button.setStyle(style);
button.setParent(this); button.setParent(this);
button.addEventListener(Events.ON_CLICK, this); button.addEventListener(Events.ON_CLICK, this);
} }
//set width
if (tabWidth > 190)
tabWidth = 190;
for (int i = 0; i < items.length; i++) {
ADTabLabel tabLabel = (ADTabLabel) items[i];
Button button = btnList.get(i);
if (!button.isVisible())
continue;
String width = (tabWidth - tabLabel.tabLevel*15)+"px";
button.setStyle(button.getStyle() + "; display: block; width:" + width);
}
} }
public int getSelectedIndex() { public int getSelectedIndex() {

View File

@ -13,6 +13,12 @@
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ * * or via info@posterita.org or http://www.posterita.org/ *
* *
* Contributors: *
* - Heng Sin Low *
* *
* Sponsors: *
* - Idalica Corporation *
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
@ -58,12 +64,8 @@ import org.zkoss.zul.Tab;
*/ */
public class ADWindowPanel extends AbstractADWindowPanel public class ADWindowPanel extends AbstractADWindowPanel
{ {
private static final CLogger logger; @SuppressWarnings("unused")
private static final CLogger logger = CLogger.getCLogger(ADWindowPanel.class);
static
{
logger = CLogger.getCLogger(ADWindowPanel.class);
}
private Borderlayout layout; private Borderlayout layout;
@ -125,6 +127,7 @@ public class ADWindowPanel extends AbstractADWindowPanel
layout.appendChild(west); layout.appendChild(west);
west.setSplittable(false); west.setSplittable(false);
west.setAutoscroll(true); west.setAutoscroll(true);
west.setFlex(true);
LayoutUtils.addSclass("adwindow-nav adwindow-left-nav", west); LayoutUtils.addSclass("adwindow-nav adwindow-left-nav", west);
adTab.setTabplacement(IADTab.LEFT); adTab.setTabplacement(IADTab.LEFT);
adTab.getTabSelectionComponent().setParent(west); adTab.getTabSelectionComponent().setParent(west);
@ -135,6 +138,7 @@ public class ADWindowPanel extends AbstractADWindowPanel
layout.appendChild(east); layout.appendChild(east);
east.setSplittable(false); east.setSplittable(false);
east.setAutoscroll(true); east.setAutoscroll(true);
east.setFlex(true);
LayoutUtils.addSclass("adwindow-nav adwindow-right-nav", east); LayoutUtils.addSclass("adwindow-nav adwindow-right-nav", east);
adTab.setTabplacement(IADTab.RIGHT); adTab.setTabplacement(IADTab.RIGHT);
adTab.getTabSelectionComponent().setParent(east); adTab.getTabSelectionComponent().setParent(east);
@ -218,7 +222,7 @@ public class ADWindowPanel extends AbstractADWindowPanel
Tabbox tabbox = (Tabbox) tab.getTabbox(); Tabbox tabbox = (Tabbox) tab.getTabbox();
if (tabbox.getSelectedTab() == tab) { if (tabbox.getSelectedTab() == tab) {
Tabs tabs = (Tabs) tabbox.getTabs(); Tabs tabs = (Tabs) tabbox.getTabs();
List childs = tabs.getChildren(); List<?> childs = tabs.getChildren();
for(int i = 0; i < childs.size(); i++) { for(int i = 0; i < childs.size(); i++) {
if (childs.get(i) == tab) { if (childs.get(i) == tab) {
if (i > 0) if (i > 0)

View File

@ -19,6 +19,7 @@ package org.adempiere.webui.panel;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.window.AboutWindow; import org.adempiere.webui.window.AboutWindow;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
@ -57,9 +58,12 @@ public class HeaderPanel extends Panel implements EventListener
UserPanel userPanel = new UserPanel(); UserPanel userPanel = new UserPanel();
String logoURL = MSysConfig.getValue("ZK_LOGO_SMALL", null); String logoURL = MSysConfig.getValue("WEBUI_LOGOURL", null);
if (logoURL == null || logoURL.trim().length() == 0) if (logoURL == null || logoURL.trim().length() == 0)
logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png"); {
String theme = MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
logoURL = ITheme.THEME_PATH_PREFIX + theme + ITheme.HEADER_LOGO_IMAGE;
}
image.setSrc(logoURL); image.setSrc(logoURL);
image.addEventListener(Events.ON_CLICK, this); image.addEventListener(Events.ON_CLICK, this);
image.setStyle("cursor: pointer;"); image.setStyle("cursor: pointer;");

View File

@ -13,6 +13,12 @@
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ * * or via info@posterita.org or http://www.posterita.org/ *
* *
* Contributors: *
* - Heng Sin Low *
* *
* Sponsors: *
* - Idalica Corporation *
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
@ -20,15 +26,15 @@ package org.adempiere.webui.panel;
import java.util.Properties; import java.util.Properties;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.util.UserPreference; import org.adempiere.webui.util.UserPreference;
import org.adempiere.webui.window.LoginWindow; import org.adempiere.webui.window.LoginWindow;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
@ -38,6 +44,10 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Language; import org.compiere.util.Language;
import org.compiere.util.Login; import org.compiere.util.Login;
import org.zkoss.util.Locales; import org.zkoss.util.Locales;
import org.zkoss.zhtml.Div;
import org.zkoss.zhtml.Table;
import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException; import org.zkoss.zk.ui.WrongValueException;
@ -45,9 +55,8 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Image; import org.zkoss.zul.Image;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
/** /**
* *
@ -59,7 +68,7 @@ import org.zkoss.zul.Listitem;
*/ */
public class LoginPanel extends Window implements EventListener public class LoginPanel extends Window implements EventListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -5823771596520748214L; private static final long serialVersionUID = -5823771596520748214L;
@ -72,9 +81,7 @@ public class LoginPanel extends Window implements EventListener
private Label lblLanguage; private Label lblLanguage;
private Textbox txtUserId; private Textbox txtUserId;
private Textbox txtPassword; private Textbox txtPassword;
private Listbox lstLanguage; private Combobox lstLanguage;
/* private Button btnOk;
private Button btnCancel;*/
private LoginWindow wndLogin; private LoginWindow wndLogin;
public LoginPanel(Properties ctx, LoginWindow loginWindow) public LoginPanel(Properties ctx, LoginWindow loginWindow)
@ -91,44 +98,78 @@ public class LoginPanel extends Window implements EventListener
private void init() private void init()
{ {
Grid grid = new Grid(); String theme = MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
grid.setOddRowSclass("even");
grid.setId("grdLogin");
Rows rows = new Rows();
Row logo = new Row();
logo.setSpans("2");
Image image = new Image();
image.setSrc(MSysConfig.getValue("ZK_LOGO_LARGE", "images/logo.png"));
logo.appendChild(image);
Row rowUser = new Row();
rowUser.setId("rowUser");
Row rowPassword = new Row();
rowPassword.setId("rowPassword");
Row rowLanguage = new Row();
rowLanguage.setId("rowLanguage");
rowUser.appendChild(lblUserId.rightAlign()); Div div = new Div();
rowUser.appendChild(txtUserId); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
Label label = new Label("Login");
label.setSclass(ITheme.LOGIN_BOX_HEADER_TXT_CLASS);
div.appendChild(label);
this.appendChild(div);
rowPassword.appendChild(lblPassword.rightAlign()); Table table = new Table();
rowPassword.appendChild(txtPassword); table.setId("grdLogin");
table.setDynamicProperty("cellpadding", "0");
table.setDynamicProperty("cellspacing", "5");
table.setSclass(ITheme.LOGIN_BOX_BODY_CLASS);
rowLanguage.appendChild(lblLanguage.rightAlign()); this.appendChild(table);
rowLanguage.appendChild(lstLanguage);
Row rowButtons = new Row(); Tr tr = new Tr();
rowButtons.setSpans("2"); table.appendChild(tr);
Td td = new Td();
td.setSclass(ITheme.LOGIN_BOX_HEADER_LOGO_CLASS);
tr.appendChild(td);
td.setDynamicProperty("colspan", "2");
Image image = new Image();
image.setSrc(ITheme.THEME_PATH_PREFIX+theme+ITheme.LOGIN_LOGO_IMAGE);
td.appendChild(image);
tr = new Tr();
tr.setId("rowUser");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(lblUserId);
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(txtUserId);
tr = new Tr();
tr.setId("rowPassword");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(lblPassword);
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(txtPassword);
tr = new Tr();
tr.setId("rowLanguage");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(lblLanguage);
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(lstLanguage);
div = new Div();
div.setSclass(ITheme.LOGIN_BOX_FOOTER_CLASS);
ConfirmPanel pnlButtons = new ConfirmPanel(false); ConfirmPanel pnlButtons = new ConfirmPanel(false);
pnlButtons.addActionListener(this); pnlButtons.addActionListener(this);
rowButtons.appendChild(pnlButtons); LayoutUtils.addSclass(ITheme.LOGIN_BOX_FOOTER_PANEL_CLASS, pnlButtons);
pnlButtons.setWidth(null);
rows.appendChild(logo); pnlButtons.getButton(ConfirmPanel.A_OK).setSclass(ITheme.LOGIN_BUTTON_CLASS);
rows.appendChild(rowUser); div.appendChild(pnlButtons);
rows.appendChild(rowPassword); this.appendChild(div);
rows.appendChild(rowLanguage);
rows.appendChild(rowButtons);
grid.appendChild(rows);
this.appendChild(grid);
} }
private void initComponents() private void initComponents()
@ -159,10 +200,10 @@ public class LoginPanel extends Window implements EventListener
txtPassword.setMaxlength(40); txtPassword.setMaxlength(40);
txtPassword.setWidth("220px"); txtPassword.setWidth("220px");
lstLanguage = new Listbox(); lstLanguage = new Combobox();
lstLanguage.setAutocomplete(true);
lstLanguage.setAutodrop(true);
lstLanguage.setId("lstLanguage"); lstLanguage.setId("lstLanguage");
lstLanguage.setRows(1);
lstLanguage.setMold("select");
lstLanguage.addEventListener(Events.ON_SELECT, this); lstLanguage.addEventListener(Events.ON_SELECT, this);
lstLanguage.setWidth("220px"); lstLanguage.setWidth("220px");
@ -206,7 +247,7 @@ public class LoginPanel extends Window implements EventListener
String initDefault = userPreference.getProperty(UserPreference.P_LANGUAGE); String initDefault = userPreference.getProperty(UserPreference.P_LANGUAGE);
for(int i = 0; i < lstLanguage.getItemCount(); i++) for(int i = 0; i < lstLanguage.getItemCount(); i++)
{ {
Listitem li = lstLanguage.getItemAtIndex(i); Comboitem li = lstLanguage.getItemAtIndex(i);
if(li.getLabel().equals(initDefault)) if(li.getLabel().equals(initDefault))
{ {
lstLanguage.setSelectedIndex(i); lstLanguage.setSelectedIndex(i);

View File

@ -13,6 +13,12 @@
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ * * or via info@posterita.org or http://www.posterita.org/ *
* *
* Contributors: *
* - Heng Sin Low *
* *
* Sponsors: *
* - Idalica Corporation *
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
@ -20,11 +26,15 @@ package org.adempiere.webui.panel;
import java.util.Properties; import java.util.Properties;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.ComboItem;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.util.UserPreference; import org.adempiere.webui.util.UserPreference;
import org.adempiere.webui.window.LoginWindow; import org.adempiere.webui.window.LoginWindow;
import org.compiere.db.CConnection; import org.compiere.db.CConnection;
@ -34,19 +44,21 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Language; import org.compiere.util.Language;
import org.compiere.util.Login; import org.compiere.util.Login;
import org.compiere.util.Msg;
import org.zkoss.zhtml.Table;
import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.Deferrable;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Button; import org.zkoss.zul.Button;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Image; import org.zkoss.zul.Image;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Row;
import org.zkoss.zul.Rows;
/** /**
* *
@ -56,7 +68,7 @@ import org.zkoss.zul.Rows;
* @author <a href="mailto:sendy.yagambrum@posterita.org">Sendy Yagambrum</a> * @author <a href="mailto:sendy.yagambrum@posterita.org">Sendy Yagambrum</a>
* @date July 18, 2007 * @date July 18, 2007
*/ */
public class RolePanel extends Window implements EventListener public class RolePanel extends Window implements EventListener, Deferrable
{ {
/** /**
* *
@ -69,12 +81,10 @@ public class RolePanel extends Window implements EventListener
private Login login; private Login login;
private KeyNamePair rolesKNPairs[]; private KeyNamePair rolesKNPairs[];
private Label lblErrorMsg; private Combobox lstRole, lstClient, lstOrganisation, lstWarehouse;
private Listbox lstRole, lstClient, lstOrganisation, lstWarehouse;
private Label lblRole, lblClient, lblOrganisation, lblWarehouse; private Label lblRole, lblClient, lblOrganisation, lblWarehouse;
private Button btnOk, btnCancel; private Button btnOk, btnCancel;
public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, String password) public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, String password)
{ {
this.wndLogin = loginWindow; this.wndLogin = loginWindow;
@ -96,53 +106,91 @@ public class RolePanel extends Window implements EventListener
private void init() private void init()
{ {
Grid grid = new Grid(); String theme = MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
grid.setId("grdChooseRole");
grid.setOddRowSclass("even");
Rows rows = new Rows();
Row logo = new Row(); Div div = new Div();
logo.setSpans("2"); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
Image image = new Image(); Label label = new Label("Login");
image.setSrc(MSysConfig.getValue("ZK_LOGO_LARGE", "images/logo.png")); label.setSclass(ITheme.LOGIN_BOX_HEADER_TXT_CLASS);
logo.appendChild(image); div.appendChild(label);
this.appendChild(div);
Row rowRole = new Row(); Table table = new Table();
Row rowClient = new Row(); table.setId("grdChooseRole");
Row rowOrg = new Row(); table.setDynamicProperty("cellpadding", "0");
Row rowWarehouse = new Row(); table.setDynamicProperty("cellspacing", "5");
table.setSclass(ITheme.LOGIN_BOX_BODY_CLASS);
rowRole.appendChild(lblRole.rightAlign()); this.appendChild(table);
rowRole.appendChild(lstRole);
rowClient.appendChild(lblClient.rightAlign()); Tr tr = new Tr();
rowClient.appendChild(lstClient); table.appendChild(tr);
Td td = new Td();
td.setSclass(ITheme.LOGIN_BOX_HEADER_LOGO_CLASS);
tr.appendChild(td);
td.setDynamicProperty("colspan", "2");
Image image = new Image();
image.setSrc(ITheme.THEME_PATH_PREFIX+theme+ITheme.LOGIN_LOGO_IMAGE);
td.appendChild(image);
rowOrg.appendChild(lblOrganisation.rightAlign()); tr = new Tr();
rowOrg.appendChild(lstOrganisation); tr.setId("rowRole");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(lblRole.rightAlign());
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(lstRole);
rowWarehouse.appendChild(lblWarehouse.rightAlign()); tr = new Tr();
rowWarehouse.appendChild(lstWarehouse); tr.setId("rowclient");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(lblClient.rightAlign());
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(lstClient);
Row rowButtons = new Row(); tr = new Tr();
tr.setId("rowOrganisation");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(lblOrganisation.rightAlign());
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(lstOrganisation);
tr = new Tr();
tr.setId("rowWarehouse");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
td.setSclass(ITheme.LOGIN_LABEL_CLASS);
td.appendChild(lblWarehouse.rightAlign());
td = new Td();
td.setSclass(ITheme.LOGIN_FIELD_CLASS);
tr.appendChild(td);
td.appendChild(lstWarehouse);
div = new Div();
div.setSclass(ITheme.LOGIN_BOX_FOOTER_CLASS);
ConfirmPanel pnlButtons = new ConfirmPanel(true); ConfirmPanel pnlButtons = new ConfirmPanel(true);
pnlButtons.addActionListener(this); pnlButtons.addActionListener(this);
rowButtons.setSpans("2"); LayoutUtils.addSclass(ITheme.LOGIN_BOX_FOOTER_PANEL_CLASS, pnlButtons);
rowButtons.appendChild(pnlButtons); pnlButtons.setWidth(null);
pnlButtons.getButton(ConfirmPanel.A_OK).setSclass(ITheme.LOGIN_BUTTON_CLASS);
rows.appendChild(logo); pnlButtons.getButton(ConfirmPanel.A_CANCEL).setSclass(ITheme.LOGIN_BUTTON_CLASS);
rows.appendChild(rowRole); div.appendChild(pnlButtons);
rows.appendChild(rowClient); this.appendChild(div);
rows.appendChild(rowOrg);
rows.appendChild(rowWarehouse);
rows.appendChild(rowButtons);
grid.appendChild(rows);
Div divErr = new Div();
divErr.appendChild(lblErrorMsg);
this.appendChild(divErr);
this.appendChild(grid);
} }
private void initComponents() private void initComponents()
@ -151,9 +199,6 @@ public class RolePanel extends Window implements EventListener
ResourceBundle res = ResourceBundle.getBundle(RESOURCE, language.getLocale()); ResourceBundle res = ResourceBundle.getBundle(RESOURCE, language.getLocale());
lblErrorMsg = new Label();
lblErrorMsg.setValue(" ");
lblRole = new Label(); lblRole = new Label();
lblRole.setId("lblRole"); lblRole.setId("lblRole");
lblRole.setValue(res.getString("Role")); lblRole.setValue(res.getString("Role"));
@ -170,31 +215,31 @@ public class RolePanel extends Window implements EventListener
lblWarehouse.setId("lblWarehouse"); lblWarehouse.setId("lblWarehouse");
lblWarehouse.setValue(res.getString("Warehouse")); lblWarehouse.setValue(res.getString("Warehouse"));
lstRole = new Listbox(); lstRole = new Combobox();
lstRole.setAutocomplete(true);
lstRole.setAutodrop(true);
lstRole.setId("lstRole"); lstRole.setId("lstRole");
lstRole.setRows(1);
lstRole.setMold("select");
lstRole.addEventListener(Events.ON_SELECT, this); lstRole.addEventListener(Events.ON_SELECT, this);
lstRole.setWidth("220px"); lstRole.setWidth("220px");
lstClient = new Listbox(); lstClient = new Combobox();
lstClient.setAutocomplete(true);
lstClient.setAutodrop(true);
lstClient.setId("lstClient"); lstClient.setId("lstClient");
lstClient.setRows(1);
lstClient.setMold("select");
lstClient.addEventListener(Events.ON_SELECT, this); lstClient.addEventListener(Events.ON_SELECT, this);
lstClient.setWidth("220px"); lstClient.setWidth("220px");
lstOrganisation = new Listbox(); lstOrganisation = new Combobox();
lstOrganisation.setAutocomplete(true);
lstOrganisation.setAutodrop(true);
lstOrganisation.setId("lstOrganisation"); lstOrganisation.setId("lstOrganisation");
lstOrganisation.setRows(1);
lstOrganisation.setMold("select");
lstOrganisation.addEventListener(Events.ON_SELECT, this); lstOrganisation.addEventListener(Events.ON_SELECT, this);
lstOrganisation.setWidth("220px"); lstOrganisation.setWidth("220px");
lstWarehouse = new Listbox(); lstWarehouse = new Combobox();
lstWarehouse.setAutocomplete(true);
lstWarehouse.setAutodrop(true);
lstWarehouse.setId("lstWarehouse"); lstWarehouse.setId("lstWarehouse");
lstWarehouse.setRows(1);
lstWarehouse.setMold("select");
lstWarehouse.addEventListener(Events.ON_SELECT, this); lstWarehouse.addEventListener(Events.ON_SELECT, this);
lstWarehouse.setWidth("220px"); lstWarehouse.setWidth("220px");
@ -213,11 +258,12 @@ public class RolePanel extends Window implements EventListener
String initDefault = userPreference.getProperty(UserPreference.P_ROLE); String initDefault = userPreference.getProperty(UserPreference.P_ROLE);
for(int i = 0; i < rolesKNPairs.length; i++) for(int i = 0; i < rolesKNPairs.length; i++)
{ {
Listitem li = lstRole.appendItem(rolesKNPairs[i].getName(), rolesKNPairs[i].getID()); ComboItem ci = new ComboItem(rolesKNPairs[i].getName(), rolesKNPairs[i].getID());
lstRole.appendChild(ci);
if(rolesKNPairs[i].getID().equals(initDefault)) if(rolesKNPairs[i].getID().equals(initDefault))
lstRole.setSelectedItem(li); lstRole.setSelectedItem(ci);
} }
if (lstRole.getSelectedIndex() == -1) if (lstRole.getSelectedIndex() == -1 && lstRole.getItemCount() > 0)
lstRole.setSelectedIndex(0); lstRole.setSelectedIndex(0);
// //
updateClientList(); updateClientList();
@ -226,7 +272,7 @@ public class RolePanel extends Window implements EventListener
private void updateClientList() private void updateClientList()
{ {
lstClient.getItems().clear(); lstClient.getItems().clear();
Listitem lstItemRole = lstRole.getSelectedItem(); Comboitem lstItemRole = lstRole.getSelectedItem();
if(lstItemRole != null) if(lstItemRole != null)
{ {
// initial client - Elaine 2009/02/06 // initial client - Elaine 2009/02/06
@ -238,11 +284,12 @@ public class RolePanel extends Window implements EventListener
{ {
for(int i = 0; i < clientKNPairs.length; i++) for(int i = 0; i < clientKNPairs.length; i++)
{ {
Listitem li = lstClient.appendItem(clientKNPairs[i].getName(), clientKNPairs[i].getID()); ComboItem ci = new ComboItem(clientKNPairs[i].getName(), clientKNPairs[i].getID());
lstClient.appendChild(ci);
if(clientKNPairs[i].getID().equals(initDefault)) if(clientKNPairs[i].getID().equals(initDefault))
lstClient.setSelectedItem(li); lstClient.setSelectedItem(ci);
} }
if (lstClient.getSelectedIndex() == -1) if (lstClient.getSelectedIndex() == -1 && lstClient.getItemCount() > 0)
lstClient.setSelectedIndex(0); lstClient.setSelectedIndex(0);
} }
// //
@ -256,7 +303,8 @@ public class RolePanel extends Window implements EventListener
private void updateOrganisationList() private void updateOrganisationList()
{ {
lstOrganisation.getItems().clear(); lstOrganisation.getItems().clear();
Listitem lstItemClient = lstClient.getSelectedItem(); lstOrganisation.setText("");
Comboitem lstItemClient = lstClient.getSelectedItem();
if(lstItemClient != null) if(lstItemClient != null)
{ {
// initial organisation - Elaine 2009/02/06 // initial organisation - Elaine 2009/02/06
@ -268,11 +316,13 @@ public class RolePanel extends Window implements EventListener
{ {
for(int i = 0; i < orgKNPairs.length; i++) for(int i = 0; i < orgKNPairs.length; i++)
{ {
Listitem li = lstOrganisation.appendItem(orgKNPairs[i].getName(), orgKNPairs[i].getID()); ComboItem ci = new ComboItem(orgKNPairs[i].getName(), orgKNPairs[i].getID());
lstOrganisation.appendChild(ci);
if(orgKNPairs[i].getID().equals(initDefault)) if(orgKNPairs[i].getID().equals(initDefault))
lstOrganisation.setSelectedItem(li); lstOrganisation.setSelectedItem(ci);
} }
if (lstOrganisation.getSelectedIndex() == -1) if (lstOrganisation.getSelectedIndex() == -1 && lstOrganisation.getItemCount() > 0)
lstOrganisation.setSelectedIndex(0); lstOrganisation.setSelectedIndex(0);
} }
// //
@ -283,7 +333,8 @@ public class RolePanel extends Window implements EventListener
private void updateWarehouseList() private void updateWarehouseList()
{ {
lstWarehouse.getItems().clear(); lstWarehouse.getItems().clear();
Listitem lstItemOrganisation = lstOrganisation.getSelectedItem(); lstWarehouse.setText("");
Comboitem lstItemOrganisation = lstOrganisation.getSelectedItem();
if(lstItemOrganisation != null) if(lstItemOrganisation != null)
{ {
// initial warehouse - Elaine 2009/02/06 // initial warehouse - Elaine 2009/02/06
@ -295,11 +346,12 @@ public class RolePanel extends Window implements EventListener
{ {
for(int i = 0; i < warehouseKNPairs.length; i++) for(int i = 0; i < warehouseKNPairs.length; i++)
{ {
Listitem li = lstWarehouse.appendItem(warehouseKNPairs[i].getName(), warehouseKNPairs[i].getID()); ComboItem ci = new ComboItem(warehouseKNPairs[i].getName(), warehouseKNPairs[i].getID());
lstWarehouse.appendChild(ci);
if(warehouseKNPairs[i].getID().equals(initDefault)) if(warehouseKNPairs[i].getID().equals(initDefault))
lstWarehouse.setSelectedItem(li); lstWarehouse.setSelectedItem(ci);
} }
if (lstWarehouse.getSelectedIndex() == -1) if (lstWarehouse.getSelectedIndex() == -1 && lstWarehouse.getItemCount() > 0)
lstWarehouse.setSelectedIndex(0); lstWarehouse.setSelectedIndex(0);
} }
// //
@ -334,27 +386,23 @@ public class RolePanel extends Window implements EventListener
**/ **/
public void validateRoles() public void validateRoles()
{ {
Listitem lstItemRole = lstRole.getSelectedItem(); Comboitem lstItemRole = lstRole.getSelectedItem();
Listitem lstItemClient = lstClient.getSelectedItem(); Comboitem lstItemClient = lstClient.getSelectedItem();
Listitem lstItemOrg = lstOrganisation.getSelectedItem(); Comboitem lstItemOrg = lstOrganisation.getSelectedItem();
Listitem lstItemWarehouse = lstWarehouse.getSelectedItem(); Comboitem lstItemWarehouse = lstWarehouse.getSelectedItem();
if(lstItemRole == null || lstItemRole.getValue() == null) if(lstItemRole == null || lstItemRole.getValue() == null)
{ {
lblErrorMsg.setValue("Role is mandatory!!!"); throw new WrongValueException(lstRole, Msg.getMsg(Env.getCtx(), "FillMandatory") + lblRole.getValue());
return ;
} }
else if(lstItemClient == null || lstItemClient.getValue() == null) else if(lstItemClient == null || lstItemClient.getValue() == null)
{ {
lblErrorMsg.setValue("Client is mandatory!!!"); throw new WrongValueException(lstClient, Msg.getMsg(Env.getCtx(), "FillMandatory") + lblClient.getValue());
return ;
} }
else if(lstItemOrg == null || lstItemOrg.getValue() == null) else if(lstItemOrg == null || lstItemOrg.getValue() == null)
{ {
lblErrorMsg.setValue("Organisation is mandatory!!!"); throw new WrongValueException(lstOrganisation, Msg.getMsg(Env.getCtx(), "FillMandatory") + lblOrganisation.getValue());
return ;
} }
lblErrorMsg.setValue(" ");
int orgId = 0, warehouseId = 0; int orgId = 0, warehouseId = 0;
orgId = Integer.parseInt((String)lstItemOrg.getValue()); orgId = Integer.parseInt((String)lstItemOrg.getValue());
KeyNamePair orgKNPair = new KeyNamePair(orgId, lstItemOrg.getLabel()); KeyNamePair orgKNPair = new KeyNamePair(orgId, lstItemOrg.getLabel());
@ -368,15 +416,13 @@ public class RolePanel extends Window implements EventListener
String msg = login.validateLogin(orgKNPair); String msg = login.validateLogin(orgKNPair);
if (msg != null && msg.length() > 0) if (msg != null && msg.length() > 0)
{ {
lblErrorMsg.setValue("Error for user login: " + msg); throw new WrongValueException(msg);
return;
} }
msg = login.loadPreferences(orgKNPair, warehouseKNPair, null, null); msg = login.loadPreferences(orgKNPair, warehouseKNPair, null, null);
if(!(msg == null || msg.length() == 0)) if(!(msg == null || msg.length() == 0))
{ {
lblErrorMsg.setValue("Error for user login: " + msg); throw new WrongValueException(msg);
return ;
} }
wndLogin.loginCompleted(); wndLogin.loginCompleted();
@ -390,4 +436,8 @@ public class RolePanel extends Window implements EventListener
userPreference.savePreference(); userPreference.savePreference();
// //
} }
public boolean isDeferrable() {
return false;
}
} }

View File

@ -0,0 +1,58 @@
/******************************************************************************
* Copyright (C) 2009 Low Heng Sin *
* Copyright (C) 2009 Idalica Corporation *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.theme;
/**
* Interface to hold global theme constant
* @author hengsin
*
*/
public interface ITheme {
//theme key in MSysConfig
public static final String ZK_THEME = "ZK_THEME";
//default theme
public static final String ZK_THEME_DEFAULT = "default";
//theme resource url prefix
public static final String THEME_PATH_PREFIX = "/theme/";
//css for login window and box
public static final String LOGIN_WINDOW_CLASS = "login-window";
public static final String LOGIN_BOX_HEADER_CLASS = "login-box-header";
public static final String LOGIN_BOX_HEADER_TXT_CLASS = "login-box-header-txt";
public static final String LOGIN_BOX_HEADER_LOGO_CLASS = "login-box-header-logo";
public static final String LOGIN_BOX_BODY_CLASS = "login-box-body";
public static final String LOGIN_BOX_FOOTER_CLASS = "login-box-footer";
public static final String LOGIN_BOX_FOOTER_PANEL_CLASS = "login-box-footer-pnl";
//css for login control
public static final String LOGIN_BUTTON_CLASS = "login-btn";
public static final String LOGIN_LABEL_CLASS = "login-label";
public static final String LOGIN_FIELD_CLASS = "login-field";
//optional top, bottom, left, right content for the login page
public static final String LOGIN_NORTH_PANEL_CLASS = "login-north-panel";
public static final String LOGIN_SOUTH_PANEL_CLASS = "login-south-panel";
public static final String LOGIN_WEST_PANEL_CLASS = "login-west-panel";
public static final String LOGIN_EAST_PANEL_CLASS = "login-east-panel";
public static final String LOGIN_TOP_PANEL_ZUL = "/login-top.zul";
public static final String LOGIN_BOTTOM_PANEL_ZUL = "/login-bottom.zul";
public static final String LOGIN_LEFT_PANEL_ZUL = "/login-left.zul";
public static final String LOGIN_RIGHT_PANEL_ZUL = "/login-right.zul";
//logo
public static final String LOGIN_LOGO_IMAGE = "/images/login-logo.png";
public static final String HEADER_LOGO_IMAGE = "/images/header-logo.png";
}

View File

@ -29,6 +29,7 @@ import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs; import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.theme.ITheme;
import org.compiere.Adempiere; import org.compiere.Adempiere;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.MUser; import org.compiere.model.MUser;
@ -302,9 +303,12 @@ public class AboutWindow extends Window implements EventListener {
vbox.setAlign("center"); vbox.setAlign("center");
vbox.setPack("center"); vbox.setPack("center");
vbox.setParent(tabPanel); vbox.setParent(tabPanel);
String logoURL = MSysConfig.getValue("ZK_LOGO_SMALL", null); String logoURL = MSysConfig.getValue("WEBUI_LOGOURL", null);
if (logoURL == null || logoURL.trim().length() == 0) if (logoURL == null || logoURL.trim().length() == 0)
logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png"); {
String theme = MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
logoURL = ITheme.THEME_PATH_PREFIX + theme + ITheme.HEADER_LOGO_IMAGE;
}
Image image = new Image(logoURL); Image image = new Image(logoURL);
image.setParent(vbox); image.setParent(vbox);

View File

@ -13,6 +13,12 @@
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ * * or via info@posterita.org or http://www.posterita.org/ *
* *
* Contributors: *
* - Heng Sin Low *
* *
* Sponsors: *
* - Idalica Corporation *
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.window; package org.adempiere.webui.window;
@ -39,48 +45,47 @@ import org.zkoss.zk.ui.event.Events;
public class LoginWindow extends FWindow implements EventListener public class LoginWindow extends FWindow implements EventListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -365979563919913804L; private static final long serialVersionUID = -365979563919913804L;
private IWebClient app; private IWebClient app;
private Properties ctx; private Properties ctx;
private LoginPanel pnlLogin; private LoginPanel pnlLogin;
private RolePanel pnlRole; private RolePanel pnlRole;
public LoginWindow(IWebClient app) public LoginWindow(IWebClient app)
{ {
this.ctx = Env.getCtx(); this.ctx = Env.getCtx();
this.app = app; this.app = app;
initComponents(); initComponents();
init(); init();
// add listener on 'ENTER' key for the login window // add listener on 'ENTER' key for the login window
addEventListener(Events.ON_OK,this); addEventListener(Events.ON_OK,this);
} }
private void init() private void init()
{ {
this.appendChild(pnlLogin); this.appendChild(pnlLogin);
this.setWidth("500px"); this.setStyle("background-color: transparent");
} }
private void initComponents() private void initComponents()
{ {
pnlLogin = new LoginPanel(ctx, this); pnlLogin = new LoginPanel(ctx, this);
} }
public void loginOk(String userName, String password) public void loginOk(String userName, String password)
{ {
pnlRole = new RolePanel(ctx, this, userName, password); pnlRole = new RolePanel(ctx, this, userName, password);
this.getChildren().clear(); this.getChildren().clear();
this.appendChild(pnlRole); this.appendChild(pnlRole);
} }
public void loginCompleted() public void loginCompleted()
{ {
app.loginCompleted(); app.loginCompleted();
} }
public void loginCancelled() public void loginCancelled()
{ {
pnlLogin = new LoginPanel(ctx, this); pnlLogin = new LoginPanel(ctx, this);
@ -88,10 +93,10 @@ public class LoginWindow extends FWindow implements EventListener
this.appendChild(pnlLogin); this.appendChild(pnlLogin);
} }
public void onEvent(Event event) public void onEvent(Event event)
{ {
// check that 'ENTER' key is pressed // check that 'ENTER' key is pressed
if ("onOK".equals(event.getName())) if (Events.ON_OK.equals(event.getName()))
{ {
/** /**
* LoginWindow can have as a child, either LoginPanel or RolePanel * LoginWindow can have as a child, either LoginPanel or RolePanel
@ -104,7 +109,7 @@ public class LoginWindow extends FWindow implements EventListener
{ {
rolePanel.validateRoles(); rolePanel.validateRoles();
} }
LoginPanel loginPanel = (LoginPanel)this.getFellowIfAny("loginPanel"); LoginPanel loginPanel = (LoginPanel)this.getFellowIfAny("loginPanel");
if (loginPanel != null) if (loginPanel != null)
{ {

View File

@ -1,79 +0,0 @@
/* Combobox2Default.java
{{IS_NOTE
Purpose:
Description:
History:
Jun 6, 2008 8:57:53 AM , Created by jumperchen
}}IS_NOTE
Copyright (C) 2008 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under GPL Version 2.0 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zkmax.zul.render;
import java.io.IOException;
import java.io.Writer;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.render.ComponentRenderer;
import org.zkoss.zk.ui.render.SmartWriter;
import org.zkoss.zul.Combobox;
/**
* {@link Combobox}'s default mold.
*
* @author jumperchen
*
* @since 3.5.0
*
* @author hengsin
* modify default zk layout for combobox
*/
public class Combobox2Default implements ComponentRenderer {
public void render(Component comp, Writer out) throws IOException {
final SmartWriter wh = new SmartWriter(out);
final Combobox self = (Combobox) comp;
final String uuid = self.getUuid();
final String zcls = self.getZclass();
final Execution exec = Executions.getCurrent();
String tableStyle = "display:inline-block";
String inputAttrs = self.getInnerAttrs();
if (inputAttrs.indexOf("style") >= 0) {
inputAttrs = inputAttrs.substring(0, inputAttrs.indexOf("style"));
}
inputAttrs = inputAttrs.trim() + " style='width: 100%'";
wh.write("<span id=\"").write(uuid).write("\"")
.write(self.getOuterAttrs())
.write(" z.type=\"zul.cb.Cmbox\" z.combo=\"true\">")
.write("<table border='0' cellspacing='0' cellpadding='0'")
.write(" width='").write(self.getWidth()).write("'")
.write(" style='"). write(tableStyle).write("'>")
.write("<tr style='width:100%; white-space:nowrap;'><td style='width: 100%'><input id=\"")
.write(uuid).write("!real\" autocomplete=\"off\"")
.write(" class=\"").write(zcls).write("-inp\" ")
.write(inputAttrs).write("/></td><td style='width: 17px'><span id=\"")
.write(uuid).write("!btn\" class=\"").write(zcls).write("-btn\"");
if (!self.isButtonVisible())
wh.write(" style=\"display:none\"");
wh.write("><img class=\"").write(zcls).write("-img\" onmousedown=\"return false;\"");
wh.write(" src=\"").write(exec.encodeURL("~./img/spacer.gif")).write("\"")
.write("\"/></span></td></tr></table><div id=\"").write(uuid).write("!pp\" class=\"")
.write(zcls).write("-pp\" style=\"display:none\" tabindex=\"-1\">")
.write("<table id=\"").write(uuid)
.write("!cave\" cellpadding=\"0\" cellspacing=\"0\">")
.writeChildren(self)
.write("</table></div></span>");
}
}

View File

@ -3,10 +3,9 @@
Copyright (C) 2007 Ashley G Ramdass. Copyright (C) 2007 Ashley G Ramdass.
--> -->
<?page style="height:100%"?> <?page style="height:100%"?>
<?link rel="icon" type="image/png" href="/images/AD16.png"?> <?init zscript="theme.zs" ?>
<?link rel="stylesheet" type="text/css" href="/css/default.css.dsp"?> <?link rel="icon" type="image/png" href="/theme/${theme}/images/icon.png"?>
<?link rel="javascript" type="text/javascript" href="/js/layout.js"?> <?link rel="stylesheet" type="text/css" href="/theme/${theme}/css/theme.css.dsp"?>
<?link rel="javascript" type="text/javascript" href="/js/calc.js"?>
<zk> <zk>
<window use="org.adempiere.webui.AdempiereWebUI"/> <window use="org.adempiere.webui.AdempiereWebUI"/>
</zk> </zk>

2
zkwebui/theme.zs Normal file
View File

@ -0,0 +1,2 @@
import org.compiere.model.MSysConfig;
var theme = MSysConfig.getValue("ZK_THEME", "default");

View File

@ -8,10 +8,83 @@ html,body {
background-color: #D4E3F4; background-color: #D4E3F4;
} }
.login { <%-- login --%>
background-color: #D4E3F4; .login-window {
background-color: #E5E5E5;
} }
.login-box-body {
width: 660px;
height: 200px;
background-image: url(../images/login-box-bg.png);
background-repeat: repeat-y;
background-color: transparent;
z-index: 1;
padding: 0;
margin: 0;
text-align: center;
padding-bottom: 100px;
}
.login-box-header {
background-image: url(../images/login-box-header.png);
background-color: transparent;
z-index: 2;
height: 54px;
width: 660px;
}
.login-box-header-txt {
color: white;
font-weight: bold;
position: relative;
top: 30px;
}
.login-box-header-logo {
padding-top: 20px;
padding-bottom: 25px;
}
.login-box-footer {
background-image: url(../images/login-box-footer.png);
background-color: transparent;
z-index: 2;
height: 110px;
width: 660px;
margin-left: 2px;
}
.login-box-footer-pnl {
width: 604px;
margin-left: 10px;
margin-right: 10px;
margin-top: 40px;
}
.login-label {
color: black;
text-align: right;
width: 40%;
}
.login-field {
text-align: left;
width: 55%;
}
.login-btn {
height: 36px;
width: 72px;
}
.login-east-panel, .login-west-panel {
width: 350px;
background-color: #E0EAF7;
position: relative;
}
<%-- header --%>
.header-left { .header-left {
margin: 0; margin: 0;
margin-left: 5px; margin-left: 5px;
@ -40,7 +113,8 @@ html,body {
} }
.header { .header {
background-image: url(images/gradient-bg.gif); --background-image: url(images/gradient-bg.gif);
background-image: url(../images/header-bg.png);
background-repeat: repeat-x; background-repeat: repeat-x;
width: 100%; width: 100%;
height: 35px; height: 35px;
@ -51,6 +125,7 @@ html,body {
font-size: 10px; font-size: 10px;
} }
<%-- button --%>
.action-button { .action-button {
height: 32px; height: 32px;
width: 48px; width: 48px;
@ -72,6 +147,7 @@ html,body {
text-align: center; text-align: center;
} }
<%-- desktop --%>
div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none { div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
background-color: white; background-color: white;
} }
@ -88,7 +164,6 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
} }
<%-- adwindow and form --%> <%-- adwindow and form --%>
.adform-content-none { .adform-content-none {
overflow: auto; overflow: auto;
position: absolute; position: absolute;
@ -102,7 +177,6 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
} }
.adwindow-nav { .adwindow-nav {
width: 200px;
} }
.adwindow-left-nav { .adwindow-left-nav {
@ -136,20 +210,36 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
font-weight: bold; font-weight: bold;
color: #274D5F; color: #274D5F;
cursor: pointer; cursor: pointer;
border-top: 1px solid #7EAAC6; border-top: 2px solid #7EAAC6;
border-bottom: 1px solid #7EAAC6; border-bottom: 2px solid #7EAAC6;
} }
.adwindow-left-navbtn-sel { .adwindow-left-navbtn-sel {
border-left: 1px solid #7EAAC6; border-left: 2px solid #7EAAC6;
border-right: none; border-right: none;
text-align: right; text-align: right;
-moz-border-radius-topleft: 5px;
-moz-border-radius-bottomleft: 5px;
-webkit-border-radius-top-left: 5px;
-webkit-border-radius-bottom-left: 5px;
background-color: #d1e7f6 !important;
background-image: url(../images/adtab-left-bg.png);
background-repeat: repeat-y;
background-position: top right;
} }
.adwindow-right-navbtn-sel { .adwindow-right-navbtn-sel {
border-right: 1px solid #7EAAC6; border-right: 2px solid #7EAAC6;
border-left: none; border-left: none;
text-align: left; text-align: left;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 5px;
-webkit-border-radius-top-right: 5px;
-webkit-border-radius-bottom-right: 5px;
background-color: #d1e7f6 !important;
background-image: url(../images/adtab-right-bg.png);
background-repeat: repeat-y;
background-position: top left;
} }
.adwindow-navbtn-uns { .adwindow-navbtn-uns {
@ -172,16 +262,19 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
border-left: 1px solid #CCCCCC; border-left: 1px solid #CCCCCC;
border-right: none; border-right: none;
text-align: right; text-align: right;
-moz-border-radius-topleft: 5px;
-moz-border-radius-bottomleft: 5px;
} }
.adwindow-right-navbtn-uns, .adwindow-right-navbtn-dis { .adwindow-right-navbtn-uns, .adwindow-right-navbtn-dis {
border-right: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC;
border-left: none; border-left: none;
text-align: left; text-align: left;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 5px;
} }
<%-- ad tab --%> <%-- ad tab --%>
.adtab-body { .adtab-body {
position: absolute; position: absolute;
margin: 0; margin: 0;
@ -270,3 +363,13 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
input:focus, textarea:focus, .z-combobox-inp:focus, z-datebox-inp:focus { input:focus, textarea:focus, .z-combobox-inp:focus, z-datebox-inp:focus {
border: 1px solid #0000ff; border: 1px solid #0000ff;
} }
<%-- fixed combobox btn position when width is set 100% --%>
.z-combobox-inp {
font-family: ${fontFamilyC};
font-size: ${fontSizeM};
font-weight: normal;
background: #FFF url(${c:encodeURL('~./zul/img/grid/text-bg.gif')}) repeat-x 0 0;
border: 1px solid #7F9DB9;
margin-right: -17px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009 Low Heng Sin
Copyright (C) 2009 Idalica Corporation
-->
<html>
<![CDATA[
<style>
.section-head {
margin-top: 20px;
font-size: 9pt;
}
.loginInfoBox {
background-color: #9CBDFF;
margin: 5px;
padding: 3px;
margin-top: 20px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
</style>
<div class="loginInfoBox">
<span class="section-head">Initially you can log into the system with the following users:
</span>
<table border="thin" cellpadding="5" cellspacing="0" style="margin-top: 10px; font-size: 8pt; background-color: transparent; border: 1px solid lightgray; border-collapse: collapse;">
<tbody><tr valign="top">
<th ><i><b>Usage</b></i>
</th><th><i><b>User</b></i>
</th><th><i><b>Password</b></i>
</th></tr>
<tr valign="top">
<td>System Management
</td><td>System
</td><td>System
</td></tr>
<tr valign="top">
<td>System Management or any role/company
</td><td>SuperUser
</td><td>System
</td></tr>
<tr valign="top">
<td>Sample Client Administration
</td><td>GardenAdmin
</td><td>GardenAdmin
</td></tr>
<tr valign="top">
<td>Sample Client User
</td><td>GardenUser
</td><td>GardenUser
</td></tr>
</tbody>
</table>
</div>
]]>
</html>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009 Low Heng Sin
Copyright (C) 2009 Idalica Corporation
-->
<?component name="vendorLogo" inline="true" macroURI="vendor-logo.zul"?>
<?component name="loginInfo" macroURI="login-info.zul"?>
<?component name="versionInfo" inline="true" macroURI="version-info.zul"?>
<?component name="loginLinks" inline="true" macroURI="login-links.zul"?>
<div>
<vendorLogo/>
<loginInfo if="${desktop.execution.serverName == &quot;www.testadempiere.com&quot; or desktop.execution.serverName == &quot;127.0.0.1&quot;}"/>
<versionInfo/>
<loginLinks/>
</div>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009 Low Heng Sin
Copyright (C) 2009 Idalica Corporation
-->
<zk>
<style>
.loginLinksBox {
padding: 0;
margin: 0;
padding-left: 3px;
font-size: 8pt;
background-color: transparent;
}
</style>
<div class="loginLinksBox" if="${desktop.execution.serverName == &quot;www.testadempiere.com&quot; or desktop.execution.serverName == &quot;127.0.0.1&quot;}"
style="position: absolute; bottom: 5px;">
<toolbarbutton href="http://www.zkoss.org" image="http://www.zkoss.org/img/zkpowered_s.png"
tooltiptext="Powered by Zk" target="_blank"
/>
<button href="http://www.mozilla.com/firefox" id="getFirefox"
image="http://sfx-images.mozilla.org/affiliates/Buttons/firefox3/110x32_get_ffx.png"
target="_blank"
/>
<button href="http://www.adempiere.org" image="images/AD32.png"
tooltiptext="ADempiere Community" style="height:32px; width:32px" target="_blank"/>
</div>
<zscript>
<![CDATA[
getFirefox.setHref("http://www.mozilla.com/?from=sfx&uid=0&t=306");
]]>
</zscript>
</zk>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009 Low Heng Sin
Copyright (C) 2009 Idalica Corporation
-->
<zk>
<div style="background-color: #E5E5E5; margin: 5px;"
if="${desktop.execution.serverName == &quot;www.testadempiere.com&quot;}">
<hbox valign="middle">
<toolbarbutton
href="http://www.idalica.com" image="http://www.testadempiere.com/images/Idalica_Logo-grey-sm.png" target="_blank"/>
<label value="ADempiere Online Demonstration - Built Nightly by Idalica"
style="font-family:Arial,sans-serif; color:#578BB8; font-size:1em; font-weight: bold;" />
</hbox>
</div>
<div style="height: 90px" if="${desktop.execution.serverName != &quot;www.testadempiere.com&quot;}">
<space/>
</div>
</zk>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009 Low Heng Sin
Copyright (C) 2009 Idalica Corporation
-->
<zk>
<zscript>
import org.compiere.Adempiere;
var mainVersion = Adempiere.MAIN_VERSION;
var dateVersion = Adempiere.DATE_VERSION;
var dbVersion = Adempiere.DB_VERSION;
var vendor = Adempiere.getImplementationVendor();
var vendorVersion = Adempiere.getImplementationVersion();
var jvm = Adempiere.getJavaInfo();
var os = Adempiere.getOSInfo();
</zscript>
<html>
<![CDATA[
<style>
.versionInfoBox {
background-color: #9CBDFF;
margin: 5px;
padding: 3px;
margin-top: 20px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
font-size: 8pt;
}
</style>
<div class="versionInfoBox">
<table border="0">
<tr>
<td align="right">Main Version</td>
<td>:</td>
<td aligh="left">${mainVersion}</td>
</tr>
<tr>
<td align="right">Date Version</td>
<td>:</td>
<td aligh="left">${dateVersion}</td>
</tr>
<tr>
<td align="right">Databse Version</td>
<td>:</td>
<td aligh="left">${dbVersion}</td>
</tr>
<tr>
<td align="right">Vendor</td>
<td>:</td>
<td aligh="left">${vendor}</td>
</tr>
<tr>
<td align="right">Vendor Version</td>
<td>:</td>
<td aligh="left">${vendorVersion}</td>
</tr>
<tr>
<td align="right">JVM</td>
<td>:</td>
<td aligh="left">${jvm}</td>
</tr>
<tr>
<td align="right">OS</td>
<td>:</td>
<td aligh="left">${os}</td>
</tr>
</table>
</div>
]]>
</html>
</zk>