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
8cddec41
Commit
8cddec41
authored
May 13, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated comments about adding/removing tab types for advanced modules
parent
66d3ccff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
cms/djangoapps/contentstore/views.py
+17
-13
No files found.
cms/djangoapps/contentstore/views.py
View file @
8cddec41
...
...
@@ -1268,26 +1268,30 @@ def course_advanced_updates(request, org, course, name):
request_body
=
json
.
loads
(
request
.
body
)
#Whether or not to filter the tabs key out of the settings metadata
filter_tabs
=
True
#Check to see if the user instantiated any advanced components. This is a hack to add the open ended panel tab
#to a course automatically if the user has indicated that they want to edit the combinedopenended or peergrading
#module, and to remove it if they have removed the open ended elements.
#Note: it has also been extended to include additional component types beyond openended.
#Check to see if the user instantiated any advanced components. This is a hack
#that does the following :
# 1) adds/removes the open ended panel tab to a course automatically if the user
# has indicated that they want to edit the combinedopendended or peergrading module
# 2) adds/removes the notes panel tab to a course automatically if the user has
# indicated that they want the notes module enabled in their course
if
ADVANCED_COMPONENT_POLICY_KEY
in
request_body
:
#Check to see if the user instantiated any open ended components
#Get the course so that we can scrape current tabs
course_module
=
modulestore
()
.
get_item
(
location
)
tab_component_types
=
[
'open_ended'
,
'notes'
]
#Maps tab types to components
tab_component_map
=
{
'open_ended'
:
OPEN_ENDED_COMPONENT_TYPES
,
'notes'
:
NOTE_COMPONENT_TYPES
,
}
for
tab_type
in
tab_component_types
:
#Check to see if the user instantiated any notes or open ended components
for
tab_type
in
tab_component_map
.
keys
():
component_types
=
tab_component_map
.
get
(
tab_type
)
found_ac_type
=
False
for
ac_type
in
component_types
:
if
ac_type
in
request_body
[
ADVANCED_COMPONENT_POLICY_KEY
]:
#Add
an open ended
tab to the course if needed
#Add tab to the course if needed
changed
,
new_tabs
=
add_extra_panel_tab
(
tab_type
,
course_module
)
#If a tab has been added to the course, then send the metadata along to CourseMetadata.update_from_json
if
changed
:
...
...
@@ -1295,18 +1299,18 @@ def course_advanced_updates(request, org, course, name):
request_body
.
update
({
'tabs'
:
new_tabs
})
#Indicate that tabs should not be filtered out of the metadata
filter_tabs
=
False
#Set this flag to avoid the
open ended
tab removal code below.
#Set this flag to avoid the tab removal code below.
found_ac_type
=
True
break
#If we did not find a
n open ended
module type in the advanced settings,
# we may need to remove the
open ended
tab from the course.
#If we did not find a module type in the advanced settings,
# we may need to remove the tab from the course.
if
not
found_ac_type
:
#Remove
open ended tab to
the course if needed
#Remove
tab from
the course if needed
changed
,
new_tabs
=
remove_extra_panel_tab
(
tab_type
,
course_module
)
if
changed
:
course_module
.
tabs
=
new_tabs
request_body
.
update
({
'tabs'
:
new_tabs
})
#Indicate that tabs should
not
be filtered out of the metadata
#Indicate that tabs should
*not*
be filtered out of the metadata
filter_tabs
=
False
response_json
=
json
.
dumps
(
CourseMetadata
.
update_from_json
(
location
,
request_body
,
filter_tabs
=
filter_tabs
))
return
HttpResponse
(
response_json
,
mimetype
=
"application/json"
)
...
...
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