[Koha-cvs] koha/catalogue MARCdetail.pl catalogue-search.p...
Tumer Garip
tgarip at neu.edu.tr
Wed Sep 27 21:37:27 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Changes by: Tumer Garip <tgarip1957> 06/09/27 19:37:27
Modified files:
catalogue : MARCdetail.pl catalogue-search.pl detail.pl
moredetail.pl
Log message:
Incorporates the facets from dev_week. This one is table read so its both UNIMARC and MARC21 compliant and also translatable.
The new search engine also has a BraveSearch where yo can write any CCL,CQL or PQF query directly
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/MARCdetail.pl?cvsroot=koha&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/catalogue-search.pl?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/detail.pl?cvsroot=koha&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/moredetail.pl?cvsroot=koha&r1=1.7&r2=1.8
Patches:
Index: MARCdetail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/MARCdetail.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- MARCdetail.pl 6 Sep 2006 16:21:04 -0000 1.7
+++ MARCdetail.pl 27 Sep 2006 19:37:27 -0000 1.8
@@ -177,12 +177,12 @@
$subfield_data{marc_lib}=$tagslib->{$data->{'tag'}}->{$code->{'code'}}->{lib};
$subfield_data{link}=$tagslib->{$data->{'tag'}}->{$code->{'code'}}->{link};
if ($tagslib->{$data->{'tag'}}->{$code->{'code'}}->{isurl}) {
- $subfield_data{marc_value}="<a href=\"$value]\">$value</a>";
+ $subfield_data{marc_value}="<a href=\"$value\">$value</a>";
} elsif ($data->{'tag'} eq $isbntag && $code->{'code'} eq $isbnsub) {
$subfield_data{marc_value}=DisplayISBN($value);
} else {
if ($tagslib->{$data->{'tag'}}->{$code->{'code'}}->{authtypecode}) {
- my ($authtag,$authtagsub)=MARCfind_marc_from_kohafield("auth_authid","biblios");
+ my ($authtag,$authtagsub)=MARCfind_marc_from_kohafield("auth_biblio_link_subf","biblios");
$subfield_data{authority}=XML_readline_onerecord($xmlhash,"","",$data->{'tag'},$authtagsub);
}
$subfield_data{marc_value}=get_authorised_value_desc($data->{'tag'}, $code->{'code'}, $value, '', $dbh);
Index: catalogue-search.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/catalogue-search.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- catalogue-search.pl 11 Sep 2006 17:41:54 -0000 1.2
+++ catalogue-search.pl 27 Sep 2006 19:37:27 -0000 1.3
@@ -27,17 +27,18 @@
my $number_of_results=$query->param('number_of_results');
my $zoom=$query->param('zoom');
my $ascend=$query->param('asc');
+my $searchtype=$query->param('searchtype'); ## this is actual query type
my @marclist = $query->param('marclist');
# collect all the fields ...
my %search;
my @forminputs; #this is for the links to navigate among the results
-my (@searchdesc, %hashdesc); #this is to show the description of the current search
-my @fields = ('value', 'kohafield', 'and_or', 'relation','order','barcode','biblionumber','itemnumber','asc','from');
+my (@searchdesc, %hashdesc,$facetsdesc); #this is to show the description of the current search
+my @fields = ('value', 'kohafield', 'and_or', 'relation','order','barcode','biblionumber','itemnumber','asc','from','searchtype');
###Collect all the marclist values coming from old Koha MARCdetails
-## Although we can not search on all marc fields- if any is matched in Zebra we can use it it
-my $sth=$dbh->prepare("Select marctokoha from koha_attr where tagfield=? and tagsubfield=? and intrashow=1");
+## Although we can not search on all marc fields- if any is matched in Zebra we can use it
+my $sth=$dbh->prepare("Select kohafield from koha_attr where tagfield=? and tagsubfield=? and intrashow=1");
foreach my $marc (@marclist) {
if ($marc) {
$sth->execute(substr($marc,0,3),substr($marc,3,1));
@@ -51,9 +52,10 @@
}
#### Now normal search routine
foreach my $field (@fields) {
- $search{$field} = $query->param($field);
- if ($search{$field}) {
- push @forminputs, { field=>$field ,value=> $search{$field}} unless ($field eq 'reorder');
+ my @fieldvalue = $query->param($field);
+ foreach my $fvalue (@fieldvalue) {
+ push @forminputs, { field=>$field ,value=> $fvalue} unless ($field eq 'reorder');
+ $facetsdesc.="&".$field."=".$fvalue;
}
}
@@ -66,7 +68,7 @@
if ($op eq "do_search"){
#this fields is just to allow the user come back to the search form with all the values previously entered
-$search{'search_type'} = $query->param('search_type');
+$search{'search_type'} = $query->param('search_type');# this is the panel type
push @forminputs, {field => 'search_type', value => $search{'search_type'}};
@@ -84,18 +86,18 @@
$search{'searchdesc'} = \@searchdesc;
$template->param(FORMINPUTS => \@forminputs);
$template->param(reorder => $query->param('reorder'));
-
+ $template->param(facetsdesc=>$facetsdesc);
# do the searchs ....
$number_of_results = 10 unless $number_of_results;
my $startfrom=$query->param('startfrom');
($startfrom) || ($startfrom=0);
-my ($count, at results);
+my ($count, at results,$facets);
if (!$zoom){
## using sql search for barcode,biblionumber or itemnumber only useful for libraian interface
($count, @results) =sqlsearch($dbh,\%search);
}else{
my $sortorder=$order.",".$ascend if $order;
- ($count, at results) =ZEBRAsearch_kohafields(\@kohafield,\@value, \@relation,$sortorder, \@and_or, 1,$reorder,$startfrom, $number_of_results,"intranet");
+ ($count,$facets, at results) =ZEBRAsearch_kohafields(\@kohafield,\@value, \@relation,$sortorder, \@and_or, 1,$reorder,$startfrom, $number_of_results,"intranet",$searchtype);
}
if ( $count eq "error"){
$template->param(error =>1);
@@ -114,16 +116,17 @@
}
# sorting out which results to display.
# the result number to star to show
- $template->param(starting => $startfrom+$number_of_results);
- $template->param(endinging => $startfrom+1);
- $template->param(startfrom => $startfrom+1);
+ $template->param(startfrom => $startfrom);
+ $template->param(beginning => $startfrom+1);
# the result number to end to show
($startfrom+$num<=$count) ? ($template->param(endat => $startfrom+$num+1)) : ($template->param(endat => $count));
# the total results searched
$template->param(numrecords => $count);
-
+ $template->param(FORMINPUTS => \@forminputs );
$template->param(searchdesc => \@searchdesc );
- $template->param(SEARCH_RESULTS => \@results);
+ $template->param(SEARCH_RESULTS => \@results,
+ facets_loop => $facets,
+ );
#this is to show the images numbers to navigate among the results, if it has to show the number highlighted or not
my $numbers;
@@ -184,12 +187,12 @@
pg => $url };
push @$numbers, { number => ">>",
highlight => 0 , forminputs=>\@forminputs,
- startfrom => ($total_pages-1)*$number_of_results,
+ start => ($total_pages-1)*$number_of_results,
pg => $total_pages};
}
# push @$numbers,{forminputs=>@forminputs};
- $template->param(numbers =>$numbers);
-
+ $template->param(numbers =>$numbers,
+ );
#show the virtual shelves
#my $results = &GetShelfList($borrowernumber);
#$template->param(shelvescount => scalar(@{$results}));
@@ -213,7 +216,7 @@
my $kohafield = $query->param('kohafield');
my ($fieldcount, at kohafields)=getkohafields();
foreach my $row (@kohafields) {
- if ($kohafield eq $row->{'marctokoha'}) {
+ if ($kohafield eq $row->{'kohafield'}) {
$row->{'sel'} = 1;
}
}
@@ -224,13 +227,27 @@
foreach my $sort (@kohafields) {
if ($sort->{sorts}){
push @sorts,$sort;
- if ($order eq $sort->{'marctokoha'}) {
+ if ($order eq $sort->{'attr'}) {
$sort->{'sel'} = 1;
}
}
}
$template->param(sorts => \@sorts);
+# load the branches
+my @branches = GetallBranches();
+$template->param(branchloop => \@branches,);
+
+# load the itemtypes
+my $itemtypes=GetItemTypes();
+my (@item_type_loop);
+foreach my $thisitemtype (sort keys %$itemtypes) {
+ my %row =(value => $thisitemtype,
+ description => $itemtypes->{$thisitemtype}->{'description'},
+ );
+ push @item_type_loop, \%row;
+}
+$template->param(itemtypeloop=>\@item_type_loop,);
my $search_type = $query->param('search_type');
if ((!$search_type) || ($search_type eq 'zoom')) {
$template->param(zoom_search => 1);
Index: detail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/detail.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- detail.pl 6 Sep 2006 16:21:04 -0000 1.8
+++ detail.pl 27 Sep 2006 19:37:27 -0000 1.9
@@ -59,13 +59,13 @@
## get notes subjects and URLS from MARC record
-# my $marcflavour = C4::Context->preference("marcflavour");
-# my $marcnotesarray = &getMARCnotes($dbh,$record,$marcflavour);
-# my $marcsubjctsarray = &getMARCsubjects($dbh,$record,$marcflavour);
-# my $marcurlssarray = &getMARCurls($dbh,$record,$marcflavour);
-# $template->param(MARCURLS => $marcurlssarray);
-# $template->param(MARCNOTES => $marcnotesarray);
-# $template->param(MARCSUBJCTS => $marcsubjctsarray);
+ my $marcflavour = C4::Context->preference("marcflavour");
+ my $marcnotesarray = &getMARCnotes($dbh,$record,$marcflavour);
+ my $marcsubjctsarray = &getMARCsubjects($dbh,$record,$marcflavour);
+ my $marcurlssarray = &getMARCurls($dbh,$record,$marcflavour);
+ $template->param(MARCURLS => $marcurlssarray);
+ $template->param(MARCNOTES => $marcnotesarray);
+ $template->param(MARCSUBJCTS => $marcsubjctsarray);
my @results = ($dat,);
Index: moredetail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/moredetail.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- moredetail.pl 11 Sep 2006 17:41:54 -0000 1.7
+++ moredetail.pl 27 Sep 2006 19:37:27 -0000 1.8
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# NOTE: Use standard 8-space tabs for this file (indents are 4 spaces)
-# $Id: moredetail.pl,v 1.7 2006/09/11 17:41:54 tgarip1957 Exp $
+# $Id: moredetail.pl,v 1.8 2006/09/27 19:37:27 tgarip1957 Exp $
# Copyright 2000-2003 Katipo Communications
#
More information about the Koha-cvs
mailing list