<!ENTITY staff.cat.volume_copy_creator.print_labels.accesskey "P">
<!ENTITY staff.cat.volume_copy_creator.library_label.value "Library">
<!ENTITY staff.cat.volume_copy_creator.num_of_volumes_label.value "# of volumes">
+<!ENTITY staff.cat.volume_copy_creator.batch_bar "BATCH">
+<!ENTITY staff.cat.volume_copy_creator.batch_bar.call_number.classification "Classification:">
+<!ENTITY staff.cat.volume_copy_creator.batch_bar.call_number.prefix "Prefix:">
+<!ENTITY staff.cat.volume_copy_creator.batch_bar.call_number.label.label "Label:">
+<!ENTITY staff.cat.volume_copy_creator.batch_bar.call_number.label.accesskey "L">
+<!ENTITY staff.cat.volume_copy_creator.batch_bar.call_number.suffix "Suffix:">
<!ENTITY staff.cat.volume_editor.title "Volumes">
<!ENTITY staff.cat.volume_editor.caption.label "Volume Editor">
<!ENTITY staff.cat.volume_editor.modify.label "Modify">
<!ENTITY staff.cat.volume_editor.cancel.accesskey "C">
<!ENTITY staff.cat.volume_editor.automerge.label "Auto-Merge on Volume Collision">
<!ENTITY staff.cat.volume_editor.automerge.accesskey "A">
+<!ENTITY staff.cat.volume_editor.owning_lib "Owning lib">
+<!ENTITY staff.cat.volume_editor.classification "Classification">
+<!ENTITY staff.cat.volume_editor.prefix "Prefix">
+<!ENTITY staff.cat.volume_editor.label "Label">
+<!ENTITY staff.cat.volume_editor.suffix "Suffix">
<!ENTITY staff.cat.z3950.marc_import.label "MARC Import via Z39.50">
<!ENTITY staff.cat.z3950.marc_import.accesskey "I">
<!ENTITY staff.cat.z3950.service_credentials.label "Service and Credentials">
g.error.sdump('D_TRACE','my_init() for cat/volume_editor.xul');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+ JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.functional');
for (var i = 0; i < g.volumes.length; i++) {
var row = document.createElement('row'); rows.appendChild(row);
var lib_label = document.createElement('label'); row.appendChild(lib_label);
- var tb = document.createElement('textbox'); row.appendChild(tb);
- if (!first_tb) { first_tb = tb; }
+ var class_ml = g.render_class_menu(i); row.appendChild(class_ml);
+ var prefix_ml = g.render_prefix_menu(i); row.appendChild(prefix_ml);
+ var label_tb = document.createElement('textbox'); row.appendChild(label_tb);
+ var suffix_ml = g.render_suffix_menu(i); row.appendChild(suffix_ml);
+ if (!first_tb) { first_tb = label_tb; }
var lib_id = g.volumes[i].owning_lib();
var last_lib_seen;
last_lib_seen = lib_id;
}
- tb.setAttribute('value',g.volumes[i].label());
- tb.setAttribute('onchange','try { var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value ); } catch(E) { alert(E); }');
+ label_tb.setAttribute('value',g.volumes[i].label());
+ label_tb.setAttribute('onchange','try { var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value ); } catch(E) { alert(E); }');
}
first_tb.select(); first_tb.focus();
}
}
+g.render_class_menu = function(vol_idx) {
+ var ml = util.widgets.make_menulist(
+ util.functional.map_list(
+ g.data.list.acnc,
+ function(o) {
+ return [ o.name(), o.id() ];
+ }
+ ),
+ typeof g.volumes[vol_idx].label_class() == 'object'
+ ? g.volumes[vol_idx].label_class().id()
+ : g.volumes[vol_idx].label_class()
+ );
+ ml.addEventListener(
+ 'command',
+ function(ev) {
+ g.volumes[vol_idx].ischanged(1);
+ g.volumes[vol_idx].label_class(ml.value);
+ },
+ false
+ );
+ return ml;
+}
+
+g.render_prefix_menu = function(vol_idx) {
+ var org = typeof g.volumes[vol_idx].owning_lib() == 'object'
+ ? g.volumes[vol_idx].owning_lib()
+ : g.data.hash.aou[ g.volumes[vol_idx].owning_lib() ];
+ var menulist = document.createElement('menulist');
+ var menupopup = document.createElement('menupopup');
+ menulist.appendChild(menupopup);
+ var org_list = []; // order from top of consortium to owning lib
+ while(org) {
+ org_list.unshift(org.id());
+ org = org.parent_ou();
+ if (org && typeof org != 'object') {
+ org = g.data.hash.aou[ org ];
+ }
+ }
+ for (var i = 0; i < org_list.length; i++) {
+ g.render_prefix_menu_items(menupopup,org_list[i]);
+ }
+ menulist.setAttribute('value',
+ typeof g.volumes[vol_idx].prefix() == 'object'
+ ? g.volumes[vol_idx].prefix().id()
+ : g.volumes[vol_idx].prefix()
+ );
+
+ menulist.addEventListener(
+ 'command',
+ function() {
+ g.volumes[vol_idx].ischanged(1);
+ g.volumes[vol_idx].prefix(menulist.value);
+ },
+ false
+ );
+ return menulist;
+}
+
+g.render_prefix_menu_items = function(menupopup,ou_id) {
+ if (typeof g.data.list['acnp_for_lib_'+ou_id] == 'undefined') {
+ g.data.list['acnp_for_lib_'+ou_id] = g.network.simple_request(
+ 'FM_ACNP_RETRIEVE_VIA_PCRUD',
+ [ ses(), {"owning_lib":{"=":ou_id}}, {"order_by":{"acnp":"label_sortkey"}} ]
+ );
+ g.data.stash('list');
+ }
+ for (var i = 0; i < g.data.list['acnp_for_lib_'+ou_id].length; i++) {
+ var my_acnp = g.data.list['acnp_for_lib_'+ou_id][i];
+ var menuitem = document.createElement('menuitem');
+ menupopup.appendChild(menuitem);
+ menuitem.setAttribute(
+ 'label',
+ my_acnp.id() == -1 ? '' :
+ $('catStrings').getFormattedString(
+ 'staff.cat.volume_copy_creator.call_number_prefix.menuitem_label',
+ [
+ my_acnp.label(),
+ g.data.hash.aou[ ou_id ].shortname()
+ ]
+ )
+ );
+ menuitem.setAttribute('value',my_acnp.id());
+ }
+}
+
+
+g.render_suffix_menu = function(vol_idx) {
+ var org = typeof g.volumes[vol_idx].owning_lib() == 'object'
+ ? g.volumes[vol_idx].owning_lib()
+ : g.data.hash.aou[ g.volumes[vol_idx].owning_lib() ];
+ var menulist = document.createElement('menulist');
+ var menupopup = document.createElement('menupopup');
+ menulist.appendChild(menupopup);
+ var org_list = []; // order from top of consortium to owning lib
+ while(org) {
+ org_list.unshift(org.id());
+ org = org.parent_ou();
+ if (org && typeof org != 'object') {
+ org = g.data.hash.aou[ org ];
+ }
+ }
+ for (var i = 0; i < org_list.length; i++) {
+ g.render_suffix_menu_items(menupopup,org_list[i]);
+ }
+ menulist.setAttribute('value',
+ typeof g.volumes[vol_idx].suffix() == 'object'
+ ? g.volumes[vol_idx].suffix().id()
+ : g.volumes[vol_idx].suffix()
+ );
+
+ menulist.addEventListener(
+ 'command',
+ function() {
+ g.volumes[vol_idx].ischanged(1);
+ g.volumes[vol_idx].suffix(menulist.value);
+ },
+ false
+ );
+ return menulist;
+}
+
+g.render_suffix_menu_items = function(menupopup,ou_id) {
+ if (typeof g.data.list['acns_for_lib_'+ou_id] == 'undefined') {
+ g.data.list['acns_for_lib_'+ou_id] = g.network.simple_request(
+ 'FM_ACNS_RETRIEVE_VIA_PCRUD',
+ [ ses(), {"owning_lib":{"=":ou_id}}, {"order_by":{"acns":"label_sortkey"}} ]
+ );
+ g.data.stash('list');
+ }
+ for (var i = 0; i < g.data.list['acns_for_lib_'+ou_id].length; i++) {
+ var my_acns = g.data.list['acns_for_lib_'+ou_id][i];
+ var menuitem = document.createElement('menuitem');
+ menupopup.appendChild(menuitem);
+ menuitem.setAttribute(
+ 'label',
+ my_acns.id() == -1 ? '' :
+ $('catStrings').getFormattedString(
+ 'staff.cat.volume_copy_creator.call_number_suffix.menuitem_label',
+ [
+ my_acns.label(),
+ g.data.hash.aou[ ou_id ].shortname()
+ ]
+ )
+ );
+ menuitem.setAttribute('value',my_acns.id());
+ }
+}
+