Overview
Comment: | + Affichage du nom du dernier auteur de la page wiki + Barre d'actions sur le wiki + bouton "voir sur le site" pour les pages publiques + correction pour empêcher qu'une page soit parente d'elle-même (ça n'aurait pas de sens) + recherche de page |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d330e190f057b0ea59d4f6fa53c93aa7 |
User & Date: | bohwaz on 2012-05-20 23:51:24 |
Other Links: | manifest | tags |
Context
2012-05-21
| ||
00:41 | Page historique des révisions + déplacement des libs externes check-in: 58530c4937 user: bohwaz tags: trunk | |
2012-05-20
| ||
23:51 | + Affichage du nom du dernier auteur de la page wiki + Barre d'actions sur le wiki + bouton "voir sur le site" pour les pages publiques + correction pour empêcher qu'une page soit parente d'elle-même (ça n'aurait pas de sens) + recherche de page check-in: d330e190f0 user: bohwaz tags: trunk | |
05:16 | Correction contexte squelette inclus + Squelette rubrique check-in: 591e952d54 user: bohwaz tags: trunk | |
Changes
Modified include/class.membres.php from [550147db4f] to [76977706c5].
︙ | ︙ | |||
293 294 295 296 297 298 299 300 301 302 303 304 305 306 | $db = Garradin_DB::getInstance(); return $db->simpleQuerySingle('SELECT *, strftime(\'%s\', date_connexion) AS date_connexion, strftime(\'%s\', date_inscription) AS date_inscription, strftime(\'%s\', date_cotisation) AS date_cotisation FROM membres WHERE id = ? LIMIT 1;', true, (int)$id); } public function getDroits($id) { $db = Garradin_DB::getInstance(); $droits = $db->simpleQuerySingle('SELECT * FROM membres_categories WHERE id = ?;', true, (int)$id); foreach ($droits as $key=>$value) | > > > > > > | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | $db = Garradin_DB::getInstance(); return $db->simpleQuerySingle('SELECT *, strftime(\'%s\', date_connexion) AS date_connexion, strftime(\'%s\', date_inscription) AS date_inscription, strftime(\'%s\', date_cotisation) AS date_cotisation FROM membres WHERE id = ? LIMIT 1;', true, (int)$id); } public function getNom($id) { $db = Garradin_DB::getInstance(); return $db->simpleQuerySingle('SELECT nom FROM membres WHERE id = ? LIMIT 1;', false, (int)$id); } public function getDroits($id) { $db = Garradin_DB::getInstance(); $droits = $db->simpleQuerySingle('SELECT * FROM membres_categories WHERE id = ?;', true, (int)$id); foreach ($droits as $key=>$value) |
︙ | ︙ |
Modified include/class.squelette.php from [fff33f2d27] to [19b6b2147d].
︙ | ︙ | |||
359 360 361 362 363 364 365 366 367 368 369 370 371 372 | $skel = 'atom.xml'; } elseif (substr($uri, -1) == '/') { $skel = 'rubrique.html'; $_GET['uri'] = $_REQUEST['uri'] = substr($uri, 1, -1); } else { $skel = 'article.html'; $_GET['uri'] = $_REQUEST['uri'] = substr($uri, 1); } $this->display($skel); | > > > > | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | $skel = 'atom.xml'; } elseif (substr($uri, -1) == '/') { $skel = 'rubrique.html'; $_GET['uri'] = $_REQUEST['uri'] = substr($uri, 1, -1); } elseif (preg_match('!^/admin/!', $uri)) { throw new UserException('Cette page n\'existe pas.'); } else { $skel = 'article.html'; $_GET['uri'] = $_REQUEST['uri'] = substr($uri, 1); } $this->display($skel); |
︙ | ︙ |
Modified include/class.wiki.php from [1e7db5ed8e] to [7b3fe9e89e].
︙ | ︙ | |||
121 122 123 124 125 126 127 128 129 130 131 132 133 134 | } } if (isset($data['droit_lecture']) && $data['droit_lecture'] >= self::LECTURE_CATEGORIE) { $data['droit_ecriture'] = $data['droit_lecture']; } $data['date_modification'] = new SQLite3_Instruction('CURRENT_TIMESTAMP'); $db->simpleUpdate('wiki_pages', $data, 'id = '.(int)$id); return true; } | > > > > > | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | } } if (isset($data['droit_lecture']) && $data['droit_lecture'] >= self::LECTURE_CATEGORIE) { $data['droit_ecriture'] = $data['droit_lecture']; } if (isset($data['parent']) && (int)$data['parent'] == (int)$id) { $data['parent'] = 0; } $data['date_modification'] = new SQLite3_Instruction('CURRENT_TIMESTAMP'); $db->simpleUpdate('wiki_pages', $data, 'id = '.(int)$id); return true; } |
︙ | ︙ | |||
207 208 209 210 211 212 213 | return true; } public function search($query) { $db = Garradin_DB::getInstance(); | | > > > > > | | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | return true; } public function search($query) { $db = Garradin_DB::getInstance(); return $db->simpleStatementFetch('SELECT p.uri, r.*, snippet(wiki_recherche, "<b>", "</b>", "...", -1, -50) AS snippet, rank(matchinfo(wiki_recherche), 0, 1.0, 1.0) AS points FROM wiki_recherche AS r INNER JOIN wiki_pages AS p ON p.id = r.id WHERE '.$this->_getLectureClause('p.').' AND wiki_recherche MATCH \''.$db->escapeString($query).'\' ORDER BY points DESC LIMIT 0,50;'); } public function setRestrictionCategorie($id, $droit_wiki) { $this->restriction_categorie = $id; $this->restriction_droit = $droit_wiki; return true; } protected function _getLectureClause($prefix = '') { if (is_null($this->restriction_categorie)) { throw new UnexpectedValueException('setRestrictionCategorie doit être appelé auparavant.'); } if ($this->restriction_droit == Garradin_Membres::DROIT_AUCUN) { throw new UserException('Vous n\'avez pas accès au wiki.'); } if ($this->restriction_droit == Garradin_Membres::DROIT_ADMIN) return '1'; return '('.$prefix.'droit_lecture = '.self::LECTURE_NORMAL.' OR '.$prefix.'droit_lecture = '.self::LECTURE_PUBLIC.' OR '.$prefix.'droit_lecture = '.(int)$this->restriction_categorie.')'; } public function canReadPage($lecture) { if (is_null($this->restriction_categorie)) { throw new UnexpectedValueException('setRestrictionCategorie doit être appelé auparavant.'); |
︙ | ︙ |
Modified templates/admin/wiki/_chercher_parent.tpl from [c5aaaf835d] to [d632d8f3ff].
︙ | ︙ | |||
16 17 18 19 20 21 22 | { var elm = document.getElementsByClassName("current")[0].getElementsByTagName("a")[0]; if (match = elm.href.match(/=(\d+)$/)) { var id = parseInt(match[1], 10); var titre = (id == 0 ? 'la racine du site' : elm.innerHTML); | > | > | > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | { var elm = document.getElementsByClassName("current")[0].getElementsByTagName("a")[0]; if (match = elm.href.match(/=(\d+)$/)) { var id = parseInt(match[1], 10); var titre = (id == 0 ? 'la racine du site' : elm.innerHTML); if (window.opener.changeParent(id, titre)) { self.close(); } else { alert("Impossible de choisir la page comme parent d'elle-même !"); } return false; } }; }()); </script> {/literal} {include file="admin/_foot.tpl"} |
Added templates/admin/wiki/chercher.tpl version [1aaac63fec].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 35 36 | {include file="admin/_head.tpl" title="Recherche" current="wiki"} <ul class="actions"> <li><a href="{$www_url}admin/wiki/"><strong>Wiki</strong></a></li> <li class="current"><a href="{$www_url}admin/wiki/chercher.php">Rechercher</a></li> </ul> <form method="get" action="{$www_url}admin/wiki/chercher.php" class="wikiSearch"> <fieldset> <legend>Rechercher une page</legend> <p> <input type="text" name="q" value="{$recherche|escape}" size="25" /> <input type="submit" value="Chercher" /> </p> </fieldset> </form> {if !$recherche} <p class="alert"> Aucun terme recherché. </p> {else} <p class="alert"> {$nb_resultats|escape} pages trouvées pour « {$recherche|escape} » </p> <div class="wikiResults"> {foreach from=$resultats item="page"} <h3><a href="./?{$page.uri|escape}">{$page.titre|escape}</a></h3> <p>{$page.snippet|escape|clean_snippet}</p> {/foreach} </div> {/if} {include file="admin/_foot.tpl"} |
Modified templates/admin/wiki/editer.tpl from [96f441694b] to [0e36c69287].
|
| | | 1 2 3 4 5 6 7 8 | {include file="admin/_head.tpl" title="Éditer une page" current="wiki"} {if $error} <p class="error"> {$error|escape} </p> {/if} |
︙ | ︙ | |||
88 89 90 91 92 93 94 | <input type="hidden" name="revision_edition" value="{form_field name=revision_edition default=$page.revision}" /> <input type="hidden" name="debut_edition" value="{form_field name=debut_edition default=$time}" /> <input type="submit" name="save" value="Enregistrer →" /> </p> </form> | < > > | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | <input type="hidden" name="revision_edition" value="{form_field name=revision_edition default=$page.revision}" /> <input type="hidden" name="debut_edition" value="{form_field name=debut_edition default=$time}" /> <input type="submit" name="save" value="Enregistrer →" /> </p> </form> <script type="text/javascript"> var page_id = '{$page.id|escape}'; {literal} (function() { document.getElementById('f_droit_lecture_categorie').onchange = function() { document.getElementById('f_droit_ecriture_normal').checked = false; document.getElementById('f_droit_ecriture_normal').disabled = true; document.getElementById('f_droit_ecriture_categorie').checked = true; |
︙ | ︙ | |||
112 113 114 115 116 117 118 119 120 121 122 123 124 125 | document.getElementById('f_droit_lecture_public').onchange = function() { document.getElementById('f_droit_ecriture_normal').disabled = false; document.getElementById('f_droit_ecriture_categorie').disabled = false; }; window.changeParent = function(parent, title) { document.getElementById('f_parent').value = parent; document.getElementById('current_parent_name').innerHTML = title; return true; }; window.browseWikiForParent = function() { | > > > > > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | document.getElementById('f_droit_lecture_public').onchange = function() { document.getElementById('f_droit_ecriture_normal').disabled = false; document.getElementById('f_droit_ecriture_categorie').disabled = false; }; window.changeParent = function(parent, title) { if (parent == page_id) { return false; } document.getElementById('f_parent').value = parent; document.getElementById('current_parent_name').innerHTML = title; return true; }; window.browseWikiForParent = function() { |
︙ | ︙ |
Modified templates/admin/wiki/page.tpl from [3187831064] to [512190e9d6].
1 2 3 4 5 6 7 8 | {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> | > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | > | | | < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | > | < | < < < < < < | | | 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 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | {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} <ul class="actions"> <li><a href="{$www_url}admin/wiki/"><strong>Wiki</strong></a></li> <li><a href="{$www_url}admin/wiki/chercher.php">Rechercher</a></li> {if $can_edit} <li><a href="{$www_url}admin/wiki/editer.php?id={$page.id|escape}">Éditer</a></li> {/if} {if $can_read && $page && $page.contenu} <li><a href="{$www_url}wiki/revisions.php?id={$page.id|escape}">Historique</a> {if $page.droit_lecture == Garradin_Wiki::LECTURE_PUBLIC} <li><a href="{$www_url}{$page.uri|escape}">Voir sur le site</a> {/if} {/if} </ul> {if !$can_read} <p class="alert">Vous n'avez pas le droit de lire cette page.</p> {else} <div class="breadCrumbs"> <ul> <li><a href="./">Wiki</a></li> {if !empty($breadcrumbs)} {foreach from=$breadcrumbs item="crumb"} <li><a href="?{$crumb.uri|escape}">{$crumb.titre|escape}</a></li> {/foreach} {/if} </ul> </div> {if !$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 !empty($children)} <div class="wikiChildren"> <h4>Dans cette rubrique</h4> <ul> {foreach from=$children item="child"} <li><a href="?{$child.uri|escape}">{$child.titre|escape}</a></li> {/foreach} </ul> </div> {/if} {if $page.contenu.chiffrement} <noscript> <div class="error"> Vous dever activer javascript pour pouvoir déchiffrer cette page. </div> </noscript> <div class="wikiContent" id="wikiEncrypted"> <p>Cette page est chiffrée.</p> </div> {else} <div class="wikiContent"> {$page.contenu.contenu|format_wiki|liens_wiki:'?'} </div> {/if} <p class="wikiFooter"> Dernière modification le {$page.date_modification|date_fr:'d/m/Y à H:i'} {if $user.droits.wiki == Garradin_Membres::DROIT_ADMIN} par <a href="{$www_url}admin/membres/fiche.php?id={$page.contenu.id_auteur|escape}">{$auteur|escape}</a> {/if} </p> {/if} {/if} {/if} {include file="admin/_foot.tpl"} |
Added www/admin/wiki/chercher.php version [f2bf08b61b].
> > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?php require_once __DIR__ . '/_inc.php'; $q = trim(utils::get('q')); $tpl->assign('recherche', $q); if (utils::get('q')) { $r = $wiki->search($q); $tpl->assign('resultats', $r); $tpl->assign('nb_resultats', count($r)); } function tpl_clean_snippet($str) { return preg_replace('!<(/?b)>!', '<$1>', $str); } $tpl->register_modifier('clean_snippet', 'tpl_clean_snippet'); $tpl->display('admin/wiki/chercher.tpl'); ?> |
Modified www/admin/wiki/index.php from [e892dc39f7] to [6eccb277f5].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | } else { $tpl->assign('can_read', $wiki->canReadPage($page['droit_lecture'])); $tpl->assign('can_edit', $wiki->canWritePage($page['droit_ecriture'])); $tpl->assign('children', $wiki->getList($page['uri'] == $config->get('accueil_wiki') ? 0 : $page['id'])); $tpl->assign('breadcrumbs', $wiki->listBackBreadCrumbs($page['id'])); } $tpl->assign('page', $page); $tpl->display('admin/wiki/page.tpl'); ?> | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | } else { $tpl->assign('can_read', $wiki->canReadPage($page['droit_lecture'])); $tpl->assign('can_edit', $wiki->canWritePage($page['droit_ecriture'])); $tpl->assign('children', $wiki->getList($page['uri'] == $config->get('accueil_wiki') ? 0 : $page['id'])); $tpl->assign('breadcrumbs', $wiki->listBackBreadCrumbs($page['id'])); $tpl->assign('auteur', $membres->getNom($page['contenu']['id_auteur'])); } $tpl->assign('page', $page); $tpl->display('admin/wiki/page.tpl'); ?> |
Modified www/style/admin.css from [cf1beeea64] to [9d69f08da5].
︙ | ︙ | |||
444 445 446 447 448 449 450 | .wikiMain samp { background: #eee; padding: 0.2em 0.3em; } .wikiChildren { | | > | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | .wikiMain samp { background: #eee; padding: 0.2em 0.3em; } .wikiChildren { margin: 1em 0 1em 1em; border: .1em solid rgba(217, 134, 40, .5); padding: 1em; background: rgba(255, 255, 255, 0.5); float: right; clear: right; width: 25%; } .wikiChildren ul { color: #ccc; list-style-type: square; margin-left: 1em; |
︙ | ︙ | |||
491 492 493 494 495 496 497 | .wikiTree .choice { text-align: center; margin-bottom: 1em; } .breadCrumbs { | | > > | | > > > > > > > > > > > > > > > > > > > > > | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | .wikiTree .choice { text-align: center; margin-bottom: 1em; } .breadCrumbs { margin-bottom: .8em; font-size: .9em; color: #999; } .breadCrumbs ul, .breadCrumbs li { list-style-type: none; display: inline; } .breadCrumbs li:before { content: "> "; } .breadCrumbs li a { color: #333; } .wikiSearch { } .wikiSearch fieldset { padding: .3em; } .wikiSearch input[type=text] { padding: .3em; } .wikiResults h3 { font-weight: normal; margin-bottom: .3em; } .wikiResults p { margin-bottom: .8em; font-size: .9em; } |