IDEMPIERE-142 Upgrade web client to Zk 6.0 CE.
- Fixed remember me. - Fixed various javascript error. - Fixed dashboard - Fixed status bar for ad_window
This commit is contained in:
parent
dab623c0b4
commit
0fd55b821f
|
@ -39,7 +39,9 @@ public class TokenCommand implements AuService {
|
|||
return false;
|
||||
|
||||
Map<?, ?> map = request.getData();
|
||||
final String[] data = (String[]) map.get("");
|
||||
String sid = (String) map.get("sid");
|
||||
String hash = (String) map.get("hash");
|
||||
final String[] data = new String[] {sid, hash};
|
||||
|
||||
final Component comp = request.getComponent();
|
||||
if (comp == null)
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.Serializable;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -57,12 +59,15 @@ import org.zkoss.zk.ui.Page;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.event.MaximizeEvent;
|
||||
import org.zkoss.zk.ui.event.OpenEvent;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Anchorchildren;
|
||||
import org.zkoss.zul.Anchorlayout;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Hlayout;
|
||||
import org.zkoss.zul.North;
|
||||
import org.zkoss.zul.Style;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
import org.zkoss.zul.West;
|
||||
import org.zkoss.zul.Html;
|
||||
|
@ -102,6 +107,11 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
private int noOfWorkflow;
|
||||
|
||||
private Tabpanel homeTab;
|
||||
|
||||
private List<Panel> panelList = new ArrayList<Panel>();
|
||||
private List<Vlayout> vlayoutList = new ArrayList<Vlayout>();
|
||||
|
||||
private Anchorlayout portalLayout;
|
||||
|
||||
public DefaultDesktop()
|
||||
{
|
||||
|
@ -201,12 +211,18 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
|
||||
private void renderHomeTab()
|
||||
{
|
||||
Style style = new Style();
|
||||
//, .z-anchorchildren
|
||||
style.setContent(".z-anchorlayout-body { overflow:auto } .z-anchorchildren { overflow:visible } ");
|
||||
style.setPage(homeTab.getPage());
|
||||
|
||||
homeTab.getChildren().clear();
|
||||
|
||||
Hlayout portalLayout = new Hlayout();
|
||||
portalLayout.setWidth("100%");
|
||||
portalLayout.setHeight("100%");
|
||||
portalLayout.setStyle("position: absolute; overflow: auto");
|
||||
portalLayout = new Anchorlayout();
|
||||
portalLayout.setWidth("99%");
|
||||
portalLayout.setHeight("99%");
|
||||
portalLayout.setStyle("position: absolute;");
|
||||
portalLayout.setVflex("true");
|
||||
homeTab.appendChild(portalLayout);
|
||||
|
||||
// Dashboard content
|
||||
|
@ -226,17 +242,23 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
if(portalchildren == null || currentColumnNo != columnNo)
|
||||
{
|
||||
portalchildren = new Vlayout();
|
||||
portalLayout.appendChild(portalchildren);
|
||||
portalchildren.setWidth(width + "%");
|
||||
portalchildren.setStyle("padding: 5px");
|
||||
vlayoutList.add(portalchildren);
|
||||
Anchorchildren anchorChildren = new Anchorchildren();
|
||||
anchorChildren.setAnchor((width-2) + "%" + " 100%");
|
||||
anchorChildren.appendChild(portalchildren);
|
||||
portalLayout.appendChild(anchorChildren);
|
||||
portalchildren.setWidth("100%");
|
||||
|
||||
currentColumnNo = columnNo;
|
||||
}
|
||||
|
||||
Panel panel = new Panel();
|
||||
panel.setStyle("margin-bottom:10px");
|
||||
panelList.add(panel);
|
||||
panel.addEventListener(Events.ON_MAXIMIZE, this);
|
||||
panel.setStyle("margin: 2px; position: relative;");
|
||||
panel.setTitle(dp.get_Translation(MDashboardContent.COLUMNNAME_Name));
|
||||
|
||||
panel.setMaximizable(true);
|
||||
|
||||
String description = dp.get_Translation(MDashboardContent.COLUMNNAME_Description);
|
||||
if(description != null)
|
||||
panel.setTooltiptext(description);
|
||||
|
@ -395,6 +417,51 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(event instanceof MaximizeEvent) {
|
||||
MaximizeEvent me = (MaximizeEvent) event;
|
||||
Panel panel = (Panel) event.getTarget();
|
||||
if (((MaximizeEvent) event).isMaximized()) {
|
||||
for (Panel p : panelList) {
|
||||
if (p == panel) {
|
||||
continue;
|
||||
}
|
||||
p.setVisible(false);
|
||||
Anchorchildren layout = (Anchorchildren) p.getParent().getParent();
|
||||
if (layout == panel.getParent().getParent()) {
|
||||
if (!layout.getAnchor().equals("100% 100%")) {
|
||||
layout.setAttribute("anchor.original", layout.getAnchor());
|
||||
layout.setAnchor("100% 100%");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (layout.isVisible()) {
|
||||
layout.setVisible(false);
|
||||
}
|
||||
}
|
||||
panel.getParent().getParent().getParent().invalidate();
|
||||
} else {
|
||||
for (Panel p : panelList) {
|
||||
if (!p.isVisible()) {
|
||||
p.setVisible(true);
|
||||
}
|
||||
Anchorchildren layout = (Anchorchildren) p.getParent().getParent();
|
||||
if (!layout.isVisible()) {
|
||||
layout.setVisible(true);
|
||||
}
|
||||
if (layout.getAnchor().equals("100% 100%")) {
|
||||
layout.setAnchor((String) layout.getAttribute("anchor.original"));
|
||||
}
|
||||
}
|
||||
}
|
||||
// String uid = portalLayout.getUuid();
|
||||
// String script = "zk.Widget.$('"+uid+"').rerender();";
|
||||
// AuScript auScript = new AuScript(portalLayout, script);
|
||||
// Clients.response("reRenderHomeTabLayout", auScript);
|
||||
for (Panel p : panelList) {
|
||||
Clients.resize(p);
|
||||
}
|
||||
// Clients.resize(portalLayout);
|
||||
}
|
||||
}
|
||||
|
||||
public void onServerPush(ServerPushTemplate template)
|
||||
|
@ -454,13 +521,9 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
private void autoHideMenu() {
|
||||
if (layout.getWest().isCollapsible() && !layout.getWest().isOpen())
|
||||
{
|
||||
//using undocumented js api, need to be retested after every version upgrade
|
||||
String id = layout.getWest().getUuid() + "!real";
|
||||
String btn = layout.getWest().getUuid() + "!btn";
|
||||
String script = "zk.show('" + id + "', false);";
|
||||
script += "$e('"+id+"')._isSlide = false;";
|
||||
script += "$e('"+id+"')._lastSize = null;";
|
||||
script += "$e('"+btn+"').style.display = '';";
|
||||
String id = layout.getWest().getUuid();
|
||||
//$n('colled') is not documented api so this might break in release after 6.0.0
|
||||
String script = "jq(zk.Widget.$('"+id+"').$n('colled')).click();";
|
||||
AuScript aus = new AuScript(layout.getWest(), script);
|
||||
Clients.response("autoHideWest", aus);
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ import org.zkoss.zul.Image;
|
|||
*/
|
||||
public class LoginPanel extends Window implements EventListener
|
||||
{
|
||||
private static final String ON_LOAD_TOKEN = "onLoadToken";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -117,10 +118,11 @@ public class LoginPanel extends Window implements EventListener
|
|||
init();
|
||||
this.setId("loginPanel");
|
||||
|
||||
AuFocus auf = new AuFocus(txtUserId);
|
||||
Clients.response(auf);
|
||||
|
||||
BrowserToken.load(this.getUuid());
|
||||
txtUserId.setEnabled(false);
|
||||
txtPassword.setEnabled(false);
|
||||
lstLanguage.setEnabled(false);
|
||||
Events.echoEvent(ON_LOAD_TOKEN, this, null);
|
||||
this.addEventListener(ON_LOAD_TOKEN, this);
|
||||
}
|
||||
|
||||
private void init()
|
||||
|
@ -210,7 +212,7 @@ public class LoginPanel extends Window implements EventListener
|
|||
div.appendChild(pnlButtons);
|
||||
this.appendChild(div);
|
||||
|
||||
this.addEventListener(TokenEvent.ON_USER_TOKEN, new EventListener() {
|
||||
txtUserId.addEventListener(TokenEvent.ON_USER_TOKEN, new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
|
@ -325,7 +327,7 @@ public class LoginPanel extends Window implements EventListener
|
|||
{
|
||||
validateLogin();
|
||||
}
|
||||
if (event.getName().equals(Events.ON_SELECT))
|
||||
else if (event.getName().equals(Events.ON_SELECT))
|
||||
{
|
||||
if(eventComp.getId().equals(lstLanguage.getId())) {
|
||||
String langName = (String) lstLanguage.getSelectedItem().getLabel();
|
||||
|
@ -333,12 +335,23 @@ public class LoginPanel extends Window implements EventListener
|
|||
}
|
||||
}
|
||||
// Elaine 2009/02/06 - initial language
|
||||
if (event.getName().equals(Events.ON_CHANGE))
|
||||
else if (event.getName().equals(Events.ON_CHANGE))
|
||||
{
|
||||
if(eventComp.getId().equals(txtUserId.getId()))
|
||||
{
|
||||
onUserIdChange();
|
||||
}
|
||||
}
|
||||
else if (event.getName().equals(ON_LOAD_TOKEN))
|
||||
{
|
||||
BrowserToken.load(txtUserId);
|
||||
|
||||
txtUserId.setEnabled(true);
|
||||
txtPassword.setEnabled(true);
|
||||
lstLanguage.setEnabled(true);
|
||||
|
||||
AuFocus auf = new AuFocus(txtUserId);
|
||||
Clients.response(auf);
|
||||
}
|
||||
//
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
|||
showPopup();
|
||||
|
||||
//auto hide
|
||||
String script = "setTimeout('$e(\"" + popup.getUuid() + "\").style.display = \"none\"',";
|
||||
String script = "setTimeout('zk.Widget.$(\"" + popup.getUuid() + "\").$n().style.display = \"none\"',";
|
||||
if (error)
|
||||
script += "3500";
|
||||
else
|
||||
|
@ -259,14 +259,14 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
|||
popup.setVisible(true);
|
||||
popup.setStyle(popupStyle);
|
||||
|
||||
String script = "var d = $e('" + popup.getUuid() + "');";
|
||||
String script = "var d = zk.Widget.$('" + popup.getUuid() + "').$n();";
|
||||
script += "d.style.display='block';d.style.visibility='hidden';";
|
||||
script += "var dhs = document.defaultView.getComputedStyle(d, null).getPropertyValue('height');";
|
||||
script += "var dh = parseInt(dhs, 10);";
|
||||
script += "var r = $e('" + getRoot().getUuid() + "');";
|
||||
script += "var r = zk.Widget.$('" + getRoot().getUuid() + "').$n();";
|
||||
script += "var rhs = document.defaultView.getComputedStyle(r, null).getPropertyValue('height');";
|
||||
script += "var rh = parseInt(rhs, 10);";
|
||||
script += "var p = Position.cumulativeOffset(r);";
|
||||
script += "var p = jq('#"+getRoot().getUuid()+"').zk.cmOffset();";
|
||||
script += "d.style.top=(rh-dh-5)+'px';";
|
||||
script += "d.style.left=(p[0]+1)+'px';";
|
||||
script += "d.style.visibility='visible';";
|
||||
|
|
|
@ -159,8 +159,8 @@ public class WAttachment extends Window implements EventListener
|
|||
AEnv.showWindow(this);
|
||||
if (autoPreview(0, true))
|
||||
{
|
||||
String script = "setTimeout(\"$e('"+ preview.getUuid() + "').src = $e('" +
|
||||
preview.getUuid() + "').src\", 1000)";
|
||||
String script = "setTimeout(\"zk.Widget.$('"+ preview.getUuid() + "').$n().src = zk.Widget.$('" +
|
||||
preview.getUuid() + "').$n().src\", 1000)";
|
||||
Clients.response(new AuScript(null, script));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.compiere.model.MSystem;
|
|||
import org.compiere.model.MUser;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.zkoss.zk.au.out.AuScript;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
|
||||
/**
|
||||
|
@ -78,13 +79,13 @@ public final class BrowserToken {
|
|||
* load stored client side token for auto login
|
||||
* @param cmpid
|
||||
*/
|
||||
public static void load(String cmpid) {
|
||||
public static void load(Component component) {
|
||||
//remember me
|
||||
try
|
||||
{
|
||||
String home = getHomeToken();
|
||||
String script = "adempiere.findUserToken('" + cmpid + "', '" + home + "');";
|
||||
AuScript aus = new AuScript(null, script);
|
||||
String script = "adempiere.findUserToken('" + component.getUuid() + "', '" + home + "');";
|
||||
AuScript aus = new AuScript(component, script);
|
||||
Clients.response("findUserToken", aus);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -58,7 +58,7 @@ public final class UserPreference implements Serializable {
|
|||
|
||||
/** window tab placement **/
|
||||
public static final String P_WINDOW_TAB_PLACEMENT = "WindowTabPlacement";
|
||||
public static final String DEFAULT_WINDOW_TAB_PLACEMENT = "Left";
|
||||
public static final String DEFAULT_WINDOW_TAB_PLACEMENT = "Right";
|
||||
|
||||
/** window tab collapsible **/
|
||||
public static final String P_WINDOW_TAB_COLLAPSIBLE = "WindowTabCollapsible";
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
function ad_deferRenderBorderLayout(uuid, timeout) {
|
||||
var meta = zkau.getMeta($e(uuid));
|
||||
var meta = zk.Widget.$(uuid);
|
||||
if (meta) {
|
||||
setTimeout("_ad_deferBDL('"+uuid+"')", timeout);
|
||||
}
|
||||
}
|
||||
|
||||
function _ad_deferBDL(uuid) {
|
||||
zk.beforeSizeAt();
|
||||
zk.onSizeAt();
|
||||
zkau.getMeta($e(uuid)).render();
|
||||
zk.Widget.$(uuid).resize();
|
||||
}
|
||||
|
||||
function ad_closeBuble(uuid) {
|
||||
var cmp = $e(uuid);
|
||||
for(i=0;i<cmp.bandInfos.length;i++){
|
||||
var cmp = zk.Widget.$(uuid);
|
||||
for(var i=0;i<cmp.bandInfos.length;i++){
|
||||
cmp.instance.getBand(i).closeBubble();
|
||||
}
|
||||
}
|
||||
|
||||
function scrollToRow(uuid){
|
||||
var cmp = $e(uuid);
|
||||
cmp.style.display="inline";
|
||||
var cmp = zk.Widget.$(uuid);
|
||||
cmp.$n().style.display='inline';
|
||||
cmp.focus();
|
||||
cmp.style.display="none";
|
||||
cmp.$n().style.display='none';
|
||||
}
|
||||
|
|
@ -1,13 +1,19 @@
|
|||
function zoom(cmpid, column, value){
|
||||
zkau.send({uuid: cmpid, cmd: 'onZoom', data: [column, value], ctl: true});
|
||||
var widget = zk.Widget.$(cmpid);
|
||||
var event = new zk.Event({target: widget, name: 'onZoom', data: [column, value], opts: {ctl: true}});
|
||||
zAu.send(event);
|
||||
}
|
||||
|
||||
function drillAcross(cmpid, column, value){
|
||||
zkau.send({uuid: cmpid, cmd: 'onDrillAcross', data: [column, value], ctl: true});
|
||||
var widget = zk.Widget.$(cmpid);
|
||||
var event = new zk.Event({target: widget, name: 'onDrillAcross', data: [column, value], opts: {ctl: true}});
|
||||
zAu.send(event);
|
||||
}
|
||||
|
||||
function drillDown(cmpid, column, value){
|
||||
zkau.send({uuid: cmpid, cmd: 'onDrillDown', data: [column, value], ctl: true});
|
||||
var widget = zk.Widget.$(cmpid);
|
||||
var event = new zk.Event({target: widget, name: 'onDrillDown', data: [column, value], opts: {ctl: true}});
|
||||
zAu.send(event);
|
||||
}
|
||||
|
||||
function showColumnMenu(e, columnName, row) {
|
||||
|
|
|
@ -19,7 +19,7 @@ adempiere.saveUserToken = function (key, hash, sessionId)
|
|||
adempiere.store.set(key+".sid", sessionId);
|
||||
adempiere.store.o.expires = 365;
|
||||
adempiere.store.set(key+".hash", hash);
|
||||
}
|
||||
};
|
||||
|
||||
adempiere.findUserToken = function (cmpid, key)
|
||||
{
|
||||
|
@ -29,7 +29,9 @@ adempiere.findUserToken = function (cmpid, key)
|
|||
if (ok && !!val && !!sid)
|
||||
{
|
||||
var hash = val;
|
||||
zkau.send({uuid: cmpid, cmd: 'onUserToken', data: [sid, hash], ctl: true});
|
||||
var widget = zk.Widget.$(cmpid);
|
||||
var event = new zk.Event(widget, 'onUserToken', {sid: sid, hash: hash}, {toServer: true});
|
||||
zAu.send(event);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -42,7 +44,7 @@ adempiere.findUserToken = function (cmpid, key)
|
|||
};
|
||||
|
||||
adempiere.store.get(key+".sid", fhash);
|
||||
}
|
||||
};
|
||||
|
||||
adempiere.removeUserToken = function (key)
|
||||
{
|
||||
|
@ -50,4 +52,4 @@ adempiere.removeUserToken = function (key)
|
|||
adempiere.store.set(key+".sid", "");
|
||||
adempiere.store.o.expires = -365;
|
||||
adempiere.store.set(key+".hash", "");
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue