JavaScript Example(Fluid/Classic) - Code Reference/Widgets for HTML objects

Instructions: Use this sample code in HTML objects for your any PeopleSoft pages(Classic/Fluid). Embed this code appropriately.

Calculator in Page:-

<!-- Instructions: Just put this script anywhere on your webpage

        Between the body tags and you will have a calculator for your visitors!  -->

<CENTER><FORM name="Keypad" action="">

<TABLE><B><TABLE border=2 width=50 height=60 cellpadding=1 cellspacing=5><TR><TD colspan=3 align=middle><input name="ReadOut" type="Text" size=24 value="0" width=100%>

</TD><TD</TD><TD><input name="btnClear" type="Button" value="  C  " onclick="Clear()"></TD>

<TD><input name="btnClearEntry" type="Button" value="  CE " onclick="ClearEntry()"></TD></TR><TR><TD>

<input name="btnSeven" type="Button" value="  7  " onclick="NumPressed(7)"></TD><TD>

<input name="btnEight" type="Button" value="  8  " onclick="NumPressed(8)"></TD><TD>

<input name="btnNine" type="Button" value="  9  " onclick="NumPressed(9)"></TD><TD></TD><TD>

<input name="btnNeg" type="Button" value=" +/- " onclick="Neg()"></TD><TD><input name="btnPercent" type="Button" value="  % " onclick="Percent()"></TD></TR><TR><TD>

<input name="btnFour" type="Button" value="  4  " onclick="NumPressed(4)"></TD><TD>

<input name="btnFive" type="Button" value="  5  " onclick="NumPressed(5)"></TD><TD>

<input name="btnSix" type="Button" value="  6  " onclick="NumPressed(6)"></TD><TD></TD>

<TD align=middle><input name="btnPlus" type="Button" value="  +  " onclick="Operation('+')"></TD>

<TD align=middle><input name="btnMinus" type="Button" value="   -   " onclick="Operation('-')">

</TD></TR><TR><TD><input name="btnOne" type="Button" value="  1  " onclick="NumPressed(1)">

</TD><TD><input name="btnTwo" type="Button" value="  2  " onclick="NumPressed(2)">

</TD><TD><input name="btnThree" type="Button" value="  3  " onclick="NumPressed(3)">

</TD><TD></TD>

<TD align=middle><input name="btnMultiply" type="Button" value="  *  " onclick="Operation('*')">

</TD>

<TD align=middle><input name="btnDivide" type="Button" value="   /   " onclick="Operation('/')">

</TD></TR><TR><TD>

<input name="btnZero" type="Button" value="  0  " onclick="NumPressed(0)"></TD><TD>

<input name="btnDecimal" type="Button" value="   .  " onclick="Decimal()"></TD><TD colspan=3>

</TD><TD><input name="btnEquals" type="Button" value="  =  " onclick="Operation('=')">

</TD></TR></TABLE></TABLE></B></FORM></CENTER><font face="Verdana, Arial, Helvetica" size=2>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var FKeyPad = document.Keypad;

var Accumulate = 0;

var FlagNewNum = false;

var PendingOp = "";

function NumPressed (Num) {

if (FlagNewNum) {

FKeyPad.ReadOut.value  = Num;

FlagNewNum = false;

   }

else {

if (FKeyPad.ReadOut.value == "0")

FKeyPad.ReadOut.value = Num;

else

FKeyPad.ReadOut.value += Num;

   }

}

function Operation (Op) {

var Readout = FKeyPad.ReadOut.value;

if (FlagNewNum && PendingOp != "=");

else

{

FlagNewNum = true;

if ( '+' == PendingOp )

Accumulate += parseFloat(Readout);

else if ( '-' == PendingOp )

Accumulate -= parseFloat(Readout);

else if ( '/' == PendingOp )

Accumulate /= parseFloat(Readout);

else if ( '*' == PendingOp )

Accumulate *= parseFloat(Readout);

else

Accumulate = parseFloat(Readout);

FKeyPad.ReadOut.value = Accumulate;

PendingOp = Op;

   }

}

function Decimal () {

var curReadOut = FKeyPad.ReadOut.value;

if (FlagNewNum) {

curReadOut = "0.";

FlagNewNum = false;

   }

else

{

if (curReadOut.indexOf(".") == -1)

curReadOut += ".";

   }

FKeyPad.ReadOut.value = curReadOut;

}

function ClearEntry () {

FKeyPad.ReadOut.value = "0";

FlagNewNum = true;

}

function Clear () {

Accumulate = 0;

PendingOp = "";

ClearEntry();

}

function Neg () {

FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1;

}

function Percent () {

FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) / 100) * parseFloat(Accumulate);

}

// End -->

</SCRIPT>

********************************************************

Clock in A page

</SCRIPT>

<SCRIPT language=JavaScript>

fCol='444444'; //face colour.

sCol='FF0000'; //seconds colour.

mCol='444444'; //minutes colour.

hCol='444444'; //hours colour.

Ybase=30; //Clock height.

Xbase=30; //Clock width.

H='...';

H=H.split('');

M='....';

M=M.split('');

S='.....';

S=S.split('');

NS4=(document.layers);

