// OpenFOP conditional format function cond_format_open_fop(checks, validOnly, zname, field_ident, display_name, fop_type, fop_zname, value_destination_field_zname, field_maps, target_location) { // get the link var link = cond_format_open_fop_link(zname, field_ident, display_name, fop_type, fop_zname, value_destination_field_zname, field_maps, target_location); // if checks fail, then hide the link var checks_result = validation_checks(checks, validOnly); if (checks_result.pass) { $(link).show(); } else { $(link).hide(); } return 'OK'; } // build open fop link function cond_format_open_fop_link(zname, field_ident, display_name, fop_type, fop_zname, value_destination_field_zname, field_maps, target_location) { var link_id = field_ident+zname; // lookup target location if not set if (!target_location || target_location == "") { var parent_location = $("#"+field_ident+"_div").parents('ul.block'); if (parent_location.length) { var ident = parent_location.first().attr('id'); if (ident) { target_location = ident.replace('SLocation_', ''); } } } if (!target_location || target_location == "") { Zymonic.log("Cannot find target location"); } // create a link if not present var link = $("#"+link_id).get(0); if (!link) { link = document.createElement("a"); link.id = link_id; link.href = "#"; link.innerHTML = display_name; link.className = "OpenFOPLink"; $("#"+field_ident+"_div").append(link); // add a click handler Zymonic.Utils.attach_event($(link), "click", link_id, function(event) { 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