koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/opac opac-account.pl opac-addbookbybiblion... [dev_week]


From: Joshua Ferraro
Subject: [Koha-cvs] koha/opac opac-account.pl opac-addbookbybiblion... [dev_week]
Date: Fri, 18 Aug 2006 16:14:16 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Joshua Ferraro <kados>  06/08/18 16:14:16

Modified files:
        opac           : opac-account.pl opac-addbookbybiblionumber.pl 
                         opac-authoritiesdetail.pl 
                         opac-authorities-home.pl opac-detail.pl 
                         opac-ISBDdetail.pl opac-main.pl 
                         opac-MARCdetail.pl opac-passwd.pl 
                         opac-readingrecord.pl opac-reserve.pl 
                         opac-serial-issues.pl opac-shelves.pl 
                         opac-suggestions.pl opac-userdetails.pl 
                         opac-user.pl opac-userupdate.pl 
Added files:
        opac           : livesearch.advanced.pl search 

Log message:
        Adding langauge switching options to all scripts. Some general cleanup
        on module namespaces.
        
        Adding livesearch.advanced.pl and search

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-account.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.8.2.6&r2=1.8.2.6.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-addbookbybiblionumber.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.6.2.2&r2=1.1.2.6.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-authoritiesdetail.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.2.2.1&r2=1.1.2.2.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-authorities-home.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.6.2.1&r2=1.1.2.6.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-detail.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.14.2.19.2.2&r2=1.14.2.19.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-ISBDdetail.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.5.2.10&r2=1.5.2.10.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-main.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.16.2.10&r2=1.16.2.10.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-MARCdetail.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.4.2.14.2.1&r2=1.4.2.14.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-passwd.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.4&r2=1.1.2.4.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-readingrecord.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.6.2.6&r2=1.6.2.6.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-reserve.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.22.2.9&r2=1.22.2.9.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-serial-issues.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.10&r2=1.1.2.10.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-shelves.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.3.2.8&r2=1.3.2.8.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-suggestions.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.3.2.7&r2=1.3.2.7.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-userdetails.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.8.2.6&r2=1.8.2.6.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-user.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.14.2.9.2.2&r2=1.14.2.9.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-userupdate.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.11.2.5.2.1&r2=1.11.2.5.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/opac/livesearch.advanced.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/search?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1

Patches:
Index: opac-account.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-account.pl,v
retrieving revision 1.8.2.6
retrieving revision 1.8.2.6.2.1
diff -u -b -r1.8.2.6 -r1.8.2.6.2.1
--- opac-account.pl     8 Mar 2006 13:46:55 -0000       1.8.2.6
+++ opac-account.pl     18 Aug 2006 16:14:15 -0000      1.8.2.6.2.1
@@ -23,6 +23,12 @@
                             debug => 1,
                             });
 
+# load languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 

Index: opac-addbookbybiblionumber.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-addbookbybiblionumber.pl,v
retrieving revision 1.1.2.6.2.2
retrieving revision 1.1.2.6.2.3
diff -u -b -r1.1.2.6.2.2 -r1.1.2.6.2.3
--- opac-addbookbybiblionumber.pl       3 Aug 2006 05:25:42 -0000       
1.1.2.6.2.2
+++ opac-addbookbybiblionumber.pl       18 Aug 2006 16:14:15 -0000      
1.1.2.6.2.3
@@ -2,7 +2,7 @@
 #script to provide bookshelf management
 # WARNING: This file uses 4-character tabs!
 #
-# $Header: /sources/koha/koha/opac/opac-addbookbybiblionumber.pl,v 1.1.2.6.2.2 
2006/08/03 05:25:42 kados Exp $
+# $Header: /sources/koha/koha/opac/opac-addbookbybiblionumber.pl,v 1.1.2.6.2.3 
2006/08/18 16:14:15 kados Exp $
 #
 # Copyright 2000-2002 Katipo Communications
 #
@@ -46,6 +46,11 @@
                                                        authnotrequired => 1,
                                                });
 
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 my $x; # for trash
 ($x,$x,$shelfnumber) = AddShelf('',$newbookshelf,$loggedinuser,$category) if 
$newbookshelf;
 
@@ -92,6 +97,12 @@
        output_html_with_http_headers $query, $cookie, $template->output;
 }
 # $Log: opac-addbookbybiblionumber.pl,v $
+# Revision 1.1.2.6.2.3  2006/08/18 16:14:15  kados
+# Adding langauge switching options to all scripts. Some general cleanup
+# on module namespaces.
+#
+# Adding livesearch.advanced.pl and search
+#
 # Revision 1.1.2.6.2.2  2006/08/03 05:25:42  kados
 # sync with rel_2_2, the bugfixes I made today
 #

Index: opac-authoritiesdetail.pl
===================================================================
RCS file: /sources/koha/koha/opac/Attic/opac-authoritiesdetail.pl,v
retrieving revision 1.1.2.2.2.1
retrieving revision 1.1.2.2.2.2
diff -u -b -r1.1.2.2.2.1 -r1.1.2.2.2.2
--- opac-authoritiesdetail.pl   3 Aug 2006 05:25:42 -0000       1.1.2.2.2.1
+++ opac-authoritiesdetail.pl   18 Aug 2006 16:14:15 -0000      1.1.2.2.2.2
@@ -70,6 +70,12 @@
                             debug => 1,
                             });
 
+# load languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 my $record;
 if (C4::Context->preference("AuthDisplayHierarchy")){
   my $trees=BuildUnimarcHierarchies($authid);

Index: opac-authorities-home.pl
===================================================================
RCS file: /sources/koha/koha/opac/Attic/opac-authorities-home.pl,v
retrieving revision 1.1.2.6.2.1
retrieving revision 1.1.2.6.2.2
diff -u -b -r1.1.2.6.2.1 -r1.1.2.6.2.2
--- opac-authorities-home.pl    21 Jul 2006 17:46:48 -0000      1.1.2.6.2.1
+++ opac-authorities-home.pl    18 Aug 2006 16:14:15 -0000      1.1.2.6.2.2
@@ -75,6 +75,13 @@
                                debug => 1,
                                });
 
+       
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
        # multi page display gestion
        my $displaynext=0;
        my $displayprev=$startfrom;
