New option to choose action on page creation

This commit is contained in:
Simon DELAGE 2015-06-13 02:05:52 +02:00
parent e47db0748b
commit a8323791cf
6 changed files with 12 additions and 4 deletions

View file

@ -119,12 +119,12 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
array_push($wikistart, $language.':'.$conf['start'], ':'.$language.':'.$conf['start']);
}
}
// If Public page was just created, redirect to it and edit
// If Public page was just created, redirect to it and edit (or show)
if ($created['public']) {
send_redirect(wl($this->public_page, 'do=edit', false, '&'));
send_redirect(wl($this->public_page, 'do='.$this->getConf('action'), false, '&'));
// Else if private start page was just created and edit option is set, redirect to it and edit
} elseif (($created['private']) && ($this->getConf('edit_before_create'))) {
send_redirect(wl($this->private_page, 'do=edit', false, '&'));
send_redirect(wl($this->private_page, 'do='.$this->getConf('action'), false, '&'));
// Else if user's private page exists AND [(user isn't requesting a specific page OR he's requesting wiki start page) AND logged in 2sec ago max]
} elseif ((page_exists($this->private_page)) && (((!isset($_GET['id'])) or (in_array($_GET['id'], $wikistart))) && (time()-$_SESSION["uhptimestamp"] <= 2))) {
send_redirect(wl($this->private_page));

View file

@ -23,3 +23,4 @@
$conf['acl_all_templates'] = '1';
$conf['acl_user_templates'] = '1';
$conf['no_acl'] = 0;
$conf['action'] = 'edit';

View file

@ -23,3 +23,4 @@
$meta['acl_all_templates'] = array('multichoice','_choices'=>array('0','1','2','noacl'));
$meta['acl_user_templates'] = array('multichoice','_choices'=>array('0','1','2','noacl'));
$meta['no_acl'] = array('onoff');
$meta['action'] = array('multichoice','_choices'=>array('edit','show'));

View file

@ -53,3 +53,6 @@
$lang['acl_user_templates_o_2'] = 'Edit';
$lang['acl_user_templates_o_noacl'] = 'No automatic ACL';
$lang['no_acl'] = 'No automated ACL setting at all but you\'ll have to remove those created so far manually. Don\'t forget to set some ACL on templates.';
$lang['action'] = 'Action on first redirection to public page after it\'s creation (or private namespace start page).';
$lang['action_o_edit'] = 'Edit (Default)';
$lang['action_o_show'] = 'Show';

View file

@ -53,3 +53,6 @@
$lang['acl_user_templates_o_2'] = 'Écriture';
$lang['acl_user_templates_o_noacl'] = 'Pas de gestion automatique des droits';
$lang['no_acl'] = 'Aucun règlage automatique des droits d\'accès mais vous devrez nettoyer manuellement les règles déjà créées. Pensez à protéger les modèles.';
$lang['action'] = 'Action à la première redirection vers la page publique après sa création (ou la page d\'accueil de l\'espace de nom privé).';
$lang['action_o_edit'] = 'Editer (Défaut)';
$lang['action_o_show'] = 'Afficher';

View file

@ -1,7 +1,7 @@
base userhomepage
author Simon Delage
email simon.geekitude@gmail.com
date 2015-06-04
date 2015-06-13
name User Homepage
desc Automatically create user's private namespace and/or public page and redirects users to private namespace on login.
url https://www.dokuwiki.org/plugin:userhomepage