Commit 9a73625e authored by Saskia Schreiber's avatar Saskia Schreiber

[FEATURE] Send textChecker values to backend

parent c634805c
......@@ -122,9 +122,13 @@ Ext.define("ARSnova.controller.Questions", {
possibleAnswers: options.possibleAnswers,
noCorrect: options.noCorrect,
abstention: options.abstention,
ignoreCaseSensitive: options.ignoreCaseSensitive,
ignoreWhitespaces: options.ignoreWhitespaces,
ignorePunctuation: options.ignorePunctuation,
fixedAnswer: options.scrictAnswer,
strictMode: options.strictMode,
rating: options.rating,
correctAnswer: options.correctAnswer,
ignoreCaseSensitive: options.ignoreCaseSensitive,
ignoreWhitespaces: options.ignoreWhitespaces,
ignorePunctuation: options.ignorePunctuation,
gridSize: options.gridSize,
offsetX: options.offsetX,
offsetY: options.offsetY,
......
......@@ -33,9 +33,6 @@ Ext.define('ARSnova.model.Answer', {
'questionId',
'sessionId',
'abstention',
'ignoreCaseSensitive',
'ignoreWhitespaces',
'ignorePunctuation',
'timestamp',
'questionVariant',
'questionValue',
......
......@@ -58,9 +58,13 @@ Ext.define('ARSnova.model.Question', {
'offsetY',
'zoomLvl',
'image',
'ignoreCaseSensitive',
'ignoreWhitespaces',
'ignorePunctuation',
'fixedAnswer',
'strictMode',
'rating',
'correctAnswer',
'ignoreCaseSensitive',
'ignoreWhitespaces',
'ignorePunctuation',
'fcImage',
'gridOffsetX',
'gridOffsetY',
......
......@@ -576,6 +576,10 @@ Ext.define('ARSnova.view.speaker.NewQuestionPanel', {
releasedFor: values.releasedFor,
noCorrect: values.noCorrect,
abstention: values.abstention,
fixedAnswer: values.fixedAnswer,
strictMode: values.strictMode,
rating: values.rating,
correctAnswer: values.correctAnswer,
ignoreCaseSensitive: values.ignoreCaseSensitive,
ignoreWhitespaces: values.ignoreWhitespaces,
ignorePunctuation: values.ignorePunctuation,
......
......@@ -42,9 +42,6 @@ Ext.define('FreetextAnswer', {
'groupDate',
'questionId',
'abstention',
'ignoreCaseSensitive',
'ignoreWhitespaces',
'ignorePunctuation',
'answerText',
'piRound',
'sessionId',
......@@ -361,16 +358,25 @@ Ext.define('ARSnova.view.speaker.QuestionDetailsPanel', {
question.set("subject", values.subject);
question.set("text", values.questionText);
question.set("abstention", panel.abstentionPart.getAbstention());
question.set("ignoreCaseSensitive", panel.textCheckerPart.getIgnoreCaseSensitive());
question.set("ignoreWhitespaces", panel.textCheckerPart.getIgnoreWhitespaces());
question.set("ignorePunctuation", panel.textCheckerPart.getIgnorePunctuation());
question.set("fixedAnswer", panel.textCheckerPart.getFixedAnswer());
question.set("strictMode", panel.textCheckerPart.getStrictMode());
question.set("rating", panel.textCheckerPart.getRating());
question.set("correctAnswer", panel.textCheckerPart.getCorrectAnswer());
question.set("ignoreCaseSensitive", panel.textCheckerPart.getIgnoreCaseSensitive());
question.set("ignoreWhitespaces", panel.textCheckerPart.getIgnoreWhitespaces());
question.set("ignorePunctuation", panel.textCheckerPart.getIgnorePunctuation());
question.raw.subject = values.subject;
question.raw.text = values.questionText;
question.raw.abstention = panel.abstentionPart.getAbstention();
question.raw.ignoreCaseSensitive = panel.textCheckerPart.getIgnoreCaseSensitive();
question.raw.ignoreWhitespaces = panel.textCheckerPart.getIgnoreWhitespaces();
question.raw.ignorePunctuation = panel.textCheckerPart.getIgnorePunctuation();
question.raw.ignoreCaseSensitive = panel.textCheckerPart.getIgnoreCaseSensitive();
question.raw.ignoreWhitespaces = panel.textCheckerPart.getIgnoreWhitespaces();
question.raw.ignorePunctuation = panel.textCheckerPart.getIgnorePunctuation();
question.raw.fixedAnswer = panel.textCheckerPart.getFixedAnswer();
question.raw.strictMode = panel.textCheckerPart.getStrictMode();
question.raw.rating = panel.textCheckerPart.getRating();
question.raw.correctAnswer = panel.textCheckerPart.getCorrectAnswer();
panel.subject.resetOriginalValue();
......@@ -775,10 +781,14 @@ Ext.define('ARSnova.view.speaker.QuestionDetailsPanel', {
hidden: true
});
this.textCheckerPart = Ext.create('ARSnova.view.speaker.form.textChecker', {
ignoreCaseSensitive: this.questionObj.ignoreCaseSensitive,
ignoreWhitespaces: this.questionObj.ignoreWhitespaces,
ignorePunctuation: this.questionObj.ignorePunctuation,
this.textCheckerPart = Ext.create('ARSnova.view.speaker.form.textChecker', {
fixedAnswer: this.questionObj.fixedAnswer,
strictMode: this.questionObj.strictMode,
rating: this.questionObj.rating,
correctAnswer: this.questionObj.correctAnswer,
ignoreCaseSensitive: this.questionObj.ignoreCaseSensitive,
ignoreWhitespaces: this.questionObj.ignoreWhitespaces,
ignorePunctuation: this.questionObj.ignorePunctuation,
hidden: true
});
......
......@@ -20,7 +20,11 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
extend: 'Ext.form.FormPanel',
config: {
pressed: 'free',
//Switch between free text/checkable answer
fixedAnswer: false,
//When checkable answer, switch strict mode on and off
strictMode: false,
scrollable: null,
ignoreCaseSensitive: false,
ignoreWhitespaces: false,
......@@ -73,25 +77,27 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
});
var freeAnswerButton = Ext.create('Ext.Button', {
this.freeAnswerButton = Ext.create('Ext.Button', {
text: Messages.TEXT_CHECKER_FREETEXT,
handler: function () {
mainFormPanel.hide();
selectField.hide();
ratingField.hide();
strictOptions.hide();
me.setFixedAnswer(false);
},
pressed: this.getPressed() === 'free'
pressed: this.getFixedAnswer() === false
});
var fixAnswerButton = Ext.create('Ext.Button', {
this.fixAnswerButton = Ext.create('Ext.Button', {
text: Messages.TEXT_CHECKER_ADD_SOLUTION,
handler: function () {
mainFormPanel.show();
selectField.show();
ratingField.show();
me.setFixedAnswer(true);
},
pressed: this.getPressed() === 'fix'
pressed: this.getFixedAnswer() === true
});
var answerTypeSegmentedButton = Ext.create('Ext.SegmentedButton', {
......@@ -100,27 +106,29 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
ui: 'action',
style: 'width: 50%'
},
items:[freeAnswerButton, fixAnswerButton]
items:[this.freeAnswerButton, this.fixAnswerButton]
});
var freefixField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.TEXT_CHECKER_TITLE,
items: [answerTypeSegmentedButton]
});
var easyButton = Ext.create('Ext.Button', {
this.easyButton = Ext.create('Ext.Button', {
text: Messages.TEXT_CHECKER_MODE_EASY,
handler: function () {
strictOptions.hide();
me.setStrictMode(false);
},
pressed: true
pressed: this.getStrictMode() === false
});
var strictButton = Ext.create('Ext.Button', {
this.strictButton = Ext.create('Ext.Button', {
text: Messages.TEXT_CHECKER_MODE_STRICT,
handler: function () {
strictOptions.show();
me.setStrictMode(true);
},
pressed: this.getPressed() === 'strict'
pressed: this.getStrictMode() === true
});
var textCheckerModeSegmentedButton = Ext.create('Ext.SegmentedButton', {
......@@ -129,7 +137,7 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
ui: 'action',
style: 'width: 50%'
},
items:[easyButton, strictButton]
items:[this.easyButton, this.strictButton]
});
var selectField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
......@@ -137,7 +145,7 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
items: [textCheckerModeSegmentedButton],
hidden: true
});
var rating = Ext.create("ARSnova.view.CustomSliderField", {
this.rating = Ext.create("ARSnova.view.CustomSliderField", {
minValue: 0,
maxValue: 10,
value: 10,
......@@ -147,13 +155,13 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
var ratingField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.ANSWER_POINTS,
items: [rating],
items: [this.rating],
hidden: true
});
// Eingabefeld
var textarea = Ext.create('Ext.plugins.ResizableTextArea', {
this.textarea = Ext.create('Ext.plugins.ResizableTextArea', {
name: 'text',
placeHolder: Messages.FORMAT_PLACEHOLDER
});
......@@ -171,7 +179,7 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
xtype: 'fieldset',
title: Messages.CORRECT_PLACEHOLDER,
//sizearea has been deprecated by KQC
items: [textarea]
items: [this.textarea]
}],
hidden: true
});
......@@ -187,10 +195,18 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
getValues: function() {
var result = {};
//To be synced with backend
result.fixedAnswer = this.getFixedAnswer();
result.strictMode = this.getStrictMode();
result.correctAnswer = this.textarea.getValue();
result.rating = this.rating.getValue();
result.ignoreCaseSensitive = this.getIgnoreCaseSensitive();
result.ignoreWhitespaces = this.getIgnoreWhitespaces();
result.ignorePunctuation = this.getIgnorePunctuation();
return result;
}
});
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