Wp-Pro-Quiz - Version 0.10

Version Description

  • Bugfix: "Matrix Sorting" in connection with "Random answer"
  • Bugfix: Database in connection with UTF-8
  • Bugfix in cloze
  • Bugfix in the backend
Download this release

Release Info

Developer xeno010
Plugin Icon 128x128 Wp-Pro-Quiz
Version 0.10
Comparing to
See all releases

Code changes from version 0.9 to 0.10

js/wpProQuiz_admin.js CHANGED
@@ -252,7 +252,7 @@ jQuery(document).ready(function($) {
252
  var type = $('input[name="answerType"]:checked');
253
  var $points = $('input[name="points"]');
254
 
255
- if(tinymce.editors.question != undefined) {
256
  question = tinymce.editors.question.getContent();
257
  } else {
258
  question = $('textarea[name="question"]').val();
@@ -325,16 +325,23 @@ jQuery(document).ready(function($) {
325
  } else if(type.val() == 'cloze_answer') {
326
  var clozeText = '';
327
 
328
- if(tinymce.editors.cloze != undefined) {
329
  clozeText = tinymce.editors.cloze.getContent();
330
  } else {
331
- clozeText = $('textarea[name="cloze"]').val();
332
  }
333
 
334
  if(isEmpty(clozeText)) {
335
  alert(wpProQuizLocalize.no_answer_msg);
336
  return false;
337
  }
 
 
 
 
 
 
 
338
  }
339
 
340
  return true;
@@ -416,27 +423,46 @@ jQuery(document).ready(function($) {
416
  addResult: function() {
417
  $('#resultList').children().each(function() {
418
  if($(this).css('display') == 'none') {
419
-
420
  var $this = $(this);
421
  var $text = $this.find('textarea[name="resultTextGrade[text][]"]');
422
  var id = $text.attr('id');
 
423
 
424
  $this.find('input[name="resultTextGrade[prozent][]"]').val('0');
425
  $this.find('input[name="resultTextGrade[activ][]"]').val('1').keyup();
426
 
 
 
 
 
 
 
 
 
 
427
  if(tinymce.editors[id] != undefined) {
428
  tinymce.editors[id].setContent('');
429
  } else {
430
  $text.val('');
431
  }
432
-
433
- tinyMCE.execCommand('mceRemoveControl', false, id);
 
 
434
 
435
  $this.parent().children(':visible').last().after($this);
436
 
437
- tinyMCE.execCommand('mceAddControl', false, id);
 
 
438
 
439
  $(this).show();
 
 
 
 
 
440
 
441
  return false;
442
  }
@@ -487,7 +513,7 @@ jQuery(document).ready(function($) {
487
 
488
  var text = '';
489
 
490
- if(tinymce.editors.text != undefined) {
491
  text = tinymce.editors.text.getContent();
492
  } else {
493
  text = $('textarea[name="text"]').val();
252
  var type = $('input[name="answerType"]:checked');
253
  var $points = $('input[name="points"]');
254
 
255
+ if(tinymce.editors.question != undefined && !tinymce.editors.question.isHidden()) {
256
  question = tinymce.editors.question.getContent();
257
  } else {
258
  question = $('textarea[name="question"]').val();
325
  } else if(type.val() == 'cloze_answer') {
326
  var clozeText = '';
327
 
328
+ if(tinymce.editors.cloze != undefined && !tinymce.editors.cloze.isHidden()) {
329
  clozeText = tinymce.editors.cloze.getContent();
330
  } else {
331
+ clozeText = $('textarea[name="answerJson[answer_cloze][text]"]').val();
332
  }
333
 
334
  if(isEmpty(clozeText)) {
335
  alert(wpProQuizLocalize.no_answer_msg);
336
  return false;
337
  }
338
+ } else if(type.val() == 'free_answer') {
339
+ var freeText = $('textarea[name="answerJson[free_answer][correct]"]').val();
340
+
341
+ if(isEmpty(freeText)) {
342
+ alert(wpProQuizLocalize.no_answer_msg);
343
+ return false;
344
+ }
345
  }
346
 
347
  return true;
423
  addResult: function() {
424
  $('#resultList').children().each(function() {
425
  if($(this).css('display') == 'none') {
426
+ //TODO rework
427
  var $this = $(this);
428
  var $text = $this.find('textarea[name="resultTextGrade[text][]"]');
429
  var id = $text.attr('id');
430
+ var hidden = true;
431
 
432
  $this.find('input[name="resultTextGrade[prozent][]"]').val('0');
433
  $this.find('input[name="resultTextGrade[activ][]"]').val('1').keyup();
434
 
435
+ if(tinymce.editors[id] != undefined && !tinymce.editors[id].isHidden()) {
436
+ hidden = false;
437
+ }
438
+
439
+ if(switchEditors != undefined && !hidden) {
440
+ switchEditors.go(id, 'toggle');
441
+ switchEditors.go(id, 'toggle');
442
+ }
443
+
444
  if(tinymce.editors[id] != undefined) {
445
  tinymce.editors[id].setContent('');
446
  } else {
447
  $text.val('');
448
  }
449
+
450
+ if(tinymce.editors[id] != undefined && !hidden) {
451
+ tinyMCE.execCommand('mceRemoveControl', false, id);
452
+ }
453
 
454
  $this.parent().children(':visible').last().after($this);
455
 
456
+ if(tinymce.editors[id] != undefined && !hidden) {
457
+ tinyMCE.execCommand('mceAddControl', false, id);
458
+ }
459
 
460
  $(this).show();
461
+
462
+ if(switchEditors != undefined && !hidden) {
463
+ switchEditors.go(id, 'toggle');
464
+ }
465
+
466
 
467
  return false;
468
  }
513
 
514
  var text = '';
515
 
516
+ if(tinymce.editors.text != undefined && !tinymce.editors.text.isHidden()) {
517
  text = tinymce.editors.text.getContent();
518
  } else {
519
  text = $('textarea[name="text"]').val();
js/wpProQuiz_admin.min.js CHANGED
@@ -5,14 +5,16 @@ a('input[name="exportItems"]');this.checked?c.attr("checked",!0):c.attr("checked
5
  break;case "matrix_sort_answer":c.displayMatrixSortAnswer();break;case "cloze_answer":c.displayClozeAnswer()}});a(".addAnswer").click(function(){c.addAnswer(this)});a(".deleteAnswer").click(function(){c.deleteAnswer(this)});a("#saveQuestion").click(function(){return d()});a(".sort_answer ul, .classic_answer ul, .matrix_sort_answer ul").sortable({handle:".wpProQuiz_move",update:function(){c.setValueClassicAnswer()}});a("#wpProQuiz_correctSameText").change(function(){this.checked?a("#wpProQuiz_incorrectMassageBox").hide():
6
  a("#wpProQuiz_incorrectMassageBox").show()});a("#wpProQuiz_tip").change(function(){this.checked?a("#wpProQuiz_tipBox").show():a("#wpProQuiz_tipBox").hide()})},displaySingle:function(b){a(".classic_answer").find('input[name="answerJson[classic_answer][correct][]"]').each(function(){a("<input type="+b+" />").attr({name:this.name,value:this.value,checked:this.checked}).insertBefore(this)}).remove();a(".classic_answer").css("display","block")},displayFreeAnswer:function(){a(".free_answer").css("display",
7
  "block")},displaySortAnswer:function(){a(".sort_answer").css("display","block")},displayMatrixSortAnswer:function(){a(".matrix_sort_answer").show()},displayClozeAnswer:function(){a(".cloze_answer").show()},addAnswer:function(b){a(b).siblings("ul").children().first().clone().css("display","block").appendTo(a(b).siblings("ul"));c.setValueClassicAnswer();a(".deleteAnswer").click(function(){c.deleteAnswer(this)})},deleteAnswer:function(b){a(b).parent("li").remove();c.setValueClassicAnswer()},setValueClassicAnswer:function(){var b=
8
- 0;a('input[name="answerJson[classic_answer][correct][]"]').each(function(){this.value=b++});b=0;a('input[name="answerJson[answer_matrix_sort][sort_string_html][]"]').each(function(){this.value=b++});b=0;a('input[name="answerJson[answer_matrix_sort][answer_html][]"]').each(function(){this.value=b++})}},d=function(){var c="",d=a('input[name="answerType"]:checked'),f=a('input[name="points"]'),c=void 0!=tinymce.editors.question?tinymce.editors.question.getContent():a('textarea[name="question"]').val();
9
- if(isNaN(f.val())||1>f.val())return alert(wpProQuizLocalize.no_nummber_points),f.focus(),!1;if(b(c))return alert(wpProQuizLocalize.no_question_msg),!1;if("single"==d.val()||"multiple"==d.val()){var e=!0;if(1>a('input[name="answerJson[classic_answer][correct][]"]:checked').each(function(){e=""!=a.trim(a(this).parent().siblings("textarea").val())?e&1:!1}).size())return alert(wpProQuizLocalize.no_correct_msg),!1;if(!e)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("sort_answer"==d.val()){if(e=
10
- !1,a('textarea[name="answerJson[answer_sort][answer][]"]').each(function(){e=b(a(this).val())?e|0:!0}),!e)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("matrix_sort_answer"==d.val()){if(e=!1,a('textarea[name="answerJson[answer_matrix_sort][answer][]"]').each(function(){if(b(a(this).val()))e|=0;else{var c=a(this).parent().parent().find('textarea[name="answerJson[answer_matrix_sort][sort_string][]"]');e=b(c.val())?e|0:!0}}),!e)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("cloze_answer"==
11
- d.val()&&(c="",c=void 0!=tinymce.editors.cloze?tinymce.editors.cloze.getContent():a('textarea[name="cloze"]').val(),b(c)))return alert(wpProQuizLocalize.no_answer_msg),!1;return!0},b=function(b){b=a.trim(b);return!b||0===b.length};c.setup();1>a('input[name="answerType"][checked="checked"]').size()&&a('input[name="answerType"][value="single"]').attr({checked:"checked"});a('input[name="answerType"]:checked').click();a("#wpProQuiz_correctSameText").change();a("#wpProQuiz_tip").change()};a.fn.wpProQuiz_questionOverall=
12
- function(){var c={saveSort:function(){var d={action:"wp_pro_quiz_update_sort",sort:c.parseSortArray()},b=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(b,d,function(b){console.debug(b);a("#sortMsg").show(400).delay(1E3).hide(400)})},parseSortArray:function(){var c=[];a("tbody tr").each(function(){c.push(this.id.replace("wpProQuiz_questionId_",""))});return c},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=
13
- a(this).children().first().text(a(this).index()+1)})}};a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",update:c.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),!1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();c.saveSort()});console.debug(a)};a.fn.wpProQuiz_quizEdit=function(){var c={addResult:function(){a("#resultList").children().each(function(){if("none"==a(this).css("display")){var b=a(this),
14
- c=b.find('textarea[name="resultTextGrade[text][]"]'),d=c.attr("id");b.find('input[name="resultTextGrade[prozent][]"]').val("0");b.find('input[name="resultTextGrade[activ][]"]').val("1").keyup();void 0!=tinymce.editors[d]?tinymce.editors[d].setContent(""):c.val("");tinyMCE.execCommand("mceRemoveControl",!1,d);b.parent().children(":visible").last().after(b);tinyMCE.execCommand("mceAddControl",!1,d);a(this).show();return!1}})},deleteResult:function(b){a(b).parent().parent().hide();a(b).siblings('input[name="resultTextGrade[activ][]"]').val("0")},
15
- changeResult:function(b){b=a(b);if(c.validResultInput(b.val()))return b.siblings(".resultProzent").text(b.val()),b.removeAttr("style"),!0;b.css("background-color","#FF9696");return!1},validResultInput:function(a){if(d(a))return!1;a=a.replace(/\,/,".");return!isNaN(a)&&100>=Number(a)&&0<=Number(a)?null!=a.match(/\./)?3>a.split(".")[1].length:!0:!1},validInput:function(){if(d(a("#wpProQuiz_title").val()))return alert(wpProQuizLocalize.no_title_msg),!1;var b="",b=void 0!=tinymce.editors.text?tinymce.editors.text.getContent():
16
- a('textarea[name="text"]').val();if(d(b))return alert(wpProQuizLocalize.no_quiz_start_msg),!1;if(a("#wpProQuiz_resultGradeEnabled:checked").length){var g=!0;console.debug("hier");a("#resultList").children().each(function(){if(a(this).is(":visible")&&!c.validResultInput(a(this).find('input[name="resultTextGrade[prozent][]"]').val()))return g=!1});if(!g)return alert(wpProQuizLocalize.fail_grade_result),!1}return!0}},d=function(b){b=a.trim(b);return!b||0===b.length};a("#statistics_on").change(function(){this.checked?
17
- a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a(".addResult").click(function(){c.addResult()});a(".deleteResult").click(function(){c.deleteResult(this)});a('input[name="resultTextGrade[prozent][]"]').keyup(function(){c.changeResult(this)}).keydown(function(a){13==a.which&&a.preventDefault()});a("#wpProQuiz_resultGradeEnabled").change(function(){this.checked?(a("#resultGrade").show(),a("#resultNormal").hide()):(a("#resultGrade").hide(),a("#resultNormal").show())});a("#wpProQuiz_save").click(function(a){c.validInput()||
18
- a.preventDefault()});a("#statistics_on").change();a("#wpProQuiz_resultGradeEnabled").change()};a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_quizOverall();a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionEdit").length&&a(".wpProQuiz_questionEdit").wpProQuiz_questionEdit();a(".wpProQuiz_questionOverall").length&&a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall()});
 
 
5
  break;case "matrix_sort_answer":c.displayMatrixSortAnswer();break;case "cloze_answer":c.displayClozeAnswer()}});a(".addAnswer").click(function(){c.addAnswer(this)});a(".deleteAnswer").click(function(){c.deleteAnswer(this)});a("#saveQuestion").click(function(){return d()});a(".sort_answer ul, .classic_answer ul, .matrix_sort_answer ul").sortable({handle:".wpProQuiz_move",update:function(){c.setValueClassicAnswer()}});a("#wpProQuiz_correctSameText").change(function(){this.checked?a("#wpProQuiz_incorrectMassageBox").hide():
6
  a("#wpProQuiz_incorrectMassageBox").show()});a("#wpProQuiz_tip").change(function(){this.checked?a("#wpProQuiz_tipBox").show():a("#wpProQuiz_tipBox").hide()})},displaySingle:function(b){a(".classic_answer").find('input[name="answerJson[classic_answer][correct][]"]').each(function(){a("<input type="+b+" />").attr({name:this.name,value:this.value,checked:this.checked}).insertBefore(this)}).remove();a(".classic_answer").css("display","block")},displayFreeAnswer:function(){a(".free_answer").css("display",
7
  "block")},displaySortAnswer:function(){a(".sort_answer").css("display","block")},displayMatrixSortAnswer:function(){a(".matrix_sort_answer").show()},displayClozeAnswer:function(){a(".cloze_answer").show()},addAnswer:function(b){a(b).siblings("ul").children().first().clone().css("display","block").appendTo(a(b).siblings("ul"));c.setValueClassicAnswer();a(".deleteAnswer").click(function(){c.deleteAnswer(this)})},deleteAnswer:function(b){a(b).parent("li").remove();c.setValueClassicAnswer()},setValueClassicAnswer:function(){var b=
8
+ 0;a('input[name="answerJson[classic_answer][correct][]"]').each(function(){this.value=b++});b=0;a('input[name="answerJson[answer_matrix_sort][sort_string_html][]"]').each(function(){this.value=b++});b=0;a('input[name="answerJson[answer_matrix_sort][answer_html][]"]').each(function(){this.value=b++})}},d=function(){var c="",d=a('input[name="answerType"]:checked'),f=a('input[name="points"]'),c=void 0!=tinymce.editors.question&&!tinymce.editors.question.isHidden()?tinymce.editors.question.getContent():
9
+ a('textarea[name="question"]').val();if(isNaN(f.val())||1>f.val())return alert(wpProQuizLocalize.no_nummber_points),f.focus(),!1;if(b(c))return alert(wpProQuizLocalize.no_question_msg),!1;if("single"==d.val()||"multiple"==d.val()){var e=!0;if(1>a('input[name="answerJson[classic_answer][correct][]"]:checked').each(function(){e=""!=a.trim(a(this).parent().siblings("textarea").val())?e&1:!1}).size())return alert(wpProQuizLocalize.no_correct_msg),!1;if(!e)return alert(wpProQuizLocalize.no_answer_msg),
10
+ !1}else if("sort_answer"==d.val()){if(e=!1,a('textarea[name="answerJson[answer_sort][answer][]"]').each(function(){e=b(a(this).val())?e|0:!0}),!e)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("matrix_sort_answer"==d.val()){if(e=!1,a('textarea[name="answerJson[answer_matrix_sort][answer][]"]').each(function(){if(b(a(this).val()))e|=0;else{var c=a(this).parent().parent().find('textarea[name="answerJson[answer_matrix_sort][sort_string][]"]');e=b(c.val())?e|0:!0}}),!e)return alert(wpProQuizLocalize.no_answer_msg),
11
+ !1}else if("cloze_answer"==d.val()){if(c="",c=void 0!=tinymce.editors.cloze&&!tinymce.editors.cloze.isHidden()?tinymce.editors.cloze.getContent():a('textarea[name="answerJson[answer_cloze][text]"]').val(),b(c))return alert(wpProQuizLocalize.no_answer_msg),!1}else if("free_answer"==d.val()&&(c=a('textarea[name="answerJson[free_answer][correct]"]').val(),b(c)))return alert(wpProQuizLocalize.no_answer_msg),!1;return!0},b=function(b){b=a.trim(b);return!b||0===b.length};c.setup();1>a('input[name="answerType"][checked="checked"]').size()&&
12
+ a('input[name="answerType"][value="single"]').attr({checked:"checked"});a('input[name="answerType"]:checked').click();a("#wpProQuiz_correctSameText").change();a("#wpProQuiz_tip").change()};a.fn.wpProQuiz_questionOverall=function(){var c={saveSort:function(){var d={action:"wp_pro_quiz_update_sort",sort:c.parseSortArray()},b=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(b,d,function(b){console.debug(b);a("#sortMsg").show(400).delay(1E3).hide(400)})},
13
+ parseSortArray:function(){var c=[];a("tbody tr").each(function(){c.push(this.id.replace("wpProQuiz_questionId_",""))});return c},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=a(this).children().first().text(a(this).index()+1)})}};a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",update:c.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),!1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();
14
+ c.saveSort()});console.debug(a)};a.fn.wpProQuiz_quizEdit=function(){var c={addResult:function(){a("#resultList").children().each(function(){if("none"==a(this).css("display")){var b=a(this),c=b.find('textarea[name="resultTextGrade[text][]"]'),d=c.attr("id"),f=!0;b.find('input[name="resultTextGrade[prozent][]"]').val("0");b.find('input[name="resultTextGrade[activ][]"]').val("1").keyup();void 0!=tinymce.editors[d]&&!tinymce.editors[d].isHidden()&&(f=!1);void 0!=switchEditors&&!f&&(switchEditors.go(d,
15
+ "toggle"),switchEditors.go(d,"toggle"));void 0!=tinymce.editors[d]?tinymce.editors[d].setContent(""):c.val("");void 0!=tinymce.editors[d]&&!f&&tinyMCE.execCommand("mceRemoveControl",!1,d);b.parent().children(":visible").last().after(b);void 0!=tinymce.editors[d]&&!f&&tinyMCE.execCommand("mceAddControl",!1,d);a(this).show();void 0!=switchEditors&&!f&&switchEditors.go(d,"toggle");return!1}})},deleteResult:function(b){a(b).parent().parent().hide();a(b).siblings('input[name="resultTextGrade[activ][]"]').val("0")},
16
+ changeResult:function(b){b=a(b);if(c.validResultInput(b.val()))return b.siblings(".resultProzent").text(b.val()),b.removeAttr("style"),!0;b.css("background-color","#FF9696");return!1},validResultInput:function(a){if(d(a))return!1;a=a.replace(/\,/,".");return!isNaN(a)&&100>=Number(a)&&0<=Number(a)?null!=a.match(/\./)?3>a.split(".")[1].length:!0:!1},validInput:function(){if(d(a("#wpProQuiz_title").val()))return alert(wpProQuizLocalize.no_title_msg),!1;var b="",b=void 0!=tinymce.editors.text&&!tinymce.editors.text.isHidden()?
17
+ tinymce.editors.text.getContent():a('textarea[name="text"]').val();if(d(b))return alert(wpProQuizLocalize.no_quiz_start_msg),!1;if(a("#wpProQuiz_resultGradeEnabled:checked").length){var g=!0;console.debug("hier");a("#resultList").children().each(function(){if(a(this).is(":visible")&&!c.validResultInput(a(this).find('input[name="resultTextGrade[prozent][]"]').val()))return g=!1});if(!g)return alert(wpProQuizLocalize.fail_grade_result),!1}return!0}},d=function(b){b=a.trim(b);return!b||0===b.length};
18
+ a("#statistics_on").change(function(){this.checked?a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a(".addResult").click(function(){c.addResult()});a(".deleteResult").click(function(){c.deleteResult(this)});a('input[name="resultTextGrade[prozent][]"]').keyup(function(){c.changeResult(this)}).keydown(function(a){13==a.which&&a.preventDefault()});a("#wpProQuiz_resultGradeEnabled").change(function(){this.checked?(a("#resultGrade").show(),a("#resultNormal").hide()):(a("#resultGrade").hide(),
19
+ a("#resultNormal").show())});a("#wpProQuiz_save").click(function(a){c.validInput()||a.preventDefault()});a("#statistics_on").change();a("#wpProQuiz_resultGradeEnabled").change()};a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_quizOverall();a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionEdit").length&&a(".wpProQuiz_questionEdit").wpProQuiz_questionEdit();
20
+ a(".wpProQuiz_questionOverall").length&&a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall()});
js/wpProQuiz_front.js CHANGED
@@ -166,6 +166,12 @@
166
  console.debug($(this));
