Merge pull request #1494 from MITx/feature/marco/addcomponent

Feature/marco/addcomponent
This commit is contained in:
Christina Roberts
2013-02-15 10:13:24 -08:00
24 changed files with 374 additions and 110 deletions

View File

@@ -703,15 +703,15 @@ class CapaDescriptor(RawDescriptor):
def get_context(self):
_context = RawDescriptor.get_context(self)
_context.update({'markdown': self.metadata.get('markdown', '')})
_context.update({'markdown': self.metadata.get('markdown', ''),
'enable_markdown' : 'markdown' in self.metadata})
return _context
@property
def editable_metadata_fields(self):
"""Remove metadata from the editable fields since it has its own editor"""
subset = super(CapaDescriptor, self).editable_metadata_fields
if 'markdown' in subset:
subset.remove('markdown')
"""Remove any metadata from the editable fields which have their own editor or shouldn't be edited by user."""
subset = [field for field in super(CapaDescriptor,self).editable_metadata_fields
if field not in ['markdown', 'empty']]
return subset

View File

@@ -172,6 +172,13 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor):
elt.set("filename", relname)
return elt
@property
def editable_metadata_fields(self):
"""Remove any metadata from the editable fields which have their own editor or shouldn't be edited by user."""
subset = [field for field in super(HtmlDescriptor,self).editable_metadata_fields
if field not in ['empty']]
return subset
class AboutDescriptor(HtmlDescriptor):
"""

View File

@@ -1,6 +1,7 @@
---
metadata:
display_name: Empty
display_name: Blank HTML Page
empty: True
data: |

View File

@@ -1,6 +1,7 @@
---
metadata:
display_name: Circuit Schematic
display_name: Circuit Schematic Builder
rerandomize: never
showanswer: always
weight: ""

View File

@@ -1,6 +1,6 @@
---
metadata:
display_name: Custom Grader
display_name: Custom Python-Evaluated Input
rerandomize: never
showanswer: always
weight: ""
@@ -8,7 +8,7 @@ metadata:
data: |
<problem>
<p>
A custom response problem accepts one or more lines of text input from the
A custom python-evaluated input problem accepts one or more lines of text input from the
student, and evaluates the inputs for correctness based on evaluation using a
python script embedded within the problem.
</p>

View File

@@ -1,10 +1,11 @@
---
metadata:
display_name: Empty
display_name: Blank Common Problem
rerandomize: never
showanswer: always
markdown: ""
weight: ""
empty: True
attempts: ""
data: |
<problem>

View File

@@ -0,0 +1,13 @@
---
metadata:
display_name: Blank Advanced Problem
rerandomize: never
showanswer: always
weight: ""
attempts: ""
empty: True
data: |
<problem>
</problem>
children: []

View File

@@ -1,6 +1,6 @@
---
metadata:
display_name: Formula Response
display_name: Math Expression Input
rerandomize: never
showanswer: always
weight: ""
@@ -8,7 +8,7 @@ metadata:
data: |
<problem>
<p>
A formula response problem accepts a line of text representing a mathematical expression from the
A math expression input problem accepts a line of text representing a mathematical expression from the
student, and evaluates the input for equivalence to a mathematical expression provided by the
grader. Correctness is based on numerical sampling of the symbolic expressions.
</p>

View File

@@ -1,6 +1,6 @@
---
metadata:
display_name: Image Response
display_name: Image Mapped Input
rerandomize: never
showanswer: always
weight: ""
@@ -8,7 +8,7 @@ metadata:
data: |
<problem>
<p>
An image response problem presents an image for the student. Input is
An image mapped input problem presents an image for the student. Input is
given by the location of mouse clicks on the image. Correctness of input can be evaluated based on expected dimensions of a rectangle.
</p>

View File

@@ -26,10 +26,6 @@ metadata:
( ) The vegetable peeler
( ) Android
( ) The Beatles
[explanation]
The release of the iPod allowed consumers to carry their entire music library with them in a
@@ -51,8 +47,6 @@ data: |
<choice correct="false" name="beatles">Napster</choice>
<choice correct="true" name="ipod">The iPod</choice>
<choice correct="false" name="peeler">The vegetable peeler</choice>
<choice correct="false" name="android">Android</choice>
<choice correct="false" name="beatles">The Beatles</choice>
</choicegroup>
</multiplechoiceresponse>
<solution>

View File

@@ -1,12 +1,12 @@
---
metadata:
display_name: Numerical Response
display_name: Numerical Input
rerandomize: never
showanswer: always
weight: ""
attempts: ""
markdown:
"A numerical response problem accepts a line of text input from the
"A numerical input problem accepts a line of text input from the
student, and evaluates the input for correctness based on its
numerical value.
@@ -45,7 +45,7 @@ metadata:
data: |
<problem>
<p>
A numerical response problem accepts a line of text input from the
A numerical input problem accepts a line of text input from the
student, and evaluates the input for correctness based on its
numerical value.
</p>

View File

@@ -1,12 +1,12 @@
---
metadata:
display_name: Option Response
display_name: Dropdown
rerandomize: never
showanswer: always
weight: ""
attempts: ""
markdown:
"OptionResponse gives a limited set of options for students to respond with, and presents those options
"Dropdown problems give a limited set of options for students to respond with, and present those options
in a format that encourages them to search for a specific answer rather than being immediately presented
with options from which to recognize the correct answer.
@@ -14,30 +14,30 @@ metadata:
The answer options and the identification of the correct answer is defined in the <b>optioninput</b> tag.
Translation between Option Response and __________ is extremely straightforward:
Translation between Dropdown and __________ is extremely straightforward:
[[(Multiple Choice), String Response, Numerical Response, External Response, Image Response]]
[[(Multiple Choice), Text Input, Numerical Input, External Response, Image Response]]
[explanation]
Multiple Choice also allows students to select from a variety of pre-written responses, although the
format makes it easier for students to read very long response options. Optionresponse also differs
format makes it easier for students to read very long response options. Dropdowns also differ
slightly because students are more likely to think of an answer and then search for it rather than
relying purely on recognition to answer the question.
[explanation]
"
data: |
<problem>
<p>OptionResponse gives a limited set of options for students to respond with, and presents those options
<p>Dropdown problems give a limited set of options for students to respond with, and present those options
in a format that encourages them to search for a specific answer rather than being immediately presented with options from which to recognize the correct answer.</p>
<p>
The answer options and the identification of the correct answer is defined in the <b>optioninput</b> tag.
</p>
<p>Translation between Option Response and __________ is extremely straightforward:
<p>Translation between Dropdown and __________ is extremely straightforward:
<optionresponse>
<optioninput options="('Multiple Choice','String Response','Numerical Response','External Response','Image Response')" correct="Multiple Choice"></optioninput>
<optioninput options="('Multiple Choice','Text Input','Numerical Input','External Response','Image Response')" correct="Multiple Choice"></optioninput>
</optionresponse>
</p>
<solution>

View File

@@ -1,15 +1,15 @@
---
metadata:
display_name: String Response
display_name: Text Input
rerandomize: never
showanswer: always
weight: ""
attempts: ""
# Note, the extra newlines are needed to make the yaml parser add blank lines instead of folding
markdown:
"A string response problem accepts a line of text input from the
"A text input problem accepts a line of text from the
student, and evaluates the input for correctness based on an expected
answer within each input box.
answer.
The answer is correct if it matches every character of the expected answer. This can be a problem with
@@ -30,9 +30,9 @@ data: |
<problem showanswer="always">
<p>
A string response problem accepts a line of text input from the
A text input problem accepts a line of text from the
student, and evaluates the input for correctness based on an expected
answer within each input box.
answer.
The answer is correct if it matches every character of the expected answer. This can be a problem with international spelling, dates, or anything where the format of the answer is not clear.
</p>