jump to navigation

A Custom Message on the Signon Page (part 4) November 14, 2007

Posted by Duncan in PeopleTools.
trackback

Hopefully, this will be the final installment!

I’ve taken the reference link provided by Joe Ngo’s comment on part 3 and we now have a version that works across IE and Firefox. It only requires the PIA to be rebooted once, and the only files you need to create/change are the signin.html file and the file containing your message. This solution also gracefully handles the situation if your file doesn’t exist.

No screenshot this time as it looks the same as in part 3, but here’s the code:

1) Create a Message File

Create a file called MOTD.html (or whatever you wish) and place it in the ‘<pshome>\webserv\<domain>\applications\peoplesoft\PORTAL\’ folder. Then make sure you can access it using ‘http://<server&gt;:<port>/MOTD.html’ from your browser. Note this URL for later.

2) Edit Signin Page

Edit signin.html (under the above path, plus \WEB-INF\psftdocs\<PIA>\)

3) Create Place-Holder Div

Look for the section near the bottom with the text ‘tracelink’ in. Add the line in red below:

<td><div align="center">
   <div id="updateDiv" style="font-family: Arial; font-size: 9pt; color: red;"></div>
   <p class="pslogintext"> <%=traceLink%> </p>
   <p class="psloginerror"> <%=error%> </p>
   <p class="psloginerror"> <%=ps.discovery.error%> </p>
</div></td>

This is a place-holder for our message. Giving the Div a name allows us to easily refer to it in JavaScript, and we are also applying a style at Div level to the text that we will insert.

4) Set the Script up to be called on Load

Alter the Body tag to read as follows (section to add in red – change the url to the one you used previously):

<BODY onLoad="setFocus();include('http://<server>:<port>/MOTD.html'); <%=framebreak%>">

This is all on one line in the HTML.

5) Add the script

In the scripts section, add the following script (add all the lines, regardless of what colour I’ve made them):

function include(url) {
 var xmlhttp=false;
 /*@cc_on @*/
 /*@if (@_jscript_version >= 5)
 // JScript gives us Conditional compilation, we can cope with old IE versions.
 // and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
 try {
  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
  xmlhttp = false;
  }
 }
 @end @*/
 if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 try {
  xmlhttp = new XMLHttpRequest();
  } catch (e) {
  xmlhttp=false;
  }
 }
 if (!xmlhttp && window.createRequest) {
 try {
 xmlhttp = window.createRequest();
 } catch (e) {
 xmlhttp=false;
 }
 }

 xmlhttp.open("HEAD", url, true);
 xmlhttp.onreadystatechange=function() {
 if (xmlhttp.readyState==4) {
  //alert("Status is "+xmlhttp.status);
  if (xmlhttp.status==200) {
   xmlhttp.open("GET", url ,true);
   xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
     newParagraph = document.createElement('p');
     newText = document.createTextNode(xmlhttp.responseText);
     newParagraph.appendChild(newText);
     document.getElementById('updateDiv').appendChild(newParagraph);
     }
    }
   xmlhttp.send(null)
   }

  }
 }
 xmlhttp.send(null)

}

The above was combined from a number of sources rather than something I’ve written from the ground up and I’ve no claims to being a JavaScript expert but, if it’s not a language you’re familiar with, the section in Red determines your browser and selects the correct XMLHttpRequest type to use, the Green section tries the URL to check if it exists, and if it does the Blue section inserts a paragraph element into our Div with the text from the file at the URL.

Final Step

Bounce your PIA and you should see your welcome message.

Note: It has been mentioned that although this works on Tools 8.48, it doesn’t work reliably on 8.49 and the message text may get truncated. This may be related to WebLogic 9.

Advertisements

Comments

1. Jim Marion - November 15, 2007

Using Ajax on the signon template is a very clever idea.

I’m not sure why this solution would work any differently on PT 8.48 or PT 8.49. What you are serving is plain HTML, and web servers are pretty good at that. I think what I would do, just to verify that everything is downloading, is use the Firebug plugin with Firefox so you can see the XHR response. If you don’t see the contents of your entire MTD.html in the Net tab of Firebug, then you will know that Weblogic is not serving the entire file.

You might want to look at jQuery for your ajax implementation. I find it to be much easier to work with than writing and maintaining my own Ajax functions. If you minify it and use a GZip servlet filter, the jQuery library download size is only a couple K. Using jQuery, you can also animate the message after it is loaded, for example, fadeIn, etc.

Another alternative is to enable public signon in your web profile and add the signon pagelet and an MTD pagelet to the Guest homepage tab.

2. Graham - January 2, 2008

In tools 8.49 weblogic.xml contains a directive for reloading servlets but NOT for reloading static resources.

Simply add in the following tag inside the to have weblogic check for changes in cached static html files.

0

Graham

3. Graham - January 2, 2008

Looks like this blog sofwtare is removing my xml so I have reposted using square brackets instead of angled.

In tools 8.49 weblogic.xml contains a [container-descriptor] directive for reloading servlets but NOT for reloading static resources.

Simply add in the following tag inside the to have weblogic check for changes in cached static html files.

[resource-reload-check-secs]0[/resource-reload-check-secs]

Graham

4. PeopleSoft Tipster - January 4, 2008

What appears to be a better version of the code has been posted by Jeremy Radwan in a comment on Part3, which can be found here:
https://peoplesofttipster.com/2007/11/09/a-custom-message-on-the-signon-page-part-3/#comment-644

5. RDX - February 29, 2008

Hi,
I found the Blog very interesting, However I want someone to help me out with this.
This is PT 8.46.00
I am done with the changes above.
I do not see any message appearing on my login page
The onload function does not seem to call the include function
Error “Object expected” It seems to be the java script error
MOTD.html gets displayed by http://:portno/MOTD.html
However the onload function does not seem to pick it.

Regards

RDXHHH

6. Mo - July 17, 2009

I am getting a permission denied error on xmlhttp.open(“head”,url,true)

7. Raj - May 12, 2010

Thanks Dear, I tested all your solutions related to this subjet and they worked for my environment.


Sorry comments are closed for this entry

%d bloggers like this: