TTpac: more use of mkurl() and general cleanup
authorBill Erickson <berick@esilibrary.com>
Thu, 11 Aug 2011 20:30:11 +0000 (16:30 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 11 Aug 2011 20:30:11 +0000 (16:30 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2
Open-ILS/web/templates/default/opac/parts/record/extras.tt2
Open-ILS/web/templates/default/opac/parts/record/summary.tt2

index d44c38d..83621b1 100644 (file)
@@ -1,9 +1,5 @@
-[%- IF ctx.page == "record";
-    prev_next_root = "/record/" _ ctx.bre_id _ extras_propagator;
-ELSE;
-    cn = CGI.param('cn') | uri;
-    prev_next_root = "/cnbrowse?cn=" _ cn;
-END -%]
+[% cnoffset = CGI.param('cnoffset') || 0; %]
+
 <div id='cn_browse' class='cn_browser'>
     <div id='cn_browse_div'> 
         <div class='color_4'>
@@ -14,15 +10,13 @@ END -%]
             <thead>
                 <tr>
                     <td>
-                        <a id='cn_browse_prev' class='classic_link' href="[% ctx.opac_root _ prev_next_root _ '&amp;cnoffset=' _ ((CGI.param('cnoffset') || 0) - 1) _ '&amp;expand=cnbrowse#cnbrowse' %]"<b>[%
-                            l("&lt;&lt; Previous Page")
-                        %]</b></a>
+                        <a id='cn_browse_prev' class='classic_link' 
+                            href="[% mkurl('', {cnoffset => cnoffset - 1}) %]#cnbrowse"><b>[% l("&lt;&lt; Previous Page") %]</b></a>
                     </td>
                     <td colspan='1' align='center'>[% l("Shelf Browser") %]</td>
                     <td>
-                        <a id='cn_browse_next' class='classic_link' href="[% ctx.opac_root _ prev_next_root _ '&amp;cnoffset=' _ ((CGI.param('cnoffset') || 0) + 1) _ '&amp;expand=cnbrowse#cnbrowse' %]"<b>[%
-                            l("Next Page &gt;&gt;")
-                        %]</b></a>
+                        <a id='cn_browse_next' class='classic_link' 
+                            href="[% mkurl('', {cnoffset => cnoffset + 1}) %]#cnbrowse"><b>[% l("Next Page &gt;&gt;") %]</b></a>
                     </td>
                 </tr>
             </thead>
@@ -36,17 +30,21 @@ END -%]
                             PROCESS get_marc_attrs args=rec_attrs;
                             ident = rec_attrs.isbn_clean || rec_attrs.upc;
                             IF ident %]
-                        <a href="[% ctx.opac_root %]/record/[% cn.record.id _ extras_propagator %]"><img height='60' width='50' 
+                        <a href="[% mkurl(ctx.opac_root _ '/record/' _ cn.record.id, {}, 1) %]"><img height='60' width='50' 
                             class='cn_browse_info' name='cn_browse_pic' border='0'
                             src="[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident %]" /></a>
                         [% END %]
                         <div class='cn_browse_info bold' name='cn_browse_cn'>[% cn.label %]</div>
                         <div class='cn_browse_info'>
-                            <a name='cn_browse_title' class='classic_link' href="[% ctx.opac_root %]/record/[% cn.record.id _ extras_propagator %]">[% rec_attrs.title %]</a>
+                            <a name='cn_browse_title' class='classic_link' 
+                                href="[% mkurl(ctx.opac_root _ '/record/' _ cn.record.id, {}, 1) %]">[% rec_attrs.title %]</a>
                         </div>
                         [% IF rec_attrs.author %]<div class='cn_browse_info'>
                             <a name='cn_browse_author' class='classic_link'
-                                href="[% ctx.opac_root %]/results?qtype=author&amp;query=[%- rec_attrs.author | replace('[,\.:;]', '') | uri %]&amp;loc=[% CGI.param('loc') | uri %]">[% rec_attrs.author %]</a>
+                                href="[%-
+                                    authorquery = rec_attrs.author | replace('[,\.:;]', '');
+                                    mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, 1)
+                                    -%]">[% rec_attrs.author | html_entity %]</a>
                         </div>[% END %]
                         <div class='cn_browse_info' name='cn_browse_lib'>[% cn.owning_lib.name %]</div>
                     </td>
