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