From ed047fead87b2ddf209758ad4a0eaabaa0cb8cad Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 10 Nov 2009 17:00:37 +0100 Subject: [PATCH] adding XSLT for intranet (UNIMARC only, MARC21 will be done by kf) - the XSLTParse4Display sub now has a new parameter : the interface (intranet or opac) - the XSLTdisplay sysprefs is common to staff & opac (Auth.pm) - added UNIMARC xslt in intranet templates (modified to deal with staff/opac differences) --- C4/Auth.pm | 8 +- C4/XSLT.pm | 13 +- catalogue/detail.pl | 7 + .../prog/en/modules/catalogue/detail.tmpl | 6 +- .../en/xslt/UNIMARCslim2intranetDetail.xsl | 561 ++++++++++++++++++ .../prog/en/xslt/UNIMARCslimUtils.xsl | 299 ++++++++++ opac/opac-detail.pl | 2 +- 7 files changed, 888 insertions(+), 8 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl diff --git a/C4/Auth.pm b/C4/Auth.pm index 9fd298f160..b96f796cb2 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -330,6 +330,8 @@ sub get_template_and_user { 'item-level_itypes' => C4::Context->preference('item-level_itypes'), patronimages => C4::Context->preference("patronimages"), singleBranchMode => C4::Context->preference("singleBranchMode"), + XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"), + XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"), ); if ( $in->{'type'} eq "intranet" ) { @@ -352,11 +354,11 @@ sub get_template_and_user { intranetreadinghistory => C4::Context->preference("intranetreadinghistory"), intranetstylesheet => C4::Context->preference("intranetstylesheet"), intranetuserjs => C4::Context->preference("intranetuserjs"), - intranetbookbag => C4::Context->preference("intranetbookbag"), + intranetbookbag => C4::Context->preference("intranetbookbag"), noItemTypeImages => C4::Context->preference("noItemTypeImages"), suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), - StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"), + StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"), NoZebra => C4::Context->preference('NoZebra'), ); } @@ -408,8 +410,6 @@ sub get_template_and_user { RequestOnOpac => C4::Context->preference("RequestOnOpac"), TemplateEncoding => "". C4::Context->preference("TemplateEncoding"), 'Version' => C4::Context->preference('Version'), - XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"), - XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"), hidelostitems => C4::Context->preference("hidelostitems"), mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '', opaclayoutstylesheet => "" . C4::Context->preference("opaclayoutstylesheet"), diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 98b06dae69..fb427c326e 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -118,7 +118,8 @@ sub getAuthorisedValues4MARCSubfields { my $stylesheet; sub XSLTParse4Display { - my ( $biblionumber, $orig_record, $xsl_suffix ) = @_; + my ( $biblionumber, $orig_record, $xsl_suffix, $interface ) = @_; + $interface = 'opac' unless $interface; # grab the XML, run it through our stylesheet, push it out to the browser my $record = transformMARCXML4XSLT($biblionumber, $orig_record); #return $record->as_formatted(); @@ -139,10 +140,18 @@ sub XSLTParse4Display { my $source = $parser->parse_string($xmlrecord); unless ( $stylesheet ) { my $xslt = XML::LibXSLT->new(); - my $xslfile = C4::Context->config('opachtdocs') . + my $xslfile; + if ($interface eq 'intranet') { + $xslfile = C4::Context->config('intrahtdocs') . + "/prog/en/xslt/" . + C4::Context->preference('marcflavour') . + "slim2intranet$xsl_suffix.xsl"; + } else { + $xslfile = C4::Context->config('opachtdocs') . "/prog/en/xslt/" . C4::Context->preference('marcflavour') . "slim2OPAC$xsl_suffix.xsl"; + } my $style_doc = $parser->parse_file($xslfile); $stylesheet = $xslt->parse_stylesheet($style_doc); } diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 16cf460f35..1a17752edf 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -36,6 +36,7 @@ use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn); use C4::External::Amazon; use C4::Search; # enabled_staff_search_views use C4::VirtualShelves; +use C4::XSLT; # use Smart::Comments; @@ -57,6 +58,12 @@ my $fw = GetFrameworkCode($biblionumber); my $marcflavour = C4::Context->preference("marcflavour"); my $record = GetMarcBiblio($biblionumber); +# XSLT processing of some stuff +if (C4::Context->preference("XSLTDetailsDisplay") ) { + $template->param('XSLTDetailsDisplay' =>'1', + 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail','intranet') ); +} + # some useful variables for enhanced content; # in each case, we're grabbing the first value we find in # the record and normalizing it 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 9c0cc3232e..e7eecd266d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl @@ -55,7 +55,10 @@ function verify_images() {
- + + + +

@@ -165,6 +168,7 @@ function verify_images() { +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl new file mode 100644 index 0000000000..479ffa0765 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl @@ -0,0 +1,561 @@ + + + + + + + + + + + + + + + + + + +

+ + + + + + : + + + + + + [ + + ] + + + / + + + + ; + + +

+
+
+ + + + 700 + Auteur principal + + + + 710 + Collectivité principale + + + + 701 + Co-auteur + + + + 702 + Auteur + + + + 711 + Collectivité co-auteur + + + + 712 + Collectivité secondaire + + + +
  • + Langue: + + + + de la trad. intermédiaire, + de l'œuvre originale, + du résumé, + de la table des matières, + de la page de titre, + du titre propre, + d'un livret, + des textes d'accompagnement, + des sous-titres, + + + + + . + + + ; + + + + +
  • +
    + + +
  • + Pays: + + + + + + . + + , + + + + +
  • +
    + + + + + + + + +
  • PPN: + +
  • +
    + + +
  • ISBN: + + + + + + . + + + ; + + + +
  • +
    + + +
  • + ISSN: + + + + + . + + + ; + + + +
  • +
    + + + 225 + Collection + + + +
  • + Dewey: + + + + , + + + + , + + + + ; + + +
  • +
    + + +
  • + Classification: + + + + , + + + + , + + + ; + +
  • +
    + + +
  • + Note de contenu: + + + + + abcdjpvxyz + jpxyz + -- + + + + +
  • +
    + + +
  • + Résumé: + + + + + . + + + ; + + + +
  • +
    + + +
  • + Note sur la provenance: + + + +
  • +
    + + +
  • + Bibliographie: + + + .; + +
  • +
    + + +
  • + Thèse: + + + .; + +
  • +
    + + +
  • + Public: + + + .; + +
  • +
    + + + 600 + Sujet - Nom de personne + + + + 601 + Sujet - Collectivité + + + + 602 + Sujet - Famille + + + + 604 + Sujet - Auteur/titre + + + + 606 + Sujet - Nom commun + + + + 607 + Sujet - Nom géographique + + + + 608 + Sujet - Forme + + + + 610 + Sujet + + + + 615 + Catégorie sujet + + + + 616 + Marque déposée + + + +
  • + Online Resources: + + + + + + + + + y3z + + + + Click here to access online + + + + + + | + + + + + + + + +
  • + + + Continues: + + + Continues in part: + + + Supersedes: + + + Supersedes in part: + + + Formed by the union: ... and: ... + + + Absorbed: + + + Absorbed in part: + + + Separated from: + + + + + + at + + + /cgi-bin/koha/opac-search.pl?q= + + +
  • + + + +
  • +
    +
    + + +
    + + + + +
  • + + + Continued by: + + + Continued in part by: + + + Superseded by: + + + Superseded in part by: + + + Absorbed by: + + + Absorbed in part by: + + + Split into .. and ...: + + + Merged with ... to form ... + + + Changed back to: + + + + + + + at + + + + /cgi-bin/koha/catalogue/search.pl?q= + + + +
  • +
    +
    + +
    + + + + + + aq + + + + :,;/ + + + + + + + + + + + + + + + + + cdn + + + + + + + acdeq + + + + + + + + bc + + + + + + + + + + n + n + fghkdlmor + + + + + p + p + fghkdlmor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl new file mode 100644 index 0000000000..07d755b756 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + +
  • + Édition: + + + + + + , + + + + : + + + + , + + + + — + + + + : + + + + , + + + + • + + + +
  • +
    + + + +
  • + Description: + + + + : + + + ; + + + + + + +
  • +
    +
    + + + +
  • + Extrait de: + + + + + + : + + + / + + + , + + + +
  • +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rtl + + + + + + + +
  • + : + + + + : + + + + + + + + + + / + + + + , + + + + , + + + + , + + + + , + + + + , + + + +
  • +
    +
    + + + + + + +
  • + : + + + + + /cgi-bin/koha/catalogue/search.pl?q=an: + + + /cgi-bin/koha/catalogue/search.pl?q=su: + + + + + + abcdjpvxyz + jpxyz + -- + + + + + + | + + +
  • +
    +
    + + + + + + +
  • + : + + + + + + + /cgi-bin/koha/catalogue/search.pl?q=an: + + + /cgi-bin/koha/catalogue/search.pl?q=au: + + + + + + + , + + + + , + + + + + + + + + ( + + ) + + + + + + + + + + + + + + ; + + +
  • +
    +
    + +
    \ No newline at end of file diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 0dfe23c363..cc679472ca 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -70,7 +70,7 @@ $template->param( biblionumber => $biblionumber ); # XSLT processing of some stuff if (C4::Context->preference("XSLTDetailsDisplay") ) { $template->param( - 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail') ); + 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail'),'opac' ); } $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); -- 2.39.5