<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="triggersCondition_Edit" type="xmlform" width="100%" labelWidth="20%">
  <PROCESS type="private"/>
  <action type="hidden"/>
  <STEP_UID type="hidden"/>
  <TRI_UID type="hidden"/>
  <ST_TYPE type="hidden"/>
  <ST_CONDITION type="textareapm" required="0" cols="55" rows="4" showVars="1" process="@#PROCESS">
    <en><![CDATA[Condition]]></en>
  </ST_CONDITION>
  <ST_POSITION type="hidden"/>
  <SAVE type="button" onclick="saveTriggerCondition(this.form);">
    <en><![CDATA[Save]]></en>
  </SAVE>
  <JS type="javascript" replaceTags="1"><![CDATA[

var _oVarsPanel_;
var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol) {
	_oVarsPanel_ = new leimnud.module.panel();
	_oVarsPanel_.options = {
    limit    : true,
    size     : {w:600,h:420},
    position : {x:0,y:0,center:true},
    title    : '',
    theme    : 'processmaker',
    statusBar: false,
    control  : {drag:false,resize:true,close:true},
    fx       : {opacity:true,rolled:false,modal:true}
  };
  _oVarsPanel_.make();
  _oVarsPanel_.events = {
    remove:function() {
      delete _oVarsPanel_;
    }.extend(this)
  };
  _oVarsPanel_.loader.show();
  oRPC = new leimnud.module.rpc.xmlhttp({
    url   : sAjaxServer,
    method: 'POST',
    args  : 'sFieldName=' + sFieldName + '&sProcess=' + sProcess + '&sSymbol=' + sSymbol
  });
  oRPC.callback = function(oRPC) {
    _oVarsPanel_.loader.hide();
    var scs = oRPC.xmlhttp.responseText.extractScript();
    _oVarsPanel_.addContent(oRPC.xmlhttp.responseText);
    scs.evalScript();
  }.extend(this);
  oRPC.make();
};

var insertFormVar = function(sFieldName, sValue) {
	oAux = document.getElementById(sFieldName);
	if (oAux.setSelectionRange) {
		var rangeStart = oAux.selectionStart;
    var rangeEnd   = oAux.selectionEnd;
    var tempStr1   = oAux.value.substring(0,rangeStart);
    var tempStr2   = oAux.value.substring(rangeEnd);
    oAux.value     = tempStr1 + sValue + tempStr2;
	}
	else {
	  if (document.selection) {
	    oAux.focus();
      document.selection.createRange().text = sValue;
	  }
	}
	_oVarsPanel_.remove();
};
function saveTriggerCondition(oForm)
{
  ajax_post(oForm.action, oForm, 'POST');
  var sType = document.getElementById('form[ST_TYPE]').value;
  currentPopupWindow.remove();
  showTriggers('@#STEP_UID', sType);
}

]]></JS>
</dynaForm>
