From df38d5c66f13088caacb78165196faed3a7761c3 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Fri, 16 Nov 2007 21:40:39 -0600 Subject: [PATCH] fixing facets, add cardview (XSLT), adding dependencies, save Record Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- Makefile.PL | 1 + catalogue/cardview.pl | 43 ++++++++++ catalogue/export.pl | 50 +++++++++++ .../intranet-tmpl/prog/en/includes/facets.inc | 4 +- .../prog/en/modules/catalogue/detail.tmpl | 15 ++++ .../prog/en/modules/catalogue/results.tmpl | 6 +- .../intranet-tmpl/prog/en/xslt/compact.xsl | 86 +++++++++++++++++++ 7 files changed, 201 insertions(+), 4 deletions(-) create mode 100755 catalogue/cardview.pl create mode 100755 catalogue/export.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/compact.xsl diff --git a/Makefile.PL b/Makefile.PL index 53ea90c1d9..1795050d24 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -122,6 +122,7 @@ WriteMakefile( 'MARC::Charset' => 0.95, 'MARC::File::XML' => 0.86, 'MARC::Record' => 1.38, +'MARC::Crosswalk::DublinCore' => 0.02, 'MIME::Base64' => 3.07, 'MIME::QuotedPrint' => 3.07, 'Mail::Sendmail' => 0.79, diff --git a/catalogue/cardview.pl b/catalogue/cardview.pl new file mode 100755 index 0000000000..e7622daa96 --- /dev/null +++ b/catalogue/cardview.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl +use strict; +require Exporter; +use CGI; +use XML::LibXSLT; +use XML::LibXML; +use C4::Koha; +use C4::Auth; +use C4::Biblio; +use C4::Languages qw(getTranslatedLanguages); + +my $query=new CGI; +my ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => "opac-detail.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + flagsrequired => {borrow => 1}, + }); + +# load the languages +my @languages_options = getTranslatedLanguages($query); +my $languages_count = @languages_options; +if($languages_count > 1){ + $template->param(languages => \@languages_options); +} +my $biblionumber=$query->param('biblionumber'); +$template->param(biblionumber => $biblionumber); + +# grab the XML, run it through our stylesheet, push it out to the browser +my $xmlrecord = GetXmlBiblio($biblionumber); +#my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2HTML.xsl"; +#my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2English.xsl"; +my $xslfile = C4::Context->config('intranetdir')."/koha-tmpl/intranet-tmpl/prog/en/xslt/compact.xsl"; +my $parser = XML::LibXML->new(); +my $xslt = XML::LibXSLT->new(); +my $source = $parser->parse_string($xmlrecord); +my $style_doc = $parser->parse_file($xslfile); +my $stylesheet = $xslt->parse_stylesheet($style_doc); +my $results = $stylesheet->transform($source); +my $newxmlrecord = $stylesheet->output_string($results); +print "Content-type: text/html\n\n"; +print $newxmlrecord; diff --git a/catalogue/export.pl b/catalogue/export.pl new file mode 100755 index 0000000000..a6b7cb0e96 --- /dev/null +++ b/catalogue/export.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl +use HTML::Template; +use strict; +require Exporter; +use C4::Record; +use C4::Auth; +use C4::Output; +use C4::Biblio; +use CGI; +use C4::Auth; + +my $query = new CGI; +my $op=$query->param("op"); +my $format=$query->param("format"); +if ($op eq "export") { + my $biblionumber = $query->param("bib"); + my $dbh=C4::Context->dbh; + my $sth; + if ($biblionumber) { + $sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber =?"); + $sth->execute($biblionumber); + } + while (my ($marc) = $sth->fetchrow) { + if ($marc){ + + if ($format =~ /marcxml/) { + $marc = marc2marcxml($marc); + } + elsif ($format=~ /mods/) { + $marc = marc2modsxml($marc); + } + elsif ($format =~ /dc/) { + my $error; + ($error,$marc) = marc2dcxml($marc,1); + $format = "dublin-core.xml"; + } + elsif ($format =~ /marc8/) { + $marc = changeEncoding($marc,"MARC","MARC21","MARC-8"); + $marc = $marc->as_usmarc(); + } + elsif ($format =~ /utf8/) { + #default + } + print $query->header( + -type => 'application/octet-stream', + -attachment=>"bib-$biblionumber.$format"); + print $marc; + } + } +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc index c65bc877f5..ee90c4c983 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc @@ -1,6 +1,7 @@ +
    -
  • Refine Your Search

  • +
  • Refine your search

  • "> + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl index 4df48c318b..c6eea2bf5d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl @@ -212,6 +212,21 @@
+
+
+ + + + /> +
Save Record
Select Download Format: +
+
+
+ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl index f57d5d8869..6e67b5cae9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -31,12 +31,12 @@ -

No Result found !

+

No results found

No results match your search for in Catalog.

-

No result found !

+

No results found

You did not specify any search criteria.

@@ -116,7 +116,7 @@
- Refine Your Search + Refine your search