|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--PTPortlet
A client-side object wrapper for a Portlet. Contains methods for accessing portlet attributes, in-place-refresh
of portlet content, firing and listening for portlet events, and the getting/setting of session preferences.
Usage:
var myportlet = PTPortlet.getPortletByID(227);
myportlet.setSessionPref('mypref', 'myprefvalue');
myportlet.refresh('nextpage.jsp');
VU: adding special constructor for Runner and future apps
takes an extra parameter to indicate what application is calling this
1=Portal
2=Runner
3=?Field Summary | |
<private> Object |
_eventListeners
A hash of namespaces containing eventListener handlers and eventListenerIDs |
<private> Object |
_refreshTimeout
The window.setTimeout key of the last window.setTimeout set for this portlet. |
Object |
callingApplication
|
<private> Object |
className
Class Name. |
String |
containerID
The id attribute of the portlet's corresponding HTML element |
String |
gatewayPrefixURL
The URL of the gateway prefix |
String |
guid
The portlet object's global unique id |
String |
id
The portlet object's id |
Boolean |
isCollapsed
Whether or not the portlet is currently collapsed (optional) |
String |
name
The portlet's internationalized name |
Number |
refreshInterval
The portlet's refresh interval, in milliseconds (optional) |
String |
refreshURL
The URL to use for refreshing the portlet (optional) |
String |
remoteBaseURL
The base URL of the portlet's remote server |
String |
remoteRequestURL
The fully qualified URL of the portlet's web service |
Object |
responseErrorHandler
The handler to call when a response error occurs, if the default behavior is undesirable (string or function reference, optional) |
Array |
responseErrors
An array of response error objects. |
Object |
responsePostProcHandler
The handler to call after calling the response handler (string or function reference, optional) |
Object |
responsePreProcHandler
The handler to call before calling the response handler. |
String |
secureGatewayPrefixURL
The secure URL of the gateway prefix |
<private> <static> Object |
SESSION_PREF_NAME_PREFIX
Prefix appended to session pref names for http transmission (string) |
<static> <final> Object |
VERSION
|
Constructor Summary | |
PTPortlet
(id, guid, name, containerID, remoteRequestURL, remoteBaseURL, gatewayPrefixURL, secureGatewayPrefixURL, isCollapsed, refreshURL, refreshInterval, callingApplication)
PTPortlet object constructor |
Method Summary | |
<private> void
|
_clearRefreshTimer()
Clears the refresh timer |
<private> Object
|
_createGetRefreshRequest(url,form,requestHeaders,type)
Create and invoke a request or refresh request to the server using GET |
<private> Object
|
_createPostRefreshRequest(url,form,requestHeaders)
Create and invoke a refresh request to the server using POST |
<private> void
|
_handleResponseErrorXML(xmlDoc,response)
Process error XML returned by the portal |
<private> Object
|
_refreshErrorHandler(response)
Handles responses to refresh requests by examining them for errors |
<private> void
|
_startRefreshTimer()
Starts the refresh timer, first clearing out any previously set refresh timer for this portlet. |
void
|
clearEvent(eventName,eventNamespace)
Clears the event listener for an event |
void
|
clearRefreshInterval()
Sets the refreshInterval of the portlet to 0 and clears any current refresh timers.
|
PTHTTPPOSTRequest
|
deleteSessionPref(name)
Deletes a single session pref |
PTHTTPPOSTRequest
|
deleteSessionPrefs(array)
Deletes multiple session prefs |
void
|
formGetRefresh(form,requestHeaders)
Requests updated content from the server by submitting a form GET request |
void
|
formPostRefresh(form,requestHeaders)
Requests updated content from the server by submitting a form POST request |
Object
|
formRefresh(form,requestHeaders)
Requests updated content from the server by submitting a form |
Number
|
getRefreshInterval()
Returns the refreshInterval of the portlet, in milliseconds.
|
String
|
getRefreshURL()
Returns the refresh URL of the portlet |
String
|
makeAbsoluteURL(url)
Make a URL into an absolute URL |
void
|
raiseEvent(eventName,eventArgs,eventNamespace)
Raise an new event |
Object
|
refresh(url,requestHeaders)
Refresh the portlet content from the server. |
void
|
refreshOnEvent(eventName,eventNamespace)
Associate portlet refresh action with a specific event |
void
|
registerForEvent(eventName,eventCallback,eventNamespace)
Register to be notified of an event |
Object
|
request(url,requestHeaders)
Replace the portlet content with new content from the server. |
void
|
setInnerHTML(html)
Sets the innerHTML of the portlet from a string
|
void
|
setRefreshInterval(refreshInterval)
Sets the refreshInterval of the portlet (in milliseconds) and resets the refresh counter to zero.
|
String
|
setRefreshURL(url)
Sets the refresh URL of the portlet |
String
|
transformURL(url)
Transform a URL to be gatewayed VU: Switch transformation types according to what the calling application is |
<static> <private> Hash
|
_getSessionPrefsFromXML(xmlDoc)
Returns a hash of name/value pairs when passed a valid session prefs XML Document. |
<static> <private> PTHTTPPOSTRequest
|
_postSetSessionPrefs(postContent,invokerPortlet)
Posts request to set session prefs on server |
<static> <private> Hash
|
_processGetSessionPrefs(postContent,invokerPortlet)
Posts request to get session prefs from server and returns session prefs as a hash |
<static> PTPortlet
|
getPortletByGUID(guid)
Returns a single portlet, given an GUID |
<static> PTPortlet
|
getPortletByID(id)
Returns a single portlet, given an ID |
<static> PTPortlet
|
getPortletByName(name)
Returns a single portlet, given a name NOTE: There is no restriction against having multiple portlets on the same page which have the same name, so portlet lookup by name in these cases is not guaranteed. |
<static> String
|
getSessionPref(name)
Get a single session pref Undefined pref returns empty string. |
<static> Hash
|
getSessionPrefs(names)
Get multiple session prefs Undefined prefs return empty string. |
<static> PTHTTPPOSTRequest
|
setSessionPref(name,value)
Set a single session pref |
<static> PTHTTPPOSTRequest
|
setSessionPrefs(hash)
Set multiple session prefs |
Field Detail |
<private> Object _eventListeners
<private> Object _refreshTimeout
Object callingApplication
<private> Object className
String containerID
String gatewayPrefixURL
String guid
String id
Boolean isCollapsed
String name
Number refreshInterval
String refreshURL
String remoteBaseURL
String remoteRequestURL
Object responseErrorHandler
Array responseErrors
Object responsePostProcHandler
Object responsePreProcHandler
String secureGatewayPrefixURL
<private> <static> Object SESSION_PREF_NAME_PREFIX
<static> <final> Object VERSION
Constructor Detail |
PTPortlet(id, guid, name, containerID, remoteRequestURL, remoteBaseURL, gatewayPrefixURL, secureGatewayPrefixURL, isCollapsed, refreshURL, refreshInterval, callingApplication)
id
- The portlet object's id (string)
guid
- The portlet object's global unique id (string)
name
- The portlet's internationalized name (string)
containerID
- The id attribute of the portlet's corresponding HTML element (string)
remoteRequestURL
- The fully qualified URL of the portlet's web service (string)
remoteBaseURL
- The base URL of the portlet's remote server (string)
gatewayPrefixURL
- The URL of the gateway prefix (string)
secureGatewayPrefixURL
- The secure URL of the gateway prefix (string)
isCollapsed
- Whether or not the portlet is currently collapsed (boolean, optional)
refreshURL
- The URL to use for refreshing the portlet (string, optional)
refreshInterval
- The portlet's refresh interval, in milliseconds (integer, optional)
responsePreProcHandler
- The handler to call before calling the response handler. Returning false from this handler cancels the call to the response handler. (string or function reference, optional). Important: Most in-place refresh actions are already making use of the responsePreProcHandler to inspect the response for errors before proceeding. If you wish to override the responsePreProcHandler for a portlet, make sure to add in an explicit call to _refreshErrorHandler and pass in the response to check for errors manually; otherwise default error-handling for your portlet's in-place refresh activities will be disabled.
responsePostProcHandler
- The handler to call after calling the response handler (string or function reference, optional) Author Patrick Corcoran
Method Detail |
<private> void _clearRefreshTimer()
<private> Object _createGetRefreshRequest(url,form,requestHeaders,type)
<private> Object _createPostRefreshRequest(url,form,requestHeaders)
<private> void _handleResponseErrorXML(xmlDoc,response)
<private> Object _refreshErrorHandler(response)
<private> void _startRefreshTimer()
interval
- Interval to set for new refresh timer, in milliseconds (integer, optional)
void clearEvent(eventName,eventNamespace)
eventName
- The name of the event to clear (string)
eventNamespace
- The namespace for the event (string, optional)
void clearRefreshInterval()
refreshInterval
of the portlet to 0 and clears any current refresh timers.PTHTTPPOSTRequest deleteSessionPref(name)
name
- The name of the pref to be deleted (string)
PTHTTPPOSTRequest deleteSessionPrefs(array)
array
- Array of named values to be deleted (Array)
void formGetRefresh(form,requestHeaders)
form
- Specifies the form to submit via GET. This method will accept a form name, a form id, or a reference to the form object. Note that form elements of type FILE, IMAGE, and SUBMIT are ignored. If you need the value for a SUBMIT element to be passed to the server, you should create a HIDDEN element whose name and value are equivalent to the SUBMIT element, and the HIDDEN element will be passed through in its place.
requestHeaders
- Headers to set in the HTTP request (associative array, optional)
void formPostRefresh(form,requestHeaders)
form
- Specifies the form to submit via POST. This method will accept a form name, a form id, or a reference to the form object. Note that form elements of type FILE, IMAGE, and SUBMIT are ignored. If you need the value for a SUBMIT element to be passed to the server, you should create a HIDDEN element whose name and value are equivalent to the SUBMIT element, and the HIDDEN element will be passed through in its place.
requestHeaders
- Headers to set in the HTTP request (associative array, optional)
Object formRefresh(form,requestHeaders)
form
- Specifies the form to submit. This method will accept a form name, a form id, or a reference to the form object. Note that form elements of type FILE, IMAGE, and SUBMIT are ignored. If you need the value for a SUBMIT element to be passed to the server, you should create a HIDDEN element whose name and value are equivalent to the SUBMIT element, and the HIDDEN element will be passed through in its place.
requestHeaders
- Headers to set in the HTTP request (associative array, optional)
Number getRefreshInterval()
refreshInterval
of the portlet, in milliseconds.String getRefreshURL()
String makeAbsoluteURL(url)
url
- The URL to be gatewayed (string)
void raiseEvent(eventName,eventArgs,eventNamespace)
eventName
- The name of the event to be raised (string)
eventArgs
- A hash of arguments to be passed with the event (object, optional)
eventNamespace
- The namespace for the event (string, optional)
Object refresh(url,requestHeaders)
url
- URL to use for refreshing content (string, optional)
requestHeaders
- Headers to set in the HTTP request (associative array, optional)
void refreshOnEvent(eventName,eventNamespace)
eventName
- The name of the event which triggers refresh action (string)
eventNamespace
- The namespace for the event (string, optional)
void registerForEvent(eventName,eventCallback,eventNamespace)
eventName
- The name of the event (string)
eventCallback
- The name of a function or a reference to a function which serves as a callback when the event is triggered (string or function)
eventNamespace
- The namespace for the event (string, optional)
Object request(url,requestHeaders)
url
- URL to use for the new content (string, required)
requestHeaders
- Headers to set in the HTTP request (associative array, optional)
void setInnerHTML(html)
innerHTML
of the portlet from a stringhtml
- The html to be rendered (string)
void setRefreshInterval(refreshInterval)
refreshInterval
of the portlet (in milliseconds) and resets the refresh counter to zero.
Setting a refreshInterval less than 1000ms (1 second) is not recommended. Shorter intervals can precipitate race conditions between server and client.refreshInterval
- (integer)
String setRefreshURL(url)
url
- to set as refreshURL
String transformURL(url)
url
- The URL to be gatewayed (string)
<static> <private> Hash _getSessionPrefsFromXML(xmlDoc)
<static> <private> PTHTTPPOSTRequest _postSetSessionPrefs(postContent,invokerPortlet)
<static> <private> Hash _processGetSessionPrefs(postContent,invokerPortlet)
<static> PTPortlet getPortletByGUID(guid)
guid
- GUID of Portlet being requested (string)
<static> PTPortlet getPortletByID(id)
guid
- ID of Portlet being requested (string)
<static> PTPortlet getPortletByName(name)
name
- Name of Portlet being requested (string)
<static> String getSessionPref(name)
name
- The name of the pref to be retrieved (string)
<static> Hash getSessionPrefs(names)
names
- The names of the prefs to be retrieved (Array of strings)
<static> PTHTTPPOSTRequest setSessionPref(name,value)
name
- The name of the pref to be set (string)
value
- The value of the pref to be set (string)
<static> PTHTTPPOSTRequest setSessionPrefs(hash)
hash
- Associative array of name/value pairs to be set (string)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |