[open-ils-commits] r14929 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/main xul/staff_client/chrome/locale/en-US xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 16 17:42:00 EST 2009


Author: phasefx
Date: 2009-11-16 17:41:54 -0500 (Mon, 16 Nov 2009)
New Revision: 14929

Added:
   trunk/Open-ILS/xul/staff_client/server/patron/staged.js
   trunk/Open-ILS/xul/staff_client/server/patron/staged.xul
Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
First cut at an interface to list "staged" users by org unit.

APROPOS:
"Ability to have online card applications entered directly into system, with approval and checking done by staff before account is activated"

TODO:
* Wire up Load patron to spawn the existing patron editor interface
* See if there is a Cancel staged patron method we want to call from here
* Add an org unit selector instead of using the workstation ou
* Support paging or a Fetch More button or something similar (the list retrieval method has offset/limit parameters)



Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-11-16 22:37:55 UTC (rev 14928)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-11-16 22:41:54 UTC (rev 14929)
@@ -789,6 +789,8 @@
 <!ENTITY staff.main.menu.circ.offline.label "Enter Offline Interface">
 <!ENTITY staff.main.menu.circ.patron_registration.accesskey "R">
 <!ENTITY staff.main.menu.circ.patron_registration.label "Register Patron">
+<!ENTITY staff.main.menu.circ.staged_patrons.accesskey "t">
+<!ENTITY staff.main.menu.circ.staged_patrons.label "Staged Patrons">
 <!ENTITY staff.main.menu.circ.patron_retrieve.accesskey "L">
 <!ENTITY staff.main.menu.circ.patron_retrieve.label "Retrieve Last Patron">
 <!ENTITY staff.main.menu.circ.patron_status.key "P">
@@ -1298,6 +1300,13 @@
 <!ENTITY staff.patron_display.archived_penalty.end_date.accesskey "">
 <!ENTITY staff.patron_display.archived_penalty.retrieve.label "Retrieve Archived Penalties">
 <!ENTITY staff.patron_display.archived_penalty.retrieve.accesskey "R">
+<!ENTITY staff.patron_display.staged.caption "Staged Patrons">
+<!ENTITY staff.patron_display.staged.menu.actions.label "Actions for Selected Events">
+<!ENTITY staff.patron_display.staged.menu.actions.accesskey "A">
+<!ENTITY staff.patron_display.staged.menu.actions.cancel.label "Cancel Patron">
+<!ENTITY staff.patron_display.staged.menu.actions.cancel.accesskey "C">
+<!ENTITY staff.patron_display.staged.menu.actions.load.label "Load Patron">
+<!ENTITY staff.patron_display.staged.menu.actions.load.accesskey "L">
 <!ENTITY staff.patron_display.trigger_event.caption "Modify Triggered Events">
 <!ENTITY staff.patron_display.trigger_event.menu.actions.label "Actions for Selected Events">
 <!ENTITY staff.patron_display.trigger_event.menu.actions.accesskey "A">

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-11-16 22:37:55 UTC (rev 14928)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-11-16 22:41:54 UTC (rev 14929)
@@ -240,6 +240,7 @@
     'FM_MOUS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fines.summary', 'cacheable' : true, 'ttl' : 60000 },
     'FM_MOUS_RETRIEVE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fines.summary.authoritative', 'cacheable' : true, 'ttl' : 60000 },
     'FM_PGT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.groups.tree.retrieve', 'secure' : false },
+    'FM_STGU_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.stage.retrieve.by_org', 'secure' : true },
     'MARC_HTML_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.html', 'secure' : false },
     'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_class' },
     'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_service' },
@@ -362,6 +363,7 @@
     'XUL_RECORD_BUCKETS_QUICK' : '/xul/server/cat/record_buckets_quick.xul',
     'XUL_REMOTE_BROWSER' : '/xul/server/util/rbrowser.xul',
     'XUL_SPINE_LABEL' : '/xul/server/cat/spine_labels.xul',
