#!/bin/sh

#turn off auto expansion
set -f

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


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

on_message()
{
	case "$in_action" in
		#information for renderer
		template)
			echo '('
			echo 'template "form"'
			echo 'url "ulogd.html"'
			echo 'help "ulogd.html"'
			if [ -n "$in_select" ]; then
				[ -n "$in_from" ] || in_from=-1
				[ -n "$in_to" ] || in_to=-1
				[ "$in_checkip" = "#t" ] && checkip="checkip" || checkip=""
				printf ' redirect "/ulogd/%s/%s/%s/%s"' "$in_iface" "$in_from" "$in_to" "$checkip"
			fi
			echo ')'
			;;
		info)
			echo '('
			printf ' title "%s"' "$(_ "Network traffic")"
			printf ' description "%s"' "$(_ "Network traffic statistics")"
			echo ')'
			;;
		*)
			echo '#f'
			;;
	esac
}

message_loop
