jacquard 1.10.14 by The Web Engineering Factory and Toolworks

Package uk.co.weft.event

A simple on-line events diary; not really part of Jacquard, but included with it to demonstrate how Jacquard can be used.

See:
          Description

Class Summary
DayView A document generator which generates a DOM tree (effectively an XML document) representing events on a given day.
DiaryMonth A simple servlet form giving a month view on the events.
Event A form for editing an event.
EventsDiaryPseudoWidget A wrapper around CalendarPseudoWidget which takes events from the events database.
 

Package uk.co.weft.event Description

A simple on-line events diary; not really part of Jacquard, but included with it to demonstrate how Jacquard can be used.

About the events diary | Installing the diary | Sample Configuration | What to do next | License

About the events diary

The events diary as distributed comprises three servlets, DiaryMonth, which displays a month view of the diary, DayView, which displays a day view of the diary, and Event, which allows events in the diary to be edited.

Event is an example of a 'classic' Jacquard servlet. It simply wraps around a data table, providing widgets to allow editing of all of the fields. Apart from setting up the right widgets, it does nothing, depending on the underlying htform package to do all the business of authenticating the connection and inserting the right data in the tables.

DayView is an example of a new style, DOM based Jacquard servlet; it constructs a dom tree in memory and then uses an XSL stylesheet to format the final output.

Installing the diary

To install the diary, you need to do all of the following:

  1. Put dbutil.jar, domutil.jar, event.jar and htform.jar on the classpath of your Servlet engine.
  2. Get xerces.jar and xalan.jar from the Apache XML project and put them on the classpath of your Servlet engine.
  3. Create a database called event, using the database schema from event.psql. Any JDBC compliant database engine will do. You should put some data in the Author, Category, and Location tables.
  4. Configure your Servlet engine to run the event servlets, ideally in a servlet zone called 'event'. My sample configuration, for Apache JServ, is below.
  5. Put the JavaScripts from the htform package (files with filename extension '.js') in a directory called 'scripts' which is a direct subdirectory of your Web server document root (obviously you can configure this differently if you want).
  6. Put 'dayview.xsl' and 'jacquard.css' in a directory called 'styles' which is a direct subdirectory of your Web server document root (obviously you can configure this differently if you want).
  7. Put the events_example subdirectory anywhere under your Web server document root.
  8. Restart your Servlet engine

Sample Configuration

This is a sample zone properties file for Apache JServ; although your servlet engine may configure these things in different ways.

# Global Init Parameters
#########################

# Parameters passed here are given to each of servlets. 
#
# The value of the property is a comma delimited list of "name=value" pairs 
# that are accessible to the servlet via the method getInitParameter() 
# in ServletConfig.
# Syntax: servlets.default.initArgs=[name]=[value],[name]=[value],...
#
# stylesheet: the URL of the CSS style-sheet to be used to format the
#    servlet output. All htform-based servlets use this parameter.
# db_url: the JDBC URL of the event database. All Jacquard servlets
#    use this parameter.
# driver_name: the name of the JDBC database driver to use. All
#    Jacquard Servlets use this parameter
servlets.default.initArgs=stylesheet=/styles/jacquard.css,db_url=jdbc:postgresql://127.0.0.1:5432/event,driver_name=postgresql.Driver

# Servlet aliases and startup paramaters

# The DayView servlet, which will be served on the URL 
# http://your.host/event/dayview
# Note that the class of the servlet is not DayView, it's DocPage;
# DocPage is a sort of universal servlet for domutils.

servlet.dayview.code=uk.co.weft.domutil.DocPage

# Parameters:
# generator_class: the class that generates the document. All
#    domutil-based servlets require this parameter.
# db_username: by explicitly passing a database username and password,
#    we allow the servlet to query the database without prompting for
#    authorisation. All Jacquard servlets can use this parameter.
# db_password: as above. All Jacquard servlets can use this parameter.
# content_type: the MIME type of the content to be generated. All 
#    Jacquard servlets can use this parameter.
# xsl_stylesheet: the URL of the XSL stylesheet to be used to format
#    the servlet output. All domutil-based servlets use this parameter.

servlet.dayview.initArgs=generator_class=uk.co.weft.event.DayView,db_username=nobody,db_password=doesntmatter,content_type=text/html,xsl_stylesheet=http://localhost/styles/dayview.xsl

# The diary servlet, which will be served on the URL 
# http://your.host/event/diary

servlet.diary.code=uk.co.weft.event.DiaryMonth

# Parameters:
# title: The title for this servlet. All htform-based servlets use 
#    this parameter.

servlet.diary.initArgs=db_username=nobody,db_password=doesntmatter,title=Event
Diary

# The event entry form servlet, which will be served on the URL 
# http://your.host/event/diary. Note that it doesn't have a
# db_username or db_password, so it must prompt for them.

servlet.event.code=uk.co.weft.event.Event
servlet.event.initArgs=title=Add or edit an Event

What to do next

You'll notice that this package doesn't provide you with any means to add or edit categories, authors, or locations. Write three simple servlets to edit these, using Event as a model.

Copyright and License

The following is the whole of your license and warranty to use this package:

[Note: this is the 'BSD License' as endorsed by OpenSource.org.]

Copyright (c) 1998,1999, Simon Brooke. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WEFT TECHNOLOGY LTD OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.




jacquard 1.10.14 by The Web Engineering Factory and Toolworks