Move the orig_file_ext field from resource to resourcerev where

it actually belongs.  Add an option to download a specific resource
revision as attachment in the view.  Fix a bug that occurred when
displaying an old revision of a resource.  Prepare for proper
deletion of the original file and the connected resource in case
a revision is deleted; mark any previous revision as head in this
case. Left-align the summary label in the resource list view.
This commit is contained in:
Thomas Keller
2011-12-01 00:30:50 +01:00
parent 58ccb93f2d
commit d6eb7532fd
7 changed files with 296 additions and 20 deletions

View File

@@ -0,0 +1,46 @@
{extends "idf/wiki/base.html"}
{block docclass}yui-t2{/block}
{block body}
{if $form.errors}
<div class="px-message-error">
<p>{trans 'The form contains some errors. Please correct them to update the page.'}</p>
{if $form.get_top_errors}
{$form.render_top_errors|unsafe}
{/if}
</div>
{/if}
<form method="post" enctype="multipart/form-data" action="." >
<table class="form" summary="">
<tr>
<th><strong>{$form.f.summary.labelTag}:</strong></th>
<td>{if $form.f.summary.errors}{$form.f.summary.fieldErrors}{/if}
{$form.f.summary|unsafe}<br />
<span class="helptext">{$form.f.summary.help_text}</span>
</td>
</tr>
<tr>
<th><strong>{$form.f.file.labelTag}:</strong></th>
<td>{if $form.f.file.errors}{$form.f.file.fieldErrors}{/if}
{$form.f.file|unsafe}
</td>
</tr>
<tr>
<th><strong>{$form.f.comment.labelTag}:</strong></th>
<td>{if $form.f.comment.errors}{$form.f.comment.fieldErrors}{/if}
{$form.f.comment|unsafe}<br />
<span class="helptext">{$form.f.comment.help_text}</span>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>{* float left is a fix for Firefox < 3.5 *}
<span style="float: left;"> <input type="submit" value="{trans 'Update Resource'}" name="submit" /> | <a href="{url 'IDF_Views_Wiki::viewResource', array($project.shortname, $resource.title)}">{trans 'Cancel'}</a></span>{if $isOwner or $isAdmin or $isMember}
{aurl 'url', 'IDF_Views_Wiki::deleteResource', array($project.shortname, $resource.id)}
<span class="dellink"><a href="{$url}" title="{trans 'Delete this resource'}"><img src="{media '/idf/img/trash.png'}" style="vertical-align: text-bottom;" alt="{trans 'Trash'}" /></a> <a href="{$url}" title="{trans 'Delete this resource'}">{trans 'Delete this resource'}</a></span>{/if}
</td>
</tr>
</table>
</form>
{/block}

View File

@@ -8,7 +8,7 @@
{block body}
{if !$rev.is_head}
{ashowuser 'submitter', $oldrev.get_submitter(), $request}{aurl 'url', 'IDF_Views_Wiki::viewResource', array($project.shortname, $resource.title)}
{ashowuser 'submitter', $rev.get_submitter(), $request}{aurl 'url', 'IDF_Views_Wiki::viewResource', array($project.shortname, $resource.title)}
<div class="old-rev">
<p>{blocktrans}You are looking at an old revision of the resource
<a href="{$url}">{$resource.title}</a>. This revision was created
@@ -21,9 +21,11 @@ by {$submitter}.{/blocktrans}</p>
<p class="preview">{$rev.render()|unsafe}</p>
{aurl 'url', 'IDF_Views_Wiki::rawResource', array($project.shortname, $rev.id), array('attachment' => 1)}
<ul>
<li>{trans 'File size'}: {$rev.filesize|size}</li>
<li>{trans 'MIME type'}: {$resource.mime_type}</li>
<li><a href="{$url}">{trans 'Download this file'}</a></li>
</ul>
{if ($isOwner or $isAdmin) and !$rev.is_head}{aurl 'url', 'IDF_Views_Wiki::deleteResourceRev', array($project.shortname, $rev.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>