<!ENTITY staff.cat.marcedit.validate.accesskey "V">
<!ENTITY staff.cat.marcedit.save-button.accesskey "d">
<!ENTITY staff.cat.marcedit.help.label "Help">
+<!ENTITY staff.cat.marcedit.swapEditor.label "Swap Editor Type">
<!ENTITY staff.cat.marcedit.help.accesskey "H">
<!ENTITY staff.cat.marcedit.caption.label "MARC Record">
<!ENTITY staff.cat.marcedit.toggleFFE.label "Fixed Fields -- Record type: ">
);
}
+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 {
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 ); ' +
</hbox>
<button label="&staff.cat.marcedit.validate.label;" accesskey="&staff.cat.marcedit.validate.accesskey;" oncommand="validateAuthority(this);"/>
<button id="save-button" accesskey="&staff.cat.marcedit.save-button.accesskey;"/>
+ <button label="&staff.cat.marcedit.swapEditor.label;" oncommand="swap_editors()"/>
<button label="&staff.cat.marcedit.help.label;" accesskey="&staff.cat.marcedit.help.accesskey;"
oncommand="alert(
$('catStrings').getString('staff.cat.marcedit.help.add_row') + '\n' +
</hbox>
</groupbox>
-<groupbox flex="1">
+<groupbox id="xul-editor" flex="1">
<caption label="&staff.cat.marcedit.caption.label;"/>
<vbox flex="1" style="overflow: auto;">
<hbox>
</vbox>
</groupbox>
+<hbox hidden="true" id="text-editor" flex="1">
+ <xhtml:textarea rows="50" cols='100' id="text-editor-box"></xhtml:textarea>
+</hbox>
+
<grid name="authority-marc-template" hidden="true">
<columns>
<column/>