Sitedetout - Tutoriels informatiques

Hiding the Standard Check-In and Standard Search menu items

Hiding the Standard Check-In and Standard Search menu items

On 3 separate comment threads on my blog, I’ve had people asking how to hide the Standard Check-In and Standard Search menu items in UCM/URM navigation.  Given that it seems to be a popular topic, I thought I would cover it here.

Out of the box, UCM does not give you a way to hide these menu choices.  There aren’t any secret configuration flags or tricks you can do with Idoc Script to get them to disappear.  You need to have a custom component to do it.   But the good thing is the code to do it is pretty minor.  And because the menus changed between 10g and 11g, the code is slightly different between the two.  But I’ll cover both here.

In both cases, you want to modify the ‘custom_finish_layout_init‘ resource. As the name implies, this is what gets called at the end of the JavaScript processing of the page layout and where we can insert our menu changes.  As best practice, you first want to include a ‘super.’ call to the resource to load any previously modified versions of the resource:

 <$include super.custom_finish_layout_init$>

The next portion depends upon the version you are running.  On 10g, the code would look like:

navBuilder.deleteItem(“MY_PERSONAL_SEARCHES_<$dpSearchCount$>”);
navBuilder.deleteItem(“MY_PERSONAL_CHECKINS_<$dpCheckinCount$>”);

And that’s it!  Just deploy your component and your menu choices should be gone.  Of course, you can always go beyond that and show the menus if the user is an admin or such.  Or hide just one or the other based on configuration entries.

In 11g, the code would look like:

var searchmenu= YAHOO.widget.MenuManager.getMenu(“MENU_A_SEARCH”);
var searchmenuitems=searchmenu.getItems();
<$if isComponentEnabled(“RecordsManagement”)$>
<$lenghthCount=”2″$>
<$else$>
<$lenghthCount=”1″$>
<$endif$>
navBuilder.deleteItem(“MY_PERSONAL_SEARCHES_” + (searchmenuitems.length-<$lenghthCount$>));

var checkinmenu= YAHOO.widget.MenuManager.getMenu(“MENU_A_NEW_CHECK_IN”);
var checkinmenuitems=checkinmenu.getItems();
navBuilder.deleteItem(“MY_PERSONAL_CHECKINS_” + (checkinmenuitems.length-1));

In this case, there isn’t an Idoc variable that is maintaining a count anymore.  So it has to be calculated through the MenuManager.

For a pre-built version of the component, I have one available on our sample code site.  It has logic to detect if you are on 11g or 10g and apply the appropriate command to delete the menu items, so it can be used in either version.


Laisser un commentaire

Votre adresse e-mail ne sera pas publiée.

Menu Title
Chargement...

Powered by sitedetout.com