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'))"> </out:if>
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'"/> </xsl:call-template> </out:if>
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.
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?
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′) +’)’,’ = ‘)#
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 mainpresentation.xsl only goes upto line 4461 !
Can you help further please ??
Thanks
Dean
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).
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
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 ??
Thanks
Dean
There are two files called presentation.xsl. The one with IDS_ACT_MORE is .templatespslogicsheetspresentationmainpresentation.xsl.
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, ”);
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.
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
http://www.cognoise.com/community/index.php?topic=17976.0
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 ๐
charon
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 ..templatespsportalpreferencescommonresponsepreferences.xslt. Look for the group
The out:if test should work fine there.
The value prompt for separators can be found in the following section of the same file:
Just delete or use the out:if on the line option.
Changes to the internal files may require deleting or renaming ..c10_64webappsp2pdWEB-INFlibportal.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.
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
ืฉืืื ืกืื ืืกืื! 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.
ืชืืื ืจืื
Exactly what I looked
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.
Thanks,
Sean
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.
Thanks,
Paul
Hi Paul,
After I setup my custom group using the IBM link it did work.
Thanks!
Sean
Hi Paul,
Very nice blog!
For those customizing parts of cognos not shown above
(for example templatespsportalccgen_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.
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…
Hi Prikala,
I appreciate the heads up. You can insert XML code with
Just use sourcecode and /sourcecode (with square brackets).
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
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.
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.
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
Sean
Hi Paul,
This was a great post! I have the same question as Sean above me, but specifically in regards to custom actions. I was able to hide a custom action using the methods described in this post, but it still appears in the “More…” actions page.
I did take a look through the xsl files in this post, and searched a few others, but was unable to find anything. If you get another chance to investigate this area again, I’d appreciate it!
Hi Dan,
I’m pretty certain the file should be ..\c10_64\templates\ps\portal\actions.xts. It has the code blocks for all of the options, with additional to determine what should appear (for example, delete won’t appear for objects in read only folders).
Paul,
One of my client is asking me to remove “Edit the option…” link after “Send the report by email” checkbox in Run with Advanced Option page. This text is actually defined in as a resource in \template\ps\message\portal.xml file, with id IDS_OTHERRUN_SET_EMAIL. So I searched all files that contains this id and commented out the XML element, to . However, the link still showed up after I restarted Cognos.
Do you know if Cognos still uses those xslt files to generate html pages, any reason my change wouldn’t work? I am using Cognos 10.2.1.
There’s a file called portal.jar under webapps\p2pd\WEB-INF\lib\. That contains a compiled copy of all of the xts/xsl files. Remove or rename that and restart, and things should hopefully work.
add me to distribution list pls.
I found out that some .xsl/.xts files on disk are never read by Cognos, and my three files are in the list. That is why I cannot see the changes. I may have to contact IBM see if they can provide some help.
Hi Paul. Should this be the same for 10.2.1? My system.xml doesn’t seem to have a ui_hide parameter in it?
The ui_hide parameter needs to be added to the xml file, it’s not there by default.
Ok so I added the ui_hide parameter manually in the system.xml. My problem now however is with the preferences.xslt as it won’t launch my preferences throwing the below error… Do I need to define it somewhere first?
javax.xml.transform.TransformerConfigurationException : jd.xml.xslt.parser.XsltParseException: variable ‘ui_black_list’ is not defined (baseUri=’xts://format’ Element=out:if (line 299))
There are a couple of system.xml files, which one are you changing?
So I added(or modified) this in the preferences.xslt file found in templates_ps_portal_preferences_common_response…
Then this is the modification at the end of the system.xml file in templates_ps_portal
…
Not sure that pasted properly.
So I added(or modified) this in the preferences.xslt file found in templates_ps_portal_preferences_common_response…
Then this is the modification at the end of the system.xml file in templates_ps_portal