[UPDATED: Sept 14, 2006] Combined announcement channel

This channel combines the Personal and Campus announcement channels into one thus saving some screen real estate when one of those channels is empty. It reuses the existing database connection so there is no need to store in the code a database user id/password, and should help minimise the number of database sessions you need on the server (vs the approach I tool in Luminis tips and tricks document).

Like my previous announcement channel, the user can see why they received this announcement (i.e. From: Group into to programing). This was a feature lacking in the existing channels that we found bothersome. By displaying this extra information to the user it saves having to come up with a policy on how an announcement should be posted thus removing possible human error.

We also have colour coded our announcements so that certain classifications stand out. This is done via some CSS listed in the included XSL file. The channel can also allow a user to browse an archive of announcements providing you used the instructions that Jonathan has given.

Changelog

Sept 14, 2006
There was an issue if a group or course name contained an apostrophe, the JavaScript has been repaired.
I have reworked the code a bit, as well as cleared out some redundant methods, be sure to install the UM Java pacakges as this version now requires the Tools pacakge.
July 25
Minor modification to the car file. Previous uploaded car file was lacking the java source code, this one has the code again
July 6
Modified the javascript to do a global search and repalce of newlines rather then the single search and replace it was doing. This makes multi line announcements readable.
Cleaned up some of the java import statements to reduce memory consumption
June 9, 2006
Added database connection pooling support
June 6, 2006
With Luminis III.3.3 the CP_HOST_PROPERTY has been removed. As such this channel now makes use of CP_HTTP_HOST_DOMAIN(which exists in previous Luminis versions), be sure to install the new cpinfo.proeprties file
Dec 8, 2005
Forgot to escape &'s in the target element of the XML which caused the channel to appear blank if a group/course had an & in their title
Nov 4, 2005
All SQL functions have now been wrapped into a package
Image url in XSL is no longer hardcoded, it picks up your domain via the CP_HOST_DOMAIN property
If you have set up the ta archive as Jonathan has shown you will get a 'View archive...' link in the channel
Oct 11, 2005
Converted dynamic SQL into stored procedures
Added href="#" to the close link in ta.xsl so that firefox shows a proper pointer
Now using Java SQL connect code rather then the Luminis code (had to in order to make use of the CallableStatement object)
Using the information from the Channel Development Guide to obtain the user's userid and roles rather then the previous Luminis java.

To install the channel:

  1. Follow the steps outlined in UM Java packages
  2. Copy cpinfo.properties to $CP_ROOT/webapps/luminis/WEB-INF/config
  3. issue configman -s cpinfo.configFile '${CP_PROP_ROOT}/cpinfo.properties' and configman -s cpinfo.cacheExpire 6000
  4. run the SQL found in ta.sql in the luminis schema of Oracle
  5. cp ta.car $CP_WEBINF/cars
  6. $CP_ROOT/bin/rc/70-webserver stop && $CP_ROOT/bin/rc/70-webserver start
  7. Log into Luminis as an admin (or someone with channel manager privlages)
  8. Create a new custom channel with the Channel Class set to ca.umanitoba.uportal.channels.ta.ta

To modify the channel:

  1. cd
  2. jar xf
  3. Edit the code
  4. If need be recompile the .java file
  5. jar cf ta.car
  6. Copy the new car over the old one and restart the web server
  7. Let us know what you changed in case we find it useful ;)

Screenshots


Comment viewing options

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

Awsome

GREAT! save me making it. This was on a long list of things that needed to be done for our portal implementation. Its great that you have shared. I will drop a note in here when I have tried it out.

On this TA note, we are looking at building a channel that will allow people to post targeted announcements (using the TA SDK). They will only be able to post to the groups they are allowed to post to, as defined in ID management. I will share when/if that is done.

Database connection problems

Hello Villiam

Very good job, thank you. This channel looks wonderful. However, we installed it in our development system locally, and our programmer noticed that there are some database connection pool errors. If your portal is underloaded this won't be much of an issue, but for heavily loaded Luminis installations this could bring Luminis down.

We have run into this exact issue in the past, and know how to resolve it. He will patch the code and I'll send you an updated version - you'll likely want to upload it over top of the attachment you have in this topic so that other people don't install the current version.

Todd

Please let us know when you

Please let us know when you have updated it. Thanks

DAVE

RE: Database connection problems

Hey Todd, not sure if this will affect the patch that your programmer is working on but I have made some changes to the code. I wanted to use stored procedures instead of dynamic SQL and make use of CallableStatement, as such I am no longer using the DBConnection class that SCT created and have gone back to just using the standard Java Connection object.

The new code is up, if the problem your programmer found is still present please let me know.

Security and the cpInfo.properties

Hey, I'm just wondering about exposing the password and username to all of the channels. It seems like there may be a security issue in doing so. I'm not sure how you do channel development, but we have a number of developers over the campus and we would not want them echoing back our database username and password, or giving them read.write permission to the database.

Now, is the fucntion of the cpInfo.properties file only to pass the username and password to the channel?

And is there a big performance difference between using stored procedures and a new connection vs. using an existing connection and not storing the procedures?

Thanks

cpinfo and database connections

The cpinfo.properties file allows your channel to access either user or configuration information. In many ways it is like the iperson object you can use with the web proxy channel. So by using this file I do not need to store the database user id/password in the channel or as a parameter to pass to the channel for all chanel admins to see.