NS6=(document.getElementById&&!document.all);

IE4=(document.all);

Ypos=0;

Xpos=0;

dots=12;

Split=360/dots;

if (NS6){

for (i=1; i < dots+1; i++){

document.write('<div id="n6Digits'+i+'" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial;font-size:10px;color:#'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');

}

for (i=0; i < M.length; i++){

document.write('<div id="Ny'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+mCol+'"></div>');

}

for (i=0; i < H.length; i++){

document.write('<div id="Nz'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+hCol+'"></div>');

}

for (i=0; i < S.length; i++){

document.write('<div id="Nx'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:#'+sCol+'"></div>');

}}

if (NS4){

dgts='1 2 3 4 5 6 7 8 9 10 11 12';

dgts=dgts.split(' ')

for (i=0; i < dots; i++){

document.write('<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');

}

for (i=0; i < M.length; i++){

document.write('<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');

}

for (i=0; i < H.length; i++){

document.write('<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');

}

for (i=0; i < S.length; i++){

document.write('<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');

}

}

if (IE4){

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i=1; i < dots+1; i++){

document.write('<div id="ieDigits" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial;font-size:10px;color:'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');

}

document.write('</div></div>')

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i=0; i < M.length; i++){

document.write('<div id=y style="position:absolute;width:2px;height:2px;font-size:2px;background:'+mCol+'"></div>');

}

document.write('</div></div>')

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i=0; i < H.length; i++){

document.write('<div id=z style="position:absolute;width:2px;height:2px;font-size:2px;background:'+hCol+'"></div>');

}

document.write('</div></div>')

document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');

for (i=0; i < S.length; i++){

document.write('<div id=x style="position:absolute;width:2px;height:2px;font-size:2px;background:'+sCol+'"></div>');

}

document.write('</div></div>')

}

