Merging terms of use branch
This commit is contained in:
parent
c7e7a28408
commit
3c74f2a381
|
@ -50,26 +50,36 @@
|
|||
<!-- End Matomo Code -->
|
||||
|
||||
|
||||
<!--<!– Terms of Use (modal) –>-->
|
||||
<!--<confirmation-dialog #subscribeToTermsModal [title]=modalTitle [isModalShown]=isModalShown-->
|
||||
<!-- [confirmActionButton]=modalButton (emitObject)="updateTerms()">-->
|
||||
<!-- <form class="" [formGroup]="agreementForm">-->
|
||||
<!-- <div formArrayName="terms">-->
|
||||
<!-- <table class="table">-->
|
||||
<!-- <tr class="uk-text-nowrap">Do you agree with the <a href="https://zenodo.org/record/1446384#.XiGIAdmxU5n" target="_blank">terms of use</a>?</tr>-->
|
||||
<!-- <tbody>-->
|
||||
<!-- <tr class="el-item" *ngFor="let term of terms.controls; let i=index">-->
|
||||
<!--<!– {{term.get('accept').value}}–>-->
|
||||
<!-- <br> {{term.get('name').value}} <br>-->
|
||||
<!-- <div [formGroupName]="i">-->
|
||||
<!-- <label>-->
|
||||
<!-- <input id="i" type="checkbox" formControlName="accept"> Yes, I agree to the terms of use.-->
|
||||
<!-- </label>-->
|
||||
<!-- </div>-->
|
||||
<!-- </tr>-->
|
||||
<!-- </tbody>-->
|
||||
<!-- </table>-->
|
||||
<!-- </div>-->
|
||||
<!-- </form>-->
|
||||
<!-- <!– <pre>{{this.agreementForm.value | json}}</pre>–>-->
|
||||
<!--</confirmation-dialog>-->
|
||||
<!-- Terms of Use (modal) -->
|
||||
<confirmation-dialog #subscribeToTermsModal [title]=modalTitle [isModalShown]=isModalShown
|
||||
[confirmActionButton]=modalButton (emitObject)="updateTerms()">
|
||||
<form class="" [formGroup]="agreementForm">
|
||||
<div formArrayName="terms">
|
||||
<table class="table">
|
||||
<tr>
|
||||
Thanks for being part of OpenAIRE. Please confirm the acceptance of our datasources policy.
|
||||
</tr>
|
||||
<br>
|
||||
<tr>
|
||||
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.
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr class="el-item" *ngFor="let term of terms.controls; let i=index">
|
||||
<br> {{term.get('name').value}} <br>
|
||||
<div [formGroupName]="i">
|
||||
<label>
|
||||
<input id="consentTerms" type="checkbox" formControlName="consentTermsOfUse"> Accept the <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">Terms of Use</a>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
<input id="consentText" type="checkbox" formControlName="fullTextDownload"> Agree to the <a href="https://www.openaire.eu/terms-of-use-for-content-providers#consent" target="_blank">re-use of full texts</a>
|
||||
</label>
|
||||
</div>
|
||||
</tr>
|
||||
</tbody>
|
||||
<p class="uk-text-meta">Note: OpenAIRE will not provide the full text files for public distribution, the users will access from the original datasource.</p>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<!-- <pre>{{this.agreementForm.value | json}}</pre>-->
|
||||
</confirmation-dialog>
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -321,7 +321,7 @@
|
|||
<div style="display: block; text-align: center">
|
||||
<img width="55" src="../../../../assets/imgs/landing/Agreement%20color.svg">
|
||||
</div>
|
||||
<div class="uk-margin-bottom uk-margin-top" style="font-weight: 600">Terms of Agreement for Content Providers</div>
|
||||
<div class="uk-margin-bottom uk-margin-top" style="font-weight: 600">Terms of Use for Content Providers</div>
|
||||
<p>Learn more: <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">https://www.openaire.eu/terms-of-use-for-content-providers</a></p>
|
||||
</div>
|
||||
|
||||
|
@ -752,7 +752,7 @@
|
|||
<div class="uk-first-column">
|
||||
<div class="uk-margin-medium-left uk-margin-medium-top uk-margin-medium-bottom">
|
||||
<img width="55" src="../../../../assets/imgs/landing/Agreement%20color.svg">
|
||||
<div class="uk-margin-bottom uk-margin-top" style="font-weight: 600">Terms of Agreement for Content Providers</div>
|
||||
<div class="uk-margin-bottom uk-margin-top" style="font-weight: 600">Terms of Use for Content Providers</div>
|
||||
<p>Learn more: <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">https://www.openaire.eu/terms-of-use-for-content-providers</a></p>
|
||||
</div>
|
||||
|
||||
|
@ -820,7 +820,7 @@
|
|||
<div class="uk-first-column">
|
||||
<div class="uk-margin-medium-left uk-margin-medium-top uk-margin-medium-bottom">
|
||||
<img width="55" src="../../../../assets/imgs/landing/Agreement%20color.svg">
|
||||
<div class="uk-margin-bottom uk-margin-top" style="font-weight: 600">Terms of Agreement for Content Providers</div>
|
||||
<div class="uk-margin-bottom uk-margin-top" style="font-weight: 600">Terms of Use for Content Providers</div>
|
||||
<p>Learn more: <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">https://www.openaire.eu/terms-of-use-for-content-providers</a></p>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<li class="uk-active" aria-expanded="true"><a href="#">Update Information</a></li>
|
||||
<li aria-expanded="false" class=""><a href="#">Update Interfaces</a></li>
|
||||
<li aria-expanded="false" class=""><a href="#">Update Admins</a></li>
|
||||
<!-- <li aria-expanded="false" class=""><a href="#">Update Terms of Agreement</a></li>-->
|
||||
<li aria-expanded="false" class=""><a href="#">Update Terms of Use</a></li>
|
||||
</ul>
|
||||
<ul id="tabs_anim4" class="uk-switcher uk-margin">
|
||||
<li aria-hidden="false" class="uk-active" style="animation-duration: 200ms;">
|
||||
|
|
|
@ -41,18 +41,15 @@
|
|||
<span class="title">Register interface</span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="tab" class="last {{ (currentStep < 3) ? 'disabled' : '' }} {{ (currentStep == 3) ? 'current' : '' }}" aria-disabled="true">
|
||||
<!-- ToU: replace above line with below line -->
|
||||
<!--<li role="tab" class=" {{ (currentStep < 3) ? 'disabled' : '' }} {{ (currentStep == 3) ? 'current' : '' }}" aria-disabled="true">-->
|
||||
<li role="tab" class=" {{ (currentStep < 3) ? 'disabled' : '' }} {{ (currentStep == 3) ? 'current' : '' }}" aria-disabled="true">
|
||||
<a id="wizard_advanced-t-3" href="#wizard_advanced-h-3" aria-controls="wizard_advanced-p-3">
|
||||
<span class="number">4</span>
|
||||
<!-- ToU: uncomment this section -->
|
||||
<!--<span class="title">Terms of Use</span>
|
||||
<span class="title">Terms of Use</span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="tab" class="last {{ (currentStep < 4) ? 'disabled' : '' }} {{ (currentStep == 4) ? 'current' : '' }}" aria-disabled="true">
|
||||
<a id="wizard_advanced-t-4" href="#wizard_advanced-h-4" aria-controls="wizard_advanced-p-4">
|
||||
<span class="number">5</span>-->
|
||||
<span class="number">5</span>
|
||||
<span class="title">Finish</span>
|
||||
</a>
|
||||
</li>
|
||||
|
@ -131,28 +128,23 @@
|
|||
</section>
|
||||
|
||||
<!-- fourth section -->
|
||||
<h3 id="wizard_advanced-h-3" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Finish</h3>
|
||||
<!-- ToU: replace line above with line below -->
|
||||
<!--<h3 id="wizard_advanced-h-3" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Terms of Use</h3>-->
|
||||
<h3 id="wizard_advanced-h-3" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Terms of Use</h3>
|
||||
<section id="wizard_advanced-p-3" role="tabpanel" aria-labelledby="wizard_advanced-h-3"
|
||||
class="body step-3 {{ (currentStep == 3) ? 'current' : '' }}" data-step="2" aria-hidden="true">
|
||||
|
||||
<div *ngIf="(currentStep === 3) && !loadingMessage" class="row openAIRECompliantLogoDownload">
|
||||
<!-- ToU: replace above 3 lines (starting at class="body step-3) with commented section below -->
|
||||
<!--class="body step-3 {{ (currentStep == 3) ? 'current' : '' }}" data-step="3" aria-hidden="true">
|
||||
class="body step-3 {{ (currentStep == 3) ? 'current' : '' }}" data-step="3" aria-hidden="true">
|
||||
<div *ngIf="(currentStep === 3) && !loadingMessage" class="uk-grid uk-grid-match">
|
||||
<datasource-update-terms-form #updateTermsForm
|
||||
[selectedRepo]="repo"
|
||||
[showButton]=false></datasource-update-terms-form>
|
||||
[showButton]=false
|
||||
(emittedInfo)="getTerms($event)"></datasource-update-terms-form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!– fifth section –>
|
||||
<!-- fifth section -->
|
||||
<h3 id="wizard_advanced-h-4" tabindex="-1" class="title {{ (currentStep == 4) ? 'current' : '' }}">Finish</h3>
|
||||
<section id="wizard_advanced-p-4" role="tabpanel" aria-labelledby="wizard_advanced-h-4"
|
||||
class="body step-4 {{ (currentStep == 4) ? 'current' : '' }}" data-step="3" aria-hidden="true">
|
||||
|
||||
<div *ngIf="(currentStep === 4) && !loadingMessage" class="row openAIRECompliantLogoDownload">-->
|
||||
<div *ngIf="(currentStep === 4) && !loadingMessage" class="row openAIRECompliantLogoDownload">
|
||||
<div class="col-lg-12">
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
|
@ -172,21 +164,8 @@
|
|||
</section>
|
||||
|
||||
</div>
|
||||
<div *ngIf="currentStep != 3" class="actions clearfix">
|
||||
<ul role="menu" aria-label="Pagination">
|
||||
<li class="button_previous {{ (currentStep < 1) ? 'disabled' : '' }}" aria-disabled="true">
|
||||
<a (click)="moveBackAStep()" role="menuitem"><i class="material-icons"></i> Previous</a>
|
||||
</li>
|
||||
<li *ngIf="currentStep < 2" class="button_next" aria-hidden="false" aria-disabled="false">
|
||||
<a (click)="moveAStep()" role="menuitem">Next<i class="material-icons"></i></a>
|
||||
</li>
|
||||
<li *ngIf="currentStep == 2" class="button_finish" aria-hidden="true">
|
||||
<a (click)="moveAStep()" role="menuitem">Finish</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- ToU: replace above <div> with commented section below -->
|
||||
<!--<div *ngIf="currentStep != 4" class="actions clearfix">
|
||||
|
||||
<div *ngIf="currentStep != 4" class="actions clearfix">
|
||||
<ul role="menu" aria-label="Pagination">
|
||||
<li class="button_previous {{ (currentStep < 1) ? 'disabled' : '' }}" aria-disabled="true">
|
||||
<a (click)="moveBackAStep()" role="menuitem"><i class="material-icons"></i> Previous</a>
|
||||
|
@ -198,7 +177,7 @@
|
|||
<a (click)="moveAStep()" role="menuitem">Finish</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -219,4 +198,3 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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<DatasourceNewInterfaceFormComponent>;
|
||||
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
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -38,13 +38,12 @@
|
|||
<li role="tab" class=" {{ (currentStep < 3) ? 'disabled' : '' }} {{ (currentStep == 3) ? 'current' : '' }}" aria-disabled="true">
|
||||
<a id="wizard_advanced-t-2" href="#wizard_advanced-h-2" aria-controls="wizard_advanced-p-2">
|
||||
<span class="number">3</span>
|
||||
<!-- ToU: uncomment this section -->
|
||||
<!--<span class="title">Terms of Use</span>
|
||||
<span class="title">Terms of Use</span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="tab" class=" {{ (currentStep < 4) ? 'disabled' : '' }} {{ (currentStep == 4) ? 'current' : '' }}" aria-disabled="true">
|
||||
<a id="wizard_advanced-t-3" href="#wizard_advanced-h-3" aria-controls="wizard_advanced-p-2">
|
||||
<span class="number">4</span>-->
|
||||
<span class="number">4</span>
|
||||
<span class="title">Finish</span>
|
||||
</a>
|
||||
</li>
|
||||
|
@ -122,25 +121,22 @@
|
|||
</section>
|
||||
|
||||
<!-- third section -->
|
||||
<h3 id="wizard_advanced-h-2" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Finish</h3>
|
||||
<!-- ToU: replace line above with line below -->
|
||||
<!-- <h3 id="wizard_advanced-h-2" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Terms of Use</h3>-->
|
||||
<h3 id="wizard_advanced-h-2" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Terms of Use</h3>
|
||||
<section id="wizard_advanced-p-2" role="tabpanel" aria-labelledby="wizard_advanced-h-2"
|
||||
class="body step-2 {{ (currentStep == 3) ? 'current' : '' }}" data-step="2" aria-hidden="true">
|
||||
<div *ngIf="(currentStep === 3) && !loadingMessage" class="row openAIRECompliantLogoDownload">
|
||||
<!-- ToU: delete line above and uncomment section below -->
|
||||
<!--<div *ngIf="(currentStep === 3) && !loadingMessage" class="uk-grid">
|
||||
<div *ngIf="(currentStep === 3) && !loadingMessage" class="uk-grid">
|
||||
<datasource-update-terms-form #updateTermsForm
|
||||
[selectedRepo]="repo"
|
||||
[showButton]=false></datasource-update-terms-form>
|
||||
[showButton]=false
|
||||
(emittedInfo)="getTerms($event)"></datasource-update-terms-form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!– fourth section –>
|
||||
<!-- fourth section -->
|
||||
<h3 id="wizard_advanced-h-3" tabindex="-1" class="title {{ (currentStep == 4) ? 'current' : '' }}">Finish</h3>
|
||||
<section id="wizard_advanced-p-3" role="tabpanel" aria-labelledby="wizard_advanced-h-3"
|
||||
class="body step-3 {{ (currentStep == 4) ? 'current' : '' }}" data-step="3" aria-hidden="true">
|
||||
<div *ngIf="(currentStep === 4) && !loadingMessage" class="row openAIRECompliantLogoDownload">-->
|
||||
<div *ngIf="(currentStep === 4) && !loadingMessage" class="row openAIRECompliantLogoDownload">
|
||||
<div class="col-lg-12">
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
|
@ -165,21 +161,8 @@
|
|||
</section>
|
||||
|
||||
</div>
|
||||
<div *ngIf="currentStep != 3" class="actions clearfix">
|
||||
<ul role="menu" aria-label="Pagination">
|
||||
<li class="button_previous {{ (currentStep < 1) ? 'disabled' : '' }}" aria-disabled="true">
|
||||
<a (click)="moveBackAStep()" role="menuitem"><i class="material-icons"></i> Previous</a>
|
||||
</li>
|
||||
<li *ngIf="currentStep < 2" class="button_next" aria-hidden="false" aria-disabled="false">
|
||||
<a (click)="moveAStep()" role="menuitem">Next<i class="material-icons"></i></a>
|
||||
</li>
|
||||
<li *ngIf="currentStep == 2" class="button_finish" aria-hidden="true">
|
||||
<a (click)="moveAStep()" role="menuitem">Finish</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- ToU: replace above <div> with commented section below -->
|
||||
<!--<div *ngIf="currentStep != 4" class="actions clearfix">
|
||||
|
||||
<div *ngIf="currentStep != 4" class="actions clearfix">
|
||||
<ul role="menu" aria-label="Pagination">
|
||||
<li class="button_previous {{ (currentStep <= 1) ? 'disabled' : '' }}" aria-disabled="true">
|
||||
<a (click)="moveBackAStep()" role="menuitem"><i class="material-icons"></i> Previous</a>
|
||||
|
@ -191,7 +174,7 @@
|
|||
<a (click)="moveAStep()" role="menuitem">Finish</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -9,6 +9,7 @@ import { DatasourceNewInterfaceFormComponent } from '../../../shared/reusablecom
|
|||
import { from, of } from 'rxjs';
|
||||
import { concatMap } from 'rxjs/operators';
|
||||
import { errorsInInterfaces, formErrorRegisterRepo, noInterfacesSaved } from '../../../domain/shared-messages';
|
||||
import {DatasourceUpdateTermsFormComponent} from "../../../shared/reusablecomponents/sources-forms/datasource-update-terms-form.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-register-new-datasource',
|
||||
|
@ -48,13 +49,14 @@ export class RegisterNewDatasourceComponent implements OnInit {
|
|||
@ViewChildren('interfacesArray') interfacesArray: QueryList<DatasourceNewInterfaceFormComponent>;
|
||||
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) {
|
||||
|
||||
|
@ -80,17 +82,14 @@ export class RegisterNewDatasourceComponent 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.interfacesArray.length === 0) {
|
||||
this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`);
|
||||
} else {
|
||||
this.currentStep = 3;
|
||||
}
|
||||
} else if (stepName === 'finish') {
|
||||
this.currentStep = 4;*/
|
||||
this.currentStep = 4;
|
||||
}
|
||||
}
|
||||
this.rightHelperContent.ngOnInit();
|
||||
|
@ -111,9 +110,7 @@ export class RegisterNewDatasourceComponent implements OnInit {
|
|||
window.scrollTo(1, 1);
|
||||
} else {
|
||||
if (this.repoInterfaces.length > 0) {
|
||||
this.addRepository();
|
||||
// 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);
|
||||
|
@ -121,9 +118,8 @@ export class RegisterNewDatasourceComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
);
|
||||
// ToU: uncomment these lines
|
||||
// } else if ( this.currentStep === 3 ) {
|
||||
// this.addRepository();
|
||||
} else if ( this.currentStep === 3 ) {
|
||||
this.addRepository();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,9 +129,8 @@ export class RegisterNewDatasourceComponent 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`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,14 +205,23 @@ export class RegisterNewDatasourceComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
//recheck if needed
|
||||
getTerms(repo: Repository) {
|
||||
console.log('this.repo', this.repo.consentTermsOfUse, this.repo.fullTextDownload);
|
||||
console.log('repo', repo.consentTermsOfUse, repo.fullTextDownload);
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
downloadLogo() {
|
||||
window.open('../../../../assets/imgs/3_0ValidatedLogo.png', '_blank', 'enabledstatus=0,toolbar=0,menubar=0,location=0');
|
||||
}
|
||||
|
||||
addRepository() {
|
||||
console.log('in addRepository, step ===', this.currentStep);
|
||||
if (this.repo) {
|
||||
this.loadingMessage = 'Saving changes';
|
||||
this.errorMessage = '';
|
||||
console.log('add this.repo', this.repo);
|
||||
this.repoService.addRepository(this.repo.datasourceType, this.repo).subscribe(
|
||||
response => {
|
||||
console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`);
|
||||
|
@ -230,7 +234,6 @@ export class RegisterNewDatasourceComponent implements OnInit {
|
|||
},
|
||||
() => {
|
||||
this.saveNewInterfaces();
|
||||
// TODO: update terms when backend is ready, maybe POST with updateRepository
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { deleteCookie, getCookie } from '../domain/utils';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class AuthenticationService {
|
||||
|
@ -21,7 +22,11 @@ export class AuthenticationService {
|
|||
|
||||
private cookie: string = null;
|
||||
|
||||
isLoggedIn: boolean = false;
|
||||
public isLoggedIn_ = new BehaviorSubject(false);
|
||||
|
||||
public get isLoggedIn() {
|
||||
return this.isLoggedIn_.asObservable();
|
||||
}
|
||||
|
||||
public loginWithState() {
|
||||
console.log(`logging in with state. Current url is: ${this.router.url}`);
|
||||
|
@ -41,8 +46,7 @@ export class AuthenticationService {
|
|||
public logout() {
|
||||
deleteCookie('AccessToken');
|
||||
sessionStorage.clear();
|
||||
this.isLoggedIn = false;
|
||||
|
||||
this.isLoggedIn_.next(false);
|
||||
console.log('logging out, calling:');
|
||||
console.log(`${this.apiUrl}/openid_logout`);
|
||||
|
||||
|
@ -61,7 +65,7 @@ export class AuthenticationService {
|
|||
userInfo => {
|
||||
// console.log('User is still logged in');
|
||||
// console.log(userInfo);
|
||||
this.isLoggedIn = true;
|
||||
this.isLoggedIn_.next(true);
|
||||
},
|
||||
() => {
|
||||
this.logout();
|
||||
|
@ -85,7 +89,7 @@ export class AuthenticationService {
|
|||
sessionStorage.setItem('name', userInfo['name']);
|
||||
sessionStorage.setItem('email', userInfo['email'].trim());
|
||||
sessionStorage.setItem('role', userInfo['role']);
|
||||
this.isLoggedIn = true;
|
||||
this.isLoggedIn_.next(true);
|
||||
// console.log(`the current user is: ${sessionStorage.getItem('name')},
|
||||
// ${sessionStorage.getItem('email')}, ${sessionStorage.getItem('role')}`);
|
||||
},
|
||||
|
@ -95,7 +99,7 @@ export class AuthenticationService {
|
|||
console.log(error);
|
||||
deleteCookie('AccessToken');
|
||||
deleteCookie('AccessToken');
|
||||
this.isLoggedIn = false;
|
||||
this.isLoggedIn_.next(false);
|
||||
this.router.navigate(['/home']);
|
||||
},
|
||||
() => {
|
||||
|
@ -113,7 +117,7 @@ export class AuthenticationService {
|
|||
}
|
||||
);
|
||||
} else {
|
||||
this.isLoggedIn = true;
|
||||
this.isLoggedIn_.next(true);
|
||||
// console.log(`the current user is: ${sessionStorage.getItem('name')},
|
||||
// ${sessionStorage.getItem('email')}, ${sessionStorage.getItem('role')}`);
|
||||
if (this.redirectUrl) {
|
||||
|
@ -128,11 +132,11 @@ export class AuthenticationService {
|
|||
|
||||
public getIsUserLoggedIn() {
|
||||
// todo: probably not all of them are needed
|
||||
return this.isLoggedIn && this.cookie && this.cookie !== '' && sessionStorage.getItem('email') !== null;
|
||||
return this.isLoggedIn_.value && this.cookie && this.cookie !== '' && sessionStorage.getItem('email') !== null;
|
||||
}
|
||||
|
||||
public getUserName() {
|
||||
if (this.isLoggedIn) {
|
||||
if (this.isLoggedIn_.value) {
|
||||
return sessionStorage.getItem('name');
|
||||
} else {
|
||||
return '';
|
||||
|
@ -148,7 +152,7 @@ export class AuthenticationService {
|
|||
}
|
||||
|
||||
public getUserRole() {
|
||||
if (this.isLoggedIn) {
|
||||
if (this.isLoggedIn_.value) {
|
||||
return sessionStorage.getItem('role');
|
||||
} else {
|
||||
return '';
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
Country, MetricsInfo,
|
||||
Repository,
|
||||
RepositoryInterface,
|
||||
RepositorySnippet, RepositorySummaryInfo,
|
||||
RepositorySnippet, RepositorySummaryInfo, TermsOfUse,
|
||||
Timezone,
|
||||
Typology, User
|
||||
} from '../domain/typeScriptClasses';
|
||||
|
@ -85,6 +85,13 @@ export class RepositoryService {
|
|||
return this.httpClient.post<Repository>(url, repoInfo, headerOptions);
|
||||
}
|
||||
|
||||
updateRepositoriesTerms(termsList: any): Observable<TermsOfUse> {
|
||||
const url = `${this.apiUrl}terms`;
|
||||
console.log(`knocking on: ${url}`);
|
||||
console.log(`sending ${JSON.stringify(termsList)}`);
|
||||
return this.httpClient.post<TermsOfUse>(url, termsList, headerOptions);
|
||||
}
|
||||
|
||||
getRepositoriesOfCountry(country: string, mode: string): Observable<RepositorySnippet[]> {
|
||||
const url = `${this.apiUrl}getRepositoriesByCountry/${country}/${mode}`;
|
||||
console.log(`knocking on: ${url}`);
|
||||
|
@ -97,7 +104,6 @@ export class RepositoryService {
|
|||
return this.httpClient.get<RepositorySnippet[]>(url, headerOptions);
|
||||
}
|
||||
|
||||
|
||||
getRepositoryById(id: string): Observable<Repository> {
|
||||
const url = `${this.apiUrl}getRepositoryById/${id}`;
|
||||
console.log(`knocking on: ${url}`);
|
||||
|
@ -110,7 +116,6 @@ export class RepositoryService {
|
|||
return this.httpClient.get<RepositoryInterface[]>(url, headerOptions);
|
||||
}
|
||||
|
||||
|
||||
getUrlsOfUserRepos(): Observable<string[]> {
|
||||
const url = `${this.apiUrl}getUrlsOfUserRepos/0/100/`;
|
||||
console.log(`knocking on: ${url}`);
|
||||
|
|
|
@ -8,18 +8,31 @@
|
|||
<div *ngIf="successMessage" class="uk-alert uk-alert-success">{{ successMessage }}</div>
|
||||
|
||||
<form *ngIf="selectedRepo && !loadingMessage" [formGroup]="agreementForm">
|
||||
<br>
|
||||
<!-- {{agreementForm.get('acceptTerms').value}}-->
|
||||
<div *ngIf="showButton" class="uk-margin-small"> <!-- Update -->
|
||||
<span>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.</span>
|
||||
</div>
|
||||
<div *ngIf="!showButton" class="uk-margin-medium"> <!-- Register -->
|
||||
<span>By registering your data source, you are giving your consent to OpenAIRE to download, transform and enrich the metadata records, publishing them in the OpenAIRE Research Graph.</span>
|
||||
</div>
|
||||
<form-inline>
|
||||
<label><input formControlName="acceptTerms" class="uk-checkbox" type="checkbox" checked> I Agree with the </label>
|
||||
<a href="https://zenodo.org/record/1446384#.XiGIAdmxU5n" target="_blank">OpenAIRE's Terms of Agreement for Content Providers</a>
|
||||
<label><input formControlName="acceptTerms" class="uk-checkbox" type="checkbox" checked
|
||||
[checked]="this.agreementForm.get('acceptTerms').value === true"
|
||||
(change)="emitRepo()">
|
||||
Accept the
|
||||
</label>
|
||||
<a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">Terms of Use</a>
|
||||
</form-inline>
|
||||
<!-- {{agreementForm.get('optOut').value}}-->
|
||||
<form-inline>
|
||||
<label><input formControlName="optOut" class="uk-checkbox" type="checkbox"> I would like to opt out from "data mining of Open Access publications in my repository"</label>
|
||||
<label><input formControlName="textMining" class="uk-checkbox" type="checkbox"
|
||||
[checked]="this.agreementForm.get('textMining').value === true"
|
||||
(change)="emitRepo()">
|
||||
Agree to the <a href="https://www.openaire.eu/terms-of-use-for-content-providers#consent" target="_blank">re-use of full texts</a>
|
||||
</label>
|
||||
</form-inline>
|
||||
<br>
|
||||
<p class="uk-text-meta">Note: OpenAIRE will not provide the full text files for public distribution, the users will access from the original datasource.</p>
|
||||
<div *ngIf="showButton" class="form-group">
|
||||
<button class="uk-button uk-button-primary updateRepoInfoButton" type="button" (click)="updateRepo()">Update Information</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!--<pre>{{agreementForm.value|json}}</pre>-->
|
||||
|
|
|
@ -19,7 +19,7 @@ export class DatasourceUpdateTermsFormComponent implements OnInit {
|
|||
|
||||
agreementForm = this.fb.group({
|
||||
acceptTerms: '',
|
||||
optOut: ''
|
||||
textMining: ''
|
||||
});
|
||||
|
||||
consentTermsOfUseDate: Date;
|
||||
|
@ -38,8 +38,6 @@ export class DatasourceUpdateTermsFormComponent implements OnInit {
|
|||
repoId: string;
|
||||
formSubmitted = false;
|
||||
// updateGroup: FormGroup;
|
||||
termsTick: boolean;
|
||||
dataMiningTick: boolean;
|
||||
readonly updateGroupDefinition = {
|
||||
softwarePlatform : ''
|
||||
};
|
||||
|
@ -52,20 +50,24 @@ export class DatasourceUpdateTermsFormComponent implements OnInit {
|
|||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.selectedRepo);
|
||||
// this.dataMiningTick = false; // until we have an actual value
|
||||
if (this.router.url.indexOf('/sources/update') > -1) {
|
||||
console.log('up');
|
||||
this.termsTick = (this.selectedRepo.consentTermsOfUse ? (this.selectedRepo.consentTermsOfUse === 'true') : true);
|
||||
// this.addTerm(this.selectedRepo.consentTermsOfUse, this.dataMiningTick);
|
||||
|
||||
} else if (this.router.url.indexOf('/sources/register') > -1) {
|
||||
console.log('reg');
|
||||
this.termsTick = true;
|
||||
this.agreementForm.get('acceptTerms').setValue(this.selectedRepo.consentTermsOfUse ? this.selectedRepo.consentTermsOfUse : false);
|
||||
this.agreementForm.get('textMining').setValue(this.selectedRepo.fullTextDownload ? this.selectedRepo.fullTextDownload : false);
|
||||
this.selectedRepo.consentTermsOfUse = this.agreementForm.value.acceptTerms;
|
||||
this.selectedRepo.fullTextDownload = this.agreementForm.value.textMining;
|
||||
// if (this.router.url.indexOf('/sources/update') > -1) {
|
||||
// console.log('update');
|
||||
// } else
|
||||
if (this.router.url.indexOf('/sources/register') > -1) {
|
||||
this.emitRepo();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: review updateRepo when backend is ready to POST terms
|
||||
emitRepo() {
|
||||
this.selectedRepo.consentTermsOfUse = this.agreementForm.value.acceptTerms;
|
||||
this.selectedRepo.fullTextDownload = this.agreementForm.value.textMining;
|
||||
this.emittedInfo.emit(this.selectedRepo);
|
||||
}
|
||||
|
||||
updateRepo() {
|
||||
this.formSubmitted = true;
|
||||
this.errorMessage = '';
|
||||
|
@ -76,6 +78,9 @@ export class DatasourceUpdateTermsFormComponent implements OnInit {
|
|||
if (this.showButton) {
|
||||
this.loadingMessage = formSubmitting;
|
||||
this.errorMessage = '';
|
||||
this.selectedRepo.consentTermsOfUse = this.agreementForm.value.acceptTerms;
|
||||
this.selectedRepo.fullTextDownload = this.agreementForm.value.textMining;
|
||||
this.selectedRepo.consentTermsOfUseDate = new Date(Date.now());
|
||||
this.repoService.updateRepository(this.selectedRepo).subscribe(
|
||||
response => {
|
||||
if (response) {
|
||||
|
|
|
@ -9722,7 +9722,7 @@ div.ganttview .ui-resizable-w {
|
|||
@media only screen and (min-width: 960px) {
|
||||
.wizard > .steps > ul > li {
|
||||
float: left;
|
||||
width: 25%;
|
||||
width: 20%;
|
||||
}
|
||||
}
|
||||
.wizard > .steps > ul > li + li a {
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue