00260: Disable Edit Button during Actual Edit

Summary: Disable Edit Button during Actual Edit
Created: 2004-12-29 06:22
Status: Closed - Answered
Category: Bug
From: Jeff Rush
Priority: 4
Version: 2.0 alpha 14
OS: Linux/Apache 2

Description: Several times I've been editting some wiki content, got distracted and clicked on the Edit button, which discard my in-progress edit work. Sigh.

If I'm in the midst of an edit, the Edit button should be greyed out. Or actually pass a flag I can key off of into the .tmpl and I can add conditional code to my template myself.

You can key off of the $action variable -- while in an edit the $action variable will contain "edit". In your config.php, place

   if ($action == 'edit') $EditLinkFmt = 'Edit Page';
   else $EditLinkFmt = "<a href='\$PageUrl?action=edit'>Edit Page</a>";

and then use $EditLinkFmt in the template at the point where the edit link would normally be placed.

(The ... in each of the above provide internationalization? support -- you can of course omit these if you don't need that.)