+    'XUL_STAGED_PATRONS' : '/xul/server/patron/staged.xul',
     'XUL_STANDALONE' : 'chrome://open_ils_staff_client/content/circ/offline.xul',
     'XUL_STANDING_PENALTIES' : '/xul/server/patron/standing_penalties.xul',
     'XUL_NEW_STANDING_PENALTY' : '/xul/server/patron/new_standing_penalty.xul',

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2009-11-16 22:37:55 UTC (rev 14928)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2009-11-16 22:41:54 UTC (rev 14929)
@@ -387,6 +387,13 @@
                     );
                 }
             ],
+            'cmd_staged_patrons' : [
+                ['oncommand'],
+                function() {
+                    obj.data.stash_retrieve();
+                    obj.set_tab(obj.url_prefix(urls.XUL_STAGED_PATRONS),{'tab_name':offlineStrings.getString('menu.circulation.staged_patrons.tab')},{});
+                }
+            ],
             'cmd_circ_checkin' : [
                 ['oncommand'],
                 function() { 

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2009-11-16 22:37:55 UTC (rev 14928)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2009-11-16 22:41:54 UTC (rev 14929)
@@ -37,6 +37,7 @@
     <command id="cmd_search_tcn" />
     <command id="cmd_search_bib_id" />
     <command id="cmd_patron_register" key="patron-register-key" />
+    <command id="cmd_staged_patrons" />
     <command id="cmd_standalone" />
     <command id="cmd_survey_wizard" />
     <command id="cmd_stat_cat_edit" />
@@ -184,6 +185,7 @@
         <menuitem label="&staff.main.menu.circ.checkin.label;" accesskey="&staff.main.menu.circ.checkin.accesskey;" key="circ-checkin-key" command="cmd_circ_checkin"/>
         <menuitem label="&staff.main.menu.circ.renew.label;" accesskey="&staff.main.menu.circ.renew.accesskey;" key="circ-renew-key" command="cmd_circ_renew"/>
         <menuitem label="&staff.main.menu.circ.patron_registration.label;" accesskey="&staff.main.menu.circ.patron_registration.accesskey;" key="patron-register-key" command="cmd_patron_register"/>
+        <menuitem label="&staff.main.menu.circ.staged_patrons.label;" accesskey="&staff.main.menu.circ.staged_patrons.accesskey;" command="cmd_staged_patrons"/>
         <menuitem label="&staff.main.menu.circ.patron_retrieve.label;" accesskey="&staff.main.menu.circ.patron_retrieve.accesskey;" command="cmd_retrieve_last_patron" key="retrieve_last_patron_key"/>
         <menuseparator />
         <menuitem label="&staff.main.menu.circ.hold_capture.label;" accesskey="&staff.main.menu.circ.hold_capture.accesskey;" key="circ-hold-capture-key" command="cmd_circ_hold_capture"/>

Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2009-11-16 22:37:55 UTC (rev 14928)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2009-11-16 22:41:54 UTC (rev 14929)
@@ -235,5 +235,6 @@
 menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies
 menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies
 menu.local_admin.work_log.tab=Work Log
+menu.circulation.staged_patrons.tab=Staged Patrons
 load_printer_settings_error_description=Printer settings did not load cleanly with this version of Evergreen.  You should reconfigure your printer under Printer Settings Editor.
 load_printer_settings_error_title=Printer Settings

Added: trunk/Open-ILS/xul/staff_client/server/patron/staged.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/staged.js	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/patron/staged.js	2009-11-16 22:41:54 UTC (rev 14929)
@@ -0,0 +1,187 @@
+var list; var error; var net; var rows;
+
+function $(id) { return document.getElementById(id); }
+
+//// parent interfaces often call these
+function default_focus() { $('stgu_list').focus(); }
+function refresh() { populate_list(); }
+////
+
+function staged_init() {
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
+
+        commonStrings = $('commonStrings');
+        patronStrings = $('patronStrings');
+
+        if (typeof JSAN == 'undefined') {
+            throw(
+                commonStrings.getString('common.jsan.missing')
+            );
+        }
+
+        JSAN.errorLevel = "die"; // none, warn, or die
+        JSAN.addRepository('..');
+
+        JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+        XML_HTTP_SERVER = data.server_unadorned;
+
+        JSAN.use('util.error'); error = new util.error();
+        JSAN.use('util.network'); net = new util.network();
+        JSAN.use('patron.util'); 
+        JSAN.use('util.list'); 
+        JSAN.use('util.functional'); 
+        JSAN.use('util.widgets');
+
+        dojo.require('openils.Util');
+
+        init_list();
+        $('list_actions').appendChild( list.render_list_actions() );
+        list.set_list_actions();
+        $('cmd_cancel').addEventListener('command', gen_event_handler('cancel'), false);
+        $('cmd_load').addEventListener('command', gen_event_handler('load'), false);
+        populate_list();
+        default_focus();
+
+    } catch(E) {
+        var err_prefix = 'staged.js -> staged_init() : ';
+        if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+    }
+}
+
+function gen_event_handler(method) { // cancel or load?
+    return function(ev) {
+        try {
+            var sel = list.retrieve_selection();
+            var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } );
+
+            if (method == 'cancel') {
+
+                var pm = $('progress'); pm.value = 0; pm.hidden = false;
+                var idx = -1;
+
+                fieldmapper.standardRequest(
+                    [ api['FM_STGU_CANCEL'].app, api['FM_STGU_CANCEL'].method ],
+                    {   async: true,
+                        params: [ses(), ids],
+                        onresponse: function(r) {
+                            try {
+                                idx++; pm.value = Number( pm.value ) + 100/ids.length;
+                                var result = openils.Util.readResponse(r);
+                                if (typeof result.ilsevent != 'undefined') { throw(result); }
+                            } catch(E) {
+                                error.standard_unexpected_error_alert('In patron/staged.js, handle_'+i+'_event onresponse.',E);
+                            }
+                        },
+                        onerror: function(r) {
+                            try {
+                                var result = openils.Util.readResponse(r);
+                                throw(result);
+                            } catch(E) {
+                                error.standard_unexpected_error_alert('In patron/staged.js, handle_'+i+'_event onerror.',E);
+                            }
+                            pm.hidden = true; pm.value = 0; populate_list();
+                        },
+                        oncomplete: function(r) {
+                            try {
+                                var result = openils.Util.readResponse(r);
+                            } catch(E) {
+                                error.standard_unexpected_error_alert('In patron/staged.js, handle_'+i+'_event oncomplete.',E);
+                            }
+                            pm.hidden = true; pm.value = 0; populate_list();
+                        }
+                    }
+                );
+            } else {
+                // load
+            }
+
+        } catch(E) {
+            alert('Error in patron/staged.js, handle_???_event(): ' + E);
+        }
+    };
+}
+
+function init_list() {
+    try {
+
+        list = new util.list( 'stgu_list' );
+        list.init( 
+            {
+                'columns' : list.fm_columns(
+                    'stgu', {
+                        'stgu_ident_type' : { 'render' : function(my) { return data.hash.cit[ my.stgu.ident_type() ].name(); } },
+                        'stgu_home_ou' : { 'render' : function(my) { return data.hash.aou[ my.stgu.home_ou() ].shortname(); } }
+                    }
+                ),
+                'retrieve_row' : retrieve_row,
+                'on_select' : handle_selection
+            }
+        );
+
+    } catch(E) {
+        var err_prefix = 'staged.js -> init_list() : ';
+        if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+    }
+}
+
+function retrieve_row(params) { // callback function for fleshing rows in a list
+    try {
+        params.row_node.setAttribute('retrieve_id',params.row.my.stgu.row_id()); 
+        params.on_retrieve(params.row); 
+    } catch(E) {
+        alert('Error in staged.js, retrieve_row(): ' + E);
+    }
+    return params.row; 
+}
+
+function handle_selection(ev) { // handler for list row selection event
+    var sel = list.retrieve_selection();
+    if (sel.length > 0) {
+        $('cmd_cancel').setAttribute('disabled','false');
+        $('cmd_load').setAttribute('disabled','false');
+    } else {
+        $('cmd_cancel').setAttribute('disabled','true');
+        $('cmd_load').setAttribute('disabled','true');
+    }
+};
+
+function populate_list() {
+    try {
+
+        rows = {};
+        list.clear();
+
+        function onResponse(r) {
+            var blob = openils.Util.readResponse(r);
+            var row_params = {
+                'row' : {
+                    'my' : {
+                        'stgu' : blob.user
+                    }
+                }
+            };
+            rows[ blob.user.row_id() ] = list.append( row_params );
+        }
+
+        function onError(r) {
+            var my_stgu = openils.Util.readResponse(r);
+            alert('error, my_stgu = ' + js2JSON(my_stgu));
+        }
+
+        fieldmapper.standardRequest(
+            [api['FM_STGU_RETRIEVE'].app, api['FM_STGU_RETRIEVE'].method ],
+            {   async: true,
+                params: [ses(), ses('ws_ou')],
+                onresponse : onResponse,
+                onerror : onError,
+                oncomplete : function() {
+                }
+            }
+        );
+
+    } catch(E) {
+        var err_prefix = 'staged.js -> populate_list() : ';
+        if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+    }
+}

