Add option to remove all external links from TPac user/tsbere/tpac_no_external
authorThomas Berezansky <tsbere@mvlc.org>
Fri, 3 Aug 2012 17:23:35 +0000 (13:23 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Fri, 3 Aug 2012 17:23:35 +0000 (13:23 -0400)
The goal is to make it so that public catalog terminals have less ways out
into the rest of the internet. Hiding browser UIs doesn't help if patrons
can just click through to eventually hit google.

parts/login/help.tt2 likely needs a less brute-forceish fix.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/footer.tt2
Open-ILS/src/templates/opac/parts/login/help.tt2
Open-ILS/src/templates/opac/parts/record/summary.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2
Open-ILS/src/templates/opac/parts/topnav.tt2
Open-ILS/src/templates/opac/parts/topnav_logo.tt2

index f23ef4d..651bfec 100644 (file)
@@ -6,6 +6,13 @@
 ##############################################################################
 
 ##############################################################################
+# No External Links
+##############################################################################
+# If enabled then (hopefully) no external links will be generated.
+# This is intended for use by public catalog stations in libraries.
+ctx.no_external_links = 'false';
+
+##############################################################################
 # Holds blocking
 ##############################################################################
 # Prevent the "Place hold" link from being displayed if a copy is available.
@@ -111,4 +118,13 @@ search.adv_config = [
 
 search.default_qtypes = ['keyword','title','author'];
 
+
+##############################################################################
+# This block turns off some features that would generate external links if the
+# option is enabled.
+
+IF ctx.no_external_links == 'true';
+    ctx.refworks.enabled = 'false';
+    ctx.openurl.enabled = 'false';
+END;
 %]
index 2368055..fc69a6a 100644 (file)
@@ -1,10 +1,12 @@
 <div id="footer-wrap">
 <div id="footer">
+[%- IF ctx.no_external_links != 'true' %]
     <a href="/">[% l('Dynamic catalog') %]</a> &nbsp;|&nbsp;
     <a href="http://example.com">[% l('Bottom Link 2') %]</a> &nbsp;|&nbsp;
     <a href="http://example.com">[% l('Bottom Link 3') %]</a> &nbsp;|&nbsp;
     <a href="http://example.com">[% l('Bottom Link 4') %]</a> &nbsp;|&nbsp;
     <a href="http://example.com">[% l('Bottom Link 5') %]</a>
+[%- END %]
     [% IF ctx.timing %]
     <div id="timing">
         [% FOR event IN ctx.timing %]
     </div>
     <div id="footer_logo">
         [% l('Powered by') %]
+[%- IF ctx.no_external_links != 'true' %]
         <a href="http://evergreen-ils.org">
+[%- END %]
             <img src="[% ctx.media_prefix %]/opac/images/eg_tiny_logo.png"
                 style="border:none; width: 94px; height: 16px;"
                 alt="[% l('Evergreen') %]"
             />
+[%- IF ctx.no_external_links != 'true' %]
         </a>
+[%- END %]
     </div>
 </div>
 </div>
index 16db31f..1dc05af 100644 (file)
@@ -1,5 +1,5 @@
 <td class="login_boxes right_brain" align="center" valign="top" width="291">
-
+[% IF ctx.no_external_links != 'true' %]
     <a href="http://example.com"><img 
         src="[% ctx.media_prefix %]/images/questions.png" alt="[% l('Questions?') %]" style="margin-top:29px;" /></a>
 
@@ -9,4 +9,5 @@
 
     <a href="http://example.com"><img
         alt="[% l('FAQs') %]" src="[% ctx.media_prefix %]/images/faqs-btn.png" style="margin-top:13px;" /></a>
+[% END %]
 </td>
index 990201d..93f6a25 100644 (file)
@@ -99,7 +99,12 @@ IF num_uris > 0;
     [%- IF num_uris > 1 %]<ul>[% END %]
     [%- FOR uri IN merged_uris %]
         [%- IF num_uris == 1 %]<p class="rdetail_uri">[% ELSE %]<li class="rdetail_uri">[% END %]
-        <a href="[% uri.href %]">[% uri.link %]</a>[% ' - ' _ uri.note IF uri.note %]
+        [%- IF ctx.no_external_links != 'true' %]
+        <a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]
+        [%- ELSE;
+            uri.link _ ' (' _ uri.href _ ')' | html;
+            ' - ' _ uri.note | html IF uri.note;
+        END %]
         [%- IF num_uris == 1 %]</p>[% ELSE %]</li>[% END %]
     [%- END %]
     [%- IF num_uris > 1 %]</ul>[% END %]
index 225c21a..8ed967e 100644 (file)
                                                                 <td valign='top'>
                                                                     <strong>[% l('Electronic resource') %]</strong>
                                                                 </td>
+                                                                [% IF ctx.no_external_links != 'true' %]
                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
+                                                                [% ELSE %]
+                                                                <td>[% uri.link _ ' (' _ uri.href _ ')' | html; ' - ' _ uri.note | html IF uri.note %] </td>
+                                                                [% END %]
                                                             </tr>
                                                             [% END %]
                                                             [%- IF args.holdings.size > 0;
index 832205d..dfb90c6 100644 (file)
@@ -58,4 +58,6 @@
 </div>
 </div>
 [% END %]
-[% INCLUDE "opac/parts/topnav_links.tt2" %]
+[% IF ctx.no_external_links != 'true';
+    INCLUDE "opac/parts/topnav_links.tt2";
+END %]
index 0b55700..72a3dc7 100644 (file)
@@ -1,2 +1,10 @@
-       <div id="topnav_logo"> <a href="http://evergreen-ils.org"><img alt="[% l('Evergreen Logo') %]" 
-            src="[% ctx.media_prefix %]/opac/images/small_logo.png" /></a></div>
+       <div id="topnav_logo">
+[% IF ctx.no_external_links != 'true' -%]
+        <a href="http://evergreen-ils.org">
+[%- END -%]
+        <img alt="[% l('Evergreen Logo') %]" 
+            src="[% ctx.media_prefix %]/opac/images/small_logo.png" />
+[%- IF ctx.no_external_links != 'true' -%]
+        </a>
+[%- END -%]
+       </div>