@@ -152,6 +159,13 @@
                                flagsrequired => {catalogue => 1},
                                debug => 1,
                                });
+
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
 #      $template->param("statements" => address@hidden,
 #                                              "nbstatements" => 
$nbstatements);
 }
@@ -166,6 +180,12 @@
                                debug => 1,
                                });
 
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
        # Gets the entered information
        my @marcfields = $query->param('marclist');
        my @and_or = $query->param('and_or');
@@ -238,6 +258,12 @@
                                debug => 1,
                                });
 
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
 }
 
 $template->param(authtypesloop => address@hidden,

Index: opac-detail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-detail.pl,v
retrieving revision 1.14.2.19.2.2
retrieving revision 1.14.2.19.2.3
diff -u -b -r1.14.2.19.2.2 -r1.14.2.19.2.3
--- opac-detail.pl      3 Aug 2006 05:25:42 -0000       1.14.2.19.2.2
+++ opac-detail.pl      18 Aug 2006 16:14:15 -0000      1.14.2.19.2.3
@@ -18,6 +18,12 @@
                             flagsrequired => {borrow => 1},
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 my $biblionumber=$query->param('bib');
 $template->param(biblionumber => $biblionumber);
 

Index: opac-ISBDdetail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-ISBDdetail.pl,v
retrieving revision 1.5.2.10
retrieving revision 1.5.2.10.2.1
diff -u -b -r1.5.2.10 -r1.5.2.10.2.1
--- opac-ISBDdetail.pl  8 Mar 2006 13:46:55 -0000       1.5.2.10
+++ opac-ISBDdetail.pl  18 Aug 2006 16:14:15 -0000      1.5.2.10.2.1
@@ -99,6 +99,12 @@
                                subscriptionsnumber => $subscriptionsnumber,
 );
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 my $ISBD = C4::Context->preference('ISBD');
 # my @blocs = split /\@/,$ISBD;
 # my @fields = $record->fields();

Index: opac-main.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-main.pl,v
retrieving revision 1.16.2.10
retrieving revision 1.16.2.10.2.1
diff -u -b -r1.16.2.10 -r1.16.2.10.2.1
--- opac-main.pl        3 Apr 2006 10:29:23 -0000       1.16.2.10
+++ opac-main.pl        18 Aug 2006 16:14:15 -0000      1.16.2.10.2.1
@@ -46,22 +46,18 @@
                             authnotrequired => 1,
                             flagsrequired => {borrow => 1},
                         });
-my $borrower = getmember('',$borrowernumber);
-my @options;
-my $counter=0;
-foreach my $language (getalllanguages()) {
-       next if $language eq 'images';
-       next if $language eq 'CVS';
-       next if $language=~ /png$/;
-       next if $language=~ /css$/;
-       my $selected='0';
-#                            next if 
$currently_selected_languages->{$language};
-       push @options, { language => $language, counter => $counter };
-       $counter++;
+
+# load the languages
+my @languages_options = displayLanguages($input);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
 }
-my $languages_count = @options;
+my $borrower = getmember('',$borrowernumber);
+my @languages_options = displayLanguages($input);
+my $languages_count = @languages_options;
 if($languages_count > 1){
-               $template->param(languages => address@hidden);
+               $template->param(languages => address@hidden);
 }
 $template->param(itemtypeloop => address@hidden,
                                branchloop=>address@hidden,

Index: opac-MARCdetail.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-MARCdetail.pl,v
retrieving revision 1.4.2.14.2.1
retrieving revision 1.4.2.14.2.2
diff -u -b -r1.4.2.14.2.1 -r1.4.2.14.2.2
--- opac-MARCdetail.pl  11 Jul 2006 14:16:46 -0000      1.4.2.14.2.1
+++ opac-MARCdetail.pl  18 Aug 2006 16:14:15 -0000      1.4.2.14.2.2
@@ -79,6 +79,12 @@
                             debug => 1,
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # fill arrays
 my @loop_data =();
 my $tag;

Index: opac-passwd.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-passwd.pl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.4.2.1
diff -u -b -r1.1.2.4 -r1.1.2.4.2.1
--- opac-passwd.pl      8 Mar 2006 13:46:55 -0000       1.1.2.4
+++ opac-passwd.pl      18 Aug 2006 16:14:15 -0000      1.1.2.4.2.1
@@ -41,6 +41,12 @@
                             debug => 1,
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 my $sth = $dbh->prepare("UPDATE borrowers SET password = ? WHERE 
borrowernumber=?");

Index: opac-readingrecord.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-readingrecord.pl,v
retrieving revision 1.6.2.6
retrieving revision 1.6.2.6.2.1
diff -u -b -r1.6.2.6 -r1.6.2.6.2.1
--- opac-readingrecord.pl       8 Mar 2006 13:46:55 -0000       1.6.2.6
+++ opac-readingrecord.pl       18 Aug 2006 16:14:15 -0000      1.6.2.6.2.1
@@ -21,6 +21,12 @@
                             debug => 1,
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 

Index: opac-reserve.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.22.2.9
retrieving revision 1.22.2.9.2.1
diff -u -b -r1.22.2.9 -r1.22.2.9.2.1
--- opac-reserve.pl     18 Apr 2006 19:49:13 -0000      1.22.2.9
+++ opac-reserve.pl     18 Aug 2006 16:14:15 -0000      1.22.2.9.2.1
@@ -27,6 +27,12 @@
                             debug => 1,
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 # my @bordat;

Index: opac-serial-issues.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-serial-issues.pl,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.10.2.1
diff -u -b -r1.1.2.10 -r1.1.2.10.2.1
--- opac-serial-issues.pl       8 Mar 2006 13:46:55 -0000       1.1.2.10
+++ opac-serial-issues.pl       18 Aug 2006 16:14:15 -0000      1.1.2.10.2.1
@@ -36,6 +36,12 @@
                                        debug => 1,
                                        });
        
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
        # replace CR by <br> in librarian note
        # $subscription->{opacnote} =~ s/\n/\<br\/\>/g;
        
@@ -60,6 +66,13 @@
                                        debug => 1,
                                        });
        
+       
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
        # replace CR by <br> in librarian note
        # $subscription->{opacnote} =~ s/\n/\<br\/\>/g;
        

