1 /* ---------------------------------------------------------------------------
2 * Copyright (C) 2009-2015 Equinox Software, Inc.
3 * Mike Rylander <miker@esilibrary.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * ---------------------------------------------------------------------------
18 // This module requires a /real/ jQuery be used with your
19 // angularjs, so as to avoid using hand-rolled AJAX.
23 Record : function(kwargs) {
24 if (!kwargs) kwargs = {};
26 this.generate008 = function () {
31 var y = now.getUTCFullYear().toString().substr(2,2);
32 var m = now.getUTCMonth() + 1;
33 if (m < 10) m = '0' + m;
34 var d = now.getUTCDate();
35 if (d < 10) d = '0' + d;
38 if (f = this.field('008',true)[0]) {
42 /* lang code from 041a */
43 var lang = orig008.substr(35, 3);
45 if (f = this.field('041',true)[0]) {
46 if (s = f.subfield('a',true)[0]) {
51 /* country code from 044a */
52 var country = orig008.substr(15, 3);
53 if (f = this.field('044',true)[0]) {
54 if (s = f.subfield('a',true)[0]) {
55 if(s[1]) country = s[1];
58 while (country.length < 3) country = country + ' ';
59 if (country.length > 3) country = country.substr(0,3);
62 var date1 = now.getUTCFullYear().toString();
63 if (f = this.field('260',true)[0]) {
64 if (s = f.subfield('c',true)[0]) {
67 tmpd = tmpd.replace(/[^0-9]/g, '');
68 if (tmpd.match(/^\d\d\d\d/)) {
69 date1 = tmpd.substr(0, 4);
75 var date2 = orig008.substr(11, 4);
76 var datetype = orig008.substr(6, 1);
77 var modded = orig008.substr(38, 1);
78 var catsrc = orig008.substr(39, 1);
80 return '' + y + m + d + datetype + date1 + date2 + country + ' ' + lang + modded + catsrc;
84 this.title = function () { return this.subfield('245','a')[1] }
86 this.field = function (spec, wantarray) {
87 var list = this.fields.filter(function (f) {
88 if (f.tag.match(spec)) return true;
92 if (!wantarray && list.length == 1) return list[0];
96 this.subfield = function (spec, code) {
97 var f = this.field(spec, true)[0];
98 if (f) return f.subfield(code)
102 this.appendFields = function () {
104 Array.prototype.slice.call(arguments).forEach( function (f) { f.position = me.fields.length; me.fields.push( f ) } );
107 this.deleteField = function (f) { return this.deleteFields(f) },
109 this.insertOrderedFields = function () {
111 for (var i = 0; i < arguments.length; i++) {
112 var f = arguments[i];
114 for (var j = 0; j < this.fields.length; j++) {
115 if (f.tag < this.fields[j].tag) {
116 this.insertFieldsBefore(this.fields[j], f);
121 if (!done) this.appendFields(f);
125 this.insertFieldsBefore = function (target) {
126 var args = Array.prototype.slice.call(arguments);
129 for (var j = 0; j < this.fields.length; j++) {
130 if (target === this.fields[j]) {
131 args.forEach( function (f) {
133 me.fields.splice(j++,0,f);
138 for (var j = 0; j < this.fields.length; j++) {
139 this.fields[j].position = j;
143 this.insertFieldsAfter = function (target) {
144 var args = Array.prototype.slice.call(arguments);
147 for (var j = 0; j < this.fields.length; j++) {
148 if (target === this.fields[j]) {
149 args.forEach( function (f) {
151 me.fields.splice(++j,0,f);
156 for (var j = 0; j < this.fields.length; j++) {
157 this.fields[j].position = j;
161 this.deleteFields = function () {
164 for ( var i in arguments ) {
165 var f = arguments[i];
166 for (var j = 0; j < me.fields.length; j++) {
167 if (f === me.fields[j]) {
168 me.fields[j].record = null;
169 me.fields.splice(j,1);
175 for (var j = 0; j < this.fields.length; j++) {
176 this.fields[j].position = j;
181 // this.clone = function () { return dojo.clone(this) } // maybe implement later...
183 this.fromXmlURL = function (url) {
185 return $.get( // This is a Promise
188 me.fromXmlDocument($('record', mxml)[0]);
189 if (me.onLoad) me.onLoad();
193 this.fromXmlString = function (mxml) {
194 this.fromXmlDocument( $( $.parseXML( mxml ) ).find('record')[0] );
197 this.fromXmlDocument = function (mxml) {
199 me.leader = $($('leader',mxml)[0]).text() || '00000cam a2200205Ka 4500';
201 $('controlfield', mxml).each(function (ind) {
206 tag : cf.attr('tag'),
212 $('datafield', mxml).each(function (ind) {
217 tag : df.attr('tag'),
218 ind1 : df.attr('ind1'),
219 ind2 : df.attr('ind2'),
220 subfields : $('subfield', df).map(
222 return [[ $(sf).attr('code'), $(sf).text(), i ]];
229 for (var j = 0; j < this.fields.length; j++) {
230 this.fields[j].position = j;
237 this.toXmlDocument = function () {
239 var doc = $.parseXML('<record xmlns="http://www.loc.gov/MARC21/slim"/>');
240 var rec_node = $('record', doc)[0];
242 var ldr = doc.createElementNS('http://www.loc.gov/MARC21/slim', 'leader');
243 ldr.textContent = this.leader;
244 rec_node.appendChild( ldr );
246 this.fields.forEach(function (f) {
247 var element = f.isControlfield() ? 'controlfield' : 'datafield';
248 var f_node = doc.createElementNS( 'http://www.loc.gov/MARC21/slim', element );
249 f_node.setAttribute('tag', f.tag);
251 if (f.isControlfield()) {
252 if (f.data) f_node.textContent = f.data;
254 f_node.setAttribute('ind1', f.indicator(1));
255 f_node.setAttribute('ind2', f.indicator(2));
256 f.subfields.forEach( function (sf) {
257 var sf_node = doc.createElementNS('http://www.loc.gov/MARC21/slim', 'subfield');
258 sf_node.setAttribute('code', sf[0]);
259 sf_node.textContent = sf[1];
260 f_node.appendChild(sf_node);
264 rec_node.appendChild(f_node);
270 this.toXmlString = function () {
271 return (new XMLSerializer()).serializeToString( this.toXmlDocument() );
274 this.fromBreaker = function (marctxt) {
277 function cf_line_data (l) { return l.substring(4) || '' };
278 function df_line_data (l) { return l.substring(6) || '' };
279 function line_tag (l) { return l.substring(0,3) };
280 function df_ind1 (l) { return l.substring(4,5).replace('\\',' ') };
281 function df_ind2 (l) { return l.substring(5,6).replace('\\',' ') };
282 function isControlField (l) {
284 return (x == 'LDR' || x < '010') ? true : false;
287 var lines = marctxt.replace(/^=/gm,'').split('\n');
288 lines.forEach(function (current_line, ind) {
290 if (current_line.match(/^#/)) {
291 // skip comment lines
292 } else if (isControlField(current_line)) {
293 if (line_tag(current_line) == 'LDR') {
294 me.leader = cf_line_data(current_line) || '00000cam a2200205Ka 4500';
299 tag : line_tag(current_line),
300 data : cf_line_data(current_line).replace('\\',' ','g'),
305 if (current_line.substring(4,5) == me.delimiter) // add delimiters if they were left out
306 current_line = current_line.substring(0,3) + ' \\\\' + current_line.substring(4);
308 var data = df_line_data(current_line);
309 if (!(data.substring(0,1) == me.delimiter)) data = me.delimiter + 'a' + data;
311 var sf_list = data.split(me.delimiter);
317 tag : line_tag(current_line),
318 ind1 : df_ind1(current_line),
319 ind2 : df_ind2(current_line),
320 subfields : sf_list.map( function (sf, i) {
321 var sf_data = sf.substring(1);
322 if (me.delimiter == '$') sf_data = sf_data.replace(/\{dollar\}/g, '$');
323 return [ sf.substring(0,1), sf_data, i ];
330 for (var j = 0; j < this.fields.length; j++) {
331 this.fields[j].position = j;
338 this.toBreaker = function () {
341 var mtxt = '=LDR ' + this.leader + '\n';
343 mtxt += this.fields.map( function (f) {
344 if (f.isControlfield()) {
345 if (f.data) return '=' + f.tag + ' ' + f.data.replace(' ','\\','g');
348 return '=' + f.tag + ' ' +
349 f.indicator(1).replace(' ','\\') +
350 f.indicator(2).replace(' ','\\') +
351 f.subfields.map( function (sf) {
353 if (me.delimiter == '$') sf_data = sf_data.replace(/\$/g, '{dollar}');
354 return me.delimiter + sf[0] + sf_data;
362 this.recordType = function () {
364 var _t = this.leader.substr(MARC21.Record._ff_pos.Type.ldr.BKS.start, MARC21.Record._ff_pos.Type.ldr.BKS.len);
365 var _b = this.leader.substr(MARC21.Record._ff_pos.BLvl.ldr.BKS.start, MARC21.Record._ff_pos.BLvl.ldr.BKS.len);
367 for (var t in MARC21.Record._recType) {
368 if (_t.match(MARC21.Record._recType[t].Type) && _b.match(MARC21.Record._recType[t].BLvl)) {
372 return 'BKS'; // default
375 this.videorecordingFormatName = function () {
376 var _7 = this.field('007').data;
378 if (_7 && _7.match(/^v/)) {
379 var _v_e = _7.substr(
380 MARC21.Record._physical_characteristics.v.subfields.e.start,
381 MARC21.Record._physical_characteristics.v.subfields.e.len
384 return MARC21.Record._physical_characteristics.v.subfields.e.values[ _v_e ];
390 this.videorecordingFormatCode = function () {
391 var _7 = this.field('007').data;
393 if (_7 && _7.match(/^v/)) {
395 MARC21.Record._physical_characteristics.v.subfields.e.start,
396 MARC21.Record._physical_characteristics.v.subfields.e.len
403 this.extractFixedField = function (field, dflt) {
404 if (!MARC21.Record._ff_pos[field]) return null;
406 var _l = this.leader;
407 var _8 = this.field('008').data;
408 var _6 = this.field('006').data;
410 var rtype = this.recordType();
414 if (MARC21.Record._ff_pos[field].ldr && _l) {
415 if (MARC21.Record._ff_pos[field].ldr[rtype]) {
417 MARC21.Record._ff_pos[field].ldr[rtype].start,
418 MARC21.Record._ff_pos[field].ldr[rtype].len
421 } else if (MARC21.Record._ff_pos[field]._8 && _8) {
422 if (MARC21.Record._ff_pos[field]._8[rtype]) {
424 MARC21.Record._ff_pos[field]._8[rtype].start,
425 MARC21.Record._ff_pos[field]._8[rtype].len
430 if (!val && MARC21.Record._ff_pos[field]._6 && _6) {
431 if (MARC21.Record._ff_pos[field]._6[rtype]) {
433 MARC21.Record._ff_pos[field]._6[rtype].start,
434 MARC21.Record._ff_pos[field]._6[rtype].len
443 if (MARC21.Record._ff_pos[field].ldr && MARC21.Record._ff_pos[field].ldr[rtype]) {
444 d = MARC21.Record._ff_pos[field].ldr[rtype].def;
448 if (MARC21.Record._ff_pos[field]._8 && MARC21.Record._ff_pos[field]._8[rtype]) {
449 d = MARC21.Record._ff_pos[field]._8[rtype].def;
453 if (!val && MARC21.Record._ff_pos[field]._6 && MARC21.Record._ff_pos[field]._6[rtype]) {
454 d = MARC21.Record._ff_pos[field]._6[rtype].def;
459 for (var j = 0; j < MARC21.Record._ff_pos[field][p][rtype].len; j++) {
470 this.setFixedField = function (field, value) {
471 if (!MARC21.Record._ff_pos[field]) return null;
473 var _l = this.leader;
474 var _8 = this.field('008').data;
475 var _6 = this.field('006').data;
477 var rtype = this.recordType();
481 if (MARC21.Record._ff_pos[field].ldr && _l) {
482 if (MARC21.Record._ff_pos[field].ldr[rtype]) { // It's in the leader
483 val = value.substr(0, MARC21.Record._ff_pos[field].ldr[rtype].len);
485 _l.substring(0, MARC21.Record._ff_pos[field].ldr[rtype].start) +
488 MARC21.Record._ff_pos[field].ldr[rtype].start
489 + MARC21.Record._ff_pos[field].ldr[rtype].len
492 } else if (MARC21.Record._ff_pos[field]._8 && _8) {
493 if (MARC21.Record._ff_pos[field]._8[rtype]) { // Nope, it's in the 008
494 val = value.substr(0, MARC21.Record._ff_pos[field]._8[rtype].len);
495 this.field('008').update(
496 _8.substring(0, MARC21.Record._ff_pos[field]._8[rtype].start) +
499 MARC21.Record._ff_pos[field]._8[rtype].start
500 + MARC21.Record._ff_pos[field]._8[rtype].len
506 if (!val && MARC21.Record._ff_pos[field]._6 && _6) {
507 if (MARC21.Record._ff_pos[field]._6[rtype]) { // ok, maybe the 006?
508 val = value.substr(0, MARC21.Record._ff_pos[field]._6[rtype].len);
509 this.field('006').update(
510 _6.substring(0, MARC21.Record._ff_pos[field]._6[rtype].start) +
513 MARC21.Record._ff_pos[field]._6[rtype].start
514 + MARC21.Record._ff_pos[field]._6[rtype].len
525 this.delimiter = '\u2021';
526 this.leader = '00000cam a2200205Ka 4500';
528 if (kwargs.delimiter) this.delimiter = kwargs.delimiter;
529 if (kwargs.onLoad) this.onLoad = kwargs.onLoad;
532 this.fromXmlURL(kwargs.url);
533 } else if (kwargs.marcxml) {
534 this.fromXmlString(kwargs.marcxml);
535 if (this.onLoad) this.onLoad();
536 } else if (kwargs.xml) {
537 this.fromXmlDocument(kwargs.xml);
538 if (this.onLoad) this.onLoad();
539 } else if (kwargs.marcbreaker) {
540 this.fromBreaker(kwargs.marcbreaker);
541 if (this.onLoad) this.onLoad();
544 if (kwargs.rtype == 'AUT') {
545 this.setFixedField('Type','z');
550 Field : function (kwargs) {
551 if (!kwargs) kwargs = {};
553 this.subfield = function (code, wantarray) {
554 var list = this.subfields.filter( function (s) {
555 if (s[0] == code) return true; return false;
557 if (!wantarray && list.length == 1) return list[0];
561 this.addSubfields = function () {
562 for (var i = 0; i < arguments.length; i++) {
563 var code = arguments[i];
564 var value = arguments[++i];
565 this.subfields.push( [ code, value ] );
569 this.deleteExactSubfields = function () {
573 for ( var i in arguments ) {
574 var f = arguments[i];
575 for (var j = 0; j < me.subfields.length; j++) {
576 if (f === me.subfields[j]) {
577 me.subfields.splice(j,1);
582 if (done && me.subfields[j])
583 me.subfields[j][2] -= 1;
590 this.deleteSubfields = function (c) {
591 return this.deleteSubfield( { code : c } );
594 this.deleteSubfield = function (args) {
596 if (!Array.isArray( args.code )) {
597 args.code = [ args.code ];
600 if (args.pos && !Array.isArray( args.pos )) {
601 args.pos = [ args.pos ];
604 for (var i = 0; i < args.code.length; i++) {
606 for (var j = 0; j < me.subfields; j++) {
607 if (me.subfields[j][0] == args.code[i]) {
609 if (!sub_pos[args.code[i]]) sub_pos[args.code[j]] = 0;
610 else sub_pos[args.code[i]]++;
613 for (var k = 0; k < args.pos.length; k++) {
614 if (sub_pos[args.code[i]] == args.pos[k]) me.subfields.splice(j,1);
616 } else if (args.match && me.subfields[j][1].match( args.match )) {
617 me.subfields.splice(j,1);
619 me.subfields.splice(j,1);
626 this.update = function ( args ) {
627 if (this.isControlfield()) {
630 if (args.ind1) this.ind1 = args.ind1;
631 if (args.ind2) this.ind2 = args.ind2;
632 if (args.tag) this.tag = args.tag;
634 for (var i in args) {
635 if (i == 'tag' || i == 'ind1' || i == 'ind2') continue;
637 this.subfields.forEach( function (f) {
638 if (!done && f[0] == i) {
647 this.isControlfield = function () {
648 return this.tag < '010' ? true : false;
651 this.indicator = function (num, value) {
652 if (value !== undefined) {
653 if (num == 1) this.ind1 = value;
654 else if (num == 2) this.ind2 = value;
655 else { this.error = true; return null; }
657 if (num == 1) return this.ind1;
658 else if (num == 2) return this.ind2;
659 else { this.error = true; return null; }
663 this.record = null; // MARC record pointer
664 this.tag = ''; // MARC tag
665 this.ind1 = ' '; // MARC indicator 1
666 this.ind2 = ' '; // MARC indicator 2
667 this.data = ''; // MARC data for a controlfield element
668 this.subfields = []; // list of MARC subfields for a datafield element
670 this.position = kwargs.position;
671 this.record = kwargs.record;
672 this.tag = kwargs.tag;
673 this.ind1 = kwargs.ind1 || ' ';
674 this.ind2 = kwargs.ind2 || ' ';
675 this.data = kwargs.data;
677 if (kwargs.subfields) this.subfields = kwargs.subfields;
678 else this.subfields = [];
682 Batch : function(kwargs) {
684 this.parse = function () {
685 if (this.source instanceof Object ) { // assume an xml collection document
686 this.source = $('record', this.source);
688 } else if (this.source.match(/^\s*</)) { // this is xml text
689 this.source = $.parseXML( mxml ).find('record');
691 } else { // must be a marcbreaker doc. split on blank lines
692 this.source = this.source.split(/^$/);
693 this.type = 'marcbreaker';
697 this.fetchURL = function (u) {
699 $.get( u, function (mrc) {
705 this.next = function () {
706 var chunk = this.source[this.current_record++];
710 args[this.type] = chunk;
711 if (this.delimiter) args.delimiter = this.delimiter;
712 return new MARC21.Record(args);
720 this.source = kwargs.source;
721 this.delimiter = kwargs.delimiter
722 this.current_record = 0;
724 if (this.source) this.ready = true;
725 if (!this.ready && kwargs.url) this.fetchURL( kwargs.url );
727 if (this.ready) this.parse();
731 AuthorityControlSet : function (kwargs) {
733 kwargs = kwargs || {};
735 if (!MARC21.AuthorityControlSet._remote_loaded) {
737 // TODO -- push the raw tree into the oils cache for later reuse
739 // fetch everything up front...
740 this._preFetchWithFielder({
741 "acs": "_control_set_list",
742 "at": "_thesaurus_list",
743 "acsaf": "_authority_field_list",
744 "acsbf": "_bib_field_list",
745 "aba": "_browse_axis_list",
746 "abaafm": "_browse_field_map_list"
749 MARC21.AuthorityControlSet._remote_loaded = true;
752 if (MARC21.AuthorityControlSet._remote_loaded && !MARC21.AuthorityControlSet._remote_parsed) {
754 MARC21.AuthorityControlSet._browse_axis_by_code = {};
755 MARC21.AuthorityControlSet._browse_axis_list.forEach(function (ba) {
757 MARC21.AuthorityControlSet._browse_field_map_list.filter(
758 function (m) { return m.axis() == ba.code() }
761 MARC21.AuthorityControlSet._browse_axis_by_code[ba.code()] = ba;
764 // loop over each acs
765 MARC21.AuthorityControlSet._control_set_list.forEach(function (cs) {
766 MARC21.AuthorityControlSet._controlsets[''+cs.id()] = {
769 description : cs.description(),
770 authority_tag_map : {},
776 // grab the authority fields
777 var acsaf_list = MARC21.AuthorityControlSet._authority_field_list.filter(
778 function (af) { return af.control_set() == cs.id() }
781 var at_list = MARC21.AuthorityControlSet._thesaurus_list.filter(
782 function (at) { return at.control_set() == cs.id() }
785 MARC21.AuthorityControlSet._controlsets[''+cs.id()].raw.authority_fields( acsaf_list );
786 MARC21.AuthorityControlSet._controlsets[''+cs.id()].raw.thesauri( at_list );
788 // and loop over each
789 acsaf_list.forEach(function (csaf) {
792 // link the main entry if we're subordinate
793 if (csaf.main_entry()) {
795 acsaf_list.filter(function (x) {
796 return x.id() == csaf.main_entry();
801 // link the sub entries if we're main
803 acsaf_list.filter(function (x) {
804 return x.main_entry() == csaf.id();
809 var acsbf_list = MARC21.AuthorityControlSet._bib_field_list.filter(
810 function (b) { return b.authority_field() == csaf.id() }
812 csaf.bib_fields( acsbf_list );
814 MARC21.AuthorityControlSet._controlsets[''+cs.id()].bib_fields = [].concat(
815 MARC21.AuthorityControlSet._controlsets[''+cs.id()].bib_fields,
819 acsbf_list.forEach(function (csbf) {
820 // link the authority field to the bib field
821 if (csbf.authority_field()) {
822 csbf.authority_field(
823 acsaf_list.filter(function (x) {
824 return x.id() == csbf.authority_field();
831 MARC21.AuthorityControlSet._browse_axis_list.forEach(
834 function (m) { return m.field() == csaf.id() }
836 function (fm) { fm.field( csaf ); csaf.axis_maps().push( fm ) } // and set the field
843 // build the authority_tag_map
844 MARC21.AuthorityControlSet._controlsets[''+cs.id()].bib_fields.forEach(function (bf) {
846 if (!MARC21.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()])
847 MARC21.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()] = {};
849 bf.authority_field().sf_list().split('').forEach(function (sf_code) {
851 if (!MARC21.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()][sf_code])
852 MARC21.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()][sf_code] = {};
854 MARC21.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()][sf_code][bf.authority_field().tag()] = sf_code;
860 if (this.controlSetList().length > 0)
861 delete MARC21.AuthorityControlSet._controlsets['-1'];
863 MARC21.AuthorityControlSet._remote_parsed = true;
866 this._preFetchWithFielder = function(cmap) {
867 for (var hint in cmap) {
868 var cache_key = cmap[hint];
869 var method = "open-ils.fielder." + hint + ".atomic";
870 var pkey = fieldmapper.IDL.fmclasses[hint].pkey;
873 query[pkey] = {"!=": null};
875 MARC21.AuthorityControlSet[cache_key] = dojo.map(
876 fieldmapper.standardRequest(
877 ["open-ils.fielder", method],
878 [{"cache": 1, "query" : query}]
880 function(h) { return new fieldmapper[hint]().fromHash(h); }
885 this.controlSetId = function (x) {
886 if (x) this._controlset = ''+x;
887 return this._controlset;
890 this.controlSet = function (x) {
891 return MARC21.AuthorityControlSet._controlsets[''+this.controlSetId(x)];
894 this.controlSetByThesaurusCode = function (x) {
895 var thes = MARC21.AuthorityControlSet._thesaurus_list.filter(
896 function (at) { return at.code() == x }
899 return this.controlSet(thes.control_set());
902 this.browseAxisByCode = function(code) {
903 return MARC21.AuthorityControlSet._browse_axis_by_code[code];
906 this.bibFieldByTag = function (x) {
908 return me.controlSet().bib_fields.filter(
909 function (bf) { if (bf.tag() == x) return true }
913 this.bibFields = function (x) {
914 return this.controlSet(x).bib_fields;
917 this.bibFieldBrowseAxes = function (t) {
919 for (var bcode in MARC21.AuthorityControlSet._browse_axis_by_code) {
920 MARC21.AuthorityControlSet._browse_axis_by_code[bcode].maps().forEach(
922 if (m.field().bib_fields().filter(
923 function (b) { return b.tag() == t }
932 this.authorityFields = function (x) {
933 return this.controlSet(x).raw.authority_fields();
936 this.thesauri = function (x) {
937 return this.controlSet(x).raw.thesauri();
940 this.controlSetList = function () {
942 for (var i in MARC21.AuthorityControlSet._controlsets) {
948 this.findControlSetsForTag = function (tag) {
950 var old_acs = this.controlSetId();
951 var acs_list = me.controlSetList().filter(
952 function(acs_id) { return (me.controlSet(acs_id).control_map[tag]) }
954 this.controlSetId(old_acs);
958 this.findControlSetsForAuthorityTag = function (tag) {
960 var old_acs = this.controlSetId();
962 var acs_list = me.controlSetList().filter(
964 var a = me.controlSet(acs_id);
965 for (var btag in a.control_map) {
966 for (var sf in a.control_map[btag]) {
967 if (a.control_map[btag][sf][tag]) return true;
973 this.controlSetId(old_acs);
977 this.bibToAuthority = function (field) {
978 var b_field = this.bibFieldByTag(field.tag);
980 if (b_field) { // construct an marc authority record
981 var af = b_field.authority_field();
984 for (var i = 0; i < field.subfields.length; i++) {
985 if (af.sf_list().indexOf(field.subfields[i][0]) > -1) {
986 sflist.push(field.subfields[i]);
990 var m = new MARC21.Record ({rtype:'AUT'});
1000 return m.toXmlString();
1006 this.bibToAuthorities = function (field) {
1010 var old_acs = this.controlSetId();
1011 me.controlSetList().forEach(
1013 var acs = me.controlSet(acs_id);
1014 var x = me.bibToAuthority(field);
1015 if (x) { var foo = {}; foo[acs_id] = x; auth_list.push(foo); }
1018 this.controlSetId(old_acs);
1023 // This should not be used in an angular world. Instead, the call
1024 // to open-ils.search.authority.simple_heading.from_xml.batch.atomic should
1025 // be performed by the code that wants to find matching authorities.
1026 this.findMatchingAuthorities = function (field) {
1027 return fieldmapper.standardRequest(
1028 [ 'open-ils.search', 'open-ils.search.authority.simple_heading.from_xml.batch.atomic' ],
1029 this.bibToAuthorities(field)
1033 if (kwargs.controlSet) {
1034 this.controlSetId( kwargs.controlSet );
1036 this.controlSetId( this.controlSetList().sort(function(a,b){return (a - b)}) );
1042 MARC21.Record._recType = {
1043 BKS : { Type : /[at]{1}/, BLvl : /[acdm]{1}/ },
1044 SER : { Type : /[a]{1}/, BLvl : /[bsi]{1}/ },
1045 VIS : { Type : /[gkro]{1}/, BLvl : /[abcdmsi]{1}/ },
1046 MIX : { Type : /[p]{1}/, BLvl : /[cdi]{1}/ },
1047 MAP : { Type : /[ef]{1}/, BLvl : /[abcdmsi]{1}/ },
1048 SCO : { Type : /[cd]{1}/, BLvl : /[abcdmsi]{1}/ },
1049 REC : { Type : /[ij]{1}/, BLvl : /[abcdmsi]{1}/ },
1050 COM : { Type : /[m]{1}/, BLvl : /[abcdmsi]{1}/ },
1051 AUT : { Type : /[z]{1}/, BLvl : /.{1}/ },
1052 MFHD : { Type : /[uvxy]{1}/, BLvl : /.{1}/ }
1055 MARC21.Record._ff_pos = {
1058 SCO : {start: 24, len : 6, def : ' ' },
1059 REC : {start: 24, len : 6, def : ' ' }
1062 SCO : {start: 7, len : 6, def : ' ' },
1063 REC : {start: 7, len : 6, def : ' ' }
1068 SER : {start : 33, len : 1, def : ' ' }
1071 SER : {start : 16, len : 1, def : ' ' }
1076 BKS : {start : 22, len : 1, def : ' ' },
1077 SER : {start : 22, len : 1, def : ' ' },
1078 VIS : {start : 22, len : 1, def : ' ' },
1079 SCO : {start : 22, len : 1, def : ' ' },
1080 REC : {start : 22, len : 1, def : ' ' },
1081 COM : {start : 22, len : 1, def : ' ' }
1084 BKS : {start : 5, len : 1, def : ' ' },
1085 SER : {start : 5, len : 1, def : ' ' },
1086 VIS : {start : 5, len : 1, def : ' ' },
1087 SCO : {start : 5, len : 1, def : ' ' },
1088 REC : {start : 5, len : 1, def : ' ' },
1089 COM : {start : 5, len : 1, def : ' ' }
1094 BKS : {start : 34, len : 1, def : ' ' }
1097 BKS : {start : 17, len : 1, def : ' ' }
1102 BKS : {start : 7, len : 1, def : 'm' },
1103 SER : {start : 7, len : 1, def : 's' },
1104 VIS : {start : 7, len : 1, def : 'm' },
1105 MIX : {start : 7, len : 1, def : 'c' },
1106 MAP : {start : 7, len : 1, def : 'm' },
1107 SCO : {start : 7, len : 1, def : 'm' },
1108 REC : {start : 7, len : 1, def : 'm' },
1109 COM : {start : 7, len : 1, def : 'm' }
1114 SCO : {start : 18, len : 2, def : 'uu'},
1115 REC : {start : 18, len : 2, def : 'uu'}
1118 SCO : {start : 1, len : 2, def : 'uu'},
1119 REC : {start : 1, len : 2, def : 'uu'}
1124 BKS : {start : 29, len : 1, def : '0' },
1125 SER : {start : 29, len : 1, def : '0' }
1128 BKS : {start : 11, len : 1, def : '0' },
1129 SER : {start : 11, len : 1, def : '0' }
1134 BKS : {start : 24, len : 4, def : ' ' },
1135 SER : {start : 25, len : 3, def : ' ' }
1138 BKS : {start : 7, len : 4, def : ' ' },
1139 SER : {start : 8, len : 3, def : ' ' }
1144 MAP : {start: 25, len : 1, def : 'a' }
1147 MAP : {start : 8, len : 1, def : 'a' }
1152 BKS : {start : 8, len : 1, def : ' ' },
1153 SER : {start : 8, len : 1, def : ' ' },
1154 VIS : {start : 8, len : 1, def : ' ' },
1155 MIX : {start : 8, len : 1, def : ' ' },
1156 MAP : {start : 8, len : 1, def : ' ' },
1157 SCO : {start : 8, len : 1, def : ' ' },
1158 REC : {start : 8, len : 1, def : ' ' },
1159 COM : {start : 8, len : 1, def : ' ' }
1164 BKS : {start : 15, len : 3, def : ' ' },
1165 SER : {start : 15, len : 3, def : ' ' },
1166 VIS : {start : 15, len : 3, def : ' ' },
1167 MIX : {start : 15, len : 3, def : ' ' },
1168 MAP : {start : 15, len : 3, def : ' ' },
1169 SCO : {start : 15, len : 3, def : ' ' },
1170 REC : {start : 15, len : 3, def : ' ' },
1171 COM : {start : 15, len : 3, def : ' ' }
1176 BKS : {start : 7, len : 4, def : ' ' },
1177 SER : {start : 7, len : 4, def : ' ' },
1178 VIS : {start : 7, len : 4, def : ' ' },
1179 MIX : {start : 7, len : 4, def : ' ' },
1180 MAP : {start : 7, len : 4, def : ' ' },
1181 SCO : {start : 7, len : 4, def : ' ' },
1182 REC : {start : 7, len : 4, def : ' ' },
1183 COM : {start : 7, len : 4, def : ' ' }
1188 BKS : {start : 11, len : 4, def : ' ' },
1189 SER : {start : 11, len : 4, def : '9' },
1190 VIS : {start : 11, len : 4, def : ' ' },
1191 MIX : {start : 11, len : 4, def : ' ' },
1192 MAP : {start : 11, len : 4, def : ' ' },
1193 SCO : {start : 11, len : 4, def : ' ' },
1194 REC : {start : 11, len : 4, def : ' ' },
1195 COM : {start : 11, len : 4, def : ' ' }
1200 BKS : {start : 18, len : 1, def : ' ' },
1201 SER : {start : 18, len : 1, def : ' ' },
1202 VIS : {start : 18, len : 1, def : ' ' },
1203 MIX : {start : 18, len : 1, def : ' ' },
1204 MAP : {start : 18, len : 1, def : ' ' },
1205 SCO : {start : 18, len : 1, def : ' ' },
1206 REC : {start : 18, len : 1, def : ' ' },
1207 COM : {start : 18, len : 1, def : ' ' }
1212 BKS : {start : 6, len : 1, def : ' ' },
1213 SER : {start : 6, len : 1, def : 'c' },
1214 VIS : {start : 6, len : 1, def : ' ' },
1215 MIX : {start : 6, len : 1, def : ' ' },
1216 MAP : {start : 6, len : 1, def : ' ' },
1217 SCO : {start : 6, len : 1, def : ' ' },
1218 REC : {start : 6, len : 1, def : ' ' },
1219 COM : {start : 6, len : 1, def : ' ' }
1224 BKS : {start : 17, len : 1, def : ' ' },
1225 SER : {start : 17, len : 1, def : ' ' },
1226 VIS : {start : 17, len : 1, def : ' ' },
1227 MIX : {start : 17, len : 1, def : ' ' },
1228 MAP : {start : 17, len : 1, def : ' ' },
1229 SCO : {start : 17, len : 1, def : ' ' },
1230 REC : {start : 17, len : 1, def : ' ' },
1231 COM : {start : 17, len : 1, def : ' ' },
1232 AUT : {start : 17, len : 1, def : 'n' },
1233 MFHD : {start : 17, len : 1, def : 'u' }
1238 SER : {start : 24, len : 1, def : ' '}
1241 SER : {start : 7, len : 1, def : ' '}
1246 BKS : {start : 30, len : 1, def : '0' }
1249 BKS : {start : 13, len : 1, def : '0' }
1254 COM : {start: 26, len : 1, def : 'u' }
1257 COM : {start: 9, len : 1, def : 'u' }
1262 SCO : {start : 20, len : 1, def : 'u'},
1263 REC : {start : 20, len : 1, def : 'n'}
1266 SCO : {start : 3, len : 1, def : 'u'},
1267 REC : {start : 3, len : 1, def : 'n'}
1272 BKS : {start : 23, len : 1, def : ' ' },
1273 SER : {start : 23, len : 1, def : ' ' },
1274 VIS : {start : 29, len : 1, def : ' ' },
1275 MIX : {start : 23, len : 1, def : ' ' },
1276 MAP : {start : 29, len : 1, def : ' ' },
1277 SCO : {start : 23, len : 1, def : ' ' },
1278 REC : {start : 23, len : 1, def : ' ' }
1281 BKS : {start : 6, len : 1, def : ' ' },
1282 SER : {start : 6, len : 1, def : ' ' },
1283 VIS : {start : 12, len : 1, def : ' ' },
1284 MIX : {start : 6, len : 1, def : ' ' },
1285 MAP : {start : 12, len : 1, def : ' ' },
1286 SCO : {start : 6, len : 1, def : ' ' },
1287 REC : {start : 6, len : 1, def : ' ' }
1292 SER : {start : 18, len : 1, def : ' '}
1295 SER : {start : 1, len : 1, def : ' '}
1300 BKS : {start : 28, len : 1, def : ' ' },
1301 SER : {start : 28, len : 1, def : ' ' },
1302 VIS : {start : 28, len : 1, def : ' ' },
1303 MAP : {start : 28, len : 1, def : ' ' },
1304 COM : {start : 28, len : 1, def : ' ' }
1307 BKS : {start : 11, len : 1, def : ' ' },
1308 SER : {start : 11, len : 1, def : ' ' },
1309 VIS : {start : 11, len : 1, def : ' ' },
1310 MAP : {start : 11, len : 1, def : ' ' },
1311 COM : {start : 11, len : 1, def : ' ' }
1316 BKS : {start : 18, len : 4, def : ' ' }
1319 BKS : {start : 1, len : 4, def : ' ' }
1324 BKS : {start : 31, len : 1, def : '0' },
1325 MAP : {start : 31, len : 1, def : '0' }
1328 BKS : {start : 14, len : 1, def : '0' },
1329 MAP : {start : 14, len : 1, def : '0' }
1334 MFHD : {start : 18, len : 1, def : 'i' }
1339 BKS : {start : 35, len : 3, def : ' ' },
1340 SER : {start : 35, len : 3, def : ' ' },
1341 VIS : {start : 35, len : 3, def : ' ' },
1342 MIX : {start : 35, len : 3, def : ' ' },
1343 MAP : {start : 35, len : 3, def : ' ' },
1344 SCO : {start : 35, len : 3, def : ' ' },
1345 REC : {start : 35, len : 3, def : ' ' },
1346 COM : {start : 35, len : 3, def : ' ' }
1351 BKS : {start : 33, len : 1, def : '0' }
1354 BKS : {start : 16, len : 1, def : '0' }
1359 SCO : {start : 30, len : 2, def : 'n'},
1360 REC : {start : 30, len : 2, def : ' '}
1363 SCO : {start : 13, len : 2, def : 'n'},
1364 REC : {start : 13, len : 2, def : ' '}
1369 BKS : {start : 38, len : 1, def : ' ' },
1370 SER : {start : 38, len : 1, def : ' ' },
1371 VIS : {start : 38, len : 1, def : ' ' },
1372 MIX : {start : 38, len : 1, def : ' ' },
1373 MAP : {start : 38, len : 1, def : ' ' },
1374 SCO : {start : 38, len : 1, def : ' ' },
1375 REC : {start : 38, len : 1, def : ' ' },
1376 COM : {start : 38, len : 1, def : ' ' }
1381 SER : {start : 22, len : 1, def : ' '}
1384 SER : {start: 5, len : 1, def: ' '}
1389 SCO : {start : 21, len : 1, def : ' '},
1390 REC : {start : 21, len : 1, def : 'n'}
1393 SCO : {start : 4, len : 1, def : ' '},
1394 REC : {start : 4, len : 1, def : 'n'}
1399 MAP : {start : 22, len : 2, def : ' ' }
1402 MAP: {start : 5, len : 2, def : ' ' }
1407 BKS : {start : 5, len : 1, def : 'n' },
1408 SER : {start : 5, len : 1, def : 'n' },
1409 VIS : {start : 5, len : 1, def : 'n' },
1410 MIX : {start : 5, len : 1, def : 'n' },
1411 MAP : {start : 5, len : 1, def : 'n' },
1412 SCO : {start : 5, len : 1, def : 'n' },
1413 REC : {start : 5, len : 1, def : 'n' },
1414 COM : {start : 5, len : 1, def : 'n' },
1415 MFHD: {start : 5, len : 1, def : 'n' },
1416 AUT : {start : 5, len : 1, def : 'n' }
1421 SER : {start : 19, len : 1, def : ' '}
1424 SER : {start : 2, len : 1, def : ' '}
1429 MAP : {start: 18, len : 4, def : ' '}
1432 MAP : {start: 1, len : 4, def : ' '}
1437 SER : {start : 34, len : 1, def : '0' }
1440 SER : {start : 17, len : 1, def : '0' }
1445 MAP : {start: 33, len : 2, def : ' ' }
1448 MAP : {start: 16, len : 2, def : ' '}
1453 BKS : {start : 39, len : 1, def : 'd' },
1454 SER : {start : 39, len : 1, def : 'd' },
1455 VIS : {start : 39, len : 1, def : 'd' },
1456 SCO : {start : 39, len : 1, def : 'd' },
1457 REC : {start : 39, len : 1, def : 'd' },
1458 COM : {start : 39, len : 1, def : 'd' },
1459 MFHD : {start : 39, len : 1, def : 'd' },
1460 "AUT" : {"start" : 39, "len" : 1, "def" : 'd' }
1465 SER : {start : 21, len : 1, def : ' '}
1468 SER : {start : 4, len : 1, def : ' '}
1473 VIS : {start : 34, len : 1, def : ' '}
1476 VIS : {start : 17, len : 1, def : ' '}
1481 VIS : {start : 18, len : 3, def : ' '}
1484 VIS : {start : 1, len : 3, def : ' '}
1489 VIS : {start : 33, len : 1, def : ' ' }
1492 VIS : {start : 16, len : 1, def : ' ' }
1497 SCO : {start : 33, len : 1, def : ' ' },
1498 REC : {start : 33, len : 1, def : 'n' }
1501 SCO : {start : 16, len : 1, def : ' ' },
1502 REC : {start : 16, len : 1, def : 'n' }
1507 BKS : {start : 6, len : 1, def : 'a' },
1508 SER : {start : 6, len : 1, def : 'a' },
1509 VIS : {start : 6, len : 1, def : 'g' },
1510 MIX : {start : 6, len : 1, def : 'p' },
1511 MAP : {start : 6, len : 1, def : 'e' },
1512 SCO : {start : 6, len : 1, def : 'c' },
1513 REC : {start : 6, len : 1, def : 'i' },
1514 COM : {start : 6, len : 1, def : 'm' },
1515 AUT : {start : 6, len : 1, def : 'z' },
1516 MFHD : {start : 6, len : 1, def : 'y' }
1521 "AUT" : {"start" : 6, "len" : 1, "def" : ' ' }
1526 "AUT" : {"start" : 7, "len" : 1, "def" : ' ' }
1531 "AUT" : {"start" : 8, "len" : 1, "def" : ' ' }
1536 "AUT" : {"start" : 9, "len" : 1, "def" : ' ' }
1541 "AUT" : {"start" : 10, "len" : 1, "def" : ' ' }
1546 "AUT" : {"start" : 11, "len" : 1, "def" : ' ' }
1551 "AUT" : {"start" : 12, "len" : 1, "def" : ' ' }
1556 "AUT" : {"start" : 13, "len" : 1, "def" : ' ' }
1561 "AUT" : {"start" : 14, "len" : 1, "def" : ' ' }
1566 "AUT" : {"start" : 15, "len" : 1, "def" : ' ' }
1571 "AUT" : {"start" : 16, "len" : 1, "def" : ' ' }
1576 "AUT" : {"start" : 17, "len" : 1, "def" : ' ' }
1581 "AUT" : {"start" : 28, "len" : 1, "def" : ' ' }
1586 "AUT" : {"start" : 29, "len" : 1, "def" : ' ' }
1591 "AUT" : {"start" : 31, "len" : 1, "def" : ' ' }
1596 "AUT" : {"start" : 32, "len" : 1, "def" : ' ' }
1601 "AUT" : {"start" : 33, "len" : 1, "def" : ' ' }
1606 "AUT" : {"start" : 38, "len" : 1, "def" : ' ' }
1611 "AUT" : {"start" : 39, "len" : 1, "def" : ' ' }
1616 MARC21.Record._physical_characteristics = {
1618 label : "Electronic Resource",
1623 values: { a : "Tape Cartridge",
1624 b : "Chip cartridge",
1625 c : "Computer optical disk cartridge",
1626 f : "Tape cassette",
1628 j : "Magnetic disk",
1629 m : "Magneto-optical disk",
1639 values: { a : "One color",
1640 b : "Black-and-white",
1644 n : "Not applicable",
1651 label : "Dimensions",
1652 values: { a : "3 1/2 in.",
1654 g : "4 3/4 in. or 12 cm.",
1655 i : "1 1/8 x 2 3/8 in.",
1656 j : "3 7/8 x 2 1/2 in.",
1657 n : "Not applicable",
1667 values: { ' ' : "No sound (Silent)",
1674 label : "Image bit depth",
1675 values: { mmm : "Multiple",
1676 nnn : "Not applicable",
1682 label : "File formats",
1683 values: { a : "One file format",
1684 m : "Multiple file formats",
1690 label : "Quality assurance target(s)",
1691 values: { a : "Absent",
1692 n : "Not applicable",
1699 label : "Antecedent/Source",
1700 values: { a : "File reproduced from original",
1701 b : "File reproduced from microform",
1702 c : "File reproduced from electronic resource",
1703 d : "File reproduced from an intermediate (not microform)",
1705 n : "Not applicable",
1711 label : "Level of compression",
1712 values: { a : "Uncompressed",
1721 label : "Reformatting quality",
1722 values: { a : "Access",
1723 n : "Not applicable",
1737 values: { a : "Celestial globe",
1738 b : "Planetary or lunar globe",
1739 c : "Terrestrial globe",
1740 e : "Earth moon globe",
1748 values: { a : "One color",
1754 label : "Physical medium",
1755 values: { a : "Paper",
1769 label : "Type of reproduction",
1770 values: { f : "Facsimile",
1771 n : "Not applicable",
1784 values: { d : "Atlas",
1789 r : "Remote-sensing image",
1799 values: { a : "One color",
1805 label : "Physical medium",
1806 values: { a : "Paper",
1814 q : "Flexible base photographic medium, positive",
1815 r : "Flexible base photographic medium, negative",
1816 s : "Non-flexible base photographic medium, positive",
1817 t : "Non-flexible base photographic medium, negative",
1819 y : "Other photographic medium",
1825 label : "Type of reproduction",
1826 values: { f : "Facsimile",
1827 n : "Not applicable",
1834 label : "Production/reproduction details",
1835 values: { a : "Photocopy, blueline print",
1837 c : "Pre-production",
1845 label : "Positive/negative",
1846 values: { a : "Positive",
1849 n : "Not applicable"
1855 label : "Microform",
1860 values: { a : "Aperture card",
1861 b : "Microfilm cartridge",
1862 c : "Microfilm cassette",
1863 d : "Microfilm reel",
1865 f : "Microfiche cassette",
1873 label : "Positive/negative",
1874 values: { a : "Positive",
1882 label : "Dimensions",
1883 values: { a : "8 mm.",
1888 l : "3 x 5 in. (8 x 13 cm.)",
1889 m : "4 x 6 in. (11 x 15 cm.)",
1890 o : "6 x 9 in. (16 x 23 cm.)",
1891 p : "3 1/4 x 7 3/8 in. (9 x 19 cm.)",
1898 label : "Reduction ratio range/Reduction ratio",
1899 values: { a : "Low (1-16x)",
1900 b : "Normal (16-30x)",
1901 c : "High (31-60x)",
1902 d : "Very high (61-90x)",
1905 v : "Reduction ratio varies"
1911 values: { b : "Black-and-white",
1920 label : "Emulsion on film",
1921 values: { a : "Silver halide",
1925 n : "Not applicable",
1932 label : "Quality assurance target(s)",
1933 values: { a : "1st gen. master",
1934 b : "Printing master",
1936 m : "Mixed generation",
1942 label : "Base of film",
1943 values: { a : "Safety base, undetermined",
1944 c : "Safety base, acetate undetermined",
1945 d : "Safety base, diacetate",
1948 n : "Not applicable",
1949 p : "Safety base, polyester",
1950 r : "Safety base, mixed",
1951 t : "Safety base, triacetate",
1959 label : "Motion Picture",
1964 values: { a : "Film cartridge",
1965 f : "Film cassette",
1974 values: { b : "Black-and-white",
1984 label : "Motion picture presentation format",
1985 values: { a : "Standard sound aperture, reduced frame",
1986 b : "Nonanamorphic (wide-screen)",
1988 d : "Anamorphic (wide-screen)",
1989 e : "Other-wide screen format",
1990 f : "Standard. silent aperture, full frame",
1997 label : "Sound on medium or separate",
1998 values: { a : "Sound on medium",
1999 b : "Sound separate from medium",
2005 label : "Medium for sound",
2006 values: { a : "Optical sound track on motion picture film",
2007 b : "Magnetic sound track on motion picture film",
2008 c : "Magnetic audio tape in cartridge",
2010 e : "Magnetic audio tape on reel",
2011 f : "Magnetic audio tape in cassette",
2012 g : "Optical and magnetic sound track on film",
2021 label : "Dimensions",
2022 values: { a : "Standard 8 mm.",
2023 b : "Super 8 mm./single 8 mm.",
2035 label : "Configuration of playback channels",
2036 values: { k : "Mixed",
2038 n : "Not applicable",
2039 q : "Multichannel, surround or quadraphonic",
2047 label : "Production elements",
2048 values: { a : "Work print",
2052 e : "Mixing tracks",
2053 f : "Title bands/inter-title rolls",
2054 g : "Production rolls",
2055 n : "Not applicable",
2062 label : "Non-projected Graphic",
2067 values: { c : "Collage",
2070 f : "Photo-mechanical print",
2071 g : "Photonegative",
2075 l : "Technical drawing",
2077 o : "Flash/activity card",
2085 values: { a : "One color",
2086 b : "Black-and-white",
2096 label : "Primary support material",
2097 values: { a : "Canvas",
2098 b : "Bristol board",
2099 c : "Cardboard/illustration board",
2105 m : "Mixed collection",
2118 label : "Secondary support material",
2119 values: { a : "Canvas",
2120 b : "Bristol board",
2121 c : "Cardboard/illustration board",
2127 m : "Mixed collection",
2141 label : "Projected Graphic",
2146 values: { c : "Film cartridge",
2148 f : "Film filmstrip type",
2149 o : "Filmstrip roll",
2158 values: { b : "Black-and-white",
2162 n : "Not applicable",
2169 label : "Base of emulsion",
2170 values: { d : "Glass",
2173 k : "Film base, other than safety film",
2174 m : "Mixed collection",
2182 label : "Sound on medium or separate",
2183 values: { a : "Sound on medium",
2184 b : "Sound separate from medium",
2190 label : "Medium for sound",
2191 values: { a : "Optical sound track on motion picture film",
2192 b : "Magnetic sound track on motion picture film",
2193 c : "Magnetic audio tape in cartridge",
2195 e : "Magnetic audio tape on reel",
2196 f : "Magnetic audio tape in cassette",
2197 g : "Optical and magnetic sound track on film",
2206 label : "Dimensions",
2207 values: { a : "Standard 8 mm.",
2208 b : "Super 8 mm./single 8 mm.",
2214 j : "2 x 2 in. (5 x 5 cm.)",
2215 k : "2 1/4 x 2 1/4 in. (6 x 6 cm.)",
2216 s : "4 x 5 in. (10 x 13 cm.)",
2217 t : "5 x 7 in. (13 x 18 cm.)",
2218 v : "8 x 10 in. (21 x 26 cm.)",
2219 w : "9 x 9 in. (23 x 23 cm.)",
2220 x : "10 x 10 in. (26 x 26 cm.)",
2221 y : "7 x 7 in. (18 x 18 cm.)",
2228 label : "Secondary support material",
2229 values: { c : "Cardboard",
2233 j : "Metal and glass",
2234 k : "Synthetics and glass",
2235 m : "Mixed collection",
2243 label : "Remote-sensing Image",
2248 values: { u : "Unspecified" }
2252 label : "Altitude of sensor",
2253 values: { a : "Surface",
2256 n : "Not applicable",
2263 label : "Attitude of sensor",
2264 values: { a : "Low oblique",
2267 n : "Not applicable",
2273 label : "Cloud cover",
2274 values: { 0 : "0-09%",
2284 n : "Not applicable",
2290 label : "Platform construction type",
2291 values: { a : "Balloon",
2292 b : "Aircraft-low altitude",
2293 c : "Aircraft-medium altitude",
2294 d : "Aircraft-high altitude",
2295 e : "Manned spacecraft",
2296 f : "Unmanned spacecraft",
2297 g : "Land-based remote-sensing device",
2298 h : "Water surface-based remote-sensing device",
2299 i : "Submersible remote-sensing device",
2300 n : "Not applicable",
2307 label : "Platform use category",
2308 values: { a : "Meteorological",
2309 b : "Surface observing",
2310 c : "Space observing",
2312 n : "Not applicable",
2319 label : "Sensor type",
2320 values: { a : "Active",
2328 label : "Data type",
2329 values: { nn : "Not applicable",
2332 aa : "Visible light",
2333 da : "Near infrared",
2334 db : "Middle infrared",
2335 dc : "Far infrared",
2336 dd : "Thermal infrared",
2337 de : "Shortwave infrared (SWIR)",
2338 df : "Reflective infrared",
2339 dv : "Combinations",
2340 dz : "Other infrared data",
2341 ga : "Sidelooking airborne radar (SLAR)",
2342 gb : "Synthetic aperture radar (SAR-single frequency)",
2343 gc : "SAR-multi-frequency (multichannel)",
2344 gd : "SAR-like polarization",
2345 ge : "SAR-cross polarization",
2346 gf : "Infometric SAR",
2347 gg : "Polarmetric SAR",
2348 gu : "Passive microwave mapping",
2349 gz : "Other microwave data",
2350 ja : "Far ultraviolet",
2351 jb : "Middle ultraviolet",
2352 jc : "Near ultraviolet",
2353 jv : "Ultraviolet combinations",
2354 jz : "Other ultraviolet data",
2355 ma : "Multi-spectral, multidata",
2356 mb : "Multi-temporal",
2357 mm : "Combination of various data types",
2358 pa : "Sonar-water depth",
2359 pb : "Sonar-bottom topography images, sidescan",
2360 pc : "Sonar-bottom topography, near-surface",
2361 pd : "Sonar-bottom topography, near-bottom",
2362 pe : "Seismic surveys",
2363 pz : "Other acoustical data",
2364 ra : "Gravity anomales (general)",
2368 sa : "Magnetic field",
2369 ta : "Radiometric surveys"
2375 label : "Sound Recording",
2380 values: { d : "Sound disc",
2382 g : "Sound cartridge",
2383 i : "Sound-track film",
2385 s : "Sound cassette",
2386 t : "Sound-tape reel",
2388 w : "Wire recording",
2395 values: { a : "16 rpm",
2415 label : "Configuration of playback channels",
2416 values: { m : "Monaural",
2425 label : "Groove width or pitch",
2426 values: { m : "Microgroove/fine",
2427 n : "Not applicable",
2428 s : "Coarse/standard",
2435 label : "Dimensions",
2436 values: { a : "3 in.",
2442 g : "4 3/4 in. (12 cm.)",
2443 j : "3 7/8 x 2 1/2 in.",
2444 o : "5 1/4 x 3 7/8 in.",
2445 s : "2 3/4 x 4 in.",
2446 n : "Not applicable",
2453 label : "Tape width",
2454 values: { l : "1/8 in.",
2456 n : "Not applicable",
2465 label : "Tape configuration ",
2466 values: { a : "Full (1) track",
2467 b : "Half (2) track",
2468 c : "Quarter (4) track",
2472 n : "Not applicable",
2479 label : "Special playback",
2480 values: { a : "NAB standard",
2481 b : "CCIR standard",
2482 c : "Dolby-B encoded, standard Dolby",
2484 e : "Digital recording",
2485 f : "Dolby-A encoded",
2486 g : "Dolby-C encoded",
2488 n : "Not applicable",
2495 label : "Capture and storage",
2496 values: { a : "Acoustical capture, direct storage",
2497 b : "Direct storage, not acoustical",
2498 d : "Digital storage",
2499 e : "Analog electrical storage",
2507 label : "Tactile Material",
2512 values: { a : "Moon",
2515 d : "Tactile, with no writing system",
2522 label : "Class of braille writing",
2523 values: { a : "Literary braille",
2524 b : "Format code braille",
2525 c : "Mathematics and scientific braille",
2526 d : "Computer braille",
2527 e : "Music braille",
2528 m : "Multiple braille types",
2529 n : "Not applicable",
2536 label : "Level of contraction",
2537 values: { a : "Uncontracted",
2540 n : "Not applicable",
2547 label : "Braille music format",
2548 values: { a : "Bar over bar",
2550 c : "Line over line",
2553 f : "Section by section",
2556 i : "Spanner short form scoring",
2557 j : "Short form scoring",
2559 l : "Vertical score",
2560 n : "Not applicable",
2567 label : "Special physical characteristics",
2568 values: { a : "Print/braille",
2569 b : "Jumbo or enlarged braille",
2570 n : "Not applicable",
2578 label : "Videorecording",
2583 values: { c : "Videocartridge",
2585 f : "Videocassette",
2594 values: { b : "Black-and-white",
2597 n : "Not applicable",
2604 label : "Videorecording format",
2605 values: { a : "Beta",
2627 label : "Sound on medium or separate",
2628 values: { a : "Sound on medium",
2629 b : "Sound separate from medium",
2635 label : "Medium for sound",
2636 values: { a : "Optical sound track on motion picture film",
2637 b : "Magnetic sound track on motion picture film",
2638 c : "Magnetic audio tape in cartridge",
2640 e : "Magnetic audio tape on reel",
2641 f : "Magnetic audio tape in cassette",
2642 g : "Optical and magnetic sound track on motion picture film",
2651 label : "Dimensions",
2652 values: { a : "8 mm.",
2664 label : "Configuration of playback channel",
2665 values: { k : "Mixed",
2667 n : "Not applicable",
2668 q : "Multichannel, surround or quadraphonic",
2678 MARC21.AuthorityControlSet._remote_loaded = false;
2679 MARC21.AuthorityControlSet._remote_parsed = false;
2681 MARC21.AuthorityControlSet._controlsets = {
2682 // static sorta-LoC setup ... to be overwritten with server data
2685 name : 'Static LoC legacy mapping',
2686 description : 'Legacy mapping provided as a default',
2689 'a' : { 100 : 'a' },
2690 'd' : { 100 : 'd' },
2691 'e' : { 100 : 'e' },
2695 'a' : { 110 : 'a' },
2699 'a' : { 111 : 'a' },
2703 'a' : { 130 : 'a' },
2707 'a' : { 130 : 'a' },
2711 'a' : { 100 : 'a' },
2715 'a' : { 110 : 'a' },
2719 'a' : { 111 : 'a' },
2723 'a' : { 130 : 'a' },
2724 'n' : { 130 : 'n' },
2728 'a' : { 100 : 'a' },
2729 'd' : { 100 : 'd' },
2730 'q' : { 100 : 'q' },
2734 'a' : { 110 : 'a' },
2738 'a' : { 111 : 'a' },
2739 'c' : { 111 : 'c' },
2743 'a' : { 130 : 'a' },
2747 'a' : { 100 : 'a' },
2751 'a' : { 110 : 'a' },
2755 'a' : { 111 : 'a' },
2759 'a' : { 130 : 'a' },
2763 'a' : { 100 : 'a' },
2764 'd' : { 100 : 'd' },
2765 'q' : { 100 : 'q' },
2766 't' : { 100 : 't' },
2793 'a' : { 110 : 'a' },
2794 'd' : { 110 : 'd' },
2795 't' : { 110 : 't' },
2822 'a' : { 111 : 'a' },
2823 'd' : { 111 : 'd' },
2824 't' : { 111 : 't' },
2851 'a' : { 130 : 'a' },
2855 'a' : { 148 : 'a' },
2856 'v' : { 148 : 'v' },
2857 'x' : { 148 : 'x' },
2858 'y' : { 148 : 'y' },
2862 'a' : { 150 : 'a' },
2863 'b' : { 150 : 'b' },
2890 'a' : { 151 : 'a' },
2917 'a' : { 155 : 'a' },