Mail Portlet v1.0


Table of Contents

Foreword
1. About, Prereqs, and Dependencies
1.1. Prerequisites
1.2. Dependencies
Compile/Test Time
RunTime
2. Configuration, Compilation, and Deployment
2.1. Configuration
2.2. Compilation
2.3. Deploying the portlet to Tomcat
Installing the Portlet (uPortal only)
3. Data Formats
3.1. Feed Lists
4. Customizing the Portlet
4.1. CSS
4.2. JSP

Foreword

The Internet Frameworks Services division of Duke University's Office Of Information Technology (OIT) has created a number of portlets used in the student portal, DukePass. We have released the source code for these portlets under the JA-SIG License.

We encourage anyone with an interest to download, install, and use these portlets. Our portal installation uses uPortal version 2.5.3, but we have tried wherever possible to create JSR-168 compliant portlets that should run in any portlet container.

1. About, Prereqs, and Dependencies

The Mail portlet is capable of fetching email headers from any IMAP server or POP server, although this version of the portlet has unacceptably slow POP mail retreival. This portlet is not intended to be a rich email client, rather a dashboard with a quick view of the X most recent email headers received.

1.1. Prerequisites

Before you begin, you should know how to deploy portlets into your portal environment. We developed and tested this portlet with uPortal v2.5.3, but it may work with other version of uPortal. If you discover a shortcoming in our code that we can correct to make the portlet more JSR-168 compliant, please let us know.

You will need to have ant and a Java 1.5+ compiler installed.

1.2. Dependencies

Where permissible, all dependencies are included in the /dep directory. These are separated into those dependencies required for runtime, and those required only for building (such as unit testing). Dependant libraries are listed below.

Compile/Test Time

  • JUnit 3.x
  • Servlet API
  • Portlet API
  • Spring Mock Objects

RunTime

  • Duke Core Services (included)
  • JavaMail (including Java Activation Framework)
  • Commons Codec
  • Commons Logging
  • Log 4j
  • Spring Framework 2.x
  • Spring Portlet Support

2. Configuration, Compilation, and Deployment

2.1. Configuration

Unzip the distribution .zip file to a working directory that will be used to build and configure the portlet. Change to the working directory. All paths referenced below are relative to the working directory.

This portlet has a Spring-based configuration, so you should be able to change all relevant parameters in text files rather than changing the source code. However, you are welcome to change the source code to suit your needs if you are comfortable doing so.

2.2. Compilation

Once the configration is complete, you're ready to compile and create a deployable version of the portlet. By default, the portlet will be compiled in a format readily deployable for uPortal, a pluto-based portlet container. Alternate deployments will require modification of the portlet.xml file, the web.xml file, and possibly the build.xml file.

ant war

This will compile the application, run the unit tests, and generate a .war file that is ready to go into your portal environment.

If the build succeeds, you will find the .war file in /dist/**filename**.war where **filename** is the portlet-name you specified in build.properties

2.3. Deploying the portlet to Tomcat

Deploying the portlet only requires copying the portlet .war file to your servlet's webapp directory.

cp dist/socialnetportlet.war $TOMCAT_HOME/webapps

Installing the Portlet (uPortal only)

Every portlet container has a different method for installing a new portlet once it is deployed as a web application. Instructions are included here for installing the portlet for use with uPortal.

3. Data Formats

3.1. Feed Lists

4. Customizing the Portlet

4.1. CSS

This section details the CSS styles used to lay out the portlet. You'll need to change these to match the look and feel of your portal's themes and skins. As the standards evolve in CSS styling for portlets, we'll be converting these specific names to more general CSS classes as defined by the specs.

Here is the section of CSS we use to style the portlet at Duke. We chose to include all of our CSS in one .css file that's downloaded as a part of the portal page's template rather than distribute a .css file with each portlet.

Example 4.1. Mail CSS

       
                    /** Portlet Tabs **/
                    div.portletTabsWrap {background:#305291 url(./slices/drk-blue-short.png) repeat-x left top; margin:0; padding:0;}
                    ul.portletTabs {clear:both; margin:0; padding:0 0 0 8px;}
                    ul.portletTabs li {float:left;}
                    ul.portletTabs li a {float:left; display:block; padding:0 1em; margin:0 .1em 0 0; font-size:1em; font-weight:bold; line-height:1.5; color:#FFF;}
                    ul.portletTabs li a.current, ul.portletTabs li a:hover {background-color:#FFF; color:#003366;}
                    
                    /** Mail Portlet **/
                    div.mailMessages div.messageContent {clear:both; padding:.5em;}
                    div.mailMessages table {clear:both; margin:1em 0; width:100%; border-collapse:collapse;}
                    div.mailMessages table tr td {padding:0 10px;}
                    div.mailMessages table tr td a {display:block; padding:.2em 0;}
                    /*div.mailMessages table tr td a:hover {background-color:#C9D4EA;}*/
                    div.mailMessages table tr {border-bottom:1px solid #FFF;}
                    div.mailMessages table tr.odd {background-color:#FDF9D9;}
                    div.mailMessages table tr.even {background-color:#FFFCE9;}
                    div.mailMessages table tr td.from {}
                    div.mailMessages table tr td.subject {}
                    div.mailMessages table tr td.time {text-align:right;}
                    div.mailMessages table div.mailError {}
                    
                    div#mailPortletEdit {}
                    div#mailPortletEdit div.currentAccounts {background-color:#F1F1F1; margin:10px 0; padding:5px;}
                    div#mailPortletEdit span.sectionTitle {display:block; line-height:1.5; font-weight:bold;}
                    div#mailPortletEdit div.addAccount {background-color:#F1F1F1; margin:10px 0; padding:5px;}
                    span.checkBackSoon {display:block;}
                    div.accountCreds {margin:10px 0;}
                    div.accountCreds span.txtField {display:block;}
                    div.accountCreds span.txtField span.fieldDescriptor {}
                    span.useInformation {display:block;}
                    /** IE 6 Fix -- http://www.positioniseverything.net/explorer/dup-characters.html 
                    div.message a span.time {margin-right:-3px;}
                    **/
                    
                

4.2. JSP

We've used CSS strategies that will flow wherever possible, however, our JSP assumes a fairly wide layout. Therefore you may want to re-tool how the data are laid out on your page. We've used Spring WebMVC with standard JSTL tags. There are, however, text strings embedded in the JSP. We'll be working to extract these strings to make internationalization a more straightforward procedure.