function Bucketz39Dialog() {
+ /**
+ * builds the Z39 sources and Z39 search indexes grid
+ */
this._build_options_grid = function(list, key, id_attr, label_attr) {
// determine the number of columns per row dynamically
});
}
+ /**
+ * Fetches needed data
+ */
this.init = function() {
var self = this;
var pcrud = new OpenSRF.ClientSession('open-ils.pcrud');
method : 'open-ils.pcrud.search.vbq.atomic',
params : [
this.authtoken,
- {owner : this.user_id},
+ {owner : this.user_id, queue_type : 'bib'},
{order_by : {vbq : 'name'}}
],
oncomplete : function(r) {
'source_selector', 'name', 'label');
}
}).send();
+
+ pcrud.request({
+ method : 'open-ils.pcrud.search.vms.atomic',
+ params : [this.authtoken, {
+ owner : this._ws_ancestors(),
+ mtype : 'biblio'
+ }],
+ oncomplete : function(r) {
+ var sets = r.recv().content();
+ dojo.forEach(sets, function(set) {
+ var attrs = {label : set.name(), value : set.id() };
+ var item = dojo.create('menuitem', attrs);
+ dojo.byId('match_set_selector').appendChild(item);
+ });
+ }
+ }).send();
+
+ }
+
+ /* my workstation org unit plus ancestors as a flat list */
+ this._ws_ancestors = function() {
+ JSAN.use('OpenILS.data');
+ var data = new OpenILS.data();
+ data.stash_retrieve();
+ var org = data.hash.aou[ this.ws_ou ]
+ var org_list = [];
+
+ while (org) {
+ org_list.push(org.id());
+ org = data.hash.aou[org.parent_ou()];
+ }
+ return org_list;
+ }
+
+ /**
+ * extracts params from UI form elements
+ */
+ this._collect_params = function() {
+
+ // request params
+ var params = [this.authtoken, this.bucket_id];
+
+ // Z39 sources
+ params.push(dojo.query('[source_selector]').filter(
+ function(cbox) { return cbox.checked }).map(
+ function(cbox) { return cbox.getAttribute('value') }));
+
+ // indexes
+ params.push(dojo.query('[index_selector]').filter(
+ function(cbox) { return cbox.checked }).map(
+ function(cbox) { return cbox.getAttribute('value') }));
+
+ // queue name / match set
+ params.push({
+ queue_name : dojo.byId('queue_selector').parentNode.value,
+ match_set : dojo.byId('match_set_selector').parentNode.value
+ });
+
+ return params;
}
this.submit = function() {
function(row) { dojo.removeClass(row, 'hideme') }
);
-
- // request params
- var params = [this.authtoken, this.bucket_id];
-
- // Z39 sources
- params.push(dojo.query('[source_selector]').filter(
- function(cbox) { return cbox.checked }).map(
- function(cbox) { return cbox.getAttribute('value') }));
-
- // indexes
- params.push(dojo.query('[index_selector]').filter(
- function(cbox) { return cbox.checked }).map(
- function(cbox) { return cbox.getAttribute('value') }));
-
- // queue name
- params.push({queue_name :
- dojo.byId('queue_selector').parentNode.value});
-
+ var params = this._collect_params();
dump('Submitting z39 search with: ' + js2JSON(params) + '\n');
var ses = new OpenSRF.ClientSession('open-ils.search');
dialog = new Bucketz39Dialog();
dialog.user_id = window.arguments[0];
dialog.authtoken = window.arguments[1];
- dialog.bucket_id = window.arguments[2];
+ dialog.ws_ou = window.arguments[2];
+ dialog.bucket_id = window.arguments[3];
dialog.init();
}