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
35a461d9
Commit
35a461d9
authored
Aug 02, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Empty file inputs insert empty string as their submission in ajax; LMS reacts accordingly
parent
ea36eef6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+5
-2
lms/djangoapps/courseware/module_render.py
+15
-6
No files found.
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
35a461d9
...
...
@@ -65,11 +65,14 @@ class @Problem
# For each file input, allow a single file submission,
# routed to Django 'request.FILES'
@
$
(
'input:file'
).
each
(
index
,
element
)
->
fd
.
append
(
element
.
id
,
element
.
files
[
0
])
if
element
.
files
[
0
]
instanceof
File
fd
.
append
(
element
.
id
,
element
.
files
[
0
])
else
fd
.
append
(
element
.
id
,
''
)
# Even if no file selected, need to include input id
# Simple (non-file) answers,
# routed to Django 'request.POST'
fd
.
append
(
'_answers_querystring'
,
@
answers
)
fd
.
append
(
'_
_
answers_querystring'
,
@
answers
)
settings
=
type
:
"POST"
...
...
lms/djangoapps/courseware/module_render.py
View file @
35a461d9
...
...
@@ -275,13 +275,22 @@ def modx_dispatch(request, dispatch=None, id=None):
post
=
request
.
POST
.
copy
()
# Catch the use of FormData in xmodule frontend
. After this block, the 'post' dict
# is functionally equivalent before- and after- the use of FormData
# Catch the use of FormData in xmodule frontend
for 'problem_check'. After this block,
#
the 'post' dict
is functionally equivalent before- and after- the use of FormData
# TODO: A more elegant solution?
if
post
.
has_key
(
'_answers_querystring'
):
post
=
parse_qs
(
post
.
get
(
'_answers_querystring'
))
for
key
in
post
.
keys
():
post
[
key
]
=
post
[
key
][
0
]
# parse_qs returns { key: list }
if
post
.
has_key
(
'__answers_querystring'
):
qs
=
post
.
pop
(
'__answers_querystring'
)[
0
]
qsdict
=
parse_qs
(
qs
,
keep_blank_values
=
True
)
for
key
in
qsdict
.
keys
():
qsdict
[
key
]
=
qsdict
[
key
][
0
]
# parse_qs returns { key: list }
post
.
update
(
qsdict
)
# Check for submitted files
if
request
.
FILES
:
print
'Got files!'
print
post
.
keys
()
print
request
.
FILES
.
keys
()
student_module_cache
=
StudentModuleCache
(
request
.
user
,
modulestore
()
.
get_item
(
id
))
instance
,
instance_module
,
shared_module
,
module_type
=
get_module
(
request
.
user
,
request
,
id
,
student_module_cache
)
...
...
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