In Liferay, you can call the Status widget by creating the portlet and specifying the source code. Review the following steps for producing the earlier Status widget example. Follow them as a model to configure the display and behavior of the Status widget in your implementation.
Follow these steps:
The New Web Content window appears.
The new portlet gets added to Liferay.
The portlet Settings appears.
The Source container opens for editing.
Source and Key Parameters
The source for the Status widget example follows:
<script type="text/javascript" src="http://hostname:portnumber/usm/explorer/scripts/status.widget.js"></script>
<script> CA_Catalog.buildWidget({type: 'status', login credentials, renderTo: 'status1', businessUnit:"London222", layout:'layout-2', openIn: '_widget', hideCart: true} ); </script>
<div align="center" id="status1" style="width: 400px; margin-bottom: 10px; height: 100px">
</div>
The first line references the JavaScript file for the Status widget.
The second line specifies the JavaScript with configuration parameters for the Status widget.
Note: Separate parameters with a comma, but do not specify a comma after the last parameter.
The third line specifies the DOM element in which the Status widget is rendered.
Key parameters and explanations follow for the CA_Catalog.buildWidget function call in the Status widget example.
login credentials
We recommend single-sign-on for widgets. However, if you require login credentials for this widget, specify them in this function call. Use the following format:
username: 'username', password: 'password'
Specifies that the widget is a Status widget.
Specifies that the widget is rendered into the DOM element whose ID is status1.
Specifies the business unit that catalog users can access while utilizing this Status widget. For this business unit and the business units under it, users can view the status of the requests for they have permission:
If you specify the root business unit, users can view the status of requests in all business units, including the root business unit. Conversely, if you specify the lowest level business unit, users can view the status of requests in that business unit only.
If you do not specify a value, the Catalog system uses the default business unit of the user accessing the widget.
Displays the options on the Status widget as buttons in a single row. The options are Cart, Open, Closed, and Pending.
Alternatively, specify layout-1 to display the options vertically: Each option appears on its own row in a table.
Specifies that other widgets on the same page listens to events from the Status widget and respond to them. In this scenario, when the user clicks an option on the Status widget, another widget responds by opening the target. The targets are as follows:
Option |
Target Function |
Widget |
Cart |
Shopping Cart |
Edit Request |
Open |
Open Requests |
Request List |
Closed |
Closed Requests |
Request List |
Pending |
Requests Pending Action |
Request List |
To enable these target functions to complete correctly when users click the option on the cart, add the following widgets to the page:
OpenIn specifies how a target opens when the user clicks it on the Status widget. Other possible values for this parameter follow:
Opens the target in the catalog, on the same page.
Performs the same function as _self, except that the target opens in the top-most frame of the browser. If the target is a frame, then the first associated frame in service option element is selected.
Opens the target on a new page.
Opens the target using a custom URL. The URL can include a placeholder for the object ID of the source context, for example, the service.
An example follows:
http://www.google.com?id={id}
Note: You can also specify the following settings, as shown in the source code: refresh rate in minutes and hide cart.
Copyright © 2013 CA.
All rights reserved.
|
|