function clock(){

time = new Date ();

secs = time.getSeconds();

sec = -1.57 + Math.PI * secs/30;

mins = time.getMinutes();

min = -1.57 + Math.PI * mins/30;

hr = time.getHours();

hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;


if (NS6){

Ypos=window.pageYOffset+window.innerHeight-Ybase-25;

Xpos=window.pageXOffset+window.innerWidth-Xbase-30;

for (i=1; i < dots+1; i++){

 document.getElementById("n6Digits"+i).style.top=Ypos-15+Ybase*Math.sin(-1.56 +i *Split*Math.PI/180)

 document.getElementById("n6Digits"+i).style.left=Xpos-15+Xbase*Math.cos(-1.56 +i*Split*Math.PI/180)

 }

for (i=0; i < S.length; i++){

 document.getElementById("Nx"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(sec);

 document.getElementById("Nx"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(sec);

 }

for (i=0; i < M.length; i++){

 document.getElementById("Ny"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(min);

 document.getElementById("Ny"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(min);

 }

for (i=0; i < H.length; i++){

 document.getElementById("Nz"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(hrs);

 document.getElementById("Nz"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(hrs);

 }

}

if (NS4){

Ypos=window.pageYOffset+window.innerHeight-Ybase-20;

Xpos=window.pageXOffset+window.innerWidth-Xbase-30;

for (i=0; i < dots; ++i){

 document.layers["nsDigits"+i].top=Ypos-5+Ybase*Math.sin(-1.045 +i*Split*Math.PI/180)

 document.layers["nsDigits"+i].left=Xpos-15+Xbase*Math.cos(-1.045 +i*Split*Math.PI/180)

 }

for (i=0; i < S.length; i++){

 document.layers["nx"+i].top=Ypos+i*Ybase/4.1*Math.sin(sec);

 document.layers["nx"+i].left=Xpos+i*Xbase/4.1*Math.cos(sec);

 }

for (i=0; i < M.length; i++){

 document.layers["ny"+i].top=Ypos+i*Ybase/4.1*Math.sin(min);

 document.layers["ny"+i].left=Xpos+i*Xbase/4.1*Math.cos(min);

 }

for (i=0; i < H.length; i++){

 document.layers["nz"+i].top=Ypos+i*Ybase/4.1*Math.sin(hrs);

 document.layers["nz"+i].left=Xpos+i*Xbase/4.1*Math.cos(hrs);

 }

}

if (IE4){

Ypos=document.body.scrollTop+window.document.body.clientHeight-Ybase-20;

Xpos=document.body.scrollLeft+window.document.body.clientWidth-Xbase-20;

for (i=0; i < dots; ++i){

 ieDigits[i].style.pixelTop=Ypos-15+Ybase*Math.sin(-1.045 +i *Split*Math.PI/180)

 ieDigits[i].style.pixelLeft=Xpos-15+Xbase*Math.cos(-1.045 +i *Split*Math.PI/180)

 }

for (i=0; i < S.length; i++){

 x[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(sec);

 x[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(sec);

 }

for (i=0; i < M.length; i++){

 y[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(min);

 y[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(min);

 }

for (i=0; i < H.length; i++){

 z[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(hrs);

 z[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(hrs);

 }

}

setTimeout('clock()',100); }

clock();

//-->

</SCRIPT>

<SCRIPT language=JavaScript>

fCol='444444'; //face colour.

sCol='FF0000'; //seconds colour.

mCol='444444'; //minutes colour.

hCol='444444'; //hours colour.

Ybase=30; //Clock height.

Xbase=30; //Clock width.

</body>

</html>

<p align="center"><a href="http://www.webloger.5u.com">

<font face="Tahoma" size="2">webloger site</font></a></p>

******************************************************************

Credit Card Logic:-

// The function determines whether a Credit Card number is "valid"

// Please note that a "valid" Credit Card number is not essentially a Credit Card in "Good Standing" 

function isValidCreditCard(number) {

     if (number.indexOf("-")) {

          cc = number.split("-");

          number = "";

          for (var i = 0; i < cc.length; i++) number += cc[i];

     }

     // Another Version of what was performed above using String & Array Methods

     if (number.indexOf(" ")) {

          cc = number.split(" ");

          number = cc.join("");

     }

     // OR using RegExp we can combine the above two

     //  number = number.replace(/-|\s/g, "");

     /**********************************************/

     if (number.length > 19) return (false);

     sum = 0; mul = 1; l = number.length;

     for (i = 0; i < l; i++) {

          digit = number.substring(l - i - 1, l - i);

          tproduct = parseInt(digit, 10) * mul;

          if (tproduct >= 10) sum += (tproduct % 10) + 1;

          else sum += tproduct;

          if (mul == 1) mul++;

          else mul--;

     }

     if ((sum % 10) == 0) return (true);

     else return (false);

}

*********************************************************
<!-- SUMMARY BRIEF
This DHTML script will put a small watermark link in the bottom right corner of your page that will stay there even when the page scrolls. This link will always take the user back to the top of the page.
-->
<!-- Put this portion of the script inside of your <HEAD> tag -->
<script>
<!--
// Change this text to the text that you want to be displayed as the link on your page.

var displayed="<nobr><font size=2 face=Arial><b>[Top]</b></font></nobr>"

// === DO NOT EDIT ANYTHING BELOW THIS LINE!!! === //

var logolink='javascript:window.scrollTo(0,0)'
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (ns4)
setTimeout("window.onresize=regenerate",400)
}

if (ie4||ns6)
document.write('<span id="logo" style="position:absolute;top:-300;z-index:100">'+displayed+'</span>')

function createtext(){ //function for NS4
staticimage=new Layer(5)
staticimage.left=-300
staticimage.document.write('<a href="'+logolink+'">'+displayed+'</a>')
staticimage.document.close()
staticimage.visibility="show"
regenerate2()
staticitns()
}

function staticit(){ //function for IE4/ NS6
var w2=ns6? pageXOffset+w : document.body.scrollLeft+w
var h2=ns6? pageYOffset+h : document.body.scrollTop+h
crosslogo.style.left=w2
crosslogo.style.top=h2
}

function staticit2(){ //function for NS4
staticimage.left=pageXOffset+window.innerWidth-staticimage.document.width-28
staticimage.top=pageYOffset+window.innerHeight-staticimage.document.height-10
}

function inserttext(){ //function for IE4/ NS6
if (ie4)
crosslogo=document.all.logo
else if (ns6)
crosslogo=document.getElementById("logo")
crosslogo.innerHTML='<a href="'+logolink+'">'+displayed+'</a>'
w=ns6? window.innerWidth-crosslogo.offsetWidth-20 : document.body.clientWidth-crosslogo.offsetWidth-10
h=ns6? window.innerHeight-crosslogo.offsetHeight-15 : document.body.clientHeight-crosslogo.offsetHeight-10
crosslogo.style.left=w
crosslogo.style.top=h
if (ie4)
window.onscroll=staticit
else if (ns6)
startstatic=setInterval("staticit()",100)
}

if (ie4||ns6){
window.onload=inserttext
window.onresize=new Function("window.location.reload()")
}
else if (ns4)
window.onload=createtext

function staticitns(){ //function for NS4
startstatic=setInterval("staticit2()",90)
}

//-->
</script>

**************************************************************
Google Search
<center>
<FORM method=GET action="http://www.google.com/search">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/">
<IMG SRC="http://www.google.com/logos/Logo_40wht.gif" <br></A>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value="en">
<INPUT type=submit name=btnG VALUE="Google Search">
</td></tr></TABLE>
</FORM>
</center>
<!-- Search Google -->

<font face="Tahoma"><a target="_blank" href="http://www.javascriptfreecode.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>

**************************************************************
One month Calender
<html><head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head><body><center>

<script LANGUAGE="JavaScript">
<!-- Begin
monthnames = new Array(
"January",
"Februrary",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"Decemeber");
var linkcount=0;
function addlink(month, day, href) {
var entry = new Array(3);
entry[0] = month;
entry[1] = day;
entry[2] = href;
this[linkcount++] = entry;
}
Array.prototype.addlink = addlink;
linkdays = new Array();
monthdays = new Array(12);
monthdays[0]=31;
monthdays[1]=28;
monthdays[2]=31;
monthdays[3]=30;
monthdays[4]=31;
monthdays[5]=30;
monthdays[6]=31;
monthdays[7]=31;
monthdays[8]=30;
monthdays[9]=31;
monthdays[10]=30;
monthdays[11]=31;
todayDate=new Date();
thisday=todayDate.getDay();
thismonth=todayDate.getMonth();
thisdate=todayDate.getDate();
thisyear=todayDate.getYear();
thisyear = thisyear % 100;
thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear));
if (((thisyear % 4 == 0) 
&& !(thisyear % 100 == 0))
||(thisyear % 400 == 0)) monthdays[1]++;
startspaces=thisdate;
while (startspaces > 7) startspaces-=7;
startspaces = thisday - startspaces + 1;
if (startspaces < 0) startspaces+=7;
document.write("<table border=2 bgcolor=white ");
document.write("bordercolor=black><font color=black>");
document.write("<tr><td colspan=7><center><strong>" 
+ monthnames[thismonth] + " " + thisyear 
+ "</strong></center></font></td></tr>");
document.write("<tr>");
document.write("<td align=center>Su</td>");
document.write("<td align=center>M</td>");
document.write("<td align=center>Tu</td>");
document.write("<td align=center>W</td>");
document.write("<td align=center>Th</td>");
document.write("<td align=center>F</td>");
document.write("<td align=center>Sa</td>"); 
document.write("</tr>");
document.write("<tr>");
for (s=0;s<startspaces;s++) {
document.write("<td> </td>");
}
count=1;
while (count <= monthdays[thismonth]) {
for (b = startspaces;b<7;b++) {
linktrue=false;
document.write("<td>");
for (c=0;c<linkdays.length;c++) {
if (linkdays[c] != null) {
if ((linkdays[c][0]==thismonth + 1) && (linkdays[c][1]==count)) {
document.write("<a href=\"" + linkdays[c][2] + "\">");
linktrue=true;
      }
   }
}
if (count==thisdate) {
document.write("<font color='FF0000'><strong>");
}
if (count <= monthdays[thismonth]) {
document.write(count);
}
else {
document.write(" ");
}
if (count==thisdate) {
document.write("</strong></font>");
}
if (linktrue)
document.write("</a>");
document.write("</td>");
count++;
}
document.write("</tr>");
document.write("<tr>");
startspaces=0;
}
document.write("</table></p>");
// End -->
</script>
</center>
<!-- Script Size:  2.98 KB  -->
</body></html>

**************************************************************
Print Page Button Script

<SCRIPT LANGUAGE="JavaScript">
if (window.print) {
document.write('<form> '
+ '<input type=button name=print value="Click" '
+ 'onClick="javascript:window.print()"> To Print this page!</form>');
}
// End -->
</script>

**************************************************************
Search Button
<SCRIPT language=JavaScript>
var NS4 = (document.layers);    
var IE4 = (document.all);
var win = window;    
var n   = 0;
function findInPage(str) {
  var txt, i, found;
  if (str == "")
    return false;
  if (NS4) {
    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;
    if (n == 0)
      alert("Not found.");
  }
  if (IE4) {
    txt = win.document.body.createTextRange();
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart("character", 1);
      txt.moveEnd("textedit");
    }
    if (found) {
      txt.moveStart("character", -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
    }
    else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }
      else
        alert("Sorry, we couldn't find.Try again");
   }
  }
  return false;
}
</SCRIPT>
<FORM name=search onsubmit="return findInPage(this.string.value);">
<P align=center><FONT size=3>
<INPUT 
style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" 
onchange="n = 0;" size=16 name=string></FONT><BR><INPUT style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #aaaaaa" type=submit value=Search in page ><center><font size=2pt;><font family=Times New Roman;><b><BR> 
</P></FORM></DIV><BR>
**************************************************************
World Time/Clock
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>New Page 2</title>
</head>
<body>
<table border="0" width="200" cellspacing="0" cellpadding="3">
<form name="where">
  <tr>
    <td width="100%">
<select name="city" size="1" onchange="updateclock(this);"> 
<option value="" selected>Local time</option>
<option value="0">London GMT</option> 
<option value="1">Rome</option>
<option value="7">Bangkok</option>
<option value="8">Hong Kong</option>
<option value="9">Tokyo</option> 
<option value="10">Sydney</option>
<option value="12">Fiji</option>
<option value="-10">Hawaii</option>
<option value="-8">San Francisco</option> 
<option value="-5">New York</option>
<option value="-3">Buenos Aires</option>
</select>
</td>
  </tr>
  <tr>
    <td width="100%">
<script language="JavaScript">

if (document.all||document.getElementById)
document.write('<span id="worldclock" style="font:bold 16px Arial;"></span><br>')

zone=0;
isitlocal=true;
ampm='';

function updateclock(z){
zone=z.options[z.selectedIndex].value;
isitlocal=(z.options[0].selected)?true:false;
}

function WorldClock(){
now=new Date();
ofst=now.getTimezoneOffset()/60;
secs=now.getSeconds();
sec=-1.57+Math.PI*secs/30;
mins=now.getMinutes();
min=-1.57+Math.PI*mins/30;
hr=(isitlocal)?now.getHours():(now.getHours() + parseInt(ofst)) + parseInt(zone);
hrs=-1.575+Math.PI*hr/6+Math.PI*parseInt(now.getMinutes())/360;
if (hr < 0) hr+=24;
if (hr > 23) hr-=24;
ampm = (hr > 11)?"PM":"AM";
statusampm = ampm.toLowerCase();

hr2 = hr;
if (hr2 == 0) hr2=12;
(hr2 < 13)?hr2:hr2 %= 12;
if (hr2<10) hr2="0"+hr2

var finaltime=hr2+':'+((mins < 10)?"0"+mins:mins)+':'+((secs < 10)?"0"+secs:secs)+' '+statusampm;
if (document.all)
worldclock.innerHTML=finaltime
else if (document.getElementById)
document.getElementById("worldclock").innerHTML=finaltime
else if (document.layers){
document.worldclockns.document.worldclockns2.document.write(finaltime)
document.worldclockns.document.worldclockns2.document.close()
}
setTimeout('WorldClock()',1000);
}
window.onload=WorldClock
//-->
</script>
<!--Place holder for NS4 only-->
<ilayer id="worldclockns" width=100% height=35><layer id="worldclockns2" width=100% height=35 left=0 top=0 style="font:bold 16px Arial;"></layer></ilayer></td></form>  </tr></table></body>
</html>

Example-2: World clock with Map
<script src="http://www.clocklink.com/embed.js">
</script>
<script type="text/javascript" language="JavaScript">
obj=new Object;
obj.clockfile="world001-green.swf";
obj.TimeZone="GMT0530";
obj.width=480;obj.height=250;
obj.wmode="transparent";
showClock(obj);
</script>

INTEGRATION BROKER - Part-2

 

1.       Enable the pub/sub processes in the App server so there is a support for Asynchronous services.

2.       Change the default Local Node i.e. HRMS

3.       Configure the PeopleSoft Listening Connector

         This is necessary for a PSFT Appserver to communicate with an Integration gateway.

4.       Configure the PeopleSoft target connector

         This tells the integration Gateway where the Appserver is located.

5.       Service configuration.

          This is required for running web services. It is to identify where the PSListening connector is:

1.       It is used to send messages from one module to another I.e. HRMS TO FSCM

2.       There are up to 6 different server processes that can be configured to support App messaging.

(a)    Pub broker Handler

(b)   Pub broker Dispatcher

(c)    Pub contract Handler

(d)   Pub contract Dispatcher

(e)   Sub contract Handler

(f)     Sub contract Dispatcher

3.       Start all servers I.e.

(a)    App server

(b)   Web server

(c)    Process Scheduler server

4.       Enable pub/sub servers in Psadmin utility

Appserv> psadmin.exe->1,1,4,Y,12,13,1,1, and press enter

After restarting it will show +6 Processes.

5.       Login to PIA I.e. PTOOLS >> IB >> configuration Gateways >> Gateways

Click on search

The gateway URL Syntax is:

http://serverip:httpportno/PSIGW/PeopleSoftListening Connector

url:  http://serverip:8000/PSIGW/PeopleSoftListeningConnector

Click on  PING GATEWAY

O/P:  PS Integration Gateway    |    Tools version 8.48.08

          PS Listening Connector      | status active

Click on Load Gateway connectors

MSG: Loading Process was successful & press ok & click on save button

 

Click on Gateway setup properties Hyperlink

Uid: administrator   pwd: password  & press ‘ok’

 

Source s/m

Webserverurl                UID           PWD      TOOLS RELEASE

192.168.1.185               PS              PS            8.48

 

Target  s/m

MSG NODE NAME           Webserverurl                UID           PWD      TOOLS RELEASE

  PSFT_HR                             192.168.1.186               PS              PS            8.48

 

Click On save button

6.       Do the same in other  system

7.       Whether our configs correct or not to check click on PING NODE

O/P:  Message Text

          Success(117,73)

NOTE:

1.       Config file for IB is

<pshome>/webserv/DN/Application/People Soft/PSIGW/web-INF/Integrationgateway.properties

(or) click on Advanced properties page in PIA Gateways.

2.       Six Processes of two types - dispatcher & handlers are paired to produce the messaging servers that transmit Asynchronous messages through out the messaging system.

 

IB DESCRIPTION:

1.       IB: It is used to send msgs from one module to another.

Communication takes place b/w different PS Application or b/w PS & Third Party systems.

 

Some of Relevant Components are:

1.       Gateways: Are the pathways b/w systems. There is always a local gateway in PeopleSoft which refers to the source PS System. Other gateway may exists

2.       Messages: The messages are written in XML. There are 2 types of messages

(a)    Synchronous: It needs to be acknowledged by the receiver

(b)   Asynchronous: It doesn’t get acknowledge. In company we use to send Asynchronous messages only

Synchronous messages are not used much in People Soft. Its purpose is Reliability.

3.       Domains: It refer to PeopleSoft App server domains i.e. Tuxedo

4.       Nodes:  It defines what application a message belong to any system that IB can talk to will have a node. It is compulsory & it will check the messages belong to which Application.

5.       Queues: It is used for Administration of IB to avoid stopping everything when something is wrong

6.       Handlers: It contain code and Logic for sending/receiving/manipulating messages.

7.       Routings: It is used to link a service operation to a node & can also specify transformation of a message. 

  

IB Troubleshooting

 

Problem 1: Cannot find message in Message Monitor

Possible causes:

1. User does not have security for the message channel.

2. The message monitor criteria have filtered out the message.

 

Problem 2: Messages are being processed in an incorrect order

Possible cause:

1. The Channel has been partitioned, and the resulting subchannels do not match what was assumed for the ordering of the messages.

Problem 3: Message Instance not created

Possible cause:

1. Message is inactive.

Problem 4: Message Instance stays in NEW status.

Possible cause:

1. The pub/sub servers are not booted.

2. The Message Dispatcher has crashed or has been brought down.

3. The Item is not at the top of the queue. All messages with the same Channel/ Subchannel are in the same queue

4. Run appmsgpurgeall.dms

5. Restart PUBSUB processes

6. Force cleanup from the monitor message -> domain status

7. Test your message by routing it through another channel to make sure that it is not an issue with the channel.

Problem 5: Message Instance stays in STARTED status.

Possible cause:

1. All Message Handlers have crashed or have been brought down. Processing will resume when Message handlers come brought back up

2. The Message dispatcher processing the message is on another machine, and either the machine or the application server domain is down.

 

Problem 6: Message Instance stays in WORKING status.

Possible cause:

1. Message Handler has crashed.

2. The Message Handler processing the message is on another machine, and either the machine or the application server domain is down. The Message handler working on the message is "blocked". The service will timeout, and the Message Dispatcher will retry the message.

 

Problem 7: Publication Contract not created

Possible cause:

1. Channel routing rules not set up properly.

 

Problem 8: Publication Contract stays in NEW status

Possible cause:

1. Publication Dispatcher has crashed or has been brought down.

2. Message Channel paused.

3. Node paused

4. Previous message had a status of RETRY, ERROR, or TIMEOUT.

5. The Publication Contract is not at the top of the queue. All Publication Contracts with the same Channel/ Subchannel and subscribing node are in the same queue

 

Problem 9: Publication Contract stays in RETRY status

Possible cause:

1. The remote node cannot be "pinged" successfully. The publication contract will be processed when the remote node comes back up.

2. No publication handler available, either because it's crashed or it has been brought down.

 

Problem 10: Publication Contract stays in WORKING status

Possible cause:

1. The publication handler processing the contract is on another machine and either the machine or the domain is down. Processing should continue when the pub/sub system on the other machine comes back up.

 

Problem 11: Subscription Contract not created.

Possible causes:

1. Message Subscription is inactive.

2. Channel routing rules not set up properly.

 

Problem 12: For a message published by the local node, subscription contract not created for local node even when Message Subscription is active and "Invoke for local publication" is checked.

Possible cause:

1. The local node was not included in the routing rules for the channel. To subscribe to its own publications, the local node must be included in the channel routing rules.

 

Problem 13: Subscription Contract stays in NEW status.

Possible causes:

1. The Subscription Dispatcher has crashed or has been brought down.

2. Message Channel Node or System paused.

3. Message Definition not Active.

4. Previous message had a status of RETRY, ERROR, or TIMEOUT.

5. The Subscription contract is not at the top of the queue. All Subscription Contracts with the same Channel/ Sub-channel and subscription owner are in the same queue.

 

Problem 14: All publication Contracts remain in a NEW status.

The queue was blocked from a Publication Contact that was in a status of ERROR from two weeks prior. User did not see the error on the message monitor because he was only looking at today. User entered xx day in and the ERROR publication appeared. Canceled the error and all subsequent publication contracts processed successfully.

Problem: Subscription Contract stays in STARTED status.

Possible causes:

1. The Subscription Handler has crashed or has been brought down.

 

Problem 15: Subscription Contract stays in WORKING status.

Possible causes:

1. The Subscription Handler has crashed or has been brought down. Check in Application Messaging Gateway Administrator

2. Also look for any errors in App Serv Log

 

Problem 16: Subscription Contract in ERROR status.

Possible causes:

1. Subscription PeopleCode errors

2. Application data errors.

 

Problem 17: Subscription Contract in TIMEOUT status.

Possible causes:

1. Subscription PeopleCode errors

2. If the message works sometimes, and sometimes does not this may be a problem with the application server configuration. Tune up your application server min/max values, or reconfigure your domain to a medium or large domain. Also, changing the recycle count for these services from 0 to 25,000 or 10,000 may eliminate this problem.

 

Problem 18: Unable to ping a node.

Possible causes:

1. The web server for the Gateway is down.

2. The Gateway is not configured properly.

3. The app server for the node is down.

4. Verify url is correct. Copy url in browser address, should see "PeopleSoft <tools release> Application Messaging gateway".

(Note: be sure that url in the manage lookup contains // before an ip address or machine name)

NOTE: In PeopleBooks it is stated as "//http://HRMS-01/servlet/psft.pt8.gateway.GatewayServlet"

It should read "http://HRMS-01/servlets/gateway" notice the "//" are missing from the begining and is should read "servlets" not "servlet"

 

Problem 19: "Access denied, source node not found" message even when source node defined on target database.

Possible cause:

1. Known bug: Message Node caching not working. If a new node is added, reboot appserver.

 

Problem 20: "Bad Gateway, General Exception error." message when pinging node.

Possible cause:

1. Check Opid/ Password of node on Configuration Servlet page. (http:// ?/servlet/gateway.administration)

 

Problem 21: "Access denied. Target and source message node password's do not match." message even when no passwords are defined on target and source nodes.

Possible cause:

1. Target application server has entry in Distinguished Name field in source node's message properties.

2. Target URL must be defined with https:// on target node in source application server.

 

Problem 21.1: "Access denied. No password defined on source message node."

Possible cause:

In 8.1x Source Message Node properties has entries in 'Password' and 'Re- verify Password'.

Solution: Blank these fields and ping the source node it worked fine.

 

Problem 22: "Page cannot be displayed message when attempting to bring up Gateway or gateway Administration page.

Possible cause:

3. Make sure Apache/ JServ started.

4. Make sure aliases are correct in zone.properties

 

Problem 23: Ping failed; Application server log message saying cannot find JVM.

Resolution: The application server was on a different machine as the web server. The Sun JRE 1.2 was downloaded on the web server machine. Sun JRE 1.2 was re-downloaded on the application server machine and the setting JavaVM Shared Library in psappsrv.cfg file was set to point to the location of this JRE.

Problem 24: Service Operation Instance Stays in NEW Status

Ppossible causes are:

1. The domain on which a pub/sub server resides is Inactive.

2. The Application server is down.

3. Pub/sub services are not configured on the Application Server domain. Check the server status via Psadmin to make sure PUBSUB services are running.

4. The Message Dispatcher crashed or was brought down.

5. The item is not at the top of the queue; all service operations with the same queue or subqueue are in the same queue.

6. The node status is in Paused state.

7. Missing data from PSIBPROFILE (Document:1108466.1E-IB:Messages Stuck In New After Tools 8.50 Upgrade)

8. PUBSUB processes in-memory queues got out of sync with the database because of running a purging script without shutting down the app server domain ()

9. Only one domain is configured for PUBSUB services but in the psappsrv.cfg file it is set as a slave domain. The Slave Mode should be set to 0 if not implementing static master/slave.

10. In PT 8.51+ the domain status page shows one active domain and the Slave indicator is Sync Template. There needs to be a master domain. Recreate the domain in PSAdmin.

Problem 25: Service Operation Instance Stays in STARTED Status

Possible causes are:

1. All Message Handlers crashed or were brought down; processing will resume when Message Handlers come back up.

2. The Message dispatcher processing the message is on another machine, and either the machine or the application server domain is down.

3. Application server domain was created using the developer template. Recreate using small, medium or large.

Problem 26: Service Operation Instance Stays in WORKING Status

Possible causes are:

1. Message Broker Handler crashed.

2. The Message Handler processing the message is on another machine, and either the machine or the application server domain is down.

3. The Message Handler working on the message is blocked. The service will time out, and the Message Dispatcher will retry the message.

4. Application server domain was created using the Developer template. Recreate using small, medium or large.

Problem 27: Service Operation Instance Stays in WORKING Status

Possible causes are:

  * Message Broker Handler crashed.

  * The Message Handler processing the message is on another machine, and either the machine or the application server domain is down.

  * The Message Handler working on the message is blocked. The service will time out, and the Message Dispatcher will retry the message.

 

Problem28: Unable to Ping a Node

Possible causes are:

  * The web server for the Gateway is down.

  * The Gateway is not configured properly.

  * The application server for the node is down.

  * The Gateway URL is incorrect; verify that the URL is correct.

  * Copy URL in browser address; you should see: \\

  

    PeopleSoft Integration Gateway

    PeopleSoft Listening Connector

    Status: ACTIVE

 

==========================================================

PeopleSoft Integration Broker's backend tables

PS IB Gateway Tables

PSGATEWAY

PSCONN

PSNODECONPROP

PSCONNPROP

PSCONNPROPIDVW

PSCONPROPNAMEVW

PSCONPROPVALVW

PSCONPROPDATAVW

IB Routings Tables

PSIBRTNGDEFN

PSRTNGDFNCONPRP

PSRTNGDFNPARMVW

PSRTNGDFNPROP

PSRTNGDFNPARM

PSIBRTNGDEFN

IB Services

PSAUTHWS

PSSERVICE

PSIBWSDL

PSOPRVERDFN

PSIBMSGSERV_VW

PSIBRTNGSERV_VW

PSOPERATION

PSSERVICEOPR_VW

PSOPRVERDFNPARM

PSOPERATIONAC

PSHUBNODEVW

PSIBRTNGDEFN

PSRTNGDFNPARM

PSRTNGDFNCONPRP

PSOPRGENRTGPARM0

IB Queues

PSQUEUEDEFN

PSOPRVERDFN

PSOPRVERDFNPARM

PSSRVQUEUE_VW

IB Message Definitions

PSMSGVER

PSMSGDEFN

PSMSGPARTS

PSMSGPARTS_VW

PSOPRVERDFNM_VW

IB Nodes

PSMSGNODEDEFN

PSNODECONPROP

PSNODEURITEXT

PSIBRTNGDEFN

PSNODEPROP

PSMSGATTR

IB Message Schemas

PSIBMSGSCHEMA

PSIBSCMADFN

PSIBSCMADATA

IB Messages

PSCONPROPVALVW

PSCONNPROPIDVW

PSNODEVW

PS_AMM_ARCH_PUB

PSAUTHWS_VW

PSAUTHWS_VW1

PSAUTHWS_VW2

PSIBUSERCOMP

PSCONTNAMEVW

PSCODESETGROUP

PSCONNGATEWAYVW

PSCONNIDVW;

 

IB Handlers

PSOPRHDLR;

 

Event Mapping Framework

 Event Mapping is a useful feature that was introduced in PeopleTools 8.55, and we've been enhancing it ever since. 

The basic concept is straightforward: Event Mapping enables you to inject custom code before or after delivered event code.  There are some key benefits of Event Mapping:

·         Your Custom PeopleCode is kept separate from delivered code

·         You have Complete access to component buffer

A developer writes their Application Class custom code in App Designer.  Note that as of 8.57, the PeopleCode Editor provides an Event Mapping button in the Application Designer toolbar as a visual indicator of custom PeopleCode programs mapped to events of a component, component page, component record, or component record field. The indicator is enabled when the PeopleCode is being viewed for one of these events. In addition, the Find Definition References tab on the output window lists the events that are mapped to custom PeopleCode programs, along with the application class. The Find Definition References tab lists references to other components where the custom PeopleCode programs of the selected application class are used.

Event Mapping configuration requires the following steps:

  1. Create an Application Class with mapped business logic,
  2. Define a Related Content Service Definition, and
  3. Map a component event to a Related Content Service Definition.

Mapping your custom code is done through the Related Content Framework, which enables us to keep your code separate from the delivered logic.
  

Events Support Event Mapping:-

The list has been growing ever since Event Mapping was introduced.

Component Level events:

·         PostBuild

·         PreBuild

·         SavePreChange

·         SavePostChange

·         WorkFlow

Component Record level events:

·         RowDelete

·         RowInit

·         RowInsert

·         RowSelect

·         SaveEdit

·         SavePreChange

·         SavePostChange

Page level events:

·         PageActivate

Field level events:

·         FieldChange


Event mapping now also supports records and record fields on subpages and secondary pages at any level of nesting, not just for primary pages explicitly defined in the component. This enhancement extends support to the page Activate event for secondary pages and to derived work records. 

Developers can use a single application class service ID for multiple configurations. This enhancement simplifies PeopleCode development because multiple blocks of code can be delivered in a single application class. Then, during configuration, you can use a new event mapping parameter to selectively invoke the specific block of code that pertains to a specific event.

Time to Use Event Mapping

Customers that have heavily customized their PeopleSoft applications should look seriously at Event Mapping to isolate those customizations to provide a better PeopleSoft life cycle.  Event Mapping can even be used in concert with other configuration features to dramatically reduce the impact of customizations.

 Use the Event Mapping page to manage which content references have associated PeopleCode application package programs.

Image: Event Mapping page

This example illustrates the fields and controls on the Event Mapping page. You can find definitions for the fields and controls later on this page.

Event Mapping page

Event Mapping References page

This example illustrates the fields and controls on the Event Mapping References page. You can find definitions for the fields and controls later on this page.

Event Mapping References page

Select a Content Reference page

This example illustrates the fields and controls on the Select a Content Reference page. You can find definitions for the fields and controls later on this page.

Select a Content Reference page

Assigning Application Class PeopleCode to Component Events

Use the Configure Event Mapping page to map application class PeopleCode to component level, page level, and component record level events.

Configure Event Mapping page (1 of 2)

This example illustrates the fields and controls on the Configure Event Mapping page (1 of 2). You can find definitions for the fields and controls later on this page.

Configure Event Mapping page (1 of 2)

Configure Event Mapping page (2 of 2)

This example illustrates the fields and controls on the Configure Event Mapping page (2 of 2). You can find definitions for the fields and controls later on this page.

Configure Event Mapping page (2 of 2)

PeopleCode Example for Multiple Events in a Single Application Class

The following application class presents an example of how eve_execute could be implemented:

import PT_RCF:ServiceInterface;

class App_Class1 implements PT_RCF:ServiceInterface
   method execute();
   method eve_execute(&str As string);
end-class;

method execute
   /+ Extends/implements PT_RCF:ServiceInterface.execute +/
end-method;

method eve_execute
   /+ &str as String +/
   /+ Extends/implements PT_RCF:ServiceInterface.eve_execute +/
   /* &str variable will have the Event Map Parameter that was */
   /* set in the configuration page for that particular event  */
   /* that is being triggered.                                 */
   Evaluate &str
   When = "1"
      /* Code block for PreBuild event */
   When = "2"
      /* Code block for PostBuild event */
   When-Other
      /* Code block to handle an invalid event map parameter  */
   End-Evaluate;
end-method;

Excel to Component Interface Utility

  To use the Excel to Component Interface utility, you must grant access to the iScript WEBLIB_SOAPTOCI in the permission list of the user w...