]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/main/data.xul
sets up observers, and sets up an interval for purging expired method cache objects
[Evergreen.git] / Open-ILS / xul / staff_client / server / main / data.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Main, Authentication Window -->
4
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
6 <!-- PRESENTATION -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
9 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/auth.css" type="text/css"?>
10
11 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
12 <!-- LOCALIZATION -->
13 <!DOCTYPE window PUBLIC "" ""[
14         <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
15 ]>
16
17 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
18 <!-- OVERLAYS -->
19 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
20
21 <window id="data_win" 
22         onload="try { data_init(); } catch(E) { alert(E); }"
23         title="&staff.auth.title;"
24         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
25
26
27         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
28         <!-- BEHAVIOR -->
29         <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
30         <scripts id="openils_util_scripts"/>
31
32         <script type="text/javascript" src="chrome://open_ils_staff_client/content/main/lang.js"/>
33         <script type="text/javascript" src="/xul/server/main/lang.js"/>
34         <script type="text/javascript" src="chrome://open_ils_staff_client/content/main/JSAN.js"/>
35         <script>
36         <![CDATA[
37                 dump("entities['lang.version'] = " + entities['lang.version'] + '\n');
38
39                 function data_init() {
40
41                         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
42
43                         if (typeof JSAN == 'undefined') {
44                                 throw(
45                                         "The JSAN library object is missing."
46                                 );
47                         }
48                         /////////////////////////////////////////////////////////////////////////////
49
50                         JSAN.errorLevel = "die"; // none, warn, or die
51                         JSAN.addRepository('/xul/server/');
52
53                         JSAN.use('OpenILS.data');
54                         g.data = new OpenILS.data()
55                         g.data.on_error = xulG.auth.logoff;
56                         g.data.entities = entities;
57                         g.data.stash('entities');
58
59                         g.data.session = {};
60                         g.data.session.key = xulG.auth.session.key;
61                         g.data.session.authtime = xulG.auth.session.authtime;
62                         g.data.stash('session');
63                         g.data.on_complete = function () {
64
65                                 g.data.stash('list','hash','tree','temp','cached_request');
66
67                                 setInterval(
68                                         function() {
69                                                 try {
70                                                         var remove_me = [];
71                                                         var n = Number( new Date() );
72                                                         for (var i in g.data.cached_request) {
73                                                                 if (g.data.cached_request[i].expire_time < n && g.data.cached_request[i].status != 'pending') remove_me.push(i);
74                                                         }
75                                                         dump('trimming ' + remove_me.length + ' requests from cache\n');
76                                                         for (var i in remove_me) delete g.data.cached_request[i];
77                                                 } catch(E) {
78                                                         alert(E);
79                                                 }
80                                         }, 180000
81                                 );
82
83                                 g.data._debug_stash();
84
85                                 document.getElementById('iframe').setAttribute(
86                                         'src',
87                                         urls.XUL_OFFLINE_GENERATE_WIDGETS       
88                                 );
89
90                                 document.getElementById('caption').setAttribute('label','Data loaded.');
91
92                                 xulG.window.open(urls.XUL_MENU_FRAME
93                                         + '?server='+window.escape(xulG.url),
94                                         'main'+xulG.window.window_name_increment(),'chrome,resizable'
95                                 );
96
97                         }
98
99                         g.data.init();
100         
101                         g.data.init_observer_functions();
102
103                 }
104         ]]>
105         </script>
106
107         <groupbox id="data_groupbox" flex="1" class="my_overflow"> 
108                 <caption id="caption" label="Loading data..."/> 
109                 <description id="data_progress"/>
110                 <iframe id="iframe" />
111         </groupbox>
112
113 </window>
114