Prevent expand and cnoffset params from propagating
authorDan Scott <dan@coffeecode.net>
Mon, 9 Jan 2012 02:43:58 +0000 (21:43 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 18 Jan 2012 21:54:19 +0000 (16:54 -0500)
The expand and cnoffset params in record summary might result in
unexpected behaviour if allowed to propagate by default, as mkurl()
enables, so stop them in their tracks.

Also, fix an overenthusiastic URI-encoding of subjects that led to a
space getting doubly-encoded (and thereby breaking searches).

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/opac/parts/record/body.tt2
Open-ILS/src/templates/opac/parts/record/subjects.tt2
Open-ILS/src/templates/opac/parts/record/summary.tt2

index bb2fbda..6a64e4e 100644 (file)
@@ -1,14 +1,14 @@
-<!-- ****************** page_rdetail.xml ***************************** -->
-[%  attrs = {marc_xml => ctx.marc_xml};
+[%-  attrs = {marc_xml => ctx.marc_xml};
     PROCESS "opac/parts/misc_util.tt2";
-    PROCESS get_marc_attrs args=attrs %]
-
+    PROCESS get_marc_attrs args=attrs;
+    stop_parms = ['expand','cnoffset'];
+%]
 <div id='canvas_main' class='canvas'>
 
     [% IF ctx.search_result_index >= 0 %]
     <div id="rdetail_header">
         <div style="float:left;">
-            <a href='[% mkurl(ctx.opac_root _ '/results') %]'>[% l('&#9668; Search Results') %]</a>
+            <a href='[% mkurl(ctx.opac_root _ '/results', {}, stop_parms); %]'>[% l('&#9668; Search Results') %]</a>
             <span id="rdetail_result_count">
                 [% l('Showing Item [_1] of [_2]', ctx.search_result_index + 1, ctx.hit_count) %]
             </span>
@@ -20,7 +20,7 @@
                     IF ctx.search_result_index % (ctx.page_size + 1) == 0; # first record in the page
                         prev_args.page = ctx.search_page - 1;
                     END;
-                    ctx.prev_rec_url = mkurl(ctx.prev_search_record, prev_args);
+                    ctx.prev_rec_url = mkurl(ctx.prev_search_record, prev_args, stop_parms);
             %]
             <a class='np_nav_link classic_link' title='[% l("Previous Record") %]'
                 href='[% ctx.prev_rec_url %]'><span class="nav_arrow_fix">&#9668; </span>[% l('Previous') %]</a>
@@ -34,7 +34,7 @@
                     IF ctx.page_size == ctx.search_result_index + 1;
                         next_args.page = ctx.search_page + 1;
                     END;
-                    ctx.next_rec_url = mkurl(ctx.next_search_record, next_args);
+                    ctx.next_rec_url = mkurl(ctx.next_search_record, next_args, stop_parms);
             %]
             <a class='np_nav_link classic_link' title='[% l("Next Record") %]'
                 href='[% ctx.next_rec_url %]'>[% l('Next') %]<span class="nav_arrow_fix"> &#9658;</span></a>
@@ -51,4 +51,3 @@
     </div>
     [% INCLUDE "opac/parts/record/summary.tt2" %]
 </div>
-<!-- ****************** end; page_rdetail.xml ***************************** -->
index 34f80b1..df06100 100644 (file)
                 # at this point, we actually have a partial term to use.
                 single_term = subfield.textContent | html;
                 all_terms.push(subfield.textContent);
-                total_term = all_terms.join(" ").replace('\s+$', '') | uri;
-                '<a href="' _ ctx.opac_root _ '/results?qtype=subject&amp;query=' _ total_term _ '&amp;loc=' _ loc _ '">' _ single_term _ '</a>';
-            END;
+                total_term = all_terms.join(" ").replace('\s+$', '');
+            %]
+<a href="[% mkurl(ctx.opac_root _ '/results', {qtype=>'subject', query=>total_term}, stop_parms); %]">[% single_term %]</a>
+            [%- END;
             IF all_terms.size; "<br/>"; END;
         END;
     END 
index 7867036..f62c531 100644 (file)
@@ -25,7 +25,7 @@
     <div id="rdetail_actions_div">
         <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()}) %]" 
+                {hold_target => ctx.bre_id, hold_type => 'T', hold_source_page => mkurl()}, stop_parms) %]" 
             class="no-dec"><img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('place hold') %]" /><span 
             class="place_hold">[% l('Place Hold') %]</span></a>
         </div>
@@ -34,7 +34,7 @@
             operation = ctx.mylist.grep(ctx.bre_id).size ? "delete" : "add";
             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}) %]" class="no-dec">
+            <a href="[% mkurl(ctx.opac_root _ '/mylist/' _ operation, {record => ctx.bre_id}, stop_parms) %]" class="no-dec">
                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
                 [% label %]
             </a>