com.plumtree.portaluiinfrastructure.statichelpers
Class PlumtreeHelpers

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.statichelpers.PlumtreeHelpers

public class PlumtreeHelpers
extends java.lang.Object

This class contains static helper functions to be used with the Plumtree API.


Field Summary
static java.lang.String DPROFILE_EDITOR_SESSION_FLAG
          Name of the session flag indicating being in the default profile editor.
static java.lang.String GIF_TYPE
          Gif type
static java.lang.String LARGE_IMAGE
          Large Image
static java.lang.String PORTAL_IMAGE_PAGE
          Portal image page
static java.lang.String s_strDefaultStyleSheet
          The default style sheet should only be used by the common code that determines style sheets.
static java.lang.String SMALL_IMAGE
          Small Image
static java.lang.String STR_JS_FUNC_NAME_EXECUTE_VIA_ENTER
          To execute a javascript function when you press enter in a input field, set the onkeypress attribute of the input equal to "return executeViaEnter(event)".
static java.lang.String STYLE_PREFIX_508
          508 mode style sheet prefix
 
Constructor Summary
PlumtreeHelpers()
           
 
Method Summary
static boolean CheckCurrentUserIsAdmin(IPTSession _ptSession)
          Checks to see whether or not the user is in the Administrators group, using cached session's list of groups.
static boolean EveryoneHasAccess(IPTServerContext ptObject)
          Returns true if the everyone group is on the ACL for the object passed in, false otherwise
static HTMLScript GetExecuteViaEnterJScript(java.lang.String strValidateFunction)
          To execute a javascript function when you press enter in a input field, set the onkeypress attribute of the input equal to "return executeViaEnter(event)".
static HTMLImg GetHTMLImage(java.lang.String strImageName, boolean bSmallImage)
          Helper function to retrieve an HTML image, large or small.
static HTMLImg GetHTMLImage(java.lang.String strImageName, boolean bSmallImage, java.lang.String strAlt)
          Helper function to retrieve an image and specify the Alt
static java.lang.String GetNewObjectName(int intClassID, AActivitySpace asOwner)
          This helper function returns a localized new object name based on a classID.
static java.lang.Object[][] GetQueryFilter(int nOperand, int nOperator, java.lang.Object objValue)
          Returns a simple queryfilter based on three parameters
static HTMLImg GetSpacerImage(java.lang.String strWidth, java.lang.String strHeight)
          Helper function to retrieve the spacer image with specified dimensions
static HTMLElementCollection GetStyleSheetLinks(IPTSession ptSession, AActivitySpace asOwner)
          Deprecated. Use AActivitySpace.GetStyleSheetLinks() or LoginHelper.INSTANCE.GetStyleSheetLinks instead. This method is just here for backwards compatibility. AActivitySpace now has a base implementation that returns the appropriate style sheets, and LoginHelper also has a method that returns the style sheets.
static boolean IsEditingDefaultProfile(AActivitySpace space)
          This method checks whether or not the current session is editing a default profile user.
static boolean IsEditingDefaultProfile(ISessionManager _persistentSubSession)
          This method checks whether or not the current session is editing a default profile user.
static boolean IsGuestSession(AActivitySpace asOwner)
          Determines if this is a gues session or not as part of checking basic access.
static HTMLElement MakeCreateObjectLink(int nCLASSID, java.lang.String strProviderCLSID, int nObjectID, java.lang.String strLink, AActivitySpace asOwner, int intOpenerMode, java.lang.String strArgs, boolean bCloseWindowOnExit)
          Makes a simple link that creates an object in the parent window - passing in the added arguments.
static HTMLElement MakeCreateObjectLink(int nCLASSID, java.lang.String strProviderCLSID, int nFolderID, java.lang.String strLink, AActivitySpace asOwner, java.lang.String strArgs, boolean bCloseWindowOnExit)
          Makes a simple link that creates an object in the parent window - passing in the added arguments.
static java.lang.String PBReadString(IXPPropertyBag ptPropBag, java.lang.String sPropID, java.lang.String strDefault)
          Reads a String value from a property bag.
static void SetUIError(AActivitySpace asOwner, OpenLogComponent uiComponent, java.lang.String strFunctionName, java.lang.Exception e, boolean bThrow, UIErrorLevel uiErrorLevel, java.lang.String strErrorMessage)
          This helper function sets a UI Error with the messages specified, and optionally throws an exception.
static void StaticInit(PTConfigVarPack varpack)
          Initializes global language and stylesheet settings using the given config settings.
static java.lang.String TrimCardLanguage(java.lang.String strLanguage)
          Inxight languages are specified as a two character string (like "en" or "fr"), with the exception of the chinese languages which can be "zh-TW" or "zh-CN"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_strDefaultStyleSheet

public static java.lang.String s_strDefaultStyleSheet
The default style sheet should only be used by the common code that determines style sheets.


SMALL_IMAGE

