<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" pagination="1" title_preset="formsubs_list" />

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%">
<tbody>
	<tr>
  	<td>
  		<script type="text/javascript">
  			//do not rename - this function is used in default grid for double click!
  			function edit()
  			{
  				// don't use temp tables, since we can receive user replies while reviewing form submission
  				std_edit_temp_item('formsubs', 'submissions/submission_view');
  			}

  			var a_toolbar = new ToolBar();

				a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );

				a_toolbar.AddButton( new ToolBarSeparator('sep3') );

				a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
						function() {
							std_delete_items('formsubs')
						} ) );

				a_toolbar.AddButton( new ToolBarSeparator('sep2') );

				a_toolbar.AddButton(
					new ToolBarButton(
						'view',
						'<inp2:m_phrase label="la_ToolTip_View" escape="1"/>',
						function(id) {
							show_viewmenu(a_toolbar,'view');
						}
					)
				);

				a_toolbar.Render();
			</script>
		</td>

		<inp2:m_RenderElement name="search_main_toolbar" prefix="formsubs" grid="Default"/>
	</tr>
</tbody>
</table>


<inp2:m_DefineElement name="grid_email_td">
	<a href="mailto:<inp2:Field field="$field" />"><inp2:Field field="$field"/></a>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="grid_upload_td">
	<inp2:m_if check="Field" name="$field" db="db">
		<a href="<inp2:Field field='$field' format='full_url'/>" target="_blank"><inp2:Field field="$field"/></a>
	</inp2:m_if>
</inp2:m_DefineElement>

<inp2:m_RenderElement name="grid" PrefixSpecial="formsubs" IdField="FormSubmissionId" grid="Default"/>
<script type="text/javascript">
	Grids['formsubs'].SetDependantToolbarButtons( new Array('edit','delete') );
</script>

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