167
  });
168
 
 
 
 
 
 
 
169
  i++;
170
  });
171
  },
@@ -243,9 +249,10 @@
243
  } else if(type == 'matrix_sort_answer') {
244
  var check = true;
245
  var $qList = $question.find('.wpProQuiz_questionList').children();
 
246
 
247
  $qList.each(function() {
248
- var index = $(this).index();
249
  var $par = $(this).find('.wpProQuiz_maxtrixSortCriterion');
250
  var item = $par.children().first();
251
 
@@ -256,10 +263,12 @@
256
  check = false;
257
  $par.addClass('wpProQuiz_answerIncorrect');
258
  }
 
 
259
  });
260
 
261
  $question.find('.wpProQuiz_sortStringItem').each(function() {
262
- $qList.eq($(this).data('correct')).find('.wpProQuiz_maxtrixSortCriterion').append(this);
263
  }).css({'box-shadow': '0 0', 'cursor': 'auto'});
264
 
265
  $question.find('.wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion').sortable("destroy");
@@ -275,9 +284,11 @@
275
  var iText = input.val().toLowerCase();
276
  var cloze = children.last().text().toLowerCase();
277
 
278
- cloze = cloze.substr(1, cloze.length-2);
 
 
279
 
280
- if($.trim(cloze) == $.trim(iText)) {
281
  check &= true;
282
  input.css('background-color', '#B0DAB0');
283
  } else {
@@ -384,6 +395,17 @@
384
  return index;
385
  },
