LP#1681095 Browser cache-busting key for longer expires
authorDan Scott <dan@coffeecode.net>
Sat, 8 Apr 2017 13:26:42 +0000 (09:26 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 7 Aug 2017 18:07:03 +0000 (14:07 -0400)
Extend the support for cache-busting that we added with autogen's generation of
ctx.eg_cache_hash for core JavaScript assets to other assets such as images,
stylesheets, and additional JavaScript. This will enable us to set very long
cache times for our assets, which can then be controlled explicitly by setting
eg.cache_key in config.tt2, or by default any time you run autogen.

Addresses TPAC and KPAC

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Josh Stompro <stomproj@larl.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
41 files changed:
Open-ILS/src/templates/kpac/category.tt2
Open-ILS/src/templates/kpac/getit.tt2
Open-ILS/src/templates/kpac/getit_results.tt2
Open-ILS/src/templates/kpac/home.tt2
Open-ILS/src/templates/kpac/parts/base.tt2
Open-ILS/src/templates/kpac/parts/breadcrumb.tt2
Open-ILS/src/templates/kpac/parts/header.tt2
Open-ILS/src/templates/kpac/parts/help_popups.tt2
Open-ILS/src/templates/kpac/parts/paginate.tt2
Open-ILS/src/templates/kpac/parts/record_row.tt2
Open-ILS/src/templates/kpac/parts/searchbox.tt2
Open-ILS/src/templates/kpac/parts/util.tt2
Open-ILS/src/templates/kpac/record.tt2
Open-ILS/src/templates/opac/browse.tt2
Open-ILS/src/templates/opac/myopac/circ_history.tt2
Open-ILS/src/templates/opac/myopac/circs.tt2
Open-ILS/src/templates/opac/myopac/hold_history.tt2
Open-ILS/src/templates/opac/myopac/holds.tt2
Open-ILS/src/templates/opac/myopac/lists.tt2
Open-ILS/src/templates/opac/myopac/messages/list.tt2
Open-ILS/src/templates/opac/myopac/prefs_my_lists.tt2
Open-ILS/src/templates/opac/myopac/prefs_settings.tt2
Open-ILS/src/templates/opac/parts/advanced/expert.tt2
Open-ILS/src/templates/opac/parts/advanced/global_row.tt2
Open-ILS/src/templates/opac/parts/advanced/search.tt2
Open-ILS/src/templates/opac/parts/base.tt2
Open-ILS/src/templates/opac/parts/bookbag_actions.tt2
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/ebook_api/base_js.tt2
Open-ILS/src/templates/opac/parts/footer.tt2
Open-ILS/src/templates/opac/parts/header.tt2
Open-ILS/src/templates/opac/parts/homesearch.tt2
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/src/templates/opac/parts/misc_util.tt2
Open-ILS/src/templates/opac/parts/record/copy_table.tt2
Open-ILS/src/templates/opac/parts/record/refworks.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/searchbar.tt2
Open-ILS/src/templates/opac/parts/staff_saved_searches.tt2
Open-ILS/src/templates/opac/parts/topnav_logo.tt2

index b4facb0..fe51d6b 100644 (file)
     <table cellpadding="0" cellspacing="0" border="0" width="100%">
         <tr>
             <td><a href="[% mkurl(ctx.home_page, {}, ['trail']) %]">
-                <img src="[% ctx.media_prefix %]/images/kpac/go_back_btn.png" /></a></td>
+                <img src="[% ctx.media_prefix %]/images/kpac/go_back_btn.png[% ctx.cache_key %]" /></a></td>
             <td width="100%" class="nav_mid_bg"></td>
             <td class="to_top_btn"><a href="[% mkurl(ctx.unparsed_uri, {}, 1) %]">
-                <img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png" /></a></td>
+                <img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png[% ctx.cache_key %]" /></a></td>
         </tr>
     </table>
 </div>
index 249d4ac..53056c1 100644 (file)
@@ -18,7 +18,7 @@
                 <div class="left_brain">
 
                     [% WRAPPER 'kpac/parts/help_popups.tt2' popup_id='card_help' %]
-                        <img src="[% ctx.media_prefix %]/images/kpac/library_card.png" alt="[% l('library card') %]" /></div></td>
+                        <img src="[% ctx.media_prefix %]/images/kpac/library_card.png[% ctx.cache_key %]" alt="[% l('library card') %]" /></div></td>
                     [% END %]
                     [% WRAPPER 'kpac/parts/help_popups.tt2' popup_id='password_help' %]
                         <p>[% l('Enter your password') %]</p>
@@ -46,7 +46,7 @@
                                     </div>
                                     <a class="help_btn" href="javascript:;" 
                                         onclick="helpPopup('card_help', this, event);"><img 
-                                        src="[% ctx.media_prefix %]/images/kpac/question_mark.png" alt="[% l('pin number help') %]" /></a>
+                                        src="[% ctx.media_prefix %]/images/kpac/question_mark.png[% ctx.cache_key %]" alt="[% l('pin number help') %]" /></a>
 
                                     <div class="clear">&nbsp;</div>
                                     <div class="hr">&nbsp;</div>
@@ -60,7 +60,7 @@
 
                                     <a class="help_btn" href="javascript:;" 
                                         onclick="helpPopup('password_help', this, event);"><img 
-                                        src="[% ctx.media_prefix %]/images/kpac/question_mark.png" alt="[% l('password help') %]" /></a>
+                                        src="[% ctx.media_prefix %]/images/kpac/question_mark.png[% ctx.cache_key %]" alt="[% l('password help') %]" /></a>
 
                                     <input type="hidden" name='pickup_lib' value='0' id='pickup_lib'>
                                     
                         </div>
                         <div class="submit_btn">
                             <input type='hidden' name='action' value='hold'/>
-                            <input type='image' src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" alt="[% l('Submit') %]"/>
+                            <input type='image' src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png[% ctx.cache_key %]" alt="[% l('Submit') %]"/>
                         </div>
                     </form>
                 </div>
                             </div>
                         [% END %]
                         <div class="submit_btn">
-                            <input type='image' src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" alt="[% l('Submit') %]" />
+                            <input type='image' src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png[% ctx.cache_key %]" alt="[% l('Submit') %]" />
                         </div>
                     </div>
                 </div>
         <tr>
             [%  # in the absence of a sane referer, return to the detail page
                 url = ctx.kpac_root _ (ctx.referer.match('results') ? '/results' : '/record/' _ ctx.bre_id) %]
-            <td><a href="[% mkurl(url) %]"><img src="[% ctx.media_prefix %]/images/kpac/cancel_back_btn.png" /></a></td>
+            <td><a href="[% mkurl(url) %]"><img src="[% ctx.media_prefix %]/images/kpac/cancel_back_btn.png[% ctx.cache_key %]" /></a></td>
             <td width="100%" class="nav_mid_bg">&nbsp;</td>
         </tr>
     </table>
index 70e9803..83040dc 100644 (file)
@@ -41,9 +41,9 @@
 <div class="sub_navigation2 checkout">
     <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr>
         <td><a href="[% mkurl(ctx.kpac_root _ '/results', {}, kill_params) %]">
-            <img src="[% ctx.media_prefix %]/images/kpac/back_to_results_btn.png" /></a></td>
+            <img src="[% ctx.media_prefix %]/images/kpac/back_to_results_btn.png[% ctx.cache_key %]" /></a></td>
         <td width="100%" class="nav_mid_bg">&nbsp;</td>
-        <td><img src="[% ctx.media_prefix %]/images/kpac/back_to_book.png" /></td>
+        <td><img src="[% ctx.media_prefix %]/images/kpac/back_to_book.png[% ctx.cache_key %]" /></td>
         <td nowrap="nowrap">
             <a class="checkout_res_back" href="[% mkurl(ctx.kpac_root _ '/record/' _ ctx.bre_id, {}, kill_params) %]">
                 [%  title = attrs.title || '';
index a1f880f..596700a 100644 (file)
@@ -37,7 +37,7 @@
 
                             <td><input type="text" class="search_box" name="query" 
                                 value="[% CGI.param('nosprop') ? '' : CGI.param('query') | html  %]"/></td>
-                            <td><input type="image" src="[% ctx.media_prefix %]/images/kpac/search_btn.png" alt="[% l('search') %]" /></td>
+                            <td><input type="image" src="[% ctx.media_prefix %]/images/kpac/search_btn.png[% ctx.cache_key %]" alt="[% l('search') %]" /></td>
                         </tr>
                     </table>
                 </form>
index 7af00ed..94364c6 100644 (file)
@@ -2,7 +2,7 @@
 <html xmlns='http://www.w3.org/1999/xhtml' lang='[% ctx.locale %]' xml:lang='[% ctx.locale %]'>
     <head>
         <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-        <link rel="stylesheet" type="text/css" href="[% ctx.media_prefix %]/css/skin/default/kpac/style.css" />
+        <link rel="stylesheet" type="text/css" href="[% ctx.media_prefix %]/css/skin/default/kpac/style.css[% ctx.cache_key %]" />
         [% IF ctx.authtime %]
         <meta http-equiv="refresh" content="[% ctx.authtime %];[% 
             ctx.logout_page _ '?redirect_to=' _ ctx.home_page %]">
@@ -18,7 +18,7 @@
             <div class="main_wrapper"> [% content %] </div>
             [% INCLUDE 'kpac/parts/footer.tt2' %]
         </div>
-        <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/kpac/functions.js"></script>
+        <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/kpac/functions.js[% ctx.cache_key %]"></script>
         [%- INCLUDE 'kpac/parts/acimport.tt2' %]
     </body>
 </html>
index 4532070..d89f819 100644 (file)
@@ -4,7 +4,7 @@
     <!-- home page -->
     <a href="[% mkurl(ctx.kpac_root _ '/home', {}, ['trail', 'page']) %]" 
         class="bread_home"><img alt="[% l('Home') %]" 
-        src="[% ctx.media_prefix %]/images/kpac/home_icon.png" /></a>
+        src="[% ctx.media_prefix %]/images/kpac/home_icon.png[% ctx.cache_key %]" /></a>
 
     <!-- category trail -->
     [%  trail = CGI.param('trail'); 
index 588b910..e632a60 100644 (file)
@@ -2,17 +2,17 @@
     <div class="logo_wrapper">
         <a href="http://evergreen-ils.org">
             <span class="logo_left">&nbsp;</span>
-            <span class="logo_middle"><img src="[% ctx.media_prefix %]/images/eg_logo.jpg" width="170" alt="[% l('Logo') %]" /></span>
+            <span class="logo_middle"><img src="[% ctx.media_prefix %]/images/eg_logo.jpg[% ctx.cache_key %]" width="170" alt="[% l('Logo') %]" /></span>
             <span class="logo_right">&nbsp;</span>
         </a>
     </div>
     <div class="header_utils">
         <!--
         <a href="javascript:;" class="text_size_btn"><span>[% l('Text size') %]</span> &nbsp; <img 
-            alt="[% l('text size') %]" src="[% ctx.media_prefix %]/images/kpac/text_size_btn.png" /></a>
+            alt="[% l('text size') %]" src="[% ctx.media_prefix %]/images/kpac/text_size_btn.png[% ctx.cache_key %]" /></a>
         -->
         <a href="javascript:window.print()" class="print_btn"><span>[% l('Print') %]</span> &nbsp; <img 
-            alt="[% l('print') %]" src="[% ctx.media_prefix %]/images/kpac/print_btn.png" /></a>
+            alt="[% l('print') %]" src="[% ctx.media_prefix %]/images/kpac/print_btn.png[% ctx.cache_key %]" /></a>
     </div>
     <div class="header_menu">
         <!-- menu rendered in reverse order -->
index 5399fb9..9551822 100644 (file)
@@ -18,7 +18,7 @@
             </tr>
             <tr>
                 <td colspan="3" align="center" valign="top">
-                    <img class="popup_arrow_bm" src="[% ctx.media_prefix %]/images/kpac/popup_arrow_bm.png" />
+                    <img class="popup_arrow_bm" src="[% ctx.media_prefix %]/images/kpac/popup_arrow_bm.png[% ctx.cache_key %]" />
                 </td>
             </tr>
         </table>
index f5b875b..27844ee 100644 (file)
@@ -17,7 +17,7 @@
                 IF page > 0;
                     href = mkurl('', {page => page - 1});
                 ELSE; class = class _ ' invisible'; END %]
-            <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_last.png" /></a>
+            <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_last.png[% ctx.cache_key %]" /></a>
         </td>
 
         <!-- page X of Y -->
                     href = mkurl('', {page => page + 1});
                 ELSE; class = class _ ' invisible'; END;
             %]
