<?xml version="1.0" encoding="UTF-8"?>
<?xfa generator="AdobeDesigner_V7.0" APIVersion="1.4.4207.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
<template xmlns="http://www.xfa.org/schema/xfa-template/2.1/">
   <subform>
      <pageSet>
         <pageArea name="snippet">
            <desc>
               <text name="name">Adobe Workflow Server Fields</text>
               <text name="description">Adobe Workflow Server Fields - Creates the group of objects required for Workflow Server forms.</text>
            </desc>
            <field h="6mm" name="JFWF_TRANSPORT" presence="invisible" relevant="+interactive" w="38.1mm" x="101.6mm" y="10.85mm">
               <value>
                  <text maxChars="255">EMAIL</text>
               </value>
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <fill>
                           <color value="192,192,192"/>
                        </fill>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <traversal passThrough="1"/>
               <caption reserve="33.02mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>JFWF_TRANSPORT</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <font typeface="Myriad Pro"/>
               <calculate override="warning"/>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <bind match="global"/>
               <para vAlign="middle"/>
            </field>
            <field h="9mm" name="JFWF_ACTION" relevant="+interactive" w="62mm" x="75.41mm">
               <ui>
                  <choiceList>
                     <border>
                        <edge stroke="lowered"/>
                        <edge stroke="lowered"/>
                        <edge stroke="lowered"/>
                        <edge stroke="lowered"/>
                     </border>
                     <margin/>
                  </choiceList>
               </ui>
               <font typeface="Myriad Pro"/>
               <calculate override="warning"/>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <fill/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <margin bottomInset="0.9906mm" leftInset="0.9906mm" rightInset="0.9906mm" topInset="0.9906mm"/>
               <para vAlign="middle"/>
               <caption reserve="12.7mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>Action</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <items/>
               <items presence="hidden" save="1"/>
               <event activity="ready" ref="$form">
                  <script contentType="application/x-javascript" runAt="both">var sChoice = JFWF_CHOICE.rawValue;
if (sChoice == null) sChoice = "";
if (sChoice.indexOf("*** ") == 0) sChoice = "";

if (sChoice.length &gt; 0) {
    // Set the contents of the JFWF_ACTION drop-down list box
    // equal to list in the JFWF_CHOICE text box.
    // This is required when the form is opened for the very
    // first time.
	
    // Populate action list array from the comma delimited string in JFWF_CHOICE
    var astrChoiceList;
    var choices;

    // Clear drop-down list box
    JFWF_ACTION.clearItems();

	astrChoiceList = JFWF_CHOICE.rawValue;
    astrChoiceList = astrChoiceList.replace(/\*/g, "");

    // add each choice to JFWF_ACTION
    choices = astrChoiceList.split(",");
    var numchoices = choices.length;

    for (var i = 0; i &lt; numchoices; i++)
    {
            JFWF_ACTION.addItem(choices[i]);
    }

    // Automatically select the first item
    // only if the array is not empty
    if (numchoices &gt; 0)
    {
			JFWF_ACTION.rawValue = choices[0];
    }
	JFWF_CHOICE.rawValue = "*** " + JFWF_CHOICE.rawValue;
}</script>
               </event>
               <bind match="global"/>
            </field>
            <field h="6mm" name="FSSUBMIT_" presence="invisible" relevant="+interactive" w="35.56mm" x="32.28mm" y="1.85mm">
               <ui>
                  <button/>
               </ui>
               <font typeface="Myriad Pro"/>
               <caption>
                  <value>
                     <text>Submit</text>
                  </value>
                  <para hAlign="center" vAlign="middle"/>
                  <font typeface="Myriad Pro"/>
               </caption>
               <calculate override="warning"/>
               <bind match="none"/>
               <border>
                  <edge stroke="raised"/>
                  <fill>
                     <color value="212,208,200"/>
                  </fill>
                  <edge stroke="raised"/>
                  <edge stroke="raised"/>
                  <edge stroke="raised"/>
               </border>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <event activity="click">
                  <submit textEncoding="UTF-8" xdpContent="pdf datasets xfdf"/>
               </event>
            </field>
            <field h="6mm" name="JFWF_DELEGATE" presence="invisible" relevant="+interactive" w="38.1mm" x="146.05mm" y="10.85mm">
               <value>
                  <text maxChars="255"/>
               </value>
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <fill>
                           <color value="192,192,192"/>
                        </fill>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <traversal passThrough="1"/>
               <caption reserve="30.48mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>JFWF_DELEGATE</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <font typeface="Myriad Pro"/>
               <calculate override="warning"/>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <bind match="global"/>
               <para vAlign="middle"/>
            </field>
            <field h="6mm" name="JFWF_CHOICE" presence="invisible" relevant="+interactive" w="50.8mm" y="10.85mm">
               <value>
                  <text maxChars="255"/>
               </value>
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <fill>
                           <color value="192,192,192"/>
                        </fill>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <traversal passThrough="1"/>
               <caption reserve="25.4mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>JFWF_CHOICE</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <font typeface="Myriad Pro"/>
               <calculate override="warning">
                  <script contentType="application/x-javascript"/>
               </calculate>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <bind match="global"/>
               <para vAlign="middle"/>
               <event activity="preSave" ref="$host">
                  <script contentType="application/x-javascript">var sChoice = JFWF_CHOICE.rawValue;
