Sometimes it is required to change the "Default timezone" of Resources when they are added through Studio or XOG/WebServices. Here is the way :-
Step 1 : Open C:\Niku\Clarity\config\i18n.xml
Step 2 : Change defaultTimeZoneId at Line #3
Tip : To find the timezone code, Open Account Settings page in Clarity and find it by looking into HTML Source of the webpage..
Note : Changes may need to re-applied after any Fixpack or version upgrade..
Showing posts with label Studio. Show all posts
Showing posts with label Studio. Show all posts
Tuesday, July 22, 2008
Monday, July 21, 2008
[3] Display logged in user name in Clarity Studio
Displaying logged in user name in Clarity Studio is a kludge. Implementing it in 8.1 is different than in 7.5.x. User Name can be displayed on top of Left Menu Navigation bar. Lets see how they can be implemented in both 7.5.x and 8.1 :-
Clarity 7.5.x
--------------

Steps :-
Step 1 : Open/Edit : C:\Niku\clarity\META-INF\union\xbl\menu\getMenu.xbl. Add following line just above the last line ( which contains says “</xbl:template>”)
<user userName = "{$userName}" userFirstName = "{$userFirstName}" userLastName = "{$userLastName}" />
Step 2 : Open/Edit C:\NIKU\clarity\META-INF\union\vxsl\menu.xsl. Add following after around 6th line and above line which says “<view type=navigation>”
<xsl:value-of select="concat(user/@userFirstName,' ',user/@userLastName)" />
Step 3 : Restart/Refresh app service and Refresh the page
Clarity 8.1
------------

