some cleanup and trying to grok progressListener. I get different states from the...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 24 Aug 2005 23:49:06 +0000 (23:49 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 24 Aug 2005 23:49:06 +0000 (23:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1721 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/Open-ILS/OpenILS.js
Evergreen/staff_client/chrome/content/evergreen/auth/auth.js
Evergreen/staff_client/chrome/content/evergreen/opac/opac.js
Evergreen/staff_client/chrome/content/evergreen/opac/opac.xul
Evergreen/staff_client/chrome/content/evergreen/util/error.js
Evergreen/staff_client/chrome/content/evergreen/util/util_overlay.xul
Evergreen/staff_client/defaults/preferences/evergreen.js

index afc208e..2f4a13c 100644 (file)
@@ -4,7 +4,7 @@ function OpenILS_init(params) {
        try {
 
                switch(params.app) {
-                       case 'Auth' : auth_init(params); dump('after auth_init\n'); break;
+                       case 'Auth' : auth_init(params); break;
                        case 'AppShell' : app_shell_init(params); register_AppShell(params.w); break;
                        case 'Opac' : opac_init(params); break;
                        case 'PatronSearch' : patron_search_init(params); break;
@@ -18,9 +18,7 @@ function OpenILS_init(params) {
        try {
 
                //register_document(params.w.document);
-               dump('before register_window\n');
                register_window(params.w);
-               dump('after register_window\n');
 
        } catch(E) { sdump('D_ERROR',js2JSON(E)+'\n'); }
        sdump('D_TRACE_EXIT',arg_dump(arguments));
index e5044ff..0bbd237 100644 (file)
@@ -47,25 +47,15 @@ var auth_meter_incr = 10;
 function auth_init() {
        sdump('D_AUTH','TESTING: auth.js: ' + mw.G['main_test_variable'] + '\n');
        sdump('D_AUTH',arg_dump(arguments));
-dump('a1\n');
        var np = document.getElementById('name_prompt');
-dump('a2\n');
        np.addEventListener("keypress",handle_keypress,false);
-dump('a3\n');
        np.focus();
-dump('a4\n');
        var pp = document.getElementById('password_prompt');
-dump('a5\n');
        pp.addEventListener("keypress",handle_keypress,false);
-dump('a6\n');
        self.addEventListener("unload",nice_shutdown,false);
-dump('a7\n');
        G['sound'] = xp_sound_init(); 
-dump('a8\n');
        //G.sound.beep();
-dump('a9\n');
        snd_logon();
-dump('a10\n');
 }
 
 function handle_keypress(ev) {
index f5876a3..a3949f4 100644 (file)
@@ -5,40 +5,81 @@ var opac_page_thing;
 
 
 /* listen for page changes */
-var progressListener = new Object();
-progressListener.onProgressChange      = function(){}
-progressListener.onLocationChange      = function(){}
-progressListener.onStatusChange                = function(){}
-progressListener.onSecurityChange      = function(){}
-progressListener.QueryInterface = function qi(iid) { return this; }
-progressListener.onStateChange = 
-       function client_statechange ( webProgress, request, stateFlags, status) {
-               if( stateFlags == 131088 ) set_opac_vars();
-};
 
+function buildProgressListener(p) {
+///*
+//     var progressListener = 
+       return {
+       onProgressChange        : function(){},
+       onLocationChange        : function(){},
+       onStatusChange          : function(){},
+       onSecurityChange        : function(){},
+       QueryInterface          : function(){return this;},
+       onStateChange           : function ( webProgress, request, stateFlags, status) {
+               const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+               const nsIChannel = Components.interfaces.nsIChannel;
+               if (stateFlags == 65540 || stateFlags == 65537 || stateFlags == 65552) { return; }
+               dump('onStateChange: stateFlags = ' + stateFlags + ' status = ' + status + '\n');
+               if (stateFlags & nsIWebProgressListener.STATE_IS_REQUEST) {
+                       dump('\tSTATE_IS_REQUEST\n');
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) {
+                       dump('\tSTATE_IS_DOCUMENT\n');
+                       if( stateFlags & nsIWebProgressListener.STATE_STOP ) set_opac_vars(p); 
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
+                       dump('\tSTATE_IS_NETWORK\n');
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_IS_WINDOW) {
+                       dump('\tSTATE_IS_WINDOW\n');
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_START) {
+                       dump('\tSTATE_START\n');
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_REDIRECTING) {
+                       dump('\tSTATE_REDIRECTING\n');
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_TRANSFERING) {
+                       dump('\tSTATE_TRANSFERING\n');
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_NEGOTIATING) {
+                       dump('\tSTATE_NEGOTIATING\n');
+               }
+               if (stateFlags & nsIWebProgressListener.STATE_STOP) {
+                       dump('\tSTATE_STOP\n');
+               }
+       }
+}
+//*/
+       //return progressListener;
+}
 
 /* init the opac */
 function opac_init(p) {
        sdump('D_OPAC',"Initing OPAC\n");
        opac_page_thing = p;
+
        p.opac_iframe = p.w.document.getElementById('opac_opac_iframe');
-       p.opac_iframe.addProgressListener(progressListener
+       p.opac_iframe.addProgressListener(buildProgressListener(p)
                Components.interfaces.nsIWebProgress.NOTIFY_ALL );
+       //p.opac_iframe.addProgressListener(progressListener, 
+       //      Components.interfaces.nsIWebProgress.NOTIFY_ALL );
        p.opac_iframe.setAttribute("src", OPAC_URL) 
 }
 
 /* shoves data into the OPAC's space */
-function set_opac_vars() {
-       var p = opac_page_thing;
-       p.opac_iframe = p.w.document.getElementById('opac_opac_iframe');
+function set_opac_vars(p) {
+       if (!p) p = opac_page_thing;
+       //var p = opac_page_thing;
+       //p.opac_iframe = p.w.document.getElementById('opac_opac_iframe');
        p.opac_iframe.contentWindow.IAMXUL = true;
        p.opac_iframe.contentWindow.xulG = mw.G;
        p.opac_iframe.contentWindow.attachEvt("rresult", "recordDrawn", opac_make_details_page);
 }
 
 function opac_make_details_page(id, node) {
-       //dump("Node HREF attribute is: " + node.getAttribute("href") + "\n and doc id is " + id);
-       //alert("Node HREF attribute is: " + node.getAttribute("href") + "\n and doc id is " + id);
+       dump("Node HREF attribute is: " + node.getAttribute("href") + "\n and doc id is " + id +'\n');
+       alert("Node HREF attribute is: " + node.getAttribute("href") + "\n and doc id is " + id +'\n');
 }
 
 
index 01a48b2..73b768f 100644 (file)
        <?xml-stylesheet href="chrome://evergreen/skin/opac.css" type="text/css"?>
 
        <vbox id="opac_vbox" flex="1">
-               <!-- 
-               <iframe id="opac_opac_iframe" type="content-primary" flex="1"/> 
-               <iframe id="opac_opac_iframe" type="content" flex="1"/>
-               -->
-               <!--
-               <iframe id="opac_opac_iframe" flex="1"/>
-               -->
                <browser id="opac_opac_iframe" flex="1"/>
        </vbox>
 
index 7ac7c48..47c473a 100644 (file)
@@ -8,7 +8,7 @@ var debugDump = true;
 var arg_dump_full = false;
 
 var sdump_levels = {
-       'D_NONE' : true,
+       'D_NONE' : false,
        'D_ALL' : false,
        'D_ERROR' : true,
        'D_TRACE' :  false,
@@ -28,7 +28,7 @@ var sdump_levels = {
 
        'D_AUTH' : false,
 
-       'D_OPAC' : false,
+       'D_OPAC' : true,
 
        'D_PATRON_SEARCH' : false,
        'D_PATRON_SEARCH_FORM' : false,
index 0841c75..ca693c1 100644 (file)
        <script src="validate.js" />    <!-- some validation functions -->
        <script src="widgets.js" />     <!-- some convenience functions for XUL/HTML elements.  want to eliminate overlap with webutils -->
        <script src="populate.js" />    <!-- populate widgets (like menus) with values -->
-       <!--
-       <script src="fieldmapper.js" /> 
-       -->     <!-- our Objects for things like patrons, books, etc.  This is generated. -->
 
-       <!--
-       <script src="chrome://evergreen/content/Open-ILS/util/utils.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/config.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/CGI.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/Cookie.js" />
        <script src="chrome://evergreen/content/Open-ILS/util/md5.js" />
        <script src="chrome://evergreen/content/Open-ILS/util/JSON.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/OrgTree.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/dtree.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/fmcore.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/RemoteRequest.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/opac_utils.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/init.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/added_content.js" />
-       -->
-       <script src="chrome://evergreen/content/Open-ILS/util/md5.js" />
-       <script src="chrome://evergreen/content/Open-ILS/util/JSON.js" />
-       <script>dump('fmall LOADING++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
        <script src="chrome://evergreen/content/Open-ILS/util/fmall.js" />
-       <script>dump('fmgen LOADING++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
        <script src="chrome://evergreen/content/Open-ILS/util/fmgen.js" />
-       <script>dump('remoterequest LOADING++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
        <script src="chrome://evergreen/content/Open-ILS/util/RemoteRequest.js" />
-       <script>dump('ORGTREE LOADING++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
        <script src="chrome://evergreen/content/Open-ILS/util/OrgTree.js" />
-       <script>dump('ORGTREE FINISHED++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
-       <script>dump('ORG_utilS LOADING++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
        <script src="chrome://evergreen/content/Open-ILS/util/org_utils.js" />
-       <script>dump('ORG_utilS FINISHED++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
-       <script>dump('orgtree = ' + js2JSON( globalOrgTree ) + '\n');</script>
-       <script>dump('0++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n');</script>
        <script>IAMXUL = true;</script>
 
        <script src="ses.js" />         <!-- my wrapper over the OpenSRF communication layer.. Jabber and XMLHttpRequest -->
        <script src="print.js" />       <!-- some xpcom for printing -->
        <script src="sound.js" />       <!-- some xpcom for sound -->
 
-       <!--
-       <script src="chrome://evergreen/content/Open-ILS/util/browser.js" />
-       -->     <!-- browser detection.. am I not using Mozilla? doh :) -->
-
-       <!--
-       <script src="chrome://evergreen/content/Open-ILS/widgets/Box.js" />
-       -->             <!-- shared code between OPAC and staff client for surveys -->
-       <!--
-       <script src="chrome://evergreen/content/Open-ILS/widgets/ListBox.js" />
-       -->
-       <!--
-       <script src="chrome://evergreen/content/Open-ILS/widgets/Survey.js" />
-       -->
-
        <script>
                dump('Finished all the js in the util overlay...\n');
        </script>
index 4384b8f..4ce16b6 100644 (file)
@@ -12,4 +12,4 @@ pref("network.http.max-persistent-connections-per-server",8);
 // However, it's better than POEM, which I wasted a day on :)
 pref("dom.max_script_run_time",60);
 
-pref("javascript.options.strict",true);
+pref("javascript.options.strict",false);