[pmwiki-users] Cluster recipe

Kathryn Andersen kat_lists at katspace.homelinux.org
Wed Feb 14 06:02:34 CST 2007


On Wed, Feb 14, 2007 at 09:59:26PM +1100, The Editor wrote:
> On 2/14/07, Kathryn Andersen <kat_lists at katspace.homelinux.org> wrote:
> > On Wed, Feb 14, 2007 at 11:36:30AM +1100, The Editor wrote:
> > > On 2/14/07, Kathryn Andersen <kat_lists at katspace.homelinux.org> wrote:
> > > > On Tue, Feb 13, 2007 at 09:04:28AM -1000, Sivakatirswami wrote:
> > > > > Kathryn Andersen wrote:
> > > > > >I've uploaded a new version of the group-cluster recipe:
> > > > > >http://www.pmwiki.org/wiki/Cookbook/Cluster

> > Would it be possible to just extract out the "urls" part of the Hg
> > recipe, and use it alongside Cluster?
> 
> Actually, maybe.  It would be easy enough to strip out the hgUrl
> function and the line that sets the PageUrl.  But Cluster would have
> to be able to read it in the resolvepagename function. Again in Hg
> that function can read either format and automatically interpret it
> properly.

Wouldn't it work if you just made sure that Hg-Urls was included before
Cluster?  Because the HgResolvePageName function would then have already
altered $pagename, yes?
 
> > > Another advantage to Hg is that it has a built in powerful group
> > > prefixing capability that can be used to great effect.  Basically you
> > > can define a subgroup and have all links automatically prefixed such
> > > that they are placed within that group.  For example, I plan to use
> > > this to allow member to create their own individual wiki spaces with
> > > normal group.name linking. It too can be turned on or off, and can be
> > > overwritten when turned on to provide normal linking.  So these are
> > > two big plusses to hg.
> >
> > I don't really see that "group prefixing" is so wonderful; you can get
> > the same kind of thing with a page variable.
> 
> Maybe I didn't explain well what prefixing is.  (Or I don't grasp how
> you could use a page variable...)  In Hg, if I set the prefix, then I
> can be in some subgroup and [[Group.Name]] will automatically be
> interpreted as [[Subgroup-Group.Name]]. This means for example new
> users can each be given a full wiki like space within a hierarchy.
> Very powerful.  How can you do that with just a page variable?

Ah.

I thought the group-prefixing stuff was done with the :: markup?
How can it distinguish between when you want a prefix and when you
don't?
 
> > The $SideBar page-variable will be set to the appropriate side-bar for
> > the current group, doing the search in the same kind of way that
> > GroupHeader or GroupFooter etc are searched for.
> 
> Isn't that redundant?  I mean in Hg, it automatically checks for all
> the subgroup sidebars and if none is found it goes to the
> sitegroup.sidebar.  Guess I don't get the point of all the extra code
> you put in...

That's because you don't understand how page-variables work.
It isn't any more complex than finding the appropriate GroupHeader; it
just has to be in a separate function, with the $group passed in, so
that it will work as a page-variable for any page, not just the current
page.  You may well ask "Why would anyone want it for anything but the
current page?" Well, I don't know, but if I'm going to have something
that behaves like a page-variable, I'd like to do it properly.
 
> > > Kathryn, were there any other functional changes you made in Cluster?
> > > I notice you made quite a few code changes, but theres no
> > > documentation on the cluster recipe page of any differences in how it
> > > works.
> >
> > The searching is basically the same algorithm.  I completely rewrote the
> > page-variables stuff because, alas, you still seem to have misunderstood
> > how page-variables work, and the current version of Hg has broken them
> > again.  Also I made the variable names more verbose because I wanted to
> > be able to understand what it was doing when I come back to it in six
> > months time and have completely forgotten what I was thinking when I
> > wrote it...
> 
> Are you sure about the page variables.  Didn't think I had changed
> that part of the code.  If so, I'll look into it again and fix it.

I am sure. I did check, and it was broken.
 
> > > Also have you used the new group home page feature in the
> > > latest beta release of PmWiki yet?  Or do you even have group
> > > homepages capabilities in Cluster?
> >
> > What do you mean "new" group home page feature?  Yes, the GroupTitle
> > uses "$Group.$DefaultName" in its list of pages to search for the
> > group-title, just as the GroupTitle recipe does; apart from that,
> > since Cluster isn't changing the URLs, it doesn't need to worry about
> > group home pages.
> 
> Don't know if Pm documented it yet, but he added a way to set the
> default page name for groups to something besides the group name.
> Like Main or HomePage.

That's not new.  $DefaultName has been around for quite a while.  What
he changed is that now, when one is linking to a *non-existant* group
home page (with [[Group/]] or [[Group.]]) you can make that link be to
"$Group.$DefaultName", wheras before it was always "$Group.$Group".

This *is* very useful with Cluster/Hg, because the group names can get
very long, and it's nice to be able to say, for example
Kingdom-Animal-Canine/HomePage rather than
Kingdom-Animal-Canine/Kingdom-Animal-Canine

> This is very important for getting something
> closer to a true hierarchical groups functionality, as you can set up
> scripts and config values to do certain things if a page is a group
> homepage.

You could check that before; the test is still the same; a group
homepage is either "$Group.$Group" or "$Group.$DefaultName".
One still needs to check both, since either one could happen.
 
> I had a system in Hg to do this that won't be needed any longer.  Just
> wondered if you incorporated the new core code yet.  Now that I think
> about it, it shouldn't work independently of Hg/Cluster, so it's kind
> of an irrelevant question...

Yes, it's an irrelevant question.
It possibly isn't irrelevant when one is changing the URLs, but Cluster
doesn't do that.
 
> Kathryn, it looks like you are doing some nice stuff with Hg and I
> really don't have time to maintain it.  If you would consider making
> the Cluster resolvepagename function able to read either format (both
> cleanurls and -. format) then I'd likely just drop Hg and add two sub
> recipes, one called Cluster-CleanUrls and another called
> Cluster-Prefixing, and make those available as simple optional addons.
>  What do you think of that idea?

As I said above, I *think* having a "ClusterCleanUrlsResolvePageName"
function should be able to work independently of what Cluster does, so
long as you make sure that the Urls recipe is included before the
cluster recipe, so that its ResolvePageName function gets run first.

As for Prefixing, since I'm not entirely certain how it works, I'm not
sure whether they would clash.  It might be that they would clash, since
they are looking (I assume) at the link markup "[[" -- I'm not sure
which one should go first.

> PS.  Did you just see the fireworks a few minutes ago?  Very nice!

No, I missed it.
 
Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe



More information about the pmwiki-users mailing list