From de5dfd465ccb50d4e3d54b837231e7aba463aef6 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Fri, 29 Jul 2011 11:51:26 -0400 Subject: [PATCH] Direct entry point into the call number browser Signed-off-by: Lebbeous Fogle-Weekley --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 1 + .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 10 ++++---- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 29 ++++++++++++++++++++++ Open-ILS/web/css/skin/default/opac/style.css | 4 +++ Open-ILS/web/templates/default/opac/cnbrowse.tt2 | 21 ++++++++++++++++ .../default/opac/parts/advanced/numeric.tt2 | 1 + .../default/opac/parts/record/cnbrowse.tt2 | 12 ++++++--- 7 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 Open-ILS/web/templates/default/opac/cnbrowse.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 6097498561..6412907fca 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -94,6 +94,7 @@ sub load { return $self->load_rresults if $path =~ m|opac/results|; return $self->load_record if $path =~ m|opac/record|; + return $self->load_cnbrowse if $path =~ m|opac/cnbrowse|; return $self->load_mylist_add if $path =~ m|opac/mylist/add|; return $self->load_mylist_move if $path =~ m|opac/mylist/move|; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index dbfad54ee2..f7a86b5848 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -62,9 +62,8 @@ sub load_record { $ctx->{expanded_holdings} = $self->get_expanded_holdings($rec_id, $org, $depth); } elsif ($expand eq 'cnbrowse') { - $ctx->{browsed_call_numbers} = $self->browse_call_numbers(); + $self->prepare_browse_call_numbers(); } - } return Apache2::Const::OK; @@ -209,10 +208,10 @@ sub any_call_number_label { } } -sub browse_call_numbers { +sub prepare_browse_call_numbers { my ($self) = @_; - my $cn = $self->any_call_number_label or + my $cn = ($self->cgi->param("cn") || $self->any_call_number_label) or return []; my $org_unit = $self->ctx->{get_aou}->($self->cgi->param('loc')) || @@ -224,7 +223,7 @@ sub browse_call_numbers { $cn, $org_unit->shortname, 9, $self->cgi->param("cnoffset") )->gather(1) || []; - return [ + $self->ctx->{browsed_call_numbers} = [ map { $_->record->marc( (new XML::LibXML)->parse_string($_->record->marc) @@ -232,6 +231,7 @@ sub browse_call_numbers { $_; } @$results ]; + $self->ctx->{browsing_ou} = $org_unit; } sub get_hold_copy_summary { diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index f59700108c..96f150e63a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -135,11 +135,15 @@ sub load_rresults { $ctx->{page} = 'rresult'; + # Special alternative searches here. This could all stand to be cleaner. if ($cgi->param("_special")) { return $self->marc_expert_search if scalar($cgi->param("tag")); return $self->item_barcode_shortcut if ( $cgi->param("qtype") and ($cgi->param("qtype") eq "item_barcode") ); + return $self->call_number_browse_standalone if ( + $cgi->param("qtype") and ($cgi->param("qtype") eq "cnbrowse") + ); } my $page = $cgi->param('page') || 0; @@ -328,4 +332,29 @@ sub marc_expert_search { } } +sub call_number_browse_standalone { + my ($self) = @_; + + if (my $cnfrag = $self->cgi->param("query")) { + my $url = sprintf( + 'http%s://%s%s/cnbrowse?cn=%s', + $self->cgi->https ? "s" : "", + $self->apache->hostname, + $self->ctx->{opac_root}, + $cnfrag # XXX some kind of escaping needed here? + ); + return $self->generic_redirect($url); + } else { + return $self->generic_redirect; # return to search page + } +} + +sub load_cnbrowse { + my ($self) = @_; + + $self->prepare_browse_call_numbers(); + + return Apache2::Const::OK; +} + 1; diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index 6a0a19ae51..dd69b492e4 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -1015,3 +1015,7 @@ a.dash-link:hover { text-decoration: underline !important; } .rdetail-extras-summary { margin: 10px; } .staff-hold { background-color: #eee; } .expert-search tbody tr th { text-align: right; padding-left: 2em; } +.bookshelf thead tr td { + border-bottom: 1px dashed #999; + padding-bottom: 1ex; +} diff --git a/Open-ILS/web/templates/default/opac/cnbrowse.tt2 b/Open-ILS/web/templates/default/opac/cnbrowse.tt2 new file mode 100644 index 0000000000..b9c74539d3 --- /dev/null +++ b/Open-ILS/web/templates/default/opac/cnbrowse.tt2 @@ -0,0 +1,21 @@ +[% # This is the stand-alone call-number browser. This mainly wraps around + # the same guts as the "shelf browser" part of a record results page. + + PROCESS "default/opac/parts/header.tt2"; + PROCESS "default/opac/parts/misc_util.tt2"; + WRAPPER "default/opac/parts/base.tt2"; + INCLUDE "default/opac/parts/topnav.tt2"; + ctx.page_title = l("Call Number Browse"); %] +
+ [% INCLUDE "default/opac/parts/printnav.tt2" %] + [% INCLUDE "default/opac/parts/searchbar.tt2" %] +
+
+
+
+ [% INCLUDE "default/opac/parts/record/cnbrowse.tt2" %] +
+
+
+
+[% END %] diff --git a/Open-ILS/web/templates/default/opac/parts/advanced/numeric.tt2 b/Open-ILS/web/templates/default/opac/parts/advanced/numeric.tt2 index c2a1d3dfdd..d842942bc8 100644 --- a/Open-ILS/web/templates/default/opac/parts/advanced/numeric.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/advanced/numeric.tt2 @@ -9,6 +9,7 @@ + diff --git a/Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2 b/Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2 index 88e4fbf0ad..c3a1cb46c2 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2 @@ -1,20 +1,26 @@ +[%- IF ctx.page == "record"; + prev_next_root = "/record/" _ ctx.bre_id _ extras_propagator; +ELSE; + cn = CGI.param('cn') | uri; + prev_next_root = "/cnbrowse?cn=" _ cn; +END -%]
[% l("You are now browsing") %] - [% ctx.get_aou(CGI.param('loc')).name %] + [% ctx.browsing_ou.name %]
-- 2.11.0
- [% + [% l("<< Previous Page") %] [% l("Shelf Browser") %] - [% + [% l("Next Page >>") %]