From d1fc46a0d731524846987c480b06d535f8d6c8b6 Mon Sep 17 00:00:00 2001 From: Michele Morgan Date: Mon, 8 May 2017 15:08:11 -0400 Subject: [PATCH] LP#1687971 - Make copy locations in the OPAC clickable. Adds a url field to asset.copy_location. The presence of a url in the field will cause the copy location to display as a link in the OPAC. Urls can be edited in the Copy Locations Editor. Additional contributors: Martha Driscoll, Christine Morgan, Suzanne Paterno. Signed-off-by: Michele Morgan Signed-off-by: Galen Charlton --- Open-ILS/examples/fm_IDL.xml | 1 + Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm | 3 ++- Open-ILS/src/sql/Pg/040.schema.asset.sql | 3 ++- .../src/sql/Pg/upgrade/XXXX.asset.copy_location.url.sql | 6 ++++++ Open-ILS/src/templates/opac/parts/location_name_link.tt2 | 14 ++++++++++++++ Open-ILS/src/templates/opac/parts/record/copy_table.tt2 | 2 +- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 ++ Open-ILS/xul/staff_client/server/admin/copy_locations.js | 11 +++++++++++ .../xul/staff_client/server/admin/copy_locations.xhtml | 8 ++++++-- docs/RELEASE_NOTES_NEXT/OPAC/clickable_copy_locations.adoc | 4 ++++ 10 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.asset.copy_location.url.sql create mode 100644 Open-ILS/src/templates/opac/parts/location_name_link.tt2 create mode 100644 docs/RELEASE_NOTES_NEXT/OPAC/clickable_copy_locations.adoc diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 02ffe75264..86a9f3b645 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4760,6 +4760,7 @@ SELECT usr, + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm index a8c6c9ff63..b24a0db6a7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm @@ -2049,7 +2049,8 @@ sub basic_opac_copy_query { 'age_protect', 'holdable', 'copy_number'], acpl => [ {column => 'name', alias => 'copy_location'}, - {column => 'holdable', alias => 'location_holdable'} + {column => 'holdable', alias => 'location_holdable'}, + {column => 'url', alias => 'location_url'} ], ccs => [ {column => 'id', alias => 'status_code'}, diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 4375013400..283b476bbd 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -32,7 +32,8 @@ CREATE TABLE asset.copy_location ( label_prefix TEXT, label_suffix TEXT, checkin_alert BOOL NOT NULL DEFAULT FALSE, - deleted BOOL NOT NULL DEFAULT FALSE + deleted BOOL NOT NULL DEFAULT FALSE, + url TEXT ); CREATE UNIQUE INDEX acl_name_once_per_lib ON asset.copy_location (name, owning_lib) WHERE deleted = FALSE OR deleted IS FALSE; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.asset.copy_location.url.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.asset.copy_location.url.sql new file mode 100644 index 0000000000..6851669ff3 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.asset.copy_location.url.sql @@ -0,0 +1,6 @@ +BEGIN; + +ALTER TABLE asset.copy_location + ADD COLUMN url TEXT; + +COMMIT; diff --git a/Open-ILS/src/templates/opac/parts/location_name_link.tt2 b/Open-ILS/src/templates/opac/parts/location_name_link.tt2 new file mode 100644 index 0000000000..06df2351ac --- /dev/null +++ b/Open-ILS/src/templates/opac/parts/location_name_link.tt2 @@ -0,0 +1,14 @@ +[%- + opac_root = ctx.opac_root; + IF ctx.kpac_root; + opac_root = ctx.kpac_root; + END; + + loc_name = copy_info.copy_location; + loc_url = copy_info.location_url; + + IF loc_url; ''; END; + ''; loc_name | html; ''; + IF loc_url; ''; END; +-%] + diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 index 3d4dae487e..ec8dda4fb8 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -136,7 +136,7 @@ END; # FOREACH bib ''; END; -%] - [% copy_info.copy_location | html %] + [%- INCLUDE "opac/parts/location_name_link.tt2"; -%] [%- IF ctx.is_staff %] [% copy_info.age_protect ? diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 4e39205979..fdbec28fe0 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2204,6 +2204,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/admin/copy_locations.js b/Open-ILS/xul/staff_client/server/admin/copy_locations.js index da25abc47e..6adc1c99c3 100644 --- a/Open-ILS/xul/staff_client/server/admin/copy_locations.js +++ b/Open-ILS/xul/staff_client/server/admin/copy_locations.js @@ -125,6 +125,7 @@ function clCreateNew() { cl.checkin_alert( $('cl_new_checkin_alert_yes').checked ? 1 : 0 ); cl.label_prefix( $('cl_new_label_prefix').value ); cl.label_suffix( $('cl_new_label_suffix').value ); + cl.url( $('cl_new_url').value ); var req = new Request(CREATE_CL, SESSION, cl); req.send(true); @@ -174,6 +175,7 @@ function clBuildRow( tbody, row, cl ) { appendClear($n( row, 'cl_checkin_alert'), (isTrue(cl.checkin_alert())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) ); $n( row, 'cl_label_prefix').appendChild(text(cl.label_prefix() || '')); $n( row, 'cl_label_suffix').appendChild(text(cl.label_suffix() || '')); + $n( row, 'cl_url').appendChild(text(cl.url() || '')); var edit = $n( row, 'cl_edit'); edit.onclick = function() { clEdit( cl, tbody, row ); }; @@ -233,6 +235,14 @@ function clEdit( cl, tbody, row ) { } label_suffix.value = cl.label_suffix(); + var url = $n(r, 'cl_edit_url'); + if (cl.url()) { + url.setAttribute('size', cl.url().length + 3); + } else { + url.setAttribute('size', 20); + } + url.value = cl.url(); + $n(r, 'cl_edit_cancel').onclick = function(){cleanTbody(tbody,'edit');} $n(r, 'cl_edit_commit').onclick = function(){clEditCommit( tbody, r, cl ); } @@ -272,6 +282,7 @@ function clEditCommit( tbody, r, cl ) { cl.name($n(r, 'cl_edit_name').value); cl.label_prefix($n(r, 'cl_edit_label_prefix').value); cl.label_suffix($n(r, 'cl_edit_label_suffix').value); + cl.url($n(r, 'cl_edit_url').value); var req = new Request( UPDATE_CL, SESSION, cl ); req.send(true); diff --git a/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml b/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml index 0d4fb94c68..412279bece 100644 --- a/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml @@ -103,8 +103,10 @@ -   -   + &staff.server.admin.copy_locations.editor.url.label; + + + &staff.server.admin.copy_locations.editor.prefix.label; @@ -140,6 +142,7 @@ &staff.server.admin.copy_locations.editor.checkin_alert; &staff.server.admin.copy_locations.editor.prefix; &staff.server.admin.copy_locations.editor.suffix; + &staff.server.admin.copy_locations.editor.url; &staff.server.admin.copy_locations.editor.edit; &staff.server.admin.copy_locations.editor.delete; @@ -158,6 +161,7 @@ + diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/clickable_copy_locations.adoc b/docs/RELEASE_NOTES_NEXT/OPAC/clickable_copy_locations.adoc new file mode 100644 index 0000000000..ee7c48a112 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/OPAC/clickable_copy_locations.adoc @@ -0,0 +1,4 @@ +Clickable Copy Locations +^^^^^^^^^^^^^^^^^^^^^^^^ +Adds a url field to the copy locations editor. When a url is entered in this field, +the associated copy location will display as a link in the opac summary display. -- 2.11.0