You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

63 lines
1.6 KiB

  1. <?php
  2. /**
  3. * Move Plugin Tree Loading Functionality
  4. *
  5. * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  6. * @author Andreas Gohr <gohr@cosmocode.de>
  7. */
  8. // must be run within Dokuwiki
  9. if(!defined('DOKU_INC')) die();
  10. /**
  11. * Class action_plugin_move_rewrite
  12. */
  13. class action_plugin_move_tree extends DokuWiki_Action_Plugin {
  14. /**
  15. * Register event handlers.
  16. *
  17. * @param Doku_Event_Handler $controller The plugin controller
  18. */
  19. public function register(Doku_Event_Handler $controller) {
  20. $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_call');
  21. }
  22. /**
  23. * Render a subtree
  24. *
  25. * @param Doku_Event $event
  26. * @param $params
  27. */
  28. public function handle_ajax_call(Doku_Event $event, $params) {
  29. if($event->data != 'plugin_move_tree') return;
  30. $event->preventDefault();
  31. $event->stopPropagation();
  32. global $INPUT;
  33. global $USERINFO;
  34. if(!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
  35. http_status(403);
  36. exit;
  37. }
  38. /** @var admin_plugin_move_tree $plugin */
  39. $plugin = plugin_load('admin', 'move_tree');
  40. $ns = cleanID($INPUT->str('ns'));
  41. if($INPUT->bool('is_media')) {
  42. $type = admin_plugin_move_tree::TYPE_MEDIA;
  43. } else {
  44. $type = admin_plugin_move_tree::TYPE_PAGES;
  45. }
  46. $data = $plugin->tree($type, $ns, $ns);
  47. echo html_buildlist(
  48. $data, 'tree_list',
  49. array($plugin, 'html_list'),
  50. array($plugin, 'html_li')
  51. );
  52. }
  53. }