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

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

% 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')}
                 <i class="icon fa fa-external-link"></i>
            </a></p>
        </div>
    % else:
        ## The result of the form submit will be rendered here.
        <iframe
            class="ltiLaunchFrame"
            name="ltiFrame-${element_id}"
            src="${form_url}"
        ></iframe>
    % endif
% elif not hide_launch:
    <h3 class="error_message">
        ${_('Please provide launch_url. Click "Edit", and fill in the required fields.')}
    </h3>
% endif

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

</div>