Step 1 : Create Portlet Page (say Name: "My page", id:my_page)
Step 2 : Create Application Menu > Create Section (Name:Welcome, id:welcome_home) > Create Link (LinkName: USERNAME, PageName: My Page, ParentMenuItem:Welcome) > Reorder Menu items and Push "Welcome" to top.
Step 3 : If you wish to show User Name is Administration Menu, then repeat Step 2 for Administration Menu as well. Only difference keep Section id as 'welcome_admin'.
Step 4 : Open C:\Niku\Clarity\META-INF\union\pmd\personalization.xml. Locate "union.getMenuItems" SQL Statement (approx Line# 102). Be careful here... This SQL statement contains 2 Select statements separated by UNION. We need to focus on Second one (which is below '<!--Second half is for custom pages, including custom object lists-->' comment)
In Second SQL :-
REPLACE : ac.name
WITH : CASE WHEN ac.name = 'USERNAME' THEN </text></sql>
<sql dbVendor="oracle">
<text>
(Select First_name || ' ' || Last_name from srm_resources where user_id = ?)
</text>
</sql>
<sql dbVendor="mssql"> <text>
(Select First_name + ' ' + Last_name from srm_resources where user_id = ?)
</text>
</sql><sql><text>
ELSE ac.name
END name
Add following parameter as 9th parameter in list (after param replace="language" one which is 8th parameter)
<param replace="userId"/>
Verify if changes done looks like below (click to enlarge) :-

Step 5 : Give "My Page" access to all the resources by either setting as group or OBS global right. This is required to display Welcome menu section. [ As an alternative to giving Rights to all users, I updated POLICY_ID to NULL for "My Page" in CMN_ACTIONS table and it did work for me, though I am still testing this alternative..]
Step 6 : Restart/Refresh App to reflect the change..
------------------------------------------------------------------------------------------
Note : Intended for Testing/Research purpose only. New Fixpack/upgrade may overwrite these changes which may require to reapply these changes.
* It was the time when I was just new to Clarity and attending Bootcamp class.. I asked instructor if there is anyway to display logged in User name on Clarity Studio screen. I was told that it only displays in About window when it is Clicked. I researched a bit looked into Clarity XML code and thought I will try that tonight and it should not be tough.. That night when I started looking into things then it appeared that it was not that easy that I initially thought... After many failures and spending two sleepless nights, finally it was SUCCESS.. Next day in class I was quite sleepy but was excited to tell instructor that it's 'done'. It was 2 lines of codes in 2 files but it took 2 days for me.. It was also probably my first post at Clarity Forum (support.niku.com). This worked well in 7.5.x but it didn't work in 8.1. After some digging, kludge for 8.1 also evolved. Approach of which is different than 7.5.x and involves more number of steps.
Clarity 7.5.x
--------------
Steps :-
Step 1 : Open/Edit : C:\Niku\clarity\META-INF\union\xbl\menu\getMenu.xbl. Add following line just above the last line ( which contains says “</xbl:template>”)
<user userName = "{$userName}" userFirstName = "{$userFirstName}" userLastName = "{$userLastName}" />
Step 2 : Open/Edit C:\NIKU\clarity\META-INF\union\vxsl\menu.xsl. Add following after around 6th line and above line which says “<view type=navigation>”
<xsl:value-of select="concat(user/@userFirstName,' ',user/@userLastName)" />
Step 3 : Restart/Refresh app service and Refresh the page
Clarity 8.1
------------
Step 1 : Create Portlet Page (say Name: "My page", id:my_page)
Step 2 : Create Application Menu > Create Section (Name:Welcome, id:welcome_home) > Create Link (LinkName: USERNAME, PageName: My Page, ParentMenuItem:Welcome) > Reorder Menu items and Push "Welcome" to top.
Step 3 : If you wish to show User Name is Administration Menu, then repeat Step 2 for Administration Menu as well. Only difference keep Section id as 'welcome_admin'.
Step 4 : Open C:\Niku\Clarity\META-INF\union\pmd\personalization.xml. Locate "union.getMenuItems" SQL Statement (approx Line# 102). Be careful here... This SQL statement contains 2 Select statements separated by UNION. We need to focus on Second one (which is below '<!--Second half is for custom pages, including custom object lists-->' comment)
In Second SQL :-
REPLACE : ac.name
WITH : CASE WHEN ac.name = 'USERNAME' THEN </text></sql>
<sql dbVendor="oracle">
<text>
(Select First_name || ' ' || Last_name from srm_resources where user_id = ?)
</text>
</sql>
<sql dbVendor="mssql"> <text>
(Select First_name + ' ' + Last_name from srm_resources where user_id = ?)
</text>
</sql><sql><text>
ELSE ac.name
END name
Add following parameter as 9th parameter in list (after param replace="language" one which is 8th parameter)
<param replace="userId"/>
Verify if changes done looks like below (click to enlarge) :-
Step 5 : Give "My Page" access to all the resources by either setting as group or OBS global right. This is required to display Welcome menu section. [ As an alternative to giving Rights to all users, I updated POLICY_ID to NULL for "My Page" in CMN_ACTIONS table and it did work for me, though I am still testing this alternative..]
Step 6 : Restart/Refresh App to reflect the change..
------------------------------------------------------------------------------------------
Note : Intended for Testing/Research purpose only. New Fixpack/upgrade may overwrite these changes which may require to reapply these changes.
* It was the time when I was just new to Clarity and attending Bootcamp class.. I asked instructor if there is anyway to display logged in User name on Clarity Studio screen. I was told that it only displays in About window when it is Clicked. I researched a bit looked into Clarity XML code and thought I will try that tonight and it should not be tough.. That night when I started looking into things then it appeared that it was not that easy that I initially thought... After many failures and spending two sleepless nights, finally it was SUCCESS.. Next day in class I was quite sleepy but was excited to tell instructor that it's 'done'. It was 2 lines of codes in 2 files but it took 2 days for me.. It was also probably my first post at Clarity Forum (support.niku.com). This worked well in 7.5.x but it didn't work in 8.1. After some digging, kludge for 8.1 also evolved. Approach of which is different than 7.5.x and involves more number of steps.
Subscribe to:
Posts (Atom)
