Forum OpenACS Development: Package instances, summarized content and central management

When openacs packages that are not singleton, they are designed to create multiple instances of the same package, mounted in different parts of the site-map and keep their own content separate but in the same table (acs objects magic). But some times, you want to aggregate / manage data from different instances of the same package and show them all in just one place, probably checking at the same time normal read permissions, etc.

In Don's words: "right now the paradigm is "separate instances, write a summarizer portlet" but it's probably a good time to raise the issue of whether or not it's the best thing to do in .LRN, .WRK etc where you have lots of subsite-like classes and instances of stuff"

A couple of use scenarios:

1. I have wimpy-point, instantiated for each class via its portlet, but now we would like to have one wp instance mounted on /wp where you can see all the presentation that are available for public (we do have a portlet that aggregates from the classes that you belong to, but the aim is for any user: unregistered users that do not have its own portal). How to aggregate the content can be achieved relatively easy with a single script, then the question is:
a. where to locate it? (probably on /lib of the pkg)
b. how to show it? in other words, how to make the /wp instance to show that given script instead of the normal index page that just show the presentations that belong to that instance? (note that might be another potential places in the same package that might need special re-factoring to achieve this behavior)

2. The events package, we want to have 1 single place=instance (/events) to manage all the events of all the installation, while there might be events pkg instances for each single class, community or subsite. Again this case is somewhat related to the previous one where you display all the instances data in one instance and you might add data through this single instance to others instance (i.e. in /events you add an event to /dep/sub/class/events).

Maybe a cleaner solution might be, for example, create some sort of special_context_id / special_package_id that manually is set for the instance through the site-map (i.e. wide-installation-instance), then when you do the normal:

where
...
and ao.context_id = :package_id
...

It will render all the package instances information.

For the management point of view, when through the site-map the package instance is marked as wide-installation-instance, a possibility is to have a given template that will change for that single request the package_id to be passed when adding a new object or maybe cleaner is when package_instantiate_object  is called, afterwards it ask you to which instance you want to add the object and then it simple updates it (like notifications does but without extra coding).

Thoughts, comments?

I have also encountered this problem. having special_context_id/special_package_id, isn't as flexible as it should be if you ask me. You might want multiple summarizer instances that selectively choose info from other instances (look at project-manager as an example of integration with logger). So a rel_type where a one package_id to many package_id would make more sense to me.

The easiest way to do this if you ask me is to put a package specific parameter, or set of parameters. Then you wouldn't have to re-write the display view pages at all, you simply say, on the index page, display all events from parameter (ShowOtherInstances): 123 345 567, and the sql query does a display all XYY where package_id in ('123','345','567') where there is public read permission (you would probably want it to display the current package and any additional package_ids). This lets you maintain permissions accross packages at the package level, and for that summarizer instance you could simply state that nobody has permission to add an event/presentation - so it would make wimply a display only instance. This would let you for example have a math-wp instance that shows all math related wimpy point instances, and an english-wp instance that lets you summarize all english deparment instances, etc.

You are making the solution a little complicated. Just make a new user interface package that can aggregate the content, and set the permissions accordingly. Make use of includes if the original package has similar pages that you can use.

In general I think making alternative UI packages that reuse a data model is a very good way to develop new applications. I recently build a new user interface on top of the survey package.

One interesting idea is to just restrict the display in such a package based on read or other permissions on the objects instead of the package_id.

You can do this without making any changes to existing applications.

To address the management issue I developed a couple of options. If the aggregator package was visited from a single instance, the links to the aggregator passed in a package_id which was stored in a cookie. Any actions that required a package instance would be done on the one stored in the cookie. If the cookie doesn't exist a list of packages the user has admin over is given.