<xf:if is="$node.isInsert()">
	<xf:title>{{ phrase('add_search_forum') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_search_forum:') }} {$node.title}</xf:title>
</xf:if>

<xf:pageaction if="$node.isUpdate()">
	<xf:button href="{{ link('search-forums/delete', $node) }}" icon="delete" overlay="true" />
</xf:pageaction>

<xf:form action="{{ link('search-forums/save', $node) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:macro template="node_edit_macros" name="title" arg-node="{$node}" />
			<xf:macro template="node_edit_macros" name="description" arg-node="{$node}" />

			<hr class="formRowSep" />
			<xf:macro template="node_edit_macros" name="node_name" arg-node="{$node}" />
			<xf:macro template="node_edit_macros" name="position"
				arg-node="{$node}"
				arg-nodeTree="{$nodeTree}" />
			<xf:macro template="node_edit_macros" name="navigation"
				arg-node="{$node}"
				arg-navChoices="{$navChoices}" />
			<xf:macro template="node_edit_macros" name="style"
				arg-node="{$node}"
				arg-styleTree="{$styleTree}" />
			<hr class="formRowSep" />
		</div>

		<h2 class="block-formSectionHeader">
			<span class="block-formSectionHeader-aligner">{{ phrase('search_results') }}</span>
		</h2>
		<div class="block-body">
			<hr class="formRowSep" />

			<xf:formrow rowtype="input"
				label="{{ phrase('sort_order') }}">

				<div class="inputPair">
					<xf:select name="sort_order" value="{$searchForum.sort_order}" class="input--inline">
						<xf:option value="last_post_date" label="{{ phrase('last_message') }}" />
						<xf:option value="post_date" label="{{ phrase('start_date') }}" />
						<xf:option value="title" label="{{ phrase('title') }}" />
						<xf:option value="reply_count" label="{{ phrase('replies') }}" />
						<xf:option value="view_count" label="{{ phrase('views') }}" />
					</xf:select>

					<xf:select name="sort_direction" value="{$searchForum.sort_direction}"
						class="input--inline">
						<xf:option value="desc" label="{{ phrase('descending') }}" />
						<xf:option value="asc" label="{{ phrase('ascending') }}" />
					</xf:select>
				</div>
			</xf:formrow>

			<xf:numberboxrow name="max_results" value="{$searchForum.max_results}"
				label="{{ phrase('maximum_results') }}"
				min="20" max="1000" />

			<xf:numberboxrow name="cache_ttl" value="{$searchForum.cache_ttl}"
				label="{{ phrase('cache_length') }}"
				explain="{{ phrase('search_forum_cache_length_desc') }}"
				units="{{ phrase('units_minutes') }}"
				min="1" max="1440" />
		</div>

		<h2 class="block-formSectionHeader">
			<span class="block-formSectionHeader-aligner">{{ phrase('thread_criteria') }}</span>
		</h2>
		<div class="block-body">
			<xf:include template="helper_thread_search_criteria" />
		</div>

		<xf:submitrow sticky="true" icon="save" />
	</div>
</xf:form>