move the menu code from chrome to remote
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jan 2009 04:08:02 +0000 (04:08 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jan 2009 04:08:02 +0000 (04:08 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/staff-client-experiment@11961 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/chrome/content/main/menu.js [deleted file]
Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul [deleted file]
Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul [deleted file]
Open-ILS/xul/staff_client/chrome/content/main/menu_frame_overlay.xul [deleted file]
Open-ILS/xul/staff_client/server/main/menu.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/main/menu_frame.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/main/menu_frame_menus.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul [new file with mode: 0644]

index 5e2941e..0307c44 100644 (file)
@@ -278,7 +278,8 @@ const urls = {
        'XUL_MARC_NEW' : '/xul/server/cat/marc_new.xul',
        'XUL_MARC_EDIT' : '/xul/server/cat/marcedit.xul',
        'XUL_MARC_VIEW' : '/xul/server/cat/marc_view.xul',
-       'XUL_MENU_FRAME' : 'chrome://open_ils_staff_client/content/main/menu_frame.xul',
+       /* 'XUL_MENU_FRAME' : 'chrome://open_ils_staff_client/content/main/menu_frame.xul', */
+       'XUL_MENU_FRAME' : '/xul/server/main/menu_frame.xul',
        'XUL_NON_CAT_LABEL_EDIT' : '/xul/server/admin/non_cat_types.xhtml',
        'XUL_OFFLINE_UPLOAD_XACTS' : '/xul/server/admin/upload_xacts.xhtml',
        'XUL_OFFLINE_MANAGE_XACTS' : '/xul/server/admin/offline_manage_xacts.xul',
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
deleted file mode 100644 (file)
index fc3a259..0000000
+++ /dev/null
@@ -1,949 +0,0 @@
-dump('entering main/menu.js\n');
-// vim:noet:sw=4:ts=4:
-
-var offlineStrings;
-offlineStrings = document.getElementById('offlineStrings');
-
-if (typeof main == 'undefined') main = {};
-main.menu = function () {
-
-       JSAN.use('util.error'); this.error = new util.error();
-       JSAN.use('util.window'); this.window = new util.window();
-
-       this.w = window;
-}
-
-main.menu.prototype = {
-
-       'id_incr' : 0,
-
-       'url_prefix' : function(url) {
-               if (url.match(/^\//)) url = urls.remote + url;
-               if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url;
-               dump('url_prefix = ' + url + '\n');
-               return url;
-       },
-
-       'init' : function( params ) {
-
-               urls.remote = params['server'];
-
-               var obj = this;
-
-               JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
-
-               var cmd_map = {
-                       'cmd_broken' : [
-                               ['oncommand'],
-                               function() { alert(offlineStrings.getString('common.unimplemented')); }
-                       ],
-
-                       /* File Menu */
-                       'cmd_close_window' : [ 
-                               ['oncommand'], 
-                               function() { window.close(); } 
-                       ],
-                       'cmd_new_window' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.window.open(
-                                               obj.url_prefix(urls.XUL_MENU_FRAME)
-                                               + '?server='+window.escape(urls.remote),
-                                               'main' + obj.window.window_name_increment(),
-                                               'chrome,resizable'); 
-                               }
-                       ],
-                       'cmd_new_tab' : [
-                               ['oncommand'],
-                               function() { obj.new_tab(null,{'focus':true},null); }
-                       ],
-                       'cmd_close_tab' : [
-                               ['oncommand'],
-                               function() { obj.close_tab(); }
-                       ],
-                       'cmd_close_all_tabs' : [
-                               ['oncommand'],
-                               function() { obj.close_all_tabs(); }
-                       ],
-
-                       /* Edit Menu */
-                       'cmd_edit_copy_buckets' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_COPY_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_copy_buckets.tab')},{});
-                               }
-                       ],
-                       'cmd_edit_volume_buckets' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_VOLUME_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_volume_buckets.tab')},{});
-                               }
-                       ],
-                       'cmd_edit_record_buckets' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_RECORD_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_record_buckets.tab')},{});
-                               }
-                       ],
-                       'cmd_edit_user_buckets' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_USER_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_user_buckets.tab')},{});
-                               }
-                       ],
-
-
-                       'cmd_replace_barcode' : [
-                               ['oncommand'],
-                               function() {
-                                       try {
-                                               JSAN.use('util.network');
-                                               var network = new util.network();
-
-                                               var old_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.label'));
-                                               if (!old_bc) return;
-       
-                                               var copy;
-                        try {
-                            copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ old_bc ]);
-                                               if (typeof copy.ilsevent != 'undefined') throw(copy); 
-                                               if (!copy) throw(copy);
-                        } catch(E) {
-                            alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.retrieval.error', [old_bc]) + '\n');
-                            return;
-                        }
-       
-                                               // Why did I want to do this twice?  Because this copy is more fleshed?
-                        try {
-                                               copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]);
-                                               if (typeof copy.ilsevent != 'undefined') throw(copy);
-                                               if (!copy) throw(copy);
-                        } catch(E) {
-                            try { alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.retrieval.error', [old_bc]) + '\n' + (typeof E.ilsevent == 'undefined' ? '' : E.textcode + ' : ' + E.desc)); } catch(F) { alert(E + '\n' + F); }
-                            return;
-                        }
-       
-                                               var new_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.replacement.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.replacement.label'));
-                                               new_bc = String( new_bc ).replace(/\s/g,'');
-                                               if (!new_bc) {
-                                                       alert(offlineStrings.getString('menu.cmd_replace_barcode.blank.error'));
-                                                       return;
-                                               }
-       
-                                               var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ new_bc ]);
-                                               if (typeof test.ilsevent == 'undefined') {
-                                               alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.duplicate.error', [new_bc]));
-                                                       return;
-                                               } else {
-                                                       if (test.ilsevent != 1502 /* ASSET_COPY_NOT_FOUND */) {
-                                                       obj.error.standard_unexpected_error_alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.testing.error', [new_bc]),test);
-                                                               return;
-                                                       }       
-                                               }
-
-                                               copy.barcode(new_bc); copy.ischanged('1');
-                                               var r = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), [ copy ] ]);
-                                               if (typeof r.ilsevent != 'undefined') { 
-                            if (r.ilsevent != 0) {
-                                if (r.ilsevent == 5000 /* PERM_FAILURE */) {
-                                    alert(offlineStrings.getString('menu.cmd_replace_barcode.permission.error'));
-                                } else {
-                                    obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.cmd_replace_barcode.renaming.error'),r);
-                                }
-                            }
-                        }
-                                       } catch(E) {
-                                               obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.cmd_replace_barcode.renaming.failure'),copy);
-                                       }
-                               }
-                       ],
-
-                       /* Search Menu */
-                       'cmd_patron_search' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_DISPLAY),{},{});
-                               }
-                       ],
-                       'cmd_search_opac' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       var content_params = { 'session' : ses(), 'authtime' : ses('authtime') };
-                                       obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {'tab_name':offlineStrings.getString('menu.cmd_search_opac.tab')}, content_params);
-                               }
-                       ],
-                       'cmd_search_tcn' : [
-                               ['oncommand'],
-                               function() {
-                                       var tcn = prompt(offlineStrings.getString('menu.cmd_search_tcn.tab'),'',offlineStrings.getString('menu.cmd_search_tcn.prompt'));
-
-                                       function spawn_tcn(r) {
-                                               for (var i = 0; i < r.count; i++) {
-                                                       var id = r.ids[i];
-                                                       var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + id;
-                                                       obj.data.stash_retrieve();
-                                                       var content_params = { 
-                                                               'session' : ses(), 
-                                                               'authtime' : ses('authtime'),
-                                                               'opac_url' : opac_url,
-                                                       };
-                                                       if (i == 0) {
-                                                               obj.set_tab(
-                                                                       obj.url_prefix(urls.XUL_OPAC_WRAPPER), 
-                                                                       {'tab_name':tcn}, 
-                                                                       content_params
-                                                               );
-                                                       } else {
-                                                               obj.new_tab(
-                                                                       obj.url_prefix(urls.XUL_OPAC_WRAPPER), 
-                                                                       {'tab_name':tcn}, 
-                                                                       content_params
-                                                               );
-                                                       }
-                                               }
-                                       }
-
-                                       if (tcn) {
-                                               JSAN.use('util.network');
-                                               var network = new util.network();
-                                               var robj = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn]);
-                                               if (robj.count != robj.ids.length) throw('FIXME -- FM_BRE_ID_SEARCH_VIA_TCN = ' + js2JSON(robj));
-                                               if (robj.count == 0) {
-                                                       var robj2 = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn,1]);
-                                                       if (robj2.count == 0) {
-                                                               alert(offlineStrings.getFormattedString('menu.cmd_search_tcn.not_found.error', [tcn]));
-                                                       } else {
-                                                               if ( window.confirm(offlineStrings.getFormattedString('menu.cmd_search_tcn.deleted.error', [tcn])) ) {
-                                                                       spawn_tcn(robj2);
-                                                               }
-                                                       }
-                                               } else {
-                                                       spawn_tcn(robj);
-                                               }
-                                       }
-                               }
-                       ],
-                       'cmd_search_bib_id' : [
-                               ['oncommand'],
-                               function() {
-                                       var bib_id = prompt(offlineStrings.getString('menu.cmd_search_bib_id.tab'),'',offlineStrings.getString('menu.cmd_search_bib_id.prompt'));
-                    if (!bib_id) return;
-
-                                       var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + bib_id;
-                                       var content_params = { 
-                                               'session' : ses(), 
-                                               'authtime' : ses('authtime'),
-                                               'opac_url' : opac_url,
-                                       };
-                                       obj.set_tab(
-                                               obj.url_prefix(urls.XUL_OPAC_WRAPPER), 
-                                               {'tab_name':'#' + bib_id}, 
-                                               content_params
-                                       );
-                               }
-                       ],
-                       'cmd_copy_status' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_COPY_STATUS),{},{});
-                               }
-                       ],
-
-                       /* Circulation Menu */
-                       'cmd_patron_register' : [
-                               ['oncommand'],
-                               function() {
-                                                               function spawn_editor(p) {
-                                                                       var url = urls.XUL_PATRON_EDIT;
-                                                                       var param_count = 0;
-                                                                       for (var i in p) {
-                                                                               if (param_count++ == 0) url += '?'; else url += '&';
-                                                                               url += i + '=' + window.escape(p[i]);
-                                                                       }
-                                                                       var loc = obj.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
-                                                                       obj.new_tab(
-                                                                               loc, 
-                                                                               {}, 
-                                                                               { 
-                                                                                       'show_print_button' : true , 
-                                                                                       'tab_name' : offline.getString('menu.cmd_patron_register.related.tab'),
-                                                                                       'passthru_content_params' : {
-                                                                                               'spawn_search' : function(s) { obj.spawn_search(s); },
-                                                                                               'spawn_editor' : spawn_editor,
-                                                                                       }
-                                                                               }
-                                                                       );
-                                                               }
-
-                                       obj.data.stash_retrieve();
-                                       var loc = obj.url_prefix( urls.XUL_REMOTE_BROWSER ) 
-                                               + '?url=' + window.escape( urls.XUL_PATRON_EDIT + '?ses=' + window.escape( ses() ) );
-                                       obj.set_tab(
-                                               loc, 
-                                               {}, 
-                                               { 
-                                                       'show_print_button' : true , 
-                                                       'tab_name' : offlineStrings.getString('menu.cmd_patron_register.tab'),
-                                                       'passthru_content_params' : {
-                                                               'spawn_search' : function(s) { obj.spawn_search(s); },
-                                                               'spawn_editor' : spawn_editor,
-                                                       }
-                                               }
-                                       );
-                               }
-                       ],
-                       'cmd_circ_checkin' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN),{},{});
-                               }
-                       ],
-                       'cmd_circ_checkout' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY),{},{});
-                               }
-                       ],
-                       'cmd_circ_hold_capture' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN)+'?hold_capture=1',{},{});
-                               }
-                       ],
-                       'cmd_browse_holds' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER),{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds.tab') },{});
-                               }
-                       ],
-                       'cmd_browse_holds_shelf' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER)+'?shelf=1',{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds_shelf.tab') },{});
-                               }
-                       ],
-                       'cmd_circ_hold_pull_list' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.data.stash_retrieve();
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
-                                               obj.url_prefix(urls.XUL_HOLD_PULL_LIST) + '?ses='+window.escape(ses())
-                                       );
-                                       obj.set_tab( loc, {'tab_name' : offlineStrings.getString('menu.cmd_browse_hold_pull_list.tab')}, { 'show_print_button' : true } );
-                               }
-                       ],
-
-                       'cmd_in_house_use' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_IN_HOUSE_USE),{},{});
-                               }
-                       ],
-
-                       'cmd_standalone' : [
-                               ['oncommand'],
-                               function() { 
-                                       obj.set_tab(obj.url_prefix(urls.XUL_STANDALONE),{},{});
-                               }
-                       ],
-
-                       'cmd_local_admin' : [
-                               ['oncommand'],
-                               function() { 
-                                       //obj.set_tab(obj.url_prefix(urls.XUL_LOCAL_ADMIN)+'?ses='+window.escape(ses())+'&session='+window.escape(ses()),{},{});
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
-                                               urls.XUL_LOCAL_ADMIN+'?ses='+window.escape(ses())+'&session='+window.escape(ses())
-                                       );
-                                       obj.set_tab( 
-                                               loc, 
-                                               {'tab_name' : offlineStrings.getString('menu.cmd_local_admin.tab'), 'browser' : true }, 
-                                               { 'no_xulG' : false, 'show_nav_buttons' : true, 'show_print_button' : true } 
-                                       );
-
-                               }
-                       ],
-
-                       'cmd_open_vandelay' : [
-                               ['oncommand'],
-                               function() { 
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + 
-                        window.escape(urls.VANDELAY+'?ses='+window.escape(ses()));
-                                       obj.set_tab( 
-                                               loc, 
-                                               {'tab_name' : offlineStrings.getString('menu.cmd_open_vandelay.tab'), 'browser' : true }, 
-                                               {'no_xulG' : false, 'show_print_button' : false } 
-                                       );
-
-                               }
-                       ],
-
-                       'cmd_open_conify' : [
-                               ['oncommand'],
-                               function() { 
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + 
-                        window.escape(urls.CONIFY+'?ses='+window.escape(ses()));
-                                       obj.set_tab( 
-                                               loc, 
-                                               {'tab_name' : offlineStrings.getString('menu.cmd_open_conify.tab'), 'browser' : true }, 
-                                               {'no_xulG' : false, 'show_print_button' : false } 
-                                       );
-
-                               }
-                       ],
-
-                       'cmd_reprint' : [
-                               ['oncommand'],
-                               function() {
-                                       try {
-                                               JSAN.use('util.print'); var print = new util.print();
-                                               print.reprint_last();
-                                       } catch(E) {
-                                               alert(E);
-                                       }
-                               }
-                       ],
-
-                       'cmd_retrieve_last_patron' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       if (!obj.data.last_patron) {
-                                               alert(offlineStrings.getString('menu.cmd_retrieve_last_patron.session.error'));
-                                               return;
-                                       }
-                                       var url = obj.url_prefix( urls.XUL_PATRON_DISPLAY ); // + '?id=' + window.escape( obj.data.last_patron ) );
-                                       obj.set_tab( url, {}, { 'id' : obj.data.last_patron } );
-                               }
-                       ],
-                       
-                       'cmd_retrieve_last_record' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       if (!obj.data.last_record) {
-                                               alert(offlineStrings.getString('menu.cmd_retrieve_last_record.session.error'));
-                                               return;
-                                       }
-                                       var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + obj.data.last_record;
-                                       var content_params = {
-                                               'session' : ses(),
-                                               'authtime' : ses('authtime'),
-                                               'opac_url' : opac_url,
-                                       };
-                                       obj.set_tab(
-                                               obj.url_prefix(urls.XUL_OPAC_WRAPPER),
-                                               {'tab_name' : offlineStrings.getString('menu.cmd_retrieve_last_record.status')},
-                                               content_params
-                                       );
-                               }
-                       ],
-
-            'cmd_verify_credentials' : [
-                ['oncommand'],
-                function() {
-                                       obj.set_tab(
-                                               obj.url_prefix(urls.XUL_VERIFY_CREDENTIALS),
-                                               { 'tab_name' : offlineStrings.getString('menu.cmd_verify_credentials.tabname') },
-                                               {}
-                                       );
-                }
-            ],
-
-                       /* Cataloging Menu */
-                       'cmd_z39_50_import' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_Z3950_IMPORT),{},{});
-                               }
-                       ],
-                       'cmd_create_marc' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_MARC_NEW),{},{});
-                               }
-                       ],
-
-                       /* Admin menu */
-                       'cmd_change_session' : [
-                               ['oncommand'],
-                               function() {
-                                       try {
-                                               obj.data.stash_retrieve();
-                                               JSAN.use('util.network'); var network = new util.network();
-                                               var x = document.getElementById('oc_menuitem');
-                                               var x_label = x.getAttribute('label_orig');
-                                               var temp_au = js2JSON( obj.data.list.au[0] );
-                                               var temp_ses = js2JSON( obj.data.session );
-                                               if (obj.data.list.au.length > 1) {
-                                                       obj.data.list.au = [ obj.data.list.au[1] ];
-                                                       obj.data.stash('list');
-                                                       network.reset_titlebars( obj.data );
-                                                       x.setAttribute('label', x_label );
-                                                       network.simple_request('AUTH_DELETE', [ obj.data.session.key ] );
-                                                       obj.data.session = obj.data.previous_session;
-                                                       obj.data.stash('session');
-                                           try {
-                                                               var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
-                                                               var cookieUri = ios.newURI("http://" + obj.data.server_unadorned, null, null);
-                                                               var cookieUriSSL = ios.newURI("https://" + obj.data.server_unadorned, null, null);
-                                                               var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
-
-                                                               cookieSvc.setCookieString(cookieUri, null, "ses="+obj.data.session.key, null);
-                                                               cookieSvc.setCookieString(cookieUriSSL, null, "ses="+obj.data.session.key, null);
-
-                                           } catch(E) {
-                                                   alert(offlineStrings.getFormattedString(main.session_cookie.error, [E]));
-                                           }
-
-                                                       removeCSSClass(document.getElementById('main_tabbox'),'operator_change');
-                                               } else {
-                                                       if (network.get_new_session(offlineStrings.getString('menu.cmd_chg_session.label'),{'url_prefix':obj.url_prefix})) {
-                                                               obj.data.stash_retrieve();
-                                                               obj.data.list.au[1] = JSON2js( temp_au );
-                                                               obj.data.stash('list');
-                                                               obj.data.previous_session = JSON2js( temp_ses );
-                                                               obj.data.stash('previous_session');
-                                                               x.setAttribute('label', offlineStrings.getFormattedString('menu.cmd_chg_session.operator.label', [obj.data.list.au[1].usrname()]) );
-                                                               addCSSClass(document.getElementById('main_tabbox'),'operator_change');
-                                                       }
-                                               }
-                                       } catch(E) {
-                                               obj.error.standard_unexpected_error_alert('cmd_change_session',E);
-                                       }
-                               }
-                       ],
-                       'cmd_manage_offline_xacts' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab(obj.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS), {'tab_name' : offlineStrings.getString('menu.cmd_manage_offline_xacts.tab')}, {});
-                               }
-                       ],
-                       'cmd_download_patrons' : [
-                               ['oncommand'],
-                               function() {
-                                       try {
-                                               netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-                                               var x = new XMLHttpRequest();
-                                               var url = 'http://' + XML_HTTP_SERVER + '/standalone/list.txt';
-                                               x.open("GET",url,false);
-                                               x.send(null);
-                                               if (x.status == 200) {
-                                                       JSAN.use('util.file'); var file = new util.file('offline_patron_list');
-                                                       file.write_content('truncate',x.responseText);
-                                                       file.close();
-                                                       file = new util.file('offline_patron_list.date');
-                                                       file.write_content('truncate',new Date());
-                                                       file.close();
-                                                       alert(offlineStrings.getString('menu.cmd_download_patrons.complete.status'));
-                                               } else {
-                                                       alert(offlineStrings.getFormattedString('menu.cmd_download_patrons.error', [x.status, x.statusText]));
-                                               }
-                                       } catch(E) {
-                                               obj.error.standard_unexpected_error_alert('cmd_download_patrons',E);
-                                       }
-                               }
-                       ],
-                       'cmd_adv_user_edit' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY), {}, { 'perm_editor' : true });
-                               }
-                       ],
-                       'cmd_print_list_template_edit' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_PRINT_LIST_TEMPLATE_EDITOR), {}, {});
-                               }
-                       ],
-                       'cmd_stat_cat_edit' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_STAT_CAT_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_stat_cat_edit.tab')},{});
-                               }
-                       ],
-                       'cmd_non_cat_type_edit' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_NON_CAT_LABEL_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_non_cat_type_edit.tab')},{});
-                               }
-                       ],
-                       'cmd_copy_location_edit' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.XUL_COPY_LOCATION_EDIT) + '?ses='+window.escape(ses()),{'tab_name' : offlineStrings.getString('menu.cmd_copy_location_edit.tab')},{});
-                               }
-                       ],
-                       'cmd_test' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       var content_params = { 'session' : ses(), 'authtime' : ses('authtime') };
-                                       obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params);
-                               }
-                       ],
-                       'cmd_test_html' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.TEST_HTML) + '?ses='+window.escape(ses()),{ 'browser' : true },{});
-                               }
-                       ],
-                       'cmd_test_xul' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.set_tab(obj.url_prefix(urls.TEST_XUL) + '?ses='+window.escape(ses()),{ 'browser' : true },{});
-                               }
-                       ],
-                       'cmd_console' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_CONSOLE),{'tab_name' : offlineStrings.getString('menu.cmd_console.tab')},{});
-                               }
-                       ],
-                       'cmd_shell' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_SHELL),{'tab_name' : offlineStrings.getString('menu.cmd_shell.tab')},{});
-                               }
-                       ],
-                       'cmd_xuleditor' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_XULEDITOR),{'tab_name' : offlineStrings.getString('menu.cmd_xuleditor.tab')},{});
-                               }
-                       ],
-                       'cmd_fieldmapper' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_FIELDMAPPER),{'tab_name' : offlineStrings.getString('menu.cmd_fieldmapper.tab')},{});
-                               }
-                       ],
-                       'cmd_survey_wizard' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.data.stash_retrieve();
-                                       obj.window.open(obj.url_prefix(urls.XUL_SURVEY_WIZARD),'survey_wizard','chrome'); 
-                               }
-                       ],
-                       'cmd_public_opac' : [
-                               ['oncommand'],
-                               function() {
-                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
-                                               urls.remote
-                                       );
-                                       obj.set_tab( 
-                                               loc, 
-                                               {'tab_name' : offlineStrings.getString('menu.cmd_public_opac.tab'), 'browser' : true}, 
-                                               { 'no_xulG' : true, 'show_nav_buttons' : true, 'show_print_button' : true } 
-                                       );
-                               }
-                       ],
-                       'cmd_clear_cache' : [
-                               ['oncommand'],
-                               function clear_the_cache() {
-                                       try {
-                                               var cacheClass          = Components.classes["@mozilla.org/network/cache-service;1"];
-                                               var cacheService        = cacheClass.getService(Components.interfaces.nsICacheService);
-                                               cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
-                                               cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
-                                       } catch(E) {
-                                               dump(E+'\n');alert(E);
-                                       }
-                               }
-                       ],
-                       'cmd_restore_all_tabs' : [
-                               ['oncommand'],
-                               function() {
-                                       var tabs = obj.controller.view.tabs;
-                                       for (var i = 0; i < tabs.childNodes.length; i++) {
-                                               tabs.childNodes[i].hidden = false;
-                                       }
-                               }
-                       ],
-                       'cmd_extension_manager' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=extensions',{'tab_name' : offlineStrings.getString('menu.cmd_extension_manager.tab')},{});
-                               }
-                       ],
-                       'cmd_theme_manager' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=themes',{'tab_name' : offlineStrings.getString('menu.cmd_theme_manager.tab')},{});
-                               }
-                       ],
-                       'cmd_about_config' : [
-                               ['oncommand'],
-                               function() {
-                                       obj.set_tab('chrome://global/content/config.xul',{'tab_name' : 'about:config'},{});
-                               }
-                       ],
-                       'cmd_shutdown' : [
-                               ['oncommand'],
-                               function() {
-                                       if (window.confirm(offlineStrings.getString('menu.cmd_shutdown.prompt'))) {
-                                               var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService();
-                                               var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
-                                               var enumerator = windowManagerInterface.getEnumerator(null);
-                                               var w; // close all other windows
-                                               while ( w = enumerator.getNext() ) {
-                                                       if (w != window) w.close();
-                                               }
-                                               window.close();
-                                       }
-                               }
-                       ],
-               };
-
-               JSAN.use('util.controller');
-               var cmd;
-               obj.controller = new util.controller();
-               obj.controller.init( { 'window_knows_me_by' : 'g.menu.controller', 'control_map' : cmd_map } );
-
-               obj.controller.view.tabbox = window.document.getElementById('main_tabbox');
-               obj.controller.view.tabs = obj.controller.view.tabbox.firstChild;
-               obj.controller.view.panels = obj.controller.view.tabbox.lastChild;
-
-               obj.new_tab(null,{'focus':true},null);
-
-               obj.init_tab_focus_handlers();
-       },
-
-       'spawn_search' : function(s) {
-               var obj = this;
-               obj.error.sdump('D_TRACE', offlineStrings.getFormattedString('menu.spawn_search.msg', [js2JSON(s)]) ); 
-               obj.data.stash_retrieve();
-               var loc = obj.url_prefix(urls.XUL_PATRON_DISPLAY);
-               loc += '?doit=1&query=' + window.escape(js2JSON(s));
-               obj.new_tab( loc, {}, {} );
-       },
-
-       'init_tab_focus_handlers' : function() {
-               var obj = this;
-               for (var i = 0; i < obj.controller.view.tabs.childNodes.length; i++) {
-                       var tab = obj.controller.view.tabs.childNodes[i];
-                       var panel = obj.controller.view.panels.childNodes[i];
-                       tab.addEventListener(
-                               'command',
-                               function(p) {
-                                       return function() {
-                                               try {
-                                                               if (p
-                                                                       && p.firstChild 
-                                                                       && ( p.firstChild.nodeName == 'iframe' || p.firstChild.nodeName == 'browser' )
-                                                                       && p.firstChild.contentWindow 
-                                                               ) {
-                                                                       if (typeof p.firstChild.contentWindow.default_focus == 'function') {
-                                                                               p.firstChild.contentWindow.default_focus();
-                                                                       } else {
-                                                                               //p.firstChild.contentWindow.firstChild.focus();
-                                                                       }
-                                                               }
-                                               } catch(E) {
-                                                       obj.error.sdump('D_ERROR','init_tab_focus_handler: ' + js2JSON(E));
-                                               }
-                                       }
-                               }(panel),
-                               false
-                       );
-               }
-       },
-
-       'close_all_tabs' : function() {
-               var obj = this;
-               try {
-                       var count = obj.controller.view.tabs.childNodes.length;
-                       for (var i = 0; i < count; i++) obj.close_tab();
-                       setTimeout( function(){ obj.controller.view.tabs.firstChild.focus(); }, 0);
-               } catch(E) {
-                       obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.close_all_tabs.error'),E);
-               }
-       },
-
-       'close_tab' : function () {
-               var idx = this.controller.view.tabs.selectedIndex;
-               var tab = this.controller.view.tabs.childNodes[idx];
-               var panel = this.controller.view.panels.childNodes[ idx ];
-               while ( panel.lastChild ) panel.removeChild( panel.lastChild );
-               if (idx == 0) {
-                       try {
-                               this.controller.view.tabs.advanceSelectedTab(+1);
-                       } catch(E) {
-                               this.error.sdump('D_TAB','failed tabs.advanceSelectedTab(+1):'+js2JSON(E) + '\n');
-                               try {
-                                       this.controller.view.tabs.advanceSelectedTab(-1);
-                               } catch(E) {
-                                       this.error.sdump('D_TAB','failed again tabs.advanceSelectedTab(-1):'+
-                                               js2JSON(E) + '\n');
-                               }
-                       }
-               } else {
-                       try {
-                               this.controller.view.tabs.advanceSelectedTab(-1);
-                       } catch(E) {
-                               this.error.sdump('D_TAB','failed tabs.advanceSelectedTab(-1):'+js2JSON(E) + '\n');
-                               try {
-                                       this.controller.view.tabs.advanceSelectedTab(+1);
-                               } catch(E) {
-                                       this.error.sdump('D_TAB','failed again tabs.advanceSelectedTab(+1):'+
-                                               js2JSON(E) + '\n');
-                               }
-                       }
-
-               }
-               
-               this.error.sdump('D_TAB','\tnew tabbox.selectedIndex = ' + this.controller.view.tabbox.selectedIndex + '\n');
-
-               this.controller.view.tabs.childNodes[ idx ].hidden = true;
-               this.error.sdump('D_TAB','tabs.childNodes[ ' + idx + ' ].hidden = true;\n');
-
-               // Make sure we keep at least one tab open.
-               var tab_flag = true;
-               for (var i = 0; i < this.controller.view.tabs.childNodes.length; i++) {
-                       var tab = this.controller.view.tabs.childNodes[i];
-                       if (!tab.hidden)
-                               tab_flag = false;
-               }
-               if (tab_flag) {
-                       this.controller.view.tabs.selectedIndex = 0;
-                       this.new_tab(); 
-               }
-       },
-
-       'find_free_tab' : function() {
-               var last_not_hidden = -1;
-               for (var i = 0; i<this.controller.view.tabs.childNodes.length; i++) {
-                       var tab = this.controller.view.tabs.childNodes[i];
-                       if (!tab.hidden)
-                               last_not_hidden = i;
-               }
-               if (last_not_hidden == this.controller.view.tabs.childNodes.length - 1)
-                       last_not_hidden = -1;
-               // If the one next to last_not_hidden is hidden, we want it.
-               // Basically, we fill in tabs after existing tabs for as 
-               // long as possible.
-               var idx = last_not_hidden + 1;
-               var candidate = this.controller.view.tabs.childNodes[ idx ];
-               if (candidate.hidden)
-                       return idx;
-               // Alright, find the first hidden then
-               for (var i = 0; i<this.controller.view.tabs.childNodes.length; i++) {
-                       var tab = this.controller.view.tabs.childNodes[i];
-                       if (tab.hidden)
-                               return i;
-               }
-               return -1;
-       },
-
-       'new_tab' : function(url,params,content_params) {
-               var tc = this.find_free_tab();
-               if (tc == -1) { return null; } // 9 tabs max
-               var tab = this.controller.view.tabs.childNodes[ tc ];
-               tab.hidden = false;
-               if (!content_params) content_params = {};
-               if (!params) params = {};
-               if (!params.tab_name) params.tab_name = offlineStrings.getString('menu.new_tab.tab');
-               if (!params.nofocus) params.focus = true; /* make focus the default */
-               try {
-                       if (params.focus) this.controller.view.tabs.selectedIndex = tc;
-                       params.index = tc;
-                       this.set_tab(url,params,content_params);
-               } catch(E) {
-                       this.error.sdump('D_ERROR',E);
-               }
-       },
-
-       'set_tab' : function(url,params,content_params) {
-               var obj = this;
-               if (!url) url = '/xul/server/';
-               if (!url.match(/:\/\//) && !url.match(/^data:/)) url = urls.remote + url;
-               if (!params) params = {};
-               if (!content_params) content_params = {};
-               var idx = this.controller.view.tabs.selectedIndex;
-               if (params && typeof params.index != 'undefined') idx = params.index;
-               var tab = this.controller.view.tabs.childNodes[ idx ];
-               if (params.focus) tab.focus();
-               var panel = this.controller.view.panels.childNodes[ idx ];
-               while ( panel.lastChild ) panel.removeChild( panel.lastChild );
-
-               content_params.new_tab = function(a,b,c) { return obj.new_tab(a,b,c); };
-               content_params.set_tab = function(a,b,c) { return obj.set_tab(a,b,c); };
-               content_params.set_tab_name = function(name) { tab.setAttribute('label',(idx + 1) + ' ' + name); };
-               content_params.open_chrome_window = function(a,b,c) { return obj.window.open(a,b,c); };
-               content_params.url_prefix = function(url) { return obj.url_prefix(url); };
-               if (params && params.tab_name) content_params.set_tab_name( params.tab_name );
-               
-               var frame;
-               try {
-                       if (params && typeof params.browser != 'undefined') {
-                               obj.id_incr++;
-                               frame = this.w.document.createElement('browser');
-                               frame.setAttribute('flex','1');
-                               frame.setAttribute('type','content');
-                               frame.setAttribute('id','frame_'+obj.id_incr);
-                               panel.appendChild(frame);
-                               try {
-                                       dump('creating browser with src = ' + url + '\n');
-                                       JSAN.use('util.browser');
-                                       var b = new util.browser();
-                                       b.init(
-                                               {
-                                                       'url' : url,
-                                                       'push_xulG' : true,
-                                                       'alt_print' : false,
-                                                       'browser_id' : 'frame_'+obj.id_incr,
-                                                       'passthru_content_params' : content_params,
-                                               }
-                                       );
-                               } catch(E) {
-                                       alert(E);
-                               }
-                       } else {
-                               frame = this.w.document.createElement('iframe');
-                               frame.setAttribute('flex','1');
-                               panel.appendChild(frame);
-                               dump('creating iframe with src = ' + url + '\n');
-                               frame.setAttribute('src',url);
-                               try {
-                                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                                       var cw = frame.contentWindow;
-                                       if (typeof cw.wrappedJSObject != 'undefined') cw = cw.wrappedJSObject;
-                                       cw.IAMXUL = true;
-                                       cw.xulG = content_params;
-                               } catch(E) {
-                                       this.error.sdump('D_ERROR', 'main.menu: ' + E);
-                               }
-                       }
-               } catch(E) {
-                       this.error.sdump('D_ERROR', 'main.menu:2: ' + E);
-                       alert(offlineStrings.getString('menu.set_tab.error'));
-               }
-
-               return frame;
-       }
-
-}
-
-dump('exiting main/menu.js\n');
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul
deleted file mode 100644 (file)
index 98e6922..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0"?>
-<!-- Application: Evergreen Staff Client -->
-<!-- Screen: Main, Menu and Tab Navigation -->
-<!-- 
- vim:noet:sw=4:ts=4:
--->
-
-<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
-<!-- STYLESHEETS -->
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
-<!--
-<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/menu_frame.css" type="text/css"?>
--->
-
-<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
-<!-- LOCALIZATION -->
-<!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
-
-<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
-<!-- OVERLAYS -->
-<?xul-overlay href="chrome://open_ils_staff_client/content/main/menu_frame_overlay.xul"?>
-<?xul-overlay href="chrome://open_ils_staff_client/content/OpenILS/util_overlay_chrome.xul"?>
-<!--
-<?xul-overlay href="/xul/server/main/menu_frame_overlay.xul"?>
-<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
--->
-
-<window id="menu_frame_win"
-       onload="try { my_init(); } catch(E) { alert(E); }"
-       orient="vertical" width="800" height="500"
-       sizemode="maximized" persist="width height" title="&staff.main.menu.title;"
-       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
-       <!-- BEHAVIOR -->
-        <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
-        <scripts id="openils_util_scripts"/>
-
-       <script type="text/javascript" src="JSAN.js"/>
-       <script type="text/javascript" src="constants.js"/>
-       <script type="text/javascript" src="../OpenILS/util/fmall.js"/>
-       <script type="text/javascript">
-       <![CDATA[
-               function my_init() {
-                       try {
-                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                               if (typeof JSAN == 'undefined') { throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); }
-                               JSAN.errorLevel = "die"; // none, warn, or die
-                               /*
-                               JSAN.addRepository('/xul/server/');
-                               */
-                               JSAN.addRepository('..');
-                               JSAN.use('util.error'); g.error = new util.error();
-                               g.error.sdump('D_TRACE','my_init() for menu_frame.xul');
-
-                               g.cgi = new CGI();
-
-                               JSAN.use('main.menu'); g.menu = new main.menu();
-                               g.menu.init( { 
-                                       'server' : g.cgi.param('server'),
-                               } );
-
-                               JSAN.use('util.window'); g.window = new util.window();
-
-                               JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
-                               XML_HTTP_SERVER = g.data.server_unadorned;
-
-                               document.title = g.window.appshell_name_increment() + ': ' + g.data.list.au[0].usrname() + '@' + g.data.ws_name + '.' + g.data.server_unadorned;
-
-                       } catch(E) {
-                               var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["menu_frame.xul", E]);
-                               try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
-                               alert(err_msg);
-                       }
-               }
-       ]]>
-       </script>
-       <script src="chrome://venkman/content/venkman-overlay.js"/>
-
-       <messagecatalog id="offlineStrings" src="chrome://open_ils_staff_client/locale/offline.properties" />   
-
-       <commandset id="universal_cmds" />
-
-       <keyset id="menu_frame_keys" />
-
-       <popupset id="universal_popupset" />
-
-       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
-       <!-- CONTENT -->
-
-       <box id="menu_frame_main" class="my_overflow"/>
-
-</window>
-
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
deleted file mode 100644 (file)
index 427b39f..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE overlay SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
-<overlay id="menu_frame_menus" 
-       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-<script>dump('loading menu_frame_menus.xul\n');</script>
-
-<commandset id="universal_cmds">
-       <command id="cmd_forward"/>
-       <command id="cmd_back"/>
-       <command id="cmd_close_window" key="close-window-key" />
-       <command id="cmd_new_window" key="new-window-key" />
-       <command id="cmd_new_tab" key="new-tab-key" />
-       <command id="cmd_close_tab" key="close-tab-key" />
-       <command id="cmd_close_all_tabs" key="close-all-tabs-key" />
-       <command id="cmd_shutdown" />
-
-       <command id="cmd_edit_copy_buckets" />
-       <command id="cmd_edit_volume_buckets" />
-       <command id="cmd_edit_record_buckets" />
-       <command id="cmd_edit_user_buckets" />
-
-       <command id="cmd_cat_main" key="cat-main-key" />
-       <command id="cmd_create_marc" />
-       <command id="cmd_circ_checkout" key="circ-checkout-key" />
-       <command id="cmd_patron_search" key="patron-search-key" />
-       <command id="cmd_circ_checkin" key="circ-checkin-key" />
-       <command id="cmd_circ_hold_capture" key="circ-hold-capture-key" />
-       <command id="cmd_circ_hold_pull_list" />
-       <command id="cmd_browse_holds" />
-       <command id="cmd_browse_holds_shelf" />
-       <command id="cmd_in_house_use" key="circ-in-house-use" />
-       <command id="cmd_copy_status" key="copy-status-key" />
-       <command id="cmd_search_opac" key="search-opac-key" />
-       <command id="cmd_public_opac" />
-       <command id="cmd_search_tcn" />
-       <command id="cmd_search_bib_id" />
-       <command id="cmd_patron_register" key="patron-register-key" />
-       <command id="cmd_standalone" />
-       <command id="cmd_survey_wizard" />
-       <command id="cmd_stat_cat_edit" />
-       <command id="cmd_non_cat_type_edit" />
-       <command id="cmd_copy_location_edit" />
-       <command id="cmd_print_list_template_edit" />
-       <command id="cmd_z39_50_import" />
-       <command id="cmd_create_new_marc_book" />
-       <command id="cmd_replace_barcode" />
-       <command id="cmd_reprint" />
-       <command id="cmd_retrieve_last_patron" />
-       <command id="cmd_retrieve_last_record" />
-       <command id="cmd_verify_credentials" />
-
-       <command id="cmd_change_session" />
-       <command id="cmd_manage_offline_xacts" />
-       <command id="cmd_download_patrons" />
-       <command id="cmd_local_admin" />
-
-       <command id="cmd_extension_manager"/>
-       <command id="cmd_theme_manager"/>
-       <command id="cmd_about_config"/>
-
-       <command id="cmd_adv_user_edit" />
-       <command id="cmd_console" />
-       <command id="cmd_shell" />
-       <command id="cmd_xuleditor" />
-       <command id="cmd_fieldmapper" />
-       <command id="cmd_test_html" />
-       <command id="cmd_test_xul" />
-       <command id="cmd_clear_cache" />
-       <command id="cmd_restore_all_tabs" />
-
-       <command id="cmd_test" />
-       <command id="cmd_broken" disabled="true" />
-       <command id="cmd_open_vandelay" />
-       <command id="cmd_open_conify" />
-</commandset>
-
-
-<!-- Accelerator Keys (Accessor Keys are in DTD's) -->
-<keyset id="menu_frame_keys">
-       <key id="new-window-key" modifiers="accel" key="N" command="cmd_new_window"/>
-       <key id="new-tab-key" modifiers="accel" key="T" command="cmd_new_tab"/>
-       <key id="open-key" modifiers="accel" key="O" command=""/>
-       <key id="save-key" modifiers="accel" key="S" command=""/>
-       <key id="close-tab-key" modifiers="accel" key="W" command="cmd_close_tab"/>
-       <key id="close-all-tabs-key" modifiers="accel,shift" key="W" command="cmd_close_all_tabs"/>
-       <key id="close-window-key" modifiers="accel" key="Q" command="cmd_close_window"/>
-       <key id="circ-checkout-key" keycode="VK_F1" command="cmd_circ_checkout"/>
-       <key id="circ-checkin-key" keycode="VK_F2" command="cmd_circ_checkin"/>
-       <key id="reprint-receipt-key" keycode="VK_F9" command="cmd_reprint"/>
-       <key id="search-opac-key" keycode="VK_F3" command="cmd_search_opac"/>
-       <key id="search-tcn-key" keycode="VK_F3" modifiers="shift" command="cmd_search_tcn"/>
-       <key id="patron-search-key" keycode="VK_F4" command="cmd_patron_search"/>
-       <key id="copy-status-key" keycode="VK_F5" command="cmd_copy_status"/>
-       <key id="circ-in-house-use-key" keycode="VK_F6" command="cmd_in_house_use"/>
-       <key id="circ-hold-capture-key" keycode="VK_F2" modifiers="shift" command="cmd_circ_hold_capture"/>
-       <key id="patron-register-key" keycode="VK_F1" modifiers="shift" command="cmd_patron_register"/>
-       <key id="retrieve_last_patron_key" keycode="VK_F8" command="cmd_retrieve_last_patron"/>
-       <key id="retrieve_last_record_key" keycode="VK_F8" modifiers="shift" command="cmd_retrieve_last_record"/>
-</keyset>
-
-
-<!-- The File menu on the main menu -->
-<menu id="main.menu.file" label="&staff.main.menu.file.label;" accesskey="&staff.main.menu.file.accesskey;" >
-       <menupopup id="main.menu.file.popup">
-               <menuitem label="&staff.main.menu.file.new.label;" accesskey="&staff.main.menu.file.new.accesskey;" key="new-window-key" command="cmd_new_window"/>
-               <menuitem label="&staff.main.menu.file.new_tab.label;" accesskey="&staff.main.menu.file.new_tab.accesskey;" key="new-tab-key" command="cmd_new_tab"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.file.close_tab.label;" accesskey="&staff.main.menu.file.close_tab.accesskey;" oldaccesskey="&staff.main.menu.file.close_tab.key;" key="close-tab-key" command="cmd_close_tab"/>
-               <menuitem label="&staff.main.menu.tabs.close;" accesskey="&staff.main.menu.tabs.close.accesskey;" key="close-all-tabs-key" command="cmd_close_all_tabs"/>
-               <menuitem label="&staff.main.menu.file.close.label;" accesskey="&staff.main.menu.file.close.accesskey;" oldaccesskey="&staff.main.menu.file.close.key;" key="close-window-key" command="cmd_close_window"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.quit;" accesskey="&staff.main.menu.quit.accesskey;" command="cmd_shutdown"/>
-       </menupopup>
-</menu>
-
-<!-- The Edit menu on the main menu -->
-<menu id="main.menu.edit" label="&staff.main.menu.edit.label;" accesskey="&staff.main.menu.edit.accesskey;">
-       <menupopup id="main.menu.edit.popup">
-               <menuitem label="&staff.main.menu.edit.buckets.copies;" command="cmd_edit_copy_buckets" accesskey="&staff.main.menu.edit.buckets.copies.accesskey;"/>
-               <menuitem label="&staff.main.menu.edit.buckets.volumes;" command="cmd_edit_volume_buckets" accesskey="&staff.main.menu.edit.buckets.volumes.accesskey;"/>
-               <menuitem label="&staff.main.menu.edit.buckets.records;" command="cmd_edit_record_buckets" accesskey="&staff.main.menu.edit.buckets.records.accesskey;"/>
-               <menuitem label="&staff.main.menu.edit.buckets.users;" command="cmd_edit_user_buckets" accesskey="&staff.main.menu.edit.buckets.users.accesskey;"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.replace_barcode.label;" command="cmd_replace_barcode"/>
-       </menupopup>
-</menu>
-
-<!-- The Circulation menu on the main menu -->
-<menu id="main.menu.circ" label="&staff.main.menu.circ.label;" accesskey="&staff.main.menu.circ.accesskey;">
-       <menupopup id="main.menu.circ.popup">
-               <menuitem label="&staff.main.menu.circ.checkout.label;" accesskey="&staff.main.menu.circ.checkout.accesskey;" key="circ-checkout-key" command="cmd_circ_checkout"/>
-               <menuitem label="&staff.main.menu.circ.checkin.label;" accesskey="&staff.main.menu.circ.checkin.accesskey;" key="circ-checkin-key" command="cmd_circ_checkin"/>
-               <menuitem label="&staff.main.menu.circ.patron_registration.label;" accesskey="&staff.main.menu.circ.patron_registration.accesskey;" key="patron-register-key" command="cmd_patron_register"/>
-               <menuitem label="&staff.main.menu.circ.patron_retrieve.label;" accesskey="&staff.main.menu.circ.patron_retrieve.accesskey;" command="cmd_retrieve_last_patron" key="retrieve_last_patron_key"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.circ.hold_capture.label;" accesskey="&staff.main.menu.circ.hold_capture.accesskey;" key="circ-hold-capture-key" command="cmd_circ_hold_capture"/>
-               <menuitem label="&staff.main.menu.circ.hold_pull.label;" accesskey="&staff.main.menu.circ.hold_pull.accesskey;" command="cmd_circ_hold_pull_list"/>
-               <menuitem label="&staff.main.menu.circ.hold_browse.label;" command="cmd_browse_holds_shelf" accesskey="&staff.main.menu.circ.hold_browse.accesskey;"/>
-               <menuitem label="&staff.main.menu.circ.place_hold.label;" accesskey="&staff.main.menu.circ.place_hold.accesskey;" key="search-opac-key" command="cmd_search_opac"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.circ.barcode.show_item;" accesskey="&staff.main.menu.circ.barcode.show_item.accesskey;" key="copy-status-key" command="cmd_copy_status"/>
-               <menuitem label="&staff.main.menu.circ.barcode.retrieve_patron;" accesskey="&staff.main.menu.circ.barcode.retrieve_patron.accesskey;" key="circ-checkout-key" command="cmd_circ_checkout"/>
-               <menuitem label="&staff.main.menu.circ.verify_credentials;" accesskey="&staff.main.menu.circ.verify_credentials.accesskey;" command="cmd_verify_credentials"/>
-               <menuitem label="&staff.main.menu.replace_barcode.label;" command="cmd_replace_barcode"/>
-               <menuitem label="&staff.main.menu.circ.in_house.label;" accesskey="&staff.main.menu.circ.in_house.accesskey;" key="circ-in-house-use-key" command="cmd_in_house_use"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.circ.reprint.label;" accesskey="&staff.main.menu.circ.reprint.accesskey;" key="reprint-receipt-key" command="cmd_reprint"/>
-               <menuitem label="&staff.main.menu.circ.offline.label;" command="cmd_standalone" accesskey="&staff.main.menu.circ.offline.accesskey;"/>
-       </menupopup>
-</menu>
-
-<!-- The Cataloging menu on the main menu -->
-<menu id="main.menu.cat" label="&staff.main.menu.cat.label;" accesskey="&staff.main.menu.cat.accesskey;">
-       <menupopup id="main.menu.cat.popup">
-               <menuitem label="&staff.main.menu.cat.bib_search.label;" accesskey="&staff.main.menu.cat.bib_search.accesskey;" key="search-opac-key" command="cmd_search_opac"/>
-               <menuitem label="&staff.main.menu.cat.search_tcn.label;" accesskey="&staff.main.menu.cat.search_tcn.accesskey;" key="search-tcn-key" command="cmd_search_tcn" />
-               <menuitem label="&staff.main.menu.cat.search_bib_id.label;" accesskey="&staff.main.menu.cat.search_bib_id.accesskey;" key="search-bib-id-key" command="cmd_search_bib_id" />
-               <menuitem label="&staff.main.menu.cat.copy_status.label;" accesskey="&staff.main.menu.cat.copy_status.accesskey;" key="copy-status-key" command="cmd_copy_status"/>
-               <menuseparator />
-               <!--
-               <menuitem disabled="true" label="&staff.main.menu.cat.dedup.label;" accesskey="&staff.main.menu.cat.dedup.accesskey;" command="cmd_broken"/>
-               -->
-               <menuitem label="&staff.main.menu.cat.edit_copy_buckets.label;" command="cmd_edit_copy_buckets" accesskey="&staff.main.menu.cat.edit_copy_buckets.accesskey;"/>
-               <menuitem label="&staff.main.menu.cat.edit_volume_buckets.label;" command="cmd_edit_volume_buckets" accesskey="&staff.main.menu.cat.edit_volume_buckets.accesskey;"/>
-               <menuitem label="&staff.main.menu.cat.edit_record_buckets.label;" command="cmd_edit_record_buckets" accesskey="&staff.main.menu.cat.edit_record_buckets.accesskey;"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.cat.create_marc.label;" accesskey="&staff.main.menu.cat.create_marc.accesskey;" command="cmd_create_marc"/>
-               <menuitem label="&staff.main.menu.cat.z39_50_import.label;" accesskey="&staff.main.menu.cat.z39_50_import.accesskey;" command="cmd_z39_50_import"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.replace_barcode.label;" command="cmd_replace_barcode"/>
-               <menuitem label="&staff.main.menu.cat.retrieve_last_record.label;" accesskey="&staff.main.menu.cat.retrieve_last_record.accesskey;" command="cmd_retrieve_last_record" key="retrieve_last_record_key"/>
-               <menuitem label="&staff.main.menu.cat.vandelay.label;" command="cmd_open_vandelay"/>
-       </menupopup>
-</menu>
-
-<!-- The Search menu on the main menu -->
-<menu id="main.menu.search" label="&staff.main.menu.search.label;" accesskey="&staff.main.menu.search.accesskey;">
-       <menupopup id="main.menu.search.popup">
-               <menuitem label="&staff.main.menu.search.patrons.label;" accesskey="&staff.main.menu.search.patrons.accesskey;" key="patron-search-key" command="cmd_patron_search" />
-               <menuitem label="&staff.main.menu.search.catalog.label;" accesskey="&staff.main.menu.search.catalog.accesskey;" key="search-opac-key" command="cmd_search_opac" />
-               <menuitem label="&staff.main.menu.search.record.label;" accesskey="&staff.main.menu.search.record.accesskey;" key="search-tcn-key" command="cmd_search_tcn" />
-               <menuitem label="&staff.main.menu.search.record_via_id.label;" accesskey="&staff.main.menu.search.record_via_id.accesskey;" key="search-bib-id-key" command="cmd_search_bib_id" />
-               <menuitem label="&staff.main.menu.search.copies.label;" accesskey="&staff.main.menu.search.copies.accesskey;" key="copy-status-key" command="cmd_copy_status"/>
-               <menuitem label="&staff.main.menu.search.patrons_barcode.label;" accesskey="&staff.main.menu.search.patrons_barcode.accesskey;" key="circ-checkout-key" command="cmd_circ_checkout"/>
-       </menupopup>
-</menu>
-
-<!-- The Help menu on the main menu -->
-<menu id="main.menu.help" label="&staff.main.menu.help.label;" accesskey="&staff.main.menu.help.accesskey;">
-       <menupopup id="main.menu.help.popup">
-               <menuitem label="stub" />
-       </menupopup>
-</menu>
-
-<!-- The Help menu on the main menu -->
-<menu id="main.menu.admin" label="&staff.main.menu.admin.label;" accesskey="&staff.main.menu.admin.accesskey;" old_accesskey="&staff.main.menu.admin.key;">
-       <menupopup id="main.menu.admin.popup">
-               <menuitem id="oc_menuitem" label="&staff.main.menu.admin.change_session.label;" label_orig="&staff.main.menu.admin.change_session.label;" 
-                       accesskey="O" command="cmd_change_session"/>
-               <menuitem label="&staff.main.menu.admin.offline_xacts.label;" accesskey="&staff.main.menu.admin.offline_xacts.accesskey;" command="cmd_manage_offline_xacts"/>
-               <menuitem label="&staff.main.menu.admin.download_patrons.label;" accesskey="&staff.main.menu.admin.download_patrons.accesskey;" command="cmd_download_patrons"/>
-               <menuseparator />
-               <menuitem label="&staff.main.menu.admin.local_admin.label;" accesskey="&staff.main.menu.admin.local_admin.accesskey;" command="cmd_local_admin"/>
-               <menuitem label="&staff.server.admin.index.conify;" command="cmd_open_conify"/>
-               <menuitem label="&staff.main.menu.admin.user_edit.label;" accesskey="&staff.main.menu.admin.user_edit.accesskey;" command="cmd_adv_user_edit"/>
-               <menuitem label="&staff.main.menu.admin.template_edit.label;" accesskey="&staff.main.menu.admin.template_edit.accesskey;" command="cmd_print_list_template_edit"/>
-               <menuitem label="&staff.main.menu.admin.survey_wizard.label;" accesskey="&staff.main.menu.admin.survey_wizard.accesskey;" command="cmd_survey_wizard"/>
-               <menuseparator />
-               <menu id="main.menu.admin.sub" accesskey="&staff.main.menu.admin.developer.accesskey;" label="&staff.main.menu.admin.developer.label;">
-                       <menupopup id="main.menu.admin.sub.popup">
-                               <menuitem label="&staff.main.menu.admin.stat_cat_edit.label;" accesskey="&staff.main.menu.admin.stat_cat_edit.accesskey;" command="cmd_stat_cat_edit"/>
-                               <menuitem label="&staff.main.menu.admin.non_cat_type_edit.label;" accesskey="&staff.main.menu.admin.non_cat_type_edit.accesskey;" command="cmd_non_cat_type_edit"/>
-                               <menuitem label="&staff.main.menu.admin.copy_location_edit.label;" accesskey="&staff.main.menu.admin.copy_location_edit.accesskey;" command="cmd_copy_location_edit"/>
-                               <menuitem label="&staff.main.menu.admin.browse_holds.label;" command="cmd_browse_holds" accesskey="&staff.main.menu.admin.browse_holds.accesskey;"/>
-                               <menuseparator />
-                               <menuitem label="&staff.main.menu.admin.public_opac.label;" command="cmd_public_opac" accesskey="&staff.main.menu.admin.public_opac.accesskey;"/>
-                               <menuitem label="&staff.main.menu.admin.cmd_test.label;" old_accesskey="T" command="cmd_test"/>
-                               <menuitem label="&staff.main.menu.admin.xuleditor.label;" accesskey="&staff.main.menu.admin.xuleditor.accesskey;" command="cmd_xuleditor"/>
-                               <menuitem label="&staff.main.menu.admin.fieldmapper.label;" accesskey="&staff.main.menu.admin.fieldmapper.accesskey;" command="cmd_fieldmapper"/>
-                               <menuitem label="&staff.main.menu.admin.cmd_console.label;" accesskey="&staff.main.menu.admin.cmd_console.accesskey;" command="cmd_console"/>
-                               <menuitem label="&staff.main.menu.admin.cmd_shell.label;" accesskey="&staff.main.menu.admin.cmd_shell.accesskey;" command="cmd_shell"/>
-                               <menuitem label="server/main/test.html" accesskey="1" command="cmd_test_html"/>
-                               <menuitem label="server/main/test.xul" accesskey="2" command="cmd_test_xul"/>
-                               <menuitem label="&staff.main.menu.admin.clear_cache.label;" accesskey="&staff.main.menu.admin.clear_cache.accesskey;" command="cmd_clear_cache"/>
-                               <menuitem label="&staff.main.menu.admin.restore_all_tabs.label;" command="cmd_restore_all_tabs"/>
-                               <menuitem label="&staff.main.menu.admin.extension_manager.label;" command="cmd_extension_manager"/>
-                               <menuitem label="&staff.main.menu.admin.theme_manager.label;" command="cmd_theme_manager"/>
-                               <menuitem label="&staff.main.menu.admin.about_config.label;" command="cmd_about_config"/>
-                               <menuitem label="&staff.main.menu.admin.venkman.label;" oncommand="try{start_venkman();}catch(E){alert(E);}"/>
-                       </menupopup>
-               </menu>
-       </menupopup>
-</menu>
-
-
-</overlay>
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_overlay.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_overlay.xul
deleted file mode 100644 (file)
index 1d0ccb6..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE overlay SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
-<?xul-overlay href="chrome://open_ils_staff_client/content/main/menu_frame_menus.xul"?>
-<!--
-<?xul-overlay href="/xul/server/main/menu_frame_menus.xul"?>
--->
-<overlay id="menu_frame_overlay" 
-       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-<script>dump('loading menu_frame_overlay.xul\n');</script>
-
-<commandset id="universal_cmds" />
-<keyset id="menu_frame_keys" />
-
-<!-- The top level widget for the staff client -->
-<box id="menu_frame_main" flex="1" orient="vertical">
-       <toolbox id="main_toolbox"/>
-       <tabbox id="main_tabbox" flex="1" eventnode="window" handleCtrlTab="true">
-               <tabs id="main_tabs" closebutton="true">
-                       <tab id="tab_1" accesskey="&staff.chrome.menu_frame_overlay.tab1.accesskey;" label="&staff.chrome.menu_frame_overlay.tab1.label;" hidden="true" />
-                       <tab id="tab_2" accesskey="&staff.chrome.menu_frame_overlay.tab2.accesskey;" label="&staff.chrome.menu_frame_overlay.tab2.label;" hidden="true" />
-                       <tab id="tab_3" accesskey="&staff.chrome.menu_frame_overlay.tab3.accesskey;" label="&staff.chrome.menu_frame_overlay.tab3.label;" hidden="true" />
-                       <tab id="tab_4" accesskey="&staff.chrome.menu_frame_overlay.tab4.accesskey;" label="&staff.chrome.menu_frame_overlay.tab4.label;" hidden="true" />
-                       <tab id="tab_5" accesskey="&staff.chrome.menu_frame_overlay.tab5.accesskey;" label="&staff.chrome.menu_frame_overlay.tab5.label;" hidden="true" />
-                       <tab id="tab_6" accesskey="&staff.chrome.menu_frame_overlay.tab6.accesskey;" label="&staff.chrome.menu_frame_overlay.tab6.label;" hidden="true" />
-                       <tab id="tab_7" accesskey="&staff.chrome.menu_frame_overlay.tab7.accesskey;" label="&staff.chrome.menu_frame_overlay.tab7.label;" hidden="true" />
-                       <tab id="tab_8" accesskey="&staff.chrome.menu_frame_overlay.tab8.accesskey;" label="&staff.chrome.menu_frame_overlay.tab8.label;" hidden="true" />
-                       <tab id="tab_9" accesskey="&staff.chrome.menu_frame_overlay.tab9.accesskey;" label="&staff.chrome.menu_frame_overlay.tab9.label;" hidden="true" />
-               </tabs>
-               <tabpanels id="main_panels" flex="1">
-                       <tabpanel id="panel_1"><label value="panel_1"/></tabpanel>
-                       <tabpanel id="panel_2"><label value="panel_2"/></tabpanel>
-                       <tabpanel id="panel_3"><label value="panel_3"/></tabpanel>
-                       <tabpanel id="panel_4"><label value="panel_4"/></tabpanel>
-                       <tabpanel id="panel_5"><label value="panel_5"/></tabpanel>
-                       <tabpanel id="panel_6"><label value="panel_6"/></tabpanel>
-                       <tabpanel id="panel_7"><label value="panel_7"/></tabpanel>
-                       <tabpanel id="panel_8"><label value="panel_8"/></tabpanel>
-                       <tabpanel id="panel_9"><label value="panel_9"/></tabpanel>
-               </tabpanels>
-       </tabbox>
-       <toolbox id="entity_toolbox"/>
-</box>
-
-<!-- The main top level menubar -->
-<toolbox id="main_toolbox">
-       <menubar id="main_menubar">
-               <menu id="main.menu.file" />
-               <menu id="main.menu.edit" />
-               <menu id="main.menu.search" />
-               <menu id="main.menu.circ" />
-               <menu id="main.menu.cat" />
-               <spacer flex="1" />
-               <menu id="main.menu.admin" />
-               <menu id="main.menu.help" />
-       </menubar>
-</toolbox>
-
-</overlay>
diff --git a/Open-ILS/xul/staff_client/server/main/menu.js b/Open-ILS/xul/staff_client/server/main/menu.js
new file mode 100644 (file)
index 0000000..fc3a259
--- /dev/null
@@ -0,0 +1,949 @@
+dump('entering main/menu.js\n');
+// vim:noet:sw=4:ts=4:
+
+var offlineStrings;
+offlineStrings = document.getElementById('offlineStrings');
+
+if (typeof main == 'undefined') main = {};
+main.menu = function () {
+
+       JSAN.use('util.error'); this.error = new util.error();
+       JSAN.use('util.window'); this.window = new util.window();
+
+       this.w = window;
+}
+
+main.menu.prototype = {
+
+       'id_incr' : 0,
+
+       'url_prefix' : function(url) {
+               if (url.match(/^\//)) url = urls.remote + url;
+               if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url;
+               dump('url_prefix = ' + url + '\n');
+               return url;
+       },
+
+       'init' : function( params ) {
+
+               urls.remote = params['server'];
+
+               var obj = this;
+
+               JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+
+               var cmd_map = {
+                       'cmd_broken' : [
+                               ['oncommand'],
+                               function() { alert(offlineStrings.getString('common.unimplemented')); }
+                       ],
+
+                       /* File Menu */
+                       'cmd_close_window' : [ 
+                               ['oncommand'], 
+                               function() { window.close(); } 
+                       ],
+                       'cmd_new_window' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.window.open(
+                                               obj.url_prefix(urls.XUL_MENU_FRAME)
+                                               + '?server='+window.escape(urls.remote),
+                                               'main' + obj.window.window_name_increment(),
+                                               'chrome,resizable'); 
+                               }
+                       ],
+                       'cmd_new_tab' : [
+                               ['oncommand'],
+                               function() { obj.new_tab(null,{'focus':true},null); }
+                       ],
+                       'cmd_close_tab' : [
+                               ['oncommand'],
+                               function() { obj.close_tab(); }
+                       ],
+                       'cmd_close_all_tabs' : [
+                               ['oncommand'],
+                               function() { obj.close_all_tabs(); }
+                       ],
+
+                       /* Edit Menu */
+                       'cmd_edit_copy_buckets' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_COPY_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_copy_buckets.tab')},{});
+                               }
+                       ],
+                       'cmd_edit_volume_buckets' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_VOLUME_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_volume_buckets.tab')},{});
+                               }
+                       ],
+                       'cmd_edit_record_buckets' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_RECORD_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_record_buckets.tab')},{});
+                               }
+                       ],
+                       'cmd_edit_user_buckets' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_USER_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_user_buckets.tab')},{});
+                               }
+                       ],
+
+
+                       'cmd_replace_barcode' : [
+                               ['oncommand'],
+                               function() {
+                                       try {
+                                               JSAN.use('util.network');
+                                               var network = new util.network();
+
+                                               var old_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.label'));
+                                               if (!old_bc) return;
+       
+                                               var copy;
+                        try {
+                            copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ old_bc ]);
+                                               if (typeof copy.ilsevent != 'undefined') throw(copy); 
+                                               if (!copy) throw(copy);
+                        } catch(E) {
+                            alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.retrieval.error', [old_bc]) + '\n');
+                            return;
+                        }
+       
+                                               // Why did I want to do this twice?  Because this copy is more fleshed?
+                        try {
+                                               copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]);
+                                               if (typeof copy.ilsevent != 'undefined') throw(copy);
+                                               if (!copy) throw(copy);
+                        } catch(E) {
+                            try { alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.retrieval.error', [old_bc]) + '\n' + (typeof E.ilsevent == 'undefined' ? '' : E.textcode + ' : ' + E.desc)); } catch(F) { alert(E + '\n' + F); }
+                            return;
+                        }
+       
+                                               var new_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.replacement.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.replacement.label'));
+                                               new_bc = String( new_bc ).replace(/\s/g,'');
+                                               if (!new_bc) {
+                                                       alert(offlineStrings.getString('menu.cmd_replace_barcode.blank.error'));
+                                                       return;
+                                               }
+       
+                                               var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ new_bc ]);
+                                               if (typeof test.ilsevent == 'undefined') {
+                                               alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.duplicate.error', [new_bc]));
+                                                       return;
+                                               } else {
+                                                       if (test.ilsevent != 1502 /* ASSET_COPY_NOT_FOUND */) {
+                                                       obj.error.standard_unexpected_error_alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.testing.error', [new_bc]),test);
+                                                               return;
+                                                       }       
+                                               }
+
+                                               copy.barcode(new_bc); copy.ischanged('1');
+                                               var r = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), [ copy ] ]);
+                                               if (typeof r.ilsevent != 'undefined') { 
+                            if (r.ilsevent != 0) {
+                                if (r.ilsevent == 5000 /* PERM_FAILURE */) {
+                                    alert(offlineStrings.getString('menu.cmd_replace_barcode.permission.error'));
+                                } else {
+                                    obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.cmd_replace_barcode.renaming.error'),r);
+                                }
+                            }
+                        }
+                                       } catch(E) {
+                                               obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.cmd_replace_barcode.renaming.failure'),copy);
+                                       }
+                               }
+                       ],
+
+                       /* Search Menu */
+                       'cmd_patron_search' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_DISPLAY),{},{});
+                               }
+                       ],
+                       'cmd_search_opac' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       var content_params = { 'session' : ses(), 'authtime' : ses('authtime') };
+                                       obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {'tab_name':offlineStrings.getString('menu.cmd_search_opac.tab')}, content_params);
+                               }
+                       ],
+                       'cmd_search_tcn' : [
+                               ['oncommand'],
+                               function() {
+                                       var tcn = prompt(offlineStrings.getString('menu.cmd_search_tcn.tab'),'',offlineStrings.getString('menu.cmd_search_tcn.prompt'));
+
+                                       function spawn_tcn(r) {
+                                               for (var i = 0; i < r.count; i++) {
+                                                       var id = r.ids[i];
+                                                       var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + id;
+                                                       obj.data.stash_retrieve();
+                                                       var content_params = { 
+                                                               'session' : ses(), 
+                                                               'authtime' : ses('authtime'),
+                                                               'opac_url' : opac_url,
+                                                       };
+                                                       if (i == 0) {
+                                                               obj.set_tab(
+                                                                       obj.url_prefix(urls.XUL_OPAC_WRAPPER), 
+                                                                       {'tab_name':tcn}, 
+                                                                       content_params
+                                                               );
+                                                       } else {
+                                                               obj.new_tab(
+                                                                       obj.url_prefix(urls.XUL_OPAC_WRAPPER), 
+                                                                       {'tab_name':tcn}, 
+                                                                       content_params
+                                                               );
+                                                       }
+                                               }
+                                       }
+
+                                       if (tcn) {
+                                               JSAN.use('util.network');
+                                               var network = new util.network();
+                                               var robj = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn]);
+                                               if (robj.count != robj.ids.length) throw('FIXME -- FM_BRE_ID_SEARCH_VIA_TCN = ' + js2JSON(robj));
+                                               if (robj.count == 0) {
+                                                       var robj2 = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn,1]);
+                                                       if (robj2.count == 0) {
+                                                               alert(offlineStrings.getFormattedString('menu.cmd_search_tcn.not_found.error', [tcn]));
+                                                       } else {
+                                                               if ( window.confirm(offlineStrings.getFormattedString('menu.cmd_search_tcn.deleted.error', [tcn])) ) {
+                                                                       spawn_tcn(robj2);
+                                                               }
+                                                       }
+                                               } else {
+                                                       spawn_tcn(robj);
+                                               }
+                                       }
+                               }
+                       ],
+                       'cmd_search_bib_id' : [
+                               ['oncommand'],
+                               function() {
+                                       var bib_id = prompt(offlineStrings.getString('menu.cmd_search_bib_id.tab'),'',offlineStrings.getString('menu.cmd_search_bib_id.prompt'));
+                    if (!bib_id) return;
+
+                                       var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + bib_id;
+                                       var content_params = { 
+                                               'session' : ses(), 
+                                               'authtime' : ses('authtime'),
+                                               'opac_url' : opac_url,
+                                       };
+                                       obj.set_tab(
+                                               obj.url_prefix(urls.XUL_OPAC_WRAPPER), 
+                                               {'tab_name':'#' + bib_id}, 
+                                               content_params
+                                       );
+                               }
+                       ],
+                       'cmd_copy_status' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_COPY_STATUS),{},{});
+                               }
+                       ],
+
+                       /* Circulation Menu */
+                       'cmd_patron_register' : [
+                               ['oncommand'],
+                               function() {
+                                                               function spawn_editor(p) {
+                                                                       var url = urls.XUL_PATRON_EDIT;
+                                                                       var param_count = 0;
+                                                                       for (var i in p) {
+                                                                               if (param_count++ == 0) url += '?'; else url += '&';
+                                                                               url += i + '=' + window.escape(p[i]);
+                                                                       }
+                                                                       var loc = obj.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
+                                                                       obj.new_tab(
+                                                                               loc, 
+                                                                               {}, 
+                                                                               { 
+                                                                                       'show_print_button' : true , 
+                                                                                       'tab_name' : offline.getString('menu.cmd_patron_register.related.tab'),
+                                                                                       'passthru_content_params' : {
+                                                                                               'spawn_search' : function(s) { obj.spawn_search(s); },
+                                                                                               'spawn_editor' : spawn_editor,
+                                                                                       }
+                                                                               }
+                                                                       );
+                                                               }
+
+                                       obj.data.stash_retrieve();
+                                       var loc = obj.url_prefix( urls.XUL_REMOTE_BROWSER ) 
+                                               + '?url=' + window.escape( urls.XUL_PATRON_EDIT + '?ses=' + window.escape( ses() ) );
+                                       obj.set_tab(
+                                               loc, 
+                                               {}, 
+                                               { 
+                                                       'show_print_button' : true , 
+                                                       'tab_name' : offlineStrings.getString('menu.cmd_patron_register.tab'),
+                                                       'passthru_content_params' : {
+                                                               'spawn_search' : function(s) { obj.spawn_search(s); },
+                                                               'spawn_editor' : spawn_editor,
+                                                       }
+                                               }
+                                       );
+                               }
+                       ],
+                       'cmd_circ_checkin' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN),{},{});
+                               }
+                       ],
+                       'cmd_circ_checkout' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY),{},{});
+                               }
+                       ],
+                       'cmd_circ_hold_capture' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN)+'?hold_capture=1',{},{});
+                               }
+                       ],
+                       'cmd_browse_holds' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER),{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds.tab') },{});
+                               }
+                       ],
+                       'cmd_browse_holds_shelf' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER)+'?shelf=1',{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds_shelf.tab') },{});
+                               }
+                       ],
+                       'cmd_circ_hold_pull_list' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.data.stash_retrieve();
+                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
+                                               obj.url_prefix(urls.XUL_HOLD_PULL_LIST) + '?ses='+window.escape(ses())
+                                       );
+                                       obj.set_tab( loc, {'tab_name' : offlineStrings.getString('menu.cmd_browse_hold_pull_list.tab')}, { 'show_print_button' : true } );
+                               }
+                       ],
+
+                       'cmd_in_house_use' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_IN_HOUSE_USE),{},{});
+                               }
+                       ],
+
+                       'cmd_standalone' : [
+                               ['oncommand'],
+                               function() { 
+                                       obj.set_tab(obj.url_prefix(urls.XUL_STANDALONE),{},{});
+                               }
+                       ],
+
+                       'cmd_local_admin' : [
+                               ['oncommand'],
+                               function() { 
+                                       //obj.set_tab(obj.url_prefix(urls.XUL_LOCAL_ADMIN)+'?ses='+window.escape(ses())+'&session='+window.escape(ses()),{},{});
+                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
+                                               urls.XUL_LOCAL_ADMIN+'?ses='+window.escape(ses())+'&session='+window.escape(ses())
+                                       );
+                                       obj.set_tab( 
+                                               loc, 
+                                               {'tab_name' : offlineStrings.getString('menu.cmd_local_admin.tab'), 'browser' : true }, 
+                                               { 'no_xulG' : false, 'show_nav_buttons' : true, 'show_print_button' : true } 
+                                       );
+
+                               }
+                       ],
+
+                       'cmd_open_vandelay' : [
+                               ['oncommand'],
+                               function() { 
+                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + 
+                        window.escape(urls.VANDELAY+'?ses='+window.escape(ses()));
+                                       obj.set_tab( 
+                                               loc, 
+                                               {'tab_name' : offlineStrings.getString('menu.cmd_open_vandelay.tab'), 'browser' : true }, 
+                                               {'no_xulG' : false, 'show_print_button' : false } 
+                                       );
+
+                               }
+                       ],
+
+                       'cmd_open_conify' : [
+                               ['oncommand'],
+                               function() { 
+                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + 
+                        window.escape(urls.CONIFY+'?ses='+window.escape(ses()));
+                                       obj.set_tab( 
+                                               loc, 
+                                               {'tab_name' : offlineStrings.getString('menu.cmd_open_conify.tab'), 'browser' : true }, 
+                                               {'no_xulG' : false, 'show_print_button' : false } 
+                                       );
+
+                               }
+                       ],
+
+                       'cmd_reprint' : [
+                               ['oncommand'],
+                               function() {
+                                       try {
+                                               JSAN.use('util.print'); var print = new util.print();
+                                               print.reprint_last();
+                                       } catch(E) {
+                                               alert(E);
+                                       }
+                               }
+                       ],
+
+                       'cmd_retrieve_last_patron' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       if (!obj.data.last_patron) {
+                                               alert(offlineStrings.getString('menu.cmd_retrieve_last_patron.session.error'));
+                                               return;
+                                       }
+                                       var url = obj.url_prefix( urls.XUL_PATRON_DISPLAY ); // + '?id=' + window.escape( obj.data.last_patron ) );
+                                       obj.set_tab( url, {}, { 'id' : obj.data.last_patron } );
+                               }
+                       ],
+                       
+                       'cmd_retrieve_last_record' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       if (!obj.data.last_record) {
+                                               alert(offlineStrings.getString('menu.cmd_retrieve_last_record.session.error'));
+                                               return;
+                                       }
+                                       var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + obj.data.last_record;
+                                       var content_params = {
+                                               'session' : ses(),
+                                               'authtime' : ses('authtime'),
+                                               'opac_url' : opac_url,
+                                       };
+                                       obj.set_tab(
+                                               obj.url_prefix(urls.XUL_OPAC_WRAPPER),
+                                               {'tab_name' : offlineStrings.getString('menu.cmd_retrieve_last_record.status')},
+                                               content_params
+                                       );
+                               }
+                       ],
+
+            'cmd_verify_credentials' : [
+                ['oncommand'],
+                function() {
+                                       obj.set_tab(
+                                               obj.url_prefix(urls.XUL_VERIFY_CREDENTIALS),
+                                               { 'tab_name' : offlineStrings.getString('menu.cmd_verify_credentials.tabname') },
+                                               {}
+                                       );
+                }
+            ],
+
+                       /* Cataloging Menu */
+                       'cmd_z39_50_import' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_Z3950_IMPORT),{},{});
+                               }
+                       ],
+                       'cmd_create_marc' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_MARC_NEW),{},{});
+                               }
+                       ],
+
+                       /* Admin menu */
+                       'cmd_change_session' : [
+                               ['oncommand'],
+                               function() {
+                                       try {
+                                               obj.data.stash_retrieve();
+                                               JSAN.use('util.network'); var network = new util.network();
+                                               var x = document.getElementById('oc_menuitem');
+                                               var x_label = x.getAttribute('label_orig');
+                                               var temp_au = js2JSON( obj.data.list.au[0] );
+                                               var temp_ses = js2JSON( obj.data.session );
+                                               if (obj.data.list.au.length > 1) {
+                                                       obj.data.list.au = [ obj.data.list.au[1] ];
+                                                       obj.data.stash('list');
+                                                       network.reset_titlebars( obj.data );
+                                                       x.setAttribute('label', x_label );
+                                                       network.simple_request('AUTH_DELETE', [ obj.data.session.key ] );
+                                                       obj.data.session = obj.data.previous_session;
+                                                       obj.data.stash('session');
+                                           try {
+                                                               var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+                                                               var cookieUri = ios.newURI("http://" + obj.data.server_unadorned, null, null);
+                                                               var cookieUriSSL = ios.newURI("https://" + obj.data.server_unadorned, null, null);
+                                                               var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
+
+                                                               cookieSvc.setCookieString(cookieUri, null, "ses="+obj.data.session.key, null);
+                                                               cookieSvc.setCookieString(cookieUriSSL, null, "ses="+obj.data.session.key, null);
+
+                                           } catch(E) {
+                                                   alert(offlineStrings.getFormattedString(main.session_cookie.error, [E]));
+                                           }
+
+                                                       removeCSSClass(document.getElementById('main_tabbox'),'operator_change');
+                                               } else {
+                                                       if (network.get_new_session(offlineStrings.getString('menu.cmd_chg_session.label'),{'url_prefix':obj.url_prefix})) {
+                                                               obj.data.stash_retrieve();
+                                                               obj.data.list.au[1] = JSON2js( temp_au );
+                                                               obj.data.stash('list');
+                                                               obj.data.previous_session = JSON2js( temp_ses );
+                                                               obj.data.stash('previous_session');
+                                                               x.setAttribute('label', offlineStrings.getFormattedString('menu.cmd_chg_session.operator.label', [obj.data.list.au[1].usrname()]) );
+                                                               addCSSClass(document.getElementById('main_tabbox'),'operator_change');
+                                                       }
+                                               }
+                                       } catch(E) {
+                                               obj.error.standard_unexpected_error_alert('cmd_change_session',E);
+                                       }
+                               }
+                       ],
+                       'cmd_manage_offline_xacts' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab(obj.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS), {'tab_name' : offlineStrings.getString('menu.cmd_manage_offline_xacts.tab')}, {});
+                               }
+                       ],
+                       'cmd_download_patrons' : [
+                               ['oncommand'],
+                               function() {
+                                       try {
+                                               netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+                                               var x = new XMLHttpRequest();
+                                               var url = 'http://' + XML_HTTP_SERVER + '/standalone/list.txt';
+                                               x.open("GET",url,false);
+                                               x.send(null);
+                                               if (x.status == 200) {
+                                                       JSAN.use('util.file'); var file = new util.file('offline_patron_list');
+                                                       file.write_content('truncate',x.responseText);
+                                                       file.close();
+                                                       file = new util.file('offline_patron_list.date');
+                                                       file.write_content('truncate',new Date());
+                                                       file.close();
+                                                       alert(offlineStrings.getString('menu.cmd_download_patrons.complete.status'));
+                                               } else {
+                                                       alert(offlineStrings.getFormattedString('menu.cmd_download_patrons.error', [x.status, x.statusText]));
+                                               }
+                                       } catch(E) {
+                                               obj.error.standard_unexpected_error_alert('cmd_download_patrons',E);
+                                       }
+                               }
+                       ],
+                       'cmd_adv_user_edit' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY), {}, { 'perm_editor' : true });
+                               }
+                       ],
+                       'cmd_print_list_template_edit' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_PRINT_LIST_TEMPLATE_EDITOR), {}, {});
+                               }
+                       ],
+                       'cmd_stat_cat_edit' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_STAT_CAT_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_stat_cat_edit.tab')},{});
+                               }
+                       ],
+                       'cmd_non_cat_type_edit' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_NON_CAT_LABEL_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_non_cat_type_edit.tab')},{});
+                               }
+                       ],
+                       'cmd_copy_location_edit' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.XUL_COPY_LOCATION_EDIT) + '?ses='+window.escape(ses()),{'tab_name' : offlineStrings.getString('menu.cmd_copy_location_edit.tab')},{});
+                               }
+                       ],
+                       'cmd_test' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       var content_params = { 'session' : ses(), 'authtime' : ses('authtime') };
+                                       obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params);
+                               }
+                       ],
+                       'cmd_test_html' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.TEST_HTML) + '?ses='+window.escape(ses()),{ 'browser' : true },{});
+                               }
+                       ],
+                       'cmd_test_xul' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.set_tab(obj.url_prefix(urls.TEST_XUL) + '?ses='+window.escape(ses()),{ 'browser' : true },{});
+                               }
+                       ],
+                       'cmd_console' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_CONSOLE),{'tab_name' : offlineStrings.getString('menu.cmd_console.tab')},{});
+                               }
+                       ],
+                       'cmd_shell' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_SHELL),{'tab_name' : offlineStrings.getString('menu.cmd_shell.tab')},{});
+                               }
+                       ],
+                       'cmd_xuleditor' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_XULEDITOR),{'tab_name' : offlineStrings.getString('menu.cmd_xuleditor.tab')},{});
+                               }
+                       ],
+                       'cmd_fieldmapper' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_FIELDMAPPER),{'tab_name' : offlineStrings.getString('menu.cmd_fieldmapper.tab')},{});
+                               }
+                       ],
+                       'cmd_survey_wizard' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.data.stash_retrieve();
+                                       obj.window.open(obj.url_prefix(urls.XUL_SURVEY_WIZARD),'survey_wizard','chrome'); 
+                               }
+                       ],
+                       'cmd_public_opac' : [
+                               ['oncommand'],
+                               function() {
+                                       var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape(
+                                               urls.remote
+                                       );
+                                       obj.set_tab( 
+                                               loc, 
+                                               {'tab_name' : offlineStrings.getString('menu.cmd_public_opac.tab'), 'browser' : true}, 
+                                               { 'no_xulG' : true, 'show_nav_buttons' : true, 'show_print_button' : true } 
+                                       );
+                               }
+                       ],
+                       'cmd_clear_cache' : [
+                               ['oncommand'],
+                               function clear_the_cache() {
+                                       try {
+                                               var cacheClass          = Components.classes["@mozilla.org/network/cache-service;1"];
+                                               var cacheService        = cacheClass.getService(Components.interfaces.nsICacheService);
+                                               cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
+                                               cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
+                                       } catch(E) {
+                                               dump(E+'\n');alert(E);
+                                       }
+                               }
+                       ],
+                       'cmd_restore_all_tabs' : [
+                               ['oncommand'],
+                               function() {
+                                       var tabs = obj.controller.view.tabs;
+                                       for (var i = 0; i < tabs.childNodes.length; i++) {
+                                               tabs.childNodes[i].hidden = false;
+                                       }
+                               }
+                       ],
+                       'cmd_extension_manager' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=extensions',{'tab_name' : offlineStrings.getString('menu.cmd_extension_manager.tab')},{});
+                               }
+                       ],
+                       'cmd_theme_manager' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=themes',{'tab_name' : offlineStrings.getString('menu.cmd_theme_manager.tab')},{});
+                               }
+                       ],
+                       'cmd_about_config' : [
+                               ['oncommand'],
+                               function() {
+                                       obj.set_tab('chrome://global/content/config.xul',{'tab_name' : 'about:config'},{});
+                               }
+                       ],
+                       'cmd_shutdown' : [
+                               ['oncommand'],
+                               function() {
+                                       if (window.confirm(offlineStrings.getString('menu.cmd_shutdown.prompt'))) {
+                                               var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService();
+                                               var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
+                                               var enumerator = windowManagerInterface.getEnumerator(null);
+                                               var w; // close all other windows
+                                               while ( w = enumerator.getNext() ) {
+                                                       if (w != window) w.close();
+                                               }
+                                               window.close();
+                                       }
+                               }
+                       ],
+               };
+
+               JSAN.use('util.controller');
+               var cmd;
+               obj.controller = new util.controller();
+               obj.controller.init( { 'window_knows_me_by' : 'g.menu.controller', 'control_map' : cmd_map } );
+
+               obj.controller.view.tabbox = window.document.getElementById('main_tabbox');
+               obj.controller.view.tabs = obj.controller.view.tabbox.firstChild;
+               obj.controller.view.panels = obj.controller.view.tabbox.lastChild;
+
+               obj.new_tab(null,{'focus':true},null);
+
+               obj.init_tab_focus_handlers();
+       },
+
+       'spawn_search' : function(s) {
+               var obj = this;
+               obj.error.sdump('D_TRACE', offlineStrings.getFormattedString('menu.spawn_search.msg', [js2JSON(s)]) ); 
+               obj.data.stash_retrieve();
+               var loc = obj.url_prefix(urls.XUL_PATRON_DISPLAY);
+               loc += '?doit=1&query=' + window.escape(js2JSON(s));
+               obj.new_tab( loc, {}, {} );
+       },
+
+       'init_tab_focus_handlers' : function() {
+               var obj = this;
+               for (var i = 0; i < obj.controller.view.tabs.childNodes.length; i++) {
+                       var tab = obj.controller.view.tabs.childNodes[i];
+                       var panel = obj.controller.view.panels.childNodes[i];
+                       tab.addEventListener(
+                               'command',
+                               function(p) {
+                                       return function() {
+                                               try {
+                                                               if (p
+                                                                       && p.firstChild 
+                                                                       && ( p.firstChild.nodeName == 'iframe' || p.firstChild.nodeName == 'browser' )
+                                                                       && p.firstChild.contentWindow 
+                                                               ) {
+                                                                       if (typeof p.firstChild.contentWindow.default_focus == 'function') {
+                                                                               p.firstChild.contentWindow.default_focus();
+                                                                       } else {
+                                                                               //p.firstChild.contentWindow.firstChild.focus();
+                                                                       }
+                                                               }
+                                               } catch(E) {
+                                                       obj.error.sdump('D_ERROR','init_tab_focus_handler: ' + js2JSON(E));
+                                               }
+                                       }
+                               }(panel),
+                               false
+                       );
+               }
+       },
+
+       'close_all_tabs' : function() {
+               var obj = this;
+               try {
+                       var count = obj.controller.view.tabs.childNodes.length;
+                       for (var i = 0; i < count; i++) obj.close_tab();
+                       setTimeout( function(){ obj.controller.view.tabs.firstChild.focus(); }, 0);
+               } catch(E) {
+                       obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.close_all_tabs.error'),E);
+               }
+       },
+
+       'close_tab' : function () {
+               var idx = this.controller.view.tabs.selectedIndex;
+               var tab = this.controller.view.tabs.childNodes[idx];
+               var panel = this.controller.view.panels.childNodes[ idx ];
+               while ( panel.lastChild ) panel.removeChild( panel.lastChild );
+               if (idx == 0) {
+                       try {
+                               this.controller.view.tabs.advanceSelectedTab(+1);
+                       } catch(E) {
+                               this.error.sdump('D_TAB','failed tabs.advanceSelectedTab(+1):'+js2JSON(E) + '\n');
+                               try {
+                                       this.controller.view.tabs.advanceSelectedTab(-1);
+                               } catch(E) {
+                                       this.error.sdump('D_TAB','failed again tabs.advanceSelectedTab(-1):'+
+                                               js2JSON(E) + '\n');
+                               }
+                       }
+               } else {
+                       try {
+                               this.controller.view.tabs.advanceSelectedTab(-1);
+                       } catch(E) {
+                               this.error.sdump('D_TAB','failed tabs.advanceSelectedTab(-1):'+js2JSON(E) + '\n');
+                               try {
+                                       this.controller.view.tabs.advanceSelectedTab(+1);
+                               } catch(E) {
+                                       this.error.sdump('D_TAB','failed again tabs.advanceSelectedTab(+1):'+
+                                               js2JSON(E) + '\n');
+                               }
+                       }
+
+               }
+               
+               this.error.sdump('D_TAB','\tnew tabbox.selectedIndex = ' + this.controller.view.tabbox.selectedIndex + '\n');
+
+               this.controller.view.tabs.childNodes[ idx ].hidden = true;
+               this.error.sdump('D_TAB','tabs.childNodes[ ' + idx + ' ].hidden = true;\n');
+
+               // Make sure we keep at least one tab open.
+               var tab_flag = true;
+               for (var i = 0; i < this.controller.view.tabs.childNodes.length; i++) {
+                       var tab = this.controller.view.tabs.childNodes[i];
+                       if (!tab.hidden)
+                               tab_flag = false;
+               }
+               if (tab_flag) {
+                       this.controller.view.tabs.selectedIndex = 0;
+                       this.new_tab(); 
+               }
+       },
+
+       'find_free_tab' : function() {
+               var last_not_hidden = -1;
+               for (var i = 0; i<this.controller.view.tabs.childNodes.length; i++) {
+                       var tab = this.controller.view.tabs.childNodes[i];
+                       if (!tab.hidden)
+                               last_not_hidden = i;
+               }
+               if (last_not_hidden == this.controller.view.tabs.childNodes.length - 1)
+                       last_not_hidden = -1;
+               // If the one next to last_not_hidden is hidden, we want it.
+               // Basically, we fill in tabs after existing tabs for as 
+               // long as possible.
+               var idx = last_not_hidden + 1;
+               var candidate = this.controller.view.tabs.childNodes[ idx ];
+               if (candidate.hidden)
+                       return idx;
+               // Alright, find the first hidden then
+               for (var i = 0; i<this.controller.view.tabs.childNodes.length; i++) {
+                       var tab = this.controller.view.tabs.childNodes[i];
+                       if (tab.hidden)
+                               return i;
+               }
+               return -1;
+       },
+
+       'new_tab' : function(url,params,content_params) {
+               var tc = this.find_free_tab();
+               if (tc == -1) { return null; } // 9 tabs max
+               var tab = this.controller.view.tabs.childNodes[ tc ];
+               tab.hidden = false;
+               if (!content_params) content_params = {};
+               if (!params) params = {};
+               if (!params.tab_name) params.tab_name = offlineStrings.getString('menu.new_tab.tab');
+               if (!params.nofocus) params.focus = true; /* make focus the default */
+               try {
+                       if (params.focus) this.controller.view.tabs.selectedIndex = tc;
+                       params.index = tc;
+                       this.set_tab(url,params,content_params);
+               } catch(E) {
+                       this.error.sdump('D_ERROR',E);
+               }
+       },
+
+       'set_tab' : function(url,params,content_params) {
+               var obj = this;
+               if (!url) url = '/xul/server/';
+               if (!url.match(/:\/\//) && !url.match(/^data:/)) url = urls.remote + url;
+               if (!params) params = {};
+               if (!content_params) content_params = {};
+               var idx = this.controller.view.tabs.selectedIndex;
+               if (params && typeof params.index != 'undefined') idx = params.index;
+               var tab = this.controller.view.tabs.childNodes[ idx ];
+               if (params.focus) tab.focus();
+               var panel = this.controller.view.panels.childNodes[ idx ];
+               while ( panel.lastChild ) panel.removeChild( panel.lastChild );
+
+               content_params.new_tab = function(a,b,c) { return obj.new_tab(a,b,c); };
+               content_params.set_tab = function(a,b,c) { return obj.set_tab(a,b,c); };
+               content_params.set_tab_name = function(name) { tab.setAttribute('label',(idx + 1) + ' ' + name); };
+               content_params.open_chrome_window = function(a,b,c) { return obj.window.open(a,b,c); };
+               content_params.url_prefix = function(url) { return obj.url_prefix(url); };
+               if (params && params.tab_name) content_params.set_tab_name( params.tab_name );
+               
+               var frame;
+               try {
+                       if (params && typeof params.browser != 'undefined') {
+                               obj.id_incr++;
+                               frame = this.w.document.createElement('browser');
+                               frame.setAttribute('flex','1');
+                               frame.setAttribute('type','content');
+                               frame.setAttribute('id','frame_'+obj.id_incr);
+                               panel.appendChild(frame);
+                               try {
+                                       dump('creating browser with src = ' + url + '\n');
+                                       JSAN.use('util.browser');
+                                       var b = new util.browser();
+                                       b.init(
+                                               {
+                                                       'url' : url,
+                                                       'push_xulG' : true,
+                                                       'alt_print' : false,
+                                                       'browser_id' : 'frame_'+obj.id_incr,
+                                                       'passthru_content_params' : content_params,
+                                               }
+                                       );
+                               } catch(E) {
+                                       alert(E);
+                               }
+                       } else {
+                               frame = this.w.document.createElement('iframe');
+                               frame.setAttribute('flex','1');
+                               panel.appendChild(frame);
+                               dump('creating iframe with src = ' + url + '\n');
+                               frame.setAttribute('src',url);
+                               try {
+                                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                       var cw = frame.contentWindow;
+                                       if (typeof cw.wrappedJSObject != 'undefined') cw = cw.wrappedJSObject;
+                                       cw.IAMXUL = true;
+                                       cw.xulG = content_params;
+                               } catch(E) {
+                                       this.error.sdump('D_ERROR', 'main.menu: ' + E);
+                               }
+                       }
+               } catch(E) {
+                       this.error.sdump('D_ERROR', 'main.menu:2: ' + E);
+                       alert(offlineStrings.getString('menu.set_tab.error'));
+               }
+
+               return frame;
+       }
+
+}
+
+dump('exiting main/menu.js\n');
diff --git a/Open-ILS/xul/staff_client/server/main/menu_frame.xul b/Open-ILS/xul/staff_client/server/main/menu_frame.xul
new file mode 100644 (file)
index 0000000..98e6922
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Main, Menu and Tab Navigation -->
+<!-- 
+ vim:noet:sw=4:ts=4:
+-->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
+<!--
+<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/menu_frame.css" type="text/css"?>
+-->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="chrome://open_ils_staff_client/content/main/menu_frame_overlay.xul"?>
+<?xul-overlay href="chrome://open_ils_staff_client/content/OpenILS/util_overlay_chrome.xul"?>
+<!--
+<?xul-overlay href="/xul/server/main/menu_frame_overlay.xul"?>
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+-->
+
+<window id="menu_frame_win"
+       onload="try { my_init(); } catch(E) { alert(E); }"
+       orient="vertical" width="800" height="500"
+       sizemode="maximized" persist="width height" title="&staff.main.menu.title;"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- BEHAVIOR -->
+        <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
+        <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="JSAN.js"/>
+       <script type="text/javascript" src="constants.js"/>
+       <script type="text/javascript" src="../OpenILS/util/fmall.js"/>
+       <script type="text/javascript">
+       <![CDATA[
+               function my_init() {
+                       try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               if (typeof JSAN == 'undefined') { throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); }
+                               JSAN.errorLevel = "die"; // none, warn, or die
+                               /*
+                               JSAN.addRepository('/xul/server/');
+                               */
+                               JSAN.addRepository('..');
+                               JSAN.use('util.error'); g.error = new util.error();
+                               g.error.sdump('D_TRACE','my_init() for menu_frame.xul');
+
+                               g.cgi = new CGI();
+
+                               JSAN.use('main.menu'); g.menu = new main.menu();
+                               g.menu.init( { 
+                                       'server' : g.cgi.param('server'),
+                               } );
+
+                               JSAN.use('util.window'); g.window = new util.window();
+
+                               JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+                               XML_HTTP_SERVER = g.data.server_unadorned;
+
+                               document.title = g.window.appshell_name_increment() + ': ' + g.data.list.au[0].usrname() + '@' + g.data.ws_name + '.' + g.data.server_unadorned;
+
+                       } catch(E) {
+                               var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["menu_frame.xul", E]);
+                               try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+                               alert(err_msg);
+                       }
+               }
+       ]]>
+       </script>
+       <script src="chrome://venkman/content/venkman-overlay.js"/>
+
+       <messagecatalog id="offlineStrings" src="chrome://open_ils_staff_client/locale/offline.properties" />   
+
+       <commandset id="universal_cmds" />
+
+       <keyset id="menu_frame_keys" />
+
+       <popupset id="universal_popupset" />
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- CONTENT -->
+
+       <box id="menu_frame_main" class="my_overflow"/>
+
+</window>
+
diff --git a/Open-ILS/xul/staff_client/server/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/server/main/menu_frame_menus.xul
new file mode 100644 (file)
index 0000000..427b39f
--- /dev/null
@@ -0,0 +1,237 @@
+<?xml version="1.0"?>
+<!DOCTYPE overlay SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
+<overlay id="menu_frame_menus" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script>dump('loading menu_frame_menus.xul\n');</script>
+
+<commandset id="universal_cmds">
+       <command id="cmd_forward"/>
+       <command id="cmd_back"/>
+       <command id="cmd_close_window" key="close-window-key" />
+       <command id="cmd_new_window" key="new-window-key" />
+       <command id="cmd_new_tab" key="new-tab-key" />
+       <command id="cmd_close_tab" key="close-tab-key" />
+       <command id="cmd_close_all_tabs" key="close-all-tabs-key" />
+       <command id="cmd_shutdown" />
+
+       <command id="cmd_edit_copy_buckets" />
+       <command id="cmd_edit_volume_buckets" />
+       <command id="cmd_edit_record_buckets" />
+       <command id="cmd_edit_user_buckets" />
+
+       <command id="cmd_cat_main" key="cat-main-key" />
+       <command id="cmd_create_marc" />
+       <command id="cmd_circ_checkout" key="circ-checkout-key" />
+       <command id="cmd_patron_search" key="patron-search-key" />
+       <command id="cmd_circ_checkin" key="circ-checkin-key" />
+       <command id="cmd_circ_hold_capture" key="circ-hold-capture-key" />
+       <command id="cmd_circ_hold_pull_list" />
+       <command id="cmd_browse_holds" />
+       <command id="cmd_browse_holds_shelf" />
+       <command id="cmd_in_house_use" key="circ-in-house-use" />
+       <command id="cmd_copy_status" key="copy-status-key" />
+       <command id="cmd_search_opac" key="search-opac-key" />
+       <command id="cmd_public_opac" />
+       <command id="cmd_search_tcn" />
+       <command id="cmd_search_bib_id" />
+       <command id="cmd_patron_register" key="patron-register-key" />
+       <command id="cmd_standalone" />
+       <command id="cmd_survey_wizard" />
+       <command id="cmd_stat_cat_edit" />
+       <command id="cmd_non_cat_type_edit" />
+       <command id="cmd_copy_location_edit" />
+       <command id="cmd_print_list_template_edit" />
+       <command id="cmd_z39_50_import" />
+       <command id="cmd_create_new_marc_book" />
+       <command id="cmd_replace_barcode" />
+       <command id="cmd_reprint" />
+       <command id="cmd_retrieve_last_patron" />
+       <command id="cmd_retrieve_last_record" />
+       <command id="cmd_verify_credentials" />
+
+       <command id="cmd_change_session" />
+       <command id="cmd_manage_offline_xacts" />
+       <command id="cmd_download_patrons" />
+       <command id="cmd_local_admin" />
+
+       <command id="cmd_extension_manager"/>
+       <command id="cmd_theme_manager"/>
+       <command id="cmd_about_config"/>
+
+       <command id="cmd_adv_user_edit" />
+       <command id="cmd_console" />
+       <command id="cmd_shell" />
+       <command id="cmd_xuleditor" />
+       <command id="cmd_fieldmapper" />
+       <command id="cmd_test_html" />
+       <command id="cmd_test_xul" />
+       <command id="cmd_clear_cache" />
+       <command id="cmd_restore_all_tabs" />
+
+       <command id="cmd_test" />
+       <command id="cmd_broken" disabled="true" />
+       <command id="cmd_open_vandelay" />
+       <command id="cmd_open_conify" />
+</commandset>
+
+
+<!-- Accelerator Keys (Accessor Keys are in DTD's) -->
+<keyset id="menu_frame_keys">
+       <key id="new-window-key" modifiers="accel" key="N" command="cmd_new_window"/>
+       <key id="new-tab-key" modifiers="accel" key="T" command="cmd_new_tab"/>
+       <key id="open-key" modifiers="accel" key="O" command=""/>
+       <key id="save-key" modifiers="accel" key="S" command=""/>
+       <key id="close-tab-key" modifiers="accel" key="W" command="cmd_close_tab"/>
+       <key id="close-all-tabs-key" modifiers="accel,shift" key="W" command="cmd_close_all_tabs"/>
+       <key id="close-window-key" modifiers="accel" key="Q" command="cmd_close_window"/>
+       <key id="circ-checkout-key" keycode="VK_F1" command="cmd_circ_checkout"/>
+       <key id="circ-checkin-key" keycode="VK_F2" command="cmd_circ_checkin"/>
+       <key id="reprint-receipt-key" keycode="VK_F9" command="cmd_reprint"/>
+       <key id="search-opac-key" keycode="VK_F3" command="cmd_search_opac"/>
+       <key id="search-tcn-key" keycode="VK_F3" modifiers="shift" command="cmd_search_tcn"/>
+       <key id="patron-search-key" keycode="VK_F4" command="cmd_patron_search"/>
+       <key id="copy-status-key" keycode="VK_F5" command="cmd_copy_status"/>
+       <key id="circ-in-house-use-key" keycode="VK_F6" command="cmd_in_house_use"/>
+       <key id="circ-hold-capture-key" keycode="VK_F2" modifiers="shift" command="cmd_circ_hold_capture"/>
+       <key id="patron-register-key" keycode="VK_F1" modifiers="shift" command="cmd_patron_register"/>
+       <key id="retrieve_last_patron_key" keycode="VK_F8" command="cmd_retrieve_last_patron"/>
+       <key id="retrieve_last_record_key" keycode="VK_F8" modifiers="shift" command="cmd_retrieve_last_record"/>
+</keyset>
+
+
+<!-- The File menu on the main menu -->
+<menu id="main.menu.file" label="&staff.main.menu.file.label;" accesskey="&staff.main.menu.file.accesskey;" >
+       <menupopup id="main.menu.file.popup">
+               <menuitem label="&staff.main.menu.file.new.label;" accesskey="&staff.main.menu.file.new.accesskey;" key="new-window-key" command="cmd_new_window"/>
+               <menuitem label="&staff.main.menu.file.new_tab.label;" accesskey="&staff.main.menu.file.new_tab.accesskey;" key="new-tab-key" command="cmd_new_tab"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.file.close_tab.label;" accesskey="&staff.main.menu.file.close_tab.accesskey;" oldaccesskey="&staff.main.menu.file.close_tab.key;" key="close-tab-key" command="cmd_close_tab"/>
+               <menuitem label="&staff.main.menu.tabs.close;" accesskey="&staff.main.menu.tabs.close.accesskey;" key="close-all-tabs-key" command="cmd_close_all_tabs"/>
+               <menuitem label="&staff.main.menu.file.close.label;" accesskey="&staff.main.menu.file.close.accesskey;" oldaccesskey="&staff.main.menu.file.close.key;" key="close-window-key" command="cmd_close_window"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.quit;" accesskey="&staff.main.menu.quit.accesskey;" command="cmd_shutdown"/>
+       </menupopup>
+</menu>
+
+<!-- The Edit menu on the main menu -->
+<menu id="main.menu.edit" label="&staff.main.menu.edit.label;" accesskey="&staff.main.menu.edit.accesskey;">
+       <menupopup id="main.menu.edit.popup">
+               <menuitem label="&staff.main.menu.edit.buckets.copies;" command="cmd_edit_copy_buckets" accesskey="&staff.main.menu.edit.buckets.copies.accesskey;"/>
+               <menuitem label="&staff.main.menu.edit.buckets.volumes;" command="cmd_edit_volume_buckets" accesskey="&staff.main.menu.edit.buckets.volumes.accesskey;"/>
+               <menuitem label="&staff.main.menu.edit.buckets.records;" command="cmd_edit_record_buckets" accesskey="&staff.main.menu.edit.buckets.records.accesskey;"/>
+               <menuitem label="&staff.main.menu.edit.buckets.users;" command="cmd_edit_user_buckets" accesskey="&staff.main.menu.edit.buckets.users.accesskey;"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.replace_barcode.label;" command="cmd_replace_barcode"/>
+       </menupopup>
+</menu>
+
+<!-- The Circulation menu on the main menu -->
+<menu id="main.menu.circ" label="&staff.main.menu.circ.label;" accesskey="&staff.main.menu.circ.accesskey;">
+       <menupopup id="main.menu.circ.popup">
+               <menuitem label="&staff.main.menu.circ.checkout.label;" accesskey="&staff.main.menu.circ.checkout.accesskey;" key="circ-checkout-key" command="cmd_circ_checkout"/>
+               <menuitem label="&staff.main.menu.circ.checkin.label;" accesskey="&staff.main.menu.circ.checkin.accesskey;" key="circ-checkin-key" command="cmd_circ_checkin"/>
+               <menuitem label="&staff.main.menu.circ.patron_registration.label;" accesskey="&staff.main.menu.circ.patron_registration.accesskey;" key="patron-register-key" command="cmd_patron_register"/>
+               <menuitem label="&staff.main.menu.circ.patron_retrieve.label;" accesskey="&staff.main.menu.circ.patron_retrieve.accesskey;" command="cmd_retrieve_last_patron" key="retrieve_last_patron_key"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.circ.hold_capture.label;" accesskey="&staff.main.menu.circ.hold_capture.accesskey;" key="circ-hold-capture-key" command="cmd_circ_hold_capture"/>
+               <menuitem label="&staff.main.menu.circ.hold_pull.label;" accesskey="&staff.main.menu.circ.hold_pull.accesskey;" command="cmd_circ_hold_pull_list"/>
+               <menuitem label="&staff.main.menu.circ.hold_browse.label;" command="cmd_browse_holds_shelf" accesskey="&staff.main.menu.circ.hold_browse.accesskey;"/>
+               <menuitem label="&staff.main.menu.circ.place_hold.label;" accesskey="&staff.main.menu.circ.place_hold.accesskey;" key="search-opac-key" command="cmd_search_opac"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.circ.barcode.show_item;" accesskey="&staff.main.menu.circ.barcode.show_item.accesskey;" key="copy-status-key" command="cmd_copy_status"/>
+               <menuitem label="&staff.main.menu.circ.barcode.retrieve_patron;" accesskey="&staff.main.menu.circ.barcode.retrieve_patron.accesskey;" key="circ-checkout-key" command="cmd_circ_checkout"/>
+               <menuitem label="&staff.main.menu.circ.verify_credentials;" accesskey="&staff.main.menu.circ.verify_credentials.accesskey;" command="cmd_verify_credentials"/>
+               <menuitem label="&staff.main.menu.replace_barcode.label;" command="cmd_replace_barcode"/>
+               <menuitem label="&staff.main.menu.circ.in_house.label;" accesskey="&staff.main.menu.circ.in_house.accesskey;" key="circ-in-house-use-key" command="cmd_in_house_use"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.circ.reprint.label;" accesskey="&staff.main.menu.circ.reprint.accesskey;" key="reprint-receipt-key" command="cmd_reprint"/>
+               <menuitem label="&staff.main.menu.circ.offline.label;" command="cmd_standalone" accesskey="&staff.main.menu.circ.offline.accesskey;"/>
+       </menupopup>
+</menu>
+
+<!-- The Cataloging menu on the main menu -->
+<menu id="main.menu.cat" label="&staff.main.menu.cat.label;" accesskey="&staff.main.menu.cat.accesskey;">
+       <menupopup id="main.menu.cat.popup">
+               <menuitem label="&staff.main.menu.cat.bib_search.label;" accesskey="&staff.main.menu.cat.bib_search.accesskey;" key="search-opac-key" command="cmd_search_opac"/>
+               <menuitem label="&staff.main.menu.cat.search_tcn.label;" accesskey="&staff.main.menu.cat.search_tcn.accesskey;" key="search-tcn-key" command="cmd_search_tcn" />
+               <menuitem label="&staff.main.menu.cat.search_bib_id.label;" accesskey="&staff.main.menu.cat.search_bib_id.accesskey;" key="search-bib-id-key" command="cmd_search_bib_id" />
+               <menuitem label="&staff.main.menu.cat.copy_status.label;" accesskey="&staff.main.menu.cat.copy_status.accesskey;" key="copy-status-key" command="cmd_copy_status"/>
+               <menuseparator />
+               <!--
+               <menuitem disabled="true" label="&staff.main.menu.cat.dedup.label;" accesskey="&staff.main.menu.cat.dedup.accesskey;" command="cmd_broken"/>
+               -->
+               <menuitem label="&staff.main.menu.cat.edit_copy_buckets.label;" command="cmd_edit_copy_buckets" accesskey="&staff.main.menu.cat.edit_copy_buckets.accesskey;"/>
+               <menuitem label="&staff.main.menu.cat.edit_volume_buckets.label;" command="cmd_edit_volume_buckets" accesskey="&staff.main.menu.cat.edit_volume_buckets.accesskey;"/>
+               <menuitem label="&staff.main.menu.cat.edit_record_buckets.label;" command="cmd_edit_record_buckets" accesskey="&staff.main.menu.cat.edit_record_buckets.accesskey;"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.cat.create_marc.label;" accesskey="&staff.main.menu.cat.create_marc.accesskey;" command="cmd_create_marc"/>
+               <menuitem label="&staff.main.menu.cat.z39_50_import.label;" accesskey="&staff.main.menu.cat.z39_50_import.accesskey;" command="cmd_z39_50_import"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.replace_barcode.label;" command="cmd_replace_barcode"/>
+               <menuitem label="&staff.main.menu.cat.retrieve_last_record.label;" accesskey="&staff.main.menu.cat.retrieve_last_record.accesskey;" command="cmd_retrieve_last_record" key="retrieve_last_record_key"/>
+               <menuitem label="&staff.main.menu.cat.vandelay.label;" command="cmd_open_vandelay"/>
+       </menupopup>
+</menu>
+
+<!-- The Search menu on the main menu -->
+<menu id="main.menu.search" label="&staff.main.menu.search.label;" accesskey="&staff.main.menu.search.accesskey;">
+       <menupopup id="main.menu.search.popup">
+               <menuitem label="&staff.main.menu.search.patrons.label;" accesskey="&staff.main.menu.search.patrons.accesskey;" key="patron-search-key" command="cmd_patron_search" />
+               <menuitem label="&staff.main.menu.search.catalog.label;" accesskey="&staff.main.menu.search.catalog.accesskey;" key="search-opac-key" command="cmd_search_opac" />
+               <menuitem label="&staff.main.menu.search.record.label;" accesskey="&staff.main.menu.search.record.accesskey;" key="search-tcn-key" command="cmd_search_tcn" />
+               <menuitem label="&staff.main.menu.search.record_via_id.label;" accesskey="&staff.main.menu.search.record_via_id.accesskey;" key="search-bib-id-key" command="cmd_search_bib_id" />
+               <menuitem label="&staff.main.menu.search.copies.label;" accesskey="&staff.main.menu.search.copies.accesskey;" key="copy-status-key" command="cmd_copy_status"/>
+               <menuitem label="&staff.main.menu.search.patrons_barcode.label;" accesskey="&staff.main.menu.search.patrons_barcode.accesskey;" key="circ-checkout-key" command="cmd_circ_checkout"/>
+       </menupopup>
+</menu>
+
+<!-- The Help menu on the main menu -->
+<menu id="main.menu.help" label="&staff.main.menu.help.label;" accesskey="&staff.main.menu.help.accesskey;">
+       <menupopup id="main.menu.help.popup">
+               <menuitem label="stub" />
+       </menupopup>
+</menu>
+
+<!-- The Help menu on the main menu -->
+<menu id="main.menu.admin" label="&staff.main.menu.admin.label;" accesskey="&staff.main.menu.admin.accesskey;" old_accesskey="&staff.main.menu.admin.key;">
+       <menupopup id="main.menu.admin.popup">
+               <menuitem id="oc_menuitem" label="&staff.main.menu.admin.change_session.label;" label_orig="&staff.main.menu.admin.change_session.label;" 
+                       accesskey="O" command="cmd_change_session"/>
+               <menuitem label="&staff.main.menu.admin.offline_xacts.label;" accesskey="&staff.main.menu.admin.offline_xacts.accesskey;" command="cmd_manage_offline_xacts"/>
+               <menuitem label="&staff.main.menu.admin.download_patrons.label;" accesskey="&staff.main.menu.admin.download_patrons.accesskey;" command="cmd_download_patrons"/>
+               <menuseparator />
+               <menuitem label="&staff.main.menu.admin.local_admin.label;" accesskey="&staff.main.menu.admin.local_admin.accesskey;" command="cmd_local_admin"/>
+               <menuitem label="&staff.server.admin.index.conify;" command="cmd_open_conify"/>
+               <menuitem label="&staff.main.menu.admin.user_edit.label;" accesskey="&staff.main.menu.admin.user_edit.accesskey;" command="cmd_adv_user_edit"/>
+               <menuitem label="&staff.main.menu.admin.template_edit.label;" accesskey="&staff.main.menu.admin.template_edit.accesskey;" command="cmd_print_list_template_edit"/>
+               <menuitem label="&staff.main.menu.admin.survey_wizard.label;" accesskey="&staff.main.menu.admin.survey_wizard.accesskey;" command="cmd_survey_wizard"/>
+               <menuseparator />
+               <menu id="main.menu.admin.sub" accesskey="&staff.main.menu.admin.developer.accesskey;" label="&staff.main.menu.admin.developer.label;">
+                       <menupopup id="main.menu.admin.sub.popup">
+                               <menuitem label="&staff.main.menu.admin.stat_cat_edit.label;" accesskey="&staff.main.menu.admin.stat_cat_edit.accesskey;" command="cmd_stat_cat_edit"/>
+                               <menuitem label="&staff.main.menu.admin.non_cat_type_edit.label;" accesskey="&staff.main.menu.admin.non_cat_type_edit.accesskey;" command="cmd_non_cat_type_edit"/>
+                               <menuitem label="&staff.main.menu.admin.copy_location_edit.label;" accesskey="&staff.main.menu.admin.copy_location_edit.accesskey;" command="cmd_copy_location_edit"/>
+                               <menuitem label="&staff.main.menu.admin.browse_holds.label;" command="cmd_browse_holds" accesskey="&staff.main.menu.admin.browse_holds.accesskey;"/>
+                               <menuseparator />
+                               <menuitem label="&staff.main.menu.admin.public_opac.label;" command="cmd_public_opac" accesskey="&staff.main.menu.admin.public_opac.accesskey;"/>
+                               <menuitem label="&staff.main.menu.admin.cmd_test.label;" old_accesskey="T" command="cmd_test"/>
+                               <menuitem label="&staff.main.menu.admin.xuleditor.label;" accesskey="&staff.main.menu.admin.xuleditor.accesskey;" command="cmd_xuleditor"/>
+                               <menuitem label="&staff.main.menu.admin.fieldmapper.label;" accesskey="&staff.main.menu.admin.fieldmapper.accesskey;" command="cmd_fieldmapper"/>
+                               <menuitem label="&staff.main.menu.admin.cmd_console.label;" accesskey="&staff.main.menu.admin.cmd_console.accesskey;" command="cmd_console"/>
+                               <menuitem label="&staff.main.menu.admin.cmd_shell.label;" accesskey="&staff.main.menu.admin.cmd_shell.accesskey;" command="cmd_shell"/>
+                               <menuitem label="server/main/test.html" accesskey="1" command="cmd_test_html"/>
+                               <menuitem label="server/main/test.xul" accesskey="2" command="cmd_test_xul"/>
+                               <menuitem label="&staff.main.menu.admin.clear_cache.label;" accesskey="&staff.main.menu.admin.clear_cache.accesskey;" command="cmd_clear_cache"/>
+                               <menuitem label="&staff.main.menu.admin.restore_all_tabs.label;" command="cmd_restore_all_tabs"/>
+                               <menuitem label="&staff.main.menu.admin.extension_manager.label;" command="cmd_extension_manager"/>
+                               <menuitem label="&staff.main.menu.admin.theme_manager.label;" command="cmd_theme_manager"/>
+                               <menuitem label="&staff.main.menu.admin.about_config.label;" command="cmd_about_config"/>
+                               <menuitem label="&staff.main.menu.admin.venkman.label;" oncommand="try{start_venkman();}catch(E){alert(E);}"/>
+                       </menupopup>
+               </menu>
+       </menupopup>
+</menu>
+
+
+</overlay>
diff --git a/Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul b/Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul
new file mode 100644 (file)
index 0000000..1d0ccb6
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!DOCTYPE overlay SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
+<?xul-overlay href="chrome://open_ils_staff_client/content/main/menu_frame_menus.xul"?>
+<!--
+<?xul-overlay href="/xul/server/main/menu_frame_menus.xul"?>
+-->
+<overlay id="menu_frame_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script>dump('loading menu_frame_overlay.xul\n');</script>
+
+<commandset id="universal_cmds" />
+<keyset id="menu_frame_keys" />
+
+<!-- The top level widget for the staff client -->
+<box id="menu_frame_main" flex="1" orient="vertical">
+       <toolbox id="main_toolbox"/>
+       <tabbox id="main_tabbox" flex="1" eventnode="window" handleCtrlTab="true">
+               <tabs id="main_tabs" closebutton="true">
+                       <tab id="tab_1" accesskey="&staff.chrome.menu_frame_overlay.tab1.accesskey;" label="&staff.chrome.menu_frame_overlay.tab1.label;" hidden="true" />
+                       <tab id="tab_2" accesskey="&staff.chrome.menu_frame_overlay.tab2.accesskey;" label="&staff.chrome.menu_frame_overlay.tab2.label;" hidden="true" />
+                       <tab id="tab_3" accesskey="&staff.chrome.menu_frame_overlay.tab3.accesskey;" label="&staff.chrome.menu_frame_overlay.tab3.label;" hidden="true" />
+                       <tab id="tab_4" accesskey="&staff.chrome.menu_frame_overlay.tab4.accesskey;" label="&staff.chrome.menu_frame_overlay.tab4.label;" hidden="true" />
+                       <tab id="tab_5" accesskey="&staff.chrome.menu_frame_overlay.tab5.accesskey;" label="&staff.chrome.menu_frame_overlay.tab5.label;" hidden="true" />
+                       <tab id="tab_6" accesskey="&staff.chrome.menu_frame_overlay.tab6.accesskey;" label="&staff.chrome.menu_frame_overlay.tab6.label;" hidden="true" />
+                       <tab id="tab_7" accesskey="&staff.chrome.menu_frame_overlay.tab7.accesskey;" label="&staff.chrome.menu_frame_overlay.tab7.label;" hidden="true" />
+                       <tab id="tab_8" accesskey="&staff.chrome.menu_frame_overlay.tab8.accesskey;" label="&staff.chrome.menu_frame_overlay.tab8.label;" hidden="true" />
+                       <tab id="tab_9" accesskey="&staff.chrome.menu_frame_overlay.tab9.accesskey;" label="&staff.chrome.menu_frame_overlay.tab9.label;" hidden="true" />
+               </tabs>
+               <tabpanels id="main_panels" flex="1">
+                       <tabpanel id="panel_1"><label value="panel_1"/></tabpanel>
+                       <tabpanel id="panel_2"><label value="panel_2"/></tabpanel>
+                       <tabpanel id="panel_3"><label value="panel_3"/></tabpanel>
+                       <tabpanel id="panel_4"><label value="panel_4"/></tabpanel>
+                       <tabpanel id="panel_5"><label value="panel_5"/></tabpanel>
+                       <tabpanel id="panel_6"><label value="panel_6"/></tabpanel>
+                       <tabpanel id="panel_7"><label value="panel_7"/></tabpanel>
+                       <tabpanel id="panel_8"><label value="panel_8"/></tabpanel>
+                       <tabpanel id="panel_9"><label value="panel_9"/></tabpanel>
+               </tabpanels>
+       </tabbox>
+       <toolbox id="entity_toolbox"/>
+</box>
+
+<!-- The main top level menubar -->
+<toolbox id="main_toolbox">
+       <menubar id="main_menubar">
+               <menu id="main.menu.file" />
+               <menu id="main.menu.edit" />
+               <menu id="main.menu.search" />
+               <menu id="main.menu.circ" />
+               <menu id="main.menu.cat" />
+               <spacer flex="1" />
+               <menu id="main.menu.admin" />
+               <menu id="main.menu.help" />
+       </menubar>
+</toolbox>
+
+</overlay>