Bugzilla – Attachment 106326 Details for
Bug 23797
Convert OpacLoginInstructions system preference to news block
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23797: Convert OpacLoginInstructions system preference to news block
Bug-23797-Convert-OpacLoginInstructions-system-pre.patch (text/plain), 10.08 KB, created by
Owen Leonard
on 2020-06-26 10:45:56 UTC
(
hide
)
Description:
Bug 23797: Convert OpacLoginInstructions system preference to news block
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-06-26 10:45:56 UTC
Size:
10.08 KB
patch
obsolete
>From 4261e6adad3f36e1848616783c9d2a65ae4b3b7d Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 24 Mar 2020 15:06:30 +0000 >Subject: [PATCH] Bug 23797: Convert OpacLoginInstructions system preference to > news block > >This patch builds on Bug 22318 to move the OpacLoginInstructions system >preference into the Koha news system, making it possible to have >language- and library-specific content. > >To test you should have some content in the OpacLoginInstructions system >preference. Apply the patch and run the database update process. > > - Go to the OPAC and click the login link. > - In the login modal, confirm that the content which was previously in > the OpacLoginInstructions system preference displays correctly > below the login form. > - While not logged in to the OPAC, navigate directly to > /cgi-bin/koha/opac-user.pl. The OpacLoginInstructions content should > display correctly here as well. > - In the staff client, go to Tools -> News and verify that the content > from OpacLoginInstructions is now stored in news items. There > should be one entry for each of the enabled translations in your > system, for instance 'OpacLoginInstructions_en', > 'OpacLoginInstructions_fr-FR', 'OpacLoginInstructions_cs-CZ' > - Go to Administration -> System preferences and confirm that the > OpacLoginInstructions preference has been removed. > - To test the correct selection of language-specific content you must > run the translation update/install process for the languages you're > updating. > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> >--- > ...g_23797-move-OpacLoginInstructions-to-news.perl | 30 ++++++++++++++++++++++ > installer/data/mysql/sysprefs.sql | 1 - > .../prog/en/modules/admin/preferences/opac.pref | 6 ----- > .../prog/en/modules/tools/koha-news.tt | 2 +- > .../opac-tmpl/bootstrap/en/modules/opac-auth.tt | 7 +++-- > .../opac-tmpl/bootstrap/en/modules/opac-main.tt | 5 ++-- > 6 files changed, 39 insertions(+), 12 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_23797-move-OpacLoginInstructions-to-news.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_23797-move-OpacLoginInstructions-to-news.perl b/installer/data/mysql/atomicupdate/bug_23797-move-OpacLoginInstructions-to-news.perl >new file mode 100644 >index 0000000000..49d33f92c5 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23797-move-OpacLoginInstructions-to-news.perl >@@ -0,0 +1,30 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ # get list of installed translations >+ require C4::Languages; >+ my @langs; >+ my $tlangs = C4::Languages::getTranslatedLanguages(); >+ >+ foreach my $language ( @$tlangs ) { >+ foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) { >+ push @langs, $sublanguage->{'rfc4646_subtag'}; >+ } >+ } >+ >+ # Get any existing value from the OpacLoginInstructions system preference >+ my ($opaclogininstructions) = $dbh->selectrow_array( q| >+ SELECT value FROM systempreferences WHERE variable='OpacLoginInstructions'; >+ |); >+ if( $opaclogininstructions ){ >+ foreach my $lang ( @langs ) { >+ print "Inserting OpacLoginInstructions contents into $lang news item...\n"; >+ # If there is a value in the OpacLoginInstructions preference, insert it into opac_news >+ $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacLoginInstructions_$lang", $opaclogininstructions); >+ } >+ } >+ # Remove the OpacLoginInstructions system preference >+ $dbh->do("DELETE FROM systempreferences WHERE variable='OpacLoginInstructions'"); >+ SetVersion ($DBversion); >+ print "Upgrade to $DBversion done (Bug 23797: Convert OpacLoginInstructions system preference to news block)\n"; >+} >\ No newline at end of file >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index d67a02b367..e1c4ea5209 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -406,7 +406,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'), > ('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'), > ('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.', 'Choice'), >-('OpacLoginInstructions', '', '60|10', 'Instructions to display on the OPAC login form when a patron is not logged in', 'Textarea'), > ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), > ('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'), > ('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index a0c0672223..bed647240c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -352,12 +352,6 @@ OPAC: > class: integer > - items on the bibliographic record detail page (if the bibliographic record has more items than this, a link is displayed instead that allows the user to choose to display all items). > - >- - "Show the following HTML on the OPAC login form when a patron is not logged in:" >- - pref: OpacLoginInstructions >- type: textarea >- syntax: text/html >- class: code >- - > - "Replace the search box at the top of OPAC pages with the following HTML:" > - pref: OpacCustomSearch > type: textarea >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index 062f0e1642..5ed119a347 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -331,7 +331,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% END %] > [% FOREACH lang_lis IN lang_list %] > <optgroup label="[% lang_lis.language | html %]"> >- [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacMainUserBlock' ] %] >+ [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacMainUserBlock', 'OpacLoginInstructions' ] %] > [% IF ( location == '' ) %] > [% SET location_lang = lang_lis.language %] > [% location = BLOCK %]OPAC news[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >index bbd4c57577..8a53127d4a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >@@ -1,6 +1,9 @@ > [% USE raw %] > [% USE Koha %] > [% USE Categories %] >+[% USE KohaNews %] >+[% PROCESS 'html_helpers.inc' %] >+[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >@@ -176,8 +179,8 @@ > </div> > [% END %] > <div id="nologininstructions"> >- [% IF Koha.Preference('OpacLoginInstructions') %] >- [% Koha.Preference('OpacLoginInstructions') | $raw %] >+ [% IF ( OpacLoginInstructions ) %] >+ [% PROCESS koha_news_block news => OpacLoginInstructions %] > [% ELSE %] > <h5>Don't have a password yet?</h5> > <p>If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.</p> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >index 70ac981762..af3e8e4af7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >@@ -7,6 +7,7 @@ > [% USE KohaNews %] > [% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %] > [% SET OpacMainUserBlock = KohaNews.get( location => "OpacMainUserBlock", lang => lang, library => branchcode ) %] >+[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -175,9 +176,9 @@ > <fieldset class="action"> > <input type="submit" value="Log in" class="btn" /> > </fieldset> >- [% IF Koha.Preference( 'OpacLoginInstructions' ) %] >+ [% IF ( OpacLoginInstructions ) %] > <div id="nologininstructions-main" class="nologininstructions"> >- [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %] >+ [% PROCESS koha_news_block news => OpacLoginInstructions %] > </div> > [% END %] > [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %] >-- >2.11.0
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 23797
:
101610
|
101699
|
106326
|
106396
|
106639
|
106640
|
106641
|
106760
|
106761
|
106762