Indefero

Indefero Commit Details


Date:2008-09-02 16:31:43 (16 years 3 months ago)
Author:Loic d'Anterroches
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:14811beeba174ff4af6951bfeccaf8d1c7ef9416
Parents: ee88dbed86557b8909db2f10405d668ac318d7a8
Message:Fixed issue 9, do not show the deprecated files by default.

Changes:

File differences

src/IDF/Project.php
287287
288288
289289
290
290
291
292
293
294
295
296
297
298
291299
292300
293301
294302
295303
296
304
297305
298306
299307
'LEFT JOIN '.$what_t.' ON idf_issue_id='.$what_t.'.id '."\n".
'WHERE idf_tag_id IS NOT NULL AND '.$what_t.'.status IN (%s) AND '.$what_t.'.project='.$this->id.' GROUP BY '.$tag_t.'.id, '.$tag_t.'.class, '.$tag_t.'.name ORDER BY '.$tag_t.'.class ASC, '.$tag_t.'.name ASC',
implode(', ', $ostatus));
} else {
} elseif ($what == 'downloads') {
$dep_ids = IDF_Views_Download::getDeprecatedFilesIds($this);
$extra = '';
if (count($dep_ids) and $what == 'downloads') {
$extra = ' AND idf_upload_id NOT IN ('.implode(', ', $dep_ids).') ';
}
if (count($dep_ids) and $what != 'downloads') {
$extra = ' AND idf_upload_id IN ('.implode(', ', $dep_ids).') ';
}
$what_t = Pluf::factory('IDF_Upload')->getSqlTable();
$asso_t = $this->_con->pfx.'idf_tag_idf_upload_assoc';
$sql = 'SELECT '.$tag_t.'.id AS id, COUNT(*) AS nb_use FROM '.$tag_t.' '."\n".
'LEFT JOIN '.$asso_t.' ON idf_tag_id='.$tag_t.'.id '."\n".
'LEFT JOIN '.$what_t.' ON idf_upload_id='.$what_t.'.id '."\n".
'WHERE idf_tag_id IS NOT NULL AND '.$what_t.'.project='.$this->id.' GROUP BY '.$tag_t.'.id, '.$tag_t.'.class, '.$tag_t.'.name ORDER BY '.$tag_t.'.class ASC, '.$tag_t.'.name ASC';
'WHERE idf_tag_id IS NOT NULL '.$extra.' AND '.$what_t.'.project='.$this->id.' GROUP BY '.$tag_t.'.id, '.$tag_t.'.class, '.$tag_t.'.name ORDER BY '.$tag_t.'.class ASC, '.$tag_t.'.name ASC';
}
$tags = array();
foreach ($this->_con->select($sql) as $idc) {
src/IDF/Views/Download.php
5151
5252
5353
54
54
55
56
57
58
59
60
61
62
5563
5664
5765
......
6977
7078
7179
80
81
7282
7383
7484
......
246256
247257
248258
259
260
249261
250262
251263
......
273285
274286
275287
288
276289
277290
278291
......
289302
290303
291304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
292324
293325
294326
$pag->summary = __('This table shows the files to download.');
$pag->action = array('IDF_Views_Download::index', array($prj->shortname));
$pag->edit_action = array('IDF_Views_Download::view', 'shortname', 'id');
$pag->forced_where = new Pluf_SQL('project=%s', array($prj->id));
$sql = 'project=%s';
$ptags = self::getDownloadTags($prj);
$dtag = array_pop($ptags); // The last tag is the deprecated tag.
$ids = self::getDeprecatedFilesIds($prj);
if (count($ids)) {
$sql .= ' AND id NOT IN ('.implode(',', $ids).')';
}
$pag->forced_where = new Pluf_SQL($sql, array($prj->id));
$list_display = array(
'file' => __('File'),
array('summary', 'IDF_Views_Download_SummaryAndLabels', __('Summary')),
'page_title' => $title,
'downloads' => $pag,
'tags' => $tags,
'deprecated' => count($ids),
'dlabel' => $dtag,
),
$request);
$title = sprintf(__('%1$s Downloads with Label %2$s'), (string) $prj,
(string) $tag);
// Paginator to paginate the downloads
$ptags = self::getDownloadTags($prj);
$dtag = array_pop($ptags); // The last tag is the deprecated tag.
$pag = new Pluf_Paginator(new IDF_Upload());
$pag->model_view = 'join_tags';
$pag->class = 'recent-issues';
'label' => $tag,
'downloads' => $pag,
'tags' => $tags,
'dlabel' => $dtag,
),
$request);
}
IDF_Form_UploadConf::init_predefined);
}
/**
* Get deprecated file ids.
*
* @return array Ids of the deprecated files.
*/
public static function getDeprecatedFilesIds($project)
{
$ptags = self::getDownloadTags($project);
$dtag = array_pop($ptags); // The last tag is the deprecated tag.
$sql = new Pluf_SQL('project=%s AND idf_tag_id=%s', array($project->id,
$dtag->id));
$ids = array();
foreach (Pluf::factory('IDF_Upload')->getList(array('filter' => $sql->gen(), 'view' => 'join_tags'))
as $file) {
$ids[] = (int) $file->id;
}
return $ids;
}
}
/**
src/IDF/templates/downloads/index.html
1010
1111
1212
13
14
15
16
13
14
15
16
17
18
19
20
21
22
1723
1824
1925
{block context}
<p><strong>{trans 'Number of files:'}</strong> {$downloads.nb_items}</p>
{assign $class = ''}{assign $i = 0}
<p class="smaller">{foreach $tags as $label}
{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $label.id)}
{if $class != $label.class}{if $i != 0}<br />{/if}<strong class="label">{$label.class}:</strong> {/if}
<a href="{$url}" class="label">{$label.name}</a>,{assign $i = $i + 1}{assign $class = $label.class}{/foreach}</p>
{if !$label or $label.id != $dlabel.id}
<p class="smaller">{foreach $tags as $lab}
{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $lab.id)}
{if $class != $lab.class}{if $i != 0}<br />{/if}<strong class="label">{$lab.class}:</strong> {/if}
<a href="{$url}" class="label">{$lab.name}</a>,{assign $i = $i + 1}{assign $class = $lab.class}{/foreach}</p>
{/if}
{if $deprecated > 0}
{aurl 'url', 'IDF_Views_Download::listLabel', array($project.shortname, $dlabel.id)}
<p class="helptext">{blocktrans}See <a href="{$url}">the deprecated files</a>.{/blocktrans}</p>
{/if}
{/block}

Archive Download the corresponding diff file

Page rendered in 0.07958s using 14 queries.