/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ var sankoreLang = { edit: "Edit", display:"Display", question:"Question", example_question:"This is an example of the question", answer:"This is one possible answer", q:"Q", add_new_question:" Add a new question ...", options:"Options", close:"Close", delete_question:"Delete question", delete_answer:"Delete the possibility", right_answer:"Right answer", template_question:"Enter your question here ...", template_answer:"Enter one possible answer here ...", add_answer:"Add one possible answer", select_text:"Choose the right answer", options_desc:"You can choose one of the three options of displaying possibilities.", radio_desc:"One right answer only and the possibilities are displayed as radio buttons.", checkbox_desc:"Several right answers and possibilities are displayed as checkboxes.", select_desc:"One right answer only and possibilities are displayed as pull-down menu.", a:"A", wgt_name: "Choose the right answer", reload: "Reload", slate: "slate", pad: "pad", none: "none", help: "Help", help_content: "

Choose the right answer

" + "

Multiple-Choice Question (MCQ)

" + "

Multiple-choice question. The goal is to choose the correct answer.

" + "

“Reload” button resets the exercises.

" + "

Enter the “Edit” mode to :

" + "" + "

To create a new exercise :

" + "" + "

To remove a label, click on the cross button on the frame.

" + "

To delete a possible answer click on the cross on the left.

" + "

To delete a question, click on the cross on the left.

" + "

“Display” button comes back to the activity.

", theme: "Theme" }; var questionArray; var currentQstId = ""; var lang = ""; //locale language var begin = true; function init(){ //variables var toggleFlag = false; var endFlag = false; var mode = true; questionArray = new Array(); var popupFlag = false var flagForSelect = false; $("#wgt_display").text(sankoreLang.display); $("#wgt_edit").text(sankoreLang.edit); $("#wgt_name").text(sankoreLang.wgt_name); $("#wgt_reload").text(sankoreLang.reload); $("#wgt_help").text(sankoreLang.help); $("#help").html(sankoreLang.help_content); $("#style_select option[value='1']").text(sankoreLang.slate); $("#style_select option[value='2']").text(sankoreLang.pad); $("#style_select option[value='3']").text(sankoreLang.none); var tmpl = $("div.inline label").html(); $("div.inline label").html(sankoreLang.theme + tmpl) //popup message var popupText = $("
").appendTo("#data"); // adding question block var addQstDiv = $("
").appendTo("#data"); var addQstButton = $("").appendTo(qstOptions); var applyChanges = $("").appendTo(qstOptions); var qstDelete = $("").appendTo(ansDiv); qstDiv.insertBefore("#addQstDiv"); $("#addQsqSpan1").text(sankoreLang.q + (count + 2)); } //add answers function addAnsBlock(id, currId, text, stage, rightAns, type){ var newAnswer = $("
"); var value; var check = ""; if(stage){ value = getNeededElement(getNeededElement(questionArray, currId).answers,id).value; if(type != "2"){ if(rightAns == value) check = "checked='true'"; } else { rightAns = rightAns.replace(/,/g,""); if(rightAns.indexOf(value + " ", 0) != -1) check = "checked='true'"; } } else { value = ($("#" + currId + " .newAnswer input:checkbox").last().val()) ? parseInt($("#" + currId + " .newAnswer input:checkbox").last().val()) + 1 : 1; getNeededElement(getNeededElement(questionArray, currId).answers,id).value = value; } var count = $("#" + currId + " .newAnswer").size() + 1; var input = $("").appendTo(newAnswer); var ansSpan = $("" + sankoreLang.a + count + "").appendTo(newAnswer); var ansContent = $("
" + text + "
").appendTo(newAnswer); var ansDelete = $("