]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/marc_view.html
marc_view i18n
[Evergreen.git] / Open-ILS / xul / staff_client / server / cat / marc_view.html
1 <html>
2 <head>
3 <style>
4 .marc_subfield_code { color: blue; padding-left: 5px; padding-right: 5px }
5 </style>
6 <script src="/xul/server/main/constants.js"></script>
7 <script>
8 <!--
9
10         var xsltProcessor;
11
12         function xsl_marc2html_init() {
13         try {
14                 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
15                 xsltProcessor = new XSLTProcessor();
16                 var req = new XMLHttpRequest();
17                 req.open("GET", urls.xsl_marc2html, false);
18                 req.send(null);
19             if (req.status != 200) {
20                 alert('We were unable to load ' + urls.xsl_marc2html + ' and thus cannot display the MARC here.\nReason: ' + req.statusText);
21                 return false;
22             }
23                 var xsl = req.responseXML;
24                 xsltProcessor.importStylesheet(xsl);
25             return true;
26         } catch(E) {
27             alert('An error occurred and we are unable to display the MARC here.\nError in xsl_marc2html_init: ' + E);
28             return false;
29         }
30         }
31
32         function apply_xsl_marc2html(marc) {
33         try {
34                 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
35             var obj = this;
36             var parser = new DOMParser();
37             var doc = parser.parseFromString( marc, 'text/xml' );
38             var node = doc.documentElement;
39             var fragment = xsltProcessor.transformToFragment(node, document);
40             document.body.appendChild(fragment);
41         } catch(E) {
42             alert('An error occurred and we are unable to display the MARC here.\nError in apply_xsl_marc2html: ' + E);
43         }
44         }
45
46         function my_init() {
47                 if (!xsl_marc2html_init()) return;
48                 document.body.innerHTML = "<button onclick='window.print()'>Print Page</button>";
49                 if (typeof xulG != 'undefined' && xulG.marcxml) apply_xsl_marc2html(xulG.marcxml);
50                 document.body.firstChild.focus();
51         }
52
53 -->
54 </script>
55 </head>
56 <body onload="try { my_init(); } catch(E) { alert(E); }">
57 </body>
58 </html>