Tuesday, June 10, 2014

Hey! Check It Out… or Not? Removing the Checkout Link on the Document Information Page with Profiles


Hey all, 

Below is a fun code trick from William Phelps. Better bookmark this, because it's a good one!



One request that comes up from time to time is a need to remove the checkout link (or 
other functional links) from the document information page.

In the first image in the following screen print, there is a “check out” link. However, the 
desire is to remove the link as shown in the second image.


Typically, most implementers say that a customization is necessary. However, a 
relatively simple profile rule can be created to accomplish the same thing.

If the result set name that holds the link generation data is known, it’s easy to loop 
over the result set and pick off the entry. Adding “IsPageDebug=1” to the URL of the 
document information page, and looking at the data in the final page binder section is 
an easy way to get this information. 

This article assumes that the reader has a basic working knowledge of how to create 
content profiles in Content Server, and a decent understanding of Idoc Script. For this 
article, a global rule is being created, but it could easily be adapted to only fire for 
specific profiles.

• Create a global rule with activation conditions of “OnRequest” and “Info” as 
shown.




• Clicking on the “Edit” button on the “General” tab next to the rule activation 
section, and then on the “Side Effects” tab, enter the following code in the 
custom code box as shown. 

(In the code below, the Idoc function “setResourceInclude” is leveraged to 
dynamically rewrite existing server code that normally would require a 
component customization.)


 <$setResourceInclude("docinfo_menus_update_setup","<$include   
 super.docinfo_menus_update_setup$>  
 <$loop PageMenusData$>  
  <$if PageMenusData.nodeId like \"checkout\"$>  
  <$exec rsDeleteRow(\"PageMenusData\")$>  
  <$endif$>  
 <$endloop$>  
 ")$>  




• This same technique could be used on other pages as long as the profile engine 
is invoked as part of the service execution. A good example would be 
selectively removing links on a search results page.

Thanks everyone for taking the time to review this. We hope it saves you the need for a custom component.. or two!

No comments:

Post a Comment