-            <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_next.png" /></a>
+            <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_next.png[% ctx.cache_key %]" /></a>
         </td>
 
         <!-- Top of page -->
         [% IF showtop %]
             <td class="to_top_btn"><a href="[% mkurl('').replace('#.*', '') %]">
-                <img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png" />
+                <img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png[% ctx.cache_key %]" />
             </a></td>
         [% END %]
     </tr>
index 38c39ad..a0d936d 100644 (file)
@@ -1,6 +1,6 @@
 <div class="search_results">
     <div class="item_detail_image">
-        [%  img_src = ctx.media_prefix _ '/images/kpac/item_image.jpg'; # default image
+        [%  img_src = ctx.media_prefix _ '/images/kpac/item_image.jpg' _ ctx.cache_key; # default image
             ident = attrs.isbn_clean || attrs.upc; 
             IF ident; 
                 img_src = ctx.media_prefix _ '/opac/extras/ac/jacket/medium/' _ ident;
@@ -21,9 +21,9 @@
         [% IF show_actions %]
         <div class="item_detail_actions">
             <div class="button"><a href="[% mkurl(ctx.kpac_root _ '/record/' _ rec_id) %]"><img 
-                src="[% ctx.media_prefix %]/images/kpac/more_info_btn.png" alt="[% l('more info') %]" /></a></div>
+                src="[% ctx.media_prefix %]/images/kpac/more_info_btn.png[% ctx.cache_key %]" alt="[% l('more info') %]" /></a></div>
             <div class="button"><a href="[% mkurl(ctx.kpac_root _ '/getit/' _ rec_id) %]"><img 
-                src="[% ctx.media_prefix %]/images/kpac/get_it_btn_sm.png" alt="[% l('get it') %]" /></a></div>
+                src="[% ctx.media_prefix %]/images/kpac/get_it_btn_sm.png[% ctx.cache_key %]" alt="[% l('get it') %]" /></a></div>
             <div class="clear">&nbsp;</div>
         </div>
         [% END %]
index 2e1e2ec..a21dcba 100644 (file)
@@ -45,7 +45,7 @@
     </div>
     <div class="hr">&nbsp;</div>
     <div>
-        <input type="image" alt="[% l('search') %]" src="[% ctx.media_prefix %]/images/kpac/search_btn_sub.png" />
+        <input type="image" alt="[% l('search') %]" src="[% ctx.media_prefix %]/images/kpac/search_btn_sub.png[% ctx.cache_key %]" />
     </div>
 </form>
 
index 632c180..2c4734d 100644 (file)
@@ -36,7 +36,7 @@
         IF img.match('^/') OR img.match('^https?://');
             img;
         ELSE;
-            ctx.media_prefix _ '/images/kpac/' _ img;
+            ctx.media_prefix _ '/images/kpac/' _ img _ ctx.cache_key;
         END;
     END;
 %]
index 514c45f..393bb1c 100644 (file)
@@ -11,7 +11,7 @@
 
     <div class="item_detail_image">
         [%  ident = attrs.isbn_clean || attrs.upc; 
-            href = ctx.media_prefix _ '/images/kpac/item_image.jpg';
+            href = ctx.media_prefix _ '/images/kpac/item_image.jpg[% ctx.cache_key %]';
             IF ident; href = ctx.media_prefix _ '/opac/extras/ac/jacket/medium/' _ ident; END %]
          <a href="[% href | url %]"><img 
             alt="[% l('Image of item') %]" width="167" src='[% href | url %]' /></a><br />
@@ -41,7 +41,7 @@
                 -->
 
                 <!--
-                <div class="item_detail_rate_starts"><img alt="[% l('rating') %]" src="[% ctx.media_prefix %]/images/kpac/stars.png" /></div>
+                <div class="item_detail_rate_starts"><img alt="[% l('rating') %]" src="[% ctx.media_prefix %]/images/kpac/stars.png[% ctx.cache_key %]" /></div>
                 <div class="item_detail_rate_link"><a href="javascript:;">[% l('Rate this') %]</a></div>
                 <div class="clear">&nbsp;</div>
                 -->
 
     <div class="item_detail_header_buttons">
         <div class="item_detail_getit_btn"><a href="[% mkurl(ctx.kpac_root _ '/getit/' _ ctx.bre_id) %]"><img 
-            alt="[% l('Get it') | html %]" src="[% ctx.media_prefix %]/images/kpac/get_it_btn.png" /></a>
+            alt="[% l('Get it') | html %]" src="[% ctx.media_prefix %]/images/kpac/get_it_btn.png[% ctx.cache_key %]" /></a>
         </div>
         <div class="item_detail_goback_btn">
             <a href="[% mkurl(ctx.kpac_root _ '/results') %]"><img 
-                alt="[% l('Go Back') | html %]" src="[% ctx.media_prefix %]/images/kpac/go_back_btn.png" /></a>
+                alt="[% l('Go Back') | html %]" src="[% ctx.media_prefix %]/images/kpac/go_back_btn.png[% ctx.cache_key %]" /></a>
         </div>
     </div>
     <div class="clear">&nbsp;</div>
index 9d58cd0..ed94609 100644 (file)
@@ -45,7 +45,7 @@
 
                        <input id='search-submit-go' type="submit" value="[% l('Browse') %]" alt="[% l('Browse') %]" class="opac-button"/>
                         <img id="browse-submit-spinner" 
-                        src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif
+                        src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]"
                         class="hidden" style="width: 16px; height: 16px;" 
                         alt="[% l('Search in progress icon') %]" />
                     </form>
