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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Sep 14 22:48:44 EDT 2009


Author: phasefx
Date: 2009-09-14 22:48:41 -0400 (Mon, 14 Sep 2009)
New Revision: 14018

Added:
   trunk/Open-ILS/xul/staff_client/server/main/simple_auth.xul
Modified:
   trunk/Open-ILS/xul/staff_client/Makefile.am
   trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul
   trunk/Open-ILS/xul/staff_client/chrome/content/main/simple_auth.xul
   trunk/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul
Log:
simple auth was buggy; due to chrome/remote restrictions in xulrunner 1.9? made separate chrome and remote versions, which is.. simpler :)

Modified: trunk/Open-ILS/xul/staff_client/Makefile.am
===================================================================
--- trunk/Open-ILS/xul/staff_client/Makefile.am	2009-09-14 03:18:12 UTC (rev 14017)
+++ trunk/Open-ILS/xul/staff_client/Makefile.am	2009-09-15 02:48:41 UTC (rev 14018)
@@ -26,7 +26,6 @@
 	@cp -fR build/chrome/content/util/ build/server/
 	@cp -fR build/chrome/content/auth/ build/server/
 	@cp build/chrome/content/main/constants.js build/server/main/constants.js
-	@cp build/chrome/content/main/simple_auth.xul build/server/main/simple_auth.xul
 	@cp build/chrome/content/main/bindings.xml build/server/main/bindings.xml
 	@cp build/chrome/content/OpenILS/data.js build/server/OpenILS/data.js
 	@cp build/chrome/content/OpenILS/global_util.js build/server/OpenILS/global_util.js
@@ -34,7 +33,6 @@
 
 # Convert chrome to remote for server localization
 chrome2remote:
-	@sed -i 's/chrome:\/\/open_ils_staff_client\/locale\//\/xul\/server\/locale\/<\!--#echo var=locale-->\//' build/server/main/simple_auth.xul
 	@for loc in $(CHROME_LOCALES); do \
 		cp -fr chrome/locale/$$loc build/server/locale/. ; \
 	done;

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul	2009-09-14 03:18:12 UTC (rev 14017)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/util_overlay_chrome.xul	2009-09-15 02:48:41 UTC (rev 14018)
@@ -16,6 +16,7 @@
 		<script type="text/javascript" src="util/org_utils.js" />   
 		<script type="text/javascript" src="global_util.js" />   
 		<messagecatalog id="offlineStrings" src='chrome://open_ils_staff_client/locale/offline.properties'/>
+		<messagecatalog id="authStrings" src='chrome://open_ils_staff_client/locale/auth.properties'/>
 		<script>dump('finished openils_util_overlay\n');</script>
 	</scripts>
 

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/simple_auth.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/simple_auth.xul	2009-09-14 03:18:12 UTC (rev 14017)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/simple_auth.xul	2009-09-15 02:48:41 UTC (rev 14018)
@@ -8,18 +8,16 @@
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- STYLESHEETS -->
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/simple_auth.css" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/auth.css" type="text/css"?>
 
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- LOCALIZATION -->
-<!DOCTYPE window PUBLIC "" ""[
-	<!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
-]>
+<!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
 
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- OVERLAYS -->
-<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+<?xul-overlay href="chrome://open_ils_staff_client/OpenILS/content/util_overlay_chrome.xul"?>
 
 <window id="simple_auth_win" 
 	onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
@@ -32,7 +30,6 @@
 	</script>
         <scripts id="openils_util_scripts"/>
 