386
 
 
 
 
 
 
 
 
 
 
 
 
387
  sendStatistics: function() {
388
  if(!config.statisticsOn)
389
  return;
166
  console.debug($(this));
167
  });
168
 
169
+ if(j.answer_type == 'matrix_sort_answer') {
170
+ $(this).children().each(function() {
171
+ $(this).data('correct', $(this).index());
172
+ });
173
+ }
174
+
175
  i++;
176
  });
177
  },
249
  } else if(type == 'matrix_sort_answer') {
250
  var check = true;
251
  var $qList = $question.find('.wpProQuiz_questionList').children();
252
+ var matrixArray = new Object();
253
 
254
  $qList.each(function() {
255
+ var index = $(this).data('correct');
256
  var $par = $(this).find('.wpProQuiz_maxtrixSortCriterion');
257
  var item = $par.children().first();
258
 
263
  check = false;
264
  $par.addClass('wpProQuiz_answerIncorrect');
265
  }
266
+
267
+ matrixArray[index] = $(this);
268
  });
269
 
270
  $question.find('.wpProQuiz_sortStringItem').each(function() {
271
+ matrixArray[$(this).data('correct')].find('.wpProQuiz_maxtrixSortCriterion').append(this);
272
  }).css({'box-shadow': '0 0', 'cursor': 'auto'});
