add contents
This commit is contained in:
38
lib/plugins/edittable/action/sectionjump.php
Normal file
38
lib/plugins/edittable/action/sectionjump.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Table editor
|
||||
*
|
||||
* @author Adrian Lang <lang@cosmocode.de>
|
||||
*/
|
||||
|
||||
/**
|
||||
* redirect to the section containg the table
|
||||
*/
|
||||
class action_plugin_edittable_sectionjump extends DokuWiki_Action_Plugin
|
||||
{
|
||||
/**
|
||||
* Register its handlers with the DokuWiki's event controller
|
||||
*/
|
||||
function register(Doku_Event_Handler $controller)
|
||||
{
|
||||
$controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'jump_to_section');
|
||||
}
|
||||
|
||||
/**
|
||||
* Jump after save to the section containing this table
|
||||
*
|
||||
* @param Doku_Event $event
|
||||
*/
|
||||
function jump_to_section($event)
|
||||
{
|
||||
global $INPUT;
|
||||
if (!$INPUT->has('edittable_data')) return;
|
||||
|
||||
global $PRE;
|
||||
if (preg_match_all('/^\s*={2,}([^=\n]+)/m', $PRE, $match, PREG_SET_ORDER)) {
|
||||
$check = false; //Byref
|
||||
$match = array_pop($match);
|
||||
$event->data['fragment'] = sectionID($match[1], $check);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user