From: Galen Charlton <gmc@esilibrary.com>
Date: Fri, 11 Jan 2013 18:11:48 +0000 (-0500)
Subject: LP#1098669: improve handling of Content Cafe external content in staff client
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2b2bb871bdaadbf6051bf3a03aa193915eb0cdf3;p=evergreen%2Fmasslnc.git

LP#1098669: improve handling of Content Cafe external content in staff client

This patch introduces a new TPac content variable, ctx.ext_proto, to
specify whether external content should be retrieved via HTTP or HTTPS.
ctx.proto can't be used for that purpose since it's set to 'oils' when
TPac is running inside the staff client.

This fixes a bug where Content Cafe reviews wouldn't display in the staff
client bib record page and where clicking on the reviews link from search
results would open an empty window.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
---

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
index cb65581107..8787ee515f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
@@ -144,6 +144,7 @@ sub load_context {
     $ctx->{skin} = $cgi->cookie(OILS_HTTP_COOKIE_SKIN) || 'default';
     $ctx->{theme} = $cgi->cookie(OILS_HTTP_COOKIE_THEME) || 'default';
     $ctx->{proto} = $cgi->https ? 'https' : 'http';
+    $ctx->{ext_proto} = $ctx->{proto};
     my $default_locale = $r->dir_config('OILSWebDefaultLocale') || 'en_us';
 
     my @template_paths = uniq $r->dir_config->get('OILSWebTemplatePath');
diff --git a/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2 b/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2
index 27513be9f4..23e21ea1a2 100644
--- a/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/summaryplus.tt2
@@ -12,7 +12,7 @@
     <!-- Embedded content cafe iframe -->
     [% ident = attrs.isbn_clean || attrs.upc %]
     <iframe width="100%" height="400" frameborder="0" 
-        src="[% ctx.proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
+        src="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
             ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[% ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y" >
     </iframe>
     [%- END %]
diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2
index b63ec88769..d53c8f25cb 100644
--- a/Open-ILS/src/templates/opac/parts/result/table.tt2
+++ b/Open-ILS/src/templates/opac/parts/result/table.tt2
@@ -261,9 +261,9 @@
                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
                                                         <div class="results_aux_utils result_util">
                                                             <a title="[% l('Reviews and More') %]" target='_blank' 
-                                                                href="[% ctx.proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
+                                                                href="[% ctx.ext_proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
-                                                                    ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&Options=Y">
+                                                                    ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&amp;Options=Y">
                                                                 <img src='[% ctx.media_prefix %]/images/starz.png'/> 
                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
                                                             </a>