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
ab49631b
Commit
ab49631b
authored
Nov 03, 2016
by
jagonzalr
Committed by
renevatium
Nov 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add disable library creation feature flag
parent
b8bc4c87
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
cms/djangoapps/contentstore/views/course.py
+30
-5
cms/envs/common.py
+1
-0
cms/templates/index.html
+3
-3
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
ab49631b
...
...
@@ -467,7 +467,10 @@ def course_listing(request):
List all courses available to the logged in user
"""
courses
,
in_process_course_actions
=
get_courses_accessible_to_user
(
request
)
libraries
=
_accessible_libraries_list
(
request
.
user
)
if
LIBRARIES_ENABLED
else
[]
user
=
request
.
user
user_has_permission
=
\
user
.
is_active
and
(
user
.
is_staff
or
CourseCreatorRole
()
.
has_user
(
user
))
libraries
=
_accessible_libraries_list
(
request
.
user
)
if
LIBRARIES_ENABLED
and
user_has_permission
else
[]
programs_config
=
ProgramsApiConfig
.
current
()
raw_programs
=
get_programs
(
request
.
user
)
if
programs_config
.
is_studio_tab_enabled
else
[]
...
...
@@ -516,18 +519,18 @@ def course_listing(request):
return
render_to_response
(
'index.html'
,
{
'courses'
:
courses
,
'in_process_course_actions'
:
in_process_course_actions
,
'libraries_enabled'
:
LIBRARIES_ENABLED
,
'libraries'
:
[
format_library_for_view
(
lib
)
for
lib
in
libraries
],
'show_new_library_button'
:
LIBRARIES_ENABLED
and
request
.
user
.
is_active
,
'user'
:
request
.
user
,
'request_course_creator_url'
:
reverse
(
'contentstore.views.request_course_creator'
),
'course_creator_status'
:
_get_course_creator_status
(
request
.
user
),
'rerun_creator_status'
:
GlobalStaff
()
.
has_user
(
request
.
user
),
'allow_unicode_course_id'
:
settings
.
FEATURES
.
get
(
'ALLOW_UNICODE_COURSE_ID'
,
False
),
'allow_course_reruns'
:
settings
.
FEATURES
.
get
(
'ALLOW_COURSE_RERUNS'
,
True
),
'libraries_enabled'
:
LIBRARIES_ENABLED
,
'libraries'
:
[
format_library_for_view
(
lib
)
for
lib
in
libraries
],
'library_creator_status'
:
_get_library_creator_status
(
user
),
'is_programs_enabled'
:
programs_config
.
is_studio_tab_enabled
and
request
.
user
.
is_staff
,
'programs'
:
programs
,
'program_authoring_url'
:
reverse
(
'programs'
)
,
'program_authoring_url'
:
reverse
(
'programs'
)
})
...
...
@@ -1646,3 +1649,25 @@ def _get_course_creator_status(user):
course_creator_status
=
'granted'
return
course_creator_status
def
_get_library_creator_status
(
user
):
"""
Helper method for returning the library creation status for a particular user,
taking into account the values of DISABLE_LIBRARY_CREATION and LIBRARIES_ENABLED.
"""
if
user
.
is_staff
:
library_creator_status
=
'granted'
elif
settings
.
FEATURES
.
get
(
'DISABLE_LIBRARY_CREATION'
,
False
):
library_creator_status
=
'disallowed_for_this_site'
elif
settings
.
FEATURES
.
get
(
'ENABLE_CREATOR_GROUP'
,
False
):
library_creator_status
=
get_course_creator_status
(
user
)
if
library_creator_status
is
None
:
# User not grandfathered in as an existing user, has not previously visited the dashboard page.
# Add the user to the course creator admin table with status 'unrequested'.
add_user_with_status_unrequested
(
user
)
library_creator_status
=
get_course_creator_status
(
user
)
else
:
library_creator_status
=
'granted'
return
library_creator_status
cms/envs/common.py
View file @
ab49631b
...
...
@@ -168,6 +168,7 @@ FEATURES = {
# Enable support for content libraries. Note that content libraries are
# only supported in courses using split mongo.
'ENABLE_CONTENT_LIBRARIES'
:
True
,
'DISABLE_LIBRARY_CREATION'
:
False
,
# Milestones application flag
'MILESTONES_APP'
:
False
,
...
...
cms/templates/index.html
View file @
ab49631b
...
...
@@ -34,7 +34,7 @@ from openedx.core.djangolib.markup import HTML, Text
<a
href=
"mailto:${settings.FEATURES.get('STUDIO_REQUEST_EMAIL','')}"
>
${_("Email staff to create course")}
</a>
% endif
% if
show_new_library_button
:
% if
library_creator_status=='granted'
:
<a
href=
"#"
class=
"button new-button new-library-button"
><span
class=
"icon fa fa-plus icon-inline"
aria-hidden=
"true"
></span>
${_("New Library")}
</a>
% endif
...
...
@@ -130,7 +130,7 @@ from openedx.core.djangolib.markup import HTML, Text
% endif
%if libraries_enabled and
show_new_library_button
:
%if libraries_enabled and
library_creator_status=='granted'
:
<div
class=
"wrapper-create-element wrapper-create-library"
>
<form
class=
"form-create create-library library-info"
id=
"create-library-form"
name=
"create-library-form"
>
<div
class=
"wrap-error"
>
...
...
@@ -497,7 +497,7 @@ from openedx.core.djangolib.markup import HTML, Text
</div>
</div>
</div>
% if
show_new_library_button
:
% if
library_creator_status=='granted'
:
<div
class=
"notice-item has-actions"
>
<div
class=
"msg"
>
<h3
class=
"title"
>
${_('Create Your First Library')}
</h3>
...
...
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