Bugzilla – Attachment 70967 Details for
Bug 19360
Give items URL a link text
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19360 - Give items URL a link text
Bug-19360---Give-items-URL-a-link-text.patch (text/plain), 11.58 KB, created by
Nick Clemens
on 2018-01-26 16:33:59 UTC
(
hide
)
Description:
Bug 19360 - Give items URL a link text
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2018-01-26 16:33:59 UTC
Size:
11.58 KB
patch
obsolete
>From 2361eb68505a3fae8c0e96ee4a96705d80a95548 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 26 Jan 2018 16:15:05 +0000 >Subject: [PATCH] Bug 19360 - Give items URL a link text > >This patch allows a user to write in a link text when adding an item to >a MARC record in addition to a URI. The link text is displayed instead >of the URI (only if a link text has been entered, otherwise the URI >value is displayed) which makes the link more readable. > >Test plan: >1. Add a MARC record (of any framework) > >2. Add an item making sure to write in a URL e.g. https://www.google.com > >3. Notice on the additem page there is no 'Link text' input > >4. Submit the add item form > >5. Search for the item in the intranet and OPAC and notice that the >whole URL is displayed, which would get annoying if the URL is long > >6. Apply patch > >7. Update the database by going to Administration->Global system >preferences-> local use and change the 'version' system preference to an >previous version and then click 'Save' > >8. This will prompt the update process > >9. After going through the update process repeat step 1 and add an item. >When adding the item notice there is a 'Link text' option write in an >appropriate name e.g. 'Google' and write in the URI value > >10. Submit the form > >11. Repeat step 5 and notice that the link text value is displayed >instead of the URL > >12. Click on the link and check that it works > >13. Add another item to a record and write in a URI but no link text >value > >14. Search for the item in intranet and OPAC and notice that when no >link text is entered but a URI is then the URI is displayed > >Sponsored-By: Catalyst IT > >Signed-off-by: David Bourgault <david.bourgault@inlibro.com> >--- > C4/Items.pm | 5 ++++- > catalogue/detail.pl | 3 ++- > installer/data/mysql/kohastructure.sql | 2 ++ > .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 10 +++++++--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 17 +++++++++++++---- > opac/opac-detail.pl | 3 ++- > 6 files changed, 30 insertions(+), 10 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index a7154be..ba2f882 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -479,6 +479,7 @@ sub _build_default_values_for_mod_marc { > stocknumber => undef, > uri => undef, > withdrawn => 0, >+ link_text => undef, > }; > my %default_values_for_mod_from_marc; > while ( my ( $field, $default_value ) = each %$default_values ) { >@@ -1793,7 +1794,8 @@ sub _koha_new_item { > more_subfields_xml = ?, > copynumber = ?, > stocknumber = ?, >- new_status = ? >+ new_status = ?, >+ link_text = ? > "; > my $sth = $dbh->prepare($query); > my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); >@@ -1838,6 +1840,7 @@ sub _koha_new_item { > $item->{'copynumber'}, > $item->{'stocknumber'}, > $item->{'new_status'}, >+ $item->{'link_text'} > ); > > my $itemnumber; >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 1359c0b..7fd682a 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -249,7 +249,7 @@ foreach my $item (@items) { > $item->{'ccode'} = $collections->{$ccode} if ( defined( $ccode ) && defined($collections) && exists( $collections->{$ccode} ) ); > my $copynumber = $item->{'copynumber'}; > $item->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumber) && defined($copynumbers) && exists( $copynumbers->{$copynumber} ) ); >- foreach (qw(ccode enumchron copynumber stocknumber itemnotes itemnotes_nonpublic uri)) { >+ foreach (qw(ccode enumchron copynumber stocknumber itemnotes itemnotes_nonpublic uri link_text)) { > $itemfields{$_} = 1 if ( $item->{$_} ); > } > >@@ -362,6 +362,7 @@ $template->param( > volinfo => $itemfields{enumchron}, > itemdata_itemnotes => $itemfields{itemnotes}, > itemdata_nonpublicnotes => $itemfields{itemnotes_nonpublic}, >+ itemdata_linktext => $itemfields{link_text}, > z3950_search_params => C4::Search::z3950_search_args($dat), > hostrecords => $hostrecords, > analytics_flag => $analytics_flag, >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index f031503..127f29b 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -696,6 +696,7 @@ CREATE TABLE `deleteditems` ( > `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) > `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) > `new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. >+ `link_text` VARCHAR(200) DEFAULT NULL, -- text displayed when uri present in item record. > PRIMARY KEY (`itemnumber`), > KEY `delitembarcodeidx` (`barcode`), > KEY `delitemstocknumberidx` (`stocknumber`), >@@ -956,6 +957,7 @@ CREATE TABLE `items` ( -- holdings/item information > `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) > `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) > `new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. >+ `link_text` VARCHAR(200) DEFAULT NULL, -- text displayed when uri present in item record. > PRIMARY KEY (`itemnumber`), > UNIQUE KEY `itembarcodeidx` (`barcode`), > KEY `itemstocknumberidx` (`stocknumber`), >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 c3d9df3..9a0174b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -251,7 +251,7 @@ > <li><strong>Dewey:</strong> [% dewey %]</li> > [% END %] > [% IF ( urlS ) %] >- <li><strong>URL:</strong> >+ <li><strong>URL/Link:</strong> > [% FOREACH url IN urlS %] > <a href="[% url.url %]">[% url.url %]</a> > [% END %] >@@ -338,7 +338,7 @@ > <th>Last seen</th> > <th>Barcode</th> > [% IF ( volinfo ) %]<th>Serial enumeration / chronology</th>[% END %] >- [% IF ( itemdata_uri ) %]<th>URL</th>[% END %] >+ [% IF ( itemdata_uri ) %]<th>URL/Link</th>[% END %] > [% IF ( itemdata_copynumber ) %]<th>Copy number</th>[% END %] > [% IF ( itemdata_stocknumber ) %]<th>Inventory number</th>[% END %] > [% IF materials %]<th>Materials specified</th>[% END %] >@@ -481,7 +481,11 @@ > </td> > [% END %] > [% IF ( itemdata_uri ) %] >- <td class="uri"><a href="[% item.uri %]">[% item.uri %]</a></td> >+ [% IF ( itemdata_linktext ) %] >+ <td class="uri"><a href="[% item.uri %]">[% item.link_text %]</a></td> >+ [% ELSE %] >+ <td class="uri"><a href="[% item.uri %]">[% item.uri %]</a></td> >+ [% END %] > [% END %] > [% IF ( itemdata_copynumber ) %] > <td class="copynumber">[% item.copynumber %]</td> >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 270fc08..76efe61 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1201,7 +1201,7 @@ > [% IF ( itemdata_enumchron ) %] > <th id="item_enumchron" data-colname="item_enumchron" class="vol_info">Vol info</th>[% END %] > [% IF ( itemdata_uri ) %] >- <th id="item_url" data-colname="item_url" class="url">URL</th>[% END %] >+ <th id="item_url" data-colname="item_url" class="url">URL/Link</th>[% END %] > [% IF ( itemdata_copynumber ) %] > <th id="item_copy" data-colname="item_copy" class="copynumber">Copy number</th>[% END %] > <th id="item_status" data-colname="item_status" class="status">Status</th> >@@ -1215,7 +1215,8 @@ > <th id="item_priority" data-colname="item_priority">Item hold queue priority</th> > [% END %] > [% IF ( ShowCourseReservesHeader ) %] >- <th id="item_coursereserves" data-colname="item_coursereserves">Course reserves</th>[% END %] >+ <th id="item_coursereserves">Course reserves</th> >+ [% END %] > </tr> > </thead> > <tbody> >@@ -1330,9 +1331,17 @@ > > [% ELSE %] > [% IF Koha.Preference("OPACURLOpenInNewWindow") %] >- <a target="_blank" rel="noreferrer" href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a> >+ [% IF ITEM_RESULT.link_text %] >+ <a target="_blank" rel="noreferrer" href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.link_text %]</a> >+ [% ELSE %] >+ <a target="_blank" rel="noreferrer" href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a> >+ [% END %] > [% ELSE %] >- <a href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a> >+ [% IF ITEM_RESULT.link_text %] >+ <a href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.link_text %]</a> >+ [% ELSE %] >+ <a href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a> >+ [% END %] > [% END %] > [% END %] > [% END %] >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index bdef7d8..bad60bd 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -686,7 +686,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { > $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} ); > $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{translated_description}; > } >- foreach (qw(ccode enumchron copynumber itemnotes location_description uri)) { >+ foreach (qw(ccode enumchron copynumber itemnotes location_description uri link_text)) { > $itemfields{$_} = 1 if ($itm->{$_}); > } > >@@ -760,6 +760,7 @@ my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib > itemdata_copynumber => $itemfields{copynumber}, > itemdata_itemnotes => $itemfields{itemnotes}, > itemdata_location => $itemfields{location_description}, >+ itemdata_linktext => $itemfields{link_text}, > subtitle => $subtitle, > OpacStarRatings => C4::Context->preference("OpacStarRatings"), > ); >-- >2.1.4
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 19360
:
67343
|
67662
|
67706
|
67707
|
67711
| 70967 |
70968
|
70969