[open-ils-commits] r8258 - in
trunk/Open-ILS/xul/staff_client/server: cat circ
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 20 17:47:13 EST 2007
Author: phasefx
Date: 2007-12-20 17:25:25 -0500 (Thu, 20 Dec 2007)
New Revision: 8258
Modified:
trunk/Open-ILS/xul/staff_client/server/cat/z3950.js
trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul
trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
multi-z-source functionality for staff client z39.50 client
Modified: trunk/Open-ILS/xul/staff_client/server/cat/z3950.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/z3950.js 2007-12-20 21:59:31 UTC (rev 8257)
+++ trunk/Open-ILS/xul/staff_client/server/cat/z3950.js 2007-12-20 22:25:25 UTC (rev 8258)
@@ -13,12 +13,14 @@
cat.z3950.prototype = {
- 'creds_version' : 1,
+ 'creds_version' : 2,
'number_of_result_sets' : 0,
'result_set' : [],
+ 'limit' : 10,
+
'init' : function( params ) {
try {
@@ -27,6 +29,8 @@
var obj = this;
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+
obj.load_creds();
JSAN.use('circ.util');
@@ -39,8 +43,9 @@
'edition' : { 'hidden' : false },
'pubdate' : { 'hidden' : false },
'publisher' : { 'hidden' : false },
+ 'service' : { 'hidden' : false }
}
- );
+ );
JSAN.use('util.list'); obj.list = new util.list('results');
obj.list.init(
@@ -137,7 +142,10 @@
var retrieve_id = obj.controller.view.marc_import.getAttribute('retrieve_id');
var result_idx = retrieve_id.split('-')[0];
var record_idx = retrieve_id.split('-')[1];
- obj.spawn_marc_editor( obj.result_set[ result_idx ].records[ record_idx ].marcxml);
+ obj.spawn_marc_editor(
+ obj.result_set[ result_idx ].records[ record_idx ].marcxml,
+ obj.result_set[ result_idx ].records[ record_idx ].service /* FIXME: we want biblio_source here */
+ );
} catch(E) {
obj.error.standard_unexpected_error_alert('Failure during marc import.',E);
}
@@ -150,7 +158,10 @@
var retrieve_id = obj.controller.view.marc_import_overlay.getAttribute('retrieve_id');
var result_idx = retrieve_id.split('-')[0];
var record_idx = retrieve_id.split('-')[1];
- obj.spawn_marc_editor_for_overlay( obj.result_set[ result_idx ].records[ record_idx ].marcxml);
+ obj.spawn_marc_editor_for_overlay(
+ obj.result_set[ result_idx ].records[ record_idx ].marcxml,
+ obj.result_set[ result_idx ].records[ record_idx ].service /* FIXME: we want biblio_source here */
+ );
} catch(E) {
obj.error.standard_unexpected_error_alert('Failure during marc import overlay.',E);
}
@@ -168,66 +179,89 @@
obj.page_next();
},
],
- 'raw_search' : [
- ['command'],
- function() {
- var raw = window.prompt('WARNING: This is not a simple keyword search. Enter raw z39.50 PQN search string: ','','Raw Z39.50 PQN Search');
- if (raw) obj.initial_raw_search(raw);
- },
- ],
- 'menu_placeholder' : [
+ 'service_rows' : [
['render'],
function(e) {
return function() {
try {
function handle_switch(node) {
- var service = obj.controller.view.service_menu.value;
- obj.current_service = service;
- var nl = document.getElementsByAttribute('mytype','search_class');
- for (var i = 0; i < nl.length; i++) { nl[i].disabled = true; }
- for (var i in obj.services[service].attrs) {
- var x = document.getElementById(i + '_input');
- if (x) {
- x.disabled = false;
- } else {
- var rows = document.getElementById('query_inputs');
- var row = document.createElement('row'); rows.appendChild(row);
- var label = document.createElement('label');
- label.setAttribute('control',i+'_input');
- label.setAttribute('search_class',i);
- label.setAttribute('style','-moz-user-focus: ignore');
- if (entities['staff.z39_50.search_class.'+i]) {
- label.setAttribute('value',entities['staff.z39_50.search_class.'+i]);
- } else {
- label.setAttribute('value',i);
- }
- row.appendChild(label);
- label.addEventListener('click',function(ev){
- var a = ev.target.getAttribute('search_class');
- if (a) obj.default_attr = a;
- },false
- );
- var tb = document.createElement('textbox');
- tb.setAttribute('id',i+'_input');
- tb.setAttribute('mytype','search_class');
- tb.setAttribute('search_class',i);
- row.appendChild(tb);
- tb.addEventListener('keypress',obj.handle_enter,false);
- }
- }
- if (obj.creds.services[ service ]) {
- document.getElementById('username').setAttribute('value',
- obj.creds.services[service].username
- );
- document.getElementById('password').setAttribute('value',
- obj.creds.services[service].password
- );
- try { g.service = service; } catch(E) {}
- obj.focus(service);
- } else {
- document.getElementById('username').focus();
- }
+ try {
+ obj.active_services = [];
+ var snl = document.getElementsByAttribute('mytype','service_class');
+ for (var i = 0; i < snl.length; i++) {
+ var n = snl[i];
+ if (n.nodeName == 'checkbox') {
+ if (n.checked) obj.active_services.push( n.getAttribute('service') );
+ }
+ }
+ var nl = document.getElementsByAttribute('mytype','search_class');
+ for (var i = 0; i < nl.length; i++) { nl[i].disabled = true; }
+ var attrs = {};
+ for (var j = 0; j < obj.active_services.length; j++) {
+ for (var i in obj.services[obj.active_services[j]].attrs) {
+ var attr = obj.services[obj.active_services[j]].attrs[i];
+ if (! attrs[i]) {
+ attrs[i] = { 'labels' : {} };
+ }
+ if (attr.label) {
+ attrs[i].labels[ attr.label ] = true;
+ } else if (entities['staff.z39_50.search_class.'+i]) {
+ attrs[i].labels[ entities['staff.z39_50.search_class.'+i] ] = true;
+ } else if (attr.name) {
+ attrs[i].labels[ attr.name ] = true;
+ } else {
+ attrs[i].labels[ i ] = true;
+ }
+
+ }
+
+ }
+
+ function set_label(x,attr) {
+ var labels = [];
+ for (var j in attrs[attr].labels) {
+ labels.push(j);
+ }
+ if (labels.length > 0) {
+ x.setAttribute('value',labels[0]);
+ x.setAttribute('tooltiptext',labels.join(','));
+ if (labels.length > 1) x.setAttribute('class','multiple_labels');
+ }
+ }
+
+ for (var i in attrs) {
+ var x = document.getElementById(i + '_input');
+ if (x) {
+ x.disabled = false;
+ var y = document.getElementById(i + '_label',i);
+ if (y) set_label(y,i);
+ } else {
+ var rows = document.getElementById('query_inputs');
+ var row = document.createElement('row'); rows.appendChild(row);
+ var label = document.createElement('label');
+ label.setAttribute('id',i+'_label');
+ label.setAttribute('control',i+'_input');
+ label.setAttribute('search_class',i);
+ label.setAttribute('style','-moz-user-focus: ignore');
+ row.appendChild(label);
+ set_label(label,i);
+ label.addEventListener('click',function(ev){
+ var a = ev.target.getAttribute('search_class');
+ if (a) obj.default_attr = a;
+ },false
+ );
+ var tb = document.createElement('textbox');
+ tb.setAttribute('id',i+'_input');
+ tb.setAttribute('mytype','search_class');
+ tb.setAttribute('search_class',i);
+ row.appendChild(tb);
+ tb.addEventListener('keypress',function(ev) { dump('foo\n'); return obj.handle_enter(ev); },false);
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error setting up search fields.',E);
+ }
}
var robj = obj.network.simple_request(
@@ -236,29 +270,40 @@
);
if (typeof robj.ilsevent != 'undefined') throw(robj);
obj.services = robj;
- var list = [];
+ var x = document.getElementById('service_rows');
for (var i in robj) {
- list.push(
- [
- i + ' : ' + robj[i].db + '@' + robj[i].host + ':' + robj[i].port,
- i
- ]
- );
- }
- util.widgets.remove_children(e);
- var ml = util.widgets.make_menulist( list );
- ml.setAttribute('flex','1');
- e.appendChild(ml);
- ml.addEventListener(
- 'command',
- function(ev) { handle_switch(ev.target); },
- false
- );
- obj.controller.view.service_menu = ml;
- setTimeout(
+ var r = document.createElement('row'); x.appendChild(r);
+ var cb = document.createElement('checkbox');
+ if (robj[i].label) {
+ cb.setAttribute('label',robj[i].label);
+ } else if (robj[i].name) {
+ cb.setAttribute('label',robj[i].name);
+ } else {
+ cb.setAttribute('label',i);
+ }
+ cb.setAttribute('tooltiptext',i + ' : ' + robj[i].db + '@' + robj[i].host + ':' + robj[i].port);
+ cb.setAttribute('mytype','service_class'); cb.setAttribute('service',i);
+ cb.setAttribute('id',i+'_service'); r.appendChild(cb);
+ cb.addEventListener('command',handle_switch,false);
+ var username = document.createElement('textbox'); username.setAttribute('id',i+'_username');
+ if (obj.creds.hosts[ obj.data.server_unadorned ] && obj.creds.hosts[ obj.data.server_unadorned ].services[i]) username.setAttribute('value',obj.creds.hosts[ obj.data.server_unadorned ].services[i].username);
+ r.appendChild(username);
+ var password = document.createElement('textbox'); password.setAttribute('id',i+'_password');
+ if (obj.creds.hosts[ obj.data.server_unadorned ] && obj.creds.hosts[ obj.data.server_unadorned ].services[i]) password.setAttribute('value',obj.creds.hosts[ obj.data.server_unadorned ].services[i].password);
+ password.setAttribute('type','password'); r.appendChild(password);
+ }
+ setTimeout(
function() {
- if (obj.creds.default_service) ml.value = obj.creds.default_service;
- handle_switch(ml);
+ if (obj.creds.hosts[ obj.data.server_unadorned ]) {
+ for (var i = 0; i < obj.creds.hosts[ obj.data.server_unadorned ].default_services.length; i++) {
+ var x = document.getElementById(obj.creds.hosts[ obj.data.server_unadorned ].default_services[i]+'_service');
+ if (x) x.checked = true;
+ }
+ } else if (obj.creds.default_service) {
+ var x = document.getElementById(obj.creds.default_service+'_service');
+ if (x) x.checked = true;
+ }
+ handle_switch();
},0
);
} catch(E) {
@@ -273,31 +318,32 @@
obj.controller.render();
- obj.controller.view.username = document.getElementById('username');
- obj.controller.view.password = document.getElementById('password');
+ setTimeout( function() { obj.focus(); }, 0 );
} catch(E) {
this.error.sdump('D_ERROR','cat.z3950.init: ' + E + '\n');
}
},
- 'focus' : function(service) {
+ 'focus' : function() {
var obj = this;
- var x = obj.creds.services[service].default_attr;
- if (x) {
- var xx = document.getElementById(x+'_input'); if (xx) xx.focus();
- } else {
- var y;
- for (var i in obj.services[service].attr) { y = i; }
- var xx = document.getElementById(y+'_input'); if (xx) xx.focus();
- }
+ var focus_me; var or_focus_me;
+ for (var i = 0; i < obj.active_services.length; i++) {
+ if (obj.creds.hosts[ obj.data.server_unadorned ] && obj.creds.hosts[ obj.data.server_unadorned ].services[ obj.active_services[i] ]) {
+ var x = obj.creds.hosts[ obj.data.server_unadorned ].services[ obj.active_services[i] ].default_attr;
+ if (x) { focus_me = x; break; }
+ }
+ for (var i in obj.services[ obj.active_services[i] ].attr) { or_focus_me = i; }
+ }
+ if (! focus_me) focus_me = or_focus_me;
+ var xx = document.getElementById(focus_me+'_input'); if (xx) xx.focus();
},
'clear' : function() {
var obj = this;
var nl = document.getElementsByAttribute('mytype','search_class');
for (var i = 0; i < nl.length; i++) { nl[i].value = ''; nl[i].setAttribute('value',''); }
- obj.focus(obj.controller.view.service_menu.value);
+ //obj.focus(obj.controller.view.service_menu.value);
},
'search_params' : {},
@@ -309,14 +355,23 @@
JSAN.use('util.widgets');
util.widgets.remove_children( obj.controller.view.result_message );
var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ if (obj.active_services.length < 1) {
+ x.appendChild( document.createTextNode( 'No services selected to search.' ));
+ return;
+ }
x.appendChild( document.createTextNode( 'Searching...' ));
obj.search_params = {}; obj.list.clear();
obj.controller.view.page_next.disabled = true;
- obj.search_params.service = obj.controller.view.service_menu.value;
- obj.search_params.username = obj.controller.view.username.value;
- obj.search_params.password = obj.controller.view.password.value;
- obj.search_params.limit = 10;
+ obj.search_params.service = [];
+ obj.search_params.username = [];
+ obj.search_params.password = [];
+ for (var i = 0; i < obj.active_services.length; i++) {
+ obj.search_params.service.push( obj.active_services[i] );
+ obj.search_params.username.push( document.getElementById( obj.active_services[i]+'_username' ).value );
+ obj.search_params.password.push( document.getElementById( obj.active_services[i]+'_password' ).value );
+ }
+ obj.search_params.limit = Math.ceil( obj.limit / obj.active_services.length );
obj.search_params.offset = 0;
obj.search_params.search = {};
@@ -338,31 +393,6 @@
}
},
- 'initial_raw_search' : function(raw) {
- try {
- var obj = this;
- obj.result_set = []; obj.number_of_result_sets = 0;
- JSAN.use('util.widgets');
- util.widgets.remove_children( obj.controller.view.result_message );
- var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild( document.createTextNode( 'Searching...' ) );
- obj.search_params = {}; obj.result_count = 0; obj.list.clear();
- obj.controller.view.page_next.disabled = true;
-
- obj.search_params.service = obj.controller.view.service_menu.value;
- obj.search_params.username = obj.controller.view.username.value;
- obj.search_params.password = obj.controller.view.password.value;
- obj.search_params.limit = 10;
- obj.search_params.offset = 0;
-
- obj.search_params.query = raw;
-
- obj.search();
- } catch(E) {
- this.error.standard_unexpected_error_alert('Failure during initial raw search.',E);
- }
- },
-
'page_next' : function() {
try {
var obj = this;
@@ -414,50 +444,55 @@
x.appendChild( document.createTextNode( 'Server Error: ' + results.textcode + ' : ' + results.desc ));
return;
}
- if (results.query) {
- x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild( document.createTextNode( 'Raw query: ' + results.query ));
- }
- if (results.count) {
- if (results.records) {
- x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild(
- document.createTextNode( 'Showing ' + (obj.search_params.offset + results.records.length) + ' of ' + results.count)
- );
- }
- if (obj.search_params.offset + obj.search_params.limit <= results.count) {
- obj.controller.view.page_next.disabled = false;
- }
- } else {
- x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild(
- document.createTextNode( results.count + ' records found')
- );
- }
- if (results.records) {
- obj.result_set[ ++obj.number_of_result_sets ] = results;
- obj.controller.view.marc_import.disabled = true;
- obj.controller.view.marc_import_overlay.disabled = true;
- var x = obj.controller.view.marc_view;
- if (x.getAttribute('toggle') == '0') x.disabled = true;
- for (var i = 0; i < obj.result_set[ obj.number_of_result_sets ].records.length; i++) {
- obj.list.append(
- {
- 'retrieve_id' : String( obj.number_of_result_sets ) + '-' + String( i ),
- 'row' : {
- 'my' : {
- 'mvr' : function(a){return a;}(obj.result_set[ obj.number_of_result_sets ].records[i].mvr),
- }
- }
- }
- );
- }
- } else {
- x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild(
- document.createTextNode( 'Error retrieving results.')
- );
- }
+ if (typeof results.length == 'undefined') results = [ results ];
+ for (var i = 0; i < results.length; i++) {
+ if (results[i].query) {
+ x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ x.appendChild( document.createTextNode( 'Raw query: ' + results[i].query ));
+ }
+ if (results[i].count) {
+ if (results[i].records) {
+ x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ var showing = obj.search_params.offset + results[i].records.length;
+ x.appendChild(
+ document.createTextNode( 'Showing ' + (showing > results[i].count ? results[i].count : showing) + ' of ' + results[i].count + ' for ' + results[i].service )
+ );
+ }
+ if (obj.search_params.offset + obj.search_params.limit <= results[i].count) {
+ obj.controller.view.page_next.disabled = false;
+ }
+ } else {
+ x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ x.appendChild(
+ document.createTextNode( results[i].count + ' records found')
+ );
+ }
+ if (results[i].records) {
+ obj.result_set[ ++obj.number_of_result_sets ] = results[i];
+ obj.controller.view.marc_import.disabled = true;
+ obj.controller.view.marc_import_overlay.disabled = true;
+ var x = obj.controller.view.marc_view;
+ if (x.getAttribute('toggle') == '0') x.disabled = true;
+ for (var j = 0; j < obj.result_set[ obj.number_of_result_sets ].records.length; j++) {
+ obj.list.append(
+ {
+ 'retrieve_id' : String( obj.number_of_result_sets ) + '-' + String( j ),
+ 'row' : {
+ 'my' : {
+ 'mvr' : function(a){return a;}(obj.result_set[ obj.number_of_result_sets ].records[j].mvr),
+ 'service' : results[i].service
+ }
+ }
+ }
+ );
+ }
+ } else {
+ x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ x.appendChild(
+ document.createTextNode( 'Error retrieving results.')
+ );
+ }
+ }
} catch(E) {
this.error.standard_unexpected_error_alert('Failure during search result handling.',E);
}
@@ -477,7 +512,7 @@
);
},
- 'spawn_marc_editor' : function(my_marcxml) {
+ 'spawn_marc_editor' : function(my_marcxml,biblio_source) {
var obj = this;
xulG.new_tab(
xulG.url_prefix(urls.XUL_MARC_EDIT),
@@ -488,7 +523,7 @@
'label' : 'Import Record',
'func' : function (new_marcxml) {
try {
- var r = obj.network.simple_request('MARC_XML_RECORD_IMPORT', [ ses(), new_marcxml, obj.current_service ]);
+ var r = obj.network.simple_request('MARC_XML_RECORD_IMPORT', [ ses(), new_marcxml, biblio_source ]);
if (typeof r.ilsevent != 'undefined') {
switch(r.ilsevent) {
case 1704 /* TCN_EXISTS */ :
@@ -497,12 +532,12 @@
var btn1 = 'Overlay';
var btn2 = typeof r.payload.new_tcn == 'undefined' ? null : 'Import with alternate TCN ' + r.payload.new_tcn;
if (btn2) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ obj.data.init({'via':'stash'});
var robj = obj.network.simple_request(
'PERM_CHECK',[
ses(),
- data.list.au[0].id(),
- data.list.au[0].ws_ou(),
+ obj.data.list.au[0].id(),
+ obj.data.list.au[0].ws_ou(),
[ 'ALLOW_ALT_TCN' ]
]
);
@@ -516,7 +551,7 @@
obj.error.sdump('D_ERROR','option ' + p + 'chosen');
switch(p) {
case 0:
- var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), r.payload.dup_record, new_marcxml, obj.current_service ]);
+ var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), r.payload.dup_record, new_marcxml, biblio_source ]);
if (typeof r3.ilsevent != 'undefined') {
throw(r3);
} else {
@@ -528,7 +563,7 @@
var r2 = obj.network.request(
api.MARC_XML_RECORD_IMPORT.app,
api.MARC_XML_RECORD_IMPORT.method + '.override',
- [ ses(), new_marcxml, obj.current_service ]
+ [ ses(), new_marcxml, biblio_source ]
);
if (typeof r2.ilsevent != 'undefined') {
throw(r2);
@@ -595,10 +630,10 @@
return true;
},
- 'spawn_marc_editor_for_overlay' : function(my_marcxml) {
+ 'spawn_marc_editor_for_overlay' : function(my_marcxml,biblio_source) {
var obj = this;
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- if (!data.marked_record) {
+ obj.data.init({'via':'stash'});
+ if (!obj.data.marked_record) {
alert('Please mark a record for overlay from within the catalog and try this again.');
return;
}
@@ -612,8 +647,8 @@
'label' : 'Overlay Record',
'func' : function (new_marcxml) {
try {
- if (! obj.confirm_overlay( [ data.marked_record ] ) ) { return; }
- var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', [ ses(), data.marked_record, new_marcxml, obj.current_service ]);
+ if (! obj.confirm_overlay( [ obj.data.marked_record ] ) ) { return; }
+ var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]);
if (typeof r.ilsevent != 'undefined') {
switch(r.ilsevent) {
case 1704 /* TCN_EXISTS */ :
@@ -624,8 +659,8 @@
var robj = obj.network.simple_request(
'PERM_CHECK',[
ses(),
- data.list.au[0].id(),
- data.list.au[0].ws_ou(),
+ obj.data.list.au[0].id(),
+ obj.data.list.au[0].ws_ou(),
[ 'ALLOW_ALT_TCN' ]
]
);
@@ -642,7 +677,7 @@
var r2 = obj.network.request(
api.MARC_XML_RECORD_REPLACE.app,
api.MARC_XML_RECORD_REPLACE.method + '.override',
- [ ses(), data.marked_record, new_marcxml, obj.current_service ]
+ [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]
);
if (typeof r2.ilsevent != 'undefined') {
throw(r2);
@@ -678,7 +713,7 @@
'load_creds' : function() {
var obj = this;
try {
- obj.creds = { 'version' : g.save_version, 'services' : {} };
+ obj.creds = { 'version' : g.save_version, 'services' : {}, 'hosts' : {} };
/*
{
'version' : xx,
@@ -697,6 +732,26 @@
'default_attr' : xx,
},
},
+ // new in version 2
+ 'hosts' : {
+ 'xxxx' : {
+ 'default_services' : [ xx, ... ],
+ 'services' : {
+
+ 'xx' : {
+ 'username' : xx,
+ 'password' : xx,
+ 'default_attr' : xx,
+ },
+
+ 'xx' : {
+ 'username' : xx,
+ 'password' : xx,
+ 'default_attr' : xx,
+ },
+ },
+ }
+ }
}
*/
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
@@ -704,7 +759,8 @@
if (file._file.exists()) {
var creds = file.get_object(); file.close();
if (typeof creds.version != 'undefined') {
- if (creds.version >= obj.creds_version) {
+ if (creds.version >= obj.creds_version) { /* so apparently, this guy is assuming that future versions will be backwards compatible */
+ if (typeof creds.hosts == 'undefined') creds.hosts = {};
obj.creds = creds;
}
}
@@ -717,15 +773,20 @@
'save_creds' : function () {
try {
var obj = this;
- obj.creds.default_service = obj.controller.view.service_menu.value;
- if (typeof obj.creds.services[ obj.creds.default_service ] == 'undefined') {
- obj.creds.services[ obj.creds.default_service ] = {}
- }
- obj.creds.services[obj.creds.default_service].username = document.getElementById('username').value;
- obj.creds.services[obj.creds.default_service].password = document.getElementById('password').value;
- if (obj.default_attr) {
- obj.creds.services[obj.creds.default_service].default_attr = obj.default_attr;
- }
+ if (typeof obj.creds.hosts == 'undefined') obj.creds.hosts = {};
+ if (typeof obj.creds.hosts[ obj.data.server_unadorned ] == 'undefined') obj.creds.hosts[ obj.data.server_unadorned ] = { 'services' : {} };
+ obj.creds.hosts[ obj.data.server_unadorned ].default_services = obj.active_services;
+ for (var i = 0; i < obj.creds.hosts[ obj.data.server_unadorned ].default_services.length; i++) {
+ var service = obj.creds.hosts[ obj.data.server_unadorned ].default_services[i];
+ if (typeof obj.creds.hosts[ obj.data.server_unadorned ].services[ service ] == 'undefined') {
+ obj.creds.hosts[ obj.data.server_unadorned ].services[ service ] = {}
+ }
+ obj.creds.hosts[ obj.data.server_unadorned ].services[service].username = document.getElementById(service + '_username').value;
+ obj.creds.hosts[ obj.data.server_unadorned ].services[service].password = document.getElementById(service + '_password').value;
+ if (obj.default_attr) {
+ obj.creds.hosts[ obj.data.server_unadorned ].services[service].default_attr = obj.default_attr;
+ }
+ }
obj.creds.version = obj.creds_version;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
JSAN.use('util.file'); var file = new util.file('z3950_store');
Modified: trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul 2007-12-20 21:59:31 UTC (rev 8257)
+++ trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul 2007-12-20 22:25:25 UTC (rev 8258)
@@ -84,83 +84,105 @@
<groupbox flex="1">
<caption label="MARC Import via Z39.50"/>
- <groupbox orient="horizontal">
- <caption id="c2" label="Service and Credentials" class="shrinkable_groupbox"/>
- <label value="Service:" />
- <hbox id="menu_placeholder" flex="1"/>
- <label value="Username:" control="username" accesskey="U"/>
- <textbox id="username" />
- <label value="Password:" control="password"/>
- <textbox id="password" />
- <button id="save_creds" label="Save as Default" accesskey="D"/>
- </groupbox>
- <groupbox>
- <caption label="Query" class="shrinkable_groupbox"/>
- <hbox>
- <spacer flex="1"/>
- <description>
- Tip: Click a search field label and then the "Save as Default" button to have that field focused by default.
- </description>
- <spacer flex="1"/>
- </hbox>
- <grid>
- <columns><column /><column flex="1" /><column /><column flex="1"/><column /><column flex="1"/></columns>
- <rows id="query_inputs">
- <row>
- <label value="&staff.z39_50.search_class.tcn;" control="tcn_input" onclick="g.z3950.default_attr = 'tcn'" accesskey="0" style="-moz-user-focus: ignore"/>
- <textbox id="tcn_input" mytype="search_class" search_class="tcn" onkeypress="handle_enter(event)"/>
- <label value="&staff.z39_50.search_class.isbn;" control="isbn_input" onclick="g.z3950.default_attr = 'isbn'" style="-moz-user-focus: ignore"/>
- <textbox id="isbn_input" mytype="search_class" search_class="isbn" onkeypress="handle_enter(event)"/>
- <label value="&staff.z39_50.search_class.issn;" control="issn_input" onclick="g.z3950.default_attr = 'issn'" style="-moz-user-focus: ignore"/>
- <textbox id="issn_input" mytype="search_class" search_class="issn" onkeypress="handle_enter(event)"/>
- </row>
- <row>
- <label value="&staff.z39_50.search_class.title;" control="title_input" onclick="g.z3950.default_attr = 'title'" style="-moz-user-focus: ignore"/>
- <textbox id="title_input" mytype="search_class" search_class="title" onkeypress="handle_enter(event)"/>
- <label value="&staff.z39_50.search_class.author;" control="author_input" onclick="g.z3950.default_attr = 'author'" style="-moz-user-focus: ignore"/>
- <textbox id="author_input" mytype="search_class" search_class="author" onkeypress="handle_enter(event)"/>
- <label value="&staff.z39_50.search_class.lccn;" control="lccn_input" onclick="g.z3950.default_attr = 'lccn'" style="-moz-user-focus: ignore"/>
- <textbox id="lccn_input" mytype="search_class" search_class="lccn" onkeypress="handle_enter(event)"/>
- </row>
- <row>
- <label value="&staff.z39_50.search_class.pubdate;" control="pubdate_input" onclick="g.z3950.default_attr = 'pubdate'" style="-moz-user-focus: ignore"/>
- <textbox id="pubdate_input" mytype="search_class" search_class="pubdate" onkeypress="handle_enter(event)"/>
- <label value="&staff.z39_50.search_class.publisher;" control="publisher_input" onclick="g.z3950.default_attr = 'publisher'" style="-moz-user-focus: ignore"/>
- <textbox id="publisher_input" mytype="search_class" search_class="publisher" onkeypress="handle_enter(event)"/>
- <label value="&staff.z39_50.search_class.item_type;" control="item_type_input" onclick="g.z3950.default_attr = 'item_type'" style="-moz-user-focus: ignore"/>
- <menulist id="item_type_input" mytype="search_class" search_class="item_type">
- <menupopup>
- <menuitem label="&staff.z39_50.search_class.item_type.all;" value=""/>
- <menuitem label="&staff.z39_50.search_class.item_type.bks;" value="bks"/>
- <menuitem label="&staff.z39_50.search_class.item_type.ser;" value="ser"/>
- <menuitem label="&staff.z39_50.search_class.item_type.vis;" value="vis"/>
- <menuitem label="&staff.z39_50.search_class.item_type.rec;" value="rec"/>
- <menuitem label="&staff.z39_50.search_class.item_type.sco;" value="sco"/>
- <menuitem label="&staff.z39_50.search_class.item_type.map;" value="map"/>
- <menuitem label="&staff.z39_50.search_class.item_type.com;" value="com"/>
- <menuitem label="&staff.z39_50.search_class.item_type.mix;" value="mix"/>
- <menuitem label="&staff.z39_50.search_class.item_type.url;" value="url"/>
- <menuitem label="&staff.z39_50.search_class.item_type.art;" value="art"/>
- </menupopup>
- </menulist>
- </row>
- </rows>
- </grid>
- <spacer flex="1"/>
- <hbox>
- <button id="raw_search" label="Raw Search" accesskey="w"/>
- <spacer flex="1"/>
- <button id="clear" label="Clear Form" accesskey="C"/>
- <button id="search" label="Search" accesskey="S"/>
- </hbox>
- </groupbox>
+ <hbox id="top_pane" persist="height" flex="1">
+ <vbox id="top_left_pane" persist="width" flex="1">
+ <groupbox id="first_pane" flex="1" class="my_overflow">
+ <caption id="c2" label="Service and Credentials" class="shrinkable_groupbox"/>
+ <grid flex="1">
+ <columns>
+ <column/>
+ <column/>
+ <column/>
+ </columns>
+ <rows id="service_rows">
+ <row>
+ <label value="Service"/>
+ <label value="Username"/>
+ <label value="Password"/>
+ </row>
+ </rows>
+ </grid>
+ </groupbox>
+ <hbox>
+ <button id="save_creds" label="Save as Default" accesskey="D"/>
+ </hbox>
+ </vbox>
+ <splitter collapse="before"><grippy/></splitter>
+ <vbox id="top_right_pane" persist="width" flex="1">
+ <groupbox id="second_pane" flex="1" class="my_overflow">
+ <caption label="Query" class="shrinkable_groupbox"/>
+ <hbox>
+ <spacer flex="1"/>
+ <description>
+ Tip: Click a search field label and then the "Save as Default" button to have that field focused by default.
+ </description>
+ <spacer flex="1"/>
+ </hbox>
+ <grid>
+ <columns><column /><column flex="1" /></columns>
+ <rows id="query_inputs">
+ <!--
+ <row>
+ <label id="tcn_label" value="&staff.z39_50.search_class.tcn;" control="tcn_input" onclick="g.z3950.default_attr = 'tcn'" accesskey="0" style="-moz-user-focus: ignore"/>
+ <textbox id="tcn_input" mytype="search_class" search_class="tcn" onkeypress="handle_enter(event)"/>
+ </row><row>
+ <label id="isbn_label" value="&staff.z39_50.search_class.isbn;" control="isbn_input" onclick="g.z3950.default_attr = 'isbn'" style="-moz-user-focus: ignore"/>
+ <textbox id="isbn_input" mytype="search_class" search_class="isbn" onkeypress="handle_enter(event)"/>
+ </row><row>
+ <label id="issn_label" value="&staff.z39_50.search_class.issn;" control="issn_input" onclick="g.z3950.default_attr = 'issn'" style="-moz-user-focus: ignore"/>
+ <textbox id="issn_input" mytype="search_class" search_class="issn" onkeypress="handle_enter(event)"/>
+ </row><row>
+ <label id="title_label" value="&staff.z39_50.search_class.title;" control="title_input" onclick="g.z3950.default_attr = 'title'" style="-moz-user-focus: ignore"/>
+ <textbox id="title_input" mytype="search_class" search_class="title" onkeypress="handle_enter(event)"/>
+ </row><row>
+ <label id="author_label" value="&staff.z39_50.search_class.author;" control="author_input" onclick="g.z3950.default_attr = 'author'" style="-moz-user-focus: ignore"/>
+ <textbox id="author_input" mytype="search_class" search_class="author" onkeypress="handle_enter(event)"/>
+ </row><row>
+ <label id="lccn_label" value="&staff.z39_50.search_class.lccn;" control="lccn_input" onclick="g.z3950.default_attr = 'lccn'" style="-moz-user-focus: ignore"/>
+ <textbox id="lccn_input" mytype="search_class" search_class="lccn" onkeypress="handle_enter(event)"/>
+ </row><row>
+ <label id="pubdate_label" value="&staff.z39_50.search_class.pubdate;" control="pubdate_input" onclick="g.z3950.default_attr = 'pubdate'" style="-moz-user-focus: ignore"/>
+ <textbox id="pubdate_input" mytype="search_class" search_class="pubdate" onkeypress="handle_enter(event)"/>
+ </row><row>
+ <label id="publisher_label" value="&staff.z39_50.search_class.publisher;" control="publisher_input" onclick="g.z3950.default_attr = 'publisher'" style="-moz-user-focus: ignore"/>
+ <textbox id="publisher_input" mytype="search_class" search_class="publisher" onkeypress="handle_enter(event)"/>
+ </row>
+ -->
+ <row>
+ <label id="item_type_label" value="&staff.z39_50.search_class.item_type;" control="item_type_input" onclick="g.z3950.default_attr = 'item_type'" style="-moz-user-focus: ignore"/>
+ <menulist id="item_type_input" mytype="search_class" search_class="item_type">
+ <menupopup>
+ <menuitem label="&staff.z39_50.search_class.item_type.all;" value=""/>
+ <menuitem label="&staff.z39_50.search_class.item_type.bks;" value="bks"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.ser;" value="ser"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.vis;" value="vis"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.rec;" value="rec"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.sco;" value="sco"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.map;" value="map"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.com;" value="com"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.mix;" value="mix"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.url;" value="url"/>
+ <menuitem label="&staff.z39_50.search_class.item_type.art;" value="art"/>
+ </menupopup>
+ </menulist>
+ </row>
+ </rows>
+ </grid>
+ </groupbox>
+ <hbox>
+ <button id="clear" label="Clear Form" accesskey="C"/>
+ <button id="search" label="Search" accesskey="S"/>
+ <spacer flex="1"/>
+ </hbox>
+ </vbox>
+ </hbox>
<splitter><grippy/></splitter>
- <groupbox flex="1">
+ <groupbox flex="1" id="third_pane" persist="height">
<caption label="Results" />
- <vbox id="result_message" />
+ <hbox id="result_message" />
<hbox>
<button id="page_next" label="Fetch More Results" accesskey="M" disabled="true"/>
- <button id="export" label="Export" command="cmd_export" accesskey=""/>
+ <button id="export" label="CSV to Clipboard" command="cmd_export" accesskey=""/>
<button id="clip_button" command="sel_clip" label="Copy to Clipboard" disabled="true"/>
<button id="save_cols_btn" command="save_columns" label="Save Columns" />
<spacer flex="1"/>
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2007-12-20 21:59:31 UTC (rev 8257)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2007-12-20 22:25:25 UTC (rev 8258)
@@ -420,6 +420,10 @@
'primary' : false, 'hidden' : true, 'render' : function(my) { return my.mvr.doc_id(); },
'persist' : 'hidden width ordinal',
},
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'service', 'label' : 'Service', 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'render' : function(my) { return my.service; },
+ },
{
'id' : 'barcode', 'label' : getString('staff.acp_label_barcode'), 'flex' : 1,
'primary' : false, 'hidden' : true, 'render' : function(my) { return my.acp.barcode(); },
@@ -603,7 +607,7 @@
{
'persist' : 'hidden width ordinal', 'id' : 'alert_message', 'label' : 'Alert Message', 'flex' : 1,
'primary' : false, 'hidden' : true, 'render' : function(my) { return my.acp.alert_message(); },
- },
+ }
];
for (var i = 0; i < c.length; i++) {
if (modify[ c[i].id ]) {
More information about the open-ils-commits
mailing list