From 75232deb62f81e3c35f0d47d854d3efb7b4ae2b9 Mon Sep 17 00:00:00 2001 From: Simon DELAGE Date: Mon, 1 Sep 2014 15:57:34 +0200 Subject: [PATCH] Changed template stuff Patern on [templatepath] option was preventing to change the path. Also renamed _template.txt to _template_private.txt and changed code accordingly. --- _template.txt | 1 - _template_private.txt | 1 + action.php | 12 ++++++------ conf/default.php | 2 +- conf/metadata.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 _template.txt create mode 100644 _template_private.txt diff --git a/_template.txt b/_template.txt deleted file mode 100644 index 98838f6..0000000 --- a/_template.txt +++ /dev/null @@ -1 +0,0 @@ -====== @NAME@ (@USER@) ====== diff --git a/_template_private.txt b/_template_private.txt new file mode 100644 index 0000000..280d43c --- /dev/null +++ b/_template_private.txt @@ -0,0 +1 @@ +====== @NAME@ (@USER@) - Private Namespace ====== \ No newline at end of file diff --git a/action.php b/action.php index 756d9be..26cb404 100644 --- a/action.php +++ b/action.php @@ -16,7 +16,7 @@ require_once (DOKU_PLUGIN . '/acl/admin.php'); class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ function register(&$controller) { $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'redirect',array()); - $controller->register_hook('HTML_PAGE_FROMTEMPLATE', 'BEFORE', $this, 'page_template',array()); +// $controller->register_hook('HTML_PAGE_FROMTEMPLATE', 'BEFORE', $this, 'page_template',array()); } function redirect(&$event, $param) { global $conf; @@ -44,9 +44,9 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ // Write things back to conf/acl.auth.php file_put_contents(DOKU_INC.'conf/acl.auth.php', implode($lines)); if (!$this->getConf('edit_before_create')) { - //writes the user info to page + //writes the user info to private page lock($id); - saveWikiText($id,$this->_template(),$lang['created']); + saveWikiText($id,$this->_template_private(),$lang['created']); unlock($id); } // redirect to edit home page @@ -72,7 +72,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ require_once (DOKU_INC.'inc/search.php'); if($_SERVER['REMOTE_USER']!=null) { $this->doku_page_path = $conf['datadir']; - $this->home_page_template = DOKU_INC . $this->getConf('templatepath'); + $this->private_page_template = DOKU_INC . $this->getConf('templatepath'); if ($this->getConf('group_by_name')) { // private:s:simon $this->home_wiki_ns = cleanID($this->getConf('users_namespace').':'.strtolower(substr($this->homeNamespace(), 0, 1)).':'. $this->homeNamespace()); @@ -103,9 +103,9 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ return $this->homeNamespace(); } } - function _template() { + function _template_private() { global $INFO; - $content = io_readFile($this->home_page_template, false); + $content = io_readFile($this->private_page_template, false); $name = $INFO['userinfo']['name']; $user = strtolower($_SERVER['REMOTE_USER']); $content = str_replace('@NAME@',$name,$content); diff --git a/conf/default.php b/conf/default.php index 82d367e..81c5dfa 100644 --- a/conf/default.php +++ b/conf/default.php @@ -12,5 +12,5 @@ $conf['users_namespace'] = 'private'; $conf['set_permissions'] = 1; $conf['set_permissions_others'] = '0'; $conf['group_by_name'] = 1; -$conf['templatepath'] = 'lib/plugins/userhomepage/_template.txt'; +$conf['templatepath'] = 'lib/plugins/userhomepage/_template_private.txt'; $conf['edit_before_create'] = 0; diff --git a/conf/metadata.php b/conf/metadata.php index a6b8f04..33a79c9 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -12,5 +12,5 @@ $meta['users_namespace'] = array('string','_pattern' => '/^(|[a-zA-Z\-:]+)$/'); $meta['set_permissions'] = array('onoff'); $meta['set_permissions_others'] = array('multichoice','_choices'=>array('0','1','2','4','8','16')); $meta['group_by_name'] = array('onoff'); -$meta['templatepath'] = array('string','_pattern' => '/^(|[a-zA-Z\-]+)$/'); +$meta['templatepath'] = array('string'); $meta['edit_before_create'] = array('onoff');