Overview
Comment: | Add page delete |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
2f6ed7549ece349f4e468e8cdc9d6c50 |
User & Date: | bohwaz on 2020-12-18 21:18:15 |
Other Links: | branch diff | manifest | tags |
Context
2021-01-04
| ||
17:19 | Fix image migration check-in: aa2a94ea17 user: bohwaz tags: dev | |
2020-12-18
| ||
21:18 | Add page delete check-in: 2f6ed7549e user: bohwaz tags: dev | |
19:47 | Refactor parent category chooser check-in: b0536631ef user: bohwaz tags: dev | |
Changes
Added src/templates/web/delete.tpl version [4069827d96].
> > > > > > > > > | 1 2 3 4 5 6 7 8 9 | {include file="admin/_head.tpl" title=$title current="web"} {include file="common/delete_form.tpl" legend=$title warning="Êtes-vous sûr de vouloir supprimer « %s » ?"|args:$page.title alert=$alert } {include file="admin/_foot.tpl"} |
Modified src/templates/web/edit.tpl from [e5e7e46f08] to [7cd945f004].
1 2 3 4 5 6 7 8 9 10 | {include file="admin/_head.tpl" title="Édition : %s"|args:$page.title current="web"} {form_errors} <form method="post" action="{$self_url}" class="web-edit"> <fieldset class="wikiMain"> <legend>Informations générales</legend> <dl> {input type="text" name="title" source=$page required=true label="Titre"} | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | {include file="admin/_head.tpl" title="Édition : %s"|args:$page.title current="web"} {form_errors} {if $diff} <pre>{$diff}</pre> {/if} <form method="post" action="{$self_url}" class="web-edit"> <fieldset class="wikiMain"> <legend>Informations générales</legend> <dl> {input type="text" name="title" source=$page required=true label="Titre"} |
︙ | ︙ |
Modified src/www/admin/web/delete.php from [cc76953c4e] to [12541ce824].
1 2 3 | <?php namespace Garradin; | | | < | | | < | | | | < | < | | < < < < < < | | > | | 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 namespace Garradin; use Garradin\Web; use Garradin\Entities\Web\Page; require_once __DIR__ . '/_inc.php'; $page = Web::get((int) qg('id')); if (!$page) { throw new UserException('Page inconnue'); } $csrf_key = 'web_delete_' . $page->id(); $form->runIf('delete', function () use ($page) { $page->delete(); }, $csrf_key, ADMIN_URL . 'web/?parent=' . $page->parent_id); $tpl->assign(compact('page', 'csrf_key')); $tpl->assign('title', $page->type == Page::TYPE_CATEGORY ? 'Supprimer une catégorie' : 'Supprimer une page'); $tpl->assign('alert', $page->type == Page::TYPE_CATEGORY ? 'Attention ceci supprimera toutes les sous-catégories, pages et fichiers dans cette catégorie.' : 'Attention ceci supprimera tous les fichiers liés dans cette page.'); $tpl->display('web/delete.tpl'); |
Modified src/www/admin/web/edit.php from [d4922fd71d] to [eaf5132a2c].
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php namespace Garradin; use Garradin\Web; use Garradin\Entities\Web\Page; require_once __DIR__ . '/_inc.php'; $id = (int) qg('id'); $page = Web::get($id); if (!$page) { | > | > | > > > > > > > | | | | 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 | <?php namespace Garradin; use Garradin\Web; use Garradin\Entities\Web\Page; use KD2\SimpleDiff; require_once __DIR__ . '/_inc.php'; $id = (int) qg('id'); $page = Web::get($id); if (!$page) { throw new UserException('Page inconnue'); } $csrf_key = 'edit_' . $page->id(); $editing_started = f('editing_started') ?: date('Y-m-d H:i:s'); $diff = null; if (f('cancel')) { Utils::redirect(ADMIN_URL . 'web/?parent=' . $page->parent_id); } $form->runIf('save', function () use ($page, $editing_started, &$diff) { $editing_started = new \DateTime($editing_started); if ($editing_started < $page->modified) { $diff = SimpleDiff::diff($page->raw(), f('content')); throw new UserException('La page a été modifiée par quelqu\'un d\'autre.'); } $page->importForm(); $page->save(); }, $csrf_key, Utils::getSelfURI() . '#saved'); $parent = $page->parent_id ? [$page->parent_id => Web::get($page->parent_id)->title] : null; $encrypted = f('encrypted') || $page->file()->type == Page::FILE_TYPE_ENCRYPTED; $tpl->assign(compact('page', 'parent', 'editing_started', 'encrypted', 'csrf_key', 'diff')); $tpl->assign('custom_js', ['wiki_editor.js', 'wiki-encryption.js']); $tpl->assign('custom_css', ['wiki.css', 'scripts/wiki_editor.css']); $tpl->display('web/edit.tpl'); |