[Pmwiki-users] Plugin coding issues (was Re: Re: Request for method to let...)
Christian Ridderström
chr
Tue Jul 20 02:57:58 CDT 2004
I didn't see any replies to this, so I'm reposting a stripped version
about the remaning issues:
On 17 Jul 2004, John Rankin wrote:
First what I guess amounts to a request for a hook variable to set a text
in $PageEditFmt.
> 2. We needed to change 'Editing $PageName' to 'Editing $PageName Draft'
> if we are editing the draft version of the page. But page drafts may be
> supported as a group-level customisation and another local customisation
> may change $PageEditFmt. So locally, what I do is include pgcust.php
> early in local/config.php and use
>
> $PageEditFmt = str_replace('[Editing $PageName]',
> '[Editing $PageName]'.$DraftTagFmt,$PageEditFmt);
>
> There is nothing to stop some other local customisation from overwriting
> this. Since this is a wording change, that's probably OK; it just means
> you lose the reminder that you are editing a draft copy, not the original.
The next paragraphs are about adding an extra button to the edit page.
> 3. For reasons discussed elsewhere, 'Edit' always edits the draft copy.
> So how do you remove a draft and revert to the original? One option is
> to put another button next to the Reset button. It might say
> Edit Original Page; pressing it brings up the original version of the
> page and next time you press Preview it overwrites the existing draft.
>
> Assuming the code behind the button is fairly trivial (which I think
> it is), what is the best way to add such a button from a local script,
> that has to co-exist with other scripts which may also wish to change
> the edit page format? Using the str_replace approach seems insufficiently
> robust. Redeclaring the entire $PageEditFmt variable seems unnecessary
> and selfish (the module is no longer a black box).
The next issue concerns the equivalent of changing a template from within
a plugin. Is this possible, or do we have to fall back to instructing
the user/admin to do this manually?
> 4. We have had to make changes to the page template. The smallest change
> I could think of was 2 extra variables:
>
> - $DraftLinkFmt goes after the page title and contains whatever it needs
> to in any given context
>
> - $DraftTagFmt goes after $[Edit Page] to let you know whether you are
> editing a draft or the original
>
> I couldn't think of a way to implement this that didn't involve changing
> the template. If the page title and edit page links had both been system
> variables, then I could have written (for example):
>
> $PageTitleFmt .= $DraftlinkFmt;
>
> What are the reasons for using physical code rather than logical building
> blocks in a template? It occurs to me that one could write large parts of
> the template using wiki markup and use the wiki engine to generate almost
> the entire thing. Indeed, the following probably already works:
>
> <!--function:PrintText %newwin%[[ThisPage:?action=print Printable View]]-->
>
> I wonder if it could be made simpler to use wiki markup in template pages.
> How about setting a design goal that the template can be written (almost)
> entirely in wiki markup? What would need to be added to wiki markup to
> achieve this? I'm not sure how this approch would affect i18n.
/Christian
--
Christian Ridderstr?m http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list