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
8934cf35
Commit
8934cf35
authored
Jun 19, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pdf_textbooks tab when textbooks are created
parent
c59d515c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
cms/djangoapps/contentstore/views/course.py
+11
-1
cms/djangoapps/contentstore/views/tabs.py
+3
-2
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
8934cf35
...
...
@@ -437,9 +437,19 @@ def textbook_index(request, org, course, name):
except
ValueError
:
msg
=
{
"error"
:
"invalid JSON"
}
return
HttpResponseBadRequest
(
json
.
dumps
(
msg
),
content_type
=
"application/json"
)
if
not
isinstance
(
obj
,
(
list
,
tuple
)):
msg
=
{
"error"
:
"must be JSON list"
}
return
HttpResponseBadRequest
(
json
.
dumps
(
msg
),
content_type
=
"application/json"
)
for
textbook
in
obj
:
if
not
textbook
.
get
(
"tab_title"
):
msg
=
{
"error"
:
"every textbook must have a tab_title"
}
return
HttpResponseBadRequest
(
json
.
dumps
(
msg
),
content_type
=
"application/json"
)
course_module
.
pdf_textbooks
=
obj
if
not
any
(
tab
[
'type'
]
==
'pdf_textbooks'
for
tab
in
course_module
.
tabs
):
course_module
.
tabs
.
append
({
"type"
:
"pdf_textbooks"
})
store
.
update_metadata
(
course_module
.
location
,
own_metadata
(
course_module
))
return
HttpResponse
(
''
,
content_type
=
"application/json"
,
status
=
201
)
return
HttpResponse
(
''
,
content_type
=
"application/json"
,
status
=
204
)
else
:
upload_asset_callback_url
=
reverse
(
'upload_asset'
,
kwargs
=
{
'org'
:
org
,
...
...
cms/djangoapps/contentstore/views/tabs.py
View file @
8934cf35
...
...
@@ -10,7 +10,7 @@ from mitxmako.shortcuts import render_to_response
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.inheritance
import
own_metadata
from
xmodule.modulestore.django
import
modulestore
from
..utils
import
get_course_for_item
from
..utils
import
get_course_for_item
,
get_modulestore
from
.access
import
get_location_and_verify_access
__all__
=
[
'edit_tabs'
,
'reorder_static_tabs'
,
'static_pages'
,
'edit_static'
]
...
...
@@ -82,7 +82,8 @@ def reorder_static_tabs(request):
@ensure_csrf_cookie
def
edit_tabs
(
request
,
org
,
course
,
coursename
):
location
=
[
'i4x'
,
org
,
course
,
'course'
,
coursename
]
course_item
=
modulestore
()
.
get_item
(
location
)
store
=
get_modulestore
(
location
)
course_item
=
store
.
get_item
(
location
)
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
...
...
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