Shortened templates names
And changed to keep a copy of original template
This commit is contained in:
parent
96781dbd83
commit
63d4b4c4f0
24
action.php
24
action.php
|
@ -19,18 +19,18 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
|
|||
$controller->register_hook('AUTH_LOGIN_CHECK', 'AFTER', $this, 'templates',array());
|
||||
}
|
||||
function templates(&$event, $param) {
|
||||
if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_private_template.txt')) {
|
||||
if (!copy(DOKU_INC.'lib/plugins/userhomepage/userhomepage_private_template.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_private_template.txt')) {
|
||||
echo ' An error occured while attempting to copy private template.';
|
||||
} else {
|
||||
echo ' Successfully copied private template.';
|
||||
if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) {
|
||||
if (!copy(DOKU_INC.'lib/plugins/userhomepage/default_private.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) {
|
||||
echo ' An error occured while attempting to copy default_private.txt to '.DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt';
|
||||
// } else {
|
||||
// echo ' Successfully copied private template.';
|
||||
}
|
||||
}
|
||||
if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_public_template.txt')) {
|
||||
if (!copy(DOKU_INC.'lib/plugins/userhomepage/userhomepage_public_template.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_public_template.txt')) {
|
||||
echo ' An error occured while attempting to copy public template.';
|
||||
} else {
|
||||
echo ' Successfully copied public template.';
|
||||
if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt')) {
|
||||
if (!copy(DOKU_INC.'lib/plugins/userhomepage/default_public.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt')) {
|
||||
echo ' An error occured while attempting to copy default_public.txt to '.DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt';
|
||||
// } else {
|
||||
// echo ' Successfully copied public template.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ 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));
|
||||
// Read private start page template
|
||||
$this->private_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_private_template.txt';
|
||||
$this->private_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt';
|
||||
// Create private page
|
||||
lock($this->private_page);
|
||||
saveWikiText($this->private_page,$this->_template_private(),$lang['created']);
|
||||
|
@ -84,7 +84,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
|
|||
// If public page doesn't exists, create it (from template)
|
||||
if ($this->getConf('create_public_page') && !page_exists($this->public_page) && !checklock($this->public_page) && !checkwordblock()) {
|
||||
// Read public page template
|
||||
$this->public_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_public_template.txt';
|
||||
$this->public_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt';
|
||||
// Create public page
|
||||
lock($this->public_page);
|
||||
saveWikiText($this->public_page,$this->_template_public(),$lang['created']);
|
||||
|
|
|
@ -22,4 +22,4 @@ $lang['group_by_name'] = 'Group users\' namespaces by the first character of use
|
|||
$lang['edit_before_create'] = 'Allow users to edit their namespace start page before create (this will only work if you disable [create_public_page]).';
|
||||
$lang['create_public_page'] = 'Create a public page for user';
|
||||
$lang['public_pages_ns'] = 'Namespace under wich public pages are created. If a value other than <code>user</code> is used, you will have to manually handle interwiki user link used by <code>showuseras</code> option (in Display settings).';
|
||||
$lang['templates_path'] = 'Path from DokuWiki root to store templates (userhomepage_private_template.txt and userhomepage_public_template.txt). Examples: <code>data/pages/wiki</code> (wich will make templates editable within DokuWiki) or <code>lib/plugins/userhomepage</code> (usefull in a farm setup to centralize templates).';
|
||||
$lang['templates_path'] = 'Path from DokuWiki root to store templates (userhomepage_private.txt and userhomepage_public.txt). Examples: <code>data/pages/wiki</code> (wich will make templates editable within DokuWiki) or <code>lib/plugins/userhomepage</code> (usefull in a farm setup to centralize templates).';
|
||||
|
|
Loading…
Reference in a new issue