Index: opac-shelves.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-shelves.pl,v
retrieving revision 1.3.2.8
retrieving revision 1.3.2.8.2.1
diff -u -b -r1.3.2.8 -r1.3.2.8.2.1
--- opac-shelves.pl     8 Mar 2006 13:46:55 -0000       1.3.2.8
+++ opac-shelves.pl     18 Aug 2006 16:14:15 -0000      1.3.2.8.2.1
@@ -2,7 +2,7 @@
 #script to provide bookshelf management
 # WARNING: This file uses 4-character tabs!
 #
-# $Header: /sources/koha/koha/opac/opac-shelves.pl,v 1.3.2.8 2006/03/08 
13:46:55 tipaul Exp $
+# $Header: /sources/koha/koha/opac/opac-shelves.pl,v 1.3.2.8.2.1 2006/08/18 
16:14:15 kados Exp $
 #
 # Copyright 2000-2002 Katipo Communications
 #
@@ -41,6 +41,12 @@
                                                        authnotrequired => 1,
                                                });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 if ($query->param('modifyshelfcontents')) {
        my $shelfnumber=$query->param('shelfnumber');
        my $barcode=$query->param('addbarcode');
@@ -184,6 +190,12 @@
 
 #
 # $Log: opac-shelves.pl,v $
+# Revision 1.3.2.8.2.1  2006/08/18 16:14:15  kados
+# Adding langauge switching options to all scripts. Some general cleanup
+# on module namespaces.
+#
+# Adding livesearch.advanced.pl and search
+#
 # Revision 1.3.2.8  2006/03/08 13:46:55  tipaul
 # some opac systempreferences are set by all pages.
 # Moving the $template->param where the template is open. This way, nothing 
can be forgotten, and code is more readable. Feel free to move to Auth.pm any 
new systempref

Index: opac-suggestions.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-suggestions.pl,v
retrieving revision 1.3.2.7
retrieving revision 1.3.2.7.2.1
diff -u -b -r1.3.2.7 -r1.3.2.7.2.1
--- opac-suggestions.pl 4 Apr 2006 14:07:33 -0000       1.3.2.7
+++ opac-suggestions.pl 18 Aug 2006 16:14:15 -0000      1.3.2.7.2.1
@@ -34,6 +34,13 @@
                                                                type => "opac",
                                                                authnotrequired 
=> 1,
                                                        });
+
+       # load the languages
+       my @languages_options = displayLanguages($input);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
 if (!$borrowernumber) {
        $borrowernumber = C4::Context->preference("AnonSuggestions");
 }
@@ -44,6 +51,13 @@
                                                                type => "opac",
                                                                authnotrequired 
=> 1,
                         });
+
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+        $template->param(languages => address@hidden);
+       }
 }
 
 if ($op eq "add_confirm") {

Index: opac-userdetails.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-userdetails.pl,v
retrieving revision 1.8.2.6
retrieving revision 1.8.2.6.2.1
diff -u -b -r1.8.2.6 -r1.8.2.6.2.1
--- opac-userdetails.pl 8 Mar 2006 13:46:55 -0000       1.8.2.6
+++ opac-userdetails.pl 18 Aug 2006 16:14:15 -0000      1.8.2.6.2.1
@@ -21,6 +21,12 @@
                             debug => 1,
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 

Index: opac-user.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-user.pl,v
retrieving revision 1.14.2.9.2.2
retrieving revision 1.14.2.9.2.3
diff -u -b -r1.14.2.9.2.2 -r1.14.2.9.2.3
--- opac-user.pl        23 Jul 2006 15:26:29 -0000      1.14.2.9.2.2
+++ opac-user.pl        18 Aug 2006 16:14:15 -0000      1.14.2.9.2.3
@@ -22,6 +22,12 @@
                             debug => 1,
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 

Index: opac-userupdate.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-userupdate.pl,v
retrieving revision 1.11.2.5.2.1
retrieving revision 1.11.2.5.2.2
diff -u -b -r1.11.2.5.2.1 -r1.11.2.5.2.2
--- opac-userupdate.pl  3 Aug 2006 05:25:42 -0000       1.11.2.5.2.1
+++ opac-userupdate.pl  18 Aug 2006 16:14:15 -0000      1.11.2.5.2.2
@@ -23,6 +23,12 @@
                             debug => 1,
                             });
 
+# load the languages
+my @languages_options = displayLanguages($query);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 
@@ -42,6 +48,12 @@
                             debug => 1,
                             });
 
