Merge pull request #19535 from edx/mroytman/EDUCATOR-3829-proctortrack-configuration-in-studio
Enable proctortrack exam configuration in Studio
This commit is contained in:
@@ -68,6 +68,7 @@ from xmodule.modulestore.inheritance import own_metadata
|
||||
from xmodule.services import ConfigurationService, SettingsService
|
||||
from xmodule.tabs import CourseTabList
|
||||
from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, PREVIEW_VIEWS, STUDENT_VIEW, STUDIO_VIEW
|
||||
from edx_proctoring.api import get_exam_configuration_dashboard_url
|
||||
|
||||
__all__ = [
|
||||
'orphan_handler', 'xblock_handler', 'xblock_view_handler', 'xblock_outline_handler', 'xblock_container_handler'
|
||||
@@ -1221,6 +1222,12 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
|
||||
})
|
||||
elif xblock.category == 'sequential':
|
||||
rules_url = settings.PROCTORING_SETTINGS.get('LINK_URLS', {}).get('online_proctoring_rules', "")
|
||||
|
||||
proctoring_exam_configuration_link = None
|
||||
if xblock.is_proctored_exam:
|
||||
proctoring_exam_configuration_link = get_exam_configuration_dashboard_url(
|
||||
course.id, xblock_info['id'])
|
||||
|
||||
xblock_info.update({
|
||||
'is_proctored_exam': xblock.is_proctored_exam,
|
||||
'online_proctoring_rules': rules_url,
|
||||
@@ -1228,6 +1235,7 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
|
||||
'is_time_limited': xblock.is_time_limited,
|
||||
'exam_review_rules': xblock.exam_review_rules,
|
||||
'default_time_limit_minutes': xblock.default_time_limit_minutes,
|
||||
'proctoring_exam_configuration_link': proctoring_exam_configuration_link,
|
||||
})
|
||||
|
||||
# Update with gating info
|
||||
|
||||
@@ -2786,7 +2786,8 @@ class TestXBlockInfo(ItemTest):
|
||||
self.assertIsNone(xblock_info.get('child_info', None))
|
||||
|
||||
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
|
||||
def test_proctored_exam_xblock_info(self):
|
||||
@patch('contentstore.views.item.get_exam_configuration_dashboard_url')
|
||||
def test_proctored_exam_xblock_info(self, get_exam_configuration_dashboard_url_patch):
|
||||
self.course.enable_proctored_exams = True
|
||||
self.course.save()
|
||||
self.store.update_item(self.course, self.user.id)
|
||||
@@ -2807,6 +2808,8 @@ class TestXBlockInfo(ItemTest):
|
||||
default_time_limit_minutes=100
|
||||
)
|
||||
sequential = modulestore().get_item(sequential.location)
|
||||
|
||||
get_exam_configuration_dashboard_url_patch.return_value = 'test_url'
|
||||
xblock_info = create_xblock_info(
|
||||
sequential,
|
||||
include_child_info=True,
|
||||
@@ -2816,6 +2819,8 @@ class TestXBlockInfo(ItemTest):
|
||||
self.assertEqual(xblock_info['is_proctored_exam'], True)
|
||||
self.assertEqual(xblock_info['is_time_limited'], True)
|
||||
self.assertEqual(xblock_info['default_time_limit_minutes'], 100)
|
||||
self.assertEqual(xblock_info['proctoring_exam_configuration_link'], 'test_url')
|
||||
get_exam_configuration_dashboard_url_patch.assert_called_with(self.course.id, xblock_info['id'])
|
||||
|
||||
|
||||
class TestLibraryXBlockInfo(ModuleStoreTestCase):
|
||||
|
||||
@@ -157,22 +157,23 @@ define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components
|
||||
},
|
||||
|
||||
editXBlock: function() {
|
||||
var enable_proctored_exams = false;
|
||||
var enable_timed_exams = false;
|
||||
var modal;
|
||||
var enableProctoredExams = false;
|
||||
var enableTimedExams = false;
|
||||
if (this.model.get('category') === 'sequential') {
|
||||
if (this.parentView.parentView.model.has('enable_proctored_exams')) {
|
||||
enable_proctored_exams = this.parentView.parentView.model.get('enable_proctored_exams');
|
||||
enableProctoredExams = this.parentView.parentView.model.get('enable_proctored_exams');
|
||||
}
|
||||
if (this.parentView.parentView.model.has('enable_timed_exams')) {
|
||||
enable_timed_exams = this.parentView.parentView.model.get('enable_timed_exams');
|
||||
enableTimedExams = this.parentView.parentView.model.get('enable_timed_exams');
|
||||
}
|
||||
}
|
||||
|
||||
var modal = CourseOutlineModalsFactory.getModal('edit', this.model, {
|
||||
modal = CourseOutlineModalsFactory.getModal('edit', this.model, {
|
||||
onSave: this.refresh.bind(this),
|
||||
parentInfo: this.parentInfo,
|
||||
enable_proctored_exams: enable_proctored_exams,
|
||||
enable_timed_exams: enable_timed_exams,
|
||||
enable_proctored_exams: enableProctoredExams,
|
||||
enable_timed_exams: enableTimedExams,
|
||||
xblockType: XBlockViewUtils.getXBlockType(
|
||||
this.model.get('category'), this.parentView.model, true
|
||||
)
|
||||
|
||||
@@ -429,7 +429,7 @@
|
||||
.subsection-header-details {
|
||||
@include float(left);
|
||||
|
||||
width: flex-grid(6, 9);
|
||||
width: flex-grid(5, 9);
|
||||
|
||||
.icon, .wrapper-subsection-title {
|
||||
display: inline-block;
|
||||
@@ -459,7 +459,7 @@
|
||||
.subsection-header-actions {
|
||||
@include float(right);
|
||||
|
||||
width: flex-grid(3, 9);
|
||||
width: flex-grid(4, 9);
|
||||
margin-top: -($baseline/4);
|
||||
|
||||
@include text-align(right);
|
||||
@@ -469,6 +469,10 @@
|
||||
@extend %t-action2;
|
||||
|
||||
margin-right: ($baseline/2);
|
||||
|
||||
.proctoring-configuration-button {
|
||||
@extend %ui-btn-flat-outline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,9 +122,15 @@ if (is_proctored_exam) {
|
||||
</span>
|
||||
<% } %>
|
||||
</h3>
|
||||
|
||||
<div class="<%- xblockType %>-header-actions">
|
||||
<ul class="actions-list">
|
||||
<% if (xblockInfo.isSequential() && xblockInfo.get('proctoring_exam_configuration_link')) { %>
|
||||
<li class="action-item">
|
||||
<a href="<%- xblockInfo.get('proctoring_exam_configuration_link') %>" data-tooltip="<%- gettext('Proctoring Settings') %>" class="proctoring-configuration-button" target="_blank">
|
||||
<span class="action-button-text"><%- gettext('Proctoring Settings') %></span>
|
||||
</a>
|
||||
</li>
|
||||
<% } %>
|
||||
<% if (xblockInfo.isPublishable()) { %>
|
||||
<li class="action-item action-publish">
|
||||
<a href="#" data-tooltip="<%- gettext('Publish') %>" class="publish-button action-button">
|
||||
|
||||
@@ -80,7 +80,7 @@ edx-enterprise
|
||||
edx-milestones
|
||||
edx-oauth2-provider
|
||||
edx-organizations
|
||||
edx-proctoring>=1.5.0
|
||||
edx-proctoring>=1.5.3
|
||||
edx-proctoring-proctortrack
|
||||
edx-rest-api-client
|
||||
edx-search
|
||||
|
||||
Reference in New Issue
Block a user