[open-ils-commits] r12249 - in trunk/Open-ILS/xul/staff_client: chrome/content/auth chrome/content/main server/main (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Feb 21 19:57:29 EST 2009


Author: phasefx
Date: 2009-02-21 19:57:29 -0500 (Sat, 21 Feb 2009)
New Revision: 12249

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/main.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul
   trunk/Open-ILS/xul/staff_client/server/main/data.xul
Log:
backporting from staff-client-experiment: entry points for some of these extensions, and the start of the chrome_xulG experiment (one cross-window global object that unlike OpenILS.data can support .watch, DOM nodes, and functions)

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js	2009-02-22 00:54:16 UTC (rev 12248)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js	2009-02-22 00:57:29 UTC (rev 12249)
@@ -60,6 +60,30 @@
 							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() {

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/main.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/main.js	2009-02-22 00:54:16 UTC (rev 12248)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/main.js	2009-02-22 00:57:29 UTC (rev 12249)
@@ -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 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 @@
 		}
 		/////////////////////////////////////////////////////////////////////////////
 
+        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 @@
 
 			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 @@
 				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 @@
 			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() {
 				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 @@
 			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(

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul	2009-02-22 00:54:16 UTC (rev 12248)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul	2009-02-22 00:57:29 UTC (rev 12249)
@@ -55,6 +55,10 @@
 		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"/>
 
@@ -67,6 +71,10 @@
 		<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"/>
@@ -175,10 +183,16 @@
 		<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>

Modified: trunk/Open-ILS/xul/staff_client/server/main/data.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/main/data.xul	2009-02-22 00:54:16 UTC (rev 12248)
+++ trunk/Open-ILS/xul/staff_client/server/main/data.xul	2009-02-22 00:57:29 UTC (rev 12249)
@@ -220,15 +220,25 @@
 
                     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();
 	



More information about the open-ils-commits mailing list