What Environment Am I in?
As I was going through some of the sessions on the QUEST NORTHEAST CONFERENCE I noticed on of the presenters mentioning customizing Test environments Main PeopleSoft CSS PSSTYLEDEF so that the users are always able to distinguish between environments.
The solution that I have employ to solve this problem is to modify the PT_BRANDING:BrandingBase class to dynamically display environment name based on the URL, like this:
PT_BRANDING Application package was meant to be used to dynamically customize the look and feel of you application and of course you can do a lot more with this but this is just a very simple example of how easy this can be done.
In order to achieve the above effect all you need is to add code to 2 methods in the class PT_BRANDING:BrandingBase
method GetUniHeaderHTML method GetUniHeaderHTML_PIA
These methods, as the name suggests are responsible for rendering you Application Portal Header.
/*Iouri Chadour - Added to put Test Environment notification in the header&Request.ContentURI - returns your portal URL in form http://server:port/psp/PSPRC/Left(Right(&Request.ContentURI, 4), 3) - extracts the significant piece to displayon the header*/ &zEnvName = Left(Right(&Request.ContentURI, 4), 3); &Greeting = &zEnvName | " Environment " | ", UserID:" | %UserId | ", Name: " | %UserDescription; /* End Mod */ /* This code below is delivered checks for client browser to ensure that Header is displayed correctly */ If &navTheme.isNS4x() Then &UniHeaderHTMLPIA = GetHTMLText(HTML.PORTAL_UNI_HEADER_NS4X, &Response.GetImageURL(Image.NEW_PS_LOGO), &Response.GetImageURL(Image.NEW_PORTAL_HDR_TBRCRV), " ", " ", &FavoritesHTML, &AddToFavoritesHTML, &HelpHTML, "", &Response.GetImageURL(Image.NEW_PORTAL_HDR_CRV), &Response.GetImageURL(Image.NEW_PORTAL_HDR_BG), &Response.GetImageURL(Image.NEW_PORTAL_HDR_BG), &Response.GetImageURL(Image.NEW_PORTAL_HDR_TBRCRV), &Response.GetImageURL(Image.NEW_PORTAL_HDR_SHD), &Response.GetImageURL(Image.NEW_PORTAL_HDR_TBR), &styleSheet, &homeURL, &startURL, &AddToFavFormHTML, &LogoutURL, MsgGetText(95, 400, "Return Home"), /*20*/MsgGetText(95, 401, "Home"), MsgGetText(95, 402, "Return to Menu"), MsgGetText(95, 403, "Menu"), MsgGetText(95, 408, "Sign out"), &Greeting, &SearchHTML, &ColSpanHTML, &PersonalizeHTML, "", "", &HelpJSHTML, &homepageJS, "", &TabHTML, &WLHTML, &domainScript, &Response.GetJavaScriptURL(HTML.PT_SAVEWARNINGSCRIPT), "", &SaveWarnCrossDomainScript, &Response.GetImageURL(Image.PT_HOME_TAB_ACTIVE_CENTER), &Response.GetImageURL(Image.PT_HOME_TAB_INACTIVE_CENTER), /*40*/&Response.GetImageURL(Image.PT_HOME_TAB_LINE), %Request.ExpireMeta, &CTIHTML, &MCFHTML, &PPMHTML, &Charset);ElseElse &UniHeaderHTMLPIA = GetHTMLText(HTML.PORTAL_UNI_HEADER_NNS, &Response.GetImageURL(Image.NEW_PS_LOGO), &Response.GetImageURL(Image.NEW_PORTAL_HDR_TBRCRV), "", "", &FavoritesHTML, &AddToFavoritesHTML, &HelpHTML, "", &Response.GetImageURL(Image.NEW_PORTAL_HDR_CRV), &Response.GetImageURL(Image.NEW_PORTAL_HDR_BG), &Response.GetImageURL(Image.NEW_PORTAL_HDR_BG), &Response.GetImageURL(Image.NEW_PORTAL_HDR_TBRCRV), &Response.GetImageURL(Image.NEW_PORTAL_HDR_SHD), &Response.GetImageURL(Image.NEW_PORTAL_HDR_TBR), &styleSheet, &homeURL, &startURL, &AddToFavFormHTML, &LogoutURL, MsgGetText(95, 400, "Return Home"), /*20*/MsgGetText(95, 401, "Home"), MsgGetText(95, 402, "Return to Menu"), MsgGetText(95, 403, "Menu"), MsgGetText(95, 408, "Sign out"), &Greeting, &SearchHTML, &ColSpanHTML, &PersonalizeHTML, "", "", &HelpJSHTML, &homepageJS, MsgGetText(95, 138, "Tool Bar Header"), &TabHTML, &WLHTML, &domainScript, &Response.GetJavaScriptURL(HTML.PT_SAVEWARNINGSCRIPT), "", &SaveWarnCrossDomainScript, &Response.GetImageURL(Image.PT_HOME_TAB_ACTIVE_CENTER), &Response.GetImageURL(Image.PT_HOME_TAB_INACTIVE_CENTER), /*40*/&Response.GetImageURL(Image.PT_HOME_TAB_LINE), %Request.ExpireMeta, &CTIHTML, &MCFHTML, &PPMHTML, &Charset); End-If;
Hi Louri,
In peoplesoft personalisation if user gives greeting text. it will override with the Greeting variable value.
This site is very good.
That is correct Srinivas – I am reusing this variable. I also suggest using this only in Test environments, I do not think this should be used in Production. Thanks a lot for a feedback.
does it work on Tools 8.50? both methods had some significant changes related to UI so just checking to see if it works or not. As this was posted before 8.50, please update it for new tools so we all can see if we could use it.
thanks for all your tips.
Thanks for a question. I am still in process of installing 8.5, however I do not foresee any problems for this particular code. I will keep you posted.
Hi Louri,
did you get a chance to test it on tools 8.50? It did not work for me and also tried to fix it but not successful.
thanks for your help.
Hey there, I wish I did – I have not had a chance to install 8.5 yet. I got tied up with other work. But thanks for reminding and I will keep you posted
I finally had a chance to install 8.5 and here is the solution – you have to put the code in
PT_BRANDING:BrandingBase
method getIframeHeaderHTML
/*Iouri Chadour - Added to put Test Environment notification in the header&Request.ContentURI - returns your portal URL in form http://server:port/psp/PSPRC/Left(Right(&Request.ContentURI, 4), 3) - extracts the significant piece to displayon the header*/
&zEnvName = Left(Right(%Request.ContentURI, 4), 3);
/* End Mod */&greeting = &zEnvName | " Environment " | ", UserID:" | %UserId | ", Name: " | %UserDescription;
right before:
/* add &addjs to PT_IFRAME_HDR_SWAN (bind 22) and PT_IFRAME_HDR(bind 23) */
If &hdrLink.isSwan Then
Let me know if you have any questions and thanks for good questions!
Louri,
Thanks for great help.
I tried this but I was not able to save the code after change as I was getting this message “Variable &zEnvName was not declared. (2,91)”.
I am sure I did not declare this in 8.4x tools.
let me know one more time.
thanks,
Venu.
Sorry it took longer – for some reason I did not get this comment in the email. Anyways try to declare &zEnvName in the beginning of the method as follows:
Local string &zEnvName;
Worked a treat for us – and solved a significant conundrum for us! (Sorry to be so late to the party. Any beer left?
Thank you Dennis, appreciate your comment. Sorry for the late reply. Beer is here every Friday 😉
hi ..I dont want userid but the user name ..can I know whats the variable name to be used instead of UserId..
Aravind, sorry for the late reply – please use %UserDescription variable for that