Start with the archive upload functionality (sponsored by Scilab);

add a new view and plain form to upload an archive; rename the internal
URLs, handlers and templates from submit to create for single downloads
and also add a help section about the new format as well as a detailed
FAQ entry. Archive files get a bigger upload limit (default: 20MB).

Next up: archive uploading, validation and processing.
This commit is contained in:
Thomas Keller
2011-11-02 00:15:33 +01:00
parent 34fbf6ec5f
commit c71ed2cecb
11 changed files with 404 additions and 10 deletions

View File

@@ -2,6 +2,10 @@
{block tabdownloads} class="active"{/block}
{block subtabs}
<div id="sub-tabs">
<a {if $inDownloads}class="active" {/if}href="{url 'IDF_Views_Download::index', array($project.shortname)}">{trans 'Downloads'}</a> {if $isOwner or $isMember}| <a {if $inSubmit}class="active" {/if}href="{url 'IDF_Views_Download::submit', array($project.shortname)}">{trans 'New Download'}</a> {/if}
<a {if $inDownloads}class="active" {/if}href="{url 'IDF_Views_Download::index', array($project.shortname)}">{trans 'Downloads'}</a>
{if $isOwner or $isMember}
| <a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Download::create', array($project.shortname)}">{trans 'New Download'}</a>
| <a {if $inCreateFromArchive}class="active" {/if}href="{url 'IDF_Views_Download::createFromArchive', array($project.shortname)}">{trans 'Upload Archive'}</a>
{/if}
</div>
{/block}

View File

@@ -1,5 +1,5 @@
{extends "idf/downloads/base.html"}
{block docclass}yui-t3{assign $inSubmit=true}{/block}
{block docclass}yui-t3{assign $inCreate=true}{/block}
{block body}
{if $form.errors}
<div class="px-message-error">

View File

@@ -0,0 +1,38 @@
{extends "idf/downloads/base.html"}
{block docclass}yui-t3{assign $inCreateFromArchive=true}{/block}
{block body}
{if $form.errors}
<div class="px-message-error">
<p>{trans 'The form contains some errors. Please correct them to submit the archive.'}</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.archive.labelTag}:</strong></th>
<td>{if $form.f.archive.errors}{$form.f.archive.fieldErrors}{/if}
{$form.f.archive|unsafe}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="{trans 'Submit Archive'}" name="submit" /> | <a href="{url 'IDF_Views_Download::index', array($project.shortname)}">{trans 'Cancel'}</a>
</td>
</tr>
</table>
</form>
{/block}
{block context}
<div class="issue-submit-info">
<h2>{trans 'Instructions'}</h2>
<p>{blocktrans}The archive must include a <code>manifest.xml</code> file with meta information about the
files to process inside the archive. All processed files must be unique or replace existing files explicitely.{/blocktrans}</p>
{aurl 'url', 'IDF_Views::faqArchiveFormat'}
<p>{blocktrans}You can learn more about the archive format <a href="{$url}">here</a>.{/blocktrans}</p>
</div>
{/block}

View File

@@ -3,7 +3,7 @@
{block body}
{$downloads.render}
{if $isOwner or $isMember}
{aurl 'url', 'IDF_Views_Download::submit', array($project.shortname)}
{aurl 'url', 'IDF_Views_Download::create', array($project.shortname)}
<p><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/add.png'}" alt="+" align="bottom" /></a> <a href="{$url}">{trans 'New Download'}</a></p>{/if}
{/block}

View File

