From: berick Date: Wed, 13 Apr 2011 18:25:58 +0000 (-0400) Subject: use unapi for record retrieval on details page; includes svf attrs for matttype,... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=12ec58a976c75ba0b3894bcac1e88b7218d267be;p=evergreen%2Fequinox.git use unapi for record retrieval on details page; includes svf attrs for matttype, etc.; some i18n cleanup --- 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 f636744eea..3a54fbc3dd 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -11,32 +11,35 @@ my $U = 'OpenILS::Application::AppUtils'; # record : bre object sub load_record { my $self = shift; - $self->ctx->{page} = 'record'; + my $ctx = $self->ctx; + $ctx->{page} = 'record'; - my $org = $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; + my $org = $self->cgi->param('loc') || $ctx->{aou_tree}->()->id; my $depth = $self->cgi->param('depth') || 0; my $copy_limit = int($self->cgi->param('copy_limit') || 10); my $copy_offset = int($self->cgi->param('copy_offset') || 0); - my $rec_id = $self->ctx->{page_args}->[0] + my $rec_id = $ctx->{page_args}->[0] or return Apache2::Const::HTTP_BAD_REQUEST; # run copy retrieval in parallel to bib retrieval + # XXX unapi my $copy_rec = OpenSRF::AppSession->create('open-ils.cstore')->request( 'open-ils.cstore.json_query.atomic', $self->mk_copy_query($rec_id, $org, $depth, $copy_limit, $copy_offset)); - $self->ctx->{record} = $self->editor->retrieve_biblio_record_entry($rec_id); - $self->ctx->{marc_xml} = XML::LibXML->new->parse_string($self->ctx->{record}->marc); + my (undef, @rec_data) = $self->get_records_and_facets([$rec_id], undef, {flesh => '{holdings_xml,mra}'}); + $ctx->{bre_id} = $rec_data[0]->{id}; + $ctx->{marc_xml} = $rec_data[0]->{marc_xml}; - $self->ctx->{copies} = $copy_rec->gather(1); - $self->ctx->{copy_limit} = $copy_limit; - $self->ctx->{copy_offset} = $copy_offset; + $ctx->{copies} = $copy_rec->gather(1); + $ctx->{copy_limit} = $copy_limit; + $ctx->{copy_offset} = $copy_offset; for my $expand ($self->cgi->param('expand')) { - $self->ctx->{"expand_$expand"} = 1; + $ctx->{"expand_$expand"} = 1; if($expand eq 'marchtml') { - $self->ctx->{marchtml} = $self->mk_marc_html($rec_id); + $ctx->{marchtml} = $self->mk_marc_html($rec_id); } } diff --git a/Open-ILS/web/templates/default/opac/parts/misc_util.tt2 b/Open-ILS/web/templates/default/opac/parts/misc_util.tt2 index 8a9c0f3940..3e6b175f1d 100644 --- a/Open-ILS/web/templates/default/opac/parts/misc_util.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/misc_util.tt2 @@ -43,8 +43,10 @@ END; END; + # "mattype" == "custom marc format specifier" FOR icon_style IN ['mattype', 'item_type']; - node = xml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="' _ icon_style _ '"]'); + node = xml.findnodes( + '//*[local-name()="attributes"]/*[local-name()="field"][@name="' _ icon_style _ '"]'); IF node; args.format_label = node.getAttribute('coded-value') args.format_icon = ctx.media_prefix _ '/images/format_icons/' _ icon_style _ '/' _ node.textContent _ '.png'; diff --git a/Open-ILS/web/templates/default/opac/parts/record/body.tt2 b/Open-ILS/web/templates/default/opac/parts/record/body.tt2 index 9de517dd0b..3444a59415 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/body.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/body.tt2 @@ -1,6 +1,5 @@ -[% record = ctx.record; - attrs = {marc_xml => ctx.marc_xml}; +[% attrs = {marc_xml => ctx.marc_xml}; PROCESS "default/opac/parts/misc_util.tt2"; PROCESS get_marc_attrs args=attrs %]
diff --git a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 index 5e81b8eb01..79eb75b5b9 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 @@ -30,38 +30,39 @@ [% l("Author") %]: [% attrs.author %] - + href="[% ctx.opac_root %]/results?qtype=author&query=[%- + attrs.author | replace('[,\.:;]', '') | uri %]&loc=[% CGI.param('loc') | uri %]">[% attrs.author %] [% END %]
- [% operation = ctx.mylist.grep(record.id).size ? "delete" : "add"; - label = (operation == "add") ? "Add to" : "Remove from"; %] + [% + operation = ctx.mylist.grep(ctx.bre_id).size ? "delete" : "add"; + label = (operation == "add") ? l("Add to my list") : l("Remove from my list"); + %]
- +
- +
-
- [% IF attrs.format %] - [% attrs.format %] + [% IF attrs.format_icon %] + [% attrs.format_label %] [% END %]
@@ -166,14 +167,14 @@ [%# For some reason, browsers render © (as in, ©_limit=foo) as the copyright symbol, even though it's inside inside the href attribute string. Use ; instead %] - « [% + « [% l('Previous [_1]', ctx.copy_offset - new_offset) %] [% END %] [% IF ctx.copies.size >= ctx.copy_limit %] - [% + [% l('Next [_1]', ctx.copy_limit) %] » @@ -220,7 +221,7 @@
- [% l('Place Hold') %][% l('Place Hold') %] [% l('Reviews and More') %]