index b4ea965..d22377a 100644 (file)
         <div class="rdetail_extras">
             <div class="rdetail_extras_hr"></div>
             <div class="rdetail_extras_link">
-                [%  # extras_propagator should be used in place of propagator
-                    # in opac extras interfaces... it just avoids duplicating
-                    # the expands CGI param and parameters that are specific
-                    # to extras.
-                    # XXX move this off into a helper function
-
-                    extras_propagator = propagator.replace('(&amp;)?expand=.+($|&|;)', '$2');
-                    extras_propagator = extras_propagator.replace('(&amp;)?cnoffset=.+($|&|;)', '$2');
-
-
-                    href = ctx.full_path _ extras_propagator _ '&amp;expand=' _ name _ '#' _ name; %]
+                [%  href = mkurl('', {expand => name}) _ '#' _ name; %]
                 <a name='[% name %]' href='[% href %]'><img
                     alt='[% extra.label %]' src="[% ctx.media_prefix %]/images/rdetail_arrow.png" /></a>
                 <a href='[% href %]' class="rdetail_extras_lbl">[% extra.label %]</a>
index bf386c2..6a833dd 100644 (file)
@@ -25,7 +25,7 @@
                             <em><a title='[% l("Perform an author search") %]'
                                     id='rdetail_author'
                                     href="[%- 
-                                        authorquery = attrs.author | replace('[,\.:;]');
+                                        authorquery = attrs.author | replace('[,\.:;]', '');
                                         mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery})
                                         -%]">[% attrs.author | html_entity %]</a></em>
                             [% END %]
     </tbody>
 </table>
 
-<div id="rdetail_locs_expand" class="hide_me">
-    <a href="#"><img
-        src="[% ctx.media_prefix %]/images/plus_sign.png" /></a>
-    <a style="position:relative;top:-3px;" href="#">[% l('Show more locations') %]</a>
-</div>
-
-<div id="rdetail_locs_collapse" class="hide_me">
-    <a href="#"><img
-        src="[% ctx.media_prefix %]/images/plus_sign.png" /></a>
-    <a style="position:relative;top:-3px;" href="#">[% l('Collapse locations') %]</a>
-</div>
-
 <div id="rdetail_extras_expand" class="hide_me">
     <a href="#"><img
         src="[% ctx.media_prefix %]/images/plus_sign.png" /></a>
     <a href="#"><img src="[% ctx.media_prefix %]/images/plus_sign.png" /></a>
     <a style="position:relative;top:-3px;" href="#">[% l('Collapse all tabs') %]</a>
 </div>
-
-<div class="hide_me">
-    <table id='' border="0" width="100%">
-        <tbody id='rdetail_details_tbody'>
-            <tr>
-                <td id='' rowspan='2' valign="top" align="center" style="padding-right:10px;">
-                </td>
-                <td class='rdetail_desc' valign="top" colspan="3">
-                    <table border="0" width="100%">
-                        <tr>
-                            <td valign="top">
-                                <div style="padding-bottom:7px;">
-                                    <strong>[% l("Title") %]:</strong>
-                                </div>
-                            </td>
-                            <td width="1" valign="top" align="right" style="white-space:nowrap;">
-                                <a href="[% ctx.opac_root %]/place_hold[% propagator; propagator.length > 1 ? "&amp;" : ""; %]hold_target=[% ctx.bre_id %]&amp;hold_type=T"><img alt="[% l('Place Hold') %]"
-                                    src="[% ctx.media_prefix %]/images/place_hold.gif" /></a>
-                                <a href="#" id="rd_reviews_and_more" target="_blank"><img
-                                    alt="[% l('Reviews and More') %]" src="[% ctx.media_prefix %]/images/reviews.gif" /></a>
-                                <a href="#" id=""><img alt="[% l('Add to My List') %]"
-                                    src="[% ctx.media_prefix %]/images/add_mylist.gif" /></a>
-                            </td>
-                        </tr>
-                    </table>
-                </td>        
-            </tr>
-            <tr>
-                <td nowrap='nowrap' colspan="3" valign="bottom" style="padding-bottom:16px;">
-                </td>
-            </tr>
-            <tr>
-                <td><div style="height:20px;"></div></td>
-            </tr>
-        </tbody>
-    </table>
-</div> <!-- details_body -->
-
-<!-- ****************** end: rdetail_summary.xml ***************************** -->