Item Status->Alternate View support for the dynamic Record Summary
authorJason Etheridge <jason@esilibrary.com>
Wed, 6 Jul 2011 18:52:53 +0000 (14:52 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 18 Jul 2011 15:26:58 +0000 (11:26 -0400)
For now, you could put something like this in server/skin/custom.js to re-configure the display:

try {

    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']);
    prefs.setCharPref(
        'oils.bib_brief.alternate_copy_summary.dynamic_grid_replacement.data',
        js2JSON([
            ['title',       'edition',  'editor'],
            ['author',      'pubdate',  'edit_date'],
            ['call_number', 'tcn',      'create_date']
        ])
    );

} catch(E) {
    dump('Error in custom.js trying to set oils.bib_brief.alternate_copy_summary.dynamic_grid_replacement.data: ' + E + '\n');
}

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/xul/staff_client/server/cat/bib_brief.js
Open-ILS/xul/staff_client/server/cat/bib_brief.xul
Open-ILS/xul/staff_client/server/cat/bib_brief_vertical.xul
Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.xul
Open-ILS/xul/staff_client/server/locale/en-US/cat.properties

index b7c5c02..d197422 100644 (file)
@@ -1,11 +1,11 @@
 var docid;
 
-function my_init(orientation) {
+function bib_brief_init(mode) {
     try {
 
         ui_init(); // JSAN, etc.
 
-        if (! orientation) { orientation = 'horizontal'; }
+        if (! mode) { mode = 'horizontal'; }
 
         JSAN.use('OpenILS.data');
         g.data = new OpenILS.data();
@@ -54,7 +54,7 @@ function my_init(orientation) {
                                 try {
                                     g.meta = req2.getResultObject()[0];
                                     set_caption();
-                                    dynamic_grid_replacement(orientation);
+                                    dynamic_grid_replacement(mode);
                                     bib_brief_overlay({
                                         'mvr' : g.mods,
                                         'bre' : g.meta
@@ -205,7 +205,7 @@ function ui_init() {
     g.error.sdump('D_TRACE','my_init() for cat_bib_brief.xul');
 }
 
-function dynamic_grid_replacement(orientation) {
+function dynamic_grid_replacement(mode) {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
     var prefs = Components.classes[
         '@mozilla.org/preferences-service;1'
@@ -213,20 +213,20 @@ function dynamic_grid_replacement(orientation) {
         Components.interfaces['nsIPrefBranch']
     );
     if (! prefs.prefHasUserValue(
-            'oils.bib_brief.'+orientation+'.dynamic_grid_replacement.data'
+            'oils.bib_brief.'+mode+'.dynamic_grid_replacement.data'
         )
     ) {
-        return;
+        return false;
     }
 
     var gridData = JSON2js(
         prefs.getCharPref(
-            'oils.bib_brief.'+orientation+'.dynamic_grid_replacement.data'
+            'oils.bib_brief.'+mode+'.dynamic_grid_replacement.data'
         )
     );
 
     var grid = document.getElementById('bib_brief_grid');
-    if (!grid) { return; }
+    if (!grid) { return false; }
 
     JSAN.use('util.widgets');
 
@@ -301,5 +301,6 @@ function dynamic_grid_replacement(orientation) {
             row.appendChild(textbox);
         }
     }
+    return true;
 }
 
index bce81b7..5cbe572 100644 (file)
@@ -22,7 +22,7 @@ vim: noet:sw=4:ts=4:
 <?xul-overlay href="/xul/server/cat/bib_brief_overlay.xul"?>
 
 <window id="cat_bib_brief_win" 
-    onload="try { my_init(); font_helper(); persist_helper(); unhide_add_volumes_button(); } catch(E) { alert(E); }"
+    onload="try { bib_brief_init(); font_helper(); persist_helper(); unhide_add_volumes_button(); } catch(E) { alert(E); }"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
index b742d20..34f7cbe 100644 (file)
@@ -22,7 +22,7 @@ vim: noet:sw=4:ts=4:
 <?xul-overlay href="/xul/server/cat/bib_brief_overlay_vertical.xul"?>
 
 <window id="cat_bib_brief_win" 
-    onload="try { my_init('vertical'); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+    onload="try { bib_brief_init('vertical'); font_helper(); persist_helper(); } catch(E) { alert(E); }"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
index af6d1c0..b7b2207 100644 (file)
@@ -120,7 +120,15 @@ function load_item() {
             // Should get back .mvr, .copy, .volume, .transit, .circ, .hold
         }
 
-        if (typeof bib_brief_overlay == 'function') bib_brief_overlay( { 'mvr' : details.mvr, 'acp' : details.copy } );
+        if (typeof dynamic_grid_replacement == 'function') {
+            dynamic_grid_replacement('alternate_copy_summary');
+        }
+        if (typeof bib_brief_overlay == 'function') {
+            bib_brief_overlay({
+                'mvr' : details.mvr,
+                'acp' : details.copy
+            });
+        }
 
         set("stat_cat_entries", '');
         set("age_protect", '');
index 2091b43..bcdf212 100644 (file)
@@ -30,6 +30,7 @@
     <scripts id="openils_util_scripts"/>
 
     <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+    <script type="text/javascript" src="/xul/server/cat/bib_brief.js"/>
     <script type="text/javascript" src="alternate_copy_summary.js"/>
 
     <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties"/>
index fb389ca..6c4eb06 100644 (file)
@@ -526,6 +526,8 @@ staff.cat.bib_brief.pubdate.label=Pub Date:
 staff.cat.bib_brief.pubdate.accesskey=
 staff.cat.bib_brief.bib_call_number.label=Bib Call #:
 staff.cat.bib_brief.bib_call_number.accesskey=
+staff.cat.bib_brief.call_number.label=Item Call #:
+staff.cat.bib_brief.ib_call_number.accesskey=
 staff.cat.bib_brief.tcn.label=TCN:
 staff.cat.bib_brief.tcn.accesskey=
 staff.cat.bib_brief.mvr_doc_id.label=Record ID: