[open-ils-commits] r17782 - trunk/Open-ILS/xul/staff_client/server/patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Sep 17 18:15:45 EDT 2010
Author: phasefx
Date: 2010-09-17 18:15:39 -0400 (Fri, 17 Sep 2010)
New Revision: 17782
Modified:
trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
Log:
change pcrud.apply to pcrud.update, and make use of closures in loop. fixes hanging progress bar and lack of list refresh in Messages interface after modifying or archiving an existing message/penalty
Modified: trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js 2010-09-17 21:20:51 UTC (rev 17781)
+++ trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js 2010-09-17 22:15:39 UTC (rev 17782)
@@ -292,7 +292,7 @@
penalty.ischanged( 1 );
dojo.require('openils.PermaCrud');
var pcrud = new openils.PermaCrud( { authtoken :ses() });
- pcrud.apply( penalty, {
+ pcrud.update( penalty, {
timeout : 10, // makes it synchronous
onerror : function(r) {
try {
@@ -303,19 +303,21 @@
alert(E);
}
},
- oncomplete : function(r) {
- try {
- var res = openils.Util.readResponse(r,true);
- /* FIXME - test for success */
- var row_params = rows[ ids[i] ];
- row_params.row.my.ausp = penalty;
- row_params.row.my.csp = penalty.standing_penalty();
- list.refresh_row( row_params );
- document.getElementById('progress').hidden = true;
- } catch(E) {
- alert(E);
+ oncomplete : function gen_func(p,row_id) {
+ return function(r) {
+ try {
+ var res = openils.Util.readResponse(r,true);
+ /* FIXME - test for success */
+ var row_params = rows[row_id];
+ row_params.row.my.ausp = p;
+ row_params.row.my.csp = p.standing_penalty();
+ list.refresh_row( row_params );
+ document.getElementById('progress').hidden = true;
+ } catch(E) {
+ alert(E);
+ }
}
- }
+ }(penalty,ids[i])
});
}
}
@@ -346,7 +348,7 @@
penalty.stop_date( util.date.formatted_date(new Date(),'%F') );
dojo.require('openils.PermaCrud');
var pcrud = new openils.PermaCrud( { authtoken :ses() });
- pcrud.apply( penalty, {
+ pcrud.update( penalty, {
onerror : function(r) {
try {
var res = openils.Util.readResponse(r,true);
@@ -358,21 +360,23 @@
document.getElementById('progress').hidden = true;
}
},
- oncomplete : function(r) {
- try {
- var res = openils.Util.readResponse(r,true);
- /* FIXME - test for success */
- var node = rows[ ids[i] ].my_node;
- var parentNode = node.parentNode;
- parentNode.removeChild( node );
- delete(rows[ ids[i] ]);
- } catch(E) {
- alert(E);
+ oncomplete : function gen_func(row_id) {
+ return function(r) {
+ try {
+ var res = openils.Util.readResponse(r,true);
+ /* FIXME - test for success */
+ var node = rows[row_id].my_node;
+ var parentNode = node.parentNode;
+ parentNode.removeChild( node );
+ delete(rows[row_id]);
+ } catch(E) {
+ alert(E);
+ }
+ if (--outstanding_requests==0) {
+ document.getElementById('progress').hidden = true;
+ }
}
- if (--outstanding_requests==0) {
- document.getElementById('progress').hidden = true;
- }
- }
+ }(ids[i])
});
}
/*
More information about the open-ils-commits
mailing list