LP#1687971 - Make copy locations in the OPAC clickable.
authorMichele Morgan <mmorgan@noblenet.org>
Mon, 8 May 2017 19:08:11 +0000 (15:08 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 25 May 2017 13:27:59 +0000 (09:27 -0400)
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 <mmorgan@noblenet.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
Open-ILS/src/sql/Pg/040.schema.asset.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.asset.copy_location.url.sql [new file with mode: 0644]
Open-ILS/src/templates/opac/parts/location_name_link.tt2 [new file with mode: 0644]
Open-ILS/src/templates/opac/parts/record/copy_table.tt2
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/admin/copy_locations.js
Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml
docs/RELEASE_NOTES_NEXT/OPAC/clickable_copy_locations.adoc [new file with mode: 0644]

index 02ffe75..86a9f3b 100644 (file)
@@ -4760,6 +4760,7 @@ SELECT  usr,
                        <field reporter:label="Label Suffix" name="label_suffix"  reporter:datatype="text" oils_persist:i18n="true"/>
                        <field reporter:label="Checkin Alert" name="checkin_alert" reporter:datatype="bool" />
                        <field reporter:label="Is Deleted?" name="deleted" reporter:datatype="bool" />
+                       <field reporter:label="URL" name="url" reporter:datatype="text" />
                </fields>
                <links>
                        <link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
index a8c6c9f..b24a0db 100644 (file)
@@ -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'},
index 4375013..283b476 100644 (file)
@@ -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 (file)
index 0000000..6851669
--- /dev/null
@@ -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 (file)
index 0000000..06df235
--- /dev/null
@@ -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; '<a property="offeredBy" typeof="Library" href="'; loc_url | html; '">'; END;
+    '<span property="name">'; loc_name | html; '</span>';
+    IF loc_url; '</a>'; END;
+-%]
+
index 3d4dae4..ec8dda4 100644 (file)
@@ -136,7 +136,7 @@ END; # FOREACH bib
                     '<meta property="gtin13" content="' _ attrs.gtin13 _ '" />';
                 END; -%]
             </td>
-            <td property="availableAtOrFrom">[% copy_info.copy_location | html %]</td>
+            <td property="availableAtOrFrom">[%- INCLUDE "opac/parts/location_name_link.tt2"; -%]</td>
             [%- IF ctx.is_staff %]
             <td>
                 [% copy_info.age_protect ?
index 4e39205..fdbec28 100644 (file)
 <!ENTITY staff.server.admin.copy_locations.editor.suffix "Label suffix">
 <!ENTITY staff.server.admin.copy_locations.editor.prefix.label "Label prefix: ">
 <!ENTITY staff.server.admin.copy_locations.editor.suffix.label "Label suffix: ">
+<!ENTITY staff.server.admin.copy_locations.editor.url "URL">
+<!ENTITY staff.server.admin.copy_locations.editor.url.label "URL: ">
 <!ENTITY staff.server.admin.copy_locations.editor.welcome "Welcome">
 <!ENTITY staff.server.admin.copy_locations.editor.checkin_alert.label "Checkin Alert: ">
 <!ENTITY staff.server.admin.copy_locations.editor.checkin_alert "Checkin Alert">
index da25abc..6adc1c9 100644 (file)
@@ -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);
index 0d4fb94..412279b 100644 (file)
                             <input type='radio' name='cl_new_checkin_alert'  
                                 id='cl_new_checkin_alert_no' checked='checked'> </input>
                         </td>
-                        <td>&nbsp;</td>
-                        <td>&nbsp;</td>
+                        <td>&staff.server.admin.copy_locations.editor.url.label;</td>
+                        <td>
+                            <input id='cl_new_url' type='text' size='20'/>
+                       </td>
                     </tr>
                     <tr>
                         <td>&staff.server.admin.copy_locations.editor.prefix.label;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.checkin_alert;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.prefix;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.suffix;</td>
+                        <td width=''>&staff.server.admin.copy_locations.editor.url;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.edit;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.delete;</td>
                     </tr>
                         <td name='cl_checkin_alert'> </td>
                         <td name='cl_label_prefix'> </td>
                         <td name='cl_label_suffix'> </td>
+                        <td name='cl_url'> </td>
                         <td><input type='submit' value='&staff.server.admin.copy_locations.editor.edit;' name='cl_edit' disabled='disabled'> </input></td>
                         <td><input type='submit' value='&staff.server.admin.copy_locations.editor.delete;' name='cl_delete' disabled='disabled'> </input></td>
                     </tr>
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 (file)
index 0000000..ee7c48a
--- /dev/null
@@ -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.