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
977f0d3d
Commit
977f0d3d
authored
May 13, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syncing between computers; system is in a broken state
parent
e32fa060
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
13 deletions
+32
-13
djangoapps/courseware/capa/capa_problem.py
+6
-5
djangoapps/courseware/capa/inputtypes.py
+26
-8
No files found.
djangoapps/courseware/capa/capa_problem.py
View file @
977f0d3d
...
...
@@ -72,11 +72,12 @@ html_skip = ["numericalresponse", "customresponse", "schematicresponse", "formul
# removed in MC
## These should be transformed
#html_special_response = {"textline":textline.render,
# "schematic":schematic.render,
# "textbox":textbox.render,
# "solution":solution.render,
# }
html_special_response
=
{
"textline"
:
inputtypes
.
textline
.
render
,
"schematic"
:
inputtypes
.
schematic
.
render
,
"textbox"
:
inputtypes
.
textbox
.
render
,
"formulainput"
:
inputtypes
.
jstextline
.
render
,
# "solution":inputtypes.solution.render,
}
class
LoncapaProblem
(
object
):
def
__init__
(
self
,
fileobject
,
id
,
state
=
None
,
seed
=
None
,
system
=
None
):
...
...
djangoapps/courseware/capa/inputtypes.py
View file @
977f0d3d
...
...
@@ -52,17 +52,34 @@ def choicegroup(element, value, state, msg=""):
return
etree
.
XML
(
html
)
def
textline
(
element
,
value
,
state
,
msg
=
""
):
eid
=
element
.
get
(
'id'
)
count
=
int
(
eid
.
split
(
'_'
)[
-
2
])
-
1
# HACK
size
=
element
.
get
(
'size'
)
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
state
,
'count'
:
count
,
'size'
:
size
}
html
=
render_to_string
(
"textinput.html"
,
context
)
return
etree
.
XML
(
html
)
return
TextLine
(
element
,
value
,
state
,
msg
)
.
render
()
class
GenericInput
(
object
):
def
__init__
(
element
,
value
,
state
,
msg
=
""
):
''' This will move into the parent object '''
self
.
element
=
element
self
.
value
=
value
self
.
state
=
state
self
.
msg
=
msg
class
TextLine
(
GenericInput
):
def
render
(
self
):
eid
=
self
.
element
.
get
(
'id'
)
count
=
int
(
eid
.
split
(
'_'
)[
-
2
])
-
1
# HACK
size
=
self
.
element
.
get
(
'size'
)
context
=
{
'id'
:
eid
,
'value'
:
self
.
value
,
'state'
:
self
.
state
,
'count'
:
count
,
'size'
:
size
}
html
=
render_to_string
(
"textinput.html"
,
context
)
return
etree
.
XML
(
html
)
#-----------------------------------------------------------------------------
# TODO: Make a wrapper for <formulainput>
# TODO: Make an AJAX loop to confirm equation is okay in real-time as user types
def
jstextline
(
element
,
value
,
state
,
msg
=
""
):
class
jstextline
(
GenericInput
):
'''
Plan: We will inspect element to figure out type
'''
js_types
=
{
'formulainput'
:
'math'
}
def
render
(
element
,
value
,
state
,
msg
=
""
):
'''
textline is used for simple one-line inputs, like formularesponse and symbolicresponse.
'''
...
...
@@ -81,7 +98,8 @@ def jstextline(element, value, state, msg=""):
#-----------------------------------------------------------------------------
## TODO: Make a wrapper for <codeinput>
def
textbox
(
element
,
value
,
state
,
msg
=
''
):
class
textbox
(
GenericInput
):
def
render
(
element
,
value
,
state
,
msg
=
''
):
'''
The textbox is used for code input. The message is the return HTML string from
evaluating the code, eg error messages, and output from the code tests.
...
...
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