From e295ec772494a9450c41916489132e5f72a91d5c Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 14 May 2025 10:41:22 +0000 Subject: [PATCH] Bug 39900: Preparation: Move html customizations options to class for reusability Signed-off-by: David Nind --- Koha/AdditionalContents.pm | 33 +++++++++++++++++++ .../en/modules/tools/additional-contents.tt | 2 -- tools/additional-contents.pl | 6 ++-- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Koha/AdditionalContents.pm b/Koha/AdditionalContents.pm index ff7bf0b82a..10f37a4dba 100644 --- a/Koha/AdditionalContents.pm +++ b/Koha/AdditionalContents.pm @@ -153,6 +153,39 @@ sub find_best_match { return $alt1 // $alt2 // $alt3; } +=head3 get_html_customizations_options + + Koha::AdditionalContents->get_html_customizations_options('opac'); + +=cut + +sub get_html_customizations_options { + my ($interface) = @_; + + if ( $interface eq 'opac' ) { + return [ + 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', + 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', + 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', + 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'OpacSuppressionMessage', 'SCOMainUserBlock', + 'SelfCheckInMainUserBlock', 'SelfCheckHelpMessage', 'CatalogConcernHelp', 'CatalogConcernTemplate', + 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions', + 'ILLModuleCopyrightClearance' + ]; + } + + if ( $interface eq 'staff' ) { + return [ + 'IntranetmainUserblock', 'RoutingListNote', 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', + 'StaffCataloguingHome', 'StaffListsHome', 'StaffLoginInstructions', 'StaffPatronsHome', 'StaffPOSHome', + 'StaffSerialsHome' + ]; + } + + return []; + +} + =head3 _type =cut diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index 330b5522ac..a5884db4bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -532,7 +532,6 @@ [% END %] [% END %] [% ELSE %] - [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'OpacSuppressionMessage', 'SCOMainUserBlock', 'SelfCheckInMainUserBlock', 'SelfCheckHelpMessage', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions', 'ILLModuleCopyrightClearance' ] %] [% FOREACH l IN opac_available_options.sort %] [% IF l == location %] @@ -542,7 +541,6 @@ [% END %] [% END %] - [% SET staff_available_options = [ 'IntranetmainUserblock', 'RoutingListNote', 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', 'StaffCataloguingHome', 'StaffListsHome', 'StaffLoginInstructions', 'StaffPatronsHome', 'StaffPOSHome', 'StaffSerialsHome' ] %] [% FOREACH l IN staff_available_options.sort %] [% IF l == location %] diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl index 89dacf9589..6809a94464 100755 --- a/tools/additional-contents.pl +++ b/tools/additional-contents.pl @@ -72,8 +72,10 @@ if ( $op eq 'add_form' ) { $category = $additional_content->category; } $template->param( - additional_content => $additional_content, - translated_contents => $translated_contents, + additional_content => $additional_content, + translated_contents => $translated_contents, + opac_available_options => Koha::AdditionalContents::get_html_customizations_options('opac'), + staff_available_options => Koha::AdditionalContents::get_html_customizations_options('staff'), ); } elsif ( $op eq 'cud-add_validate' ) { output_and_exit_if_error( $cgi, $cookie, $template, { check => 'csrf_token' } ); -- 2.39.5