2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Example Template for remote xul -->
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
9 <?xml-stylesheet href="/xul/server/skin/simple_auth.css" type="text/css"?>
11 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
13 <!DOCTYPE window PUBLIC "" ""[
14 <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
17 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
19 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
21 <window id="simple_auth_win"
22 onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
23 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
25 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
27 <script type="text/javascript">
28 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
30 <scripts id="openils_util_scripts"/>
32 <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
37 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
38 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
39 JSAN.errorLevel = "die"; // none, warn, or die
40 JSAN.addRepository('/xul/server/');
41 JSAN.use('util.error'); g.error = new util.error();
42 g.error.sdump('D_TRACE','my_init() for simple_auth.xul');
44 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
45 g.data.temporary_session = ''; g.data.stash('temporary_session');
47 $('server').value = g.data.server_unadorned;
50 addCSSClass(document.documentElement,g.cgi.param('login_type'))
52 if (g.cgi.param('desc_brief')) {
53 $('desc').hidden = false;
54 $('desc_brief').appendChild( document.createTextNode( g.cgi.param('desc_brief') ) );
56 if (g.cgi.param('desc_full')) {
57 $('desc').hidden = false;
58 $('desc_full').appendChild( document.createTextNode( g.cgi.param('desc_full') ) );
61 $('username').focus();
63 $('username').addEventListener('keypress',handle_keypress,false);
64 $('password').addEventListener('keypress',handle_keypress,false);
67 var err_msg = "!! This software has encountered an error. Please tell your friendly " +
68 "system administrator or software developer the following:\nquick_auth.xul\n" + E + '\n';
69 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
74 function $(id) { return document.getElementById(id); }
76 function handle_keypress(ev) {
77 if ( (! ev.keyCode) || (ev.keyCode != 13) ) return;
79 case $('username') : $('password').focus(); break;
80 case $('password') : authorize(); break;
85 function authorize() {
87 JSAN.use('auth.session');
88 g.session = new auth.session(
90 'name_prompt' : $('username'),
91 'password_prompt' : $('password'),
92 'server_prompt' : $('server'),
94 g.cgi.param('login_type') || 'temp'
96 g.session.on_init = function() {
97 JSAN.use('util.network'); var n = new util.network();
98 var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
99 g.data.temporary_session = { 'key' : g.session.key, 'authtime' : g.session.authtime, 'usr' : js2JSON(staff) };
100 g.data.stash('temporary_session');
103 g.session.on_init_error = function() {
104 $('password').value = '';
105 $('username').focus();
106 $('username').select();
117 <commandset id="simple_auth_cmds">
118 <command id="cmd_broken" />
121 <vbox id="simple_auth_main" flex="1">
122 <groupbox id="desc" hidden="true">
123 <caption label="Exception"/>
124 <description id="desc_brief" style="color: red"/>
125 <description id="desc_full"/>
128 <caption label="Authorization"/>
130 <columns><column /><column /></columns>
133 <label value="Username:" control="username" accesskey="U"/>
134 <textbox id="username" />
137 <label value="Password:" control="password" accesskey="P"/>
138 <textbox id="password" type="password"/>
141 <button label="Cancel" accesskey="C" oncommand="window.close()"/>
142 <button label="Authorize" accesskey="A" oncommand="authorize()"/>
146 <label id="server" hidden="true"/>