dojo.require("dojo.cookie");
dojo.require("dojox.xml.parser");
-dojo.require("openils.BibTemplate");
dojo.require("openils.widget.ProgressDialog");
var authtoken;
var cgi;
+// extract the title and author from a MARCXML string.
+function get_marc_bits(marcxml) {
+ var m100a = '';
+ var m100c = '';
+ var m245a = '';
+ var m245b = '';
+
+ var xmlDoc = new DOMParser().parseFromString(marcxml, 'text/xml');
+
+ dojo.forEach(
+ xmlDoc.documentElement.getElementsByTagName('datafield'),
+ function(node) {
+ var tag = node.getAttribute('tag');
+ if (tag == '100') {
+ dojo.forEach(node.childNodes, function(sub_node) {
+ var code = sub_node.getAttribute('code');
+ if (code == 'a') m100a = sub_node.textContent;
+ if (code == 'c') m100c = sub_node.textContent;
+ });
+ } else if (tag == '245') {
+ dojo.forEach(node.childNodes, function(sub_node) {
+ var code = sub_node.getAttribute('code');
+ if (code == 'a') m245a = sub_node.textContent;
+ if (code == 'b') m245b = sub_node.textContent;
+ });
+ }
+ }
+ );
+
+ return {
+ title : m100a + ' ' + m100c,
+ author : m245a + ' ' + m245b
+ };
+}
+
+
function do_pull_list() {
progress_dialog.show(true);
hold.current_copy.parts_stringified += ' ' + part.label();
});
+ var bits = get_marc_bits(
+ hold.current_copy.call_number.record.marc);
+
+ hold.title = bits.title;
+ hold.author = bits.author;
+
// clone the template's html
var tr = dojo.clone(
}
);
- new openils.BibTemplate({
- root : tr,
- xml : dojox.xml.parser.parse(hold.current_copy.call_number.record.marc),
- delay: false
- });
-
dojo.place(tr, "target");
});
},
var hold = hashify_fields(resp.hold_details);
hold.action = resp.action;
- var xmlDoc = new DOMParser().parseFromString(
- hold.current_copy.call_number.record.marc,"text/xml");
-
- var m100a = '';
- var m100c = '';
- var m245a = '';
- var m245b = '';
-
- dojo.forEach(
- xmlDoc.documentElement.getElementsByTagName('datafield'),
- function(node) {
- var tag = node.getAttribute('tag');
- if (tag == '100') {
- dojo.forEach(node.childNodes, function(sub_node) {
- var code = sub_node.getAttribute('code');
- if (code == 'a') m100a = sub_node.textContent;
- if (code == 'c') m100c = sub_node.textContent;
- });
- } else if (tag == '245') {
- dojo.forEach(node.childNodes, function(sub_node) {
- var code = sub_node.getAttribute('code');
- if (code == 'a') m245a = sub_node.textContent;
- if (code == 'b') m245b = sub_node.textContent;
- });
- }
- }
- );
+ var bits = get_marc_bits(
+ hold.current_copy.call_number.record.marc);
- hold.author = m100a + ' ' + m100c;
- hold.title = m245a + ' ' + m245b;
+ hold.title = bits.title;
+ hold.author = bits.author;
if(resp.hold_details.hold_type) {
hold.hold_type = resp.hold_details.hold_type;