@@ -70,7 +70,7 @@
                     [% END %]
 
                     <img id="browse-pager-spinner-[% id %]" 
-                        src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif
+                        src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]"
                         class="hidden" style="width: 16px; height: 16px;" 
                         alt="[% l('Search in progress icon') %]" />
                 </div>
index 8e989c4..d7f2175 100644 (file)
@@ -81,7 +81,7 @@
                 <!--
                 <td style="padding-left:5px;">
                     <a href="#"><img alt="[% l('Deleting Help') %]"
-                        src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
+                        src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
                 </td>
                 -->
             </tr>
index bd93d7b..91ebeb0 100644 (file)
@@ -56,7 +56,7 @@
                 <a href="#"><img 
                     alt="[% l('Renewing Help') %]"
                     title="[% l('Actions for checked out items') %]"
-                    src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
+                    src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
             </span>
         </div>
 
index 16b4c02..9f22b1d 100644 (file)
@@ -93,7 +93,7 @@
                     <td>
                         <div class='format_icon'>
                             [% IF attrs.format_icon %]
-                            <img title="[% attrs.format_label | html %]" alt="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" />
+                            <img title="[% attrs.format_label | html %]" alt="[% attrs.format_label | html %]" src="[% attrs.format_icon %][% ctx.cache_key %]" />
                             [% END %]
                         </div>
                     </td>
index 1ba5c9c..100e806 100644 (file)
@@ -83,7 +83,7 @@
                     <a href="#"><img
                         alt="[% l('Holds Help') %]"
                         title="[% l('Actions for selected holds') %]"
-                        src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
+                        src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
                 </td>
                 <td style="padding-left:5px;" class='error'>
                     [%  IF ctx.hold_suspend_post_capture;
                             FOR format IN formats 
                           %]
                             <img title="[% format.label | html %]" 
-                              alt="[% format.label | html %]" src="[% format.icon %]" />
+                              alt="[% format.label | html %]" src="[% format.icon %][% ctx.cache_key %]" />
                             [% END %]
                         </div>
                     </td>
index 510fea2..12f8003 100644 (file)
@@ -55,7 +55,7 @@
                         onclick="alert('[% bb_publish_text %]')">
                         <img alt="[% l('Sharing Help') %]"
                             [% html_text_attr('title', bb_publish_text) %]
-                            src="[% ctx.media_prefix %]/images/question-mark.png" />
+                            src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" />
                     </a>
                 </td>
             </tr>
                 [% IF bbag.pub == 't'; %]
                 <a target='_blank' href='/opac/extras/feed/bookbag/rss2-full/[% bbag.id %]'><img
                     alt="[% l('RSS Feed') %]" border="0"
