Commit 5134c99d by Victor Shnayder

Merge pull request #1500 from MITx/700x-sandbox

700x sandbox
parents f80181be e352226d
...@@ -633,9 +633,11 @@ class MultipleChoiceResponse(LoncapaResponse): ...@@ -633,9 +633,11 @@ class MultipleChoiceResponse(LoncapaResponse):
# define correct choices (after calling secondary setup) # define correct choices (after calling secondary setup)
xml = self.xml xml = self.xml
cxml = xml.xpath('//*[@id=$id]//choice', id=xml.get('id')) cxml = xml.xpath('//*[@id=$id]//choice', id=xml.get('id'))
# contextualize correct attribute and then select ones for which # contextualize correct attribute and then select ones for which
# correct = "true" # correct = "true"
self.correct_choices = [contextualize_text(choice.get('name'), self.context) self.correct_choices = [
contextualize_text(choice.get('name'), self.context)
for choice in cxml for choice in cxml
if contextualize_text(choice.get('correct'), self.context) == "true"] if contextualize_text(choice.get('correct'), self.context) == "true"]
......
<section id="designprotein2dinput_${id}" class="designprotein2dinput"> <section id="designprotein2dinput_${id}" class="designprotein2dinput">
<div class="script_placeholder" data-src="/static/js/capa/protex/protex.nocache.js"/> <div class="script_placeholder" data-src="/static/js/capa/protex/protex.nocache.js?raw"/>
<div class="script_placeholder" data-src="${applet_loader}"/> <div class="script_placeholder" data-src="${applet_loader}"/>
% if status == 'unsubmitted': % if status == 'unsubmitted':
......
...@@ -22,6 +22,15 @@ ...@@ -22,6 +22,15 @@
// It calls protexIsReady with a deferred command when it has finished // It calls protexIsReady with a deferred command when it has finished
// initialization and has drawn itself // initialization and has drawn itself
function updateProtexField() {
var problem = $('#protex_container').parents('.problem');
var input_field = problem.find('input[type=hidden]');
var protex_answer = protexCheckAnswer();
var value = {protex_answer: protex_answer};
//console.log(JSON.stringify(value));
input_field.val(JSON.stringify(value));
}
protexIsReady = function() { protexIsReady = function() {
//Load target shape //Load target shape
var target_shape = $('#target_shape').val(); var target_shape = $('#target_shape').val();
...@@ -29,15 +38,18 @@ ...@@ -29,15 +38,18 @@
//Get answer from protex and store it into the hidden input field //Get answer from protex and store it into the hidden input field
//when Check button is clicked //when Check button is clicked
var problem = $('#protex_container').parents('.problem'); var fold_button = $("#fold-button");
var check_button = problem.find('input.check'); fold_button.on('click', function(){
var input_field = problem.find('input[type=hidden]'); var problem = $('#protex_container').parents('.problem');
check_button.on('click', function() { var input_field = problem.find('input[type=hidden]');
var protex_answer = protexCheckAnswer(); var protex_answer = protexCheckAnswer();
var value = {protex_answer: protex_answer}; var value = {protex_answer: protex_answer};
//console.log(JSON.stringify(value));
input_field.val(JSON.stringify(value)); input_field.val(JSON.stringify(value));
}); });
updateProtexField();
}; };
/*function initializeProtex() { /*function initializeProtex() {
//Check to see if the two exported GWT functions protexSetTargetShape //Check to see if the two exported GWT functions protexSetTargetShape
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment