From cf669842fb5e7b75a6d32bfcc3f2786f68a86602 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Tue, 28 Aug 2012 14:08:28 -0400 Subject: [PATCH] Various fixes, largely UI Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/Application/URLVerify.pm | 20 ++++++----- .../src/templates/url_verify/create_session.tt2 | 3 +- .../js/dojo/openils/url_verify/nls/url_verify.js | 4 ++- .../web/js/ui/default/url_verify/create_session.js | 39 ++++++++++++++++++---- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm index 4d0c876035..ebe79ead20 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm @@ -11,6 +11,10 @@ use OpenILS::Utils::CStoreEditor q/:funcs/; use OpenILS::Application::AppUtils; use LWP::UserAgent; +use Data::Dumper; + +$Data::Dumper::Indent = 0; + my $U = 'OpenILS::Application::AppUtils'; @@ -730,7 +734,7 @@ __PACKAGE__->register_method( return => { desc => q/stream of numbers: first number of search results, then numbers of extracted URLs for each record, grouped into arrays - of 10/, + of 100/, type => "number" } } @@ -797,26 +801,24 @@ sub session_search_and_extract { $client->respond($pos); # first response: the number of items created # (number of search results) - $pos = 0; - my @url_counts; - # For each contain item, extract URLs. Report counts of URLs extracted - # from each record in batches at every ten records. + # from each record in batches at every hundred records. XXX Arbitrary. + my @url_counts; foreach my $item_id (@item_ids) { my $res = $e->json_query({ from => ["url_verify.extract_urls", $ses_id, $item_id] }) or return $e->die_event; - push @url_counts, $res->[0]{extract_urls}; + push @url_counts, $res->[0]{"url_verify.extract_urls"}; - if (++$pos % 10 == 0) { - $client->respond(\@url_counts); + if (scalar(@url_counts) % 100 == 0) { + $client->respond([ @url_counts ]); @url_counts = (); } } - $client->respond(\@url_counts) if @url_counts; + $client->respond([ @url_counts ]) if @url_counts; $e->disconnect; return; diff --git a/Open-ILS/src/templates/url_verify/create_session.tt2 b/Open-ILS/src/templates/url_verify/create_session.tt2 index 16758ddd50..0df3b4a08c 100644 --- a/Open-ILS/src/templates/url_verify/create_session.tt2 +++ b/Open-ILS/src/templates/url_verify/create_session.tt2 @@ -31,6 +31,7 @@
[% ctx.page_title %]
+
@@ -110,7 +111,7 @@ [% l("Subfield(s)") %] - [% l('Add') %] + [% l('Add') %]
diff --git a/Open-ILS/web/js/dojo/openils/url_verify/nls/url_verify.js b/Open-ILS/web/js/dojo/openils/url_verify/nls/url_verify.js index 3a3527fe76..91244ffdad 100644 --- a/Open-ILS/web/js/dojo/openils/url_verify/nls/url_verify.js +++ b/Open-ILS/web/js/dojo/openils/url_verify/nls/url_verify.js @@ -2,5 +2,7 @@ "CREATING": "Creating session ...", "SAVING_TAGS": "Saving tag/subfield selectors ...", "PERFORMING_SEARCH": "Performing search ...", - "EXTRACTING_URLS": "Extracting URLs..." + "EXTRACTING_URLS": "Extracting URLs ...", + "NEED_UVUS": "You must add some tag and subfield combinations", + "REDIRECTING": "Loading next interface ..." } diff --git a/Open-ILS/web/js/ui/default/url_verify/create_session.js b/Open-ILS/web/js/ui/default/url_verify/create_session.js index 4b1bd3efbc..867d2aa376 100644 --- a/Open-ILS/web/js/ui/default/url_verify/create_session.js +++ b/Open-ILS/web/js/ui/default/url_verify/create_session.js @@ -31,6 +31,7 @@ var create_session = {}; /* Reacting to the interface's "Begin" button, this function triggers the * first of three server-side processes necessary to create a session: + * * 1) create the session itself (API call), */ create_session.begin = function() { var name = uv_session_name.attr("value"); @@ -57,6 +58,11 @@ var create_session = {}; scope ); + if (!create_session.tag_and_subfields.any()) { + alert(localeStrings.NEED_UVUS); + return; + } + progress_dialog.attr("title", localeStrings.CREATING); progress_dialog.show(true); fieldmapper.standardRequest( @@ -148,7 +154,6 @@ var create_session = {}; r = openils.Util.readResponse(r); if (!search_result_count) { search_result_count = Number(r); - console.log("search_result_count: " + r); progress_dialog.show(); /* sic */ progress_dialog.attr( @@ -158,23 +163,32 @@ var create_session = {}; {"maximum": search_result_count, "progress": 0} ); } else { - console.log("r.length: " + r.length); progress_dialog.update({"progress": r.length}) } }, "oncomplete": function() { - progress_dialog.attr("title", ""); - progress_dialog.hide(); - console.warn("XXX TODO redirect to next interface"); + progress_dialog.attr("title", localeStrings.REDIRECTING); + progress_dialog.show(true); + + if (no_url_selection.checked) { + location.href = oilsBasePath + + "/url_verify/validation_review?" + + "session_id=" + create_session.session_id + + "&validate=1"; + } else { + location.href = oilsBasePath + + "/url_verify/select_urls?session_id=" + + create_session.session_id; + } } } ); }; /* At least in Dojo 1.3.3 (I know, I know), dijit.form.MultiSelect does - * not behave like FilteringSelect, like you might thing, and work from a + * not behave like FilteringSelect, like you might expect, or work from a * data store. So we'll use a native