in case marc_view.xul gets sent a pre-cat
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 18 Sep 2009 18:39:32 +0000 (18:39 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 18 Sep 2009 18:39:32 +0000 (18:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14055 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/marc_view.xul
Open-ILS/xul/staff_client/server/locale/en-US/cat.properties

index 67f8021..a45dadf 100644 (file)
@@ -61,16 +61,21 @@ vim:noet:sw=4:ts=4:
 
                                JSAN.use('util.network'); g.network = new util.network();
 
-                               g.network.request(
-                                       api.MARC_HTML_RETRIEVE.app,
-                                       api.MARC_HTML_RETRIEVE.method,
-                                       [ docid ],
-                                       function(req) {
-                                               marc_html = req.getResultObject();
-                                               if (noprint||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
-                                               document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + marc_html);
-                                       }
-                               );
+                if (docid > -1) {
+                    g.network.request(
+                        api.MARC_HTML_RETRIEVE.app,
+                        api.MARC_HTML_RETRIEVE.method,
+                        [ docid ],
+                        function(req) {
+                            var marc_html = req.getResultObject();
+                            if (noprint||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
+                            document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + marc_html);
+                        }
+                    );
+                } else {
+                    var marc_html = '<h1>' + document.getElementById('catStrings').getString('bib.no_marc') + '</h1>';
+                    document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + marc_html);
+                }
 
                        } catch(E) {
                                var err_msg = document.getElementById("commonStrings").getFormattedString('common.exception', ['cat/marc_view.xul', E]);
@@ -82,6 +87,8 @@ vim:noet:sw=4:ts=4:
        ]]>
        </script>
 
+    <messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale' -->/cat.properties"/>
+
        <groupbox flex="1">
                <caption label="&staff.cat.marc_view.title;"/>
                <iframe id="marc_frame" flex="1"/>
index bfa269e..3d3a295 100644 (file)
@@ -1,3 +1,4 @@
+bib.no_marc=No MARC Record
 cat.barcode_for_item=The barcode for the item is %1$s
 cat.batch_operation_failed=The whole batch operation failed. %1$s
 cat.copy_buckets.tab=Copy Buckets