[open-ils-commits] r16884 - trunk/Open-ILS/xul/staff_client/server/cat (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 8 11:33:01 EDT 2010


Author: dbs
Date: 2010-07-08 11:32:59 -0400 (Thu, 08 Jul 2010)
New Revision: 16884

Modified:
   trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Reclaim cataloguing real estate by hiding unnecessary rows in fixed field grid editor

The fixed field grid editor currently shows blank rows for fixed field
attributes that don't apply to the currently displayed MARC record type. We
can hide these rows and offer more screen real estate for the MARC record
proper.


Modified: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-07-08 15:25:15 UTC (rev 16883)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-07-08 15:32:59 UTC (rev 16884)
@@ -346,7 +346,7 @@
     while (direction == 'up' ? row = row.previousSibling : row = row.nextSibling) {
         var children = row.childNodes;
         for (var i = 0; i <  children.length; i++) {
-			// This would be way cleaner with dojo.query()
+            // This would be way cleaner with dojo.query()
             if (row.className  == 'marcDatafieldRow') {
                 // marcSubfield lives in hbox.hbox.textbox
                 var hboxKids = children[i].childNodes;
@@ -1124,6 +1124,36 @@
 function changeFFEditor (type) {
     var grid = document.getElementById('leaderGrid');
     grid.setAttribute('type',type);
+
+    // Hide FFEditor rows that we don't need for our current type
+    // Again, this would be easier with dojo
+    var row_list = grid.childNodes;
+    var rows;
+    for (var i = 0; i < row_list.length; i++) {
+        if (row_list[i].nodeType && row_list[i].tagName == 'rows') {
+            rows = row_list[i];
+        }
+    }
+
+    // If all of the labels for a given row do not include our
+    // desired type in their set attribute, we can hide that row
+    row_list = rows.childNodes;
+    for (var i = 0; i < row_list.length; i++) {
+        if (row_list[i].nodeType && row_list[i].tagName == 'row') {
+            var label_list = row_list[i].childNodes;
+            var found_type = false;
+            for (var j = 0; j < label_list.length; j++) {
+                if (label_list[j].nodeType && 
+                        label_list[j].tagName == 'label' && 
+                        label_list[j].getAttribute('set').indexOf(type) != -1) {
+                    found_type = true;
+                }
+            }
+            if (!found_type) {
+                row_list[i].hidden = true;
+            }
+        }
+    }
 }
 
 function fillFixedFields (rec) {



More information about the open-ils-commits mailing list