Commit e6fcb9d9 authored by Andreas Gärtner's avatar Andreas Gärtner
Browse files

Merge remote-tracking branch 'origin/master' into peerinstruction

parents 91845305 5b6a330f
/*
* This file is part of ARSnova Mobile.
* Copyright (C) 2011-2012 Christian Thomas Weber
* Copyright (C) 2012-2015 The ARSnova Team
*
* ARSnova Mobile 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.
*
* ARSnova Mobile 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 ARSnova Mobile. If not, see <http://www.gnu.org/licenses/>.
*/
(function () {
/* jscs:disable validateIndentation */
"use strict";
// by http://www.quirksmode.org/js/detect.html
Ext.define('ARSnova.BrowserDetect', {
/* jscs:enable */
/* jscs:enable */
constructor: function () {
var browser = this.searchString(this.dataBrowser) || "An unknown browser",
userAgentVersion = this.searchVersion(navigator.userAgent),
......@@ -113,7 +131,8 @@ Ext.define('ARSnova.BrowserDetect', {
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}],
}
],
dataOS: [{
string: navigator.platform,
......@@ -131,6 +150,7 @@ Ext.define('ARSnova.BrowserDetect', {
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}]
}
]
});
}());
/*
* This file is part of ARSnova Mobile.
* Copyright (C) 2011-2012 Christian Thomas Weber
* Copyright (C) 2012-2015 The ARSnova Team
*
* ARSnova Mobile 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.
*
* ARSnova Mobile 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 ARSnova Mobile. If not, see <http://www.gnu.org/licenses/>.
*/
(function () {
/* jscs:disable validateIndentation */
"use strict";
Ext.define('ARSnova.BrowserSupport', {
/* jscs:enable */
/* jscs:enable */
extend: 'Ext.Base',
requires: ['ARSnova.BrowserDetect'],
......
......@@ -28,6 +28,8 @@ Ext.define("ARSnova.controller.PreparationQuestions", {
listQuestions: function () {
var sTP = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel;
sTP.newQuestionPanel.setVariant('preparation');
sTP.sortQuestionsPanel.setController(this);
sTP.sortSubjectsPanel.setController(this);
sTP.audienceQuestionPanel.setController(this);
sTP.showcaseQuestionPanel.setController(this);
sTP.showcaseQuestionPanel.setPreparationMode();
......@@ -50,5 +52,25 @@ Ext.define("ARSnova.controller.PreparationQuestions", {
getQuestions: function () {
var question = Ext.create('ARSnova.model.Question');
question.getPreparationQuestions.apply(question, arguments);
},
getSubjectSort: function (options) {
ARSnova.app.questionModel.getSubjectPreparationSort(sessionStorage.getItem('keyword'),
options.callbacks);
},
setSubjectSort: function (options) {
ARSnova.app.questionModel.setSubjectPreparationSort(sessionStorage.getItem('keyword'),
options.sortType, options.subjects, options.callbacks);
},
getQuestionSort: function (options) {
ARSnova.app.questionModel.getQuestionPreparationSort(sessionStorage.getItem('keyword'),
options.subject, options.callbacks);
},
setQuestionSort: function (options) {
ARSnova.app.questionModel.setQuestionPreparationSort(sessionStorage.getItem('keyword'),
options.subject, options.sortType, options.questionIDs, options.callbacks);
}
});
......@@ -63,6 +63,8 @@ Ext.define("ARSnova.controller.Questions", {
listQuestions: function () {
var sTP = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel;
sTP.newQuestionPanel.setVariant('lecture');
sTP.sortQuestionsPanel.setController(this);
sTP.sortSubjectsPanel.setController(this);
sTP.audienceQuestionPanel.setController(this);
sTP.showcaseQuestionPanel.setController(this);
sTP.showcaseQuestionPanel.setLectureMode();
......@@ -371,6 +373,7 @@ Ext.define("ARSnova.controller.Questions", {
adHoc: function () {
var sTP = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel;
sTP.sortQuestionsPanel.setController(this);
sTP.audienceQuestionPanel.setController(this);
sTP.showcaseQuestionPanel.setController(this);
sTP.newQuestionPanel.setVariant('lecture');
......@@ -425,5 +428,25 @@ Ext.define("ARSnova.controller.Questions", {
type: 'slide',
direction: 'right'
});
},
getSubjectSort: function (options) {
ARSnova.app.questionModel.getSubjectLectureSort(sessionStorage.getItem('keyword'),
options.callbacks);
},
setSubjectSort: function (options) {
ARSnova.app.questionModel.setSubjectLectureSort(sessionStorage.getItem('keyword'),
options.sortType, options.subjects, options.callbacks);
},
getQuestionSort: function (options) {
ARSnova.app.questionModel.getQuestionLectureSort(sessionStorage.getItem('keyword'),
options.subject, options.callbacks);
},
setQuestionSort: function (options) {
ARSnova.app.questionModel.setQuestionLectureSort(sessionStorage.getItem('keyword'),
options.subject, options.sortType, options.questionIDs, options.callbacks);
}
});
......@@ -211,6 +211,19 @@
NO_ANSWER_MARKED_CORRECT_OPTION_YES: "Trotzdem speichern",
NO_ANSWER_MARKED_CORRECT_OPTION_NO: "Abbrechen",
/* sort */
SORT_QUESTIONS_TITLE: "Fragen sortieren",
SORT_CATEGORIES_TITLE: "Kategorien suchen",
SORT_CATEGORIES: "Kategorien",
SORT_SAVED: "Sortierung wurde gespeichert.",
SORT_SAVE_AND_CONTINUE: "Speichern und fortfahren",
SORT_TRANSMISSION_ERROR: "Das Sortieren war leider nicht erfolgreich.",
SORT_QUESTIONS: "Fragen<br/>sortieren",
SORT_ALPHABET: "Alphabet<br/>Sortierung",
SORT_TIME: "Zeitliche<br/>Sortierung",
SORT_RANDOM: "Zufällig<br/>anordnen",
SORT_REVERT: "Änderung<br/>verwerfen",
/* user */
QUESTIONS_TO_STUDENTS: "Fragen ans Publikum",
QUESTIONS_FROM_STUDENTS: "Fragen der Studierenden",
......@@ -710,6 +723,19 @@
NO_ANSWER_MARKED_CORRECT_OPTION_YES: "Save anyway",
NO_ANSWER_MARKED_CORRECT_OPTION_NO: "Abort",
/* sort */
SORT_QUESTIONS_TITLE: "Sort Questions",
SORT_CATEGORIES_TITLE: "Sort Categories",
SORT_CATEGORIES: "Categories",
SORT_SAVED: "Your sort order has been saved.",
SORT_SAVE_AND_CONTINUE: "Save and continue",
SORT_TRANSMISSION_ERROR: "Sort failed.",
SORT_QUESTIONS: "Sort<br/>questions",
SORT_ALPHABET: "Alphabetic<br/>sort",
SORT_TIME: "Time<br/>sort",
SORT_RANDOM: "Random<br/>sort",
SORT_REVERT: "Revert<br/>changes",
/* user */
QUESTIONS_TO_STUDENTS: "Teacher's questions",
QUESTIONS_FROM_STUDENTS: "Student questions",
......
......@@ -21,76 +21,76 @@ Ext.define('ARSnova.model.PublicPool', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'name'
},
{
name: 'hs'
},
{
name: 'logo'
},
{
name: 'subject'
},
{
name: 'licence'
},
{
name: 'email'
},
{
name: 'sessionName'
},
{
name: 'sessionShortName'
},
{
name: 'description'
},
{
name: 'faculty'
},
{
name: 'level'
}
],
validations: [
{
type: 'presence',
field: 'name',
message: Messages.EXPORT_FIELD_NAME + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_NAME
},
{
type: 'presence',
field: 'hs',
message: Messages.EXPORT_FIELD_UNI + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_UNIVERSITY
},
{
type: 'presence',
field: 'subject',
message: Messages.EXPORT_FIELD_SUBJECT + ':\t ' + Messages.SESSIONPOOL_NOTIFICATION_SUBJECT
},
{
type: 'presence',
field: 'licence',
message: Messages.EXPORT_FIELD_LICENCE + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_LICENCE
},
{
type: 'email',
field: 'email',
message: Messages.EXPORT_FIELD_EMAIL + ': ' + Messages.SESSIONPOOL_NOTIFICATION_EMAIL
},
{
type: 'presence',
field: 'sessionName',
message: Messages.SESSION_NAME + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_SESSION_NAME
},
{
type: 'presence',
field: 'sessionShortName',
message: Messages.SESSION_SHORT_NAME + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_SESSION_SHORTNAME
}
{
name: 'name'
},
{
name: 'hs'
},
{
name: 'logo'
},
{
name: 'subject'
},
{
name: 'licence'
},
{
name: 'email'
},
{
name: 'sessionName'
},
{
name: 'sessionShortName'
},
{
name: 'description'
},
{
name: 'faculty'
},
{
name: 'level'
}
],
validations: [
{
type: 'presence',
field: 'name',
message: Messages.EXPORT_FIELD_NAME + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_NAME
},
{
type: 'presence',
field: 'hs',
message: Messages.EXPORT_FIELD_UNI + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_UNIVERSITY
},
{
type: 'presence',
field: 'subject',
message: Messages.EXPORT_FIELD_SUBJECT + ':\t ' + Messages.SESSIONPOOL_NOTIFICATION_SUBJECT
},
{
type: 'presence',
field: 'licence',
message: Messages.EXPORT_FIELD_LICENCE + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_LICENCE
},
{
type: 'email',
field: 'email',
message: Messages.EXPORT_FIELD_EMAIL + ': ' + Messages.SESSIONPOOL_NOTIFICATION_EMAIL
},
{
type: 'presence',
field: 'sessionName',
message: Messages.SESSION_NAME + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_SESSION_NAME
},
{
type: 'presence',
field: 'sessionShortName',
message: Messages.SESSION_SHORT_NAME + ':\t' + Messages.SESSIONPOOL_NOTIFICATION_SESSION_SHORTNAME
}
]
}
});
......@@ -333,6 +333,38 @@ Ext.define('ARSnova.model.Question', {
return this.getProxy().delAllPreparationAnswers(sessionKeyword, callbacks);
},
getSubjectPreparationSort: function (sessionKeyword, callbacks) {
return this.getProxy().getSubjectSort(sessionKeyword, true, callbacks);
},
setSubjectPreparationSort: function (sessionKeyword, sortType, subjects, callbacks) {
return this.getProxy().setSubjectSort(sessionKeyword, true, sortType, subjects, callbacks);
},
getSubjectLectureSort: function (sessionKeyword, callbacks) {
return this.getProxy().getSubjectSort(sessionKeyword, false, callbacks);
},
setSubjectLectureSort: function (sessionKeyword, sortType, subjects, callbacks) {
return this.getProxy().setSubjectSort(sessionKeyword, false, sortType, subjects, callbacks);
},
getQuestionPreparationSort: function (sessionKeyword, subject, callbacks) {
return this.getProxy().getQuestionSort(sessionKeyword, subject, true, callbacks);
},
setQuestionPreparationSort: function (sessionKeyword, subject, sortType, questionIDs, callbacks) {
return this.getProxy().setQuestionSort(sessionKeyword, subject, true, sortType, questionIDs, callbacks);
},
getQuestionLectureSort: function (sessionKeyword, subject, callbacks) {
return this.getProxy().getQuestionSort(sessionKeyword, subject, false, callbacks);
},
setQuestionLectureSort: function (sessionKeyword, subject, sortType, questionIDs, callbacks) {
return this.getProxy().setQuestionSort(sessionKeyword, subject, false, sortType, questionIDs, callbacks);
},
getImageAnswerImage: function (questionId, answerId, callbacks) {
return this.getProxy().getImageAnswerImage(questionId, answerId, callbacks);
}
......
......@@ -380,7 +380,7 @@ Ext.define('ARSnova.proxy.RestProxy', {
this.arsjax.request({
url: "session/" + sessionKeyword + "/interposed",
method: "POST",
f: {subject: subject, text: text, sessionId: sessionKeyword, timestamp: timestamp},
f: {subject: subject, text: text, sessionId: sessionKeyword, timestamp: timestamp},
success: callbacks.success,
failure: callbacks.failure
});
......@@ -841,6 +841,27 @@ Ext.define('ARSnova.proxy.RestProxy', {
});
},
getSubjectSort: function (sessionKeyword, isPreparation, callbacks) {
this.arsjax.request({
url: "lecturerquestion/subjectsort?sessionkey=" + sessionKeyword +
"&ispreparation=" + encodeURIComponent(isPreparation),
method: "GET",
success: callbacks.success,
failure: callbacks.failure
});
},
setSubjectSort: function (sessionKeyword, isPreparation, sortType, subjects, callbacks) {
this.arsjax.request({
url: "lecturerquestion/subjectsort?sessionkey=" + sessionKeyword +
"&sorttype=" + encodeURIComponent(sortType) +
"&ispreparation=" + encodeURIComponent(isPreparation),
method: "POST",
jsonData: subjects,
success: callbacks.success,
failure: callbacks.failure
});
},
changeFeatures: function (keyword, features, callbacks) {
this.arsjax.request({
url: "session/" + encodeURIComponent(keyword) + "/features",
......@@ -854,6 +875,30 @@ Ext.define('ARSnova.proxy.RestProxy', {
});
},
getQuestionSort: function (sessionKeyword, subject, isPreparation, callbacks) {
this.arsjax.request({
url: "lecturerquestion/questionsort?sessionkey=" + sessionKeyword +
"&subject=" + encodeURIComponent(subject) +
"&ispreparation=" + encodeURIComponent(isPreparation),
method: "GET",
success: callbacks.success,
failure: callbacks.failure
});
},
setQuestionSort: function (sessionKeyword, subject, isPreparation, sortType, questionIDs, callbacks) {
this.arsjax.request({
url: "lecturerquestion/questionsort?sessionkey=" + sessionKeyword +
"&subject=" + encodeURIComponent(subject) +
"&sorttype=" + encodeURIComponent(sortType) +
"&ispreparation=" + encodeURIComponent(isPreparation),
method: "POST",
jsonData: questionIDs,
success: callbacks.success,
failure: callbacks.failure
});
},
getFeatures: function (keyword, callbacks) {
this.arsjax.request({
url: "session/" + encodeURIComponent(keyword) + "/features",
......
......@@ -108,7 +108,8 @@ Ext.define('ARSnova.view.Caption', {
}, {
badgeText: options.answers && hasAnswers ? Messages.ANSWERS : "",
badgeCls: "answersBadgeIcon"
}]);
}
]);
return badges;
},
......
......@@ -138,7 +138,8 @@ Ext.define('ARSnova.view.FreetextDetailAnswer', {
disabledCls: 'disableDefault',
inputCls: 'thm-grey',
disabled: true
}, questionPanel
},
questionPanel
]
},
imgContainer,
......
......@@ -32,7 +32,7 @@ Ext.define('ARSnova.view.ImageAnswerPanel', {
freetextAnswerStore: null
},
//flag for vertical or horizontal list
//flag for vertical or horizontal list
isVertical: false,
constructor: function (args) {
var me = this;
......@@ -98,7 +98,7 @@ Ext.define('ARSnova.view.ImageAnswerPanel', {
text: Messages.IMAGE_QUESTION_HORIZONTAL_VIEW,
cls: 'actionButton',
buttonConfig: 'icon',
imageCls: 'icon-vertical-list thm-grey',
imageCls: 'icon-vertical-list icon-horizontal-list-config thm-grey',
scope: this,
handler: this.horizontalListClicked
});
......@@ -143,25 +143,25 @@ Ext.define('ARSnova.view.ImageAnswerPanel', {
cls: 'dataview-inline gallery-dataview',
itemCls: 'thumbnail-image',
itemCls: 'arsnova-mathdown x-html thumbnail-image',
itemTpl: new Ext.XTemplate(
'<tpl if="this.isVertical() === false">',
'<div class="wrapper">',
'<img src="{answerThumbnailImage}"/>',
'<span>{answerSubject:htmlEncode}</span>',
'<span>{formattedAnswerSubject}</span>', //formatted = markdown-rendered
'</div>',
'</tpl>',
'<tpl if="this.isVertical() === true">',
'<div class="wrapper-list">',
'<img src="{answerThumbnailImage}" class="image-list"/>',
'<span class="answer-subject">{answerSubject:htmlEncode}</span>',
'<span class="answer-text">{answerText:htmlEncode}</span>',
'<span class="answer-subject">{formattedAnswerSubject}</span>',
'<span class="answer-text">{formattedAnswerText}</span>',
'</div>',
'</tpl>',
{
isVertical: function () {
return me.isVertical;
}
isVertical: function () {
return me.isVertical;
}
}
),
inline: true,
......@@ -232,7 +232,9 @@ Ext.define('ARSnova.view.ImageAnswerPanel', {
} else {
me.imageAnswerList.show();
var listItems = responseObj.map(function (item) {
var me = this;
var v = item;
var date = new Date(v.timestamp);
return Ext.apply(item, {
formattedTime: Ext.Date.format(date, "H:i"),
......@@ -249,6 +251,25 @@ Ext.define('ARSnova.view.ImageAnswerPanel', {
me.freetextAnswerStore.removeAll();
me.freetextAnswerStore.add(answers);
me.freetextAnswerStore.each(function (entry) {
//create an markdown-panel for rendering the answers.
var md = Ext.create('ARSnova.view.MathJaxMarkDownPanel');
md.setContent(entry.get('answerSubject'), true, true, function (html) {
//delete all <p>-tags in the subject so span's aren't overwritten
var plane = html.getHtml().replace(/<\/?[pP]>/g, "");
entry.set('formattedAnswerSubject', plane);
md.destroy();
});
md = Ext.create('ARSnova.view.MathJaxMarkDownPanel');
md.setContent(entry.get('answerText'), true, true, function (html) {
entry.set('formattedAnswerText', html.getHtml());
md.destroy();
});
});
me.freetextAnswerStore.sort([{
property: 'timestamp',
direction: 'DESC'
......
......@@ -51,11 +51,9 @@ Ext.define('ARSnova.view.components.GridImageContainer', {
*/
markChosenFields: function () {
var thiz = this;
this.getChosenFields().forEach(
function (entry) {
thiz.markField(entry[0],
entry[1], thiz.getHighlightColor(), 0.5);
});
this.getChosenFields().forEach(function (entry) {
thiz.markField(entry[0], entry[1], thiz.getHighlightColor(), 0.5);
});
},
/**
......@@ -207,8 +205,8 @@ Ext.define('ARSnova.view.components.GridImageContainer', {
for (var i = 0; i < this.getGridSizeX(); i++) {
for (var j = 0; j < this.getGridSizeY(); j++) {
obj = {
text: i + ";" + j,
correct: false
text: i + ";" + j,
correct: false
};
// use chosenFields as right answers
for (var k = 0; k < this.getChosenFields().length; k++) {
......
......@@ -200,8 +200,8 @@ Ext.define('ARSnova.view.components.GridModerationContainer', {
for (var i = 0; i < this.getGridSizeX(); i++) {
for (var j = 0; j < this.getGridSizeY(); j++) {
obj = {
text: i + ";" + j,
correct: false
text: i + ";" + j,
correct: false
};
// do not use chosenFields as right answers
values.push(obj);
......