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
3c8eacd4
Commit
3c8eacd4
authored
Jul 17, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disabled student view if course is not yet released for students.
LMS-6617
parent
4aa2dc52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletions
+24
-1
lms/djangoapps/courseware/views.py
+17
-1
lms/templates/courseware/course_navigation.html
+7
-0
No files found.
lms/djangoapps/courseware/views.py
View file @
3c8eacd4
...
...
@@ -6,6 +6,7 @@ import logging
import
urllib
import
json
from
datetime
import
datetime
from
collections
import
defaultdict
from
django.utils
import
translation
from
django.utils.translation
import
ugettext
as
_
...
...
@@ -16,6 +17,7 @@ from django.core.exceptions import PermissionDenied
from
django.core.urlresolvers
import
reverse
from
django.contrib.auth.models
import
User
,
AnonymousUser
from
django.contrib.auth.decorators
import
login_required
from
django.utils.timezone
import
UTC
from
django.views.decorators.http
import
require_GET
from
django.http
import
Http404
,
HttpResponse
from
django.shortcuts
import
redirect
...
...
@@ -27,7 +29,7 @@ from functools import wraps
from
markupsafe
import
escape
from
courseware
import
grades
from
courseware.access
import
has_access
from
courseware.access
import
has_access
,
_adjust_start_date_for_beta_testers
from
courseware.courses
import
get_courses
,
get_course
,
get_studio_url
,
get_course_with_access
,
sort_by_announcement
from
courseware.masquerade
import
setup_masquerade
from
courseware.model_data
import
FieldDataCache
...
...
@@ -337,6 +339,13 @@ def index(request, course_id, chapter=None, section=None,
'reverifications'
:
fetch_reverify_banner_info
(
request
,
course_key
),
}
now
=
datetime
.
now
(
UTC
())
effective_start
=
_adjust_start_date_for_beta_testers
(
user
,
course
,
course_key
)
if
staff_access
and
now
<
effective_start
:
# Disable student view button if user is staff and
# course is not yet visible to students.
context
[
'disable_student_access'
]
=
True
has_content
=
course
.
has_children_at_depth
(
CONTENT_DEPTH
)
if
not
has_content
:
# Show empty courseware for a course with no units
...
...
@@ -590,6 +599,13 @@ def course_info(request, course_id):
'url_to_enroll'
:
url_to_enroll
,
}
now
=
datetime
.
now
(
UTC
())
effective_start
=
_adjust_start_date_for_beta_testers
(
request
.
user
,
course
,
course_key
)
if
staff_access
and
now
<
effective_start
:
# Disable student view button if user is staff and
# course is not yet visible to students.
context
[
'disable_student_access'
]
=
True
return
render_to_response
(
'courseware/info.html'
,
context
)
...
...
lms/templates/courseware/course_navigation.html
View file @
3c8eacd4
...
...
@@ -62,6 +62,10 @@ def url_class(is_active):
<script
type=
"text/javascript"
>
masq
=
(
function
(){
var
el
=
$
(
'#staffstatus'
);
%
if
disable_student_access
:
el
.
attr
(
"disabled"
,
true
);
el
.
attr
(
"title"
,
"${_("
Course
is
not
yet
visible
to
students
.
")}"
);
%
endif
var
setstat
=
function
(
status
){
if
(
status
==
'student'
){
el
.
html
(
'<font color="green">${_("Student view")}</font>'
);
...
...
@@ -72,6 +76,9 @@ masq = (function(){
setstat
(
'${masquerade}'
);
el
.
click
(
function
(){
if
(
el
.
attr
(
"disabled"
))
{
return
alert
(
"${_("
You
cannot
view
the
course
as
a
student
or
beta
tester
before
the
course
release
date
.
")}"
);
}
$
.
ajax
({
url
:
'/masquerade/toggle'
,
type
:
'GET'
,
success
:
function
(
result
){
...
...
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