From: dbs Date: Fri, 9 Jul 2010 14:59:20 +0000 (+0000) Subject: Initial support for wrapping long subfields in the MARC editor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5fb60811fb966ecee0ddc25dc1ab93edc91c1d52;p=evergreen%2Fbjwebb.git 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. git-svn-id: svn://svn.open-ils.org/ILS/trunk@16897 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index c5d417a39..8dbcb10e5 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -78,6 +78,17 @@ function xml_escape_unicode ( str ) { ); } +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 swap_editors () { } } - function my_init() { try { @@ -1501,6 +1511,8 @@ function marcDatafield (field) { marcSubfield(sf) ); + dojo.query('.marcSubfield', sf_box).forEach(wrap_long_fields); + if (sf.@code == '' && (!current_focus || current_focus.className.match(/Ind/))) current_focus = sf_box.lastChild.childNodes[1]; }