]> git.deb.at Git - deb/packages.git/blob - templates/html/search.tmpl
search.tmpl: Fix two bugs
[deb/packages.git] / templates / html / search.tmpl
1 [%- PROCESS 'config/archive_layout.tmpl' -%]
2 [%- PROCESS 'html/head.tmpl'
3    title_tag = 'Debian Package Search Results'
4    print_search_field = 'packages'
5    search_field_values = {
6         keywords => search_keywords.join(' '),
7         searchon => opts.searchon_form,
8         suite => params.values.suite.no_replace.join(','),
9         architectures => params.values.arch.no_replace.join(','),
10         sections => params.values.section.no_replace.join(','),
11     }
12    navigation = [ { name => 'Package Search Results' } ]
13 -%]
14
15 [% keyword_str = search_keywords.join(' ');
16    keyword_esc = uri_escape(keyword_str);
17    keyword_enc = html_encode(keyword_str);
18
19    section_str = params.values.section.no_replace.join(', ');
20    section_esc = uri_escape(section_str);
21    section_enc = html_encode(section_str);
22
23    suite_str = params.values.suite.no_replace.join(', ');
24    suite_esc = uri_escape(suite_str);
25    suite_enc = html_encode(suite_str);
26
27    architectures_str = params.values.arch.no_replace.join(', ');
28    architectures_esc = uri_escape(architectures_str);
29    architectures_enc = html_encode(architectures_str);
30 %]
31
32 <div id="psearchsug">
33 [% UNLESS results %]
34         <p>You can try a different search on the <a href="[% searchformurl %]#search_packages">Packages search page</a>.</p>
35         
36         [% IF opts.searchon != "names" && opts.exact %]
37         <p>You have searched only for words exactly matching your keywords.
38         You can try to search <a href="[% make_search_url('',"keywords=$keyword_esc",'exact',0) %]">allowing subword matching</a>
39         [% END %]
40 [% END %]
41 [% IF opts.searchon == "names" && non_results %]
42 <p><a href="[% search_url %][% keyword_esc %]">[% non_results %]</a>
43 results have not been displayed due to the search parameters.</p>
44 [% END %]
45 </div>
46
47 [%- PROCESS 'html/messages.tmpl' -%]
48
49 <div id="psearchres">
50
51 [% suite_wording = suite_enc.match("^(default|all)$") ? "all suites" : "suite(s) <em>$suite_enc</em>";
52    section_wording = (section_enc == 'all') ? "all sections" : "section(s) <em>$section_enc</em>";
53    arch_wording = (architectures_enc == 'any') ? "all architectures" : "architecture(s) <em>$architectures_enc</em>";
54     IF opts.searchon == "names";
55         source_wording = opts.source ? "source packages" : "packages";
56         msg = "You have searched for $source_wording that names contain <em>$keyword_enc</em> in $suite_wording, $section_wording, and $arch_wording .";
57     ELSE;
58         exact_wording = opts.exact ? "" : " (including subword matching)";
59         msg = "You have searched for <em>$keyword_enc</em> in packages names and descriptions in $suite_wording, $section_wording, and $arch_wording$exact_wording .";
60     END %]
61 <p>[% msg %]
62
63 [% IF results %]
64 Found <strong>[% results %]</strong> matching packages.</p>
65 [% END %]
66
67 [% IF too_many_hits %]
68 <p id="psearchtoomanyhits">Your search was too wide so we will only display exact matches.
69 At least <em>[% too_many_hits %]</em> results have been omitted and will not be displayed.
70 Please consider using a longer keyword or more keywords.</p>
71 [% END %]
72
73 [% UNLESS results %]
74 <p id="psearchnoresult">Sorry, your search gave no results</p>
75 [% END %]
76
77 [% FOREACH categories %]
78   [% "<h2>$name</h2>" IF name %]
79
80 [% FOREACH packages %]
81   <h3>Package [% pkg %]</h3>
82   <ul>
83   [% FOREACH s IN suites %]
84     <li><a class="resultlink" href="[% make_url(pkg,'','suite',s.suite,'arch','','section','') %]">[% s.suite %]</a>[% ' (' _ s.subsection _ ')' IF s.subsection %]: [% s.desc %]  [%- IF s.section != main_section %] [<strong class="pmarker">[% s.section %]</strong>][% END %]
85     [% FOREACH s.versions %]
86       <br>[% version %] [%- IF archive != main_archive %] [<strong class="pmarker">[% archive %]</strong>][% END %]: [% architectures.join(' ') %]
87     [% END %]
88     [% IF s.providers %]
89         <br>[% 'also ' IF s.versions.size > 0 %]provided by: [% FOREACH provider IN s.providers %]<a href="[% make_url(provider,'','suite',suite) %]">[% provider %]</a>[% ', ' UNLESS loop.last %][% END %]
90     [% END %]
91     </li>
92   [% END %]
93   </ul>
94 [% END %]
95
96 [% FOREACH src_packages %]
97   <h3>Source Package [% pkg %]</h3>
98   <ul>
99   [% FOREACH origins %]
100      [% origin = (archive == main_archive) ? suite : "$suite/$archive";
101         js_id = string2id("$pkg$suite$archive")  %]
102     <li><a class="resultlink" href="[% make_url(pkg,'','source','source','suite',origin,'section','','arch','') %]">[% origin %]</a> ([% subsection %]): [% version %]
103       [%- IF section %] [<strong class="pmarker">[% section %]</strong>][% END %]
104       [%- IF real_archive %] [<strong class="pmarker">[% real_archive %]</strong>][% END %]
105     <br>Binary packages: <span id="js_[% js_id %]" class="p_js_elem"></span> <span id="html_[% js_id %]" class="binaries">[% FOREACH binary IN binaries %]<a href="[% make_url(binary,'','source','','suite',suite,'archive',archive,'arch','','archive','') %]">[% binary %]</a>[% ', ' UNLESS loop.last %][% END %]</span>
106         [% IF binaries.size > 10 %]
107         <script type="text/javascript">init_toggle_elem("[% js_id %]","[% binaries.size %] binary packages")</script>
108         [% END %]
109     </li>
110   [% END %]
111   </ul>
112 [% END %]
113
114 [% END %]
115
116 [% IF skipped %]
117   <p><a href="[% make_search_url('',"keywords=$keyword_esc",'exact', 0) %]">[% skipped %]</a> results have not been displayed because you requested only exact matches.
118 [% END %]
119
120 </div>