View | Details | Raw Unified | Return to bug 4032
Collapse All | Expand All

(-)a/C4/Search.pm (-2 / +1 lines)
Lines 1839-1846 sub searchResults { Link Here
1839
            $oldbiblio->{XSLTResultsRecord}
1839
            $oldbiblio->{XSLTResultsRecord}
1840
              = XSLTParse4Display($oldbiblio->{biblionumber},
1840
              = XSLTParse4Display($oldbiblio->{biblionumber},
1841
                                  $marcrecord,
1841
                                  $marcrecord,
1842
                                  'Results',
1842
                                  C4::Context->preference("OPACXSLTResultsDisplay"),
1843
                                  $search_context,
1844
                                  1, # clean up the problematic ampersand entities that Zebra outputs
1843
                                  1, # clean up the problematic ampersand entities that Zebra outputs
1845
                                  \@hiddenitems
1844
                                  \@hiddenitems
1846
                                );
1845
                                );
(-)a/C4/VirtualShelves/Page.pm (-1 / +1 lines)
Lines 208-214 sub shelfpage ($$$$$) { Link Here
208
                    my $biblionumber = $this_item->{'biblionumber'};
208
                    my $biblionumber = $this_item->{'biblionumber'};
209
                    my $record = GetMarcBiblio($biblionumber);
209
                    my $record = GetMarcBiblio($biblionumber);
210
                    $this_item->{XSLTBloc} =
210
                    $this_item->{XSLTBloc} =
211
                        XSLTParse4Display($biblionumber, $record, 'Results', 'opac')
211
                        XSLTParse4Display($biblionumber, $record, C4::Context->preference("OPACXSLTResultsDisplay"))
212
                            if C4::Context->preference("OPACXSLTResultsDisplay") && $type eq 'opac';
212
                            if C4::Context->preference("OPACXSLTResultsDisplay") && $type eq 'opac';
213
213
214
                    # the virtualshelfcontents table does not store these columns nor are they retrieved from the items
214
                    # the virtualshelfcontents table does not store these columns nor are they retrieved from the items
(-)a/C4/XSLT.pm (-21 / +27 lines)
Lines 3-8 package C4::XSLT; Link Here
3
# <jmf at liblime dot com>
3
# <jmf at liblime dot com>
4
# Parts Copyright Katrin Fischer 2011
4
# Parts Copyright Katrin Fischer 2011
5
# Parts Copyright ByWater Solutions 2011
5
# Parts Copyright ByWater Solutions 2011
6
# Parts Copyright Biblibre 2012
6
#
7
#
7
# This file is part of Koha.
8
# This file is part of Koha.
8
#
9
#
Lines 32-37 use C4::Reserves; Link Here
32
use Encode;
33
use Encode;
33
use XML::LibXML;
34
use XML::LibXML;
34
use XML::LibXSLT;
35
use XML::LibXSLT;
36
use LWP::Simple;
35
37
36
use vars qw($VERSION @ISA @EXPORT);
38
use vars qw($VERSION @ISA @EXPORT);
37
39
Lines 41-46 BEGIN { Link Here
41
    @ISA = qw(Exporter);
43
    @ISA = qw(Exporter);
42
    @EXPORT = qw(
44
    @EXPORT = qw(
43
        &XSLTParse4Display
45
        &XSLTParse4Display
46
        &GetURI
44
    );
47
    );
45
}
48
}
46
49
Lines 50-55 C4::XSLT - Functions for displaying XSLT-generated content Link Here
50
53
51
=head1 FUNCTIONS
54
=head1 FUNCTIONS
52
55
56
=head2 GetURI
57
58
GetURI file and returns the xslt as a string
59
60
=cut
61
62
sub GetURI {
63
    my ($uri) = @_;
64
    my $string;
65
    $string = get $uri ;
66
    return $string;
67
}
68
53
=head2 transformMARCXML4XSLT
69
=head2 transformMARCXML4XSLT
54
70
55
Replaces codes with authorized values in a MARC::Record object
71
Replaces codes with authorized values in a MARC::Record object
Lines 121-128 sub getAuthorisedValues4MARCSubfields { Link Here
121
my $stylesheet;
137
my $stylesheet;
122
138
123
sub XSLTParse4Display {
139
sub XSLTParse4Display {
124
    my ( $biblionumber, $orig_record, $xsl_suffix, $interface, $fixamps, $hidden_items ) = @_;
140
    my ( $biblionumber, $orig_record, $xslfilename, $fixamps, $hidden_items ) = @_;
125
    $interface = 'opac' unless $interface;
126
    # grab the XML, run it through our stylesheet, push it out to the browser
141
    # grab the XML, run it through our stylesheet, push it out to the browser
127
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
142
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
128
    #return $record->as_formatted();
143
    #return $record->as_formatted();
Lines 153-181 sub XSLTParse4Display { Link Here
153
    # don't die when you find &, >, etc
168
    # don't die when you find &, >, etc
154
    $parser->recover_silently(0);
169
    $parser->recover_silently(0);
155
    my $source = $parser->parse_string($xmlrecord);
170
    my $source = $parser->parse_string($xmlrecord);
156
    unless ( $stylesheet ) {
171
    unless ( $stylesheet->{$xslfilename} ) {
157
        my $xslt = XML::LibXSLT->new();
172
        my $xslt = XML::LibXSLT->new();
158
        my $xslfile;
173
        my $style_doc;
159
        if ($interface eq 'intranet') {
174
        if ( $xslfilename =~ /http:/ ) {
160
            $xslfile = C4::Context->config('intrahtdocs') . 
175
            my $xsltstring = GetURI($xslfilename);
161
                      '/' . C4::Context->preference("template") . 
176
            $style_doc = $parser->parse_string($xsltstring);
162
                      '/' . C4::Templates::_current_language() .
163
                      '/xslt/' .
164
                      C4::Context->preference('marcflavour') .
165
                      "slim2intranet$xsl_suffix.xsl";
166
        } else {
177
        } else {
167
            $xslfile = C4::Context->config('opachtdocs') . 
178
            use Cwd;
168
                      '/' . C4::Context->preference("opacthemes") . 
179
            $style_doc = $parser->parse_file($xslfilename);
169
                      '/' . C4::Templates::_current_language() .
170
                      '/xslt/' .
171
                      C4::Context->preference('marcflavour') .
172
                      "slim2OPAC$xsl_suffix.xsl";
173
        }
180
        }
174
        my $style_doc = $parser->parse_file($xslfile);
181
        $stylesheet->{$xslfilename} = $xslt->parse_stylesheet($style_doc);
175
        $stylesheet = $xslt->parse_stylesheet($style_doc);
176
    }
182
    }
177
    my $results = $stylesheet->transform($source);
183
    my $results      = $stylesheet->{$xslfilename}->transform($source);
178
    my $newxmlrecord = $stylesheet->output_string($results);
184
    my $newxmlrecord = $stylesheet->{$xslfilename}->output_string($results);
179
    return $newxmlrecord;
185
    return $newxmlrecord;
180
}
186
}
181
187
(-)a/catalogue/detail.pl (-1 / +1 lines)
Lines 84-90 my $marcflavour = C4::Context->preference("marcflavour"); Link Here
84
# XSLT processing of some stuff
84
# XSLT processing of some stuff
85
if (C4::Context->preference("XSLTDetailsDisplay") ) {
85
if (C4::Context->preference("XSLTDetailsDisplay") ) {
86
    $template->param('XSLTDetailsDisplay' =>'1',
86
    $template->param('XSLTDetailsDisplay' =>'1',
87
        'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail','intranet') );
87
        'XSLTBloc' => XSLTParse4Display($biblionumber, $record, C4::Context->preference("XSLTDetailsDisplay")) );
88
}
88
}
89
89
90
$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
90
$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
(-)a/installer/data/mysql/sysprefs.sql (-4 / +4 lines)
Lines 218-227 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES Link Here
218
218
219
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OPACShelfBrowser','1','','Enable/disable Shelf Browser on item details page. WARNING: this feature is very resource consuming on collections with large numbers of items.','YesNo');
219
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OPACShelfBrowser','1','','Enable/disable Shelf Browser on item details page. WARNING: this feature is very resource consuming on collections with large numbers of items.','YesNo');
220
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
220
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
221
('OPACXSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on OPAC','YesNo'),
221
('OPACXSLTDetailsDisplay','','','Enable XSL stylesheet control over details page display on OPAC','Free'),
222
('OPACXSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on OPAC','YesNo'),
222
('OPACXSLTResultsDisplay','','','Enable XSL stylesheet control over results page display on OPAC','Free'),
223
('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on intranet','YesNo'),
223
('XSLTDetailsDisplay','','','Enable XSL stylesheet control over details page display on intranet','Free'),
224
('XSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on intranet','YesNo');
224
('XSLTResultsDisplay','','','Enable XSL stylesheet control over results page display on intranet','Free');
225
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice');
225
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice');
226
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo');
226
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo');
227
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
227
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+31 lines)
Lines 37-42 use Getopt::Long; Link Here
37
use C4::Context;
37
use C4::Context;
38
use C4::Installer;
38
use C4::Installer;
39
use C4::Dates;
39
use C4::Dates;
40
use C4::Templates;
40
41
41
use MARC::Record;
42
use MARC::Record;
42
use MARC::File::XML ( BinaryEncoding => 'utf8' );
43
use MARC::File::XML ( BinaryEncoding => 'utf8' );
Lines 4663-4668 ENDOFRENEWAL Link Here
4663
    print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
4664
    print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
4664
    SetVersion($DBversion);
4665
    SetVersion($DBversion);
4665
}
4666
}
4667
4668
$DBversion = "XXX";
4669
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4670
    my $countXSLTDetailsDisplay = 0;
