show just hits or all details buttons on result page
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 23 Mar 2003 01:17:49 +0000 (01:17 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 23 Mar 2003 01:17:49 +0000 (01:17 +0000)
git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@47 13eb9ef6-21d5-0310-b721-a9d68796d827

TODO
WebPac.pm
all2xml.conf
template_html/results.html

diff --git a/TODO b/TODO
index 66d9b93..44b060d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -35,3 +35,9 @@ This are notes about WWW interface:
 
 ---------------------------------------------------------------------------
 
+Fix stupid things with HTML::Pager and HTML::Template. Since communication
+between swish and HTML::Pager isn't as good as it should be, I must include
+all fields in output every time, creating huge html comments when you want
+just hits (I could turn off die_on_bad_params in HTML::Template, but there
+should be better way...)
+
index d79040b..5911d54 100644 (file)
--- a/WebPac.pm
+++ b/WebPac.pm
@@ -67,6 +67,9 @@ sub show_results_list {
 
        my @s_arr;      # all queries are located here
 
+       my @path_arr = $q->param('path');
+       my $full = $q->param('full');
+
        for(my $i = 1; $i <=10; $i++) {
 
                return show_index($self, $i) if ($q->param("f".$i."_index"));
@@ -115,15 +118,24 @@ sub show_results_list {
 
                },
                #startnum => 0,
-               maxhits => $MAX_HITS,
+               maxhits => $MAX_HITS
        );
 
        die $SWISH::errstr unless $sh;
 
-       my $hits = $sh->query(join(" and ",@s_arr)) || 0;       # FIX: and/or
+       # construct swish query
+       my $sw_q = join(" and ",@s_arr);
+       if (@path_arr) {
+               $sw_q .= "and (swishdocpath=\"";
+               $sw_q .= join("\" or swishdocpath=\"",@path_arr);
+               $sw_q .= "\")";
+               $tmpl->param('full',1); # show full records
+       }
+
+       my $hits = $sh->query($sw_q);
 
        $tmpl->param('hits',$hits);
-       $tmpl->param('search',join(" and ",@s_arr));
+       $tmpl->param('search',$sw_q);
 
        # create a Pager object
        my $pager = HTML::Pager->new(
index 869c8d6..19094fb 100644 (file)
@@ -2,14 +2,14 @@
 
 # describe your databases here
 
-#[ps-libri]
+[ps-libri]
        # directory for isis databases
-#      isis_db=/data/isis_data/ps/LIBRI/LIBRI
+       isis_db=/data/isis_data/ps/LIBRI/LIBRI
        # this will use xml file in import_xml/ dir
-#      type=isis
+       type=isis
        # this is arbirary xml added to each record (e.g. Library identifier
        # or something like that
-#      xml=<type>Knjiga</type>
+       xml=<type>Knjiga</type>
 
 #[ge-libri]
 #      isis_db=/data/isis_data/ge/LIBRI/LIBRI
index b99665a..6362f9e 100644 (file)
 
 <h2>Rezultati pretra¾ivanja</h2>
 
-<p>Your query <TMPL_VAR search> returned <TMPL_VAR hits> results...</p>
-
 <form>
+
+<p>Your query <TMPL_VAR search> returned <TMPL_VAR hits> results...
+</p>
+
 <TABLE BORDER=0 WIDTH=100%>
 <TR><TD><TABLE BORDER=1 WIDTH=100%>
+
+<TMPL_IF NAME="full">
+
+<input type=submit value="Back to all results">
+
+<TMPL_LOOP NAME="PAGER_DATA_LIST">
+  <TR>
+       <td><TMPL_VAR NAME="nr"></td>
+       <td>
+       <TMPL_VAR NAME="headline">
+       <i><TMPL_VAR NAME="path"></i>
+       <b><TMPL_VAR NAME="rank"></b>
+       </td>
+       </tr>
+       <tr><td colspan="2">
+               <table border=0> <TMPL_VAR NAME="html"> </table>
+       </td></td>
+  </TR>
+</TMPL_LOOP>
+
+<TMPL_ELSE>
+
+<input type=submit value="Display details about checked items">
 <TMPL_LOOP NAME="PAGER_DATA_LIST">
   <TR>
        <td><input type=checkbox name="path" value="<TMPL_VAR NAME="path">"><TMPL_VAR NAME="nr"></td>
        <TMPL_VAR NAME="headline">
        <i><TMPL_VAR NAME="path"></i>
        <b><TMPL_VAR NAME="rank"></b>
+       <!-- FIX: remove this <TMPL_VAR NAME="html"> -->
        </td>
        </tr>
-       <TMPL_IF NAME="full">
-       <tr><td colspan="2"><table border=1><TMPL_VAR NAME="html"></table></td></td>
-       </TMPL_IF>
   </TR>
 </TMPL_LOOP>
+
+</TMPL_IF>
+
 <TR><TD COLSPAN=3 ALIGN=CENTER class="navigacija">
   <TMPL_VAR NAME="PAGER_PREV">
   <TMPL_VAR NAME="PAGER_JUMP">