<%!
import json
from django.utils.translation import ugettext as _
%>

<h3 class="hd hd-3 problem-header">
    ## Translators:  "External resource" means that this learning module is hosted on a platform external to the edX LMS
    ${display_name} (${_('External resource')})
</h3>

% if has_score and weight:
    <div class="problem-progress">
        % if module_score is not None:
            ## Translators: "points" is the student's achieved score on this LTI unit, and "total_points" is the maximum number of points achievable.
            (${_("{points} / {total_points} points").format(points=module_score, total_points=weight)})
        % else:
            ## Translators: "total_points" is the maximum number of points achievable on this LTI unit
            (${_("{total_points} points possible").format(total_points=weight)})
        % endif
    </div>
% endif

<div
    id="${element_id}"
    class="${element_class}"
    data-ask-to-send-username="${ask_to_send_username}"
    data-ask-to-send-email="${ask_to_send_email}"
>

% if launch_url and launch_url !=  'http://www.example.com' and not hide_launch:
    % if open_in_a_new_page:
        <div class="wrapper-lti-link">
            % if description:
                <div class="lti-description">${description}</div>
            % endif
            <p class="lti-link external"><a target="_blank" class="link_lti_new_window" href="${form_url}">
                ${button_text or _('View resource in a new window')}
                 <span class="icon fa fa-external-link" aria-hidden="true"></span>
            </a></p>
        </div>
    % else:
        ## The result of the form submit will be rendered here.
        <iframe
            title="Form Result"
            class="ltiLaunchFrame"
            name="ltiFrame-${element_id}"
            src="${form_url}"
            allowfullscreen="true"
            webkitallowfullscreen="true"
            mozallowfullscreen="true"
        ></iframe>
    % endif
% elif not hide_launch:
    <h4 class="hd hd-4 error_message">
        ${_('Please provide launch_url. Click "Edit", and fill in the required fields.')}
    </h4>
% endif

% if has_score and comment:
    <h4 class="hd hd-4 problem-feedback-label">${_("Feedback on your work from the grader:")}</h4>
    <div class="problem-feedback">
        ## sanitized with bleach in view
        ${comment}
    </div>
% endif

</div>