Zymonic Web UI and Javascript Implementation

=Zymonic Web UI and Javascript Implementation=

Zymonic Javascript
Zymonic Javascript is mostly object oriented and contained in a Zymonic. namespace; there are exceptions to this but they are in the process of being removed.

Handling XML
The following is an example of using the Object Oriented form of Transformer: if(zt.XMLErrHandle(function(dxml) { Zymonic.newBlockCB(dxml, block_id); }, loading_function )) { /* Transform the XML */

if (zt.block_deleted) { $('#block_' + block_id).remove; } else { $('#block_' + block_id).replaceWith(zt.resultDocument);

//Re-run any JS that has not been run Zymonic.Utils.reRunJS($('#block_' + zt.block_id)); }		}

The following is an example of using Transformer in a non-OO style: var zt = new Zymonic.Transformer.Transformer; var doc = zt.TransformXML(xml);

The following is an example of using the Transformer object to check for 'routine' Zymonic XML errors and handle them (and if not then pass the xml through to be handled - in this case by process filter data). var zt = new Zymonic.Transformer.Transformer; if (zt.XMLErrHandle( function(dxml) { thisfilter.processNoData( dxml, no_transform); }, undefined, xml, this.block_id)) {

// may have collapsed a group that had all per record filter actions this.updateFilterActions(this.ident); }

Opening a Block
Opening a block should be done with Zymonic.openBlock - an example, with additional parameters, follows...

var extras = {}; // add main value field mappiung if (value_destination_field_zname != '') { Zymonic.addOpenBlockParam(extras, target_location, value_destination_field_zname, getZymonicField(field_ident).getValue); }			// add field maps for (var i=0; i<field_maps.length; ++i) { Zymonic.addOpenBlockParam(extras, 						                 target_location, 						                  ( field_maps[i].destination_field ? field_maps[i].destination_field : field_maps[i].destination_parameter ),						                 ( field_maps[i].source_field_ident ? getZymonicField(field_maps[i].source_field_ident).getValue : field_maps[i].static_value ) ); }			Zymonic.openBlock(fop_zname, 0, fop_type, target_location, extras);