Commit d083c3b3 authored by Thomas Flemmer's avatar Thomas Flemmer

add messagebox, add button, add view

parent 515d1933
TDB
\ No newline at end of file
......@@ -221,6 +221,9 @@ Ext.application({
console.debug("Application: afterLogin");
this.socket.connect();
/*call FN for MessageofTheday */
ARSnova.app.getController('Application').showMessageOfTheDay();
/* show diagnosis tab panel */
mainTabPanel.diagnosisPanel.tab.show();
......
......@@ -467,5 +467,16 @@ Ext.define("ARSnova.controller.Application", {
});
messageBox.setMessage(window.location + 'id/​' + sessionStorage.getItem('keyword'));
},
showMessageOfTheDay: function(){
var title = 'Message of the Day';
localStorage.setItem('MotD_title', 'Diese Seite verwendet Cookies');
var message = localStorage.getItem('MotD_title');
Ext.Msg.alert(title, message, Ext.emptyFn);
}
});
......@@ -148,7 +148,7 @@ Ext.define("ARSnova.controller.Auth", {
}
},
changeRole: function (role) {
changeRole: function (role, callback) {
console.debug("Controller: Auth.changeRole", role);
var mainTabPanel = ARSnova.app.mainTabPanel.tabPanel;
var hTP = mainTabPanel.homeTabPanel;
......@@ -158,19 +158,21 @@ Ext.define("ARSnova.controller.Auth", {
role === ARSnova.app.USER_ROLE_SPEAKER ?
role : ARSnova.app.userRole;
var animation = {
type: 'flip',
direction: role ? 'right' : left,
listeners: !callback ? {} : {
animationend: callback
}
};
switch (ARSnova.app.userRole) {
case ARSnova.app.USER_ROLE_STUDENT:
hTP.homePanel.checkLogin();
hTP.animateActiveItem(hTP.homePanel, {
type: 'flip',
direction: 'left'
});
hTP.animateActiveItem(hTP.homePanel, animation);
break;
case ARSnova.app.USER_ROLE_SPEAKER:
hTP.animateActiveItem(hTP.mySessionsPanel, {
type: 'flip',
direction: 'right'
});
hTP.animateActiveItem(hTP.mySessionsPanel, animation);
break;
}
......@@ -271,5 +273,19 @@ Ext.define("ARSnova.controller.Auth", {
/* desktop */
window.location = location;
}
},
MessageOfTheDay: function (role, callback) {
console.log("Controller: Auth.MessageOfTheDay");
var mainTabPanel = ARSnova.app.mainTabPanel.tabPanel;
var hTP = mainTabPanel.homeTabPanel;
ARSnova.app.userRole =
role === ARSnova.app.USER_ROLE_STUDENT ||
role === ARSnova.app.USER_ROLE_SPEAKER ?
role : ARSnova.app.userRole;
ARSnova.app.getController('Authentication').showMessageOfTheDay();
}
});
......@@ -92,6 +92,12 @@
ON_THIS_DEVICE: "auf diesem Gerät",
DEMO_SESSION: "Demo-Session: ",
/* MESSAGE OF THE DAY */
MESSAGEOFTHEDAY: "Message of the Day",
MESSAGEOFTHEDAY_BUTTON: "MotD_DE",
CREATE_NEW_MOTD: "Neue Message anlegen",
MY_MESSAGES: "Alle Nachrichten:",
/* LOAD MASK */
LOAD_MASK: "Lade Daten...",
LOAD_MASK_LOGIN: "Login...",
......@@ -248,7 +254,7 @@
ONE_NEW_LECTURE_QUESTION: 'Es gibt eine neue Hörsaalfrage.',
ONE_NEW_PREPARATION_QUESTION: 'Es gibt eine neue Vorbereitungsaufgabe.',
SEVERAL_NEW_LECTURE_QUESTIONS: 'Es gibt ### neue Hörsaalfragen.',
SEVERAL_PREPARATION_QUESTIONS: 'Es gibt ### neue Vorbereitungsaufgaben.',
SEVERAL_NEW_PREPARATION_QUESTIONS: 'Es gibt ### neue Vorbereitungsaufgaben.',
WANNA_ANSWER: 'Möchten Sie jetzt antworten?',
THERE_ARE: "Es gibt",
NEW_QUESTIONS: "neue Fragen.",
......@@ -659,6 +665,12 @@
ON_THIS_DEVICE: "and on this device",
DEMO_SESSION: "Demo session: ",
/* MESSAGE OF THE DAY */
MESSAGEOFTHEDAY: "Message of the Day",
MESSAGEOFTHEDAY_BUTTON: "MotD_EN",
CREATE_NEW_MOTD: "Create New Message",
MY_MESSAGES: "All Messages:",
/* LOAD MASK */
LOAD_MASK: "Loading...",
LOAD_MASK_LOGIN: "Login...",
......@@ -813,7 +825,7 @@
ONE_NEW_LECTURE_QUESTION: 'There is one new lecture question.',
ONE_NEW_PREPARATION_QUESTION: 'There is one new preparation task.',
SEVERAL_NEW_LECTURE_QUESTIONS: 'There are ### new lecture questions.',
SEVERAL_PREPARATION_QUESTIONS: 'There are ### new preparation tasks.',
SEVERAL_NEW_PREPARATION_QUESTIONS: 'There are ### new preparation tasks.',
WANNA_ANSWER: 'Would you like to answer now?',
THERE_ARE: "There are",
NEW_QUESTIONS: "new questions.",
......
......@@ -85,7 +85,7 @@ Ext.define('ARSnova.view.TabPanel', {
this.infoTabPanel,
this.blogTabPanel,
this.privacyTabPanel,
this.imprintTabPanel
this.imprintTabPanel,
]);
this.on('activeitemchange', function (panel, newCard, oldCard) {
......
......@@ -67,9 +67,13 @@ Ext.define('ARSnova.view.home.HomePanel', {
text: Messages.CHANGE_ROLE,
align: 'right',
ui: 'confirm',
handler: function () {
scope: this,
handler: function (button) {
button.disable();
ARSnova.app.getController('Auth').changeRole(
ARSnova.app.USER_ROLE_SPEAKER
ARSnova.app.USER_ROLE_SPEAKER, function () {
button.enable();
}
);
}
});
......@@ -231,29 +235,7 @@ Ext.define('ARSnova.view.home.HomePanel', {
this.add(this.matrixButtonPanel);
}
this.onBefore('painted', function () {
var me = this;
if (ARSnova.app.userRole !== ARSnova.app.USER_ROLE_SPEAKER) {
var handler = function success(sessions) {
me.caption.summarize(sessions, {
questions: true,
unanswered: false,
unredInterposed: false,
interposed: true,
answers: true
});
me.add(me.caption);
};
var p1 = this.loadVisitedSessions();
var p2 = this.loadMySessions();
// get the summary of all session lists
RSVP.all([p1, p2]).then(handler, function error() {
// errors swallow results, retest each promise seperately to figure out if one succeeded
p1.then(handler);
p2.then(handler);
});
}
});
this.on('activate', this.onActivate);
this.on('resize', function () {
this.resizeSessionButtons();
......@@ -261,6 +243,30 @@ Ext.define('ARSnova.view.home.HomePanel', {
});
},
onActivate: function () {
var me = this;
if (ARSnova.app.userRole !== ARSnova.app.USER_ROLE_SPEAKER) {
var handler = function success(sessions) {
me.caption.summarize(sessions, {
questions: true,
unanswered: false,
unredInterposed: false,
interposed: true,
answers: true
});
me.add(me.caption);
};
var p1 = this.loadVisitedSessions();
var p2 = this.loadMySessions();
// get the summary of all session lists
RSVP.all([p1, p2]).then(handler, function error() {
// errors swallow results, retest each promise seperately to figure out if one succeeded
p1.then(handler);
p2.then(handler);
});
}
},
checkLogin: function () {
if (ARSnova.app.loginMode === ARSnova.app.LOGIN_THM) {
this.logoutButton.addCls('thm');
......
This diff is collapsed.
......@@ -84,13 +84,29 @@ Ext.define('ARSnova.view.home.MySessionsPanel', {
text: Messages.CHANGE_ROLE,
align: 'right',
ui: 'confirm',
handler: function () {
handler: function (button) {
button.disable();
ARSnova.app.getController('Auth').changeRole(
ARSnova.app.USER_ROLE_STUDENT
ARSnova.app.USER_ROLE_STUDENT, function () {
button.enable();
}
);
}
});
this.motdButton = Ext.create('Ext.Button', {
text: Messages.MESSAGEOFTHEDAY_BUTTON,
align: 'right',
ui: 'confirm',
scope: this,
//ARSnova.app.getController('Application').showMessageOfTheDay();
handler: function () {
var hTP = ARSnova.app.mainTabPanel.tabPanel.homeTabPanel;
hTP.animateActiveItem(hTP.motdPanel, 'slide');
}
});
this.toolbar = Ext.create('Ext.TitleBar', {
title: Messages.SESSIONS,
cls: 'speakerTitleText',
......@@ -100,7 +116,9 @@ Ext.define('ARSnova.view.home.MySessionsPanel', {
this.backButton,
this.logoutButton,
this.roleIcon,
this.motdButton,
this.changeRoleButton
]
});
......@@ -353,47 +371,41 @@ Ext.define('ARSnova.view.home.MySessionsPanel', {
this.lastVisitedSessionsForm
]);
this.onBefore('painted', function () {
var me = this;
if (ARSnova.app.userRole === ARSnova.app.USER_ROLE_SPEAKER) {
var handler = function success(sessions) {
me.caption.summarize(sessions, {
unredInterposed: false
});
me.add(me.caption);
};
var p1 = this.loadCreatedSessions();
var p2 = this.loadVisitedSessions();
var p3 = this.loadCreatedPublicPoolSessions();
// get the summary of all session lists
RSVP.all([p1, p2, p3]).then(handler, function error() {
// errors swallow results, retest each promise seperately to figure out if one succeeded
p1.then(handler);
p2.then(handler);
p3.then(handler);
});
}
this.on('activate', this.onActivate);
this.on('resize', function () {
this.resizeMySessionsButtons();
this.resizeLastVisitedSessionButtons();
});
},
this.on('activate', function () {
switch (ARSnova.app.userRole) {
case ARSnova.app.USER_ROLE_SPEAKER:
this.backButton.hide();
this.logoutButton.show();
break;
default:
break;
}
onActivate: function () {
var me = this;
if (ARSnova.app.userRole === ARSnova.app.USER_ROLE_SPEAKER) {
this.backButton.hide();
this.logoutButton.show();
if (ARSnova.app.loginMode === ARSnova.app.LOGIN_THM) {
this.logoutButton.addCls('thm');
}
});
this.on('resize', function () {
this.resizeMySessionsButtons();
this.resizeLastVisitedSessionButtons();
});
var handler = function success(sessions) {
me.caption.summarize(sessions, {
unredInterposed: false
});
me.add(me.caption);
};
var p1 = this.loadCreatedSessions();
var p2 = this.loadVisitedSessions();
var p3 = this.loadCreatedPublicPoolSessions();
// get the summary of all session lists
RSVP.all([p1, p2, p3]).then(handler, function error() {
// errors swallow results, retest each promise seperately to figure out if one succeeded
p1.then(handler);
p2.then(handler);
p3.then(handler);
});
}
},
resizeMySessionsButtons: function () {
......
......@@ -23,7 +23,8 @@ Ext.define('ARSnova.view.home.TabPanel', {
requires: [
'ARSnova.view.home.HomePanel',
'ARSnova.view.home.MySessionsPanel',
'ARSnova.view.home.NewSessionPanel'
'ARSnova.view.home.NewSessionPanel',
'ARSnova.view.home.motdPanel',
],
config: {
......@@ -39,11 +40,13 @@ Ext.define('ARSnova.view.home.TabPanel', {
this.homePanel = Ext.create('ARSnova.view.home.HomePanel');
this.mySessionsPanel = Ext.create('ARSnova.view.home.MySessionsPanel');
this.newSessionPanel = Ext.create('ARSnova.view.home.NewSessionPanel');
this.motdPanel = Ext.create('ARSnova.view.home.motdPanel');
this.add([
this.homePanel,
this.mySessionsPanel,
this.newSessionPanel
this.newSessionPanel,
this.motdPanel,
]);
}
});
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