From b8da5215260a0d76349386ad242be17364e90f2d Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 22 Oct 2007 05:10:20 +0000 Subject: [PATCH] venkman integration and chrome Replace Item Barcode fixes git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@7901 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/chrome/content/main/menu.js | 68 +++++++++-- .../chrome/content/main/menu_frame.xul | 1 + .../chrome/content/main/menu_frame_menus.xul | 126 +++++++++++---------- 3 files changed, 126 insertions(+), 69 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 49644b1a5a..4ac7492744 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -101,28 +101,58 @@ main.menu.prototype = { JSAN.use('util.network'); var network = new util.network(); - var old_bc = window.prompt('Enter original barcode for the copy:','','Replace Barcode'); + var old_bc = window.prompt('Enter original barcode for the item:','','Replace Barcode'); if (!old_bc) return; - var copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ old_bc ]); - if (typeof copy.ilsevent != 'undefined') throw(copy); - if (!copy) throw(copy); + var copy; + try { + copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ old_bc ]); + if (typeof copy.ilsevent != 'undefined') throw(copy); + if (!copy) throw(copy); + } catch(E) { + alert('We were unable to retrieve an item with barcode "' + old_bc + '".\n'); + return; + } // Why did I want to do this twice? Because this copy is more fleshed? - copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]); - if (typeof copy.ilsevent != 'undefined') throw(copy); - if (!copy) throw(copy); + try { + copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]); + if (typeof copy.ilsevent != 'undefined') throw(copy); + if (!copy) throw(copy); + } catch(E) { + try { alert('We were unable to retrieve an item with barcode "' + old_bc + '".\n' + (typeof E.ilsevent == 'undefined' ? '' : E.textcode + ' : ' + E.desc)); } catch(F) { alert(E + '\n' + F); } + return; + } var new_bc = window.prompt('Enter the replacement barcode for the copy:','','Replace Barcode'); + new_bc = String( new_bc ).replace(/\s/g,''); + if (!new_bc) { + alert('Rename aborted. Blank for barcode not allowed.'); + return; + } - var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ ses(), new_bc ]); + var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ new_bc ]); if (typeof test.ilsevent == 'undefined') { - alert('Rename aborted. Another copy has that barcode'); + alert('Rename aborted. Another copy has barcode "' + new_bc + '".'); return; + } else { + if (test.ilsevent != 1502 /* ASSET_COPY_NOT_FOUND */) { + obj.error.standard_unexpected_error_alert('Error testing replacement barcode "' + new_bc + '".',test); + return; + } } + copy.barcode(new_bc); copy.ischanged('1'); var r = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), [ copy ] ]); - if (typeof r.ilsevent != 'undefined') { if (r.ilsevent != 0) throw(r); } + if (typeof r.ilsevent != 'undefined') { + if (r.ilsevent != 0) { + if (r.ilsevent == 5000 /* PERM_FAILURE */) { + alert('Renamed aborted. Insufficient permission.'); + } else { + obj.error.standard_unexpected_error_alert('Error renaming item.',r); + } + } + } } catch(E) { obj.error.standard_unexpected_error_alert('Rename did not likely occur.',copy); } @@ -578,6 +608,24 @@ main.menu.prototype = { } } ], + 'cmd_extension_manager' : [ + ['oncommand'], + function() { + obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=extensions',{'tab_name':'Extension Manager'},{}); + } + ], + 'cmd_theme_manager' : [ + ['oncommand'], + function() { + obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=themes',{'tab_name':'Theme Manager'},{}); + } + ], + 'cmd_about_config' : [ + ['oncommand'], + function() { + obj.set_tab('chrome://global/content/config.xul',{'tab_name':'about:config'},{}); + } + ], 'cmd_shutdown' : [ ['oncommand'], function() { diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul index 689a98dcfc..160c54ec0a 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul @@ -75,6 +75,7 @@ } ]]> +