Forum OpenACS Development: Coding Automatic Subsite Creation and Configuration

I'm beginning to design a site that will allow a user to establish a group account and configure packages for the group that he/she represents. Some of the services will be standard OACS packages such as news and forums, and some will be instantiated from other as-yet-to-be-created packages.

**Issue a)
I'm thinking about the programatic creation of a subsite for each group along with unique subsite-associated admin and user groups, and then automated creation and mounting of package instances under the subsite. These are all actions that are currently performed manually by a site-wide administrator using the site-map and groups UIs.

**Issue b)
Along with subsite creation and package mounting, I'll need to utilize a payment gateway that can handle subscription-based and use-based collection.

I haven't (yet) located examples, discussions, or API doc to tell me how to handle the programming of issue a), so I'm beginning to trace through the site-map code to figure this out. I don't know quite where to start with issue b).

Has anyone already addressed either or both of these issues? Can anyone gently point me toward resources that might help me?

Randy

As for issue a), Greenpeace has done something similar, where they added one page to select all the functionality that should go into a newly created subsite. Furthermore, we have been *thinking* about adding some functionality that would allow a site wide admin to define subsite types, so he could create a new subsite by giving the parent node, the type and user groups he'd like to import users from.
Collapse
Posted by Don Baccus on
dotLRN does much of "a" and I really wish we had some similar functionality for the vanilla acs-subsite package.
Collapse
Posted by Randy O'Meara on
Malte,
Might I have a look at the Greenpeace implementation?

Don,
I assume that dotLRN doesn't provide a service that generalizes a). Is it based on acs-subsite? Do you think dotLRN's implementation would be useful to me as a guide? If so, where would be good place to start looking?

All,
Is there any theoretical or practical limit to the number of subsites present in a single OACS site?

Hi Randy,

sorry for the confusion, but I just *know* that Greenpeace implementation has done something like this. The person to ask though would be Bruno from Greenpeace.

Collapse
Posted by Tom Jackson on

If anyone is going to work on this, please let me help. I have decided to use the subsite feature and I already had to change the datamodel.

Ben of OpenForce suggested that his folks had solved some problems they found, but he didn't elaborate. One I found annoying is that when you login/register you see the main site info.

One thing definitely needed is the ability to place users into a specific subsite group. The ability to create subsite types is also a great organizing idea. This needs to have a tcl or pl api so other packages can create new subsite types easily.

Collapse
Posted by Samir Joshi on

dotLRN community or club is general enough to cater needs of non-educational groups, similar to Randy's req. above issues a) and b).

There is already a project created for this dotWRK , not much active right now, but that should be active soon given high interest level. You can also check out dotLRN demo, linked from https://openacs.org/projects/dotlrn

-Samir
Collapse
Posted by Samir Joshi on
Oops... I shoot the previous post in haste. Just for records, as Don already said (but I missed it !), doLRN caters for a) only, not b). And no subsites, but it has code for automatic mounting of packages - a good starting point can be      mount_package in packages/dotlrn/tcl/dotlrn-procs.tcl and its callers.
Collapse
Posted by Don Baccus on
Actually the Greenpeace code doesn't do what Randy's looking for.  It provides a streamlined admin UI for mounting packages for a particular Greenpeace National or Regional Organization's site, that's all.  I'll stick with my suggestion that the dotLRN code is a better starting point for issue "a".
Collapse
Posted by Randy O'Meara on
Thank you Samir and Don.

The dotLRN mount_package looks like a good start for the "mounting" portion of issue a). More to come...

Randy

Collapse
11: Coding Subsite Deletion (response to 10)
Posted by Randy O'Meara on
I am now able to create a subsite and mount subordinate applications.

Now, I am searching for an acceptable method to programatically delete a subsite. The subsite may have other  applications and subsites mounted beneath it. In addition, there is at least one side-effect of creating a subsite that also has to be addressed, and that is removal of the "Parties" application group and its relations that are associated with the subsite.

I see the process going something like this:
1) identify all site nodes subordinate to the subsite
2) for each of the subordinate nodes, unmount and delete
3) unmount the subsite itself
4) delete the "Parties" application group
5) delete the subsite
6) pray... (actually this should be step 0

First, am I missing anything?

Second, how might I go about performing step 1?

Randy

Collapse
Posted by Jun Yamog on
Hi Randy,

You may need to delete the parties first.  Look at this post

https://openacs.org/forums/message-view?message_id=67633

#1 can be performed by the UI.  If you want it on the db you can join apm_packages and site_nodes and look for the package type acs-subsite.  There is also I believe a db api to delete a subsite.

Collapse
Posted by Dave Bauer on
Randy,

The hardest part right now is #1. Currently there is no way to delete a package that has already been mounted. You can unmount it, but the code necessary to remove the objects that package has created does not exist.

We do need a way to delete individual package instances and the content they contain. I see this happening rarely on a production site, but for someone who wants to test or try out a package it would be very useful.

I see two options, either a service contract or a magically named tcl proc for each package. A package developer would be required to provide a tcl proc that would accept a package_id and correctly remove the objects that belong to it. Some people have mentioned that comprehensive use of on delete cascade in the OpenACS data model would also accomplish this.

Most of the problems with deleting a package instance wouldn't exist if there would have been proper usage of ON DELETE CASCADE from the beginning. I mean - why on earth should for example deletion of an object cause an error just because it has direct permissions associated with it?

In my understanding it was agreed that this situation should be improved on the way to 4.7 by adding on delete cascade where appropriate. I wouldn't find it productive to have a magic tcl proc mimicing this functionality. (Which doesn't mean that there is no use for such a proc, but it should definitely not handle things like deleting direct permissions).

Collapse
Posted by Dave Bauer on
Til,

I agree. That is definitely a case where removing an object should be handled better. But besides acs_objects which nearly all packages will have, each package has it's own internal data that also must be removed correctly. It is this data that must be removed by the package itself.

Collapse
Posted by Randy O'Meara on
OK. I now believe that subsite (or any package, for that matter) deletion cannot be cleanly done at this time. I've deferred deletion/cleanup to some time in the future.

So, I figure the next best thing is to move/rename the subsite and make it inaccessible. I want to retain the ability to re-use the same subsite name and location on the site map.

Can anyone suggest how I could move (say) /subsite1 to some other site map location? As I said, I want to be able to create a new /subsite1 after the relocation of the old subsite.

Thanks,

Randy