Jasig Widget Portlets Configuration and Installation

Installation

  1. Bundled by default in uPortal overlays.  No separate installation needed

Otherwise

  1. Download source from https://github.com/Jasig/JasigWidgetPortlets
  2. From the main project directory, run "mvn install".
  3. Deploy the resulting artifact using your portal's portlet deployment tool. To deploy to uPortal, change directories to the root of the uPortal project and run

    ant deployPortletApp -DportletApp=/path/to/jasig-widget-portlets.war

Configuration

Google-based portlets

In order to use the Google-based portlets for a hostname other than "localhost", you will need to sign up for a Google API key for the portlet. The Jasig Widget Portlet project provides a custom CONFIG mode interface for setting the Google API key. In uPortal 3.2 and above, this configuration feature may be accessed through the Portlet Administration Portlet.

Simple JSP

  • Add a custom JSP page to uportal-portlets-overlay/jasig-widget-portlets/src/main/webapp/WEB-INF/jsp (in an overlay situation like the typical uPortal build) and  configure the SimpleJspPortletController.jspName portlet preference to specify JSP page (see preferences in Manage Portlets when creating the portlet)
  • You can access environment variables using markup such as <p>USER environment variable=<spring:eval expression="@systemEnvironment['USER']"/></p>
  • v2.0.1+:  You can access user attributes in the JSP (user attributes must also be listed in the portlet.xml) using userInfo; e.g. something like  <c:out value="${userInfo['attributeName']}"/>
  • v2.0.3+:  The portlet supports an is<rolename> property to use in the JSP (e.g. <c:if test="${isFaculty}">...</c:if>) to allow for conditional menu building for sidebar menus, etc.  If needing other than standard security roles (faculty, staff, students), you must add additional security roles to a portlet.xml in the Jasig Widget overlay and specify the list of all the security roles as a portlet preference.  See comments in portlet.xml.

  • v2.1.7+:  The SimpleJSP can also use values from a property file called simple-jsp.properties at the root of the classpath.  In the portlet you'd reference the property using something like <c:out value="${property['property.name']}"/>.  You can use the overlays process to add your own property values to uportal-portlets-overlay/jasig-widget-portlets/src/main/resources/simple-jsp.properties.

Example:  Replace the SimpleCMS logo in uPortal 4.1 with an image using SimpleJSP

  1. Add the image file to uportal-portlets-overlay/jasig-widget-portlets/src/main/webapp/images.
  2. Add a  JSP page (say myLogo.jsp) that references the image using the HTML img element to uportal-portlets-overlay/jasig-widget-portlets/src/main/webapp/WEB-INF/jsp.
  3. Publish a new instance of the JasigWidgetsPortlet SimpleJSP portlet using the admin UI (Manage Portlets) or by creating a new XML file (I suggest the former, then export it to your src/main/data folder when done so it is available with an ant initdb on your test and prod systems)
    1. In the Admin UI, edit the preferences and add a preference "SimpleJspPortletController.jspName" and set to it myLogo (the jsp folder and .jsp extension are assumed)
  4. Update respondr-lo.fragment-layout.xml file and replace channel portal-logo with the portlet you created (using the portlet fname you added in step 2).  Reimport the fragment-layout file using the Import/Export feature in the Admin UI, or use ant to do the data import.  Alternately, do an initdb to verify you have the portlet setup in your src/main/data properly.

Pluggable Data JSP

  • Add JSP page and custom Java class(es) to uportal-portlets-overlay.  You will likely need to add dependencies to Jasig Widgets overlay's pom.xml file to support your java classes
  • Place user-specified beans in a pluggableDataJspPortletContextOverrides.xml in the Jasig Widget's overlay referencing the custom Java class(es).
  • If using caching other than default, add custom ehcache.xml to Jasig Widget's overlay.
  • In the portlet publication (e.g. Manage Portlets from the admin UI), configure portlet preferences to specify the JSP page, Spring bean referencing the Java class as the data source, and if using custom cache the cache name from ehcache.xml.  See portlet.xml (https://github.com/Jasig/JasigWidgetPortlets/blob/master/src/main/webapp/WEB-INF/portlet.xml) for a list of the portlet preferences.
  • If needing other than standard security roles (faculty, staff, students), must add additional security roles to a copy of the portlet.xml put into the Jasig Widget overlay and specify security roles in portlet preference
  • JSP page
    • The objects returned from the configured dao are available in the page in the model object; e.g. ${model}.  If you set portlet preference 'PluggableDataJspPortlet.Controller.asJson' to true, the data from the dao will also be returned as JSON in the variable 'jsonData', though the JSON data is also accessible via a resourceURL request.

See PluggableDataJSP portlet in portlet.xml (https://github.com/Jasig/JasigWidgetPortlets/blob/master/src/main/webapp/WEB-INF/portlet.xml#L330),  comments in the code and spring configuration for additional details on configuration.

App Launcher Portlet

Configure portlet preferences for the following items.  See comments for the App Launcher Portlet in portlet.xml for more details.

  • icon size and URL
    • You can specify the icon URL using /jasig-widget-portlets/images/xxx.png if you have the icon in the images folder of the portlet.
  • app launcher URL.  Starting with jasig-widget-portlets version 2.1.2, the App Launcher Portlet will support using Spring EL for the URL.   The Spring EL context will include any property added to the app-launcher.properties file, all request parameters and all user info properties.    Examples:
    • http://${casserver}:${casport}/cas/Login?${request['service.url']}
      • casserver, casport should be added to an app-launcher.properties file
      • request['service.url'] represents a property passed from the request.   Note that for request parameters that do NOT include a period, the property can be referenced as ${request.param}.   If the parameter does include a period, the format must be ${request['property.with.period']}
    • http://${server}:${port}/service/view?userId=${user['user.login.id']}
      • server and port will be read from app-launcher.properties
      • ${user['user.login.id']} represents the users ID.
    • You can also access environment variables using the notation ${@systemEnvironment['TARGET_HOST']}.  Examples:
      • http://${@systemEnvironment['TARGET_HOST']}/app/guest
  • Link title and subtitle
  • Display strategy:
    • iframe: iframe in detached mode with banner allowing for return to uPortal
    • newWindow: Launch in new window
    • sameWindow: Replace current window with launch URL
  • Portlet preferences (not in rich config page):
    • AppLauncherPortletController.jspViewName
      • app/icon - displays icon with title and subtitle
      • app/iconOnly - displays icon.  Title and subtitle appear when you hover over the icon.

Cloud Drive

See Cloud Drive