initial dojo-ified xul glue
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 Feb 2009 04:52:25 +0000 (04:52 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 Feb 2009 04:52:25 +0000 (04:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12215 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/XUL.js [new file with mode: 0644]

diff --git a/Open-ILS/web/js/dojo/openils/XUL.js b/Open-ILS/web/js/dojo/openils/XUL.js
new file mode 100644 (file)
index 0000000..80f4c09
--- /dev/null
@@ -0,0 +1,25 @@
+if(!dojo._hasResource["openils.XUL"]) {
+
+    dojo.provide("openils.XUL");
+    dojo.declare('openils.XUL', null, {});
+
+    openils.XUL.isXUL = function() {
+        return window.IAMXUL;
+    }
+    
+    openils.XUL.getStash = function() {
+        if(openils.XUL.isXUL()) {
+            try {
+                           netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                           var CacheClass = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS");
+                           return new CacheClass().wrappedJSObject.OpenILS.prototype.data;
+            } catch(e) {
+                console.log("Error loading XUL stash: " + e);
+            }
+        }
+
+        return {};
+    };
+}
+
+