From: miker Date: Fri, 9 Jul 2010 14:34:47 +0000 (+0000) Subject: add support for switching between xul and textarea marc editors X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b5d1b5e86dcaee9b6d29b2777798fd29f70a20eb;p=evergreen%2Fbjwebb.git add support for switching between xul and textarea marc editors git-svn-id: svn://svn.open-ils.org/ILS/trunk@16896 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index a7f22891a..8551ac398 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2454,6 +2454,7 @@ + diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 32e7031e7..c5d417a39 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -78,6 +78,36 @@ function xml_escape_unicode ( str ) { ); } +function swap_editors () { + + dojo.require('MARC.Record'); + + var xe = $('xul-editor'); + var te = $('text-editor'); + + te.hidden = te.hidden ? false : true; + xe.hidden = xe.hidden ? false : true; + + if (te.hidden) { + // get the marcxml from the text box + var xml_string = new MARC.Record({ + marcbreaker : $('text-editor-box').value, + delimiter : '$' + }).toXmlString(); + + // reset the xml record and rerender it + xml_record = new XML( xml_string ); + loadRecord(xml_record); + } else { + var xml_string = xml_record.toXMLString(); + + // push the xml record into the textbox + var rec = new MARC.Record ({ delimiter : '$', marcxml : xml_string }); + $('text-editor-box').value = rec.toBreaker(); + } +} + + function my_init() { try { @@ -107,6 +137,7 @@ function my_init() { document.getElementById('save-button').setAttribute('label', window.xulG.save.label); document.getElementById('save-button').setAttribute('oncommand', + 'if ($("xul-editor").hidden) swap_editors(); ' + 'mangle_005(); ' + 'var xml_string = xml_escape_unicode( xml_record.toXMLString() ); ' + 'save_attempt( xml_string ); ' + diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.xul b/Open-ILS/xul/staff_client/server/cat/marcedit.xul index e56fa3b24..4baa212bc 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.xul +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.xul @@ -33,6 +33,7 @@