From: Thomas Berezansky
Date: Fri, 3 Aug 2012 17:23:35 +0000 (-0400)
Subject: Add option to remove all external links from TPac
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6c6053a8109170c12885087ebf5aab86bac4658e;p=working%2FEvergreen.git
Add option to remove all external links from TPac
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
---
diff --git a/Open-ILS/src/templates/opac/parts/config.tt2 b/Open-ILS/src/templates/opac/parts/config.tt2
index f23ef4d492..651bfecf87 100644
--- a/Open-ILS/src/templates/opac/parts/config.tt2
+++ b/Open-ILS/src/templates/opac/parts/config.tt2
@@ -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;
%]
diff --git a/Open-ILS/src/templates/opac/parts/footer.tt2 b/Open-ILS/src/templates/opac/parts/footer.tt2
index 236805526b..fc69a6a55c 100644
--- a/Open-ILS/src/templates/opac/parts/footer.tt2
+++ b/Open-ILS/src/templates/opac/parts/footer.tt2
@@ -1,10 +1,12 @@
diff --git a/Open-ILS/src/templates/opac/parts/login/help.tt2 b/Open-ILS/src/templates/opac/parts/login/help.tt2
index 16db31fe7e..1dc05afd2b 100644
--- a/Open-ILS/src/templates/opac/parts/login/help.tt2
+++ b/Open-ILS/src/templates/opac/parts/login/help.tt2
@@ -1,5 +1,5 @@
-
+[% IF ctx.no_external_links != 'true' %]
@@ -9,4 +9,5 @@
+[% END %]
|
diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2
index 990201d143..93f6a25909 100644
--- a/Open-ILS/src/templates/opac/parts/record/summary.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2
@@ -99,7 +99,12 @@ IF num_uris > 0;
[%- IF num_uris > 1 %][% END %]
[%- FOR uri IN merged_uris %]
[%- IF num_uris == 1 %][% ELSE %]
- [% END %]
- [% uri.link %][% ' - ' _ uri.note IF uri.note %]
+ [%- IF ctx.no_external_links != 'true' %]
+ [% uri.link | html %][% ' - ' _ uri.note | html IF uri.note %]
+ [%- ELSE;
+ uri.link _ ' (' _ uri.href _ ')' | html;
+ ' - ' _ uri.note | html IF uri.note;
+ END %]
[%- IF num_uris == 1 %]
[% ELSE %][% END %]
[%- END %]
[%- IF num_uris > 1 %][% END %]
diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2
index 225c21a17a..8ed967e0a3 100644
--- a/Open-ILS/src/templates/opac/parts/result/table.tt2
+++ b/Open-ILS/src/templates/opac/parts/result/table.tt2
@@ -135,7 +135,11 @@
[% l('Electronic resource') %]
|
+ [% IF ctx.no_external_links != 'true' %]
[% uri.link | html %][% ' - ' _ uri.note | html IF uri.note %] |
+ [% ELSE %]
+ [% uri.link _ ' (' _ uri.href _ ')' | html; ' - ' _ uri.note | html IF uri.note %] |
+ [% END %]
[% END %]
[%- IF args.holdings.size > 0;
diff --git a/Open-ILS/src/templates/opac/parts/topnav.tt2 b/Open-ILS/src/templates/opac/parts/topnav.tt2
index 832205d13c..dfb90c61e3 100644
--- a/Open-ILS/src/templates/opac/parts/topnav.tt2
+++ b/Open-ILS/src/templates/opac/parts/topnav.tt2
@@ -58,4 +58,6 @@
[% END %]
-[% INCLUDE "opac/parts/topnav_links.tt2" %]
+[% IF ctx.no_external_links != 'true';
+ INCLUDE "opac/parts/topnav_links.tt2";
+END %]
diff --git a/Open-ILS/src/templates/opac/parts/topnav_logo.tt2 b/Open-ILS/src/templates/opac/parts/topnav_logo.tt2
index 0b55700afe..72a3dc7002 100644
--- a/Open-ILS/src/templates/opac/parts/topnav_logo.tt2
+++ b/Open-ILS/src/templates/opac/parts/topnav_logo.tt2
@@ -1,2 +1,10 @@
-
+