273
 
274
  $question.find('.wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion').sortable("destroy");
284
  var iText = input.val().toLowerCase();
285
  var cloze = children.last().text().toLowerCase();
286
 
287
+ cloze = $.trim(cloze.substr(1, cloze.length-2));
288
+ cloze = plugin.methode.cleanupCurlyQuotes(cloze);
289
+ iText = plugin.methode.cleanupCurlyQuotes($.trim(iText));
290
 
291
+ if(cloze == iText) {
292
  check &= true;
293
  input.css('background-color', '#B0DAB0');
294
  } else {
395
  return index;
396
  },
397
 
398
+ cleanupCurlyQuotes: function(str) {
399
+
400
+ str = str.replace(/\u2018/, "'");
401
+ str = str.replace(/\u2019/, "'");
402
+
403
+ str = str.replace(/\u201C/, '"');
404
+ str = str.replace(/\u201D/, '"');
405
+
406
+ return str;
407
+ },
408
+
409
  sendStatistics: function() {
410
  if(!config.statisticsOn)
411
  return;
js/wpProQuiz_front.min.js CHANGED
@@ -1,18 +1,19 @@
1
- (function(c){c.wpProQuizFront=function(m,f){var b=c(m),e=this,l=0,h=0,n=0,i={},k=0,j=0;e.methode={startQuiz:function(){i={};f.questionRandom&&e.methode.questionRandom();f.answerRandom?e.methode.answerRandom(".wpProQuiz_questionList"):e.methode.answerRandom(b.find(".wpProQuiz_sortable").parent().parent());f.timeLimit&&e.methode.setTimeLimit();k=l=0;n=new Date;f.checkAnswer?b.find('input[name="check"]').show():b.find('input[name="next"]').show();b.find(".wpProQuiz_text").hide();b.find(".wpProQuiz_quiz").show();
2
  b.find(".wpProQuiz_listItem").first().fadeIn(200);b.find(".wpProQuiz_sortable").parent().parent().sortable().disableSelection();b.find(".wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion").sortable({connectWith:".wpProQuiz_maxtrixSortCriterion:not(:has(li)), .wpProQuiz_sortStringList",placeholder:"wpProQuiz_placehold"}).disableSelection()},reStartQuiz:function(){b.find(".wpProQuiz_answerCorrect").removeClass("wpProQuiz_answerCorrect");b.find(".wpProQuiz_answerIncorrect").removeClass("wpProQuiz_answerIncorrect");
3
  b.find('.wpProQuiz_text, input[name="tip"]').show();b.find(".wpProQuiz_quiz, .wpProQuiz_results, .wpProQuiz_response, .wpProQuiz_correct, .wpProQuiz_incorrect").hide();b.find(".wpProQuiz_time_limit, .wpProQuiz_time_limit_expired, .wpProQuiz_sort_correct_answer").hide();b.find(".wpProQuiz_quiz").children().first().children().hide();b.find(".wpProQuiz_sortable, .wpProQuiz_sortStringItem").removeAttr("style");b.find('input[name="check"]').hide();b.find('input[name="next"]').hide();b.find(".wpProQuiz_questionInput").removeAttr("disabled").removeAttr("checked");
4
- b.find('input.wpProQuiz_questionInput[type="text"]').removeAttr("value");b.find(".wpProQuiz_resultsList").children().hide();b.find(".wpProQuiz_cloze input").removeAttr("disabled").removeAttr("value").css("background-color","");b.find(".wpProQuiz_cloze span").hide();e.methode.resetMatrix()},resetMatrix:function(){b.find(".wpProQuiz_question").each(function(){var a=c(this),d=a.find(".wpProQuiz_sortStringList");a.find(".wpProQuiz_sortStringItem").each(function(){d.append(c(this))})})},setTimeLimit:function(){var a=
5
- b.find(".wpProQuiz_time_limit"),d=a.find("span"),c=f.timeLimit;a.css({width:"100%",display:"block"});d.html(e.methode.parseTime(c));a.find(".progress").css("width","100%").animate({width:"0%"},1E3*f.timeLimit);h=setInterval(function(){d.html(e.methode.parseTime(c--));0>c&&(clearInterval(h),h=0,a.find(".progress").clearQueue().stop(),b.find('input[name="check"]').click().parent().hide(),b.find(".wpProQuiz_time_limit_expired").show(),e.methode.showResult())},1E3)},parseTime:function(a){var d=parseInt(a%
6
- 60),c=parseInt(a/60%60),a=parseInt(a/3600%24);return(9<a?"":"0")+a+":"+((9<c?"":"0")+c)+":"+((9<d?"":"0")+d)},setQuizTime:function(){var a=((new Date).getTime()-n.getTime())/1E3;b.find(".wpProQuiz_quiz_time span").first().html(e.methode.parseTime(a))},setData:function(){var a=0;b.find(".wpProQuiz_questionList").each(function(){var d=f.json[a],b=0;j+=d.points;c(this).parent().parent().data("type",d.answer_type).data("questionId",d.id).data("points",d.points);c(this).find(".wpProQuiz_questionInput").each(function(){switch(d.answer_type){case "single":case "multiple":0<=
7
- c.inArray(this.value,d.correct)?c(this).data("correct","1"):c(this).data("correct","0");break;case "free_answer":c(this).data("correct",d.correct)}});b=0;c(this).find(".wpProQuiz_sortable").each(function(){c(this).data("correct",d.correct[b++])});b=0;c(this).parent().find(".wpProQuiz_sortStringList").children().each(function(){c(this).data("correct",d.correct[b++]);console.debug(c(this))});a++})},checkAnswer:function(a){var d=c(a).parent(),b=!1,e=d.find(".wpProQuiz_questionInput"),f=d.data("type");
8
- d.find('input[name="tip"]').hide();if("multiple"==f||"single"==f){var g=!0;e.each(function(){"1"==c(this).data("correct")?(c(this).parent().parent().addClass("wpProQuiz_answerCorrect"),g=this.checked?g&1:g&0):this.checked&&(c(this).parent().parent().addClass("wpProQuiz_answerIncorrect"),g&=0)});b=g}else if("sort_answer"==f){g=!0;d.find(".wpProQuiz_sortable").each(function(){var a=c(this),b=a.parent().index();a.data("correct")==b?(a.parent().addClass("wpProQuiz_answerCorrect"),g&=1):(a.parent().addClass("wpProQuiz_answerIncorrect"),
9
- g=!1);a.css({"box-shadow":"0 0",cursor:"auto"})});var h=d.find(".wpProQuiz_sortable").parent().parent(),b=h.children("li");h.sortable("destroy");b.sort(function(a,b){return c(a).children("div").data("correct")>c(b).children("div").data("correct")});c.each(b,function(a,b){h.append(b)});b=g}else if("free_answer"==f)f=c.trim(e.val()).toLowerCase(),0<=c.inArray(f,e.data("correct"))?(b=!0,e.parent().parent().addClass("wpProQuiz_answerCorrect")):e.parent().parent().addClass("wpProQuiz_answerIncorrect");
10
- else if("matrix_sort_answer"==f){var g=!0,j=d.find(".wpProQuiz_questionList").children();j.each(function(){var a=c(this).index(),b=c(this).find(".wpProQuiz_maxtrixSortCriterion");b.children().first().data("correct")==a?(g&=1,b.addClass("wpProQuiz_answerCorrect")):(g=!1,b.addClass("wpProQuiz_answerIncorrect"))});d.find(".wpProQuiz_sortStringItem").each(function(){j.eq(c(this).data("correct")).find(".wpProQuiz_maxtrixSortCriterion").append(this)}).css({"box-shadow":"0 0",cursor:"auto"});d.find(".wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion").sortable("destroy");
11
- b=g}else"cloze_answer"==f&&(g=!0,d.find(".wpProQuiz_cloze").each(function(){var a=c(this).children(),b=a.first(),d=b.val().toLowerCase(),e=a.last().text().toLowerCase(),e=e.substr(1,e.length-2);c.trim(e)==c.trim(d)?(g&=1,b.css("background-color","#B0DAB0")):(g=!1,b.css("background-color","#FFBABA"),a.last().show());b.attr("disabled","disabled")}),b=g);c(a).hide();e.attr("disabled","disabled");void 0==i[d.data("questionId")]&&(i[d.data("questionId")]={});i[d.data("questionId")].correct=Number(b);d.find(".wpProQuiz_response").show();
12
- b?(d.find(".wpProQuiz_correct").show(),l++,k+=d.data("points")):d.find(".wpProQuiz_incorrect").show();d.find('input[name="next"]').show()},nextQuestion:function(a){var a=c(a).parent(),d=a.next();a.hide();d.length?(d.show(),f.backButton&&!f.checkAnswer&&d.find('input[name="back"]').show()):(f.checkAnswer||b.find('input[name="check"]').click(),e.methode.showResult())},backQuestion:function(a){var a=c(a).parent(),b=a.prev();a.hide();b.show()},showResult:function(){clearInterval(h);var a=b.find(".wpProQuiz_points span");
13
- b.find(".wpProQuiz_time_limit .progress").clearQueue().stop();b.find(".wpProQuiz_correct_answer").html(l);b.find(".wpProQuiz_results").show();b.find(".wpProQuiz_time_limit").hide();e.methode.setQuizTime();var d=Math.round(1E4*(k/j))/100;a.eq(0).text(k);a.eq(1).text(j);a.eq(2).text(d);a=e.methode.findResultIndex(d);-1<a&&b.find(".wpProQuiz_resultsList").children().eq(a).show();e.methode.sendStatistics()},findResultIndex:function(a){for(var b=f.resultsGrade,c=-1,e=999999,h=0;h<b.length;h++){var g=b[h];
14
- a>=g&&a-g<e&&(e=a-g,c=h)}return c},sendStatistics:function(){f.statisticsOn&&c.ajax({url:f.url,type:"POST",cache:!1,data:{action:"wp_pro_quiz_statistics_save",results:i,quizId:f.quizId}})},reShowQuestion:function(){b.find('input[name="next"], input[name="check"], input[name="back"]').hide();b.find(".wpProQuiz_quiz").children().first().children().show()},answerRandom:function(a){b.find(a).each(function(){var a=c(this).children(),a=a.sort(function(){return Math.round(Math.random())-0.5}).slice(0,a.length);
15
- c(a).appendTo(a[0].parentNode).show()})},questionRandom:function(){var a=b.find(".wpProQuiz_quiz ol").children(),a=a.sort(function(){return Math.round(Math.random())-0.5}).slice(0,a.length);c(a).appendTo(a[0].parentNode);var d=1;c(a).each(function(){c(this).find(".wpProQuiz_question_page span").eq(0).html(d);c(this).find("h3 span").html(d++)})},showTip:function(a){$tip=c(a).siblings(".wpProQuiz_tipp");$par=c(a).parent();void 0==i[$par.data("questionId")]&&(i[$par.data("questionId")]={});i[$par.data("questionId")].tip=
16
- 1;$tip.toggle("fast")},setClozeStyle:function(){b.find(".wpProQuiz_cloze").each(function(){var a=c(this).children(),b=a.first(),a=a.last().clone();a.css("visibility","hidden");c("body").append(a);var e=a.width();a.remove();b.width(e+10)})}};e.init=function(){l=0;void 0==f.resultsGrade&&(f.resultsGrade=[0]);b.find(".wpProQuiz_quiz, .wpProQuiz_results").hide();b.find(".wpProQuiz_quiz").children().first().children().hide();e.methode.setData();e.methode.setClozeStyle();b.find('input[name="startQuiz"]').click(function(a){a.preventDefault();
17
- e.methode.startQuiz()});b.find('input[name="check"]').click(function(a){a.preventDefault();e.methode.checkAnswer(this)});b.find('input[name="next"]').click(function(a){a.preventDefault();e.methode.nextQuestion(this)});b.find('input[name="restartQuiz"]').click(function(a){a.preventDefault();e.methode.reStartQuiz()});b.find('input[name="reShowQuestion"]').click(function(a){a.preventDefault();e.methode.reShowQuestion(this)});b.find('input[name="back"]').click(function(){e.methode.backQuestion(this)});
18
- b.find('input[name="tip"]').click(function(){e.methode.showTip(this)});c(document).mouseup(function(a){var c=b.find(".wpProQuiz_tipp"),e=b.find('input[name="tip"]');!c.is(a.target)&&(0==c.has(a.target).length&&!e.is(a.target))&&c.hide("fast")})};e.init()};c.fn.wpProQuizFront=function(m){return this.each(function(){void 0==c(this).data("wpProQuizFront")&&c(this).data("wpProQuizFront",new c.wpProQuizFront(this,m))})}})(jQuery);
 
1
+ (function(c){c.wpProQuizFront=function(n,e){var b=c(n),f=this,m=0,i=0,p=0,j={},l=0,k=0;f.methode={startQuiz:function(){j={};e.questionRandom&&f.methode.questionRandom();e.answerRandom?f.methode.answerRandom(".wpProQuiz_questionList"):f.methode.answerRandom(b.find(".wpProQuiz_sortable").parent().parent());e.timeLimit&&f.methode.setTimeLimit();l=m=0;p=new Date;e.checkAnswer?b.find('input[name="check"]').show():b.find('input[name="next"]').show();b.find(".wpProQuiz_text").hide();b.find(".wpProQuiz_quiz").show();
2
  b.find(".wpProQuiz_listItem").first().fadeIn(200);b.find(".wpProQuiz_sortable").parent().parent().sortable().disableSelection();b.find(".wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion").sortable({connectWith:".wpProQuiz_maxtrixSortCriterion:not(:has(li)), .wpProQuiz_sortStringList",placeholder:"wpProQuiz_placehold"}).disableSelection()},reStartQuiz:function(){b.find(".wpProQuiz_answerCorrect").removeClass("wpProQuiz_answerCorrect");b.find(".wpProQuiz_answerIncorrect").removeClass("wpProQuiz_answerIncorrect");
3
  b.find('.wpProQuiz_text, input[name="tip"]').show();b.find(".wpProQuiz_quiz, .wpProQuiz_results, .wpProQuiz_response, .wpProQuiz_correct, .wpProQuiz_incorrect").hide();b.find(".wpProQuiz_time_limit, .wpProQuiz_time_limit_expired, .wpProQuiz_sort_correct_answer").hide();b.find(".wpProQuiz_quiz").children().first().children().hide();b.find(".wpProQuiz_sortable, .wpProQuiz_sortStringItem").removeAttr("style");b.find('input[name="check"]').hide();b.find('input[name="next"]').hide();b.find(".wpProQuiz_questionInput").removeAttr("disabled").removeAttr("checked");
4
+ b.find('input.wpProQuiz_questionInput[type="text"]').removeAttr("value");b.find(".wpProQuiz_resultsList").children().hide();b.find(".wpProQuiz_cloze input").removeAttr("disabled").removeAttr("value").css("background-color","");b.find(".wpProQuiz_cloze span").hide();f.methode.resetMatrix()},resetMatrix:function(){b.find(".wpProQuiz_question").each(function(){var a=c(this),d=a.find(".wpProQuiz_sortStringList");a.find(".wpProQuiz_sortStringItem").each(function(){d.append(c(this))})})},setTimeLimit:function(){var a=
5
+ b.find(".wpProQuiz_time_limit"),d=a.find("span"),c=e.timeLimit;a.css({width:"100%",display:"block"});d.html(f.methode.parseTime(c));a.find(".progress").css("width","100%").animate({width:"0%"},1E3*e.timeLimit);i=setInterval(function(){d.html(f.methode.parseTime(c--));0>c&&(clearInterval(i),i=0,a.find(".progress").clearQueue().stop(),b.find('input[name="check"]').click().parent().hide(),b.find(".wpProQuiz_time_limit_expired").show(),f.methode.showResult())},1E3)},parseTime:function(a){var d=parseInt(a%
6
+ 60),c=parseInt(a/60%60),a=parseInt(a/3600%24);return(9<a?"":"0")+a+":"+((9<c?"":"0")+c)+":"+((9<d?"":"0")+d)},setQuizTime:function(){var a=((new Date).getTime()-p.getTime())/1E3;b.find(".wpProQuiz_quiz_time span").first().html(f.methode.parseTime(a))},setData:function(){var a=0;b.find(".wpProQuiz_questionList").each(function(){var d=e.json[a],b=0;k+=d.points;c(this).parent().parent().data("type",d.answer_type).data("questionId",d.id).data("points",d.points);c(this).find(".wpProQuiz_questionInput").each(function(){switch(d.answer_type){case "single":case "multiple":0<=
7
+ c.inArray(this.value,d.correct)?c(this).data("correct","1"):c(this).data("correct","0");break;case "free_answer":c(this).data("correct",d.correct)}});b=0;c(this).find(".wpProQuiz_sortable").each(function(){c(this).data("correct",d.correct[b++])});b=0;c(this).parent().find(".wpProQuiz_sortStringList").children().each(function(){c(this).data("correct",d.correct[b++]);console.debug(c(this))});"matrix_sort_answer"==d.answer_type&&c(this).children().each(function(){c(this).data("correct",c(this).index())});
8
+ a++})},checkAnswer:function(a){var d=c(a).parent(),b=!1,e=d.find(".wpProQuiz_questionInput"),h=d.data("type");d.find('input[name="tip"]').hide();if("multiple"==h||"single"==h){var g=!0;e.each(function(){"1"==c(this).data("correct")?(c(this).parent().parent().addClass("wpProQuiz_answerCorrect"),g=this.checked?g&1:g&0):this.checked&&(c(this).parent().parent().addClass("wpProQuiz_answerIncorrect"),g&=0)});b=g}else if("sort_answer"==h){g=!0;d.find(".wpProQuiz_sortable").each(function(){var a=c(this),
9
+ b=a.parent().index();a.data("correct")==b?(a.parent().addClass("wpProQuiz_answerCorrect"),g&=1):(a.parent().addClass("wpProQuiz_answerIncorrect"),g=!1);a.css({"box-shadow":"0 0",cursor:"auto"})});var i=d.find(".wpProQuiz_sortable").parent().parent(),b=i.children("li");i.sortable("destroy");b.sort(function(a,b){return c(a).children("div").data("correct")>c(b).children("div").data("correct")});c.each(b,function(a,b){i.append(b)});b=g}else if("free_answer"==h)h=c.trim(e.val()).toLowerCase(),0<=c.inArray(h,
10
+ e.data("correct"))?(b=!0,e.parent().parent().addClass("wpProQuiz_answerCorrect")):e.parent().parent().addClass("wpProQuiz_answerIncorrect");else if("matrix_sort_answer"==h){var g=!0,k={};d.find(".wpProQuiz_questionList").children().each(function(){var a=c(this).data("correct"),b=c(this).find(".wpProQuiz_maxtrixSortCriterion");b.children().first().data("correct")==a?(g&=1,b.addClass("wpProQuiz_answerCorrect")):(g=!1,b.addClass("wpProQuiz_answerIncorrect"));k[a]=c(this)});d.find(".wpProQuiz_sortStringItem").each(function(){k[c(this).data("correct")].find(".wpProQuiz_maxtrixSortCriterion").append(this)}).css({"box-shadow":"0 0",
11
+ cursor:"auto"});d.find(".wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion").sortable("destroy");b=g}else"cloze_answer"==h&&(g=!0,d.find(".wpProQuiz_cloze").each(function(){var a=c(this).children(),b=a.first(),d=b.val().toLowerCase(),e=a.last().text().toLowerCase(),e=c.trim(e.substr(1,e.length-2)),e=f.methode.cleanupCurlyQuotes(e),d=f.methode.cleanupCurlyQuotes(c.trim(d));e==d?(g&=1,b.css("background-color","#B0DAB0")):(g=!1,b.css("background-color","#FFBABA"),a.last().show());b.attr("disabled",
12
+ "disabled")}),b=g);c(a).hide();e.attr("disabled","disabled");void 0==j[d.data("questionId")]&&(j[d.data("questionId")]={});j[d.data("questionId")].correct=Number(b);d.find(".wpProQuiz_response").show();b?(d.find(".wpProQuiz_correct").show(),m++,l+=d.data("points")):d.find(".wpProQuiz_incorrect").show();d.find('input[name="next"]').show()},nextQuestion:function(a){var a=c(a).parent(),d=a.next();a.hide();d.length?(d.show(),e.backButton&&!e.checkAnswer&&d.find('input[name="back"]').show()):(e.checkAnswer||
13
+ b.find('input[name="check"]').click(),f.methode.showResult())},backQuestion:function(a){var a=c(a).parent(),b=a.prev();a.hide();b.show()},showResult:function(){clearInterval(i);var a=b.find(".wpProQuiz_points span");b.find(".wpProQuiz_time_limit .progress").clearQueue().stop();b.find(".wpProQuiz_correct_answer").html(m);b.find(".wpProQuiz_results").show();b.find(".wpProQuiz_time_limit").hide();f.methode.setQuizTime();var d=Math.round(1E4*(l/k))/100;a.eq(0).text(l);a.eq(1).text(k);a.eq(2).text(d);
14
+ a=f.methode.findResultIndex(d);-1<a&&b.find(".wpProQuiz_resultsList").children().eq(a).show();f.methode.sendStatistics()},findResultIndex:function(a){for(var b=e.resultsGrade,c=-1,f=999999,h=0;h<b.length;h++){var g=b[h];a>=g&&a-g<f&&(f=a-g,c=h)}return c},cleanupCurlyQuotes:function(a){a=a.replace(/\u2018/,"'");a=a.replace(/\u2019/,"'");a=a.replace(/\u201C/,'"');return a=a.replace(/\u201D/,'"')},sendStatistics:function(){e.statisticsOn&&c.ajax({url:e.url,type:"POST",cache:!1,data:{action:"wp_pro_quiz_statistics_save",
15
+ results:j,quizId:e.quizId}})},reShowQuestion:function(){b.find('input[name="next"], input[name="check"], input[name="back"]').hide();b.find(".wpProQuiz_quiz").children().first().children().show()},answerRandom:function(a){b.find(a).each(function(){var a=c(this).children(),a=a.sort(function(){return Math.round(Math.random())-0.5}).slice(0,a.length);c(a).appendTo(a[0].parentNode).show()})},questionRandom:function(){var a=b.find(".wpProQuiz_quiz ol").children(),a=a.sort(function(){return Math.round(Math.random())-
16
+ 0.5}).slice(0,a.length);c(a).appendTo(a[0].parentNode);var d=1;c(a).each(function(){c(this).find(".wpProQuiz_question_page span").eq(0).html(d);c(this).find("h3 span").html(d++)})},showTip:function(a){$tip=c(a).siblings(".wpProQuiz_tipp");$par=c(a).parent();void 0==j[$par.data("questionId")]&&(j[$par.data("questionId")]={});j[$par.data("questionId")].tip=1;$tip.toggle("fast")},setClozeStyle:function(){b.find(".wpProQuiz_cloze").each(function(){var a=c(this).children(),b=a.first(),a=a.last().clone();
17
+ a.css("visibility","hidden");c("body").append(a);var e=a.width();a.remove();b.width(e+10)})}};f.init=function(){m=0;void 0==e.resultsGrade&&(e.resultsGrade=[0]);b.find(".wpProQuiz_quiz, .wpProQuiz_results").hide();b.find(".wpProQuiz_quiz").children().first().children().hide();f.methode.setData();f.methode.setClozeStyle();b.find('input[name="startQuiz"]').click(function(a){a.preventDefault();f.methode.startQuiz()});b.find('input[name="check"]').click(function(a){a.preventDefault();f.methode.checkAnswer(this)});
18
+ b.find('input[name="next"]').click(function(a){a.preventDefault();f.methode.nextQuestion(this)});b.find('input[name="restartQuiz"]').click(function(a){a.preventDefault();f.methode.reStartQuiz()});b.find('input[name="reShowQuestion"]').click(function(a){a.preventDefault();f.methode.reShowQuestion(this)});b.find('input[name="back"]').click(function(){f.methode.backQuestion(this)});b.find('input[name="tip"]').click(function(){f.methode.showTip(this)});c(document).mouseup(function(a){var c=b.find(".wpProQuiz_tipp"),
19
+ e=b.find('input[name="tip"]');!c.is(a.target)&&(0==c.has(a.target).length&&!e.is(a.target))&&c.hide("fast")})};f.init()};c.fn.wpProQuizFront=function(n){return this.each(function(){void 0==c(this).data("wpProQuizFront")&&c(this).data("wpProQuizFront",new c.wpProQuizFront(this,n))})}})(jQuery);
lib/helper/WpProQuiz_Helper_DbUpgrade.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  class WpProQuiz_Helper_DbUpgrade {
3
 
4
- const WPPROQUIZ_DB_VERSION = 7;
5
 
6
  private $_wpdb;
7
  private $_prefix;
@@ -63,8 +63,8 @@ class WpProQuiz_Helper_DbUpgrade {
63
  `statistics_on` tinyint(1) NOT NULL,
64
  `statistics_ip_lock` int(10) unsigned NOT NULL,
65
  `show_points` tinyint(1) NOT NULL,
66
- PRIMARY KEY (`id`)
67
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
68
 
69
  ');
70
 
@@ -86,18 +86,18 @@ class WpProQuiz_Helper_DbUpgrade {
86
  `tip_count` int(11) NOT NULL,
87
  `answer_type` varchar(50) NOT NULL,
88
  `answer_json` text NOT NULL,
89
- PRIMARY KEY (`id`),
90
- KEY `quiz_id` (`quiz_id`)
91
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
92
  ');
93
 
94
  $this->_wpdb->query('
95
  CREATE TABLE IF NOT EXISTS `'.$this->_wpdb->prefix.'wp_pro_quiz_lock` (
96
- `quiz_id` int(11) NOT NULL,
97
- `lock_ip` varchar(100) NOT NULL,
98
- `lock_date` int(11) NOT NULL,
99
- PRIMARY KEY (`quiz_id`,`lock_ip`)
100
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
101
  ');
102
  }
103
 
@@ -211,4 +211,43 @@ class WpProQuiz_Helper_DbUpgrade {
211
 
212
  return 7;
213
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  }
1
  <?php
2
  class WpProQuiz_Helper_DbUpgrade {
3
 
4
+ const WPPROQUIZ_DB_VERSION = 8;
5
 
6
  private $_wpdb;
7
  private $_prefix;
63
  `statistics_on` tinyint(1) NOT NULL,
64
  `statistics_ip_lock` int(10) unsigned NOT NULL,
65
  `show_points` tinyint(1) NOT NULL,
66
+ PRIMARY KEY (`id`)
67
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
68
 
69
  ');
70
 
86
  `tip_count` int(11) NOT NULL,
87
  `answer_type` varchar(50) NOT NULL,
88
  `answer_json` text NOT NULL,
89
+ PRIMARY KEY (`id`),
90
+ KEY `quiz_id` (`quiz_id`)
91
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
92
  ');
93
 
94
  $this->_wpdb->query('
95
  CREATE TABLE IF NOT EXISTS `'.$this->_wpdb->prefix.'wp_pro_quiz_lock` (
96
+ `quiz_id` int(11) NOT NULL,
97
+ `lock_ip` varchar(100) NOT NULL,
98
+ `lock_date` int(11) NOT NULL,
99
+ PRIMARY KEY (`quiz_id`,`lock_ip`)
100
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
101
  ');
102
  }
103
 
211
 
212
  return 7;
213
  }
214
+
215
+ private function upgradeDbV7() {
216
+ $this->_wpdb->query('
217
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_master`
218
+ CHANGE `name` `name` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
219
+ CHANGE `text` `text` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
220
+ CHANGE `result_text` `result_text` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
221
+ ');
222
+
223
+ $this->_wpdb->query('
224
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_question`
225
+ CHANGE `title` `title` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
226
+ CHANGE `question` `question` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
227
+ CHANGE `correct_msg` `correct_msg` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
228
+ CHANGE `incorrect_msg` `incorrect_msg` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
229
+ CHANGE `tip_msg` `tip_msg` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
230
+ CHANGE `answer_type` `answer_type` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
231
+ CHANGE `answer_json` `answer_json` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
232
+ ');
233
+
234
+ $this->_wpdb->query('
235
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_lock`
236
+ CHANGE `lock_ip` `lock_ip` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
237
+ ');
238
+
239
+ $this->_wpdb->query('
240
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_lock` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
241
+ ');
242
+
243
+ $this->_wpdb->query('
244
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_master` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
245
+ ');
246
+
247
+ $this->_wpdb->query('
248
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_question` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
249
+ ');
250
+
251
+ return 8;
252
+ }
253
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: xeno010
3
  Tags: quiz, test, answer, question, learning
4
  Requires at least: 3.3
5
  Tested up to: 3.4.2
6
- Stable tag: 0.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -112,4 +112,10 @@ Own themes changes internal order of filters, what causes the problems. With ad
112
  * Bugfix in the frontend and backend
113
 
114
  = 0.9 =
115
- * Bugfix in the frontend (Single choice)
 
 
 
 
 
 
3
  Tags: quiz, test, answer, question, learning
4
  Requires at least: 3.3
5
  Tested up to: 3.4.2
6
+ Stable tag: 0.10
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
112
  * Bugfix in the frontend and backend
113
 
114
  = 0.9 =
115
+ * Bugfix in the frontend (Single choice)
116
+
117
+ = 0.10 =
118
+ * Bugfix: "Matrix Sorting" in connection with "Random answer"
119
+ * Bugfix: Database in connection with UTF-8
120
+ * Bugfix in cloze
121
+ * Bugfix in the backend
wp-pro-quiz.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: WP-Pro-Quiz
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-pro-quiz
5
  Description: A powerful and beautiful quiz plugin for WordPress.
6
- Version: 0.9
7
  Author: Julius Fischer
8
  Author URI: http://www.it-gecko.de
9
  */
10
 
11
- define('WPPROQUIZ_VERSION', '0.9');
12
 
13
  include_once 'lib/controller/WpProQuiz_Controller_Admin.php';
14
  include_once 'lib/helper/WpProQuiz_Helper_DbUpgrade.php';
3
  Plugin Name: WP-Pro-Quiz
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-pro-quiz
5
  Description: A powerful and beautiful quiz plugin for WordPress.
6
+ Version: 0.10
7
  Author: Julius Fischer
8
  Author URI: http://www.it-gecko.de
9
  */
10
 
11
+ define('WPPROQUIZ_VERSION', '0.10');
12
 
13
  include_once 'lib/controller/WpProQuiz_Controller_Admin.php';
14
  include_once 'lib/helper/WpProQuiz_Helper_DbUpgrade.php';