standing penalty patron UI. almost there
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Dec 2008 23:35:38 +0000 (23:35 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Dec 2008 23:35:38 +0000 (23:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11717 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/locale/en-US/common.properties
Open-ILS/xul/staff_client/server/patron/display.js
Open-ILS/xul/staff_client/server/patron/display.xul
Open-ILS/xul/staff_client/server/patron/display_overlay.xul
Open-ILS/xul/staff_client/server/patron/standing_penalties.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/standing_penalties.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/util.js

index d3234d6..2902ac5 100644 (file)
 <!ENTITY staff.patron_display.standing.label 'Standing:'>
 <!ENTITY staff.patron_display.status.caption 'Status'>
 <!ENTITY staff.patron_display_interface_label "Patron">
+<!ENTITY staff.patron_display.penalty.caption "Staff-Generated Blocks / Standing Penalties">
+<!ENTITY staff.patron_display.penalty.menu.actions.label "Actions for these Penalties">
+<!ENTITY staff.patron_display.penalty.menu.actions.accesskey "P">
+<!ENTITY staff.patron_display.penalty.menu.actions.apply.label "Apply to Patron">
+<!ENTITY staff.patron_display.penalty.menu.actions.apply.accesskey "A">
+<!ENTITY staff.patron_display.penalty.menu.actions.remove.label "Remoe from Patron">
+<!ENTITY staff.patron_display.penalty.menu.actions.remove.accesskey "R">
 <!ENTITY staff.patron_editor_interface_label "Patron Edit">
 <!ENTITY staff.patron_interface_label "Patron ">
 <!ENTITY staff.patron_navbar.bills 'Bills'>
 <!ENTITY staff.patron_navbar.retrieve.accesskey 'R'>
 <!ENTITY staff.patron_navbar.actions.menu.label 'Actions for this Patron'>
 <!ENTITY staff.patron_navbar.actions.menu.accesskey 'A'>
+<!ENTITY staff.patron_navbar.actions.menu.standing_penalties.label 'Modify Blocks/Standing Penalties'>
+<!ENTITY staff.patron_navbar.actions.menu.standing_penalties.accesskey 'M'>
 <!ENTITY staff.patron_register_interface_label "New Patron">
 <!ENTITY staff.patron_search_form.caption 'Search for Patron'>
 <!ENTITY staff.patron_search_form.city.accesskey ''>
index 448d2b3..74360c4 100644 (file)
@@ -307,6 +307,7 @@ const urls = {
        'XUL_REMOTE_BROWSER' : '/xul/server/util/rbrowser.xul',
        'XUL_SPINE_LABEL' : '/xul/server/cat/spine_labels.xul',
        'XUL_STANDALONE' : 'chrome://open_ils_staff_client/content/circ/offline.xul',
+       'XUL_STANDING_PENALTIES' : '/xul/server/patron/standing_penalties.xul',
        'XUL_STAT_CAT_EDIT' : '/xul/server/admin/stat_cat_editor.xhtml',
        'XUL_SURVEY_WIZARD' : 'chrome://open_ils_staff_client/content/admin/survey_wizard.xul',
        'XUL_USER_BUCKETS' : '/xul/server/patron/user_buckets.xul',
index 534442a..bf860ec 100644 (file)
@@ -65,6 +65,22 @@ staff.mvr_label_title=Title
 staff.bills_xact_dates_label=Record / Dates
 staff.bills_information=Information
 staff.bills_current_payment_label=Current Payment
+staff.csp_id_label=Penalty ID
+staff.csp_name_label=Name
+staff.csp_label_label=Label
+staff.csp_block_list_label=Block List
+staff.csp_block_circ_label=Blocks Circulations?
+staff.csp_block_renew_label=Blocks Renewals?
+staff.csp_block_hold_label=Blocks Holds?
+staff.csp_block_circ_yes=Yes
+staff.csp_block_circ_no=
+staff.csp_block_renew_yes=Yes
+staff.csp_block_renew_no=
+staff.csp_block_hold_yes=Yes
+staff.csp_block_hold_no=
+staff.csp_applied_label=Applied to Patron?
+staff.csp_applied_yes=Applied
+staff.csp_applied_no=
 staff.mbts_id_label=Bill # 
 staff.mbts_xact_start_label=Start
 staff.mbts_xact_finish_label=Finish
index 1a0f3da..217b095 100644 (file)
@@ -359,6 +359,18 @@ patron.display.prototype = {
                         function() {
                              var frame = obj.right_deck.reset_iframe( urls.XUL_USER_PERM_EDITOR + '?ses=' + window.escape(ses()) + '&usr=' + obj.patron.id(), {}, {});
                         }
+                    ],
+                    'cmd_standing_penalties' : [
+                        ['command'],
+                        function() {
+                            var vframe = obj.right_deck.reset_iframe(
+                                urls.XUL_STANDING_PENALTIES,
+                                {},
+                                {
+                                    'patron' : obj.patron,
+                                }
+                            );
+                        } 
                     ]
                                }
                        }
index c952323..aa30bd6 100644 (file)
                <command id="cmd_search_form" />
                <command id="cmd_verify_credentials" />
                <command id="cmd_perm_editor" />
+               <command id="cmd_standing_penalties" />
        </commandset>
 
        <box id="patron_display_main" class="my_overflow" />
index ef9614c..37e5749 100644 (file)
@@ -85,6 +85,8 @@
                     <menupopup>
                         <menuitem label="&staff.patron_display.verify_password.label;" accesskey="&staff.patron_display.verify_password.accesskey;" command="cmd_verify_credentials"/>
                         <menuitem label="&staff.main.menu.admin.user_edit.label;" accesskey="&staff.main.menu.admin.user_edit.accesskey;" command="cmd_perm_editor"/>
+                        <menuitem label="&staff.patron_navbar.actions.menu.standing_penalties.label;" accesskey="&staff.patron_navbar.actions.menu.standing_penalties.accesskey;" 
+                            command="cmd_standing_penalties"/>
                     </menupopup>
                 </menu>
             </menubar>
diff --git a/Open-ILS/xul/staff_client/server/patron/standing_penalties.js b/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
new file mode 100644 (file)
index 0000000..dd8f226
--- /dev/null
@@ -0,0 +1,59 @@
+function penalty_init() {
+    try {
+        commonStrings = document.getElementById('commonStrings');
+        patronStrings = document.getElementById('patronStrings');
+
+        if (typeof JSAN == 'undefined') {
+            throw(
+                commonStrings.getString('common.jsan.missing')
+            );
+        }
+
+        JSAN.errorLevel = "die"; // none, warn, or die
+        JSAN.addRepository('..');
+
+               JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+        XML_HTTP_SERVER = data.server_unadorned;
+
+        JSAN.use('util.network'); var net = new util.network();
+        JSAN.use('patron.util'); JSAN.use('util.list'); JSAN.use('util.functional');
+
+        var list = new util.list( 'csp_list' );
+        list.init( 
+            {
+                'columns' : patron.util.csp_columns({}),
+                'map_row_to_columns' : patron.util.std_map_row_to_columns(),
+                'retrieve_row' : function(params) { params.row_node.setAttribute('retrieve_id',params.row.my.csp.id()); params.on_retrieve(params.row); return params.row; },
+                'on_select' : function(ev) {
+                    var sel = list.retrieve_selection();
+                    var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } );
+                    if (ids.length > 0) {
+                        document.getElementById('cmd_apply_penalty').setAttribute('disabled','false');
+                        document.getElementById('cmd_remove_penalty').setAttribute('disabled','false');
+                    } else {
+                        document.getElementById('cmd_apply_penalty').setAttribute('disabled','true');
+                        document.getElementById('cmd_remove_penalty').setAttribute('disabled','true');
+                    }
+                }
+            } 
+        );
+
+        for (var i = 0; i < data.list.csp.length; i++) {
+            if (data.list.csp[i].id() >= 100 ) {
+                list.append(
+                    {
+                        'row' : {
+                            'my' : {
+                                'csp' : data.list.csp[i],
+                                'au' : xulG.patron
+                            }
+                        }
+                    }
+                );
+            }
+        };
+
+    } catch(E) {
+        alert(E);
+    }
+}
diff --git a/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul b/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul
new file mode 100644 (file)
index 0000000..e2a6906
--- /dev/null
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Apply/Remove Standing Penalties to Patron -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- PRESENTATION -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" 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="penalty_win" onload="try { penalty_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; var G;</script>
+       <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+       <script type="text/javascript" src="standing_penalties.js"/>
+
+       <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties" />
+
+       <commandset id="penalty_cmds">
+               <command id="cmd_apply_penalty" />
+               <command id="cmd_remove_penalty" />
+       </commandset>
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- CONTENT -->
+       <groupbox id="penalty_groupbox" flex="1" class="my_overflow">
+               <caption id="penalty_caption" label="&staff.patron_display.penalty.caption;"/>
+        <vbox flex="0">
+            <hbox flex="1">
+                <spacer flex="1"/>
+                <menubar>
+                    <menu label="&staff.patron_display.penalty.menu.actions.label;" accesskey="&staff.patron_display.penalty.menu.actions.accesskey;">
+                        <menupopup>
+                            <menuitem command="cmd_apply_penalty" label="&staff.patron_display.penalty.menu.actions.apply.label;" accesskey="&staff.patron-display.menu.actions.apply.accesskey;"/>
+                            <menuitem command="cmd_remove_penalty" label="&staff.patron_display.penalty.menu.actions.remove.label;" accesskey="&staff.patron-display.menu.actions.remove.accesskey;"/>
+                        </menupopup>
+                    </menu>
+                </menubar>
+            </hbox>
+        </vbox>
+        <tree id="csp_list" flex="1" enableColumnDrag="true" context="csp_actions"/>
+       </groupbox>
+
+    <popupset id="csp_popupset">
+        <popup id="csp_actions" position="at_pointer">
+            <menuitem command="cmd_apply_penalty" label="&staff.patron_display.penalty.menu.actions.apply.label;" accesskey="&staff.patron-display.menu.actions.apply.accesskey;"/>
+            <menuitem command="cmd_remove_penalty" label="&staff.patron_display.penalty.menu.actions.remove.label;" accesskey="&staff.patron-display.menu.actions.remove.accesskey;"/>
+        </popup>
+    </popupset>
+
+</window>
+
index 040b115..c424653 100644 (file)
@@ -257,6 +257,87 @@ patron.util.mp_columns = function(modify,params) {
        return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
 }
 
+patron.util.csp_columns = function(modify,params) {
+
+       JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+    JSAN.use('util.functional');
+
+    var commonStrings = document.getElementById('commonStrings');
+
+       var c = [
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_id', 'label' : commonStrings.getString('staff.csp_id_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : true, 'render' : function(my) { return my.csp.id(); }
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_name', 'label' : commonStrings.getString('staff.csp_name_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : false, 'render' : function(my) { return my.csp.name(); }
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_label', 'label' : commonStrings.getString('staff.csp_label_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : false, 'render' : function(my) { return my.csp.label(); }
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_block_list', 'label' : commonStrings.getString('staff.csp_block_list_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : true, 'render' : function(my) { return my.csp.block_list(); }
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_block_circ', 'label' : commonStrings.getString('staff.csp_block_circ_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : true, 'render' : function(my) { 
+                return String( my.csp.block_list() ).match('circ') ? commonStrings.getString('staff.csp_block_circ_yes') : commonStrings.getString('staff.csp_block_circ_no'); 
+            }
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_block_renew', 'label' : commonStrings.getString('staff.csp_block_renew_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : true, 'render' : function(my) { 
+                return String( my.csp.block_list() ).match('renew') ? commonStrings.getString('staff.csp_block_renew_yes') : commonStrings.getString('staff.csp_block_renew_no'); 
+
+            }
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_block_hold', 'label' : commonStrings.getString('staff.csp_block_hold_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : true, 'render' : function(my) { 
+                return String( my.csp.block_list() ).match('hold') ?  commonStrings.getString('staff.csp_block_hold_yes') : commonStrings.getString('staff.csp_block_hold_no'); 
+            }
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'csp_applied', 'label' : commonStrings.getString('staff.csp_applied_label'), 'flex' : 1,
+                       'primary' : false, 'hidden' : false, 'render' : function(my) { 
+                return util.functional.find_id_object_in_list( my.au.standing_penalties(), my.csp.id() ) 
+                    ? commonStrings.getString('staff.csp_applied_yes') : commonStrings.getString('staff.csp_applied_no'); 
+            }
+               }
+       ];
+       for (var i = 0; i < c.length; i++) {
+               if (modify[ c[i].id ]) {
+                       for (var j in modify[ c[i].id ]) {
+                               c[i][j] = modify[ c[i].id ][j];
+                       }
+               }
+       }
+       if (params) {
+               if (params.just_these) {
+                       var new_c = [];
+                       for (var i = 0; i < params.just_these.length; i++) {
+                               var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+                               new_c.push( function(y){ return y; }( x ) );
+                       }
+                       c = new_c;
+               }
+               if (params.except_these) {
+                       var new_c = [];
+                       for (var i = 0; i < c.length; i++) {
+                               var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+                               if (!x) new_c.push(c[i]);
+                       }
+                       c = new_c;
+               }
+
+       }
+       return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+}
+
+
 patron.util.columns = function(modify,params) {
        
        JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});