-                    src="[% ctx.media_prefix %]/images/small-rss.png"/></a>
+                    src="[% ctx.media_prefix %]/images/small-rss.png[% ctx.cache_key %]"/></a>
                 [% END %]
                 [% IF bbag.pub == 't'; %]
                 <a href='[%-
index 885112b..7702c1e 100644 (file)
@@ -73,7 +73,7 @@
                     <a href="#"><img
                         alt="[% l('Messages Help') %]"
                         title="[% l('Actions for messages') %]"
-                        src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
+                        src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]" /></a>
                 </span>
             </div>
             [% IF count < 1 %]
index a95ab7c..87eda11 100644 (file)
@@ -34,7 +34,7 @@
                             [% END %]
                         </select>
                         <img alt="[% l('List Items Help') %]"
-                            src="[% ctx.media_prefix %]/images/question-mark.png"
+                            src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]"
                             title="[% l('The number of lists displayed per page.') %]"
                         />
                     </td>
@@ -54,7 +54,7 @@
                             [% END %]
                         </select>
                         <img alt="[% l('List Items Help') %]"
-                            src="[% ctx.media_prefix %]/images/question-mark.png"
+                            src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]"
                             title="[% l('The number of list items displayed per page when viewing a selected list.') %]"
                         />
                     </td>
index e98f6dd..415dcec 100644 (file)
@@ -46,7 +46,7 @@
                             [% END %]
                         </select>
                         <a href="#"><img alt="[% l('Search Hits Help') %]" 
-                            src="[% ctx.media_prefix %]/images/question-mark.png"
+                            src="[% ctx.media_prefix %]/images/question-mark.png[% ctx.cache_key %]"
                         /></a>
                     </td>
                 </tr>
index c883336..a424bc4 100644 (file)
@@ -24,7 +24,7 @@
                     <a href="javascript:;" class="row-remover"
                         title="[% l('Remove row') %]" alt="[% l('Remove row') %]"
                         onclick='return killRowIfAtLeast(1, this);'>
-                        <img src="[% ctx.media_prefix %]/images/expert_row_close_btn.png
+                        <img src="[% ctx.media_prefix %]/images/expert_row_close_btn.png[% ctx.cache_key %]"
                             alt="[% l('Remove Search Row') %]"/>
                     </a>
                 </td>
index 5310bb6..59b8c4e 100644 (file)
@@ -50,7 +50,7 @@
         <a href="javascript:;" class="row-remover"
             title="[% l('Remove row') %]" alt="[% l('Remove row') %]"
             onclick='return killRowIfAtLeast(2, this);'>
-                <img src="[% ctx.media_prefix %]/images/expert_row_close_btn.png
+                <img src="[% ctx.media_prefix %]/images/expert_row_close_btn.png[% ctx.cache_key %]"
                     alt="[% l('Remove row') %]"/>
             </a>
     </td>
index 0b76d08..1ac3b67 100644 (file)
@@ -37,7 +37,7 @@
         <span>
             <input id='search-submit-go' type="submit" value="[% l('Search') %]" title="[% l('Search') %]" class="opac-button"
                 onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden"}, 2000)'/>
-            <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif'
+            <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif[% ctx.cache_key %]'
                 class='hidden' alt="[% l('Search in progress icon') %]"/>
         </span>
 
index 8d7b07d..aa12e39 100644 (file)
@@ -9,12 +9,12 @@
         <meta http-equiv="refresh" content="[% ctx.authtime %]; url=[% ctx.home_page %]" />
         [% END %]
         <meta name = "viewport" content = "initial-scale = 1.0">
-        <link rel="stylesheet" type="text/css" href="[% ctx.media_prefix %]/css/skin/default/opac/semiauto.css" />
-        <link rel="stylesheet" type="text/css" href="[% ctx.opac_root %]/css/style.css?dir=[%
+        <link rel="stylesheet" type="text/css" href="[% ctx.media_prefix %]/css/skin/default/opac/semiauto.css[% ctx.cache_key %]" />
+        <link rel="stylesheet" type="text/css" href="[% ctx.opac_root %]/css/style.css[% ctx.cache_key %]&amp;dir=[%
           IF ctx.get_i18n_l(ctx.eg_locale).rtl == 't' %]rtl[%
           ELSE %]ltr[% END %]" />
         [% IF ctx.get_i18n_l(ctx.eg_locale).rtl == 't' %]
