[pmwiki-users] File manager -- implementation of pmwiki interfac

Patrick R. Michaud pmichaud at pobox.com
Tue Apr 19 10:49:35 CDT 2005


On Sun, Mar 20, 2005 at 07:34:40PM +0100, chr at home.se wrote:
> Please read the earlier two posts for background. This post is a 
> solictation for help on how to create the backend in pmwiki for invoking 
> the file manager properly.
> 
> What I think I need from pmwiki is basically the following:
> 
> * A suitable markup entry for "uploads:..."
> * Being able to parse the argument to "uploads:..." and check if:
> ** Is it a path to a file or a directory?  (1)
> ** Does the file or directory exist?

Set $LinkFunctions['uploads:'] = 'MyLinkUpload';

When an "uploads:" link is encountered, the MyLinkUpload function
will be called as:

   MyLinkUpload($pagename, $imap, $path, $title, $txt, $fmt=NULL)

and this function should return the correct HTML for the link.
The arguments are:

   $pagename - current pagename
   $imap     - 'uploads:'
   $path     - everything after 'uploads:'
   $title    - an alternate title, e.g. for images
   $txt      - the link text (e.g., from [[uploads:... | text]])
   $fmt      - an optional format to be used other than the default
               for this type of link (e.g., for inline images)

See LinkUpload() in scripts/upload.php to see how it's currently done
for 'Attach:' links (the function is fairly short).

> * How do I go about making this work with e.g.
> 	[[uploads:file.txt | link text]]?

PmWiki already handles this prior to calling the custom markup function.

> ** What should happen if 'file.txt' doesn't exist?

I would guess you'd want to construct a link that would make it
easy for someone to upload it.  Or you could just make it not a link,
or otherwise decorate it to indicate that it doesn't exist.

Pm



More information about the pmwiki-users mailing list