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);
$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(
order_by => {cbreb => 'name'},
limit => $self->cgi->param('bbag_limit') || 100,
}],
- {substream => 1}
);
}
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;
<h2>[% l('save it!') %]</h2>
<p>[% l('If you would like to save this item to a list to be requested later, please choose a location and click <br/>Submit below.') %]</p>
</div>
- [% IF ctx.user AND ctx.bookbags.size > 0 %]
- <div class="checkout_box">
- <div class="box1_top"> </div>
- <div class="box_inside">
- <p>[% l('Add to one of your lists?') %]</p>
- <select name='bookbag'>
- <option selected='selected'>[% l('-- Select a List --') %]</option>
- [% FOR bbag IN ctx.bookbags %]
- <option value="[% bbag.id %]">[% bbag.name | html %]</option>
- [% END %]
- </select>
+ <form method='POST'>
+ <input type='hidden' name='action' value='save'/>
+ [% IF ctx.user AND ctx.bookbags.size > 0 %]
+ <div class="checkout_box">
+ <div class="box1_top"> </div>
+ <div class="box_inside">
+ <p>[% l('Add to one of your lists?') %]</p>
+ <select name='bookbag'>
+ <option selected='selected'>[% l('-- Select a List --') %]</option>
+ [% FOR bbag IN ctx.bookbags %]
+ <option value="[% bbag.id %]">[% bbag.name | html %]</option>
+ [% END %]
+ </select>
+ </div>
</div>
+ [% END %]
+ <div class="submit_btn">
+ <input type='image' src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" alt="[% l('Submit') %]" />
</div>
- [% END %]
- <div class="submit_btn">
- <a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" alt="submit" /></a>
</div>
</div>
</td>