4671
    my $valueXSLTDetailsDisplay = "";
4672
    my $valueXSLTResultsDisplay = "";
4673
    my $valueOPACXSLTDetailsDisplay = "";
4674
    my $valueOPACXSLTResultsDisplay = "";
4675
    #the line below test if database comes from a BibLibre's branch
4676
    $countXSLTDetailsDisplay = $dbh->do('SELECT 1 FROM `systempreferences` WHERE `variable`="IntranetXSLTDetailsDisplay"');
4677
    if ($countXSLTDetailsDisplay > 0)
4678
    {
4679
        #the two lines below will only be used to update the databases from the BibLibre's branch. They will not affect the others
4680
        $dbh->do(q|UPDATE `systempreferences` SET `variable`="XSLTDetailsDisplay" WHERE `variable`="IntranetXSLTDetailsDisplay"|);
4681
        $dbh->do(q|UPDATE `systempreferences` SET `variable`="XSLTResultsDisplay" WHERE `variable`="IntranetXSLTResultsDisplay"|);
4682
    }
4683
    else
4684
    {
4685
        $valueXSLTDetailsDisplay = C4::Context->config('intrahtdocs').'/'.C4::Context->preference("template").'/'.C4::Templates::_current_language().'/xslt/'.C4::Context->preference('marcflavour')."slim2intranetDetail.xsl" if (C4::Context->preference("XSLTDetailsDisplay"));
4686
        $valueXSLTResultsDisplay = C4::Context->config('intrahtdocs').'/'.C4::Context->preference("template").'/'.C4::Templates::_current_language().'/xslt/'.C4::Context->preference('marcflavour')."slim2intranetResults.xsl" if (C4::Context->preference("XSLTResultsDisplay"));
4687
        $valueOPACXSLTDetailsDisplay = C4::Context->config('opachtdocs').'/'.C4::Context->preference("opacthemes").'/'.C4::Templates::_current_language().'/xslt/'.C4::Context->preference('marcflavour')."slim2OPACDetail.xsl" if (C4::Context->preference("OPACXSLTDetailsDisplay"));
4688
        $valueOPACXSLTResultsDisplay = C4::Context->config('opachtdocs').'/'.C4::Context->preference("opacthemes").'/'.C4::Templates::_current_language().'/xslt/'.C4::Context->preference('marcflavour')."slim2OPACResults.xsl" if (C4::Context->preference("OPACXSLTResultsDisplay"));
4689
        $dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueXSLTDetailsDisplay\" WHERE variable='XSLTDetailsDisplay'");
