Classifieds Channel - How To

Some people may be interested in implementing the Classifieds channel by Iowa State University listed in the uPortal Clearinghouse in their uPortal installations. I spent some time emailing with Mark Boyd of SunGardSCT until I got this working. I figured I could share with everyone how to do this so he is no longer bugged about it and we can all use it. (Additionally I convinced him to join LDN)

This great channel was something that we really wanted to add to our portal as a value added service that helps add more to the community feel of the portal. Unfortunately, on my first attempt with this channel, I was following the instructions using ant and all that complexity. Them I was pointed at the uPortal channel ARchives site which has classifieds in CAR format. This is FAR easier to implement. Additionally, this site has a great overall description of how CARs work and why they are so dang sweet.

In a perfect world, you should be able to download this CAR and drop it into $CP_ROOT/webapps/luminis/WEB-INF/cars and restart the portal. If you are on the latest patch of Luminis III.2, it will create the database tables and add the classifieds channel to your list of available channels when the portal starts up. This did not work for me, but I would suggest trying it, I'm likely a few patches behind the most current.

At this point, I can describe how I made this work without the autopublish and table creation.

1. Put CAR in $CP_ROOT/pipeline/webapps/luminis/WEB-INF/cars
2. Create and populate DB tables (ex for Oracle)
 
 CREATE TABLE CLASSIFIEDS_ADS
 (
  POSTED       DATE,
  ID           INTEGER,
  CATEGORY     VARCHAR2(20 BYTE),
  TITLE        VARCHAR2(30 BYTE),
  DESCRIPTION  VARCHAR2(150 BYTE),
  USERID       INTEGER,
  CONTACT      VARCHAR2(30 BYTE),
  PRICE        VARCHAR2(10 BYTE),
  EXPIRES      DATE,
  APPROVED     VARCHAR2(1 BYTE),
  URL          VARCHAR2(100 BYTE)
 );
 
 ALTER TABLE CLASSIFIEDS_ADS ADD (
  CONSTRAINT PK_CLASSIFIEDS_ADS PRIMARY KEY (ID));

 CREATE TABLE CLASSIFIEDS_CATEGORIES
 (
   NAME  VARCHAR2(20 BYTE)
 );

3. Put some categories in CLASSIFIEDS_CATEGORIES table
4. Restart portal
5. Add a custom channel (you can modify many of these to be more specific to what you want)
   
  a. Enter the following Channel Information:

    Type = Custom
    Title = Classifieds
    Name = Classifieds
    Functional Name = edu.iastate.ait.channels.classifieds.CClassifieds
    Description = Banner A channel to display classified ads.
    Channel Timeout = 10000
    Channel Secure = unchecked
    Channel Class = edu.iastate.ait.channels.classifieds.CClassifieds


  b. Specify the following channel parameters: 

    date.format = dd-MMM-yyyy <this is the format the DB expects, try as we might we can't get a timestamp part in here, insight on this appreciated>
    adFormat = MM/dd/yy <this shows in the channel>
    approveAds = false <put approve true if you want to screen these>
    policyURL = <URL to where your usage policy is, if ommitted won't show link>
    expireTime = <When you want events to be expired> (Note: I am not certain how this on works out)
    Example: 10:30:00
    expireIP = <The numeric value of the server IP that will do the expiring> (Note: I'm not certain about how this one work out either)
    Example: 129.186.100.50


  c. Specify the following channel controls:
    Has Edit = unchecked
    Has About = checked
    Has Help = checked
    

  d. Select the Channel Category "Application" 
  e. Select groups = "Public" 
  f. Add to your layout and enjoy!

The only thing still not working for me is the contact email field being properly populated. If anyone spends some time fighting with this and gets it to grab appropriate values from the LDAP, let me know and I'll update these intructions. From what I can tell you should be able to extract the car with 'jar xvf classifieds.car' then edit ClassifiedsState.java. It is getting this attribute with the code `person.getAttribute("mail")` The person object is an IPerson object. I'm not certain how those work, but I'm sure there is a much better java programmer who will know a super easy fix for this.

I hope this will be helpful.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Got it to work

I think you have to have at least hotfix 13 installed if you want the autopublish thing to work correctly. Then you have to edit the CP_WEBINF/config/cpinfo.properties and add the
line
pdsEmailDefaultAddress:ldap

This didn't pop my email address in there though. I had to get the iPerson object working and then add this block to the PersonDirs.XML file

<attribute>
<name>pdsEmailDefaultAddress</name>
<alias>mail</alias>
</attribute>

I bounced the server, and created a new classified ad, and sure enough, my email address was there.

-Jon

Jonathan Wheat
Founder of the Luminis Developer's Network
LDN, the place for Luminis Developers to hang

Stylesheet

Grrr. Any idea what stylesheet controls the layout of that channel? I've been trying to tone down the font size for a while now. With he time spent trying, I could have tackled all the screens of the channel and wrapped a span tag around them... that's next on my list.

The problem is, is that things like 'Click on title to view details:' are in a plain <TD> with no class, and much larger than the rest of the portal text, so there's nothing to go edit anywhere. I've attemtped to add a generic TD class to the cp.css file to no avail.

I think I may have to go in and assign uportal-text to all those areas with the car file. What a pain. Guess its a once and done thing though.

I'll re-jar the .car and post it when I'm done in case anyone wants the same results.

-Jon

You are correct in that

You are correct in that iPerson Object must be working in order to get the eMail address picked up. My problem is that only people only people in the Admin access group can post adds. Everyone else has view capability. I have the Groups set to "Public".

Any ideas?

if it looks like a bug ...

and acts like a bug, and 4 people all see it as a bug ... its a bug.

Sounds like we've uncovered something about that .car and III.3 that doesn't work.

Who wants to tell support ? hands ? Anyone ... ?

Classifieds Email Bug

In answer id 944, there is a comment that you need to:

c) edit CP_WEBINF/config/cpinfo.properties and add the line
pdsEmailDefaultAddress:ldap

However, I found that this does not completely work. I noticed when I Add an Ad, my contact was displayed as "null username". This caused the Contact information to display null as a mailto when viewing the advertisement.

So I extracted the code, and I had to modify the ClassifiedState.java file and initialize the global email variable:

Before:

String email;

After

String email = "";

This worked and I now have the email address working properly.

Issues with the Classifieds Channel

Just wondering if any of you experienced this with the Classifieds Channel. We are running it on Luminis 3.3.1.58. There were no issues with the install and permissions and even the LDAP sync to show the email addresses of the posters. But there were these issues:

1. We have the approve_ads feature set to true so that all ads require approval before getting posted. Works fine. However, once an admin approves an ad, it still shows up in red with the "approval Pending" msg although the database field for approval changes from N to Y. Only if the admin logs out and logs back in, the ad shows up the normal way.

2. after posting an ad, if you refresh your browser or the channel, the ad gets posted again.

3. While listing the ads using the list menu, the categories that do not have any ad defaults to the last viewed blank category (in the list drop-down) with no results. It seems that it is querying the database fine and is not finding any ad (as there are none for that category), but the category in the drop down list is displaying the last viewed blank category. this problem becomes apparent in the following sequence:
category A has 2 ads, category B has 3 ads, category C and D have no ads. The list option works fine for All, Category A and B. the first time u choose category C (which is blank), u get it correct, but then if u choose category D, u still get Category C in the drop down list.

4. Going by the previous example, if category A only had Ads and none for categories B,C and D, choosing category A from the list menu shows All in the drop down. the behavior explained in point 2 above for blank categories behaves exactly the same way as before.