What I like about this method is not only the security aspect, but that when I change the database password all my channels continue to work without modification to the code or the parameters being passed.



As for the connection issue I am really not sure. There is a performance gain in using stored procedures vs dynamic SQL. I had really hopped to make use of an existing database connection but sadly the SCT java packages do not have the CallableStatement ability that Java SQL does.

I probably could have came up with a way that would have allowed the stored procedure to work with the SCT connection pool code however I wanted to wait to hear back from Todd to see what his programmer was going to suggest for how my initial channel was connecting to the database and figured I would at least get this one working with the stored procedures which my DB group wanted me to switch to.

The one issue in using the SCT code as I was doing before is that there is no public documentation for us to refer to so it was created out of expirmentation, as such if a new version of Luminis has this code change quite a bit our channels will break and we will need to expirement again to make it work against their new code. By using standard Java packages, and java APIs which SCT supports I hope to make channels that can stand the test of time better.

Perhaps someone with more Java knowledge then I could suggest a means to emulate the connection pooling that SCT uses using java.sql. Either way as I learn more I will continue to try and enhance this channel. :)

small changes

I think that what we are going to do is store your functions in a different schema that has read, and a little write access to the Luminis schema. Then modify the functions so that they talk across the schemas.

This will let us have better access control to the Luminis database, and also allow us to just copy our channel schema to the new database on other systems rather than re-installing the scripts.

Here is anouther question about how TAs work...

We would like to create an archive of announcements and only display a few on the users base channel view. Have you thought about doing this? One of our issues with the current channel is that if you go on vacation for a month you may miss important announcements because they are only posted for a limited time. Have you implemented or thought about this?

Thanks as always
DAVE

TA Archive

I actually had not thought of doing that. From what I understand of the TA system there is some process that is fired every so often to delete any TAs that have expired.

Without recreating the whole TA system I am not sure how one could create an archive.

Old TA removal

Does anyone know for sure if TAs of a certain age are automatically removed? Otherwise I will just use the list of deleted and expired TAs to populate the archive... I will look more at John's post in the mean time, however, I'm handcuffed a bit with the installation of a trigger like he has done.

TA expiration

>handcuffed a bit with the installation of a trigger like he has done

Because you don't have control over the database ? Tell your DBA its a luminis patch [EVILGRIN] That's one good thing about my position here, I have control over everything [insert evil laugh here].

>automatically removed

I believe every TA must have an expiration date when it is created. Luminis cleans out the TA's if they're expired, that's what prompted me to create this. Ok that's part of what prompted me. We have a content admin that has been manually archiving the announcements in HTML (cut-n-paste) so the 2 people on campus that read archives, can read them . This is a huge waste of time for her, so this should free up huge chunks of time. Copy paste into Luminis to create the announcement, paste / format / link in HTML for the archive. Ugh.

I'm working on getting them out of the archive and into a channel now.
They've been collecting for about a month. I wanted to be sure it all worked before I spent too much time on it.

If you beat me to it, let me know :)

- Jon

How about this

Well my announcement channel has been updated again to read your archive tables. Was not sure how to handle announcements that had been sent to courses or groups that no longer exist so currently it ignores them.

This channel rocks

I installed this on our dev and then live system (limited role) here and it is fantastic. The only issue is the archive. I have the tables (obviously) but there are so many announcements that I think it dies. What happens is when I click view the archive, it refreshes the page, and I see 'You currently have no announcements'.

I just did a count and there are 926 in there. Looking at how they are built in the page, maybe the javascript array is bombing out ? Not sure, figured I'd ask before I went digging into your java code.

The archive worked awesome on the dev box, only had about 15 messages in there. No biggie we can talk at Summit about it.

Jon

Paging... Paging is the

Paging... Paging is the solution!

We are paging by month. But we are doing our archive a slightly different way.

Probably the XML

It could be the XML file is far to large. I think webmonkey has the idea. When I get back I will see about setting up some kind of month by month paging option.

Heck maybe I'll handle the archive as an AJAX application (co-worker of mine keeps pushing that).

You can check out the paging

You can check out the paging that I've done here:

http://usource.uvic.ca

My announcements channel is based on yours but I have changed a bunch of code. Including, adding the archive myself, and Seperating out my SQL into my own database schema so that it can just be attached to any instance of Luminis. I should really post the code here... Should I make my own blog post or do you want to include it here too?

sender for targeted announcements

you mentioned that you had not found where luminis stores the sender of targeted/campus announcements. i knew it stored them (given the output of 'cptool diagnose ta' command), but did not know where.

i have since found the link. TA_MESSAGE.CREATORID = GT_USER.USER_ID = MB_USER.USER_ID. all of these are the user's pdsID stored in the luminis ldap. it should be relatively easy to add this in so we can see which account actually sent the announcement without having to find the ta id and cptool diagnose ta.

btw, i will likely implement this in our environment for the fall term. thanks for the channel!!!

PL/SQL Error

sorry, never mind

Color in TA body

Hi Villiam,
I noticed that your channel has color coded the TA titles using some XSL. Do you know if it is possible to include color in the TA body/details ?
Any ideas/suggestions on how this can be accomplished ?

Thanks,
Shyam

RE: Color in TA body

Depending what you wish to do it should be possible. I believe right now I am just using inline styles to colourise the subjects. However it could be easily moved into a class in an external stylesheet if one wants.

What type of colouring are you going for?

Syndicate content