1<?php 2/** 3 * DblClickEdit Plugin - enter edit mode with double click 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author H�kan Sandell <hakan.sandell@home.se> 7 */ 8 9// must be run within Dokuwiki 10if (!defined('DOKU_INC')) die(); 11 12class action_plugin_dblclickedit extends DokuWiki_Action_Plugin { 13 14 /** 15 * register the eventhandlers 16 */ 17 function register(& $controller) { 18 $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'enable_dblClick'); 19 } 20 21 /** 22 * Ensure we have enough access rights and edit is an allowed action 23 * section edit is disabled for old revisions 24 */ 25 function enable_dblClick(& $event, $param) { 26 global $INFO; 27 global $ACT; 28 global $REV; 29 global $JSINFO; 30 31 if ($INFO['writable'] && in_array($ACT, array('show'))) { 32 if ($REV > 0) { 33 $JSINFO['dblclick'] = 1; 34 } else { 35 $JSINFO['dblclick'] = 2; 36 } 37 } 38 } 39 40} 41