[open-ils-commits] r14951 - in trunk/Open-ILS/xul/staff_client/server: admin circ patron (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 18 08:33:32 EST 2009
Author: erickson
Date: 2009-11-18 08:33:31 -0500 (Wed, 18 Nov 2009)
New Revision: 14951
Modified:
trunk/Open-ILS/xul/staff_client/server/admin/transit_list.js
trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js
trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul
trunk/Open-ILS/xul/staff_client/server/circ/renew.js
trunk/Open-ILS/xul/staff_client/server/circ/util.js
trunk/Open-ILS/xul/staff_client/server/patron/holds.js
trunk/Open-ILS/xul/staff_client/server/patron/items.js
Log:
Patch from Lebbeous Fogle-Weekley to change the behavior of the "Show Item Details" context
menu entry for patron items out, checkin, transit list, copy status, renewal, hold shelf.
Action now opens a new Item Status tab with the alternate (details) view focused by default.
Works with single or multiple copies.
TODO: no need to fetch copy details twice for the same copy
Modified: trunk/Open-ILS/xul/staff_client/server/admin/transit_list.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/transit_list.js 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/admin/transit_list.js 2009-11-18 13:33:31 UTC (rev 14951)
@@ -405,7 +405,16 @@
'sel_opac' : [ ['command'], function() { JSAN.use('cat.util'); cat.util.show_in_opac(obj.selection_list); } ],
'sel_transit_abort' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.abort_transits(obj.selection_list); } ],
'sel_patron' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.selection_list); } ],
- 'sel_copy_details' : [ ['command'], function() { JSAN.use('circ.util'); for (var i = 0; i < obj.selection_list.length; i++) { circ.util.show_copy_details( obj.selection_list[i].copy_id ); } } ],
+ 'sel_copy_details' : [ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
+ } ],
'sel_bucket' : [ ['command'], function() { JSAN.use('cat.util'); cat.util.add_copies_to_bucket(obj.selection_list); } ],
'cmd_print_list' : [ ['command'], function() { obj.print_list(0); } ],
'cmd_kick_off' : [ ['command'], function(ev) { ev.target.disabled = true; obj.kick_off(); } ],
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js 2009-11-18 13:33:31 UTC (rev 14951)
@@ -161,9 +161,12 @@
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_backdate' : [
Modified: trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js 2009-11-18 13:33:31 UTC (rev 14951)
@@ -276,9 +276,12 @@
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_renew' : [
@@ -1148,8 +1151,14 @@
var f = obj.browser.get_content();
xulG.barcode = result.copy.barcode(); // FIXME: We could pass the already-fetched data, but need to figure out how to manage that and honor Trim List, the whole point of which is to limit memory consumption
if (f) {
- f.xulG = xulG;
- f.load_item();
+ if (!xulG.from_item_details_new) {
+ /* We don't want to call load_item() in this case
+ * because we're going to call copy_status() later
+ * (which gets action menus populated, unlike
+ * load_item()). */
+ f.xulG = xulG;
+ f.load_item();
+ }
} else {
alert('hrmm');
}
Modified: trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul 2009-11-18 13:33:31 UTC (rev 14951)
@@ -56,32 +56,67 @@
}
}
- JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
+ JSAN.use('OpenILS.data');
+ g.data = new OpenILS.data();
+ g.data.stash_retrieve();
- g.barcodes = xul_param(
- 'barcodes',{
- 'concat' : true,
- 'JSON2js_if_cgi' : true,
- 'stash_name':'temp_barcodes_for_copy_status',
- 'clear_xpcom' : true,
+ if (window.xulG.barcodes && window.xulG.barcodes.length) {
+ if (window.xulG.from_item_details_new) {
+ // Switch item status display to "alternate view"
+ g.copy_status.controller.control_map.cmd_alt_view[1](0);
+
+ // This property's truthiness should not persist any
+ // longer. Otherwise, user's won't get results if they
+ // enter a different barcode into the Alternate View.
+ window.xulG.from_item_details_new = false;
}
- ) || [];
-
- if (g.barcodes.length > 0) {
+
+ // This timeout is needed to populate the
+ // "Actions for (Catalogers|Selected Items)" menus.
+ // Without this, the other fields still get populated
+ // with data about the item referred to by barcode, but
+ // for some reason those menus don't start working.
JSAN.use('util.exec'); var exec = new util.exec();
var funcs = [];
- for (var i = 0; i < g.barcodes.length; i++) {
+ for (var i = 0; i < window.xulG.barcodes.length; i++) {
funcs.push(
function(b){
return function() {
g.copy_status.copy_status(b);
}
- }(g.barcodes[i])
+ }(window.xulG.barcodes[i])
);
}
- exec.chain( funcs );
+ setTimeout(function() { exec.chain(funcs); }, 1000);
+ } else {
+ g.barcodes = xul_param(
+ 'barcodes',{
+ 'concat' : true,
+ 'JSON2js_if_cgi' : true,
+ 'stash_name':'temp_barcodes_for_copy_status',
+ 'clear_xpcom' : true,
+ }
+ ) || [];
+
+ if (g.barcodes.length > 0) {
+ JSAN.use('util.exec'); var exec = new util.exec();
+ var funcs = [];
+ for (var i = 0; i < g.barcodes.length; i++) {
+ funcs.push(
+ function(b){
+ return function() {
+ g.copy_status.copy_status(b);
+ }
+ }(g.barcodes[i])
+ );
+ }
+ if (window.xulG.from_item_details_new) {
+ g.copy_status.controller.control_map.cmd_alt_view[1](0);
+ window.xulG.from_item_details_new = false;
+ }
+ setTimeout(function() { exec.chain(funcs); }, 1000);
+ }
}
-
} catch(E) {
var err_msg = document.getElementById("commonStrings").getFormattedString('common.exception', ['circ.copy_status.xul', E]);
try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
Modified: trunk/Open-ILS/xul/staff_client/server/circ/renew.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/renew.js 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/circ/renew.js 2009-11-18 13:33:31 UTC (rev 14951)
@@ -158,9 +158,12 @@
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_mark_items_damaged' : [
Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js 2009-11-18 13:33:31 UTC (rev 14951)
@@ -84,6 +84,19 @@
}
};
+circ.util.item_details_new = function(barcodes) {
+ try {
+ var content_params = {
+ 'from_item_details_new': true,
+ 'barcodes': barcodes
+ };
+ xulG.new_tab(urls.XUL_COPY_STATUS, {}, content_params);
+ } catch(E) {
+ JSAN.use('util.error');
+ (new util.error()).standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_copy.failure'),E);
+ }
+};
+
circ.util.backdate_post_checkin = function(circ_ids) {
var obj = {};
JSAN.use('util.error'); obj.error = new util.error();
Modified: trunk/Open-ILS/xul/staff_client/server/patron/holds.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/holds.js 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/patron/holds.js 2009-11-18 13:33:31 UTC (rev 14951)
@@ -275,9 +275,12 @@
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- if (obj.retrieve_ids[i].copy_id) circ.util.show_copy_details( obj.retrieve_ids[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.retrieve_ids,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
Modified: trunk/Open-ILS/xul/staff_client/server/patron/items.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/items.js 2009-11-18 07:25:39 UTC (rev 14950)
+++ trunk/Open-ILS/xul/staff_client/server/patron/items.js 2009-11-18 13:33:31 UTC (rev 14951)
@@ -120,7 +120,12 @@
'sel_copy_details' : [ ['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.retrieve_ids.length; i++) { circ.util.show_copy_details( obj.retrieve_ids[i].copy_id ); }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.retrieve_ids,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_patron2' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.retrieve_ids2); } ],
More information about the open-ils-commits
mailing list