Support linking to library info from copy display
authorDan Scott <dscott@laurentian.ca>
Mon, 8 Jul 2013 18:06:48 +0000 (14:06 -0400)
committerDan Scott <dan@coffeecode.net>
Mon, 22 Jul 2013 14:51:41 +0000 (10:51 -0400)
If the "Library information URL" library setting has a value, then the
copy display section of the TPAC and KPAC will turn the library name
for that branch into a link to the given URL. This supports the patron
goal of quickly finding branch information such as hours of operation,
directions, and contact information.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Dan Scott <dan@coffeecode.net>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.add_library_info_url_OUS.sql [new file with mode: 0644]
Open-ILS/src/templates/kpac/parts/copy_table.tt2
Open-ILS/src/templates/opac/parts/misc_util.tt2
Open-ILS/src/templates/opac/parts/record/copy_table.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2
docs/RELEASE_NOTES_NEXT/OPAC/link_library_names.txt [new file with mode: 0644]

index f6a42f4..fb3b637 100644 (file)
@@ -3831,6 +3831,15 @@ INSERT into config.org_unit_setting_type
         'coust', 'description'),
     'string', null)
 
+,( 'lib.info_url', 'lib',
+    oils_i18n_gettext('lib.info_url',
+        'Library information URL (such as "http://example.com/about.html")',
+        'coust', 'label'),
+    oils_i18n_gettext('lib.info_url',
+        'URL for information on this library, such as contact information, hours of operation, and directions. If set, the library name in the copy details section links to that URL. Use a complete URL, such as "http://example.com/hours.html".',
+        'coust', 'description'),
+    'string', null)
+
 ,( 'notice.telephony.callfile_lines', 'lib',
     oils_i18n_gettext('notice.telephony.callfile_lines',
         'Telephony: Arbitrary line(s) to include in each notice callfile',
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.add_library_info_url_OUS.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.add_library_info_url_OUS.sql
new file mode 100644 (file)
index 0000000..623539b
--- /dev/null
@@ -0,0 +1,11 @@
+INSERT into config.org_unit_setting_type
+( name, grp, label, description, datatype, fm_class ) VALUES
+( 'lib.info_url', 'lib',
+    oils_i18n_gettext('lib.info_url',
+        'Library information URL (such as "http://example.com/about.html")',
+        'coust', 'label'),
+    oils_i18n_gettext('lib.info_url',
+        'URL for information on this library, such as contact information, hours of operation, and directions. If set, the library name in the copy details section links to that URL. Use a complete URL, such as "http://example.com/hours.html".',
+        'coust', 'description'),
+    'string', null)
+;
index 7939987..58fc329 100644 (file)
@@ -36,7 +36,15 @@ END;
             END;
         -%]
         <tr>
-            <td class="location">[% ctx.get_aou(copy_info.circ_lib).name | html %]</td>
+            <td class="location">
+            [%-
+                org_name = ctx.get_aou(copy_info.circ_lib).name;
+                lib_url = ctx.get_org_setting(copy_info.circ_lib, 'lib.info_url');
+                IF lib_url; '<a href="'; lib_url | url; '">'; END;
+                org_name | html;
+                IF lib_url; '</a>'; END;
+            -%]
+            </td>
             [%- IF has_parts == 'true' %]
             <td class="callnumber">[% l('[_1] ([_2])', callnum, copy_info.part_label) | html %]</td>
             [% ELSE %]
index 63d6b44..5c18d60 100644 (file)
                     status = copy.findnodes('./*[local-name()="status"]');
                     NEXT IF status.getAttribute('opac_visible') == 'false';
 
+                    # extract the circ_lib id from the circ_lib node
+                    circ_lib = copy.findnodes('./*[local-name()="circ_lib"]');
+                    circ_lib_id = circ_lib.getAttribute('id').replace('.*/', '');
+
                     UNLESS ou_hiding_disabled;
-                        # extract the circ_lib id from the circ_lib node
-                        circ_lib = copy.findnodes('./*[local-name()="circ_lib"]');
-                        circ_lib_id = circ_lib.getAttribute('id').replace('.*/', '');
                         NEXT UNLESS ctx.org_within_hiding_scope(circ_lib_id);
                     END;
 
                     holding = {
+                        circ_lib => circ_lib_id,
                         label => vol.label,
                         part_label => part_label,
                         location => loc.textContent,
index e82ba2b..9a71bce 100644 (file)
@@ -74,7 +74,10 @@ END;
             [%- ELSE %]<td header='copy_header_library'>
             [%-
                 org_name = ctx.get_aou(copy_info.circ_lib).name;
-                org_name | html
+                lib_url = ctx.get_org_setting(copy_info.circ_lib, 'lib.info_url');
+                IF lib_url; '<a href="'; lib_url | url; '">'; END;
+                org_name | html;
+                IF lib_url; '</a>'; END;
             -%]
             </td>[% END %]
             <td header='copy_header_callnumber'>[% callnum | html %] [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %](<a href="[% mkurl(ctx.opac_root _ '/sms_cn', {copy_id => copy_info.id}) %]">Text</a>)[% END %]</td>
index 0c0b27c..65b475c 100644 (file)
@@ -233,7 +233,14 @@ END;
                                                                         <tbody>
                                                                 [% FOR copy IN args.holdings %]
                                                                         <tr>
-                                                                            <td>[% copy.library | html %]</td>
+                                                                            <td>
+[%-
+    lib_url = ctx.get_org_setting(copy.circ_lib, 'lib.info_url');
+    IF lib_url; '<a href="'; lib_url | url; '">'; END;
+    copy.library | html;
+    IF lib_url; '</a>'; END;
+-%]
+                                                                            </td>
                                                                             <td>[% copy.location | html %]</td>
                                                                             <td>[% copy.label | html %]</td>
                                                                             [%- IF has_parts == 'true'; %]
diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/link_library_names.txt b/docs/RELEASE_NOTES_NEXT/OPAC/link_library_names.txt
new file mode 100644 (file)
index 0000000..7b926ce
--- /dev/null
@@ -0,0 +1,14 @@
+Linked library names in copy details
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A patron may find one or more available copies of an item that they want to
+retrieve, but may not be familiar with the location, hours of operation, or
+contact information for each branch of their local library system. To enable
+the patron to quickly access information about a given library branch, the TPAC
+and KPAC can link the name of the branch in the copy details display to a URL
+associated with that branch.
+
+To set the URL for a given branch, use the *Local Administration -> Library
+Settings Editor* and edit the *Library Information URL* setting for that
+branch. Any branches that do not have a library information URL setting display
+as normal text.