]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/admin/upload_xacts.js
xul_param and modal xulG conversion
[Evergreen.git] / Open-ILS / xul / staff_client / server / admin / upload_xacts.js
1 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
2
3 function $(id) {
4         return document.getElementById(id);
5 }
6
7 function my_init() {
8         try {
9                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalFileRead");
10                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
11                 JSAN.errorLevel = "die"; // none, warn, or die
12                 JSAN.addRepository('..');
13                 JSAN.use('util.error'); g.error = new util.error();
14                 g.error.sdump('D_TRACE','my_init() for upload_xacts.html');
15
16                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
17                         try { window.xulG.set_tab_name('Upload Offline Transactions'); } catch(E) { alert(E); }
18                 }
19
20                 JSAN.use('util.file'); g.file = new util.file( xul_param('filename') );
21
22                 if (g.file._file.exists()) {
23                         $('submit').disabled = false;
24                         $('file').value = g.file._file.path;
25                 } else {
26                         alert('No transactions to upload.');
27                         return;
28                 }
29
30                 $( 'ws' ).setAttribute('value', xul_param('ws'));
31                 $( 'ses' ).setAttribute('value', xul_param('ses'));
32                 $( 'seskey' ).setAttribute('value', xul_param('seskey'));
33                 $( 'delta' ).setAttribute('value', xul_param('delta'));
34
35                 $( 'form' ).setAttribute('action', xulG.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS_CGI));
36
37                 setTimeout(
38                         function() {
39                                 JSAN.use('util.widgets');
40                                 util.widgets.click('submit');
41                         }, 0
42                 );
43
44         } catch(E) {
45                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
46                         "system administrator or software developer the following:\nmain/upload_xacts.xhtml\n" + E + '\n';
47                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
48                 alert(err_msg);
49         }
50 }
51
52