<inp2:adm_SetPopupSize width="820" height="570"/>

<inp2:m_include t="incs/header"/>

<inp2:m_Get var="form_id" result_to_var="form_id"/>
<inp2:m_RenderElement name="combined_header" prefix="formsubs" section="in-portal:submissions:$form_id" title_preset="submission_log_edit"/>

<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
	<tr>
		<td>
			<script type="text/javascript">
				a_toolbar = new ToolBar();

				<inp2:m_if check="submission-log_IsNewItem">
					a_toolbar.AddButton(
						new ToolBarButton(
							'select',
							'<inp2:m_phrase label="la_ToolTip_Send" escape="1"/>',
							function() {
								submit_event('submission-log', '<inp2:submission-log_SaveEvent/>');
							}
						)
					);
				</inp2:m_if>

				a_toolbar.AddButton(
					new ToolBarButton(
						'cancel',
						'<inp2:m_phrase label="la_ToolTip_Close" escape="1"/>',
						function() {
							cancel_edit('submission-log', 'OnGoBack', '<inp2:submission-log_SaveEvent/>', '<inp2:m_Phrase label="la_FormCancelConfirmation" escape="1"/>');
						}
					)
				);

				<inp2:m_if check="submission-log_IsUserReply" inverse="inverse">
					a_toolbar.AddButton(
						new ToolBarButton(
							'resend',
							'<inp2:m_phrase label="la_ToolTip_Resend" escape="1"/>',
							function() {
								submit_event('submission-log', 'OnResendReply');
							}
						)
					);
				</inp2:m_if>

				<inp2:m_if check="submission-log_IsNewItem">
					a_toolbar.AddButton(
						new ToolBarButton(
							'reset_to_user',
							'<inp2:m_phrase label="la_ToolTip_SaveAsDraft" escape="1"/>',
							function() {
								submit_event('submission-log', 'OnSaveDraft');
							}
						)
					);
				</inp2:m_if>

				a_toolbar.Render();
			</script>

			<script type="text/javascript" src="js/swfobject.js"></script>
			<script type="text/javascript" src="<inp2:m_Compress files='js/uploader/upload_manager.js|js/uploader/uploader.js'/>"></script>
		</td>
	</tr>
</table>

<inp2:m_DefineElement name="file_element">
	<a href="<inp2:Field field='$field' format='full_url'/>" target="_blank"><inp2:Field field="$field"/></a><br/>
</inp2:m_DefineElement>

<input type="hidden" name="client_mode" value="<inp2:m_Get name='client_mode'/>"/>

<inp2:submission-log_SaveWarning name="grid_save_warning"/>
<inp2:submission-log_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="FormSubmissionId"/>
		<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="DraftId"/>
		<inp2:m_RenderElement name="inp_id_label" prefix="submission-log" field="SubmissionLogId" title="la_fld_Id"/>
		<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="FromEmail" title="la_fld_FromEmail"/>
		<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="ToEmail" size="60" title="la_fld_ToEmail"/>
		<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="Cc" size="60" title="la_fld_Cc"/>
		<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="Bcc" size="60" title="la_fld_Bcc"/>

		<inp2:m_if check="submission-log_IsNewItem">
			<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="Subject" size="80" title="la_fld_Subject"/>

			<inp2:m_if check="submission-log_HasDraft">
				<inp2:m_RenderElement design="form_row" prefix="submission-log" field="DraftId" title="la_DraftAvailableFrom">
					<td class="control-cell">
						<inp2:draft.related_Field name="CreatedOn"/>
						[<a href="#" onclick="submit_event('<inp2:m_Param name='prefix'/>', 'OnUseDraft'); return false;"><inp2:m_Phrase name="la_btn_UseDraft"/></a>]
						&nbsp;[<a href="#" onclick="submit_event('<inp2:m_Param name='prefix'/>', 'OnDeleteDraft'); return false;"><inp2:m_Phrase name="la_btn_DeleteDraft"/></a>]
					</td>
				</inp2:m_RenderElement>
			</inp2:m_if>

			<inp2:m_RenderElement name="inp_edit_textarea" prefix="submission-log" field="Message" rows="30" cols="100" title="la_fld_Message" allow_html="0"/>
			<inp2:m_RenderElement name="inp_edit_swf_upload" prefix="submission-log" field="Attachment" title="la_fld_Attachment"/>
		<inp2:m_else/>
			<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="Subject" title="la_fld_Subject"/>
			<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="Message" title="la_fld_Message" nl2br="1"/>
			<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="ReplyStatus" title="la_fld_ReplyStatus"/>
			<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="RepliedOn" title="la_fld_RepliedOn"/>
			<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="SentStatus" title="la_fld_SentStatus"/>
			<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="SentOn" title="la_fld_SentOn"/>

			<inp2:m_RenderElement design="form_row" prefix="submission-log" field="Attachment" title="la_fld_Attachment">
				<td class="control-cell">
					<inp2:$prefix_IterateFiles render_as="file_element" field="$field"/>
				</td>
			</inp2:m_RenderElement>

			<inp2:m_if check="submission-log_Field" name="BounceInfo">
				<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="BounceInfo" title="la_fld_BounceInfo" nl2br="1"/>
			</inp2:m_if>

			<inp2:m_if check="submission-log_Field" name="BounceDate" db="db">
				<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="BounceDate" title="la_fld_BounceDate"/>
			</inp2:m_if>
		</inp2:m_if>

		<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="FromEmail"/>
		<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="ReplyTo"/>

		<inp2:m_RenderElement name="inp_edit_filler" />
	</table>
</div>

<inp2:m_include t="incs/footer"/>