Indefero

Indefero Commit Details


Date:2008-11-25 14:07:51 (16 years 26 days 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:86ab5221a74e577b1e30a9943b1ff08e5d27c48e
Parents: 7a0a0b523b771645be09ff262ddb163646a0dbf5
Message:Added view of pages by label.

Changes:

File differences

src/IDF/Project.php
287287
288288
289289
290
290
291291
292292
293293
......
307307
308308
309309
310
311
312
313
314
315
316
317
318
319
320
321
310322
311323
312324
313
325
314326
315327
316
317
318
319328
320329
321330
* get the extra property 'nb_use' for the number of use in the
* project.
*
* @param string ('issues') 'closed_issues' or 'downloads'
* @param string ('issues') 'closed_issues', 'wiki' or 'downloads'
* @return ArrayObject of IDF_Tag
*/
public function getTagCloud($what='issues')
'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));
} elseif ($what == 'wiki') {
$dep_ids = IDF_Views_Wiki::getDeprecatedPagesIds($this);
$extra = '';
if (count($dep_ids)) {
$extra = ' AND idf_wikipage_id NOT IN ('.implode(', ', $dep_ids).') ';
}
$what_t = Pluf::factory('IDF_WikiPage')->getSqlTable();
$asso_t = $this->_con->pfx.'idf_tag_idf_wikipage_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_wikipage_id='.$what_t.'.id '."\n".
'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';
} elseif ($what == 'downloads') {
$dep_ids = IDF_Views_Download::getDeprecatedFilesIds($this);
$extra = '';
if (count($dep_ids) and $what == 'downloads') {
if (count($dep_ids)) {
$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".
src/IDF/Views/Wiki.php
6666
6767
6868
69
69
7070
7171
7272
7373
74
74
7575
7676
7777
......
119119
120120
121121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
122165
123166
124167
......
317360
318361
319362
320
363
321364
322365
323366
......
355398
356399
357400
358
359401
360402
361403
$pag->no_results_text = __('No documentation pages were found.');
$pag->sort_order = array('title', 'ASC');
$pag->setFromRequest($request);
//$tags = $prj->getTagCloud('downloads');
$tags = $prj->getTagCloud('wiki');
return Pluf_Shortcuts_RenderToResponse('idf/wiki/index.html',
array(
'page_title' => $title,
'pages' => $pag,
//'tags' => $tags,
'tags' => $tags,
'deprecated' => count($ids),
'dlabel' => $dtag,
),
}
/**
* View list of pages with a given label.
*/
public $listLabel_precond = array('IDF_Precondition::accessWiki');
public function listLabel($request, $match)
{
$prj = $request->project;
$tag = Pluf_Shortcuts_GetObjectOr404('IDF_Tag', $match[2]);
$prj->inOr404($tag);
$title = sprintf(__('%1$s Documentation Pages with Label %2$s'), (string) $prj,
(string) $tag);
// Paginator to paginate the pages
$ptags = self::getWikiTags($prj);
$dtag = array_pop($ptags); // The last tag is the deprecated tag.
$pag = new Pluf_Paginator(new IDF_WikiPage());
$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 documentation pages 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_Wiki::listLabel', array($prj->shortname, $tag->id));
$pag->edit_action = array('IDF_Views_Wiki::view', 'shortname', 'title');
$list_display = array(
'title' => __('Page Title'),
array('summary', 'IDF_Views_Wiki_SummaryAndLabels', __('Summary')),
array('modif_dtime', 'Pluf_Paginator_DateYMD', __('Updated')),
);
$pag->configure($list_display, array(), array('title', 'modif_dtime'));
$pag->items_per_page = 25;
$pag->no_results_text = __('No documentation pages were found.');
$pag->setFromRequest($request);
$tags = $prj->getTagCloud('wiki');
return Pluf_Shortcuts_RenderToResponse('idf/wiki/index.html',
array(
'page_title' => $title,
'label' => $tag,
'pages' => $pag,
'tags' => $tags,
'dlabel' => $dtag,
),
$request);
}
/**
* Create a new documentation page.
public static function getDeprecatedPagesIds($project, $dtag=null)
{
if (is_null($dtag)) {
$ptags = self::getDownloadTags($project);
$ptags = self::getWikiTags($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,
}
return substr($auto, 0, -1);
}
}
/**
src/IDF/conf/urls.php
221221
222222
223223
224
225
226
227
228
229
224230
225231
226232
'model' => 'IDF_Views_Wiki',
'method' => 'search');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/doc/label/(\d+)/$#',
'base' => $base,
'priority' => 4,
'model' => 'IDF_Views_Wiki',
'method' => 'listLabel');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/doc/update/(.*)/$#',
'base' => $base,
'priority' => 4,
src/IDF/templates/idf/wiki/index.html
99
1010
1111
12
13
14
15
16
17
18
19
20
21
22
1223
1324
{/block}
{block context}
<p><strong>{trans 'Number of pages:'}</strong> {$pages.nb_items}</p>
{assign $class = ''}{assign $i = 0}
{if !$label or $label.id != $dlabel.id}
<p class="smaller">{foreach $tags as $lab}
{aurl 'url', 'IDF_Views_Wiki::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_Wiki::listLabel', array($project.shortname, $dlabel.id)}
<p class="helptext">{blocktrans}See <a href="{$url}">the deprecated pages</a>.{/blocktrans}</p>
{/if}
{/block}

Archive Download the corresponding diff file

Page rendered in 0.09499s using 13 queries.