CAT-188 Catalog Browser compatability WIP SQUASH
authorKyle Huckins <khuckins@catalyte.io>
Wed, 11 Jul 2018 20:19:37 +0000 (20:19 +0000)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
12 files changed:
KCLS/openils/var/templates_kcls/conify/global/config/search_templates.tt2
KCLS/openils/var/templates_kcls/opac/browse_results.tt2
KCLS/openils/var/templates_kcls/opac/parts/js.tt2
KCLS/openils/var/templates_kcls/opac/parts/result/table.tt2
Open-ILS/web/js/ui/default/opac/staff.js
Open-ILS/web/js/ui/kcls/conify/global/config/search_templates.js
Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
Open-ILS/xul/staff_client/chrome/content/cat/opac.js
Open-ILS/xul/staff_client/chrome/content/util/error.js
Open-ILS/xul/staff_client/chrome/content/util/network.js
Open-ILS/xul/staff_client/chrome/content/util/sound.js

index a04847c..3a1c9d8 100644 (file)
     }
 
     //get g.data cache
-    getSearchStash();
+    [% IF ctx.is_staff %]
+        [% IF ctx.is_browser_staff %]
+            getSearchStash();
+        [% ELSE %]
+            getXULSearchStash();
+        [% END %]
+    [% END %]
+
     populateTemplateOptions(templateList);
 
     if (template)
