[pmwiki-users] Need a New Forms recipe

The Editor editor at fast.st
Wed Aug 1 07:11:00 CDT 2007


On 8/1/07, Sivakatirswami <katir at hindu.org> wrote:
> As Zap is, but the author's own admission, an abandoned recipe.
> I'm looking for another forms "engine" that I can use.
>
> I have created a very simple TO DO system and the model is working well.
> I'm pretty happy with my current architecture,
> but am nervous about using ZAP to develop anything further and am
> looking for
> forms recipes from authors who are committed to PMwiki...
>
> as a "naive admin" who know no PHP ( I can read it and get the idea
> but... that's about it...) I need something super simple.
>
> I have a small TODO form that appears globally on all site pages.
>
> When you fill in the form, the ZAP engine generates
> a data page in new group folder and pages within it like this;
>
> TODO-FAQ
>   TODO-FAQ.1001
>   TODO-FAQ.1002
>
> The data on the data pages looks like this:
>
> (:Project: HTDE-MediaViewer:)
> (:Owner: Andre:)
> (:Priority: 2-Hi:)
> (:Status: Open:)
> (:Description: Submit Functional Specification proposal for new media
> viewer:)
> (:returnpage: HTDE-MediaViewer.FunctionalSpecification:)
>
>
> where the "returnpage" is a the page from which the TODO was originally
> created.
>
> That's all there is to it.. with this simple model for input, I can then
> can use PMwiki's marvelous pagelist magic to display these any way,
> anywhere any how: staff can see their TO DO's the TO DO' attached
> to a given propect page are made to appear in the Site.AllGroupMenu
> section. Home pages for a group show all the TODO's for the entire
> group... TODO's for a particular project are in their own folder, and
> provide
> a flat file documentation trail of tasks that went into any project
> etc.  I'm really happy the way's it is working...
>
> I built this after abandoning
> XtoDo because I found the XToDO recipe has serious limitations
>  fragmenting the knowledge base for any given project.. no way to
> tie TO Do's across multiple projects in motion to staff etc.
> and my system is built to over come those issue....and it works, sort of...
>
> Any ideas on an alternative forms engine-cookbook?
> The requirements are really simple
>
> 1) take the form data
> 2) create a new page (and a new group if necessary)
>   the group name of the new page
>       on the group the current page is in prepended with "TODO-"
> 3) and the page name itself is a thread number that is increment.
> Presently the ZAP engine is generating unique ID's as integers
> but across groups we get... duplicate page names...e.g.
>
> TODO-FAQ.1000
>
> TODO-WebContent.1000
>
> This latter requirement is flexible... any kind of unique ID which is
> the actual
> page name, will suffice. I just took this from ZAP's forum model.
>
>
> Sivakatirswami


Hi Sivaka!

I'll write more about ZAP's future in another post, but thought I
would at least mention, you can already do this pretty easily without
ZAP.

I don't know the exact syntax, but Pm has recently introduced the
capability of saving PTV's on a page using a default form. I believe
the recipe was PmForm or something like that. You should look into
using.

http://www.pmwiki.org/wiki/Cookbook/PmForm
http://www.pmwiki.org/pmform/PmForm/DataForms

The only thing currently lacking is the threading, and for that you
can create a simple markup expression. Here are the functions
currently used in ZAP...

SDV($ZAPthreadstart,'1000');
$MarkupExpr['thread'] = 'MkExpExtThread($args[0])';
function MkExpExtThread($g) {
	global $ZAPthreadstart, $pagename;
	if ($g == '') $g = substr($pagename, 0, strpos($pagename, "."));
	return ZAPthread($g);
	}

and

function ZAPthread($g) {
	global $ZAPthreadstart;
	$e = $ZAPthreadstart - 1;
	$gg = explode(",", $g);
	foreach($gg as $ggg) {
		foreach(ListPages("/^$ggg\\.\\d/") as $n) {
		$n = substr($n,strlen($ggg)+1);
		if (! ereg("^[0-9]+$", $n)) continue;
		$e = max($e,$n);
		}
	}
	$e = $e + 1;
	return $e;
	}

Actually, you can probably just combine this to (not tested):

SDV($ZAPthreadstart,'1000');
$MarkupExpr['thread'] = 'MkExpExtThread($args[0])';
function MkExpExtThread($g) {
	global $ZAPthreadstart, $pagename;
	if ($g == '') $g = substr($pagename, 0, strpos($pagename, "."));
	$e = $ZAPthreadstart - 1;
	$gg = explode(",", $g);
	foreach($gg as $ggg) {
		foreach(ListPages("/^$ggg\\.\\d/") as $n) {
		$n = substr($n,strlen($ggg)+1);
		if (! ereg("^[0-9]+$", $n)) continue;
		$e = max($e,$n);
		}
	}
	$e = $e + 1;
	return $e;
	}

Drop it in a config file, and then add {(thread Group)} and it returns
the proper thread number which you insert into the target for your
data form.

Hopefully this will get you the basic functionality you want. So
unless you want mor than this basic functionality, there's hardly need
any longer for a new recipe. And for advanced functionality, ZAP
continue to remain available.

Cheers,
Dan



More information about the pmwiki-users mailing list