if (sChoice == null) sChoice = "";
if (sChoice.indexOf("*** ") == 0) 
	JFWF_CHOICE.rawValue = sChoice.substr(4);</script>
               </event>
            </field>
            <field h="6mm" name="JFWF_AGENT" presence="invisible" relevant="+interactive" w="38.1mm" x="101.6mm" y="17.2mm">
               <value>
                  <text maxChars="255"/>
               </value>
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <fill>
                           <color value="192,192,192"/>
                        </fill>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <traversal passThrough="1"/>
               <caption reserve="24.13mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>JFWF_AGENT</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <font typeface="Myriad Pro"/>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <bind match="global"/>
               <para vAlign="middle"/>
            </field>
            <field h="6mm" name="JFWF_DEBUGACTOR" presence="invisible" relevant="+interactive" w="50.8mm" y="17.2mm">
               <value>
                  <text maxChars="255"/>
               </value>
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <fill>
                           <color value="192,192,192"/>
                        </fill>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <traversal passThrough="1"/>
               <caption reserve="35.56mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>JFWF_DEBUGACTOR</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <font typeface="Myriad Pro"/>
               <calculate override="warning"/>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <assist>
                  <toolTip>Type the name of the Adobe Workflow Server user that you want to impersonate.</toolTip>
               </assist>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <bind match="global"/>
               <para vAlign="middle"/>
            </field>
            <field h="6mm" name="JFWF_STATUS" presence="invisible" relevant="+interactive" w="38.1mm" x="57.15mm" y="17.2mm">
               <value>
                  <text maxChars="255"/>
               </value>
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <fill>
                           <color value="192,192,192"/>
                        </fill>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <traversal passThrough="1"/>
               <caption reserve="25.4mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>JFWF_STATUS</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <font typeface="Myriad Pro"/>
               <calculate override="warning"/>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <para vAlign="middle"/>
               <event activity="preSave" ref="$host">
                  <script contentType="application/x-javascript">JFWF_STATUS.rawValue = "";</script>
               </event>
               <bind match="global"/>
            </field>
            <field h="6mm" name="JFWF_VERSION" presence="invisible" relevant="+interactive" w="38.1mm" x="146.05mm" y="17.2mm">
               <value>
                  <text maxChars="255">6.2</text>
               </value>
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <fill>
                           <color value="192,192,192"/>
                        </fill>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <traversal passThrough="1"/>
               <caption reserve="26.67mm">
                  <font typeface="Myriad Pro"/>
                  <value>
                     <text>JFWF_VERSION</text>
                  </value>
                  <para vAlign="middle"/>
               </caption>
               <font typeface="Myriad Pro"/>
               <calculate override="warning"/>
               <border hand="right">
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <edge cap="butt" presence="hidden" stroke="lowered"/>
                  <corner/>
                  <corner/>
                  <corner/>
                  <corner/>
               </border>
               <margin bottomInset="0mm" leftInset="0mm" rightInset="0mm" topInset="0mm"/>
               <bind match="global"/>
               <para vAlign="middle"/>
            </field>
            <field h="5.9944mm" name="JFWF_TRANID" presence="invisible" w="38.1mm" x="57.15mm" y="10.85mm">
               <ui>
                  <textEdit>
                     <border>
                        <edge/>
                        <edge/>
                        <edge/>
                        <edge/>
                        <corner/>
                        <corner/>
                        <corner/>
                        <fill/>
                     </border>
                     <margin/>
                  </textEdit>
               </ui>
               <font typeface="Myriad Pro"/>
               <margin bottomInset="1mm" leftInset="1mm" rightInset="1mm" topInset="1mm"/>
               <para vAlign="middle"/>
               <caption reserve="25mm">
                  <font typeface="Myriad Pro"/>
                  <para vAlign="middle"/>
                  <value>
                     <text>Text Field</text>
                  </value>
               </caption>
               <value>
                  <text maxChars="255"/>
               </value>
               <calculate override="warning"/>
               <bind match="global"/>
            </field>
            <field h="6mm" name="JFWF_SUBMIT" w="38.5416mm" x="146.05mm" y="1.33mm">
               <ui>
                  <button/>
               </ui>
               <font typeface="Myriad Pro"/>
               <caption>
                  <value>
                     <text>Submit</text>
                  </value>
                  <para hAlign="center" vAlign="middle"/>
                  <font typeface="Myriad Pro"/>
               </caption>
               <border>
                  <edge stroke="raised"/>
                  <fill>
                     <color value="212,208,200"/>
                  </fill>
                  <edge stroke="raised"/>
                  <edge stroke="raised"/>
                  <edge stroke="raised"/>
               </border>
               <bind match="none"/>
               <event activity="click">
                  <script contentType="application/x-javascript">if (xfa.host.name == "Acrobat")
{
	// reset the JFWF_CHOICE field
	var sChoice = JFWF_CHOICE.rawValue;
	if (sChoice == null) sChoice = "";
	if (sChoice.indexOf("*** ") == 0) 
		JFWF_CHOICE.rawValue = sChoice.substr(4);

	var bSubmit = true;
	var bEmail = false;
	if (JFWF_TRANSPORT.rawValue	== "EMAIL")
	{
		bEmail = true;
		// ensure there is an agent email address 
		if (JFWF_AGENT.rawValue == "") 
		{ 
			JFWF_AGENT.rawValue = app.response("This form does not contain the email address for a Workflow Server. Please enter the Workflow Server email address now.", "Workitem Submission Information"); 
			if (JFWF_AGENT.rawValue == "") 
			{ 
				bSubmit = false;
			} 
		} 
	}
	else // came from the web
	{
		// can only email if loaded from disk and there is a Workflow Server email address 
		var sURL = event.target.URL;
		if (sURL == null) 
		{
			sURL = "";
		}

		// can only email if there is a Workflow Server email address and doc loaded from disk (not in a browser)  
		if (JFWF_AGENT.rawValue	!= "" &amp;&amp; (sURL.indexOf("file://") == 0) )
		{
			bEmail = true;
		}
	}

	if (bEmail)
	{
		if (JFWF_STATUS.rawValue == "Submitted") 
		{ 
			app.response("This workflow item has already been submitted.", "Workitem Submission Error");
			bSubmit = false;
		} 

		var bUDA = false; 
		// Populate action list array from the comma delimited string in JFWF_CHOICE 
		var astrChoiceList; 
		var choices; 
		var sUDA; 
		sUDA = "*" + JFWF_ACTION.rawValue; 
		astrChoiceList = JFWF_CHOICE.rawValue;
		if (astrChoiceList.indexOf("*** ") == 0)
			astrChoiceList = astrChoiceList.substr(4);
		 
		choices = astrChoiceList.split(","); 
		for (var i = 0; i &lt; choices.length; i++) 
		{ 
			if (sUDA == choices[i]) 
			{ 
				bUDA = true; break; 
			} 
		} 

		if (bUDA &amp;&amp; bSubmit) 
		{
			var sDelegate = JFWF_DELEGATE.rawValue;
			if (sDelegate == null) sDelegate = "";
			if (sDelegate == "")
			{
				JFWF_DELEGATE.rawValue = app.response("The selected action requires that you specify the next user before submitting. Please enter the next user now.", "Select Next Participant");
				if (JFWF_DELEGATE.rawValue == "") 
				{ 
					bSubmit = false;
				} 
			}
		}

		if (bSubmit)
		{
			JFWF_STATUS.rawValue = "Submitted";
			//event.target.submitForm("mailto:"+JFWF_AGENT.rawValue, false, true, null, false, false); 
			event.target.submitForm({cURL: "mailto:"+JFWF_AGENT.rawValue,
			 						 bEmpty: true,		// Post all fields (true), or do Not post all fields (false)
			 						 cSubmitAs: "XDP",	// Post XDP format 
			 						 cCharset: "utf-8"});
		}
	}

	if (bEmail == false)
	{
		FSSUBMIT_.execEvent("click");
	}
}
else // web submit
{
	FSSUBMIT_.execEvent("click");
}</script>
               </event>
            </field>
         </pageArea>
      </pageSet>
   </subform>
</template></xdp:xdp>
