From fb08c4afe5807040bdc8a940d8197d92dc24665b Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Tue, 6 Mar 2012 08:42:36 -0500 Subject: [PATCH] lp948012 double-clicking on list rows Teaches util.list how to handle double-clicks, and Patron Search to use double-clicks for patron retrieval, and Holdings Maintenance to use double-clicks for item editing. Signed-off-by: Jason Etheridge Signed-off-by: Thomas Berezansky --- Open-ILS/xul/staff_client/chrome/content/util/list.js | 8 ++++++++ Open-ILS/xul/staff_client/server/cat/copy_browser.js | 12 ++++++++++++ Open-ILS/xul/staff_client/server/patron/display.js | 4 ++++ .../xul/staff_client/server/patron/search_result.js | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index 4013eff722..df7f37d180 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -174,6 +174,14 @@ util.list.prototype = { false ); } + if (typeof params.on_dblclick == 'function') { + this.node.addEventListener( + 'dblclick', + params.on_dblclick, + false + ); + } + /* this.node.addEventListener( 'mousemove', diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.js b/Open-ILS/xul/staff_client/server/cat/copy_browser.js index 0fbce27015..ce3c578f74 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.js @@ -1841,6 +1841,18 @@ cat.copy_browser.prototype = { window.xulG.on_select(list); } }, + 'on_dblclick' : function(ev) { + JSAN.use('util.functional'); + JSAN.use('util.widgets'); + var sel = obj.list.retrieve_selection(); + obj.controller.view.sel_clip.disabled = sel.length < 1; + obj.sel_list = util.functional.map_list( + sel, + function(o) { return o.getAttribute('retrieve_id'); } + ); + obj.toggle_actions(); + util.widgets.dispatch('command','cmd_edit_items'); + }, 'on_select' : function(ev) { JSAN.use('util.functional'); var sel = obj.list.retrieve_selection(); diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js index 97f23c0b49..f18ecf5f09 100644 --- a/Open-ILS/xul/staff_client/server/patron/display.js +++ b/Open-ILS/xul/staff_client/server/patron/display.js @@ -735,6 +735,10 @@ patron.display.prototype = { 'query' : query, 'search_limit' : search_limit, 'search_sort' : search_sort, + 'on_dblclick' : function(list) { + JSAN.use('util.widgets'); + util.widgets.dispatch('command','cmd_patron_retrieve') + }, 'on_select' : function(list) { if (!list) return; if (list.length < 1) return; diff --git a/Open-ILS/xul/staff_client/server/patron/search_result.js b/Open-ILS/xul/staff_client/server/patron/search_result.js index 6d71bd50b2..0512e1c146 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_result.js +++ b/Open-ILS/xul/staff_client/server/patron/search_result.js @@ -102,6 +102,24 @@ patron.search_result.prototype = { } ); }, + 'on_dblclick' : function(ev) { + JSAN.use('util.functional'); + var sel = obj.list.retrieve_selection(); + var list = util.functional.map_list( + sel, + function(o) { return o.getAttribute('retrieve_id'); } + ); + obj.controller.view.cmd_sel_clip.setAttribute('disabled', list.length < 1 ); + if (typeof obj.on_dblclick == 'function') { + obj.on_dblclick(list); + } + if (typeof window.xulG == 'object' && typeof window.xulG.on_dblclick == 'function') { + obj.error.sdump('D_PATRON','patron.search_result: Calling external .on_dblclick()\n'); + window.xulG.on_dblclick(list); + } else { + obj.error.sdump('D_PATRON','patron.search_result: No external .on_dblclick()\n'); + } + }, 'on_select' : function(ev) { JSAN.use('util.functional'); var sel = obj.list.retrieve_selection(); -- 2.11.0