From 3c74f2a3813e129764c08b030cda52378a841dda Mon Sep 17 00:00:00 2001 From: "stefania.martziou" <19352921+smartziou@users.noreply.github.com> Date: Wed, 6 Apr 2022 10:10:42 +0000 Subject: [PATCH] Merging terms of use branch --- src/app/app.component.html | 56 +++++++++++-------- src/app/app.component.ts | 53 +++++++++--------- src/app/domain/typeScriptClasses.ts | 18 ++++-- .../pages/landing/home/home.component.html | 6 +- .../update/sources-update-repo.component.html | 2 +- ...egister-existing-datasource.component.html | 46 ++++----------- .../register-existing-datasource.component.ts | 36 ++++++------ .../register-new-datasource.component.html | 39 ++++--------- .../register-new-datasource.component.ts | 37 ++++++------ src/app/services/authentication.service.ts | 24 ++++---- src/app/services/repository.service.ts | 11 +++- ...atasource-update-terms-form.component.html | 27 ++++++--- .../datasource-update-terms-form.component.ts | 33 ++++++----- src/assets/theme-assets/css/main.css | 2 +- src/assets/theme-assets/css/main.min.css | 2 +- 15 files changed, 201 insertions(+), 191 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 2afcc4b06..39e2f9307 100755 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -50,26 +50,36 @@ - - - - - - - - - - - - - - - - - - - - - - - + + +
+
+ + + Thanks for being part of OpenAIRE. Please confirm the acceptance of our datasources policy. + +
+ + Being registered in OpenAIRE, you are giving consent to OpenAIRE to download, transform and enrich the metadata records, publishing them in the OpenAIRE Research Graph. + + + +
{{term.get('name').value}}
+
+ +
+ +
+ + +

Note: OpenAIRE will not provide the full text files for public distribution, the users will access from the original datasource.

