PDA

View Full Version : Disable Right Click for all the uiviews in nsf



R.J
24 Dec 2009, 9:47 AM
I have the following code in my Head content of my page :


thisWebDbName := @WebDbName;
extndDbWebPath := "/mainfoldername/subfolderpath/extnd_b3.nsf/";
extUrl := extndDbWebPath + "ext/3x/";
extndUrl := extndDbWebPath + "extnd/3x/";
sViewName := "By name";
sOutlineName := "OlMain";
bShowSearch := "true";
mode := @If(@UrlQueryString("debug") = "true"; "-debug"; "");
unid := @If(@IsNewDoc;"";@Text(@DocumentUniqueID));
editMode := @If(@IsDocBeingEdited;"true";"false");

"<!-- Ext JS library -->" + @NewLine +
"<script type='text/javascript' src='" + extUrl + "adapter/ext/ext-base.js'></script>" + @NewLine +
"<script type='text/javascript' src='" + extUrl + "ext-all" + mode + ".js'></script>" + @NewLine +
"<!-- Ext.nd JS library -->" + @NewLine +
"<script type='text/javascript' src='" + extndUrl + "extnd-all" + mode + ".js'></script>" + @NewLine +
"<script type='text/javascript' src='" + extndUrl + "Session.js?OpenAgent&db=" + thisWebDbName + "'></script>" + @NewLine +
"<script type='text/javascript' src='" + extndUrl + "UIDocument.js?OpenAgent&db=" + thisWebDbName + "&unid=" + unid + "&editmode=" + editMode + "'></script>" + @NewLine +
"<script type='text/javascript'>" + @NewLine +
" var ExtndApp = function() {
return {
init : function(){
this.ui = new Ext.nd.DominoUI({
uiOutline : {outlineName: '" + sOutlineName + "'},
uiView : {viewName: '" + sViewName + "', viewTitle: '" + sViewTitle + "', showSearch: " + bShowSearch + ",
gridHandleRowContextMenu: function(grid,rowIndex,e){ e.stopEvent(); return false;}

}
});
} // init
} // return
}();" + @NewLine +
" Ext.onReady(ExtndApp.init, ExtndApp, true); " + @NewLine +
"</script>" + @NewLine +
"<link rel='stylesheet' type='text/css' href='" + extUrl + "resources/css/ext-all.css' />" + @NewLine +

"<link rel='stylesheet' type='text/css' href='" + extndUrl + "resources/css/domino.css' />"


the code marked in red disables right click option in By Document view which is loaded when the database is opened on web, but it does not disable the rightclick option on other views when clicked on the outline.

Please guide how to disable right click on all the views of the database so that Open and Edit options are not available on right click.

Thanks In Advance. :) :-?

RWaters
4 Jan 2010, 1:31 PM
Ext.override(Ext.nd.UIView, {
gridHandleRowContextMenu: function(grid, ri, e) { e.stopEvent(); return false; }
});


Ext.override will change the prototype of the object making all instances of it use the 'empty' handler function, your implementation was only overriding this function in that specific view instance. Looks like a good place for us to add a config option for you in a later version.

TY@GP
10 Jan 2010, 11:32 AM
Jack made the remark that this function only applies to the view. I like to add that when you select the same view in the outline these setting will also disappear. If you are using the dominoui function you need to add your function also to the viewDefaults property of the uioutline.

See here sample for the multiExpand property:


this.ui = new Ext.nd.DominoUI({
uiOutline : {
outlineName: '<outlineName>',
viewDefaults: {
multiExpand: true
}
},
uiView: {
viewName: '<viewName>',
showSearch: true, multiExpand: true
}
});

RWaters
15 Jan 2010, 1:37 PM
The override that I posted should affect every instance so that you don't have to put it into each specific config or into the defaults section.