more holds work; added item form/type/lang maps to list of public access classes...
authorBill Erickson <berick@esilibrary.com>
Thu, 27 Jan 2011 19:55:44 +0000 (14:55 -0500)
committerBill Erickson <berick@esilibrary.com>
Thu, 27 Jan 2011 19:55:44 +0000 (14:55 -0500)
Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm
Open-ILS/web/templates/default/opac/place_hold.tt2
Open-ILS/web/templates/default/opac/records.tt2 [deleted file]
Open-ILS/web/templates/default/opac/results.tt2
Open-ILS/web/templates/default/opac/welcome.tt2 [deleted file]

index 167f408..aabc73d 100644 (file)
@@ -104,7 +104,7 @@ sub load_helpers {
     $cache{list} = {}; # public object lists
 
     # fetch-on-demand-and-cache subs for commonly used public data
-    my @public_classes = qw/ccs aout/;
+    my @public_classes = qw/ccs aout cifm citm clm/;
 
     for my $hint (@public_classes) {
 
@@ -112,6 +112,8 @@ sub load_helpers {
             $Fieldmapper::fieldmap->{$_}->{hint} eq $hint
         } keys %{ $Fieldmapper::fieldmap };
 
+        my $ident_field =  $Fieldmapper::fieldmap->{$class}->{identity};
+
            $class =~ s/Fieldmapper:://o;
            $class =~ s/::/_/g;
 
@@ -130,7 +132,7 @@ sub load_helpers {
         $ctx->{$find_key} = sub {
             my $id = shift;
             return $cache{map}{$hint}{$id} if $cache{map}{$hint}{$id}; 
-            ($cache{map}{$hint}{$id}) = grep { $_->id == $id } @{$ctx->{$list_key}->()};
+            ($cache{map}{$hint}{$id}) = grep { $_->$ident_field eq $id } @{$ctx->{$list_key}->()};
             return $cache{map}{$hint}{$id};
         };
 
@@ -547,10 +549,11 @@ sub load_place_hold {
     my $self = shift;
     my $ctx = $self->ctx;
     my $e = $self->editor;
+    my $cgi = $self->cgi;
     $self->ctx->{page} = 'place_hold';
 
-    $ctx->{hold_target} = $self->cgi->param('hold_target');
-    $ctx->{hold_type} = $self->cgi->param('hold_type');
+    $ctx->{hold_target} = $cgi->param('hold_target');
+    $ctx->{hold_type} = $cgi->param('hold_type');
     $ctx->{default_pickup_lib} = $e->requestor->home_ou; # XXX staff
 
     if($ctx->{hold_type} eq 'T') {
@@ -560,7 +563,7 @@ sub load_place_hold {
 
     $ctx->{marc_xml} = XML::LibXML->new->parse_string($ctx->{record}->marc);
 
-    if(my $pickup_lib = $self->cgi->param('pickup_lib')) {
+    if(my $pickup_lib = $cgi->param('pickup_lib')) {
 
         my $args = {
             patronid => $e->requestor->id,
@@ -592,13 +595,15 @@ sub load_place_hold {
             );
 
             if($stat and $stat > 0) {
-                $ctx->{hold_success} = 1;
+
+                # if successful, return the user to the requesting page
+                $self->apache->print($cgi->redirect(-url => $cgi->referer));
+                return Apache2::Const::REDIRECT;
+
             } else {
                 $ctx->{hold_failed} = 1; # XXX process the events, etc
             }
         }
-
-        # place the hold and deliver results
     }
 
     return Apache2::Const::OK;
index b92315b..71810a7 100644 (file)
@@ -25,6 +25,7 @@
         <input type='Submit'/>
         <input type='hidden' name='hold_target' value='[% CGI.param('hold_target') %]'/>
         <input type='hidden' name='hold_type' value='[% CGI.param('hold_type') %]'/>
+        <input type='hidden' name='origin' value='[% CGI.param('origin') %]'/>
     </form>
     [% END %]
 </div>
diff --git a/Open-ILS/web/templates/default/opac/records.tt2 b/Open-ILS/web/templates/default/opac/records.tt2
deleted file mode 100644 (file)
index 7d53268..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-[% WRAPPER "default/opac/base.tt2" %]
-[% ctx.page_title = "Results" %]
-[% page = ctx.cgi.param('page') || 0; %]
-<a href='?page=[% page - 1 %]'>Prev</a>  <a href='?page=[% page + 1 %]'>Next</a>
-<br/>
-
-<table>
-[%
-    e = ctx.editor;
-    idx = 0;
-    WHILE idx < 10;
-        id = idx + page * 10;
-        attrs = e.search_acq_lineitem_attr({lineitem => id});
-        isbn = '';
-        FOR attr IN attrs; 
-            IF attr.attr_name == 'isbn';
-                isbn = attr.attr_value;
-                LAST;
-            END;
-        END;
-        idx = idx + 1;
-%]
-
-<tr>
-    <td><img width='65' height='90' src='/opac/extras/ac/jacket/small/[% isbn %]'/></td>
-    <td>[% FOR attr IN attrs; attr.attr_value _ ' / '; END; %]</td>
-</tr>
-
-    [% END %]
-</table>
-[% END %]
index fa09cca..700010e 100644 (file)
                         [% END %]
                     </td>
                     <td width='auto'>
-                        <div>
-                            <a href='record/[% rec.bre.id %]'>[% attrs.title %]</a>
-                            <span style='padding-left:10px;'>[% rec.copy_counts.available %] / [% rec.copy_counts.visible %]</span>
-                        </div>
+                        <div width='99%'>
+                            <div style='float:left'>
+                                <a href='record/[% rec.bre.id %]'>[% attrs.title %]</a>
+                            </div>
+                            <div style='float:right'>
+                                <span>[% rec.copy_counts.available %] / [% rec.copy_counts.visible %]</span>
+                                <span style='padding-left:10px;'><a href='place_hold?hold_target=[% rec.bre.id %]&hold_type=T'>Place Hold</a></span>
+                            </div>
+                        </div><br/>
                         <div>[% attrs.author %]</div>
                         <div>[% attrs.isbn || attrs.issn || attrs.upc %] [% attrs.publisher %] [% attrs.pubdate %]</div>
                     </td>
diff --git a/Open-ILS/web/templates/default/opac/welcome.tt2 b/Open-ILS/web/templates/default/opac/welcome.tt2
deleted file mode 100644 (file)
index 0cccd3f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<div style='position:absolute; top:0px; right:0px; border-left:1px solid #9A9; border-bottom:1px solid #9A9; padding: 10px; background:#ded'>
-    [% IF ctx.user; %]
-        <table>
-            <tr>
-                <td colspan='2' style='border-bottom:1px solid #9A9'>Welcome, [% ctx.user.usrname %]!</td>
-            </tr>
-            <tr>
-                <td>Total Holds</td><td>[% ctx.user_stats.holds.total %]</td>
-            </tr>
-            <tr>
-                <td>Ready Holds</td><td>[% ctx.user_stats.holds.ready %]</td>
-            </tr>
-            <tr>
-                <td>Items Out</td><td>[% ctx.user_stats.checkouts.out %]</td>
-            </tr>
-            <tr>
-                <td>Fines</td><td>$[% ctx.user_stats.fines.balance_owed %]</td>
-            </tr>
-            <tr>
-                <td><a href='logout'>Logout</a></td>
-                <td><a href='myopac/main'>Account</a></td>
-            </tr>
-        </table>
-    [% ELSE %]
-        <a href='[% ctx.base_url.replace('^http:', 'https:') _ ctx.base_path _ '/opac/login' %]'>Login</a>
-    [% END %]
-</div>