Overview
Comment: | Création de page |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
44a5face717f8da36956bd284b86159f |
User & Date: | bohwaz on 2012-02-17 05:01:12 |
Other Links: | manifest | tags |
Context
2012-02-23
| ||
23:53 | Correction de détermination du chemin pour getSelfUrl check-in: e44e34a766 user: bohwaz tags: trunk | |
2012-02-17
| ||
05:01 | Création de page check-in: 44a5face71 user: bohwaz tags: trunk | |
03:52 | Edition de page wiki fonctionnelle check-in: 4e960757db user: bohwaz tags: trunk | |
Changes
Modified include/class.wiki.php from [e0a91f01c5] to [0c616c6224].
︙ | ︙ | |||
12 13 14 15 16 17 18 | protected $restriction_categorie = null; protected $restriction_droit = null; static public function transformTitleToURI($str) { $str = utils::transliterateToAscii($str); | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | protected $restriction_categorie = null; protected $restriction_droit = null; static public function transformTitleToURI($str) { $str = utils::transliterateToAscii($str); $str = preg_replace('!\s+!', '-', $str); $str = preg_replace('![^a-z0-9_-]!i', '', $str); return $str; } // Gestion des données /////////////////////////////////////////////////////// |
︙ | ︙ | |||
222 223 224 225 226 227 228 | public function canReadPage($lecture) { if (is_null($this->restriction_categorie)) { throw new UnexpectedValueException('setRestrictionCategorie doit être appelé auparavant.'); } | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | public function canReadPage($lecture) { if (is_null($this->restriction_categorie)) { throw new UnexpectedValueException('setRestrictionCategorie doit être appelé auparavant.'); } if ($this->restriction_droit < Garradin_Membres::DROIT_ACCES) { return false; } if ($this->restriction_droit == Garradin_Membres::DROIT_ADMIN || $lecture == self::LECTURE_NORMAL || $lecture == self::LECTURE_PUBLIC || $lecture == $this->restriction_categorie) |
︙ | ︙ |
Modified include/template.php from [00b5636989] to [04457d5232].
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | $value = $_POST[$name]; elseif (isset($params['data']) && isset($params['data'][$name])) $value = $params['data'][$name]; elseif (isset($params['default'])) $value = $params['default']; else $value = ''; return htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); } function tpl_format_tel($n) { $n = preg_replace('![^\d\+]!', '', $n); | > > > > > > > > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | $value = $_POST[$name]; elseif (isset($params['data']) && isset($params['data'][$name])) $value = $params['data'][$name]; elseif (isset($params['default'])) $value = $params['default']; else $value = ''; if (isset($params['checked'])) { if ($value == $params['checked']) return ' checked="checked" '; return ''; } return htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); } function tpl_format_tel($n) { $n = preg_replace('![^\d\+]!', '', $n); |
︙ | ︙ |
Added templates/admin/wiki/creer.tpl version [55d3438eb1].
> > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | {include file="admin/_head.tpl" title="Créer une page" current="wiki"} {if $error} <p class="error"> {$error|escape} </p> {/if} <form method="post" action="{$self_url|escape}"> <fieldset> <legend>Informations</legend> <dl> <dt><label for="f_titre">Titre</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd><input type="text" name="titre" id="f_titre" value="{form_field name=titre}" /></dd> </dl> </fieldset> <p class="submit"> {csrf_field key="wiki_create"} <input type="submit" name="create" value="Créer cette page" /> </p> </form> {include file="admin/_foot.tpl"} |
Modified templates/admin/wiki/editer.tpl from [b26ce37307] to [9a403c37ac].
︙ | ︙ | |||
29 30 31 32 33 34 35 | </fieldset> <fieldset class="wikiRights"> <legend>Droits d'accès</legend> <dl> <dt><label for="f_droit_lecture_public">Cette page est visible :</label></dt> <dd> | | | | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | </fieldset> <fieldset class="wikiRights"> <legend>Droits d'accès</legend> <dl> <dt><label for="f_droit_lecture_public">Cette page est visible :</label></dt> <dd> <input type="radio" name="droit_lecture" id="f_droit_lecture_public" value="{Garradin_Wiki::LECTURE_PUBLIC}" {form_field data=$page name="droit_lecture" checked=Garradin_Wiki::LECTURE_PUBLIC} /> <label for="f_droit_lecture_public"><strong>Sur le site de l'association</strong></label> — cette page apparaîtra sur le site public de l'association, accessible à tous les visiteurs </dd> <dd> <input type="radio" name="droit_lecture" id="f_droit_lecture_normal" value="{Garradin_Wiki::LECTURE_NORMAL}" {form_field data=$page name="droit_lecture" checked=Garradin_Wiki::LECTURE_NORMAL} /> <label for="f_droit_lecture_normal"><strong>Sur le wiki uniquement</strong></label> — seuls les membres ayant accès au wiki pourront la voir </dd> <dd> <input type="radio" name="droit_lecture" id="f_droit_lecture_categorie" value="{$user.id_categorie}" {if $page['droit_lecture'] >= Garradin_Wiki::LECTURE_GROUPE}checked="checked"{/if} /> <label for="f_droit_lecture_categorie"><strong>Aux membres de ma catégorie</strong></label> — seuls les membres de la même catégorie que moi pourront voir cette page </dd> <dt><label for="f_droit_ecriture_normal">Cette page peut être modifiée par :</label></dt> <dd> <input type="radio" name="droit_ecriture" id="f_droit_ecriture_normal" value="{Garradin_Wiki::ECRITURE_NORMAL}" {form_field data=$page name="droit_ecriture" checked=Garradin_Wiki::ECRITURE_NORMAL} /> <label for="f_droit_ecriture_normal">Les membres qui ont accès au wiki</label> </dd> <dd> <input type="radio" name="droit_ecriture" id="f_droit_ecriture_categorie" value="{$user.id_categorie}" {if $page['droit_ecriture'] >= Garradin_Wiki::ECRITURE_GROUPE}checked="checked"{/if} /> <label for="f_droit_ecriture_categorie">Les membres de ma catégorie</label> </dd> </dl> </fieldset> <fieldset class="wikiText"> |
︙ | ︙ |
Modified templates/admin/wiki/page.tpl from [ad3251e950] to [354188b052].
|
| | > > | > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | {if !empty($page.titre) && $can_read} {include file="admin/_head.tpl" title=$page.titre current="wiki"} {else} {include file="admin/_head.tpl" title="Wiki" current="wiki"} {/if} {if !$can_read} <p class="alert">Vous n'avez pas le droit de lire cette page.</p> {elseif !$page} <p class="error"> Cette page n'existe pas. </p> {if $can_edit} <form method="post" action="{$www_url}admin/wiki/creer.php"> <p class="submit"> {csrf_field key="wiki_create"} <input type="hidden" name="titre" value="{$uri|escape}" /> <input type="submit" name="create" value="Créer cette page" /> </p> </form> {/if} {else} {if !$page.contenu} <p class="alert">Cette page est vide, cliquez sur « Éditer » pour la modifier.</p> {else} {if $page.contenu.chiffrement} <noscript> <div class="error"> |
︙ | ︙ |
Added www/admin/wiki/creer.php version [b3f3d59d79].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | <?php require_once __DIR__ . '/_inc.php'; $error = false; if (!empty($_POST['create'])) { if (!utils::CSRF_check('wiki_create')) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } else { try { $id = $wiki->create(array( 'titre' => utils::post('titre'), 'parent' => 0, )); utils::redirect('/admin/wiki/editer.php?id='.$id); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->display('admin/wiki/creer.tpl'); ?> |
Modified www/admin/wiki/editer.php from [c87f2dbcf6] to [1f2eae6d66].
︙ | ︙ | |||
22 23 24 25 26 27 28 | if (!empty($_POST['save'])) { if (!utils::CSRF_check('wiki_edit_'.$page['id'])) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } | < < < < | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | if (!empty($_POST['save'])) { if (!utils::CSRF_check('wiki_edit_'.$page['id'])) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } elseif ($page['date_modification'] > (int) utils::post('debut_edition')) { $error = 'La page a été modifiée par quelqu\'un d\'autre depuis que vous avez commencé l\'édition.'; } else { try { |
︙ | ︙ | |||
47 48 49 50 51 52 53 | $wiki->editRevision($page['id'], (int) utils::post('revision_edition'), array( 'contenu' => utils::post('contenu'), 'modification' => utils::post('modification'), 'id_auteur' => $user['id'], )); | > > | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | $wiki->editRevision($page['id'], (int) utils::post('revision_edition'), array( 'contenu' => utils::post('contenu'), 'modification' => utils::post('modification'), 'id_auteur' => $user['id'], )); $page = $wiki->getById($page['id']); utils::redirect('/admin/wiki/?'.$page['uri']); } catch (UserException $e) { $error = $e->getMessage(); } } } |
︙ | ︙ |
Modified www/admin/wiki/index.php from [561c34d75a] to [1e2237a2e4].
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php require_once __DIR__ . '/_inc.php'; if (!empty($_SERVER['QUERY_STRING'])) { $page = $wiki->getByURI($_SERVER['QUERY_STRING']); } else { $page = $wiki->getByURI($config->get('accueil_wiki')); } | > > > > | > > > > | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <?php require_once __DIR__ . '/_inc.php'; if (!empty($_SERVER['QUERY_STRING'])) { $page = $wiki->getByURI($_SERVER['QUERY_STRING']); } else { $page = $wiki->getByURI($config->get('accueil_wiki')); } if (!$page) { $tpl->assign('uri', $_SERVER['QUERY_STRING']); $tpl->assign('can_edit', $wiki->canWritePage(Garradin_Wiki::ECRITURE_NORMAL)); $tpl->assign('can_read', true); } else { $tpl->assign('can_read', $wiki->canReadPage($page['droit_lecture'])); $tpl->assign('can_edit', $wiki->canWritePage($page['droit_ecriture'])); } $tpl->assign('page', $page); $tpl->display('admin/wiki/page.tpl'); ?> |