Forum .LRN Q&A: Re: how to add new portlet to community-portal

Collapse
Posted by Ben Adida on
If you want your code to be well-behaved dotLRN code, the portlet addition should be done from within a dotLRN applet. For example, dotlrn-forums is responsible for adding the forums-portlet to various portal pages throughout the system. That's how you can maintain modularity.

Thus, when you add an applet to a community, that applet's code add_applet_to_community should add your portlet to the community's portal page. Similarly, add_user_to_community should add a user-based portlet to the user's portal page, if that makes sense for your application. Take a look at dotlrn-forums for example code.

In addition, when you create a new applet (by creating an applet service contract implementation), the dotlrn-init Tcl script automatically registers the applet in the dotlrn_applets table (that happens upon server restart only).

There are parameters in the top-level dotlrn package instance (/dotlrn usually) that indicate which applets to automatically instantiate within a community: you can tweak those to include your applet. Or, you can manually add it to a community by going to the community's control panel and selecting "manage applets."