Commit 84bc2f6a authored by Stefan Schindler's avatar Stefan Schindler

updt

parent da227bbe
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -521,5 +521,8 @@
"@schematics/angular:component": {
"styleext": "scss"
}
},
"cli": {
"analytics": "ad7357c8-2ec0-44a0-b892-f71808373433"
}
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -83,6 +83,7 @@
"bootstrap": "^4.4.1",
"cors": "^2.8.5",
"dexie": "^2.0.4",
"docker-compose": "^0.23.2",
"marked": "^0.8.0",
"messageformat": "^2.3.0",
"ng2-simple-mq": "^8.2.1",
......@@ -91,6 +92,7 @@
"ngx-toastr": "^12.0.0",
"ngx-translate-messageformat-compiler": "^4.5.0",
"node-sass": "^4.13.1",
"pip": "0.0.1",
"prism-themes": "^1.3.0",
"rxjs": "~6.5.4",
"ts-loader": "^6.2.1",
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
import * as bodyParser from "body-parser";
import express from "express";
import path from "path";
import { Observable } from "rxjs";
import * as routes from "./server/routes";
const app = express();
const port = 8080; // default port to listen
// configure bodyParser
app.use(bodyParser.urlencoded({extended: true}));
app.use("/public", express.static(path.join(__dirname, "public")));
// Configure Express to use EJS
app.set( "views", path.join( __dirname, "views" ) );
app.set( "view engine", "ejs" );
// Configure routes
routes.register(app);
// start the express server
app.listen( port, () => {
// tslint:disable-next-line:no-console
console.log( `server started at http://localhost:${ port }` );
} );
<div class="modal-header">
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserTokenComponent } from './user-token.component';
describe('UserTokenComponent', () => {
let component: UserTokenComponent;
let fixture: ComponentFixture<UserTokenComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserTokenComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserTokenComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component} from '@angular/core';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-user-token',
templateUrl: './user-token.component.html',
styleUrls: ['./user-token.component.scss']
})
export class UserTokenComponent {
constructor(private activeModal: NgbActiveModal) { }
public confirm(): void {
this.activeModal.close();
}
public abort(): void {
this.activeModal.dismiss();
}
}
......@@ -144,3 +144,4 @@
</ng-container>
</ng-container>
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, TemplateRef} from '@angular/core';
import { Router } from '@angular/router';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { SimpleMQ } from 'ng2-simple-mq';
......@@ -22,6 +22,8 @@ import { I18nService } from '../../../service/i18n/i18n.service';
import { QuestionTextService } from '../../../service/question-text/question-text.service';
import { QuizService } from '../../../service/quiz/quiz.service';
import { ToLobbyConfirmComponent } from './modals/to-lobby-confirm/to-lobby-confirm.component';
import {TrackingService} from '../../../service/tracking/tracking.service';
import {UserTokenComponent} from './modals/user-token/user-token.component';
@Component({
selector: 'app-quiz-results',
......@@ -92,6 +94,7 @@ export class QuizResultsComponent implements OnInit, OnDestroy, IHasTriggeredNav
private ngbModal: NgbModal,
private cd: ChangeDetectorRef,
private messageQueue: SimpleMQ,
private trackingService: TrackingService,
) {
this.footerBarService.TYPE_REFERENCE = QuizResultsComponent.TYPE;
......@@ -234,6 +237,27 @@ export class QuizResultsComponent implements OnInit, OnDestroy, IHasTriggeredNav
return result;
}
public openUserTokenModal(content: TemplateRef<any>): void {
this.trackingService.trackClickEvent({
action: 'UserTokenModal',
label: 'open-dialog',
customDimensions: {
dimension1: this.connectionService.lowSpeed,
dimension2: this.connectionService.mediumSpeed,
dimension3: this.connectionService.rtt,
dimension4: this.connectionService.serverAvailable,
dimension5: this.connectionService.websocketAvailable,
},
});
this.ngbModal.dismissAll();
this.ngbModal.open(content);
this.connectionService.calculateRTT();
if (!this.connectionService.websocketAvailable) {
this.connectionService.initWebsocket();
}
}
public ngOnInit(): void {
this.questionTextService.eventEmitter.pipe(takeUntil(this._destroy)).subscribe((value: string | Array<string>) => {
if (Array.isArray(value)) {
......@@ -440,9 +464,14 @@ export class QuizResultsComponent implements OnInit, OnDestroy, IHasTriggeredNav
}).catch(() => {});
};
} else {
footerElems = [];
footerElems = [this.footerBarService.footerElemShowToken];
this.footerBarService.footerElemShowToken.onClickCallback = async () => {
this.ngbModal.open(UserTokenComponent).result.then(() => {}
).catch(() => {});
};
}
this.footerBarService.replaceFooterElements(footerElems);
this.cd.markForCheck();
}
private handleMessages(): void {
......
......@@ -8,13 +8,14 @@ import { ProgressBarModule } from './progress-bar/progress-bar.module';
import { QuestionDetailsComponent } from './question-details/question-details.component';
import { QuizResultsComponent } from './quiz-results.component';
import { ReadingConfirmationProgressComponent } from './reading-confirmation-progress/reading-confirmation-progress.component';
import { UserTokenComponent } from './modals/user-token/user-token.component';
@NgModule({
imports: [
SharedModule, ProgressBarModule, HeaderModule, QuizFlowSharedModule,
],
declarations: [
QuizResultsComponent, ConfidenceRateComponent, ReadingConfirmationProgressComponent, QuestionDetailsComponent, ToLobbyConfirmComponent,
QuizResultsComponent, ConfidenceRateComponent, ReadingConfirmationProgressComponent, QuestionDetailsComponent, ToLobbyConfirmComponent, UserTokenComponent,
],
bootstrap: [ToLobbyConfirmComponent],
exports: [QuizResultsComponent],
......
......@@ -59,6 +59,7 @@ import {
faUpload,
faUsers,
faWrench,
faUser
} from '@fortawesome/free-solid-svg-icons';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
......@@ -143,5 +144,6 @@ export class SharedModule {
library.addIcons(faCopy);
library.addIcons(faSquare);
library.addIcons(faCheckSquare);
library.addIcons(faUser);
}
}
......@@ -71,7 +71,8 @@
"login": "Einloggen",
"logout": "Ausloggen",
"save_quiz": "Quiz speichern",
"admin": "Administration"
"admin": "Administration",
"showToken": "Token anzeigen"
},
"about": {
"title": "arsnova.click",
......
......@@ -79,7 +79,8 @@
"login": "Login",
"logout": "Logout",
"save_quiz": "Save Quiz",
"admin": "Administrate"
"admin": "Administrate",
"showToken": "Show Token"
},
"about": {
"title": "About arsnova.click",
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
export let mysql = require("mysql2-promise")();
mysql.configure({
host: "zippsolutions.de",
user: "wbs",
password: "hausuebung2",
database: "usermanager"
});
// database sort helper
export function getSortDirection(asc: boolean): string {
if (asc) {
return "ASC";
} else {
return "DSC";
}
}
export function getSortColumn(col: string): string {
switch (col) {
case "firstname": {
return "us_firstname";
}
case "lastname": {
return "us_lastname";
}
case "email": {
return "us_email";
}
case "role": {
return "us_role";
}
default: {
return "us_id";
}
}
}
import {mysql} from "../connection";
export let roles: Role[] = [];
export class Role {
public id: number;
public name: string;
constructor(id: number, name: string) {
this.id = id;
this.name = name;
}
}
export function initializeRoles() {
roles = [];
mysql.query(
"SELECT * FROM `roles`;",
[],
(err, results, fields) => {
results.forEach((value) => {
roles.push(new Role(value.ro_id, value.ro_name));
});
}
);
}
import {first} from "rxjs/internal/operators";
import {async} from "rxjs/internal/scheduler/async";
import {getSortColumn, getSortDirection, mysql} from "../connection";
import {Role} from "./roles";
// export let users: User[] = [];
export class User {
public id: number;
public firstname: string;
public lastname: string;
public email: string;
public password: string;
public role: number;
constructor(id: number, firstname: string, lastname: string, email: string, password: string, role: number) {
this.id = id;
this.firstname = firstname;
this.lastname = lastname;
this.email = email;
this.password = password;
this.role = role;
}
}
export function createUser( firstname: string, lastname: string,
email: string, password: string, role: number) {
mysql.query(
"INSERT INTO `users` (us_firstname, us_lastname, us_email, us_password, us_role)" +
"VALUES ( ?, ?, ?, ?, ?);",
[firstname, lastname, email, password, role]
).spread((results) => {
console.log(results);
}).catch((error) => {
console.log(error);
});
}
export function editUser( id: number, firstname: string, lastname: string,
email: string, password: string, role: number) {
console.log(id + " xx " + firstname + " xx " + lastname + " xx " + email + " xx " + password + " xx " + role);
mysql.query(
"INSERT INTO `users` (us_id, us_firstname, us_lastname, us_email, us_password, us_role)" +
"VALUES ( ?, ?, ?, ?, ?, ?);",
[id, firstname, lastname, email, password, role]
).spread((results) => {
console.log(results);
}).catch((error) => {
console.log(error);
});
}
export async function deleteUser(id: number) {
mysql.query(
"DELETE FROM `users` WHERE us_id = ?;",
[id],
(err, results, fields) => {
console.log(err);
}
);
}
export function updateUser() {
console.log("test");
}
export async function getUser(editValue: string): Promise<User> {
let user: User = null;
const querystring: string = ("SELECT * FROM `users` WHERE us_id = " + editValue + ";");
await mysql.execute(
querystring,
[0]
).spread((results) => {
results.forEach((value) => {
// console.log(value)
user = new User(value.us_id, value.us_firstname, value.us_lastname, value.us_email, value.us_password,
value.us_role);
});
})
.catch((error) => {
console.log(error);
});
// console.log("getUsers: " + users.length);
// console.log("getUsers: " + users.length);
return user;
}
export async function getUsers(sortValue: string, sortDirection: string): Promise<User[]> {
const users: User[] = [];
console.log(sortValue);
console.log(sortDirection);
const querystring: string = ("SELECT * FROM `users` ORDER BY " + sortValue + " " + sortDirection + ";");
await mysql.execute(
querystring,
[0]
).spread((results) => {
results.forEach((value) => {
// console.log(value)
users.push(new User(value.us_id, value.us_firstname, value.us_lastname, value.us_email, value.us_password,
value.us_role));
});
})
.catch((error) => {
console.log(error);
});
// console.log("getUsers: " + users.length);
// console.log("getUsers: " + users.length);
return users;
}
export async function getUsersFilteredName(filterValue: string) {
const users: User[] = [];
console.log(filterValue);
const querystring: string = ("SELECT * FROM `users` WHERE us_firstname LIKE '%" + filterValue + "%' OR us_lastname LIKE '%" + filterValue + "%';");
await mysql.execute(
querystring,
[0]
).spread((results) => {
results.forEach((value) => {
// console.log(value)
users.push(new User(value.us_id, value.us_firstname, value.us_lastname, value.us_email, value.us_password,
value.us_role));
});
})
.catch((error) => {
console.log(error);
});
// console.log("getUsers: " + users.length);
// console.log("getUsers: " + users.length);
return users;
}
export async function getUsersFilteredRole(filterValue: any) {
const users: User[] = [];
console.log(filterValue);
const querystring: string = ("SELECT * FROM `users` WHERE us_role LIKE '" + filterValue + "';");
await mysql.execute(
querystring,
[0]
).spread((results) => {
results.forEach((value) => {
// console.log(value)
users.push(new User(value.us_id, value.us_firstname, value.us_lastname, value.us_email, value.us_password,
value.us_role));
});
})
.catch((error) => {
console.log(error);
});
// console.log("getUsers: " + users.length);
// console.log("getUsers: " + users.length);
return users;
}
// export function initializeUsers() {
// connection.query(
// "SELECT * FROM `users`;",
// [],
// (err, results, fields) => {
// // console.log(err);
// results.forEach((value) => {
// console.log(value);
// users.push(new User(value.us_id, value.us_firstname, value.us_lastname,
// value.us_email, value.password,
// value.role));
// });
// // console.log(results[0].us_id);
// // console.log(fields);
//
// console.log("init users: " + users.length);
// }
// );
// }
......@@ -3,17 +3,17 @@ import { QuizTheme } from '../app/lib/enums/QuizTheme';
import { IEnvironment } from '../app/lib/interfaces/IEnvironment';
export const environment: IEnvironment = {
production: false,
title: Title.Westermann,
production: true,
title: Title.Default,
version: 'VERSION',
enableCasLogin: true,
sentryDSN: 'https://f16c02fdefe64c018f5d580d1cf05b56@sentry.io/1819496',
ssrEndpoint: 'http://localhost:4000',
serverEndpoint: 'http://localhost:3030',
httpApiEndpoint: 'http://localhost:3030/api/v1',
httpLibEndpoint: 'http://localhost:3030/lib',
ssrEndpoint: 'https://staging.arsnova.click/backend',
serverEndpoint: 'https://localhost:3030',
httpApiEndpoint: 'https://staging.arsnova.click/backend/api/v1',
httpLibEndpoint: 'https://staging.arsnova.click/backend/lib',
stompConfig: {
endpoint: 'ws://localhost:15674/ws',
endpoint: 'wss://staging.arsnova.click/rabbitmq/ws',
user: 'arsnova-click',
password: 'K3BHZQMHsxh6XQ5a',
vhost: '/',
......@@ -21,17 +21,27 @@ export const environment: IEnvironment = {
leaderboardAmount: 5,
readingConfirmationEnabled: false,
confidenceSliderEnabled: false,
infoAboutTabEnabled: false,
infoProjectTabEnabled: false,
infoBackendApiEnabled: false,
requireLoginToCreateQuiz: true,
forceQuizTheme: true,
loginMechanism: [LoginMechanism.UsernamePassword, LoginMechanism.Token],
showJoinableQuizzes: false,
showPublicQuizzes: false,
persistQuizzes: false,
availableQuizThemes: [QuizTheme.WestermannBlue, QuizTheme.Material, QuizTheme.Blackbeauty],
defaultTheme: QuizTheme.WestermannBlue,
infoAboutTabEnabled: true,
infoProjectTabEnabled: true,
infoBackendApiEnabled: true,
requireLoginToCreateQuiz: false,
forceQuizTheme: false,
loginMechanism: [LoginMechanism.UsernamePassword],
showJoinableQuizzes: true,
showPublicQuizzes: true,
persistQuizzes: true,
availableQuizThemes: [
QuizTheme.Material,
QuizTheme.ArsnovaDotClickContrast,
QuizTheme.Blackbeauty,
QuizTheme.Elegant,
QuizTheme.DecentBlue,
QuizTheme.MaterialHope,
QuizTheme.MaterialBlue,
QuizTheme.SpiritualPurple,
QuizTheme.GreyBlueLime,