IDEMPIERE-5218 Improvements for Record Info dialog (#1219)
* IDEMPIERE-5218 Improvements for Record Info dialog #resolve #comment Permalink as a button + new button Copy SELECT * Use navigator.clipboard and PO.get_WhereClause - as suggested by Heng Sin
This commit is contained in:
parent
e3555e5fff
commit
063788242c
|
@ -0,0 +1,18 @@
|
|||
-- IDEMPIERE-5218 Improvements for Record Info dialog
|
||||
SELECT register_migration_script('202203031428_IDEMPIERE-5218.sql') FROM dual;
|
||||
|
||||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Mar 3, 2022, 2:28:28 PM CET
|
||||
UPDATE AD_Message SET MsgText='Click to copy a permanent link to this record',Updated=TO_TIMESTAMP('2022-03-03 14:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200370
|
||||
;
|
||||
|
||||
-- Mar 3, 2022, 2:29:07 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Copy SELECT',0,0,'Y',TO_TIMESTAMP('2022-03-03 14:29:06','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-03-03 14:29:06','YYYY-MM-DD HH24:MI:SS'),100,200733,'CopySelect','D','441bb105-9f59-44db-a9bc-a1873f3678e3')
|
||||
;
|
||||
|
||||
-- Mar 3, 2022, 2:29:34 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Click to copy a SELECT SQL query pointing to this record',0,0,'Y',TO_TIMESTAMP('2022-03-03 14:29:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-03-03 14:29:33','YYYY-MM-DD HH24:MI:SS'),100,200734,'CopySelect_tooltip','D','8f403aaf-6fe4-4fdb-9630-5ec81cd03a4e')
|
||||
;
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
-- IDEMPIERE-5218 Improvements for Record Info dialog
|
||||
SELECT register_migration_script('202203031428_IDEMPIERE-5218.sql') FROM dual;
|
||||
|
||||
-- Mar 3, 2022, 2:28:28 PM CET
|
||||
UPDATE AD_Message SET MsgText='Click to copy a permanent link to this record',Updated=TO_TIMESTAMP('2022-03-03 14:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200370
|
||||
;
|
||||
|
||||
-- Mar 3, 2022, 2:29:07 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Copy SELECT',0,0,'Y',TO_TIMESTAMP('2022-03-03 14:29:06','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-03-03 14:29:06','YYYY-MM-DD HH24:MI:SS'),100,200733,'CopySelect','D','441bb105-9f59-44db-a9bc-a1873f3678e3')
|
||||
;
|
||||
|
||||
-- Mar 3, 2022, 2:29:34 PM CET
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Click to copy a SELECT SQL query pointing to this record',0,0,'Y',TO_TIMESTAMP('2022-03-03 14:29:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-03-03 14:29:33','YYYY-MM-DD HH24:MI:SS'),100,200734,'CopySelect_tooltip','D','8f403aaf-6fe4-4fdb-9630-5ec81cd03a4e')
|
||||
;
|
||||
|
|
@ -59,7 +59,7 @@ import org.zkoss.zhtml.Text;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.A;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Div;
|
||||
|
@ -71,6 +71,7 @@ import org.zkoss.zul.North;
|
|||
import org.zkoss.zul.Radio;
|
||||
import org.zkoss.zul.Radiogroup;
|
||||
import org.zkoss.zul.South;
|
||||
import org.zkoss.zul.Toolbarbutton;
|
||||
|
||||
/**
|
||||
* Record Info (Who) With Change History
|
||||
|
@ -145,7 +146,9 @@ public class WRecordInfo extends Window implements EventListener<Event>
|
|||
/** Info */
|
||||
private StringBuffer m_info = new StringBuffer();
|
||||
/** Permalink */
|
||||
private A m_permalink = new A();
|
||||
private Toolbarbutton m_permalink = new Toolbarbutton();
|
||||
/** Copy Select */
|
||||
private Toolbarbutton m_copySelect = new Toolbarbutton();
|
||||
|
||||
/** Date Time Format */
|
||||
private SimpleDateFormat m_dateTimeFormat = DisplayType.getDateFormat
|
||||
|
@ -241,14 +244,15 @@ public class WRecordInfo extends Window implements EventListener<Event>
|
|||
south.setSclass("dialog-footer");
|
||||
south.setParent(layout);
|
||||
//
|
||||
m_permalink.setTarget("_blank");
|
||||
m_permalink.setLabel(Msg.getMsg(Env.getCtx(), "Permalink"));
|
||||
m_permalink.setTooltiptext(Msg.getMsg(Env.getCtx(), "Permalink_tooltip"));
|
||||
m_copySelect.setLabel(Msg.getMsg(Env.getCtx(), "CopySelect"));
|
||||
m_copySelect.setTooltiptext(Msg.getMsg(Env.getCtx(), "CopySelect_tooltip"));
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.setWidth("100%");
|
||||
south.appendChild(hbox);
|
||||
ZKUpdateUtil.setHflex(m_permalink, "true");
|
||||
hbox.appendChild(m_permalink);
|
||||
hbox.appendChild(m_copySelect);
|
||||
ZKUpdateUtil.setHflex(confirmPanel, "true");
|
||||
hbox.appendChild(confirmPanel);
|
||||
|
||||
|
@ -341,8 +345,29 @@ public class WRecordInfo extends Window implements EventListener<Event>
|
|||
}
|
||||
if (!Util.isEmpty(uuid))
|
||||
m_info.append("\n ").append(uuidcol).append("=").append(uuid);
|
||||
m_permalink.setHref(AEnv.getZoomUrlTableID(po));
|
||||
if (po.get_KeyColumns().length == 1) {
|
||||
m_permalink.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
|
||||
public void onEvent(Event event) throws Exception {
|
||||
String ticketURL = AEnv.getZoomUrlTableID(po);
|
||||
StringBuffer sb = new StringBuffer("navigator.clipboard.writeText(\"")
|
||||
.append(ticketURL)
|
||||
.append("\");");
|
||||
Clients.evalJavaScript(sb.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
m_permalink.setVisible(po.get_KeyColumns().length == 1);
|
||||
m_copySelect.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
|
||||
public void onEvent(Event event) throws Exception {
|
||||
StringBuffer query = new StringBuffer("navigator.clipboard.writeText(\"SELECT * FROM ")
|
||||
.append(po.get_TableName())
|
||||
.append(" WHERE ")
|
||||
.append(po.get_WhereClause(true));
|
||||
query.append("\");");
|
||||
Clients.evalJavaScript(query.toString());
|
||||
}
|
||||
});
|
||||
m_copySelect.setVisible(true);
|
||||
}
|
||||
}
|
||||
if (gridTab != null)
|
||||
|
|
Loading…
Reference in New Issue