koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/search.marc suggest.pl,NONE,1.1 search.pl,1.13,1.14


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/search.marc suggest.pl,NONE,1.1 search.pl,1.13,1.14
Date: Fri, 16 Apr 2004 00:28:25 -0700

Update of /cvsroot/koha/koha/search.marc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28364/search.marc

Modified Files:
        search.pl 
Added Files:
        suggest.pl 
Log Message:
improving Search :
* adding "suggestion", that popup a windows. The popup windows shows, for each 
word entered in the search form, the 10 words that sounds like the word 
entered, and that are used most often.
* fixes some minor bugs 

Still to do :
* good support of ' and ,

--- NEW FILE ---
#!/usr/bin/perl
# WARNING: 4-character tab stops here

# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA  02111-1307 USA

use strict;
require Exporter;
use CGI;
use C4::Auth;
use HTML::Template;
use C4::Context;
use C4::Search;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Biblio;
use C4::SearchMarc;
use C4::Catalogue;
use C4::Koha; # XXX subfield_is_koha_internal_p

# Creates the list of active tags using the active MARC configuration
my $query=new CGI;
my $Q=$query->param('Q');
my @words = split / /,$Q;
my $dbh = C4::Context->dbh;

my $suggestions = findsuggestion($dbh,address@hidden);
my @loop_suggests;
foreach my $line (@$suggestions) {
        my ($word,$suggestion,$count) = split /\|/,$line;
        push @loop_suggests, { word => $word, suggestion =>$suggestion, count 
=> $count };
}

my ($template, $loggedinuser, $cookie)
    = get_template_and_user({template_name => "search.marc/suggest.tmpl",
                             query => $query,
                             type => "intranet",
                             authnotrequired => 0,
                             flagsrequired => {editcatalogue => 1},
                             debug => 1,
                             });
$template->param("loop" => address@hidden);

output_html_with_http_headers $query, $cookie, $template->output;
1;
# Local Variables:
# tab-width: 4
# End:

Index: search.pl
===================================================================
RCS file: /cvsroot/koha/koha/search.marc/search.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** search.pl   15 Mar 2004 15:03:35 -0000      1.13
--- search.pl   16 Apr 2004 07:28:22 -0000      1.14
***************
*** 31,34 ****
--- 31,35 ----
  use C4::Biblio;
  use C4::SearchMarc;
+ use C4::Catalogue;
  use C4::Koha; # XXX subfield_is_koha_internal_p
  
***************
*** 183,187 ****
                $to = (($startfrom+1)*$resultsperpage);
        }
- 
        $template->param(result => $results,
                                                        startfrom=> $startfrom,
--- 184,187 ----
***************
*** 195,199 ****
                                                        from=>$from,
                                                        to=>$to,
!                                                       numbers=>address@hidden
                                                        );
  
--- 195,199 ----
                                                        from=>$from,
                                                        to=>$to,
!                                                       numbers=>address@hidden,
                                                        );
  
***************
*** 298,303 ****
        push @statements, { "marclist" => $marclist, "first" => 0 };
        push @statements, { "marclist" => $marclist, "first" => 0 };
  
!       $template->param("statements" => address@hidden, "nbstatements" => 3);
  }
  
--- 298,342 ----
        push @statements, { "marclist" => $marclist, "first" => 0 };
        push @statements, { "marclist" => $marclist, "first" => 0 };
+       my $sth=$dbh->prepare("Select itemtype,description from itemtypes order 
by description");
+       $sth->execute;
+       my  @itemtype;
+       my %itemtypes;
+       push @itemtype, "";
+       $itemtypes{''} = "";
+       while (my ($value,$lib) = $sth->fetchrow_array) {
+               push @itemtype, $value;
+               $itemtypes{$value}=$lib;
+       }
+ 
+       my $CGIitemtype=CGI::scrolling_list( -name     => 'value',
+                               -values   => address@hidden,
+                               -labels   => \%itemtypes,
+                               -size     => 1,
+                               -multiple => 0 );
+       $sth->finish;
+ 
+       my @branches;
+       my @select_branch;
+       my %select_branches;
+       my ($count2,@branches)=branches();
+       push @select_branch, "";
+       $select_branches{''} = "";
+       for (my $i=0;$i<$count2;$i++){
+               push @select_branch, $branches[$i]->{'branchcode'};#
+               $select_branches{$branches[$i]->{'branchcode'}} = 
$branches[$i]->{'branchname'};
+       }
+       my $CGIbranch=CGI::scrolling_list( -name     => 'value',
+                               -values   => address@hidden,
+                               -labels   => \%select_branches,
+                               -size     => 1,
+                               -multiple => 0 );
+       $sth->finish;
+ 
  
!       $template->param("statements" => address@hidden,
!                       "nbstatements" => 3,
!                       CGIitemtype => $CGIitemtype,
!                       CGIbranch => $CGIbranch,
!                       );
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]