From: Lebbeous Fogle-Weekley Date: Wed, 22 Jun 2011 14:50:06 +0000 (-0400) Subject: Ability to return to specific authority.control_set or X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a80f625b27a794866f7121ec4ea52f1268993c56;p=evergreen%2Fpines.git Ability to return to specific authority.control_set or to specific authority.control_set_authority_field from a child table. Other improvements heading toward finishing authority control set config UI Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm index 937aee7330..696a4468f1 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm @@ -238,7 +238,7 @@ __PACKAGE__->register_method( "params" => [ {"name" => "limit", "desc" => "limit (optional; default 15)", "type" => "number"}, {"name" => "offset", "desc" => "offset doptional; default 0)", "type" => "number"}, - {"name" => "id", "desc" => "acs id (optional; default all)", "type" => "number"} + {"name" => "focus", "desc" => "optionally make sure the acs object with ID matching this value comes at the top of the result set (only works with offset 0)", "type" => "number"} ] } ); @@ -248,19 +248,32 @@ sub retrieve_acs { my $self = shift; my $client = shift; - my ($limit, $offset, $id) = map int, @_; + my ($limit, $offset, $focus) = map int, @_; $limit ||= 15; $offset ||= 0; - $id ||= undef; + $focus ||= undef; my $e = new_editor; - my $where = {"id" => ($id ? $id : {"!=" => undef})}; + my $order_by = [ + {"class" => "acs", "field" => "name"} + ]; + + # Here is the magic that let's us say that a given acsaf + # will be our first result. + unshift @$order_by, { + "class" => "acs", "field" => "id", + "transform" => "numeric_eq", "params" => [$focus], + "direction" => "desc" + } if $focus; + my $sets = $e->search_authority_control_set([ - $where, { + {"id" => {"!=" => undef}}, { "flesh" => 1, "flesh_fields" => {"acs" => [qw/thesauri authority_fields/]}, - "order_by" => {"acs" => "name"} + "order_by" => $order_by, + "limit" => $limit, + "offset" => $offset } ]) or return $e->die_event; @@ -270,4 +283,67 @@ sub retrieve_acs { return undef; } +__PACKAGE__->register_method( + "method" => "retrieve_acsaf", + "api_name" => "open-ils.cat.authority.control_set_authority_field.retrieve", + "api_level" => 1, + "stream" => 1, + "argc" => 2, + "signature" => { + "desc" => q/Retrieve authority.control_set_authority_field objects with + fleshed bib_fields and axes/, + "params" => [ + {"name" => "limit", "desc" => "limit (optional; default 15)", "type" => "number"}, + {"name" => "offset", "desc" => "offset (optional; default 0)", "type" => "number"}, + {"name" => "control_set", "desc" => "optionally constrain by value of acsaf.control_set field", "type" => "number"}, + {"name" => "focus", "desc" => "optionally make sure the acsaf object with ID matching this value comes at the top of the result set (only works with offset 0)"} + ] + } +); + +sub retrieve_acsaf { + my $self = shift; + my $client = shift; + + my ($limit, $offset, $control_set, $focus) = map int, @_; + + $limit ||= 15; + $offset ||= 0; + $control_set ||= undef; + $focus ||= undef; + + my $e = new_editor; + my $where = { + "control_set" => ($control_set ? $control_set : {"!=" => undef}) + }; + my $order_by = [ + {"class" => "acsaf", "field" => "main_entry", "direction" => "desc"}, + {"class" => "acsaf", "field" => "id"} + ]; + + unshift @$order_by, { + "class" => "acsaf", "field" => "id", + "transform" => "numeric_eq", "params" => [$focus], + "direction" => "desc" + } if $focus; + + my $fields = $e->search_authority_control_set_authority_field([ + $where, { + "flesh" => 2, + "flesh_fields" => { + "acsaf" => ["bib_fields", "axis_maps"], + "abaafm" => ["axis"] + }, + "order_by" => $order_by, + "limit" => $limit, + "offset" => $offset + } + ]) or return $e->die_event; + + $e->disconnect; + + $client->respond($_) foreach @$fields; + return undef; +} + 1; diff --git a/Open-ILS/web/js/ui/default/cat/authority/common.js b/Open-ILS/web/js/ui/default/cat/authority/common.js new file mode 100644 index 0000000000..d8d8a37a7c --- /dev/null +++ b/Open-ILS/web/js/ui/default/cat/authority/common.js @@ -0,0 +1,11 @@ +function render_control_set_metadata(control_set) { + var anchor = dojo.byId("control-set-metadata"); + anchor.href = oilsBasePath + "/cat/authority/control_set?focus=" + + control_set.id(); + anchor.innerHTML = dojo.string.substitute( + localeStrings.CONTROL_SET_METADATA, [ + control_set.id(), control_set.name(), control_set.description() + ] + ); + openils.Util.show("control-set-metadata-holder"); +} diff --git a/Open-ILS/web/templates/default/cat/authority/control_set.tt2 b/Open-ILS/web/templates/default/cat/authority/control_set.tt2 index d763b61641..4d1e97d7ff 100644 --- a/Open-ILS/web/templates/default/cat/authority/control_set.tt2 +++ b/Open-ILS/web/templates/default/cat/authority/control_set.tt2 @@ -29,10 +29,12 @@