Disable ContextMenu - IBM Content Navigator - filenet-p8

Is there a way to disable a context menu item through a plugin through ACCE? Trying to understand if a context menu can be enabled/disabled based on the folder or based on the user's security groups. I am only able to set the privileges, but I need finer control than that.

Although this is an old question, an answer can be useful for someone.
The simplest way to do this - if you would like to remove it permanently - is to copy the containing menu and remove the menuitem you would like to hide, then replace the OOTB menu in desktop configuration with your custom one.
The other way is to create a Content Navigator plugin and you can create your custom action (menuitem) that does the exactly same thing that the menuitem you would like to control. When you install your plugin, your new action(menuitem) will be available in the menuitem list in the menu configuration.
The next step is the same as you can see above: copy the OOTB menu, create a custom menu, then remove the original menuitem and replace with your custom one, then replace the OOTB menu with your custom menu.
There is an official github repo with sample plugins to find some ideas in this topic.
For example, in this custom CheckinAction the author would like to enable the checkin of the document only if the item (the document) is not locked, the DSSignatureStatus property is true and there are some other conditions in the superclass (e.g. the item is a Document, there is no checkin on Folder):
/**
* Returns true if this action should be enabled for the given repository, list type, and items.
*/
isEnabled: function(repository, listType, items, teamspace, resultSet)
{
var enabled = this.inherited(arguments);
if(!items || items.length != 1){
return false;
};
if(items[0].attributes && items[0].attributes.DSSignatureStatus == 3 && !items[0].locked) {
return (enabled && true);
}
return false;
},
/**
* Returns true if this action should be visible for the given repository and list type.
*/
isVisible: function(repository, listType)
{
return this.inherited(arguments);
}
As you can see here, you can influence the visiblility too, you can decide to put your logic to the isVisible function if you would like to hide the menu, not just disable it.

Related

MFC Change CMFCToolBar button to Toggle instead of press/release?

I found an article online that said to setup the toolbar button to be a type that stays pressed you just set a style TBBS_CHECKBOX on the button but it doesn't work for me (it still acts like a normal button). I confirmed the style is set, just after created and the SetWindowText() MFC wizard setup of CMainFrame::OnCreate(). What am I doing wrong?
for (int i=0; ; i++) {
int id=m_wndToolBar.GetItemID(i);
if (id==0) {
break;
}
if (id == ID_THE_ID) {
m_wndToolBar.SetButtonStyle(i, TBBS_CHECKBOX);
}
}
Using Command Handlers is the recommended implementation here. A command ID may be used in multiple UI items, eg a menu item and a toolbar button. A handler affects all items with the same ID, so you don't need a separate one for each item. The CCmdUI Class provides methods that can cause UI items like menus or toolbar buttons to behave as push-buttons, check-boxes or radio-buttons, in addition to enabling/disabling.
In your example, suppose that the option whether to filter is instantiated on a per document basis, ie all views of the document would be filtered or non-filtered, all at the same time. You should define a boolean variable in your document class:
BOOL m_bFilterData = FALSE;
Then the ON_COMMAND and ON_UPDATE_COMMAND_UI handlers for the toolbar button with the Filter pic (and possibly a menu item as well):
BEGIN_MESSAGE_MAP(CMyDoc, CDocument)
.
.
ON_COMMAND(ID_VIEW_FILTERDATA, OnViewFilterData)
ON_UPDATE_COMMAND_UI(ID_VIEW_FILTERDATA, OnUpdateViewFilterData)
.
.
END_MESSAGE_MAP()
void CMyDoc::OnViewFilterData()
{
// Toggle filtered state
m_bFilterData = !m_bFilterData;
// Tell all views to refresh - You can limit this using the lHint/pHint params
UpdateAllViews(NULL, 0L, NULL);
}
void CMyDoc::OnUpdateViewFilterData(CCmdUI* pCmdUI)
{
// Enable/Disable as needed
pCmdUI->Enable(m_nTotalItems>0);
// Show pressed/checked if data filtered
pCmdUI->SetCheck(m_bFilterData);
}
Now, if the filter option is instantiated per view, ie each view can indpendently be filtered or non-filtered, the above must go to your view class(-es):
void CMyView::OnViewFilterData()
{
// Toggle filtered state
m_bFilterData = !m_bFilterData;
// Refresh this view only
.
.
}
void CMyView::OnUpdateViewFilterData(CCmdUI* pCmdUI)
{
// Enable/Disable as needed
pCmdUI->Enable(GetDocument()->m_nTotalItems > 0);
// Show pressed/checked if data filtered
pCmdUI->SetCheck(m_bFilterData);
}

Adding functionality to wicket palette button

I want to add some functionality to the right arrow button, the one that puts the user selection into the selected elements panel. Specifically, when the user selects an element from the avaliable choices, I don't want the element to be taken to the selected elements panel if there are elements at the right panel of another palette. So basically, what I need is to execute custom java code when the button is pressed, and alter the default behavior of the palette when a condition occurs.
I found the solution somewhere else. Just in case someone needs it, here is what you have to do.
myPalette = new Palette<MyClass>(...) {
#Override
protected Recorder newRecorderComponent() {
Recorder<MyClass> recorder = super.newRecorderComponent();
recorder.add(new AjaxFormComponentUpdatingBehavior("onchange") {
protected void onUpdate(AjaxRequestTarget target) {
// Custom code
...
if (target != null)
// Update another component
target.add(anotherComponent);
}
}
);
return recorder;
}
};

How can I remove the default onCancel confirmation prompt in CKEDITOR dialogs?

