EditOnDblClick
Goal
When you double click on a page, go to the edit action.
Solution
Add this line to the <body> declaration of the skin template (In the .tmpl
file in the pub\skins\pmwiki
folder) you are using :
ondblclick="if(window.location.href.indexOf('action=edit') < 0){window.location.href = window.location.href + '?action=edit';}"
--Pyros , Floris
practically, the body tag will now look like this :
<body ondblclick="if(window.location.href.indexOf('action=edit') < 0){window.location.href = window.location.href + '?action=edit';}">
To avoid having people without edit permissions getting irritated by this wonderful little script it can be modified like this:
Put the following in your skin php file, or just the second line in your config file.
global $BodyAttr;
if (CondAuth($pagename
, 'edit') == true) $BodyAttr = 'ondblclick="window.location.href=window.location.href + \'?action=edit\'"';
Then, change the body tag to look like this:
<body background="$SkinDirUrl
/space.gif" $BodyAttr>
It will ignore the double click unless the user has edit privileges. If someone wants to rewrite this to look more like the one above, go for it, but this works fine for me. Caveman
To avoid editing again (and lose all your modifications) when double-clicking on a word you want to select, while in edition mode, I added a condition on the current action : //
if ((CondAuth($pagename
, 'edit') == true)&&($_GET['action']!="edit")) $BodyAttr = 'ondblclick="window.location.href=window.location.href + \'?action=edit\'"';
Kaskooy
Comments
See discussion at EditOnDblClick-Talk