Added: trunk/Open-ILS/xul/staff_client/server/patron/staged.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/staged.xul	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/patron/staged.xul	2009-11-16 22:41:54 UTC (rev 14929)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Cancel/Reset Action::Trigger Events for Patron -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- PRESENTATION -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/global.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="staged_win" onload="try { font_helper(); persist_helper(); staged_init(); } 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;</script>
+    <scripts id="openils_util_scripts"/>
+
+    <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+    <script type="text/javascript" src="staged.js"/>
+
+    <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties" />
+
+    <commandset id="staged_cmds">
+        <command id="cmd_load" disabled="true"/>
+        <command id="cmd_cancel" disabled="true"/>
+    </commandset>
+
+    <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+    <!-- CONTENT -->
+    <groupbox id="staged_groupbox" flex="1" class="my_overflow">
+        <caption id="staged_caption" label="&staff.patron_display.staged.caption;"/>
+        <vbox flex="0">
+            <hbox flex="1">
+                <spacer flex="1" />
+                <progressmeter id="progress" flex="1" hidden="true" mode="undetermined"/>
+                <menubar>
+                    <menu label="&staff.patron_display.staged.menu.actions.label;" 
+                        accesskey="&staff.patron_display.staged.menu.actions.accesskey;" 
+                        style="-moz-user-focus: normal">
+                        <menupopup>
+                            <menuitem command="cmd_load" label="&staff.patron_display.staged.menu.actions.load.label;" accesskey="&staff.patron-display.menu.actions.load.accesskey;"/>
+                            <menuitem command="cmd_cancel" label="&staff.patron_display.staged.menu.actions.cancel.label;" accesskey="&staff.patron-display.menu.actions.cancel.accesskey;"/>
+                        </menupopup>
+                    </menu>
+                </menubar>
+            </hbox>
+        </vbox>
+        <tree id="stgu_list" flex="1" enableColumnDrag="true" context="stgu_actions" />
+        <hbox id="list_actions" />
+    </groupbox>
+
+    <popupset id="stgu_popupset">
+        <popup id="stgu_actions" position="at_pointer">
+            <menuitem command="cmd_load" label="&staff.patron_display.staged.menu.actions.load.label;" accesskey="&staff.patron-display.menu.actions.load.accesskey;"/>
+            <menuitem command="cmd_cancel" label="&staff.patron_display.staged.menu.actions.cancel.label;" accesskey="&staff.patron-display.menu.actions.cancel.accesskey;"/>
+        </popup>
+    </popupset>
+
+</window>
+



More information about the open-ils-commits mailing list