-        <link rel="stylesheet" type="text/css" href="[% ctx.media_prefix %]/css/skin/default/opac/semiauto-rtl.css" />
+        <link rel="stylesheet" type="text/css" href="[% ctx.media_prefix %]/css/skin/default/opac/semiauto-rtl.css[% ctx.cache_key %]" />
         [% END %]
         
         [%- libname = ctx.get_aou(ctx.search_ou).name;
@@ -33,7 +33,7 @@
         [% FOREACH meta IN ctx.metalinks; meta _ "\n"; END; -%]
         [% IF want_dojo %]
         <style type="text/css">
-            @import "[% ctx.media_prefix %]/js/dojo/dijit/themes/tundra/tundra.css";
+            @import "[% ctx.media_prefix %]/js/dojo/dijit/themes/tundra/tundra.css[% ctx.cache_key %]";
         </style>
         [% END %]
 
index 611d1fc..0b0ee67 100644 (file)
@@ -38,7 +38,7 @@
 %]
 <ul class="popmenu">
     <li><a href="#" class="no-dec">
-          <img src="[% ctx.media_prefix %]/images/clipboard.png
+          <img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]"
               [% html_text_attr('alt', 
                 l('Add item to a list: [_1]', record_title)) %]/>
           [% l("Add to my list") %]
index 3af7bb7..aff6d6e 100644 (file)
@@ -237,4 +237,17 @@ ctx.exclude_electronic_checkbox = 0;
 ##############################################################################
 # obalkyknih_cz.enabled = 'false';
 
+
+##############################################################################
+# Browser cache-busting key
+##############################################################################
+# Links to assets like stylesheets, JavaScript, and images will have this
+# key appended so that browsers will be forced to request a new version.
+# Enables you to set a cache max-date of years.
+#
+# If unset, it falls back to eg_cache_hash (which is set every time you run
+# "autogen", which may or may not be when you change styles etc)
+##############################################################################
+# ctx.cache_key = '001'
+
 %]
index 632e534..d82cd78 100644 (file)
@@ -1,10 +1,10 @@
 [%
 # HTML display chunks
-progress_icon = '<img id="ebook_avail_spinner" src="/opac/images/progressbar_green.gif" alt="' _ l("Checking availability for this item...") _ '"/>'
+progress_icon = '<img id="ebook_avail_spinner" src="/opac/images/progressbar_green.gif[% ctx.cache_key %]" alt="' _ l("Checking availability for this item...") _ '"/>'
 %]
 
-<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/session.js"></script>
-<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/ebook.js"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/session.js[% ctx.cache_key %]"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/ebook.js[% ctx.cache_key %]"></script>
 <script type="text/javascript">
 
 // translatable strings as JS variables
@@ -65,7 +65,7 @@ dojo.addOnLoad(function() {
 </script>
 
 [%- IF ctx.user %]
-<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/relation.js"></script>
-<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/loggedin.js"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/relation.js[% ctx.cache_key %]"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/ebook_api/loggedin.js[% ctx.cache_key %]"></script>
 [%- END %]
 
index a5d7d9f..81758e7 100644 (file)
@@ -25,7 +25,7 @@
     <div id="footer_logo">
         [% l('Powered by') %]
         <a href="http://evergreen-ils.org">
-            <img src="[% ctx.media_prefix %]/opac/images/eg_tiny_logo.png"
+            <img src="[% ctx.media_prefix %]/opac/images/eg_tiny_logo.png[% ctx.cache_key %]"
                 style="border:none; width: 94px; height: 16px;"
                 alt="[% l('Evergreen') %]"
             />
@@ -33,4 +33,4 @@
     </div>
 </div>
 </div>
-[% END %]
\ No newline at end of file
+[% END %]
index 7a8e40d..de933e9 100644 (file)
     MACRO img_alt(text) BLOCK;
         html_text_attr('alt', text);
     END;
+
+    # Browser cache-busting key
+    # Fall back to the eg_cache_hash (set by autogen) so that we don't have to
+    # add conditionals into the rest of the templates
+    IF ctx.cache_key AND ctx.cache_key != "?" _ ctx.eg_cache_hash;
+        ctx.cache_key = "?v=" _ ctx.cache_key;
+    ELSE;
+        ctx.cache_key = "?" _ ctx.eg_cache_hash;
+    END;
 %]
index 6fce85f..7fbc620 100644 (file)
@@ -1,4 +1,4 @@
 <div id="homesearch_main_logo">
-    <img src="[% ctx.media_prefix %]/opac/images/main_logo.png
+    <img src="[% ctx.media_prefix %]/opac/images/main_logo.png[% ctx.cache_key %]"
         [% img_alt(l('Evergreen Logo')) %]/>
 </div>
index f7fc737..ebc5421 100644 (file)
@@ -1,5 +1,5 @@
 <!-- JS imports, etc.  -->
-<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/simple.js"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/simple.js[% ctx.cache_key %]"></script>
 
 <!-- DOB validation for Patron Registration in OPAC -->
 <script type="text/javascript">
@@ -20,7 +20,7 @@
 [% END -%]
 
 [%- IF ctx.is_staff %]
-<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/staff.js"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/staff.js[% ctx.cache_key %]"></script>
     [% IF ctx.page == 'record' %]
         [% IF ctx.search_result_index >= 0 %]
         <script>
 [% INCLUDE "opac/parts/acjs.tt2" IF ctx.page == 'record' %]
 [% IF ctx.page == 'advanced' %]
 <script type="text/javascript" 
-    src="[% ctx.media_prefix %]/js/ui/default/opac/copyloc.js"></script>
+    src="[% ctx.media_prefix %]/js/ui/default/opac/copyloc.js[% ctx.cache_key %]"></script>
 [% END %]
 
 [% IF ebook_api.enabled == 'true' %]
index add3c64..b1ca125 100644 (file)
@@ -80,7 +80,7 @@
     END;
 
     BLOCK get_ccvm_icon;
-        ctx.media_prefix _ '/images/format_icons/' _ ccvm.ctype _ '/' _ ccvm.code _ '.png';
+        ctx.media_prefix _ '/images/format_icons/' _ ccvm.ctype _ '/' _ ccvm.code _ '.png' _ ctx.cache_key;
     END;
 
     # Extract MARC fields from XML
index 8636fe9..774f188 100644 (file)
@@ -286,12 +286,12 @@ END; # FOREACH bib
                 [%- more_copies_limit = 50 %] [%# TODO: config %]
                 [%- IF  ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit AND ctx.copy_limit < total_copies %]
                     <div class="rdetail_show_copies">
-                        <img src="[% ctx.media_prefix %]/images/plus_sign.png" alt="[% l('Show more copies icon') %]"/>
+                        <img src="[% ctx.media_prefix %]/images/plus_sign.png[% ctx.cache_key %]" alt="[% l('Show more copies icon') %]"/>
                         <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]">[% l('Show more copies') %]</a>
                     </div>
                 [%- ELSIF ctx.copy_limit == more_copies_limit %]
                     <div  class="rdetail_show_copies">
-                        <img src="[% ctx.media_prefix %]/images/minus_sign.png" alt="[% l('Show fewer copies icon') %]"/>
+                        <img src="[% ctx.media_prefix %]/images/minus_sign.png[% ctx.cache_key %]" alt="[% l('Show fewer copies icon') %]"/>
                         <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]">[% l('Show fewer copies') %]</a>
                     </div>
                 [%- END %]
