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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Dec 30 18:35:43 EST 2008


Author: phasefx
Date: 2008-12-30 18:35:38 -0500 (Tue, 30 Dec 2008)
New Revision: 11717

Added:
   trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
   trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.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/server/locale/en-US/common.properties
   trunk/Open-ILS/xul/staff_client/server/patron/display.js
   trunk/Open-ILS/xul/staff_client/server/patron/display.xul
   trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul
   trunk/Open-ILS/xul/staff_client/server/patron/util.js
Log:
standing penalty patron UI.  almost there

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2008-12-30 21:50:45 UTC (rev 11716)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2008-12-30 23:35:38 UTC (rev 11717)
@@ -1148,6 +1148,13 @@
 <!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'>
@@ -1169,6 +1176,8 @@
 <!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 ''>

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2008-12-30 21:50:45 UTC (rev 11716)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2008-12-30 23:35:38 UTC (rev 11717)
@@ -307,6 +307,7 @@
 	'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',

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/common.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/common.properties	2008-12-30 21:50:45 UTC (rev 11716)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/common.properties	2008-12-30 23:35:38 UTC (rev 11717)
@@ -65,6 +65,22 @@
 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

Modified: trunk/Open-ILS/xul/staff_client/server/patron/display.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display.js	2008-12-30 21:50:45 UTC (rev 11716)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display.js	2008-12-30 23:35:38 UTC (rev 11717)
@@ -359,6 +359,18 @@
                         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,
+                                }
+                            );
+                        } 
                     ]
 				}
 			}

Modified: trunk/Open-ILS/xul/staff_client/server/patron/display.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display.xul	2008-12-30 21:50:45 UTC (rev 11716)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display.xul	2008-12-30 23:35:38 UTC (rev 11717)
@@ -101,6 +101,7 @@
 		<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" />

Modified: trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul	2008-12-30 21:50:45 UTC (rev 11716)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul	2008-12-30 23:35:38 UTC (rev 11717)
@@ -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>

Added: trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2008-12-30 23:35:38 UTC (rev 11717)
@@ -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);
+    }
+}

Added: trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul	2008-12-30 23:35:38 UTC (rev 11717)
@@ -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>
+

Modified: trunk/Open-ILS/xul/staff_client/server/patron/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/util.js	2008-12-30 21:50:45 UTC (rev 11716)
+++ trunk/Open-ILS/xul/staff_client/server/patron/util.js	2008-12-30 23:35:38 UTC (rev 11717)
@@ -257,6 +257,87 @@
 	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'});



More information about the open-ils-commits mailing list