MC_Query = MC_Query.extend({
// mode should be "delivery" or "review"; "delivery" is assumed
getHTML: function (mode) {
// initialize imagemap elements
if (this.imagemap_initialized === false) {
var question_jq = this.jq.parent();
this.im_init(question_jq);
this.imagemap_initialized = true;
}
// start with the query text, if there
var html = this.query_text_html();
// wrap answers in a p tag
html += "
";
// Build answer selection
var is_correct = false;
for (var z = 0; z < this.choices.length; z++) {
var index = this.choice_order[z];
// if this is review mode...
var checked = "";
var disabled = "";
var radio_style = "query_mc_other_choice";
if (mode == 'review' || mode == 'review_correct_incorrect' || mode == 'preview') {
// if it's the correct choice, it should be marked in green
if (index == this.correct_answer_index) {
// but only if we're *not* in review_correct_incorrect mode or this is the user's choice
if (mode != 'review_correct_incorrect' || index == this.user_answer_index) {
radio_style = "query_mc_correct_choice";
}
// if this is what the user chose, he got it correct
if (index == this.user_answer_index) {
is_correct = true;
}
// else if it's the user's choice (and this.md.no_correct_answer is not true), it should be marked in red
} else if (index == this.user_answer_index && this.md.no_correct_answer != "true") {
radio_style = "query_mc_incorrect_user_choice";
}
// and the input should be disabled, unless we're in review_correct_incorrect mode
if (mode != "review_correct_incorrect") {
disabled = "disabled";
}
}
// if this is the choice the user clicked, it's checked (regardless of mode)
if (index == this.user_answer_index) {
checked = "checked";
}
// Create radio button input plus label
html += "
";
}
// get a possible feedback string; this fn will take account of mode
html += this.correct_incorrect_feedback(mode, is_correct);
html += "";
return html;
}
});
var Activity_subtype = Activity_manuscript_type.extend({
});
var Player_subtype = Player_manuscript_type.extend({
opened_from_portal: true,
start_quiz: function() {
this._super();
},
show_guidance: function(el) {
var jq = $(el).next();
jq.slideToggle('fast');
$('html, body').animate({
scrollTop: $(document).height()
},
1500);
},
full_screen: function() {
var src = $("[data-type=figure]").find("iframe").first().attr("src");
// get height and width of window
var fsw = window.open(src, "synthesis_full_screen", "height=" + screen.height + ",width=" + screen.width + ",top=0,left=0,resizable=yes");
},
initialize: function() {
this._super();
// after we call this.super, re-initialize the activity to the custom
// activity type for this subtype
this.activity = new Activity_subtype();
},
initialize2: function() {
this._super();
var html = UI_Elements.get_button_html({
"label": "Full Screen Mode"
, "fn": 'player.full_screen()'
, "extra_class": "instructor_guidance_button"
});
$("#activity_instructions").before(html);
// process instructor_guidance boxes for questions
$("[data-block_type=instructor_guidance]").each(function(index, element) {
// PW: this isn't getting located quite right yet; leave out for now
return;
var jq = $(this);
// if the user is a student, don't show this box at all
if (player.activity.is_instructor() != true) {
jq.remove();
return;
}
// prepend an element to show the content
var html = UI_Elements.get_button_html({
"label": "Instructor Notes"
, "fn": 'player.show_guidance(this)'
, "extra_class": "instructor_guidance_button"
})
jq.before(html);
});
// get reference to the iframe
this.iframe = $("[data-type=figure]").find("iframe")[0].contentWindow;
// anything that you want to do after *everything* has been set up
// should be done here.
}
});
player = new Player_subtype();