most of what we need for the first screen
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 18 Jun 2005 03:06:28 +0000 (03:06 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 18 Jun 2005 03:06:28 +0000 (03:06 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@834 dcc99617-32d9-48b4-a31d-7c20da2025e4

13 files changed:
Evergreen/staff_client/chrome/content/evergreen/Open-ILS/OpenILS_overlay.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/OpenSRF/OpenSRF_overlay.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/auth/auth.js [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/auth/auth.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/auth/auth_overlay.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/util/browser.js [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/util/browser_overlay.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/locale/en-US/evergreen/auth.dtd [new file with mode: 0644]
Evergreen/staff_client/chrome/locale/en-US/evergreen/auth.properties [new file with mode: 0644]
Evergreen/staff_client/chrome/skin/evergreen/auth.css [new file with mode: 0644]
Evergreen/staff_client/chrome/skin/evergreen/evergreen.css [new file with mode: 0644]
Evergreen/staff_client/defaults/preferences/evergreen.js

diff --git a/Evergreen/staff_client/chrome/content/evergreen/Open-ILS/OpenILS_overlay.xul b/Evergreen/staff_client/chrome/content/evergreen/Open-ILS/OpenILS_overlay.xul
new file mode 100644 (file)
index 0000000..5b0f534
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!-- Modified by Jason for Evergreen -->
+
+<overlay id="OpenILS"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<OpenILS id="OpenILS_js">
+</OpenILS>
+
+</overlay>
diff --git a/Evergreen/staff_client/chrome/content/evergreen/OpenSRF/OpenSRF_overlay.xul b/Evergreen/staff_client/chrome/content/evergreen/OpenSRF/OpenSRF_overlay.xul
new file mode 100644 (file)
index 0000000..cd35b7e
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!-- Modified by Jason for Evergreen -->
+
+<overlay id="OpenSRF"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<OpenSRF id="OpenSRF_js">
+       <script src="JSON.js" />
+       <script src="md5.js" />
+       <script src="opensrf_utils.js" />
+       <script src="opensrf_config.js" />
+       <script src="opensrf_dom_element.js" />
+       <script src="opensrf_domain_object.js" />
+       <script src="opensrf_transport.js" />
+       <script src="opensrf_jabber_transport.js" />
+       <script src="opensrf_msg_stack.js" />
+       <script src="opensrf_app_session.js" />
+</OpenSRF>
+
+</overlay>
diff --git a/Evergreen/staff_client/chrome/content/evergreen/auth/auth.js b/Evergreen/staff_client/chrome/content/evergreen/auth/auth.js
new file mode 100644 (file)
index 0000000..42da53d
--- /dev/null
@@ -0,0 +1,421 @@
+var G = {}; // the master Global variable
+G['main_window'] = self;
+G['win_list'] = new Array();
+G['window_name_increment'] = 0;
+G['auth_ses'] = '';
+G['user_ou'] = '';
+G['main_test_variable'] = 'Hello World';
+G['org_tree'] = '';
+G['my_orgs'] = [];
+G['my_orgs_hash'] = {};
+G['fieldmap'] = '';
+G['patrons'] = {};
+
+G['ap_list'] = []; // actor::profile
+G['ap_hash'] = {};
+G['cit_list'] = []; // config::identification_type
+G['cit_hash'] = {};
+G['cst_list'] = []; // config::standing
+G['cst_hash'] = {};
+G['acpl_list'] = []; // asset::copy_location
+G['acpl_hash'] = {}; G['acpl_my_orgs'] = []; G['acpl_my_orgs_hash'] = {};
+G['aout_list'] = []; // actor::org_unit_type
+G['aout_hash'] = {};
+G['ccs_list'] = []; // config::copy_status
+G['ccs_hash'] = {};
+G['asc_list'] = []; // asset::stat_cat
+G['actsc_list'] = []; // actor::stat_cat
+G['actsc_hash']; // actor::stat_cat
+
+var mw = G['main_window'];
+var auth_meter_per = 10;
+
+function OpenILS_init() {
+       my_init();
+}
+
+function my_init() {
+       dump('TESTING: auth.js: ' + mw.G['main_test_variable'] + '\n');
+       var np = document.getElementById('name_prompt');
+       np.addEventListener("keypress",handle_keypress,false);
+       np.focus();
+       var pp = document.getElementById('password_prompt');
+       pp.addEventListener("keypress",handle_keypress,false);
+       self.addEventListener("unload",nice_shutdown,false);
+       G['sound'] = xp_sound_init(); 
+       //G.sound.beep();
+       snd_logon();
+}
+
+function handle_keypress(ev) {
+       if (ev.keyCode && ev.keyCode == 13) {
+               switch(this) {
+                       case document.getElementById('name_prompt') :
+                               ev.preventDefault();
+                               var pp = document.getElementById('password_prompt');
+                               pp.focus(); pp.select();
+                       break;
+                       case document.getElementById('password_prompt') :
+                               ev.preventDefault();
+                               var sb = document.getElementById('submit_button');
+                               sb.focus();
+                               authenticate();
+                       break;
+                       default:
+                       break;
+               }
+       }
+}
+
+function disable_login_prompts() {
+       disable_widgets('password_prompt','name_prompt','submit_button');
+       G.sound.beep();
+}
+
+function enable_login_prompts() {
+       enable_widgets('password_prompt','name_prompt','submit_button');
+       document.getElementById('password_prompt').value = '';
+       var np = document.getElementById('name_prompt');
+       np.focus(); np.select();
+       document.getElementById('auth_meter').value = 0;
+       G.sound.beep();
+}
+
+function authenticate() {
+       timer_init('cat');
+       var name = document.getElementById('name_prompt').value;
+       if (name.length == 0) { enable_login_prompts(); return; }
+       // Talk to the system and authenticate the user.
+       user_async_request(
+               'open-ils.auth',
+               'open-ils.auth.authenticate.init',
+               [ name ],
+               auth_init_callback
+       );
+}
+
+function auth_init_callback(request) {
+       var auth_init;
+       try {
+               auth_init = request.getResultObject();
+               if (!auth_init) { throw('null result'); }
+       } catch(E) {
+               alert('Login failed on auth_init: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+
+       dump( 'AUTH_INIT: ' + typeof(auth_init) + ' : ' + auth_init + '\n');
+       var name = document.getElementById('name_prompt').value;
+       var pw = document.getElementById('password_prompt').value;
+
+       user_async_request(
+               'open-ils.auth',
+               'open-ils.auth.authenticate.complete',
+               [ name, hex_md5(auth_init + hex_md5(pw)) ],
+               auth_ses_callback
+       );
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function auth_ses_callback(request) {
+       var auth_ses;
+       try {
+               auth_ses = request.getResultObject();
+               if (!auth_ses) { throw('null result'); }
+               if (auth_ses == 0) { throw('0 result'); }
+       } catch(E) {
+               alert('Login failed on auth_ses: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.auth_ses = [ auth_ses ];
+       dump( 'AUTH_SES: ' + typeof(mw.G['auth_ses'][0]) + ' : ' + mw.G['auth_ses'][0] + '\n');
+
+       user_async_request(
+               'open-ils.actor',
+               'open-ils.actor.user.profiles.retrieve',
+               [],
+               ap_list_callback
+       );
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function ap_list_callback(request) {
+       var ap_list;
+       try {
+               ap_list = request.getResultObject();
+               if (!ap_list) { throw('null result'); }
+               if (ap_list.length == 0) { throw('zero length result'); }
+       } catch(E) {
+               alert('Login failed on ap_list: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.ap_list = ap_list;
+       mw.G.ap_hash = convert_object_list_to_hash( ap_list );
+
+       user_async_request(
+               'open-ils.actor',
+               'open-ils.actor.user.ident_types.retrieve',
+               [],
+               cit_list_callback
+       );
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function cit_list_callback(request) {
+       var cit_list;
+       try {
+               cit_list = request.getResultObject();
+               if (!cit_list) { throw('null result'); }
+               if (cit_list.length == 0) { throw('zero length result'); }
+       } catch(E) {
+               alert('Login failed on cit_list: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.cit_list = cit_list;
+       mw.G.cit_hash = convert_object_list_to_hash( cit_list );
+       
+       user_async_request(
+               'open-ils.actor',
+               'open-ils.actor.standings.retrieve',
+               [],
+               cst_list_callback
+       );
+
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function cst_list_callback(request) {
+       var cst_list;
+       try {
+               cst_list = request.getResultObject();
+               if (!cst_list) { throw('null result'); }
+               if (cst_list.length == 0) { throw('zero length result'); }
+       } catch(E) {
+               alert('Login failed on cst_list: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.cst_list = cst_list;
+       mw.G.cst_hash = convert_object_list_to_hash( cst_list );
+       dump('cst_list = ' + js2JSON(cst_list) + '\n');
+
+       user_async_request(
+               'open-ils.search',
+               'open-ils.search.config.copy_location.retrieve.all',
+               [],
+               acpl_list_callback
+       );
+       document.getElementById('auth_meter').value += auth_meter_per;
+
+}
+
+function acpl_list_callback(request) {
+       var acpl_list;
+       try {
+               acpl_list = request.getResultObject();
+               if (!acpl_list) { throw('null result'); }
+               if (acpl_list.length == 0) { throw('zero length result'); }
+       } catch(E) {
+               alert('Login failed on acpl_list: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.acpl_list = acpl_list;
+       mw.G.acpl_hash = convert_object_list_to_hash( acpl_list );
+       dump('acpl_list = ' + js2JSON(acpl_list) + '\n');
+
+       user_async_request(
+               'open-ils.search',
+               'open-ils.search.config.copy_status.retrieve.all',
+               [],
+               ccs_list_callback
+       );
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function ccs_list_callback(request) {
+       var ccs_list;
+       try {
+               ccs_list = request.getResultObject();
+               if (!ccs_list) { throw('null result'); }
+               if (ccs_list.length == 0) { throw('zero length result'); }
+       } catch(E) {
+               alert('Login failed on ccs_list: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.ccs_list = ccs_list;
+       mw.G.ccs_hash = convert_object_list_to_hash( ccs_list );
+       dump('ccs_list = ' + js2JSON(ccs_list) + '\n');
+
+       user_async_request(
+               'open-ils.search',
+               'open-ils.search.actor.user.session',
+               [ mw.G['auth_ses'][0] ],
+               user_callback
+       );
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function user_callback(request) {
+       var user;
+       var user_ou;
+       try {
+               user = request.getResultObject();
+               if (!user) { throw('null result'); }
+               if (typeof(user) != 'object') { throw('result not an object' + user); }
+       } catch(E) {
+               alert('Login failed on user: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.user = user;
+       mw.G.user_ou = user.home_ou();
+       dump("user: " + js2JSON(mw.G['user']) + '\n');
+       dump("user_ou: " + js2JSON(mw.G['user_ou']) + '\n');
+       /*user_async_request(
+               'open-ils.search',
+               'open-ils.search.actor.org_tree.retrieve',
+               [],
+               org_tree_callback
+       );*/
+       /*user_async_request(
+               'open-ils.actor',
+               'open-ils.actor.org_types.retrieve',
+               [ mw.G.auth_ses[0] ],
+               org_type_callback
+       );*/
+       org_type_callback();
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function org_type_callback(request) {
+       var aout_list = globalOrgTypes;
+       /*try {
+               aout_list = request.getResultObject();
+               if (!aout_list) { throw('null result'); }
+               if (typeof(aout_list) != 'object') { throw('result not an object' + aout_list); }
+               if (aout_list.length == 0) { throw('empty aout_list'); }
+       } catch(E) {
+               alert('Login failed on aout_list: ' + js2JSON(E)); enable_login_prompts(); return;
+       }*/
+       mw.G.aout_list = aout_list;
+       mw.G.aout_hash = convert_object_list_to_hash( aout_list );
+       mw.G.org_tree = globalOrgTree;
+       mw.G.org_tree_hash = convert_object_list_to_hash( flatten_ou_branch( globalOrgTree ) );
+       mw.G.user_ou = find_ou( mw.G.org_tree, mw.G.user_ou );
+
+       user_async_request(
+               'open-ils.actor',
+               'open-ils.actor.org_unit.full_path.retrieve',
+               [ mw.G.auth_ses[0] ],
+               my_orgs_callback
+       );
+       document.getElementById('auth_meter').value += auth_meter_per;
+
+}
+
+function my_orgs_callback(request) {
+       var my_orgs;
+       try {
+               my_orgs = request.getResultObject();
+               if (!my_orgs) { throw('null result'); }
+               if (typeof(my_orgs) != 'object') { throw('result not an object' + my_orgs); }
+               if (my_orgs.length == 0) { throw('empty my_orgs'); }
+       } catch(E) {
+               alert('Login failed on my_orgs: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+
+       mw.G.my_orgs = my_orgs;
+       mw.G.my_orgs_hash = convert_object_list_to_hash( my_orgs );
+       dump('my_orgs = ' + js2JSON(my_orgs) + '\n');
+       mw.G.acpl_my_orgs = filter_list( 
+               mw.G.acpl_list, 
+               function (obj) {
+                       if ( typeof obj != 'object' ) return null;
+                       if ( mw.G.my_orgs_hash[ obj.owning_lib() ] ) return obj;
+               }
+       );
+       mw.G.acpl_my_orgs_hash = convert_object_list_to_hash( mw.G.acpl_my_orgs );
+       //dump('my_orgs.length = ' + mw.G.my_orgs.length + '   other_orgs.length = ' + mw.G.other_orgs.length + '\n');
+
+       user_async_request(
+               'open-ils.circ',
+               'open-ils.circ.stat_cat.actor.retrieve.all',
+               [ mw.G.auth_ses[0], mw.G.user_ou.id() ],
+               my_actsc_list_callback
+       );
+
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function my_actsc_list_callback(request) {
+       var actsc_list;
+       try {
+               actsc_list = request.getResultObject();
+               if (!actsc_list) { throw('null result'); }
+               if (actsc_list.length == 0) { throw('zero length result'); }
+       } catch(E) {
+               alert('Login failed on asc_list: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       mw.G.actsc_list = actsc_list;
+       mw.G.actsc_hash = convert_object_list_to_hash( actsc_list );
+       dump('actsc_list = ' + js2JSON(actsc_list) + '\n');
+
+       document.getElementById('auth_meter').value += auth_meter_per;
+
+       spawn_main();
+
+}
+
+
+function spawn_main() {
+       try {
+               var w = new_window('chrome://evergreen/content/evergreen/main.xul');
+               if (!w) { throw('window ref == null'); }
+               try {
+                       w.document.title = mw.G.user.usrname() + '@' + mw.G.user_ou.name();
+               } catch(E) {
+                       alert('Hrmm. ' + pretty_print( js2JSON(E) ) );
+               }
+       } catch(E) {
+               alert('Login failed on new_window: ' + js2JSON(E)); enable_login_prompts(); return;
+       }
+       document.getElementById('auth_meter').value += auth_meter_per;
+}
+
+function logoff() {
+       mw.G['auth_ses'] = '';
+       close_all_windows();
+       enable_login_prompts();
+       snd_logoff();
+}
+
+function nice_shutdown() {
+       if (ses) { logoff(); ses.disconnect(); }
+       snd_exit;
+       close_all_windows();
+       window.close();
+}
+
+function test_mvc () {
+       var w = new_window('chrome://evergreen/content/blank.xul');
+       w.title = 'testing';
+       w.addEventListener('load',test_mvc2,false);
+}
+
+function test_mvc2(ev) {
+
+       // Model
+
+       var cm = user_request(
+               'open-ils.search',
+               'open-ils.search.asset.copy.batch.retrieve',
+               [ [2] ]
+       )[0][0];
+       dump('cm = ' + js2JSON(cm) + '\n');
+       
+       // View
+
+       var cv = new CopyDisplayXULView();
+
+       var doc = ev.target;
+       var cnv = doc.getElementById('canvas');
+       cv.canvas( cnv );
+
+       // Controller
+
+       var cc = new CopyController();
+       cc.add_view(cv);
+       cc.add_model(cm);
+
+       cc.render_active_view();
+}
diff --git a/Evergreen/staff_client/chrome/content/evergreen/auth/auth.xul b/Evergreen/staff_client/chrome/content/evergreen/auth/auth.xul
new file mode 100644 (file)
index 0000000..6c1eb75
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!-- Application: Open-ILS Staff Client -->
+<!-- Screen: Auth/Login -->
+
+<!-- Modified by Jason for Evergreen -->
+
+<!-- Localization -->
+<!DOCTYPE window SYSTEM "chrome://evergreen/locale/auth.dtd">
+
+<window id="auth_win" title="&auth.title;" 
+       orient="vertical" style="overflow: auto"  persist="width height"
+       onload="OpenILS_init('login');"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- More Localization -->
+       <stringbundle id="strings" src="chrome://evergreen/locale/auth.properties"/>
+
+       <!-- Stylesheets -->
+       <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+       <?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
+       <?xml-stylesheet href="chrome://evergreen/skin/auth.css" type="text/css"?>
+
+       <!-- Overlays for this XUL file -->
+       <?xul-overlay href="chrome://evergreen/content/OpenSRF/OpenSRF_overlay.xul"?>
+       <?xul-overlay href="chrome://evergreen/content/Open-ILS/OpenILS_overlay.xul"?>
+       <?xul-overlay href="chrome://evergreen/content/util/util_overlay.xul"?>
+       <?xul-overlay href="chrome://evergreen/content/auth/auth_overlay.xul"?>
+
+       <!-- OpenSRF -->
+       <script>var myPackageDir = "evergreen";</script>
+       <OpenSRF id="OpenSRF_js" />
+
+       <!-- The logic for this app -->
+       <OpenILS id="OpenILS_js" />
+
+       <!-- The logic for this screen -->
+       <Auth id="auth_js" />
+
+       <!-- XUL'ified abstraction for logic to attach to widgets -->
+       <commandset id="auth_cmds" />
+
+       <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
+       <keyset id="auth_keys" />
+
+       <!-- Layout to be filled in by overlays and javascript -->
+       <box id="auth_main" />
+
+</window>
+
diff --git a/Evergreen/staff_client/chrome/content/evergreen/auth/auth_overlay.xul b/Evergreen/staff_client/chrome/content/evergreen/auth/auth_overlay.xul
new file mode 100644 (file)
index 0000000..1ada821
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!DOCTYPE overlay SYSTEM "chrome://evergreen/locale/auth.dtd">
+<overlay id="auth_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<!-- Modified by Jason for Evergreen -->
+
+<!-- The javascript logic for the staff client -->
+<Auth id="auth_js">
+       <script>var ses;</script>
+       <util id="util_js"/>
+       <script src="auth.js" />
+</Auth>
+
+<!-- Some logic abstracted a bit.  Sort of like an API list -->
+<commandset id="auth_cmds">
+       <command id="cmd_login" oncommand="
+               disable_login_prompts();
+               authenticate();
+       "/>
+       <command id="cmd_logoff" oncommand="logoff();"/>
+       <command id="cmd_close_window" oncommand="nice_shutdown();"/>
+</commandset>
+
+<!-- The top level widget for the staff client -->
+<box id="auth_main" flex="1" orient="vertical">
+       <deck id="main_deck">
+               <groupbox id="main_groupbox" flex="1"/>
+               <iframe id="print_frame" flex="1"/>
+               <iframe id="scratch_pad" flex="1"/>
+       </deck>
+       <button id="test" label="testing MVC" oncommand="test_mvc();" accesskey="t"/>
+       <button id="test2" label="testing MVC 2" oncommand="test_mvc2();" accesskey="2"/>
+</box>
+
+<groupbox id="main_groupbox" flex="1">
+       <caption id="main_caption" label="&auth.login_header;"/>
+       <label value="&auth.version;"/>
+       <grid>
+               <columns>
+                       <column />
+                       <column />
+               </columns>
+               <rows>
+                       <row>
+                               <label value="&auth.name_prompt;" control="name_prompt" accesskey="&auth.name_prompt.key;"/>
+                               <textbox id="name_prompt" value=""/>
+                       </row>
+                       <row>
+                               <label value="&auth.password_prompt;" control="password_prompt" accesskey="&auth.password_prompt.key;"/>
+                               <textbox id="password_prompt" value="" type="password"/>
+                       </row>
+                       <row>
+                               <label/>
+                               <hbox>
+                               <button id="submit_button" label="&auth.submit_prompt;" accesskey="&auth.submit_prompt.key;" command="cmd_login"/>
+                               <button label="&auth.logoff_prompt;" accesskey="&auth.logoff_prompt.key;" command="cmd_logoff"/>
+                               </hbox>
+                       </row>
+                       <row>
+                               <label/>
+                               <label/>
+                       </row>
+                       <row>
+                               <label/>
+                               <button label="&auth.quit_prompt;" accesskey="&auth.quit_prompt.key;" command="cmd_close_window"/>
+                       </row>
+               </rows>
+       </grid>
+       <progressmeter id="auth_meter" mode="normal" value="0"/>
+</groupbox>
+
+<!-- Accelerator Keys (Accessor Keys are in DTD's) -->
+<keyset id="auth_keys">
+       <key id="auth-login-key" modifiers="accel" key="S" command="cmd_login"/>
+       <key id="auth-logoff-key" modifiers="accel" key="L" command="cmd_logoff"/>
+       <key id="auth-close-key" modifiers="accel" key="Q" command="cmd_close_window"/>
+</keyset>
+
+</overlay>
diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/browser.js b/Evergreen/staff_client/chrome/content/evergreen/util/browser.js
new file mode 100644 (file)
index 0000000..db89a83
--- /dev/null
@@ -0,0 +1,40 @@
+// Modified by Jason for Evergreen
+
+function startEvergreenStaffClient() {
+       if (! window.open('chrome://evergreen/content/','auth_win','chrome') )
+               alert('Could not start Evergreen');
+}
+
+function startEvergreenOPAC() {
+       var text = evergreenGetSelectedText();
+       var url = 'http://gapines.org/';
+       if (text) {
+               url = 'http://gapines.org/opac/'
+               + '?target=mr_result'
+               + '&mr_search_type=keyword'
+               + '&mr_search_query=' + encodeURIComponent( text )
+               + '&mr_search_location=1'
+               + '&mr_search_depth=0'
+               + '&page=0'
+               + '&sub_frame=1';
+       }
+       if (! window.open(url,'gapines.org') )
+               alert('Could not load http://gapines.org/');
+}
+
+function evergreenGetSelectedText() {
+       var node = document.popupNode;
+       var selection = "";
+       var nodeLocalName = node.localName.toUpperCase();
+       if ((nodeLocalName == "TEXTAREA") || (nodeLocalName == "INPUT" && node.type == "text")) {
+               selection = node.value.substring(node.selectionStart, node.selectionEnd);
+       } 
+       else {
+               var focusedWindow = new XPCNativeWrapper(document.commandDispatcher.focusedWindow, 'document', 'getSelection()');
+               selection = focusedWindow.getSelection().toString();
+       }
+       selection = selection.replace(/(^\s+)|(\s+$)/g, "");
+
+       return selection;
+}
+
diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/browser_overlay.xul b/Evergreen/staff_client/chrome/content/evergreen/util/browser_overlay.xul
new file mode 100644 (file)
index 0000000..0d5e552
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!-- Modified by Jason for Evergreen -->
+
+<overlay id="util"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <script src="chrome://evergreen/content/util/browser.js"/>
+
+       <popup id="contentAreaContextMenu">
+               <menuitem id="evergreen_right_click_menu" 
+                       label="Search Evergreen OPAC" 
+                       accesskey=""
+                       insertafter="context-stop" 
+                       oncommand="startEvergreenOPAC();"/>
+       </popup>
+
+       <menupopup id="menu_ToolsPopup">
+               <menuitem id="evergreen_tools_menu"
+                       insertafter="devToolsSeparator" 
+                       label="Evergreen Staff Client"
+                       accesskey="" 
+                       oncommand="startEvergreenStaffClient();" />
+       </menupopup>
+
+</overlay>
diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul b/Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul
new file mode 100644 (file)
index 0000000..7b9dd68
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Modified by Jason for Evergreen -->
+
+<overlay id="util"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<util id="util_js">
+       <script>
+               var IAMXUL = true;
+       </script>
+</util>
+
+</overlay>
diff --git a/Evergreen/staff_client/chrome/locale/en-US/evergreen/auth.dtd b/Evergreen/staff_client/chrome/locale/en-US/evergreen/auth.dtd
new file mode 100644 (file)
index 0000000..0a4d604
--- /dev/null
@@ -0,0 +1,12 @@
+<!ENTITY auth.title "Evergreen Staff Client - Login">
+<!ENTITY auth.version "Pre-Alpha Public Demo 0.0.3d">
+
+<!ENTITY auth.login_header "Login">
+<!ENTITY auth.name_prompt "Name:"><!ENTITY auth.name_prompt.key "N">
+<!ENTITY auth.password_prompt "Password:"><!ENTITY auth.password_prompt.key "P">
+<!ENTITY auth.submit_prompt "Submit"><!ENTITY auth.submit_prompt.key "S">
+<!ENTITY auth.logoff_prompt "Log Off"><!ENTITY auth.logoff_prompt.key "L">
+<!ENTITY auth.quit_prompt "Exit Evergreen"><!ENTITY auth.quit_prompt.key "x">
+
+<!ENTITY about.title "About">
+
diff --git a/Evergreen/staff_client/chrome/locale/en-US/evergreen/auth.properties b/Evergreen/staff_client/chrome/locale/en-US/evergreen/auth.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Evergreen/staff_client/chrome/skin/evergreen/auth.css b/Evergreen/staff_client/chrome/skin/evergreen/auth.css
new file mode 100644 (file)
index 0000000..19db78e
--- /dev/null
@@ -0,0 +1,3 @@
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); 
+@namespace html url("http://www.w3.org/TR/REC-html40"); 
+
diff --git a/Evergreen/staff_client/chrome/skin/evergreen/evergreen.css b/Evergreen/staff_client/chrome/skin/evergreen/evergreen.css
new file mode 100644 (file)
index 0000000..19db78e
--- /dev/null
@@ -0,0 +1,3 @@
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); 
+@namespace html url("http://www.w3.org/TR/REC-html40"); 
+
index 10bf628..a03eec9 100644 (file)
@@ -1,7 +1,9 @@
 // Preferences that get set when the application is loaded
 
+// Modified by Jason for Evergreen
+
 // This one is required for XUL Runner
-pref("toolkit.defaultChromeURI", "chrome://evergreen/content/evergreen.xul");
+pref("toolkit.defaultChromeURI", "chrome://evergreen/content/auth/auth.xul");
 
 // This one just makes things speedier.  We use a lot of XMLHttpRequest
 pref("network.http.max-persistent-connections-per-server",8);