diff --git a/src/main/webapp/app/controller/Feature.js b/src/main/webapp/app/controller/Feature.js index a6713b1ce18183329e507d41aaabb162b2c319e9..c9f4421274c425e742730fd94e1c43e98785de9b 100644 --- a/src/main/webapp/app/controller/Feature.js +++ b/src/main/webapp/app/controller/Feature.js @@ -377,7 +377,7 @@ Ext.define("ARSnova.controller.Feature", { * apply changes affecting combined feature activation/deactivation */ applyAdditionalChanges: function (features) { - var hasQuestionFeatures = features.lecture || features.jitt || features.slides; + var hasQuestionFeatures = features.lecture || features.jitt || features.slides || features.flashcardFeature; var feedbackWithoutInterposed = features.feedback && !features.interposed; var isSpeaker = ARSnova.app.userRole === ARSnova.app.USER_ROLE_SPEAKER; var loneActiveFeature = this.getLoneActiveFeatureKey(features); @@ -423,6 +423,10 @@ Ext.define("ARSnova.controller.Feature", { tP.userQuestionsPanel.setPreparationMode(); tabPanel.inClassPanel.updateQuestionsPanelBadge(); tP.userQuestionsPanel.tab.setTitle(Messages.TASKS); + } else if (features.flashcardFeature && !features.lecture) { + tP.userQuestionsPanel.setFlashcardMode(); + tabPanel.inClassPanel.updateQuestionsPanelBadge(); + tP.userQuestionsPanel.tab.setTitle(Messages.FLASHCARDS); } else { tP.userQuestionsPanel.setLectureMode(); tabPanel.inClassPanel.updateQuestionsPanelBadge(); @@ -505,6 +509,7 @@ Ext.define("ARSnova.controller.Feature", { switch (featureKey) { case 'jitt': case 'lecture': + case 'flashcardFeature': case 'slides': if (tP.getActiveItem() === tP.userQuestionsPanel) { tP.userQuestionsPanel.removeAll(); diff --git a/src/main/webapp/app/controller/FlashcardQuestions.js b/src/main/webapp/app/controller/FlashcardQuestions.js index 658561766787eca2809dd679e868434f9f1e1d76..4777bcfe3f50aa87e5cb5b90d19cbdd47ed440f0 100644 --- a/src/main/webapp/app/controller/FlashcardQuestions.js +++ b/src/main/webapp/app/controller/FlashcardQuestions.js @@ -55,5 +55,41 @@ Ext.define("ARSnova.controller.FlashcardQuestions", { getQuestions: function () { ARSnova.app.questionModel.getFlashcards.apply(ARSnova.app.questionModel, arguments); + }, + + adHoc: function () { + var sTP = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel; + sTP.sortQuestionsPanel.setController(this); + sTP.audienceQuestionPanel.setController(this); + sTP.showcaseQuestionPanel.setController(this); + sTP.newQuestionPanel.setVariant('flashcard'); + sTP.animateActiveItem(sTP.newQuestionPanel, { + type: 'slide', + duration: 700 + }); + + /* change the backButton-redirection to inClassPanel, + * but only for one function call */ + var backButton = sTP.newQuestionPanel.down('button[ui=back]'); + backButton.setHandler(function () { + var sTP = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel; + sTP.animateActiveItem(sTP.inClassPanel, { + type: 'slide', + direction: 'right', + duration: 700 + }); + }); + backButton.setText(Messages.SESSION); + sTP.newQuestionPanel.on('deactivate', function (panel) { + panel.backButton.handler = function () { + var sTP = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel; + sTP.animateActiveItem(sTP.audienceQuestionPanel, { + type: 'slide', + direction: 'right', + duration: 700 + }); + }; + panel.backButton.setText(Messages.TASKS); + }, this, {single: true}); } }); diff --git a/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js b/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js index 8f9f8e126b79a4df7b298711bbe951a1869161f3..1ada2426e8070bf719f3152299d921d57a868640 100644 --- a/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js +++ b/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js @@ -715,8 +715,9 @@ Ext.define('ARSnova.view.speaker.AudienceQuestionPanel', { lectureButtonText = Messages.NEW_CONTENT; this.questionStatusButton.setKeynoteWording(); - this.voteStatusButton.setKeynoteWording(); this.newQuestionButton.element.down('.iconBtnImg').replaceCls('icon-question', 'icon-pencil'); + this.voteStatusButton.setKeynoteWording(); + this.voteStatusButton.show(); captionTranslation = { active: Messages.OPEN_CONTENT, @@ -732,8 +733,9 @@ Ext.define('ARSnova.view.speaker.AudienceQuestionPanel', { }; } else { this.questionStatusButton.setDefaultWording(); - this.voteStatusButton.setDefaultWording(); this.newQuestionButton.element.down('.iconBtnImg').replaceCls('icon-pencil', 'icon-question'); + this.voteStatusButton.setDefaultWording(); + this.voteStatusButton.show(); } if (this.getVariant() === 'flashcard') { @@ -745,8 +747,10 @@ Ext.define('ARSnova.view.speaker.AudienceQuestionPanel', { deleteAnswersText = Messages.DELETE_FLASHCARD_VIEWS; deleteQuestionsText = Messages.DELETE_ALL_FLASHCARDS; this.flashcardImportButton.show(); + this.voteStatusButton.hide(); this.questionStatusButton.setFlashcardsWording(); + this.newQuestionButton.element.down('.iconBtnImg').replaceCls('icon-question', 'icon-pencil'); captionTranslation = { active: Messages.OPEN_CONTENT, diff --git a/src/main/webapp/app/view/speaker/InClass.js b/src/main/webapp/app/view/speaker/InClass.js index 83b887ea8960d3f06c978ac9a032a2ca8f0dcbc9..a311ead781d85f0b074ec9115033fe90b826e33f 100644 --- a/src/main/webapp/app/view/speaker/InClass.js +++ b/src/main/webapp/app/view/speaker/InClass.js @@ -123,9 +123,17 @@ Ext.define('ARSnova.view.speaker.InClass', { scope: this, handler: function () { var button = this.createAdHocQuestionButton; - button.config.controller = button.config.mode === 'preparation' ? - 'PreparationQuestions' : 'Questions'; + switch (button.config.mode) { + case 'preparation': + button.config.controller = 'PreparationQuestions'; + break; + case 'flashcard': + button.config.controller = 'FlashcardQuestions'; + break; + default: + button.config.controller = 'Questions'; + } this.buttonClicked(button); } }); @@ -339,6 +347,7 @@ Ext.define('ARSnova.view.speaker.InClass', { changeActionButtonsMode: function (features) { features = features || ARSnova.app.getController('Feature').getActiveFeatures(); var sTP = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel; + this.createAdHocQuestionButton.setImageCls(this.createAdHocQuestionButton.config.imageCls); if (features.liveClicker) { this.showcaseActionButton.setHandler(this.showcaseLiveQuestionHandler); @@ -349,14 +358,18 @@ Ext.define('ARSnova.view.speaker.InClass', { this.showcaseActionButton.setButtonText(this.showcaseActionButton.config.altText); this.createAdHocQuestionButton.setButtonText(this.createAdHocQuestionButton.config.altText); this.showcaseActionButton.setHandler(this.showcaseHandler); + } else if (features.flashcard) { + sTP.showcaseQuestionPanel.setFlashcardMode(); + this.createAdHocQuestionButton.config.mode = 'flashcard'; + this.showcaseActionButton.setHandler(this.showcaseHandler); + this.createAdHocQuestionButton.setButtonText(Messages.NEW_FLASHCARD); + this.createAdHocQuestionButton.setImageCls('icon-newsession'); } else { sTP.showcaseQuestionPanel.setLectureMode(); this.createAdHocQuestionButton.config.mode = 'lecture'; this.showcaseActionButton.setButtonText(this.showcaseActionButton.config.text); this.showcaseActionButton.setHandler(this.showcaseHandler); - this.createAdHocQuestionButton.setButtonText( - features.flashcard ? Messages.NEW_FLASHCARD : this.createAdHocQuestionButton.config.text - ); + this.createAdHocQuestionButton.setButtonText(this.createAdHocQuestionButton.config.text); } if (features.slides) { this.showcaseActionButton.setButtonText(Messages.SHOWCASE_KEYNOTE); @@ -367,7 +380,7 @@ Ext.define('ARSnova.view.speaker.InClass', { updateActionButtonElements: function (showElements) { var me = this; var features = ARSnova.app.getController('Feature').getActiveFeatures(); - var hasQuestionFeature = features.lecture || features.jitt; + var hasQuestionFeature = features.lecture || features.jitt || features.flashcardFeature; if (features.liveClicker) { showElements = true; @@ -630,15 +643,20 @@ Ext.define('ARSnova.view.speaker.InClass', { applyUIChanges: function (features) { var lectureButtonText = Messages.LECTURE_QUESTIONS_LONG; + var adHocIconEl = this.createAdHocQuestionButton.element.down('.iconBtnImg'); this.courseLearningProgressButton.setText( features.peerGrading ? Messages.EVALUATION_ALT : Messages.COURSES_LEARNING_PROGRESS ); + if (features.total || features.slides || features.flashcard) { + adHocIconEl.replaceCls('icon-question', 'icon-pencil'); + } else { + adHocIconEl.replaceCls('icon-pencil', 'icon-question'); + } + if (features.total || features.slides) { lectureButtonText = Messages.SLIDE_LONG; - - this.createAdHocQuestionButton.element.down('.iconBtnImg').replaceCls('icon-question', 'icon-pencil'); this.caption.setBadgeTranslation({ feedback: Messages.QUESTIONS_FROM_STUDENTS, unredFeedback: Messages.UNREAD_QUESTIONS_FROM_STUDENTS, @@ -647,7 +665,6 @@ Ext.define('ARSnova.view.speaker.InClass', { }); } else { this.caption.setBadgeTranslation(this.caption.config.badgeTranslation); - this.createAdHocQuestionButton.element.down('.iconBtnImg').replaceCls('icon-pencil', 'icon-question'); } if (features.peerGrading) {