Classifieds

Documentation

Classifieds provides users with the ability to post and view ads. Users may edit and delete their own ads and portal administrators may edit and delete any ad as well as edit the ad categories. Ads are automatically expired based on expiration dates set by users. Classifieds uses groups and permissions to control the view, post and edit tasks. Ant is required for installation. It has been used on uP2.1.1-2.5 systems with PostgreSQL, Oracle, MSSql and MySQL.

Directory Structure

The extracted zip file contains the following subdirectories...

  • docs
  • images
  • properties
  • src
  • upgrade
  • XSL

...and the following files in the root...

  • build.properties
  • build.xml
  • jta.jar

Prerequisites

Classifieds makes use of the Groups and Permissions channels.

Installation

(Note: Installation requires ant to be setup on your environment.)

To install the Classifieds channel into uPortal 2.x, follow these steps:

  1. Download classifieds.1.2.zip from the Clearinghouse
  2. Extract the contents to your local channel collection (eg. c:\javaclasses\channels)
  3. Modify build.properties to match your environment. In particular, configure the database jars for your portal database. The default setup uses postgresql. The database should be running.
  4. Edit the file properties/chanpub/chandef/classifieds_data.xml and change the category names to the desired values. Putting number in front will help with sorting and specifying subcategories. Portal administrators may edit this list interactively after the channel is published.
  5. Run 'ant deploy'. This will put classifieds.jar in webapps/uPortal/WEB-INF/lib and copy the property files and images to the correct directories.
  6. Copy /chanpub/chandef/classifieds_data.xml and /chanpub/chandef/classifieds_tables.xml to $UPORTAL_HOME/properties/db/
  7. From uPortal Home run: ant db -Dusetable=-t -Dtablefile=/properties/db/class
    ifieds_tables.xml -Dusedata=-d -Ddatafile=/properties/db/classifieds_data.xml
  8. Restart the portal.
  9. Publish the channel either with the graphical channel publisher or by copying properties/chanpub/chandef/classifieds_def.xml to $UPORTAL_HOME/properties/chanpub and running ant pubchan -Dchannel=classifieds_def.xml

Permissions

You must assign permissions to everyone to view and post ads.

  • login as an adminstrator.
  • select Classifieds from the Permissions Manager channel.
  • Give Everyone permission to view and post Ads.
  • Give the Portal administrator privilege to manage classifieds (i.e. edit the categories.)
  • logout and login. The Post and Edit categories icons should appear for the administrator. The Post icon should appear for other users.

Usage

Users may add Ads by clicking on the new icon and providing the information requested. They may also select when the ad will expires (1 to 14 days). Other users may click on the ad name and view the information. Users may only delete their own ads.

Adminstrators may delete any ad and edit the list of categories. (info)Warning: If a category is deleted, all ads in that category will also be deleted.

A system task is run daily to delete expired ads. If you are using multiple processors for uPortal, you can edit the CClassifieds.java source code and restrict the expiration process to a single processor via ip address. Comments in the code explain how to do this.

Ad Approval

To enable the approval process, add the channel parameter approveAds with the value true and restart the server.

When a user posts an ad, the title will appear with the uportal-channel-warning style and 'Approval pending' will appear at the bottom of the display. The portal administrator will see the same indications.

To approve the ad, the portal administrator should edit the ad and click on the Approve button. To disapprove the ad, just delete it.

If you would like to add a policy statement to the channel, add the channel parameter policyURL with a valid url as the value and restart the server.

When the user chooses to post or edit an ad, a 'Important: Read Policy Statement' link will be added to the bottom of the display.

Date Formatting

Databases differ in how they store and process dates. The default date format is

yyyy-MM-dd hh:mm:ss

For Oracle or other databases, you may need to change this date format. To do this, add the channel parameter date.format with the appropriate value for your database and restart the server.

You may also change the date format displayed in the channel. Just define the parameter adFormat and restart the server.

I18n

Classifieds supports internationalization based on the user's browser preferences. To support a new language, follow these steps:

  1. Copy properties/classifieds.properties to a new file named with the appropriate language prefix. For example, classifieds_it.properties for Italian, classifieds_jp.properties for Japan etc.
  2. Edit the new properties file and change the English to the right of the equals to your language. For example,
    classifieds.category=Category:
    to
    classifieds.category=Italian version of Category
    *Edit the help files helpinfo.xsl and aboutinfo.xsl and provide a named XSL template for the appropriate language and the translate the English to your language.
  3. Deploy the channel as described above.
  4. Send me the file so I can include it in the distribution.

Expiration

A process is run by default at 3AM each day to expire old ads. In a multiserver environment you will want only one server to perform this service. To do so, add the channel parameter expireIP with the numeric value of the server ip (e.g. 129.186.100.50).

You may also specify the parameter expireTime with a value like 10:30:00 to perform that expiration at 10:30AM.

Upgrading

If you are upgrading from version 1.0 or 1.0.1, you should either run 'ant dbload' again to rebuild the tables or issue the SQL statement

ALTER TABLE CLASSIFIEDS_ADS ADD URL VARCHAR(100)

Changes

Version 1.2

  • Upgraded to commons-logging.
  • Changed to using new locale manager.

Version 1.1

  • Fixed problem involved with caching. Different users were seeing the same display when modifying their own ads.
  • Removed text next to icons to allow for a less cluttered display. All icons now have titles so that users can place mouse over icon to view title.
  • Made all form elements use uPortal CSS classes.

Version 1.0.1

  • Fixed bug that caused duplicate ads
  • Fixed bug that failed to return from help pages
  • Added URL field to Ad

Version 1.0

  • Added approval process
  • Fixed bug when selecting to view All ads
  • Added I18n support
  • Made channel cacheable
  • Added parameters to control which server expires ads and at what time
  • Changed doc.appendChild() with doc.getDocumentElement().appendChild()
  • Added user control to adjust ads per page
  • Changed date formatting to support Oracle and Postgres
  • Add regular expression searching
  • Forced contact to be user email address
  • Added mail link to contact in Ad View
  • Fixed posted date to reflect Ad posted date rather than current date
  • Added About and Help events and documentation
  • Added JavaDoc documentation
  • Changed procedures to create database tables by using DbLoader from uP2.1
  • Fixed search bug when title or description were null
  • Added 'Search Results' label when I search is requested