## mako <%page args="active_page=None" expression_filter="h" /> <%namespace name='static' file='/static_content.html'/> <%! from django.utils.translation import ugettext as _ from django.conf import settings from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition from openedx.core.djangolib.js_utils import dump_js_escaped_json from openedx.core.djangolib.markup import HTML, Text %> <% show_preview_menu = course and staff_access and supports_preview_menu %> % if show_preview_menu: <% def selected(is_selected): return "selected" if is_selected else "" cohorted_user_partition = get_cohorted_user_partition(course) masquerade_user_name = masquerade.user_name if masquerade else None masquerade_group_id = masquerade.group_id if masquerade else None staff_selected = selected(not masquerade or masquerade.role != "student") specific_student_selected = selected(not staff_selected and masquerade.user_name) student_selected = selected(not staff_selected and not specific_student_selected and not masquerade_group_id) %> <% preview_options = { "courseId": course.id, "disableStudentAccess": disable_student_access if disable_student_access is not UNDEFINED else False, "specificStudentSelected": specific_student_selected, "cohortedUserPartitionId": cohorted_user_partition.id if cohorted_user_partition else None, "masqueradeUsername" : masquerade_user_name if masquerade_user_name is not UNDEFINED else None, } %> <%static:require_module_async module_name="lms/js/preview/preview_factory" class_name="PreviewFactory"> PreviewFactory(${preview_options | n, dump_js_escaped_json}); % endif