[open-ils-commits] r13288 - in trunk/Open-ILS: examples/apache web/opac/common/js web/opac/skin/default/xml web/opac/skin/default/xml/common (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jun 2 13:11:04 EDT 2009
Author: miker
Date: 2009-06-02 13:11:02 -0400 (Tue, 02 Jun 2009)
New Revision: 13288
Modified:
trunk/Open-ILS/examples/apache/eg_vhost.conf
trunk/Open-ILS/web/opac/common/js/added_content.js
trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml
trunk/Open-ILS/web/opac/skin/default/xml/setenv.xml
Log:
Patch from Jeff Godin (MLC/TADL) which:
Fixes the mixed content warnings from IE7 and IE8 "out of the box" without
breaking sites that use static servers for CSS and Javascript.
This sets OILS_PROTOCOL based on the environment variable HTTPS (which
Apache sets to "on" for https:// requests).
Thus, a page loaded via https:// gets https:// urls, and a page loaded via
http:// gets http:// urls.
To accommodate sites with static servers that can not support https,
there's a new OILS_OPAC_STATIC_PROTOCOL variable in eg_vhost.conf
which can be set to "http" to force JS/CSS to be loaded over http://
(you'll get the same warnings that you got before).
Modified: trunk/Open-ILS/examples/apache/eg_vhost.conf
===================================================================
--- trunk/Open-ILS/examples/apache/eg_vhost.conf 2009-06-02 13:54:04 UTC (rev 13287)
+++ trunk/Open-ILS/examples/apache/eg_vhost.conf 2009-06-02 17:11:02 UTC (rev 13288)
@@ -75,12 +75,26 @@
SetEnvIf Request_URI ".*" OILS_OPAC_BASE=/opac/
# This gives you the option to configure a different host to serve OPAC images from
- # Specify the hostname (withouth protocol) and path to the images. Protocol will
+ # Specify the hostname (without protocol) and path to the images. Protocol will
# be determined at runtime
#SetEnvIf Request_URI ".*" OILS_OPAC_IMAGES_HOST=static.example.org/opac/
+
+ # In addition to loading images from a static host, you can also load CSS and/or
+ # Javascript from a static host or hosts. Protocol will be determined at runtime
+ # and/or by configuration options immediately following.
#SetEnvIf Request_URI ".*" OILS_OPAC_CSS_HOST=static.example.org/opac/
#SetEnvIf Request_URI ".*" OILS_OPAC_JS_HOST=static.example.org/opac/
+ # If you are not able to serve static content via https and
+ # wish to force http:// (and are comfortable with mixed-content
+ # warnings in client browsers), set this:
+ #SetEnvIf Request_URI ".*" OILS_OPAC_STATIC_PROTOCOL=http
+
+ # If you would prefer to fall back to your non-static servers for
+ # https pages, avoiding mixed-content warnings in client browsers
+ # and are willing to accept some increased server load, set this:
+ #SetEnvIf Request_URI ".*" OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=yes
+
</LocationMatch>
Modified: trunk/Open-ILS/web/opac/common/js/added_content.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/added_content.js 2009-06-02 13:54:04 UTC (rev 13287)
+++ trunk/Open-ILS/web/opac/common/js/added_content.js 2009-06-02 17:11:02 UTC (rev 13288)
@@ -5,8 +5,9 @@
function buildISBNSrc(isbn, size) {
size = (size) ? size : 'small';
+ var protocol = (OILS_OPAC_STATIC_PROTOCOL) ? OILS_OPAC_STATIC_PROTOCOL + ':' : location.protocol;
if(OILS_OPAC_IMAGES_HOST)
- return location.protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn;
+ return protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn;
return '../../../../extras/ac/jacket/'+size+'/'+isbn;
}
Modified: trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml 2009-06-02 13:54:04 UTC (rev 13287)
+++ trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml 2009-06-02 17:11:02 UTC (rev 13288)
@@ -30,6 +30,10 @@
<!--#if expr="$OILS_OPAC_IMAGES_HOST"-->
OILS_OPAC_IMAGES_HOST = '<!--#echo var="OILS_OPAC_IMAGES_HOST"-->extras/ac/jacket/';
<!--#endif -->
+ var OILS_OPAC_STATIC_PROTOCOL = null;
+ <!--#if expr="$OILS_OPAC_STATIC_PROTOCOL"-->
+ OILS_OPAC_STATIC_PROTOCOL = '<!--#echo var="OILS_OPAC_STATIC_PROTOCOL"-->';
+ <!--#endif -->
<!-- builds the "Now searching: <org_unit>" text on the home page -->
function home_init() {
Modified: trunk/Open-ILS/web/opac/skin/default/xml/setenv.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/setenv.xml 2009-06-02 13:54:04 UTC (rev 13287)
+++ trunk/Open-ILS/web/opac/skin/default/xml/setenv.xml 2009-06-02 17:11:02 UTC (rev 13288)
@@ -30,14 +30,29 @@
<!--#endif-->
+<!--#if expr="$HTTPS"-->
+ <!--#set var="OILS_PROTOCOL" value="https"-->
+ <!--#if expr="$OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=='yes'"-->
+ <!--#set var="OILS_OPAC_CSS_HOST" value=""-->
+ <!--#set var="OILS_OPAC_JS_HOST" value=""-->
+ <!--#endif-->
+<!--#else-->
+ <!--#set var="OILS_PROTOCOL" value="http"-->
+<!--#endif-->
-<!--#set var="OILS_BASE" value="http://${SERVER_NAME}/${OILS_OPAC_BASE}"-->
+<!--#if expr="$OILS_OPAC_STATIC_PROTOCOL"-->
+
+<!--#else-->
+ <!--#set var="OILS_OPAC_STATIC_PROTOCOL" value="$OILS_PROTOCOL"-->
+<!--#endif-->
+
+<!--#set var="OILS_BASE" value="${OILS_PROTOCOL}://${SERVER_NAME}/${OILS_OPAC_BASE}"-->
<!--#set var="OILS_XML_BASE" value="${OILS_BASE}/common/xml"-->
<!-- Javascript host -->
<!--#if expr="$OILS_OPAC_JS_HOST"-->
- <!--#set var="OILS_OPAC_JS_HOST" value="http://${OILS_OPAC_JS_HOST}"-->
+ <!--#set var="OILS_OPAC_JS_HOST" value="${OILS_OPAC_STATIC_PROTOCOL}://${OILS_OPAC_JS_HOST}"-->
<!--#else -->
<!--#set var="OILS_OPAC_JS_HOST" value="$OILS_BASE"-->
<!--#endif -->
@@ -45,7 +60,7 @@
<!--#if expr="$OILS_OPAC_CSS_HOST"-->
- <!--#set var="OILS_OPAC_CSS_HOST" value="http://${OILS_OPAC_CSS_HOST}"-->
+ <!--#set var="OILS_OPAC_CSS_HOST" value="${OILS_OPAC_STATIC_PROTOCOL}://${OILS_OPAC_CSS_HOST}"-->
<!--#else -->
<!--#set var="OILS_OPAC_CSS_HOST" value="$OILS_BASE"-->
<!--#endif -->
More information about the open-ils-commits
mailing list