Indefero

Indefero Commit Details


Date:2008-11-25 13:32:33 (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:fd9cb629462202cf67b01933e91b75db950594f3
Parents: 4dc074776929fb75a7c2ba2254404654e9aff295
Message:Added documentation wiki search.

Changes:

File differences

src/IDF/Views/Issue.php
197197
198198
199199
200
200
201201
202202
203203
return new Pluf_HTTP_Response_Redirect($url);
}
$q = $request->REQUEST['q'];
$title = sprintf(__('Search Issues - %s'), Pluf_esc($q));
$title = sprintf(__('Search Issues - %s'), $q);
$issues = new Pluf_Search_ResultSet(IDF_Search::mySearch($q, $prj, 'IDF_Issue'));
if (count($issues) > 100) {
// no more than 100 results as we do not care
src/IDF/Views/Wiki.php
7878
7979
8080
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
81123
82124
83125
$request);
}
public $search_precond = array('IDF_Precondition::accessWiki',);
public function search($request, $match)
{
$prj = $request->project;
if (!isset($request->REQUEST['q']) or trim($request->REQUEST['q']) == '') {
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::index',
array($prj->shortname));
return new Pluf_HTTP_Response_Redirect($url);
}
$q = $request->REQUEST['q'];
$title = sprintf(__('Documentation Search - %s'), $q);
$pages = new Pluf_Search_ResultSet(IDF_Search::mySearch($q, $prj, 'IDF_WikiPage'));
if (count($pages) > 100) {
$pages->results = array_slice($pages->results, 0, 100);
}
$pag = new Pluf_Paginator();
$pag->items = $pages;
$pag->class = 'recent-issues';
$pag->item_extra_props = array('project_m' => $prj,
'shortname' => $prj->shortname,
'current_user' => $request->user);
$pag->summary = __('This table shows the pages found.');
$pag->action = array('IDF_Views_Wiki::search', array($prj->shortname), array('q'=> $q));
$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);
$pag->items_per_page = 100;
$pag->no_results_text = __('No pages were found.');
$pag->setFromRequest($request);
$params = array('page_title' => $title,
'pages' => $pag,
'q' => $q,
);
return Pluf_Shortcuts_RenderToResponse('idf/wiki/search.html', $params, $request);
}
/**
* Create a new documentation page.
*/
src/IDF/WikiPage.php
131131
132132
133133
134
134
135135
136136
137137
function _toIndex()
{
$rev = $this->get_current_revision()->_toIndex();
$str = str_repeat($this->summary.' ', 4).' '.$rev;
$str = str_repeat($this->title.' '.$this->summary.' ', 4).' '.$rev;
return Pluf_Text::cleanString(html_entity_decode($str, ENT_QUOTES, 'UTF-8'));
}
src/IDF/conf/urls.php
215215
216216
217217
218
219
220
221
222
223
218224
219225
220226
'model' => 'IDF_Views_Wiki',
'method' => 'create');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/doc/search/$#',
'base' => $base,
'priority' => 4,
'model' => 'IDF_Views_Wiki',
'method' => 'search');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/doc/update/(.*)/$#',
'base' => $base,
'priority' => 4,
src/IDF/templates/idf/wiki/base.html
55
66
77
8
9
10
11
12
813
914
1015
<a {if $inWiki}class="active" {/if}href="{url 'IDF_Views_Wiki::index', array($project.shortname)}">{trans 'List Pages'}</a>
{if !$user.isAnonymous()} | <a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Wiki::create', array($project.shortname)}">{trans 'New Page'}</a> {/if}
{if !$user.isAnonymous() and $inView} | <a href="{url 'IDF_Views_Wiki::update', array($project.shortname, $page.title)}">{trans 'Update This Page'}</a> {/if}
|
<form class="star" action="{url 'IDF_Views_Wiki::search', array($project.shortname)}" method="get">
<input accesskey="4" type="text" value="{$q}" name="q" size="20" />
<input type="submit" name="s" value="{trans 'Search'}" />
</form>
{superblock}
</div>
{/block}
src/IDF/templates/idf/wiki/search.html
1
2
3
4
5
6
7
8
9
10
11
12
13
{extends "idf/wiki/base.html"}
{block docclass}yui-t1{assign $inWiki=true}{/block}
{block body}
{$pages.render}
{if !$user.isAnonymous()}
{aurl 'url', 'IDF_Views_Wiki::create', array($project.shortname)}
<p><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/add.png'}" alt="+" align="bottom" /></a> <a href="{$url}">{trans 'New Page'}</a></p>{/if}
{/block}
{block context}
<p><strong>{trans 'Pages found:'}</strong> {$pages.nb_items}</p>
{/block}

Archive Download the corresponding diff file

Page rendered in 0.08867s using 13 queries.