Show
Ignore:
Timestamp:
02/06/07 14:53:36 (2 years ago)
Author:
moseley
Message:

More updates getting ready to move to the new host
Combined the two search scripts into one.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • swish_website/lib/page/search.html

    r1629 r1889  
    11[%- # $id$ 
    2     # Page for shwoing search results 
     2    # Page for showing search results 
    33-%] 
    44[%- META 
     
    1111 
    1212    page.title = 'Search'; 
     13    page.no_search = 1; 
     14 
     15    include_javascript( 'search' ); 
    1316 
    1417 
     
    2023    END; 
    2124 
     25    page_ids = {}; 
     26    MACRO radio( name, value, label, checked ) BLOCK; 
     27        page_ids.$name = page_ids.$name + 1; 
     28        id = page_ids.$name; 
     29        ck = checked ? ' checked="checked"' : ''; 
     30        %] 
     31        <input id="[% name; id %]" type="radio" name="[% name %]" value="[% value | html %]"[% ck %]/> 
     32        <label for="[% name; id %]">[% label | html %]</label> 
     33        [% 
     34    END; 
     35 
     36 
     37    MACRO select( name, value, label, checked ) BLOCK; 
     38        ck = checked ? ' selected="selected"' : ''; 
     39        %] 
     40        <option id="[% name; value %]" value="[% value | html %]"[% ck %]>[% label | html %]</option> 
     41        [% 
     42    END; 
     43 
    2244    USE myurl = url( request.myself, query=request.query,  
    2345                     metaname=request.metaname, size=request.pagesize ); 
     
    2648 
    2749 
    28     UNLESS result; 
    29         message( "Must enter a query" ); 
    30     ELSE; 
    31  
     50 
     51    PROCESS search_form; 
     52 
     53 
     54    IF result; 
    3255        # Show results 
    3356 
    3457        message( result.message ) IF result.message; 
     58 
    3559 
    3660        IF result.results.size; 
     
    4973</div> 
    5074 
     75<div id="hidingplace" style="display:none"></div> 
     76 
     77 
     78 
     79[% BLOCK search_form %] 
     80<form id="searchform" method="get" action="index.html"> 
     81    <h2>Enter your query</h2> 
     82    <div id="simpleform"> 
     83        <input type="text" size="30" name="query" /> 
     84        <input type="submit" name="submit" value="Search!" /> 
     85    </div> 
     86    <div id="advancedform" style="display: none"> 
     87        <input id="advflag" name="adv" type="hidden" value="0" /> 
     88        Limit to: 
     89        [% 
     90            radio( 'meta', '', 'Subject/Title & Body', 1 ); 
     91            radio( 'meta', 'title', 'Subject/Title' ); 
     92            radio( 'meta', 'name', "Poster's Name" ); 
     93            radio( 'meta', 'email', "Poster's Email" ); 
     94        %] 
     95 
     96        <br /> 
     97 
     98        Search: 
     99        <select name="section"> 
     100        [% 
     101            select( 'section', '', 'Everywhere',1 ); 
     102            select( 'section', 'docs', 'Documentation' ); 
     103            select( 'section', 'devel', 'Development Docs' ); 
     104            select( 'section', 'archive', 'List Archives' ); 
     105            select( 'section', 'website', 'Site web pages' ); 
     106        %] 
     107        </select> 
     108 
     109        Sort by: 
     110        <select name="sort"> 
     111            <option value="rank">Rank</option> 
     112            <option value="title">Subject/Title</option> 
     113            <option value="email">Email</option> 
     114            <option value="date">Date</option> 
     115        </select> 
     116        <input id="rsort" type="checkbox" name="reverse" /><label for="rsort">Reverse Sort</label> 
     117 
     118        <br /> 
     119        Limit to date: 
     120        [% 
     121            radio( 'date', '', 'All', 1); 
     122            radio( 'date', 'day', 'Today' ); 
     123            radio( 'date', 'week', 'This Week' ); 
     124            radio( 'date', 'month', 'This Month' ); 
     125            radio( 'date', '90', 'Last 90 Days' ); 
     126            '<br />'; 
     127            radio( 'date', 'select', 'Select date range' ); 
     128 
     129 
     130            PROCESS select_date name = 's'; 
     131            ' through '; 
     132            PROCESS select_date name = 'e'; 
     133        %] 
     134    </div><!-- /#advancedform --> 
     135</form> 
     136[% END %] 
     137 
     138[% BLOCK select_date %] 
     139    <select name="[% name %]month"> 
     140        <option value="1">Jan</option> 
     141        <option value="2">Feb</option> 
     142        <option value="3">Mar</option> 
     143        <option value="4">Apr</option> 
     144        <option value="5">May</option> 
     145        <option value="6">Jun</option> 
     146        <option value="7">Jul</option> 
     147        <option value="8">Aug</option> 
     148        <option value="9">Sep</option> 
     149        <option value="10">Oct</option> 
     150        <option value="11">Nov</option> 
     151        <option value="12">Dec</option> 
     152    </select> 
     153    &nbsp; 
     154    <select name="[% name %]day"> 
     155    [% i = 1;  WHILE i < 32 %] 
     156        <option value="[% i %]">[% i %]</option> 
     157    [% i = i + 1; END %] 
     158    </select> 
     159    &nbsp; 
     160    <select name="[% name %]year"> 
     161    [% i = cur_year; WHILE i > 1995 %] 
     162        <option value="[% i %]">[% i %]</option> 
     163    [% i = i - 1; END %] 
     164    </select> 
     165[% END %] 
     166 
     167 
     168 
    51169 
    52170 
     
    67185<div class="search-header"> 
    68186    Results for <b>[% request.query | html %]</b><br /> 
     187</div> 
     188[% END %] 
     189 
     190 
     191 
     192 
     193[% BLOCK next_links %] 
    69194    Showing page [% result.page %]  
    70195    ([% result.start +1 %] - [% (result.start + result.shown) %] of [% result.hits %] hits)  
    71196 
    72 </div> 
    73 [% END %] 
    74  
    75  
    76  
    77  
    78 [% BLOCK next_links %] 
    79197    [% IF result.prev %] 
    80198       <a class="next" href="[% myurl( page=result.prev ) %]">Previous</a> 
     
    94212    %] 
    95213 
    96     <div class="search-title"> 
    97  
     214    <h2 id="result-heading"> 
     215        <a href="[% item.Property('swishdocpath') %]"> 
     216            [%  item.Property('swishtitle') || 'missing title' | highlight('swishtitle', item ) %] 
     217        </a> 
     218    </h2> 
     219 
     220    <div class="search-subtitle"> 
    98221        [% IF is_list %] 
    99222            <span class='indxtype'>[List Archive]</span> 
     
    104227        [% END %] 
    105228 
    106         <a href="[% item.Property('swishdocpath') %]"> 
    107             [%  item.Property('swishtitle') || 'missing title' | highlight('swishtitle', item ) %]</a> 
    108  
    109         <span class="search-rank"> -- rank: <b>[% item.Property('swishrank') %]</b></span> 
     229        <span class="search-rank">Rank: <b>[% item.Property('swishrank') %]</b></span> 
    110230    </div> 
    111231 
     
    134254        SET name    = item.Property('name'); 
    135255        SET email   = item.Property('email'); 
    136         SET name_href = myurl( query="name=\"$name\"" ); 
    137         SET email_href = myurl( query="email=\"$email\"" ); 
     256        SET name_href = myurl( query="\"$name\"", meta="name" ); 
     257        SET email_href = myurl( query="\"$email\"", meta="email" ); 
    138258    %] 
    139259