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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 7 03:16:42 EST 2009


Author: phasefx
Date: 2009-01-07 03:16:38 -0500 (Wed, 07 Jan 2009)
New Revision: 11755

Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/common.properties
   trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
   trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul
   trunk/Open-ILS/xul/staff_client/server/patron/util.js
Log:
re-orient this interface from scaffolding off of csp's to just using ausp's.  Need to add a drop-down of csp's for creating new ausp's, and an edit note function.  Also need to rethink the patron sidebar to maintain/stabilize dimensions/layout

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-01-07 02:23:03 UTC (rev 11754)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-01-07 08:16:38 UTC (rev 11755)
@@ -1151,8 +1151,6 @@
 <!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 "Remove from Patron">
 <!ENTITY staff.patron_display.penalty.menu.actions.remove.accesskey "R">
 <!ENTITY staff.patron_editor_interface_label "Patron Edit">

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	2009-01-07 02:23:03 UTC (rev 11754)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/common.properties	2009-01-07 08:16:38 UTC (rev 11755)
@@ -78,9 +78,6 @@
 staff.csp_block_renew_no=
 staff.csp_block_hold_yes=Yes
 staff.csp_block_hold_no=
-staff.ausp_applied_label=Applied to Patron?
-staff.ausp_applied_yes=Applied
-staff.ausp_applied_no=
 staff.ausp_staff_label=Applied By 
 staff.ausp_set_date_label=Applied On 
 staff.ausp_note_label=Note 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2009-01-07 02:23:03 UTC (rev 11754)
+++ trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2009-01-07 08:16:38 UTC (rev 11755)
@@ -22,27 +22,17 @@
         var list = new util.list( 'csp_list' );
         list.init( 
             {
-                'columns' : patron.util.csp_columns({}),
+                'columns' : patron.util.ausp_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()); 
-                    if (params.row.my.ausp) { params.row_node.setAttribute('retrieve_ausp_id',params.row.my.ausp.id()); }
+                    params.row_node.setAttribute('retrieve_id',params.row.my.ausp.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') ); } );
-                    var ausp_ids = util.functional.filter_list(
-                        util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_ausp_id') || 'null' ); } ),
-                        function(o) { return o != null; }
-                    );
                     if (ids.length > 0) {
-                        document.getElementById('cmd_apply_penalty').setAttribute('disabled','false');
-                    } else {
-                        document.getElementById('cmd_apply_penalty').setAttribute('disabled','true');
-                    }
-                    if (ausp_ids.length > 0) {
                         document.getElementById('cmd_remove_penalty').setAttribute('disabled','false');
                     } else {
                         document.getElementById('cmd_remove_penalty').setAttribute('disabled','true');
@@ -51,21 +41,18 @@
             } 
         );
 
-        for (var i = 0; i < data.list.csp.length; i++) {
-            if (data.list.csp[i].id() > 100 ) {
-            //if (true) {
-                list.append(
-                    {
-                        'row' : {
-                            'my' : {
-                                'csp' : data.list.csp[i],
-                                'au' : xulG.patron,
-                                'ausp' : util.functional.find_list( xulG.patron.standing_penalties(), function(o) { return o.standing_penalty().id() == data.list.csp[i].id(); } )
-                            }
-                        }
+        var rows = [];
+        for (var i = 0; i < xulG.patron.standing_penalties().length; i++) {
+            var row_params = {
+                'row' : {
+                    'my' : {
+                        'ausp' : xulG.patron.standing_penalties()[i],
+                        'csp' : xulG.patron.standing_penalties()[i].standing_penalty(),
+                        'au' : xulG.patron,
                     }
-                );
-            }
+                }
+            };
+            rows[ xulG.patron.standing_penalties()[i].id() ] = list.append( row_params );
         };
 
         document.getElementById('cmd_apply_penalty').addEventListener(
@@ -116,19 +103,25 @@
             'command',
             function() {
                 var sel = list.retrieve_selection();
-                var ids = util.functional.filter_list(
-                    util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_ausp_id') || 'null' ); } ),
-                    function(o) { return o != null; }
-                );
+                var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } );
                 if (ids.length > 0) {
                     function gen_func(id) {
                         return function() {
-                            var penalty = util.functional.find_list( xulG.patron.standing_penalties(), function(o) { return o.id() == id; } );
-                            penalty.isdeleted(1);
+                            try {
+                                var penalty = util.functional.find_list( xulG.patron.standing_penalties(), function(o) { return o.id() == id; } );
+                                penalty.isdeleted(1);
 
-                            var req = net.simple_request( 'FM_AUSP_REMOVE', [ ses(), penalty ] );
-                            if (typeof req.ilsevent != 'undefined' || String(req) != '1') {
-                                error.standard_unexpected_error_alert(patronStrings.getFormattedString('staff.patron.standing_penalty.remove_error',[data.hash.csp[id].name()]),req);
+                                var req = net.simple_request( 'FM_AUSP_REMOVE', [ ses(), penalty ] );
+                                if (typeof req.ilsevent != 'undefined' || String(req) != '1') {
+                                    error.standard_unexpected_error_alert(patronStrings.getFormattedString('staff.patron.standing_penalty.remove_error',[id]),req);
+                                } else {
+                                    var node = rows[ id ].my_node;
+                                    var parentNode = node.parentNode;
+                                    parentNode.removeChild( node );
+                                    delete(rows[ id ]);
+                                }
+                            } catch(E) {
+                                alert(E);
                             }
                         }; 
                     }

Modified: trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul	2009-01-07 02:23:03 UTC (rev 11754)
+++ trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul	2009-01-07 08:16:38 UTC (rev 11755)
@@ -47,7 +47,6 @@
                 <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>
@@ -59,7 +58,6 @@
 
     <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>

Modified: trunk/Open-ILS/xul/staff_client/server/patron/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/util.js	2009-01-07 02:23:03 UTC (rev 11754)
+++ trunk/Open-ILS/xul/staff_client/server/patron/util.js	2009-01-07 08:16:38 UTC (rev 11755)
@@ -257,7 +257,7 @@
 	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) {
+patron.util.ausp_columns = function(modify,params) {
 
 	JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
     JSAN.use('util.functional');
@@ -301,12 +301,6 @@
             }
 		},
 		{
-			'persist' : 'hidden width ordinal', 'id' : 'ausp_applied', 'label' : commonStrings.getString('staff.ausp_applied_label'), 'flex' : 1,
-			'primary' : false, 'hidden' : false, 'render' : function(my) { 
-                return my.ausp ? commonStrings.getString('staff.ausp_applied_yes') : commonStrings.getString('staff.ausp_applied_no'); 
-            }
-		},
-		{
 			'persist' : 'hidden width ordinal', 'id' : 'ausp_staff', 'label' : commonStrings.getString('staff.ausp_staff_label'), 'flex' : 1,
 			'primary' : false, 'hidden' : true, 'render' : function(my) { 
                 return my.ausp ? my.ausp.staff() : '';



More information about the open-ils-commits mailing list