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
6c875206
Commit
6c875206
authored
Aug 06, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify file submission front end
parent
c950d437
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
23 deletions
+8
-23
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+5
-7
lms/djangoapps/courseware/module_render.py
+3
-16
No files found.
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
6c875206
...
...
@@ -67,16 +67,14 @@ class @Problem
fd
=
new
FormData
()
# For each file input, allow a single file submission,
# which is routed to Django 'request.FILES'
@
$
(
'input:file'
).
each
(
index
,
element
)
->
@
$
(
"[id^=input_
#{
@
element_id
.
replace
(
/problem_/
,
''
)
}
_]"
).
each
(
index
,
element
)
->
if
element
.
type
is
'file'
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, which is routed to Django 'request.POST'
fd
.
append
(
'__answers_querystring'
,
@
answers
)
fd
.
append
(
element
.
id
,
''
)
else
fd
.
append
(
element
.
id
,
element
.
value
)
settings
=
type
:
"POST"
...
...
lms/djangoapps/courseware/module_render.py
View file @
6c875206
import
json
import
logging
from
urlparse
import
parse_qs
from
django.conf
import
settings
from
django.http
import
Http404
...
...
@@ -273,22 +272,10 @@ def modx_dispatch(request, dispatch=None, id=None):
# ''' (fix emacs broken parsing)
# Check for submitted files
p
ost
=
dict
()
p
=
request
.
POST
.
copy
()
if
request
.
FILES
:
for
inputfile_id
in
request
.
FILES
.
keys
():
post
[
inputfile_id
]
=
request
.
FILES
[
inputfile_id
]
# 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?
for
key
in
request
.
POST
.
keys
():
if
key
==
'__answers_querystring'
:
qs
=
request
.
POST
.
get
(
key
)
qsdict
=
parse_qs
(
qs
,
keep_blank_values
=
True
)
for
qskey
in
qsdict
.
keys
():
post
[
qskey
]
=
qsdict
[
qskey
][
0
]
# parse_qs returns {key: list}
else
:
post
[
key
]
=
request
.
POST
.
get
(
key
)
p
[
inputfile_id
]
=
request
.
FILES
[
inputfile_id
]
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
)
...
...
@@ -301,7 +288,7 @@ def modx_dispatch(request, dispatch=None, id=None):
# Let the module handle the AJAX
try
:
ajax_return
=
instance
.
handle_ajax
(
dispatch
,
p
ost
)
ajax_return
=
instance
.
handle_ajax
(
dispatch
,
p
)
except
NotFoundError
:
log
.
exception
(
"Module indicating to user that request doesn't exist"
)
raise
Http404
...
...
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