The ALI Scripting Framework is a client-side JavaScript library that provides services to portlets and hosted gatewayed pages. (For details on the gateway, see Portal to Remote Server Communication). The Portlet Communication Component (PCC) is contained within the Scripting Framework.
These concepts also apply to pagelets deployed in Ensemble; a portlet is a pagelet designed for use in the ALI portal.
The ALI Scripting Framework allows portlets to:
Store and share session state through browser level variables. Browser-level variables can be stored and shared among portlets, even portlets that are not on the same page. For example, a value entered by the user in one portlet can be retrieved by another. The Scripting Framework acts as an intermediary, allowing all portlets in the portal access to all values stored in a common session. For details, see Session Preferences.
Leverage page-level events. A portlet can respond when specific events happen, such as when the page loads or when the browser focus changes. For details, see Notification Services.
Refresh portlet content without reloading the portal page. Portlets can reload their internal content without refreshing the portal page. For details, see In-Place Refresh.
Open any ALI object from anywhere within the portal. The CommonOpener_OpenObject function is included in every page generated by the ALI application, and can be called from any piece of UI or from within a portlet. For details, see Using the Common Opener. Portlets can also call the function remotely through the PRC. You can also reference ALI objects in portlets and UI components using Adaptive Tags.
For a full list of classes and methods, see the JSPortlet API documentation. To download the sample code referenced in this section, see the ALI Scripting Framework Samples in dev2dev code share.
The following best practices apply to all code that utilizes the ALI Scripting Framework.
|
|
Forms and functions must be uniquely named. You must use the GUID of a portlet when forming unique names and values to avoid name collisions with other code on the page. You can append the portlet ID using the pt:namespace and pt:token tags, as shown in the code below. (For details on Adaptive Tags, see Adaptive Pagelets: Using Adaptive Tags.)
Valid values for the token must be in the ASCII range 0x21 to 0x7E, excluding "<" (0x3C). The scope of the token runs from the tag defining it to the end of the file; you cannot use a token prior to defining it. A second pt:namespace tag with a different token redefines it; two tokens cannot be defined at the same time. | |
|
|
Gateway all URLs. You cannot make a request to a URL whose host/port differs from that of the calling page. All URLs requested through JavaScript must be gatewayed. For details on the portal gateway, see Portal to Remote Server Communication. For instruction on configuring gateway settings, see ALI Portlet Configuration and Ensemble Pagelet Configuration. | |
|
|
Check for ALI Scripting Framework support. The Scripting Framework is a standard AquaLogic Interaction feature starting with version 6.0. (The PCC component is installed with versions 4.5 and 5.x.) Earlier versions of the portal can be updated to support the ALI Scripting Framework with a JavaScript plug-in. For information, see the ALUI Developer Center on dev2dev. It is good practice to include code that determines whether or not the component is present. Ideally, your portlet should be able to handle either situation. The simplest solution is to precede your code with an If statement that alerts the user if the ALI Scripting Framework is not supported.
Note: Before version 5.0 of the portal, the PCC component was called the GCC (Gadget Communication Component). The document.GCC object is still supported in version 5.0. | |
|
|
Always
close all popup windows opened by a portlet when the portal window closes.
The ALI Scripting Framework can be used to close popup windows
using the onunload event. | |
|
|
Browsers might not process script blocks/includes added to the page through innerHTML property. You must add all required JavaScript to the page in advance:
|
Next: Session Preferences