Hiding Cognos Connection Elements

Hiding Cognos Connection Elements

By default Cognos offers a ride range of UI options. Based on the group or role you can programmatically decide who can see which UI Elements. A simple modification of the system.xml file is all that is needed to take care of this.

The Admin and Security guide, which can be found in the \webcontents\documentation\en\ug_cra.pdf, has an excellent article on how to accomplish this. You can also find the article online here.

The full list of elements that you can hide can also be found in the guide, or online here.

While those links are for 8.4, they are essentially identical for 8.4.1 and 10.1.

But what happens when you have a requirement to remove elements that don’t appear in the list? This is possible by modifying one of the template files that controls the structure of the portal. These files are saved as XSL files, and are easily modified using any text editor. I strongly recommend using a text editor with XML support, such as Notepad++.

Before I continue, it’s worth mentioning the following. Changing these files may be risky. A misplaced semicolon will prevent Cognos from loading, and IBM has a tendancy not to support installations that have modified the Cognos internals. These changes will also be overridden by any patches or upgrades.

Always make a backup of any files you modify. When trouble does occur and you need IBM’s help, simply switch the active files with the backup, and IBM will be none the wiser (and if the problem is fixed, you know where to look).
You should also maintain a change log of everything you do. Upgrades will replace the template files, and there may be differences between the versions. Instead of simply overwriting the upgraded version with your modified version, you should make all the changes again manually. Fortunately (unfortunately?) patches and version upgrades tend to be rare occurrences.

A brief explanation of the files to modify:

There are two primary XSL files which control the portal.
1. \templates\ps\logicsheets\presentation\controls\presentation.xsl
2. \templates\ps\logicsheets\presentation\main\presentation.xsl

The \controls\presentation.xsl renders, among other things, the HTML behind tabs, and the rows and columns in the Public Folders/My Folders table.

The \main\presentation.xsl renders the links to the correct style sheets, the page headers, and the individual links in the Public Folders/My Folders table.

Between the two, they control the HTML between most of the objects you see on the page.

The system.xml file that contains the UI black list can be found in \templates\ps\portal\system.xml

And now the problem. The client has decided that no user, except administrators and report authors, should be able to see the Properties or More… links for any reports or folders.

First, hiding the properties.

In the \main\presentation.xsl do a search for action_properties.gif. There should be four instances of that string. Each of these instances controls the properties for a different type of object. Series 7 object, CRN object, Job and… well, I’m not entirely sure what the fourth one is for, but I’m sure it’s very important. 5 points to whoever enlightens me.

In each of these four cases the action_properties.gif is part of a xsl:call-template reference.

This statement is calling the renderActions template with values for the onclick, icon and tooltip parameters.

In order to prevent this segment from being rendered we need to add it to the “Elements you can hide” list. The code that controls items on the list is as follows:

<out:if test="not(contains($ui_black_list, 'NAME'))">			

This will check the system.xml for an appearance of NAME in the ui_hide list. Should it appear, it will not render anything inside the code block except for users or groups listed in the show parameter. Knowing this, all that is needed to hide the properties is to add the black list code to all four appearances of the renderAction call.

		<out:if test="not(contains($ui_black_list, ' PROPERTIES '))">			
			<xsl:call-template name="renderAction">
				<xsl:with-param name="onclick">actions('{xtsext:javascriptencode(string($obj-name))}', '{$obj-class}', '{xtsext:javascriptencode(string($obj-path))}','properties_general.xts');</xsl:with-param>
				<xsl:with-param name="icon" select="'action_properties.gif'"/>
				<xsl:with-param name="tooltip" select="'IDS_PROPERTIES'"/>

In this case, I set the black list name to PROPERTIES. Now, in the system.xml simply add the following to the ui_hide param:

	<PROPERTIES show ="Administrators RSUsers"/>

When you restart, only administrators and authors will be able to see the properties for any object.

Now for the More…

The technique to hide the “More…” link is almost identical.

Simply find all occurences of IDS_ACT_MORE in the same file. In my modified file all occurences appear between lines 4640 and 4722. Thanks to Notepad++’s XML support, I can see that all of these are held inside a single group.

Instead of black listing each individual appearance of the More… link, let’s try black listing the entire group.

Now to add MORE to the system.xml black list

As before, only administrators and authors will be able to see the More… link.

The following shows how folders look to normal users:

And this is what reports look like:

It’s very important to do extensive tests to ensure this meets the client needs. You could probably also reverse the black list by getting rid of the “not()” from the code. Remember that the idea behind this article is not to simply show how to hide specific elements from the Cognos Connection. It’s to show how easily it is to shape Cognos to meet your needs. The XSL sheets are there to be modified.


25 Responses to Hiding Cognos Connection Elements

  1. Rookie says:

    I am a rookie Cognos developer (8.4.1) and I have a prompt requirement that I need help with. I have many regiosn on my database but the report is only concerned with 6. So I have a query with the 6 in the filter to build the drop down prompt. The prompt needs to be optional so if they select 1 from the prompt they only want the one region but if they select nothing they only want to see the 6 not all that are available in the database. The data type of the region is text and I do not have the ability to change the framework. Can you suggest a solution please?

    • cognospaul says:

      The best place to ask questions like these would be on the Cognoise forum.

      Your filter probably looks something like [NS].[Table].[Region] = ?Region?

      That is caused a prompt alias. Easy to use, but it doesn’t have as options as a prompt macro. I recommend looking at the article I posted about prompt macros.

      As for the answer to your question, try something like the following:

      [NS].[Table].[Region] #prompt(‘Region’,’string’,’ in (‘+sq(‘Region1′)+’, ‘+sq(‘Region2)+’, ‘+sq(‘Region3′)+’, ‘+sq(‘Region4′)+’, ‘+sq(‘Region5′)+’, ‘+sq(‘Region6′) +’)’,’ = ‘)#

  2. Dean says:

    Hi Paul,
    I’ve followed your blog around hiding properties for consumers which has worked ok in public folders. I’m a bit lost as to where to place the code to hide the More action.
    I’m using notepad++ but the code in \main\presentation.xsl only goes upto line 4461 !
    Can you help further please ??


    • CognosPaul says:

      Hi Dean,

      It’s possible that we’re working on different versions of Cognos. My test environment is now 10.1.1. The variable names should remain the same however. Do a search for IDS_ACT_MORE. That string should be repeated 10 or so times in the same area. Each group controls the More link for a different object type. You can use this method to hide the More from specific types (put it inside the individual out:when), or the entire thing (wrap the entire xsl:choose).

    • Dean says:

      Thanks for the reply.
      Yes we have different versions we are still on 8.4 !
      I’ll have a mess and see what happens ๐Ÿ™‚


    • Dean says:

      Hi Paul,
      Only just getting back to this!
      I’ve searched in presentation.xsl for IDS_ACT_MORE but it is not present in the file!
      Any ideas ??


      • CognosPaul says:

        There are two files called presentation.xsl. The one with IDS_ACT_MORE is .\templates\ps\logicsheets\presentation\main\presentation.xsl.

        • Dean says:

          Hi Paul,
          Me being a bit quick of the mark and posting I think, forgot there were 2 files!!
          I now have this working in 8.4, This is the code I’ve wrapped to exclude. Works lovely except in portals already in use! any ideas how to exclude in portals or would I need to recreate the portals for it to take effect ??

          actions(”, ”,”,’actions.xts’, null, ”);

          • CognosPaul says:

            I’m guessing you’re talking about the navigator portlet? I honestly not sure. There may be another file that controls the navigator. I won’t be connecting to a cognos server until Sunday – until then check in the portal ps folders.

            If you do find that the navigator is controlled by another file let me know and I’ll update the post.

  3. mike charon says:

    Hi Paul,

    i am new to Cognos, just getin the COG 612 next week.
    Started to execute a task customizing Cognos Connection UI, and have a big problem:
    i can not find the right position/ xml file.

    After reading Cog Administration and Sec. Guide i think i know how to hide UI objects using
    and so on, also you tip with markin other objects so its possible to put them on this list as well works brilliant (thank you for this one :D)

    But what i am trying to do is to hide a menue/ option in “my area/my preferences”, hiding the radio button for “welcome screen” e.g.

    I already posted in cognoise
    but sadly nobody responded for now.

    Do you have any idea where to find the correct position of the “my preferences” options and how to manipulate/ hide them?

    Thx a lot
    ur new fan ๐Ÿ˜€

    • CognosPaul says:

      Hi Charon,

      I just answered on Cognoise, but I’ll answer here for people from the future with the same question.

      Those options are generated in ..\templates\ps\portal\preferences\common\response\preferences.xslt. Look for the group

      				<lyt:section width="70%">																	
      					<!-- Format :  -->
      					<out:copy-of select="$format"/>											
      					<!-- Show Welcome page -->
      					<out:copy-of select="$showWelcomePage"/>
      					<!-- Run Options Confirmation  -->
      					<out:copy-of select="$showRunOptionsSummary"/>		
      					<!-- Accessibility support for reports -->	
      					<out:if test="count(/root/configuration/property[@name='overrideOptions']/*/value/item[name='http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures'])!=1">	
      						<out:copy-of select="$enableAccessibilityForReports"/> 

      The out:if test should work fine there.

      The value prompt for separators can be found in the following section of the same file:

      	<out:variable name="listViewSeparator">
      				<xts:string id="IDS_PERS_TAB_GENERAL_SEPARATORS"/>
      				<utml:select name="m_po_listViewSeparator">
      						<out:value-of select="$defaultValues/param[@name='listViewSeparator']"/>
      					<utml:option value="line"><xts:string id="IDS_PERS_TAB_GENERAL_SEPARATORS_OPTION_GL"/>	</utml:option>
      					<utml:option value="background"><xts:string id="IDS_PERS_TAB_GENERAL_SEPARATORS_OPTION_AB"/>	</utml:option>
      					<utml:option value="none"><xts:string id="IDS_PERS_TAB_GENERAL_SEPARATORS_OPTION_NS"/>	</utml:option>

      Just delete or use the out:if on the line option.

      Changes to the internal files may require deleting or renaming ..\c10_64\webapps\p2pd\WEB-INF\lib\portal.jar. That jar contains the compressed versions of many (but not all) of the internals. I usually just rename it to portal.jar.bak. If Cognos doesn’t find the jar it will use the live versions in the templates folder.

      I’ve had a lot of success removing options from the preferences page, but I haven’t had much luck adding a new session parameter.

  4. Stanislav says:

    Hi, Paul
    I’m looking for method to add users and groups to Cognos 10.1 (Not by LDAP or custom java provider)) if you can help me?.
    BTW: according to images attached to this paragraph you can write me on your local language

    • CognosPaul says:

      ืฉืœื•ื ืกื˜ื ื™ืกืœื‘! My Hebrew isn’t that great (after all, I’ve only lived here 15 years), so I’ll stick with English.

      If you don’t want everyone to log on as anonymous, you’ll need some sort of authentication provider. There are a number of free authentication providers available, such as OpenLDAP, that you can use.

  5. Sean says:

    Hi Paul,

    Is there a way to do the permissions but flipped? Say I want to only exclude page elements from one group and leave the elements for all other groups.


    • CognosPaul says:

      Hi Sean,

      The conditional statement is out:if test=”not(contains($ui_black_list, ‘NAME’))”. To flip it you just need to get rid of the not(). Well, that should be the way, I haven’t actually tried it yet. Try it and let me know if it works.


  6. prikala says:

    Hi Paul,
    Very nice blog!

    For those customizing parts of cognos not shown above
    (for example templates\ps\portal\cc\gen_page.xslt):
    “out:if” syntax is enabled by

    at the start of the presentation.xml.
    If you are customizing gen_page.xslt where “out” is undefined, use “xsl:if” instead.

    • prikala says:

      after “enabled by” I meant to copy the xsl expression defining “out” as namespace-alias for “xsl” but xml/xsl is not allowed in comments…

      • CognosPaul says:

        Hi Prikala,

        I appreciate the heads up. You can insert XML code with

        <out:variable name="user_skin">
        		<out:when test="key('env-param', 'skin') != ''">
        			<out:value-of select="key('env-param', 'skin')"/>
        		<out:when test="key('user-param', 'skin') != ''">
        			<out:value-of select="key('user-param', 'skin')"/>
        			<out:value-of select="key('system-param', 'defaultPortalPreferences')/pref[@name='skin']"/>

        Just use sourcecode and /sourcecode (with square brackets).

  7. Abhi says:

    Hi Paul
    I want to hide the “More..” button within only 1 specific folder inside the Public Folder for all the users .Pls can you share with me how to achieve this .

    Do we have to specify a path of that given folder within XML or do something else ?It would be of great help

    • CognosPaul says:

      I’ve been looking into it, but I don’t think there’s a way. You should open an enhancement request with IBM for this; the idea being the more people who do, the more likely it is to actually happen.

  8. Ashok says:

    Need Help Customizing the Cognos Search Portlet in Cognos Portal Page.

    New Page is created on Cognos Connection and that page has Cognos Search on it.In Cognos Search if you click advanced you will see ‘Type’.How to remove the unwanted Values in the Dropdown and how can i make my prefered value as Default?Thanks for the help.

  9. Sean says:

    Hi Paul,

    Thank you for the wonderful blog on this topic. I’ve been asked to remove the copy/cut/paste button from Cognos Connection from all Consumers and Enhanced Consumers, and I’ve managed to do that by following the Cognos ‘Administer & Deploy’ document. There is one other location where the user can still copy reports/folders/packages, and that’s clicking the ‘More’ properties, under Available actions. The available options allow users to Set properties, View report out versions, … Move, Copy, Create a shortcut to this entry …

    Is there a way to ‘hide’ these options by the method you described in your blog, or any other method that you know of? We’re running Cognos 10.2 distributed environment, with 1 gateway, 1 Content Manager, and 2 dispatchers. Thanks for the help, Paul


  10. Murugan says:

    hi Paul,

    how do we hide create a report view and Schedule icon from Cognos connection.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: