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

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jul 9 10:59:22 EDT 2010


Author: dbs
Date: 2010-07-09 10:59:20 -0400 (Fri, 09 Jul 2010)
New Revision: 16897

Modified:
   trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Initial support for wrapping long subfields in the MARC editor

Limitations of the current approach are that the line width is arbitrarily set
to break at 100 characters, and is only calculated on a per-subfield basis. So
if a given field contains 50 subfields, each with 90 characters, this commit
isn't going to help you. (But really... in that scenario, you're beyond help
anyway!)

Also, the double-dagger aligns itself at the top of the box rather than the
middle once the box goes into multiline mode, which is annoying; but long 505
fields that scroll ten screens to the right are more annoying, so I'll commit
this for now rather than waste more time trying to CSS it into shape.


Modified: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-07-09 14:34:47 UTC (rev 16896)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-07-09 14:59:20 UTC (rev 16897)
@@ -78,6 +78,17 @@
     );
 }
 
+function wrap_long_fields (node) {
+    var text_size = dojo.attr(node, 'size');
+    var hard_width = 100; 
+    if (text_size > hard_width) {
+        dojo.attr(node, 'multiline', 'true');
+        dojo.attr(node, 'cols', hard_width);
+        var text_rows = (text_size / hard_width) + 1;
+        dojo.attr(node, 'rows', text_rows);
+    }
+}
+
 function swap_editors () {
 
 	dojo.require('MARC.Record');
@@ -107,7 +118,6 @@
 	}
 }
 
-
 function my_init() {
     try {
 
@@ -1501,6 +1511,8 @@
             marcSubfield(sf)
         );
 
+        dojo.query('.marcSubfield', sf_box).forEach(wrap_long_fields);
+
         if (sf. at code == '' && (!current_focus || current_focus.className.match(/Ind/)))
             current_focus = sf_box.lastChild.childNodes[1];
     }



More information about the open-ils-commits mailing list