<%!
import json
from django.utils.translation import ugettext as _
%>
<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>LTI</title>
    </head>
    <body>
    ## This form will be hidden.
    ## LTI module JavaScript will trigger a "submit" on the form, and the
    ## result will be rendered instead.
        <form
            id="lti-${element_id}"
            action="${launch_url}"
            method="post"
            encType="application/x-www-form-urlencoded"
            style="display:none;"
        >

            % for param_name, param_value in input_fields.items():
                <input name="${param_name}" value="${param_value}" />
            %endfor

            <input type="submit" value="${_('Press to Launch')}" />
        </form>
        <script type="text/javascript">
            (function (d) {
                var element = d.getElementById("lti-${element_id}");
                if (element) {
                    element.submit();
                }
            }(document));
        </script>
    </body>
</html>
