Link from copies to library info page
authorDan Scott <dscott@laurentian.ca>
Sun, 27 Oct 2013 04:16:20 +0000 (00:16 -0400)
committerDan Scott <dscott@laurentian.ca>
Fri, 1 Nov 2013 20:31:13 +0000 (16:31 -0400)
In the absence of a specific lib.info_url org unit setting, link to the
library info page.

If we _do_ have a lib.info_url org unit setting, link from the library
info page to to the external web site.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/library.tt2
Open-ILS/src/templates/opac/parts/record/copy_table.tt2

index 7321457..52c8008 100644 (file)
@@ -3,9 +3,16 @@
     INCLUDE "opac/parts/topnav.tt2";
     ctx.page_title = l("Library details: [_1]", ctx.library.name);
 -%]
-    [% INCLUDE "opac/parts/searchbar.tt2" %]
+    [%- INCLUDE "opac/parts/searchbar.tt2" %]
     <div id="content-wrapper" class="content-wrapper-library-page" vocab="http://schema.org/" typeof="Library">
-    <h1 property="name">[% ctx.library.name %]</h1>
+    <h1 property="name">[% ctx.library.name | html %]</h1>
+
+    [%-
+        lib_url = ctx.get_org_setting(ctx.library.id, 'lib.info_url');
+        IF lib_url;
+            '<div id="library-url"><a href="'; lib_url | url; '" property="url">'; l('External web site'); '</a></div>';
+        END;
+    -%]
 
     [%- IF ctx.hours_schema; %]
     <h2>[% l('Opening hours') %]</h2>
     [%- IF (ctx.library.email OR ctx.library.phone); %]
     <h2 id="contact-info">[% l('Contact information') %]</h2>
     [%- IF ctx.library.email; %]
-        <div>[% l('Email address: ') %]<a href="mailto:[% ctx.library.email %]" property="email">[% ctx.library.email %]</a></div>
+        <div>[% l('Email address: ') %]<a href="mailto:[% ctx.library.email | html %]" property="email">[% ctx.library.email | html %]</a></div>
     [%- END; %]
     [%- IF ctx.library.phone; %]
-        <div>[% l('Telephone: ') %]<span property="telephone">[% ctx.library.phone %]</span></div>
+        <div>[% l('Telephone: ') %]<a href="tel:[% ctx.library.phone | html %]" property="telephone">[% ctx.library.phone | html %]</a></div>
     [% END; %]
     [% END; %]
 
     <div id="addresses">
         <div id="mailing" property="location address" typeof="PostalAddress">
             <h3 property="contactType">[% l('Mailing address') %]</h3>
-            <span property="streetAddress">[% ctx.mailing_address.street1 %]
-            [%- IF ctx.mailing_address.street2; "<br />"; ctx.mailing_address.street2; END; %]
+            <span property="streetAddress">[% ctx.mailing_address.street1 | html %]
+            [%- IF ctx.mailing_address.street2; "<br />"; ctx.mailing_address.street2 | html; END; %]
             </span><br />
-            <span property="addressLocality">[% ctx.mailing_address.city %]</span><br />
-            <span property="addressRegion">[% ctx.mailing_address.state %]</span><br />
-            <span property="addressCountry">[% ctx.mailing_address.country %]</span><br />
-            <span property="postalCode">[% ctx.mailing_address.post_code %]</span><br />
+            <span property="addressLocality">[% ctx.mailing_address.city | html %]</span><br />
+            <span property="addressRegion">[% ctx.mailing_address.state | html %]</span><br />
+            <span property="addressCountry">[% ctx.mailing_address.country | html %]</span><br />
+            <span property="postalCode">[% ctx.mailing_address.post_code | html %]</span><br />
         </div>
     </div>
     [%- END; %]
@@ -48,7 +55,7 @@
     [%- IF ctx.library.parent_ou; %]
     <h2>Branch relationship</h2>
     <div id="branch-info">[% l('Parent library: ') %]
-        <a property="branchOf" href="[% mkurl(ctx.opac_root _ '/library/' _ ctx.parent.shortname, {}, 1) %]">[% ctx.parent.name %]</a>
+        <a property="branchOf" href="[% mkurl(ctx.opac_root _ '/library/' _ ctx.parent.shortname, {}, 1) %]">[% ctx.parent.name | html %]</a>
     </div>
     [%  END; -%]
 
index 9c8407b..5678da1 100644 (file)
@@ -96,7 +96,11 @@ END; # FOREACH bib
             [%- ELSE %]<td headers='copy_header_library' property="seller">
             [%-
                 org_name = ctx.get_aou(copy_info.circ_lib).name;
+                org_sname = ctx.get_aou(copy_info.circ_lib).shortname;
                 lib_url = ctx.get_org_setting(copy_info.circ_lib, 'lib.info_url');
+                UNLESS lib_url;
+                    lib_url = mkurl(ctx.opac_root _ '/library/' _ ctx.get_aou(copy_info.circ_lib).shortname, {}, 1);
+                END; 
                 IF lib_url; '<a href="'; lib_url | url; '">'; END;
                 org_name | html;
                 IF lib_url; '</a>'; END;