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
e99aa117
Commit
e99aa117
authored
Oct 05, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make publish and unpublish recursive operations
parent
b079b336
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
cms/djangoapps/contentstore/views.py
+15
-3
No files found.
cms/djangoapps/contentstore/views.py
View file @
e99aa117
...
...
@@ -418,6 +418,13 @@ def get_module_previews(request, descriptor):
preview_html
.
append
(
module
.
get_html
())
return
preview_html
def
_xmodule_recurse
(
item
,
action
):
for
child
in
item
.
get_children
():
_xmodule_recurse
(
child
,
action
)
action
(
item
)
def
_delete_item
(
item
,
recurse
=
False
):
if
recurse
:
children
=
item
.
get_children
()
...
...
@@ -441,7 +448,10 @@ def delete_item(request):
item
=
modulestore
()
.
get_item
(
item_location
)
_delete_item
(
item
,
delete_children
)
if
delete_children
:
_xmodule_recurse
(
item
,
lambda
i
:
modulestore
()
.
delete_item
(
i
.
location
))
else
:
modulestore
()
.
delete_item
(
item
.
location
)
return
HttpResponse
()
...
...
@@ -517,7 +527,8 @@ def publish_draft(request):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
modulestore
()
.
publish
(
location
)
item
=
modulestore
()
.
get_item
(
location
)
_xmodule_recurse
(
item
,
lambda
i
:
modulestore
()
.
publish
(
i
.
location
))
return
HttpResponse
()
...
...
@@ -531,7 +542,8 @@ def unpublish_unit(request):
if
not
has_access
(
request
.
user
,
location
):
raise
PermissionDenied
()
modulestore
()
.
unpublish
(
location
)
item
=
modulestore
()
.
get_item
(
location
)
_xmodule_recurse
(
item
,
lambda
i
:
modulestore
()
.
unpublish
(
i
.
location
))
return
HttpResponse
()
...
...
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