refactor
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Jun 2005 13:54:45 +0000 (13:54 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Jun 2005 13:54:45 +0000 (13:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@873 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/util/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 (file)
index 0000000..4bdaac2
--- /dev/null
@@ -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);
+}
+
+
index 201a94c..015944b 100644 (file)
@@ -27,6 +27,7 @@
        <script src="ses.js" />         <!-- my wrapper over the OpenSRF communication layer.. Jabber and XMLHttpRequest -->
        <script src="explode.js" />     <!-- original attempt at linking widgets to data.  Want to use something more OO -->
        <script src="win.js" />         <!-- window and tab handling -->
+       <script src="spawn_win.js" />   <!-- spawning various interfaces in tabs -->
        <script src="xpcom.js" />       <!-- misc xpcom -->
        <script src="print.js" />       <!-- some xpcom for printing -->
        <script src="sound.js" />       <!-- some xpcom for sound -->
index b15ba0c..ae0030c 100644 (file)
@@ -114,147 +114,4 @@ function close_all_windows() {
        }
 }
 
-function spawn_copy_browser(tab,params) {
-       sdump('D_WIN','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_WIN','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_WIN','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_WIN','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_WIN','trying to spawn_bill_pay('+js2JSON(patron)+')\n');
-       sdump('D_WIN','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_WIN','trying to spawn_check_out('+js2JSON(patron)+')\n');
-       sdump('D_WIN','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_WIN','trying to spawn_circ_list('+js2JSON(patron)+')\n');
-       sdump('D_WIN','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_WIN','trying to spawn_patron_edit('+js2JSON(patron)+')\n');
-       sdump('D_WIN','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);
-}
-