[pmwiki-users] auto-upload using fox?

Hans design5 at softflow.co.uk
Mon Mar 31 03:17:29 CDT 2008


Monday, March 31, 2008, 8:37:22 AM, martin at kerz.org wrote:

> p.s. I have two remaining question regarding fox. Can I somehow check
> for special characters in form fields? I want to disallow them. And  
> finally. Can I somehow get a wikified version of {$$name} (e.g.  
> without spaces) for use in paths in the template file?

Since you are German you may be interested to try automatic character
conversion for page names, transforming zB äöü into ae, oe, ue etc.
See
http://pmwiki.org/wiki/Cookbook/ISO8859MakePageNamePatterns

Then you won't need to disallow these characters, but new page names
will be created not using them. If you make use of the (:title :)
markup in your fox new page templates, the pages can keep the special
characters in the title, but use the conversions in the names.
same can be done for the file names.

Fox creates already valid pagenames out of names which have special
characters. Using the recipe to convert ISO 8859 character input to
unaccented equivalents you avoid the creation of pagenames like
%dcber%e4nderung.

Also for special cases there is a markup expression wikiword, part of
http://pmwiki.org/wiki/Cookbook/MarkupExprPlus

{(wikiword 'Make a wiki word')}  =>  MakeAWikiWord
This can also be used within Fox templates, using syntax
{$$(wikiword 'Make a wiki word')}
so it only is evaluated when the form is processed.
But as I said, Fox does this already automatically for target page
names, so you may  need to use the wikiword markup expression only
for non pagenames.

Here is an example of part of a Fox form to create a new coworker page
and upload an image as well as content (some lines are split for this
email:

%red%(:foxmessages neumit list=check:)
(:fox neumit template=Site.FoxTemplates#neumitarbeiter
    target='{$$nachname} {$$vorname}' upload=1 foxgroup=Mitarbeiter redirect=1:)
(:foxcheck vorname msg='Bitte Vorname(n) eingeben! ':)
(:foxcheck nachname msg='Bitte Nachname eingeben! ':)
.....
|| Vorname:||(:input text vorname size=40:)
     %red%(:foxmessages neumit vorname:) ||
|| Nachname:||(:input text nachname size=40:)
     %red%(:foxmessages neumit nachname:) ||
.....
|| Bild hochladen:||(:input file upfile size=70:)
    (:input hidden var '{$$(wikiword {$$nachname} {$$vorname})}':)
    (:input hidden upfile_name {$$var}.jpg':) ||

The last shows the use of wikiword markuop expression for generating
an automatic upload filename, which then can be references with a
Attach:{$Name}.jpg in the GroupHeader,  or
Attach:{$$var}.jpg syntax in the Fox template

hope this helps!

  ~Hans




More information about the pmwiki-users mailing list