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
fbdc190a
Commit
fbdc190a
authored
Jan 29, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in file upload ability
parent
f367b7ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
common/lib/xmodule/xmodule/combined_open_ended_module.py
+5
-4
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
+18
-2
lms/templates/combined_open_ended.html
+1
-1
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
fbdc190a
...
...
@@ -39,7 +39,7 @@ MAX_SCORE = 1
MAX_SCORE_ALLOWED
=
3
IS_SCORED
=
False
UPLOAD_IMAGE
=
False
ACCEPT_FILE_UPLOAD
=
False
class
CombinedOpenEndedModule
(
XModule
):
"""
...
...
@@ -142,7 +142,7 @@ class CombinedOpenEndedModule(XModule):
self
.
allow_reset
=
instance_state
.
get
(
'ready_to_reset'
,
False
)
self
.
max_attempts
=
int
(
self
.
metadata
.
get
(
'attempts'
,
MAX_ATTEMPTS
))
self
.
is_scored
=
(
self
.
metadata
.
get
(
'is_graded'
,
IS_SCORED
)
==
"True"
)
self
.
upload_image
=
(
self
.
metadata
.
get
(
'upload_image'
,
UPLOAD_IMAGE
)
==
"True"
)
self
.
accept_file_upload
=
(
self
.
metadata
.
get
(
'accept_file_upload'
,
ACCEPT_FILE_UPLOAD
)
==
"True"
)
log
.
debug
(
self
.
metadata
.
get
(
'is_graded'
,
IS_SCORED
))
...
...
@@ -176,7 +176,7 @@ class CombinedOpenEndedModule(XModule):
'prompt'
:
definition
[
'prompt'
],
'rubric'
:
definition
[
'rubric'
],
'display_name'
:
self
.
display_name
,
'accept_file_upload'
:
self
.
upload_image
,
'accept_file_upload'
:
self
.
accept_file_upload
,
}
self
.
task_xml
=
definition
[
'task_xml'
]
...
...
@@ -327,7 +327,8 @@ class CombinedOpenEndedModule(XModule):
'task_count'
:
len
(
self
.
task_xml
),
'task_number'
:
self
.
current_task_number
+
1
,
'status'
:
self
.
get_status
(),
'display_name'
:
self
.
display_name
'display_name'
:
self
.
display_name
,
'accept_file_upload'
:
self
.
accept_file_upload
,
}
return
context
...
...
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
View file @
fbdc190a
...
...
@@ -12,6 +12,7 @@ class @CombinedOpenEnded
@
state
=
@
el
.
data
(
'state'
)
@
task_count
=
@
el
.
data
(
'task-count'
)
@
task_number
=
@
el
.
data
(
'task-number'
)
@
accept_file_upload
=
@
el
.
data
(
'accept-file-upload'
)
@
allow_reset
=
@
el
.
data
(
'allow_reset'
)
@
reset_button
=
@
$
(
'.reset-button'
)
...
...
@@ -45,6 +46,7 @@ class @CombinedOpenEnded
@
skip_button
.
click
@
skip_post_assessment
@
file_upload_area
=
@
$
(
'.file-upload'
)
@
can_upload_files
=
false
@
open_ended_child
=
@
$
(
'.open-ended-child'
)
@
find_assessment_elements
()
...
...
@@ -119,6 +121,7 @@ class @CombinedOpenEnded
@
submit_button
.
show
()
@
reset_button
.
hide
()
@
next_problem_button
.
hide
()
@
hide_file_upload
()
@
hint_area
.
attr
(
'disabled'
,
false
)
if
@
child_state
==
'done'
@
rubric_wrapper
.
hide
()
...
...
@@ -134,8 +137,10 @@ class @CombinedOpenEnded
@
answer_area
.
attr
(
"disabled"
,
false
)
@
submit_button
.
prop
(
'value'
,
'Submit'
)
@
submit_button
.
click
@
save_answer
@
setup_file_upload
()
else
if
@
child_state
==
'assessing'
@
answer_area
.
attr
(
"disabled"
,
true
)
@
hide_file_upload
()
@
submit_button
.
prop
(
'value'
,
'Submit assessment'
)
@
submit_button
.
click
@
save_assessment
if
@
child_type
==
"openended"
...
...
@@ -301,4 +306,15 @@ class @CombinedOpenEnded
window
.
queuePollerID
=
window
.
setTimeout
(
@
poll
,
10000
)
setup_file_upload
:
=>
@
file_upload_area
.
html
(
'<input type="file" class="file">'
)
\ No newline at end of file
if
window
.
File
and
window
.
FileReader
and
window
.
FileList
and
window
.
Blob
alert
(
'File API supported.'
)
if
@
accept_file_upload
==
"True"
@
can_upload_files
=
true
@
file_upload_area
.
html
(
'<input type="file" class="file-upload-box">'
)
@
file_upload_area
.
show
()
else
@
gentle_alert
'File uploads are not supported in this browser. Try the newest version of google chrome'
hide_file_upload
:
=>
if
@
accept_file_upload
==
"True"
@
file_upload_area
.
hide
()
\ No newline at end of file
lms/templates/combined_open_ended.html
View file @
fbdc190a
<section
id=
"combined-open-ended"
class=
"combined-open-ended"
data-ajax-url=
"${ajax_url}"
data-allow_reset=
"${allow_reset}"
data-state=
"${state}"
data-task-count=
"${task_count}"
data-task-number=
"${task_number}"
>
<section
id=
"combined-open-ended"
class=
"combined-open-ended"
data-ajax-url=
"${ajax_url}"
data-allow_reset=
"${allow_reset}"
data-state=
"${state}"
data-task-count=
"${task_count}"
data-task-number=
"${task_number}"
data-accept-file-upload =
"${accept_file_upload}"
>
<h2>
${display_name}
</h2>
<div
class=
"status-container"
>
...
...
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