From 010a8f18fce8f39e717186e04cbf27ef5377a420 Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 20 Jun 2005 13:54:45 +0000 Subject: [PATCH] refactor git-svn-id: svn://svn.open-ils.org/ILS/trunk@873 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../chrome/content/evergreen/util/spawn_win.js | 144 +++++++++++++++++++++ .../chrome/content/evergreen/util/util_overlay.xul | 1 + .../chrome/content/evergreen/util/win.js | 143 -------------------- 3 files changed, 145 insertions(+), 143 deletions(-) create mode 100644 Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js b/Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js new file mode 100644 index 0000000000..4bdaac2989 --- /dev/null +++ b/Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js @@ -0,0 +1,144 @@ +function spawn_copy_browser(tab,params) { + sdump('D_SPAWN','trying to spawn_copy_browser('+js2JSON(params)+')\n'); + var w; + var chrome = 'chrome://evergreen/content/cat/browse_list.xul'; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','COPIES',chrome); + } else { + w = mw.new_window( chrome ); + } + w.find_this_id = params[0]; + w.record_columns = params; +} + +function spawn_batch_copy_editor(tab,params) { + sdump('D_SPAWN','trying to spawn_copy_editor(' + params + ')'); + var w; + var chrome = 'chrome://evergreen/content/cat/copy_edit.xul'; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','COPIES EDITOR',chrome); + } else { + w = mw.new_window( chrome ); + } + w.params = params; +} + +function spawn_marc_editor(tab,params) { + sdump('D_SPAWN','trying to spawn_marc_editor('+js2JSON(params)+')\n'); + var w; + var chrome = 'chrome://evergreen/content/cat/marc.xul'; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','MARC',chrome); + } else { + w = mw.new_window( chrome ); + } + w.find_this_id = params[0]; + w.record_columns = params; + w.params = params; +} + +function spawn_oclc_import(tab,params) { + sdump('D_SPAWN','trying to spawn_marc_editor('+js2JSON(params)+')\n'); + // sample TCN: 03715963 + try { + if (params.tcn.length < 6) { + throw("Too short. At the moment, we're really doing a search rather than a retrieve, and it's a substring search at that. We grab the result that matches exactly. But sending a short query would just be mean. :)"); + } + var result = user_request( + 'open-ils.search', + 'open-ils.search.z3950.import', + [ mw.G.auth_ses[0], params.tcn ] + )[0]; + if (typeof result == 'object') { + if (result.records.length > 0) { + params['import_tree'] = result.records[0]; + } else { + throw('no records. result = ' + js2JSON(result) + '\n'); + } + } else { + throw('result: ' + js2JSON(result) + '\n'); + } + var w; + var chrome = 'chrome://evergreen/content/cat/marc.xul'; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','MARC',chrome); + } else { + w = mw.new_window( chrome ); + } + w.params = params; + w.find_this_id = -1; + //w.record_columns = params; + + } catch(E) { + handle_error(E); + } + +} + +function spawn_bill_pay(tab,patron,params) { + sdump('D_SPAWN','trying to spawn_bill_pay('+js2JSON(patron)+')\n'); + sdump('D_SPAWN','barcode: ' + patron.barcode() + '\n'); + var w; + var chrome = 'chrome://evergreen/content/bill/bill.xul'; + var params = { 'barcode' : patron.barcode() }; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','BILLS',chrome,params); + } else { + w = mw.new_window( chrome,params ); + } +} + +function spawn_check_out(tab,patron,params) { + sdump('D_SPAWN','trying to spawn_check_out('+js2JSON(patron)+')\n'); + sdump('D_SPAWN','barcode: ' + patron.barcode() + '\n'); + var w; + var chrome = 'chrome://evergreen/content/circ/checkout.xul'; + var params = { 'barcode' : patron.barcode() }; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','CHECK OUT',chrome,params); + } else { + w = mw.new_window( chrome,params ); + } +} + +function spawn_circ_list(tab,patron,params) { + sdump('D_SPAWN','trying to spawn_circ_list('+js2JSON(patron)+')\n'); + sdump('D_SPAWN','barcode: ' + patron.barcode() + '\n'); + var w; + var chrome = 'chrome://evergreen/content/circ/circ_list.xul'; + var params = { 'barcode' : patron.barcode() }; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','ITEMS OUT',chrome,params); + } else { + w = mw.new_window( chrome,params ); + } +} + +function spawn_patron_edit(tab,patron,params) { + sdump('D_SPAWN','trying to spawn_patron_edit('+js2JSON(patron)+')\n'); + sdump('D_SPAWN','barcode: ' + patron.barcode() + '\n'); + var w; + var chrome = 'chrome://evergreen/content/patron/patron_edit.xul'; + var params = { 'barcode' : patron.barcode() }; + if (tab) { + if (tab != 'replace') { tabWindow.new_tab('main_tabbox'); } + w = tabWindow.replace_tab('main_tabbox','PATRON EDIT',chrome,params); + } else { + w = mw.new_window( chrome, params ); + } +} + +function spawn_test() { + var chrome = 'chrome://evergreen/content/patron/patron_edit.xul'; + var params = { 'barcode':'101010101010101' }; + var w = tabWindow.replace_tab('main_tabbox','TEST',chrome,params); +} + + diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul b/Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul index 201a94cdbf..015944b1f2 100644 --- a/Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul +++ b/Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul @@ -27,6 +27,7 @@