Bug 39860: Move display control from system preference to additional contents
Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
9cdb95121e
commit
c55388dd86
35
C4/XSLT.pm
35
C4/XSLT.pm
|
|
@ -33,7 +33,9 @@ use Koha::XSLT::Base;
|
|||
use Koha::Libraries;
|
||||
use Koha::Recalls;
|
||||
use Koha::TemplateUtils qw( process_tt );
|
||||
use Koha::AdditionalContents;
|
||||
use C4::Scrubber;
|
||||
use C4::Languages;
|
||||
|
||||
my $engine; #XSLT Handler object
|
||||
|
||||
|
|
@ -241,13 +243,38 @@ sub XSLTParse4Display {
|
|||
}
|
||||
}
|
||||
my $extracontent = '';
|
||||
my $location;
|
||||
my $branch = C4::Context->userenv->{branch} || '';
|
||||
my $lang = C4::Languages::getlanguage;
|
||||
|
||||
# Check if we should add extra content based on system preference
|
||||
if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) {
|
||||
if ( $xslsyspref eq "XSLTDetailsDisplay" ) {
|
||||
$location = 'StaffDetailPage';
|
||||
} elsif ( $xslsyspref eq "XSLTResultsDisplay" ) {
|
||||
$location = 'StaffResultsPage';
|
||||
} elsif ( $xslsyspref eq "OPACXSLTDetailsDisplay" ) {
|
||||
$location = 'OPACDetailPage';
|
||||
} elsif ( $xslsyspref eq "OPACXSLTResultsDisplay" ) {
|
||||
$location = 'OPACResultsPage';
|
||||
}
|
||||
|
||||
my @record_display_customizations = Koha::AdditionalContents->search_for_display(
|
||||
{
|
||||
category => 'record_display',
|
||||
location => $location,
|
||||
lang => $lang,
|
||||
library_id => $branch,
|
||||
}
|
||||
)->as_list;
|
||||
|
||||
if (@record_display_customizations) {
|
||||
foreach my $customization (@record_display_customizations) {
|
||||
$extracontent .= $customization->content;
|
||||
}
|
||||
}
|
||||
|
||||
if ($extracontent) {
|
||||
my $scrubber = C4::Scrubber->new('staff');
|
||||
my $extracontentvalue = C4::Context->preference('ExtraContentForXSLTDisplay');
|
||||
my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } );
|
||||
my $extracontentproccessed = process_tt( $extracontent, { record => $record } );
|
||||
$extracontent = $scrubber->scrub($extracontentproccessed);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
[% t("Modify news item") | html %]
|
||||
[% ELSIF category == 'pages' %]
|
||||
[% t("Modify page") | html %]
|
||||
[% ELSIF category == 'record_display' %]
|
||||
[% t("Modify record display customization") | html %]
|
||||
[% ELSE %]
|
||||
[% t("Modify HTML customization") | html %]
|
||||
[% END %]
|
||||
|
|
@ -20,6 +22,8 @@
|
|||
[% t("New news item") | html %]
|
||||
[% ELSIF category == 'pages' %]
|
||||
[% t("New page") | html %]
|
||||
[% ELSIF category == 'record_display' %]
|
||||
[% t("New record display customization") | html %]
|
||||
[% ELSE %]
|
||||
[% t("New HTML customization") | html %]
|
||||
[% END %]
|
||||
|
|
@ -30,6 +34,8 @@
|
|||
[% t("News") | html %]
|
||||
[% ELSIF category == 'pages' %]
|
||||
[% t("Pages") | html %]
|
||||
[% ELSIF category == 'record_display' %]
|
||||
[% t("Record display customizations") | html %]
|
||||
[% ELSE %]
|
||||
[% t("HTML customizations") | html %]
|
||||
[% END %]
|
||||
|
|
@ -97,6 +103,8 @@
|
|||
<a href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
|
||||
[% ELSIF category == 'pages' %]
|
||||
<a href="/cgi-bin/koha/tools/additional-contents.pl?category=pages">Pages</a>
|
||||
[% ELSIF category == 'record_display' %]
|
||||
<a href="/cgi-bin/koha/tools/additional-contents.pl?category=record_display">Record display customizations</a>
|
||||
[% ELSE %]
|
||||
<a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
|
||||
[% END %]
|
||||
|
|
@ -356,6 +364,8 @@
|
|||
[% t("News") | html %]
|
||||
[% ELSIF category == 'pages' %]
|
||||
[% t("Pages") | html %]
|
||||
[% ELSIF category == 'record_display' %]
|
||||
[% t("Record display customizations") | html %]
|
||||
[% ELSE %]
|
||||
[% t("HTML customizations") | html %]
|
||||
[% END %]
|
||||
|
|
@ -365,6 +375,7 @@
|
|||
<a class="customization-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=news">News</a>
|
||||
<a class="customization-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customizations</a>
|
||||
<a class="customization-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=pages">Pages</a>
|
||||
<a class="customization-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=record_display">Record display customizations</a>
|
||||
[% IF ( CAN_user_parameters_manage_sysprefs ) %]
|
||||
<a class="syspref-link" href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserJS">OPACUserJS</a>
|
||||
<a class="syspref-link" href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserCSS">OPACUserCSS</a>
|
||||
|
|
@ -531,6 +542,27 @@
|
|||
<option value="slip">Slip</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% ELSIF category == 'record_display' %]
|
||||
[% SET staff_available_options = ['StaffResultsPage' , 'StaffDetailPage'] %]
|
||||
<optgroup label="Staff interface">
|
||||
[% FOREACH l IN staff_available_options.sort %]
|
||||
[% IF l == location %]
|
||||
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% l | html %]">[% l | html %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</optgroup>
|
||||
[% SET opac_available_options = ['OPACResultsPage' , 'OPACResultsPage'] %]
|
||||
<optgroup label="OPAC">
|
||||
[% FOREACH l IN opac_available_options.sort %]
|
||||
[% IF l == location %]
|
||||
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% l | html %]">[% l | html %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</optgroup>
|
||||
[% ELSE %]
|
||||
<optgroup label="OPAC">
|
||||
[% FOREACH l IN opac_available_options.sort %]
|
||||
|
|
|
|||
|
|
@ -145,6 +145,9 @@
|
|||
|
||||
<dt><a href="/cgi-bin/koha/tools/additional-contents.pl?category=pages">Pages</a></dt>
|
||||
<dd>Write custom pages</dd>
|
||||
|
||||
<dt><a href="/cgi-bin/koha/tools/additional-contents.pl?category=record_display">Record display customizations</a></dt>
|
||||
<dd>Write record display customizations</dd>
|
||||
[% END %]
|
||||
|
||||
[% IF ( CAN_user_tools_schedule_tasks ) %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue