Edit Links |
UploadListFcn
<< | Page list | >> A wiki author would use a special markup to invoke the function. I'll create the markup bit and how it parses its arguments etc. What I'd like from you is a "backend" function that I can invoke to produce the listing. The markup I'm suggesting below will have a few options/parameters, which results in a set of requirements on the function. Please don't feel you have to implement all of those requirements, I'll be happy with the basics - additional requirements can be added as they are needed. The reason I list a relatively complete specification is primarily to get a good syntax for the markup - otherwise it's quite easy to design a markup which can't be expanded later on. Also note that the markup I'm suggesting below is just that, a suggestion. If you have comments or would like it differently, let me know! Anyway, here's a possible syntax of the markup: (:uploadslist <dir> fmt=<fmt> recurse=<yes|no> filter=<regexp>:) where
what we'd like from detailed list is unclear, I'm just guessing
that size and modification is enough.
This then leads to the requirements of the function... Here's how I imagine it: $str = UploadListFcn($baseDir, $baseURI, $opts); where the function should return a file listing either as a snippet of HTML which I'll just insert into the output, or as wiki markup. You choose which you feel is easiest for you. I suspect it's actually easier to do it by returning wiki markup, see further down for a suggestion. As for the arguments, here's how I imagine them:
Let me know if you'd prefer this string to always end in a '/' or not,
or if you make the function so that it doesn't matter.
Same thing goes here if you'd like a '/' at the end or not.
$opts = array( 'fmt' => $fmt, 'recurse' => $recurse, 'filter' => $filter); where
As for the output, I don't really have much of an opinion about what it should look like. To me it doesn't make sense to make it too complicated. Here is one suggestion as to what the output could be when returned as wiki markup when invoked from different markups: The markup UploadsListFcn('/home/lyx/pmwiki/uploads/Windows', 'uploads:/Windows', array('fmt'=>'simple', 'recurse'='no','filter'=>'')); which then returns the following: * [[file0.txt -> uploads:/Windows/file0.txt]] * [[file1.txt -> uploads:/Windows/file1.txt]] ... Here's another example when the function should recurse, based on the
markup UploadsListFcn('/home/lyx/pmwiki/uploads/Windows', 'uploads:/Windows', array('fmt'=>'simple','recurse'='yes','filter'=>'')); which then returns the following: * [[file0.txt -> uploads:/Windows/file0.txt]] * [[file1.txt -> uploads:/Windows/file1.txt]] * LyX14x/ ** [[file2.txt -> uploads:/Windows/LyX14x/file2.txt]] ... Finally here's an example of a detailed list, from the markup:
UploadsListFcn('/home/lyx/pmwiki/uploads/Windows', 'uploads:/Windows', array('fmt'=>'detailed','recurse'='no','filter'=>'')); which then returns the following: * [[file0.txt -> uploads:/Windows/file.txt]] (105 bytes, 2006-03-21 15:03) ... |