#SQLFormSearchTmpl00001
#create
#title:Default SQLForm Search template
#menuTitle:Default SQLForm Search template
#url:default_sqlform_search_template
#namespace:SQLForm/Search
<a name="id<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
	<p><tmpl_var controls></p>
</tmpl_if>

<div class="SQLForm-contentBox">

<tmpl_if displayTitle>
	<h1><tmpl_var title></h1>
</tmpl_if>

<tmpl_var managementLinks>

<h2>Search records</h2>
<a href="<tmpl_var superSearch.url>"><tmpl_var superSearch.label></a><br>

<tmpl_if errorOccurred>
Some error(s) occurred:
<ul>
	<tmpl_loop errorLoop>
	<li><tmpl_var error.message></li>
	</tmpl_loop>
</ul>
</tmpl_if>

<tmpl_var searchForm>

<tmpl_if showFieldsDefined>
<tmpl_var searchResults.header>
<tmpl_var searchResults.actionButtons>
<table border="0">
	<tr>
		<th></th>
		<tmpl_if showMetaData>
		<th>Last update</th>
		<th>Last update by</th>
		</tmpl_if>
	<tmpl_loop headerLoop>
		<th <tmpl_if
header.sort.onThis>color="red"</tmpl_if>>
			<a href="<tmpl_var header.sort.url>">
			<tmpl_var header.title> 
			<tmpl_if header.sort.onThis><tmpl_if header.sort.ascending>(asc)<tmpl_else>(desc)</tmpl_if></tmpl_if></a></th>
	</tmpl_loop>
	</tr>
	<tmpl_loop searchResults.recordLoop>
	<tr>
		<td><tmpl_var record.controls></td>
		<tmpl_if showMetaData>
		<td><tmpl_var record.updateDate></td>
		<td><tmpl_var record.updatedBy></td>
		</tmpl_if>
		<tmpl_loop record.valueLoop>
		<td>
		<tmpl_if record.value.isFile>
			<tmpl_if record.value>
				<a href="<tmpl_var record.value.downloadUrl>">
				<tmpl_if record.value.isImage>
					<img width="100" src="<tmpl_var record.value.downloadUrl>">
				<tmpl_else>
					Click here for file
				</tmpl_if>
				</a>
			</tmpl_if>
		<tmpl_else>
			<tmpl_var record.value>
		</tmpl_if>
		</td>
		</tmpl_loop>
	</tr>
	</tmpl_loop>
</table>
<tmpl_var searchResults.actionButtons>
<tmpl_var searchResults.footer>
<tmpl_else>
No fields are defined to be shown in the search results.
</tmpl_if>

</div>
