<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="tasks_Definition" width="99%" mode="edit" border="0" enableTemplate="0" height="305px">
  <PRO_UID type="hidden"/>
  <TAS_UID type="hidden"/>
  <INDEX type="hidden"/>
  <IFORM type="hidden"/>
  <TAS_TITLE type="text" size="50" maxlength="255" defaultvalue="" required="1" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
    <en><![CDATA[Title]]></en>
  </TAS_TITLE>
  <TAS_DESCRIPTION type="textarea" required="0" cols="50" rows="6" group="1">
    <en><![CDATA[Description]]></en>
  </TAS_DESCRIPTION>
  <TAS_PRIORITY_VARIABLE type="textpm" size="48" maxlength="155" defaultvalue="" showVars="1" process="@#PRO_UID" group="1">
    <en><![CDATA[Variable for Case priority]]></en>
  </TAS_PRIORITY_VARIABLE>
  <TAS_DERIVATION_SCREEN_TPL type="dropdown" sqlconnection="dbarray">
  SELECT FILE,NAME FROM _TEMPLATES1
  <en><![CDATA[Routing Screen Template]]><option name=""><![CDATA[- Default -]]></option></en>
</TAS_DERIVATION_SCREEN_TPL>
  <TAS_START type="checkbox" value="TRUE" group="1">
    <en><![CDATA[Starting task]]></en>
  </TAS_START>
  <JS type="javascript"><![CDATA[
Pm.tmp.propertiesPanel.events.remove = function() { bFunctionAlreadyAssigned = false; aTaskFlag = [false,false,false,false,false,false,false]; };

/* Initialize panel buttons */
if (!bFunctionAlreadyAssigned)
{
  leimnud.event.add(Pm.tmp.propertiesPanel.elements.statusBarButtons[0], 'click', function(){
    aTaskFlag = [false,false,false,false,false,false];
    saveTaskData(getField('TAS_UID').form, getField('IFORM').value, 2);
  });
  leimnud.event.add(Pm.tmp.propertiesPanel.elements.statusBarButtons[1], 'click', function(){
    aTaskFlag = [false,false,false,false,false,false];
    Pm.tmp.propertiesPanel.remove();
  });
  bFunctionAlreadyAssigned = true;
}
//alert(aTaskFlag);
/* Recovery data */
if (aTaskFlag[0])
{
  getField('TAS_TITLE').value       = oTaskData.TAS_TITLE;
  getField('TAS_DESCRIPTION').value = oTaskData.TAS_DESCRIPTION;
  getField('TAS_START').checked     = (oTaskData.TAS_START == 'TRUE' ? true : false);
  getField('TAS_PRIORITY_VARIABLE').value = oTaskData.TAS_PRIORITY_VARIABLE;
}
else
{
  saveDataTaskTemporal(1);
  aTaskFlag[0] = true;
}


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 + '&sNoShowLeyend=1'
  });
  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) {
	  oAux.value     = '';
		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();
};

]]></JS>
</dynaForm>
