[open-ils-commits] r16120 - trunk/Open-ILS/web/js/dojo/openils (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Apr 3 21:01:09 EDT 2010
Author: miker
Date: 2010-04-03 21:01:08 -0400 (Sat, 03 Apr 2010)
New Revision: 16120
Modified:
trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
Log:
add metarecord support to BibTemplate
Modified: trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js 2010-04-03 20:46:54 UTC (rev 16119)
+++ trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js 2010-04-04 01:01:08 UTC (rev 16120)
@@ -25,30 +25,39 @@
this.root = kwargs.root;
this.record = kwargs.record;
this.org_unit = kwargs.org_unit || '-';
+
+ this.mode = 'biblio-record_entry';
+ this.default_datatype = 'marcxml-uris';
+ if (kwargs.metarecord) {
+ this.record = kwargs.metarecord;
+ this.mode = 'metabib-metarecord';
+ this.default_datatype = 'mods';
+ }
},
render : function() {
var all_slots = dojo.query('*[type^=opac/slot-data]', this.root);
+ var default_datatype = this.default_datatype;
var slots = {};
dojo.forEach(all_slots, function(s){
// marcxml-uris does not include copies, which avoids timeouts
// with bib records that have hundreds or thousands of copies
- var datatype = 'marcxml-uris';
+ var current_datatype = default_datatype;
if (s.getAttribute('type').indexOf('+') > -1)
- datatype = s.getAttribute('type').split('+').reverse()[0];
+ current_datatype = s.getAttribute('type').split('+').reverse()[0];
- if (!slots[datatype]) slots[datatype] = [];
- slots[datatype].push(s);
+ if (!slots[current_datatype]) slots[current_datatype] = [];
+ slots[current_datatype].push(s);
});
for (var datatype in slots) {
- (function (slot_list,dtype,rec,org) {
+ (function (slot_list,dtype,mode,rec,org) {
dojo.xhrGet({
- url: '/opac/extras/unapi?id=tag:opac:biblio-record_entry/' + rec + '/' + org + '&format=' + datatype,
+ url: '/opac/extras/unapi?id=tag:opac:' + mode + '/' + rec + '/' + org + '&format=' + dtype,
handleAs: 'xml',
load: function (bib) {
@@ -76,7 +85,7 @@
}
});
- })(slots[datatype],datatype,this.record,this.org_unit);
+ })(slots[datatype],datatype,this.mode,this.record,this.org_unit);
}
More information about the open-ils-commits
mailing list