When using ckeditor links, images and table properties dialogs if the user clicks on cancel, CKEDITOR will check if anything has changed and if so prompts the user with js confirm popup.
How can I disable this prompt on cancel; no other dialogs in our webapp prompts on cancel and this is not consistent.
There doesn't' seem to be a way to get a list of all the handlers for an event to remove the one that's doing the prompt.
I don't want to specify a custom isChanged for each and every dialog item to hack a fake nothings changed.
Is there a standard way to override the base on('cancel',...) event handlers in CKEDITOR? I see that I can monkeypatch the dialogdefinition.OnLoad, OnOK, OnCancel handlers but this forced cancel prompt I'm referring to is not being done in the dialog's OnCancel.
I'm using the latest version 4.2
This is now a supported configuration option in version 4.3. Just specify config.dialog_noConfirmCancel = true when you create the dialog.
Check out http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-dialog_noConfirmCancel
You where very close. In fact it is in fact is the onCancel event.
There is a ticket for this problem that also includes a workaround:
CKEDITOR.on('dialogDefinition', function(dialogDefinitionEvent) {
if (dialogDefinitionEvent.data.name == 'link') {
var dialogDefinition = dialogDefinitionEvent.data.definition;
// Get rid of annoying confirmation dialog on cancel
dialogDefinition.dialog.on('cancel', function(cancelEvent) {
return false;
}, this, null, -1);
}
});
If you leave out the if (dialogDefinitioNEvent.data.name == 'link') statement it would disable the check for all dialogs.
The -1 handler parameter is the key here, as it inserts the handler before the dialog plugin's default handler, which will never be invoked because the return false cancels the bubbling of the cancel event to the other registered event listeners.
CKEditor Ticket #8331: Ability to ignore "Confirm Cancel"-warning on dialogs
I can confirm that the latest version of ckEditor works with the "noConfirmCancel" attribute.
A snippet of my working code is as follows:
<script type="text/javascript" src="#ckBasePath#/ckeditor.js" language="JavaScript"></script>
<script>
thisConfig = CKEDITOR.config;
thisConfig.autoParagraph = true;
thisConfig.fillEmptyBlocks= true;
thisConfig.dialog_noConfirmCancel = true;
objSample = CKEDITOR.replace( 'Sample' , thisConfig);
</script>
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-dialog_noConfirmCancel

how to dismiss the dropdown list of an autocompletebox in windows phone 7

is there anyway to programmatically dismiss the drop-down list of an autocompletebox? my use case is as follows.
MainPage.xaml passes a value to SearchPage.xaml (i.e. /SearchPage.xaml?query=someText).
in SearchPage.xaml.cs, i set,
autoCompleteBox.Text = NavigationContext.QueryString["query"].
at this point, the drop-down list of suggested matches shows up. i don't want this behavior when the page is just navigated to.
i also tried the following to dismiss the drop-down list but it didn't help.
autoCompleteBox.Text = NavigationContext.QueryString["query"];
autoCompleteBox.IsDropDownOpen = false;
the drop-down list seems to go away from the AutoCompleteBox when it loses focuses, but i don't see a property/field to set to make it lose focus.
any help is appreciated.
well, i tinkered a bit and came up with a kludge. in the constructor of SearchPage.xaml.cs i have the following code.
autoCompleteBox.TextFilter += DummyFilter;
autoCompleteBox.GotFocus += (s,args) => {
if(!isAutoCompleteBoxInit) {
autoCompleteBox.TextFilter -= DummyFilter;
autoCompleteBox.TextFilter += RealFilter;
}
}
DummyFilter looks like the following.
bool DummyFilter(string search, string value) { return false; }
RealFilter looks like the following.
bool RealFilter(string search, string value) {
if(null != value) return value.ToLower().StartsWith(search.ToLower());
}
in my OnNavigatedTo method, is where i set, autoCompleteBox.Text = NavigationContext.QueryString["query"]. so when i do this now, the DummyFilter will always return false, so the drop-down list goes away. when the user focuses in on the AutoCompleteBox, i check if the correct Filter was already attached to the TextFilter property, if not, then i do a switch.
hope this helps some of you.
Is there any other focusable control on the page? Just set the focus somewhere else, and your problem should be solved.
When you have changed the text of the AutoCompleteBox the dropdown will open. Only when the user has changed the text and there is a match then the dropdown will close.
Just change userInitiated to true and when there is a match the dropdown will close.
private void UpdateTextCompletion(bool userInitiated)
{
userInitiated = true; ...

How to disable contextmenu except in the grid of telerik FileExplorer?

I tried to disable unnecessary context menu when I set a grid with ContextMenus. By default, if you click the blank part of the grid, it disables the Delete menu.
However, after adding customized menu like Download, it shows in the context menu even there is no selected item (i.e., How can I download it?). So I want to disable the unnecessary menu or make it invisible except in the grid row context menu.
I'm using telerik ASP.NET AJAX contorl 2009 Q2.
Thanks in advance.
This piece of code should help - basically what you need to do is attach a handler to the menu showing event, check the target element (the element where you right-clicked) and if it is the grid area itself - disable the menu item.
<script type="text/javascript">
function OnClientLoad(explorer)
{
explorer.get_gridContextMenu().add_showing(disableItem);
}
function disableItem(sender, args)
{
var target = args.get_targetElement();
if (target && target.className == "rgDataDiv")
{
var dlItem = sender.findItemByValue("download");
dlItem.set_enabled(false);
}
}</script><telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" OnClientLoad="OnClientLoad"></telerik:RadFileExplorer>

Resources