+
+
+
+ +
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index f4a3569e4..d3cb59141 100755 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -5,10 +5,10 @@ import { environment } from '../environments/environment'; import { MatomoTracker } from 'ngx-matomo'; import { ConfirmationDialogComponent } from './shared/reusablecomponents/confirmation-dialog.component'; import { RepositoryService } from './services/repository.service'; -import { RepositorySnippet } from './domain/typeScriptClasses'; +import {RepositorySnippet, TermsOfUse} from './domain/typeScriptClasses'; import {FormBuilder, FormGroup, FormControl, FormArray} from '@angular/forms'; import {element} from 'protractor'; -import {timestamp} from 'rxjs/operators'; +import {timeout, timestamp} from 'rxjs/operators'; @Component({ selector: 'oa-repo-manager', @@ -38,7 +38,7 @@ export class AppComponent implements OnInit { private repositoryService: RepositoryService, private fb: FormBuilder) { - console.log('21-06-2019. Fixed matomo to log userIds?'); + // console.log('21-06-2019. Fixed matomo to log userIds?'); /*disabling console.log in production*/ if ( environment.production === true ) { @@ -57,15 +57,17 @@ export class AppComponent implements OnInit { } getReposOfUser(): void { - this.repositoryService.getRepositoriesSnippetsOfUser() - .subscribe( - repos => { this.reposOfUser = repos; }, - error => { console.log(error); }, + this.repositoryService.getRepositoriesSnippetsOfUser().subscribe( + repos => { + this.reposOfUser = repos; + }, + error => { + console.log(error); + }, () => { console.log(this.reposOfUser); - this.reposOfUser.forEach( repo => { - // TODO: change !repo.consentTermsOfUse check when it gets a non-null value - if (this.authService.isLoggedIn && !repo.consentTermsOfUse) { + this.reposOfUser.forEach(repo => { + if (!repo.consentTermsOfUse || !repo.fullTextDownload) { this.addTerm(repo.officialname, repo.id, repo.consentTermsOfUse); this.isModalShown = true; } @@ -75,18 +77,10 @@ export class AppComponent implements OnInit { } updateTerms() { - /* update consentTermsOfUse, consentTermsOfUseDate(?) - depending on what value will consentTermsOfUse hold - Also what type of consentTermsOfUse will be? boolean or string */ - for (let i = 0; i < this.terms.length; i++) { - const id = this.terms.controls[i].get('id').value; - if (this.terms.controls[i].get('accept').value === true) { - console.log(`Agreed to the Terms of Use for: `, id); - } - } - this.consentTermsOfUseDate = new Date(Date.now()); - console.log(this.consentTermsOfUseDate); - console.log('will POST when backend is ready'); + this.repositoryService.updateRepositoriesTerms(this.agreementForm.value.terms).subscribe( + res => {}, + err => {console.log(err)} + ); } ngOnInit() { @@ -94,25 +88,30 @@ export class AppComponent implements OnInit { if (!(evt instanceof NavigationEnd)) { return; } - if (this.authService.isLoggedIn) { + if (this.authService.isLoggedIn_) { this.matomoTracker.setUserId(this.authService.getUserEmail()); } window.scrollTo(0, 0); }); - // this.getReposOfUser(); + this.authService.isLoggedIn.subscribe( + logged => {if(logged){this.getReposOfUser()}}, + error => {console.log(error)} + ); } - addTerm(name: string, id: string, consent: string) { + addTerm(name: string, id: string, consent: boolean) { this.terms.push(this.newTerm(name, id, consent)); } - newTerm(name: string, id: string, consent: string): FormGroup { + newTerm(name: string, id: string, consent: boolean): FormGroup { return this.fb.group({ id: [id], name: [name], - accept: [(consent ? consent : true)] + // accept: [(consent ? consent : true)] + consentTermsOfUse: false, + fullTextDownload: false }); } diff --git a/src/app/domain/typeScriptClasses.ts b/src/app/domain/typeScriptClasses.ts index 3cd6aac83..38e4e8052 100755 --- a/src/app/domain/typeScriptClasses.ts +++ b/src/app/domain/typeScriptClasses.ts @@ -130,6 +130,9 @@ export class Repository extends DriverResource implements IsSerializable { eissn: string; lissn: string; interfaces: RepositoryInterface[]; + consentTermsOfUse: boolean; + fullTextDownload: boolean; + consentTermsOfUseDate: Date; availableDiskSpace: string; securityParameters: string; protocol: string; @@ -151,9 +154,6 @@ export class Repository extends DriverResource implements IsSerializable { registrationDate: Date; verified: boolean; dataCollectionTypes: DataCollectionType[]; - consentTermsOfUse: string; - consentTermsOfUseDate: Date; - fullTextDownload: string; } export class RepositorySnippet { @@ -168,9 +168,17 @@ export class RepositorySnippet { piwikInfo: PiwikInfo; logoUrl: string; description: string; - consentTermsOfUse: string; + consentTermsOfUse: boolean; + fullTextDownload: boolean; consentTermsOfUseDate: Date; - fullTextDownload: string; +} + +export class TermsOfUse { + id: string; + name: string; + consentTermsOfUse: boolean; + fullTextDownload: boolean; + // consentTermsOfUseDate: Date; } export class Organization { diff --git a/src/app/pages/landing/home/home.component.html b/src/app/pages/landing/home/home.component.html index 179aa948b..9f83eb865 100755 --- a/src/app/pages/landing/home/home.component.html +++ b/src/app/pages/landing/home/home.component.html @@ -321,7 +321,7 @@
-
Terms of Agreement for Content Providers
+
Terms of Use for Content Providers

Learn more: https://www.openaire.eu/terms-of-use-for-content-providers

@@ -752,7 +752,7 @@
-
Terms of Agreement for Content Providers
+
Terms of Use for Content Providers

Learn more: https://www.openaire.eu/terms-of-use-for-content-providers

@@ -820,7 +820,7 @@
-
Terms of Agreement for Content Providers
+
Terms of Use for Content Providers

Learn more: https://www.openaire.eu/terms-of-use-for-content-providers

diff --git a/src/app/pages/repository/update/sources-update-repo.component.html b/src/app/pages/repository/update/sources-update-repo.component.html index d0ff3c82f..ebe240448 100755 --- a/src/app/pages/repository/update/sources-update-repo.component.html +++ b/src/app/pages/repository/update/sources-update-repo.component.html @@ -43,7 +43,7 @@
  • Update Information
  • - +
    @@ -219,4 +198,3 @@ - diff --git a/src/app/pages/sources/sources-register/register-existing-datasource.component.ts b/src/app/pages/sources/sources-register/register-existing-datasource.component.ts index fc22029b9..ef09511d2 100644 --- a/src/app/pages/sources/sources-register/register-existing-datasource.component.ts +++ b/src/app/pages/sources/sources-register/register-existing-datasource.component.ts @@ -19,6 +19,7 @@ import { } from '../../../domain/shared-messages'; import { DatasourceUpdateFormComponent } from '../../../shared/reusablecomponents/sources-forms/datasource-update-form.component'; import { RegisterDatasourceSelectExistingComponent } from './register-datasource-select-existing.component'; +import {DatasourceUpdateTermsFormComponent} from "../../../shared/reusablecomponents/sources-forms/datasource-update-terms-form.component"; @Component({ selector: 'app-register-existing-datasource', @@ -63,13 +64,14 @@ export class RegisterExistingDatasourceComponent implements OnInit { @ViewChildren('interfacesArray') interfacesArray: QueryList; dataForInterfaceComp: any[] = []; + @ViewChild('updateTermsForm') + updateTermsForm: DatasourceUpdateTermsFormComponent; + constructor(private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private repoService: RepositoryService) {} - // @ViewChild('updateTermsForm') - ngOnInit() { if (this.datasourceType && this.currentMode) { // will execute getStep() every time there is a change in query params @@ -98,17 +100,14 @@ export class RegisterExistingDatasourceComponent implements OnInit { } else { this.currentStep = 2; } - } else if (stepName === 'finish') { - this.currentStep = 3; - // ToU: to enable ToU delete the 2 lines above and uncomment the section below - /*} else if (stepName === 'termsOfUse') { + } else if (stepName === 'termsOfUse') { if (!this.interfacesArray) { this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=selectDatasource`); } else { this.currentStep = 3; } } else if (stepName === 'finish') { - this.currentStep = 4;*/ + this.currentStep = 4; } } this.rightHelperContent.ngOnInit(); @@ -135,9 +134,7 @@ export class RegisterExistingDatasourceComponent implements OnInit { window.scrollTo(1, 1); } else { if (this.repoInterfaces.length > 0) { - this.registerRepository(); -// ToU: replace above line with the comment below - // this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=termsOfUse`); + this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=termsOfUse`); } else { this.errorMessage = noInterfacesSaved; window.scrollTo(1, 1); @@ -145,9 +142,8 @@ export class RegisterExistingDatasourceComponent implements OnInit { } } ); - // ToU: uncomment these lines - // } else if (this.currentStep === 3) { - // this.registerRepository(); + } else if (this.currentStep === 3) { + this.registerRepository(); } } @@ -162,9 +158,8 @@ export class RegisterExistingDatasourceComponent implements OnInit { of(this.getInterfaces()).subscribe( () => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`) ); - // ToU: uncomment these lines - // } else if (this.currentStep === 3) { - // this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=interfaces`); + } else if (this.currentStep === 3) { + this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=interfaces`); } } @@ -279,6 +274,7 @@ export class RegisterExistingDatasourceComponent implements OnInit { } getUpdatedRepo(repo: Repository) { + console.log('getUpdatedRepo(repo: Repository)'); this.repo = repo; if (this.repoInterfaces.length === 0) { this.getRepoInterfaces(); @@ -320,14 +316,21 @@ export class RegisterExistingDatasourceComponent implements OnInit { ); } + //recheck if needed + getTerms(repo: Repository) { + this.repo = repo; + } + downloadLogo() { window.open('../../../../assets/imgs/3_0ValidatedLogo.png', '_blank', 'enabledstatus=0,toolbar=0,menubar=0,location=0'); } registerRepository() { + console.log('in registerRepository, step ===', this.currentStep); if (this.repo) { this.loadingMessage = 'Saving changes'; this.errorMessage = ''; + console.log('reg this.repo', this.repo); this.repoService.addRepository( this.repo.datasourceType, this.repo).subscribe( response => { console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`); @@ -341,7 +344,6 @@ export class RegisterExistingDatasourceComponent implements OnInit { }, () => { this.saveNewInterfaces(); - // TODO: update terms when backend is ready, maybe POST with updateRepository } ); } diff --git a/src/app/pages/sources/sources-register/register-new-datasource.component.html b/src/app/pages/sources/sources-register/register-new-datasource.component.html index a7b5502e5..5fb2bbd9f 100644 --- a/src/app/pages/sources/sources-register/register-new-datasource.component.html +++ b/src/app/pages/sources/sources-register/register-new-datasource.component.html @@ -38,13 +38,12 @@ @@ -122,25 +121,22 @@ -

    Finish

    - - +

    Terms of Use