toward patron search
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Dec 2005 16:39:08 +0000 (16:39 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Dec 2005 16:39:08 +0000 (16:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2346 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/search_form.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/search_form.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul [new file with mode: 0644]

diff --git a/Open-ILS/xul/staff_client/server/patron/search_form.js b/Open-ILS/xul/staff_client/server/patron/search_form.js
new file mode 100644 (file)
index 0000000..4a8ae20
--- /dev/null
@@ -0,0 +1,209 @@
+dump('entering patron/search_form.js\n');
+
+if (typeof patron == 'undefined') patron = {};
+patron.search_form = function (params) {
+
+       JSAN.use('util.error'); this.error = new util.error();
+       JSAN.use('main.network'); this.network = new main.network();
+       this.w = window;
+}
+
+patron.search_form.prototype = {
+
+       'init' : function( params ) {
+
+               var obj = this;
+
+               obj.session = params['session'];
+
+               JSAN.use('OpenILS.data'); this.OpenILS = {}; 
+               obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
+
+               JSAN.use('main.controller'); obj.controller = new main.controller();
+               obj.controller.init(
+                       {
+                               control_map : {
+                                       'cmd_broken' : [
+                                               ['command'],
+                                               function() { alert('Not Yet Implemented'); }
+                                       ],
+                                       'cmd_patron_search_submit' : [
+                                               ['command'],
+                                               function() {
+                                                       var query = '';
+                                                       for (var i = 0; i < obj.controller.render_list.length; i++) {
+                                                               var id = obj.controller.render_list[i][0];
+                                                               var node = document.getElementById(id);
+                                                               if (node && node.value != '') {
+                                                                       if (query == '') {
+                                                                               query += '?';
+                                                                       } else {
+                                                                               query += '&';
+                                                                       }
+                                                                       query += id + '=' + window.escape(node.value);
+                                                                       dump('id = ' + id + '  value = ' + node.value + '\n');
+                                                               }
+                                                       }
+                                                       if (typeof obj.on_submit == 'function') {
+                                                               obj.on_submit(query);
+                                                       }
+                                                       if (typeof window.xulG == 'object' 
+                                                               && typeof window.xulG.on_submit == 'function') {
+                                                               obj.error.sdump('D_PATRON','patron.search_form: Calling external .on_submit()\n');
+                                                               window.xulG.on_submit(query);
+                                                       } else {
+                                                               obj.error.sdump('D_PATRON','patron.search_form: No external .on_query()\n');
+                                                       }
+
+                                               }
+                                       ],
+                                       'cmd_patron_search_clear' : [
+                                               ['command'],
+                                               function() { obj.controller.render(); }
+                                       ],
+                                       'family_name' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.family_name) {
+                                                                       e.value = params.query.family_name;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'first_given_name' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.first_given_name) {
+                                                                       e.value = params.query.first_given_name;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'second_given_name' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.second_given_name) {
+                                                                       e.value = params.query.second_gtiven_name;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'email' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.email) {
+                                                                       e.value = params.query.email;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'phone' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.phone) {
+                                                                       e.value = params.query.phone;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'ident' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.ident) {
+                                                                       e.value = params.query.ident;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'street1' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.street1) {
+                                                                       e.value = params.query.street1;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'street2' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.street2) {
+                                                                       e.value = params.query.street2;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'city' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.city) {
+                                                                       e.value = params.query.city;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'state' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.state) {
+                                                                       e.value = params.query.state;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                                       'post_code' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               if (params.query&&params.query.post_code) {
+                                                                       e.value = params.query.post_code;
+                                                               } else {
+                                                                       e.value = '';
+                                                               }
+                                                       };
+                                               }
+                                       ],
+                               }
+                       }
+               );
+
+       },
+
+       'on_submit' : function(q) {
+               var msg = 'Query = ' + q;
+               this.error.sdump('D_PATRON', msg);
+       },
+
+}
+
+dump('exiting patron/search_form.js\n');
diff --git a/Open-ILS/xul/staff_client/server/patron/search_form.xul b/Open-ILS/xul/staff_client/server/patron/search_form.xul
new file mode 100644 (file)
index 0000000..a758487
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Patron Display -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/evergreen.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window SYSTEM "chrome://evergreen/locale/lang.dtd">
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+<?xul-overlay href="/xul/server/patron/search_form_overlay.xul"?>
+
+<window id="patron_search_form_win" 
+       onload="my_init()"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- BEHAVIOR -->
+        <script type="text/javascript">var myPackageDir = 'evergreen'; var IAMXUL = true; var g = {};</script>
+        <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+       <script>
+       <![CDATA[
+               function my_init() {
+                       try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               if (typeof JSAN == 'undefined') { throw( "The JSAN library object is 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 patron_search_form.xul');
+
+                               g.cgi = new CGI();
+                               var session = g.cgi.param('session');
+                               var keys = g.cgi.keys();
+                               var query = {};
+                               for (var i in keys) {
+                                       query[i] = g.cgi.param(i);
+                               }
+
+                               JSAN.use('patron.search_form'); g.search_form = new patron.search_form();
+                               g.search_form.init( { 'session' : session, 'query' : query } );
+       
+                       } catch(E) {
+                               var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
+                                       "system administrator or software developer the following:\n" 
+                                       'patron/search_form.xul\n' + E + '\n';
+                               try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+                               alert(err_msg);
+                       }
+               }
+
+       ]]>
+       </script>
+
+       <commandset id="patron_search_form_cmds">
+       </commandset>
+
+       <box id="patron_search_form_main" />
+
+</window>
+
diff --git a/Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul b/Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul
new file mode 100644 (file)
index 0000000..d6ec7d6
--- /dev/null
@@ -0,0 +1,113 @@
+<?xml version="1.0"?>
+<!DOCTYPE overlay SYSTEM "chrome://evergreen/locale/lang.dtd">
+<overlay id="patron_search_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script>dump('loading patron/search_overlay.xul\n');</script>
+
+<commandset id="patron_search_form_cmds">
+       <command id="cmd_patron_search_submit" />
+       <command id="cmd_patron_search_clear" />
+</commandset>
+
+<box id="patron_search_form_main" orient="vertical" class="my_overflow">
+       <groupbox id="psgf_gb">
+               <caption id="psgf_gbc" label='&staff.patron_search_form.caption;' />
+               <grid id="psg" />
+       </groupbox>
+</box>
+
+<!-- group 0 = user  group 1 = address  group 2 = phone, ident -->
+
+<grid id="psg">
+       <columns id="psc">
+               <column id="psc1"/>
+               <column id="psc2" flex="1"/>
+       </columns>
+       <rows id="psr">
+               <row id="psr1">
+                       <label id="psl1" control="family_name" 
+                               value="&staff.patron_search_form.family_name.label;" 
+                               accesskey="&staff.patron_search_form.family_name.accesskey;"/>
+                       <textbox id="family_name" group="0"/>
+               </row>
+               <row id="psr2">
+                       <label id="psl2" control="first_given_name" 
+                               value="&staff.patron_search_form.first_given_name.label;" 
+                               accesskey="&staff.patron_search_form.first_given_name.accesskey;"/>
+                       <textbox id="first_given_name" group="0"/>
+               </row>
+               <row id="psr3">
+                       <label id="psl3" control="second_given_name" 
+                               value="&staff.patron_search_form.second_given_name.label;" 
+                               accesskey="&staff.patron_search_form.second_given_name.accesskey;"/>
+                       <textbox id="second_given_name" group="0"/>
+               </row>
+               <row id="psr4">
+                       <label id="psl4" control="email" 
+                               value="&staff.patron_search_form.email.label;" 
+                               accesskey="&staff.patron_search_form.email.accesskey;"/>
+                       <textbox id="email" group="0"/>
+               </row>
+               <row id="psr5">
+                       <label id="psl5" control="phone" 
+                               value="&staff.patron_search_form.phone.label;" 
+                               accesskey="&staff.patron_search_form.phone.accesskey;"/>
+                       <textbox id="phone" group="2"/>
+               </row>
+               <row id="psr6">
+                       <label id="psl6" control="ident" 
+                               value="&staff.patron_search_form.ident.label;" 
+                               accesskey="&staff.patron_search_form.ident.accesskey;"/>
+                       <textbox id="ident" group="2"/>
+               </row>
+               <row id="psr6a">
+                       <label id="psl6a" value=" "/>
+               </row>
+               <row id="psr7">
+                       <label id="psl7" control="street1" 
+                               value="&staff.patron_search_form.street1.label;" 
+                               accesskey="&staff.patron_search_form.street1.accesskey;"/>
+                       <textbox id="street1" group="1"/>
+               </row>
+               <row id="psr8">
+                       <label id="psl8" control="street2" 
+                               value="&staff.patron_search_form.street2.label;" 
+                               accesskey="&staff.patron_search_form.street2.accesskey;"/>
+                       <textbox id="street2" group="1"/>
+               </row>
+               <row id="psr9">
+                       <label id="psl9" control="city" 
+                               value="&staff.patron_search_form.city.label;" 
+                               accesskey="&staff.patron_search_form.city.accesskey;"/>
+                       <textbox id="city" group="1"/>
+               </row>
+               <row id="psr10">
+                       <label id="psl10" control="state" 
+                               value="&staff.patron_search_form.state.label;" 
+                               accesskey="&staff.patron_search_form.state.accesskey;"/>
+                       <textbox id="state" group="1"/>
+               </row>
+               <row id="psr11">
+                       <label id="psl11" control="post_code" 
+                               value="&staff.patron_search_form.post_code.label;" 
+                               accesskey="&staff.patron_search_form.post_code.accesskey;"/>
+                       <textbox id="post_code" group="1"/>
+               </row>
+               <row id="psr12">
+                       <spacer id="pss12"/>
+                       <button id="search" label="&staff.patron_search_form.search.label;" 
+                               accesskey="&staff.patron_search_form.search.accesskey;"
+                               command="cmd_patron_search_submit"/>
+               </row>
+               <row id="psr13">
+                       <spacer id="pss13"/>
+                       <button id="clear" label="&staff.patron_search_form.clear.label;" 
+                               accesskey="&staff.patron_search_form.clear.accesskey;"
+                               command="cmd_patron_search_clear"/>
+               </row>
+       </rows>
+</grid>
+
+
+</overlay>