Add connect/community and results directories, Move community.service, communityInfo and resultInfo in openaireLibrary

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51075 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-03-07 11:07:19 +00:00
parent cabb1d9550
commit 295bc21b4b
12 changed files with 11 additions and 139 deletions

View File

@ -5,7 +5,7 @@ import {ActivatedRoute} from '@angular/router';
import { EnvProperties} from './openaireLibrary/utils/properties/env-properties';
import{MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import {CommunityService} from "./utils/services/community.service";
import {CommunityService} from "./openaireLibrary/connect/community/community.service";
@Component({

View File

@ -21,7 +21,7 @@ import { ErrorModule} from './openaireLibrary/error/error.module';
import { OpenaireErrorPageComponent } from './error/errorPage.component';
import { AppRoutingModule } from './app-routing.module';
import { CommunityService } from './utils/services/community.service';
import { CommunityService } from './openaireLibrary/connect/community/community.service';
import { CommunitiesService } from './communities/communities.service';
//import { LibSearchProjectsModule } from './searchPages/simple/searchProjects.module';

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { CommunityInfo } from '../utils/communityInfo';
import { CommunityInfo } from '../openaireLibrary/connect/community/communityInfo';
@Injectable()
export class CommunitiesService {

View File

@ -7,7 +7,7 @@ import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {Properties} from '../utils/properties';
import {CommunityService} from "../utils/services/community.service";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';

View File

@ -11,7 +11,7 @@ import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {SearchEntriesService} from '../searchEntries/searchEntries.service';
import { CommunityService } from '../utils/services/community.service';
import { CommunityService } from '../openaireLibrary/connect/community/community.service';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';

View File

@ -1,9 +0,0 @@
export class ResultInfo {
title: string;
id: string;
accessRights: string;
authors: string[];
year: string;
description: string;
type: string;
}

View File

@ -1,6 +1,6 @@
import {Component, Input} from '@angular/core';
import { ResultInfo } from './resultInfo';
import { CommunityInfo } from '../../utils/communityInfo';
import { ResultInfo } from '../../openaireLibrary/connect/results/resultInfo';
import { CommunityInfo } from '../../openaireLibrary/connect/community/communityInfo';
@Component({
selector: 'results-comp',

View File

@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { ResultInfo } from './results/resultInfo';
import { CommunityInfo } from '../utils/communityInfo';
import { ResultInfo } from '../openaireLibrary/connect/results/resultInfo';
import { CommunityInfo } from '../openaireLibrary/connect/community/communityInfo';
@Injectable()
export class SearchEntriesService {

View File

@ -8,7 +8,7 @@ import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {Properties} from '../utils/properties';
import {CommunityService} from "../utils/services/community.service";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {CommunitiesService} from "../communities/communities.service";
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';

View File

@ -6,7 +6,7 @@ import { RouterModule } from '@angular/router';
import{StatisticsRoutingModule} from './statistics-routing.module';
import{StatisticsComponent} from './statistics.component';
import { StatisticsService } from '../utils/services/statistics.service';
import { CommunityService } from '../utils/services/community.service';
import { CommunityService } from '../openaireLibrary/connect/community/community.service';
import { CommunitiesService } from '../communities/communities.service';
import {IFrameModule} from '../openaireLibrary/utils/iframe.module';

View File

@ -1,11 +0,0 @@
export class CommunityInfo {
title: string;
shortTitle:string;
communityId: string;
queryId: string;
logoUrl: string;
description: string;
managers: string[];
date:Date;
subjects: string[];
}

View File

@ -1,108 +0,0 @@
import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { ResultInfo } from '../../searchEntries/results/resultInfo';
import { CommunityInfo } from '../communityInfo';
@Injectable()
export class CommunityService {
constructor(private http:Http) {
}
getCommunity(url: string) {
return this.http.get(url).map(res => <any> res.json()).map(res => this.parseCommunity(res));
}
parseCommunity(data:any): CommunityInfo {
let length = Array.isArray(data) ? data.length :1;
for (let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i] : data;
var community: CommunityInfo = new CommunityInfo();
if(Array.isArray(resData)) {
community['title'] = resData[0].name;
community['shortTitle'] = resData[0].shortName;
community['communityId'] = resData[0].id;
community['queryId'] = resData[0].queryId;
community['logoUrl'] = resData[0].logoUrl;
community['description'] = resData[0].description;
community['date'] = resData[0].creationDate;
if(resData[0].managers != null) {
if(community['managers'] == undefined) {
community['managers'] = new Array<string>();
}
let managers = resData[0].managers;
let length = Array.isArray(managers) ? managers.length : 1;
for(let i=0; i<length; i++) {
let manager = Array.isArray(managers) ? managers[i] : managers;
community.managers[i] = manager;
}
}
if(resData[0].subjects != null) {
if(community['subjects'] == undefined) {
community['subjects'] = new Array<string>();
}
let subjects = resData[0].subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
community.subjects[i] = subject;
}
}
} else if(!Array.isArray(resData)) {
community['title'] = resData.name;
community['shortTitle'] = resData.shortName;
community['communityId'] = resData.id;
community['queryId'] = resData.queryId;
community['logoUrl'] = resData.logoUrl;
community['description'] = resData.description;
community['date'] = resData.creationDate;
if(resData.managers != null) {
if(community['managers'] == undefined) {
community['managers'] = new Array<string>();
}
let managers = resData.managers;
let length = Array.isArray(managers) ? managers.length : 1;
for(let i=0; i<length; i++) {
let manager = Array.isArray(managers) ? managers[i] : managers;
community.managers[i] = manager;
}
}
if(resData.subjects != null) {
if(community['subjects'] == undefined) {
community['subjects'] = new Array<string>();
}
let subjects = resData.subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
community.subjects[i] = subject;
}
}
}
}
return community;
}
}