@@ -0,0 +1,100 @@
{extends "idf/base-simple.html"}
{block docclass}yui-t3{/block}
{block body}
<p>At the moment, this documentation is only available in English.</p>
<ul>
<li><a href="#q-motivation">Motivation</a></li>
<li><a href="#q-manifest">The manifest format</a></li>
</ul>
<h2 id="q-motivation">Motivation</h2>
<p>
Adding multiple, individual downloads to a project for a release can be a tedious task if
one has to select each file manually, and then has to fill in the summary and correct labels
for each of these downloads individually.
</p>
<p>
InDefero therefor supports the upload of "archives" that contain multiple downloadable
files. These archives are standard PKZIP files with only one special property - they
contain an additional manifest file which describes the files that should be published.
</p>
<p>
Once such an archive has been uploaded and validated by InDefero, its files are extracted
and individual downloads are created for each of them. If the archive contains files
that should deprecate existing downloads, then InDefero takes care of this as well -
automatically.
</p>
<p>
An archive file and its manifest file can easily be compiled, either by hand with the help
of a text editor, or through an automated build system with the help of your build tool of
choice, such as Apache Ant.
</p>
<h2 id="q-manifest">The manifest format</h2>
<p>
The manifest is an XML file that follows a simple syntax. As it is always easier to look
at an example, here you have one:
</p>
<pre>
&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;manifest>
&lt;file>
&lt;name>foo-1.2.tar.gz&lt;/name>
&lt;summary>Tarball&lt;/summary>
&lt;replaces>foo-1.1.tar.gz&lt;/replaces>
&lt;tags>
&lt;tag>Type:Archive&lt;/tag>
&lt;/tags>
&lt;/file>
&lt;file>
&lt;name>foo-1.2-installer.exe&lt;/name>
&lt;summary>Windows MSI Installer&lt;/summary>
&lt;description>This installer needs Windows XP SP2 or later.&lt;/description>
&lt;tags>
&lt;tag>Type:Installer&lt;/tag>
&lt;tag>OpSys:Windows&lt;/tag>
&lt;/tags>
&lt;/file>
&lt;/manifest>
</pre>
<p>
This is the DTD for the format:
</p>
<pre>
&lt;!DOCTYPE manifest [
&lt;!ELEMENT manifest (file+)>
&lt;!ELEMENT file (name,summary,replaces?,description?,tags?)>
&lt;!ELEMENT name (#PCDATA)>
&lt;!ELEMENT summary (#PCDATA)>
&lt;!ELEMENT replaces (#PCDATA)>
&lt;!ELEMENT description (#PCDATA)>
&lt;!ELEMENT tags (tag+)>
&lt;!ELEMENT tag (#PCDATA)>
]>
</pre>
<p>
The format is more or less self-explaining, all fields map to properties of a single download.
One special element has been introduced though, <code>replaces</code>. If this optional element
is given, InDefero looks for a file with that name in the project and deprecates it by attaching
the label <code>Other:Deprecated</code> to it. If no such file is found, the element is simply
ignored.
</p>
{/block}
{block context}
<p>{trans 'Here we are, just to help you.'}</p>
<h2>{trans 'Projects'}</h2>
<ul>{foreach $projects as $p}
<li><a href="{url 'IDF_Views_Project::home', array($p.shortname)}">{$p}</a></li>
{/foreach}</ul>
{/block}

View File

@@ -5,6 +5,7 @@
<li><a href="#q-keyboard">{trans 'What are the keyboard shortcuts?'}</a></li>
<li><a href="#q-duplicate">{trans 'How to mark an issue as duplicate?'}</a></li>
<li><a href="#q-mugshot">{trans 'How can I display my head next to my comments?'}</a></li>
<li><a href="#q-archive-format">{trans 'What is this "Upload Archive" functionality about?'}</a></li>
<li><a href="#q-api">{trans 'What is the API and how is it used?'}</a></li>
</ul>
@@ -48,11 +49,27 @@
<p>{blocktrans}You need to create an account on <a href="http://en.gravatar.com/">Gravatar</a>, this takes about 5 minutes and is free.{/blocktrans}</p>
<h2 id="q-archive-format">{trans 'What is this "Upload Archive" functionality about?'}</h2>
{blocktrans}<p>If you have to publish many files at once for a new release, it is a very tedious task
to upload them one after another and enter meta information like a summary, a description or additional
labels for each of them.</p>
<p>InDefero therefor supports a special archive format that is basically a standard zip file which comes with
some meta information. These meta information are kept in a special manifest file, which is distinctly kept from
the rest of the files in the archive that should be published.</p>
<p>Once this archive has been uploaded, InDefero reads in the meta information, unpacks the other files from
the archive and creates new individual downloads for each of them.</p>{/blocktrans}
{aurl 'url', 'IDF_Views::faqArchiveFormat'}
<p>{blocktrans}<a href="{$url}">Learn more about the archive format</a>.{/blocktrans}</p>
<h2 id="q-api">{trans 'What is the API and how is it used?'}</h2>
<p>{blocktrans}The API (Application Programming Interface) is used to interact with InDefero with another program. For example, this can be used to create a desktop program to submit new tickets easily.{/blocktrans}</p>{aurl 'url', 'IDF_Views::faqApi'}
<p>{blocktrans}The API (Application Programming Interface) is used to interact with InDefero with another program. For example, this can be used to create a desktop program to submit new tickets easily.{/blocktrans}</p>
{aurl 'url', 'IDF_Views::faqApi'}
<p>{blocktrans}<a href="{$url}">Learn more about the API</a>.{/blocktrans}</p>
{/block}
{block context}
<p>{trans 'Here we are, just to help you.'}</p>