Instead of directly displaying the URL entered into the URI (Uniform Resource Identifier) field the patch attached to this bug report will allow the user to input a link text to be displayed instead of the URL on the intranet and OPAC detail page.
Created attachment 67343 [details] [review] 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
When running the QA test tool all files pass except the detail.tt (see below) I reverted the changes I made and it still fails, so I believe that it is a bug introduced by a previous patch. I have written a bug report for this template (bug 19363) FAIL koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt OK forbidden patterns OK git manipulation OK spelling OK tt_valid FAIL valid_template Attempt to reload Koha/Template/Plugin/Koha.pm aborted. Compilation failed in require at /usr/lib/x86_64-linux-gnu/perl5/5.20/Template/Plugins.pm line 206.
Hi Alex, I think this might be a duplicate to bug 15352. Maybe you could take a look and help fixing it?
Hm, maybe only touching the same area
I followed the test plan up to step 8, but I still got an database error message when trying to add an item : DBIx::Class::Storage::DBI::_dbh_execute(): Unknown column 'me.link_text' in 'field list' at /inlibro/git/koha-master-dev-inlibro/Koha/Objects.pm line 92 Looking at the commit, I didn't see any SQL files, did you forget to add it?
Can't find any SQL either...
Created attachment 67662 [details] [review] Bug 19360 - Added missing atomicupdate SQL file 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
Hi David Sorry I missed the SQL atomicupdate files in the first patch, I have just attached them in this second patch, can you please test again?
Created attachment 67706 [details] [review] 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>
Created attachment 67707 [details] [review] Bug 19360 - Added missing atomicupdate SQL file 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>
Tested according to test plan, worked as announced. Note: I find it easier to update the DB by running installer/data/mysql/updatedatabase.pl than by changing the version number. I think it would be preferable to have the 'Link Text' input right under the 'URI' input, but from what I understand of the code this would require moving many things around, for a small benefit, so not a priority.
In my test the link text didn't appear in the OPAC. It read "Link to resource" instead. David did you not find that to be the case?
Created attachment 67711 [details] OPAC with and without Link_text Are you editing the marc 856$u field or the item field? When adding an item (cataloguing/additem.pl) I had an input field for "k - Link text" and "u - URI". I attached a picture of what it looked like for me in the OPAC.
Alex, please make the changes to Koha::Schema namespace a separate patch. It always should be done this way and generated by misc/devel/update_dbix_class_files.pl. Also the patches need rebase.
Created attachment 70967 [details] [review] 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>
Created attachment 70968 [details] [review] Bug 19360 - Added missing atomicupdate SQL file 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>
Created attachment 70969 [details] [review] Schema changes
Was an easy rebase, split the schema updtaes to separate patch and added cfhanges to kohastructure and deleteditems table - very cool feature
Comment on attachment 70967 [details] [review] Bug 19360 - Give items URL a link text Review of attachment 70967 [details] [review]: ----------------------------------------------------------------- ::: koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ +1215,4 @@ > <th id="item_priority" data-colname="item_priority">Item hold queue priority</th> > [% END %] > [% IF ( ShowCourseReservesHeader ) %] > + <th id="item_coursereserves">Course reserves</th> Why do you changed this line? How it is related to this issue?
Comment on attachment 70968 [details] [review] Bug 19360 - Added missing atomicupdate SQL file Review of attachment 70968 [details] [review]: ----------------------------------------------------------------- ::: installer/data/mysql/atomicupdate/Bug-19360_Add_Link_text_field_to_items.sql @@ +9,5 @@ > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'IR', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'KT', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'SER', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'SR', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'VR', NULL) I think you should add this field only to frameworks that does exist, have field 952 defined and 952$k not defined. Also, this field needs to be added to installer data.
Hm, we don't have a lot of subfields left and $k and $u are rather far apart in the form, so editing won't be nice. I'd prefer something like url|text and maybe make the field repeatable as well in the future. with $k and $u separate, this would be a lot harder. We could also think about a plugin hiding the way we store the data but displaying it nicely. This patch is in competition with bug 18760 for the last available free subfield $k.
(In reply to Katrin Fischer from comment #21) > Hm, we don't have a lot of subfields left and $k and $u are rather far apart > in the form, so editing won't be nice. I'd prefer something like url|text > and maybe make the field repeatable as well in the future. with $k and $u > separate, this would be a lot harder. We could also think about a plugin > hiding the way we store the data but displaying it nicely. > > This patch is in competition with bug 18760 for the last available free > subfield $k. I agree, the plugin and only one field in database looks like better aproach here. We need the link text to bind with the URL - imagine somebody wants to have more then one URL field on item...
Thanks for the comments. Sorry I have been travelling for the last few months and so haven't worked on this for a little while, however I am back into it now and am keen to push it forward. So Katrin and Josef to clarify would you like a single database field holding both the uri and link text with a delimiter? Then when the user loads the item page the value of this field is split at the delimiter and the URL is set as the form action and the link text is displayed? If so, couldn't I simply remove the $k subfield and store this data value (with a data delimiter) in the $u subfield, rather than adding a brand new field url|text? I am not familiar with Koha plugins so I've had a look at the kitchen sink example plugin and it looks like I'd need to make a tool plugin and it would need to be accessed via a link in the cataloguing/addbiblio.tt file. The .tt file of this plugin will contain two inputs (url and link text inputs) which the backend logic concatenates and separates with a delimiter before this data value is stored in the 952$u database field of marc_subfield_structure database table.
Hi Alex, welcome back! > If so, couldn't I simply remove the $k subfield and store this data value > (with a data delimiter) in the $u subfield, rather than adding a brand new > field url|text? Yes, I think that was the thought, also to keep the last subfield $k free for now. > > I am not familiar with Koha plugins so I've had a look at the kitchen sink > example plugin and it looks like I'd need to make a tool plugin and it would > need to be accessed via a link in the cataloguing/addbiblio.tt file. Sorry, need to clarify. There are different kinds of plugins in Koha :) I was thinking of a value builder that you can link to the subfield via the framework configuration (look for plugin as an option there). It's older and a bit simpler than the new plugins. We use one for dateacccessioned in items, and some others are present in the record, as the helpers for the 00x fields or the authority linker. > The .tt file of this plugin will contain two inputs (url and link text > inputs) which the backend logic concatenates and separates with a delimiter > before this data value is stored in the 952$u database field of > marc_subfield_structure database table. That was the idea - but my initial suggestion of | is not good I think. If you mark $u repeatable in the frameworks, Koha uses | for sorting multiples. Might have to think about something else, that is no tin a URL.
Thanks very much Katrin! I started work on writing the value builder this evening, based on dateacccessioned.pl. Will hopefully have it ready to test by the end of the week.
*** Bug 8090 has been marked as a duplicate of this bug. ***
Hi, This is still a really good idea, and people are still asking for this feature - what are the chances of work continuing on this bug? Seems like it's only getting more common for libraries to have one item that they have many different online sources for! Cheers, Liz
Hi Liz, Marking as new as I don't have time to work on this at the moment, hopefully someone else will pick it up or I'll try to give it a go over Christmas!
Christmastime is a perfectly acceptable timeline if you have a chance to get to it :D
Comment on attachment 70968 [details] [review] Bug 19360 - Added missing atomicupdate SQL file Review of attachment 70968 [details] [review]: ----------------------------------------------------------------- ::: installer/data/mysql/atomicupdate/Bug-19360_Add_Link_text_field_to_items.sql @@ +9,5 @@ > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'IR', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'KT', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'SER', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'SR', NULL), > +(952, 'k', 'Link text', 'Link text', 0, 0, 'items.link_text', 10, 1, 0, 'VR', NULL) Good call. I did some digging around and it looks like once upon a time 952$k did exist. git log --follow --name-only -- installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql git show f8e9fb6445dadbdef91e13a253c9c6bcb75e0eec +INSERT INTO `marc_subfield_structure` VALUES ('952', 'k', 'Call number (similar to 852 $k $h $i $m combined)', 'Call number', 0, 0, 'items.itemcallnumber', 10, '', '', NULL, 0, 0, '', '', '');
Locally, we have a few customizations for this one, but the one typically used is to just render "Link to resource" instead of the URI as the link text. (The main complaint we got was just that long/complicated URLs are annoying/ugly.) (Also added support for URLLinkText, and the option to use the item's item type as the link text.) It's a lightweight touch that doesn't require any schema changes, although it wouldn't be as full featured as this one. But just a thought.