Forum OpenACS Improvement Proposals (TIPs): Tip #76: (Approved) Allow multiple packages to serve as "subsites"

For our current work we have modified the request processor and subsite procs to allow multiple packages to be treated as subsites. This code has been used on a half dozen sites for more that a year and seems to work quite well. It has only very limited performance implications and additional subsite packages are easy to write (and we can provide 2 examples).

Why do this?

We needed to provide a user friendly admin screen and limit the operations a subsite admin could carry out as well remove some of the other acs-subsite functionality. Having other packages stand in as acs-subsite packages made this quite easy. For the parts of acs subsite we did use we provided a one line .vuh file like this (for user/...) in this example):

  rp_internal_redirect "/packages/acs-subsite/www/user[ad_conn path_info]"

We also had to match the set of parameters a subsite is expected to have.

Why it's good

It allows for much more limited url space in the subsite and control over what is there. It also is a way out from the unfortunate monolithicness of the current acs-subsite package. The code is done tested and works well.

Why it's bad

No bad things other than it's ever more complication piled in to the rp.

I can provide the patch to anyone who is interested in what has to change

Collapse
Posted by Don Baccus on
How do you mark a package as being a "subsite package"? In the package's .info file? That would seem to be the "right" way to do it ...

What functionality is the RP performing? At first glance I'm not seeing why you can't just mount a package and dispatch to it, ala .LRN. Is it the setting of certain ad_conn values or something along those lines?

I don't worry about complexity in the RP much as long as it continues to be fast. We don't have to change it that often and not that many of us need to really understand how it works ...

Collapse
Posted by Dave Bauer on
I wanted to do something similar for .LRN where the procs that search for sites nodes in a subsite sould stop at the dotlrn package instance instead of acs-subsite package instance. Does you change do this?
Collapse
Posted by Dave Bauer on
In addition, does it set [ad_conn subsite_id] to the package id of the stand-in subsite package?
Collapse
Posted by Don Baccus on
Dave I think that's one of the things they have to do in the RP but Jeff can answer authoritatively.
Collapse
Posted by Jeff Davis on
Currently a package adds itself to the "subsite_packages" table to identify as a subsite and then things like getting DefaultMaster and other things which you look for from the [ad_conn subsite] are just gotten from the package at it's mountpoint. The changes in the rp code are more changes to ad_conn to report subsite_id as whichever subsite package it encounters first walking up the tree.

Identifying via the .info file would be best of course but we could possibly just add a parameter SubsiteP=1 for those we wanted to be subsites.

I am not sure what you mean by "mount a package and dispatch to it, ala .LRN". How can you for example set the DefaultMaster starting from a non-subsite package?

Collapse
Posted by Jeff Davis on
I put up the patch we use to add this behavior at
http://xarg.co.uk/alternate-subsite.patch.txt
It's a bit messy and needs some cleanup.

I should point out we also create application groups for the
new "subsite" packages at mount time as well. That is
broken out into subsite::default::create_app_group

Collapse
Posted by Don Baccus on
Adding stuff like this to the info file and the APM package builder pages are very easy, I'd very much prefer we stick to the info file paradigm.

OK, you've confirmed that [ad_conn subsite_id] is one of the things that needs setting ...

.LRN sets the default master by a kludge, it assumes it is mounted under the main subsite and changes its default master parameter behind its back.

If we could define it as a subsite package it wouldn't have to do that, so you've just indentified something we could clean up once we have this facility. A small improvement but a very nice one, IMO.

So, yes, this is functionality you don't get by just visiting a mounted package that we don't call a "subsite". IIRC default master is driven off the [ad_conn subsite_id], ideally everything of this sort should be, if not at the moment, then someday.

APPROVE if it's spec'd in the .info file. If not, I need further convincing ...

Oh ... why do we need a subsite_packages table? If this is designated in the .info file then we can extract whether or not the package is a subsite when we mount just like the other "what kind of package am I?" attributes, and mark the node as a subsite node in the site map table, no? Add a column to that table, in other words...

Then any code which might be interested in whether or not a particular node is a subsite could tell by checking the site map table ...

This would make it possible to control the behavior on a per-instance basis, too ... now I'm getting a bit ambitious, but it would be slick if the portals package could be mounted as a subsite package (after the proper support's written) while also allowing it to function as a subsystem mated to .LRN.

Hmmm...probably should keep your proposal simple for now, though.

Collapse
Posted by Dave Bauer on
Where the information is stored depends on how this is used.

If every instance of a particular package is always mounted as a subsite-type package, then the info file is the place to define it.

If a package can be used as a subsite or not, then we need to define that somewhere else.

