Forum .LRN Q&A: Re: how to add portlets?

2: Re: how to add portlets? (response to 1)
Posted by Peter Marklund on
I can answer one of your questions and for the other one I can give you some hints.

A variable value on the format <span>#</span>package_key.message_key# is a reference to a multilingual message in the message catalog. You can view all messages under /acs-lang/admin or look at the xml file at packages/package_key/catalog/package_key.locale.encoding.xml. When the variable value is displayed in the UI the proc lang::util::localize is invoked to convert the <span>#</span>package_key.message_key# value to a text in the language of the request (depending on the users preference).

To add a new portlet to dotlrn you need to create two new packages - a portlet package and an applet package. Take the forums portlet as example and study the following files:

- dotlrn-forums/tcl/dotlrn-forums-procs.tcl
As you can see from this file the forums applet takes care of mounting a forums and attachments package under the (dotlrn) class package. The applet also responds to events such as adding/removing a user from the community and adding/removing portlets. The applet is the contract between your application and dotlrn.

- forums-portlet/www/forums-portlet.tcl
- forums-portlet/www/forums-portlet.adp
These are the templates that actually display the forums in a portlet. Notice how these templates get passed the package_id of the corresponding forums package (see dotlrn_community::get_applet_package_id).

Any applets in the system will be picked up by dotlrn after server creation (see dotlrn/tcl/dotlrn-init.tcl, it does this by selecting all implementations of the dotlrn_applet service contract). The class admin is then able to visit the Manage applets page from the admin page of his community to add your applet. This should make the portlet available on the Customize Layout page where portlets are added and moved around.

I put up the dotLRN technical documentation here:

and you should probably read it.

If you gain further insights into this issue please post them here.