Pages

Custom Search

Opening a new window

Soure: http://peoplesoft.wikidot.com/opening-a-new-window

/*****************************************************************************
 NewWinUrl(&strUrl)

 This function modifies a URL to return a new window URL
 It allows a new state block to be generated in a separate browser instance.
 http://server:port/psp/ps/EMPLOYEE/HRMS/c/......
 turns into
 http://server:port/psp/ps_newwin/EMPLOYEE/HRMS/c/......
 which renders to the browser as
 http://server:port/psp/ps_1/EMPLOYEE/HRMS/c/......

 Input parameters:  &strUrl - a URL to manipulate
 Output parameters: &strUrlModified - New URL with _newwin parameter

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

Function NewWinUrl(&strUrl As string) Returns string;
   Local string &sRegex, &sReplace, &Result;
   /* Declare java object */
   Local JavaObject &jUrl;
 
   /**
    * Peoplesoft Content types:
    * -------------------------
    * Component: c
    * Script: s
    * External: e
    * Homepage: h
    * Template: t
    * Query: q
    * Worklist: w
    * Navigation: n
    * File: f
   **/
 
   /* Regex strings */
   /*          psc/psp  Site      Portal    Node      Content Type */
   &sRegex = "/(ps[cp])/([^\/]*)?/([^\/]*)?/([^\/]*)?/([csehtqwnf]{1})/";
   &sReplace = "/$1/$2_newwin/$3/$4/$5/";
 
   /* Instantiate objects and replace */
   &jUrl = CreateJavaObject("java.lang.String", &strUrl);
 
   &Result = &jUrl.replaceAll(&sRegex, &sReplace);
 
   /* Return modified URL */
   Return &Result;
End-Function;