From: Lebbeous Fogle-Weekley Date: Tue, 11 Sep 2012 02:12:39 +0000 (-0400) Subject: implement the "process immediately" switch, hitherto unhooked up X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9c6c5e406b73c16889a81ca25752aa2c2ef2e750;p=evergreen%2Fequinox.git implement the "process immediately" switch, hitherto unhooked up Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/web/js/dojo/openils/URLVerify/CreateSession.js b/Open-ILS/web/js/dojo/openils/URLVerify/CreateSession.js index cb79e82b79..e0c16193a0 100644 --- a/Open-ILS/web/js/dojo/openils/URLVerify/CreateSession.js +++ b/Open-ILS/web/js/dojo/openils/URLVerify/CreateSession.js @@ -5,6 +5,7 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { dojo.require("openils.Util"); dojo.require("openils.PermaCrud"); dojo.require("openils.widget.FilteringTreeSelect"); + dojo.require("openils.URLVerify.Verify"); dojo.requireLocalization("openils.URLVerify", "URLVerify"); @@ -87,7 +88,7 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { ); }; - /* 2) save the tag/subfield sets for URL extraction, */ + /* 2a) save the tag/subfield sets for URL extraction, */ module.save_tags = function() { module.progress_dialog.attr("title", localeStrings.SAVING_TAGS); module.progress_dialog.show(); /* sic */ @@ -95,7 +96,8 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { uvus_progress = 0; /* Note we're not using openils.PermaCrud, which is inadequate - * when you want transactions. Thanks for figuring it out, Bill. */ + * when you need one big transaction. Thanks for figuring it + * out Bill. */ var pcrud_raw = new OpenSRF.ClientSession("open-ils.pcrud"); pcrud_raw.connect(); @@ -106,9 +108,7 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { "oncomplete": function(r) { module._create_uvus_one_at_a_time( pcrud_raw, - module.tag_and_subfields.generate_uvus( - module.session_id - ) + module.tag_and_subfields.generate_uvus(module.session_id) ); } }).send(); @@ -125,7 +125,7 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { {"maximum": uvus_list.length, "progress": ++uvus_progress} ); - uvus_list.shift(); /* /now/ actually shorten the list */ + uvus_list.shift(); /* /now/ actually shorten working list */ if (uvus_list.length < 1) { pcrud_raw.request({ @@ -147,8 +147,9 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { }; /* 3) search and populate the container (API call). */ - var search_result_count = 0; module.perform_search = function() { + var search_result_count = 0; + module.progress_dialog.attr("title", localeStrings.PERFORMING_SEARCH); module.progress_dialog.show(true); @@ -180,11 +181,13 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { module.progress_dialog.show(true); if (no_url_selection.checked) { - location.href = oilsBasePath + - "/url_verify/validation_review?" + - "session_id=" + module.session_id + - "&validate=1"; + /* verify URLs and ultimately redirect to review page */ + openils.URLVerify.Verify.go( + module.session_id, null, module.progress_dialog + ); } else { + /* go to the URL selection page, allowing users to + * selectively verify URLs */ location.href = oilsBasePath + "/url_verify/select_urls?session_id=" + module.session_id; @@ -201,13 +204,10 @@ if (!dojo._hasResource["openils.URLVerify.CreateSession"]) { */ module._populate_saved_searches = function(node) { var pcrud = new openils.PermaCrud(); - var list = pcrud.retrieveAll( - "asq", {"order_by": {"asq": "label"}} - ); + var list = pcrud.retrieveAll("asq", {"order_by": {"asq": "label"}}); dojo.forEach( - list, - function(o) { + list, function(o) { dojo.create( "option", { "innerHTML": o.label(), diff --git a/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js b/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js index 1c479dad71..8c1cde961f 100644 --- a/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js +++ b/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js @@ -2,6 +2,7 @@ if (!dojo._hasResource["openils.URLVerify.SelectURLs"]) { dojo.require("dojo.string"); dojo.require("openils.CGI"); dojo.require("openils.Util"); + dojo.require("openils.URLVerify.Verify"); dojo.requireLocalization("openils.URLVerify", "URLVerify"); @@ -51,47 +52,11 @@ if (!dojo._hasResource["openils.URLVerify.SelectURLs"]) { * terms */ - module.progress_dialog.attr("title", localeStrings.VERIFICATION_DIALOG); - module.progress_dialog.show(); - - fieldmapper.standardRequest( - ["open-ils.url_verify", "open-ils.url_verify.session.verify"], { - "params": [ - openils.User.authtoken, - module.session_id, - really_everything ? null : module.grid.getSelectedIDs() - ], - "async": true, - "onresponse": function(r) { - if (r = openils.Util.readResponse(r)) { - module.progress_dialog.update({ - "maximum": r.url_count, - "progress": r.total_excluding_redirects - }); - - if (r.attempt) { - module.attempt = r.attempt; - module.progress_dialog.show( - false, - dojo.string.substitute( - localeStrings.VERIFICATION_ATTEMPT_ID, - [r.attempt.id()] - ) - ); - } - } - }, - "oncomplete": function() { - module.progress_dialog.show(true); - module.progress_dialog.attr( - "title", localeStrings.REDIRECTING - ); - location.href = oilsBasePath + - "/url_verify/review_attempt?attempt_id=" + - module.attempt.id(); - } - } - ) + openils.URLVerify.Verify.go( + module.session_id, + really_everything ? null : module.grid.getSelectedIDs(), + module.progress_dialog + ); }; }()); diff --git a/Open-ILS/web/js/dojo/openils/URLVerify/Verify.js b/Open-ILS/web/js/dojo/openils/URLVerify/Verify.js new file mode 100644 index 0000000000..1839af8569 --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/URLVerify/Verify.js @@ -0,0 +1,59 @@ +if (!dojo._hasResource["openils.URLVerify.Verify"]) { + + dojo.requireLocalization("openils.URLVerify", "URLVerify"); + + dojo._hasResource["openils.URLVerify.Verify"] = true; + dojo.provide("openils.URLVerify.Verify"); + + dojo.declare("openils.URLVerify.Verify", null, {}); + + /* Take care that we add nothing to the global namespace. + * This is not an OO module so much as a container for + * functions needed by specific interfaces. */ + +(function() { + var module = openils.URLVerify.Verify; + var localeStrings = + dojo.i18n.getLocalization("openils.URLVerify", "URLVerify"); + + module.go = function(session_id, url_id_list, progress_dialog) { + progress_dialog.attr("title", localeStrings.VERIFICATION_DIALOG); + progress_dialog.show(); + + fieldmapper.standardRequest( + ["open-ils.url_verify", "open-ils.url_verify.session.verify"], { + "params": [openils.User.authtoken, session_id, url_id_list], + "async": true, + "onresponse": function(r) { + if (r = openils.Util.readResponse(r)) { + progress_dialog.update({ + "maximum": r.url_count, + "progress": r.total_excluding_redirects + }); + + if (r.attempt) { + module.attempt = r.attempt; + progress_dialog.show( + false, + dojo.string.substitute( + localeStrings.VERIFICATION_ATTEMPT_ID, + [r.attempt.id()] + ) + ); + } + } + }, + "oncomplete": function() { + progress_dialog.show(true); + progress_dialog.attr("title", localeStrings.REDIRECTING); + location.href = oilsBasePath + + "/url_verify/review_attempt?attempt_id=" + + module.attempt.id(); + } + } + ); + }; + +}()); + +}