#!/bin/sh -ef

. /usr/share/alterator/build/backend3.sh

alt_template()
{
	echo '('
	case "$in__objects" in
		/)
			echo ' template "form"'
			echo ' translate "alterator-ovz"'
			echo ' url "ovz-template-list.html"'
			[ "$in_orig_action" = "new" -a -n "$in_name" ] &&
			    printf ' redirect "/ovz-template/%s"' "$in_name"
			;;
		*)
			echo ' template "form"'
			echo ' translate "alterator-ovz"'
			echo ' url "ovz-template-status.html"'
			echo ' redirect "/ovz-template"'
			;;
	esac
	echo ')'
}

on_message()
{
	case "$in_action" in
		#information for renderer
		template)
			alt_template
			;;
		*)
			echo '#f'
			;;
	esac
}

message_loop
