- added ZK_LOGO_LARGE and ZK_LOGO_SMALL ( deprecated WEBUI_LOGOURL )
- added ZK_BROWSER_TITLE
This commit is contained in:
Heng Sin Low 2009-05-07 10:05:59 +00:00
parent a619628e8d
commit b362b9a8f1
4 changed files with 87 additions and 79 deletions

View File

@ -44,20 +44,22 @@ public class HeaderPanel extends Panel implements EventListener
private static final long serialVersionUID = -4293371180738797244L;
private Image image = new Image();
public HeaderPanel()
{
super();
init();
}
private void init()
{
LayoutUtils.addSclass("header", this);
UserPanel userPanel = new UserPanel();
String logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png");
UserPanel userPanel = new UserPanel();
String logoURL = MSysConfig.getValue("ZK_LOGO_SMALL", null);
if (logoURL == null || logoURL.trim().length() == 0)
logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png");
image.setSrc(logoURL);
image.addEventListener(Events.ON_CLICK, this);
image.setStyle("cursor: pointer;");
@ -67,20 +69,20 @@ public class HeaderPanel extends Panel implements EventListener
layout.setParent(this);
West west = new West();
west.setParent(layout);
Vbox vb = new Vbox();
vb.setParent(west);
vb.setHeight("100%");
// vb.setWidth("100%"); // Elaine 2008/11/19 the role and logout links don't work if width is set to 100%
// vb.setWidth("100%"); // Elaine 2008/11/19 the role and logout links don't work if width is set to 100%
vb.setPack("center");
vb.setAlign("left");
image.setParent(vb);
LayoutUtils.addSclass("header-left", west);
//the following doesn't work when declare as part of the header-left style
west.setStyle("background-color: transparent; border: none;");
// Elaine 2009/03/02
Center center = new Center();
center.setParent(layout);
@ -92,7 +94,7 @@ public class HeaderPanel extends Panel implements EventListener
LayoutUtils.addSclass("header-right", center);
//the following doesn't work when declare as part of the header-right style
center.setStyle("background-color: transparent; border: none;");
// East east = new East();
// east.setParent(layout);
// userPanel.setParent(east);
@ -109,10 +111,10 @@ public class HeaderPanel extends Panel implements EventListener
if(event.getTarget() == image)
{
AboutWindow w = new AboutWindow();
w.setPage(this.getPage());
w.setPage(this.getPage());
w.doModal();
}
}
}
}

View File

