Indefero

Indefero Commit Details


Date:2011-12-06 01:38:40 (13 years 16 days ago)
Author:Thomas Keller
Branch:develop, release-1.3
Commit:0d410605f90c01d70f1a8f66bf5c22507801959a
Parents: 22dfab253babbd85e58b285749b78403fa597b96
Message:Implement deletion of resource revisions.

Changes:

File differences

src/IDF/Views/Wiki.php
430430
431431
432432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
433471
434472
435473
}
/**
* Remove a revision of a resource.
*/
public $deleteResourceRev_precond = array('IDF_Precondition::accessWiki',
'IDF_Precondition::projectMemberOrOwner');
public function deleteResourceRev($request, $match)
{
$prj = $request->project;
$oldrev = Pluf_Shortcuts_GetObjectOr404('IDF_Wiki_ResourceRevision', $match[2]);
$resource = $oldrev->get_wikiresource();
$prj->inOr404($resource);
if ($oldrev->is_head == true) {
return new Pluf_HTTP_Response_NotFound($request);
}
if ($request->method == 'POST') {
$oldrev->delete();
$request->user->setMessage(__('The old revision has been deleted.'));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::viewResource',
array($prj->shortname, $resource->title));
return new Pluf_HTTP_Response_Redirect($url);
}
$title = sprintf(__('Delete Old Revision of %s'), $resource->title);
$revision = $resource->get_current_revision();
$false = Pluf_DB_BooleanToDb(false, $resource->getDbConnection());
$revs = $resource->get_revisions_list(array('order' => 'creation_dtime DESC',
'filter' => 'is_head='.$false));
return Pluf_Shortcuts_RenderToResponse('idf/wiki/deleteResourceRev.html',
array(
'page_title' => $title,
'resource' => $resource,
'oldrev' => $oldrev,
'rev' => $revision,
'revs' => $revs,
),
$request);
}
/**
* Update a documentation page.
*/
public $updatePage_precond = array('IDF_Precondition::accessWiki',
src/IDF/templates/idf/wiki/deleteResourceRev.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
47
48
49
{extends "idf/wiki/base.html"}
{block extraheader}{if $oldrev}<meta name="ROBOTS" content="NOINDEX" />{/if}{/block}
{block docclass}yui-t3{assign $inResourceView=true}{/block}
{block body}
{assign $submitter = $oldrev.get_submitter()}{aurl 'url', 'IDF_Views_Wiki::viewResource', array($project.shortname, $resource.title)}
<div class="old-rev">
<p>{blocktrans}You are looking at an old revision (<em>{$oldrev.summary}</em>) of the resource
<a href="{$url}">{$resource.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::viewResource', array($project.shortname, $resource.title)}">{trans 'Cancel'}</a>
</td>
</tr>
</table>
</form>
<p class="desc">{$resource.summary}</p>
{assign $preview = $rev.renderRaw()}
{if $preview == ''}
{assign $preview = __('Unable to render preview for this MIME type.')}
{/if}
<p class="preview">{$preview|unsafe}</p>
<ul>
<li>{trans 'File size'}: {$rev.filesize|size}</li>
<li>{trans 'MIME type'}: {$resource.mime_type}</li>
<li><a href="{$rev.getRawURL(true)}">{trans 'Download this file'}</a></li>
</ul>
{/block}
{/block}
{block context}
{assign $submitter = $resource.get_submitter()}
<p><strong>{trans 'Created:'}</strong> <span class="nobrk">{$resource.creation_dtime|dateago}</span><br /><span class="nobrk">{blocktrans}by {$submitter}{/blocktrans}</span></p>
{if $rev.creation_dtime != $resource.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 $revs.count() > 0}
<p><strong>{trans 'Old Revisions'}</strong></p>
<ul>{foreach $revs as $old}
<li><a href="{url 'IDF_Views_Wiki::viewResource', array($project.shortname, $resource.title), array('rev'=>$old.id)}">{$old.summary}</a></li>
{/foreach}</ul>
{/if}
{/block}

Archive Download the corresponding diff file

Page rendered in 0.09540s using 13 queries.