On Wed, Nov 07, 2007 at 05:26:28PM -0500, Stirling Westrup wrote: > I've been thinking of writing a recipe to implement the YouSendIt clone I > mentioned on the list a few months ago. In my mind, what would be ideal would > be to have an (:attachlist...:) and a (:filelist ...:) directive that would > use much of the same code as pagelist, and have most of the same features, > including the fmt=... option.
The big problem with using (:pagelist:) for things like attachlist or filelist is that pagelist is really built to work with lists of pages (and all of the associated page properties), whereas attachlist/filelist would need to deal with lists of attachments or files (and a different set of properties). While this may sound like a minor difference, in terms of implementation I've found it to be very significant -- especially since pagelist is one of the most intensive operations we have. I think the biggest difference between the two is that attachments don't have "page variables" in the same way that pages do, thus it's very difficult to use things like {$Name} or {$Group} for display or sorting criteria. We'd probably need to come up with a set of "attachment variables", and they probably should not use the {$var} page variable syntax. It might make sense for them to possibly use the {$$var} template syntax, but then we'll also be looking for things like {=$$var} and {<$$var} and that starts to get really confusing. The other big difference is that attachments don't have the same access control mechanism that pages do, so much of what pagelist is trying to do is irrelevant to an attachment context. Even things like pagelist caching don't seem to make much sense in an attachment context, since we're caching completely different types of data. So, I really think that attachlist/filelist are fundamentally different beasts from pagelist, and any attempt to get one routine to handle both would be more superficial than helpful. One possible exception to this would be if the whole of PmWiki became very heavily object oriented, where both pages and attachments are internally represented as objects that share some common interfaces. That might make it easier to develop a common base for pagelist/filelist, and there could be some other advantages. However, it's certainly not likely to happen anytime soon, and I'm not sure that the supposed advantage would actually be all that useful in the overall scheme of things. Please correct me if I'm wrong, but I think the main reason that people are so interested in trying to re-use (:pagelist:) code for attachments is to gain the flexibility we currently have with pagelist templates. But that's really more a function of the templating code than of (:pagelist:), and the templating functions in PmWiki have been factored out into re-usable subroutines. So, if we're just looking for a templatable attachlist, we just need a driver that builds a list of attachments according to whatever filtering/ordering criteria we want, and then have it perform template substitutions with the appropriate variables set. And we need to figure out what those variables are going to be. :-) Hope this helps explain why I haven't tried to unify pagelist/attachlist in the codebase. Ultimately I find there are just too many differences in the underlying data components to make a single routine have that much benefit. Pm _______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel