Bugzilla – Attachment 159177 Details for
Bug 35153
Convert IntranetmainUserblock system preference to additional contents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35153: Convert IntranetmainUserblock system preference to additional contents
Bug-35153-Convert-IntranetmainUserblock-system-pre.patch (text/plain), 10.10 KB, created by
Owen Leonard
on 2023-11-21 18:09:54 UTC
(
hide
)
Description:
Bug 35153: Convert IntranetmainUserblock system preference to additional contents
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2023-11-21 18:09:54 UTC
Size:
10.10 KB
patch
obsolete
>From 0daa85eed55650d4308d0c017e7cf1adb53ecdf7 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 20 Nov 2023 13:51:22 +0000 >Subject: [PATCH] Bug 35153: Convert IntranetmainUserblock system preference to > additional contents > >This patch moves the IntranetmainUserblock system preference into HTML >customizations, making it possible to have language- and >library-specific content. > >To test you should have some content in the IntranetmainUserblock >system preference before applying the patch. Apply the patch and run >the database update process. > >- In the staff client, go to Tools -> HTML customizations and verify > that the content from IntranetmainUserblock is now stored there. >- The HTML customization entry form should offer IntranetmainUserblock > as a choice under "Display location." >- Update and reinstall active translations (for instance fr-FR): > - perl misc/translator/translate update fr-FR > - perl misc/translator/translate install fr-FR >- Enable the translation if necessary under Administration -> System > preferences -> language. >- Edit the IntranetmainUserblock HTML customization and add unique > content to the "fr-FR" tab. > >- Go to the staff client home page. You should see the > content you added to the IntranetmainUserblock HTML customization. >- Switch to your updated translation and confirm that the content you > added for your translation shows up correctly. >- Go to Administration -> System preferences and search for > "IntranetmainUserblock." It should return no results. >--- > ...netmainUserblock-to-additional-contents.pl | 40 +++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 - > .../en/includes/html-customization-help.inc | 4 ++ > .../admin/preferences/staff_interface.pref | 6 --- > .../prog/en/modules/intranet-main.tt | 23 ++++++----- > .../en/modules/tools/additional-contents.tt | 2 +- > 6 files changed, 59 insertions(+), 17 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug-35153-move-IntranetmainUserblock-to-additional-contents.pl > >diff --git a/installer/data/mysql/atomicupdate/bug-35153-move-IntranetmainUserblock-to-additional-contents.pl b/installer/data/mysql/atomicupdate/bug-35153-move-IntranetmainUserblock-to-additional-contents.pl >new file mode 100755 >index 0000000000..e50c7ba5e9 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-35153-move-IntranetmainUserblock-to-additional-contents.pl >@@ -0,0 +1,40 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "35153", >+ description => "Move IntranetmainUserblock to additional contents", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Get any existing value from the IntranetmainUserblock system preference >+ my ($intranetmainuserblock) = $dbh->selectrow_array( >+ q| >+ SELECT value FROM systempreferences WHERE variable='IntranetmainUserblock'; >+ | >+ ); >+ if ($intranetmainuserblock) { >+ >+ $dbh->do( >+ "INSERT INTO additional_contents ( category, code, location, branchcode, published_on ) VALUES ('html_customizations', 'IntranetmainUserblock', 'IntranetmainUserblock', NULL, CAST(NOW() AS date) )" >+ ); >+ >+ my ($insert_id) = $dbh->selectrow_array( >+ "SELECT id FROM additional_contents WHERE category = 'html_customizations' AND code = 'IntranetmainUserblock' AND location = 'IntranetmainUserblock' LIMIT 1", >+ {} >+ ); >+ >+ $dbh->do( >+ "INSERT INTO additional_contents_localizations ( additional_content_id, title, content, lang ) VALUES ( ?, 'IntranetmainUserblock default', ?, 'default' )", >+ undef, $insert_id, $intranetmainuserblock >+ ); >+ >+ say $out "Added 'IntranetmainUserblock' HTML customization"; >+ } >+ >+ # Remove old system preference >+ $dbh->do("DELETE FROM systempreferences WHERE variable='IntranetmainUserblock'"); >+ say $out "Removed system preference 'IntranetmainUserblock'"; >+ >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index b58114d802..a3fb0bbe6e 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -328,7 +328,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff interface', 'YesNo'), > ('intranetcolorstylesheet','','50','Define the color stylesheet to use in the staff interface','free'), > ('IntranetFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the staff interface','free'), >-('IntranetmainUserblock','','70|10','Add a block of HTML that will display on the intranet home page','Textarea'), > ('IntranetNav','','70|10','Use HTML tabs to add navigational links to the top-hand navigational bar in the staff interface','Textarea'), > ('IntranetNumbersPreferPhrase','0',NULL,'Control the use of phr operator in callnumber and standard number staff interface searches','YesNo'), > ('intranetreadinghistory','1','','If ON, Checkout history is enabled for all patrons','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc >index d41cfcda87..04ebb2bd70 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc >@@ -18,6 +18,10 @@ > Include this content in the popup message which is displayed in the OPAC when the CookieConsent system preference is enabled and the user clicks the "Your cookies" menu item in the header. > </div> > >+<div id="IntranetmainUserblock_notes" class="hint customization_note"> >+ Include this content in its own section on the main page of the staff interface >+</div> >+ > <div id="opaccredits_notes" class="hint customization_note"> > Include this content in the footer of all pages in the OPAC. > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref >index 62dca5a673..97f0298614 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref >@@ -49,12 +49,6 @@ Staff interface: > - pref: intranet_includes > class: file > - directory in the template directory, instead of <code>includes/</code>. (Leave blank to disable) >- - >- - "Show the following HTML in its own column on the main page of the staff interface:" >- - pref: IntranetmainUserblock >- type: textarea >- syntax: text/html >- class: code > - > - "Show the following HTML to the left of the More menu at the top of each page on the staff interface (should be a list of links or blank):" > - pref: IntranetNav >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index c066fe3ace..fa22b3f742 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -3,6 +3,7 @@ > [% USE Koha %] > [% USE Branches %] > [% USE KohaDates %] >+[% USE AdditionalContents %] > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >@@ -277,17 +278,21 @@ > </div> <!-- /.col-sm-12 --> > </div> <!-- /.row --> > >- [% IF ( IntranetmainUserblock ) %] >+ [% SET IntranetmainUserblock = AdditionalContents.get( location => "IntranetmainUserblock", lang => lang, library => logged_in_user.branchcode || default_branch ) %] >+ >+ [% IF ( IntranetmainUserblock.content && IntranetmainUserblock.content.count > 0 ) %] > <div class="row"> > <div class="col-sm-12"> >- <div id="area-userblock" class="page-section"> >- <div class="user-info"> >- [% IntranetmainUserblock | $raw %] >- </div> >- </div> >- </div> >- </div> >- [% END %] >+ <div id="[% IntranetmainUserblock.location | html %]" class="page-section"> >+ [% FOREACH n IN IntranetmainUserblock.content %] >+ <div class="[% n.lang | html %]_item"> >+ <div class="[% n.lang | html %]_body">[% n.content | $raw %]</div> >+ </div> >+ [% END %] >+ </div> <!-- /#IntranetmainUserblock --> >+ </div> <!-- /.col-sm-12 --> >+ </div> <!-- /.row --> >+ [% END # /IF IntranetmainUserblock %] > > <div class="row"> > <div class="col-sm-12"> >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 cf372332c3..1b015c9240 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 >@@ -534,7 +534,7 @@ > [% END %] > [% END %] > </optgroup> >- [% SET staff_available_options = [ 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', 'StaffCataloguingHome', 'StaffListsHome', 'StaffPatronsHome', 'StaffPOSHome', 'StaffSerialsHome' ] %] >+ [% SET staff_available_options = [ 'IntranetmainUserblock', 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', 'StaffCataloguingHome', 'StaffListsHome', 'StaffPatronsHome', 'StaffPOSHome', 'StaffSerialsHome' ] %] > <optgroup label="Staff"> > [% FOREACH l IN staff_available_options.sort %] > [% IF l == location %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35153
:
159177
|
159551
|
159721
|
162958
|
167243