4690
        $dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueXSLTResultsDisplay\" WHERE variable='XSLTResultsDisplay'");
4691
        $dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueOPACXSLTDetailsDisplay\" WHERE variable='OPACXSLTDetailsDisplay'");
4692
        $dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueOPACXSLTResultsDisplay\" WHERE variable='OPACXSLTResultsDisplay'");
4693
    }
4694
    print "XSLT systempreference takes a path to file rather than YesNo\n";
4695
    SetVersion($DBversion);
4696
}
4666
=head1 FUNCTIONS
4697
=head1 FUNCTIONS
4667
4698
4668
=head2 DropAllForeignKeys($table)
4699
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-8 / +4 lines)
Lines 48-64 OPAC: Link Here
48
                  no: Show
48
                  no: Show
49
            - lost items on search and detail pages.
49
            - lost items on search and detail pages.
50
        -
50
        -
51
            - Show biblio records on OPAC result page
51
            - XSLT path for the OPAC result page
52
            - pref: OPACXSLTResultsDisplay
52
            - pref: OPACXSLTResultsDisplay
53
              choices:
53
              class: file
54
                  yes: using XSLT stylesheets.
55
                  no: normally.
56
        -
54
        -
57
            - Show item details pages on the OPAC
55
            - XSLT path for the details pages on the OPAC
