From 06697607119c0e49746082925d00c2787c0a57c2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 4 Feb 2021 21:39:15 +0100 Subject: [PATCH] IDEMPIERE-3340 Adaxa's User Favorite which allow user to organize their menu, create folders (#569) * Login Automatic Open Sequence -> buttons don't require names * Login Automatic Open Sequence -> buttons look bad with non-font icons * Clicking on + on an item of the favourites throws an NPE * Implement same approach about checking for new button restricted on menu search, menu popup and quick entry popup --- .../oracle/202101181900_IDEMPIERE-3340.sql | 18 +---------------- .../202101181900_IDEMPIERE-3340.sql | 18 +---------------- .../webui/apps/MenuSearchController.java | 8 ++++++++ .../component/FavoriteSimpleTreeModel.java | 1 + .../dashboard/LoginOpenSequenceDialog.java | 8 ++++---- .../webui/editor/WEditorPopupMenu.java | 20 +++++++++++++------ .../webui/panel/AbstractMenuPanel.java | 11 ++++++++++ 7 files changed, 40 insertions(+), 44 deletions(-) diff --git a/migration/i8.2z/oracle/202101181900_IDEMPIERE-3340.sql b/migration/i8.2z/oracle/202101181900_IDEMPIERE-3340.sql index 6e42cf5f04..9ee0301284 100644 --- a/migration/i8.2z/oracle/202101181900_IDEMPIERE-3340.sql +++ b/migration/i8.2z/oracle/202101181900_IDEMPIERE-3340.sql @@ -14,21 +14,5 @@ INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created, 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','Expand/Collapse Tree',0,0,'Y',TO_DATE('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,200658,'Tooltip_ExpandCollapseTree','D','26463bcc-7a17-444c-aab4-51fda0fde442') ; --- May 7, 2020 7:15:41 PM IST -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','Move Down',0,0,'Y',TO_DATE('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,200608,'MoveDown','D','525bf4d4-5ce3-4a7d-9081-2e3b96708cf1') -; - --- May 7, 2020 7:16:04 PM IST -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','Move Up',0,0,'Y',TO_DATE('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,200609,'MoveUp','D','bdf56785-ce50-49ce-a2c5-d20a1a08ec96') -; - --- May 7, 2020 7:16:17 PM IST -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','Move Left',0,0,'Y',TO_DATE('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,200610,'MoveLeft','D','f0082f8f-7ecf-4682-9ee2-593b6b21fe41') -; - --- May 7, 2020 7:16:31 PM IST -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','Move Right',0,0,'Y',TO_DATE('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,200611,'MoveRight','D','0d2f8a50-350d-43c5-9629-64c3a6ea88d1') -; - SELECT register_migration_script('202101181900_IDEMPIERE-3340.sql') FROM dual -; \ No newline at end of file +; diff --git a/migration/i8.2z/postgresql/202101181900_IDEMPIERE-3340.sql b/migration/i8.2z/postgresql/202101181900_IDEMPIERE-3340.sql index ce75283931..4aced2982c 100644 --- a/migration/i8.2z/postgresql/202101181900_IDEMPIERE-3340.sql +++ b/migration/i8.2z/postgresql/202101181900_IDEMPIERE-3340.sql @@ -11,21 +11,5 @@ INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created, 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','Expand/Collapse Tree',0,0,'Y',TO_TIMESTAMP('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-01-18 18:56:38','YYYY-MM-DD HH24:MI:SS'),100,200658,'Tooltip_ExpandCollapseTree','D','26463bcc-7a17-444c-aab4-51fda0fde442') ; --- May 7, 2020 7:15:41 PM IST -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','Move Down',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:15:40','YYYY-MM-DD HH24:MI:SS'),100,200608,'MoveDown','D','525bf4d4-5ce3-4a7d-9081-2e3b96708cf1') -; - --- May 7, 2020 7:16:04 PM IST -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','Move Up',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:16:03','YYYY-MM-DD HH24:MI:SS'),100,200609,'MoveUp','D','bdf56785-ce50-49ce-a2c5-d20a1a08ec96') -; - --- May 7, 2020 7:16:17 PM IST -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','Move Left',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:16:16','YYYY-MM-DD HH24:MI:SS'),100,200610,'MoveLeft','D','f0082f8f-7ecf-4682-9ee2-593b6b21fe41') -; - --- May 7, 2020 7:16:31 PM IST -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','Move Right',0,0,'Y',TO_TIMESTAMP('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-05-07 19:16:30','YYYY-MM-DD HH24:MI:SS'),100,200611,'MoveRight','D','0d2f8a50-350d-43c5-9629-64c3a6ea88d1') -; - SELECT register_migration_script('202101181900_IDEMPIERE-3340.sql') FROM dual -; \ No newline at end of file +; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/MenuSearchController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/MenuSearchController.java index e205dccf86..0f049fdd64 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/MenuSearchController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/MenuSearchController.java @@ -27,6 +27,8 @@ import org.adempiere.webui.util.TreeItemAction; import org.adempiere.webui.util.TreeNodeAction; import org.adempiere.webui.util.TreeUtils; import org.adempiere.webui.util.ZKUpdateUtil; +import org.compiere.model.MMenu; +import org.compiere.model.MToolBarButtonRestrict; import org.compiere.model.MTreeNode; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -302,6 +304,12 @@ public class MenuSearchController implements EventListener{ Clients.showBusy(selected, null); Events.echoEvent(ON_LOAD_MORE, layout, null); } else { + if (newRecord) { + Treeitem ti = (Treeitem)item.getData(); + MMenu menu = MMenu.get(Integer.parseInt(ti.getValue())); + if (MToolBarButtonRestrict.isNewButtonRestricted(menu.getAD_Window_ID())) + newRecord = false; + } selectTreeitem(item.getData(), newRecord); selected.setAttribute(ONSELECT_TIMESTAMP, System.currentTimeMillis()); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FavoriteSimpleTreeModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FavoriteSimpleTreeModel.java index f839b6f53b..bcf91e96ef 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FavoriteSimpleTreeModel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FavoriteSimpleTreeModel.java @@ -257,6 +257,7 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis if (Events.ON_DROP.equals(eventName) || Events.ON_RIGHT_CLICK.equals(eventName) || (Events.ON_CLICK.equals(eventName) && comp instanceof Toolbarbutton + && ((Toolbarbutton) event.getTarget()).getAttribute(FavoriteSimpleTreeModel.MOBILE_TOOLBAR_CTX_MENU) != null && (boolean) ((Toolbarbutton) event.getTarget()).getAttribute(FavoriteSimpleTreeModel.MOBILE_TOOLBAR_CTX_MENU))) { for (EventListener listener : onDropListners) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/LoginOpenSequenceDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/LoginOpenSequenceDialog.java index 1b4a0596eb..0d0a74bc30 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/LoginOpenSequenceDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/LoginOpenSequenceDialog.java @@ -72,10 +72,10 @@ public class LoginOpenSequenceDialog extends Window /** Logger */ protected static final CLogger log = CLogger.getCLogger(LoginOpenSequenceDialog.class); - private Button bAdd = ButtonFactory.createNamedButton("MoveRight", true, true); - private Button bRemove = ButtonFactory.createNamedButton("MoveLeft", true, true); - private Button bUp = ButtonFactory.createNamedButton("MoveUp", true, true); - private Button bDown = ButtonFactory.createNamedButton("MoveDown", true, true); + private Button bAdd = ButtonFactory.createNamedButton("Next", false, true); + private Button bRemove = ButtonFactory.createNamedButton("Previous", false, true); + private Button bUp = ButtonFactory.createNamedButton("Parent", false, true); + private Button bDown = ButtonFactory.createNamedButton("Detail", false, true); private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, true, false, false, false); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java index 8495f72e9f..1faa853330 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java @@ -29,6 +29,7 @@ import org.compiere.model.Lookup; import org.compiere.model.MFieldSuggestion; import org.compiere.model.MRole; import org.compiere.model.MTable; +import org.compiere.model.MToolBarButtonRestrict; import org.compiere.model.MZoomCondition; import org.compiere.util.DB; import org.compiere.util.Env; @@ -141,18 +142,25 @@ public class WEditorPopupMenu extends Menupopup implements EventListener for (MZoomCondition zoomCondition : MZoomCondition.getConditions(table.getAD_Table_ID())) { Boolean canAccessZoom = MRole.getDefault().getWindowAccess(zoomCondition.getAD_Window_ID()); if (canAccessZoom != null && canAccessZoom) { - this.zoomEnabled = true; - if (hasQuickEntryField(zoomCondition.getAD_Window_ID(), 0, tableName)) { - this.newEnabled = true; - this.updateEnabled = true; - } + this.zoomEnabled = true; + if (hasQuickEntryField(zoomCondition.getAD_Window_ID(), 0, tableName)) { + if (MToolBarButtonRestrict.isNewButtonRestricted(zoomCondition.getAD_Window_ID())) + this.newEnabled = false; + else + this.newEnabled = true; + this.updateEnabled = true; + } break; } } } else { if (hasQuickEntryField(winID,winIDPO,tableName)) { - this.newEnabled = true; + if ( !MToolBarButtonRestrict.isNewButtonRestricted(winID) + || (winIDPO > 0 && winIDPO != winID && !MToolBarButtonRestrict.isNewButtonRestricted(winIDPO))) + this.newEnabled = true; + else + this.newEnabled = false; this.updateEnabled = true; } else { this.newEnabled = false; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java index e30d7f9776..a10c7d95d8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java @@ -30,6 +30,7 @@ import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; import org.compiere.model.MMenu; import org.compiere.model.MQuery; +import org.compiere.model.MToolBarButtonRestrict; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; import org.compiere.util.DB; @@ -264,6 +265,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener