diff --git a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml index 0d5c62ea7b..7c58770368 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml +++ b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml @@ -48,7 +48,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI). - + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java index d79fa2cfe0..6778c507f3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java @@ -401,13 +401,14 @@ public final class LayoutUtils { public static ISupportMask findMaskParent (Component child, Class parentClass){ Component parent = child; ISupportMask trueParent = null; - while ((parent = parent.getParent()) != null){ + while (parent != null) { if (ISupportMask.class.isInstance(parent)){ if (parentClass == null || parentClass.isInstance(parent)){ trueParent = (ISupportMask)parent; break; } } + parent = parent.getParent(); } return trueParent; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DrillCommand.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DrillCommand.java index 8fbae5cfbb..6bad2d29e5 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DrillCommand.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/DrillCommand.java @@ -64,7 +64,7 @@ public class DrillCommand implements AuService { MQuery query = new MQuery(tableName); query.addRestriction(columnName, MQuery.EQUAL, code); - Events.postEvent(new DrillEvent(request.getCommand(), comp, new DrillEvent.DrillData(query, columnName, code, displayValue, null ))); + Events.postEvent(new DrillEvent(request.getCommand(), comp, new DrillEvent.DrillData(query, columnName, code, displayValue, data ))); return true; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java index 9196614f27..7013dff455 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java @@ -47,6 +47,8 @@ import org.adempiere.webui.apps.graph.model.ChartModel; import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.dashboard.DashboardPanel; import org.adempiere.webui.dashboard.DashboardRunnable; +import org.adempiere.webui.event.DrillEvent; +import org.adempiere.webui.event.DrillEvent.DrillData; import org.adempiere.webui.report.HTMLExtension; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.theme.ThemeManager; @@ -82,6 +84,7 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; +import org.zkoss.json.JSONArray; import org.zkoss.util.media.AMedia; import org.zkoss.zhtml.Text; import org.zkoss.zk.ui.Component; @@ -95,6 +98,7 @@ 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.util.Clients; import org.zkoss.zul.A; import org.zkoss.zul.Anchorchildren; import org.zkoss.zul.Anchorlayout; @@ -170,6 +174,7 @@ public class DashboardController implements EventListener { * @param isShowInDashboard */ public void render(Component parent, IDesktop desktopImpl, boolean isShowInDashboard) { + String layoutOrientation = MSysConfig.getValue(MSysConfig.DASHBOARD_LAYOUT_ORIENTATION, Env.getAD_Client_ID(Env.getCtx())); if(layoutOrientation.equals(DASHBOARD_LAYOUT_ROWS) && isShowInDashboard) renderRows(parent, desktopImpl, isShowInDashboard, false); @@ -772,6 +777,7 @@ public class DashboardController implements EventListener { if (dashboardContent.isEmbedReportContent()) { + addDrillAcrossEventListener(AD_Process_ID, appDesktop); String processParameters = dashboardContent.getProcessParameters(); Div layout = new Div(); @@ -961,6 +967,30 @@ public class DashboardController implements EventListener { return !empty; } + /** + * Add Drill Across Event Listener to Border Layout + * @param processID + */ + private void addDrillAcrossEventListener(int processID, IDesktop appDesktop) { + appDesktop.getComponent().addEventListener(DrillEvent.ON_DRILL_ACROSS, new EventListener() { + public void onEvent(Event event) throws Exception { + if (event instanceof DrillEvent) { + Clients.clearBusy(); + DrillEvent de = (DrillEvent) event; + if (de.getData() != null && de.getData() instanceof DrillData) { + DrillData data = (DrillData) de.getData(); + if(data.getData() instanceof JSONArray) { + JSONArray jsonData = (JSONArray) data.getData(); + if(jsonData.indexOf(String.valueOf(processID)) < 0) + return; + } + AEnv.actionDrill(data, 0, processID); // WindowNo of Home tab is always 0 + } + } + } + }); + } + @Override public void onEvent(Event event) throws Exception { Component comp = event.getTarget(); @@ -1461,7 +1491,7 @@ public class DashboardController implements EventListener { File file = FileUtil.createTempFile(re.getName(), ".html"); re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(contextPath, "rp", - appDesktop.getComponent().getUuid())); + appDesktop.getComponent().getUuid(), String.valueOf(AD_Process_ID))); return new AMedia(re.getName(), "html", "text/html", file, false); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/DrillEvent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/DrillEvent.java index 75c2117552..cb98cf7600 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/DrillEvent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/DrillEvent.java @@ -45,6 +45,9 @@ public class DrillEvent extends Event { private Object value; + /** + * [columnName, displayValue, value, processID - source] + */ private Object data; public DrillData(MQuery query, String columnName, Object value, String displayValue, Object data) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java index 587ce28d1e..4412235d7c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java @@ -44,6 +44,7 @@ public class HTMLExtension implements IHTMLExtension { private String scriptURL; private String styleURL; private String contextPath; + private String processID; /** * @param contextPath @@ -51,6 +52,15 @@ public class HTMLExtension implements IHTMLExtension { * @param componentId */ public HTMLExtension(String contextPath, String classPrefix, String componentId) { + this(contextPath, classPrefix, componentId, ""); + } + + /** + * @param contextPath + * @param classPrefix + * @param componentId + */ + public HTMLExtension(String contextPath, String classPrefix, String componentId, String processID) { String theme = MSysConfig.getValue(MSysConfig.HTML_REPORT_THEME, "/", Env.getAD_Client_ID(Env.getCtx())); @@ -69,6 +79,7 @@ public class HTMLExtension implements IHTMLExtension { this.styleURL = contextPath + theme + "css/report.css"; } this.contextPath = contextPath; + this.processID = processID; } @Override @@ -84,7 +95,7 @@ public class HTMLExtension implements IHTMLExtension { @Override public void extendIDColumn(int row, ConcreteElement columnElement, a href, PrintDataElement dataElement) { - href.addAttribute("onclick", "parent.idempiere.showColumnMenu(document, event, '" + dataElement.getColumnName() + "', " + row + ", " + ThemeManager.isUseFontIconForImage() + ")"); + href.addAttribute("onclick", "parent.idempiere.showColumnMenu(document, event, '" + dataElement.getColumnName() + "', " + row + ", " + ThemeManager.isUseFontIconForImage() + ", " + processID + ")"); href.addAttribute ("componentId", componentId); href.addAttribute ("foreignColumnName", dataElement.getForeignColumnName()); href.addAttribute ("value", dataElement.getValueAsString()); diff --git a/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js b/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js index 70cf6a516d..165a264449 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js +++ b/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js @@ -15,10 +15,10 @@ window.idempiere.zoomWindow = function(cmpid, column, value, windowuu){ zAu.send(event); }; -window.idempiere.drillAcross = function(cmpid, column, value, displayValue){ +window.idempiere.drillAcross = function(cmpid, column, value, displayValue, processID){ zAu.cmd0.showBusy(null); let widget = zk.Widget.$(cmpid); - let event = new zk.Event(widget, 'onDrillAcross', {data: [column, value, displayValue]}, {toServer: true}); + let event = new zk.Event(widget, 'onDrillAcross', {data: [column, value, displayValue, processID]}, {toServer: true}); zAu.send(event); }; @@ -29,8 +29,8 @@ window.idempiere.drillDown = function(cmpid, column, value){ zAu.send(event); }; -window.idempiere.showColumnMenu = function(doc, e, columnName, row, isUseFontIcons) { - let d = idempiere.getMenu (doc, e.target.getAttribute ("componentId"), e.target.getAttribute ("foreignColumnName"), e.target.getAttribute ("value"), e.target.getAttribute ("displayValue"), isUseFontIcons); +window.idempiere.showColumnMenu = function(doc, e, columnName, row, isUseFontIcons, processID) { + let d = idempiere.getMenu (doc, e.target.getAttribute ("componentId"), e.target.getAttribute ("foreignColumnName"), e.target.getAttribute ("value"), e.target.getAttribute ("displayValue"), isUseFontIcons, processID); let posx = 0; let posy = 0; @@ -56,7 +56,7 @@ window.idempiere.showColumnMenu = function(doc, e, columnName, row, isUseFontIco setTimeout(f, 3000); }; -window.idempiere.getMenu = function(doc, componentId, foreignColumnName, value, displayValue, isUseFontIcons){ +window.idempiere.getMenu = function(doc, componentId, foreignColumnName, value, displayValue, isUseFontIcons, processID){ doc.contextMenu = null; if (componentId != null){ //menu div @@ -157,7 +157,8 @@ window.idempiere.getMenu = function(doc, componentId, foreignColumnName, value, reportDrillHref.style.textDecorationColor = "inherit"; reportDrillHref.style.fontSize = "11px"; reportDrillHref.style.verticalAlign = "middle"; - reportDrillHref.setAttribute("onclick", "parent.idempiere.drillAcross('" + componentId + "','" + foreignColumnName + "','" + value + "','" + displayValue + "')"); + console.log(processID); + reportDrillHref.setAttribute("onclick", "parent.idempiere.drillAcross('" + componentId + "','" + foreignColumnName + "','" + value + "','" + displayValue + "','" + processID + "')"); let drillIco = doc.body.getAttribute ("drillAssistantIco"); if (typeof drillIco === 'string' && drillIco.length > 0) {