From 9dfeaa4914245729cd129d0b9133fc2e1a5a6f32 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 16 Aug 2012 12:53:25 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 6494 - opacmysummaryhtml on reading history This patch re-uses code and markup from opac-user.tt & .pl to place the contents of the opacmysummaryhtml preference on the circulation history page in exactly the same way it appears on the "my summary" page. The wording of the system preference description has been modified to reflect this addition. Signed-off-by: Nicole C. Engard Works as advertised. --- installer/data/mysql/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/opac.pref | 2 +- .../prog/en/modules/opac-readingrecord.tt | 6 ++++++ opac/opac-readingrecord.pl | 11 +++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f5a18b2..e17b51f 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -280,7 +280,7 @@ INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanatio INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'DisplayClearScreenButton', '0', '', 'If set to ON, a clear screen button will appear on the circulation page.', 'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patron''s cardnumber will be shown instead of their name on the holds and catalog screens', 'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACSearchForTitleIn','
  • Other Libraries (WorldCat)
  • \n
  • Other Databases (Google Scholar)
  • \n
  • Online Stores (Bookfinder.com)
  • \n
  • Open Library (openlibrary.org)
  • ','Enter the HTML that will appear in the \'Search for this title in\' box on the detail page in the OPAC. Enter {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the URL. Leave blank to disable \'More Searches\' menu.','70|10','Textarea'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACMySummaryHTML','','Enter the HTML that will appear in a column on the \'my profile\' tab when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','70|10','Textarea'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACMySummaryHTML','','Enter the HTML that will appear in a column on the \'my summary\' and \'my reading history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACPatronDetails','1','If OFF the patron details tab in the OPAC is disabled.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','If OFF the patron fines tab in the OPAC is disabled.','','YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo'); 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 0fe79d4..50abfeb 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 @@ -199,7 +199,7 @@ OPAC: type: textarea class: code - - - 'Include a "Links" column on the "my summary" tab when a user is logged in to the OPAC, with the following HTML (leave blank to disable):' + - 'Include a "Links" column on the "my summary" and "my reading history" tabs when a user is logged in to the OPAC, with the following HTML (leave blank to disable):' - '
    Note: The placeholders {BIBLIONUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.' - pref: OPACMySummaryHTML type: textarea diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt index 8786925..213deeb 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt @@ -59,6 +59,9 @@ You have never borrowed anything from this library. Item type Call no. Date +[% IF ( OPACMySummaryHTML ) %] +Links +[% END %] [% FOREACH READING_RECOR IN READING_RECORD %] @@ -85,6 +88,9 @@ You have never borrowed anything from this library. [% UNLESS ( noItemTypeImages ) %][% IF ( READING_RECOR.imageurl ) %][% END %][% END %] [% READING_RECOR.description %] [% READING_RECOR.itemcallnumber %] [% IF ( READING_RECOR.returndate ) %][% READING_RECOR.returndate | $KohaDates %][% ELSE %](Checked out)[% END %] +[% IF ( OPACMySummaryHTML ) %] +[% READING_RECOR.MySummaryHTML %] +[% END %] [% END %] diff --git a/opac/opac-readingrecord.pl b/opac/opac-readingrecord.pl index 3e78c9a..0c92de6 100755 --- a/opac/opac-readingrecord.pl +++ b/opac/opac-readingrecord.pl @@ -97,6 +97,16 @@ foreach my $issue (@{$issues} ) { $line{'description'} = $itemtypes->{ $issue->{'itemtype'} }->{'description'}; $line{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $issue->{'itemtype'} }->{'imageurl'} ); } + # My Summary HTML + if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){ + $line{author} ? $my_summary_html =~ s/{AUTHOR}/$line{author}/g : $my_summary_html =~ s/{AUTHOR}//g; + $line{title} =~ s/\/+$//; # remove trailing slash + $line{title} =~ s/\s+$//; # remove trailing space + $line{title} ? $my_summary_html =~ s/{TITLE}/$line{title}/g : $my_summary_html =~ s/{TITLE}//g; + $line{normalized_isbn} ? $my_summary_html =~ s/{ISBN}/$line{normalized_isbn}/g : $my_summary_html =~ s/{ISBN}//g; + $line{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$line{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g; + $line{MySummaryHTML} = $my_summary_html; + } push( @loop_reading, \%line ); $line{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($issue->{'biblionumber'})); } @@ -130,6 +140,7 @@ $template->param( showfulllink => 1, readingrecview => 1, count => scalar @loop_reading, + OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0, ); output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.2.3