Added option to edit public page

Edit private page option will not work wich is a good thing: after first
login, user will be redirected to his private namespace start page so he
won't forget to edit it while he might not even know he has a public one
This commit is contained in:
Simon DELAGE 2014-09-01 19:18:16 +02:00
parent 8d12996bd9
commit 2d3ab28a4c
4 changed files with 12 additions and 3 deletions

View file

@ -49,8 +49,10 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
saveWikiText($id,$this->_template_private(),$lang['created']);
unlock($id);
// }
// redirect to edit home page
send_redirect(wl($id, array("do" => ($this->getConf('edit_before_create'))?"edit":"show"), false, "&"));
// Redirect to edit or show private namespace start page (if edit public page is not on)
if (!($this->getConf('edit_public_before_create'))) {
send_redirect(wl($id, array("do" => ($this->getConf('edit_before_create'))?"edit":"show"), false, "&"));
}
}
// If Translation plugin is active, determine if we're at wikistart
if (!plugin_isdisabled('translation')) {
@ -93,6 +95,10 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
lock($this->public_page);
saveWikiText($this->public_page,$this->_template_public(),$lang['created']);
unlock($this->public_page);
// redirect to edit public page
if ($this->getConf('edit_public_before_create')) {
send_redirect(wl($this->public_page, 'do=edit', false, '&'));
}
}
}
}

View file

@ -18,3 +18,4 @@ $conf['edit_before_create'] = 0;
$conf['create_public_page'] = 0;
$conf['public_pages_ns'] = 'user';
$conf['templatepathpublic'] = 'lib/plugins/userhomepage/_template_public.txt';
$conf['edit_public_before_create'] = 1;

View file

@ -18,3 +18,4 @@ $meta['edit_before_create'] = array('onoff');
$meta['create_public_page'] = array('onoff');
$meta['public_pages_ns'] = array('string','_pattern' => '/^(|[a-zA-Z\-:]+)$/','_caution' => 'warning');
$meta['templatepathpublic'] = array('string');
$meta['edit_public_before_create'] = array('onoff');

View file

@ -20,7 +20,8 @@ $lang['set_permissions_others_o_8'] = 'Upload';
$lang['set_permissions_others_o_16'] = 'Delete';
$lang['group_by_name'] = 'Group users\' namespaces by the first character of user name ?';
$lang['templatepath'] = 'Doku relative path to the template file for user\'s namespace start page.';
$lang['edit_before_create'] = 'Allow users to edit their namespace start page before create.';
$lang['edit_before_create'] = 'Allow users to edit their private namespace start page on creation (will not work if editing public page on creation is on).';
$lang['create_public_page'] = 'Create a public page for user';
$lang['public_pages_ns'] = 'Namespace under wich public pages ar created. If a value other than \'user\' is used, ?????????????????';
$lang['templatepathpublic'] = 'lib/plugins/userhomepage/_template_public.txt';
$lang['edit_public_before_create'] = 'Allow users to edit their public on creation.';