From dbf4fe9fb88fe7df1fe67357ed778ed6be658fe5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 24 Nov 2014 22:36:58 -0500 Subject: [PATCH] IDEMPIERE-2334 Allow zoom from URL --- .../org/adempiere/webui/AdempiereWebUI.java | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index 82bab4149d..c520599cdf 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -43,11 +43,13 @@ import org.compiere.model.MRole; import org.compiere.model.MSession; import org.compiere.model.MSysConfig; import org.compiere.model.MSystem; +import org.compiere.model.MTable; import org.compiere.model.MUser; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Language; import org.compiere.util.Msg; +import org.compiere.util.Util; import org.zkforge.keylistener.Keylistener; import org.zkoss.web.Attributes; import org.zkoss.web.servlet.Servlets; @@ -77,7 +79,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb /** * */ - private static final long serialVersionUID = 5875869799688466929L; + private static final long serialVersionUID = -225993322049019137L; private static final String SAVED_CONTEXT = "saved.context"; @@ -275,9 +277,45 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb } Env.setContext(ctx, "#LocalHttpAddr", localHttpAddr.toString()); Clients.response(new AuScript("zAu.cmd0.clearBusy()")); + + processParameters(); } - /** + private void processParameters() { + String action = Executions.getCurrent().getParameter("Action"); + if (action != null && "Zoom".equalsIgnoreCase(action)) { + int tableID = 0; + try { + String prm = Executions.getCurrent().getParameter("AD_Table_ID"); + if (!Util.isEmpty(prm)) + tableID = Integer.parseInt(prm); + } catch (NumberFormatException e) { + // ignore + } + if (tableID == 0) { + String tableName = Executions.getCurrent().getParameter("TableName"); + if (!Util.isEmpty(tableName)) { + MTable table = MTable.get(Env.getCtx(), tableName); + if (table != null) { + tableID = table.getAD_Table_ID(); + } + } + } + int recordID = 0; + try { + String prm = Executions.getCurrent().getParameter("AD_Table_ID"); + if (!Util.isEmpty(prm)) + recordID = Integer.parseInt(prm); + } catch (NumberFormatException e) { + // ignore + } + if (tableID > 0) { + AEnv.zoom(tableID, recordID); + } + } + } + + /** * @return key listener */ @Override