index 8deea61..b8775c7 100644 (file)
@@ -16,5 +16,5 @@
         ctx.bre_id;
 %]
 <div class="rdetail_aux_utils rdetail_refworks">
-    <a href="[% rw_uri %]" rel="nofollow" vocab=""><img src="/images/starz.png" alt="" />[% l('Export to RefWorks') %]</a>
+    <a href="[% rw_uri %]" rel="nofollow" vocab=""><img src="/images/starz.png[% ctx.cache_key %]" alt="" />[% l('Export to RefWorks') %]</a>
 </div>
index cf98891..42835fd 100644 (file)
@@ -74,7 +74,7 @@
             <div class="rdetail_aux_utils place_hold">
                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
                     {hold_target => ctx.bre_id, hold_type => 'T', hold_source_page => mkurl()}, stop_parms) %]" 
-                class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/green_check.png"
+                class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/green_check.png[% ctx.cache_key %]"
                     [% img_alt(l('Place Hold on [_1]', attrs.title)) %]/>
                 <span class="place_hold">[% l('Place Hold') %]</span></a>
             </div>
@@ -89,7 +89,7 @@
                 label = (operation == "add") ? l("Add to my list") : l("Remove from my list");
             %]
                 <a href="[% mkurl(ctx.opac_root _ '/mylist/' _ operation, {record => ctx.bre_id}, stop_parms) %]" class="no-dec" rel="nofollow" vocab="">
-                    <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
+                    <img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="" />
                     [% label %]
                 </a>
             [% END %]
             <div class="rdetail_aux_utils toggle_list">
                      [% IF ctx.mylist.size %]
                         [%- IF ctx.user; %]
-                        <a href="[% mkurl(ctx.opac_root _ '/myopac/lists') %]" class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/clipboard.png" alt="[% l('View My Lists') %]" />[% l(' View My Lists') %]</a>
+                        <a href="[% mkurl(ctx.opac_root _ '/myopac/lists') %]" class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="[% l('View My Lists') %]" />[% l(' View My Lists') %]</a>
                         [%- ELSE %]
-                        <a href="[% mkurl(ctx.opac_root _ '/mylist') %]" class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/clipboard.png" alt="[% l('View My Temporary List') %]" />[% l(' View My Temporary List') %]</a>
+                        <a href="[% mkurl(ctx.opac_root _ '/mylist') %]" class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="[% l('View My Temporary List') %]" />[% l(' View My Temporary List') %]</a>
                         [%- END %]
                     [% END %]
                 </div>
                 <div class="rdetail_aux_utils">
