[pmwiki-users] Editform: clearing a page text variable, escaping directives

Patrick R. Michaud pmichaud at pobox.com
Sat Apr 28 12:10:26 CDT 2007


On Sat, Apr 28, 2007 at 05:58:16PM +0200, Petko Yotov wrote:
> On Saturday 28 April 2007 17:02, Patrick R. Michaud wrote:
> > > If people really use empty input boxes to modify existing, non-empty PTVs
> > > (I still cannot understand why), then probably PmWiki could detect if it
> > > had or had not pre-filled the form with values ...
> >
> > It is _very_ difficult for PmWiki to know if it has pre-filled out a
> > particular form with values.  Doing so requires keeping quite a bit
> > of session information around for every form that PmWiki generates, [...]
> 
> I was thinking not of session data, but more of a hidden form field as in:
>    (:input default request=1 source=DataPage:)
>    translated to:
>    <input type="hidden" name="_ptv_were_prefilled" value="1"/>
> 
> when there is a "source=DataPage" parameter, it was pre-filled.

Oh, something like that might work.  I'll keep it in mind.

> > > > But converting "(&#x3a;" back to "(:" upon edit would defeat the
> > > > purpose here.  
> > >
> > > I did not mean in the wiki source, but in the editform's input-boxes
> > > (PmPhilosophy n°1) but currently I cannot see how this could be done.
> >
> > The problem is that if it's in the editform's input-boxes, then
> > when the author (re-)submits the page to PmWiki we cannot know if
> > the "(:" that comes from the text field is because we previously
> > converted from (&#x3a; or because the author really wants a "(:"
> > to appear there.
> 
> I understand what you mean, however this is still a puzzle: what if 
> the "advanced" editor adds "(:" in the page source? It will display "(:" in 
> the input box, and then, when saved, will transform into "(&#x3a;" and 
> eventually will break something.

Currently the transformation from "(:" to "(&#x3a;" will
happen only when updating a page text variable, or inserting
text that is bypassing edit permissions.  Normal editing is
unaffected.

> For me, the most consistent behaviour would be, from a posted "editform", to 
> always escape "(:" inside PTVs, advanced editor or not. If it is always 
> escaped, there is no problem, only in the "editform" mode, to "unescape" back 
> the "(&#x3a;" into "(:".

Oh, I understand what you're referring to now.  You're saying
that it should be switched back only when using an editform.
That's possible... but it also has a bit of the "spooky action
at a distance" sort of take to it.

My current thought is that we simply add spaces, so that
"(:" and ":) are converted to "( :" and ": )" and leave it
at that.  That preserves safety, still looks reasonable when
editing, and makes it relatively clear as to what is going on.

> Hopefully, we will have more ideas to brainstorm. :-)

Undoubtedly.  Thanks again!

Pm



More information about the pmwiki-users mailing list