diff --git a/src/IDF/Views/Download.php b/src/IDF/Views/Download.php index efdfab7..f09528e 100644 --- a/src/IDF/Views/Download.php +++ b/src/IDF/Views/Download.php @@ -42,6 +42,8 @@ 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'; @@ -186,6 +188,46 @@ class IDF_Views_Download return substr($auto, 0, -1); } + /** + * View list of downloads with a given label. + */ + public function listLabel($request, $match) + { + $prj = $request->project; + $tag = Pluf_Shortcuts_GetObjectOr404('IDF_Tag', $match[2]); + $prj->inOr404($tag); + $title = sprintf(__('%1$s Downloads with Label %2$s'), (string) $prj, + (string) $tag); + // Paginator to paginate the downloads + $pag = new Pluf_Paginator(new IDF_Upload()); + $pag->model_view = 'join_tags'; + $pag->class = 'recent-issues'; + $pag->item_extra_props = array('project_m' => $prj, + 'shortname' => $prj->shortname); + $pag->summary = sprintf(__('This table shows the downloads with label %s.'), (string) $tag); + $pag->forced_where = new Pluf_SQL('project=%s AND idf_tag_id=%s', array($prj->id, $tag->id)); + $pag->action = array('IDF_Views_Download::index', array($prj->shortname)); + $pag->edit_action = array('IDF_Views_Download::view', 'shortname', 'id'); + $list_display = array( + 'file' => __('File'), + array('summary', 'IDF_Views_Download_SummaryAndLabels', __('Summary')), + array('filesize', 'IDF_Views_Download_Size', __('Size')), + array('modif_dtime', 'Pluf_Paginator_DateYMD', __('Uploaded')), + ); + $pag->configure($list_display, array(), array('file', 'filesize', 'modif_dtime')); + $pag->items_per_page = 10; + $pag->no_results_text = __('No downloads were found.'); + $pag->sort_order = array('file', 'ASC'); + $pag->setFromRequest($request); + return Pluf_Shortcuts_RenderToResponse('downloads/index.html', + array( + 'page_title' => $title, + 'label' => $tag, + 'downloads' => $pag, + ), + $request); + } + /** * Get the download tags. * @@ -210,7 +252,9 @@ function IDF_Views_Download_SummaryAndLabels($field, $down, $extra='') { $tags = array(); foreach ($down->get_tags_list() as $tag) { - $tags[] = sprintf('%s', Pluf_esc((string) $tag)); + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::listLabel', + array($down->shortname, $tag->id)); + $tags[] = sprintf('%s', $url, Pluf_esc((string) $tag)); } $out = ''; if (count($tags)) { diff --git a/src/IDF/conf/views.php b/src/IDF/conf/views.php index 7360263..82bde44 100644 --- a/src/IDF/conf/views.php +++ b/src/IDF/conf/views.php @@ -147,12 +147,20 @@ $ctl[] = array('regex' => '#^/p/(\w+)/source/download/(\w+)/$#', 'model' => 'IDF_Views_Source', 'method' => 'download'); +// ---------- Downloads ------------------------------------ + $ctl[] = array('regex' => '#^/p/(\w+)/downloads/$#', 'base' => $base, 'priority' => 4, 'model' => 'IDF_Views_Download', 'method' => 'index'); +$ctl[] = array('regex' => '#^/p/(\w+)/downloads/label/(\d+)/$#', + 'base' => $base, + 'priority' => 4, + 'model' => 'IDF_Views_Download', + 'method' => 'listLabel'); + $ctl[] = array('regex' => '#^/p/(\w+)/downloads/(\d+)/$#', 'base' => $base, 'priority' => 4, diff --git a/src/IDF/locale/fr/idf.po b/src/IDF/locale/fr/idf.po index dacae21..62d6b24 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 14:49+0200\n" -"PO-Revision-Date: 2008-08-06 14:51+0100\n" +"POT-Creation-Date: 2008-08-06 21:49+0200\n" +"PO-Revision-Date: 2008-08-06 21:51+0100\n" "Last-Translator: Loïc d'Anterroches \n" "Language-Team: Translation team \n" "MIME-Version: 1.0\n" @@ -227,12 +227,15 @@ msgid "%s Downloads" msgstr "Téléchargements de %s" #: IDF/Views/Download.php:50 +#: IDF/Views/Download.php:52 msgid "This table shows the files to download." msgstr "Ce tableau présente la liste des fichiers en téléchargement." #: 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 msgid "File" msgstr "Fichier" @@ -245,28 +248,38 @@ msgstr "Fichier" #: 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 msgid "Summary" msgstr "Résumé" #: IDF/Views/Download.php:56 #: IDF/gettexttemplates/source/tree.html.php:9 +#: IDF/Views/Download.php:58 +#: IDF/Views/Download.php:214 msgid "Size" msgstr "Taille" #: IDF/Views/Download.php:57 +#: IDF/Views/Download.php:59 +#: IDF/Views/Download.php:215 msgid "Uploaded" msgstr "Mis en ligne" #: IDF/Views/Download.php:61 +#: IDF/Views/Download.php:63 +#: IDF/Views/Download.php:219 msgid "No downloads were found." msgstr "Aucun fichier n'a été trouvé." #: IDF/Views/Download.php:81 +#: IDF/Views/Download.php:83 #, php-format msgid "Download %s" msgstr "Télécharger %s" #: IDF/Views/Download.php:94 +#: IDF/Views/Download.php:96 #, php-format msgid "The file %2$s has been updated." msgstr "Le fichier %2$s a été mis à jour." @@ -274,10 +287,12 @@ msgstr "Le fichier %2$s a été mis à jour." #: IDF/Views/Download.php:135 #: IDF/gettexttemplates/downloads/base.html.php:4 #: IDF/gettexttemplates/downloads/index.html.php:3 +#: IDF/Views/Download.php:137 msgid "New Download" msgstr "Nouveau téléchargement" #: IDF/Views/Download.php:144 +#: IDF/Views/Download.php:146 #, php-format msgid "The file has been uploaded." msgstr "Le fichier a été mis en ligne." @@ -1211,3 +1226,13 @@ msgstr "Détails d'un commit de %s" msgid "%s Commit Details - %s" msgstr "Détails d'un commit de %s - %s" +#: IDF/Views/Download.php:199 +#, 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 +#, php-format +msgid "This table shows the downloads with label %s." +msgstr "Ce tableau montre les téléchargements avec l'étiquette %s." + diff --git a/src/IDF/locale/idf.pot b/src/IDF/locale/idf.pot index 657ad87..57e98d4 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 14:49+0200\n" +"POT-Creation-Date: 2008-08-06 21:49+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -217,50 +217,54 @@ msgstr "" msgid "%s Downloads" msgstr "" -#: IDF/Views/Download.php:50 +#: IDF/Views/Download.php:50 IDF/Views/Download.php:52 msgid "This table shows the files to download." msgstr "" #: IDF/Views/Download.php:54 IDF/gettexttemplates/source/tree.html.php:6 -#: IDF/Form/Upload.php:49 +#: IDF/Form/Upload.php:49 IDF/Views/Download.php:56 IDF/Views/Download.php:212 msgid "File" msgstr "" #: IDF/Views/Download.php:55 IDF/Views/Issue.php:57 IDF/Views/Issue.php:109 #: 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/Form/IssueUpdate.php:45 IDF/Views/Download.php:57 +#: IDF/Views/Download.php:213 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 msgid "Size" msgstr "" -#: IDF/Views/Download.php:57 +#: IDF/Views/Download.php:57 IDF/Views/Download.php:59 +#: IDF/Views/Download.php:215 msgid "Uploaded" msgstr "" -#: IDF/Views/Download.php:61 +#: IDF/Views/Download.php:61 IDF/Views/Download.php:63 +#: IDF/Views/Download.php:219 msgid "No downloads were found." msgstr "" -#: IDF/Views/Download.php:81 +#: IDF/Views/Download.php:81 IDF/Views/Download.php:83 #, php-format msgid "Download %s" msgstr "" -#: IDF/Views/Download.php:94 +#: IDF/Views/Download.php:94 IDF/Views/Download.php:96 #, 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/gettexttemplates/downloads/index.html.php:3 IDF/Views/Download.php:137 msgid "New Download" msgstr "" -#: IDF/Views/Download.php:144 +#: IDF/Views/Download.php:144 IDF/Views/Download.php:146 #, php-format msgid "The file has been uploaded." msgstr "" @@ -1153,3 +1157,13 @@ msgstr "" #, php-format msgid "%s Commit Details - %s" msgstr "" + +#: IDF/Views/Download.php:199 +#, php-format +msgid "%1$s Downloads with Label %2$s" +msgstr "" + +#: IDF/Views/Download.php:207 +#, php-format +msgid "This table shows the downloads with label %s." +msgstr "" diff --git a/src/IDF/templates/downloads/view.html b/src/IDF/templates/downloads/view.html index b1be8c6..6408a76 100644 --- a/src/IDF/templates/downloads/view.html +++ b/src/IDF/templates/downloads/view.html @@ -55,8 +55,8 @@ {assign $tags = $file.get_tags_list()}{if $tags.count()}

{trans 'Labels:'}
-{foreach $tags as $tag} -{$tag.class}:{$tag.name}
+{foreach $tags as $tag}{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $tag.id)} +{$tag.class}:{$tag.name}
{/foreach}

{/if} {/block}