backporting from staff-client-experiment: entry points for some of these extensions...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Feb 2009 00:57:29 +0000 (00:57 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Feb 2009 00:57:29 +0000 (00:57 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12249 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/auth/controller.js
Open-ILS/xul/staff_client/chrome/content/main/main.js
Open-ILS/xul/staff_client/chrome/content/main/main.xul
Open-ILS/xul/staff_client/server/main/data.xul

index d448397..c48565c 100644 (file)
@@ -60,6 +60,30 @@ auth.controller.prototype = {
                                                        obj.debug('js_console');
                                                }
                                        ],
+                    'cmd_debugger' : [
+                        ['command'],
+                        function() {
+                            start_debugger();
+                        }
+                    ],
+                    'cmd_inspector' : [
+                        ['command'],
+                        function() {
+                            start_inspector();
+                        }
+                    ],
+                    'cmd_chrome_list' : [
+                        ['command'],
+                        function() {
+                            start_chrome_list();
+                        }
+                    ],
+                    'cmd_js_shell' : [
+                        ['command'],
+                        function() {
+                            start_js_shell();
+                        }
+                    ],
                                        'cmd_override' : [
                                                ['command'],
                                                function() {
index 6a71274..95267d1 100644 (file)
@@ -1,6 +1,7 @@
 dump('entering main/main.js\n');
 // vim:noet:sw=4:ts=4:
 
+var xulG;
 var offlineStrings;
 var authStrings;
 
@@ -31,6 +32,47 @@ function clear_the_cache() {
        }
 }
 
+function toOpenWindowByType(inType, uri) { /* for Venkman */
+    try {
+       var winopts = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar";
+       window.open(uri, "_blank", winopts);
+    } catch(E) {
+        alert(E); throw(E);
+    }
+}
+
+function start_debugger() {
+    setTimeout(
+        function() {
+            try { start_venkman(); } catch(E) { alert(E); }
+        }, 0
+    );
+};
+
+function start_inspector() {
+    setTimeout(
+        function() {
+            try { inspectDOMDocument(); } catch(E) { alert(E); }
+        }, 0
+    );
+};
+
+function start_chrome_list() {
+    setTimeout(
+        function() {
+            try { startChromeList(); } catch(E) { alert(E); }
+        }, 0
+    );
+};
+
+function start_js_shell() {
+    setTimeout(
+        function() {
+            try { window.open('chrome://open_ils_staff_client/content/util/shell.html','shell','chrome,resizable,scrollbars'); } catch(E) { alert(E); }
+        }, 0
+    );
+};
+
 function main_init() {
        dump('entering main_init()\n');
        try {
@@ -47,6 +89,8 @@ function main_init() {
                }
                /////////////////////////////////////////////////////////////////////////////
 
+        var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+
                JSAN.errorLevel = "die"; // none, warn, or die
                JSAN.addRepository('..');
 
@@ -105,10 +149,11 @@ function main_init() {
 
                        grant_perms(url);
 
-                       var xulG = {
+                       xulG = {
                                'auth' : G.auth,
                                'url' : url,
-                               'window' : G.window
+                               'window' : G.window,
+                'data' : G.data
                        };
 
                        if (G.data.ws_info && G.data.ws_info[G.auth.controller.view.server_prompt.value]) {
@@ -118,6 +163,7 @@ function main_init() {
                                var iframe = document.createElement('iframe'); deck.appendChild(iframe);
                                iframe.setAttribute( 'src', url + '/xul/server/main/data.xul' );
                                iframe.contentWindow.xulG = xulG;
+                G.data_xul = iframe.contentWindow;
                        } else {
                                xulG.file = G.file;
                                var deck = G.auth.controller.view.ws_deck;
@@ -249,6 +295,11 @@ function main_init() {
                        version = 'versionless debug build';
                        document.getElementById('debug_gb').hidden = false;
                }
+
+        if (pref && pref.getBoolPref('open-ils.debug_options')) {
+                       document.getElementById('debug_gb').hidden = false;
+        }
+
         window.title = authStrings.getFormattedString('staff.auth.titlebar.label', version);
                var x = document.getElementById('about_btn');
                x.addEventListener(
@@ -267,9 +318,13 @@ function main_init() {
                        function() {
                                if (G.data.session) {
                                        try {
-                                               G.window.open('chrome://open_ils_staff_client/content/main/menu_frame.xul?server=' +
-                                                       G.data.server,'main','chrome,resizable' );
-
+                                               //G.data_xul.g.open_menu();
+                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                        var mframe = xulG.window.open(( String(urls.XUL_MENU_FRAME).match(/^chrome:/) ? '' : G.data.server ) + urls.XUL_MENU_FRAME
+                            + '?server='+window.escape(G.data.server),
+                            'main'+xulG.window.window_name_increment(),'chrome,resizable'
+                        );
+                        mframe.xulG = xulG; 
                                        } catch(E) { alert(E); }
                                } else {
                                        alert ( offlineStrings.getString('main.new_window_btn.login_first_warning') );
@@ -322,10 +377,7 @@ function main_init() {
                        false
                );
 
-        var pref = Components.classes["@mozilla.org/preferences-service;1"]
-                .getService(Components.interfaces.nsIPrefBranch);
-
-               if ( found_ws_info_in_Achrome() && pref.getBoolPref("open-ils.write_in_user_chrome_directory") ) {
+               if ( found_ws_info_in_Achrome() && pref && pref.getBoolPref("open-ils.write_in_user_chrome_directory") ) {
                        //var hbox = x.parentNode; var b = document.createElement('button'); 
                        //b.setAttribute('label','Migrate legacy settings'); hbox.appendChild(b);
                        //b.addEventListener(
index 5347bcb..a692c8f 100644 (file)
                dump("lang.version = &lang.version;" + '\n');
        </script>
 
+    <script type="text/javascript" src="chrome://venkman/content/venkman-overlay.js"/>
+    <script type="application/x-javascript" src="chrome://inspector/content/hooks.js"/>
+    <script type="application/x-javascript" src="chrome://chromelist/content/overlay/ChromeListOverlay.js" />
+
        <messagecatalog id="authStrings" src="chrome://open_ils_staff_client/locale/auth.properties"/>
        <messagecatalog id="offlineStrings" src="chrome://open_ils_staff_client/locale/offline.properties"/>
 
                <command id="cmd_standalone_export"/>
                <command id="cmd_standalone_import"/>
                <command id="cmd_js_console"/>
+               <command id="cmd_debugger"/>
+               <command id="cmd_inspector"/>
+               <command id="cmd_chrome_list"/>
+               <command id="cmd_js_shell"/>
                <command id="cmd_clear_cache"/>
                <command id="cmd_test_server"/>
                <command id="cmd_ssl_exception" hidden="true"/>
                <button label="&staff.auth.quit_prompt;" accesskey="&staff.auth.quit_prompt.accesskey;" command="cmd_close_window"/>
                <groupbox id="debug_gb" flex="1" hidden="true">
                        <caption label="&staff.main.auth.debug.caption;"/>
-                       <hbox>
-                               <button label="&staff.main.auth.debug.javascript;" accesskey="&staff.main.auth.debug.javascript.accesskey;" command="cmd_js_console"/>
-                               <button label="&staff.main.auth.debug.clear;" accesskey="&staff.main.auth.debug.clear.accesskey;" command="cmd_clear_cache"/>
-                       </hbox>
+            <hbox>
+                <arrowscrollbox orient="horizontal" flex="1">
+                    <button label="&staff.main.auth.debug.javascript;" accesskey="&staff.main.auth.debug.javascript.accesskey;" command="cmd_js_console"/>
+                    <button label="&staff.main.auth.debug.debugger;" accesskey="&staff.main.auth.debug.debugger.accesskey;" command="cmd_debugger"/>
+                    <button label="&staff.main.auth.debug.inspector;" accesskey="&staff.main.auth.debug.inspector.accesskey;" command="cmd_inspector"/>
+                    <button label="&staff.main.auth.debug.chrome_list;" accesskey="&staff.main.auth.debug.chrome_list.accesskey;" command="cmd_chrome_list"/>
+                    <button label="&staff.main.auth.debug.js_shell;" accesskey="&staff.main.auth.debug.js_shell.accesskey;" command="cmd_js_shell"/>
+                    <button label="&staff.main.auth.debug.clear;" accesskey="&staff.main.auth.debug.clear.accesskey;" command="cmd_clear_cache"/>
+                </arrowscrollbox>
+            </hbox>
                </groupbox>
 
        </groupbox>
index 7092b69..3b128e4 100644 (file)
 
                     document.getElementById('caption').setAttribute('label', document.getElementById('commonStrings').getString('staff.main.data.loaded'));
 
-                    xulG.window.open(urls.XUL_MENU_FRAME
+                    g.open_menu();
+
+                } catch(E) {
+                    alert(E);
+                }
+                       }
+
+            g.open_menu = function() {
+                try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                    var mframe = xulG.window.open(urls.XUL_MENU_FRAME
                         + '?server='+window.escape(xulG.url),
                         'main'+xulG.window.window_name_increment(),'chrome,resizable'
                     );
-
+                    mframe.xulG = xulG; // This is the xulG from main.js, with auth, url, and window
                 } catch(E) {
                     alert(E);
                 }
-                       }
+            }
 
                        g.data.init();