[pmwiki-users] Any suggestions?
Crisses
crisses at kinhost.org
Sun Sep 17 08:10:46 CDT 2006
On Sep 17, 2006, at 4:08 AM, Allister Jenks wrote:
> Here's my problem.
>
> A live site, so when editing a page with complex markup, I save as
> draft. I make several iterations to test the changes and soon enough,
> in a moment of frustration that my logic isn't doing what I want,
> instinct kicks in and I click 'Save' instead of 'Save draft'!
>
> Could the buttons be reversed or could there be an 'are you sure' if
> clicking 'Save' on a -Draft page?
I didn't know about a draft feature in PmWiki -- new to me -- and I
see the EnableDrafts now that I look for it.
I'm sure that Patrick could give you a code snippet to add to your
config.php, but I'm pretty sure most people won't need the feature
for it to be rolled into the main distro.
The key would be taking a look at the form and seeing what the
different buttons do. (Save is submit=post and save & edit is
submit=postedit)
One way to do it would be a javascript, and you'd have to change how
the form is submitted. The logic would be to change those two
buttons with something that checks in with the JavaScript rather than
setting submit values. JavaScript says "Are you sure you want this
page to go live?" and you click to validate, at which point JS
changes submit to either "post" or "postedit" and submits the form to
pmwiki.
The other way would be something like this:
if ($_POST['submit'] == "postedit" || $_POST['submit'] == "post") {
some code to get verification here
}
The problem is that if you do the validation with PHP, you need to
make sure you pass all the submitted information to the intervening
"Are you sure?" page. A JavaScript pop-up is probably the right way
to do this. And I'm not a JS expert; I'd have to sit down with a JS
manual and pour over the code to get a program that did this.
Would it be easier if you changed the layout of the form, so you had
to specifically go out of your way to save the page? Put the save &
save & edit buttons several lines below the Save as Draft? You can
easily do that through Site/EditForm --
change the edit form to have something like this -- I've inserted a
horizontal rule on the page:
(:input e_savedraftbutton:) (:input e_previewbutton:)
----
(:input e_savebutton:) (:input e_saveeditbutton:) (:input
e_cancelbutton:)
(:input end:)
(:divend:)
Of course you can space it differently. Or put the buttons in a
table so they're at opposite ends of the screen, etc.
Crisses
----
"If you made a list [of memories] from your days in the eighth grade,
it would probably be [...] brief. This leads to an interesting
question: How can we study memories that cannot be recalled? If a
person cannot recall an experience, can we assume that the memory
trace representing that experience has vanished?"
-- Experimental Psychology, 7th Ed, Kantowitz, Roediger III, Elmes.
More information about the pmwiki-users
mailing list