[open-ils-commits] r18308 - in branches/rel_1_6/Open-ILS: web/opac/locale/en-US xul/staff_client/server/cat (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Oct 13 10:05:22 EDT 2010


Author: miker
Date: 2010-10-13 10:05:20 -0400 (Wed, 13 Oct 2010)
New Revision: 18308

Modified:
   branches/rel_1_6/Open-ILS/web/opac/locale/en-US/lang.dtd
   branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.js
   branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.xul
Log:
backport editor swapping functionality from 2.0 for 1.6.2

Modified: branches/rel_1_6/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- branches/rel_1_6/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-10-13 08:33:58 UTC (rev 18307)
+++ branches/rel_1_6/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-10-13 14:05:20 UTC (rev 18308)
@@ -2189,6 +2189,7 @@
 <!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: ">

Modified: branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-10-13 08:33:58 UTC (rev 18307)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-10-13 14:05:20 UTC (rev 18308)
@@ -89,6 +89,36 @@
     }
 }
 
+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 {
 
@@ -137,6 +167,7 @@
 
         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 ); ' +

Modified: branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.xul
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.xul	2010-10-13 08:33:58 UTC (rev 18307)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/server/cat/marcedit.xul	2010-10-13 14:05:20 UTC (rev 18308)
@@ -36,6 +36,7 @@
         </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' +
@@ -53,7 +54,7 @@
     </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>
@@ -205,6 +206,10 @@
     </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/>



More information about the open-ils-commits mailing list