From e0dbfda521e537748dc532f471fb9adf85d8dcf4 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Fri, 22 Jul 2011 13:04:37 -0400 Subject: [PATCH] More better call number browser, uses supercat directly, doesn't use mvr Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 28 +++++++++++++++------- .../default/opac/parts/record/cnbrowse.tt2 | 25 +++++++++---------- .../templates/default/opac/parts/record/extras.tt2 | 4 ++-- 3 files changed, 35 insertions(+), 22 deletions(-) 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 235cb6a987..a1f6777e51 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -202,14 +202,26 @@ sub any_call_number_label { sub browse_call_numbers { my ($self) = @_; - my $cn = $self->any_call_number_label or return []; - - my $search = create OpenSRF::AppSession("open-ils.search"); - - return $search->request( - "open-ils.search.callnumber.browse", - $cn, $self->cgi->param("loc"), 9, $self->cgi->param("cnoffset") - )->gather(1); + my $cn = $self->any_call_number_label or + return []; + + my $org_unit = $self->ctx->{get_aou}->($self->cgi->param('loc')) || + $self->ctx->{aou_tree}->(); + + my $supercat = create OpenSRF::AppSession("open-ils.supercat"); + my $results = $supercat->request( + "open-ils.supercat.call_number.browse", + $cn, $org_unit->shortname, 9, $self->cgi->param("cnoffset") + )->gather(1) || []; + + return [ + map { + $_->record->marc( + (new XML::LibXML)->parse_string($_->record->marc) + ); + $_; + } @$results + ]; } sub get_hold_copy_summary { 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 1ee18c7aea..88e4fbf0ad 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2 @@ -8,7 +8,7 @@ - [% + [% l("<< Previous Page") %] @@ -21,27 +21,28 @@ - [% tr_open = 0; FOR ent IN ctx.browsed_call_numbers %] + [% tr_open = 0; FOR cn IN ctx.browsed_call_numbers %] [%- IF loop.index % 3 == 0; tr_open = 1 %] [% END -%] - [% # Not to extend to life of the mvr fieldmapper class, - # but should we add a upc field to it to make this better? - IF ent.mods.isbn %] - cn.record.marc}; + PROCESS get_marc_attrs args=rec_attrs; + ident = rec_attrs.isbn_clean || rec_attrs.upc; + IF ident %] + + src="[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident %]" /> [% END %] -
[% ent.cn.label %]
+
[% cn.label %]
- [% IF ent.mods.author %]
+ [% IF rec_attrs.author %]
[% ent.mods.author %] + href="[% ctx.opac_root %]/results?qtype=author&query=[%- rec_attrs.author | replace('[,\.:;]', '') | uri %]&loc=[% CGI.param('loc') | uri %]">[% rec_attrs.author %]
[% END %] -
[% ctx.get_aou(ent.cn.owning_lib).name %]
+
[% cn.owning_lib.name %]
[% IF loop.index % 3 == 2; tr_open = 0 %] diff --git a/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 b/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 index 2bfa8be320..c53ce31668 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/extras.tt2 @@ -43,8 +43,8 @@ # to extras. # XXX move this off into a helper function - extras_propagator = propagator.replace('&expand=.+($|&|;)', '$1'); - extras_propagator = extras_propagator.replace('&cnoffset=.+($|&|;)', '$1'); + extras_propagator = propagator.replace('(&)?expand=.+($|&|;)', '$2'); + extras_propagator = extras_propagator.replace('(&)?cnoffset=.+($|&|;)', '$2'); href = ctx.full_path _ extras_propagator _ '&expand=' _ name _ '#' _ name; %] -- 2.11.0