@ -31,6 +31,7 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.util.UserPreference;
import org.adempiere.webui.window.LoginWindow;
import org.compiere.model.MSysConfig;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
@ -59,7 +60,7 @@ import org.zkoss.zul.Listitem;
public class LoginPanel extends Window implements EventListener
{
/**
*
*
*/
private static final long serialVersionUID = -5823771596520748214L;
private static final String RESOURCE = "org.compiere.apps.ALoginRes";
@ -97,7 +98,7 @@ public class LoginPanel extends Window implements EventListener
Row logo = new Row();
logo.setSpans("2");
Image image = new Image();
image.setSrc("images/logo.png");
image.setSrc(MSysConfig.getValue("ZK_LOGO_LARGE", "images/logo.png"));
logo.appendChild(image);
Row rowUser = new Row();
rowUser.setId("rowUser");

View File

@ -29,6 +29,7 @@ import org.adempiere.webui.util.UserPreference;
import org.adempiere.webui.window.LoginWindow;
import org.compiere.db.CConnection;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Language;
@ -58,7 +59,7 @@ import org.zkoss.zul.Rows;
public class RolePanel extends Window implements EventListener
{
/**
*
*
*/
private static final long serialVersionUID = 2808473294679524383L;
@ -81,14 +82,14 @@ public class RolePanel extends Window implements EventListener
rolesKNPairs = login.getRoles(userName, password);
if(rolesKNPairs == null)
throw new ApplicationException("Login is invalid, UserName: " + userName + " and Password:" + password);
//set app server credentials
CConnection.get().setAppServerCredential(userName, password);
initComponents();
init();
this.setId("rolePanel");
AuFocus auf = new AuFocus(lstRole);
Clients.response(auf);
}
@ -99,13 +100,13 @@ public class RolePanel extends Window implements EventListener
grid.setId("grdChooseRole");
grid.setOddRowSclass("even");
Rows rows = new Rows();
Row logo = new Row();
logo.setSpans("2");
Image image = new Image();
image.setSrc("images/logo.png");
image.setSrc(MSysConfig.getValue("ZK_LOGO_LARGE", "images/logo.png"));
logo.appendChild(image);
Row rowRole = new Row();
Row rowClient = new Row();
Row rowOrg = new Row();
@ -147,9 +148,9 @@ public class RolePanel extends Window implements EventListener
private void initComponents()
{
Language language = Env.getLanguage(Env.getCtx());
ResourceBundle res = ResourceBundle.getBundle(RESOURCE, language.getLocale());
lblErrorMsg = new Label();
lblErrorMsg.setValue(" ");
@ -245,7 +246,7 @@ public class RolePanel extends Window implements EventListener
lstClient.setSelectedIndex(0);
}
//
//force reload of default role
MRole.getDefault(Env.getCtx(), true);
}
@ -370,7 +371,7 @@ public class RolePanel extends Window implements EventListener
lblErrorMsg.setValue("Error for user login: " + msg);
return;
}
msg = login.loadPreferences(orgKNPair, warehouseKNPair, null, null);
if(!(msg == null || msg.length() == 0))
{
@ -378,7 +379,7 @@ public class RolePanel extends Window implements EventListener
return ;
}
wndLogin.loginCompleted();
// Elaine 2009/02/06 save preference to AD_Preference
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
userPreference.setProperty(UserPreference.P_LANGUAGE, Env.getContext(Env.getCtx(), UserPreference.LANGUAGE_NAME));

View File

