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"?>
10 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
12 <!DOCTYPE window PUBLIC "" ""[
13 <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
16 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
18 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
20 <window id="simple_auth_win"
21 onload="try { my_init(); } catch(E) { alert(E); }"
22 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
24 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
26 <script type="text/javascript">
27 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
29 <scripts id="openils_util_scripts"/>
31 <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
36 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
37 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
38 JSAN.errorLevel = "die"; // none, warn, or die
39 JSAN.addRepository('/xul/server/');
40 JSAN.use('util.error'); g.error = new util.error();
41 g.error.sdump('D_TRACE','my_init() for simple_auth.xul');
43 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
44 g.data.temporary_session = ''; g.data.stash('temporary_session');
46 $('server').value = g.data.server_unadorned;
50 if (g.cgi.param('desc_brief')) {
51 $('desc').hidden = false;
52 $('desc_brief').appendChild( document.createTextNode( g.cgi.param('desc_brief') ) );
54 if (g.cgi.param('desc_full')) {
55 $('desc').hidden = false;
56 $('desc_full').appendChild( document.createTextNode( g.cgi.param('desc_full') ) );
59 $('username').focus();
61 $('username').addEventListener('keypress',handle_keypress,false);
62 $('password').addEventListener('keypress',handle_keypress,false);
65 var err_msg = "!! This software has encountered an error. Please tell your friendly " +
66 "system administrator or software developer the following:\nquick_auth.xul\n" + E + '\n';
67 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
72 function $(id) { return document.getElementById(id); }
74 function handle_keypress(ev) {
75 if ( (! ev.keyCode) || (ev.keyCode != 13) ) return;
77 case $('username') : $('password').focus(); break;
78 case $('password') : authorize(); break;
83 function authorize() {
85 JSAN.use('auth.session');
86 g.session = new auth.session(
88 'name_prompt' : $('username'),
89 'password_prompt' : $('password'),
90 'server_prompt' : $('server'),
92 g.cgi.param('login_type') || 'temp'
94 g.session.on_init = function() {
95 g.data.temporary_session = { 'key' : g.session.key, 'authtime' : g.session.authtime };
96 g.data.stash('temporary_session');
99 g.session.on_init_error = function() {
100 $('password').value = '';
101 $('username').focus();
102 $('username').select();
113 <commandset id="simple_auth_cmds">
114 <command id="cmd_broken" />
117 <vbox id="simple_auth_main">
118 <groupbox id="desc" hidden="true">
119 <caption label="Exception"/>
120 <description id="desc_brief" style="color: red"/>
121 <description id="desc_full"/>
124 <caption label="Authorization"/>
126 <columns><column /><column /></columns>
129 <label value="Username:" control="username" accesskey="U"/>
130 <textbox id="username" />
133 <label value="Password:" control="password" accesskey="P"/>
134 <textbox id="password" type="password"/>
137 <button label="Cancel" accesskey="C" oncommand="window.close()"/>
138 <button label="Authorize" accesskey="A" oncommand="authorize()"/>
142 <label id="server" hidden="true"/>