Merge branch 'new-api' into develop
This commit is contained in:
commit
096d601d29
|
@ -458,7 +458,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.communityId = (this.community && ConnectHelper.isPrivate(this.community, this.user))?this.community.communityId:null;
|
||||
this.configurationService.initPortal(this.properties, "connect");
|
||||
this.buildConnectMenu(true);
|
||||
if (this.community && this.community.status == "manager") {
|
||||
if (this.community && this.community.isRestricted()) {
|
||||
if (!this.user) {
|
||||
if (typeof location !== 'undefined' && location.pathname.indexOf("user-info") == -1) {
|
||||
this.router.navigate(['/user-info'], {
|
||||
|
@ -473,7 +473,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.router.navigate(['/'], {queryParamsHandling: "merge"});
|
||||
}
|
||||
}
|
||||
} else if (this.community && this.community.status == "hidden") {
|
||||
} else if (this.community && (this.community.isPrivate())) {
|
||||
this.router.navigate([this.properties.errorLink]);
|
||||
} else {
|
||||
this.router.navigate(['/'], this.community && this.community.status ? {queryParamsHandling: "merge"} : {});
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
class="uk-text-background uk-text-small uk-position-top-left uk-padding-small uk-text-uppercase uk-text-bold">
|
||||
Member
|
||||
</div>
|
||||
<div *ngIf="community.status === 'manager'"
|
||||
<div *ngIf="community.isRestricted()"
|
||||
class="uk-position-top-right uk-margin-small-top uk-margin-small-right uk-flex uk-flex-column uk-flex-middle">
|
||||
<icon [name]="visibilityIcon.get('RESTRICTED')" ratio="1.2" [flex]="true"></icon>
|
||||
<span class="uk-text-small uk-text-capitalize">restricted</span>
|
||||
</div>
|
||||
<div *ngIf="community.status === 'hidden'"
|
||||
<div *ngIf="community.isPrivate()"
|
||||
class="uk-position-top-right uk-margin-small-top uk-margin-small-right uk-flex uk-flex-column uk-flex-middle">
|
||||
<icon [name]="visibilityIcon.get('PRIVATE')" ratio="1.2" [flex]="true"></icon>
|
||||
<span class="uk-text-small uk-text-capitalize">private</span>
|
||||
|
|
|
@ -175,7 +175,7 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
let showCommunity: boolean = true;
|
||||
community.isSubscribed = Session.isSubscribedTo('community', community.communityId, this.user);
|
||||
|
||||
if (community['status'] == "hidden" || community['status'] == "manager") {
|
||||
if (community.isPrivate() || community.isRestricted()) {
|
||||
showCommunity = false;
|
||||
}
|
||||
if (showCommunity) {
|
||||
|
@ -193,7 +193,7 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
}
|
||||
|
||||
hasPermission(communityInfo: CommunityInfo) {
|
||||
return communityInfo.status === "all" || (communityInfo.status === "manager" && communityInfo.isManager);
|
||||
return communityInfo.isPublic() || (communityInfo.isRestricted() && communityInfo.isManager);
|
||||
}
|
||||
|
||||
private sort(results: CommunityInfo[]) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'
|
|||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
||||
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||
import {SearchZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
||||
import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
||||
import {Session, User} from '../openaireLibrary/login/utils/helper.class';
|
||||
import {StatisticsForDashboardComponent} from '../statistics/statistics.component';
|
||||
|
@ -156,7 +155,6 @@ export class CommunityComponent {
|
|||
private _searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
|
||||
private _searchCommunityProjectsService: SearchCommunityProjectsService,
|
||||
private _searchResearchResultsService: SearchResearchResultsService,
|
||||
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
|
||||
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private seoService: SEOService,
|
||||
private userManagementService: UserManagementService,
|
||||
|
@ -221,7 +219,7 @@ export class CommunityComponent {
|
|||
this._title.setTitle(community.title);
|
||||
this.subs.push(this._piwikService.trackView(this.properties, community.title).subscribe());
|
||||
if (this.community.zenodoCommunity) {
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity).subscribe(
|
||||
result => {
|
||||
this.masterZenodoCommunity = result;
|
||||
},
|
||||
|
@ -230,14 +228,7 @@ export class CommunityComponent {
|
|||
}
|
||||
));
|
||||
}
|
||||
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
||||
result => {
|
||||
this.zenodoCommunityIdS = result;
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
||||
}
|
||||
));
|
||||
this.zenodoCommunityIdS = this.community.otherZenodoCommunities;
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
@ -12,12 +12,10 @@ import {InviteModule} from '../utils/subscribe/invite/invite.module';
|
|||
import {ManageModule} from '../openaireLibrary/utils/manage/manage.module';
|
||||
|
||||
import {StatisticsModule} from "../statistics/statistics.module";
|
||||
import {
|
||||
SearchZenodoCommunitiesServiceModule
|
||||
} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
|
||||
import {
|
||||
ZenodoCommunitiesServiceModule
|
||||
} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
|
||||
|
||||
import {SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module';
|
||||
import {
|
||||
SearchDataprovidersServiceModule
|
||||
|
@ -47,7 +45,7 @@ import {NoLoadPaging} from '../openaireLibrary/searchPages/searchUtils/no-load-p
|
|||
imports: [
|
||||
CommonModule, FormsModule, RouterModule,
|
||||
SubscribeModule, StatisticsModule, ManageModule, InviteModule,
|
||||
SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, SearchFormModule, SearchDataprovidersServiceModule, SearchProjectsServiceModule,
|
||||
ZenodoCommunitiesServiceModule, SearchFormModule, SearchDataprovidersServiceModule, SearchProjectsServiceModule,
|
||||
SearchResearchResultsServiceModule, SearchResultsModule, CuratorsModule, AffiliationsModule,
|
||||
SEOServiceModule, MatSelectModule, EntitiesSelectionModule,
|
||||
TabsModule, SearchTabModule, ErrorMessagesModule, SafeHtmlPipeModule, ErrorModule,
|
||||
|
|
|
@ -6,9 +6,6 @@ import {ZenodoInformationClass} from "../openaireLibrary/deposit/utils/zenodoInf
|
|||
import {FetchZenodoInformation} from "./utils/fetchZenodoInformation.class";
|
||||
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
|
||||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||
import {
|
||||
SearchZenodoCommunitiesService
|
||||
} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
|
||||
import {Subscriber, Subscription} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
|
@ -33,9 +30,8 @@ export class OpenaireDepositComponent {
|
|||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private _communityService: CommunityService,
|
||||
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
|
||||
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
|
||||
private _communityService: CommunityService) {
|
||||
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService);
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
|
@ -44,7 +40,7 @@ export class OpenaireDepositComponent {
|
|||
if(community) {
|
||||
this.communityId = community.communityId
|
||||
let masterZenodoCommunityId = community.zenodoCommunity;
|
||||
if (masterZenodoCommunityId) {
|
||||
if (masterZenodoCommunityId || (community.otherZenodoCommunities && community.otherZenodoCommunities.length > 0)) {
|
||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
|
||||
} else {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
|
|
|
@ -9,7 +9,6 @@ import {DepositRoutingModule} from "./deposit-routing.module";
|
|||
import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module";
|
||||
|
||||
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
|
||||
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -23,6 +22,6 @@ import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoC
|
|||
OpenaireDepositComponent,
|
||||
],
|
||||
providers: [PreviousRouteRecorder, IsRouteEnabled,
|
||||
ZenodoCommunitiesService, SearchZenodoCommunitiesService]
|
||||
ZenodoCommunitiesService]
|
||||
})
|
||||
export class LibDepositModule { }
|
||||
|
|
|
@ -3,9 +3,6 @@ import {ActivatedRoute} from '@angular/router';
|
|||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
||||
import {
|
||||
SearchZenodoCommunitiesService
|
||||
} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
||||
import {CommunityService} from '../openaireLibrary/connect/community/community.service';
|
||||
|
||||
import {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInformation.class';
|
||||
|
@ -31,8 +28,8 @@ export class OpenaireSearchDataprovidersToDepositComponent {
|
|||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private _communityService: CommunityService, private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
|
||||
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
|
||||
private _communityService: CommunityService) {
|
||||
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService);
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
|
@ -41,7 +38,7 @@ export class OpenaireSearchDataprovidersToDepositComponent {
|
|||
if(community) {
|
||||
this.communityId = community.communityId;
|
||||
let masterZenodoCommunityId = community.zenodoCommunity;
|
||||
if (masterZenodoCommunityId) {
|
||||
if (masterZenodoCommunityId || (community.otherZenodoCommunities && community.otherZenodoCommunities.length > 0)) {
|
||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
|
||||
} else {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
|
|
|
@ -9,14 +9,13 @@ import {SearchDataprovidersToDepositModule} from '../openaireLibrary/deposit/sea
|
|||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard';
|
||||
import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
|
||||
import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
SearchDataprovidersToDepositModule,
|
||||
SearchDataprovidersToDepositRoutingModule,
|
||||
ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule
|
||||
ZenodoCommunitiesServiceModule
|
||||
],
|
||||
declarations: [
|
||||
OpenaireSearchDataprovidersToDepositComponent
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
||||
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
||||
|
||||
import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
|
||||
import {Subscriber} from "rxjs";
|
||||
|
@ -11,8 +10,7 @@ import {Injectable} from "@angular/core";
|
|||
})
|
||||
export class FetchZenodoInformation {
|
||||
private subscriptions = [];
|
||||
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { }
|
||||
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService ) { }
|
||||
|
||||
public ngOnDestroy() {
|
||||
this.clearSubscriptions();
|
||||
|
@ -26,7 +24,7 @@ export class FetchZenodoInformation {
|
|||
});
|
||||
}
|
||||
public getZenodoCommunityNameAndUrlById(masterZenodoCommunityId: string, properties:EnvProperties, zenodoInformation: ZenodoInformationClass){
|
||||
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe(
|
||||
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId).subscribe(
|
||||
result => {
|
||||
console.info("getZenodoCommunityNameAndUrlById", result);
|
||||
var masterZenodoCommunity = result;
|
||||
|
@ -38,22 +36,4 @@ export class FetchZenodoInformation {
|
|||
}
|
||||
));
|
||||
}
|
||||
|
||||
public searchNumberOfZCommunities(communityId: string, properties: EnvProperties, zenodoInformation: ZenodoInformationClass) {
|
||||
this.subscriptions.push(this._searchZenodoCommunitiesService.searchZCommunities(properties,communityId).subscribe (
|
||||
result => {
|
||||
console.info("searchNumberOfZCommunities", result);
|
||||
|
||||
var CommunityIds = result;
|
||||
var totalResults = CommunityIds.length;
|
||||
if(totalResults > 0) {
|
||||
zenodoInformation.shareInZenodoUrl = properties.shareInZenodoPage;
|
||||
console.info(zenodoInformation.shareInZenodoUrl);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.error("list of zenodo communities couldn't be loaded");
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="zenodoSearchUtils.status == errorCodes.LOADING"
|
||||
class="uk-animation-fade uk-margin-large uk-padding-large uk-padding-remove-horizontal" role="alert">
|
||||
<loading></loading>
|
||||
|
@ -86,7 +85,13 @@
|
|||
No zenodo communities found
|
||||
</div>
|
||||
<div class="uk-section">
|
||||
<h6 class="uk-margin-medium-bottom">Other related Zenodo communities</h6>
|
||||
<h6 *ngIf="masterZenodoCommunity" class="uk-margin-medium-bottom">Other related Zenodo communities</h6>
|
||||
<h6 *ngIf="!masterZenodoCommunity" class="uk-margin-medium-bottom">Related Zenodo communities</h6>
|
||||
<div *ngIf="!masterZenodoCommunity" class="uk-margin-top uk-text-center uk-margin-medium-bottom">
|
||||
<a routerLink="/participate/deposit/search" target="_blank" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
|
||||
OpenAIRE Compliant Repositories
|
||||
</a>
|
||||
</div>
|
||||
<no-load-paging *ngIf="communityIds && communityIds.length > size" [type]="'Zenodo communities'"
|
||||
(pageChange)="getCommunities($event)"
|
||||
[page]="page" [pageSize]="size"
|
||||
|
@ -95,36 +100,36 @@
|
|||
<div *ngIf="communityIds && communityIds.length > 0" class="uk-grid uk-grid-medium uk-grid-match uk-child-width-1-2@m uk-margin-top" uk-grid
|
||||
uk-height-match="target: .header, .body">
|
||||
<ng-template ngFor let-item [ngForOf]="communityIds" let-i="index">
|
||||
<div *ngIf="i>=((page-1)*size) && i < communityIds.length && i< this.page * this.size && communities[this.communityIds[i]['zenodoid']]"
|
||||
<div *ngIf="i>=((page-1)*size) && i < communityIds.length && i< this.page * this.size && communities[this.communityIds[i]]"
|
||||
class="uk-animation-fade">
|
||||
<div class="uk-card uk-card-default">
|
||||
<div class="uk-card-body">
|
||||
<div class="header uk-grid uk-grid-medium uk-flex-middle" uk-grid>
|
||||
<div class="uk-width-auto" *ngIf="communities[this.communityIds[i]['zenodoid']].logoUrl">
|
||||
<a target="_blank" [href]="communities[this.communityIds[i]['zenodoid']].link">
|
||||
<img *ngIf="communities[this.communityIds[i]['zenodoid']].logoUrl"
|
||||
src="{{communities[this.communityIds[i]['zenodoid']].logoUrl}}" width="80" height="80" alt="{{communities[this.communityIds[i]['zenodoid']].title}}">
|
||||
<div class="uk-width-auto" *ngIf="communities[this.communityIds[i]].logoUrl">
|
||||
<a target="_blank" [href]="communities[this.communityIds[i]].link">
|
||||
<img *ngIf="communities[this.communityIds[i]].logoUrl"
|
||||
src="{{communities[this.communityIds[i]].logoUrl}}" width="80" height="80" alt="{{communities[this.communityIds[i]].title}}">
|
||||
</a>
|
||||
</div>
|
||||
<div class="uk-width-expand">
|
||||
<h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6">
|
||||
<a class="custom-external uk-link uk-link-heading uk-width-expand" target="_blank"
|
||||
href="{{communities[this.communityIds[i]['zenodoid']].link}}">
|
||||
<span *ngIf="communities[this.communityIds[i]['zenodoid']].title">{{communities[this.communityIds[i]['zenodoid']].title}}</span>
|
||||
<span *ngIf="!communities[this.communityIds[i]['zenodoid']].title">[no name available]</span>
|
||||
href="{{communities[this.communityIds[i]].link}}">
|
||||
<span *ngIf="communities[this.communityIds[i]].title">{{communities[this.communityIds[i]].title}}</span>
|
||||
<span *ngIf="!communities[this.communityIds[i]].title">[no name available]</span>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="uk-text-small uk-margin-small-top">
|
||||
<span class="uk-text-meta">Last update: </span>{{communities[this.communityIds[i]['zenodoid']].date | date:'yyyy/MM/dd'}}
|
||||
<span class="uk-text-meta">Last update: </span>{{communities[this.communityIds[i]].date | date:'yyyy/MM/dd'}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="body uk-margin-top uk-margin-bottom uk-text-small multi-line-ellipsis lines-3"> <!-- uk-height-max-small uk-overflow-auto -->
|
||||
<p *ngIf="communities[this.communityIds[i]['zenodoid']].description" class="uk-margin-remove" [innerHtml]="communities[this.communityIds[i]['zenodoid']].description"></p>
|
||||
<p *ngIf="communities[this.communityIds[i]].description" class="uk-margin-remove" [innerHtml]="communities[this.communityIds[i]].description"></p>
|
||||
</div>
|
||||
<div>
|
||||
<span class="uk-width-expand uk-flex-right">
|
||||
<a [href]="depositLink + communities[this.communityIds[i]['zenodoid']].id" target="_blank" type="submit"
|
||||
<a [href]="depositLink + communities[this.communityIds[i]].id" target="_blank" type="submit"
|
||||
class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<icon name="file_upload" type="outlined" [flex]="true" class="uk-margin-small-right"></icon>
|
||||
|
|
|
@ -3,9 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router';
|
|||
import {Meta, Title} from '@angular/platform-browser';
|
||||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
||||
import {
|
||||
SearchZenodoCommunitiesService
|
||||
} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
||||
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
||||
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
||||
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
|
||||
|
@ -58,7 +55,6 @@ export class ShareInZenodoComponent {
|
|||
private _title: Title,
|
||||
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private _communityService: CommunityService,
|
||||
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
|
||||
private helper: HelperService,
|
||||
private _piwikService: PiwikService,
|
||||
private seoService: SEOService) {
|
||||
|
@ -86,7 +82,7 @@ export class ShareInZenodoComponent {
|
|||
this.community = community;
|
||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||
if (this.masterZenodoCommunityId) {
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId).subscribe(
|
||||
result => {
|
||||
this.masterZenodoCommunity = result;
|
||||
|
||||
|
@ -98,22 +94,14 @@ export class ShareInZenodoComponent {
|
|||
));
|
||||
}
|
||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
||||
result => {
|
||||
this.communityIds = result;
|
||||
this.communityIds = this.community.otherZenodoCommunities;
|
||||
this.zenodoSearchUtils.totalResults = this.communityIds.length;
|
||||
if (this.communityIds.length == 0) {
|
||||
this.zenodoSearchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
this.getCommunities()
|
||||
|
||||
},
|
||||
error => {
|
||||
//console.error("list of zenodo communities couldn't be loaded");
|
||||
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
||||
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
|
||||
} //this.handleError('System error retrieving community profile', error)
|
||||
));
|
||||
|
||||
}
|
||||
}));
|
||||
|
||||
|
@ -154,8 +142,8 @@ export class ShareInZenodoComponent {
|
|||
}));
|
||||
}
|
||||
|
||||
getZenodoCommunityById(zenodoid, openaireId) {
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
|
||||
getZenodoCommunityById(zenodoid) {
|
||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid).subscribe(
|
||||
result => {
|
||||
this.communities[zenodoid] = result;
|
||||
this.zenodoCommunitiesLoadedCount++;
|
||||
|
@ -176,7 +164,7 @@ export class ShareInZenodoComponent {
|
|||
this.zenodoSearchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
//console.error("Zenodo community'"+zenodoid+"' couldn't be loaded");
|
||||
this.handleError("Error getting Zenodo community with id: " + zenodoid + " and openaire id: " + openaireId, error);
|
||||
this.handleError("Error getting Zenodo community with id: " + zenodoid, error);
|
||||
|
||||
}
|
||||
));
|
||||
|
@ -190,7 +178,7 @@ export class ShareInZenodoComponent {
|
|||
this.page = $event.value;
|
||||
for (let i = (this.page - 1) * this.size; i < this.communityIds.length && i < this.page * this.size; i++) {
|
||||
if (!this.communities[this.communityIds[i]["zenodoid"]]) {
|
||||
this.getZenodoCommunityById(this.communityIds[i]["zenodoid"], this.communityIds[i]["id"]);
|
||||
this.getZenodoCommunityById(this.communityIds[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
|
|||
import {ShareInZenodoComponent} from './shareInZenodo.component';
|
||||
import {ShareInZenodoRoutingModule} from './shareInZenodo-routing.module';
|
||||
import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
|
||||
import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
|
||||
|
||||
import {RouterModule} from "@angular/router";
|
||||
import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module";
|
||||
|
@ -21,7 +20,7 @@ import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.modul
|
|||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule,
|
||||
CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule,
|
||||
RouterModule, HelperModule, LoadingModule,
|
||||
PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule
|
||||
],
|
||||
|
|
|
@ -97,7 +97,7 @@ export class MyCommunitiesComponent {
|
|||
}
|
||||
|
||||
hasPermission(communityInfo: CommunityInfo) {
|
||||
return communityInfo.status === "all" || (communityInfo.status === "manager" && communityInfo.isManager);
|
||||
return communityInfo.isPublic() || (communityInfo.isRestricted() && communityInfo.isManager);
|
||||
}
|
||||
|
||||
public getCommunities() {
|
||||
|
@ -122,10 +122,10 @@ export class MyCommunitiesComponent {
|
|||
communitiesResults.forEach((community, index) => {
|
||||
let showCommunity: boolean = true;
|
||||
community.isManager = Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || Session.isManager('community', community.communityId, this.user);
|
||||
if (community['status'] == "hidden") {
|
||||
if (community.isPrivate()) {
|
||||
showCommunity = false;
|
||||
} else {
|
||||
if(!community.isManager && community['status'] == "manager") {
|
||||
if(!community.isManager && community.isRestricted()) {
|
||||
showCommunity = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,9 +175,9 @@ export class SearchCommunitiesComponent {
|
|||
private showCommunities() {
|
||||
let ret: CommunityInfo[] = [];
|
||||
for (let result of this.results) {
|
||||
if (result.status == 'hidden' && result.isManager) {
|
||||
if (result.isPrivate() && result.isManager) {
|
||||
ret.push(result);
|
||||
} else if (result.status == "manager" || result.status == "all") {
|
||||
} else if (result.isRestricted() || result.isPublic()) {
|
||||
ret.push(result);
|
||||
}
|
||||
}
|
||||
|
@ -284,6 +284,7 @@ export class SearchCommunitiesComponent {
|
|||
if (params[filterId]) {
|
||||
values = (StringUtils.URIDecode(params[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1);
|
||||
}
|
||||
console.log(filterId + ": " +values)
|
||||
if (filterId == 'type') {
|
||||
for (let i = 0; i < this.results.length; i++) {
|
||||
if (values.length == 0) {
|
||||
|
@ -302,19 +303,20 @@ export class SearchCommunitiesComponent {
|
|||
if (values.length == 0) {
|
||||
results.push(this.results[i]);
|
||||
} else {
|
||||
// console.log(this.results[i].status, this.results[i].isPublic(),this.results[i].isRestricted(), this.results[i].isPrivate() )
|
||||
for (let value of values) {
|
||||
if (value.replace(/["']/g, "") == 'public') {
|
||||
if (this.results[i].status === 'all') {
|
||||
if (this.results[i].isPublic()) {
|
||||
results.push(this.results[i]);
|
||||
break;
|
||||
}
|
||||
} else if (value.replace(/["']/g, "") == 'restricted') {
|
||||
if (this.results[i].status === 'manager') {
|
||||
if (this.results[i].isRestricted()) {
|
||||
results.push(this.results[i]);
|
||||
break;
|
||||
}
|
||||
} else if (value.replace(/["']/g, "") == 'private') {
|
||||
if (this.results[i].status === 'hidden') {
|
||||
if (this.results[i].isPrivate()) {
|
||||
results.push(this.results[i]);
|
||||
break;
|
||||
}
|
||||
|
@ -381,9 +383,9 @@ export class SearchCommunitiesComponent {
|
|||
}
|
||||
}
|
||||
} else if (this.filters[i].filterId == 'access') {
|
||||
if (results[k].status === 'all') {
|
||||
if (results[k].isPublic()) {
|
||||
this.filters[i].values[0].number++;
|
||||
} else if (results[k].status === 'manager') {
|
||||
} else if (results[k].isRestricted()) {
|
||||
this.filters[i].values[1].number++;
|
||||
} else if (this.user) {
|
||||
this.filters[i].values[2].number++;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import {Component, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
|
||||
import {AdvancedField, Filter, Value} from '../../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class';
|
||||
|
||||
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
|
||||
import {ErrorMessagesComponent} from '../../openaireLibrary/utils/errorMessages.component';
|
||||
import {SearchFields} from '../../openaireLibrary/utils/properties/searchFields';
|
||||
|
@ -14,6 +12,7 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit
|
|||
import {Subscriber} from "rxjs";
|
||||
import {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||
import {SearchResult} from "../../openaireLibrary/utils/entities/searchResult";
|
||||
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
|
||||
|
||||
@Component({
|
||||
selector: 'openaire-search-projects',
|
||||
|
@ -50,8 +49,9 @@ export class OpenaireSearchProjectsComponent {
|
|||
private errorMessages: ErrorMessagesComponent;
|
||||
public columnNames = ['Project', 'GrantId', 'Funder'];
|
||||
public results =[];
|
||||
public originalFilters =[];
|
||||
public originalFunders =[];
|
||||
public filters =[];
|
||||
selectedFunder = null;
|
||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||
subscriptions = [];
|
||||
public searchFields:SearchFields = new SearchFields();
|
||||
|
@ -64,7 +64,6 @@ export class OpenaireSearchProjectsComponent {
|
|||
private communityId: string = '';
|
||||
customFilter: SearchCustomFilter = null;
|
||||
initialLoad = true;
|
||||
public allResults =[];
|
||||
@ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
|
||||
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
|
||||
public fieldIdsMap= this.searchFields.PROJECT_FIELDS;
|
||||
|
@ -88,14 +87,14 @@ export class OpenaireSearchProjectsComponent {
|
|||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
||||
this.searchUtils.page = (page <= 0) ? 1 : page;
|
||||
this.selectedFunder = params["funder"]?StringUtils.unquote(params["funder"]):null;
|
||||
this.searchUtils.validateSize(params['size']);
|
||||
|
||||
this.keyword = decodeURIComponent(params['fv0']?params['fv0']:(params['keyword']?params['keyword']:''));
|
||||
this.selectedFields = [];
|
||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap, this.customFilter, params, "project");
|
||||
if(this.initialLoad) {
|
||||
this.initialLoad = false;
|
||||
this._getResults();
|
||||
this._getCommunityFunders();
|
||||
}else{
|
||||
this._getResults();
|
||||
}
|
||||
|
@ -119,13 +118,18 @@ export class OpenaireSearchProjectsComponent {
|
|||
this.disableForms = true;
|
||||
this.disableRefineForms = true;
|
||||
this.enableSearchView = false;
|
||||
if(this.allResults) {
|
||||
this.subscriptions.push(this._searchProjectsService.searchProjects(this.properties, this.communityId).subscribe(
|
||||
this.subscriptions.push(this._searchProjectsService.searchProjectsWithPaging(this.properties, this.communityId, this.searchUtils.page, this.searchUtils.size, this.searchUtils.keyword, this.selectedFunder, "name" ).subscribe(
|
||||
data => {
|
||||
this.originalFilters = this.createFilters(data).slice(); //copy array
|
||||
this.allResults = this.parseResults(data);
|
||||
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length);
|
||||
this.filterResults();
|
||||
this.searchUtils.totalResults = data['totalElements'];
|
||||
this.filters = this.selectedFunder?this.createFilters([this.selectedFunder]):this.createFilters(this.originalFunders);
|
||||
this.results = this.parseResults(data.content);
|
||||
this.oldTotalResults = data['totalElements'];
|
||||
this.searchUtils.totalResults = data['totalElements'];
|
||||
this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE;
|
||||
this.disableForms = false;
|
||||
this.disableRefineForms = false;
|
||||
this.enableSearchView = true;
|
||||
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||
},
|
||||
err => {
|
||||
this.handleError("Error getting projects for community with id: " + this.communityId, err);
|
||||
|
@ -133,59 +137,41 @@ export class OpenaireSearchProjectsComponent {
|
|||
this.enableSearchView = true;
|
||||
}
|
||||
));
|
||||
}else{
|
||||
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length);
|
||||
this.filterResults();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private createFilters(data):Filter[] {
|
||||
let length = Array.isArray(data) ? data.length : 1;
|
||||
|
||||
var filter_names=["Funder"];
|
||||
var filter_ids=["funder"];
|
||||
var filter_original_ids = ["funder"];
|
||||
|
||||
var value_names=[];
|
||||
var value_original_ids=[];
|
||||
|
||||
var funders = new Set<String>();
|
||||
var value_name = [];
|
||||
var value_original_id = [];
|
||||
let i;
|
||||
for(i=0; i<length; i++) {
|
||||
let resData = Array.isArray(data) ? data[i] : data;
|
||||
if(resData.funder && !funders.has(resData.funder)) {
|
||||
funders.add(resData.funder);
|
||||
value_name.push(resData.funder);
|
||||
value_original_id.push(resData.funder.trim());
|
||||
for(let funder of data) {
|
||||
funders.add(funder);
|
||||
value_name.push(funder);
|
||||
value_original_id.push(funder);
|
||||
}
|
||||
}
|
||||
value_names.push(value_name);
|
||||
value_original_ids.push(value_original_id);
|
||||
|
||||
|
||||
var filters: Filter[] =[];
|
||||
for(i =0 ; i < filter_names.length;i++){
|
||||
if(value_names[i].length > 0) {
|
||||
if(value_name.length > 0) {
|
||||
var values: Value[] = [];
|
||||
for (var j = 0; j < value_names[i].length; j++) {
|
||||
var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: j, selected: false}
|
||||
for (var j = 0; j < value_name.length; j++) {
|
||||
var value: Value = {name: value_name[j], id:value_name[j], number: 0, selected: this.selectedFunder == value_name[j] }
|
||||
values.push(value);
|
||||
}
|
||||
var filter: Filter = {
|
||||
title: filter_names[i],
|
||||
filterId: filter_ids[i],
|
||||
originalFilterId: filter_original_ids[i],
|
||||
title: "Funder",
|
||||
filterId: "funder",
|
||||
originalFilterId: "funder",
|
||||
values: values,
|
||||
countSelectedValues: 0,
|
||||
countSelectedValues: this.selectedFunder?1:0,
|
||||
"filterOperator": 'or',
|
||||
valueIsExact: true,
|
||||
filterType: "checkbox"
|
||||
};
|
||||
filters.push(filter);
|
||||
}
|
||||
}
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
|
@ -203,33 +189,32 @@ export class OpenaireSearchProjectsComponent {
|
|||
}
|
||||
return results;
|
||||
}
|
||||
filterResults(){
|
||||
let results = this.allResults.filter(value => { return value.title.name && value.title.name.toLowerCase().indexOf(this.keyword.toLowerCase()) !=-1 || value.acronym && value.acronym.toLowerCase().indexOf(this.keyword.toLowerCase()) !=-1});
|
||||
let funderFilterValues = [];
|
||||
getFunderFilterValue(){
|
||||
for(let filter of this.filters){
|
||||
if(filter.countSelectedValues > 0){
|
||||
for(let value of filter.values){
|
||||
if(value.selected) {
|
||||
funderFilterValues.push(value.name);
|
||||
return value.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(funderFilterValues.length > 0) {
|
||||
results = results.filter(value => {
|
||||
return funderFilterValues.indexOf(value.funderShortname) != -1
|
||||
});
|
||||
}
|
||||
this.oldTotalResults = results.length;
|
||||
this.searchUtils.totalResults = results.length;
|
||||
this.results = results.slice((this.searchUtils.page - 1) * this.searchUtils.size, this.searchUtils.page *this.searchUtils.size );
|
||||
this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE;
|
||||
this.disableForms = false;
|
||||
this.disableRefineForms = false;
|
||||
this.enableSearchView = true;
|
||||
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||
return null;
|
||||
|
||||
}
|
||||
private handleError(message: string, error) {
|
||||
console.error("Projects simple Search Page: "+message, error);
|
||||
}
|
||||
|
||||
public _getCommunityFunders() {
|
||||
this.subscriptions.push(this._searchProjectsService.getProjectFunders(this.properties, this.communityId).subscribe(
|
||||
data => {
|
||||
this.originalFunders = data
|
||||
this._getResults();
|
||||
},
|
||||
err => {
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue