[DEV] update navigation in web interface

This commit is contained in:
Edouard DUPIN 2020-04-13 13:37:42 +02:00
parent d1f6e9b29f
commit 4fe781da00
20 changed files with 415 additions and 248 deletions

View File

@ -26,23 +26,19 @@ import { SaisonEditComponent } from './scene/saison-edit/saison-edit';
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full'},
{ path: 'home', component: HomeComponent },
{ path: 'type/:type_id', component: TypeComponent },
{ path: 'type/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: TypeComponent },
{ path: 'univers/:univers_id', component: UniversComponent },
{ path: 'univers/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: UniversComponent },
{ path: 'group/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: GroupComponent },
{ path: 'group-edit/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: GroupEditComponent },
{ path: 'saison/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: SaisonComponent },
{ path: 'saison-edit/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: SaisonEditComponent },
{ path: 'video/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: VideoComponent },
{ path: 'video-edit/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: VideoEditComponent },
//{ path: 'type/:type_id/univers/:univers_id', component: UniversComponent },
{ path: 'group/:group_id', component: GroupComponent },
{ path: 'group-edit/:group_id', component: GroupEditComponent },
//{ path: 'type/:type_id/group/:group_id', component: GroupComponent },
//{ path: 'type/:type_id/univers/:univers_id/group/:group_id', component: GroupComponent },
//{ path: 'univers/:univers_id/group/:group_id', component: GroupComponent },
{ path: 'saison/:saison_id', component: SaisonComponent },
{ path: 'saison-edit/:saison_id', component: SaisonEditComponent },
//{ path: 'type/:type_id/univers/:univers_id/group/:group_id/saison/:saison_id', component: SaisonComponent },
{ path: 'video/:video_id', component: VideoComponent },
//{ path: 'type/:type_id/univers/:univers_id/group/:group_id/saison/:saison_id/video/:video_id', component: VideoComponent },
//{ path: 'type/:type_id/univers/:univers_id/group/:group_id/saison/:saison_id/video/:video_id/edit', component: VideoEditComponent },
{ path: 'video-edit/:video_id', component: VideoEditComponent },
{ path: 'login', component: LoginComponent },
{ path: 'signup', component: SignUpComponent },
{ path: 'settings', component: SettingsComponent },

View File

@ -1,7 +1,8 @@
<div class="top">
<div id="main-menu" class="main-menu color-menu-background">
<button class="item"
(click)="onHome()">
(click)="onHome($event)"
(auxclick)="($event)">
<div class="xdesktop">
<i class="material-icons">home</i> Home
</div>
@ -10,7 +11,11 @@
</div>
</button>
<div class="ariane">
<button class="item" *ngIf="ariane_type_id != null" title="type" (click)="onArianeType()">
<button class="item"
*ngIf="ariane_type_id != null"
title="Uype"
(click)="onArianeType($event)"
(auxclick)="onArianeType($event)">
<div class="xdesktop">
{{ariane_type_name}}
</div>
@ -19,7 +24,11 @@
</div>
</button>
<div class="item_ariane_separator" *ngIf="ariane_univers_id != null && ariane_type_id != null" >/</div>
<button class="item" *ngIf="ariane_univers_id != null" title="univers" (click)="onArianeUnivers()">
<button class="item"
*ngIf="ariane_univers_id != null"
title="Univers"
(click)="onArianeUnivers($event)"
(auxclick)="onArianeUnivers($event)">
<div class="xdesktop">
{{ariane_univers_name}}
</div>
@ -28,7 +37,11 @@
</div>
</button>
<div class="item_ariane_separator" *ngIf="ariane_group_id != null && (ariane_univers_id != null || ariane_type_id != null)" >/</div>
<button class="item" *ngIf="ariane_group_id != null" title="group" (click)="onArianeGroup()">
<button class="item"
*ngIf="ariane_group_id != null"
title="Group"
(click)="onArianeGroup($event)"
(auxclick)="onArianeGroup($event)">
<div class="xdesktop">
{{ariane_group_name}}
</div>
@ -37,19 +50,24 @@
</div>
</button>
<div class="item_ariane_separator" *ngIf="ariane_saison_id != null && (ariane_group_id != null || ariane_univers_id != null || ariane_type_id != null)" >/</div>
<button class="item" *ngIf="ariane_saison_id != null" title="saison" (click)="onArianeSaison()">
<button class="item"
*ngIf="ariane_saison_id != null"
title="Saison"
(click)="onArianeSaison($event)"
(auxclick)="onArianeSaison($event)">
<div class="xdesktop">
{{ariane_saison_name}}
</div>
<div class="xmobile">
N
S
</div>
</button>
</div>
<button class="item"
*ngIf="login == null"
style="float:right;"
(click)="onSignIn()">
(click)="onSignIn($event)"
(auxclick)="onSignIn($event)">
<div class="xdesktop">
<i class="material-icons">add_circle_outline</i> Sign-up
</div>
@ -60,7 +78,8 @@
<button class="item"
*ngIf="login == null"
style="float:right;"
(click)="onLogin()"> <!-- [routerLink]="['./login']" routerLinkActive="active" -->
(click)="onLogin($event)"
(auxclick)="onLogin($event)">
<div class="xdesktop">
<i class="material-icons">account_circle</i> Sign-in
</div>
@ -75,7 +94,7 @@
<img class="avatar" src="{{avatar}}"/>
</button>
<button class="item"
*ngIf="edit != null"
*ngIf="edit_show == true"
style="float:right; height:56px;"
(click)="onEdit()">
<div class="xdesktop">
@ -92,13 +111,19 @@
<button class="item" disabled="disabled">
Sign in as <b>{{login}}</b>
</button>
<button class="item" (click)="onHelp()" >
<button class="item"
(click)="onHelp($event)"
(auxclick)="onHelp($event)">
<i class="material-icons">help_outline</i> Help
</button>
<button class="item" (click)="onSetting()" >
<button class="item"
(click)="onSetting($event)"
(auxclick)="onSetting($event)">
<i class="material-icons">settings</i> Settings
</button>
<button class="item" (click)="onLogout()" >
<button class="item"
(click)="onLogout($event)"
(auxclick)="onLogout($event)">
<i class="material-icons">exit_to_app</i> Sign out
</button>
</div>
@ -107,15 +132,73 @@
<!-- (click)="onOutUserProperty()" -->
<div class="xdesktop">
<div class="sub-menu edit-menu color-menu-background">
<button class="item" disabled="disabled">
<b>edit</b>
<!--
<button class="item"
*ngIf="ariane_type_id != null"
(click)="onSubEditType($event)"
(auxclick)="onSubEditType($event)">
<b>Edit Type</b>
</button>
<button class="item"
*ngIf="ariane_univers_id != null"
(click)="onSubEditUnivers($event)"
(auxclick)="onSubEditUnivers($event)">
<b>Edit Univers</b>
</button>
-->
<button class="item"
*ngIf="ariane_group_id != null"
(click)="onSubEditGroup($event)"
(auxclick)="onSubEditGroup($event)">
<b>Edit Group</b>
</button>
<button class="item"
*ngIf="ariane_saison_id != null"
(click)="onSubEditSaison($event)"
(auxclick)="onSubEditSaison($event)">
<b>Edit Saison</b>
</button>
<button class="item"
*ngIf="ariane_video_id != null"
(click)="onSubEditVideo($event)"
(auxclick)="onSubEditVideo($event)">
<b>Edit Video</b>
</button>
</div>
</div>
<div class="xmobile">
<div class="sub-menu edit-menu-mob color-menu-background">
<button class="item" disabled="disabled">
<b>edit</b>
<!--
<button class="item"
*ngIf="ariane_type_id != null"
(click)="onSubEditType($event)"
(auxclick)="onSubEditType($event)">
<b>Edit Type</b>
</button>
<button class="item"
*ngIf="ariane_univers_id != null"
(click)="onSubEditUnivers($event)"
(auxclick)="onSubEditUnivers($event)">
<b>Edit Univers</b>
</button>
-->
<button class="item"
*ngIf="ariane_group_id != null"
(click)="onSubEditGroup($event)"
(auxclick)="onSubEditGroup($event)">
<b>Edit Group</b>
</button>
<button class="item"
*ngIf="ariane_saison_id != null"
(click)="onSubEditSaison($event)"
(auxclick)="onSubEditSaison($event)">
<b>Edit Saison</b>
</button>
<button class="item"
*ngIf="ariane_video_id != null"
(click)="onSubEditVideo($event)"
(auxclick)="onSubEditVideo($event)">
<b>Edit Video</b>
</button>
</div>
</div>

View File

@ -36,7 +36,10 @@ export class TopMenuComponent implements OnInit {
public ariane_saison_id: number = null;
public ariane_saison_name: string = null;
public edit: string = "";
public ariane_video_id: number = null;
public ariane_video_name: string = null;
public edit_show: boolean = false;
constructor(private router: Router,
private sessionService: SessionService,
@ -62,119 +65,110 @@ export class TopMenuComponent implements OnInit {
this.arianeService.type_change.subscribe(type_id => {
this.ariane_type_id = type_id;
this.ariane_type_name = this.arianeService.getTypeName();
this.updateEditable();
this.updateEditShow();
});
this.arianeService.univers_change.subscribe(univers_id => {
this.ariane_univers_id = univers_id;
this.ariane_univers_name = this.arianeService.getUniversName();
this.updateEditable();
this.updateEditShow();
});
this.arianeService.group_change.subscribe(group_id => {
this.ariane_group_id = group_id;
this.ariane_group_name = this.arianeService.getGroupName();
this.updateEditable();
this.updateEditShow();
});
this.arianeService.saison_change.subscribe(saison_id => {
this.ariane_saison_id = saison_id;
this.ariane_saison_name = this.arianeService.getSaisonName();
this.updateEditable();
this.updateEditShow();
});
this.arianeService.video_change.subscribe(video_id => {
this.updateEditable();
this.ariane_video_id = video_id;
this.ariane_video_name = this.arianeService.getVideoName();
this.updateEditShow();
});
}
updateEditShow():void {
this.edit_show = /* this.ariane_type_id != null
|| this.ariane_univers_id != null
||*/ this.ariane_group_id != null
|| this.ariane_saison_id != null
|| this.ariane_video_id != null;
}
onAvatar(): void {
console.log("onAvatar() " + this.displayUserMenu);
this.displayUserMenu = !this.displayUserMenu;
this.displayEditMenu = false;
}
updateEditable() {
if (this.arianeService.getVideoId() != null) {
this.edit = "video";
return;
}
if (this.arianeService.getSaisonId() != null) {
this.edit = "saison";
return;
}
if (this.arianeService.getGroupId() != null) {
this.edit = "group";
return;
}
/*
if (this.arianeService.getUniversId() != null) {
this.edit = "univers";
return;
}
if (this.arianeService.getTypeId() != null) {
this.edit = "type";
return;
}
*/
this.edit = null;
}
onEdit(): void {
console.log("onEdit()");
this.displayEditMenu = !this.displayEditMenu;
this.displayUserMenu = false;
/*
if (this.arianeService.getVideoId() != null) {
this.router.navigate(['video-edit/' + this.arianeService.getVideoId()]);
return;
}
if (this.arianeService.getSaisonId() != null) {
this.router.navigate(['saison-edit/' + this.arianeService.getSaisonId()]);
return;
}
if (this.arianeService.getGroupId() != null) {
this.router.navigate(['group-edit/' + this.arianeService.getGroupId()]);
return;
}
if (this.arianeService.getUniversId() != null) {
this.router.navigate(['univers-edit/' + this.arianeService.getUniversId()]);
return;
}
if (this.arianeService.getTypeId() != null) {
this.router.navigate(['type-edit/' + this.arianeService.getTypeId()]);
return;
}
this.edit = null;
*/
}
onSubEditVideo(_event: any): void {
console.log("onSubEdit()");
this.displayEditMenu = false;
this.displayUserMenu = false;
this.arianeService.navigateVideoEdit(this.ariane_video_id, _event.which==2);
}
onSubEditSaison(_event: any): void {
console.log("onSubEdit()");
this.displayEditMenu = false;
this.displayUserMenu = false;
this.arianeService.navigateSaisonEdit(this.ariane_saison_id, _event.which==2);
}
onSubEditGroup(_event: any): void {
console.log("onSubEdit()");
this.displayEditMenu = false;
this.displayUserMenu = false;
this.arianeService.navigateGroupEdit(this.ariane_group_id, _event.which==2);
}
onSubEditUnivers(_event: any): void {
console.log("onSubEdit()");
this.displayEditMenu = false;
this.displayUserMenu = false;
this.arianeService.navigateUniversEdit(this.ariane_univers_id, _event.which==2);
}
onSubEditType(_event: any): void {
console.log("onSubEditType()");
this.displayEditMenu = false;
this.displayUserMenu = false;
this.arianeService.navigateTypeEdit(this.ariane_type_id, _event.which==2);
}
onHome(): void {
onHome(_event: any): void {
console.log("onHome()");
this.router.navigate(['home']);
}
onSignIn(): void {
onSignIn(_event: any): void {
console.log("onSignIn()");
//Session.destroy();
this.router.navigate(['signup']);
}
onLogin(): void {
onLogin(_event: any): void {
console.log("onLogin()");
//Session.destroy();
this.router.navigate(['login']);
this.displayUserMenu = false;
}
onLogout(): void {
onLogout(_event: any): void {
console.log("onLogout()");
this.sessionService.destroy();
this.router.navigate(['home']);
this.displayUserMenu = false;
}
onSetting(): void {
onSetting(_event: any): void {
console.log("onSetting()");
this.router.navigate(['settings']);
this.displayUserMenu = false;
}
onHelp(): void {
onHelp(_event: any): void {
console.log("onHelp()");
this.router.navigate(['help']);
this.displayUserMenu = false;
@ -186,38 +180,24 @@ export class TopMenuComponent implements OnInit {
this.displayEditMenu = false;
}
onArianeType(): void {
onArianeType(_event: any): void {
console.log("onArianeType(" + this.ariane_type_id + ")");
this.router.navigate(['type/' + this.ariane_type_id ]);
this.arianeService.setVideo(null);
this.arianeService.setSaison(null);
this.arianeService.setGroup(null);
this.arianeService.setUnivers(null);
this.updateEditable();
this.arianeService.navigateType(this.ariane_type_id, _event.which==2);
}
onArianeUnivers(): void {
onArianeUnivers(_event: any): void {
console.log("onArianeUnivers(" + this.ariane_univers_id + ")");
this.router.navigate(['univers/' + this.ariane_univers_id ]);
this.arianeService.setVideo(null);
this.arianeService.setSaison(null);
this.arianeService.setGroup(null);
this.updateEditable();
this.arianeService.navigateUnivers(this.ariane_univers_id, _event.which==2);
}
onArianeGroup(): void {
onArianeGroup(_event: any): void {
console.log("onArianeGroup(" + this.ariane_group_id + ")");
this.router.navigate(['group/' + this.ariane_group_id ]);
this.arianeService.setVideo(null);
this.arianeService.setSaison(null);
this.updateEditable();
this.arianeService.navigateGroup(this.ariane_group_id, _event.which==2);
}
onArianeSaison(): void {
onArianeSaison(_event: any): void {
console.log("onArianeSaison(" + this.ariane_saison_id + ")");
this.router.navigate(['saison/' + this.ariane_saison_id ]);
this.arianeService.setVideo(null);
this.updateEditable();
this.arianeService.navigateSaison(this.ariane_saison_id, _event.which==2);
}
}

View File

@ -5,6 +5,8 @@
*/
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ArianeService } from '../../service/ariane';
@Component({
selector: 'app-error-viewer',
@ -13,9 +15,12 @@ import { Component, OnInit } from '@angular/core';
})
export class ErrorViewerComponent implements OnInit {
constructor() { }
ngOnInit() {
}
constructor(private route: ActivatedRoute,
private arianeService: ArianeService) { }
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
}
}

View File

@ -13,6 +13,7 @@ import { fadeInAnimation } from '../../_animations/index';
import { GroupService } from '../../service/group';
import { DataService } from '../../service/data';
import { ArianeService } from '../../service/ariane';
export class ElementList {
value: number;
@ -48,12 +49,14 @@ export class GroupEditComponent implements OnInit {
private router: Router,
private locate: Location,
private dataService: DataService,
private groupService: GroupService) {
private groupService: GroupService,
private arianeService: ArianeService) {
}
ngOnInit() {
this.id_group = parseInt(this.route.snapshot.paramMap.get('group_id'));
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.id_group = this.arianeService.getGroupId();
let self = this;
this.groupService.get(this.id_group)
.then(function(response) {

View File

@ -42,10 +42,10 @@ export class GroupComponent implements OnInit {
}
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
//this.id_univers = parseInt(this.route.snapshot.paramMap.get('univers_id'));
//this.id_type = parseInt(this.route.snapshot.paramMap.get('type_id'));
this.id_group = parseInt(this.route.snapshot.paramMap.get('group_id'));
console.log
this.id_group = this.arianeService.getGroupId();
let self = this;
this.groupService.get(this.id_group)
.then(function(response) {
@ -85,29 +85,11 @@ export class GroupComponent implements OnInit {
});
}
onSelectSaison(_event: any, _idSelected: number):void {
if(_event.which==2) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/saison/' + _idSelected);
} else {
window.open("/" + environment.frontBaseUrl + '/saison/' + _idSelected);
}
} else {
this.router.navigate(['/saison/' + _idSelected ]);
this.arianeService.setSaison(_idSelected);
}
this.arianeService.navigateSaison(_idSelected, _event.which==2);
}
onSelectVideo(_event: any, _idSelected: number):void {
if(_event.which==2) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/video/' + _idSelected);
} else {
window.open("/" + environment.frontBaseUrl + '/video/' + _idSelected);
}
} else {
this.router.navigate(['/video/' + _idSelected ]);
this.arianeService.setVideo(_idSelected);
}
this.arianeService.navigateVideo(_idSelected, _event.which==2);
}
}

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ArianeService } from '../../service/ariane';
@Component({
selector: 'app-help',
@ -7,9 +9,11 @@ import { Component, OnInit } from '@angular/core';
})
export class HelpComponent implements OnInit {
constructor() { }
ngOnInit() {
}
constructor(private route: ActivatedRoute,
private arianeService: ArianeService) { }
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
}
}

View File

@ -5,7 +5,7 @@
*/
import { Component, OnInit } from '@angular/core';
import { Router } from "@angular/router";
import { Router, ActivatedRoute } from "@angular/router";
import { Location } from '@angular/common';
import { fadeInAnimation } from '../../_animations/index';
@ -23,7 +23,8 @@ import { environment } from 'environments/environment';
export class HomeComponent implements OnInit {
data_list = [];
error = "";
constructor(private router: Router,
constructor(private route: ActivatedRoute,
private router: Router,
private locate: Location,
private typeService: TypeService,
private arianeService: ArianeService) {
@ -31,6 +32,7 @@ export class HomeComponent implements OnInit {
}
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
let self = this
this.typeService.getData()
.then(function(response) {
@ -45,17 +47,7 @@ export class HomeComponent implements OnInit {
this.arianeService.reset();
}
onSelectType(_event: any, _idSelected: number):void {
if(_event.which==2) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/type/' + _idSelected);
} else {
window.open("/" + environment.frontBaseUrl + '/type/' + _idSelected);
}
} else {
this.arianeService.setType(_idSelected);
//this.router.navigate(['type/', { id: _idSelected} ]);
this.router.navigate(['type/' + _idSelected ]);
}
this.arianeService.navigateType(_idSelected, _event.which==2);
}
}

View File

@ -5,6 +5,7 @@
*/
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Router } from "@angular/router";
import { Location } from '@angular/common';
import { fadeInAnimation } from '../../_animations/index';
@ -12,6 +13,7 @@ import { slideInOutAnimation } from '../../_animations/index';
import { UserService } from '../../service/user';
import { SessionService } from '../../service/session';
import { CookiesService } from '../../service/cookies';
import { ArianeService } from '../../service/ariane';
export let checkLoginValidity = function(_value:string):boolean {
@ -62,16 +64,18 @@ export class LoginComponent implements OnInit {
public rememberMe:boolean = true;
constructor(private router: Router,
private route: ActivatedRoute,
private locate: Location,
private cookiesService: CookiesService,
private userService: UserService,
private sessionService: SessionService) {
private sessionService: SessionService,
private arianeService: ArianeService) {
}
ngOnInit() {
// TODO : If already loaded ==> jusp in the home page ...
this.arianeService.updateManual(this.route.snapshot.paramMap);
}
updateButtonVisibility():void {

View File

@ -13,6 +13,7 @@ import { fadeInAnimation } from '../../_animations/index';
import { SaisonService } from '../../service/saison';
import { DataService } from '../../service/data';
import { ArianeService } from '../../service/ariane';
export class ElementList {
value: number;
@ -48,12 +49,14 @@ export class SaisonEditComponent implements OnInit {
private router: Router,
private locate: Location,
private dataService: DataService,
private saisonService: SaisonService) {
private saisonService: SaisonService,
private arianeService: ArianeService) {
}
ngOnInit() {
this.id_saison = parseInt(this.route.snapshot.paramMap.get('saison_id'));
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.id_saison = this.arianeService.getSaisonId();
let self = this;
this.saisonService.get(this.id_saison)
.then(function(response) {

View File

@ -42,8 +42,10 @@ export class SaisonComponent implements OnInit {
}
ngOnInit() {
this.id_saison = parseInt(this.route.snapshot.paramMap.get('saison_id'));
this.arianeService.setSaison(this.id_saison);
console.log("ngOnInit(SaisonComponent)");
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.id_saison = this.arianeService.getSaisonId();
let self = this;
this.saisonService.get(this.id_saison)
.then(function(response) {
@ -85,16 +87,8 @@ export class SaisonComponent implements OnInit {
}
onSelectVideo(_event: any, _idSelected: number):void {
if(_event.which==2) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/video/' + _idSelected);
} else {
window.open("/" + environment.frontBaseUrl + '/video/' + _idSelected);
}
} else {
this.router.navigate(['video/' + _idSelected ]);
this.arianeService.setVideo(_idSelected);
}
this.arianeService.navigateVideo(_idSelected, _event.which==2);
}
}

View File

@ -5,6 +5,8 @@
*/
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ArianeService } from '../../service/ariane';
@Component({
selector: 'app-settings',
@ -13,9 +15,11 @@ import { Component, OnInit } from '@angular/core';
})
export class SettingsComponent implements OnInit {
constructor() { }
constructor(private route: ActivatedRoute,
private arianeService: ArianeService) { }
ngOnInit() {
}
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
}
}

View File

@ -5,10 +5,11 @@
*/
import { Component, OnInit } from '@angular/core';
import { Router } from "@angular/router";
import { Router, ActivatedRoute } from "@angular/router";
import { checkLoginValidity, checkEmailValidity, checkPasswordValidity } from '../login/login';
import { fadeInAnimation } from '../../_animations/index';
import { UserService } from '../../service/user';
import { ArianeService } from '../../service/ariane';
@Component({
@ -47,13 +48,17 @@ export class SignUpComponent implements OnInit {
constructor(private userService: UserService,
private router: Router) {
private router: Router,
private route: ActivatedRoute,
private arianeService: ArianeService) {
}
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
}
updateButtonVisibility():void {
if ( this.loginOK == true

View File

@ -46,7 +46,8 @@ export class TypeComponent implements OnInit {
}
ngOnInit() {
this.type_id = parseInt(this.route.snapshot.paramMap.get('type_id'));
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.type_id = this.arianeService.getTypeId();
let self = this;
console.log("get parameter id: " + this.type_id);
this.typeService.get(this.type_id)
@ -75,30 +76,11 @@ export class TypeComponent implements OnInit {
});
}
onSelectGroup(_event: any, _idSelected: number):void {
if(_event.which==2) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/group/' + _idSelected);
} else {
window.open("/" + environment.frontBaseUrl + '/group/' + _idSelected);
}
} else {
this.router.navigate(['/group/' + _idSelected ]);
this.arianeService.setGroup(_idSelected);
}
this.arianeService.navigateGroup(_idSelected, _event.which==2);
}
onSelectVideo(_event: any, _idSelected: number):void {
//console.log("event: " + _event.which);
if(_event.which==2) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/video/' + _idSelected);
} else {
window.open("/" + environment.frontBaseUrl + '/video/' + _idSelected);
}
} else {
this.router.navigate(['/video/' + _idSelected ]);
this.arianeService.setVideo(_idSelected);
}
this.arianeService.navigateVideo(_idSelected, _event.which==2);
}
}

View File

@ -35,7 +35,8 @@ export class UniversComponent implements OnInit {
}
ngOnInit() {
this.univers_id = parseInt(this.route.snapshot.paramMap.get('univers_id'));
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.univers_id = this.arianeService.getUniversId();
let self = this;
console.log("get parameter id: " + this.univers_id);
/*

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ArianeService } from '../../service/ariane';
@Component({
selector: 'app-validate-email',
@ -7,18 +9,21 @@ import { Component, OnInit } from '@angular/core';
})
export class ValidateEmailComponent implements OnInit {
constructor() { }
constructor(private route: ActivatedRoute,
private arianeService: ArianeService
) {
}
ngOnInit() {
}
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
}
onSend() {
}
onCheck() {
}
onSend() {
}
onCheck() {
}
}
/*

View File

@ -140,8 +140,8 @@ export class VideoEditComponent implements OnInit {
}
ngOnInit() {
this.id_video = parseInt(this.route.snapshot.paramMap.get('video_id'));
this.arianeService.setVideo(this.id_video);
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.id_video = this.arianeService.getVideoId();
let self = this;
this.listType = [{value: undefined, label: '---'}];
this.listUnivers = [{value: undefined, label: '---'}];

View File

@ -76,8 +76,9 @@ export class VideoComponent implements OnInit {
}
ngOnInit() {
this.id_video = parseInt(this.route.snapshot.paramMap.get('video_id'));
this.arianeService.setVideo(this.id_video);
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.id_video = this.arianeService.getVideoId();
let self = this;
this.videoService.get(this.id_video)
.then(function(response) {

View File

@ -4,15 +4,16 @@
* @license PROPRIETARY (see license file)
*/
import { Injectable, Output, EventEmitter } from '@angular/core'
import { Injectable, Output, EventEmitter, OnInit} from '@angular/core'
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
import { Router, ActivatedRoute, ParamMap, NavigationEnd } from '@angular/router';
import { TypeService } from 'app/service/type';
import { UniversService } from 'app/service/univers';
import { GroupService } from 'app/service/group';
import { SaisonService } from 'app/service/saison';
import { VideoService } from 'app/service/video';
import { environment } from 'environments/environment';
export class InputOrders {
public type_id: number = null;
@ -47,14 +48,71 @@ export class ArianeService {
@Output() video_change: EventEmitter<number> = new EventEmitter();
constructor(private route: ActivatedRoute,
private router: Router,
private typeService: TypeService,
private universService: UniversService,
private groupService: GroupService,
private saisonService: SaisonService,
private videoService: VideoService) {
console.log("Start ArianeService");
}
updateParams(params) {
console.log("sparams " + params);
console.log("sparams['type_id'] " + params['type_id']);
if(params['type_id']) {
this.setType(params['type_id'])
} else {
this.setType(null);
}
}
updateManual(params) {
let type_id = params.get('type_id');
if (type_id === null || type_id === undefined || type_id == "null" || type_id == "NULL" || type_id == "") {
type_id = null;
} else {
type_id = parseInt(type_id)
}
console.log("type_id = " + type_id + " " + params.get('type_id'));
let univers_id = params.get('univers_id');
if (univers_id === null || univers_id === undefined || univers_id == "null" || univers_id == "NULL" || univers_id == "") {
univers_id = null;
} else {
univers_id = parseInt(univers_id)
}
console.log("univers_id = " + univers_id + " " + params.get('univers_id'));
let group_id = params.get('group_id');
if (group_id === null || group_id === undefined || group_id == "null" || group_id == "NULL" || group_id == "") {
group_id = null;
} else {
group_id = parseInt(group_id)
}
console.log("group_id = " + group_id + " " + params.get('group_id'));
let saison_id = params.get('saison_id');
if (saison_id === null || saison_id === undefined || saison_id == "null" || saison_id == "NULL" || saison_id == "") {
saison_id = null;
} else {
saison_id = parseInt(saison_id)
}
console.log("saison_id = " + saison_id + " " + params.get('saison_id'));
let video_id = params.get('video_id');
if (video_id === null || video_id === undefined || video_id == "null" || video_id == "NULL" || video_id == "") {
video_id = null;
} else {
video_id = parseInt(video_id)
}
console.log("video_id = " + video_id + " " + params.get('video_id'));
this.setType(type_id);
this.setUnivers(univers_id);
this.setGroup(group_id);
this.setSaison(saison_id);
this.setVideo(video_id);
}
reset():void {
this.type_id = null;
this.type_name = null;
@ -105,18 +163,21 @@ export class ArianeService {
}
*/
setType(id:number):void {
if (this.type_id == id) {
setType(_id:number):void {
if (this.type_id == _id) {
return;
}
this.type_id = id;
if (_id === undefined) {
return;
}
this.type_id = _id;
this.type_name = "??--??";
if (this.type_id == null) {
if (this.type_id === null) {
this.type_change.emit(this.type_id);
return;
}
let self = this;
this.typeService.get(id)
this.typeService.get(_id)
.then(function(response) {
self.type_name = response.name
self.type_change.emit(self.type_id);
@ -131,18 +192,21 @@ export class ArianeService {
return this.type_name;
}
setUnivers(id:number) {
if (this.univers_id == id) {
setUnivers(_id:number) {
if (this.univers_id == _id) {
return;
}
this.univers_id = id;
if (_id === undefined) {
return;
}
this.univers_id = _id;
this.univers_name = "??--??";
if (this.univers_id == null) {
if (this.univers_id === null) {
this.univers_change.emit(this.univers_id);
return;
}
let self = this;
this.universService.get(id)
this.universService.get(_id)
.then(function(response) {
self.univers_name = response.number
self.univers_change.emit(self.univers_id);
@ -157,18 +221,21 @@ export class ArianeService {
return this.univers_name;
}
setGroup(id:number):void {
if (this.group_id == id) {
setGroup(_id:number):void {
if (this.group_id == _id) {
return;
}
this.group_id = id;
if (_id === undefined) {
return;
}
this.group_id = _id;
this.group_name = "??--??";
if (this.group_id == null) {
if (this.group_id === null) {
this.group_change.emit(this.group_id);
return;
}
let self = this;
this.groupService.get(id)
this.groupService.get(_id)
.then(function(response) {
self.group_name = response.name
self.group_change.emit(self.group_id);
@ -183,21 +250,24 @@ export class ArianeService {
return this.group_name;
}
setSaison(id:number):void {
if (this.saison_id == id) {
setSaison(_id:number):void {
if (this.saison_id == _id) {
return;
}
this.saison_id = id;
if (_id === undefined) {
return;
}
this.saison_id = _id;
this.saison_name = "??--??";
if (this.saison_id == null) {
if (this.saison_id === null) {
this.saison_change.emit(this.saison_id);
return;
}
let self = this;
this.saisonService.get(id)
this.saisonService.get(_id)
.then(function(response) {
self.setGroup(response.group_id);
self.saison_name = response.number
//self.setGroup(response.group_id);
self.saison_name = response.name
self.saison_change.emit(self.saison_id);
}).catch(function(response) {
self.saison_change.emit(self.saison_id);
@ -210,21 +280,24 @@ export class ArianeService {
return this.saison_name;
}
setVideo(id:number):void {
if (this.video_id == id) {
setVideo(_id:number):void {
if (this.video_id == _id) {
return;
}
this.video_id = id;
if (_id === undefined) {
return;
}
this.video_id = _id;
this.video_name = "??--??";
if (this.video_id == null) {
if (this.video_id === null) {
this.video_change.emit(this.video_id);
return;
}
let self = this;
this.videoService.get(id)
this.videoService.get(_id)
.then(function(response) {
self.setSaison(response.saison_id);
self.setGroup(response.group_id);
//self.setSaison(response.saison_id);
//self.setGroup(response.group_id);
self.video_name = response.name;
self.video_change.emit(self.video_id);
}).catch(function(response) {
@ -234,4 +307,53 @@ export class ArianeService {
getVideoId():number {
return this.video_id;
}
getVideoName():string {
return this.video_name;
}
genericNavigate(_destination:string, _universId:number, _typeId:number, _groupId:number, _saisonId:number, _videoId:number, _newWindows:boolean):void {
let addressOffset = _destination + '/' + _universId + '/' + _typeId + '/' + _groupId + '/' + _saisonId + '/' + _videoId;
if(_newWindows==true) {
if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") {
window.open('/' + addressOffset);
} else {
window.open("/" + environment.frontBaseUrl + '/' + addressOffset);
}
} else {
this.router.navigate([addressOffset]);
}
}
navigateUnivers(_id:number, _newWindows:boolean):void {
this.genericNavigate('univers', _id, this.type_id, null, null, null, _newWindows);
}
navigateUniversEdit(_id:number, _newWindows:boolean):void {
this.genericNavigate('univers-edit', _id, this.type_id, null, null, null, _newWindows);
}
navigateType(_id:number, _newWindows:boolean):void {
this.genericNavigate('type', this.univers_id, _id, null, null, null, _newWindows);
}
navigateTypeEdit(_id:number, _newWindows:boolean):void {
this.genericNavigate('type-edit', this.univers_id, _id, null, null, null, _newWindows);
}
navigateGroup(_id:number, _newWindows:boolean):void {
this.genericNavigate('group', this.univers_id, this.type_id, _id, null, null, _newWindows);
}
navigateGroupEdit(_id:number, _newWindows:boolean):void {
this.genericNavigate('group-edit', this.univers_id, this.type_id, _id, null, null, _newWindows);
}
navigateSaison(_id:number, _newWindows:boolean):void {
this.genericNavigate('saison', this.univers_id, this.type_id, this.group_id, _id, null, _newWindows);
}
navigateSaisonEdit(_id:number, _newWindows:boolean):void {
this.genericNavigate('saison-edit', this.univers_id, this.type_id, this.group_id, _id, null, _newWindows);
}
navigateVideo(_id:number, _newWindows:boolean):void {
this.genericNavigate('video', this.univers_id, this.type_id, this.group_id, this.saison_id, _id, _newWindows);
}
navigateVideoEdit(_id:number, _newWindows:boolean):void {
this.genericNavigate('video-edit', this.univers_id, this.type_id, this.group_id, this.saison_id, _id, _newWindows);
}
}

View File

@ -27,6 +27,7 @@ export class GroupService {
return;
}
resolve(data);
return;
}).catch(function(response) {
reject(response);
});