The Common Opener allows you to open any ALI object from anywhere within the portal. (To retrieve an URL as a String or HTMLAnchor object, use ASURL.)
The PTCommonOpener class is included in every page generated by the ALI application, and can be called from any piece of UI or from within a portlet. Portlets can also call functions remotely through the PRC. The most commonly used function in this class is getOpenerURLOpenObjID.
getOpenerURLOpenObjID (_nClassID, _nObjectID, _strOptQSArgs, _nOpenerMode)
nClassID refers to the numeric ID for the type of object being opened (e.g., User = 1, Portlet = 43, Content Source = 35). A full list of object types can be found in the PTCLASSDESCRIPTION table in the com.plumtree.portaluiinfrastructure.classtypedescriptors package.
nObjectID is the identifier for the specific object being opened. Every object has a unique identifier (ObjectID) stored within the database (e.g., for the Users object type: Administrator = 1, Guest = 2, Default Profile = 3, etc.). The ObjectID can be retrieved through the com.plumtree.server package and usually through a QueryResult.
strOptQSArgs allows you to add arguments to the query string that are not included by default. This argument may be empty.
nOpenerMode defines the mode in which the object will be opened, which controls the actions that can be performed on the object (i.e., Create = 0, Edit = 1, View = 2, View Meta Data = 3).
As noted above, the getOpenerURLOpenObjID function returns a URL. To open the URL you must pass it to another function. PTCommonOpener includes two handy functions for opening URLs: openInSameWindow and openInNewWindow.
Call either of these functions in a standard OnClick event. The example below opens the User Editor ActivitySpace as the Administrator user in View mode.
value="Opener Click" type="Button" name="btnSubmit"
You can execute custom functionality whenever the Common Opener is used to open an object or direct to an ActivitySpace through the IOpenerActions PEI. For more details on PTCommonOpener and its functions, see the Common Opener API documentation. To download the samples referenced on this page, see the ALI Scripting Framework Samples in dev2dev code share.
As noted earlier, PTCommonOpener functions can be called from within any ALI-based portal page. You can also use these functions in a custom editor or browsing page by making a call to the Opener ActivitySpace. The Common Opener functionality can be implemented in a variety of ways; the method explained here is the easiest and most commonly used.
Note: To use the following method, first import the package that contains the Opener ActivitySpace (com.plumtree.portaluiinfrastructure.classtypedescriptors.classframework).
Next: Using ASURL and Redirect