From 5a0beda6173e6d7715ed3f454e787297d96d29d2 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Tue, 13 Sep 2011 08:48:52 -0400 Subject: [PATCH] LP#848945 - Hide Empty Libs checkbox The "Show Libraries With Items" button in Holdings Maintenance shows all the libs with items regardless of the library/depth filters. One problem is that when the list refreshes (whenever an item/volume is edited, deleted, or added), staff using this feature have to re-press the button, which can take a while for some bibs. This branch removes this button and replaces it with a "sticky" checkbox labelled "Hide Empty Libs". This allows you to do almost the same thing; you can set the context library to Consortium and the depth filter to the lowest depth, which would normally show all libs, but then use the checkbox to prune out the ones that have no children and no volumes(*). One possible use case that we'd lose is the ability to show a specific set of libs that don't already have volumes in addition to all the libs that do. * - Also, the test for whether to hide an org or not is very simplistic, but easy to implement. A more aggressive test would hide a library and all its descendants if none of the descendants have volumes. Signed-off-by: Jason Etheridge Signed-off-by: Mike Rylander --- Open-ILS/web/opac/locale/en-US/lang.dtd | 3 +- .../staff_client/server/cat/copy_browser.js | 57 ++++++++++++++++--- .../staff_client/server/cat/copy_browser.xul | 3 +- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index f352a1f3c7..2ba73f7e16 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2620,9 +2620,8 @@ + - - 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 bb9b632ddd..d234f37ba3 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.js @@ -42,8 +42,15 @@ cat.copy_browser.prototype = { document.getElementById('show_acns').addEventListener( 'command', function(ev) { - JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned); - util.widgets.save_attributes(file, { 'lib_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], 'show_acps' : [ 'checked' ] }); + JSAN.use('util.file'); + var file = new util.file( + 'copy_browser_prefs.'+obj.data.server_unadorned); + util.widgets.save_attributes(file, { + 'lib_menu' : [ 'value' ], + 'depth_menu' : [ 'value' ], + 'show_acns' : [ 'checked' ], + 'show_acps' : [ 'checked' ], + 'hide_aous' : [ 'checked' ] }); }, false ); @@ -51,8 +58,31 @@ cat.copy_browser.prototype = { document.getElementById('show_acps').addEventListener( 'command', function(ev) { - JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned); - util.widgets.save_attributes(file, { 'lib_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], 'show_acps' : [ 'checked' ] }); + JSAN.use('util.file'); + var file = new util.file( + 'copy_browser_prefs.'+obj.data.server_unadorned); + util.widgets.save_attributes(file, { + 'lib_menu' : [ 'value' ], + 'depth_menu' : [ 'value' ], + 'show_acns' : [ 'checked' ], + 'show_acps' : [ 'checked' ], + 'hide_aous' : [ 'checked' ] }); + }, + false + ); + + document.getElementById('hide_aous').addEventListener( + 'command', + function(ev) { + JSAN.use('util.file'); + var file = new util.file( + 'copy_browser_prefs.'+obj.data.server_unadorned); + util.widgets.save_attributes(file, { + 'lib_menu' : [ 'value' ], + 'depth_menu' : [ 'value' ], + 'show_acns' : [ 'checked' ], + 'show_acps' : [ 'checked' ], + 'hide_aous' : [ 'checked' ] }); }, false ); @@ -1058,7 +1088,8 @@ cat.copy_browser.prototype = { 'lib_menu' : [ 'value' ], 'depth_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], - 'show_acps' : [ 'checked' ] + 'show_acps' : [ 'checked' ], + 'hide_aous' : [ 'checked' ] }); }, false @@ -1128,7 +1159,8 @@ cat.copy_browser.prototype = { 'lib_menu' : [ 'value' ], 'depth_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], - 'show_acps' : [ 'checked' ] + 'show_acps' : [ 'checked' ], + 'hide_aous' : [ 'checked' ] }); obj.refresh_list(); }, @@ -1485,9 +1517,20 @@ cat.copy_browser.prototype = { obj.map_acp[ 'acp_' + copies[j].id() ] = function(r){return r;}(copies[j]); } } - data.row.my.volume_count = v_count; + data.row.my.volume_count = String(v_count); data.row.my.copy_count = '<' + c_count + '>'; } + if (document.getElementById('hide_aous').checked) { + if (org.children().length == 0 + && data.row.my.volume_count == '0') { + if (!params) { + params = { 'hidden' : true }; + } else { + params['hidden'] = true; + } + dump('hiding org.id() = ' + org.id() + '\n'); + } + } if (parent_org) { data.node = obj.map_tree[ 'aou_' + parent_org.id() ]; } diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul index 359dd1265f..ba64563598 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul @@ -152,8 +152,9 @@ vim:noet:sw=4:ts=4: +