Add a Toolbar Button
You can customize the Query Studio toolbar by
adding buttons.
Procedure
- Stop the IBM® Cognos® service.
- Open the file c10_location/templates/ps/qs/ui.xml in an XML or text editor.
- Under the toolbarContent element, add
an ID for the new button.
The following example shows how to do this for a button named Test.
<button id="Test" />
- Save and close the ui.xml file.
- Open the file c10_location/templates/ps/qs/features.xml in an XML editor.
- Under the root element, add a new
feature element corresponding to the toolbar button defined
in the ui.xml file.
For example, for the Test button, add the following:
<feature name="Test" > <toolbar buttonType="button"> <tooltip>"Test"</tooltip> <icon> <active useWebRoot="true">qs/images/toolbar/test_button.gif</active> </icon> <action> <parameters> <parameter type="string">Test</parameter> </parameters> </action> </toolbar> </feature>
The test.gif file referenced by the icon element must exist in the c10_location/webcontent/qs/images/toolbar directory.
Note: If you are adding a corresponding menu item for the same functionality, add the button under the same feature element as the menu item, as shown in the following example:
<feature name="Test" > <menuItem type="menuItem"> <... </menuItem> <toolbar buttonType="button"> <... </toolbar> </feature>
- Save and close the features.xml file.
- In the c10_location\webcontent\qs\classes directory,
create a new JavaScript file
named CFeatureID.js.
For example, for the Test button, the file name would be CTest.js.
Note: If you are adding a corresponding menu item for the same functionality, this file is used both by the menu item and the button.
- In the JavaScript file,
define a class named CFeatureID, for example CTest, and the supporting
functions, as shown in the following example:
function CTest() { //Initialize } CTest.prototype = new AFeatureObject(); CTest.prototype.setup = function (aFeatureParams) { //setup feature parameter }; CTest.prototype.processErrorState = function() { //Handle error and return error state }; CTest.prototype.proceedWithoutDialog = function() { return this.execute(); }; CTest.prototype.execute = function (aParameters) { //Execute Feature };
- Save the JavaScript file.
- Start the IBM Cognos service.
Results
To remove a toolbar button, delete the sections of code associated with the button from ui.xml and features.xml.
Parent topic: Customize the Query Studio Toolbar and Menus