#!/bin/sh -ef

_()
{
	LANG=${in_language%%;*}.utf8 gettext 'alterator-ovz' "$1"
}


. /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"'
			echo ' help "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 ' help "ovz-template-status.html"'
			echo ' redirect "/ovz-template"'
			;;
	esac
	echo ')'
}

on_message()
{
	case "$in_action" in
		#information for renderer
		template)
			alt_template
			;;
		info)
			echo '('
			printf ' title "%s"' "`_ "OpenVZ Templates"`"
			printf ' description "%s"' "`_ "Creation OpenVZ Templates from profile"`"
			printf ' group "%s"' "`_ "Virtualization"`"
			printf ' weight 99'
			echo ')'
			;;
		*)
			echo '#f'
			;;
	esac
}

message_loop