+       # load the languages
+       my @languages_options = displayLanguages($query);
+       my $languages_count = @languages_options;
+       if($languages_count > 1){
+            $template->param(languages => address@hidden);
+       }
     $template->param(errormessage => 'KohaAdminEmailAddress system preference
     is not set.  Please visit the library to update your user record');
 

Index: livesearch.advanced.pl
===================================================================
RCS file: livesearch.advanced.pl
diff -N livesearch.advanced.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ livesearch.advanced.pl      18 Aug 2006 16:14:15 -0000      1.1.2.1
@@ -0,0 +1,78 @@
+#!/usr/bin/perl -w
+#use C4::Context;
+#use Apache::DBI;
+use CGI;
+use C4::Context;
+
+my $cgi = new CGI;
+my $zconn=C4::Context->Zconn("biblioserver");
+
+binmode(STDOUT, "utf8"); #output as utf8
+
+print $cgi->header( -type =>'text/xml' );
+
+#my $dbh=DBI->connect("DBI:mysql:demosuggest:localhost","sugg","Free2cirC");
+#my $dbh = C4::Context->dbh;
+
+my $word = $cgi->param('value');
+
+
+if ($word) {
+       # strip out bad stuff -- this takes too long!
+       $word =~ tr/A-Z/a-z/;
+        $word =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\})/ /g;
+        $word =~s/  / /g;      
+#      $word =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\Athe |\Aa |\Aan 
)//g;
+       #$word  .= "\%";
+       #$word = "&quot;".$word."&quot;";
+       my $query = "\"$word\"";
+       if ($query =~ / /) {
+               $query = "address@hidden 6=2 $query";
+       }
+       warn "$query";
+       my $result;
+       eval {
+               my $zoom_query_obj = new ZOOM::Query::PQF($query);
+               $result = $zconn->scan($zoom_query_obj);
+       };
+       if ($@) {
+               die "error connecting to Zebra".$@;
+       }
+       my $numresults = 0 | $result->size() if  ($result);
+       my $outstring="<?xml version='1.0' encoding='utf-8'  ?>";
+       $outstring="<h2 style=\"margin-top: 10px;\">Top 9 search results</h2>";
+       $outstring="<p>Term: &#8216;<span class=\"highlight0\"><a 
href=\"/cgi-bin/koha/livesearch.pl/?value=$query\" title=\"Search for this 
term\">$query</a></span>&#8217;</p>";
+        $outstring.="<ul>";
+
+       for ( my $i=1; $i<=10; $i++){
+               my ($suggest,$count) = $result->term($i-1);
+               my $length=length($suggest);
+               $query=$suggest;
+#              $query =~ 
s/(\'s|&|\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\/|)//g;
+               #$outstring.="<li class=\"LSRow\" 
onmouseover=\"liveSearchHover(this)\" onclick=\"liveSearchClicked(this)\"><a 
href="."\"http://zoomopac.liblime.com/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;cql_query=&quot;$query&quot;\";>\n$suggest";
+               $outstring.="
+<li>
+<dl>
+<dt class=\"ls-title\"><a 
href=\"/cgi-bin/koha/opac-zoomsearch.pl?op=\"get_results\"&cql_query=\"$suggest\"/\"
 title=\"\">$suggest</a></dt>
+<dd class=\"ls-cmnts\"><small><a 
href=\"/cgi-bin/koha/opac-zoomsearch.pl?op=\"get_results\"&cql_query=\"$suggest\"\"
 title=\"Read current comments and post your own\">($count)</a></small></dd>
+<dd class=\"ls-data\">
+<p class=\"ls-sum\"><span>Summary:</span> NPL LiveSearch Test</p><p 
class=\"ls-snip\"><span>Snippet:</span> &#8220;NPL LiveSearch 
Testing&#8230;&#8221;</p><div class=\"btm\">
+
+<p class=\"ls-stats\"><span>Stats:</span> 255 words, 1 image</p>
+<p class=\"ls-time\"><span>Posted:</span> 1 year, 7 months ago</p>
+<br />
+</div>
+</dd>
+</dl>
+</li>"
+
+
+
+#              $outstring.="\n</a>\n<span class=\"LSResRight\">$count 
results</span></li>";
+       }
+       $outstring.="
+</ul>
+<p style=\"padding-top: 10px;\"><a href=\"/blog/search/?q=aa\" title=\"View 
complete result listings for this search\">View all 11 results&#8230;</a></p>";
+       print $outstring;
+}
+

