kpac : copy table; record details
authorBill Erickson <berick@esilibrary.com>
Fri, 27 Jan 2012 17:15:05 +0000 (12:15 -0500)
committerMike Rylander <mrylander@gmail.com>
Mon, 30 Jul 2012 19:03:19 +0000 (15:03 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/examples/kpac.xml
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm
Open-ILS/src/templates/kpac/detailed.tt2
Open-ILS/src/templates/kpac/parts/breadcrumb.tt2
Open-ILS/src/templates/kpac/parts/copy_table.tt2 [new file with mode: 0644]
Open-ILS/src/templates/kpac/parts/grid.tt2
Open-ILS/src/templates/kpac/parts/searchbox.tt2

index c905cc1..6e8ff49 100644 (file)
@@ -28,7 +28,7 @@
             <cell name="Trumpet"  img="category.png" type="search">su:trumpet</cell>
             <cell name="Drums"    img="category.png" type="search">su:drums</cell>
             <cell name="Bass"     img="category.png" type="search">su:bass</cell>
-            <cell name="Clarinet" img="category.png" type="search">su:clarinet</cell>
+            <cell name="Clarinet" img="category.png" type="link">http://en.wikipedia.org/wiki/Clarinet</cell>
         </page>
         <page id="11" columns="3" name="Current Events" img="category.png">
             <cell name="Entertainment"  img="category.png" type="search">su:entertainment sort('pubdate')#descending</cell>
index f6fb060..4e9dbea 100644 (file)
@@ -80,7 +80,7 @@ sub load_kpac_config {
         );
     }
 
-    # TODO: make generic "whoami" sub for EGCatLoader.
+    # TODO: make generic "whereami" sub for EGCatLoader.
     my $ou = $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id;
     my $layout;
 
index 478e5b3..5e66ee5 100644 (file)
     <div class="clear">&nbsp;</div>
 </div>
 
-<div class="sub_header">You can find this item at these locations:</div>
+<div class="sub_header">[% l('You can find this item at these locations:') %]</div>
     <div class="item_detail_location_wrapper">
-        <table cellpadding="0" cellspacing="0" border="0" class="item_location_table">
-            <tbody>
-                <tr class="header">
-                    <td class="location">Location</td>
-                    <td class="loc_info">&nbsp;</td>
-                    <td class="status">Status</td>
-                    <td class="callnumber">Call Number</td>
-                </tr>
-                <tr>
-                    <td class="location">Bellevue Library</td>
-                    <td class="loc_info"><a href="javascript:;">View Library Info</a></td>
-                    <td class="status">Check Shelf</td>
-                    <td class="callnumber">J613.71 CRE</td>
-                </tr>
-            </tbody>
-        </table>
-    </div>
-    <div class="sub_header">About this item:</div>
-    <div class="item_detail_desc">
-        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam <a href="javascript:;">nonummy</a> nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit</p>
+        [% INCLUDE 'kpac/parts/copy_table.tt2' %]
     </div>
 
+    [% IF attrs.summary %]
+        <div class="sub_header">[% l('About this item:') %]</div>
+        <div class="item_detail_desc">
+            [% FOR sum IN attrs.summary %]
+                [% IF !loop.first; '<br/>'; END %]
+                <p>[% sum | html %] </p>
+            [% END %]
+        </div>
+    [% END %]
+
+    <!-- TODO -->
+
     <div class="item_detail_extras_tabs">
         <a href="javascript:;">Reviews</a>
         <div class="selected">Rate this Item</div>
index 8f59e24..665e928 100644 (file)
@@ -1,7 +1,7 @@
 <div class="breadcrumb">
 
     <!-- home page -->
-    <a href="[% mkurl(ctx.kpac_root _ '/index', {}, ['trail']) %]" 
+    <a href="[% mkurl(ctx.kpac_root _ '/index', {}, ['trail', 'page']) %]" 
         class="bread_home"><img alt="[% l('Home') %]" 
         src="[% ctx.media_prefix %]/images/kpac/home_icon.png" /></a>
 
 
             <!-- record title -->
             <div class="bread_green_mid">&nbsp;</div>
