From 19ca5ef02f0c9a2cba873e73d639578b09824983 Mon Sep 17 00:00:00 2001
From: Loic d'Anterroches
Date: Wed, 6 Aug 2008 22:30:44 +0200
Subject: [PATCH] Added a nice warning if the user tries to download a
deprecated file.
---
src/IDF/Views/Download.php | 8 +++++--
src/IDF/locale/fr/idf.po | 26 ++++++++++++++++++++--
src/IDF/locale/idf.pot | 31 +++++++++++++++++++++------
src/IDF/templates/downloads/view.html | 3 ++-
4 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/src/IDF/Views/Download.php b/src/IDF/Views/Download.php
index edc4fb2..29c4be9 100644
--- a/src/IDF/Views/Download.php
+++ b/src/IDF/Views/Download.php
@@ -42,8 +42,6 @@ class IDF_Views_Download
{
$prj = $request->project;
$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.
$pag = new Pluf_Paginator(new IDF_Upload());
$pag->class = 'recent-issues';
@@ -84,6 +82,10 @@ class IDF_Views_Download
$prj->inOr404($upload);
$title = sprintf(__('Download %s'), $upload->summary);
$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
true === IDF_Precondition::projectMemberOrOwner($request)) {
@@ -109,6 +111,8 @@ class IDF_Views_Download
return Pluf_Shortcuts_RenderToResponse('downloads/view.html',
array(
'file' => $upload,
+ 'deprecated' => $deprecated,
+ 'tags' => $tags,
'auto_labels' => self::autoCompleteArrays($prj),
'page_title' => $title,
'form' => $form,
diff --git a/src/IDF/locale/fr/idf.po b/src/IDF/locale/fr/idf.po
index 62d6b24..eb8d3c7 100644
--- a/src/IDF/locale/fr/idf.po
+++ b/src/IDF/locale/fr/idf.po
@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: InDefero\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-08-06 21:49+0200\n"
-"PO-Revision-Date: 2008-08-06 21:51+0100\n"
+"POT-Creation-Date: 2008-08-06 22:28+0200\n"
+"PO-Revision-Date: 2008-08-06 22:30+0100\n"
"Last-Translator: Loïc d'Anterroches \n"
"Language-Team: Translation team \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/Views/Download.php:56
#: IDF/Views/Download.php:212
+#: IDF/Views/Download.php:218
msgid "File"
msgstr "Fichier"
@@ -250,6 +251,7 @@ msgstr "Fichier"
#: IDF/Form/IssueUpdate.php:45
#: IDF/Views/Download.php:57
#: IDF/Views/Download.php:213
+#: IDF/Views/Download.php:219
msgid "Summary"
msgstr "Résumé"
@@ -257,18 +259,21 @@ msgstr "Résumé"
#: IDF/gettexttemplates/source/tree.html.php:9
#: IDF/Views/Download.php:58
#: IDF/Views/Download.php:214
+#: IDF/Views/Download.php:220
msgid "Size"
msgstr "Taille"
#: IDF/Views/Download.php:57
#: IDF/Views/Download.php:59
#: IDF/Views/Download.php:215
+#: IDF/Views/Download.php:221
msgid "Uploaded"
msgstr "Mis en ligne"
#: IDF/Views/Download.php:61
#: IDF/Views/Download.php:63
#: IDF/Views/Download.php:219
+#: IDF/Views/Download.php:225
msgid "No downloads were found."
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:96
+#: IDF/Views/Download.php:100
#, php-format
msgid "The file %2$s has been updated."
msgstr "Le fichier %2$s a été mis à jour."
@@ -288,11 +294,13 @@ msgstr "Le fichier %2$s a été mis à jour."
#: IDF/gettexttemplates/downloads/base.html.php:4
#: IDF/gettexttemplates/downloads/index.html.php:3
#: IDF/Views/Download.php:137
+#: IDF/Views/Download.php:143
msgid "New Download"
msgstr "Nouveau téléchargement"
#: IDF/Views/Download.php:144
#: IDF/Views/Download.php:146
+#: IDF/Views/Download.php:152
#, php-format
msgid "The file has been uploaded."
msgstr "Le fichier a été mis en ligne."
@@ -440,15 +448,18 @@ msgstr "Administrer"
#: IDF/gettexttemplates/downloads/view.html.php:3
#: IDF/gettexttemplates/issues/view.html.php:6
+#: IDF/gettexttemplates/downloads/view.html.php:4
#, php-format
msgid "by %%submitter%%"
msgstr "par %%submitter%%"
#: 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."
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:6
msgid "Update File"
msgstr "Mettre à jour le fichier"
@@ -459,25 +470,30 @@ msgstr "Mettre à jour le fichier"
#: IDF/gettexttemplates/register/index.html.php:7
#: IDF/gettexttemplates/issues/view.html.php:14
#: IDF/gettexttemplates/issues/create.html.php:12
+#: IDF/gettexttemplates/downloads/view.html.php:7
msgid "Cancel"
msgstr "Annuler"
#: IDF/gettexttemplates/downloads/view.html.php:7
+#: IDF/gettexttemplates/downloads/view.html.php:8
msgid "Uploaded:"
msgstr "Mis en ligne :"
#: IDF/gettexttemplates/downloads/view.html.php:8
#: IDF/gettexttemplates/issues/view.html.php:16
+#: IDF/gettexttemplates/downloads/view.html.php:9
msgid "Updated:"
msgstr "Mis à jour :"
#: IDF/gettexttemplates/downloads/view.html.php:9
+#: IDF/gettexttemplates/downloads/view.html.php:10
msgid "Downloads:"
msgstr "Téléchargements :"
#: IDF/gettexttemplates/downloads/view.html.php:10
#: IDF/gettexttemplates/issues/view.html.php:11
#: IDF/gettexttemplates/issues/view.html.php:20
+#: IDF/gettexttemplates/downloads/view.html.php:11
msgid "Labels:"
msgstr "Étiquettes :"
@@ -1227,12 +1243,18 @@ msgid "%s Commit Details - %s"
msgstr "Détails d'un commit de %s - %s"
#: IDF/Views/Download.php:199
+#: IDF/Views/Download.php:205
#, php-format
msgid "%1$s Downloads with Label %2$s"
msgstr "Téléchargements avec l'étiquette %2$s de %1$s"
#: IDF/Views/Download.php:207
+#: IDF/Views/Download.php:213
#, php-format
msgid "This table shows the downloads with label %s."
msgstr "Ce tableau montre les téléchargements avec l'étiquette %s."
+#: IDF/gettexttemplates/downloads/view.html.php:3
+msgid "Attention! This file is marked as deprecated, download it only if you are sure you need this specific version."
+msgstr "Attention ! Ce fichier est marqué comme obsolète, téléchargez ce fichier uniquement si vous avez besoin de cette version."
+
diff --git a/src/IDF/locale/idf.pot b/src/IDF/locale/idf.pot
index 57e98d4..f7bd87f 100644
--- a/src/IDF/locale/idf.pot
+++ b/src/IDF/locale/idf.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -223,6 +223,7 @@ msgstr ""
#: 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/Views/Download.php:218
msgid "File"
msgstr ""
@@ -230,22 +231,23 @@ msgstr ""
#: 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/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"
msgstr ""
#: 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:220
msgid "Size"
msgstr ""
#: 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"
msgstr ""
#: 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."
msgstr ""
@@ -255,16 +257,19 @@ msgid "Download %s"
msgstr ""
#: IDF/Views/Download.php:94 IDF/Views/Download.php:96
+#: IDF/Views/Download.php:100
#, php-format
msgid "The file %2$s has been updated."
msgstr ""
#: 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/Views/Download.php:143
msgid "New Download"
msgstr ""
#: IDF/Views/Download.php:144 IDF/Views/Download.php:146
+#: IDF/Views/Download.php:152
#, php-format
msgid "The file has been uploaded."
msgstr ""
@@ -404,15 +409,18 @@ msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:3
#: IDF/gettexttemplates/issues/view.html.php:6
+#: IDF/gettexttemplates/downloads/view.html.php:4
#, php-format
msgid "by %%submitter%%"
msgstr ""
#: 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."
msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:5
+#: IDF/gettexttemplates/downloads/view.html.php:6
msgid "Update File"
msgstr ""
@@ -423,25 +431,30 @@ msgstr ""
#: IDF/gettexttemplates/register/index.html.php:7
#: IDF/gettexttemplates/issues/view.html.php:14
#: IDF/gettexttemplates/issues/create.html.php:12
+#: IDF/gettexttemplates/downloads/view.html.php:7
msgid "Cancel"
msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:7
+#: IDF/gettexttemplates/downloads/view.html.php:8
msgid "Uploaded:"
msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:8
#: IDF/gettexttemplates/issues/view.html.php:16
+#: IDF/gettexttemplates/downloads/view.html.php:9
msgid "Updated:"
msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:9
+#: IDF/gettexttemplates/downloads/view.html.php:10
msgid "Downloads:"
msgstr ""
#: IDF/gettexttemplates/downloads/view.html.php:10
#: IDF/gettexttemplates/issues/view.html.php:11
#: IDF/gettexttemplates/issues/view.html.php:20
+#: IDF/gettexttemplates/downloads/view.html.php:11
msgid "Labels:"
msgstr ""
@@ -1158,12 +1171,18 @@ msgstr ""
msgid "%s Commit Details - %s"
msgstr ""
-#: IDF/Views/Download.php:199
+#: IDF/Views/Download.php:199 IDF/Views/Download.php:205
#, php-format
msgid "%1$s Downloads with Label %2$s"
msgstr ""
-#: IDF/Views/Download.php:207
+#: IDF/Views/Download.php:207 IDF/Views/Download.php:213
#, php-format
msgid "This table shows the downloads with label %s."
msgstr ""
+
+#: IDF/gettexttemplates/downloads/view.html.php:3
+msgid ""
+"Attention! This file is marked as deprecated, download it "
+"only if you are sure you need this specific version."
+msgstr ""
diff --git a/src/IDF/templates/downloads/view.html b/src/IDF/templates/downloads/view.html
index 6408a76..790a227 100644
--- a/src/IDF/templates/downloads/view.html
+++ b/src/IDF/templates/downloads/view.html
@@ -3,6 +3,7 @@
{block body}
+{if $deprecated}
{blocktrans}Attention! This file is marked as deprecated, download it only if you are sure you need this specific version.{/blocktrans}
{/if}
{$file} - {$file.filesize|size}
@@ -52,7 +53,7 @@
{trans 'Updated:'} {$file.modif_dtime|dateago}
{trans 'Downloads:'} {$file.downloads}
-{assign $tags = $file.get_tags_list()}{if $tags.count()}
+{if $tags.count()}
{trans 'Labels:'}
{foreach $tags as $tag}{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $tag.id)}