going back to heavy overlay use instead of nested iframes (and timeouts). windows...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 Jul 2005 19:32:00 +0000 (19:32 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 Jul 2005 19:32:00 +0000 (19:32 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1188 dcc99617-32d9-48b4-a31d-7c20da2025e4

38 files changed:
Evergreen/staff_client/Makefile
Evergreen/staff_client/chrome/content/evergreen/Open-ILS/OpenILS.js
Evergreen/staff_client/chrome/content/evergreen/Open-ILS/OpenILS_scripts_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/circ/circ_tree.js
Evergreen/staff_client/chrome/content/evergreen/circ/circ_tree.xul
Evergreen/staff_client/chrome/content/evergreen/circ/circ_tree_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/main/app_shell.xul
Evergreen/staff_client/chrome/content/evergreen/main/app_shell_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/main/clam_shell.js
Evergreen/staff_client/chrome/content/evergreen/main/clam_shell.xul
Evergreen/staff_client/chrome/content/evergreen/main/clam_shell_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/main/clam_shell_vertical.xul
Evergreen/staff_client/chrome/content/evergreen/main/clam_shell_vertical_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/main/paged_tree.js
Evergreen/staff_client/chrome/content/evergreen/main/paged_tree.xul
Evergreen/staff_client/chrome/content/evergreen/main/paged_tree_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_contact.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_contact.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_contact_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_status.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_status.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display_status_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search_form.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search_form.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search_form_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search_results.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search_results.xul
Evergreen/staff_client/chrome/content/evergreen/patron/patron_search_results_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/util/error.js
Evergreen/staff_client/chrome/content/evergreen/util/filter_console.xul
Evergreen/staff_client/chrome/content/evergreen/util/util.js
Evergreen/staff_client/chrome/content/evergreen/util/widgets.js

index abec3fe..3448169 100644 (file)
@@ -22,12 +22,16 @@ open-ils:
        cp ../../Open-ILS/src/javascript/widgets/*.js chrome/content/evergreen/Open-ILS/widgets/
        cp ../../Open-ILS/src/javascript/widgets/menu/*.js chrome/content/evergreen/Open-ILS/widgets/menu/
 
+patron:
+       (cat chrome/content/evergreen/main/paged_tree_overlay.xul | sed s/paged_tree/patron_items/g | sed s/PagedTree/PatronItems/g > chrome/content/evergreen/patron/patron_items_overlay.xul )
+       (cp chrome/locale/en-US/evergreen/paged_tree.dtd chrome/locale/en-US/evergreen/patron_items.dtd)
+
 evergreen.xpi: evergreen.jar
        @echo
        @echo make the xpi file
        zip -r evergreen.xpi chrome/ defaults/ install.js install.rdf Makefile LICENSE README -x \*CVS\* > /dev/null
 
-evergreen.jar: generated open-ils
+evergreen.jar: generated open-ils patron
        @echo
        @echo make the jar file
        (cd chrome; zip -r evergreen.jar content/ locale/ skin/ -x \*CVS\* > /dev/null )
@@ -37,6 +41,7 @@ clean:
        @echo delete derived files
        rm -f evergreen.xpi
        rm -f chrome/evergreen.jar
+       rm -f chrome/content/evergreen/patron/patron_items_overlay.xml chrome/locale/en-US/evergreen/patron_items.dtd
        rm -f chrome/content/evergreen/conf/client_config.xml
        rm -f chrome/content/evergreen/util/fieldmapper.js
        rm -f chrome/content/evergreen/util/OrgTree.js
index aac82ce..c165c4e 100644 (file)
@@ -15,6 +15,7 @@ function OpenILS_init(params) {
                        case 'PatronDisplay' : patron_display_init(params); break;
                        case 'PatronDisplayStatus' : patron_display_status_init(params); break;
                        case 'PatronDisplayContact' : patron_display_contact_init(params); break;
+                       case 'PatronItems' : patron_items_init(params); break;
                        case 'CircTree' : circ_tree_init(params); break;
                }
 
@@ -47,6 +48,7 @@ function OpenILS_exit(params) {
                        case 'PatronDisplay' : patron_display_exit(params); break;
                        case 'PatronDisplayStatus' : patron_display_status_exit(params); break;
                        case 'PatronDisplayContact' : patron_display_contact_exit(params); break;
+                       case 'PatronItems' : patron_items_exit(params); break;
                        case 'CircTree' : circ_tree_exit(params); break;
                }
 
index 73ea079..088cabe 100644 (file)
@@ -18,6 +18,7 @@
                <script src="chrome://evergreen/content/patron/patron_display.js" />
                <script src="chrome://evergreen/content/patron/patron_display_status.js" />
                <script src="chrome://evergreen/content/patron/patron_display_contact.js" />
+               <script src="chrome://evergreen/content/patron/patron_items.js" />
                <script src="chrome://evergreen/content/circ/circ_tree.js" />
        </apps>
 
index 39b4575..2aead74 100644 (file)
@@ -1,10 +1,5 @@
 sdump('D_TRACE','Loading circ_tree.js\n');
-
-function circ_tree_init(p) {
-       sdump('D_CIRC_TREE',"TESTING: circ_tree.js: " + mw.G['main_test_variable'] + '\n');
-       sdump('D_TRACE_ENTER',arg_dump(arguments));
-
-       p.w.circ_cols = [
+var circ_cols = [
                {
                        'id' : 'barcode', 'label' : getString('acp_label_barcode'), 'flex' : 1,
                        'primary' : true, 'hidden' : false, 'fm_class' : 'acp', 'fm_field_render' : '.barcode()'
@@ -84,6 +79,11 @@ function circ_tree_init(p) {
                
        ];
 
+
+function circ_tree_init(p) {
+       sdump('D_CIRC_TREE',"TESTING: circ_tree.js: " + mw.G['main_test_variable'] + '\n');
+       sdump('D_TRACE_ENTER',arg_dump(arguments));
+
        p.w.register_circ_select_callback = function (f) {
                p.w._circ_select_callback = f;
        }
@@ -100,7 +100,7 @@ function circ_tree_init(p) {
                circ_tree_map_circ_to_cols(p, circ, treeitem);  
        }
 
-       setTimeout(
+       consider_Timeout(
                function() {
                        sdump('D_TIMEOUT','***** timeout occured circ_tree.js');
                        p.w.tree_win = spawn_paged_tree(
@@ -111,7 +111,7 @@ function circ_tree_init(p) {
                                        'onload' : circ_tree_init_after_paged_tree(p) 
                                }
                        );
-                       setTimeout(
+                       consider_Timeout(
                                function () {
                                        sdump('D_TIMEOUT','***** timeout timeout occured circ_tree.js');
                                        if (p.onload) {
@@ -142,7 +142,7 @@ function circ_tree_init_after_paged_tree(p) {
                tree_win.register_context_builder( p.w._context_function );
                p.w.add_circs = tree_win.add_rows;
                p.w.clear_circs = tree_win.clear_tree;
-               setTimeout(
+               consider_Timeout(
                        function() {
                                sdump('D_TIMEOUT','***** timeout after paged_tree occured circ_tree.js');
                                try {
index 3dd7dab..9dc5b11 100644 (file)
@@ -22,7 +22,7 @@
        <?xul-overlay href="chrome://evergreen/content/circ/circ_tree_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="CircTree_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="CircTree_keys" />
@@ -30,5 +30,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="CircTree_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index a2a70ee..a1fe234 100644 (file)
@@ -5,7 +5,7 @@
 
        <script>mw.sdump('D_TRACE','Loading circ_tree_overlay.xul\n');</script>
 
-<commandset id="CircTree_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
index cd83977..0be2c36 100644 (file)
@@ -22,7 +22,7 @@
        <?xul-overlay href="chrome://evergreen/content/main/app_shell_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="AppShell_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="AppShell_keys" />
@@ -30,5 +30,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="AppShell_main" />
 
+       <popupset id="universal_popupset" />
+
 </window>
 
index 89db78e..d84868e 100644 (file)
@@ -7,7 +7,7 @@
 
        <?xul-overlay href="chrome://evergreen/content/main/app_shell_menus_overlay.xul"?>
 
-<commandset id="AppShell_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_close_window" oncommand="
                window.close();" />
@@ -67,7 +67,7 @@
                mw.spawn_filter_console(document,'new_tab','main_tabbox',{}); "/>
 
        <command id="cmd_test" oncommand="
-               alert('Not Yet Implemented'); "/>
+               mw.spawn_patron_display(document,'new_tab','main_tabbox',{'patron':'21099000006699'}); "/>
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
index 871162f..6ca1063 100644 (file)
@@ -2,86 +2,83 @@ sdump('D_TRACE','Loading clam_shell.js\n');
 
 function clam_shell_init(p) {
        sdump('D_CLAM',"TESTING: clam_shell.js: " + mw.G['main_test_variable'] + '\n');
-       p.w.clamshell = get_widget(p.w.document,p.clamshell);
+       sdump('D_CONSTRUCTOR',arg_dump(arguments));
+
        if (p) {
+               // This code breaks the splitter, so don't use
                if (p.horizontal) {
                        sdump('D_CLAM','Setting horizontal\n');
-                       p.w.clamshell.orient = 'horizontal';
+                       p.node.orient = 'horizontal';
                } else if (p.vertical) {
                        sdump('D_CLAM','Setting vertical\n');
-                       p.w.clamshell.orient = 'vertical';
+                       p.node.orient = 'vertical';
                }
-               p.w.splitter = get_widget( p.w.document, p.splitter );
+
+               p.splitter_node = p.node.childNodes[1];
                if (p.hide_splitter) {
                        sdump('D_CLAM','Hiding splitter\n');
-                       p.w.splitter.hidden = true;
+                       p.splitter_node.hidden = true;
                } else {
                        sdump('D_CLAM','Showing splitter\n');
-                       p.w.splitter.hidden = false;
+                       p.splitter_node.hidden = false;
                }
                        
        }
-       var nl = p.w.clamshell.getElementsByTagName('deck');
-       var first_deck = nl[0];
-       var second_deck = nl[1];
 
-       p.w.first_deck = first_deck;
-       p.w.second_deck = second_deck;
-       p.w.get_card_in_first_deck = function (idx) {
+       p.first_deck = p.node.firstChild;
+       p.second_deck = p.node.lastChild;
+
+       p.get_card_in_first_deck = function (idx) {
                if (idx)
                        return first_deck.childNodes[ idx ];
                else
                        return first_deck.selectedPanel;
        }
-       p.w.get_card_in_second_deck = function (idx) {
+
+       p.get_card_in_second_deck = function (idx) {
                if (idx)
                        return second_deck.childNodes[ idx ];
                else
                        return second_deck.selectedPanel;
        }
-       p.w.set_first_deck = function (idx) { return set_deck(p.w.document,first_deck,idx); };
-       p.w.set_second_deck = function (idx) { return set_deck(p.w.document,second_deck,idx); };
-       p.w.replace_card_in_first_deck = function (idx,chrome,params) {
-               return replace_card_in_deck(p.w.document,first_deck,idx,chrome,params);
+
+       p.set_first_deck = function (idx) { return p.first_deck.selectedIndex = idx; };
+
+       p.set_second_deck = function (idx) { return p.second_deck.selectedIndex = idx; };
+
+       p.replace_card_in_first_deck = function (idx,chrome,params) {
+               return replace_card_in_deck(p.first_deck,idx,chrome,params);
        };
-       p.w.replace_card_in_second_deck = function (idx,chrome,params) {
-               return replace_card_in_deck(p.w.document,second_deck,idx,chrome,params);
+
+       p.replace_card_in_second_deck = function (idx,chrome,params) {
+               return replace_card_in_deck(p.second_deck,idx,chrome,params);
        };
-       p.w.new_card_in_first_deck = function (chrome,params) {
-               return new_card_in_deck(p.w.document,first_deck,chrome,params);
+
+       p.new_card_in_first_deck = function (chrome,params) {
+               return new_card_in_deck(p.first_deck,chrome,params);
        };
-       p.w.new_card_in_second_deck = function (chrome,params) {
-               return new_card_in_deck(p.w.document,second_deck,chrome,params);
+       p.new_card_in_second_deck = function (chrome,params) {
+               return new_card_in_deck(p.second_deck,chrome,params);
        };
 
-       if (p.onload) {
-               try {
-                       sdump('D_TRACE','trying psuedo-onload: ' + p.onload + '\n');
-                       p.onload(p.w);
-               } catch(E) {
-                       sdump('D_ERROR', js2JSON(E) + '\n' );
-               }
-       }
-
-       return;
+       return p;
 }
 
-function new_card_in_deck(doc,deck,chrome,params) {
+function new_card_in_deck(deck,chrome,params) {
        sdump('D_CLAM',arg_dump(arguments));
-       deck = get_widget(doc,deck);
-       var new_card = document.createElement('iframe');
+       var new_card = deck.ownerDocument.createElement('iframe');
        deck.appendChild(new_card);
        new_card.setAttribute('flex','1');
        new_card.setAttribute('src',chrome);
        new_card.setAttribute('id','card_'+(deck.childNodes.length-1));
+       new_card.contentWindow.mw = mw;
        return new_card.contentWindow;
 }
 
-function replace_card_in_deck(doc,deck,idx,chrome,params) {
+function replace_card_in_deck(deck,idx,chrome,params) {
        sdump('D_CLAM',arg_dump(arguments));
-       deck = get_widget(doc,deck);
        var old_card = deck.childNodes[ idx ];
-       var new_card = document.createElement('iframe');
+       var new_card = deck.ownerDocument.createElement('iframe');
        new_card.setAttribute('flex','1');
        new_card.setAttribute('src',chrome);
        deck.appendChild(new_card);
@@ -92,3 +89,4 @@ function replace_card_in_deck(doc,deck,idx,chrome,params) {
                new_card.contentWindow.params = params;
        return new_card.contentWindow;
 }
+
index b930bf1..1745ff0 100644 (file)
@@ -7,8 +7,7 @@
 <page id="clam_shell_win"
        orient="vertical" style="overflow: auto" width="800" height="500"
        sizemode="maximized" persist="width height" 
-       onload="params.clamshell = 'ClamShell_main'; 
-               params.splitter = 'ClamShell_splitter';
+       onload="params.node = document.getElementById('ClamShell_main'); 
                params.w = window; 
                params.app = 'ClamShell'; 
                mw.OpenILS_init(params);"
@@ -26,7 +25,7 @@
        <?xul-overlay href="chrome://evergreen/content/main/clam_shell_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="ClamShell_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="ClamShell_keys" />
@@ -34,5 +33,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="ClamShell_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index 8ec8765..05ad21e 100644 (file)
@@ -5,7 +5,7 @@
 
        <script>mw.sdump('D_TRACE','Loading clam_shell_overlay.xul\n');</script>
 
-<commandset id="ClamShell_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
index 3d6bd3f..4d5c2b2 100755 (executable)
@@ -26,7 +26,7 @@
        <?xul-overlay href="chrome://evergreen/content/main/clam_shell_vertical_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="ClamShell_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="ClamShell_keys" />
@@ -34,5 +34,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="ClamShell_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index dbbb1cb..a55b9d6 100644 (file)
@@ -5,7 +5,7 @@
 
        <script>mw.sdump('D_TRACE','Loading clam_shell_vertical_overlay.xul\n');</script>
 
-<commandset id="ClamShell_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
index 57fa3a2..40326d4 100644 (file)
@@ -2,35 +2,69 @@ sdump('D_TRACE','Loading paged_tree.js\n');
 
 function paged_tree_init(p) {
        sdump('D_PAGED_TREE',"TESTING: paged_tree.js: " + mw.G['main_test_variable'] + '\n');
-       sdump('D_TRACE_ENTER',arg_dump(arguments));
+       sdump('D_CONSTRUCTOR',arg_dump(arguments));
 
-       p.w.current_idx = 0;
+       p.current_idx = 0;
 
-       p.w.results_label = get_widget( p.w.document, p.nav_results );
-       p.w.range_label = get_widget( p.w.document, p.nav_range );
+       p.tree = p.node.getElementsByAttribute('name','tree')[0];
+       p.popup = p.popupset_node.getElementsByAttribute('name','tree')[0];
+       p.treecols = p.tree.firstChild;
+       p.tc = p.tree.lastChild;
 
-       p.w.hits_per_page_menu = get_widget( p.w.document, p.nav_hits_per_page );
-       if (p.hits_per_page) 
-               p.w.display_count = parseInt( p.hits_per_page );
-       else 
-               p.w.display_count = parseInt( p.w.hits_per_page_menu.getAttribute('value') );
+       p._context_function = function (ev) {};
+       p.popup.addEventListener('popupshowing',function (ev) { return p._context_function(ev); },false);
 
-       p.w.next_button = get_widget( p.w.document, p.nav_next );
-       p.w.prev_button = get_widget( p.w.document, p.nav_prev );
+       p._select_callback = function (ev) {};
+       p.tree.addEventListener('select',function (ev) { return p._select_callback(ev); },false);
 
-       p.w.nav_bar = get_widget( p.w.document, p.nav_bar );
-       if (p.hide_nav) p.w.nav_bar.hidden = p.hide_nav;
+       paged_tree_make_columns( p, p.treecols, p.cols )
 
-       /*
-       // Doesn't work for some reason
-       var cmd_set_hits_per_page = get_widget( p.w.document, 'cmd_set_hits_per_page' );
-       cmd_set_hits_per_page.addEventListener(
+       p.clear_tree = function () {
+               empty_widget( p.w.document, p.tc );
+               p.current_idx = 0;
+               return paged_tree_update_nav(p);
+       }
+
+       p.add_rows = function (ids) { 
+               return paged_tree_add_rows(p,p.tc,ids); 
+       }
+
+       p.register_flesh_row_function = function (f) { 
+               return p._flesh_row_function = f; 
+       }
+
+       p.register_select_callback = function (f) { 
+               return p._select_callback = f; 
+       }
+
+       p.register_context_builder = function (f) {
+               return p._context_function = f;
+       }
+
+       p.map_cols_to_treeitem = map_array_to_treecells_via_treeitem;
+
+       p.nav_bar = p.node.getElementsByAttribute('name','nav')[0];
+       if (p.hide_nav) p.nav_bar.hidden = p.hide_nav;
+
+       p.results_label = p.nav_bar.getElementsByAttribute('name','label_results')[0];
+       p.range_label = p.nav_bar.getElementsByAttribute('name','label_range')[0];
+
+       p.next_button = p.nav_bar.getElementsByAttribute('name','button_next')[0];
+       p.prev_button = p.nav_bar.getElementsByAttribute('name','button_prev')[0];
+
+       p.hits_per_page_menu = p.nav_bar.getElementsByAttribute('name','hits_per_page')[0];
+       if (p.hits_per_page) {
+               p.display_count = parseInt( p.hits_per_page );
+       } else {
+               p.display_count = parseInt( p.hits_per_page_menu.getAttribute('value') );
+       }
+       p.hits_per_page_menu.addEventListener(
                'command',
                function (ev) {
                        sdump('D_TRACE','In set_hits handler\n');
                        alert('testing123');
                        try {
-                               p.w.display_count = parseInt( p.w.hits_per_page_menu.getAttribute('value') );
+                               p.display_count = parseInt( p.hits_per_page_menu.getAttribute('value') );
                                paged_tree_update_visibility( p );
                                paged_tree_update_nav( p );
                                paged_tree_flesh_records( p );
@@ -41,11 +75,10 @@ function paged_tree_init(p) {
                },
                false
        );
-       */
 
-       p.w.set_hits_per_page = function () {
+       p.set_hits_per_page = function () {
                try {
-                       p.w.display_count = parseInt( p.w.hits_per_page_menu.getAttribute('value') );
+                       p.display_count = parseInt( p.hits_per_page_menu.getAttribute('value') );
                        paged_tree_update_visibility( p );
                        paged_tree_update_nav( p );
                        paged_tree_flesh_records( p );
@@ -54,84 +87,34 @@ function paged_tree_init(p) {
                }
        }
 
-       var cmd_next = get_widget( p.w.document, 'cmd_next' );
+       var cmd_next = p.commandset_node.getElementsByAttribute('id', 'cmd_tree_next' )[0];
        cmd_next.addEventListener(
                'command',
                function (ev) {
-                       var backup_select_callback = p.w._select_callback;
-                       p.w._select_callback = function (ev) {};
+                       var backup_select_callback = p._select_callback;
+                       p._select_callback = function (ev) {};
                        var result = paged_tree_nav_next(p);
-                       p.w._select_callback = backup_select_callback;
+                       p._select_callback = backup_select_callback;
                        return result;
                },
                false
        );
 
-       var cmd_prev = get_widget( p.w.document, 'cmd_prev' );
+       var cmd_prev = p.commandset_node.getElementsByAttribute('id', 'cmd_tree_prev' )[0];
        cmd_prev.addEventListener(
                'command',
                function (ev) {
-                       var backup_select_callback = p.w._select_callback;
-                       p.w._select_callback = function (ev) {};
+                       var backup_select_callback = p._select_callback;
+                       p._select_callback = function (ev) {};
                        var result = paged_tree_nav_prev(p);
-                       p.w._select_callback = backup_select_callback;
+                       p._select_callback = backup_select_callback;
                        return result;
                },
                false
        );
 
-       p.w.tree = get_widget(p.w.document,p.paged_tree);
-       p.w.popup = get_widget(p.w.document,p.popup);
-       p.w.treecols = p.w.tree.firstChild;
-       p.w.tc = p.w.tree.lastChild;
-
-       p.w._context_function = function (ev) {};
-       p.w.popup.addEventListener('popupshowing',function (ev) { return p.w._context_function(ev); },false);
-
-       p.w._select_callback = function (ev) {};
-       p.w.tree.addEventListener('select',function (ev) { return p.w._select_callback(ev); },false);
-
-       paged_tree_make_columns( p, p.w.treecols, p.cols )
-
-       p.w.clear_tree = function () {
-               empty_widget( p.w.document, p.w.tc );
-               p.w.current_idx = 0;
-               return paged_tree_update_nav(p);
-       }
-
-       p.w.add_rows = function (ids) { 
-               return paged_tree_add_rows(p,p.w.tc,ids); 
-       }
-
-       p.w.register_flesh_row_function = function (f) { 
-               return p.w._flesh_row_function = f; 
-       }
-
-       p.w.register_select_callback = function (f) { 
-               return p.w._select_callback = f; 
-       }
-
-       p.w.register_context_builder = function (f) {
-               return p.w._context_function = f;
-       }
-
-       p.w.map_cols_to_treeitem = map_array_to_treecells_via_treeitem;
-
-       setTimeout(
-               function() {
-                       sdump('D_TIMEOUT','***** timeout occured paged_tree.js');
-                       if (p.onload) {
-                               try {
-                                       sdump('D_TRACE','trying psuedo-onload: ' + p.onload + '\n');
-                                       p.onload(p.w);
-                               } catch(E) {
-                                       sdump('D_ERROR', js2JSON(E) + '\n' );
-                               }
-                       }
-               }, 0
-       );
        sdump('D_TRACE_EXIT',arg_dump(arguments));
-       return;
+       return p;
 }
 
 function paged_tree_make_columns( p, treecols, cols ) {
@@ -168,7 +151,7 @@ function paged_tree_add_rows( p, tc, ids ) {
                treeitem.setAttribute( 'id', i+offset+1 );
                treeitem.setAttribute( 'record_id', id );
                treeitem.setAttribute( 'retrieved', 'false' );
-               if ( (i+offset) < (p.w.display_count + p.w.current_idx) ) {
+               if ( (i+offset) < (p.display_count + p.current_idx) ) {
                        treeitem.setAttribute( 'hidden', 'false' );
                } else {
                        treeitem.setAttribute( 'hidden', 'true' );
@@ -178,7 +161,7 @@ function paged_tree_add_rows( p, tc, ids ) {
                var treerow = d.createElement( 'treerow' );
                treeitem.appendChild( treerow );
 
-               for (var j = 0; j < p.w.treecols.childNodes.length; j++) {
+               for (var j = 0; j < p.treecols.childNodes.length; j++) {
                        var treecell = d.createElement( 'treecell' );
                        if (j == 0)
                                treecell.setAttribute('label', getString('retrieving.record') );
@@ -196,16 +179,16 @@ function paged_tree_add_rows( p, tc, ids ) {
 function paged_tree_flesh_record(p,treeitem) {
        sdump('D_TRACE_ENTER',arg_dump(arguments));
        treeitem.setAttribute('retrieved','true');
-       if (p.w._flesh_row_function) {
-               p.w._flesh_row_function( treeitem );
+       if (p._flesh_row_function) {
+               p._flesh_row_function( treeitem );
        }
        sdump('D_TRACE_EXIT',arg_dump(arguments));
 }
 
 function paged_tree_flesh_records(p) {
        sdump('D_TRACE_ENTER',arg_dump(arguments));
-       for (var i = 0; i < p.w.tc.childNodes.length; i++) {
-               var treeitem = p.w.tc.childNodes[i];
+       for (var i = 0; i < p.tc.childNodes.length; i++) {
+               var treeitem = p.tc.childNodes[i];
                if ( (treeitem.hidden == false) && (treeitem.getAttribute('retrieved')=='false') ) {
                        paged_tree_flesh_record(p,treeitem);
                }
@@ -215,41 +198,41 @@ function paged_tree_flesh_records(p) {
 
 function paged_tree_update_nav(p) {
        sdump('D_TRACE_ENTER',arg_dump(arguments));
-       if (p.w.results_label)
-               p.w.results_label.setAttribute('value', p.w.tc.childNodes.length );
-
-       var min = p.w.current_idx + 1;
-       var max = p.w.current_idx + p.w.display_count;
-       if (max > p.w.tc.childNodes.length)
-               max = p.w.tc.childNodes.length;
-       if (p.w.range_label) {
+       if (p.results_label)
+               p.results_label.setAttribute('value', p.tc.childNodes.length );
+
+       var min = p.current_idx + 1;
+       var max = p.current_idx + p.display_count;
+       if (max > p.tc.childNodes.length)
+               max = p.tc.childNodes.length;
+       if (p.range_label) {
                if (max > 0)
-                       p.w.range_label.setAttribute('value', min + ' - ' + max );
+                       p.range_label.setAttribute('value', min + ' - ' + max );
                else
-                       p.w.range_label.setAttribute('value', '0 - 0' );
+                       p.range_label.setAttribute('value', '0 - 0' );
        }
 
-       if (p.w.next_button) {
-               if (max < p.w.tc.childNodes.length)
-                       p.w.next_button.disabled = false;
+       if (p.next_button) {
+               if (max < p.tc.childNodes.length)
+                       p.next_button.disabled = false;
                else
-                       p.w.next_button.disabled = true;
+                       p.next_button.disabled = true;
        }
 
-       if (p.w.prev_button) {
+       if (p.prev_button) {
                if (min == 1)
-                       p.w.prev_button.disabled = true;
+                       p.prev_button.disabled = true;
                else
-                       p.w.prev_button.disabled = false;
+                       p.prev_button.disabled = false;
        }
        sdump('D_TRACE_EXIT',arg_dump(arguments));
 }
 
 function paged_tree_update_visibility(p) {
        sdump('D_TRACE_ENTER',arg_dump(arguments));
-       for (var i = 0; i < p.w.tc.childNodes.length; i++) {
-               var treeitem = p.w.tc.childNodes[i];
-               if ( (i >= p.w.current_idx) && (i < (p.w.current_idx+p.w.display_count)) )
+       for (var i = 0; i < p.tc.childNodes.length; i++) {
+               var treeitem = p.tc.childNodes[i];
+               if ( (i >= p.current_idx) && (i < (p.current_idx+p.display_count)) )
                        treeitem.hidden = false;
                else
                        treeitem.hidden = true;
@@ -259,10 +242,10 @@ function paged_tree_update_visibility(p) {
 
 function paged_tree_nav_next(p) {
        sdump('D_TRACE_ENTER',arg_dump(arguments));
-       var proposed_idx = p.w.current_idx + p.w.display_count;
-       if (proposed_idx >= p.w.tc.childNodes.length)
-               proposed_idx = p.w.tc.childNodes.length - 1;
-       p.w.current_idx = proposed_idx;
+       var proposed_idx = p.current_idx + p.display_count;
+       if (proposed_idx >= p.tc.childNodes.length)
+               proposed_idx = p.tc.childNodes.length - 1;
+       p.current_idx = proposed_idx;
        paged_tree_update_visibility(p);
        paged_tree_update_nav(p);
        paged_tree_flesh_records(p);
@@ -271,10 +254,10 @@ function paged_tree_nav_next(p) {
 
 function paged_tree_nav_prev(p) {
        sdump('D_TRACE_ENTER',arg_dump(arguments));
-       var proposed_idx = p.w.current_idx - p.w.display_count;
+       var proposed_idx = p.current_idx - p.display_count;
        if (proposed_idx < 0)
                proposed_idx = 0;
-       p.w.current_idx = proposed_idx;
+       p.current_idx = proposed_idx;
        paged_tree_update_visibility(p);
        paged_tree_update_nav(p);
        paged_tree_flesh_records(p);
index e1e877e..7da2f14 100644 (file)
        <?xul-overlay href="chrome://evergreen/content/main/paged_tree_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="PagedTree_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="PagedTree_keys" />
 
        <!-- Context menus -->
-       <popupset id="PagedTree_popupset" />
+       <popupset id="universal_popupset" />
 
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="PagedTree_main" />
 
+
 </page>
 
index ccda131..d417235 100644 (file)
@@ -5,15 +5,15 @@
 
        <script>mw.sdump('D_TRACE','Loading paged_tree_overlay.xul\n');</script>
 
-<commandset id="PagedTree_cmds">
+<commandset id="universal_cmds">
 
-       <command id="cmd_prev" />
+       <command id="cmd_tree_prev" />
 
-       <command id="cmd_next" />
+       <command id="cmd_tree_next" />
 
        <!-- For some reason I can't add an event listener to this and have it fire
                from the menulist below, so using oncommand instead -->
-       <command id="cmd_set_hits_per_page" />
+       <command id="cmd_tree_set_hits_per_page" />
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
@@ -22,8 +22,8 @@
 
 <!-- main widget for paged_tree -->
 <box id="PagedTree_main" flex="1" orient="vertical">
-       <hbox id="PagedTree_nav" />
-       <tree id="PagedTree_tree" flex="1" enableColumnDrag="true">
+       <hbox id="PagedTree_nav" name="nav"/>
+       <tree id="PagedTree_tree" flex="1" enableColumnDrag="true" name="tree">
                <treecols id="PagedTree_columns"/>
                <treechildren id="PagedTree_children" context="PagedTree_popup"/>
        </tree>
 
 <hbox id="PagedTree_nav">
        <label value="&displaying.results;"/>
-       <label id="PagedTree_label_range" value="??? - ???" />
+       <label id="PagedTree_label_range" value="??? - ???" name="label_range"/>
        <label value="&displaying.of;"/>
-       <label id="PagedTree_label_results" value="???"/>
+       <label id="PagedTree_label_results" value="???" name="label_results"/>
        <spacer flex="1"/>
        <label id="ptnl1" value="&displaying.hits_per_page;"/>
-       <menulist id="PagedTree_menulist_hits_per_page" oncommand="window.set_hits_per_page()">
+       <menulist id="PagedTree_menulist_hits_per_page" name="hits_per_page">
                <menupopup id="ptnmp">
                        <menuitem id="ptnm0" label="10" value="10"  />
                        <menuitem id="ptnm1" label="20" value="20" selected="true" />
                        <menuitem id="ptnm9" label="100" value="100" />
                </menupopup>
        </menulist>
-       <button id="PagedTree_button_prev" label="&previous.range;" accesskey="&previous.range.key;" command="cmd_prev" disabled="true"/>
-       <button id="PagedTree_button_next" label="&next.range;" accesskey="&next.range.key;" command="cmd_next" disabled="true"/>
+       <button id="PagedTree_button_prev" label="&previous.range;" accesskey="&previous.range.key;" command="cmd_tree_prev" disabled="true" name="button_prev"/>
+       <button id="PagedTree_button_next" label="&next.range;" accesskey="&next.range.key;" command="cmd_tree_next" disabled="true" name="button_next"/>
 </hbox>
 
 <!-- Context menus -->
-<popupset id="PagedTree_popupset">
-       <popup id="PagedTree_popup" />
+<popupset id="universal_popupset">
+       <popup id="PagedTree_popup" name="tree" />
 </popupset>
 
 <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
index 23cc648..f5c1b47 100755 (executable)
@@ -2,184 +2,121 @@ sdump('D_TRACE','Loading patron_display.js\n');
 
 function patron_display_init(p) {
        sdump('D_PATRON_DISPLAY',"TESTING: patron_display.js: " + mw.G['main_test_variable'] + '\n');
-       sdump('D_TRACE_ENTER',arg_dump(arguments));
+       sdump('D_CONSTRUCTOR',arg_dump(arguments));
 
-       p.w.set_patron = function (au) {
-               return p.w._patron = au;
+       p.clamshell = clam_shell_init( { 'w' : p.w, 'node' : p.clamshell_node, 'debug' : p.app } );
+       p.left_panel = p.clamshell.first_deck;
+       p.right_panel = p.clamshell.second_deck;
+
+       p.inner_left_clamshell = clam_shell_init( { 'w' : p.w, 'node' : p.left_panel.firstChild, 'debug' : p.app } );
+       p.inner_top_panel = p.inner_left_clamshell.first_deck;
+       p.inner_bottom_panel = p.inner_left_clamshell.second_deck;
+
+       p.patron_items = patron_items_init( { 'w' : p.w, 'node' : p.patron_items_node, 'popupset_node' : p.popupset_node, 'commandset_node' : p.commandset_node, 'debug' : p.app } );
+       p.patron_items.register_patron_items_select_callback(
+               function (ev) {
+                       sdump('D_PATRON_DISPLAY','Firing patron_items_select_callback\n');
+                       var patron_items = get_list_from_tree_selection( p.patron_items.tree_win.tree );
+                       /* grab cover art for selected item? */
+               }
+       );
+       p.patron_items.register_flesh_patron_items_function(
+               function (treeitem) {
+                       sdump('D_PATRON_DISPLAY',arg_dump(arguments));
+                       var record_id = treeitem.getAttribute('record_id'); 
+                       p.patron_items.map_patron_items_to_cols( p._patron.checkouts()[ record_id ], treeitem );
+               }
+       );
+       p.patron_items.register_context_builder(
+               function (ev) {
+                       /* add check-in and renew options */
+                       empty_widget(p.patron_items.tree_win.popup);
+                       var patron_items = get_list_from_tree_selection( p.patron_items.tree_win.tree );
+                       var menuitem = p.patron_items.tree_win.document.createElement('menuitem');
+                       p.patron_items.tree_win.popup.appendChild( menuitem );
+                       menuitem.setAttribute('label','Open in OPAC');
+                       menuitem.addEventListener(
+                               'command',
+                               function (ev) {
+                                       for (var i = 0; i < patron_items.length; i++) {
+                                               spawn_patron_itemsdisplay(
+                                                       p.w.app_shell,'new_tab','main_tabbox', 
+                                                       { 
+                                                               'circ' : retrieve_circ_by_id( 
+                                                                       circs[i].getAttribute('record_id') 
+                                                               )
+                                                       }
+                                               );
+                                       }
+                               },
+                               false
+                       );
+               }
+       );
+
+       p.set_patron = function (au) {
+               return p._patron = au;
        }
-       p.w.display_patron = function (au) {
-               if (au) p.w.set_patron(au);
-               if (p.w.status_w)
-                       p.w.status_w.display_patron();
-               if (p.w.contact_w)
-                       p.w.contact_w.display_patron();
-               return render_fm(p.w.document, { 'au' : p.w._patron });
-       };
-       p.w.retrieve_patron_via_barcode = function (barcode) {
-               if (!barcode) barcode = patron_get_barcode( p.w._patron );
-               p.w.set_patron( retrieve_patron_by_barcode( barcode ) );
-               return p.w.display_patron();
+
+       p.display_patron = function (au) {
+               if (au) p.set_patron(au);
+               p.patron_items.clear_patron_items();
+               if (!p._patron.checkouts()) patron_get_checkouts( p._patron );
+               for (var i = 0; i < p._patron.checkouts().length; i++) {
+                       p.patron_items.add_patron_items( [ i ] );
+               }
+               return render_fm(p.w.document, { 'au' : p._patron });
+       }
+
+       p.retrieve_patron_via_barcode = function (barcode) {
+               if (!barcode) barcode = patron_get_barcode( p._patron );
+               p.set_patron( retrieve_patron_by_barcode( barcode ) );
+               return p.display_patron();
        }
-       p.w.retrieve_patron_via_id = function (id) {
-               p.w.set_patron( retrieve_patron_by_id( id ) );
-               return p.w.display_patron();
+
+       p.retrieve_patron_via_id = function (id) {
+               p.set_patron( retrieve_patron_by_id( id ) );
+               return p.display_patron();
        }
-       p.w.refresh = function() {
-               p.w.retrieve_patron_via_id( p.w._patron.id() );
+
+       p.refresh = function() {
+               if (p._patron) p.retrieve_patron_via_id( p._patron.id() );
        }
 
        if (p.patron) {
                if (typeof(p.patron) == 'object') {
-                       p.w._patron = p.patron;
-                       p.w.display_patron();
+                       p._patron = p.patron;
+                       p.display_patron();
                } else
-                       p.w.retrieve_patron_via_barcode( p.patron );
+                       p.retrieve_patron_via_barcode( p.patron );
        }
 
-       sdump('D_TIMEOUT','******** SETTING TIMEOUT\n');
-       setTimeout( 
-               function() {
-                       sdump('D_TIMEOUT','******** timeout occurred in patron_display.js\n');
-                       p.w.clamshell = spawn_clamshell( 
-                               p.w.document, 'new_iframe', p.clamshell, {
-                                       'horizontal' : true,
-                                       'onload' : patron_display_init_after_clamshell(p) 
-                               }
-                       );
-               }
-               ,0
+       p.commandset_node.getElementsByAttribute('id','cmd_patron_refresh')[0].addEventListener(
+               'command',
+               function (ev) {
+                       p.refresh();
+               },
+               false
        );
-       sdump('D_TIMEOUT','******** AFTER SETTING TIMEOUT\n');
-
-       sdump('D_TRACE_EXIT',arg_dump(arguments));
-       return;
-}
 
-function patron_display_init_after_clamshell(p) {
-       sdump('D_PATRON_DISPLAY',arg_dump(arguments));
-       return function (clamshell_w) {
-               setTimeout(
-                       function() {
-                               sdump('D_TIMEOUT','******** timeout occurred (1) after clamshell in patron_display.js\n');
-                               p.w.inner_clamshell = spawn_clamshell_vertical( 
-                                       clamshell_w.document, 
-                                       'new_iframe', 
-                                       clamshell_w.first_deck, {
-                                               'vertical' : true,
-                                               'onload' : patron_display_init_after_inner_clamshell(p)
-                                       }
-                               );
-                       }, 0
-               );
-               /*
-               setTimeout(
-                       function() {
-                               sdump('D_TIMEOUT','******** timeout occurred (2) after clamshell in patron_display.js\n');
-                               p.w.item_tree = spawn_circ_tree( 
-                                       clamshell_w.document, 
-                                       'new_iframe', 
-                                       clamshell_w.second_deck, {
-                                               'paged_tree_onload' : patron_display_init_after_item_tree_paged_tree(p),
-                                               'onload' : patron_display_init_after_item_tree(p)
-                                       }
-                               );
-                       }, 0
+       function gen_func(i) {
+               // because otherwise i would be 5 for each closure
+               return function(ev) {
+                       dump('i = ' + i + '\n');
+                       p.clamshell.set_second_deck(i);
+               };
+       }
+       var cmds = [ 'cmd_patron_checkout', 'cmd_patron_items', 'cmd_patron_holds', 
+               'cmd_patron_bills', 'cmd_patron_edit', 'cmd_patron_info' ]
+       for (var i in cmds) {
+               p.commandset_node.getElementsByAttribute('id',cmds[i])[0].addEventListener(
+                       'command',
+                       gen_func(i),
+                       false
                );
-               */
-               return;
-       };
-
-}
-
-function patron_display_init_after_item_tree_paged_tree(p) {
-       sdump('D_PATRON_DISPLAY',arg_dump(arguments));
-       return function (tree_win) {
-               if (p.w._patron) {
-                       if (!p.w._patron.checkouts()) patron_get_checkouts( p.w._patron );
-                       for (var i = 0; i < p.w._patron.checkouts().length; i++) {
-                               p.w.item_tree.add_circs( [ i ] );
-                       }
-               }
-       };
-};
+       }
 
-function patron_display_init_after_inner_clamshell(p) {
-       sdump('D_PATRON_DISPLAY',arg_dump(arguments));
-       return function (clamshell_w) {
-               sdump('D_PATRON_DISPLAY',arg_dump(arguments));
-               setTimeout(
-                       function() {
-                               sdump('D_TIMEOUT','******** timeout occurred (1) after inner clamshell in patron_display.js\n');
-                               p.w.status_w = spawn_patron_display_status(
-                                       clamshell_w.document, 
-                                       'new_iframe', 
-                                       clamshell_w.first_deck, {
-                                               'patron' : p.w._patron
-                                       }
-                               );
-                       }, 0
-               );
-               setTimeout(
-                       function() {
-                               sdump('D_TIMEOUT','******** timeout occurred (2) after inner clamshell in patron_display.js\n');
-                               p.w.contact_w = spawn_patron_display_contact(
-                                       clamshell_w.document, 
-                                       'new_iframe', 
-                                       clamshell_w.second_deck, {
-                                               'patron' : p.w._patron
-                                       }
-                               );
-                       }, 0
-               );
-               return;
-       };
+       sdump('D_TRACE_EXIT',arg_dump(arguments));
+       return p;
 }
 
-function patron_display_init_after_item_tree(p) {
-       sdump('D_PATRON_DISPLAY',arg_dump(arguments));
-       return function (item_tree_w) {
-               sdump('D_PATRON_DISPLAY',arg_dump(arguments));
-               item_tree_w.register_circ_select_callback(
-                       function (ev) {
-                               sdump('D_PATRON_DISPLAY','Firing circ_select_callback\n');
-                               var circs = get_list_from_tree_selection( item_tree_w.tree_win.tree );
-                               /* grab cover art for selected item? */
-                       }
-               );
-               item_tree_w.register_flesh_circ_function(
-                       function (treeitem) {
-                               sdump('D_PATRON_DISPLAY',arg_dump(arguments));
-                               /* A little kludgy if the patron's checkouts change while the list is being navigated, but since
-                               there is no network traffic, it may be worth clearing and rebuilding the tree when updating */
-                               var record_id = treeitem.getAttribute('record_id'); 
-                               item_tree_w.map_circ_to_cols( p.w._patron.checkouts()[ record_id ], treeitem );
-                       }
-               );
-               item_tree_w.register_context_builder(
-                       function (ev) {
-                               /* add check-in and renew options */
-                               empty_widget(item_tree_w.tree_win.popup);
-                               var circs = get_list_from_tree_selection( item_tree_w.tree_win.tree );
-                               var menuitem = item_tree_w.tree_win.document.createElement('menuitem');
-                               item_tree_w.tree_win.popup.appendChild( menuitem );
-                               menuitem.setAttribute('label','Open in OPAC');
-                               menuitem.addEventListener(
-                                       'command',
-                                       function (ev) {
-                                               for (var i = 0; i < circs.length; i++) {
-                                                       spawn_circ_display(
-                                                               p.w.app_shell,'new_tab','main_tabbox', 
-                                                               { 
-                                                                       'circ' : retrieve_circ_by_id( 
-                                                                               circs[i].getAttribute('record_id') 
-                                                                       )
-                                                               }
-                                                       );
-                                               }
-                                       },
-                                       false
-                               );
-                       }
-               );
-       };
-}
index 2f4911b..b606a59 100755 (executable)
@@ -9,7 +9,10 @@
        sizemode="maximized" persist="width height" 
        onload="params.w = window; 
                params.app = 'PatronDisplay'; 
-               params.clamshell = 'PatronDisplay_groupbox';
+               params.clamshell_node = document.getElementById('ClamShell_main');
+               params.patron_items_node = document.getElementById('PatronItems_main');
+               params.commandset_node = document.getElementById('universal_cmds');
+               params.popupset_node = document.getElementById('universal_popupset');
                mw.focus_widget( document, 'PatronNavBar_refresh' );
                mw.OpenILS_init(params);"
        onunload="mw.OpenILS_exit(params);"
@@ -27,7 +30,7 @@
        <?xul-overlay href="chrome://evergreen/content/patron/patron_display_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="PatronDisplay_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="PatronDisplay_keys" />
@@ -35,5 +38,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="PatronDisplay_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index 1193077..993e48c 100755 (executable)
@@ -22,7 +22,7 @@ function patron_display_contact_init(p) {
                return p.w.display_patron();
        }
 
-       setTimeout(
+       consider_Timeout(
                function() {
                        sdump('D_TIMEOUT','******** timeout occurred in patron_display_contact.js\n');
                        if (p.patron) {
index 5d876b6..d911948 100755 (executable)
@@ -26,7 +26,7 @@
        <?xul-overlay href="chrome://evergreen/content/patron/patron_display_contact_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="PatronDisplayContact_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="PatronDisplayContact_keys" />
@@ -34,5 +34,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="PatronDisplayContact_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index db23753..2e23e04 100755 (executable)
@@ -5,7 +5,7 @@
 
        <script>mw.sdump('D_TRACE','Loading patron_display_contact_overlay.xul\n');</script>
 
-<commandset id="PatronDisplayContact_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
index 499ade8..aebd579 100755 (executable)
@@ -5,27 +5,55 @@
 
        <script>mw.sdump('D_TRACE','Loading patron_display_overlay.xul\n');</script>
 
-<commandset id="PatronDisplay_cmds">
+       <?xul-overlay href="chrome://evergreen/content/main/clam_shell_overlay.xul"?>
+       <?xul-overlay href="chrome://evergreen/content/patron/patron_items_overlay.xul"?>
+       <?xul-overlay href="chrome://evergreen/content/patron/patron_display_status.xul"?>
+       <?xul-overlay href="chrome://evergreen/content/patron/patron_display_contact.xul"?>
+
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
 
-       <command id="cmd_patron_refresh" oncommand="try { refresh(); } catch(E) { mw.sdump('D_ERROR',E); };" />
-       <command id="cmd_patron_checkout" oncommand="try { } catch(E) { mw.sdump('D_ERROR',E); };"/>
-       <command id="cmd_patron_items" oncommand="try { show_items(); } catch(E) { mw.sdump('D_ERROR',E); };"/>
-       <command id="cmd_patron_holds" oncommand="try { } catch(E) { mw.sdump('D_ERROR',E); };"/>
-       <command id="cmd_patron_bills" oncommand="try { } catch(E) { mw.sdump('D_ERROR',E); };"/>
-       <command id="cmd_patron_edit" oncommand="try { } catch(E) { mw.sdump('D_ERROR',E); };"/>
-       <command id="cmd_patron_info" oncommand="alert('info');"/>
+       <command id="cmd_patron_refresh" />
+       <command id="cmd_patron_checkout" />
+       <command id="cmd_patron_items" />
+       <command id="cmd_patron_holds" />
+       <command id="cmd_patron_bills" />
+       <command id="cmd_patron_edit" />
+       <command id="cmd_patron_info" />
 
 </commandset>
 
 <!-- main widget for patron_display -->
 <box id="PatronDisplay_main" flex="1" orient="vertical">
        <hbox id="PatronNavBar" flex="0"/>
-       <groupbox id="PatronDisplay_groupbox" orient="vertical" flex="1"/>
+       <groupbox id="PatronDisplay_groupbox" orient="vertical" flex="1">
+               <box id="ClamShell_main" />
+       </groupbox>
 </box>
 
+<deck id="ClamShell_first_deck">
+       <vbox id="inner_left_clamshell" flex="1">
+               <deck id="csfdvbd1" style="overflow: auto;">
+                       <groupbox id="PatronDisplayStatus_groupbox" />
+               </deck>
+               <splitter id="csfdvbs" />
+               <deck id="csfdvbd2" style="overflow: auto;">
+                       <groupbox id="PatronDisplayContact_groupbox" />
+               </deck>
+       </vbox>
+</deck>
+
+<deck id="ClamShell_second_deck">
+       <box id="PatronCheckout_main"><label value="checkout"/></box>
+       <box id="PatronItems_main" />
+       <box id="PatronHolds_main"><label value="holds" /></box>
+       <box id="PatronBills_main"><label value="bills" /></box>
+       <box id="PatronEdit_main"><label value="edit" /></box>
+       <box id="PatronInfo_main"><label value="info" /></box>
+</deck>
+
 <hbox id="PatronNavBar">
        <label id="PatronNavBar_patron_name" class="patronNameLarge"
                tooltiptext="&patron_display.name.label;"
index 973f2d7..e784763 100755 (executable)
@@ -54,7 +54,7 @@ function patron_display_status_init(p) {
                return p.w.display_patron();
        }
 
-       setTimeout(
+       consider_Timeout(
                function() {
                        sdump('D_TIMEOUT','******** timeout occurred in patron_display_status.js\n');
                        if (p.patron) {
index f0b01fe..a3ef690 100755 (executable)
@@ -28,7 +28,7 @@
        <?xul-overlay href="chrome://evergreen/content/patron/patron_display_status_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="PatronDisplayStatus_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="PatronDisplayStatus_keys" />
@@ -36,5 +36,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="PatronDisplayStatus_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index e336ddd..ad93e27 100755 (executable)
@@ -5,7 +5,7 @@
 
        <script>mw.sdump('D_TRACE','Loading patron_display_status_overlay.xul\n');</script>
 
-<commandset id="PatronDisplayStatus_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
 
 <groupbox id="PatronDisplayStatus_groupbox" orient="vertical">
        <caption label="&patron_display.status.caption;"/>
-       <label id="PatronDisplayStatus_patron_name" class="patronNameMedium"
-               tooltiptext="&patron_display.name.label;"
-               value=" "
-               render="true" fm_class="au" 
-               render_value="patron_get_full_name($$)" />
+       <hbox id="PatronSearch_DisplayStatus_insert1"/>
        <label id="PatronDisplayStatus_home_ou"
                tooltiptext="&patron_display.home_ou.label;"
                value=" "
                render="true" fm_class="au" 
                render_value="patron_get_home_ou_name($$)" />
        <grid id="PatronDisplayStatus_grid" flex="1"/>
-       <button id="PatronDisplayStatus_retrieve_button" 
-               label="&patron_navbar.retrieve;" 
-               accesskey="&patron_navbar.retrieve.accesskey;"/>
+       <hbox id="PatronSearch_DisplayStatus_insert2"/>
        <label bug="without this here, the label and grid get swapped in the display"/>
 </groupbox>
 
index cc02467..e488bc6 100644 (file)
@@ -6,22 +6,21 @@ function patron_search_init(p) {
        sdump('D_PATRON_SEARCH',"TESTING: patron_search.js: " + mw.G['main_test_variable'] + '\n');
        sdump('D_TRACE_ENTER',arg_dump(arguments));
 
-       setTimeout(
-               function () {
-                       sdump('D_TIMEOUT','******** timeout occurred in patron_search.js\n');
-                       p.w.clamshell = spawn_clamshell( 
-                               p.w.document, 'new_iframe', p.clamshell, { 
-                                       'onload' : patron_search_init_after_clamshell(p) 
-                               }
-                       );
-               }, 0
-       );
-
        p.w.crazy_search = function (crazy_search_hash) {
                sdump('D_TRACE_ENTER',arg_dump(arguments));
                sdump('D_TRACE_EXIT',arg_dump(arguments));
                return patron_search( p.w, crazy_search_hash );
        };
+       
+       p.w.result_tree = spawn_patron_search_results(
+               p.w.document, 
+               'new_iframe', 
+               get_widget(p.w.document,p.right_panel), {
+                       'onload' : patron_init_after_patron_search_results(p)
+               }
+       );
+
+
        sdump('D_TRACE_EXIT',arg_dump(arguments));
        return;
 }
@@ -44,40 +43,6 @@ function patron_search(search_win, crazy_search_hash) {
        return result;
 }
 
-function patron_search_init_after_clamshell(p) {
-       sdump('D_PATRON_SEARCH',arg_dump(arguments));
-       return function (clamshell_w) {
-               sdump('D_PATRON_SEARCH',arg_dump(arguments));
-               sdump('D_TRACE_ENTER',arg_dump(arguments));
-               setTimeout(
-                       function () {
-                               sdump('D_TIMEOUT','******** timeout occurred (1) after clamshell in patron_search.js\n');
-                               p.w.search_form = spawn_patron_search_form(
-                                       clamshell_w.document, 
-                                       'new_iframe', 
-                                       clamshell_w.first_deck, {
-                                               'onload' : patron_init_after_patron_search_form(p)
-                                       }
-                               );
-                       }, 0
-               );
-               setTimeout(
-                       function () {
-                               sdump('D_TIMEOUT','******** timeout occurred (2) after clamshell in patron_search.js\n');
-                               p.w.result_tree = spawn_patron_search_results(
-                                       clamshell_w.document, 
-                                       'new_iframe', 
-                                       clamshell_w.second_deck, {
-                                               'onload' : patron_init_after_patron_search_results(p)
-                                       }
-                               );
-                       }, 0
-               );
-               sdump('D_TRACE_EXIT',arg_dump(arguments));
-               return;
-       };
-}
-
 function patron_init_after_patron_search_form(p) {
        sdump('D_PATRON_SEARCH',arg_dump(arguments));
        sdump('D_TRACE_ENTER',arg_dump(arguments));
@@ -97,7 +62,7 @@ function patron_init_after_patron_search_form(p) {
                                }
                        }
                );
-               setTimeout(
+               consider_Timeout(
                        function () {
                                sdump('D_TIMEOUT','******** timeout occurred after patron_search_form in patron_search.js\n');
                                form_w.status_w = spawn_patron_display_status( 
index b32deab..3910120 100644 (file)
@@ -7,7 +7,11 @@
 <page id="patron_search_win"
        orient="vertical" style="overflow: auto" width="800" height="500"
        sizemode="maximized" persist="width height" 
-       onload="params.clamshell = 'PatronSearch_clamshell'; params.w = window; params.app = 'PatronSearch'; mw.OpenILS_init(params);"
+       onload="params.clamshell = 'PatronSearch_clamshell'; 
+               params.right_panel = 'PatronSearch_right_panel';
+               params.w = window; 
+               params.app = 'PatronSearch'; 
+               mw.OpenILS_init(params);"
        onunload="mw.OpenILS_exit(params);"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
@@ -22,7 +26,7 @@
        <?xul-overlay href="chrome://evergreen/content/patron/patron_search_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="PatronSearch_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="PatronSearch_keys" />
@@ -30,5 +34,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="PatronSearch_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index 6e62546..9ec48ba 100644 (file)
@@ -34,7 +34,7 @@ function patron_search_form_init(p) {
        else
                sdump('D_PATRON_SEARCH_FORM',"No cmd_clear element.\n");
 
-       setTimeout(
+       consider_Timeout(
                function() {
                        sdump('D_TIMEOUT','******** timeout occurred in patron_search_form.js\n');
                        if (p.onload) {
index b76c6f3..5916ee7 100644 (file)
@@ -25,7 +25,7 @@
        <?xul-overlay href="chrome://evergreen/content/patron/patron_search_form_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="PatronSearchForm_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="PatronSearchForm_keys" />
@@ -33,5 +33,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="PatronSearchForm_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index 1b3b29b..ce083d2 100644 (file)
@@ -5,7 +5,7 @@
 
        <script>mw.sdump('D_TRACE','Loading patron_search_form_overlay.xul\n');</script>
 
-<commandset id="PatronSearchForm_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
@@ -22,8 +22,7 @@
                <caption id="psgf_gbc" label='&patron_search_form.caption;' />
                <grid id="psg" />
        </groupbox>
-       <box id="PatronSearchForm_selection" orient="vertical" flex="1" />
-
+       <groupbox id="PatronDisplayStatus_groupbox">
 </box>
 
 <!-- group 0 = user  group 1 = address  group 2 = phone, ident -->
index a22d09a..1a219c0 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
-<!DOCTYPE overlay SYSTEM "chrome://evergreen/locale/patron_search.dtd">
+<!DOCTYPE overlay SYSTEM "chrome://evergreen/locale/patron_display.dtd">
 <overlay id="patron_search_overlay" 
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
        <script>mw.sdump('D_TRACE','Loading patron_search_overlay.xul\n');</script>
 
-<commandset id="PatronSearch_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
 
 <!-- main widget for patron_search -->
 <box id="PatronSearch_main" flex="1" orient="vertical">
-       <box id="PatronSearch_clamshell" flex="1" orient="horizontal"/>
+       <deck id="psmd1">
+       </deck>
+       <splitter id="psms" />
+       <deck id="PatronSearch_right_panel"/>
 </box>
 
+<hbox id="PatronSearch_DisplayStatus_insert1"/>
+       <label id="PatronSearch_patron_name" class="patronNameMedium"
+               tooltiptext="&patron_display.name.label;"
+               value=" "
+               render="true" fm_class="au" 
+               render_value="patron_get_full_name($$)" />
+</hbox>
+<hbox id="PatronSearch_DisplayStatus_insert2"/>
+       <button id="PatronSearch_retrieve_button" 
+               label="&patron_navbar.retrieve;" 
+               accesskey="&patron_navbar.retrieve.accesskey;"/>
+</hbox>
+
+
 <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
 <keyset id="PatronSearch_keys">
 </keyset>
index 078a4bd..1f29ddf 100644 (file)
@@ -54,7 +54,7 @@ function patron_search_results_init(p) {
                patron_search_results_map_patron_to_cols(p, patron, treeitem);  
        }
 
-       setTimeout(
+       consider_Timeout(
                function() {
                        sdump('D_TIMEOUT','******** timeout occurred in patron_search_results.js\n');
                        if (p.onload) {
index 5589d5d..d37b702 100644 (file)
@@ -22,7 +22,7 @@
        <?xul-overlay href="chrome://evergreen/content/patron/patron_search_results_overlay.xul"?>
 
        <!-- XUL'ified abstraction for logic to attach to widgets -->
-       <commandset id="PatronSearchResults_cmds" />
+       <commandset id="universal_cmds" />
 
        <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
        <keyset id="PatronSearchResults_keys" />
@@ -30,5 +30,7 @@
        <!-- Layout to be filled in by overlays and javascript -->
        <box id="PatronSearchResults_main" />
 
+       <popupset id="universal_popupset" />
+
 </page>
 
index be1ba88..8ea0412 100644 (file)
@@ -5,7 +5,7 @@
 
        <script>mw.sdump('D_TRACE','Loading patron_search_results_overlay.xul\n');</script>
 
-<commandset id="PatronSearchResults_cmds">
+<commandset id="universal_cmds">
 
        <command id="cmd_broken" oncommand="
                alert('Not Yet Implemented'); "/>
index 3713908..0dde6fd 100644 (file)
@@ -16,6 +16,7 @@ var sdump_levels = {
        'D_TRACE_EXIT' :  false,
        'D_TIMEOUT' :  true,
        'D_FILTER' : true,
+       'D_CONSTRUCTOR' : true,
 
        'D_CLAM' : false,
        'D_PAGED_TREE' : false,
@@ -33,6 +34,8 @@ var sdump_levels = {
        'D_PATRON_DISPLAY_STATUS' : true,
        'D_PATRON_DISPLAY_CONTACT' : true,
 
+       'D_PATRON_ITEMS' : true,
+
        'D_PATRON_UTILS' : true,
        
        'D_CIRC_TREE' : true,
index cec1119..2b8b9c3 100644 (file)
@@ -58,6 +58,7 @@
                                var tb = document.createElement('textbox');
                                hbox.appendChild(tb);
                                tb.setAttribute('multiline','true');
+                               tb.setAttribute('readonly','true');
                                tb.setAttribute('rows','5');
                                tb.setAttribute('flex','1');
                                tb.setAttribute('value',msg.message);
index 25b0fd9..7d16349 100644 (file)
@@ -2,6 +2,19 @@ sdump('D_TRACE','Loading util.js\n');
 
 var timer = {};
 var counter = {};
+var consider_Timeout_default = false;
+
+function consider_Timeout( f, t, b) {
+       sdump('D_TIMEOUT', arg_dump(arguments,{0:true,1:true,2:true}));
+       if (b) {
+               setTimeout(f,t);
+       } else {
+               if (consider_Timeout_default)
+                       setTimeout(f,t);
+               else
+                       f();
+       }
+}
 
 function parse_render_string( obj_string, render_string, regexp ) {
        sdump('D_UTIL', arg_dump(arguments,{0:true,1:true}));
index ed03619..deacaf8 100644 (file)
@@ -381,12 +381,13 @@ function set_deck() {
        if (arguments.length == 2) {
                deck = arguments[0];
                idx = arguments[1];
+               set_decks({ deck : idx });
        } else {
                d = arguments[0];
                deck = arguments[1];
                idx = arguments[2];
+               set_decks(d,{ deck : idx });
        }
-       set_decks(d,{ deck : idx });
 }
 
 // Takes a hash with key:value => deck element id : page index
@@ -404,7 +405,10 @@ function set_decks() {
                var deck = deck_id;
                if (typeof(deck) != 'object')
                        deck = d.getElementById( deck_id )
-               if (deck) deck.setAttribute( 'selectedIndex', params[deck_id] );
+               if (deck) {
+                       deck.setAttribute( 'selectedIndex', params[deck_id] );
+                       deck.selectedIndex = params[deck_id];
+               }
        }
 }