{{if $smarty.post.save eq 'save'}}

{{else}}

	
	
	{{getCollectionByCategory OrderColumn=1 CollectionID=99 ColumnID=1 Value=$CollectionID Collection_99_2=1 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}
	{{if $Tmp.Collection_99_3 eq 'on'}}{{assign var=wFlowApproveActive value='checked'}}{{else}}{{assign var=wFlowApproveActive value=''}}{{/if}}
	{{assign var=approveToAddress value=$Tmp.Collection_99_4}}
	{{assign var=approveFromName value=$Tmp.Collection_99_5}}
	{{assign var=approveFromAddress value=$Tmp.Collection_99_6}}
	{{assign var=approveSubject value=$Tmp.Collection_99_7}}
	{{assign var=approveNotes value=$Tmp.Collection_99_8}}
	{{assign var=approvePage value=$Tmp.Collection_99_9}}
	{{assign var=approveToName value=$Tmp.Collection_99_10}}


{{/if}}

{{capture name=jsWorkflowCodeApproval assign=tmpJSApproval}}
				
		$("#wFlowApproveActive").click(function(){ var ch = $(this).attr('checked'); 
		
				if (ch == true)
				{
						$('#wFlowWriteAddFrontEndActive').attr('checked',false);
						$('#wFlowWriteEditFrontEndActive').attr('checked',false);
						$('#wFlowWriteDeleteFrontEndActive').attr('checked',false);
						
						$('#wFlowWriteAddAdminActive').attr('checked',false);
						$('#wFlowWriteEditAdminActive').attr('checked',false);
						$('#wFlowWriteDeleteAdminActive').attr('checked',false);
				}
		
		});
		
		$("#wFlowWriteAddFrontEndActive").click(function(){ var ch = $(this).attr('checked');  if (ch == true) {  $('#wFlowApproveActive').attr('checked',false);  } });
		$("#wFlowWriteEditFrontEndActive").click(function(){ var ch = $(this).attr('checked');  if (ch == true) {  $('#wFlowApproveActive').attr('checked',false);  } });
		$("#wFlowWriteDeleteFrontEndActive").click(function(){ var ch = $(this).attr('checked');  if (ch == true) {  $('#wFlowApproveActive').attr('checked',false);  } });
		
		$("#wFlowWriteAddAdminActive").click(function(){ var ch = $(this).attr('checked');  if (ch == true) {  $('#wFlowApproveActive').attr('checked',false);  } });
		$("#wFlowWriteEditAdminActive").click(function(){ var ch = $(this).attr('checked');  if (ch == true) {  $('#wFlowApproveActive').attr('checked',false);  } });
		$("#wFlowWriteDeleteAdminActive").click(function(){ var ch = $(this).attr('checked');  if (ch == true) {  $('#wFlowApproveActive').attr('checked',false);  } });

{{/capture}}
{{assign var=JavascriptJQueryCode value=$JavascriptJQueryCode|concat:" "|concat:$tmpJSApproval}} 

{{RunQuery ResultsVar=XREFsTest q="SELECT * FROM CollectionSettings_5  WHERE collectionXrefsSave = "|concat:$CollectionID}}
{{RunQuery ResultsVar=XREFsTest2 q="SELECT * FROM CollectionSettings_6  WHERE collectionComplexXref = "|concat:$CollectionID}}

{{if $XREFsTest|@count gt 0 or $XREFsTest2|@count gt 0}}
<div class="ui-state-error ui-corner-all" style="padding: 0pt 0.7em;">
<p style="margin-top:4px; margin-bottom:4px;">
<span class="ui-icon ui-icon-alert" style="float: left; margin-right: 0.3em;"></span>
<strong>Alert:</strong>
This workflow is disabled because another collection uses this collection to store information.
</p>
</div>
{{else}}

<p><input type="checkbox" id="wFlowApproveActive" name="wFlowApproveActive" {{$wFlowApproveActive}} /> Activate approval workflow</p>

<h3>Email Verification Settings</h3>

<table cellpadding="4" cellspacing="0" border="0">
<tr>
	<td><p>Recipient Name</p></td>
	<td>
		<p><input type="text" class="input" size="40" name="approveToName" value="{{$approveToName}}" /></p>
	</td>
</tr>
<tr>
	<td><p>Recipient Email Address</p></td>
	<td>
		<p><input type="text" class="input" size="40" name="approveToAddress" value="{{$approveToAddress}}" /></p>
	</td>
</tr>
<tr>
	<td width="150"><p>Sender Name</p></td>
	<td>
		<p><input type="text" class="input" size="40" name="approveFromName" value="{{$approveFromName}}" /></p>
	</td>
</tr>
<tr>
	<td><p>Sender Email Address</p></td>
	<td>
		<p><input type="text" class="input" size="40" name="approveFromAddress" value="{{$approveFromAddress}}" /></p>
	</td>
</tr>
<tr>
	<td><p>Subject</p></td>
	<td>
		<p><input type="text" class="input" size="40" name="approveSubject" value="{{$approveSubject}}" /></p>
	</td>
</tr>

<tr valign="top">
	<td width="150"><p>Notes</p></td>
	<td>
		<p><text{{**}}area class="input" cols="40" rows="8" name="approveNotes">{{$approveNotes}}</text{{**}}area></p>
	</td>
</tr>
<tr>
	<td><p>Email Template</p></td>
	<td>
		{{getCollectionByCategory CollectionID=17 ColumnID=4 Value=2 OrderColumn=1 var=PagesEmail}}
		<p><select name="approvePage" class="input">
										<option value="">Select an email template...</option>
										{{foreach from=$PagesEmail item=vPage key=kPage}}
										<option value="{{$vPage.Collection_17_ID}}" {{if $approvePage eq $vPage.Collection_17_ID}}selected {{/if}}>{{$vPage.Collection_17_1}}</option>
										{{/foreach}}
			</select></p>
	</td>
</tr>
</table>
{{/if}}