[pmwiki-users] adddeleteline: A great script, suggested fixes and additions.
Martin Fick
fick at fgm.com
Thu Nov 3 11:53:26 CST 2005
Wow, what a fabulous script and idea!! :)
It is really clever.
Some thoughts:
1) The (:input :) markup interferes with the new pmwiki
(:input :) markup. See what it does to your edit page!
a) I would suggest making most of the markup more recipe
specific
or
b) Using as much of the new pmwiki form markup as
possible
I realise that option 'b' would probably make things a
little wordy.
2) Still some german spread around in the recipe, i.e. the
delete
button comes up as 'austragen'. :)
3) How about adding a target= option to the (:form:)
directive?
I have added some notes on doing this manually with the
pmwiki (:input hidden:) markup to the recipe page.
(:input hidden name='n' value='<page>.<group>':)
4) Append: How about making it possible to append to a page
without that page needing to have an (:addhere:) in it.
I have implemented this with the following changes:
Add a new HandleAction:
$HandleActions['appendline']='HandleAddLine';
Add the following 3 lines inside HandleAddLine():
> $added = FALSE;
foreach ($text as $nr => $line) {
if ($line==$newpagecmd) {
$text[$nr] = $replace."\n$line";
> $added = TRUE;
}
}
> if($action === "appendline" && ! $added) $text[]="$replace";
Lastly, use the following pmwiki markup in your form to
specify that you want stuff to actually get appended if
it is not inserted via an (:addhere:) directive.
(:input hidden name='action' value='appendline':)
This leads to...
Future ideas to make the backend more generic and easier to
integrate by other recipes (it is a great building block!):
5) Possibly Change (:addhere:) to (:insert:) to be more DB
like.
6) Maybe add some form of update mechanism. Alogn with
providing a way for editing already added data, this
would give a mechanism to allow the middle of a line to
be edited.
7) Make multiple additions possible so that if more than one
entry is provided, more than one line will be added.
8) Add a conditional notation, so that if I have multiple
fields and they don't get filled out they don't get
added. Something like this (a little wordy though).
Example:
(:form party:)
||Name || (:input name:) ||
||I am bringing: || (:input food:) ||
|| (:submit Enter:) ||||
(:appendas ifset name "# {name} - (:delete:)":)
(:appendas ifset food "* {food} - (:delete:)":)
(:endform:)
!!People Attending
(:addhere party.name:)
!!Food
(:addhere party.food:)
9) Allow multiple targets from one form. Imagine a
PageListTemplate that lists each page with a checkbox
next to it. At the bottom of the page will be a
category textbox. This would allow a person to enter a
category that would then be appended to all the checked
pages!
Im my case, these pages will have photos in them, this
will allow me to easily add categories to my photos
creating a enriched way to browse them by categories.
This could also be very usefull to apply categories to
the documentation pages by scanning an index and apply
categories without having to edit individual pages.
Again, a great recipe! Thanks,
-Martin
More information about the pmwiki-users
mailing list