public static final java.lang.String SMALL_IMAGE
Small Image

See Also:
Constant Field Values

LARGE_IMAGE

public static final java.lang.String LARGE_IMAGE
Large Image

See Also:
Constant Field Values

GIF_TYPE

public static final java.lang.String GIF_TYPE
Gif type

See Also:
Constant Field Values

PORTAL_IMAGE_PAGE

public static final java.lang.String PORTAL_IMAGE_PAGE
Portal image page

See Also:
Constant Field Values

STYLE_PREFIX_508

public static final java.lang.String STYLE_PREFIX_508
508 mode style sheet prefix

See Also:
Constant Field Values

DPROFILE_EDITOR_SESSION_FLAG

public static final java.lang.String DPROFILE_EDITOR_SESSION_FLAG
Name of the session flag indicating being in the default profile editor. Defined in the gateway so that the AppDataObject can access it too. This is stored on the persistent session.

See Also:
Constant Field Values

STR_JS_FUNC_NAME_EXECUTE_VIA_ENTER

public static final java.lang.String STR_JS_FUNC_NAME_EXECUTE_VIA_ENTER
To execute a javascript function when you press enter in a input field, set the onkeypress attribute of the input equal to "return executeViaEnter(event)". Also include the HTMLScript returned by GetExecuteViaEnterJScript in your page. Example: myInput.SetOnKeyPress("return " + PlumtreeHelpers.STR_JS_FUNC_NAME_EXECUTE_VIA_ENTER + "(event);");

See Also:
Constant Field Values
Constructor Detail

PlumtreeHelpers

public PlumtreeHelpers()
Method Detail

GetHTMLImage

public static HTMLImg GetHTMLImage(java.lang.String strImageName,
                                   boolean bSmallImage)
Helper function to retrieve an HTML image, large or small. Alt is not specified

Parameters:
strImageName - - The image name
bSmallImage - - True for a small image
Returns:
HTMLImg

GetHTMLImage

public static HTMLImg GetHTMLImage(java.lang.String strImageName,
                                   boolean bSmallImage,
                                   java.lang.String strAlt)
Helper function to retrieve an image and specify the Alt

Parameters:
strImageName - - The image name
bSmallImage - - True if a small image
strAlt - - The alt tag
Returns:
HTMLImg

GetSpacerImage

public static final HTMLImg GetSpacerImage(java.lang.String strWidth,
                                           java.lang.String strHeight)
Helper function to retrieve the spacer image with specified dimensions

Parameters:
strWidth - Width of the spacer image
strHeight - Height of the spacer image
Returns:
The spacer image

MakeCreateObjectLink

public static HTMLElement MakeCreateObjectLink(int nCLASSID,
                                               java.lang.String strProviderCLSID,
                                               int nObjectID,
                                               java.lang.String strLink,
                                               AActivitySpace asOwner,
                                               int intOpenerMode,
                                               java.lang.String strArgs,
                                               boolean bCloseWindowOnExit)
Makes a simple link that creates an object in the parent window - passing in the added arguments.

Parameters:
nCLASSID - - The classID for the objecdt
strProviderCLSID - - If it is an extensibility object the CLSID
nObjectID - - The parent admin folder id in create mode, or the objectID in Edit mode
strLink - - The text for the anchor
asOwner - - The activity space owner
intOpenerMode - - The opener mode - IPTOpenerConstants. OPENER_MODE_CREATE or IPTOpenerConstants.OPENER_MODE_EDIT
strArgs - - Optional querystring arguments
bCloseWindowOnExit - - Close the window on exit?
Returns:
HTMLElement
Throws:
HTMLException

MakeCreateObjectLink

public static HTMLElement MakeCreateObjectLink(int nCLASSID,
                                               java.lang.String strProviderCLSID,
                                               int nFolderID,
                                               java.lang.String strLink,
                                               AActivitySpace asOwner,
                                               java.lang.String strArgs,
                                               boolean bCloseWindowOnExit)
Makes a simple link that creates an object in the parent window - passing in the added arguments. This version of the function defaults to create mode

Parameters:
nCLASSID - - The classID for the objecdt
strProviderCLSID - - If it is an extensibility object the CLSID
nFolderID - - The parent admin folder id
strLink - - The text for the anchor
asOwner - - The activity space owner
strArgs - - Optional querystring arguments
bCloseWindowOnExit - - Close the window on exit?
Returns:
HTMLElement
Throws:
HTMLException

EveryoneHasAccess

public static boolean EveryoneHasAccess(IPTServerContext ptObject)
Returns true if the everyone group is on the ACL for the object passed in, false otherwise

Parameters:
ptObject -
Returns:
boolean

GetQueryFilter

public static java.lang.Object[][] GetQueryFilter(int nOperand,
                                                  int nOperator,
                                                  java.lang.Object objValue)
Returns a simple queryfilter based on three parameters