index 026b530..47e7d7f 100644 (file)
         #
     %]
     function new_tab( element ) {
+        [% IF ctx.is_browser_staff %]
+            // For now open browse title results in the same tab.
+            location.href = element.getAttribute( 'url' );
+        [% ELSE %]
         var tabName = element.getAttribute( 'tabname' );
         var url = "oils://remote" + element.getAttribute( 'url' );
         var content_params = { 
@@ -54,9 +58,9 @@
         if ( success ) {
             element.removeAttribute( "href" );
         }
+        [% END %] // XUL staff
     }     
 </script>
-
 [% END %]
 
 
index 583a332..3a305aa 100644 (file)
@@ -3,6 +3,8 @@
 
 [%- IF ctx.is_staff %]
 <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/staff.js"></script>
+
+[%- IF NOT ctx.is_browser_staff %]
 <script type="text/javascript" src="/xul/server/OpenILS/global_util.js"></script>
 <script type="text/javascript" src="/xul/server/main/constants.js"></script>
 <script type="text/javascript" src="/xul/server/main/JSAN.js"></script>
@@ -12,7 +14,9 @@ try {
     var data = {};
     var error = {};
 
-    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+    if (window.netscape && window.netscape.security.PrivilegeManager.enablePrivilege) {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+    }
 
     if (typeof JSAN == 'undefined') { 
         throw( document.getElementById("commonStrings").getString('common.jsan.missing') ); 
@@ -35,6 +39,7 @@ try {
 }
 
 </script>
+[% END %]
     [% IF ctx.page == 'record' %]
         [% IF ctx.search_result_index >= 0 %]
         <script>
index f043f47..044f6cb 100644 (file)
      */
     function new_tab( element ) {
         var tabName = element.getAttribute( 'tabname' );
-        var url = "oils://remote" + element.getAttribute( 'url' );
-        var content_params = { 
-            'override_tab_lock' : true, 
-            'no_xulG' : false, 
-            'opac_url' : xulG.url_prefix( url ) 
-        };
-        element.setAttribute( 'href', url );
-        var success = xulG.new_tab( 
-            xulG.url_prefix( 'chrome://open_ils_staff_client/content/cat/opac.xul' ), 
-            {}, 
-            content_params
-        );  
-        if ( success ) {
-            element.removeAttribute( "href" );
-        }
+        [% IF ctx.is_staff %]
+            [% IF ctx.is_browser_staff %]
+            var href = "oils://remote" + element.getAttribute( 'href' );
+            var content_params = { 
+                'override_tab_lock' : true, 
+                'no_xulG' : true
+            };
+            [% ELSE %]
+            var url = "oils://remote" + element.getAttribute('url');
+            var content_params = {
+                'override_tab_lock': true,
+                'no_xulG': false,
+                'opac_url': xulG.url_prefix(url)
+            };
+            element.setAttribute('href', url);
+            var success = xulG.new_tab(
+                xulG.url_prefix('chrome://open_ils_staff_client/content/cat/opac.xul'),
+                {},
+                content_params
+            );
+            if (success) {
+                element.removeAttribute("href");
+            }
+            [% END %]
+        [% END %]
     }     
 </script>
 [% END %]
@@ -84,7 +94,7 @@
                                                 [% IF ctx.is_staff %] 
                                                 <a name='record_[% rec.id %]' style="cursor:pointer;" 
                                                     title="[% attrs.title_extended | uri %]" 
-                                                    url = "[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
+                                                    href = "[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
                                                     tabname = "[% rec.id %]" 
                                                     recId = "[% rec.id %]" 
                                                     onclick = "new_tab( this )" 
index cfab8ac..fd921be 100644 (file)
@@ -213,12 +213,10 @@ window.onload = function() {
 function rdetail_next_prev_actions(index, count, prev, next, start, end, results) {
     /*  we mostly get the relative URL from the template:  recid?query_args...
         replace the recid and args on location.href to get the new URL  */
-    function fullurl(url) {
+        function fullurl(url) {
         if (url.match(/eg\/opac\/results/)) {
             return location.href.replace(/\/eg\/opac\/.+$/, url);
-        } else if (url.match(/eg\/opac\/browse_items/)) {
-            return location.href.replace(/\/eg\/opac\/.+$/, url);
-        }else {
+        } else {
             return location.href.replace(/\/\d+\??.*/, '/' + url);
         }
     }
index c6f6ca9..f4a0e09 100644 (file)
@@ -1,45 +1,44 @@
 
 
-    var g = {};
-    var templateList;
-    var template;
-    var DEFAULT = "--Default--";
-    var myPackageDir = 'open_ils_staff_client';
+var g = {};
+var templateList;
+var template;
+var DEFAULT = "--Default--";
+var myPackageDir = 'open_ils_staff_client';
 
 function getSearchStash() {
-    try
-    {
-        if (typeof JSAN == 'undefined')
-        {
+    return window.localStorage.getItem('eg.catalog.staff.search_templates') || [];
+}
+
+function getXULSearchStash() {
+    try {
+        if (typeof JSAN == 'undefined') {
             throw( document.getElementById("commonStrings").getString('common.jsan.missing') );
         }
         JSAN.errorLevel = "die"; // none, warn, or die
         JSAN.addRepository('/xul/server/');
         JSAN.use('util.error');
         g.error = new util.error();
-        g.error.sdump('D_TRACE','getSearchStash() from search_settings.tt2 or search.tt2');
+        g.error.sdump('D_TRACE', 'getSearchStash() from search_settings.tt2 or search.tt2');
 
         JSAN.use('OpenILS.data');
         g.data = new OpenILS.data();
         g.data.stash_retrieve();
 
         //populate templateList, or not.
-        if (g.data.search_templates)
-        {
+        if (g.data.search_templates) {
             templateList = g.data.search_templates;
 
             //check for current template
-            if (g.data.current_search_template)
-            {
+            if (g.data.current_search_template) {
                 template = g.data.current_search_template;
             }
         }
-        else
-        {
+        else {
             templateList = new Array();
         }
-    } catch(E) {
-        try { g.error.standard_unexpected_error_alert('search_settings.tt2',E); } catch(F) { alert(E); }
+    } catch (E) {
+        try { g.error.standard_unexpected_error_alert('search_settings.tt2', E); } catch (F) { alert(E); }
         return 0;
     }
 }
@@ -143,18 +142,21 @@ function saveCurrentTemplateToFile( template ) {
 function populateTemplateOptions(templateList)  {
     templateSel.options.length = 0;
     templateSel.options[0]= new Option(DEFAULT, "");
-    var len = templateList.length;
 
-    for(var i=1; i<=len; i++)
+    if (templateList)
     {
-        templateSel.options[i]= new Option(templateList[i-1].name, templateList[i-1].name);
-        if (template && template.name == templateList[i-1].name)
+        var len = templateList.length;
+        for(var i=1; i<=len; i++)
         {
-            templateSel.options[i].selected= true;
+            templateSel.options[i]= new Option(templateList[i-1].name, templateList[i-1].name);
+            if (template && template.name == templateList[i-1].name)
+            {
+                templateSel.options[i].selected= true;
+            }
         }
     }
-
 }
+
 //returns template with a given name from templatelist
 function getTemplateByName(templateName, templateList)  {
     var len = templateList.length;
@@ -278,7 +280,7 @@ function selectSearchTemplateOrClearAll(tName)  {
     clearPubDateInputs();
 }
 
- //Unselects all search options, clears text inputs
+//Unselects all search options, clears text inputs
 function clearAll()     {
     clearOptions();
     clearGlobalRowInputs();
index e235de1..e4b28d9 100644 (file)
@@ -1,4 +1,4 @@
-dump('entering OpenILS/data.js\n');
+console.log('entering OpenILS/data.js\n');
 
 if (typeof OpenILS == 'undefined') OpenILS = {};
 OpenILS.data = function () {
@@ -214,7 +214,7 @@ OpenILS.data.prototype = {
         try {
             var data_cache = Components.classes["@open-ils.org/openils_data_cache;1"].getService();
             for (var i in data_cache.wrappedJSObject.data) {
-                dump('_debug_stash ' + i + '\n');
+                console.log('_debug_stash ' + i + '\n');
             }
         } catch(E) {
             this.error.sdump('D_ERROR','Error in OpenILS.data._debug_stash(): ' + js2JSON(E) );
@@ -1161,4 +1161,4 @@ OpenILS.data.prototype = {
     }
 }
 
-dump('exiting OpenILS/data.js\n');
+console.log('exiting OpenILS/data.js\n');
index 10432ae..df6f001 100644 (file)
@@ -2,6 +2,11 @@
         xulG = window.arguments[0];
     }
 
+    var dump = function(e) {
+        /*if (window.IAMBROWSER)*/ console.debug(e);
+        //else dump(e);
+    }
+
     function $(id) { return document.getElementById(id); }
 
     function oils_unsaved_data_V() {
         }
 
         data.stash('unsaved_data');
-        dump('\n=-=-=-=-=\n');
-        dump('oils_unsaved_data_V for ' + location.href + '\n');
-        dump('incrementing window.oils_lock\n');
-        dump('incrementing data.unsaved_data\n');
-        dump('\twindow.oils_lock == ' + window.oils_lock + '\n');
-        dump('\tdata.unsaved_data == ' + data.unsaved_data + '\n');
+         console.log('\n=-=-=-=-=\n');
+         console.log('oils_unsaved_data_V for ' + location.href + '\n');
+         console.log('incrementing window.oils_lock\n');
+         console.log('incrementing data.unsaved_data\n');
+         console.log('\twindow.oils_lock == ' + window.oils_lock + '\n');
+         console.log('\tdata.unsaved_data == ' + data.unsaved_data + '\n');
     }
 
     function oils_unsaved_data_P(count) {
-        dump('\n=-=-=-=-=\n');
-        dump('oils_unsaved_data_P for ' + location.href + '\n');
+         console.log('\n=-=-=-=-=\n');
+         console.log('oils_unsaved_data_P for ' + location.href + '\n');
         if (!count) { count = 1; }
-        dump('decrementing window.oils_lock by ' + count + '\n');
+         console.log('decrementing window.oils_lock by ' + count + '\n');
         window.oils_lock -= count;
         if (window.oils_lock < 0) { window.oils_lock = 0; }
         JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
         data.stash_retrieve();
         if (typeof data.unsaved_data == 'undefined') { data.unsaved_data = 0; }
-        dump('decrementing data.unsaved_data by ' + count + '\n');
+         console.log('decrementing data.unsaved_data by ' + count + '\n');
         data.unsaved_data -= count;
         if (data.unsaved_data < 0) { data.unsaved_data = 0; }
         data.stash('unsaved_data');
-        dump('\twindow.oils_lock == ' + window.oils_lock + '\n');
-        dump('\tdata.unsaved_data == ' + data.unsaved_data + '\n');
+         console.log('\twindow.oils_lock == ' + window.oils_lock + '\n');
+         console.log('\tdata.unsaved_data == ' + data.unsaved_data + '\n');
     }
 
     function oils_lock_page(params) {
-        dump('\n=-=-=-=-=\n');
-        dump('oils_lock_page for ' + location.href + '\n');
+         console.log('\n=-=-=-=-=\n');
+         console.log('oils_lock_page for ' + location.href + '\n');
         if (!params) { params = {}; }
         if (window.oils_lock > 0) {
             if (!params.allow_multiple_locks) {
@@ -72,7 +77,7 @@
 
         if (typeof xulG != 'undefined') {
             if (typeof xulG.unlock_tab == 'function') {
-                dump('\twith xulG.lock_tab\n');
+                 console.log('\twith xulG.lock_tab\n');
                 xulG.lock_tab();
                 //make sure we are not in the marc edit window
                 var marceditRe = /\/marcedit.xul$/;
                 }
                 window.oils_lock++; // different window scope than the chrome of xulG.lock_tab
             } else {
-                dump('\twithout xulG.lock_tab\n');
+                 console.log('\twithout xulG.lock_tab\n');
                 oils_unsaved_data_V();
             }
         } else {
-            dump('\twithout xulG.lock_tab\n');
+             console.log('\twithout xulG.lock_tab\n');
             oils_unsaved_data_V();
         }
         return window.oils_lock;
     }
 
     function oils_unlock_page(params) {
-        dump('\n=-=-=-=-=\n');
-        dump('oils_unlock_page for ' + location.href + '\n');
+         console.log('\n=-=-=-=-=\n');
+         console.log('oils_unlock_page for ' + location.href + '\n');
 
         if (typeof xulG != 'undefined') {
             if (typeof xulG.unlock_tab == 'function') {
-                dump('\twith xulG.unlock_tab\n');
+                 console.log('\twith xulG.unlock_tab\n');
                 xulG.unlock_tab();
                 window.oils_lock--; // different window scope than the chrome of xulG.unlock_tab
                 if (window.oils_lock < 0) { window.oils_lock = 0; }
             } else {
-                dump('\twithout xulG.unlock_tab\n');
+                 console.log('\twithout xulG.unlock_tab\n');
                 oils_unsaved_data_P();
             }
         } else {
-            dump('\twithout xulG.unlock_tab\n');
+             console.log('\twithout xulG.unlock_tab\n');
             oils_unsaved_data_P();
         }
         return window.oils_lock;
     }
 
     window.oils_lock = 0;
-    dump('\n=-=-=-=-=\n');
-    dump('init window.oils_lock == ' + window.oils_lock + ' for ' + location.href + '\n');
+     console.log('\n=-=-=-=-=\n');
+     console.log('init window.oils_lock == ' + window.oils_lock + ' for ' + location.href + '\n');
     window.addEventListener(
         'close',
         function(ev) {
             try {
-                dump('\n=-=-=-=-=\n');
-                dump('oils_lock_page/oils_unlock_page onclose handler for ' + location.href + '\n');
+                 console.log('\n=-=-=-=-=\n');
+                 console.log('oils_lock_page/oils_unlock_page onclose handler for ' + location.href + '\n');
                 if (window.oils_lock > 0) {
                     var confirmation = window.confirm($('offlineStrings').getString('menu.close_window.unsaved_data_warning'));
                     if (!confirmation) {
                     oils_unsaved_data_P( window.oils_lock );
                 }
                 window.oils_lock = 0;
-                dump('forcing window.oils_lock == ' + window.oils_lock + '\n');
+                 console.log('forcing window.oils_lock == ' + window.oils_lock + '\n');
 
                 // Dispatching the window close event doesn't always close the window, even though the event does happen
                 setTimeout(
                         try {
                             window.close();
                         } catch(E) {
-                            dump('Error inside global_util.js, onclose handler, setTimeout window.close KLUDGE: ' + E + '\n');
+                             console.log('Error inside global_util.js, onclose handler, setTimeout window.close KLUDGE: ' + E + '\n');
                         }
                     }, 0
                 );
 
                 return true;
             } catch(E) {
-                dump('Error inside global_util.js, onclose handler: ' + E + '\n');
+                 console.log('Error inside global_util.js, onclose handler: ' + E + '\n');
                 return true;
             }
         },
                 break;
             }
         } catch(E) {
-            alert(location.href + '\nError in global_utils.js, ses(): ' + E);
+            console.log(location.href + '\nError in global_utils.js, ses(): ' + E);
             throw(E);
         }
     }
             addCSSClass(document.documentElement,data.global_font_adjust);
         } catch(E) {
             var Strings = $('offlineStrings') || $('commonStrings');
-            alert(Strings.getFormattedString('openils.global_util.font_size.error', [E]));
+            console.log(Strings.getFormattedString('openils.global_util.font_size.error', [E]));
         }
     }
 
             evt.initEvent( 'oils_persist', false, cancelable ); // event name, bubbles, cancelable
             e.dispatchEvent(evt);
         } catch(E) {
-            alert('Error with oils_persist():' + E);
+            console.log('Error with oils_persist():' + E);
         }
     }
 
                     try {
                         oils_persist(ev.target);
                     } catch(E) {
-                        alert('Error in persist_helper, firing virtual event oils_persist after ' + etype + ' event on ' + node.nodeName + '.id = ' + node.id + ': ' + E);
+                        console.log('Error in persist_helper, firing virtual event oils_persist after ' + etype + ' event on ' + node.nodeName + '.id = ' + node.id + ': ' + E);
                     }
                 };
             };
                         var filename = location.pathname.split('/')[ location.pathname.split('/').length - 1 ];
                         var base_key = 'oils_persist_' + String(oils_persist_hostname() + '_' + filename + '_' + target.getAttribute('id')).replace('/','_','g') + '_' + base_key_suffix;
                         var attribute_list = target.getAttribute('oils_persist').split(' ');
-                        dump('on_oils_persist: <<< ' + target.nodeName + '.id = ' + target.id + '\t' + bk + '\n');
+                         console.log('on_oils_persist: <<< ' + target.nodeName + '.id = ' + target.id + '\t' + bk + '\n');
                         for (var j = 0; j < attribute_list.length; j++) {
                             var key = base_key + attribute_list[j];
                             var value;
                             try {
                                 value = encodeURI(target.getAttribute( attribute_list[j] ));
                             } catch(E) {
-                                dump('Error in persist_helper with encodeURI: ' + E + '\n');
+                                 console.log('Error in persist_helper with encodeURI: ' + E + '\n');
                                 value = target.getAttribute( attribute_list[j] );
                             }
                             if ( attribute_list[j] == 'checked' && ['checkbox','toolbarbutton'].indexOf( target.nodeName ) > -1 ) {
                                 value = target.checked;
-                                dump('\t' + value + ' <== .' + attribute_list[j] + '\n');
+                                 console.log('\t' + value + ' <== .' + attribute_list[j] + '\n');
                             } else if ( attribute_list[j] == 'value' && ['menulist'].indexOf( target.nodeName ) > -1 ) {
                                 value = target.value;
-                                dump('\t' + value + ' <== .' + attribute_list[j] + '\n');
+                                 console.log('\t' + value + ' <== .' + attribute_list[j] + '\n');
                             } else if ( attribute_list[j] == 'value' && ['textbox'].indexOf( target.nodeName ) > -1 ) {
                                 value = target.value;
-                                dump('\t' + value + ' <== .' + attribute_list[j] + '\n');
+                                 console.log('\t' + value + ' <== .' + attribute_list[j] + '\n');
                             } else if ( attribute_list[j] == 'sizemode' && ['window'].indexOf( target.nodeName ) > -1 ) {
                                 value = window.windowState;
-                                dump('\t' + value + ' <== window.windowState, @' + attribute_list[j] + '\n');
+                                 console.log('\t' + value + ' <== window.windowState, @' + attribute_list[j] + '\n');
                             } else if ( attribute_list[j] == 'height' && ['window'].indexOf( target.nodeName ) > -1 ) {
                                 value = window.outerHeight;
-                                dump('\t' + value + ' <== window.outerHeight, @' + attribute_list[j] + '\n');
+                                 console.log('\t' + value + ' <== window.outerHeight, @' + attribute_list[j] + '\n');
                             } else if ( attribute_list[j] == 'width' && ['window'].indexOf( target.nodeName ) > -1 ) {
                                 value = window.outerWidth;
-                                dump('\t' + value + ' <== window.outerWidth, @' + attribute_list[j] + '\n');
+                                 console.log('\t' + value + ' <== window.outerWidth, @' + attribute_list[j] + '\n');
                             } else {
-                                dump('\t' + value + ' <== @' + attribute_list[j] + '\n');
+                                 console.log('\t' + value + ' <== @' + attribute_list[j] + '\n');
                             }
                             prefs.setCharPref( key, value );
                             // TODO: Need to add logic for splitter repositioning, grippy state, etc.
                         if (target.hasAttribute('oils_persist_peers') && ! ev.cancelable) { // We abuse the .cancelable field on the oils_persist event to prevent looping
                             var peer_list = target.getAttribute('oils_persist_peers').split(' ');
                             for (var j = 0; j < peer_list.length; j++) {
-                                dump('on_oils_persist: dispatching oils_persist to peer ' + peer_list[j] + '\n');
+                                 console.log('on_oils_persist: dispatching oils_persist to peer ' + peer_list[j] + '\n');
                                 oils_persist( document.getElementById( peer_list[j] ), true );
                             } 
                         }
                     } catch(E) {
-                        alert('Error in persist_helper() event listener for ' + bk + ': ' + E);
+                        console.log('Error in persist_helper() event listener for ' + bk + ': ' + E);
                     }
                 };
             }
                 var filename = location.pathname.split('/')[ location.pathname.split('/').length - 1 ];
                 var base_key = 'oils_persist_' + String(oils_persist_hostname() + '_' + filename + '_' + nodes[i].getAttribute('id')).replace('/','_','g') + '_' + base_key_suffix;
                 var attribute_list = nodes[i].getAttribute('oils_persist').split(' ');
-                dump('persist_helper: >>> ' + nodes[i].nodeName + '.id = ' + nodes[i].id + '\t' + base_key + '\n');
+                 console.log('persist_helper: >>> ' + nodes[i].nodeName + '.id = ' + nodes[i].id + '\t' + base_key + '\n');
                 for (var j = 0; j < attribute_list.length; j++) {
                     var key = base_key + attribute_list[j];
                     var has_key = prefs.prefHasUserValue(key);
                     try {
                         value = has_key ? decodeURI(prefs.getCharPref(key)) : null;
                     } catch(E) {
-                        dump('Error in persist_helper with decodeURI: ' + E + '\n');
+                         console.log('Error in persist_helper with decodeURI: ' + E + '\n');
                         value = has_key ? prefs.getCharPref(key) : null;
                     }
                     if (value == 'true') { value = true; }
                     if (has_key) {
                         if ( attribute_list[j] == 'checked' && ['checkbox','toolbarbutton'].indexOf( nodes[i].nodeName ) > -1 ) {
                             nodes[i].checked = value; 
-                            dump('\t' + value + ' ==> .' + attribute_list[j] + '\n');
+                             console.log('\t' + value + ' ==> .' + attribute_list[j] + '\n');
                             if (!value) {
                                 nodes[i].removeAttribute('checked');
-                                dump('\tremoving @checked\n');
+                                 console.log('\tremoving @checked\n');
                             }
                         } else if ( attribute_list[j] == 'value' && ['textbox'].indexOf( nodes[i].nodeName ) > -1 ) {
                             nodes[i].value = value;
-                            dump('\t' + value + ' ==> .' + attribute_list[j] + '\n');
+                             console.log('\t' + value + ' ==> .' + attribute_list[j] + '\n');
                         } else if ( attribute_list[j] == 'value' && ['menulist'].indexOf( nodes[i].nodeName ) > -1 ) {
                             nodes[i].value = value;
-                            dump('\t' + value + ' ==> .' + attribute_list[j] + '\n');       
+                             console.log('\t' + value + ' ==> .' + attribute_list[j] + '\n');       
                         } else if ( attribute_list[j] == 'sizemode' && ['window'].indexOf( nodes[i].nodeName ) > -1 ) {
                             switch(value) {
                                 case window.STATE_MAXIMIZED:
                                     window.minimize();
                                     break;
                             };
-                            dump('\t' + value + ' ==> window.windowState, @' + attribute_list[j] + '\n');
+                             console.log('\t' + value + ' ==> window.windowState, @' + attribute_list[j] + '\n');
                         } else if ( attribute_list[j] == 'height' && ['window'].indexOf( nodes[i].nodeName ) > -1 ) {
                             window.outerHeight = value;
-                            dump('\t' + value + ' ==> window.outerHeight, @' + attribute_list[j] + '\n');
+                             console.log('\t' + value + ' ==> window.outerHeight, @' + attribute_list[j] + '\n');
                         } else if ( attribute_list[j] == 'width' && ['window'].indexOf( nodes[i].nodeName ) > -1 ) {
                             window.outerWidth = value;
-                            dump('\t' + value + ' ==> window.outerWidth, @' + attribute_list[j] + '\n');
+                             console.log('\t' + value + ' ==> window.outerWidth, @' + attribute_list[j] + '\n');
                         } else {
                             nodes[i].setAttribute( attribute_list[j], value);
-                            dump('\t' + value + ' ==> @' + attribute_list[j] + '\n');
+                             console.log('\t' + value + ' ==> @' + attribute_list[j] + '\n');
                         }
                     }
                 }
                     var no_poke = nodes[i].getAttribute('oils_persist_no_poke');
                     if (no_poke && no_poke == 'true') {
                         // Timing issue for some checkboxes; don't poke them with an event
-                        dump('\tnot poking\n');
+                         console.log('\tnot poking\n');
                     } else {
                         if (cmd_el) {
-                            dump('\tpoking @command\n');
+                             console.log('\tpoking @command\n');
                             var evt = document.createEvent("Events");
                             evt.initEvent( 'command', true, true );
                             cmd_el.dispatchEvent(evt);
                         } else {
-                            dump('\tpoking\n');
+                             console.log('\tpoking\n');
                             var evt = document.createEvent("Events");
                             evt.initEvent( 'command', true, true );
                             nodes[i].dispatchEvent(evt);
                 }
             }
         } catch(E) {
-            alert('Error in persist_helper(): ' + E);
+            console.log('Error in persist_helper(): ' + E);
         }
     }
 
         try {
             window.persist_helper_event_listeners.removeAll();
         } catch(E) {
-            alert('Error in persist_helper_cleanup(): ' + E);
+            console.log('Error in persist_helper_cleanup(): ' + E);
         }
     }
 
                                      return frame.contentWindow.wrappedJSObject;
                           }
                 } catch(E) {
-                    var Strings = $('offlineStrings') || $('commonStrings');
-                    alert(Strings.getFormattedString('openils.global_util.content_window_jsobject.error', [frame, E]));
+                    console.error('get_contentWindow failed', E);
                 }
                 return frame.contentWindow;
             } else {
                 return null;
             }
         } catch(E) {
-            var Strings = $('offlineStrings') || $('commonStrings');
-            alert(Strings.getFormattedString('openils.global_util.content_window.error', [frame, E]));
+            console.error('get_contentWindow failed', E);
         }
     }
 
     function xul_param(param_name,_params) {
         /* By default, this function looks for a CGI-style query param identified by param_name.  If one isn't found, it then looks in xulG.  If one still isn't found, and _params.stash_name is true, it looks in the global xpcom stash for the field identified by stash_name.  If _params.concat is true, then it looks in all these places and concatenates the results.  There are also options for converting JSON to javascript objects, and clearing the xpcom stash_name field after retrieval.  Also added, ability to search a specific spot in the xpcom stash that implements a stack to hold xulG's for modal windows */
         try {
-            //dump('xul_param('+param_name+','+js2JSON(_params)+')\n');
+            // console.log('xul_param('+param_name+','+js2JSON(_params)+')\n');
             var value = undefined; if (!_params) _params = {};
             if (typeof _params.no_cgi == 'undefined') {
                 var cgi = new CGI();
                 if (cgi.param(param_name)) {
                     var x = cgi.param(param_name);
-                    //dump('\tfound via location.href = ' + x + '\n');
+                    // console.log('\tfound via location.href = ' + x + '\n');
                     if (typeof _params.JSON2js_if_cgi != 'undefined') {
                         x = JSON2js( x );
-                        //dump('\tJSON2js = ' + x + '\n');
+                        // console.log('\tJSON2js = ' + x + '\n');
                     }
                     if (typeof _params.concat == 'undefined') {
-                        //alert(param_name + ' x = ' + x);
+                        //console.log(param_name + ' x = ' + x);
                         return x; // value
                     } else {
                         if (value) {
             if (typeof _params.no_xulG == 'undefined') {
                 if (typeof xulG == 'object' && typeof xulG[ param_name ] != 'undefined') {
                     var x = xulG[ param_name ];
-                    //dump('\tfound via xulG = ' + x + '\n');
+                    // console.log('\tfound via xulG = ' + x + '\n');
                     if (typeof _params.JSON2js_if_xulG != 'undefined') {
                         x = JSON2js( x );
-                        //dump('\tJSON2js = ' + x + '\n');
+                        // console.log('\tJSON2js = ' + x + '\n');
                     }
                     if (typeof _params.concat == 'undefined') {
-                        //alert(param_name + ' x = ' + x);
+                        //console.log(param_name + ' x = ' + x);
                         return x; // value
                     } else {
                         if (value) {
                     JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
                     if (typeof data[ _params.stash_name ] != 'undefined') {
                         var x = data[ _params.stash_name ];
-                        //dump('\tfound via xpcom = ' + x + '\n');
+                        // console.log('\tfound via xpcom = ' + x + '\n');
                         if (typeof _params.JSON2js_if_xpcom != 'undefined') {
                             x = JSON2js( x );
-                            //dump('\tJSON2js = ' + x + '\n');
+                            // console.log('\tJSON2js = ' + x + '\n');
                         }
                         if (_params.clear_xpcom) { 
                             data[ _params.stash_name ] = undefined; data.stash( _params.stash_name ); 
                         }
                         if (typeof _params.concat == 'undefined') {
-                            //alert(param_name + ' x = ' + x);
+                            //console.log(param_name + ' x = ' + x);
                             return x; // value
                         } else {
                             if (value) {
                     }
                 }
             }
-            //alert(param_name + ' value = ' + value);
+            //console.log(param_name + ' value = ' + value);
             return value;
         } catch(E) {
-            dump('xul_param error: ' + E + '\n');
+             console.log('xul_param error: ' + E + '\n');
         }
     }
 
                 .getService(Components.interfaces.nsIClipboardHelper);
             gClipboardHelper.copyString(text);
             var Strings = $('offlineStrings') || $('commonStrings');
-            // alert(Strings.getFormattedString('openils.global_util.clipboard', [text]));
+            // console.log(Strings.getFormattedString('openils.global_util.clipboard', [text]));
         } catch(E) {
             var Strings = $('offlineStrings') || $('commonStrings');
-            alert(Strings.getFormattedString('openils.global_util.clipboard.error', [E]));    
+            console.log(Strings.getFormattedString('openils.global_util.clipboard.error', [E]));    
         }
     }
 
             cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
         } catch(E) {
             var Strings = $('offlineStrings') || $('commonStrings');
-            alert(Strings.getFormattedString('openils.global_util.clear_cache.error', [E]));
+            console.log(Strings.getFormattedString('openils.global_util.clear_cache.error', [E]));
         }
     }
 
         }
         if (url.match(/^\//)) url = urls.remote + url;
         if (! url.match(/^(http|https|chrome|oils):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url;
-        dump('url_prefix = ' + url + '\n');
+         console.log('url_prefix = ' + url + '\n');
         return url;
     }
 
                 return my_xulG.value;
             }
         } catch(E) {
-            alert('Error in global_utils.js, widget_prompt(): ' + E);
+            console.log('Error in global_utils.js, widget_prompt(): ' + E);
         }
     }
 
                 JSAN.use('addon.autoloader');
                 window.oils_autoloaded = new addon.autoloader();
             } catch(E) {
-                dump('Error in global_util.js with addon.autoloader: ' + E + '\n');
+                 console.log('Error in global_util.js with addon.autoloader: ' + E + '\n');
             }
         },
         false
index eb40d03..3b8a8cf 100644 (file)
@@ -12,13 +12,13 @@ function $(id) { return document.getElementById(id); }
 
 function my_init() {
     try {
-        if (typeof JSAN == 'undefined') { throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); }
+        if (typeof JSAN == 'undefined') { throw (document.getElementById('offlineStrings').getString('common.jsan.missing')); }
         JSAN.errorLevel = "die"; // none, warn, or die
         JSAN.addRepository('..');
         JSAN.use('util.error'); g.error = new util.error();
-        g.error.sdump('D_TRACE','my_init() for cat/opac.xul');
+        g.error.sdump('D_TRACE', 'my_init() for cat/opac.xul');
 
-        JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+        JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({ 'via': 'stash' });
         XML_HTTP_SERVER = g.data.server_unadorned;
 
         // Pull in local customizations
@@ -28,7 +28,7 @@ function my_init() {
         r.send(null);
         if (r.status == 200) {
             dump('Evaluating ' + custom_js + '\n');
-            eval( r.responseText );
+            eval(r.responseText);
         }
 
         window.help_context_set_locally = true;
@@ -36,10 +36,10 @@ function my_init() {
         JSAN.use('util.network'); g.network = new util.network();
 
         g.cgi = new CGI();
-        try { authtime = g.cgi.param('authtime') || xulG.authtime; } catch(E) { g.error.sdump('D_ERROR',E); }
-        try { docid = g.cgi.param('docid') || xulG.docid; } catch(E) { g.error.sdump('D_ERROR',E); }
-        try { opac_url = g.cgi.param('opac_url') || xulG.opac_url; } catch(E) { g.error.sdump('D_ERROR',E); }
-        try { g.view_override = g.cgi.param('default_view') || xulG.default_view; } catch(E) { g.error.sdump('D_ERROR',E); }
+        try { authtime = g.cgi.param('authtime') || xulG.authtime; } catch (E) { g.error.sdump('D_ERROR', E); }
+        try { docid = g.cgi.param('docid') || xulG.docid; } catch (E) { g.error.sdump('D_ERROR', E); }
+        try { opac_url = g.cgi.param('opac_url') || xulG.opac_url; } catch (E) { g.error.sdump('D_ERROR', E); }
+        try { g.view_override = g.cgi.param('default_view') || xulG.default_view; } catch (E) { g.error.sdump('D_ERROR', E); }
 
         JSAN.use('util.deck');
         top_pane = new util.deck('top_pane');
@@ -47,9 +47,9 @@ function my_init() {
 
         set_opac();
 
-    } catch(E) {
+    } catch (E) {
         var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["cat/opac.xul", E]);
-        try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+        try { g.error.sdump('D_ERROR', err_msg); } catch (E) { dump(err_msg); }
         alert(err_msg);
     }
 }
@@ -71,11 +71,11 @@ function opac_wrapper_set_help_context() {
         if (cw && typeof cw['location'] != 'undefined') {
             if (typeof cw.help_context_set_locally == 'undefined') {
                 var help_params = {
-                    'protocol' : cw.location.protocol,
-                    'hostname' : cw.location.hostname,
-                    'port' : cw.location.port,
-                    'pathname' : cw.location.pathname,
-                    'src' : ''
+                    'protocol': cw.location.protocol,
+                    'hostname': cw.location.hostname,
+                    'port': cw.location.port,
+                    'pathname': cw.location.pathname,
+                    'src': ''
                 };
                 xulG.set_help_context(help_params);
             } else {
@@ -94,20 +94,20 @@ function opac_wrapper_set_help_context() {
             dump('opac.js: problem in opac_wrapper_set_help_context(): bottom_pane = ' + bottom_pane + ' cw = ' + cw + '\n');
             dump('\tcw.location = ' + cw.location + '\n');
         }
-    } catch(E) {
+    } catch (E) {
         // We can expect some errors here if this called before the DOM is ready.  Easiest to just trap and ignore
         dump('Error in opac.js, opac_wrapper_set_help_context(): ' + E + '\n');
     }
 }
 
 function set_brief_view() {
-    var url = xulG.url_prefix( 'XUL_BIB_BRIEF?docid=' ) + window.encodeURIComponent(docid);
+    var url = xulG.url_prefix('XUL_BIB_BRIEF?docid=') + window.encodeURIComponent(docid);
     dump('spawning ' + url + '\n');
 
     var content_params = {
-        'set_tab_name' : function(n) {
+        'set_tab_name': function (n) {
             if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
-                try { window.xulG.set_tab_name(document.getElementById('offlineStrings').getFormattedString("cat.bib_record", [n])); } catch(E) { alert(E); }
+                try { window.xulG.set_tab_name(document.getElementById('offlineStrings').getFormattedString("cat.bib_record", [n])); } catch (E) { alert(E); }
             } else {
                 dump('no set_tab_name\n');
             }
@@ -119,217 +119,215 @@ function set_brief_view() {
         "holdings_maintenance_tab", "open_chrome_window", "url_prefix",
         "network_meter", "page_meter", "set_statusbar", "set_help_context",
         "get_barcode", "reload_opac", "get_barcode_and_settings"
-    ].forEach(function(k) { content_params[k] = xulG[k]; });
+    ].forEach(function (k) { content_params[k] = xulG[k]; });
 
     top_pane.set_iframe(
         url,
         {},
         content_params
     );
-    document.getElementById('top_pane').setAttribute('height', '120');
 }
 
 function set_marc_view() {
     g.view = 'marc_view';
     if (marc_view_reset) {
-        bottom_pane.reset_iframe( xulG.url_prefix( 'XUL_MARC_VIEW?docid=' ) + window.encodeURIComponent(docid),{},xulG);
+        bottom_pane.reset_iframe(xulG.url_prefix('XUL_MARC_VIEW?docid=') + window.encodeURIComponent(docid), {}, xulG);
         marc_view_reset = false;
     } else {
-        bottom_pane.set_iframe( xulG.url_prefix( 'XUL_MARC_VIEW?docid=' ) + window.encodeURIComponent(docid),{},xulG);
+        bottom_pane.set_iframe(xulG.url_prefix('XUL_MARC_VIEW?docid=') + window.encodeURIComponent(docid), {}, xulG);
     }
     opac_wrapper_set_help_context();
-    bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
+    bottom_pane.get_contentWindow().addEventListener('load', opac_wrapper_set_help_context, false);
 }
 
 function set_marc_edit() {
     g.view = 'marc_edit';
-    var a =    xulG.url_prefix( 'XUL_MARC_EDIT' );
-    var b =    {};
-    var c =    {
-            'marc_control_number_identifier' : g.data.hash.aous['cat.marc_control_number_identifier'] || 'Set cat.marc_control_number_identifier in Library Settings',
-            'record' : { 'url' : '/opac/extras/supercat/retrieve/marcxml/record/' + docid, "id": docid, "rtype": "bre" },
-            'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
-                try {
-                    var cat = { util: {} }; /* FIXME: kludge since we can't load remote JSAN libraries into chrome */
-                    cat.util.spawn_copy_editor = function(params) {
-                        try {
-                            if (!params.copy_ids && !params.copies) return;
-                            if (params.copy_ids && params.copy_ids.length == 0) return;
-                            if (params.copies && params.copies.length == 0) return;
-                            if (params.copy_ids) params.copy_ids = js2JSON(params.copy_ids); // legacy
-                            if (!params.caller_handles_update) params.handle_update = 1; // legacy
-
-                            var obj = {};
-                            JSAN.use('util.network'); obj.network = new util.network();
-                            JSAN.use('util.error'); obj.error = new util.error();
-
-                            var title = '';
-                            if (params.copy_ids && params.copy_ids.length > 1 && params.edit == 1)
-                                title = $("offlineStrings").getString('staff.cat.util.copy_editor.batch_edit');
-                            else if(params.copies && params.copies.length > 1 && params.edit == 1)
-                                title = $("offlineStrings").getString('staff.cat.util.copy_editor.batch_view');
-                            else if(params.copy_ids && params.copy_ids.length == 1)
-                                title = $("offlineStrings").getString('staff.cat.util.copy_editor.edit');
-                            else
-                                title = $("offlineStrings").getString('staff.cat.util.copy_editor.view');
-
-                            JSAN.use('util.window'); var win = new util.window();
-                            var my_xulG = win.open(
-                                (urls.XUL_COPY_EDITOR),
-                                title,
-                                'chrome,modal,resizable',
-                                params
-                            );
-                            if (!my_xulG.copies && params.edit) {
-                            } else {
-                                return my_xulG.copies;
-                            }
-                            return [];
-                        } catch(E) {
-                            JSAN.use('util.error'); var error = new util.error();
-                            error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.spawn_copy_editor',E);
+    var a = xulG.url_prefix('XUL_MARC_EDIT');
+    var b = {};
+    var c = {
+        'marc_control_number_identifier': g.data.hash.aous['cat.marc_control_number_identifier'] || 'Set cat.marc_control_number_identifier in Library Settings',
+        'record': { 'url': '/opac/extras/supercat/retrieve/marcxml/record/' + docid, "id": docid, "rtype": "bre" },
+        'fast_add_item': function (doc_id, cn_label, cp_barcode) {
+            try {
+                var cat = { util: {} }; /* FIXME: kludge since we can't load remote JSAN libraries into chrome */
+                cat.util.spawn_copy_editor = function (params) {
+                    try {
+                        if (!params.copy_ids && !params.copies) return;
+                        if (params.copy_ids && params.copy_ids.length == 0) return;
+                        if (params.copies && params.copies.length == 0) return;
+                        if (params.copy_ids) params.copy_ids = js2JSON(params.copy_ids); // legacy
+                        if (!params.caller_handles_update) params.handle_update = 1; // legacy
+
+                        var obj = {};
+                        JSAN.use('util.network'); obj.network = new util.network();
+                        JSAN.use('util.error'); obj.error = new util.error();
+
+                        var title = '';
+                        if (params.copy_ids && params.copy_ids.length > 1 && params.edit == 1)
+                            title = $("offlineStrings").getString('staff.cat.util.copy_editor.batch_edit');
+                        else if (params.copies && params.copies.length > 1 && params.edit == 1)
+                            title = $("offlineStrings").getString('staff.cat.util.copy_editor.batch_view');
+                        else if (params.copy_ids && params.copy_ids.length == 1)
+                            title = $("offlineStrings").getString('staff.cat.util.copy_editor.edit');
+                        else
+                            title = $("offlineStrings").getString('staff.cat.util.copy_editor.view');
+
+                        JSAN.use('util.window'); var win = new util.window();
+                        var my_xulG = win.open(
+                            (urls.XUL_COPY_EDITOR),
+                            title,
+                            'chrome,modal,resizable',
+                            params
+                        );
+                        if (!my_xulG.copies && params.edit) {
+                        } else {
+                            return my_xulG.copies;
                         }
+                        return [];
+                    } catch (E) {
+                        JSAN.use('util.error'); var error = new util.error();
+                        error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.spawn_copy_editor', E);
                     }
-                    cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) {
-                        var error;
-                        try {
+                }
+                cat.util.fast_item_add = function (doc_id, cn_label, cp_barcode) {
+                    var error;
+                    try {
 
-                            JSAN.use('util.error'); error = new util.error();
-                            JSAN.use('util.network'); var network = new util.network();
+                        JSAN.use('util.error'); error = new util.error();
+                        JSAN.use('util.network'); var network = new util.network();
 
-                            var acn_blob = network.simple_request(
-                                'FM_ACN_FIND_OR_CREATE',
-                                [ ses(), cn_label, doc_id, ses('ws_ou') ]
-                            );
-
-                            if (typeof acn_blob.ilsevent != 'undefined') {
-                                error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.fast_item_add', acn_blob);
-                                return;
-                            }
+                        var acn_blob = network.simple_request(
+                            'FM_ACN_FIND_OR_CREATE',
+                            [ses(), cn_label, doc_id, ses('ws_ou')]
+                        );
 
-                            // Get the default copy status; default to available if unset, per 1.6
-                            var fast_ccs = g.data.hash.aous['cat.default_copy_status_fast'] || 0;
-
-                            var copy_obj = new acp();
-                            copy_obj.id( -1 );
-                            copy_obj.isnew('1');
-                            copy_obj.barcode( cp_barcode );
-                            copy_obj.call_number( acn_blob.acn_id );
-                            copy_obj.circ_lib( ses('ws_ou') );
-                            /* FIXME -- use constants */
-                            copy_obj.deposit(0);
-                            copy_obj.price(0);
-                            copy_obj.deposit_amount(0);
-                            copy_obj.fine_level(2); // Normal
-                            copy_obj.loan_duration(2); // Normal
-                            copy_obj.location(1); // Stacks
-                            copy_obj.status(fast_ccs);
-                            copy_obj.circulate(get_db_true());
-                            copy_obj.holdable(get_db_true());
-                            copy_obj.opac_visible(get_db_true());
-                            copy_obj.ref(get_db_false());
-                            copy_obj.mint_condition(get_db_true());
-
-                            JSAN.use('util.window'); var win = new util.window();
-
-                            var unified_interface = String( data.hash.aous['ui.unified_volume_copy_editor'] ) == 'true';
-                            if (unified_interface) {
-                                var horizontal_interface = String( data.hash.aous['ui.cat.volume_copy_editor.horizontal'] ) == 'true';
-                                var url = window.xulG.url_prefix( horizontal_interface ? 'XUL_VOLUME_COPY_CREATOR_HORIZONTAL' : 'XUL_VOLUME_COPY_CREATOR' );
-                                var w = xulG.set_tab(
-                                    url,
-                                    {
-                                        'tab_name' : document.getElementById('offlineStrings').getFormattedString(
-                                            'cat.bib_record',
-                                            [ doc_id ]
-                                        )
-                                    },
-                                    {
-                                        'doc_id' : doc_id,
-                                        'existing_copies' : [ copy_obj ],
-                                        'load_opac_when_done' : true,
-                                        'labels_in_new_tab' : true
-                                    }
-                                );
+                        if (typeof acn_blob.ilsevent != 'undefined') {
+                            error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.fast_item_add', acn_blob);
+                            return;
+                        }
 
-                            } else {
-                                var x = cat.util.spawn_copy_editor( { 'handle_update' : 1, 'edit' : 1, 'docid' : doc_id, 'copies' : [ copy_obj ] });
-                                xulG.reload_opac();
-                                return x;
-                            }
+                        // Get the default copy status; default to available if unset, per 1.6
+                        var fast_ccs = g.data.hash.aous['cat.default_copy_status_fast'] || 0;
+
+                        var copy_obj = new acp();
+                        copy_obj.id(-1);
+                        copy_obj.isnew('1');
+                        copy_obj.barcode(cp_barcode);
+                        copy_obj.call_number(acn_blob.acn_id);
+                        copy_obj.circ_lib(ses('ws_ou'));
+                        /* FIXME -- use constants */
+                        copy_obj.deposit(0);
+                        copy_obj.price(0);
+                        copy_obj.deposit_amount(0);
+                        copy_obj.fine_level(2); // Normal
+                        copy_obj.loan_duration(2); // Normal
+                        copy_obj.location(1); // Stacks
+                        copy_obj.status(fast_ccs);
+                        copy_obj.circulate(get_db_true());
+                        copy_obj.holdable(get_db_true());
+                        copy_obj.opac_visible(get_db_true());
+                        copy_obj.ref(get_db_false());
+                        copy_obj.mint_condition(get_db_true());
+
+                        JSAN.use('util.window'); var win = new util.window();
+
+                        var unified_interface = String(data.hash.aous['ui.unified_volume_copy_editor']) == 'true';
+                        if (unified_interface) {
+                            var horizontal_interface = String(data.hash.aous['ui.cat.volume_copy_editor.horizontal']) == 'true';
+                            var url = window.xulG.url_prefix(horizontal_interface ? 'XUL_VOLUME_COPY_CREATOR_HORIZONTAL' : 'XUL_VOLUME_COPY_CREATOR');
+                            var w = xulG.set_tab(
+                                url,
+                                {
+                                    'tab_name': document.getElementById('offlineStrings').getFormattedString(
+                                        'cat.bib_record',
+                                        [doc_id]
+                                    )
+                                },
+                                {
+                                    'doc_id': doc_id,
+                                    'existing_copies': [copy_obj],
+                                    'load_opac_when_done': true,
+                                    'labels_in_new_tab': true
+                                }
+                            );
 
-                        } catch(E) {
-                            if (error) error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.fast_item_add #2',E); else alert('FIXME: ' + E);
+                        } else {
+                            var x = cat.util.spawn_copy_editor({ 'handle_update': 1, 'edit': 1, 'docid': doc_id, 'copies': [copy_obj] });
+                            xulG.reload_opac();
+                            return x;
                         }
+
+                    } catch (E) {
+                        if (error) error.standard_unexpected_error_alert('Error in chrome/content/cat/opac.js, cat.util.fast_item_add #2', E); else alert('FIXME: ' + E);
                     }
-                    return cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
-                } catch(E) {
-                    alert('Error in chrome/content/cat/opac.js, set_marc_edit, fast_item_add: ' + E);
                 }
-            },
-            'save' : {
-                'label' : document.getElementById('offlineStrings').getString('cat.save_record'),
-                'func' : function (new_marcxml) {
-                    try {
-                        var r = g.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), docid, new_marcxml ]);
-                        marc_view_reset = true;
-                        copy_browser_reset = true;
-                        hold_browser_reset = true;
-                        xulG.reload_opac();
-                        if (typeof r.ilsevent != 'undefined') {
-                            throw(r);
-                        } else {
-                            return {
-                                'id' : r.id(),
-                                'oncomplete' : function() {}
-                            };
-                        }
-                    } catch(E) {
-                            g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString("cat.save.failure"), E);
+                return cat.util.fast_item_add(doc_id, cn_label, cp_barcode);
+            } catch (E) {
+                alert('Error in chrome/content/cat/opac.js, set_marc_edit, fast_item_add: ' + E);
+            }
+        },
+        'save': {
+            'label': document.getElementById('offlineStrings').getString('cat.save_record'),
+            'func': function (new_marcxml) {
+                try {
+                    var r = g.network.simple_request('MARC_XML_RECORD_UPDATE', [ses(), docid, new_marcxml]);
+                    marc_view_reset = true;
+                    copy_browser_reset = true;
+                    hold_browser_reset = true;
+                    xulG.reload_opac();
+                    if (typeof r.ilsevent != 'undefined') {
+                        throw (r);
+                    } else {
+                        return {
+                            'id': r.id(),
+                            'oncomplete': function () { }
+                        };
                     }
+                } catch (E) {
+                    g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString("cat.save.failure"), E);
                 }
-            },
-            'lock_tab' : xulG.lock_tab,
-            'unlock_tab' : xulG.unlock_tab,
-            'url_prefix': xulG.url_prefix
-        };
+            }
+        },
+        'lock_tab': xulG.lock_tab,
+        'unlock_tab': xulG.unlock_tab,
+        'url_prefix': xulG.url_prefix
+    };
     if (marc_edit_reset) {
-        bottom_pane.reset_iframe( a,b,c );
+        bottom_pane.reset_iframe(a, b, c);
         marc_edit_reset = false;
     } else {
-        bottom_pane.set_iframe( a,b,c );
+        bottom_pane.set_iframe(a, b, c);
     }
     opac_wrapper_set_help_context();
-    bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
+    bottom_pane.get_contentWindow().addEventListener('load', opac_wrapper_set_help_context, false);
 }
 
 function set_copy_browser() {
     g.view = 'copy_browser';
     if (copy_browser_reset) {
-        bottom_pane.reset_iframe( xulG.url_prefix( 'XUL_COPY_VOLUME_BROWSE?docid=' ) + window.encodeURIComponent(docid),{},xulG);
-        copy_browser_reset =false;
+        bottom_pane.reset_iframe(xulG.url_prefix('XUL_COPY_VOLUME_BROWSE?docid=') + window.encodeURIComponent(docid), {}, xulG);
+        copy_browser_reset = false;
     } else {
-        bottom_pane.set_iframe( xulG.url_prefix( 'XUL_COPY_VOLUME_BROWSE?docid=' ) + window.encodeURIComponent(docid),{},xulG);
+        bottom_pane.set_iframe(xulG.url_prefix('XUL_COPY_VOLUME_BROWSE?docid=') + window.encodeURIComponent(docid), {}, xulG);
     }
     opac_wrapper_set_help_context();
-    bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
+    bottom_pane.get_contentWindow().addEventListener('load', opac_wrapper_set_help_context, false);
 }
 
 function set_hold_browser() {
     g.view = 'hold_browser';
     if (hold_browser_reset) {
-        bottom_pane.reset_iframe( xulG.url_prefix( 'XUL_HOLDS_BROWSER?docid=' ) + window.encodeURIComponent(docid),{},xulG);
+        bottom_pane.reset_iframe(xulG.url_prefix('XUL_HOLDS_BROWSER?docid=') + window.encodeURIComponent(docid), {}, xulG);
         hold_browser_reset = false;
     } else {
-        bottom_pane.set_iframe( xulG.url_prefix( 'XUL_HOLDS_BROWSER?docid=' ) + window.encodeURIComponent(docid),{},xulG);
+        bottom_pane.set_iframe(xulG.url_prefix('XUL_HOLDS_BROWSER?docid=') + window.encodeURIComponent(docid), {}, xulG);
     }
     opac_wrapper_set_help_context();
-    bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
+    bottom_pane.get_contentWindow().addEventListener('load', opac_wrapper_set_help_context, false);
 }
 
 
 function open_acq_orders() {
-
     try {
         var content_params = {
             "session": ses(),
@@ -345,7 +343,7 @@ function open_acq_orders() {
             "url_prefix", "network_meter", "page_meter", "set_statusbar",
             "set_help_context", "get_barcode", "reload_opac",
             "get_barcode_and_settings"
-        ].forEach(function(k) { content_params[k] = xulG[k]; });
+        ].forEach(function (k) { content_params[k] = xulG[k]; });
 
         var loc = urls.XUL_BROWSER + "?url=" + window.encodeURIComponent(
             xulG.url_prefix("ACQ_LINEITEM") +
@@ -364,69 +362,6 @@ function open_acq_orders() {
     }
 }
 
-function update_items(){
-    try {
-        var edit = 0;
-        try {
-            edit = g.network.request(
-                api.PERM_MULTI_ORG_CHECK.app,
-                api.PERM_MULTI_ORG_CHECK.method,
-                [ 
-                    ses(), 
-                    ses('staff_id'), 
-                    [ ses('ws_ou') ],
-                    [ 'UPDATE_ITEMS' ]
-                ]
-            ).length == 0 ? 1 : 0;
-        } catch(E) {
-            g.error.sdump('D_ERROR','batch permission check: ' + E);
-        }
-
-        if (edit==0) {
-            alert(document.getElementById('offlineStrings').getString('staff.circ.copy_status.add_volumes.perm_failure'));
-            return; // no read-only view for this interface
-        }
-
-        // Check if the source is allowed to have copies.
-        try {
-            var bibObj = g.network.request(
-                api.FM_BRE_RETRIEVE_VIA_ID.app,
-                api.FM_BRE_RETRIEVE_VIA_ID.method,
-                               [ ses(), [docid] ]
-            );
-
-                       bibObj = bibObj[0];
-
-            var cbsObj = g.network.request(
-                api.FM_CBS_RETRIEVE_VIA_PCRUD.app,
-                api.FM_CBS_RETRIEVE_VIA_PCRUD.method,
-                [ ses(), bibObj.source() ]
-            );
-
-            if (cbsObj && cbsObj.can_have_copies() != get_db_true()) {
-                alert(document.getElementById('offlineStrings').getFormattedString('staff.cat.bib_source.can_have_copies.false', [cbsObj.source()]));
-                return;
-            }
-        } catch(E) {
-            g.error.sdump('D_ERROR','can have copies check: ' + E);
-            alert('Error in chrome/content/cat/opac.js, update_items(): ' + E);
-            return;
-        }
-
-        var title = document.getElementById('offlineStrings').getFormattedString('staff.cat.update_items.title', [docid]);
-
-        var url = window.xulG.url_prefix( 'XUL_UPDATE_ITEMS' );
-               
-        var w = xulG.new_tab(
-            url,
-            { 'tab_name' : title },
-            { 'doc_id' : docid, 'ou_ids' : [ ses('ws_ou') ], 'reload_opac' : xulG.reload_opac }
-        );
-    } catch(E) {
-        alert('Error in chrome/content/cat/opac.js, update_items(): ' + E);
-    }
-}
-
 function open_alt_serial_mgmt() {
     try {
         var content_params = {
@@ -446,7 +381,7 @@ function open_alt_serial_mgmt() {
             "url_prefix", "network_meter", "page_meter", "set_statusbar",
             "set_help_context", "get_barcode", "reload_opac",
             "get_barcode_and_settings"
-        ].forEach(function(k) { content_params[k] = xulG[k]; });
+        ].forEach(function (k) { content_params[k] = xulG[k]; });
 
         var loc = urls.XUL_BROWSER + "?url=" + window.encodeURIComponent(
             xulG.url_prefix("SERIAL_LIST_SUBSCRIPTION?record_entry=") +
@@ -469,28 +404,28 @@ function set_opac() {
     g.view = 'opac';
     try {
         var content_params = {
-            'show_nav_buttons' : true,
-            'show_print_button' : true,
-            'passthru_content_params' : {
-                'authtoken' : ses(),
-                'authtime' : ses('authtime'),
-                'window_open' : function(a,b,c) {
+            'show_nav_buttons': true,
+            'show_print_button': true,
+            'passthru_content_params': {
+                'authtoken': ses(),
+                'authtime': ses('authtime'),
+                'window_open': function (a, b, c) {
                     try {
-                        return window.open(a,b,c);
-                    } catch(E) {
-                        g.error.standard_unexpected_error_alert('window_open',E);
+                        return window.open(a, b, c);
+                    } catch (E) {
+                        g.error.standard_unexpected_error_alert('window_open', E);
                     }
                 },
-                'get_barcode' : xulG.get_barcode,
-                'get_barcode_and_settings' : xulG.get_barcode_and_settings,
-                'opac_hold_placed' : function(hold) {
+                'get_barcode': xulG.get_barcode,
+                'get_barcode_and_settings': xulG.get_barcode_and_settings,
+                'opac_hold_placed': function (hold) {
                     try {
                         var hold_id = typeof hold == 'object' ? hold.id() : hold;
-                        g.network.simple_request('FM_AHR_BLOB_RETRIEVE.authoritative', [ ses(), hold_id ],
-                            function(blob_req) {
+                        g.network.simple_request('FM_AHR_BLOB_RETRIEVE.authoritative', [ses(), hold_id],
+                            function (blob_req) {
                                 try {
                                     var blob = blob_req.getResultObject();
-                                    if (typeof blob.ilsevent != 'undefined') throw(blob);
+                                    if (typeof blob.ilsevent != 'undefined') throw (blob);
                                     g.error.work_log(
                                         $('offlineStrings').getFormattedString(
                                             'staff.circ.work_log_hold_placed.message',
@@ -502,22 +437,22 @@ function set_opac() {
                                                 blob.hold.hold_type()
                                             ]
                                         ), {
-                                            'au_id' : blob.hold.usr(),
-                                            'au_family_name' : blob.patron_family_name,
-                                            'au_barcode' : blob.patron_barcode
+                                            'au_id': blob.hold.usr(),
+                                            'au_family_name': blob.patron_family_name,
+                                            'au_barcode': blob.patron_barcode
                                         }
                                     );
-                                } catch(E) {
-                                    g.error.standard_unexpected_error_alert('opac.js, opac_hold_placed(), work_log #2: ',E);
+                                } catch (E) {
+                                    g.error.standard_unexpected_error_alert('opac.js, opac_hold_placed(), work_log #2: ', E);
                                 }
                             }
                         );
-                    } catch(F) {
-                        g.error.standard_unexpected_error_alert('opac.js, opac_hold_placed(), work_log #1: ',F);
+                    } catch (F) {
+                        g.error.standard_unexpected_error_alert('opac.js, opac_hold_placed(), work_log #1: ', F);
                     }
                 }
             },
-            'on_url_load' : function(f) {
+            'on_url_load': function (f) {
                 var win;
                 try {
                     if (typeof f.contentWindow.wrappedJSObject.attachEvt != 'undefined') {
@@ -525,17 +460,17 @@ function set_opac() {
                     } else {
                         win = f.contentWindow;
                     }
-                } catch(E) {
+                } catch (E) {
                     win = f.contentWindow;
                 }
                 win.attachEvt("rdetail", "recordRetrieved",
-                    function(id){
+                    function (id) {
                         try {
                             if (docid == id) return;
                             docid = id;
                             refresh_display(id);
-                        } catch(E) {
-                            g.error.standard_unexpected_error_alert('rdetail -> recordRetrieved',E);
+                        } catch (E) {
+                            g.error.standard_unexpected_error_alert('rdetail -> recordRetrieved', E);
                         }
                     }
                 );
@@ -546,13 +481,13 @@ function set_opac() {
                 $('record_start').disabled = true; $('record_next').disabled = true;
                 $('record_prev').disabled = true; $('record_end').disabled = true;
                 $('record_back_to_results').disabled = true;
-                $('record_pos').setAttribute('value','');
+                $('record_pos').setAttribute('value', '');
 
                 win.attachEvt("rdetail", "nextPrevDrawn",
-                    function(rIndex,rCount){
-                        $('record_pos').setAttribute('value', document.getElementById('offlineStrings').getFormattedString('cat.record.counter', [(1+rIndex), rCount ? rCount : 1]));
+                    function (rIndex, rCount) {
+                        $('record_pos').setAttribute('value', document.getElementById('offlineStrings').getFormattedString('cat.record.counter', [(1 + rIndex), rCount ? rCount : 1]));
                         if (win.rdetailNext) {
-                            g.f_record_next = function() {
+                            g.f_record_next = function () {
                                 if (safe_to_proceed()) {
                                     g.view_override = g.view;
                                     win.rdetailNext();
@@ -561,7 +496,7 @@ function set_opac() {
                             $('record_next').disabled = false;
                         }
                         if (win.rdetailPrev) {
-                            g.f_record_prev = function() {
+                            g.f_record_prev = function () {
                                 if (safe_to_proceed()) {
                                     g.view_override = g.view;
                                     win.rdetailPrev();
@@ -570,7 +505,7 @@ function set_opac() {
                             $('record_prev').disabled = false;
                         }
                         if (win.rdetailStart) {
-                            g.f_record_start = function() {
+                            g.f_record_start = function () {
                                 if (safe_to_proceed()) {
                                     g.view_override = g.view;
                                     win.rdetailStart();
@@ -579,7 +514,7 @@ function set_opac() {
                             $('record_start').disabled = false;
                         }
                         if (win.rdetailEnd) {
-                            g.f_record_end = function() {
+                            g.f_record_end = function () {
                                 if (safe_to_proceed()) {
                                     g.view_override = g.view;
                                     win.rdetailEnd();
@@ -588,7 +523,7 @@ function set_opac() {
                             $('record_end').disabled = false;
                         }
                         if (win.rdetailBackToResults) {
-                            g.f_record_back_to_results = function() {
+                            g.f_record_back_to_results = function () {
                                 if (safe_to_proceed()) {
                                     g.view_override = g.view;
                                     win.rdetailBackToResults();
@@ -603,7 +538,7 @@ function set_opac() {
                     }
                 );
 
-                $('mfhd_add').setAttribute('oncommand','create_mfhd()');
+                $('mfhd_add').setAttribute('oncommand', 'create_mfhd()');
                 var mfhd_edit_menu = $('mfhd_edit');
                 var mfhd_delete_menu = $('mfhd_delete');
 
@@ -617,7 +552,7 @@ function set_opac() {
                 mfhd_delete_menu.disabled = true;
 
                 win.attachEvt("rdetail", "MFHDDrawn",
-                    function() {
+                    function () {
                         if (win.mfhdDetails && win.mfhdDetails.length > 0) {
                             g.mfhd = {};
                             g.mfhd.details = win.mfhdDetails;
@@ -629,20 +564,20 @@ function set_opac() {
                                 num++;
                                 var label = mfhd_details.label + ' (' + num + ')';
                                 var item = mfhd_edit_menu.appendItem(label);
-                                item.setAttribute('oncommand','open_mfhd_editor('+mfhd_details.id+')');
+                                item.setAttribute('oncommand', 'open_mfhd_editor(' + mfhd_details.id + ')');
                                 item = mfhd_delete_menu.appendItem(label);
-                                item.setAttribute('oncommand','delete_mfhd('+mfhd_details.id+')');
+                                item.setAttribute('oncommand', 'delete_mfhd(' + mfhd_details.id + ')');
                             }
                         } else if (g.mfhd) { // clear from previous runs if deleting last MFHD
                             delete g.mfhd;
                         }
                         var change_event = document.createEvent("Event");
-                        change_event.initEvent("MFHDChange",false,false);
+                        change_event.initEvent("MFHDChange", false, false);
                         window.dispatchEvent(change_event);
                     }
                 );
             },
-            'url_prefix' : xulG.url_prefix,
+            'url_prefix': xulG.url_prefix,
         };
         content_params.new_tab = xulG.new_tab;
         content_params.set_tab = xulG.set_tab;
@@ -667,14 +602,9 @@ function set_opac() {
         content_params.get_barcode_and_settings = xulG.get_barcode_and_settings;
 
         if (opac_url) {
-            content_params.url = xulG.url_prefix( opac_url, true );
+            content_params.url = xulG.url_prefix(opac_url, true);
         } else {
-            var sortMethod = g.data.browse_sort_default;
-                       if(!g.data.browse_sort_default){
-                               sortMethod = 'pubdate.descending';
-                       }
-            content_params.url = xulG.url_prefix( 'browser', true );
-                       content_params.url += '?sort='+ sortMethod;
+            content_params.url = xulG.url_prefix('browser', true);
         }
         if (g.data.adv_pane) {
             // For fun, we can have no extra params, extra params with &, or extra params with ;.
@@ -686,23 +616,23 @@ function set_opac() {
                 content_params.url += ';';
             content_params.url += 'pane=' + g.data.adv_pane;
         }
-        browser_frame = bottom_pane.set_iframe( xulG.url_prefix('XUL_BROWSER?name=Catalog'), {}, content_params);
+        browser_frame = bottom_pane.set_iframe(xulG.url_prefix('XUL_BROWSER?name=Catalog'), {}, content_params);
         /* // Remember to use the REMOTE_BROWSER if we ever try to move this to remote xul again
         browser_frame = bottom_pane.set_iframe( xulG.url_prefix('XUL_REMOTE_BROWSER?name=Catalog'), {}, content_params);
         */
-    } catch(E) {
-        g.error.sdump('D_ERROR','set_opac: ' + E);
+    } catch (E) {
+        g.error.sdump('D_ERROR', 'set_opac: ' + E);
     }
     opac_wrapper_set_help_context();
     opac_browser = bottom_pane.get_contentWindow();
-    opac_browser.addEventListener('load',opac_wrapper_set_help_context,false);
+    opac_browser.addEventListener('load', opac_wrapper_set_help_context, false);
 }
 
-xulG.reload_opac = function() {
+xulG.reload_opac = function () {
     try {
         JSAN.use('util.widgets');
         opac_browser.g.browser.reload();
-    } catch(E) {
+    } catch (E) {
         g.error.sdump("D_ERROR", 'error reloading opac: ' + E + '\n');
     }
 }
@@ -710,10 +640,10 @@ xulG.reload_opac = function() {
 function set_serctrl_view() {
     g.view = 'serctrl_view';
     if (serctrl_view_reset) {
-        bottom_pane.reset_iframe( xulG.url_prefix( 'XUL_SERIAL_SERCTRL_MAIN?docid=' ) + window.encodeURIComponent(docid), {}, xulG);
-        serctrl_view_reset =false;
+        bottom_pane.reset_iframe(xulG.url_prefix('XUL_SERIAL_SERCTRL_MAIN?docid=') + window.encodeURIComponent(docid), {}, xulG);
+        serctrl_view_reset = false;
     } else {
-        bottom_pane.set_iframe( xulG.url_prefix( 'XUL_SERIAL_SERCTRL_MAIN?docid=' ) + window.encodeURIComponent(docid), {}, xulG);
+        bottom_pane.set_iframe(xulG.url_prefix('XUL_SERIAL_SERCTRL_MAIN?docid=') + window.encodeURIComponent(docid), {}, xulG);
     }
 }
 
@@ -723,7 +653,7 @@ function create_mfhd() {
         var bibObj = g.network.request(
             api.FM_BRE_RETRIEVE_VIA_ID.app,
             api.FM_BRE_RETRIEVE_VIA_ID.method,
-            [ ses(), [docid] ]
+            [ses(), [docid]]
         );
 
         bibObj = bibObj[0];
@@ -731,15 +661,15 @@ function create_mfhd() {
         var cbsObj = g.network.request(
             api.FM_CBS_RETRIEVE_VIA_PCRUD.app,
             api.FM_CBS_RETRIEVE_VIA_PCRUD.method,
-            [ ses(), bibObj.source() ]
+            [ses(), bibObj.source()]
         );
 
         if (cbsObj && cbsObj.can_have_copies() != get_db_true()) {
             alert(document.getElementById('offlineStrings').getFormattedString('staff.cat.bib_source.can_have_copies.false', [cbsObj.source()]));
             return;
         }
-    } catch(E) {
-        g.error.sdump('D_ERROR','can have copies check: ' + E);
+    } catch (E) {
+        g.error.sdump('D_ERROR', 'can have copies check: ' + E);
         alert('Error in chrome/content/cat/opac.js, create_mfhd(): ' + E);
         return;
     }
@@ -750,21 +680,21 @@ function create_mfhd() {
             xulG.url_prefix('XUL_SERIAL_SELECT_AOU'),
             '_blank',
             'chrome,resizable,modal,centerscreen',
-            {'server_unadorned' : g.data.server_unadorned}
+            { 'server_unadorned': g.data.server_unadorned }
         );
         if (!select_aou_window.create_mfhd_aou) {
             return;
         }
         var r = g.network.simple_request(
-                'MFHD_XML_RECORD_CREATE',
-                [ ses(), 1, select_aou_window.create_mfhd_aou, docid ]
-            );
+            'MFHD_XML_RECORD_CREATE',
+            [ses(), 1, select_aou_window.create_mfhd_aou, docid]
+        );
         if (typeof r.ilsevent != 'undefined') {
-            throw(r);
+            throw (r);
         }
         alert("MFHD record created."); //TODO: better success message
         xulG.reload_opac(); // browser_frame.contentWindow.g.browser.controller.view.cmd_reload.doCommand();
-    } catch(E) {
+    } catch (E) {
         g.error.standard_unexpected_error_alert("Create MFHD failed", E); //TODO: better error handling
     }
 }
@@ -778,11 +708,11 @@ function delete_mfhd(sre_id) {
         null,
         document.getElementById('offlineStrings').getString('cat.opac.record_deleted.confirm')) == 0) {
         var robj = g.network.request(
-                'open-ils.permacrud',
-                'open-ils.permacrud.delete.sre',
-                [ses(),sre_id]);
+            'open-ils.permacrud',
+            'open-ils.permacrud.delete.sre',
+            [ses(), sre_id]);
         if (typeof robj.ilsevent != 'undefined') {
-            alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error',  [docid, robj.textcode, robj.desc]) + '\n');
+            alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error', [docid, robj.textcode, robj.desc]) + '\n');
         } else {
             alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted'));
             xulG.reload_opac(); // browser_frame.contentWindow.g.browser.controller.view.cmd_reload.doCommand();
@@ -793,14 +723,14 @@ function delete_mfhd(sre_id) {
 function open_mfhd_editor(sre_id) {
     try {
         var r = g.network.simple_request(
-                'FM_SRE_RETRIEVE',
-                [ ses(), sre_id ]
-              );
+            'FM_SRE_RETRIEVE',
+            [ses(), sre_id]
+        );
         if (typeof r.ilsevent != 'undefined') {
-            throw(r);
+            throw (r);
         }
         open_marc_editor(r, 'MFHD');
-    } catch(E) {
+    } catch (E) {
         g.error.standard_unexpected_error_alert("Create MFHD failed", E); //TODO: better error handling
     }
 }
@@ -810,13 +740,13 @@ function open_marc_editor(rec, label) {
     var initHeight = self.outerHeight - 40;
     /* Setting an explicit height results in a super skinny window, so fix that up */
     var initWidth = self.outerWidth / 2;
-    win = window.open( xulG.url_prefix('XUL_MARC_EDIT'), '', 'chrome,resizable,height=' + initHeight + ',width=' + initWidth );
+    win = window.open(xulG.url_prefix('XUL_MARC_EDIT'), '', 'chrome,resizable,height=' + initHeight + ',width=' + initWidth);
 
     win.xulG = {
-        record : {marc : rec.marc()},
-        save : {
+        record: { marc: rec.marc() },
+        save: {
             label: 'Save ' + label,
-            func: function(xmlString) {  // TODO: switch to pcrud, or define an sre update method in Serial.pm?
+            func: function (xmlString) {  // TODO: switch to pcrud, or define an sre update method in Serial.pm?
                 var method = 'open-ils.permacrud.update.' + rec.classname;
                 rec.marc(xmlString);
                 g.network.request(
@@ -832,7 +762,7 @@ function open_marc_editor(rec, label) {
 function bib_in_new_tab() {
     try {
         var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href;
-        var content_params = { 'session' : ses(), 'authtime' : ses('authtime'), 'opac_url' : url };
+        var content_params = { 'session': ses(), 'authtime': ses('authtime'), 'opac_url': url };
         content_params.url_prefix = xulG.url_prefix;
         content_params.new_tab = xulG.new_tab;
         content_params.set_tab = xulG.set_tab;
@@ -857,14 +787,14 @@ function bib_in_new_tab() {
         content_params.get_barcode_and_settings = xulG.get_barcode_and_settings;
 
         xulG.new_tab(xulG.url_prefix('XUL_OPAC_WRAPPER'), {}, content_params);
-    } catch(E) {
-        g.error.sdump('D_ERROR',E);
+    } catch (E) {
+        g.error.sdump('D_ERROR', E);
     }
 }
 
 function batch_receive_in_new_tab() {
     try {
-        var content_params = {"session": ses(), "authtime": ses("authtime")};
+        var content_params = { "session": ses(), "authtime": ses("authtime") };
 
         ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab",
             "set_patron_tab", "volume_item_creator", "get_new_session",
@@ -872,11 +802,11 @@ function batch_receive_in_new_tab() {
             "url_prefix", "network_meter", "page_meter", "set_statusbar",
             "set_help_context", "get_barcode", "reload_opac",
             "get_barcode_and_settings"
-        ].forEach(function(k) { content_params[k] = xulG[k]; });
+        ].forEach(function (k) { content_params[k] = xulG[k]; });
 
         xulG.new_tab(
             xulG.url_prefix('XUL_SERIAL_BATCH_RECEIVE?docid=') +
-                window.encodeURIComponent(docid), {
+            window.encodeURIComponent(docid), {
                 "tab_name": $("offlineStrings").getString(
                     "menu.cmd_serial_batch_receive.tab"
                 )
@@ -888,11 +818,10 @@ function batch_receive_in_new_tab() {
 }
 
 function remove_me() {
-    var url = xulG.url_prefix( 'XUL_BIB_BRIEF?docid=' ) + window.encodeURIComponent(docid);
+    var url = xulG.url_prefix('XUL_BIB_BRIEF?docid=') + window.encodeURIComponent(docid);
     dump('removing ' + url + '\n');
-    try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
-    $('top_pane').removeAttribute('height');
-    $('nav').setAttribute('hidden','true');
+    try { top_pane.remove_iframe(url); } catch (E) { dump(E + '\n'); }
+    $('nav').setAttribute('hidden', 'true');
 }
 
 function add_to_bucket() {
@@ -902,7 +831,7 @@ function add_to_bucket() {
         '_blank',
         'chrome,resizable,modal,centerscreen',
         {
-            record_ids: [ docid ]
+            record_ids: [docid]
         }
     );
 }
@@ -912,27 +841,27 @@ function add_to_bucket() {
 function mark_for_overlay() {
     g.data.marked_record = docid;
     g.data.stash('marked_record');
-    var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]);
+    var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative', [docid]);
     if (typeof robj.ilsevent == 'undefined') {
         g.data.marked_record_mvr = robj;
     } else {
         g.data.marked_record_mvr = null;
-        g.error.standard_unexpected_error_alert('in mark_for_overlay',robj);
+        g.error.standard_unexpected_error_alert('in mark_for_overlay', robj);
     }
     g.data.stash('marked_record_mvr');
     if (g.data.marked_record_mvr) {
-        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.tcn.alert',[ g.data.marked_record_mvr.tcn() ]));
+        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.tcn.alert', [g.data.marked_record_mvr.tcn()]));
         xulG.set_statusbar(
             1,
-            $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.tcn.label',[g.data.marked_record_mvr.tcn()]),
-            $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label',[g.data.marked_record]),
+            $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.tcn.label', [g.data.marked_record_mvr.tcn()]),
+            $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label', [g.data.marked_record]),
             gen_statusbar_click_handler('marked_record')
         );
     } else {
-        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.record_id.alert',[ g.data.marked_record  ]));
+        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.record_id.alert', [g.data.marked_record]));
         xulG.set_statusbar(
             1,
-            $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label',[g.data.marked_record]),
+            $("offlineStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label', [g.data.marked_record]),
             '',
             gen_statusbar_click_handler('marked_record')
         );
@@ -942,16 +871,16 @@ function mark_for_overlay() {
 function mark_for_hold_transfer() {
     g.data.marked_record_for_hold_transfer = docid;
     g.data.stash('marked_record_for_hold_transfer');
-    var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]);
+    var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative', [docid]);
     if (typeof robj.ilsevent == 'undefined') {
         g.data.marked_record_for_hold_transfer_mvr = robj;
     } else {
         g.data.marked_record_for_hold_transfer_mvr = null;
-        g.error.standard_unexpected_error_alert('in mark_for_hold_transfer',robj);
+        g.error.standard_unexpected_error_alert('in mark_for_hold_transfer', robj);
     }
     g.data.stash('marked_record_for_hold_transfer_mvr');
     if (g.data.marked_record_mvr) {
-        var m = $("offlineStrings").getFormattedString('staff.cat.opac.marked_record_for_hold_transfer_indicator.tcn.label',[g.data.marked_record_for_hold_transfer_mvr.tcn()]);
+        var m = $("offlineStrings").getFormattedString('staff.cat.opac.marked_record_for_hold_transfer_indicator.tcn.label', [g.data.marked_record_for_hold_transfer_mvr.tcn()]);
         alert(m);
         xulG.set_statusbar(
             3,
@@ -960,7 +889,7 @@ function mark_for_hold_transfer() {
             gen_statusbar_click_handler('marked_record_for_hold_transfer')
         );
     } else {
-        var m = $("offlineStrings").getFormattedString('staff.cat.opac.marked_record_for_hold_transfer_indicator.record_id.label',[g.data.marked_record_for_hold_transfer]);
+        var m = $("offlineStrings").getFormattedString('staff.cat.opac.marked_record_for_hold_transfer_indicator.record_id.label', [g.data.marked_record_for_hold_transfer]);
         alert(m);
         xulG.set_statusbar(
             3,
@@ -971,26 +900,6 @@ function mark_for_hold_transfer() {
     }
 }
 
-function mark_for_li_transfer() {
-    g.data.marked_record_for_li_transfer = docid;
-    g.data.stash('marked_record_for_li_transfer');
-
-    var mvr = g.network.simple_request(
-        'MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]);
-
-    var msg = $("offlineStrings").getFormattedString(
-        'staff.cat.opac.marked_record_for_li_transfer_indicator.tcn.label', 
-        [mvr.tcn()]
-    );
-
-    alert(msg);
-
-    xulG.set_statusbar(
-        3, msg, '',
-        gen_statusbar_click_handler('marked_record_for_li_transfer')
-    );
-}
-
 function transfer_title_holds() {
     g.data.stash_retrieve();
     var target = g.data.marked_record_for_hold_transfer;
@@ -999,7 +908,7 @@ function transfer_title_holds() {
         alert(m);
         return;
     }
-    var robj = g.network.simple_request('TRANSFER_TITLE_HOLDS',[ ses(), target, [ docid ] ]);
+    var robj = g.network.simple_request('TRANSFER_TITLE_HOLDS', [ses(), target, [docid]]);
     if (robj == 1) {
         var m = $("offlineStrings").getString('staff.cat.opac.title_for_hold_transfer.success.label');
         alert(m);
@@ -1019,9 +928,9 @@ function delete_record() {
         document.getElementById('offlineStrings').getString('cat.opac.cancel'),
         null,
         document.getElementById('offlineStrings').getString('cat.opac.record_deleted.confirm')) == 0) {
-        var robj = g.network.simple_request('FM_BRE_DELETE',[ses(),docid]);
+        var robj = g.network.simple_request('FM_BRE_DELETE', [ses(), docid]);
         if (typeof robj.ilsevent != 'undefined') {
-            alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error',  [docid, robj.textcode, robj.desc]) + '\n');
+            alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error', [docid, robj.textcode, robj.desc]) + '\n');
         } else {
             alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted'));
             refresh_display(docid);
@@ -1038,9 +947,9 @@ function undelete_record() {
         null,
         document.getElementById('offlineStrings').getString('cat.opac.record_undeleted.confirm')) == 0) {
 
-        var robj = g.network.simple_request('FM_BRE_UNDELETE',[ses(),docid]);
+        var robj = g.network.simple_request('FM_BRE_UNDELETE', [ses(), docid]);
         if (typeof robj.ilsevent != 'undefined') {
-            alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_undeleted.error',  [docid, robj.textcode, robj.desc]) + '\n');
+            alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_undeleted.error', [docid, robj.textcode, robj.desc]) + '\n');
         } else {
             alert(document.getElementById('offlineStrings').getString('cat.opac.record_undeleted'));
             refresh_display(docid);
@@ -1057,42 +966,42 @@ function refresh_display(id) {
         manage_parts_reset = true;
         manage_multi_home_reset = true;
         serctrl_view_reset = true;
-        while(top_pane.node.lastChild) top_pane.node.removeChild( top_pane.node.lastChild );
+        while (top_pane.node.lastChild) top_pane.node.removeChild(top_pane.node.lastChild);
         var children = bottom_pane.node.childNodes;
         for (var i = 0; i < children.length; i++) {
             if (children[i] != browser_frame) bottom_pane.node.removeChild(children[i]);
         }
 
         set_brief_view();
-        $('nav').setAttribute('hidden','false');
+        $('nav').setAttribute('hidden', 'false');
         var settings = g.network.simple_request(
             'FM_AUS_RETRIEVE',
-            [ ses(), g.data.list.au[0].id() ]
+            [ses(), g.data.list.au[0].id()]
         );
         var view = settings['staff_client.catalog.record_view.default'];
         if (g.view_override) {
             view = g.view_override;
             g.view_override = null;
         }
-        switch(view) {
-            case 'marc_view' : set_marc_view(); break;
-            case 'marc_edit' : set_marc_edit(); break;
-            case 'copy_browser' : set_copy_browser(); break;
-            case 'hold_browser' : set_hold_browser(); break;
-            case 'serctrl_view' : set_serctrl_view(); break;
-            case 'opac' :
+        switch (view) {
+            case 'marc_view': set_marc_view(); break;
+            case 'marc_edit': set_marc_edit(); break;
+            case 'copy_browser': set_copy_browser(); break;
+            case 'hold_browser': set_hold_browser(); break;
+            case 'serctrl_view': set_serctrl_view(); break;
+            case 'opac':
             default: set_opac(); break;
         }
         opac_wrapper_set_help_context();
-    } catch(E) {
-        g.error.standard_unexpected_error_alert('in refresh_display',E);
+    } catch (E) {
+        g.error.standard_unexpected_error_alert('in refresh_display', E);
     }
 }
 
 function set_default() {
     var robj = g.network.simple_request(
         'FM_AUS_UPDATE',
-        [ ses(), g.data.list.au[0].id(), { 'staff_client.catalog.record_view.default' : g.view } ]
+        [ses(), g.data.list.au[0].id(), { 'staff_client.catalog.record_view.default': g.view }]
     )
     if (typeof robj.ilsevent != 'undefined') {
         if (robj.ilsevent != 0) g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString('cat.preference.error'), robj);
@@ -1109,15 +1018,15 @@ function add_volumes() {
                 [
                     ses(),
                     ses('staff_id'),
-                    [ ses('ws_ou') ],
-                    [ 'CREATE_VOLUME', 'CREATE_COPY' ]
+                    [ses('ws_ou')],
+                    ['CREATE_VOLUME', 'CREATE_COPY']
                 ]
             ).length == 0 ? 1 : 0;
-        } catch(E) {
-            g.error.sdump('D_ERROR','batch permission check: ' + E);
+        } catch (E) {
+            g.error.sdump('D_ERROR', 'batch permission check: ' + E);
         }
 
-        if (edit==0) {
+        if (edit == 0) {
             alert(document.getElementById('offlineStrings').getString('staff.circ.copy_status.add_volumes.perm_failure'));
             return; // no read-only view for this interface
         }
@@ -1127,23 +1036,23 @@ function add_volumes() {
             var bibObj = g.network.request(
                 api.FM_BRE_RETRIEVE_VIA_ID.app,
                 api.FM_BRE_RETRIEVE_VIA_ID.method,
-                               [ ses(), [docid] ]
+                [ses(), [docid]]
             );
 
-                       bibObj = bibObj[0];
+            bibObj = bibObj[0];
 
             var cbsObj = g.network.request(
                 api.FM_CBS_RETRIEVE_VIA_PCRUD.app,
                 api.FM_CBS_RETRIEVE_VIA_PCRUD.method,
-                [ ses(), bibObj.source() ]
+                [ses(), bibObj.source()]
             );
 
             if (cbsObj && cbsObj.can_have_copies() != get_db_true()) {
                 alert(document.getElementById('offlineStrings').getFormattedString('staff.cat.bib_source.can_have_copies.false', [cbsObj.source()]));
                 return;
             }
-        } catch(E) {
-            g.error.sdump('D_ERROR','can have copies check: ' + E);
+        } catch (E) {
+            g.error.sdump('D_ERROR', 'can have copies check: ' + E);
             alert('Error in chrome/content/cat/opac.js, add_volumes(): ' + E);
             return;
         }
@@ -1151,20 +1060,20 @@ function add_volumes() {
         var title = document.getElementById('offlineStrings').getFormattedString('staff.circ.copy_status.add_volumes.title', [docid]);
 
         var url;
-        var unified_interface = String( g.data.hash.aous['ui.unified_volume_copy_editor'] ) == 'true';
+        var unified_interface = String(g.data.hash.aous['ui.unified_volume_copy_editor']) == 'true';
         if (unified_interface) {
-            var horizontal_interface = String( g.data.hash.aous['ui.cat.volume_copy_editor.horizontal'] ) == 'true';
-            url = window.xulG.url_prefix( horizontal_interface ? 'XUL_VOLUME_COPY_CREATOR_HORIZONTAL' : 'XUL_VOLUME_COPY_CREATOR' );
+            var horizontal_interface = String(g.data.hash.aous['ui.cat.volume_copy_editor.horizontal']) == 'true';
+            url = window.xulG.url_prefix(horizontal_interface ? 'XUL_VOLUME_COPY_CREATOR_HORIZONTAL' : 'XUL_VOLUME_COPY_CREATOR');
         } else {
-            url = window.xulG.url_prefix( 'XUL_VOLUME_COPY_CREATOR_ORIGINAL' );
+            url = window.xulG.url_prefix('XUL_VOLUME_COPY_CREATOR_ORIGINAL');
         }
 
         var w = xulG.new_tab(
             url,
-            { 'tab_name' : title },
-            { 'doc_id' : docid, 'ou_ids' : [ ses('ws_ou') ], 'reload_opac' : xulG.reload_opac }
+            { 'tab_name': title },
+            { 'doc_id': docid, 'ou_ids': [ses('ws_ou')], 'reload_opac': xulG.reload_opac }
         );
-    } catch(E) {
+    } catch (E) {
         alert('Error in chrome/content/cat/opac.js, add_volumes(): ' + E);
     }
 }
@@ -1176,14 +1085,14 @@ function manage_parts() {
             window.xulG.url_prefix('CONIFY_MANAGE_PARTS?r=') + docid
         );
         if (manage_parts_reset) {
-            bottom_pane.reset_iframe( loc,{},xulG);
-            manage_parts_reset =false;
+            bottom_pane.reset_iframe(loc, {}, xulG);
+            manage_parts_reset = false;
         } else {
-            bottom_pane.set_iframe( loc,{},xulG);
+            bottom_pane.set_iframe(loc, {}, xulG);
         }
         opac_wrapper_set_help_context();
-        bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
-    } catch(E) {
+        bottom_pane.get_contentWindow().addEventListener('load', opac_wrapper_set_help_context, false);
+    } catch (E) {
         alert('Error in chrome/content/cat/opac.js, manage_parts(): ' + E);
     }
 }
@@ -1193,14 +1102,14 @@ function manage_multi_home_items() {
         g.view = 'manage_multi_home';
         var loc = window.xulG.url_prefix('MANAGE_MULTI_HOME_ITEMS');
         if (manage_multi_home_reset) {
-            bottom_pane.reset_iframe( loc,{},{'docid':docid,'no_bib_summary':true,'url_prefix':xulG.url_prefix,'new_tab':xulG.new_tab});
-            manage_multi_home_reset =false;
+            bottom_pane.reset_iframe(loc, {}, { 'docid': docid, 'no_bib_summary': true, 'url_prefix': xulG.url_prefix, 'new_tab': xulG.new_tab });
+            manage_multi_home_reset = false;
         } else {
-            bottom_pane.set_iframe( loc,{},{'docid':docid,'no_bib_summary':true,'url_prefix':xulG.url_prefix,'new_tab':xulG.new_tab});
+            bottom_pane.set_iframe(loc, {}, { 'docid': docid, 'no_bib_summary': true, 'url_prefix': xulG.url_prefix, 'new_tab': xulG.new_tab });
         }
         opac_wrapper_set_help_context();
-        bottom_pane.get_contentWindow().addEventListener('load',opac_wrapper_set_help_context,false);
-    } catch(E) {
+        bottom_pane.get_contentWindow().addEventListener('load', opac_wrapper_set_help_context, false);
+    } catch (E) {
         alert('Error in chrome/content/cat/opac.js, manage_multi_home_items(): ' + E);
     }
 }
@@ -1208,28 +1117,28 @@ function manage_multi_home_items() {
 function mark_for_multi_home() {
     g.data.marked_multi_home_record = docid;
     g.data.stash('marked_multi_home_record');
-    var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]);
+    var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative', [docid]);
     if (typeof robj.ilsevent == 'undefined') {
         g.data.marked_multi_home_record_mvr = robj;
     } else {
         g.data.marked_multi_home_record_mvr = null;
-        g.error.standard_unexpected_error_alert('in mark_for_multi_home',robj);
+        g.error.standard_unexpected_error_alert('in mark_for_multi_home', robj);
     }
     g.data.stash('marked_multi_home_record_mvr');
 
     if (g.data.marked_multi_home_record_mvr) {
-        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_multi_home.tcn.alert',[ g.data.marked_multi_home_record_mvr.tcn() ]));
+        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_multi_home.tcn.alert', [g.data.marked_multi_home_record_mvr.tcn()]));
         xulG.set_statusbar(
             2,
-            $("offlineStrings").getFormattedString('staff.cat.copy_browser.marked_record_for_multi_home_indicator.tcn.label',[g.data.marked_multi_home_record_mvr.tcn()]),
-            $("offlineStrings").getFormattedString('staff.cat.copy_browser.marked_record_for_multi_home_indicator.record_id.label',[g.data.marked_multi_home_record]),
+            $("offlineStrings").getFormattedString('staff.cat.copy_browser.marked_record_for_multi_home_indicator.tcn.label', [g.data.marked_multi_home_record_mvr.tcn()]),
+            $("offlineStrings").getFormattedString('staff.cat.copy_browser.marked_record_for_multi_home_indicator.record_id.label', [g.data.marked_multi_home_record]),
             gen_statusbar_click_handler('marked_multi_home_record')
         );
     } else {
-        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_multi_home.record_id.alert',[ g.data.marked_multi_home_record ]));
+        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_multi_home.record_id.alert', [g.data.marked_multi_home_record]));
         xulG.set_statusbar(
             2,
-            $("offlineStrings").getFormattedString('staff.cat.copy_browser.marked_record_for_multi_home_indicator.record_id.label',[g.data.marked_multi_home_record]),
+            $("offlineStrings").getFormattedString('staff.cat.copy_browser.marked_record_for_multi_home_indicator.record_id.label', [g.data.marked_multi_home_record]),
             '',
             gen_statusbar_click_handler('marked_multi_home_record')
         );
@@ -1239,29 +1148,29 @@ function mark_for_multi_home() {
 function gen_statusbar_click_handler(data_key) {
     return function (ev) {
 
-        if (! g.data[data_key]) {
+        if (!g.data[data_key]) {
             return;
         }
 
         if (ev.button == 0 /* left click, spawn opac */) {
-            var opac_url = xulG.url_prefix( 'opac_rdetail' ) + g.data[data_key];
+            var opac_url = xulG.url_prefix('opac_rdetail') + g.data[data_key];
             var content_params = {
-                'session' : ses(),
-                'authtime' : ses('authtime'),
-                'opac_url' : opac_url,
+                'session': ses(),
+                'authtime': ses('authtime'),
+                'opac_url': opac_url,
             };
             xulG.new_tab(
                 xulG.url_prefix('XUL_OPAC_WRAPPER'),
-                {'tab_name':'Retrieving title...'},
+                { 'tab_name': 'Retrieving title...' },
                 content_params
             );
         }
 
         if (ev.button == 2 /* right click, remove mark */) {
-            if ( window.confirm( document.getElementById('offlineStrings').getString('cat.opac.clear_statusbar') ) ) {
+            if (window.confirm(document.getElementById('offlineStrings').getString('cat.opac.clear_statusbar'))) {
                 g.data[data_key] = null;
                 g.data.stash(data_key);
-                ev.target.setAttribute('label','');
+                ev.target.setAttribute('label', '');
                 if (ev.target.hasAttribute('tooltiptext')) {
                     ev.target.removeAttribute('tooltiptext');
                 }
@@ -1285,7 +1194,7 @@ function record_action(action_function) {
                 }
             }
         }
-            
+
         return action_function.apply(null, args);
     }
 }
@@ -1310,11 +1219,11 @@ function safe_to_proceed() {
 
         if ((in_marc_edit != true) || (marc_edit_changed != true)) {
             if (typeof xulG.is_tab_locked == 'undefined') { return true; }
-            if (! xulG.is_tab_locked()) { return true; }
+            if (!xulG.is_tab_locked()) { return true; }
         }
         var r = window.confirm(
             document.getElementById('offlineStrings').getString(
-               'generic.unsaved_data_warning'
+                'generic.unsaved_data_warning'
             )
         );
 
@@ -1323,7 +1232,7 @@ function safe_to_proceed() {
         //in cmd_search_tcn
         if (r) {
             if (typeof xulG.unlock_tab === 'function') {
-                while ( xulG.unlock_tab() > 0 ) {};
+                while (xulG.unlock_tab() > 0) { };
             }
 
             return true;
index 6b2a669..ab5eb3f 100644 (file)
@@ -1,4 +1,4 @@
-dump('entering util/error.js\n');
+console.log('entering util/error.js\n');
 
 if (typeof util == 'undefined') util = {};
 util.error = function () {
@@ -10,7 +10,6 @@ util.error = function () {
                 .getService(Components.interfaces.nsIConsoleService);
         } catch(E) {
             this.consoleDump = false;
-            dump('util.error constructor: ' + E + '\n');
         }
 
         this.sdump_last_time = new Date();
@@ -46,8 +45,7 @@ util.error.prototype = {
     'arg_dump_full' : false,
 
     'debug' : function(e){
-        dump('-----------------------------------------\n' 
-            + e + '\n-----------------------------------------\n' );
+        console.log(e);
     },
 
     'obj_dump' : function(s,dobj) {
@@ -189,7 +187,7 @@ util.error.prototype = {
                 }
             }
         } catch(E) {
-            dump('Calling sdump but ' + E + '\n');
+            console.log('Calling sdump but ' + E + '\n');
         }
     },
 
@@ -345,7 +343,7 @@ util.error.prototype = {
             c    = Text for confirmation checkbox.  null for no confirm
         */
 
-        dump('yns_alert:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
+        console.log('yns_alert:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
 
         // Check to see if we are in pre-cat checkout so we don't strip out html code
         var barcode_number = s.match(/\d+/);
@@ -396,8 +394,7 @@ util.error.prototype = {
         }
 
         } catch(E) {
-
-            dump('yns_alert failed: ' + E + '\ns = ' + s + '\ntitle = ' + title + '\nb1 = ' + b1 + '\nb2 = ' + b2 + '\nb3 = ' + b3 + '\nc = ' + c + '\nimage = ' + image + '\n');
+            console.log('yns_alert failed: ' + E + '\ns = ' + s + '\ntitle = ' + title + '\nb1 = ' + b1 + '\nb2 = ' + b2 + '\nb3 = ' + b3 + '\nc = ' + c + '\nimage = ' + image + '\n');
 
             this.yns_alert_original(s + '\n\nAlso, yns_alert failed: ' + E,title,b1,b2,b3,c);
 
@@ -422,7 +419,7 @@ util.error.prototype = {
             c    = Text for confirmation checkbox.  null for no confirm
         */
 
-        dump('yns_alert_formatted:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
+        console.log('yns_alert_formatted:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
 
         //FIXME - is that good enough of an escape job?
         s = s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
@@ -487,7 +484,7 @@ util.error.prototype = {
             c    = Text for confirmation checkbox.  null for no confirm
         */
 
-        dump('yns_alert_original:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
+        console.log('yns_alert_original:\n\ts = ' + s + '\n\ttitle = ' + title + '\n\tb1 = ' + b1 + '\n\tb2 = ' + b2 + '\n\tb3 = ' + b3 + '\n\tc = ' + c + '\n');
 
         if (this.sound) { this.sound.bad(); }
 
@@ -644,4 +641,4 @@ util.error.prototype = {
     } 
 }
 
-dump('exiting util/error.js\n');
+console.log('exiting util/error.js\n');
index 9617e61..3001f95 100644 (file)
@@ -1,4 +1,4 @@
-dump('entering util/network.js\n');
+console.log('entering util/network.js\n');
 // vim:noet:sw=4:ts=4:
 
 var offlineStrings;
@@ -63,7 +63,7 @@ util.network.prototype = {
                 if (instanceOf(E, NetworkFailure)) {
                     obj.NETWORK_FAILURE = E;
                 } else {
-                    try { obj.NETWORK_FAILURE = js2JSON(E); } catch(F) { dump(F + '\n'); obj.NETWORK_FAILURE = E; };
+                    try { obj.NETWORK_FAILURE = js2JSON(E); } catch(F) { console.log(F + '\n'); obj.NETWORK_FAILURE = E; };
                 }
             } catch(I) { 
                 obj.NETWORK_FAILURE = offlineStrings.getString('network.unknown_status');
@@ -259,17 +259,17 @@ util.network.prototype = {
                     );
                     if (r == 1) {
                         data.proceed_offline = true; data.stash('proceed_offline');
-                        dump('Remembering proceed_offline for 200000 ms.\n');
+                        console.log('Remembering proceed_offline for 200000 ms.\n');
                         setTimeout(
                             function() {
                                 data.proceed_offline = false; data.stash('proceed_offline');
-                                dump('Setting proceed_offline back to false.\n');
+                                console.log('Setting proceed_offline back to false.\n');
                             }, 200000
                         );
                     }
                 }
 
-                dump( r == 0 ? 'Retry Network\n' : 'Ignore Errors\n' );
+                console.log( r == 0 ? 'Retry Network\n' : 'Ignore Errors\n' );
 
                 switch(r) {
                     case 0: 
@@ -580,7 +580,7 @@ util.network.prototype = {
 
             var args = [];
 
-            dump('process.run = ' + process.run(true, args, args.length) + '\n');
+            console.log('process.run = ' + process.run(true, args, args.length) + '\n');
 
             file.close();
 
@@ -611,7 +611,7 @@ util.network.prototype = {
                 }
             }
         } catch(E) {
-            dump('Error in network.js, play_sounds() : ' + E + '\n');
+            console.log('Error in network.js, play_sounds() : ' + E + '\n');
         }
     }
 }
@@ -622,4 +622,4 @@ function sample_callback(request) {
 }
 */
 
-dump('exiting util/network.js\n');
+console.log('exiting util/network.js\n');
index f576eaf..54376a9 100644 (file)
@@ -1,4 +1,4 @@
-dump('entering util/sound.js\n');
+console.log('entering util/sound.js\n');
 
 if (typeof util == 'undefined') util = {};
 util.sound = function (params) {
@@ -13,10 +13,10 @@ util.sound = function (params) {
         /* We're going to turn this guy into a singleton, at least for a given window, and look for it in xulG */
         if (! window.xulG) { window.xulG = {}; }
         if (window.xulG._sound && !params.reuse_queue_from_this_snd_obj) { 
-            dump('SOUND('+this.sig+'): reusing sound from ' + window.xulG._sound.origin + '('+xulG._sound.sig+') for ' + location.pathname + '\n');
+            console.log('SOUND('+this.sig+'): reusing sound from ' + window.xulG._sound.origin + '('+xulG._sound.sig+') for ' + location.pathname + '\n');
             return window.xulG._sound; 
         } else {
-            dump('SOUND('+this.sig+'): instantiating new sound for ' + location.pathname + '\n');
+            console.log('SOUND('+this.sig+'): instantiating new sound for ' + location.pathname + '\n');
         }
 
         /* So we can queue up sounds and put a pause between them instead of having them trample over each other */
@@ -34,7 +34,7 @@ util.sound = function (params) {
             if (!delay) { delay = _sound_delay_interval; /* define this in server/skin/custom.js */ }
             if (!delay) { delay = 2000; }
             var intervalId = this._exec.timer( this._funcs, delay );
-            dump('SOUND('+this.sig+'): starting timer with intervalId = ' + intervalId + '\n');
+            console.log('SOUND('+this.sig+'): starting timer with intervalId = ' + intervalId + '\n');
         }
 
         var SOUNDContractID = "@mozilla.org/sound;1";
@@ -48,7 +48,7 @@ util.sound = function (params) {
         return this;
 
     } catch(E) {
-        dump('error in util.sound constructor: ' + E + '\n');
+        console.log('error in util.sound constructor: ' + E + '\n');
         return this;
     }
 };
@@ -80,65 +80,65 @@ util.sound.prototype = {
             if (typeof data.no_sound == 'undefined' || data.no_sound == false || data.no_sound == 'false') {
 
                 if (obj._queue) {
-                    dump('SOUND('+obj.sig+'): queueing file = ' + url + '\n');
+                    console.log('SOUND('+obj.sig+'): queueing file = ' + url + '\n');
                     obj._funcs.push( function() { 
-                        dump('SOUND('+obj.sig+'): playing file = ' + url + '\n');
+                        console.log('SOUND('+obj.sig+'): playing file = ' + url + '\n');
                         obj.SOUND.play( url2 ); 
                     } );
                 } else {
-                    dump('SOUND('+obj.sig+'): playing file = ' + url + '\n');
+                    console.log('SOUND('+obj.sig+'): playing file = ' + url + '\n');
                     obj.SOUND.play( url2 );
                 }
             }
         } catch(E) {
             try { if (data.no_sound == 'undefined' || data.no_sound == false || data.no_sound == 'false') obj.SOUND.beep(); } catch(F) { 
-                dump('beep(): ' + F + '\n');
+                console.log('beep(): ' + F + '\n');
             }
-            dump('play_url(): ' + E + '\n');
+            console.log('play_url(): ' + E + '\n');
         }
     },
 
     'event' : function event(evt) {
         var key = 'AUDIO_' + arguments.callee.name + '_' + evt.textcode;
-        dump('SOUND('+this.sig+'): key = ' + key + '\n');
+        console.log('SOUND('+this.sig+'): key = ' + key + '\n');
         this.play_url( urls[key] );
     },
 
     'special' : function special(e) {
         var key = 'AUDIO_' + arguments.callee.name + '_' + e;
-        dump('SOUND('+this.sig+'): key = ' + key + '\n');
+        console.log('SOUND('+this.sig+'): key = ' + key + '\n');
         this.play_url( urls[key] );
     },
 
     'good' : function good(e){
         var key = 'AUDIO_' + arguments.callee.name;
-        dump('SOUND('+this.sig+'): key = ' + key + '\n');
+        console.log('SOUND('+this.sig+'): key = ' + key + '\n');
         this.play_url( urls[key] );
     },
 
     'bad' : function bad(e){
         var key = 'AUDIO_' + arguments.callee.name;
-        dump('SOUND('+this.sig+'): key = ' + key + '\n');
+        console.log('SOUND('+this.sig+'): key = ' + key + '\n');
         this.play_url( urls[key] );
     },
 
     'horrible' : function horrible(e){
         var key = 'AUDIO_' + arguments.callee.name;
-        dump('SOUND('+this.sig+'): key = ' + key + '\n');
+        console.log('SOUND('+this.sig+'): key = ' + key + '\n');
         this.play_url( urls[key] );
     },
 
     'circ_good' : function circ_good(e){
         var key = 'AUDIO_' + arguments.callee.name;
-        dump('SOUND('+this.sig+'): key = ' + key + '\n');
+        console.log('SOUND('+this.sig+'): key = ' + key + '\n');
         this.play_url( urls[key] );
     },
 
     'circ_bad' : function circ_bad(e){
         var key = 'AUDIO_' + arguments.callee.name;
-        dump('SOUND('+this.sig+'): key = ' + key + '\n');
+        console.log('SOUND('+this.sig+'): key = ' + key + '\n');
         this.play_url( urls[key] );
     }
 }
 
-dump('exiting util/sound.js\n');
+console.log('exiting util/sound.js\n');