<xf:title>{{ phrase('batch_update_threads') }}</xf:title>

<xf:form action="{{ link('threads/batch-update/action') }}" class="block">
	<div class="block-container">
		<h2 class="block-header">{{ phrase('update_threads') }}</h2>
		<div class="block-body">
			<xf:formrow label="{{ phrase('matched_threads') }}">
				{$total|number}
				<xf:if is="!$threadIds">
					<span role="presentation" aria-hidden="true">&middot;</span>
					<a href="{{ link('threads/list', null, {'criteria': $criteria, 'all': true}) }}">{{ phrase('view_or_filter_matches') }}</a>
				</xf:if>
			</xf:formrow>

			<hr class="formRowSep" />

			<xf:selectrow name="actions[node_id]"
				label="{{ phrase('move_to_forum') }}">

				<xf:option value="0"></xf:option>
				<xf:foreach loop="$forums" value="$forum">
					<xf:option value="{$forum.value}" label="{$forum.label}" disabled="{$forum.disabled}" />
				</xf:foreach>
				<xf:explain><xf:if is="$hasPrefixes">
					{{ phrase('move_to_forum_prefixes_explain') }}
				</xf:if></xf:explain>
			</xf:selectrow>

			<xf:selectrow name="actions[discussion_type]"
				label="{{ phrase('change_thread_type') }}"
				explain="{{ phrase('thread_type_will_only_be_changed_if_it_is_valid_for_forum') }}">
				<xf:option value=""></xf:option>
				<xf:options source="$threadTypes" />
			</xf:selectrow>

			<xf:if is="$prefixes.prefixesGrouped">
				<xf:checkboxrow
					explain="{{ phrase('prefix_will_only_be_applied_if_valid_for_forum') }}">
					<xf:option name="actions[apply_thread_prefix]"
						label="{{ phrase('set_prefix') }}">

						<xf:dependent>
							<xf:macro template="public:prefix_macros" name="select"
								arg-prefixes="{$prefixes.prefixesGrouped}"
								arg-name="actions[prefix_id]"
								arg-type="thread" />
						</xf:dependent>
					</xf:option>
				</xf:checkboxrow>
			</xf:if>

			<hr class="formRowSep" />

			<xf:checkboxrow>
				<xf:option name="actions[stick]" value="stick">{{ phrase('stick_threads') }}</xf:option>
				<xf:option name="actions[unstick]" value="unstick">{{ phrase('unstick_threads') }}</xf:option>
				<xf:option name="actions[lock]" value="lock">{{ phrase('lock_threads') }}</xf:option>
				<xf:option name="actions[unlock]" value="unlock">{{ phrase('unlock_threads') }}</xf:option>
				<xf:option name="actions[approve]" value="approve">{{ phrase('approve_threads') }}</xf:option>
				<xf:option name="actions[unapprove]" value="unapprove">{{ phrase('unapprove_threads') }}</xf:option>
				<xf:option name="actions[soft_delete]" value="soft_delete">{{ phrase('soft_delete_threads') }}</xf:option>
			</xf:checkboxrow>

		</div>
		<xf:submitrow submit="{{ phrase('update_threads') }}" icon="save" />
	</div>

	<xf:if is="$threadIds">
		<xf:hiddenval name="thread_ids">{$threadIds|json}</xf:hiddenval>
	<xf:else />
		<xf:hiddenval name="criteria">{$criteria|json}</xf:hiddenval>
	</xf:if>
</xf:form>

<xf:form action="{{ link('threads/batch-update/action') }}" class="block">
	<div class="block-container">
		<h2 class="block-header">{{ phrase('delete_threads') }}</h2>
		<div class="block-body">
			<xf:checkboxrow>
				<xf:option name="actions[delete]">
					{{ phrase('confirm_deletion_of_x_threads', {'total': $total|number}) }}
				</xf:option>
			</xf:checkboxrow>
		</div>
		<xf:submitrow name="confirm_delete" icon="delete" />
	</div>

	<xf:if is="$threadIds">
		<xf:hiddenval name="thread_ids">{$threadIds|json}</xf:hiddenval>
	<xf:else />
		<xf:hiddenval name="criteria">{$criteria|json}</xf:hiddenval>
	</xf:if>
</xf:form>