dojo.require("openils.Util");
dojo.require("openils.PermaCrud");
dojo.require("openils.widget.FilteringTreeSelect");
+ dojo.require("openils.URLVerify.Verify");
dojo.requireLocalization("openils.URLVerify", "URLVerify");
);
};
- /* 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 */
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();
"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();
{"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({
};
/* 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);
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;
*/
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(),
dojo.require("dojo.string");
dojo.require("openils.CGI");
dojo.require("openils.Util");
+ dojo.require("openils.URLVerify.Verify");
dojo.requireLocalization("openils.URLVerify", "URLVerify");
* 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
+ );
};
}());
--- /dev/null
+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();
+ }
+ }
+ );
+ };
+
+}());
+
+}