Forum OpenACS Development: Re: Making Categories subsite aware

Posted by Stan Kaufman on
I've posted a patch (against oacs-5-2) that accomplishes what we've discussed, I believe:

  • Client packages can pass in a package_id (subsite or a mounted application) that sets how Categories operates -- with a default to the main site subsite_id if a package doesn't want to use this capability.
  • The add/edit UI enables setting site_wide_p as well as the context_id from a widget that includes the relevant subsite plus any installed applications at that subsite.
  • The main index (/cadmin/index.tcl) lists the scope of category trees (site-wide, subsite, application -- and which subsites and applications).
  • The available category trees that can be mapped by a client package are determined by these settings -- a package can see these trees:

    • site-wide trees
    • subsite trees where that package is mounted
    • trees only for that package

    All other trees are now invisible to client packages.

There are a few funky things about this:

  • Trees set to site_wide_p = 't' can also have a context_id set to some package_id (either a subsite or an application), but the context_id is ignored by Categories; site_wide_p supercedes the context_id. This works out OK, but conceptually it's muddy; there isn't a clean, mutually-exclusive set of states for trees using this mechanism of (site_wide_p + context_id). I don't see any reason to try to re-do the whole schema, however; this is kind of a work-around, but it works, so that presumably is good enough, eh?
  • The context bar links aren't entirely sensible. Since Categories is a singleton, when a user navigates there from an application mounted in a subsite, there is a link back to that application, but not to the subsite itself. Seems that there are several options for the context bar:

    • Leave it as it is.
    • Make it: Main Site >> Subsite Name >> Categories >> Package Name >> Category Management (etc)
    • Make it: Main Site >> Categories >> Subsite Name >> Package Name >> Category Management (etc)

Anyway, this code appears to work correctly here, but it needs to be dropped into other uses of Categories, so please do so and post any problems. If it works/looks OK, then someone (OCT?) should let me know and I'll commit this.