From 32f7523f5f527316ef62d5ec700c6a9115bc3151 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 18 May 2012 08:30:08 -0400 Subject: [PATCH] LP#921142: Bring back automatic padding of short fixed fields in the GUI MARC editor Bring back automatic padding of short fixed fields in the GUI MARC editor. Also, use onblur instead of oninput, so that we've already lost focus and don't care if that happens again. Signed-off-by: Mike Rylander Signed-off-by: Remington Steed Signed-off-by: Ben Shum --- Open-ILS/web/js/dojo/MARC/FixedFields.js | 12 ++ Open-ILS/xul/staff_client/server/cat/marcedit.js | 5 - Open-ILS/xul/staff_client/server/cat/marcedit.xul | 130 +++++++++++----------- 3 files changed, 77 insertions(+), 70 deletions(-) diff --git a/Open-ILS/web/js/dojo/MARC/FixedFields.js b/Open-ILS/web/js/dojo/MARC/FixedFields.js index b4df7046ea..14027a4a01 100644 --- a/Open-ILS/web/js/dojo/MARC/FixedFields.js +++ b/Open-ILS/web/js/dojo/MARC/FixedFields.js @@ -1779,6 +1779,10 @@ if(!dojo._hasResource["MARC.FixedFields"]) { if (MARC.Record._ff_pos[field].ldr && _l) { if (MARC.Record._ff_pos[field].ldr[rtype]) { // It's in the leader val = value.substr(0, MARC.Record._ff_pos[field].ldr[rtype].len); + if (val.length < MARC.Record._ff_pos[field].ldr[rtype].len) { + //right-pad val with the appropriate default character + val += Array(MARC.Record._ff_pos[field].ldr[rtype].len - val.length + 1).join(MARC.Record._ff_pos[field].ldr[rtype].def); + } this.leader = _l.substring(0, MARC.Record._ff_pos[field].ldr[rtype].start) + val + @@ -1790,6 +1794,10 @@ if(!dojo._hasResource["MARC.FixedFields"]) { } else if (MARC.Record._ff_pos[field]._8 && _8) { if (MARC.Record._ff_pos[field]._8[rtype]) { // Nope, it's in the 008 val = value.substr(0, MARC.Record._ff_pos[field]._8[rtype].len); + if (val.length < MARC.Record._ff_pos[field]._8[rtype].len) { + //right-pad val with the appropriate default character + val += Array(MARC.Record._ff_pos[field]._8[rtype].len - val.length + 1).join(MARC.Record._ff_pos[field]._8[rtype].def); + } this.field('008').update( _8.substring(0, MARC.Record._ff_pos[field]._8[rtype].start) + val + @@ -1804,6 +1812,10 @@ if(!dojo._hasResource["MARC.FixedFields"]) { if (!val && MARC.Record._ff_pos[field]._6 && _6) { if (MARC.Record._ff_pos[field]._6[rtype]) { // ok, maybe the 006? val = value.substr(0, MARC.Record._ff_pos[field]._6[rtype].len); + if (val.length < MARC.Record._ff_pos[field]._6[rtype].len) { + //right-pad val with the appropriate default character + val += Array(MARC.Record._ff_pos[field]._6[rtype].len - val.length + 1).join(MARC.Record._ff_pos[field]._6[rtype].def); + } this.field('006').update( _6.substring(0, MARC.Record._ff_pos[field]._6[rtype].start) + val + diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 74b65599b1..ca07723173 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -1086,12 +1086,7 @@ function fillFixedFields () { } function updateFixedFields (element) { - var grid = document.getElementById('leaderGrid'); - var recGrid = document.getElementById('recGrid'); var new_value = element.value; - // Don't take focus away/adjust the record on partial changes - var length = element.getAttribute('maxlength'); - if(new_value.length < length) return true; var marc_rec = new MARC.Record ({ delimiter : '$', marcxml : xml_record.toXMLString() }); marc_rec.setFixedField(element.getAttribute('name'), new_value); diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.xul b/Open-ILS/xul/staff_client/server/cat/marcedit.xul index 203697f29d..14a829ef46 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.xul +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.xul @@ -80,157 +80,157 @@ -- 2.11.0