reporter:label="URL Verification Session"
>
<fields oils_persist:primary="id" oils_persist:sequence="url_verify.session_id_seq">
- <field reporter:label="ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Session ID" name="id" reporter:datatype="id"/>
<field reporter:label="Name" name="name" reporter:datatype="text" oils_obj:required="true"/>
<field reporter:label="Owning Library" name="owning_lib" reporter:datatype="org_unit" oils_obj:required="true"/>
<field reporter:label="Creator" name="creator" reporter:datatype="link" oils_obj:required="true"/>
reporter:label="URL Verification URL Selector"
>
<fields oils_persist:primary="id" oils_persist:sequence="url_verify.url_selector_id_seq">
- <field reporter:label="ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="URL Selector ID" name="id" reporter:datatype="id"/>
<field reporter:label="XPath" name="xpath" reporter:datatype="text" oils_obj:required="true"/>
<field reporter:label="Session" name="session" reporter:datatype="link" oils_obj:required="true"/>
<field reporter:label="URLs" name="urls" reporter:datatype="link" oils_persist:virtual="true"/>
reporter:label="URL Verification URL"
>
<fields oils_persist:primary="id" oils_persist:sequence="url_verify.url_id_seq">
- <field reporter:label="ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="URL ID" name="id" reporter:datatype="id"/>
<field reporter:label="Redirected From" name="redirect_from" reporter:datatype="link"/>
<field reporter:label="Container Item" name="item" reporter:datatype="link" oils_obj:required="true"/>
+ <field reporter:label="Session" name="session" reporter:datatype="link" oils_obj:required="true"/>
<field reporter:label="URL Selector" name="url_selector" reporter:datatype="link"/>
<field reporter:label="Tag" name="tag" reporter:datatype="text"/>
<field reporter:label="Subfield" name="subfield" reporter:datatype="text"/>
<links>
<link field="redirect_from" reltype="has_a" key="id" map="" class="uvu"/>
- <link field="item" reltype="has_a" key="id" map="" class="uvsbrem" /><!-- surprise! -->
+ <link field="item" reltype="has_a" key="id" map="" class="uvsbrem" />
+ <link field="session" reltype="has_a" key="id" map="" class="uvs"/>
<link field="url_selector" reltype="has_a" key="id" map="" class="uvus"/>
<link field="verifications" reltype="has_many" key="url" map="" class="uvuv"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
<create permission="URL_VERIFY">
- <context link="url_selector" jump="session" field="owning_lib"/>
+ <context link="session" field="owning_lib"/>
</create>
<retrieve permission="URL_VERIFY">
- <context link="url_selector" jump="session" field="owning_lib"/>
+ <context link="session" field="owning_lib"/>
</retrieve>
<update permission="URL_VERIFY">
- <context link="url_selector" jump="session" field="owning_lib"/>
+ <context link="session" field="owning_lib"/>
</update>
<delete permission="URL_VERIFY">
- <context link="url_selector" jump="session" field="owning_lib"/>
+ <context link="session" field="owning_lib"/>
</delete>
</actions>
</permacrud>
reporter:label="URL Verification Attempt"
>
<fields oils_persist:primary="id" oils_persist:sequence="url_verify.verification_attempt_id_seq">
- <field reporter:label="ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Attempt ID" name="id" reporter:datatype="id"/>
<field reporter:label="User" name="usr" reporter:datatype="link"/>
<field reporter:label="Session" name="session" reporter:datatype="link"/>
<field reporter:label="Start Time" name="start_time" reporter:datatype="timestamp"/>
reporter:label="URL Verification"
>
<fields oils_persist:primary="id" oils_persist:sequence="url_verify.url_verification_id_seq">
- <field reporter:label="ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Verification ID" name="id" reporter:datatype="id"/>
<field reporter:label="URL" name="url" reporter:datatype="link"/>
<field reporter:label="Attempt" name="attempt" reporter:datatype="link"/>
<field reporter:label="Request Time" name="req_time" reporter:datatype="timestamp"/>
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);
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,
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;
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,
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;
--- /dev/null
+[% WRAPPER base.tt2 %]
+[% ctx.page_title = "Link Checker - Review Verification Attempt" %]
+<script type="text/javascript">
+ dojo.require("dijit.form.Button");
+ dojo.require("openils.widget.FlattenerGrid");
+ dojo.require("openils.widget.ProgressDialog");
+ dojo.require("openils.Util");
+ dojo.require("openils.CGI");
+ dojo.require("openils.URLVerify.ReviewAttempt");
+
+ /* Minimize namespace pollution, but save us some typing later. */
+ var module = openils.URLVerify.ReviewAttempt;
+
+ openils.Util.addOnLoad(
+ function() {
+ module.setup(grid, progress_dialog);
+ }
+ );
+</script>
+<style type="text/css">
+ .url-verify-attempt-info { font-style: italic; }
+</style>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ <div dojoType="dijit.layout.ContentPane"
+ layoutAlign="top" class="oils-header-panel">
+ <div>[% ctx.page_title %]</div>
+ <div>
+ <!-- buttons here -->
+ </div>
+ </div>
+ <div class="oils-acq-basic-roomy">
+ <!-- any blurb to precede grid can go here -->
+ </div>
+ <table
+ jsid="grid"
+ dojoType="openils.widget.FlattenerGrid"
+ columnPersistKey='"url_verify.review_attempt"'
+ autoHeight="10"
+ editOnEnter="false"
+ autoFieldFields="['url']"
+ autoFieldFieldsUnsorted="['url']"
+ autoCoreFields="true"
+ autoCoreFieldsFilter="true"
+ autoCoreFieldsUnsorted="true"
+ fetchLock="true"
+ mapExtras="{attempt_id:{path:'attempt.id',filter:true,_label:'[% l("Attempt ID") %]'}}"
+ showLoadFilter="true"
+ fmClass="'uvuv'">
+ <thead>
+ <tr>
+ <th field="url_redirect_from" fpath="url.redirect_from"></th>
+ <th field="title" fpath="url.item.target_biblio_record_entry.simple_record.title"></th>
+ <th field="author" fpath="url.item.target_biblio_record_entry.simple_record.author"></th>
+ <th field="isbn" fpath="url.item.target_biblio_record_entry.simple_record.isbn" _visible="false"></th>
+ <th field="issn" fpath="url.item.target_biblio_record_entry.simple_record.issn" _visible="false"></th>
+ <th field="bib_id" fpath="url.item.target_biblio_record_entry.id" _visible="false"></th>
+ </tr>
+ </thead>
+ </table>
+</div>
+<div class="hidden">
+ <div dojoType="openils.widget.ProgressDialog" jsId="progress_dialog"></div>
+</div>
+[% END %]
columnPersistKey='"url_verify.select_url"'
autoHeight="10"
editOnEnter="false"
- autoFieldFields="null"
autoCoreFields="true"
autoCoreFieldsFilter="true"
autoCoreFieldsUnsorted="true"
--- /dev/null
+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;
+ };
+
+}());
+
+}
"progress": r.total_excluding_redirects
});
- if (r.attempt)
+ if (r.attempt) {
module.update_attempt_display(r.attempt);
+ module.attempt = r.attempt;
+ }
}
},
"oncomplete": function() {
"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();
}
}
)
"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}"
}
"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 */
},
"_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
}
dojo.forEach(
- fields, function(f) {
+ fields, dojo.hitch(this, function(f) {
if (f.datatype == "link" || f.virtual)
return;
"fsort": true,
"ffilter": this.autoCoreFieldsFilter
});
- }
+ })
);
},
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);
}
}
);