From 5db8fb03ca1a7ebbe176bc05936018b411f93b4d Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 26 Mar 2012 14:02:00 -0400 Subject: [PATCH] kpac: save to anon-list Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../perlmods/lib/OpenILS/WWW/EGKPacLoader.pm | 27 +++++++++++++++- Open-ILS/src/templates/kpac/getit.tt2 | 31 ++++++++++--------- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm index 7622374247..b17ddd229b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm @@ -51,6 +51,9 @@ sub load { sub load_getit { my $self = shift; my $ctx = $self->ctx; + my $rec_id = $ctx->{page_args}->[0]; + my $bbag_id = $self->cgi->param('bookbag'); + my $action = $self->cgi->param('action') || ''; # first load the record my $stat = $self->load_record(no_search => 1); @@ -58,6 +61,8 @@ sub load_getit { $self->ctx->{page} = 'getit'; # repair the page + return $self->save_item_to_bookbag($rec_id, $bbag_id) if $action eq 'save'; + # if the user is logged in, fetch his bookbags if ($ctx->{user}) { $ctx->{bookbags} = $self->editor->search_container_biblio_record_entry_bucket( @@ -68,7 +73,6 @@ sub load_getit { order_by => {cbreb => 'name'}, limit => $self->cgi->param('bbag_limit') || 100, }], - {substream => 1} ); } @@ -76,6 +80,27 @@ sub load_getit { return Apache2::Const::OK; } +sub save_item_to_bookbag { + my $self = shift; + my $rec_id = shift; + my $bookbag_id = shift; + + if ($bookbag_id) { + # save to existing bookbag + + } else { + # save to anonymous list + + # set some params assumed to exist for load_mylist_add + $self->cgi->param('record', $rec_id); + (my $new_uri = $self->apache->unparsed_uri) =~ s/getit/getit_results/g; + $self->cgi->param('redirect_to', $new_uri); + + $self->load_mylist_add; + } + + return Apache2::Const::OK; +} sub load_kpac_config { my $self = shift; diff --git a/Open-ILS/src/templates/kpac/getit.tt2 b/Open-ILS/src/templates/kpac/getit.tt2 index d665da5b5f..1b0dbf69be 100644 --- a/Open-ILS/src/templates/kpac/getit.tt2 +++ b/Open-ILS/src/templates/kpac/getit.tt2 @@ -81,22 +81,25 @@

[% l('save it!') %]

[% l('If you would like to save this item to a list to be requested later, please choose a location and click
Submit below.') %]

- [% IF ctx.user AND ctx.bookbags.size > 0 %] -
-
 
-
-

[% l('Add to one of your lists?') %]

- +
+ + [% IF ctx.user AND ctx.bookbags.size > 0 %] +
+
 
+
+

[% l('Add to one of your lists?') %]

+ +
+ [% END %] +
+
- [% END %] -
- submit
-- 2.43.2