]> git.deb.at Git - deb/packages.git/blob - templates/html/search.tmpl
Various improvements to the search result comments
[deb/packages.git] / templates / html / search.tmpl
1 [%- PROCESS 'config/archive_layout.tmpl' -%]
2 [%- keyword_str = search_keywords.join(' ');
3    keyword_esc = uri_escape(keyword_str);
4    keyword_enc = html_encode(keyword_str);
5
6    section_str = params.values.section.no_replace.join(', ');
7    section_esc = uri_escape(section_str);
8    section_enc = html_encode(section_str);
9
10    suite_str = params.values.suite.no_replace.join(', ');
11    suite_esc = uri_escape(suite_str);
12    suite_enc = html_encode(suite_str);
13
14    architectures_str = params.values.arch.no_replace.join(', ');
15    architectures_esc = uri_escape(architectures_str);
16    architectures_enc = html_encode(architectures_str);
17 -%]
18 [%- PROCESS 'html/head.tmpl'
19    title_tag = g("Package Search Results -- %s", keyword_enc)
20    print_search_field = 'packages'
21    search_field_values = {
22         keywords => search_keywords.join(' '),
23         searchon => opts.searchon_form,
24         suite => params.values.suite.no_replace.join(','),
25         architectures => params.values.arch.no_replace.join(','),
26         sections => params.values.section.no_replace.join(','),
27     }
28    navigation = [ { name => g('Package Search Results') } ]
29 -%]
30
31 <div id="psearchsug">
32 [% UNLESS results %]
33         [% IF opts.searchon != "names" && opts.exact %]
34         <p>[% g('You have searched only for words exactly matching your keywords. You can try to search <a href="%s">allowing subword matching</a>.',
35                 make_search_url('',"keywords=$keyword_esc",'exact',0) ) %]</p>
36         [% END %]
37 [% END %]
38
39 <p>[% g('Search in specific suite:') %]
40 [% FOREACH s IN all_suites %]
41         [% IF s != suite_str %]
42         [<a href="[% make_search_url('',"keywords=$keyword_esc",'suite',s) %]">[% s %]</a>]
43         [% ELSE %]
44         [[% s %]]
45         [% END %]
46 [% END %]
47 [% IF search_suites.size == 1 %]
48 <p>[% g('Search in <a href="%s">all suites</a>',
49         make_search_url('',"keywords=$keyword_esc",'suite','all')) %]
50 [% END %]
51
52 <p>[% g('Limit search to a specific architecture:') %]
53 [% FOREACH a IN all_architectures %]
54    [% IF a != arch_str %]
55    [<a href="[% make_search_url('',"keywords=$keyword_esc",'arch',a) %]">[% a %]</a>]
56    [% ELSE %]
57    [[% a %]]
58    [% END %]
59 [% END %]
60 [% IF search_architectures.size == 1 %]
61 <p>[% g('Search in <a href="%s">all architectures</a>',
62         make_search_url('',"keywords=$keyword_esc",'arch','any')) %]
63 [% END %]
64
65 </div>
66
67 [% IF opts.searchon == "names" && non_results %]
68 <p>[% g('<a href="%s">Some</a> results have not been displayed due to the search parameters.',
69         "$search_url$keyword_esc") %]</p>
70 [% END %]
71 </div>
72
73 [%- PROCESS 'html/messages.tmpl' -%]
74
75 <div id="psearchres">
76
77 [% suite_wording = suite_enc.match("^(default|all)$") ? g("all suites") : g("suite(s) <em>%s</em>", suite_enc);
78    section_wording = (section_enc == 'all') ? g("all sections") : g("section(s) <em>%s</em>", section_enc);
79    arch_wording = (architectures_enc == 'any') ? g("all architectures") : g("architecture(s) <em>%s</em>", architectures_enc);
80     IF opts.searchon == "names";
81         source_wording = opts.source ? g("source packages") : g("packages");
82         msg = g("You have searched for %s that names contain <em>%s</em> in %s, %s, and %s.",
83                 source_wording, keyword_enc, suite_wording, section_wording, arch_wording);
84     ELSE;
85         exact_wording = opts.exact ? "" : g(" (including subword matching)");
86         # @translators: I'm really sorry :/
87         msg = g("You have searched for <em>%s</em> in packages names and descriptions in %s, %s, and %s%s.",
88                 keyword_enc, suite_wording, section_wording, arch_wording, exact_wording);
89     END %]
90 <p>[% msg %]
91
92 [% IF results %]
93 [% g('Found <strong>%u</strong> matching packages.', results) %]</p>
94 [% END %]
95
96 [% IF too_many_hits %]
97 [% IF opts.searchon != "names" %]
98 <p id="psearchtoomanyhits">[% g("Note that this only shows the best matches, sorted by relevance. If the first few packages don't match what you searched for, try using more keywords or alternative keywords.") %]</p>
99 [% ELSE %]
100 <p id="psearchtoomanyhits">
101 [%- IF results %]
102 [% g("Your keyword was too generic, for optimizing reasons some results might have been supressed.<br>Please consider using a longer keyword or more keywords.") %]
103 [%- ELSE -%]
104 [% g("Your keyword was too generic.<br>Please consider using a longer keyword or more keywords.") %]
105 [% END -%]
106 </p>
107 [% END; END %]
108
109 [% UNLESS results || too_many_hits %]
110 <p id="psearchnoresult">[% g('Sorry, your search gave no results') %]</p>
111 [% END %]
112
113 [% FOREACH categories %]
114   [% "<h2>$name</h2>" IF name %]
115
116 [% FOREACH packages %]
117   <h3>[% g('Package %s', pkg) %]</h3>
118   <ul>
119   [% FOREACH s IN suites;
120         suite = s.suite %]
121     <li class="[% suite %]"><a class="resultlink" href="[% make_url(pkg,'','suite',suite,'arch','','section','') %]">[% suite %]
122         [%- ' (' _ suite_aliases.$suite _ ')' IF suite_aliases.$suite %]</a>[% ' (' _ s.subsection _ ')' IF s.subsection %]: [% IF s.trans_desc.$lang; s.trans_desc.$lang | html; ELSE; s.desc | html; END %]  [%- IF s.section && s.section != main_section %] [<strong class="pmarker">[% s.section %]</strong>][% END %]
123     [% FOREACH s.versions %]
124       <br>[% version %] [%- IF archive != main_archive %] [<strong class="pmarker">[% archive %]</strong>][% END %]: [% architectures.join(' ') %]
125     [% END %]
126     [% IF s.providers %]
127         <br>[% IF s.versions.size > 0; g('also provided by:'); ELSE; g('provided by:'); END %]
128         [% FOREACH provider IN s.providers.sort %]<a href="[% make_url(provider,'','suite',suite) %]">[% provider %]</a>[% ', ' UNLESS loop.last %][% END %]
129     [% END %]
130     </li>
131   [% END %]
132   </ul>
133 [% END %]
134
135 [% FOREACH src_packages %]
136   <h3>[% g('Source Package %s', pkg) %]</h3>
137   <ul>
138   [% FOREACH origins %]
139      [% origin = (archive == main_archive) ? suite : "$suite/$archive";
140         js_id = string2id("$pkg$suite$archive")  %]
141     <li><a class="resultlink" href="[% make_url(pkg,'','source','source','suite',origin,'section','','arch','') %]">[% origin %]</a> ([% subsection %]): [% version %]
142       [%- IF section %] [<strong class="pmarker">[% section %]</strong>][% END %]
143       [%- IF real_archive %] [<strong class="pmarker">[% real_archive %]</strong>][% END %]
144     <br>[% g('Binary packages:') %] <span id="js_[% js_id %]" class="p_js_elem"></span> <span id="html_[% js_id %]" class="binaries">[% FOREACH binary IN binaries.sort %]<a href="[% make_url(binary,'','source','','suite',suite,'archive',archive,'arch','','archive','') %]">[% binary %]</a>[% ', ' UNLESS loop.last %][% END %]</span>
145         [% IF binaries.size > 10 %]
146         <script type="text/javascript">init_toggle_elem("[% js_id %]","[% g('show %u binary packages', binaries.size) %]","[% g('hide %u binary packages', binaries.size) %]")</script>
147         [% END %]
148     </li>
149   [% END %]
150   </ul>
151 [% END %]
152
153 [% END %]
154
155 [% IF skipped %]
156   <p>[% g('<a href="%s">%u</a> results have not been displayed because you requested only exact matches.',
157         make_search_url('',"keywords=$keyword_esc",'exact', 0), skipped) %]
158 [% END %]
159
160 </div>
161
162 [%- PROCESS 'html/foot.tmpl' -%]