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
54c763d8
Commit
54c763d8
authored
Jan 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set up template for open ended xmodule
parent
6ac90cf9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
4 deletions
+116
-4
common/lib/capa/capa/inputtypes.py
+1
-1
common/lib/xmodule/open_ended_module.py
+59
-3
lms/templates/open_ended.html
+56
-0
No files found.
common/lib/capa/capa/inputtypes.py
View file @
54c763d8
...
@@ -742,7 +742,7 @@ class OpenEndedInput(InputTypeBase):
...
@@ -742,7 +742,7 @@ class OpenEndedInput(InputTypeBase):
etc.
etc.
"""
"""
template
=
"openendedinput.html"
template
=
tags
=
[
'openendedinput'
]
tags
=
[
'openendedinput'
]
# pulled out for testing
# pulled out for testing
...
...
common/lib/xmodule/open_ended_module.py
View file @
54c763d8
...
@@ -200,7 +200,7 @@ class OpenEndedModule():
...
@@ -200,7 +200,7 @@ class OpenEndedModule():
event_info
[
'problem_id'
]
=
self
.
location
.
url
()
event_info
[
'problem_id'
]
=
self
.
location
.
url
()
event_info
[
'student_id'
]
=
self
.
system
.
anonymous_student_id
event_info
[
'student_id'
]
=
self
.
system
.
anonymous_student_id
event_info
[
'survey_responses'
]
=
get
event_info
[
'survey_responses'
]
=
get
survey_responses
=
event_info
[
'survey_responses'
]
survey_responses
=
event_info
[
'survey_responses'
]
for
tag
in
[
'feedback'
,
'submission_id'
,
'grader_id'
,
'score'
]:
for
tag
in
[
'feedback'
,
'submission_id'
,
'grader_id'
,
'score'
]:
if
tag
not
in
survey_responses
:
if
tag
not
in
survey_responses
:
...
@@ -318,7 +318,7 @@ class OpenEndedModule():
...
@@ -318,7 +318,7 @@ class OpenEndedModule():
return
cmap
return
cmap
def
update_score
(
self
,
score_msg
,
oldcmap
,
queuekey
):
def
_
update_score
(
self
,
score_msg
,
oldcmap
,
queuekey
):
log
.
debug
(
score_msg
)
log
.
debug
(
score_msg
)
score_msg
=
self
.
_parse_score_msg
(
score_msg
)
score_msg
=
self
.
_parse_score_msg
(
score_msg
)
if
not
score_msg
.
valid
:
if
not
score_msg
.
valid
:
...
@@ -530,7 +530,6 @@ class OpenEndedModule():
...
@@ -530,7 +530,6 @@ class OpenEndedModule():
'problem_check'
:
self
.
check_problem
,
'problem_check'
:
self
.
check_problem
,
'problem_reset'
:
self
.
reset_problem
,
'problem_reset'
:
self
.
reset_problem
,
'problem_save'
:
self
.
save_problem
,
'problem_save'
:
self
.
save_problem
,
'problem_show'
:
self
.
get_answer
,
'score_update'
:
self
.
update_score
,
'score_update'
:
self
.
update_score
,
'message_post'
:
self
.
message_post
,
'message_post'
:
self
.
message_post
,
}
}
...
@@ -546,3 +545,60 @@ class OpenEndedModule():
...
@@ -546,3 +545,60 @@ class OpenEndedModule():
'progress_status'
:
Progress
.
to_js_status_str
(
after
),
'progress_status'
:
Progress
.
to_js_status_str
(
after
),
})
})
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
get_problem
:
return
{
'html'
:
self
.
get_problem_html
(
encapsulate
=
False
)}
def
check_problem
:
pass
def
reset_problem
:
pass
def
save_problem
:
pass
def
update_score
:
"""
Delivers grading response (e.g. from asynchronous code checking) to
the capa problem, so its score can be updated
'get' must have a field 'response' which is a string that contains the
grader's response
No ajax return is needed. Return empty dict.
"""
queuekey
=
get
[
'queuekey'
]
score_msg
=
get
[
'xqueue_body'
]
#TODO: Remove need for cmap
self
.
_update_score
(
score_msg
,
queuekey
)
return
dict
()
# No AJAX return is needed
def
get_html
(
self
):
"""
Implement special logic: handle queueing state, and default input.
"""
# if no student input yet, then use the default input given by the problem
if
not
self
.
value
:
self
.
value
=
self
.
xml
.
text
# Check if problem has been queued
self
.
queue_len
=
0
# Flag indicating that the problem has been queued, 'msg' is length of queue
if
self
.
status
==
'incomplete'
:
self
.
status
=
'queued'
self
.
queue_len
=
self
.
msg
self
.
msg
=
self
.
submitted_msg
context
=
{
'rows'
:
30
,
'cols'
:
80
,
'hidden'
:
''
,
}
html
=
self
.
system
.
render_template
(
"openendedinput.html"
,
context
)
def
_extra_context
(
self
):
"""Defined queue_len, add it """
return
{
'queue_len'
:
self
.
queue_len
,}
lms/templates/open_ended.html
0 → 100644
View file @
54c763d8
<section
id=
"openended_${id}"
class=
"openended"
>
<textarea
rows=
"${rows}"
cols=
"${cols}"
name=
"input_${id}"
class=
"short-form-response"
id=
"input_${id}"
%
if
hidden:
style=
"display:none;"
%
endif
>
${value|h}
</textarea>
<div
class=
"grader-status"
>
% if status == 'unsubmitted':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
>
Unanswered
</span>
% elif status == 'correct':
<span
class=
"correct"
id=
"status_${id}"
>
Correct
</span>
% elif status == 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
>
Incorrect
</span>
% elif status == 'queued':
<span
class=
"grading"
id=
"status_${id}"
>
Submitted for grading
</span>
% endif
% if hidden:
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
% endif
</div>
<span
id=
"answer_${id}"
></span>
% if status == 'queued':
<input
name=
"reload"
class=
"reload"
type=
"button"
value=
"Recheck for Feedback"
onclick=
"document.location.reload(true);"
/>
% endif
<div
class=
"external-grader-message"
>
${msg|n}
% if status in ['correct','incorrect']:
<div
class=
"collapsible evaluation-response"
>
<header>
<a
href=
"#"
>
Respond to Feedback
</a>
</header>
<section
id=
"evaluation_${id}"
class=
"evaluation"
>
<p>
How accurate do you find this feedback?
</p>
<div
class=
"evaluation-scoring"
>
<ul
class=
"scoring-list"
>
<li><input
type=
"radio"
name=
"evaluation-score"
id=
"evaluation-score-5"
value=
"5"
/>
<label
for=
"evaluation-score-5"
>
Correct
</label></li>
<li><input
type=
"radio"
name=
"evaluation-score"
id=
"evaluation-score-4"
value=
"4"
/>
<label
for=
"evaluation-score-4"
>
Partially Correct
</label></li>
<li><input
type=
"radio"
name=
"evaluation-score"
id=
"evaluation-score-3"
value=
"3"
/>
<label
for=
"evaluation-score-3"
>
No Opinion
</label></li>
<li><input
type=
"radio"
name=
"evaluation-score"
id=
"evaluation-score-2"
value=
"2"
/>
<label
for=
"evaluation-score-2"
>
Partially Incorrect
</label></li>
<li><input
type=
"radio"
name=
"evaluation-score"
id=
"evaluation-score-1"
value=
"1"
/>
<label
for=
"evaluation-score-1"
>
Incorrect
</label></li>
</ul>
</div>
<p>
Additional comments:
</p>
<textarea
rows=
"${rows}"
cols=
"${cols}"
name=
"feedback_${id}"
class=
"feedback-on-feedback"
id=
"feedback_${id}"
></textarea>
<div
class=
"submit-message-container"
>
<input
name=
"submit-message"
class=
"submit-message"
type=
"button"
value=
"Submit your message"
/>
</div>
</section>
</div>
% endif
</div>
</section>
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