[pmwiki-users] Need a New Forms recipe
Hans
design5 at softflow.co.uk
Wed Aug 29 16:17:00 CDT 2007
Here is a custom solution using Fox:
you need to install fox.php as normal.
http://www.pmwiki.org/wiki/Cookbook/Fox
add to config.php:
include_once("$FarmD/cookbook/fox.php");
SDV($ThreadStart,'0001');
$MarkupExpr['thread'] = 'MakeThread($pagename,$args[0])';
function MakeThread($pagename,$grp) {
global $ThreadStart;
if (!$grp) $grp = PageVar($pagename, '$Group');
$e = $ThreadStart-1;
foreach(ListPages("/^TODO-$grp.\\d/") as $n) {
$n = substr($n,-4);
if (! ereg("^[0-9]+$", $n)) continue;
$e = max($e,$n);
}
return sprintf("%04d",$e+1);
}
This last is a simplified modified version of the ZAP thread
functions. It is specific for the TODO-$group.#### pages.
Fox will use it to create threaded pages starting with 0001 (not 1000).
If you want to have 3-digit numbers instead of four, use this instead:
SDV($ThreadStart,'001');
$MarkupExpr['thread'] = 'MakeThread($pagename,$args[0])';
function MakeThread($pagename,$grp) {
global $ThreadStart;
if (!$grp) $grp = PageVar($pagename, '$Group');
$e = $ThreadStart-1;
foreach(ListPages("/^TODO-$grp.\\d/") as $n) {
$n = substr($n,-3);
if (! ereg("^[0-9]+$", $n)) continue;
$e = max($e,$n);
}
return sprintf("%03d",$e+1);
}
Then create a Site.FoxConfig page with
(:linebreaks:)
TODO-*.*: add
This sets permission for Fox to add content to any page in any group
starting with TODO-
Create a Site.ToDoForm page with:
(:linebreaks:)
(:messages:)
(:fox todoform template="Site.ToDoTemplate" target="TODO-{*$Group}.{(thread {*$Group})}"
redirect=1:)
||width=50%
|| Project:||(:input text project:) ||
|| Owner:||(:input text owner:) ||
|| Priority:||(:input text priority:)||
|| Status:||(:input text status:) ||
|| Description:||(:input text description:) ||
|| Return Page:||(:input text name=returnpage value="{*$FullName}":) ||
|| ||(:input submit post Enter:)
(:foxend todoform:)
watch the 3rd line is one long line, the email may have chopped it up
into two! Note the redirect=1 which will bring the poster to the
newly created page. You may want to omit this, but I have not got
"successful posted" message system.
The (:messages:) markup is used for error messages at present.
Create a template page Site.ToDoTemplate with:
(:nogroupheader:)
(:Project:{$$project}:)
(:Owner:{$$owner}:)
(:Priority:{$$priority}:)
(:Status:{$$status}:)
(:Description:{$$description}:)
(:ReturnPage:{$$returnpage}:)
Project Page: [[{$:ReturnPage}]]
this determines what goes onto the TODO pages.
(:nogroupheader:) surpresses the ToDoForm from appearing on those
pages. Then you got the PTVs, and finally a link back to the project
page from which the TODO was created. The {$$name} variables
correspond to field names in the Fox form.
And finally put into your Site.AllGroupFooter
(:include Site.ToDoForm:)
as you got already.
hope this will get you sorted!
Let me know how it goes.
~Hans
More information about the pmwiki-users
mailing list