Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
0914acd5
Commit
0914acd5
authored
Nov 22, 2017
by
Bill Filler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show gated content in outline and navigation, but don't show actual content when goto page
parent
c1abf432
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
11 deletions
+34
-11
common/lib/xmodule/xmodule/seq_module.py
+17
-5
lms/djangoapps/course_api/blocks/transformers/milestones.py
+2
-2
lms/djangoapps/courseware/access.py
+1
-1
lms/djangoapps/courseware/access_utils.py
+1
-1
lms/templates/hidden_content.html
+13
-2
No files found.
common/lib/xmodule/xmodule/seq_module.py
View file @
0914acd5
...
...
@@ -253,8 +253,11 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
display depending on whether staff is masquerading.
"""
course
=
self
.
_get_course
()
if
not
self
.
_can_user_view_content
(
course
):
if
course
.
self_paced
:
content_gated
=
self
.
_is_content_gated
()
if
not
self
.
_can_user_view_content
(
course
)
or
content_gated
:
if
content_gated
:
banner_text
=
_
(
'This subsection is locked until prerequisite requirements met.'
)
elif
course
.
self_paced
:
banner_text
=
_
(
"Because the course has ended, this assignment is hidden from the learner."
)
else
:
banner_text
=
_
(
"Because the due date has passed, this assignment is hidden from the learner."
)
...
...
@@ -264,6 +267,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
{
'self_paced'
:
course
.
self_paced
,
'progress_url'
:
context
.
get
(
'progress_url'
),
'content_gated'
:
content_gated
}
)
...
...
@@ -274,14 +278,22 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
Checks whether the content is gated for learners. If so,
returns a banner_text depending on whether user is staff.
"""
banner_text
=
_
(
'This subsection is unlocked for learners when they meet the prerequisite requirements.'
)
if
self
.
_is_content_gated
()
and
self
.
runtime
.
user_is_staff
:
return
banner_text
def
_is_content_gated
(
self
):
"""
Checks whether the content is gated for learners.
"""
milestones_service
=
self
.
runtime
.
service
(
self
,
'milestones'
)
if
milestones_service
:
content_milestones
=
milestones_service
.
get_course_content_milestones
(
self
.
course_id
,
self
.
location
,
'requires'
)
banner_text
=
_
(
'This subsection is unlocked for learners when they meet the prerequisite requirements.'
)
if
content_milestones
and
self
.
runtime
.
user_is_staff
:
return
banner_text
return
content_milestones
return
False
def
_can_user_view_content
(
self
,
course
):
"""
...
...
lms/djangoapps/course_api/blocks/transformers/milestones.py
View file @
0914acd5
...
...
@@ -66,8 +66,8 @@ class MilestonesAndSpecialExamsTransformer(BlockStructureTransformer):
if
usage_info
.
has_staff_access
:
return
False
elif
self
.
has_pending_milestones_for_user
(
block_key
,
usage_info
):
return
True
#
elif self.has_pending_milestones_for_user(block_key, usage_info):
#
return True
elif
self
.
gated_by_required_content
(
block_key
,
block_structure
,
required_content
):
return
True
elif
(
settings
.
FEATURES
.
get
(
'ENABLE_SPECIAL_EXAMS'
,
False
)
and
...
...
lms/djangoapps/courseware/access.py
View file @
0914acd5
...
...
@@ -493,7 +493,7 @@ def _has_access_descriptor(user, action, descriptor, course_key=None):
return
(
_visible_to_nonstaff_users
(
descriptor
)
and
_can_access_descriptor_with_milestones
(
user
,
descriptor
,
course_key
)
and
#
_can_access_descriptor_with_milestones(user, descriptor, course_key) and
(
_has_detached_class_tag
(
descriptor
)
or
check_start_date
(
user
,
descriptor
.
days_early_for_beta
,
descriptor
.
start
,
course_key
)
...
...
lms/djangoapps/courseware/access_utils.py
View file @
0914acd5
...
...
@@ -15,7 +15,7 @@ from openedx.features.course_experience import COURSE_PRE_START_ACCESS_FLAG
from
student.roles
import
CourseBetaTesterRole
from
xmodule.util.django
import
get_current_request_hostname
DEBUG_ACCESS
=
Fals
e
DEBUG_ACCESS
=
Tru
e
log
=
getLogger
(
__name__
)
ACCESS_GRANTED
=
AccessResponse
(
True
)
...
...
lms/templates/hidden_content.html
View file @
0914acd5
...
...
@@ -6,7 +6,9 @@ from openedx.core.djangolib.markup import HTML, Text
<div
class=
"sequence hidden-content proctored-exam completed"
>
<h3>
% if self_paced:
% if content_gated:
${_("Prerequistes not met.")}
% elif self_paced:
${_("The course has ended.")}
% else:
${_("The due date for this assignment has passed.")}
...
...
@@ -14,7 +16,16 @@ from openedx.core.djangolib.markup import HTML, Text
</h3>
<hr>
<p>
% if self_paced:
% if content_gated:
${Text(_(
"This content is locked until all prerequistes have been met.{line_break}Press refresh to try again. "
"Grade is available on the {link_start}progress page{link_end}."
)).format(
line_break=HTML("
<br>
"),
link_start=HTML("
<a
href=
'{}'
>
").format(progress_url),
link_end=HTML("
</a>
"),
)}
% elif self_paced:
${Text(_(
"Because the course has ended, this assignment is no longer "
"available.{line_break}If you have completed this assignment, your "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment