]> git.evergreen-ils.org Git - Evergreen.git/blob - Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js
typo
[Evergreen.git] / Evergreen / staff_client / chrome / content / evergreen / util / spawn_win.js
1 function spawn_interface(d,tab_flag,tabbox,chrome,label,passthru_params) {
2         sdump('D_SPAWN','trying to spawn_window('+d+','+tab_flag+','+tabbox+','+chrome+','+label+','+js2JSON(passthru_params)+')\n');
3         var w;
4         if (tab_flag) {
5                 if (tab_flag != 'replace') { new_tab(d,tabbox); }
6                 w = replace_tab(d,tabbox,label,chrome);
7         } else {
8                 w = new_window( chrome );
9         }
10         w.params = params;
11 }
12
13 function spawn_batch_copy_editor(d,tab_flag,passthru_params) {
14         var chrome = 'chrome://evergreen/content/cat/copy_edit.xul';
15         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('copies_editor_interface_label'),passthru_params);
16 }
17
18 function spawn_bill_pay(d,tab_flag,passthru_params) {
19         var chrome = 'chrome://evergreen/content/bill/bill.xul';
20         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('bills_interface_label'),passthru_params);
21 }
22
23 function spawn_check_in(d,tab_flag,passthru_params) {
24         var chrome = 'chrome://evergreen/content/circ/checkin.xul';
25         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('checkin_interface_label'),passthru_params);
26 }
27
28 function spawn_check_out(d,tab_flag,passthru_params) {
29         var chrome = 'chrome://evergreen/content/circ/checkout.xul';
30         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('checkout_interface_label'),passthru_params);
31 }
32
33 function spawn_circ_display(d,tab_flag,passthru_params) {
34         var chrome = 'chrome://evergreen/content/circ/circ_deck_patron.xul';
35         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('display_patron_interface_label'),passthru_params);
36 }
37
38 function spawn_circ_list(d,tab_flag,passthru_params) {
39         var chrome = 'chrome://evergreen/content/circ/circ_list.xul';
40         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('items_out_interface_label'),passthru_params);
41 }
42
43 function spawn_circ_search(d,tab_flag,passthru_params) {
44         var chrome = 'chrome://evergreen/content/circ/circ_deck_search.xul';
45         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('patron_search_interface_label'),passthru_params);
46 }
47
48 function spawn_copy_browser(d,tab_flag,passthru_params) {
49         var chrome = 'chrome://evergreen/content/cat/browse_list.xul';
50         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('copy_browser_interface_label'),passthru_params);
51 }
52
53 function spawn_main() {
54         sdump('D_SPAWN','trying to spawn app_shell\n');
55         try {
56                 var w = new_window('chrome://evergreen/content/main/app_shell.xul');
57                 if (!w) { throw('window ref == null'); }
58                 try {
59                         w.document.title = G.user.usrname() + '@' + G.user_ou.name();
60                 } catch(E) {
61                         alert('Hrmm. ' + pretty_print( js2JSON(E) ) );
62                 }
63         } catch(E) {
64                 dump(js2JSON(E)+'\n');
65                 //incr_progressmeter('auth_meter',-100);
66                 //alert('Login failed on new_window: ' + js2JSON(E)); enable_login_prompts(); return;
67         }
68         //incr_progressmeter('auth_meter',100);
69 }
70
71 function spawn_marc_editor(d,tab_flag,passthru_params) {
72         var chrome = 'chrome://evergreen/content/cat/marc.xul';
73         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('marc_editor_interface_label'),passthru_params);
74 }
75
76 function spawn_opac_navigator(d,tab_flag,passthru_params) {
77         var chrome = 'chrome://evergreen/content/opac/opac.xul';
78         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('opac_navigator_interface_label'),passthru_params);
79 }
80
81 function spawn_oclc_import(d,tab_flag,params) {
82         sdump('D_SPAWN','trying to spawn_oclc_import('+js2JSON(passthru_params)+')\n');
83         // sample TCN: 03715963 
84         try {
85                 if (params.tcn.length < 6) {
86                         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. :)");
87                 }
88                 var result = user_request(
89                         'open-ils.search',
90                         'open-ils.search.z3950.import',
91                         [ G.auth_ses[0], params.tcn ]
92                 )[0];
93                 if (typeof result == 'object') {
94                         if (result.records.length > 0) {        
95                                 params['import_tree'] = result.records[0];
96                         } else {
97                                 throw('no records. result = ' + js2JSON(result) + '\n');
98                         }
99                 } else {
100                         throw('result: ' + js2JSON(result) + '\n');
101                 }
102                 spawn_marc_editor(d,tab_flag,params);
103         } catch(E) {
104                 handle_error(E);
105         }
106 }
107
108 function spawn_patron_edit(d,tab_flag,passthru_params) {
109         var chrome = 'chrome://evergreen/content/patron/patron_edit.xul';
110         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('patron_editor_interface_label'),passthru_params);
111 }
112
113 function spawn_patron_register(d,tab_flag,passthru_params) {
114         var chrome = 'chrome://evergreen/content/patron/patron_new.xul';
115         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('patron_register_interface_label'),passthru_params);
116 }
117
118
119 function spawn_copy_stat_cat_edit(d,tab_flag,passthru_params) {
120         var chrome = 'chrome://evergreen/content/stat_cat/copy_stat_cat_editor.xul';
121         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('copy_stat_cat_editor_interface'),passthru_params);
122 }
123
124 function spawn_patron_stat_cat_edit(d,tab_flag,passthru_params) {
125         var chrome = 'chrome://evergreen/content/stat_cat/patron_stat_cat_editor.xul';
126         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('patron_stat_cat_editor_interface'),passthru_params);
127 }
128
129 function spawn_survey_admin_wizard(d,tab_flag,passthru_params) {
130         var chrome = 'chrome://evergreen/content/survey/survey_wizard.xul';
131         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('survey_admin_interface_label'),passthru_params);
132 }
133
134
135 function spawn_z3950_import(d,tab_flag,passthru_params) {
136         var chrome = 'chrome://evergreen/content/z39_50/z39_50.xul';
137         spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('z39_50_import_interface_label'),passthru_params);
138 }
139