[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/search.marc search.pl,NONE,1.1
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/search.marc search.pl,NONE,1.1 |
Date: |
Tue, 28 Jan 2003 06:56:41 -0800 |
Update of /cvsroot/koha/koha/search.marc
In directory sc8-pr-cvs1:/tmp/cvs-serv6348/search.marc
Added Files:
search.pl
Log Message:
search on MARC datas.
first draft
--- NEW FILE ---
#!/usr/bin/perl
# 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::Biblio;
use C4::SearchMarc;
my $query=new CGI;
my $type=$query->param('type');
my $op = $query->param('op');
#$type="opac" unless $type;
my $dbh = C4::Context->dbh;
my ($loggedinuser, $cookie, $sessionID) = checkauth($query, ($type eq 'opac') ?
(1) : (0));
my $startfrom=$query->param('startfrom');
($startfrom) || ($startfrom=0);
my ($template, $loggedinuser, $cookie);
if ($op eq "do_search") {
my @marclist = $query->param('marclist');
my @and_or = $query->param('and_or');
my @excluding = $query->param('excluding');
my @operator = $query->param('operator');
my @value = $query->param('value');
# builds tag and subfield arrays
my @tags;
my @subfields;
foreach my $marc (@marclist) {
push @tags, substr($marc,0,3);
push @subfields, substr($marc,3,1);
}
my @results = catalogsearch($dbh, address@hidden, address@hidden,
address@hidden,
address@hidden, address@hidden, address@hidden,
$startfrom, 20);
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name =>
"search.marc/result.tmpl",
query => $query,
type => $type,
authnotrequired => 0,
flagsrequired => {catalogue => 1},
debug => 1,
});
$template->param(loggedinuser => $loggedinuser,
result =>
address@hidden);
} else {
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name =>
"search.marc/search.tmpl",
query => $query,
type => $type,
authnotrequired => 0,
flagsrequired => {catalogue => 1},
debug => 1,
});
$template->param(loggedinuser => $loggedinuser);
my $tagslib;
if ($type eq "opac") {
$tagslib = &MARCgettagslib($dbh,1);
} else {
$tagslib = &MARCgettagslib($dbh,1);
}
my @marcarray;
push @marcarray,"";
for (my $tabloop = 0; $tabloop<=9;$tabloop++) {
push @marcarray,"--------------------------------------- $tabloop
---------------------------------------";
foreach my $tag (sort(keys (%{$tagslib}))) {
foreach my $subfield (sort(keys %{$tagslib->{$tag}})) {
next if ($subfield eq 'lib'); # skip lib and
tabs, which are koha internal
next if ($subfield eq 'tab');
next unless
($tagslib->{$tag}->{$subfield}->{tab} eq $tabloop);
push @marcarray, "$tag$subfield -
$tagslib->{$tag}->{$subfield}->{lib}";
}
}
}
my $marclist = CGI::scrolling_list(-name=>"marclist",
-values=> address@hidden,
-size=>1,
-multiple=>0,
-onChange => "sql_update()",
);
$template->param("marclist" => $marclist);
}
# Print the page
print $query->header(-cookie => $cookie), $template->output;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/search.marc search.pl,NONE,1.1,
Paul POULAIN <=
- Prev by Date:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/search.marc result.tmpl,NONE,1.1 search.tmpl,NONE,1.1
- Next by Date:
[Koha-cvs] CVS: koha thesaurus_popup.pl,1.8,1.9
- Previous by thread:
[Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/search.marc result.tmpl,NONE,1.1 search.tmpl,NONE,1.1
- Next by thread:
[Koha-cvs] CVS: koha thesaurus_popup.pl,1.8,1.9
- Index(es):