-	<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
 	<script>
 	<![CDATA[
 		function my_init() {
@@ -42,7 +39,7 @@
 					throw( offlineStrings.getString('common.jsan.missing'));
 				}
 				JSAN.errorLevel = "die"; // none, warn, or die
-				JSAN.addRepository('/xul/server/');
+				JSAN.addRepository('..');
 				JSAN.use('util.error'); g.error = new util.error();
 				g.error.sdump('D_TRACE','my_init() for simple_auth.xul');
 

Modified: trunk/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul	2009-09-14 03:18:12 UTC (rev 14017)
+++ trunk/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul	2009-09-15 02:48:41 UTC (rev 14018)
@@ -28,6 +28,7 @@
         </menupopup>
 		<messagecatalog id="commonStrings" src='/xul/server/locale/<!--#echo var="locale"-->/common.properties'/>
 		<messagecatalog id="offlineStrings" src='/xul/server/locale/<!--#echo var="locale"-->/offline.properties'/>
+		<messagecatalog id="authStrings" src='/xul/server/locale/<!--#echo var="locale"-->/auth.properties'/>
 		<script>dump('finished openils_util_overlay\n');</script>
 	</scripts>
 

Copied: trunk/Open-ILS/xul/staff_client/server/main/simple_auth.xul (from rev 14013, trunk/Open-ILS/xul/staff_client/chrome/content/main/simple_auth.xul)
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/main/simple_auth.xul	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/main/simple_auth.xul	2009-09-15 02:48:41 UTC (rev 14018)
@@ -0,0 +1,169 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Example Template for remote xul -->
+<!--
+ vim:noet:sw=4:ts=4:
+-->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/simple_auth.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window PUBLIC "" ""[
+	<!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
+<window id="simple_auth_win" 
+	onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+	<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+	<!-- BEHAVIOR -->
+        <script type="text/javascript">
+		var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
+	</script>
+        <scripts id="openils_util_scripts"/>
+
+	<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+	<script>
+	<![CDATA[
+
+        var offlineStrings = document.getElementById('offlineStrings');
+
+		function my_init() {
+			try {
+				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+				if (typeof JSAN == 'undefined') { 
+					throw( offlineStrings.getString('common.jsan.missing'));
+				}
+				JSAN.errorLevel = "die"; // none, warn, or die
+				JSAN.addRepository('/xul/server/');
+				JSAN.use('util.error'); g.error = new util.error();
+				g.error.sdump('D_TRACE','my_init() for simple_auth.xul');
+
+				JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+				g.data.temporary_session = ''; g.data.stash('temporary_session');
+
+				$('server').value = g.data.server_unadorned;
+
+				addCSSClass(document.documentElement,xul_param('login_type',{'modal_xulG':true}))
+
+				if (xul_param('desc_brief',{'modal_xulG':true})) {
+					$('desc').hidden = false;
+					$('desc_brief').appendChild( document.createTextNode( xul_param('desc_brief',{'modal_xulG':true}) ) );
+				}
+				if (xul_param('desc_full',{'modal_xulG':true})) {
+					$('desc').hidden = false;
+					$('desc_full').appendChild( document.createTextNode( xul_param('desc_full',{'modal_xulG':true}) ) );
+				}
+
+				$('username').focus();
+
+				$('username').addEventListener('keypress',handle_keypress,false);
+				$('password').addEventListener('keypress',handle_keypress,false);
+
+			} catch(E) {
+				var err_msg =  offlineStrings.getFormattedString('common.exception', ['simple_auth.xul', E]);
+				try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+				alert(err_msg);
+			}
+		}
+
+		function $(id) { return document.getElementById(id); }
+
+		function handle_keypress(ev) {
+			if ( (! ev.keyCode) || (ev.keyCode != 13) ) return;
+			switch(ev.target) {
+				case $('username') : $('password').focus(); break;
+				case $('password') : authorize(); break;
+				default: break;
+			}
+		}
+
+		function authorize() {
+			try {
+				JSAN.use('auth.session');
+				g.session = new auth.session(
+					{
+						'name_prompt' : $('username'),
+						'password_prompt' : $('password'),
+						'server_prompt' : $('server'),
+					},
+					xul_param('login_type',{'modal_xulG':true}) || 'temp'
+				);
+				g.session.on_init = function() { 
+					try {
+						JSAN.use('util.network'); var n = new util.network();
+						var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
+						g.data.temporary_session = {  // old way because of local chrome still out there
+							'key' : g.session.key, 
+							'authtime' : g.session.authtime, 
+							'usr' : js2JSON(staff)
+						}
+						g.data.stash('temporary_session');
+						var my_xulG = { // new way, to minimize the use of global spaces
+							'temporary_session' : g.data.temporary_session
+						};
+						update_modal_xulG(my_xulG);
+						window.close();
+					} catch(E) {
+						g.error.standard_unexpected_error_alert('simple_auth.session.on_init',E);
+					}
+				}
+				g.session.on_init_error = function() { 
+					$('password').value = '';
+					$('username').focus();
+					$('username').select();
+				 }
+				g.session.init();
+			} catch(E) {
+				alert(E);
+			}
+		}
+
+	]]>
+	</script>
+
+	<commandset id="simple_auth_cmds">
+		<command id="cmd_broken" />
+	</commandset>
+
+	<vbox id="simple_auth_main" flex="1">
+	<groupbox id="desc" hidden="true">
+		<caption label="&staff.main.simple_auth.exception.label;"/>
+		<description id="desc_brief" style="color: red"/>
+		<description id="desc_full"/>
+	</groupbox>
+	<groupbox>
+		<caption label="&staff.main.simple_auth.authorization.label;"/>
+		<grid>
+			<columns><column /><column /></columns>
+			<rows>
+				<row>
+					<label value="&common.username.label;" control="username" accesskey="&common.username.accesskey;"/>
+					<textbox id="username" />
+				</row>
+				<row>
+					<label value="&staff.auth.password_prompt;" control="password" accesskey="&staff.auth.password_prompt.accesskey;"/>
+					<textbox id="password" type="password"/>
+				</row>
+				<row>
+					<button label="&common.cancel;" accesskey="&common.cancel.accesskey;" oncommand="window.close()"/>
+					<button label="&staff.main.simple_auth.authorize.label;" accesskey="&staff.main.simple_auth.authorize.accesskey;" oncommand="authorize()"/>
+				</row>
+			</rows>
+		</grid>
+		<label id="server" hidden="true"/>
+	</groupbox>
+	<spacer flex="1"/>
+	</vbox>
+</window>
+


Property changes on: trunk/Open-ILS/xul/staff_client/server/main/simple_auth.xul
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + /trunk/Open-ILS/xul/staff_client/chrome/content/main/simple_auth.xul:10932,10935
Name: svn:eol-style
   + native



More information about the open-ils-commits mailing list