kpac : initial holds; misc
authorBill Erickson <berick@esilibrary.com>
Mon, 30 Jan 2012 17:32:43 +0000 (12:32 -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/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm
Open-ILS/src/templates/kpac/checkout.tt2
Open-ILS/src/templates/kpac/detailed.tt2
Open-ILS/src/templates/kpac/parts/header.tt2
Open-ILS/src/templates/kpac/parts/record_row.tt2 [new file with mode: 0644]
Open-ILS/src/templates/kpac/parts/searchbox.tt2
Open-ILS/src/templates/kpac/search_results.tt2

index 1f31081..6f68647 100644 (file)
@@ -436,7 +436,7 @@ sub load_login {
 # -----------------------------------------------------------------------------
 sub load_logout {
     my $self = shift;
-    my $redirect_to = shift;
+    my $redirect_to = shift || $self->cgi->param('redirect_to');
 
     # If the user was adding anyting to an anonymous cache 
     # while logged in, go ahead and clear it out.
index 4e9dbea..93e8891 100644 (file)
@@ -27,8 +27,6 @@ sub load {
 
     return $self->load_simple("index") if $path =~ m|kpac/index|;
     return $self->load_simple("category") if $path =~ m|kpac/category|;
-    return $self->load_simple("checkout") if $path =~ m|kpac/checkout|;
-    return $self->load_simple("checkout_results") if $path =~ m|kpac/checkout_results|;
 
     # note: sets page=rresult
     return $self->load_rresults if $path =~ m|kpac/search_results|; # inherited from tpac
@@ -40,21 +38,15 @@ sub load {
     #  Everything below here requires SSL
     # ----------------------------------------------------------------
     return $self->redirect_ssl unless $self->cgi->https;
-    return $self->load_logout if $path =~ m|kpac/logout|;
-
-    if($path =~ m|kpac/login|) {
-        return $self->load_login unless $self->editor->requestor; # already logged in?
-
-        # This will be less confusing to users than to be shown a login form
-        # when they're already logged in.
-        return $self->generic_redirect(
-            sprintf(
-                "https://%s%s/kpac/index",
-                $self->apache->hostname, $self->ctx->{base_path}
-            )
-        );
+
+    if ($path =~ m|kpac/checkout|) {
+        my $stat = $self->load_record(no_search => 1);
+        $self->ctx->{page} = 'checkout'; # repair the page
+        return $stat;
     }
 
+    # XXX auth vs. no-auth, pending list answers
+    return $self->load_simple("checkout_results") if $path =~ m|kpac/checkout_results|;
 
     # ----------------------------------------------------------------
     #  Everything below here requires authentication
index 884368d..7050494 100644 (file)
@@ -1,24 +1,15 @@
-[%  PROCESS "opac/parts/header.tt2";
-    PROCESS "kpac/parts/grid.tt2";
+[%  
+    PROCESS "opac/parts/header.tt2";
+    PROCESS "opac/parts/misc_util.tt2"; # MARC 
     WRAPPER "kpac/parts/subpage.tt2";
-    ctx.page_title = l('Get it') %]
+    attrs = {marc_xml => ctx.marc_xml};
+    PROCESS get_marc_attrs args=attrs;
+    ctx.page_title = attrs.title | html 
+%]
 
-          <div id="search_results_parent">
-            <div class="search_results checkout_item_pad">
-              <div class="item_detail_image"><a href="javascript:;"><img alt="item image" src="[% ctx.media_prefix %]/images/kpac/item_image.jpg" /></a></div>
-              <div class="item_detail_info">
-                <div class="item_detail_name">Book Name</div>
-                <div class="item_detail_author">by Author Name</div>
-                <div class="item_detail_callnumber">Call Number</div>
-                <div class="item_detail_extra_info">Publisher, Year, Size</div>
-              </div>
-              <div class="item_icon_wrapper">
-                <div class="item_icon">&nbsp;<img alt="book" src="[% ctx.media_prefix %]/images/kpac/icon_book.png" />&nbsp; <!-- put a single &nbsp; around each side of the image - for vertical centering --></div>
-                <div class="item_icon_type_text">Book</div>
-              </div>
-              <div class="clear">&nbsp;</div>
-            </div>
-          </div>
+<div id="search_results_parent">
+    [% INCLUDE 'kpac/parts/record_row.tt2' rec_id=ctx.bre_id%]
+</div>
           
           <div class="checkout_options">
             <table cellpadding="0" cellspacing="0" border="0"><tr><td valign="top" class="left_brain_cell">
index 5e66ee5..7690773 100644 (file)
@@ -7,7 +7,6 @@
     ctx.page_title = attrs.title | html 
 %]
 
-  <!-- did somebody order the div salad? -->
 <div class="item_detail_header">
 
     <div class="item_detail_image">
@@ -49,7 +48,7 @@
     </div>
 
     <div class="item_detail_header_buttons">
-        <div class="item_detail_getit_btn"><a href="[% mkurl(ctx.kpac_root _ '/checkout') %]"><img 
+        <div class="item_detail_getit_btn"><a href="[% mkurl(ctx.kpac_root _ '/checkout/' _ ctx.bre_id) %]"><img 
             alt="[% l('Get it') | html %]" src="[% ctx.media_prefix %]/images/kpac/get_it_btn.png" /></a>
         </div>
         <div class="item_detail_goback_btn">
index f280b66..e10889d 100644 (file)
     </div>
     <div class="header_menu">
         <!-- menu rendered in reverse order -->
-        <a href="javascript:;">Login</a>
-        <a href="javascript:;">Get a Library Card</a>
-        <a href="javascript:;">Help</a>
+        [% IF ctx.user %]
+            [% redir = CGI.url('-base' => 1) _ ctx.kpac_root _ '/index' %]
+            <a href="[% mkurl(ctx.logout_page, 
+                {redirect_to => redir.replace('^https:', 'http:')}, 1) %]">[% l('Logout') %]</a>
+        [% ELSE %]
+            <a href="[% mkurl(ctx.opac_root _ '/login').replace('^http:', 'https:') %]">[% l('Login') %]</a>
+        [% END %]
+        <a href="javascript:;">[% l('Get a Library Card') %]</a>
+        <a href="javascript:;">[% l('Help') %]</a>
     </div>
     <div class="clear">&nbsp;</div>
 </div>
diff --git a/Open-ILS/src/templates/kpac/parts/record_row.tt2 b/Open-ILS/src/templates/kpac/parts/record_row.tt2
new file mode 100644 (file)
index 0000000..4522afb
--- /dev/null
@@ -0,0 +1,40 @@
+<div class="search_results">
+    <div class="item_detail_image">
+        [%  img_src = ctx.media_prefix _ '/images/kpac/item_image.jpg'; # default image
+            ident = attrs.isbn_clean || attrs.upc; 
+            IF ident; 
+                img_src = ctx.media_prefix _ '/opac/extras/ac/jacket/medium/' _ ident;
+            END;
+        %]
+        <a href="[% mkurl(ctx.kpac_root _ '/detailed/' _ rec_id) %]"><img 
+            alt="[% l('Image of item') %]" width="167"
+            src='[% mkurl(img_src, {}, 1) %]' /></a><br />
+    </div>
+    <div class="item_detail_info">
+        <div class="item_detail_name"><a href="[% mkurl(ctx.kpac_root _ '/detailed/' _ rec_id) %]">[% attrs.title %]</a></div>
+        <div class="item_detail_author">[% l('by [_1]', attrs.author) %]</div>
+        <div class="item_detail_callnumber">[% attrs.holdings.0.label | html %]</div>
+        <div class="item_detail_extra_info">
+            [% l('[_1], [_2]', attrs.publisher, attrs.pubdate) | html %] <!-- TODO fix commas, etc. -->
+            [% IF attrs.phys_desc %]<br/>[% attrs.phys_desc | html; END %]
+        </div>
+        [% IF show_actions %]
+        <div class="item_detail_actions">
+            <div class="button"><a href="[% mkurl(ctx.kpac_root _ '/detailed/' _ rec_id) %]"><img 
+                src="[% ctx.media_prefix %]/images/kpac/more_info_btn.png" alt="more info" /></a></div>
+            <div class="button"><a href="[% mkurl(ctx.kpac_root _ '/checkout/' _ rec_id) %]"><img 
+                src="[% ctx.media_prefix %]/images/kpac/get_it_btn_sm.png" alt="get it" /></a></div>
+            <div class="clear">&nbsp;</div>
+        </div>
+        [% END %]
+    </div>
+    <div class="item_icon_wrapper">
+        <div class="item_icon">
+            &nbsp;<img width="35" alt="[% attrs.format_label %]" src="[% attrs.format_icon %]" />&nbsp; 
+            <!-- put a single &nbsp; around each side of the image - for vertical centering -->
+        </div>
+        <div class="item_icon_type_text">[% attrs.format_label %]</div>
+    </div>
+    <div class="clear">&nbsp;</div>
+</div>
+
index d53cb9e..714eb92 100644 (file)
@@ -19,7 +19,8 @@
                 qtype = qtype_blob.keys.0 %]
                 <td class="st_radio_btn">
                     <input type="radio" name="qtype" value="[% qtype %]" id="st_[% qtype %]"
-                        [% IF CGI.param('qtype') == qtype %]checked="checked"[% END %]/>
+                        [% IF (CGI.param('qtype') == qtype) OR 
+                            (!CGI.param('qtype') AND qtype == 'keyword') %]checked="checked"[% END %]/>
                 </td>
                 <td class="st_label"><label for="st_[% qtype %]">[% qtype_blob.$qtype | html %]</label></td>
                 [% IF !loop.last %]
index 582307e..8a8dc0d 100644 (file)
         attrs = {marc_xml => rec.marc_xml};
         PROCESS get_marc_attrs args=attrs %]
 
-    <div class="search_results" id="search_results_template">
-        <div class="item_detail_image">
-            [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
-                <a href="[% mkurl('detailed/' _ rec.id) %]"><img alt="[% l('Image of item') %]"
-                    width="167"
-                    src='[% ctx.media_prefix %]/opac/extras/ac/jacket/medium/[% ident | uri %]' /></a><br />
-            [% ELSE %]
-                <a href="[% mkurl('detailed/' _ rec.id) %]"><img alt="[% l('Image of item') %]"
-                    src="[% ctx.media_prefix %]/images/kpac/item_image.jpg" /></a>
-            [% END %]
-        </div>
-        <div class="item_detail_info">
-            <div class="item_detail_name"><a href="[% mkurl('detailed/' _ rec.id) %]">[% attrs.title %]</a></div>
-            <div class="item_detail_author">[% l('by [_1]', attrs.author) %]</div>
-            <div class="item_detail_callnumber">[% attrs.holdings.0.label | html %]</div>
-            <div class="item_detail_extra_info">
-                [% l('[_1], [_2]', attrs.publisher, attrs.pubdate) | html %] <!-- TODO fix commas, etc. -->
-                [% IF attrs.phys_desc %]<br/>[% attrs.phys_desc | html; END %]
-            </div>
-            <div class="item_detail_actions">
-                <div class="button"><a href="[% mkurl(ctx.kpac_root _ '/detailed/' _ rec.id) %]"><img 
-                    src="[% ctx.media_prefix %]/images/kpac/more_info_btn.png" alt="more info" /></a></div>
-                <div class="button"><a href="javascript:;"><img 
-                    src="[% ctx.media_prefix %]/images/kpac/get_it_btn_sm.png" alt="get it" /></a></div>
-                <div class="clear">&nbsp;</div>
-            </div>
-        </div>
-        <div class="item_icon_wrapper">
-            <div class="item_icon">
-                &nbsp;<img width="35" alt="[% attrs.format_label %]" src="[% attrs.format_icon %]" />&nbsp; 
-                <!-- put a single &nbsp; around each side of the image - for vertical centering -->
-            </div>
-            <div class="item_icon_type_text">[% attrs.format_label %]</div>
-        </div>
-        <div class="clear">&nbsp;</div>
-    </div>
+    [% INCLUDE 'kpac/parts/record_row.tt2' show_actions=1 rec_id=rec.id%]
 
 [% END %]
 </div>