Indefero

Indefero Commit Details


Date:2008-11-23 05:33:11 (16 years 29 days ago)
Author:Loic d'Anterroches
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:7c1ad62cdbdbf3ebbae55dccba8ab8f3e3d5a0bd
Parents: 048e2ba78316b2ec093437c7ca39b2e22aab0c4d
Message:Added the deletion of old revisions of the wiki pages.

Changes:

File differences

src/IDF/Views/Wiki.php
139139
140140
141141
142
142
143143
144144
145145
......
162162
163163
164164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
165205
166206
167207
if (isset($request->GET['rev']) and preg_match('/^[0-9]+$/', $request->GET['rev'])) {
$oldrev = Pluf_Shortcuts_GetObjectOr404('IDF_WikiRevision',
$request->GET['rev']);
if ($oldrev->wikipage != $page->id) {
if ($oldrev->wikipage != $page->id or $oldrev->is_head == true) {
throw new Pluf_HTTP_Error404($request);
}
}
}
/**
* Remove a revision of a page.
*/
public $deleteRev_precond = array('IDF_Precondition::accessWiki',
'IDF_Precondition::projectMemberOrOwner');
public function deleteRev($request, $match)
{
$prj = $request->project;
$oldrev = Pluf_Shortcuts_GetObjectOr404('IDF_WikiRevision', $match[2]);
$page = $oldrev->get_wikipage();
$prj->inOr404($page);
if ($oldrev->is_head == true) {
throw new Pluf_HTTP_Error404($request);
}
if ($request->method == 'POST') {
$oldrev->delete();
$request->user->setMessage(__('The old revision has been deleted.'));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
array($prj->shortname, $page->title));
return new Pluf_HTTP_Response_Redirect($url);
}
$title = sprintf(__('Delete Old Revision of %s'), $page->title);
$revision = $page->get_current_revision();
$db = $page->getDbConnection();
$false = Pluf_DB_BooleanToDb(false, $db);
$revs = $page->get_revisions_list(array('order' => 'creation_dtime DESC',
'filter' => 'is_head='.$false));
return Pluf_Shortcuts_RenderToResponse('idf/wiki/delete.html',
array(
'page_title' => $title,
'page' => $page,
'oldrev' => $oldrev,
'rev' => $revision,
'revs' => $revs,
'tags' => $page->get_tags_list(),
),
$request);
}
/**
* View a documentation page.
*/
public $update_precond = array('IDF_Precondition::accessWiki',
src/IDF/conf/urls.php
215215
216216
217217
218
219
220
221
222
223
218224
219225
220226
'model' => 'IDF_Views_Wiki',
'method' => 'update');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/doc/delrev/(\d+)/$#',
'base' => $base,
'priority' => 4,
'model' => 'IDF_Views_Wiki',
'method' => 'deleteRev');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/page/(.*)/$#',
'base' => $base,
'priority' => 4,
src/IDF/templates/idf/wiki/delete.html
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
{extends "idf/wiki/base.html"}
{block extraheader}{if $oldrev}<meta name="ROBOTS" content="NOINDEX" />{/if}{/block}
{block docclass}yui-t3{assign $inView=true}{/block}
{block body}
{assign $submitter = $oldrev.get_submitter()}{aurl 'url', 'IDF_Views_Wiki::view', array($project.shortname, $page.title)}
<div class="old-rev">
<p>{blocktrans}You are looking at an old revision (<em>{$oldrev.summary}</em>) of the page
<a href="{$url}">{$page.title}</a>. This revision was created
by {$submitter}.{/blocktrans}</p>
</div>
<p>{blocktrans}If you delete this old revision, it will be removed from the database and <strong>you will not be able to recover it</strong>.{/blocktrans}</p>
<form method="post" action=".">
<table class="form" summary="">
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="{trans 'Delete Revision'}" name="submit" /> | <a href="{url 'IDF_Views_Wiki::view', array($project.shortname, $page.title)}">{trans 'Cancel'}</a>
</td>
</tr>
</table>
</form>
<p class="desc">{$page.summary}</p>
{markdown $oldrev.content, $request}
{/block}
{block context}
{assign $submitter = $page.get_submitter()}
<p><strong>{trans 'Created:'}</strong> <span class="nobrk">{$page.creation_dtime|dateago}</span><br /><span class="nobrk">{blocktrans}by {$submitter}{/blocktrans}</span></p>
{if $rev.creation_dtime != $page.creation_dtime}<p>{assign $submitter = $rev.get_submitter()}
<strong>{trans 'Updated:'}</strong> <span class="nobrk">{$rev.creation_dtime|dateago}</span><br /><span class="nobrk">{blocktrans}by {$submitter}{/blocktrans}</span></p>{/if}
{if $tags.count()}
<p>
<strong>{trans 'Labels:'}</strong><br />
{foreach $tags as $tag}
<span class="label"><strong>{$tag.class}:</strong>{$tag.name}</span><br />
{/foreach}
</p>{/if}
{if $revs.count() > 0}
<p><strong>{trans 'Old Revisions'}</strong></p>
<ul>{foreach $revs as $old}
<li><a href="{url 'IDF_Views_Wiki::view', array($project.shortname, $page.title), array('rev'=>$old.id)}">{$old.summary}</a></li>
{/foreach}</ul>
{/if}
{/block}
src/IDF/templates/idf/wiki/view.html
1818
1919
2020
21
22
23
2124
2225
2326
{markdown $rev.content, $request}
{else}
{markdown $oldrev.content, $request}
{if $isOwner or $isAdmin}{aurl 'url', 'IDF_Views_Wiki::deleteRev', array($project.shortname, $oldrev.id)}
<p class="delp"><a href="{$url}" title="{trans 'Delete this revision'}"><img src="{media '/idf/img/trash.png'}" style="vertical-align: text-bottom;" alt="{trans 'Trash'}" /></a> <a href="{$url}">{trans 'Delete this revision'}</a></p>
{/if}
{/if}
{/block}
www/media/idf/css/style.css
598598
599599
600600
601
602
603
604
605
606
607
608
609
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.delp {
float: right;
position: relative;
}
.delp a {
color: #a00;
}

Archive Download the corresponding diff file

Page rendered in 0.08278s using 13 queries.