-                    <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="[% l('Print / Email Actions Image') %]" />
+                    <img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="[% l('Print / Email Actions Image') %]" />
                     <a href="[% mkurl(ctx.opac_root _ '/record/print/' _ ctx.bre_id) %]" class="no-dec" rel="nofollow" vocab="">[% l('Print') %]</a> /
                     <a href="[% mkurl(ctx.opac_root _ '/record/email/' _ ctx.bre_id) %]" class="no-dec" rel="nofollow" vocab="">[% l('Email') %]</a>
                 </div>
             [% IF !ctx.is_staff %]
                 <div class="rdetail_aux_utils share_record">
                     <a href="[% mkurl('', {locg =>CGI.param('locg'), copy_depth =>CGI.param('copy_depth')}, 1) %]" class="no-dec">
-                         <img src="[% ctx.media_prefix %]/images/link.png" alt="[% l('Permalink') %]" />
+                         <img src="[% ctx.media_prefix %]/images/link.png[% ctx.cache_key %]" alt="[% l('Permalink') %]" />
                          [% l('Permalink') %]
                     </a>
                 </div>
index e2fa5ba..d520f5e 100644 (file)
@@ -364,7 +364,7 @@ END;
                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
                                                     [% IF rec.user_circulated %]
                                                     <div class="result_item_circulated">
-                                                        <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
+                                                        <img src="[% ctx.media_prefix %]/images/green_check.png[% ctx.cache_key %]" alt="[% l('Checked Out Before') %]"/>
                                                         <span>[% l('I have checked this item out before') %]</span>
                                                     </div>
                                                     [% END %]
@@ -392,7 +392,7 @@ END;
                                                                       hold_source_page => mkurl()}, ['query','tag','subfield','term','_special','sort','page']) %]"
                                                                 [% html_text_attr('title', l('Place Hold on [_1]', attrs.title)) %]
                                                                     class="no-dec" rel="nofollow" vocab=""><img
-                                                                src="[% ctx.media_prefix %]/images/green_check.png"
+                                                                src="[% ctx.media_prefix %]/images/green_check.png[% ctx.cache_key %]"
                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
                                                         </div>
 [%- END -%]
@@ -412,7 +412,7 @@ END;
                                                             %]      
                                                             <a href="[% href %]" class="no-dec" 
                                                                 [% html_text_attr('title', title_label) %] rel="nofollow" vocab="">
-                                                                <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
+                                                                <img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="" />
                                                                 [% label %]
                                                             </a>
                                                             [% END %]
@@ -426,7 +426,7 @@ END;
                                                                 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 %]&amp;Options=Y" rel="nofollow" vocab="">
-                                                                <img src='[% ctx.media_prefix %]/images/starz.png' alt="[% l('Ratings Icon') %]"/> 
+                                                                <img src='[% ctx.media_prefix %]/images/starz.png[% ctx.cache_key %]' alt="[% l('Ratings Icon') %]"/>
                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
                                                             </a>
                                                         </div>
index 1b24159..c33a897 100644 (file)
@@ -102,7 +102,7 @@ END;
         <button id='search-submit-go-depth' type="submit" value="[% ctx.depth_sel_depth %]" name="depth" class="[% ctx.depth_sel_button_class %]"
             onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden"; $("search-submit-go-depth").className="hidden";}, 2000)' title="[% ctx.depth_sel_tooltip | html %]">[% ctx.depth_sel_button_label | html %]</button>
         [%- END %]
-        <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif' style='height:16px;width:16px;' class='hidden' alt='[% l("Search In Progress") %]'/>
+        <img id='search-submit-spinner' src='[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]' style='height:16px;width:16px;' class='hidden' alt='[% l("Search In Progress") %]'/>
     </span>
     </div>
     [% IF ctx.bookbag %]
index ade1290..378d2c8 100644 (file)
@@ -6,9 +6,9 @@
         </div>
         <div class="button">
             [% IF ctx.saved_searches_expanded %]
-            <a href="[% mkurl('', {'sss_expand' => 0}) %]" title="[% l('Collapse') %]"><img src="[% ctx.media_prefix %]/images/staff_search_minus_btn.png" alt="[% l('Collapse') %]" /></a>
+            <a href="[% mkurl('', {'sss_expand' => 0}) %]" title="[% l('Collapse') %]"><img src="[% ctx.media_prefix %]/images/staff_search_minus_btn.png[% ctx.cache_key %]" alt="[% l('Collapse') %]" /></a>
             [% ELSE %]
-            <a href="[% mkurl('', {'sss_expand' => 1}) %]" title="[% l('Expand') %]"><img src="[% ctx.media_prefix %]/images/staff_search_plus_btn.png" alt="[% l('Expand') %]" /></a>
+            <a href="[% mkurl('', {'sss_expand' => 1}) %]" title="[% l('Expand') %]"><img src="[% ctx.media_prefix %]/images/staff_search_plus_btn.png[% ctx.cache_key %]" alt="[% l('Expand') %]" /></a>
             [% END %]
         </div>
         <div class="clear">&nbsp;</div>
index fedb66a..944eb19 100644 (file)
@@ -1,2 +1,2 @@
        <div id="topnav_logo"> <a href="/"><img alt="[% l('Evergreen Logo') %]" 
-            src="[% ctx.media_prefix %]/opac/images/small_logo.png" /></a></div>
+            src="[% ctx.media_prefix %]/opac/images/small_logo.png[% ctx.cache_key %]" /></a></div>