Index: search
===================================================================
RCS file: search
diff -N search
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ search      18 Aug 2006 16:14:15 -0000      1.1.2.1
@@ -0,0 +1,591 @@
+#!/usr/bin/perl
+use strict;                    # always use
+#use warnings;         # use only for development
+
+## load our Koha modules
+use C4::Context;
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Search;
+use C4::Biblio;
+use C4::Koha;
+use POSIX qw(ceil floor);
+
+# create a new CGI object
+use CGI;
+my $cgi = new CGI;
+
+my ($template,$borrowernumber,$cookie);
+
+# decide which template to use
+my $do = $cgi->param("do");
+my $template_name;
+if ((lc($do) =~/search/)|| $cgi->param("q")) {
+       warn "loading results";
+       $template_name = 'opac-results.tmpl';
+}
+else {
+       warn "loading adv search page";
+       $template_name = 'opac-advsearch.tmpl';
+}
+
+# load the template
+($template, $borrowernumber, $cookie) = get_template_and_user({
+    template_name => $template_name,
+    query => $cgi,
+    type => "opac",
+    authnotrequired => 1,}
+);
+
+# load the branches
+my $branches = getallbranches();
+my @branch_loop;
+push @branch_loop, {value => "", branchname => "All Branches", };
+for my $branch_hash (keys %$branches) {
+       push @branch_loop, {value => "branch: $branch_hash", branchname => 
$branches->{$branch_hash}->{'branchname'}, };        
+}
+
+# load the itemtypes
+my ($itemtypecount,@item_type_loop) = getitemtypes();
+$template->param(itemtypeloop=>address@hidden,);
+
+# load the languages
+my @languages_options = displayLanguages($cgi);
+my $languages_count = @languages_options;
+if($languages_count > 1){
+        $template->param(languages => address@hidden);
+}
+# load the servers
+my $outer_servers_loop = [
+       { inner_servers_loop => [
+               {label => C4::Context->preference('LibraryName')." Catalog", 
id=>"NPL", name=>"server", 
value=>"localhost:9900/biblios",checked=>"checked",icon => "npl.png",zed => 
"1"},
+               {label => "OPLIN Databases", id=>"OPLIN", name=>"server", 
value=>"",checked=>"",icon => "oplin.ico",zed => "1"},
+       ],
+       },
+];
+$template->param(outer_servers_loop =>  $outer_servers_loop,);
+
+my $outer_sup_servers_loop = [
+       { inner_sup_servers_loop => [
+               {label => "Google", id=>"GOOG", value=>"google",icon => 
"google.ico",opensearch => "1"},
+               {label => "Yahoo", id=>"YAH", value=>"yahoo", icon 
=>"yahoo.ico", zed => "1"},
+               {label => "Worldcat", id=>"WCT", value=>"worldcat", icon => 
"worldcat.gif", zed => "1"},
+               {label => "Library of Congress", id=>"LOC", name=> "server", 
value=>"z3950.loc.gov:7090/Voyager", icon =>"loc.ico", zed => "1"},
+       ],
+       },
+];
+$template->param(outer_sup_servers_loop => $outer_sup_servers_loop,);
+
+# Here's a loop that can eventually be stored in the database
+# to store limit types and how to display them
+my $outer_limit_types_loop = [
+
+{ inner_limit_types_loop => [
+       {label => "Books",
+       id => "mc-bks",
+       name => "limit",
+       value => "mc:t",
+       icon => "AF.gif",
+       title => "Books, Pamphlets, Technical reports, Manuscripts, Legal 
papers, Theses and dissertations",},
+
+       {label => "Visual Materials",
+    id => "mc-vis",
+    name => "limit",
+       value => "mc:v",
+       icon => "AV Aids.gif",
+    title => "Motion pictures, Videorecordings, Filmstrips, Slides, 
Transparencies, Photos, Cards, Charts, Drawings",},
+
+       {label => "Sound Recordings",
+    id => "mc-sr",
+    name => "limit",
+       value => "mc:s",
+       icon => "AF.gif",
+    title => "Musical, Spoken, Books on Tape, etc. on DVD, CD, Cassette, and 
LP recordings",},
+
+       ],
+},
+{ inner_limit_types_loop => [
+    {label => "Computer Files",
+    id => "mc-cf",
+    name => "limit",
+    value => "mc:c",
+       icon => "CD-ROM software.gif",
+    title => "Computer files, Data, Software",},
+
+    {label => "Local History Materials",
+    id => "mc-lh",
+    name => "limit",
+    value => "mt-collection:LH",
+       icon => "Local history.gif",
+    title => "Local History Materials",},
+
+    {label => "Maps",
+    id => "mc-map",
+    name => "limit",
+    value => "mc:a",
+       icon => "PF.gif ",
+    title => "Maps, Globes",},
+    ],
+},
+
+];
+
+$template->param(outer_limit_types_loop =>  $outer_limit_types_loop,);
+
+# Here's a loop that can eventually be stored in the database used to 
+# display the advanced search input boxes, indexes, boolean, etc.
+my $indexes = [
+    { value => 'kw', label => 'Keyword' },
+    { value => 'au', label => 'Author' },
+    { value => 'au,phr', label => '&nbsp;&nbsp;&nbsp;&nbsp; Author Phrase' },
+#    { value => 'cpn', label => '&nbsp;&nbsp;&nbsp;&nbsp; Corporate Name' },
+#      { value => 'cfn', label => '&nbsp;&nbsp;&nbsp;&nbsp; Conference Name' },
+#   { value => 'cpn,phr', label => '&nbsp;&nbsp;&nbsp;&nbsp; Corporate Name 
Phrase' },
+#      { value => 'cfn,phr', label => '&nbsp;&nbsp;&nbsp;&nbsp; Conference 
Name Phrase' },
+#    { value => 'pn', label => '&nbsp;&nbsp;&nbsp;&nbsp; Personal Name' },
+#    { value => 'pn,phr', label => '&nbsp;&nbsp;&nbsp;&nbsp; Personal Name 
Phrase' },
+#    { value => 'ln', label => 'Language' },
+#    { value => 'mt', label => 'Material Type' },
+#    { value => 'mt,phr', label => 'Material Type Phrase' },
+#    { value => 'mc', label => 'Musical Composition' },
+#    { value => 'mc,phr', label => 'Musical Composition Phrase' },
+
+    { value => 'nt', label => 'Notes/Comments' },
+    { value => 'pb', label => 'Publisher' },
+    { value => 'pl', label => 'Publisher Location' },
+    { value => 'sn', label => 'Standard Number' },
+    { value => 'nb', label => '&nbsp;&nbsp;&nbsp;&nbsp; ISBN' },
+    { value => 'ns', label => '&nbsp;&nbsp;&nbsp;&nbsp; ISSN' },
+       { value => 'lcn', label => '&nbsp;&nbsp;&nbsp;&nbsp; Call Number' },
+    { value => 'su', label => 'Subject' },
+    { value => 'su,phr', label => '&nbsp;&nbsp;&nbsp;&nbsp; Subject Phrase' },
+#    { value => 'de', label => '&nbsp;&nbsp;&nbsp;&nbsp; Descriptor' },
+#    { value => 'ge', label => '&nbsp;&nbsp;&nbsp;&nbsp; Genre/Form' },
+#    { value => 'gc', label => '&nbsp;&nbsp;&nbsp;&nbsp; Geographic Coverage' 
},
+
+#    { value => 'nc', label => '&nbsp;&nbsp;&nbsp;&nbsp; Named Corporation and 
Conference' },
+#    { value => 'na', label => '&nbsp;&nbsp;&nbsp;&nbsp; Named Person' },
+
+    { value => 'ti', label => 'Title' },
+    { value => 'ti,phr', label => '&nbsp;&nbsp;&nbsp;&nbsp; Title Phrase' },
+    { value => 'se', label => '&nbsp;&nbsp;&nbsp;&nbsp; Series Title' },
+                       
+];
+my @search_boxes_array;
+my $search_boxes_count = 3;
+for (my $i=0;$i<=$search_boxes_count;$i++) {
+       my $this_index address@hidden; # clone the data, not just the reference
+       address@hidden>{selected} = "selected";
+       if ($i==0) {
+               push @search_boxes_array, 
+                       {indexes => $this_index,
+                       search_boxes_label => "<span class='labels'>Search 
for:</span>",
+                       scan_index => "<label for='scan'></label><input 
type='checkbox' name='scan' id='scan' value='1'/>Scan Indexes",
+                       };
+
+    } 
+       elsif ($i==$search_boxes_count) {
+        push @search_boxes_array,
+            {indexes => $indexes,
+            left_content => " <select name='op'><option value='and' 
selected='selected'>and</option><option value='or'>or</option><option 
value='not'>not</option></select>",
+                       add_field => "1"};
+       } 
+       else {
+               push @search_boxes_array,
+                       {indexes => $indexes,
+                       left_content => " <select name='op'><option value='and' 
selected='selected'>and</option><option value='or'>or</option><option 
value='not'>not</option></select>",};
+       }
+}
+$template->param(search_boxes_loop => address@hidden,);
+
+# Here's another loop that will eventually be stored in the database
+# It controls the languages that show up in the language limit section of the
+# advanced search page
+my $languages_loop = [
+       {value => "", language_label => "No Limit", locale_label => "",selected 
=> "selected",},
+       {value => "ln:ara", language_label => 
"&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;", locale_label => 
"Arabic",,},
+       {value => "ln:bul", language_label => 
"&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;", locale_label 
=> "Bulgarian",,},
+       {value => "ln:chi", language_label => "&#20013;&#25991;", locale_label 
=> "Chinese",,},
+       {value => "ln:scr", language_label => "Hrvatski", locale_label => 
"Croatian",,},
+    {value => "ln:cze", language_label => "&#x010D;e&#353;tina", locale_label 
=> "Czech",,},
+    {value => "ln:dan", language_label => "D&aelig;nsk", locale_label => 
"Danish",,},
+    {value => "ln:dut", language_label => "ned&#601;rl&#593;ns", locale_label 
=> "Dutch",,},
+    {value => "ln:eng", language_label => "English", locale_label => "",,},
+    {value => "ln:fre", language_label => "Fran&ccedil;ais", locale_label => 
"French",,},
+    {value => "ln:ger", language_label => "Deutsch", locale_label => 
"German",,},
+    {value => "ln:gre", language_label => 
"&#949;&#955;&#955;&#951;&#957;&#953;&#954;&#940;", locale_label => "Greek, 
Modern [1453- ]",,},
+    {value => "ln:heb", language_label => 
"&#1506;&#1489;&#1512;&#1497;&#1514;", locale_label => "Hebrew",,},
+    {value => "ln:hin", language_label => 
"&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;", locale_label => "Hindi",,},
+    {value => "ln:hun", language_label => "Magyar", locale_label => 
"Hungarian",,},
+    {value => "ln:ind", language_label => "", locale_label => "Indonesian",,},
+    {value => "ln:ita", language_label => "Italiano", locale_label => 
"Italian",,},
+    {value => "ln:jpn", language_label => "&#26085;&#26412;&#35486;", 
locale_label => "Japanese",,},
+    {value => "ln:kor", language_label => "&#54620;&#44397;&#50612;", 
locale_label => "Korean",,},
+    {value => "ln:lat", language_label => "Latina", locale_label => "Latin",,},
+    {value => "ln:nor", language_label => "Norsk", locale_label => 
"Norwegian",,},
+    {value => "ln:per", language_label => 
"&#1601;&#1575;&#1585;&#1587;&#1609;", locale_label => "Persian",,},
+    {value => "ln:pol", language_label => "Polski", locale_label => 
"Polish",,},
+    {value => "ln:por", language_label => "Portugu&ecirc;s", locale_label => 
"Portuguese",,},
+    {value => "ln:rum", language_label => "Rom&acirc;n&#259;", locale_label => 
"Romanian",,},
+    {value => "ln:rus", language_label => 
"&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;", locale_label => 
"Russian",,},
+    {value => "ln:spa", language_label => "Espa&ntilde;ol", locale_label => 
"Spanish",,},
+    {value => "ln:swe", language_label => "Svenska", locale_label => 
"Swedish",,},
+    {value => "ln:tha", language_label => 
"&#3616;&#3634;&#3625;&#3634;&#3652;&#3607;&#3618;", locale_label => "Thai",,},
+    {value => "ln:tur", language_label => "T&uuml;rk&ccedil;e", locale_label 
=> "Turkish",,},
+    {value => "ln:ukr", language_label => 
"&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;", 
locale_label => "Ukrainian",,},
+
+];
+$template->param(search_languages_loop => $languages_loop,);
+
+# Yet another loop we can move to the DB when the scheme matures:
+my $outer_subtype_limits_loop = [
+
+            { # in MARC21, aud codes are stored in 008/22 (Target audience)
+                       name => "limit",
+                       inner_subtype_limits_loop => [
+                                       { value => '', label => 'Any Audience', 
selected => "selected" },
+                                       { value => 'aud:a', label => 'Easy',  },
+                    { value => 'aud:c', label => 'Juvenile',  },
+                    { value => 'aud:d', label => 'Young Adult',  },
+                    { value => 'aud:e', label => 'Adult',  },
+
+                               ],
+                       },
+                       { # in MARC21, fic is in 008/33, bio in 008/34, mus in 
LDR/06
+            name => "limit",
+            inner_subtype_limits_loop => [
+                    { value => '', label => 'Any Content', selected => 
"selected" },
+                    { value => 'fic:1', label => 'Fiction',  },
+                    { value => 'fic:0', label => 'Non Fiction',  },
+                    { value => 'bio:b', label => 'Biography',  },
+                    { value => 'mus:', label => 'Not working - Musical 
recording',  },
+                                       { value => 'mus:', label => 'Not 
working - Non-musical recording',  },
+
+                ],
+            },
+                       { # MARC21, these are codes stored in 007/00-01
+            name => "limit",
+            inner_subtype_limits_loop => [
+                    { value => '', label => 'Any Format', selected => 
"selected" },
+                                       { value => 'l-format:ta', label => 
'Regular print',  },
+                    { value => 'l-format:td', label => 'Large print',  },
+                                       { value => 'l-format:fk', label => 
'Braille',  },
+                                       { value => '', label => '-----------',  
},
+                                       { value => 'l-format:sd', label => 'CD 
audio',  },
+                    { value => 'l-format:ss', label => 'Cassette recording',  
},
+                    { value => 'l-format:vf', label => 'VHS tape / 
Videocassette',  },
+                                       { value => 'l-format:vd', label => 'DVD 
video / Videodisc',  },
+                                       { value => 'l-format:co', label => 'CD 
Software',  },
+
+                ],
+            },
+                       { # in MARC21, these are codes in 008/24-28
+            name => "limit",
+            inner_subtype_limits_loop => [
+                { value => '', label => 'Additional Content Types',  },
+                { value => 'ctype:a', label => 'Abstracts/summaries',  },
+                { value => 'ctype:b', label => 'Bibliographies',  },
+                { value => 'ctype:c', label => 'Catalogs',  },
+                { value => 'ctype:d', label => 'Dictionaries',  },
+                { value => 'ctype:e', label => 'Encyclopedias ',},
+                { value => 'ctype:f', label => 'Handbooks',  },
+                { value => 'ctype:g', label => 'Legal articles',},
+                { value => 'ctype:i', label => 'Indexes',  },
+                { value => 'ctype:j', label => 'Patent document',  },
+                { value => 'ctype:k', label => 'Discographies',  },            
    
+                               { value => 'ctype:l', label => 'Legislation',  
},                
+                               { value => 'ctype:m', label => 'Theses',},
+                               { value => 'ctype:n', label => 'Surveys', },
+                               { value => 'ctype:o', label => 'Reviews',},
+                               { value => 'ctype:p', label => 'Programmed 
texts',  },                
+                               { value => 'ctype:q', label => 'Filmographies', 
 },                
+                               { value => 'ctype:r', label => 'Directories',  
},                
+                               { value => 'ctype:s', label => 'Statistics',  
},                
+                               { value => 'ctype:t', label => 'Technical 
reports',  },                
+                               { value => 'ctype:v', label => 'Legal cases and 
case notes',  },                
+                               { value => 'ctype:w', label => 'Law reports and 
digests',  },                
+                               { value => 'ctype:z', label => 'Treaties ',  }, 
               
+                               ],            
+                       },
+];
+$template->param(outer_subtype_limits_loop => $outer_subtype_limits_loop,);
+
+$template->param(branchloop => address@hidden,);
+
+# Fetch the paramater list as a hash in scalar context:
+#  * returns paramater list as tied hash ref
+#  * we can edit the values by changing the key
+#  * multivalued CGI paramaters are returned as a packaged string separated by 
"\0" (null)
+my $params = $cgi->Vars;
+
+# Params that can have more than one value
+#
+# Use the servers defined, or just search our local catalog(default)
+my @servers;
address@hidden = split("\0",$params->{'server'}) if $params->{'server'};
+unless (@servers) {
+       #FIXME: this should be handled in Context.pm
+       @servers = ("localhost:9900/biblios");
+}
+
+# operators include boolean and proximity operators and are used
+# to evaluate multiple operands
+my @operators;
address@hidden = split("\0",$params->{'op'}) if $params->{'op'};
+
+# indexes are query qualifiers, like 'title', 'author', etc. They
+# can be simple or complex
+my @indexes;
address@hidden = split("\0",$params->{'idx'}) if $params->{'idx'};
+
+# an operand can be a single term, a phrase, or a complete ccl query
+my @operands;
address@hidden = split("\0",$params->{'qf'}) if $params->{'qf'};
+
+# limits are use to limit to results to a pre-defined category such as branch 
or language
+my @limits;
address@hidden = split("\0",$params->{'limit'}) if $params->{'limit'};
+push @limits, map "yr:".$_, split("\0",$params->{'limit-yr'}) if 
$params->{'limit-yr'};
+
+# sort by is used to sort the query
+my @sort_by;
address@hidden = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
+
+# Params that can only have one value
+my $query = $params->{'q'};
+my $scan = $params->{'scan'};
+my $expanded_options = $params->{'expanded_options'};
+my $count = $params->{'count'} || 20;
+my $offset = $params->{'offset'} || 0;
+my $hits;
+my $expanded_facet = $params->{'expand_facet'};
+$template->param(expanded_options => $expanded_options);
+unless ( (lc($do) =~/search/ )||($cgi->param("q")) ) {
+       warn "nothing to do, exiting";
+    output_html_with_http_headers $cgi, $cookie, $template->output;
+       exit;
+}
+
+# Define some global variables
+my $error; # used for error handling
+my $search_desc; # the query expressed in terms that humans understand
+my $koha_query; # the query expressed in terms that zoom understands with 
field weighting and stemming
+my $federated_query;
+my $query_type; # usually not needed, but can be used to trigger ccl, cql, or 
pqf queries if set
+my @results;
+
+## I. BUILD THE QUERY
+($error,$search_desc,$koha_query,$federated_query,$query_type) = 
buildQuery($query,address@hidden,address@hidden,address@hidden,address@hidden);
+
+## II. DO THE SEARCH AND GET THE RESULTS
+my $total; # the total results for the whole set
+my $facets;
+my @results_array;
+my $results_hashref;
+eval {
+
+       ($error, $results_hashref, $facets) = 
getRecords($koha_query,$federated_query,address@hidden,address@hidden,$count,$offset,$expanded_facet,$branches,$query_type,$scan);
+
+};
+if ($@ || $error) {
+       $template->param(query_error => $error.$@);
+       warn "error: ".$error.$@;
+       output_html_with_http_headers $cgi, $cookie, $template->output;
+       exit;
+}
+# At this point, each server has given us a result set
+# now we build that set for template display
+my @sup_results_array;
+for (my $i=0;$i<address@hidden;$i++) {
+       my $server = $servers[$i];
+       if ($server =~/localhost/) { # this is the local server
+               my @newresults = searchResults( 
$search_desc,$results_hashref->{$server}->{"hits"},$count,@{$results_hashref->{$server}->{"RECORDS"}});
+
+               $total = $total + $results_hashref->{$server}->{"hits"};
+               $hits = $results_hashref->{$server}->{"hits"};
+               if ($hits) {
+               # sorting out which results to display.
+               # the result number to start to show
+               $template->param(starting => $offset+1);
+               $template->param(ending => $offset+$count);
+               # the result number to end to show
+               ($offset+$hits<=$count) ? ($template->param(endat => 
$offset+$hits)) : ($template->param(endat => $count));
+               # the total results found
+               $template->param(total => $hits);
+               $template->param(searchdesc => $search_desc );
+               $template->param(results_per_page =>  $count);
+               $template->param(SEARCH_RESULTS => address@hidden);
+
+                       #this is to show the page numbers to navigate among the 
results, whether it has to show the number highlighted or not
+                       my $numbers;
+                       @$numbers = ();
+                       my $pg = 1;
+                       if (defined($cgi->param('pg'))) {
+                               $pg = $cgi->param('pg');
+                       }
+                       my $start = 0;
+                       $start = ($pg - 1) * $hits;
+                       my $pages = ceil($count / $hits);
+                       my $total_pages = ceil($count / $hits);
+                       my $url;
+                       if ($pg > 1) {
+                       $url = $pg - 1;
+                       push @$numbers, {
+                number => "&lt;&lt;",
+                highlight => 0 ,
+                startfrom => 0,
+                pg => '1' };
+
+                       push @$numbers, {
+                number => "&lt;",
+                highlight => 0 ,
+                startfrom => ($url-1)*$hits,
+                pg => $url };
+                       }
+    
+                       my $current_ten = $pg / 10;
+
+                       if ($current_ten == 0) {
+                       $current_ten = 0.1;           # In case it's in ten = 0
+                       }
+               my $from = $current_ten * 10; # Calculate the initial page
+               my $end_ten = $from + 9;
+               my $to;
+               if ($pages > $end_ten) {
+                       $to = $end_ten;
+               } else {
+                       $to = $pages;
+               }
+               for (my $i =$from; $i <= $to ; $i++) {
+                       if ($i == $pg) {
+                       if ($count > $hits) {
+                               push @$numbers, {
+                        number => $i,
+                        highlight => 1 ,
+                        startfrom => ($i-1)*$hits ,
+                        pg => $i };
+                       }
+                       } else {
+                       push @$numbers, {
+                        number => $i,
+                        highlight => 0 ,
+                        startfrom => ($i-1)*$hits ,
+                        pg => $i };
+                       }
+               }
+               if ($pg < $pages) {
+                       $url = $pg + 1;
+                       push @$numbers, {
+                        number => "&gt;",
+                        highlight => 0 ,
+                        startfrom => ($url-1)*$hits,
+                        pg => $url };
+
+                       push @$numbers, {
+                        number => "&gt;&gt;",
+                        highlight => 0 ,
+                        startfrom => ($total_pages-1)*$hits,
+                        pg => $total_pages};
+                       }
+               }
+       } # end of the if local
+       else {
+               # check if it's a z3950 or opensearch source
+               my $zed3950 = 1;
+               if ($zed3950) {
+                       my @inner_sup_results_array;
+                       for my $sup_record ( 
@{$results_hashref->{$server}->{"RECORDS"}} ) {
+                               my $marc_record_object = 
MARC::Record->new_from_usmarc($sup_record);
+                               my $control_number = 
$marc_record_object->field('010')->subfield('a') if 
$marc_record_object->field('010');
+                               $control_number =~ s/^ //g;
+                               my $link = 
"http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?SAB1=".$control_number."&BOOL1=all+of+these&FLD1=LC+Control+Number+LCCN+%28K010%29+%28K010%29&GRP1=AND+with+next+set&SAB2=&BOOL2=all+of+these&FLD2=Keyword+Anywhere+%28GKEY%29+%28GKEY%29&PID=6211&SEQ=20060816121838&CNT=25&HIST=1";;
+                               my $title = $marc_record_object->title();
+                               push @inner_sup_results_array, {
+                                       title => $title,
+                                       link => $link,
+                               };
+                       }
+                       my $servername = $server;
+                       push @sup_results_array, { servername => $servername, 
inner_sup_results_loop => address@hidden;
+                       $template->param(outer_sup_results_loop => 
address@hidden);
+               }
+       }
+
+} #/end of the for loop
+#$template->param(FEDERATED_RESULTS => address@hidden);
+
+$template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary"))
 if (C4::Context->preference("Disable_Dictionary"));
+#my $scan_use = $cgi->param('use1');
+
+$template->param(
+            #classlist => $classlist,
+                       total => $total,
+                       searchdesc => $search_desc,
+                       opacfacets => 1,
+                       facets_loop => $facets,
+            suggestion => C4::Context->preference("suggestion"),
+            virtualshelves => C4::Context->preference("virtualshelves"),
+            LibraryName => C4::Context->preference("LibraryName"),
+            OpacNav => C4::Context->preference("OpacNav"),
+            opaccredits => C4::Context->preference("opaccredits"),
+            AmazonContent => C4::Context->preference("AmazonContent"),
+            opacsmallimage => C4::Context->preference("opacsmallimage"),
+            opaclayoutstylesheet => 
C4::Context->preference("opaclayoutstylesheet"),
+            opaccolorstylesheet => 
C4::Context->preference("opaccolorstylesheet"),
+            #scan_use => $scan_use,
+            search_error => $error,
+);
+## Now let's find out if we have any supplemental data to show the user
+#  and in the meantime, save the current query for statistical purposes, etc.
+my $koha_spsuggest; # a flag to tell if we've got suggestions coming from Koha
+my @koha_spsuggest; # place we store the suggestions to be returned to the 
template as LOOP
+my $phrases = $search_desc;
+my $ipaddress;
+
+if ( C4::Context->preference("kohaspsuggest") ) {
+        eval {
+            my $koha_spsuggest_dbh;
+            eval {
+                
$koha_spsuggest_dbh=DBI->connect("DBI:mysql:suggest:66.213.78.76","auth","Free2cirC");
+            };
+            if ($@) { warn "can't connect to spsuggest db";
+            }
+            else {
+                my $koha_spsuggest_insert = "INSERT INTO 
phrase_log(phr_phrase,phr_resultcount,phr_ip) VALUES(?,?,?)";
+                my $koha_spsuggest_query = "SELECT display FROM distincts 
WHERE strcmp(soundex(suggestion), soundex(?)) = 0 order by soundex(suggestion) 
limit 0,5";
+                my $koha_spsuggest_sth = 
$koha_spsuggest_dbh->prepare($koha_spsuggest_query);
+                $koha_spsuggest_sth->execute($phrases);
+                while (my $spsuggestion = $koha_spsuggest_sth->fetchrow_array) 
{
+                    $spsuggestion =~ s/(:|\/)//g;
+                    my %line;
+                    $line{spsuggestion} = $spsuggestion;
+                    push @koha_spsuggest,\%line;
+                    $koha_spsuggest = 1;
+                }
+
+                # Now save the current query
+                
$koha_spsuggest_sth=$koha_spsuggest_dbh->prepare($koha_spsuggest_insert);
+                #$koha_spsuggest_sth->execute($phrases,$count,$ipaddress);
+                $koha_spsuggest_sth->finish;
+
+                $template->param( koha_spsuggest => $koha_spsuggest ) unless 
$hits;
+                $template->param( SPELL_SUGGEST => address@hidden,
+                );
+            }
+       };
+       if ($@) {
+            warn "Kohaspsuggest failure:".$@;
+       }
+}
+
+
+
+# IV. GET THE QUERY HISTORY
+#($error,@query_history) = getQueryHistory($session);
+
+# V. GET SUGGESTIONS
+#($error,@spsuggest) = getSpellingSuggestions($simple_term);
+#($error,@rsuggest) = getRelatedSuggestions($simple_term);
+
+# VI. BUILD THE TEMPLATE
+output_html_with_http_headers $cgi, $cookie, $template->output;




reply via email to

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