/**** CLASSIFICATION COLUMN ****/
var classification_column_box = document.createElement('vbox');
r.appendChild(classification_column_box);
- var classification_column_menulist = document.createElement('menulist');
- classification_column_box.appendChild(classification_column_menulist);
/**** PREFIX COLUMN ****/
var prefix_column_box = document.createElement('vbox');
r.appendChild(prefix_column_box);
- var prefix_column_menulist = document.createElement('menulist');
- prefix_column_box.appendChild(prefix_column_menulist);
/**** CALLNUMBER COLUMN ****/
var call_number_column_box = document.createElement('vbox');
call_number_column_textbox.addEventListener( 'change', g.gather_copies_soon, false);
call_number_column_textbox.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
+ /**** CLASSIFICATION COLUMN revisited ****/
+ var classification_column_menulist = g.render_class_menu(call_number_column_textbox);
+ classification_column_menulist.addEventListener( 'change', g.gather_copies_soon, false);
+ classification_column_box.appendChild(classification_column_menulist);
+
+ /**** PREFIX COLUMN revisited ****/
+ var prefix_column_menulist = document.createElement('menulist');
+ prefix_column_box.appendChild(prefix_column_menulist);
+
/**** SUFFIX COLUMN ****/
var suffix_column_box = document.createElement('vbox');
r.appendChild(suffix_column_box);
var nl = document.getElementsByTagName('textbox');
var volumes_hash = {};
+ /*
+ volumes_hash = {
+ '#ou_id' : {
+ '#callnumber label' : {
+ 'call_number_data' : {
+ 'acnc_id' : '#classification_id',
+ 'acnp_id' : '#prefix_id',
+ 'acns_id' : '#suffix_id',
+ },
+ 'barcode_data' :
+ [
+ {
+ 'barcode' : '#barcode',
+ 'acp_id' : '#copy_id',
+ 'bmp_id' : '#part_id'
+ }, ...
+ ]
+ }
+ }, ...
+ }
+ */
var barcodes = [];
if ( nl[i].getAttribute('rel_vert_pos') == rel_vert_pos_barcode ) barcodes.push( nl[i] );
if ( nl[i].getAttribute('rel_vert_pos') == rel_vert_pos_call_number ) {
var ou_id = nl[i].getAttribute('ou_id');
+ var acnc_id = nl[i].getAttribute('acnc_id');
var callnumber = nl[i].value;
- if (typeof volumes_hash[ou_id] == 'undefined') { volumes_hash[ou_id] = {} }
- if (typeof volumes_hash[ou_id][callnumber] == 'undefined') { volumes_hash[ou_id][callnumber] = [] }
+ if (typeof volumes_hash[ou_id] == 'undefined') {
+ volumes_hash[ou_id] = {}
+ }
+ if (typeof volumes_hash[ou_id][callnumber] == 'undefined') {
+ volumes_hash[ou_id][callnumber] = {
+ 'call_number_data' : {
+ 'acnc_id' : acnc_id
+ },
+ 'barcode_data' : []
+ }
+ }
}
};
var barcode = barcodes[i].value;
var bmp_id = barcodes[i].getAttribute('bmp_id');
- if (typeof volumes_hash[ou_id] == 'undefined') { volumes_hash[ou_id] = {} }
- if (typeof volumes_hash[ou_id][callnumber] == 'undefined') { volumes_hash[ou_id][callnumber] = [] }
+ if (typeof volumes_hash[ou_id] == 'undefined') {
+ volumes_hash[ou_id] = {}
+ }
+ if (typeof volumes_hash[ou_id][callnumber] == 'undefined') {
+ volumes_hash[ou_id][callnumber] = {
+ 'call_number_data' : {},
+ 'barcode_data' : []
+ }
+ }
if (barcode != '') {
- volumes_hash[ou_id][callnumber].push(
+ volumes_hash[ou_id][callnumber].barcode_data.push(
{
'barcode' : barcode,
'acp_id' : acp_id,
continue;
}
- volume_labels[ acn_id ] = { 'label' : cn_label, 'owning_lib' : ou_id };
+ volume_labels[ acn_id ] = {
+ 'label' : cn_label,
+ 'owning_lib' : ou_id
+ };
+ for (var i in volumes_hash[ou_id][cn_label].call_number_data) {
+ volume_labels[ acn_id ][ i ] = volumes_hash[ou_id][cn_label].call_number_data[i];
+ }
- for (var i = 0; i < volumes_hash[ou_id][cn_label].length; i++) {
- var barcode = volumes_hash[ou_id][cn_label][i].barcode;
- var acp_id = volumes_hash[ou_id][cn_label][i].acp_id;
- var bmp_id = volumes_hash[ou_id][cn_label][i].bmp_id;
+ for (var i = 0; i < volumes_hash[ou_id][cn_label].barcode_data.length; i++) {
+ var barcode = volumes_hash[ou_id][cn_label].barcode_data[i].barcode;
+ var acp_id = volumes_hash[ou_id][cn_label].barcode_data[i].acp_id;
+ var bmp_id = volumes_hash[ou_id][cn_label].barcode_data[i].bmp_id;
var copy = g.id_copy_map[ acp_id ];
if (!copy) {
copy = new_copy(acp_id,ou_id,acn_id,barcode);
}
}
+g.render_class_menu = function(call_number_tb) {
+ var ml = util.widgets.make_menulist(
+ util.functional.map_list(
+ g.data.list.acnc,
+ function(o) {
+ return [ o.name(), o.id() ];
+ }
+ )
+ );
+ ml.addEventListener(
+ 'command',
+ function() {
+ call_number_tb.setAttribute('acnc_id',ml.value);
+ },
+ false
+ );
+ return ml;
+}
+
g.list_callnumbers = function(doc_id, label_class) {
var cn_blob;
try {