Not sure if this belongs here but in the past we had some schools who were interested to know if it is possible to have several dotlrn instances running on one openacs (Since all schools belong to one university) instance each with their own design. Would this be possible then?
Collapse
Posted by Don Baccus on
dave if we make it work on a per-instance basis, then the .info parameters simply says "supports subsite semantics", we could also have a .info parameter that says whether it does or not by default etc.

For now we could easily adopt the "supports subsite semantics" interpretation of the .info parameter, track it in the site node map, and not bother implementing any code to make it optional on a per-instance basis (no admin UI) and think about doing that later. But I'd rather we think a bit more generally first and if we think there's any use for making dual-purpose packages possible (as I mention for portal) go ahead and support it in the datamodel from the beginning.

On the other hand, the .LRN/portal mating is a kludge and it may be I'm being too complex in my thinking...

Collapse
Posted by Don Baccus on
Nima, no, it doesn't really relate. Not sure how hard it would be to make .LRN work if mounted more than once, Open Force made that decision early on and there are various bits of code that are hard-wired with the assumption that it's mounted once, and worse, mounted as /dotlrn.
Collapse
Posted by Jeff Davis on
You have to do a lot of work to support subsite semantics so I think it will always be "you are or you aren't". Right now it means 15 or so paramters (maybe 5 important), and supporting the expected url space: image.vuh members.vuh pvt.vuh register.vuh shared.vuh user.vuh and admin, navigation stuff, and callbacks to create the application group.

We could make a lot of this "just work", eg the application group creation could be automatic, the paramter set could be made smaller, and the url space could be trimmed (e.g. we could make user pvt and shared packages) which would make the changes needed to make a package "subsitable" easier.

I'm not sure we want to go through all that though as mostly what you are shooting for is selectively trimming off current acs-subsite features and replacing the odd bit here and there. It's still a "subsite package" rather than a package which does a bunch of stuff besides what subsite does.

On a related note. Would it make sense to move acs-subsite's group management stuff to a separate singleton package ala notifications so that these new "subsite" applications that have application groups don't have to add this to their packages?

Jeff, how are you handling this now?

Looks like we cross posted. The user and pvt packages are the same sort of idea.
Collapse
Posted by Don Baccus on
Jeff handles it through a bunch of .vuh files.

The centralized services idea has floated before, but it would be a lot of work. Maybe someday ...

I'm thinking that for now we should just adopt Jeff's patch with the caveat (IMO) that we put the parameter in the .info file, that we think of the semantics as being "can be a subsite" while in reality currently the semantics will always be glued on via the subsite_packages table.

Later, if others have the need or desire to implement more flexible semantics, split off the membership services stuff from acs-subsite, etc they can do so. Wouldn't be that hard, for instance, to later augment the site node table with a "subsite" flag via upgrade scripts (though I kinda like doing that right off if it weren't difficult, problem being Jeff already has sites runnign with his existing code).

Collapse
Posted by Jeff Davis on
I do think dotlrn is great example of something that really really wants to be a subsite.
Collapse
Posted by Don Baccus on
I wanted it to be a subsite from day one. But ... I know Open Force was on a very tight schedule. In a perfect world, that would've been when the user and group services stuff would've been broken out into a separate service package, with dotLRN than being an alternative to acs-subsite (and mountable multiple times).
If someone from the OACS gurus could help out writing a spec and steps that have to be taken to make dotlrn a subsite I could gather here a group of students willing to implement that.

Just an idea if that makes sense.

Looks good. Jeff said on IRC that the new table isn't necessary.

APPROVE.

Looks good to me.

Jeff, can you provide any documentation to other developers on how to do this for their packages? How will this look in the administrative UI?

I've implemented this, in the form of a new "implements-subsite-p" global package attribute (i.e. same level as "singleton-p", not tied to version).

I've not implemented the portion of the TIP that explicitly calls the code to create an application group for the subsite-implementing package.

This is due to my having implemented this in conjuction with the new "EXTENDS" package dependency, which properly calls dependent apm callbacks when instantiating a package.

In other words, typically one would implement a subsite-like package by EXTENDing acs-subsite. Instantiate and mount will call the acs-subsite callbacks as well as your custom package, causing the application group (and anything else acs-subsite decides it needs now or in the future) to be created.

Coupled with the "inherit-templates-p" package attribute, and "EXTENDS", one can easily customize acs-subsite with custom enhancements, or build an entirely new UI while maintaining the necessary subsite semantics provided by acs-subsite.

Please comment. If there are no objections, I'll commit this upon approval of my implementation of package extensibility.