diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 18f5c9f865..28b75f81a9 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -63,7 +63,7 @@ public final class MRole extends X_AD_Role /** * */ - private static final long serialVersionUID = -4649095180532036099L; + private static final long serialVersionUID = 8041397465891798378L; /** * Get Default (Client) Role @@ -3344,4 +3344,25 @@ public final class MRole extends X_AD_Role return access; } + /** + * Does the table is excluded for current role (this method doesn't check the level of the table, use isTableAccess for this purpose) + * @param tableID ID of the table + * @return + */ + public boolean isTableAccessExcluded(int tableID) + { + loadTableAccess(false); + + for (int i = 0; i < m_tableAccess.length; i++) { + if ( m_tableAccess[i].isExclude() + && m_tableAccess[i].getAD_Table_ID() == tableID + && ! m_tableAccess[i].isReadOnly() + && MTableAccess.ACCESSTYPERULE_Accessing.equals(m_tableAccess[i].getAccessTypeRule()) + ) + return true; + } + + return false; + } // isTableAccessExcluded + } // MRole 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 9a8916a1e0..8495f72e9f 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 @@ -26,6 +26,7 @@ import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.window.WFieldSuggestion; import org.compiere.model.GridField; import org.compiere.model.Lookup; +import org.compiere.model.MFieldSuggestion; import org.compiere.model.MRole; import org.compiere.model.MTable; import org.compiere.model.MZoomCondition; @@ -289,17 +290,19 @@ public class WEditorPopupMenu extends Menupopup implements EventListener } public void addSuggestion(final GridField field) { - Menuitem editor = new Menuitem(Msg.getElement(Env.getCtx(), "AD_FieldSuggestion_ID")); - if (ThemeManager.isUseFontIconForImage()) - editor.setIconSclass("z-icon-FieldSuggestion"); - editor.addEventListener(Events.ON_CLICK, new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - WFieldSuggestion fieldSuggestion = new WFieldSuggestion(field.getAD_Field_ID()); - fieldSuggestion.setPage(WEditorPopupMenu.this.getPage()); - fieldSuggestion.doHighlighted(); - } - }); - appendChild(editor); + if (!MRole.getDefault().isTableAccessExcluded(MFieldSuggestion.Table_ID)) { + Menuitem editor = new Menuitem(Msg.getElement(Env.getCtx(), "AD_FieldSuggestion_ID")); + if (ThemeManager.isUseFontIconForImage()) + editor.setIconSclass("z-icon-FieldSuggestion"); + editor.addEventListener(Events.ON_CLICK, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + WFieldSuggestion fieldSuggestion = new WFieldSuggestion(field.getAD_Field_ID()); + fieldSuggestion.setPage(WEditorPopupMenu.this.getPage()); + fieldSuggestion.doHighlighted(); + } + }); + appendChild(editor); + } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java index 8a43307de6..7019106613 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java @@ -29,10 +29,12 @@ import org.compiere.model.I_AD_InfoWindow; import org.compiere.model.I_AD_WF_Node; import org.compiere.model.I_AD_Workflow; import org.compiere.model.MCtxHelpMsg; +import org.compiere.model.MCtxHelpSuggestion; import org.compiere.model.MForm; import org.compiere.model.MInfoWindow; import org.compiere.model.MProcess; import org.compiere.model.MQuery; +import org.compiere.model.MRole; import org.compiere.model.MTab; import org.compiere.model.MTask; import org.compiere.model.PO; @@ -269,16 +271,19 @@ public class HelpController if (ctxHelpMsg != null) { sb.append(stripHtml(ctxHelpMsg.get_Translation(I_AD_CtxHelpMsg.COLUMNNAME_MsgText), false) + "
\n"); - ContextHelpMenupopup popup = new ContextHelpMenupopup(ctxHelpMsg); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + if (!MRole.getDefault().isTableAccessExcluded(MCtxHelpSuggestion.Table_ID)) { + ContextHelpMenupopup popup = new ContextHelpMenupopup(ctxHelpMsg); + pnlContextHelp.setAttribute("contextMenu", popup); + pnlContextHelp.setContext(popup); + popup.setPage(pnlContextHelp.getPage()); + } } else { StringBuilder baseContent = new StringBuilder(); StringBuilder translatedContent = new StringBuilder(); - ContextHelpMenupopup popup = null; + if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Tab)) { MTab tab = new MTab(Env.getCtx(), recordId, null); @@ -323,11 +328,8 @@ public class HelpController } sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString()); - - popup = new ContextHelpMenupopup(tab, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + addContextHelpMenupopup(tab, baseContent, translatedContent); } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Process)) { @@ -374,11 +376,8 @@ public class HelpController } sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString()); - - popup = new ContextHelpMenupopup(process, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + addContextHelpMenupopup(process, baseContent, translatedContent); } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Form)) { @@ -424,11 +423,8 @@ public class HelpController } sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString()); - - popup = new ContextHelpMenupopup(form, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + addContextHelpMenupopup(form, baseContent, translatedContent); } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Info)) { @@ -473,11 +469,8 @@ public class HelpController } sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString()); - - popup = new ContextHelpMenupopup(info, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + addContextHelpMenupopup(info, baseContent, translatedContent); } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) { @@ -522,12 +515,8 @@ public class HelpController } sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString()); - - popup = new ContextHelpMenupopup(workflow, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + addContextHelpMenupopup(workflow, baseContent, translatedContent); } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) { @@ -574,11 +563,8 @@ public class HelpController } sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString()); - - popup = new ContextHelpMenupopup(task, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + addContextHelpMenupopup(task, baseContent, translatedContent); } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) { @@ -624,21 +610,16 @@ public class HelpController } sb.append(Util.isEmpty(translatedContent.toString()) ? baseContent.toString() : translatedContent.toString()); - - popup = new ContextHelpMenupopup(node, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + addContextHelpMenupopup(node, baseContent, translatedContent); } else { translatedContent.append("

(" + Msg.getMsg(Env.getCtx(), "NotAvailable") + ")

"); baseContent.append("

(" + Msg.getMsg(Language.getBaseAD_Language(), "NotAvailable") + ")

"); sb.append(translatedContent.toString()); - popup = new ContextHelpMenupopup(null, baseContent.toString(), translatedContent.toString()); - pnlContextHelp.setAttribute("contextMenu", popup); - pnlContextHelp.setContext(popup); - popup.setPage(pnlContextHelp.getPage()); + + addContextHelpMenupopup(null, baseContent, translatedContent); } } @@ -646,7 +627,16 @@ public class HelpController htmlContextHelp.setContent(sb.toString()); } - + + private void addContextHelpMenupopup(PO po, StringBuilder baseContent, StringBuilder translatedContent) { + if (!MRole.getDefault().isTableAccessExcluded(MCtxHelpSuggestion.Table_ID)) { + ContextHelpMenupopup popup = new ContextHelpMenupopup(po, baseContent.toString(), translatedContent.toString()); + pnlContextHelp.setAttribute("contextMenu", popup); + pnlContextHelp.setContext(popup); + popup.setPage(pnlContextHelp.getPage()); + } + } + public void renderQuickInfo(GridTab gridTab) { if (gridTab == null) { pnlQuickInfo.setVisible(false);