260 likes | 391 Views
Simplifying the Development of Custom Channels. Dr. Pete Boysen Iowa State University. Problem: Need Portfolios Now!. Campus-wide initiative to develop e-Portfolios starting 2003 Four departments needed very different interfaces and data Attended OSPI v2.0 Duluth design meeting
E N D
Simplifying the Development of Custom Channels Dr. Pete Boysen Iowa State University
Problem: Need Portfolios Now! • Campus-wide initiative to develop e-Portfolios starting 2003 • Four departments needed very different interfaces and data • Attended OSPI v2.0 Duluth design meeting • Needed uPortal channels by Jan 2004 JA-SIG Conference -Denver 2004
Requirements • Multiple Personal and Class Portfolios • Close integration with uPortal (Authorization, LDAP etc.) • Integration with Open AFS for file storage • Non-portal user access (employers) • Rapid prototyping and deployment • Eventual CD Delivery JA-SIG Conference -Denver 2004
Result: Themes • Not uPortal themes! • Definition: a collection of resources (xslt, Java, images, documents etc.) to implement an application in channel • Single channel class (CThemes) supports multiple channel instances • Main Themes provide primary interface • Sub-themes support other themes • Distributed as cars JA-SIG Conference -Denver 2004
Structure of Talk • Demonstrationpersonal portfolios, class portfolios, departmental portfolios, forum, briefcase • HellouP example • Theme Development Process • Features JA-SIG Conference -Denver 2004
Demonstration • uPortal 2.1.4 example • Nested-Divs theme • Unadorned Focus mode Go! JA-SIG Conference -Denver 2004
Theme Design • Four major components – • View - visual layout of the channel • Rendering – specific view output for particular set of data • Datasource – Java class that converts raw data to XML document for view • Action – Java Class that implements functions requested by user JA-SIG Conference -Denver 2004
HellouP View Rendering 1 – view mode Rendering 2 – edit mode JA-SIG Conference -Denver 2004
Caching Strategies • Each view maintains renderings unless data change • XSLT stylesheets are cached at system level • Input documents are cached for each user unless changed during session • User cache flushes LRU documents JA-SIG Conference -Denver 2004
File System Configurations single multiple username helloup forums pboysen root 123 Pete’s Forum greeting.xml topic1 forum .users.xml categories.xml repository .access.xml forum.xml biography.xml JA-SIG Conference -Denver 2004 shared.xml
HellouP Datasource • greeting.xml<greeting> Welcome to <strong>uPortal</strong>! This is the default greeting. </greeting> • Uses FileDataSource • Caches document unless file modification date changes JA-SIG Conference -Denver 2004
HellouP Rendering greetings.xml parameters.xml <parameters> <entry name=“” value=“”/> </parameters> (from last rendering) home.xsl XHTML JA-SIG Conference -Denver 2004
home.xsl - heading <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:theme="http://www.iastate.edu/edu.iastate.ait.theme.Theme" xmlns:usercontext="http://www.iastate.edu/edu.iastate.ait.theme.UserContext" version="1.0"> <xsl:output method="html"/> <xsl:variable name="action" select="$parameters/entry[@name = 'action']/."/> <xsl:template match="/"> <theme:form base="/"> <theme:toolbar> <theme:tool icon="ShareFolder16.gif" condition="$authorization.grant" title="Share"> <theme:urlarg name="action" value="call"/> <theme:urlarg name="view" value="home"/> <theme:urlarg name="theme" value="authorization"/> </theme:tool> </theme:toolbar> <theme:space height="5"/> JA-SIG Conference -Denver 2004
home.xsl - body <table align="center" width="50%" border="0"> <xsl:if test="$helloup.edit and not($action = 'edit')"> <tr> <td align="right"> <theme:button action="edit" value="Edit"/> </td> </tr> </xsl:if> <tr> <td class="uportal-background-highlight" style="border:1px solid black"> <xsl:choose> <xsl:when test="$helloup.edit and $action = 'edit'"> <theme:textarea name="greeting" rows="10" format="html"> <xsl:copy-of select="$greeting/greeting/node()"/> </theme:textarea> <theme:space height="10"/> <theme:button action="save" value="Save"/> <theme:space/> <theme:button action="cancel" value="Cancel"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$greeting/greeting/node()"/> </xsl:otherwise> </xsl:choose> </td> </tr> </table> </theme:form> JA-SIG Conference -Denver 2004
HellouP - action User clicks on save… Sends parameter action=“save” (and other parameters) to action definition:<action name="save"> <write path="{$path}greeting.xml"> <transform xsl="xsl/savegreeting.xsl"> <file name="greeting" path="{$path}greeting.xml"/> </transform> </write> </action> JA-SIG Conference -Denver 2004
savegreeting.xsl <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:variable name="time" select="usercontext:getTime($userContext)" xmlns:usercontext="http://www.iastate.edu/edu.iastate.ait.theme.UserContext"/> <xsl:variable name="text" select="$parameters/entry[@name = 'greeting']/."/> <xsl:template match="/"> <xsl:apply-templates select="$greeting/greeting"/> </xsl:template> <xsl:template match="greeting"> <greeting modified="{$time}" name="{$userName}"> <xsl:value-of select="tidy:parseString(string($text))" disable-output-escaping="yes" xmlns:tidy="http://www.iastate.edu/edu.iastate.ait.theme.TidyHelper"/> </greeting> </xsl:template> </xsl:stylesheet> JA-SIG Conference -Denver 2004
The Glue – theme.xml <?xml version="1.0"?> <theme name="helloup" debug="stylesheets,parameters"> <description>A demonstration of a theme allowing selected users to change greeting. </description> <home> <render> <transform xsl="xsl/home.xsl"> <file name="greeting" path="{$path}greeting.xml"/> </transform> </render> <action name="save"> <write path="{$path}greeting.xml"> <transform xsl="xsl/savegreeting.xsl"> <file name="greeting" path="{$path}greeting.xml"/> </transform> </write> </action> </home> </theme> JA-SIG Conference -Denver 2004
Authorization • Authorization theme – views to manage authorization for a project • Stores authorizations in .users.xml of project • Each theme defines its own activities and roles (activity groups) • Permits access by both uPortal users and external users JA-SIG Conference -Denver 2004
authorization.xml <?xml version="1.0"?> <authorization name="helloup"> <activities> <activity name="helloup.edit">Let's the user edit the greeting</activity> <include theme="authorization"/> </activities> <roles> <owner> <grant activity="helloup.edit"/> <grant activity="authorization.grant"/> </owner> <role name="collaborator"> <grant activity="helloup.edit"/> </role> </roles> </authorization> JA-SIG Conference -Denver 2004
Datasources JA-SIG Conference -Denver 2004
Actions JA-SIG Conference -Denver 2004
<theme:taglib> • Common components to generate standard XHTML • Supports mail, HTML editor, upload and download of files • Runtime translation • Examples – theme:form, theme:toolbar, theme:radiolist, theme:mail JA-SIG Conference -Denver 2004
Debugging Options • Selectively log stylesheets, parameters and documents by theme • Error interface to capture browser and system information of user, stack trace and current state • Property locations for bugs and debugging • Global switch to turn off for production JA-SIG Conference -Denver 2004
Features - 1 • File management based on HyperContext1.3 • Provides authenticated access for non-uPortal users • Provides automated bug reporting • Permits themes built from themes • Many themes require no Java Programming • Supports custom Java Datasources and Actions JA-SIG Conference -Denver 2004
Features - 2 • Aggressive caching of stylesheets, documents and output • Java CD viewer planned • Built-in uploading/downloading of files • Integrated with JavaMail • Icon Library (Sun) • HTML Editing JA-SIG Conference -Denver 2004
Availability • Available by August, 2004 • Contact: pboysen@iastate.edu JA-SIG Conference -Denver 2004