-            [%  title = '';
-                IF attrs AND attrs.title;
-                    title = attrs.title.substr(15, -1, '...');
-                END
+            [%  tlen = 18; # TODO config?
+                title = attrs.title || '';
+                IF title.length > tlen;
+                    title = l('[_1]...', title.substr(0, tlen - 3));
+                END;
+                # I know there's a way to do this all w/ substr, 
+                # but it's trying my patience.  this works.
             %]
             <a href="javascript:;">[% title | html %]</a>
 
diff --git a/Open-ILS/src/templates/kpac/parts/copy_table.tt2 b/Open-ILS/src/templates/kpac/parts/copy_table.tt2
new file mode 100644 (file)
index 0000000..0527f9f
--- /dev/null
@@ -0,0 +1,82 @@
+[%-
+FOREACH copy_info IN ctx.copies;
+    IF copy_info.call_number_label != '##URI##';
+        has_copies = 'true';
+    END;
+    IF copy_info.part_label != '';
+        has_parts = 'true';
+    END;
+    IF has_parts && has_copies;
+        LAST;
+    END;
+END;
+%]
+[%- IF has_copies; %]
+<table cellpadding="0" cellspacing="0" border="0" width="100%" class="item_location_table">
+    <tbody>
+        <tr class="header">
+            <td class="location">[% l('Location') %]</td>
+            <td class="loc_info">&nbsp;</td>
+            <td class="status">[% l('Status') %]</td>
+            <td class="callnumber">[% l('Call Number') %]</td>
+        </tr>
+        [%- 
+        FOR copy_info IN ctx.copies;
+            callnum = copy_info.call_number_label;
+            NEXT IF callnum == '##URI##';
+
+            callnum_prefix = copy_info.call_number_prefix_label;
+            IF callnum_prefix != "";
+                callnum = callnum_prefix _ " " _ callnum;
+            END;
+
+            callnum_suffix = copy_info.call_number_suffix_label;
+            IF callnum_suffix != "";
+                callnum = callnum  _ " " _ callnum_suffix;
+            END;
+        -%]
+        <tr>
+            <td class="location">[% ctx.get_aou(copy_info.circ_lib).name | html %]</td>
+            <td class="loc_info"><a href="javascript:;">View Library Info</a></td><!-- TODO -->
+            <td class="status">[% copy_info.copy_status | html %]</td>
+            [%- IF has_parts == 'true' %]
+            <td class="callnumber">[% l('[_1] ([_2])', callnum, copy_info.part_label) | html %]</td>
+            [% ELSE %]
+            <td class="callnumber">[% callnum | html %]</td>
+            [%- END %]
+        </tr>
+        [%- END %]
+
+        <!-- PAGING -->
+
+        <tr>
+
+            <td>
+            [%- IF ctx.copy_offset > 0;
+                new_offset = ctx.copy_offset - ctx.copy_limit;
+                IF new_offset < 0; new_offset = 0; END %]
+                    <a href="[% mkurl('', {copy_offset => new_offset, copy_limit => ctx.copy_limit}) %]">&laquo; [%
+                        l('Previous [_1]', ctx.copy_offset - new_offset) %]</a>
+            [%- END %]
+            </td>
+
+            <td>
+            [%- IF ctx.copies.size >= ctx.copy_limit %]
+                    <a href="[% mkurl('', {copy_offset => ctx.copy_offset + ctx.copy_limit, copy_limit => ctx.copy_limit}) %]">[%
+                        l('Next [_1]', ctx.copy_limit) %] &raquo;</a>
+            [%- END %]
+            </td>
+
+            [%- more_copies_limit = 50 %] [%# TODO: config %]
+            <td>
+            [%- IF  ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %]
+                <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]">[% l('Show more copies') %]</a>
+            [%- ELSIF ctx.copy_limit == more_copies_limit %]
+                <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]">[% l('Show fewer copies') %]</a>
+            [%- END %]
+            </td>
+        </tr>
+    </tbody>
+</table>
+[% END %]
+
index 3a2d204..2ec7800 100644 (file)
@@ -27,7 +27,7 @@ MACRO render_kpac_grid(page_id) BLOCK;
 
         [% ELSIF cell.type == 'search'; %]
 
-        <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/search_results', {query => cell.content}) %]"><img 
+        <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/search_results', {query => cell.content}, ['page']) %]"><img 
             src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
 
         [% ELSIF cell.type == 'link'; %]
index b7a1a62..d53cb9e 100644 (file)
@@ -1,6 +1,5 @@
 <div class="sub_sidebar_header">[% l('New Search') %]</div>
 <form action="[% ctx.kpac_root _ '/search_results' %]">
-    <input type='hidden' name='trail' value="[% CGI.param('trail') | html %]"/>
     <div class="sub_sidebar_search_wrapper">
         <input type="text" name='query' value="[% CGI.param('query') | html %]"
             [% seed = l(' Enter Text... ') | html %]