From bf661abb31b1efcea5b34b0dc8a79daa1390e7ec Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 19 Apr 2017 01:40:13 +0000 Subject: [PATCH] Bug 15352: Add syspref URLLinkTextItems, defines text to display for URL URLLinkTextItems replaces the URL of an item on catalog detail pages with this placeholder. To test: 1) Apply patch and update database 2) Edit an item (not a record) and add a URL (field u) 3) Notice the detail page shows the full URL in staff client and OPAC. If this is a very long URL it looks really ugly 4) Go to Admin -> Search for URLLinkTextItems syspref 5) Type something in the textbox (eg: "This is a link") 6) Refresh the detail pages for the record on staff client and OPAC. Confirm the text you entered has replaced the URL text. 7) Confirm the link still redirects you as expected. Sponsored-by: Catalyst IT --- .../bug_15352_-_add_URLLinkTextItems_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../en/modules/admin/preferences/cataloguing.pref | 4 +++ .../prog/en/modules/catalogue/detail.tt | 6 ++++- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 31 ++++++++++++++++------ 5 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_15352_-_add_URLLinkTextItems_syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_15352_-_add_URLLinkTextItems_syspref.sql b/installer/data/mysql/atomicupdate/bug_15352_-_add_URLLinkTextItems_syspref.sql new file mode 100644 index 0000000..67b18e2 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_15352_-_add_URLLinkTextItems_syspref.sql @@ -0,0 +1 @@ +INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('URLLinkTextItems', '', NULL, 'Replace links for items with this text', 'Free'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 64aa493..f73e0e8 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -542,6 +542,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'), ('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'), ('URLLinkText','',NULL,'Text to display as the link anchor in the OPAC','free'), +('URLLinkTextItems', '', NULL, 'Replace links for items with this text', 'Free'), ('UsageStats', 0, NULL, 'Share anonymous usage data on the Hea Koha community website.', 'YesNo'), ('UsageStatsCountry', '', NULL, 'The country where your library is located, to be shown on the Hea Koha community website', 'Choice'), ('UsageStatsID', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.', 'Free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index 1aeadf9..a261b2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -127,6 +127,10 @@ Cataloging: - If the pref is empty, no fields are restricted. Display: - + - Show + - pref: URLLinkTextItems + - as the text of links for items. + - - 'Separate multiple displayed authors, series or subjects with ' - pref: AuthoritySeparator class: short diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index b9bf9ed..d10def1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -783,7 +783,11 @@ function verify_images() { [% END %] [% IF ( itemdata_uri ) %] - [% item.uri %] + [% IF ( Koha.Preference('URLLinkTextItems') && item.uri ) %] + [% Koha.Preference('URLLinkTextItems') %] + [% ELSE %] + [% item.uri %] + [% END %] [% END %] [% IF ( itemdata_copynumber ) %] [% item.copynumber %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index ca6e1b1..769408f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1288,18 +1288,33 @@ [% IF ( itemdata_uri ) %] [% IF ITEM_RESULT.uri %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - Link to resource + [% IF Koha.Preference('URLLinkTextItems') %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + [% IF Koha.Preference("OPACURLOpenInNewWindow") %] + [% Koha.Preference('URLLinkTextItems') %] + [% ELSE %] + [% Koha.Preference('URLLinkTextItems') %] + [% END %] [% ELSE %] - Link to resource + [% IF Koha.Preference("OPACURLOpenInNewWindow") %] + [% Koha.Preference('URLLinkTextItems') %] + [% ELSE %] + [% Koha.Preference('URLLinkTextItems') %] + [% END %] [% END %] - [% ELSE %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - [% ITEM_RESULT.uri %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + [% IF Koha.Preference("OPACURLOpenInNewWindow") %] + Link to resource + [% ELSE %] + Link to resource + [% END %] [% ELSE %] - [% ITEM_RESULT.uri %] + [% IF Koha.Preference("OPACURLOpenInNewWindow") %] + [% ITEM_RESULT.uri %] + [% ELSE %] + [% ITEM_RESULT.uri %] + [% END %] [% END %] [% END %] [% END %] -- 2.1.4