Merge branch 'Sankore-1.40' of github.com:Sankore/Sankore-3.1 into Sankore-1.40

preferencesAboutTextFull
Claudio Valerio 13 years ago
commit 17c461d89b
  1. 2
      resources/library/interactivities/Choisir.wgt/css/basic.css
  2. 27
      resources/library/interactivities/Choisir.wgt/locales/fr/scripts/selQuestionApp.js
  3. 23
      resources/library/interactivities/Choisir.wgt/locales/ru/scripts/selQuestionApp.js
  4. 6
      resources/library/interactivities/Choisir.wgt/scripts/selQuestionApp.js

@ -363,7 +363,7 @@ body{
position: absolute; position: absolute;
display: none; display: none;
width: 100px; width: 100px;
height: 20px; min-height: 20px;
top: 0; top: 0;
left: 0; left: 0;
text-align: center; text-align: center;

@ -37,8 +37,8 @@ var sankoreLang = {
a:"R", a:"R",
wgt_name: "Choisir", wgt_name: "Choisir",
reload: "Recharger", reload: "Recharger",
slate: "Ardoise", slate: "Bois",
pad: "Tablette" pad: "Pad"
}; };
@ -75,7 +75,7 @@ function init(){
//import saved data //import saved data
if(window.sankore){ if(window.sankore){
if(sankore.preference("qstArrayData","")){ if(sankore.preference("qstArrayData","") && sankore.preference("qstArrayData","") != "[]"){
questionArray = jQuery.parseJSON(sankore.preference("qstArrayData","")); questionArray = jQuery.parseJSON(sankore.preference("qstArrayData",""));
for(var i in questionArray){ for(var i in questionArray){
addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'"); addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'");
@ -114,6 +114,8 @@ function init(){
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
displayData(true); displayData(true);
mode = true; mode = true;
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
sankore.setPreference("choisir_style", $(".style_select").find("option:selected").val());
} }
} else { } else {
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
@ -129,6 +131,9 @@ function init(){
}); });
$("#wgt_reload").text(sankoreLang.reload).click(function(){ $("#wgt_reload").text(sankoreLang.reload).click(function(){
if($("#wgt_edit").css("display") == "none")
$("#wgt_display").trigger("click");
else
window.location.reload(); window.location.reload();
}); });
@ -225,7 +230,13 @@ function init(){
questionArray[i].rightAns = questionArray[i].rightAns.replace($("#" + currentQstId + " #" + id + " input:checkbox").val(),""); questionArray[i].rightAns = questionArray[i].rightAns.replace($("#" + currentQstId + " #" + id + " input:checkbox").val(),"");
for(var j in questionArray[i].answers) for(var j in questionArray[i].answers)
if(questionArray[i].answers[j].id == id){ if(questionArray[i].answers[j].id == id){
delete questionArray[i].answers[j]; if(j == 0)
questionArray[i].answers.shift();
else
if((j+1) == questionArray[i].answers.length)
questionArray[i].answers.pop();
else
questionArray[i].answers = questionArray[i].answers.slice(0,j).concat(questionArray[i].answers.slice(j+1));
break; break;
} }
} }
@ -238,7 +249,13 @@ function init(){
$("#" + currentQstId).remove(); $("#" + currentQstId).remove();
for(var i in questionArray) for(var i in questionArray)
if(questionArray[i].id == currentQstId){ if(questionArray[i].id == currentQstId){
delete questionArray[i]; if(i == 0)
questionArray.shift();
else
if((i+1) == questionArray.length)
questionArray.pop();
else
questionArray = questionArray.slice(0,i).concat(questionArray.slice(i+1));
break; break;
} }
refreshQst(); refreshQst();

@ -75,7 +75,7 @@ function init(){
//import saved data //import saved data
if(window.sankore){ if(window.sankore){
if(sankore.preference("qstArrayData","")){ if(sankore.preference("qstArrayData","") && sankore.preference("qstArrayData","") != "[]"){
questionArray = jQuery.parseJSON(sankore.preference("qstArrayData","")); questionArray = jQuery.parseJSON(sankore.preference("qstArrayData",""));
for(var i in questionArray){ for(var i in questionArray){
addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'"); addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'");
@ -114,6 +114,8 @@ function init(){
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
displayData(true); displayData(true);
mode = true; mode = true;
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
sankore.setPreference("choisir_style", $(".style_select").find("option:selected").val());
} }
} else { } else {
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
@ -129,6 +131,9 @@ function init(){
}); });
$("#wgt_reload").text(sankoreLang.reload).click(function(){ $("#wgt_reload").text(sankoreLang.reload).click(function(){
if($("#wgt_edit").css("display") == "none")
$("#wgt_display").trigger("click");
else
window.location.reload(); window.location.reload();
}); });
@ -225,7 +230,13 @@ function init(){
questionArray[i].rightAns = questionArray[i].rightAns.replace($("#" + currentQstId + " #" + id + " input:checkbox").val(),""); questionArray[i].rightAns = questionArray[i].rightAns.replace($("#" + currentQstId + " #" + id + " input:checkbox").val(),"");
for(var j in questionArray[i].answers) for(var j in questionArray[i].answers)
if(questionArray[i].answers[j].id == id){ if(questionArray[i].answers[j].id == id){
delete questionArray[i].answers[j]; if(j == 0)
questionArray[i].answers.shift();
else
if((j+1) == questionArray[i].answers.length)
questionArray[i].answers.pop();
else
questionArray[i].answers = questionArray[i].answers.slice(0,j).concat(questionArray[i].answers.slice(j+1));
break; break;
} }
} }
@ -238,7 +249,13 @@ function init(){
$("#" + currentQstId).remove(); $("#" + currentQstId).remove();
for(var i in questionArray) for(var i in questionArray)
if(questionArray[i].id == currentQstId){ if(questionArray[i].id == currentQstId){
delete questionArray[i]; if(i == 0)
questionArray.shift();
else
if((i+1) == questionArray.length)
questionArray.pop();
else
questionArray = questionArray.slice(0,i).concat(questionArray.slice(i+1));
break; break;
} }
refreshQst(); refreshQst();

@ -131,12 +131,6 @@ function init(){
}); });
$("#wgt_reload").text(sankoreLang.reload).click(function(){ $("#wgt_reload").text(sankoreLang.reload).click(function(){
//window.location.reload();
// if(!sankore.preference("qstArrayData","") || sankore.preference("qstArrayData","") == "[]" || sankore.preference("qstArrayData","") == "[null]"){
// $(".qstDivDisplay").remove();
// displayData(false);
// }
// else
if($("#wgt_edit").css("display") == "none") if($("#wgt_edit").css("display") == "none")
$("#wgt_display").trigger("click"); $("#wgt_display").trigger("click");
else else

Loading…
Cancel
Save