@ -30,6 +30,7 @@ import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.compiere.Adempiere;
import org.compiere.model.MSysConfig;
import org.compiere.model.MUser;
import org.compiere.util.CLogErrorBuffer;
import org.compiere.util.CLogMgt;
@ -50,14 +51,14 @@ import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/**
*
*
* @author Low Heng Sin
*
*/
public class AboutWindow extends Window implements EventListener {
/**
*
*
*/
private static final long serialVersionUID = -257313771447940626L;
private Checkbox bErrorsOnly;
@ -76,16 +77,16 @@ public class AboutWindow extends Window implements EventListener {
this.setWidth("500px");
this.setHeight("450px");
this.setPosition("center");
this.setTitle("ADempiere Zk Web Client");
this.setTitle(MSysConfig.getValue("ZK_BROWSER_TITLE", "Adempiere"));
this.setClosable(true);
this.setSizable(true);
this.addEventListener(Events.ON_SIZE, this);
Vbox layout = new Vbox();
layout.setWidth("100%");
layout.setParent(this);
tabbox = new Tabbox();
tabbox.setParent(layout);
tabbox.setWidth("480px");
@ -96,35 +97,35 @@ public class AboutWindow extends Window implements EventListener {
tabPanels = new Tabpanels();
tabPanels.setParent(tabbox);
tabPanels.setWidth("480px");
//about
Tab tab = new Tab();
tab.setLabel("About");
tab.setParent(tabs);
Tabpanel tabPanel = createAbout();
tabPanel.setParent(tabPanels);
//Credit
tab = new Tab();
tab.setLabel("Credit");
tab.setParent(tabs);
tabPanel = createCredit();
tabPanel.setParent(tabPanels);
//Info
//Info
tab = new Tab();
tab.setLabel("Info");
tab.setParent(tabs);
tabPanel = createInfo();
tabPanel.setParent(tabPanels);
//Trace
tab = new Tab();
tab.setLabel("Logs");
tab.setParent(tabs);
tabPanel = createTrace();
tabPanel.setParent(tabPanels);
Hbox hbox = new Hbox();
hbox.setParent(layout);
hbox.setPack("end");
@ -133,7 +134,7 @@ public class AboutWindow extends Window implements EventListener {
btnOk.setImage("/images/Ok24.png");
btnOk.addEventListener(Events.ON_CLICK, this);
btnOk.setParent(hbox);
this.setBorder("normal");
}
@ -143,7 +144,7 @@ public class AboutWindow extends Window implements EventListener {
vbox.setParent(tabPanel);
vbox.setWidth("100%");
vbox.setHeight("100%");
Hbox hbox = new Hbox();
bErrorsOnly = new Checkbox();
bErrorsOnly.setLabel(Msg.getMsg(Env.getCtx(), "ErrorsOnly"));
@ -158,9 +159,9 @@ public class AboutWindow extends Window implements EventListener {
btnErrorEmail.addEventListener(Events.ON_CLICK, this);
hbox.appendChild(btnErrorEmail);
vbox.appendChild(hbox);
Vector<String> columnNames = CLogErrorBuffer.get(true).getColumnNames(Env.getCtx());
logTable = new Listbox();
ListHead listHead = new ListHead();
listHead.setParent(logTable);
@ -170,14 +171,14 @@ public class AboutWindow extends Window implements EventListener {
header.setWidth("100px");
listHead.appendChild(header);
}
vbox.appendChild(logTable);
logTable.setWidth("480px");
logTable.setHeight("310px");
logTable.setVflex(false);
updateLogTable();
return tabPanel;
}
@ -186,7 +187,7 @@ public class AboutWindow extends Window implements EventListener {
SimpleListModel model = new SimpleListModel(data);
model.setMaxLength(new int[]{0, 0, 0, 200, 0, 200});
logTable.setItemRenderer(model);
logTable.setModel(model);
logTable.setModel(model);
}
private Tabpanel createInfo() {
@ -199,13 +200,13 @@ public class AboutWindow extends Window implements EventListener {
pre.setParent(div);
Text text = new Text(CLogMgt.getInfo(null).toString());
text.setParent(pre);
return tabPanel;
}
private Tabpanel createCredit() {
Tabpanel tabPanel = new Tabpanel();
Vbox vbox = new Vbox();
Vbox vbox = new Vbox();
vbox.setParent(tabPanel);
vbox.setWidth("100%");
Hbox hbox = new Hbox();
@ -217,10 +218,10 @@ public class AboutWindow extends Window implements EventListener {
link.setTarget("_blank");
Label label= new Label("Contributed the initial Zk Web Client code.");
label.setParent(hbox);
Separator separator = new Separator();
separator.setParent(vbox);
Div div = new Div();
div.setParent(vbox);
div.setWidth("100%");
@ -243,10 +244,10 @@ public class AboutWindow extends Window implements EventListener {
link.setHref("http://www.idalica.com/");
link.setTarget("_blank");
link.setParent(content);
separator = new Separator();
separator.setParent(vbox);
div = new Div();
div.setParent(vbox);
div.setWidth("100%");
@ -259,7 +260,7 @@ public class AboutWindow extends Window implements EventListener {
content = new Vbox();
content.setWidth("100%");
content.setParent(div);
link = new ToolBarButton();
link = new ToolBarButton();
link.setLabel("Ashley G Ramdass");
link.setHref("http://www.adempiere.com/wiki/index.php/User:Agramdass");
link.setTarget("_blank");
@ -275,7 +276,7 @@ public class AboutWindow extends Window implements EventListener {
link.setLabel("Carlos Ruiz");
link.setHref("http://www.adempiere.com/wiki/index.php/User:CarlosRuiz");
link.setTarget("_blank");
link.setParent(content);
link.setParent(content);
link = new ToolBarButton();
link.setLabel("Teo Sarca");
@ -288,32 +289,35 @@ public class AboutWindow extends Window implements EventListener {
link.setHref("http://www.adempiere.com/wiki/index.php/User:Trifonnt");
link.setTarget("_blank");
link.setParent(content);
return tabPanel;
}
private Tabpanel createAbout() {
Tabpanel tabPanel = new Tabpanel();
Tabpanel tabPanel = new Tabpanel();
Vbox vbox = new Vbox();
vbox.setWidth("100%");
vbox.setHeight("100%");
vbox.setAlign("center");
vbox.setPack("center");
vbox.setParent(tabPanel);
Image image = new Image("images/AD10030.png");
String logoURL = MSysConfig.getValue("ZK_LOGO_SMALL", null);
if (logoURL == null || logoURL.trim().length() == 0)
logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png");
Image image = new Image(logoURL);
image.setParent(vbox);
Text text = new Text(Adempiere.getSubtitle());
text.setParent(vbox);
Separator separator = new Separator();
separator.setParent(vbox);
text = new Text(Adempiere.MAIN_VERSION + "<br>");
text.setParent(vbox);
text = new Text(Adempiere.DB_VERSION +"<br>");
text.setParent(vbox);
separator = new Separator();
separator.setParent(vbox);
ToolBarButton link = new ToolBarButton();
@ -321,7 +325,7 @@ public class AboutWindow extends Window implements EventListener {
link.setHref("http://www.sourceforge.net/projects/adempiere");
link.setTarget("_blank");
link.setParent(vbox);
separator = new Separator();
separator.setParent(vbox);
link = new ToolBarButton();
@ -329,7 +333,7 @@ public class AboutWindow extends Window implements EventListener {
link.setHref("http://www.adempiere.com/wiki/index.php");
link.setTarget("_blank");
link.setParent(vbox);
separator = new Separator();
separator.setParent(vbox);
link = new ToolBarButton();
@ -337,7 +341,7 @@ public class AboutWindow extends Window implements EventListener {
link.setHref("http://www.adempiere.org");
link.setTarget("_blank");
link.setParent(vbox);
separator = new Separator();
separator.setParent(vbox);
link = new ToolBarButton();
@ -345,14 +349,14 @@ public class AboutWindow extends Window implements EventListener {
link.setHref("http://www.adempiere.com");
link.setTarget("_blank");
link.setParent(vbox);
return tabPanel;
}
public void onEvent(Event event) throws Exception {
if (event.getTarget() == bErrorsOnly) {
this.updateLogTable();
}
}
else if (event.getTarget() == btnDownload)
downloadLog();
else if (event.getTarget() == btnErrorEmail)
@ -366,34 +370,34 @@ public class AboutWindow extends Window implements EventListener {
private void doResize(SizeEvent event) {
int width = Integer.parseInt(event.getWidth().substring(0, event.getWidth().length() - 2));
int height = Integer.parseInt(event.getHeight().substring(0, event.getHeight().length() - 2));
tabbox.setWidth((width - 20) + "px");
tabbox.setHeight((height - 70) + "px");
tabPanels.setWidth((width - 20) + "px");
logTable.setHeight((height - 140) + "px");
logTable.setWidth((width - 30) + "px");
}
private void downloadLog() {
String log = CLogErrorBuffer.get(true).getErrorInfo(Env.getCtx(), bErrorsOnly.isChecked());
AMedia media = new AMedia("trace.log", null, "text/plain", log.getBytes());
Filedownload.save(media);
}
/**
* EMail Errors
*/
private void cmd_errorEMail()
{
new WEMailDialog(this,
"EMail Trace",
MUser.get(Env.getCtx()),
"", // to
"Adempiere Trace Info",
CLogErrorBuffer.get(true).getErrorInfo(Env.getCtx(), bErrorsOnly.isSelected()),
new WEMailDialog(this,
"EMail Trace",
MUser.get(Env.getCtx()),
"", // to
"Adempiere Trace Info",
CLogErrorBuffer.get(true).getErrorInfo(Env.getCtx(), bErrorsOnly.isSelected()),
null);
} // cmd_errorEMail
}