2 # Extract MARC fields from XML
3 # get_marc_attrs( { marc_xml => doc } )
6 args.isbn = xml.findnodes('//*[@tag="020"]/*[@code="a"]').shift.textContent;
7 args.upc = xml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
8 args.issn = xml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
9 args.title = xml.findnodes('//*[@tag="245"]/*[@code="a"]').textContent;
10 args.author = xml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
11 args.publisher = xml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
12 args.pubdate = xml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
13 args.edition = xml.findnodes('//*[@tag="250"]/*[@code="a"]').textContent ||
14 xml.findnodes('//*[@tag="534"]/*[@code="b"]').textContent ||
15 xml.findnodes('//*[@tag="775"]/*[@code="b"]').textContent;
17 '//*[@tag="300"]/*[@code="a" or @code="b" or @code="c" or @code="e"]'
20 FOR p IN phys; phys_content.push(p.textContent); END;
21 args.phys_desc = phys_content.join("");
24 args.isbn_clean = args.isbn.replace('\ .*', '');
27 FOR holding IN xml.findnodes('//*[local-name()="volumes"]/*[local-name()="volume"]');
33 # Extract the copy count summary
34 count_type = (ctx.is_staff) ? 'staff' : 'public';
35 xpath = '//*[local-name()="counts"]/*[local-name()="count"][@type="' _ count_type _ '"]';
36 FOR node IN xml.findnodes(xpath);
37 args.copy_counts = {};
38 FOR attr IN ['count', 'available', 'unshadow', 'transcendant'];
39 args.copy_counts.$attr = node.getAttribute(attr);
43 # KCLS-specific stuff; needs to change
44 args.mattype = xml.findnodes('//*[@tag="998"]/*[@code="d"]').textContent;
45 args.kcls_cn = xml.findnodes('//*[@tag="092" or @tag="099"]/*').textContent;
46 mattype = args.mattype;
47 args.format = ctx.find_citm(mattype).value;
48 args.format_icon = icon_by_format.$mattype;
51 BLOCK get_hold_status;
52 IF hold.hold.status == 4;
54 IF ahr.shelf_expire_time;
55 l('<br/>Expires [_1]',
56 date.format(ctx.parse_datetime(ahr.shelf_expire_time), DATE_FORMAT));
58 ELSIF hold.hold.estimated_wait AND hold.hold.estimated_wait > 0;
59 # estimated wait is delivered as seconds.
60 SET hwait = POSIX.ceil(hold.hold.estimated_wait / 86400);
61 l("Estimated wait: [quant,_1,day,days]", hwait);
62 ELSIF hold.hold.status == 3;
64 ELSIF hold.hold.status < 3;
65 l("Waiting for copy");