File: swish.tt

package info (click to toggle)
swish-e 2.4.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,248 kB
  • ctags: 7,642
  • sloc: ansic: 47,385; sh: 8,502; perl: 5,101; makefile: 719; xml: 9
file content (212 lines) | stat: -rwxr-xr-x 5,874 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212


[% # This is just an example -- you would want your own "page" for the wrapper %]

[% WRAPPER page %]

    [% PROCESS swish_header %]


    [% title = PROCESS title %]

    [% IF ! search.results %]
        [% PROCESS show_message %]
        [% PROCESS search_form %]

    [% ELSE %]
        [% PROCESS search_form %]
        [% PROCESS nav_bar %]
        [% PROCESS results_list %]
    [% END %]

    [% PROCESS swish_footer %]

[% END %]


[% # This is just an example -- you would want your own "page" to wrap around "swish" %]
[% BLOCK page %]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
   [% title || "Welcome"  %]
</title>
<body>
   [% content %]
</body>    
</html>    
[% END %]


[% BLOCK title %]
    [% IF ! search.results %]
        [% search.errstr || search.config('title') || "Search page" %]

    [% ELSE %]
        [% search.navigation('hits') %] Results for [[% search.query_simple | html %]]
    [% END %]
[% END %]

[% BLOCK swish_header %]    

    <table border="0" cellpadding="0" cellspacing="0">
    <tr><td>
        <a href="http://swish-e.org">
        <img border="0" alt="Swish-e home page" src="http://swish-e.org/Images/swish-e.gif"></a>
    </td><td valign="middle">
        <font size="+3">[% search.config('title') || "Search page"  %]</font>
    </td></tr>
    </table>

[% END %]    

[% BLOCK swish_footer %] 

    [% PROCESS nav_bar_pages2 %]
    <hr>
    <small>Powered by <em>Swish-e</em> <a href="http://swish-e.org">swish-e.org</a></small>
    [% IF search.MOD_PERL %]
        <br><small>Response brought to you by <a href="http://perl.apache.org"><em>mod_perl</em></a></small>
    [% END %]
  <p>
    <a href="http://validator.w3.org/check/referer"><img border="0"
        src="http://www.w3.org/Icons/valid-html401"
        alt="Valid HTML 4.01!" height="31" width="88"></a>
  </p>
[% END %]    



[% BLOCK show_message %]
    [% IF search.errstr %]
        <font size="+2" color="red">[% search.errstr | html %]</font>
    [% END %]
[% END %]



[% BLOCK search_form %]
    [% CGI.start_form( '-action' => CGI.script_name, '-method' => 'GET' ) %]
        [% CGI.textfield( {
            name    => 'query',
            size    => 40,
            maxlength => 200,
            } ) %]

        [% CGI.submit('submit','Search!') %]<br>
        [% search.get_meta_name_limits %]
        [% search.get_sort_select_list %]
        [% search.get_index_select_list %]
        [% search.get_limit_select %]
        [% search.get_date_ranges %]
        
    [% CGI.end_form.join('') %]

[% END %]


[% BLOCK nav_bar %]
    [% search.stopwords_removed %]
    <table cellpadding=0 cellspacing=0 border=0 width="100%">
        <tr>
            <td height=20 bgcolor="#FF9999">
                <font size="-1" face="Geneva, Arial, Helvetica, San-Serif">
                &nbsp;Results for <b>[% search.query_simple | html %]</b>
                &nbsp; [% search.navigation('from') %] to [% search.navigation('to') %] of [% search.navigation('hits') %] results.
                </font>
            </td>
            <td align=right bgcolor="#FF9999">
                <font size="-2" face="Geneva, Arial, Helvetica, San-Serif">
                Run time: [% search.navigation('run_time') %] |
                Search time: [% search.navigation('search_time') %] &nbsp; &nbsp;
                </font>
            </td>
        </tr>

        [% IF search.navigation('pages') %]

        <tr>
            <td colspan=2 bgcolor="#EEEEEE">
                [%# PROCESS nav_bar_pages %]
                [% PROCESS nav_bar_pages2 %]
            </td>
        </tr>
        [% END %]

    </table>
[% END %]

[% BLOCK nav_bar_pages %]                
    <font size="-1" face="Geneva, Arial, Helvetica, San-Serif">&nbsp;Page:</font>
    [% search.navigation('pages') %]

    [% IF search.navigation('prev_count') %]
        <a href="[% search.query_href %]&amp;start=[% search.navigation('prev') %]">
        Previous [% search.navigation('prev_count') %]</a>
    [% END %]

    [% IF search.navigation('next_count') %]
        <a href="[% search.query_href %]&amp;start=[% search.navigation('next') %]">
        Next [% search.navigation('next_count') %]</a>
    [% END %]
[% END %]

[%#
    Insead of pre-formatted numeric page links as above, you can use this
    example to generate the pages individually.
    For example, allows using images for page numbers.
%]

[% BLOCK nav_bar_pages2 %]
    &nbsp;

    [% IF search.navigation('prev_count') %]
        <a style="text-decoration:none" href="[% search.query_href %]&amp;start=[% search.navigation('prev') %]">&lt;&lt;</a>
    [% END %]


    [% FOR page = search.navigation('page_array') %]
        [% IF page.cur_page %]
            [[% page.page_number %]]
        [% ELSE %]
            <a style="text-decoration:none" href="[% search.query_href %];start=[% page.page_start %]">[% page.page_number %]</a>
        [% END %]
    [% END %]

    [% IF search.navigation('next_count') %]
        <a style="text-decoration:none" href="[% search.query_href %]&amp;start=[% search.navigation('next') %]">&gt;&gt;</a>
    [% END %]
[% END %]




[% BLOCK results_list %]
    [% FOREACH item = search.results %]
        <dl>
            <dt>
                [% item.swishreccount %]
                 <a href="[% item.swishdocpath_href %]">
                [% ( item.swishtitle || item.swishdocpath )  %]
                </a>

                <small>-- rank: <b>[% item.swishrank %]</b></small>
            </dt>

            <dd>
                [% item.swishdescription %]
                <br>
                <small>
                    [% item.swishdocpath %]
                    - [% item.swishdocsize %] bytes
                    - [% item.swishlastmodified %]
                </small>
            </dd>
        </dl>
    [% END %]
[% END %]