From 0d04229585d61ea9532a1ae1d0ebc08baf90bcb9 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Thu, 6 Sep 2012 16:16:16 -0400 Subject: [PATCH] started verification review UI, also SCHEMA CHANGES It just doesn't work for me to not have url_verify.url directly related to url_verify.session. When dealing with the "root" URL in a redirect chain, you can get the related session through url_selector, but not when you have any later URL in the chain. The only way for IDL perms to work would be to have a link to a view using a CTE to find the "root" URL. That's too complex, so instead of that I've just added a session fkey on url_verify.url. Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/examples/fm_IDL.xml | 22 ++++---- .../perlmods/lib/OpenILS/Application/URLVerify.pm | 1 + Open-ILS/src/sql/Pg/075.schema.url_verify.sql | 1 + Open-ILS/src/sql/Pg/076.functions.url_verify.sql | 4 +- .../src/sql/Pg/upgrade/XXXX.schema.url_verify.sql | 1 + .../sql/Pg/upgrade/YYYY.functions.url_verify.sql | 4 +- .../src/templates/url_verify/review_attempt.tt2 | 64 ++++++++++++++++++++++ Open-ILS/src/templates/url_verify/select_urls.tt2 | 1 - .../web/js/dojo/openils/URLVerify/ReviewAttempt.js | 40 ++++++++++++++ .../web/js/dojo/openils/URLVerify/SelectURLs.js | 8 ++- .../web/js/dojo/openils/URLVerify/nls/URLVerify.js | 2 +- .../web/js/dojo/openils/widget/FlattenerGrid.js | 26 ++++++--- 12 files changed, 147 insertions(+), 27 deletions(-) create mode 100644 Open-ILS/src/templates/url_verify/review_attempt.tt2 create mode 100644 Open-ILS/web/js/dojo/openils/URLVerify/ReviewAttempt.js diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 65b2939431..3405dde65c 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -9338,7 +9338,7 @@ SELECT usr, reporter:label="URL Verification Session" > - + @@ -9404,7 +9404,7 @@ SELECT usr, reporter:label="URL Verification URL Selector" > - + @@ -9442,9 +9442,10 @@ SELECT usr, reporter:label="URL Verification URL" > - + + @@ -9463,7 +9464,8 @@ SELECT usr, - + + @@ -9471,16 +9473,16 @@ SELECT usr, - + - + - + - + @@ -9495,7 +9497,7 @@ SELECT usr, reporter:label="URL Verification Attempt" > - + @@ -9534,7 +9536,7 @@ SELECT usr, reporter:label="URL Verification" > - + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm index 0e49a006bd..4b4e3ba32a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/URLVerify.pm @@ -589,6 +589,7 @@ sub verify_one_url { if (my $loc = $res->headers->{location}) { $redir_url = Fieldmapper::url_verify::url->new; + $redir_url->session($attempt->session); $redir_url->redirect_from($url->id); $redir_url->full_url($loc); diff --git a/Open-ILS/src/sql/Pg/075.schema.url_verify.sql b/Open-ILS/src/sql/Pg/075.schema.url_verify.sql index db42861d4a..653d028082 100644 --- a/Open-ILS/src/sql/Pg/075.schema.url_verify.sql +++ b/Open-ILS/src/sql/Pg/075.schema.url_verify.sql @@ -42,6 +42,7 @@ CREATE TABLE url_verify.url ( id SERIAL PRIMARY KEY, redirect_from INT REFERENCES url_verify.url(id) DEFERRABLE INITIALLY DEFERRED, item INT REFERENCES container.biblio_record_entry_bucket_item (id) DEFERRABLE INITIALLY DEFERRED, + session INT REFERENCES url_verify.session (id) DEFERRABLE INITIALLY DEFERRED, url_selector INT REFERENCES url_verify.url_selector (id) DEFERRABLE INITIALLY DEFERRED, tag TEXT, subfield TEXT, diff --git a/Open-ILS/src/sql/Pg/076.functions.url_verify.sql b/Open-ILS/src/sql/Pg/076.functions.url_verify.sql index a49e5fc2ba..5443d51930 100644 --- a/Open-ILS/src/sql/Pg/076.functions.url_verify.sql +++ b/Open-ILS/src/sql/Pg/076.functions.url_verify.sql @@ -91,8 +91,8 @@ BEGIN JOIN container.biblio_record_entry_bucket_item c ON (c.target_biblio_record_entry = b.id) WHERE c.id = item_id; - INSERT INTO url_verify.url (item, url_selector, tag, subfield, ord, full_url) - VALUES ( item_id, current_selector.id, current_tag, current_sf, current_ord, current_url); + INSERT INTO url_verify.url (session, item, url_selector, tag, subfield, ord, full_url) + VALUES ( session_id, item_id, current_selector.id, current_tag, current_sf, current_ord, current_url); current_url_pos := current_url_pos + 1; current_ord := current_ord + 1; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.url_verify.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.url_verify.sql index 82da8ee24c..42e544431a 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.url_verify.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.url_verify.sql @@ -29,6 +29,7 @@ CREATE TABLE url_verify.url ( redirect_from INT REFERENCES url_verify.url(id) DEFERRABLE INITIALLY DEFERRED, item INT REFERENCES container.biblio_record_entry_bucket_item (id) DEFERRABLE INITIALLY DEFERRED, url_selector INT REFERENCES url_verify.url_selector (id) DEFERRABLE INITIALLY DEFERRED, + session INT REFERENCES url_verify.session (id) DEFERRABLE INITIALLY DEFERRED, tag TEXT, subfield TEXT, ord INT, diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.functions.url_verify.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.functions.url_verify.sql index f8a5bad0ab..bed0ae3db2 100644 --- a/Open-ILS/src/sql/Pg/upgrade/YYYY.functions.url_verify.sql +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.functions.url_verify.sql @@ -75,8 +75,8 @@ BEGIN JOIN container.biblio_record_entry_bucket_item c ON (c.target_biblio_record_entry = b.id) WHERE c.id = item_id; - INSERT INTO url_verify.url (item, url_selector, tag, subfield, ord, full_url) - VALUES ( item_id, current_selector.id, current_tag, current_sf, current_ord, current_url); + INSERT INTO url_verify.url (session, item, url_selector, tag, subfield, ord, full_url) + VALUES ( session_id, item_id, current_selector.id, current_tag, current_sf, current_ord, current_url); current_url_pos := current_url_pos + 1; current_ord := current_ord + 1; diff --git a/Open-ILS/src/templates/url_verify/review_attempt.tt2 b/Open-ILS/src/templates/url_verify/review_attempt.tt2 new file mode 100644 index 0000000000..093d63cbcc --- /dev/null +++ b/Open-ILS/src/templates/url_verify/review_attempt.tt2 @@ -0,0 +1,64 @@ +[% WRAPPER base.tt2 %] +[% ctx.page_title = "Link Checker - Review Verification Attempt" %] + + +
+
+
[% ctx.page_title %]
+
+ +
+
+
+ +
+ + + + + + + + + + + +
+
+ +[% END %] diff --git a/Open-ILS/src/templates/url_verify/select_urls.tt2 b/Open-ILS/src/templates/url_verify/select_urls.tt2 index 525bd45d57..c8d94ffdde 100644 --- a/Open-ILS/src/templates/url_verify/select_urls.tt2 +++ b/Open-ILS/src/templates/url_verify/select_urls.tt2 @@ -42,7 +42,6 @@ columnPersistKey='"url_verify.select_url"' autoHeight="10" editOnEnter="false" - autoFieldFields="null" autoCoreFields="true" autoCoreFieldsFilter="true" autoCoreFieldsUnsorted="true" diff --git a/Open-ILS/web/js/dojo/openils/URLVerify/ReviewAttempt.js b/Open-ILS/web/js/dojo/openils/URLVerify/ReviewAttempt.js new file mode 100644 index 0000000000..ac5d30bb35 --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/URLVerify/ReviewAttempt.js @@ -0,0 +1,40 @@ +if (!dojo._hasResource["openils.URLVerify.ReviewAttempt"]) { + dojo.require("dojo.string"); + dojo.require("openils.CGI"); + dojo.require("openils.Util"); + + dojo.requireLocalization("openils.URLVerify", "URLVerify"); + + dojo._hasResource["openils.URLVerify.ReviewAttempt"] = true; + dojo.provide("openils.URLVerify.ReviewAttempt"); + + dojo.declare("openils.URLVerify.ReviewAttempt", 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 a specific interface. */ + +(function() { + var module = openils.URLVerify.ReviewAttempt; + var localeStrings = + dojo.i18n.getLocalization("openils.URLVerify", "URLVerify"); + + module.setup = function(grid, progress_dialog) { + var cgi = new openils.CGI(); + module.attempt_id = cgi.param("attempt_id"); + + module.grid = grid; + + module.grid.setBaseQuery({"attempt_id": module.attempt_id}); + + module.grid.refresh(); + // Alternative to grid.refresh() once filter is set up + //module.grid.fetchLock = false; + //module.grid.filterUi.doApply(); + + module.progress_dialog = progress_dialog; + }; + +}()); + +} diff --git a/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js b/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js index b4c6de1e38..bd7b7337b3 100644 --- a/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js +++ b/Open-ILS/web/js/dojo/openils/URLVerify/SelectURLs.js @@ -65,8 +65,10 @@ if (!dojo._hasResource["openils.URLVerify.SelectURLs"]) { "progress": r.total_excluding_redirects }); - if (r.attempt) + if (r.attempt) { module.update_attempt_display(r.attempt); + module.attempt = r.attempt; + } } }, "oncomplete": function() { @@ -74,7 +76,9 @@ if (!dojo._hasResource["openils.URLVerify.SelectURLs"]) { "title", localeStrings.REDIRECTING ); module.progress_dialog.show(true); - console.error("would redirect here XXX TODO"); // XXX TODO + location.href = oilsBasePath + + "/url_verify/review_attempt?attempt_id=" + + module.attempt.id(); } } ) diff --git a/Open-ILS/web/js/dojo/openils/URLVerify/nls/URLVerify.js b/Open-ILS/web/js/dojo/openils/URLVerify/nls/URLVerify.js index 900f125fec..2db8ca8cf4 100644 --- a/Open-ILS/web/js/dojo/openils/URLVerify/nls/URLVerify.js +++ b/Open-ILS/web/js/dojo/openils/URLVerify/nls/URLVerify.js @@ -8,7 +8,7 @@ "INTERFACE_SETUP": "Setting up interface ...", "VERIFY_ALL": "Click 'OK' to verify ALL the URLs found in this session. Click 'Cancel' if the selected, visible URLs are the only ones you want verified.", "VERIFICATION_DIALOG": "Verifying URLs ...", - "VERIFICATION_ATTEMPT_ID": "Last verification attempt ID: ${0}", + "VERIFICATION_ATTEMPT_ID": "Verification attempt ID: ${0}", "VERIFICATION_ATTEMPT_START": "Attempt start time: ${0}", "VERIFICATION_ATTEMPT_FINISH": "Attempt finish time: ${0}" } diff --git a/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js b/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js index 1bb4a92de8..7adeb65214 100644 --- a/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js @@ -20,6 +20,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { "autoCoreFieldsUnsorted": false, "autoCoreFieldsFilter": false, "autoFieldFields": null, + "autoFieldFieldsUnsorted": null, /* array, subset of autoFieldFields */ "showLoadFilter": false, /* use FlattenerFilter(Dialog|Pane) */ "filterAlwaysInDiv": null, /* use FlattenerFilterPane and put its content in this HTML element */ @@ -284,15 +285,22 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { }, "_getAutoFieldFields": function(fmclass) { - return dojo.clone( + var field_list = dojo.clone( fieldmapper.IDL.fmclasses[fmclass].fields) .filter( - function(field) { - return !field.virtual && field.datatype != "link"; - } - ).sort( - function(a, b) { return a.label > b.label ? 1 : -1; } + function(f) { return !f.virtual && f.datatype != "link"; } ); + + /* Sort fields unless the class is named in grid property + * 'autoFieldFieldsUnsorted' (array). */ + if (!dojo.isArray(this.autoFieldFieldsUnsorted) || + !this.autoFieldFieldsUnsorted[fmclass]) { + field_list = field_list.sort( + function(a, b) { return a.label > b.label ? 1 : -1; } + ); + } + + return field_list; }, /* Take our core class (this.fmClass) and add table columns for @@ -311,7 +319,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { } dojo.forEach( - fields, function(f) { + fields, dojo.hitch(this, function(f) { if (f.datatype == "link" || f.virtual) return; @@ -329,7 +337,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { "fsort": true, "ffilter": this.autoCoreFieldsFilter }); - } + }) ); }, @@ -922,7 +930,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) { that always gets mixed in with whatever you do in the filter dialog */ - this._baseQuery = dojo.clone(this.attr("query", query)); + this._baseQuery = dojo.clone(this.query = query); } } ); -- 2.11.0