$self->ctx->{page} = 'getit'; # repair the page
return $self->save_item_to_bookbag($rec_id, $bbag_id) if $action eq 'save';
+ return $self->login_and_place_hold($rec_id) if $action eq 'hold';
# if the user is logged in, fetch his bookbags
if ($ctx->{user}) {
$self->ctx->{page} = 'getit'; # repair the page
return Apache2::Const::OK;
}
+
+sub login_and_place_hold {
+ my $self = shift;
+ my $bre_id = shift;
+ my $ctx = $self->ctx;
+ my $username = $self->cgi->param('username');
+ my $password = $self->cgi->param('password');
+ my $pickup_lib = $self->cgi->param('pickup_lib');
+
+ if (!$ctx->{user}) {
+ # First, log the user in and return to
+ # TODO: let user know username/password is required..
+ return Apache2::Const::OK unless $username and $password;
+ my $new_uri = $self->apache->unparsed_uri;
+ my $sep = ($new_uri =~ /\?/) ? '&' : '?';
+ $new_uri .= "${sep}pickup_lib=$pickup_lib&action=hold";
+ $self->cgi->param('redirect_to', $new_uri);
+ return $self->load_login;
+ }
+
+ # TODO: place hold
+
+ my $hold_id = '';
+# (my $new_uri = $self->apache->unparsed_uri) =~ s/getit/getit_results/g;
+# $new_uri .= ($new_uri =~ /\?/) ? "&hold=$hold_id" : "?hold=$hold_id";
+# return $self->generic_redirect($new_uri);
+
+ return Apache2::Const::OK;
+}
sub save_item_to_bookbag {
my $self = shift;
<div class="top_side">
<h2>get it!</h2>
- <p>[% |l %]If you would like to request this item, please enter the following information and click<br />Submit below:[% END %]</p>
+ <p>[% |l %]If you would like to request this item, please enter the
+ following information and click<br />Submit below:[% END %]</p>
</div>
- <div class="checkout_box">
- <div class="box1_top"> </div>
- <div class="box_inside">
- [% IF !ctx.user %]
- [% seed = l(' Enter Numbers... ') %]
- <p>[% l('Library Card Number without spaces:') %]</p>
- <div class="input_box">
- <input type="text" class="text_box" style="color:#aaa;" value="[% seed %]"
- onfocus="if(this.value=='[% seed %]'){this.value='';this.style.color='#424242';}"
- onblur="if(this.value==''){this.value='[% seed %]'; this.style.color='#aaa';}" />
- </div>
- <a class="help_btn" href="javascript:;"
- onclick="helpPopup('card_help', this, event);"><img
- src="[% ctx.media_prefix %]/images/kpac/question_mark.png" alt="pin number help" /></a>
- <div class="clear"> </div>
- <div class="hr"> </div>
+ <form method='POST'><!-- login + place hold form -->
+
+ <div class="checkout_box">
+ <div class="box1_top"> </div>
+ <div class="box_inside">
+
+ [% IF !ctx.user %]
+ [% seed = l(' Enter Numbers... ') %]
+ <p>[% l('Library Card Number without spaces:') %]</p>
+ <div class="input_box">
+ <input name="username" type="text" class="text_box" style="color:#aaa;" value="[% seed %]"
+ onfocus="if(this.value=='[% seed %]'){this.value='';this.style.color='#424242';}"
+ onblur="if(this.value==''){this.value='[% seed %]'; this.style.color='#aaa';}" />
+ </div>
+ <a class="help_btn" href="javascript:;"
+ onclick="helpPopup('card_help', this, event);"><img
+ src="[% ctx.media_prefix %]/images/kpac/question_mark.png" alt="pin number help" /></a>
- <p>[% l('Password') %]</p>
- <div class="input_box">
- <input type="password" class="text_box" style="color:#aaa;" value="[% seed %]"
- onfocus="if(this.value=='[% seed %]'){this.value='';this.style.color='#424242';}"
- onblur="if(this.value==''){this.value='[% seed %]'; this.style.color='#aaa';}" />
+ <div class="clear"> </div>
+ <div class="hr"> </div>
- <a class="help_btn" href="javascript:;"
- onclick="helpPopup('password_help', this, event);"><img
- src="[% ctx.media_prefix %]/images/kpac/question_mark.png" alt="[% l('password help') %]" /></a>
+ <p>[% l('Password') %]</p>
+ <div class="input_box">
+ <input name="password" type="password" class="text_box" style="color:#aaa;" value="[% seed %]"
+ onfocus="if(this.value=='[% seed %]'){this.value='';this.style.color='#424242';}"
+ onblur="if(this.value==''){this.value='[% seed %]'; this.style.color='#aaa';}" />
+ </div>
- <div class="clear"> </div>
- <div class="hr"> </div>
- [% END %]
+ <a class="help_btn" href="javascript:;"
+ onclick="helpPopup('password_help', this, event);"><img
+ src="[% ctx.media_prefix %]/images/kpac/question_mark.png" alt="[% l('password help') %]" /></a>
- <p>[% l('Choose a Pickup Library:') %]</p>
- <div class="pickup_lib">
- [% def_lib = ctx.default_pickup_lib || ctx.physical_loc;
- PROCESS "opac/parts/org_selector.tt2";
- PROCESS build_org_selector name='pickup_lib'
- value=def_lib id='pickup_lib' can_have_vols_only=1 %]
+ <div class="clear"> </div>
+ <div class="hr"> </div>
+ [% END %]
+
+ <p>[% l('Choose a Pickup Library:') %]</p>
+ <div class="pickup_lib">
+ [% def_lib = ctx.default_pickup_lib || ctx.physical_loc;
+ PROCESS "opac/parts/org_selector.tt2";
+ PROCESS build_org_selector name='pickup_lib'
+ value=def_lib id='pickup_lib' can_have_vols_only=1 %]
+ </div>
</div>
</div>
- </div>
- <div class="submit_btn">
- <a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" alt="submit" /></a>
- </div>
+ <div class="submit_btn">
+ <input type='hidden' name='action' value='hold'/>
+ <input type='image' src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" alt="[% l('Submit') %]"/>
+ </div>
+ </form>
</div>
</td>
</div>
<form method='POST'>
<input type='hidden' name='action' value='save'/>
- [% IF ctx.user AND ctx.bookbags.size > 0 %]
+ [% IF ctx.user AND ctx.bookbags AND ctx.bookbags.size > 0 %]
<div class="checkout_box">
<div class="box1_top"> </div>
<div class="box_inside">