Added a nice warning if the user tries to download a deprecated file.

This commit is contained in:
Loic d'Anterroches 2008-08-06 22:30:44 +02:00
parent a8699db268
commit 19ca5ef02f
4 changed files with 57 additions and 11 deletions

View File

@ -42,8 +42,6 @@ class IDF_Views_Download
{ {
$prj = $request->project; $prj = $request->project;
$title = sprintf(__('%s Downloads'), (string) $prj); $title = sprintf(__('%s Downloads'), (string) $prj);
$tags = self::getDownloadTags($prj);
$dtag = array_pop($tags); // The last tag is the deprecated tag.
// Paginator to paginate the files to download. // Paginator to paginate the files to download.
$pag = new Pluf_Paginator(new IDF_Upload()); $pag = new Pluf_Paginator(new IDF_Upload());
$pag->class = 'recent-issues'; $pag->class = 'recent-issues';
@ -84,6 +82,10 @@ class IDF_Views_Download
$prj->inOr404($upload); $prj->inOr404($upload);
$title = sprintf(__('Download %s'), $upload->summary); $title = sprintf(__('Download %s'), $upload->summary);
$form = false; $form = false;
$ptags = self::getDownloadTags($prj);
$dtag = array_pop($ptags); // The last tag is the deprecated tag.
$tags = $upload->get_tags_list();
$deprecated = Pluf_Model_InArray($dtag, $tags);
if ($request->method == 'POST' and if ($request->method == 'POST' and
true === IDF_Precondition::projectMemberOrOwner($request)) { true === IDF_Precondition::projectMemberOrOwner($request)) {
@ -109,6 +111,8 @@ class IDF_Views_Download
return Pluf_Shortcuts_RenderToResponse('downloads/view.html', return Pluf_Shortcuts_RenderToResponse('downloads/view.html',
array( array(
'file' => $upload, 'file' => $upload,
'deprecated' => $deprecated,
'tags' => $tags,
'auto_labels' => self::autoCompleteArrays($prj), 'auto_labels' => self::autoCompleteArrays($prj),
'page_title' => $title, 'page_title' => $title,
'form' => $form, 'form' => $form,

View File

@ -2,8 +2,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: InDefero\n" "Project-Id-Version: InDefero\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-08-06 21:49+0200\n" "POT-Creation-Date: 2008-08-06 22:28+0200\n"
"PO-Revision-Date: 2008-08-06 21:51+0100\n" "PO-Revision-Date: 2008-08-06 22:30+0100\n"
"Last-Translator: Loïc d'Anterroches <titoo@users.sourceforge.net>\n" "Last-Translator: Loïc d'Anterroches <titoo@users.sourceforge.net>\n"
"Language-Team: Translation team <titoo@users.sourceforge.net>\n" "Language-Team: Translation team <titoo@users.sourceforge.net>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -236,6 +236,7 @@ msgstr "Ce tableau présente la liste des fichiers en téléchargement."
#: IDF/Form/Upload.php:49 #: IDF/Form/Upload.php:49
#: IDF/Views/Download.php:56 #: IDF/Views/Download.php:56
#: IDF/Views/Download.php:212 #: IDF/Views/Download.php:212
#: IDF/Views/Download.php:218
msgid "File" msgid "File"
msgstr "Fichier" msgstr "Fichier"
@ -250,6 +251,7 @@ msgstr "Fichier"
#: IDF/Form/IssueUpdate.php:45 #: IDF/Form/IssueUpdate.php:45
#: IDF/Views/Download.php:57 #: IDF/Views/Download.php:57
#: IDF/Views/Download.php:213 #: IDF/Views/Download.php:213
#: IDF/Views/Download.php:219
msgid "Summary" msgid "Summary"
msgstr "Résumé" msgstr "Résumé"
@ -257,18 +259,21 @@ msgstr "Résumé"
#: IDF/gettexttemplates/source/tree.html.php:9 #: IDF/gettexttemplates/source/tree.html.php:9
#: IDF/Views/Download.php:58 #: IDF/Views/Download.php:58
#: IDF/Views/Download.php:214 #: IDF/Views/Download.php:214
#: IDF/Views/Download.php:220
msgid "Size" msgid "Size"
msgstr "Taille" msgstr "Taille"
#: IDF/Views/Download.php:57 #: IDF/Views/Download.php:57
#: IDF/Views/Download.php:59 #: IDF/Views/Download.php:59
#: IDF/Views/Download.php:215 #: IDF/Views/Download.php:215
#: IDF/Views/Download.php:221
msgid "Uploaded" msgid "Uploaded"
msgstr "Mis en ligne" msgstr "Mis en ligne"
#: IDF/Views/Download.php:61 #: IDF/Views/Download.php:61
#: IDF/Views/Download.php:63 #: IDF/Views/Download.php:63
#: IDF/Views/Download.php:219 #: IDF/Views/Download.php:219
#: IDF/Views/Download.php:225
msgid "No downloads were found." msgid "No downloads were found."
msgstr "Aucun fichier n'a été trouvé." msgstr "Aucun fichier n'a été trouvé."
@ -280,6 +285,7 @@ msgstr "Télécharger %s"
#: IDF/Views/Download.php:94 #: IDF/Views/Download.php:94
#: IDF/Views/Download.php:96 #: IDF/Views/Download.php:96
#: IDF/Views/Download.php:100
#, php-format #, php-format
msgid "The file <a href=\"%1$s\">%2$s</a> has been updated." msgid "The file <a href=\"%1$s\">%2$s</a> has been updated."
msgstr "Le fichier <a href=\"%1$s\">%2$s</a> a été mis à jour." msgstr "Le fichier <a href=\"%1$s\">%2$s</a> a été mis à jour."
@ -288,11 +294,13 @@ msgstr "Le fichier <a href=\"%1$s\">%2$s</a> a été mis à jour."
#: IDF/gettexttemplates/downloads/base.html.php:4 #: IDF/gettexttemplates/downloads/base.html.php:4
#: IDF/gettexttemplates/downloads/index.html.php:3 #: IDF/gettexttemplates/downloads/index.html.php:3
#: IDF/Views/Download.php:137 #: IDF/Views/Download.php:137
#: IDF/Views/Download.php:143
msgid "New Download" msgid "New Download"
msgstr "Nouveau téléchargement" msgstr "Nouveau téléchargement"
#: IDF/Views/Download.php:144 #: IDF/Views/Download.php:144
#: IDF/Views/Download.php:146 #: IDF/Views/Download.php:146
#: IDF/Views/Download.php:152
#, php-format #, php-format
msgid "The <a href=\"%s\">file</a> has been uploaded." msgid "The <a href=\"%s\">file</a> has been uploaded."
msgstr "Le <a href=\"%s\">fichier</a> a été mis en ligne." msgstr "Le <a href=\"%s\">fichier</a> a été mis en ligne."
@ -440,15 +448,18 @@ msgstr "Administrer"
#: IDF/gettexttemplates/downloads/view.html.php:3 #: IDF/gettexttemplates/downloads/view.html.php:3
#: IDF/gettexttemplates/issues/view.html.php:6 #: IDF/gettexttemplates/issues/view.html.php:6
#: IDF/gettexttemplates/downloads/view.html.php:4
#, php-format #, php-format
msgid "by %%submitter%%" msgid "by %%submitter%%"
msgstr "par %%submitter%%" msgstr "par %%submitter%%"
#: IDF/gettexttemplates/downloads/view.html.php:4 #: IDF/gettexttemplates/downloads/view.html.php:4
#: IDF/gettexttemplates/downloads/view.html.php:5
msgid "The form contains some errors. Please correct them to update the file." msgid "The form contains some errors. Please correct them to update the file."
msgstr "Le formulaire contient des erreurs. Merci de les corriger pour mettre en ligne le fichier." msgstr "Le formulaire contient des erreurs. Merci de les corriger pour mettre en ligne le fichier."
#: IDF/gettexttemplates/downloads/view.html.php:5 #: IDF/gettexttemplates/downloads/view.html.php:5
#: IDF/gettexttemplates/downloads/view.html.php:6
msgid "Update File" msgid "Update File"
msgstr "Mettre à jour le fichier" msgstr "Mettre à jour le fichier"
@ -459,25 +470,30 @@ msgstr "Mettre à jour le fichier"
#: IDF/gettexttemplates/register/index.html.php:7 #: IDF/gettexttemplates/register/index.html.php:7
#: IDF/gettexttemplates/issues/view.html.php:14 #: IDF/gettexttemplates/issues/view.html.php:14
#: IDF/gettexttemplates/issues/create.html.php:12 #: IDF/gettexttemplates/issues/create.html.php:12
#: IDF/gettexttemplates/downloads/view.html.php:7
msgid "Cancel" msgid "Cancel"
msgstr "Annuler" msgstr "Annuler"
#: IDF/gettexttemplates/downloads/view.html.php:7 #: IDF/gettexttemplates/downloads/view.html.php:7
#: IDF/gettexttemplates/downloads/view.html.php:8
msgid "Uploaded:" msgid "Uploaded:"
msgstr "Mis en ligne :" msgstr "Mis en ligne :"
#: IDF/gettexttemplates/downloads/view.html.php:8 #: IDF/gettexttemplates/downloads/view.html.php:8
#: IDF/gettexttemplates/issues/view.html.php:16 #: IDF/gettexttemplates/issues/view.html.php:16
#: IDF/gettexttemplates/downloads/view.html.php:9
msgid "Updated:" msgid "Updated:"
msgstr "Mis à jour :" msgstr "Mis à jour :"
#: IDF/gettexttemplates/downloads/view.html.php:9 #: IDF/gettexttemplates/downloads/view.html.php:9
#: IDF/gettexttemplates/downloads/view.html.php:10
msgid "Downloads:" msgid "Downloads:"
msgstr "Téléchargements :" msgstr "Téléchargements :"
#: IDF/gettexttemplates/downloads/view.html.php:10 #: IDF/gettexttemplates/downloads/view.html.php:10
#: IDF/gettexttemplates/issues/view.html.php:11 #: IDF/gettexttemplates/issues/view.html.php:11
#: IDF/gettexttemplates/issues/view.html.php:20 #: IDF/gettexttemplates/issues/view.html.php:20
#: IDF/gettexttemplates/downloads/view.html.php:11
msgid "Labels:" msgid "Labels:"
msgstr "Étiquettes :" msgstr "Étiquettes :"
@ -1227,12 +1243,18 @@ msgid "%s Commit Details - %s"
msgstr "Détails d'un commit de %s - %s" msgstr "Détails d'un commit de %s - %s"
#: IDF/Views/Download.php:199 #: IDF/Views/Download.php:199
#: IDF/Views/Download.php:205
#, php-format #, php-format
msgid "%1$s Downloads with Label %2$s" msgid "%1$s Downloads with Label %2$s"
msgstr "Téléchargements avec l'étiquette %2$s de %1$s" msgstr "Téléchargements avec l'étiquette %2$s de %1$s"
#: IDF/Views/Download.php:207 #: IDF/Views/Download.php:207
#: IDF/Views/Download.php:213
#, php-format #, php-format
msgid "This table shows the downloads with label %s." msgid "This table shows the downloads with label %s."
msgstr "Ce tableau montre les téléchargements avec l'étiquette %s." msgstr "Ce tableau montre les téléchargements avec l'étiquette %s."
#: IDF/gettexttemplates/downloads/view.html.php:3
msgid "<strong>Attention!</strong> This file is marked as deprecated, download it only if you are sure you need this specific version."
msgstr "<strong>Attention !</strong> Ce fichier est marqué comme obsolète, téléchargez ce fichier uniquement si vous avez besoin de cette version."

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-08-06 21:49+0200\n" "POT-Creation-Date: 2008-08-06 22:28+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -223,6 +223,7 @@ msgstr ""
#: IDF/Views/Download.php:54 IDF/gettexttemplates/source/tree.html.php:6 #: IDF/Views/Download.php:54 IDF/gettexttemplates/source/tree.html.php:6
#: IDF/Form/Upload.php:49 IDF/Views/Download.php:56 IDF/Views/Download.php:212 #: IDF/Form/Upload.php:49 IDF/Views/Download.php:56 IDF/Views/Download.php:212
#: IDF/Views/Download.php:218
msgid "File" msgid "File"
msgstr "" msgstr ""
@ -230,22 +231,23 @@ msgstr ""
#: IDF/Views/Issue.php:228 IDF/Views/Issue.php:281 IDF/Form/Upload.php:40 #: IDF/Views/Issue.php:228 IDF/Views/Issue.php:281 IDF/Form/Upload.php:40
#: IDF/Form/IssueCreate.php:50 IDF/Form/UpdateUpload.php:42 #: IDF/Form/IssueCreate.php:50 IDF/Form/UpdateUpload.php:42
#: IDF/Form/IssueUpdate.php:45 IDF/Views/Download.php:57 #: IDF/Form/IssueUpdate.php:45 IDF/Views/Download.php:57
#: IDF/Views/Download.php:213 #: IDF/Views/Download.php:213 IDF/Views/Download.php:219
msgid "Summary" msgid "Summary"
msgstr "" msgstr ""
#: IDF/Views/Download.php:56 IDF/gettexttemplates/source/tree.html.php:9 #: IDF/Views/Download.php:56 IDF/gettexttemplates/source/tree.html.php:9
#: IDF/Views/Download.php:58 IDF/Views/Download.php:214 #: IDF/Views/Download.php:58 IDF/Views/Download.php:214
#: IDF/Views/Download.php:220
msgid "Size" msgid "Size"
msgstr "" msgstr ""
#: IDF/Views/Download.php:57 IDF/Views/Download.php:59 #: IDF/Views/Download.php:57 IDF/Views/Download.php:59
#: IDF/Views/Download.php:215 #: IDF/Views/Download.php:215 IDF/Views/Download.php:221
msgid "Uploaded" msgid "Uploaded"
msgstr "" msgstr ""
#: IDF/Views/Download.php:61 IDF/Views/Download.php:63 #: IDF/Views/Download.php:61 IDF/Views/Download.php:63
#: IDF/Views/Download.php:219 #: IDF/Views/Download.php:219 IDF/Views/Download.php:225
msgid "No downloads were found." msgid "No downloads were found."
msgstr "" msgstr ""
@ -255,16 +257,19 @@ msgid "Download %s"
msgstr "" msgstr ""
#: IDF/Views/Download.php:94 IDF/Views/Download.php:96 #: IDF/Views/Download.php:94 IDF/Views/Download.php:96
#: IDF/Views/Download.php:100
#, php-format #, php-format
msgid "The file <a href=\"%1$s\">%2$s</a> has been updated." msgid "The file <a href=\"%1$s\">%2$s</a> has been updated."
msgstr "" msgstr ""
#: IDF/Views/Download.php:135 IDF/gettexttemplates/downloads/base.html.php:4 #: IDF/Views/Download.php:135 IDF/gettexttemplates/downloads/base.html.php:4
#: IDF/gettexttemplates/downloads/index.html.php:3 IDF/Views/Download.php:137 #: IDF/gettexttemplates/downloads/index.html.php:3 IDF/Views/Download.php:137
#: IDF/Views/Download.php:143
msgid "New Download" msgid "New Download"
msgstr "" msgstr ""
#: IDF/Views/Download.php:144 IDF/Views/Download.php:146 #: IDF/Views/Download.php:144 IDF/Views/Download.php:146
#: IDF/Views/Download.php:152
#, php-format #, php-format
msgid "The <a href=\"%s\">file</a> has been uploaded." msgid "The <a href=\"%s\">file</a> has been uploaded."
msgstr "" msgstr ""
@ -404,15 +409,18 @@ msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:3 #: IDF/gettexttemplates/downloads/view.html.php:3
#: IDF/gettexttemplates/issues/view.html.php:6 #: IDF/gettexttemplates/issues/view.html.php:6
#: IDF/gettexttemplates/downloads/view.html.php:4
#, php-format #, php-format
msgid "by %%submitter%%" msgid "by %%submitter%%"
msgstr "" msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:4 #: IDF/gettexttemplates/downloads/view.html.php:4
#: IDF/gettexttemplates/downloads/view.html.php:5
msgid "The form contains some errors. Please correct them to update the file." msgid "The form contains some errors. Please correct them to update the file."
msgstr "" msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:5 #: IDF/gettexttemplates/downloads/view.html.php:5
#: IDF/gettexttemplates/downloads/view.html.php:6
msgid "Update File" msgid "Update File"
msgstr "" msgstr ""
@ -423,25 +431,30 @@ msgstr ""
#: IDF/gettexttemplates/register/index.html.php:7 #: IDF/gettexttemplates/register/index.html.php:7
#: IDF/gettexttemplates/issues/view.html.php:14 #: IDF/gettexttemplates/issues/view.html.php:14
#: IDF/gettexttemplates/issues/create.html.php:12 #: IDF/gettexttemplates/issues/create.html.php:12
#: IDF/gettexttemplates/downloads/view.html.php:7
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:7 #: IDF/gettexttemplates/downloads/view.html.php:7
#: IDF/gettexttemplates/downloads/view.html.php:8
msgid "Uploaded:" msgid "Uploaded:"
msgstr "" msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:8 #: IDF/gettexttemplates/downloads/view.html.php:8
#: IDF/gettexttemplates/issues/view.html.php:16 #: IDF/gettexttemplates/issues/view.html.php:16
#: IDF/gettexttemplates/downloads/view.html.php:9
msgid "Updated:" msgid "Updated:"
msgstr "" msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:9 #: IDF/gettexttemplates/downloads/view.html.php:9
#: IDF/gettexttemplates/downloads/view.html.php:10
msgid "Downloads:" msgid "Downloads:"
msgstr "" msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:10 #: IDF/gettexttemplates/downloads/view.html.php:10
#: IDF/gettexttemplates/issues/view.html.php:11 #: IDF/gettexttemplates/issues/view.html.php:11
#: IDF/gettexttemplates/issues/view.html.php:20 #: IDF/gettexttemplates/issues/view.html.php:20
#: IDF/gettexttemplates/downloads/view.html.php:11
msgid "Labels:" msgid "Labels:"
msgstr "" msgstr ""
@ -1158,12 +1171,18 @@ msgstr ""
msgid "%s Commit Details - %s" msgid "%s Commit Details - %s"
msgstr "" msgstr ""
#: IDF/Views/Download.php:199 #: IDF/Views/Download.php:199 IDF/Views/Download.php:205
#, php-format #, php-format
msgid "%1$s Downloads with Label %2$s" msgid "%1$s Downloads with Label %2$s"
msgstr "" msgstr ""
#: IDF/Views/Download.php:207 #: IDF/Views/Download.php:207 IDF/Views/Download.php:213
#, php-format #, php-format
msgid "This table shows the downloads with label %s." msgid "This table shows the downloads with label %s."
msgstr "" msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:3
msgid ""
"<strong>Attention!</strong> This file is marked as deprecated, download it "
"only if you are sure you need this specific version."
msgstr ""

View File

@ -3,6 +3,7 @@
{block body} {block body}
<div class="download-file"> <div class="download-file">
{if $deprecated}<p class="smaller">{blocktrans}<strong>Attention!</strong> This file is marked as deprecated, download it only if you are sure you need this specific version.{/blocktrans}</p>{/if}
<a href="{url 'IDF_Views_Download::download', array($project.shortname, $file.id)}">{$file}</a> - {$file.filesize|size} <a href="{url 'IDF_Views_Download::download', array($project.shortname, $file.id)}">{$file}</a> - {$file.filesize|size}
</div> </div>
@ -52,7 +53,7 @@
<strong>{trans 'Updated:'}</strong> <span class="nobrk">{$file.modif_dtime|dateago}</span></p> <strong>{trans 'Updated:'}</strong> <span class="nobrk">{$file.modif_dtime|dateago}</span></p>
<p> <p>
<strong>{trans 'Downloads:'}</strong> <span class="nobrk">{$file.downloads}</span></p> <strong>{trans 'Downloads:'}</strong> <span class="nobrk">{$file.downloads}</span></p>
{assign $tags = $file.get_tags_list()}{if $tags.count()} {if $tags.count()}
<p> <p>
<strong>{trans 'Labels:'}</strong><br /> <strong>{trans 'Labels:'}</strong><br />
{foreach $tags as $tag}{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $tag.id)} {foreach $tags as $tag}{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $tag.id)}