58
            - pref: OPACXSLTDetailsDisplay
56
            - pref: OPACXSLTDetailsDisplay
59
              choices:
57
              class: file
60
                  yes: using XSLT stylesheets.
61
                  no: normally.
62
        -
58
        -
63
            - On pages displayed with XSLT stylesheets on the OPAC,
59
            - On pages displayed with XSLT stylesheets on the OPAC,
64
            - pref: DisplayOPACiconsXSLT
60
            - pref: DisplayOPACiconsXSLT
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref (-8 / +4 lines)
Lines 51-67 Staff Client: Link Here
51
              class: url
51
              class: url
52
            - for the Staff Client's favicon. (This should be a complete URL, starting with <code>http://</code>.)
52
            - for the Staff Client's favicon. (This should be a complete URL, starting with <code>http://</code>.)
53
        -
53
        -
54
            - Show biblio records on result page in the staff client
54
            - XSLT path for the result page in the staff client
55
            - pref: XSLTResultsDisplay
55
            - pref: XSLTResultsDisplay
56
              choices:
56
              class: file
57
                  yes: using XSLT stylesheets.
58
                  no: normally.
59
        -
57
        -
60
            - Show item details pages in the staff client
58
            - XSLT path for the details pages in the staff client
61
            - pref: XSLTDetailsDisplay
59
            - pref: XSLTDetailsDisplay
62
              choices:
60
              class: file
63
                  yes: using XSLT stylesheets.
64
                  no: normally.
65
        -
61
        -
66
            - Use the Yahoo UI libraries
62
            - Use the Yahoo UI libraries
67
            - pref: yuipath
63
            - pref: yuipath
(-)a/opac/opac-detail.pl (-3 / +1 lines)
Lines 79-88 SetUTF8Flag($record); Link Here
79
79
80
# XSLT processing of some stuff
80
# XSLT processing of some stuff
81
if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
81
if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
82
    $template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail', 'opac') );
82
    $template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, C4::Context->preference("OPACXSLTDetailsDisplay") ) );
83
}
83
}
84
84
85
86
# We look for the busc param to build the simple paging from the search
85
# We look for the busc param to build the simple paging from the search
87
my $session = get_session($query->cookie("CGISESSID"));
86
my $session = get_session($query->cookie("CGISESSID"));
88
my %paging = (previous => {}, next => {});
87
my %paging = (previous => {}, next => {});
89
- 

Return to bug 4032