Parameters:
int - nOperand - the Plumtree PropID operand (of type PT_PROPIDS)
int - nOperator - the Plumtree Operator (of type PT_FILTEROPS)
Object - objValue - the value to be filtered on (Integer, String, [], etc...)

GetStyleSheetLinks

public static HTMLElementCollection GetStyleSheetLinks(IPTSession ptSession,
                                                       AActivitySpace asOwner)
Deprecated. Use AActivitySpace.GetStyleSheetLinks() or LoginHelper.INSTANCE.GetStyleSheetLinks instead. This method is just here for backwards compatibility. AActivitySpace now has a base implementation that returns the appropriate style sheets, and LoginHelper also has a method that returns the style sheets.

Returns a PTStyleSheetLink. A style sheet is named "stylesheetname- language", for instance "mainstyle12-en". This function creates a valid PTStyleSheetLink by collecting the style sheet name from the user's subportal, and the user's language from the activity space, then forming a PTStyleSheetLink object from this information.

Parameters:
Pass - in the ptSession, this function will look up the stylesheet name from the user's subportal.
Pass - in the ActivitySpace, this function will look up the current user's language.

StaticInit

public static void StaticInit(PTConfigVarPack varpack)
Initializes global language and stylesheet settings using the given config settings. Can only be called once globally.

Parameters:
varpack - a PTConfigVarPack

TrimCardLanguage

public static java.lang.String TrimCardLanguage(java.lang.String strLanguage)
Inxight languages are specified as a two character string (like "en" or "fr"), with the exception of the chinese languages which can be "zh-TW" or "zh-CN"


CheckCurrentUserIsAdmin

public static boolean CheckCurrentUserIsAdmin(IPTSession _ptSession)
Checks to see whether or not the user is in the Administrators group, using cached session's list of groups.

Parameters:
_ptSession - Current session
Returns:
True if user is in the Administrators group. Otherwise false.

GetExecuteViaEnterJScript

public static HTMLScript GetExecuteViaEnterJScript(java.lang.String strValidateFunction)
To execute a javascript function when you press enter in a input field, set the onkeypress attribute of the input equal to "return executeViaEnter(event)". Also include the HTMLScript returned by GetExecuteViaEnterJScript in your page. Example: myInput.SetOnKeyPress("return " + PlumtreeHelpers.STR_JS_FUNC_NAME_EXECUTE_VIA_ENTER + "(event);");

Returns:
myScript

IsGuestSession

public static boolean IsGuestSession(AActivitySpace asOwner)
Determines if this is a gues session or not as part of checking basic access.

Parameters:
AActivitySpace - current space
Returns:
boolean true if guest

SetUIError

public static void SetUIError(AActivitySpace asOwner,
                              OpenLogComponent uiComponent,
                              java.lang.String strFunctionName,
                              java.lang.Exception e,
                              boolean bThrow,
                              UIErrorLevel uiErrorLevel,
                              java.lang.String strErrorMessage)
This helper function sets a UI Error with the messages specified, and optionally throws an exception. The UI Error will contain the strings specified only, but the Debug log entry will also contain the text of the exception (e.getMessage())

Parameters:
asOwner - - The activity space in which the error was thrown
strFunctionName - - The function that trapped the error (e.g. MyModel::CheckEditorAccessAndStart)
uiComponent - - The UI component in which the error occurred, e.g. OpenLogService.GetComponent("Portal_UI_Infrastructure")
e - - The exception that has been thrown
bThrow - - Throw an XPException in addition to setting the error?
uiErrorLevel - - The error level (e.g. UIErrorLevel.SERIOUS)
strErrorMessage - - The error message string to be displayed

GetNewObjectName

public static java.lang.String GetNewObjectName(int intClassID,
                                                AActivitySpace asOwner)
This helper function returns a localized new object name based on a classID. It is used by the editor framework to suggest object names for newly created objects.

Parameters:
intClassID - - The classID of the object
asOwner - - The activity space this is being called from
Returns:
String - The new object name

PBReadString

public static java.lang.String PBReadString(IXPPropertyBag ptPropBag,
                                            java.lang.String sPropID,
                                            java.lang.String strDefault)
Reads a String value from a property bag. Returns strDefault if the value was not found or an error occurred. Copied from ModelHelpers in PortalPages. We may want to put this and other property bag helpers into their own class, or unifying class.

Parameters:
sPropID -
ptPropBag -
strDefault -
Returns:
String

IsEditingDefaultProfile

public static boolean IsEditingDefaultProfile(AActivitySpace space)
This method checks whether or not the current session is editing a default profile user.

Parameters:
space -
Returns:
True implies the current user is edting a default profile.

IsEditingDefaultProfile

public static boolean IsEditingDefaultProfile(ISessionManager _persistentSubSession)
This method checks whether or not the current session is editing a default profile user.

Parameters:
_persistentSubSession -
Returns:
True implies the current user is edting a default profile.



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.