[pmwiki-users] PmForm - change summary and cancel button
Randy Brown
alongkiss at aprivatespot.com
Sun Mar 6 18:06:41 CST 2011
Dave,
Thanks for your pointers. The BlogIt recipe was a bit complex for me. I think I'm missing a couple of very basic things:
1. My function doesn't seem to be invoked. How does my HandleActions function get called? If it's called, will PmForm still do its part, or will I now have to update *all* the fields myself? Would I be better off just making a custom version of PmForm?
2. My posting template ("metapost") only lists the page text variables. Should it list the EnteredChangeSummary too? When I tried that, PmForm created a page text variable by that name - not what I wanted. How will I pass EnteredChangeSummary to the handler?
Thanks,
Randy
P.S. Here is what is now in my config:
$PmForm['savemeta'] = 'saveto={$FullName} form=#metaform fmt=#metapost';
## Allow PmForms to change the page summary
SDV($HandleActions['MetaEdit'], 'HandleMetaEdit');
SDV($HandleAuth['MetaEdit'], 'edit');
# ----------------------------------------
# - HandleActions Functions
# ----------------------------------------
function HandleMetaEdit($pagename, $auth='edit') {
global $_POST,$ChangeSummary;
echo "HandleMetaEdit: entering function"; # This never appears
if (isset($_REQUEST['cancel'])) {
Redirect($pagename);
}
Lock(2);
if (!PageExists($pagename)) {
Abort("HandleMetaEdit: source page ($pagename) doesn't exist");
}
if ($_POST['target']=='savemeta' && @$_POST['save']) {
$ChangeSummary = $_POST['EnteredChangeSummary'];
$old = RetrieveAuthPage($pagename, $auth, TRUE);
if (!$old) {
Abort("HandleMetaEdit: cannot read source ($pagename)");
} else {
$new = $old;
$new['csum'] = $ChangeSummary;
# Do I need to handle the other fields, or will PmForm continue to do that?
UpdatePage($pagename,$old,$new);
}
}
Lock(0);
}
In my markup:
[[#metaform]]
**Edit the information about this page**
(:input pmform target=savemeta:)
(:input default source={*$FullName} request=1 :)
(:messages:)
(:table:)
etc.
**Please summarize your changes:** \\
(:input text EnteredChangeSummary size=80:)\\ \\
[[#metapost]]
(:template defaults savevars=$:OnePTV,$:AnotherPTV, etc. :)
[[#metapostend]]
On Mar 1, 2011, at 7:27 PM, DaveG wrote:
> Check out BlogIt, which uses PmForms, that might help (or might be too complex to easily grab info quickly).
More information about the pmwiki-users
mailing list