Monday, January 5, 2009

PT_BRANDING - App Package pcode changes


Here is a great mod to change the greeting within your PIA environment.

PT_BRANDING.BrandingBase.OnExecute (Application Package Peoplecode)

Within this method:

method GetIScriptHPDefaultHdrHTML
/+ Returns String +/;

Local string &ActiveTab, &PersHTML, &TabHTML, &cookieJSURL, &refreshHPJSURL, &Today, &Greeting, &homepageJS, &EntHeaderHTML;

Local ApiObject &Portal;

REM Get the active tab;
&ActiveTab = %Request.GetParameter("tab");

&Portal = PortalOpen();
%This.GetHPTabHTML(&Portal, &ActiveTab, &PersHTML, &TabHTML);
/* Start - ASU_UT0100 - 11/2007 - J.McMahon - Adding user and environment to branding */
/* &Greeting = &Portal.Homepage.Greeting; */
Local string &Current_date;
SQLExec("Select to_char(SYSDATE,'MM/DD/YYYY') from DUAL", &Current_date);

&Greeting = %UserId | " on " | %DbName | " " | &Current_date;
/* ASU_UT0100 - End */
&Portal.Close();


&cookieJSURL = %Response.GetJavaScriptURL(HTML.PORTAL_COOKIE);
&refreshHPJSURL = %Response.GetJavaScriptURL(HTML.PORTAL_REFRESHPAGE);
&homepageJS = GetHTMLText(HTML.PORTAL_HP_JS_INCLUDE, &cookieJSURL, &refreshHPJSURL);

&Today = "";

&EntHeaderHTML = %This.GetUniHeaderHTML(&PersHTML, &Today, &Greeting, &homepageJS, &TabHTML);

Return &EntHeaderHTML;
end-method;

Also, change within this method: GetUniHeaderHTML

/* Start - ASU_UT0100 - 11/2007 - J.McMahon - Adding user and environment to branding */
/* &Greeting = &Portal.Homepage.Greeting; */
Local string &Current_date;
SQLExec("Select to_char(SYSDATE,'MM/DD/YYYY') from DUAL", &Current_date);


&Greeting = %UserId | " on " | %DbName | " " | &Current_date;
/* ASU_UT0100 - End */

18 comments:

Ciphersbak said...

Hi Jeromy,

Gr8 Post ... i 2 have customized the App Package PT_BRANDING by adding direct links alongside the Home/Worklist/Signout Links...which point directly to a Cref ... Will surely go ahead and add this ...

Great Work...

Thank You
Prashant

Jeromy McMahon said...

Thanks! I appreciate it!

Jim Marion said...

Jeromy, I noticed that you are overriding the value of &Greeting. &Greeting is a field on the "Personalize Content" page that allows a user to set his/her personal greeting. What do you think about concatenating that value (&Portal.Homepage.Greeting) with OPRID, DB Name, etc?

Jeromy McMahon said...

Hey Jim, thanks for the comments. I will check that Portal variable out. Might be a better solution.

Thanks
Jeromy McMahon

Chenchuraman said...

Hi Jeromy,

This Greeting will disappear once the user started navigating to folders.
What if i want to have the UserID and DBName on the top even when the user drill down.

Any idea appreciated.

Thank You
Chenchu

Jeromy McMahon said...

You have to make sure you update the pcode in a few places so that when a user navs it will continue to remain.

Thanks
Jeromy

Ciphersbak said...

Hi Chenchu,

You need to ensure that your customizations are in both the methods
1. GetUniHeaderHTML_PIA
2. GetUniHeaderHTML

Thanks!
Prashant

Chenchuraman said...

Hi,

Prashant, as you said, I have customized 'GetUniHeaderHTML_PIA'. It looks perfect.
Thank you very much.

Jeromy, Thank you very much.

Thanks,
Chenchu.

Anonymous said...

Hi All,
This site is very helpful for me to learn more about PS. Could any one please advice me, that what can be the value addition that we can perform in PS. My client is using full of SQR. PS 8.8 is version we are using.

Thanks,
Jaggi

Anonymous said...

This method isn't working for 8.50.xx tools. It worked for me on 8.47.xx.

Could you guys update it for 8.50?

I have tried it but not able to port it. It is not working as there are some changes to both methods.
Thanks,
Venu.

Jeromy McMahon said...

Within Tools 8.5, you will need to also update this method getIframeHeaderHTML

Local string &Current_date;
SQLExec("Select to_char(SYSDATE,'MM/DD/YYYY') from DUAL", &Current_date);


&greeting = %UserId | " on " | %DbName | " " | &Current_date;

/* Modification - End */

REM link seperator HTML;
Local string &sepHTML = GetHTMLText(HTML.PT_IFRAME_HDR_LINK_SEP, "", " ");

Nyc_Dude said...

Hello, Am wondering if there is a way to change IE ico on the Application pages, once user logged into,(not signin.html).?
So far I tried to replace PTBROWSER_IE(small E) with custom pic, is there a way?

Thanks
Nyc_dude.

Jeromy McMahon said...

I think you will have to update the page source within the portal code. I will do some more digging.

The normal way to handle this with HTML is within this sample.

You need to create a favicon.ico file. You can make one at http://www.favicon.cc/ .

Then put this html code in the head section of your pages:

<

"link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"
/>

Jeromy McMahon said...

Actually in reviewing this, all you would need to do is place whatever *.ico file you want and update the start page HTML.

<
LINK REL="SHORTCUT ICON" HREF="<%=psHome%>/favicon.ico"

>

Update "favicon.ico" to another *.ico that you would like to use.

Nyc_Dude said...

LINK REL="SHORTCUT ICON" HREF="%=psHome%/favicon.ico" , This works with signin.html pages,
am question is after once logged into, control goes to application pages, where it uses App package PT_BRANDING peoplecode and calls PT_NAV and other peoplecode to construct application pages, so I am trying to modify html.PORTAL_UNI_HEADER_NS4X_SWAN and pass bind variable using app package, PT_BRANDING BrandingBase peoplecode, not sure if this works?

Saeem said...

is there any way to change the portal greetings dynamically, suppose i have a field NAME and a push button in my page, when I click on the push button whatever value is ther in the Field NAME should appear as the portal greeting.
I dont want to make any modifications to PT_BRANDING.

Is ther anythin that could be done with PORTAL_UNI_HEADER_NEW html.

Jeromy McMahon said...

Saeem, I think you will need to update the PT_BRANDING code to make this happen. I will review and see if there is another option here.

Saeem said...

Hi Jeromy,
A solution at the earliest will be grtly thankful.

IS there any way the same can be done with function. I am new to app packages.