[trunk]: Merging branch 'changeDeposit' into trunk for revisions 54355:54751

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54755 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-02-12 11:15:21 +00:00
parent dfdc601812
commit f57ad6940a
28 changed files with 644 additions and 275 deletions

View File

@ -21,38 +21,24 @@ import {ZenodoInformationClass} from '../utils/zenodoInformation.class';
@Component({
selector: 'deposit-by-subject-result',
templateUrl: 'depositBySubjectResult.component.html'
template: `
<deposit-result [requestFor]="'Research Data'" [piwikSiteId]=piwikSiteId
[zenodoInformation]="zenodoInformation"
[subjectResults]="true" [subject]="subject">
</deposit-result>
`
//templateUrl: 'depositBySubjectResult.component.html'
})
export class DepositBySubjectResultComponent {
@Input() compatibility: string = '';
// Type of entity: Publication or Research Data
@Input() requestFor: string = "Research Data";
@Input() subject: string = "";
@Input() piwikSiteId = null;
public newSubject: string= "";
public fetchDataproviders : FetchDataproviders;
public linkToSearchDataproviders = "";
// url of Zenodo
public zenodo: string;
public page: number = 1;
public status: number;
public routerHelper:RouterHelper = new RouterHelper();
public errorCodes:ErrorCodes = new ErrorCodes();
sub: any;
piwiksub: any;
properties:EnvProperties;
url=null;
@Input() zenodoInformation: ZenodoInformationClass;
public subject: string = "";
properties:EnvProperties;
constructor (private route: ActivatedRoute) {}
constructor (private _router: Router,
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService,
@ -78,13 +64,6 @@ export class DepositBySubjectResultComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.updateUrl(data.envSpecific.baseLink+this._router.url);
this.zenodo = this.properties.zenodo;
this.url = data.envSpecific.baseLink+this._router.url;
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor, this.piwikSiteId).subscribe();
}
if(!this.zenodoInformation.url) {
this.zenodoInformation.url = this.properties.zenodo;
@ -92,69 +71,6 @@ export class DepositBySubjectResultComponent {
if(!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo";
}
});
console.info('depositResult init');
this.sub = this.route.queryParams.subscribe(params => {
this.subject = params['subject'];
this.newSubject = this.subject;
this.searchDataproviders();
});
}
// ngDoCheck() {
// if(this.organizationId == "" || this.organizationId == undefined) {
// this.organizationId = "";
// this.status = this.errorCodes.ERROR;
// }
// }
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
public totalPages(): number {
let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
public searchDataproviders() {
this.subject = this.newSubject;
this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10, this.properties);
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;
}
public goToDeposit() {
if(this.requestFor == "Publications") {
this._router.navigate( ['participate/deposit-publications'] );
} else if(this.requestFor == "Research Data") {
this._router.navigate( ['participate/deposit-datasets'] );
}
}
public pageChange($event) {
this.page = +$event.value;
this.searchDataproviders();
}
private updateDescription(description:string) {
this._meta.updateTag({content:description},"name='description'");
this._meta.updateTag({content:description},"property='og:description'");
}
private updateTitle(title:string) {
var _prefix ="OpenAIRE | ";
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
this._title.setTitle(_title);
this._meta.updateTag({content:_title},"property='og:title'");
}
private updateUrl(url:string) {
this._meta.updateTag({content:url},"property='og:url'");
}
}

View File

@ -17,7 +17,8 @@ import { DepositBySubjectComponent } from './datasets/depositBySubject.component
import {IFrameModule} from '../utils/iframe.module';
import {Schema2jsonldModule} from '../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../sharedComponents/SEO/SEOService.module';
import{SearchPagingModule} from '../searchPages/searchUtils/searchPaging.module';
import {ApprovedByCommunityModule} from '../connect/approvedByCommunity/approved.module';
@NgModule({
@ -30,7 +31,8 @@ import { SEOServiceModule } from '../sharedComponents/SEO/SEOService.module';
SearchResultsModule,
PiwikServiceModule,
HelperModule,
IFrameModule, Schema2jsonldModule, SEOServiceModule
IFrameModule, Schema2jsonldModule, SEOServiceModule,
SearchPagingModule, ApprovedByCommunityModule
],
declarations: [
DepositComponent,

View File

@ -25,18 +25,13 @@ import {ZenodoInformationClass} from './utils/zenodoInformation.class';
<schema2jsonld *ngIf="url" [URL]="url" name="Deposit {{requestFor}}" type="other"></schema2jsonld>
<div class="uk-container uk-margin-top">
<!--div class="uk-article-title custom-article-title">
Deposit {{requestFor}}
</div-->
<div class="uk-article-title custom-article-title uk-margin-bottom">
Deposit {{requestFor}}
</div>
<helper position="top"></helper>
<div class="uk-grid helper-grid">
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
<div class="uk-width-expand">
<div *ngIf="status == errorCodes.LOADING || (status == errorCodes.LOADING && fetchDataproviders.searchUtils.status == errorCodes.LOADING)"
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><span class="loading-gif uk-align-center" ></span>
</div>
<!--div *ngIf="status != errorCodes.LOADING" class="uk-margin-bottom uk-margin-top">
<h3>See if your institution has a repository </h3>
@ -54,72 +49,154 @@ import {ZenodoInformationClass} from './utils/zenodoInformation.class';
</form>
</div-->
<h4 *ngIf=" organization && (fetchDataproviders.searchUtils.status == errorCodes.DONE ||
(fetchDataproviders.searchUtils.status == errorCodes.LOADING && !fetchDataproviders.loadPaging && fetchDataproviders.oldTotalResults > 0))"
class="organization">
<a *ngIf="organization['url']!=''" href="{{organization.url}}" target="_blank">
<span><i class="custom-external"></i>{{organization['name']}}</span>
</a>
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
</h4>
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<h2 *ngIf="organization" class="organization">
<a *ngIf="organization['url']!=''" href="{{organization.url}}" target="_blank">
<span><i class="custom-external"></i>{{organization['name']}}</span>
</a>
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
</h2>
<div *ngIf="subjectResults" class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
<form class= "uk-margin uk-text-center uk-margin-top">
<input type="text" [(ngModel)]="subject" class=" uk-input uk-width-1-2" name="subject" placeholder="Search for classifications..." />
<button class=" uk-button portal-button" type="submit" (click)="newSubject()" >
Search
</button>
</form>
<div *ngIf="subject.length > 0" class=" uk-text-center ">
<span>Keywords: {{subject}}<span>
<a class=" " (click)="subject=''; newSubject()"> <span aria-hidden="true" class="uk-icon-button icon-button-small ">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span>
</a>
</div>
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<p class="uk-text-meta">Please use the information below and contact your repository to deposit your <span class="uk-text-lowercase">{{requestFor}}</span>.</p>
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10">
<!--a [href] = "linkToSearchDataproviders">
View all {{fetchDataproviders.searchUtils.totalResults | number}} results <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span>
</a-->
<a [queryParams]="routerHelper.createQueryParams(['organizationId', 'og'], [organizationId, 'and'])"
routerLinkActive="router-link-active" [routerLink]="linkToSearchDataproviders" class="uk-button uk-button-text">
View all {{fetchDataproviders.searchUtils.totalResults | number}} results
</a>
</div>
<search-result [(results)]="fetchDataproviders.results"
[(status)]= "fetchDataproviders.searchUtils.status"
type="dataprovider" urlParam="datasourceId" [showOrganizations] = false
[custom_class]="'other-results'" [(properties)] =properties>
</search-result>
</div>
<div *ngIf="(fetchDataproviders.searchUtils.totalResults == 0 && status == errorCodes.DONE)
|| status == errorCodes.NOT_FOUND || status == errorCodes.ERROR || status == errorCodes.NOT_AVAILABLE" class = "alert alert-warning">
<div *ngIf="organization">
<span *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR">
An error occured.
</span>
No content providers found for institution:
<a *ngIf="organization['url']!=''" target="_blank" href="{{organization.url}}">
<span>{{organization['name']}} (<i class="custom-external"></i>)</span>
</a>
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
.
</span>
</div>
</div>
<p class="uk-text-meta"
*ngIf=" fetchDataproviders.searchUtils.status == errorCodes.DONE ||
(fetchDataproviders.searchUtils.status == errorCodes.LOADING && !fetchDataproviders.loadPaging && fetchDataproviders.oldTotalResults > 0)">
Please use the information below and contact your repository to deposit your <span class="uk-text-lowercase">{{requestFor}}</span>.
</p>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.DONE ||
(fetchDataproviders.searchUtils.status == errorCodes.LOADING && !fetchDataproviders.loadPaging && fetchDataproviders.oldTotalResults > 0)"
class="uk-align-center uk-margin-remove-bottom">
<search-paging [type]="'content providers'" [(searchUtils)] = "fetchDataproviders.searchUtils" [(results)] = "fetchDataproviders.results"
[(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues"
[loadPaging]="fetchDataproviders.loadPaging" [oldTotalResults]="fetchDataproviders.oldTotalResults">
</search-paging>
</div>
<div *ngIf="status == errorCodes.LOADING || fetchDataproviders.searchUtils.status == errorCodes.LOADING"
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><span class="loading-gif uk-align-center" ></span>
</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.DONE" class=" uk-margin uk-margin-remove-top other-results">
<div *ngFor="let result of fetchDataproviders.results" [title] = "result.compatibilityUNKNOWN ? 'Incompatible content provider' : ''" [class]="'uk-margin-small-top uk-card uk-padding-small uk-animation-fade '+(result.compatibilityUNKNOWN ? 'li-disabled ' : 'uk-card-default' ) ">
<h5>
<span *ngIf="!result.compatibilityUNKNOWN" class="" title ="Compatible Content Provider" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="check" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.1" points="4,10 8,15 17,4"></polyline></svg>
</span>
<a *ngIf="!result.compatibilityUNKNOWN" [queryParams]="{datasourceId: result.id}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
<span *ngIf="result['title'].name" [innerHTML]="result['title'].name"></span>
<span *ngIf="!result['title'].name">[no title available]</span>
</a>
<p *ngIf="result.compatibilityUNKNOWN && result['title'].name" [innerHTML]="result['title'].name"></p>
<p *ngIf="result.compatibilityUNKNOWN && !result['title'].name">[no title available]</p>
</h5>
<approved-by-community [contentProviderId]="result.id"></approved-by-community>
<span *ngIf="result['type'] != undefined && result['type'] != ''" class="uk-label custom-label label-blue label-dataprovider" title="Type"> {{result['type']}}</span>
<span *ngIf="result['compatibility'] != undefined && result['compatibility'] != ''" class="uk-label custom-label label-compatibility" title="Compatibility">{{result.compatibility}}</span>
<div *ngIf="subjectResults && result['organizations'] != undefined && result['organizations'].length > 0">
<span> Organization: </span>
<span *ngFor="let organization of result['organizations'].slice(0,10) let i=index">
<!--a *ngIf="organization.url != undefined" href="{{organization.url}}"-->
<a *ngIf="organization.id" [queryParams]="{organizationId: organization.id}" routerLinkActive="router-link-active" routerLink="/search/organization">
{{organization.name}}</a><span
*ngIf="!organization.id">
{{organization.name}}</span><span
*ngIf="(i < result['organizations'].length-1) && (i < 9)">,</span>
</span>
<span *ngIf="result['organizations'].length > 10">...</span>
</div>
<div *ngIf="status == errorCodes.NOT_FOUND && organizationId != ''">
No organization with ID: {{organizationId}} found.
<div *ngIf="result['countries'] && result['countries'].length > 0">
Country: <span *ngFor="let country of result['countries'].slice(0,10) let i = index">{{country}}{{(i < ( result['countries'].slice(0,10).length-1))?", ":""}}{{(i == result['countries'].slice(0,10).length-1 && result['countries'].length > 10)?"...":""}}</span>
</div>
<div *ngIf="status == errorCodes.ERROR && organizationId != ''">
<div *ngIf="result['websiteURL'] != undefined && result['websiteURL'] != ''">
<span>Website URL: </span>
<span>
<a href="{{result['websiteURL']}}" target="_blank" class="custom-external custom-icon">
{{result['websiteURL']}}
</a>
</span>
</div>
<div *ngIf="result['OAIPMHURL'] != undefined && result['OAIPMHURL'] != ''">
<span>OAI-PMH URL: </span>
<span>
<a href="{{result['OAIPMHURL']}}" target="_blank" class="custom-external custom-icon">
{{result['OAIPMHURL']}}
</a>
</span>
</div>
<div *ngIf="subjectResults && result['subjects'] && result['subjects'].length > 0">
Subject: <span *ngFor="let subject of result['subjects'].slice(0,10) let i = index">{{subject}}{{(i < ( result['subjects'].slice(0,10).length-1))?", ":""}}{{(i == result['subjects'].slice(0,10).length-1 && result['subjects'].length > 10)?"...":""}}</span>
</div>
</div>
</div>
<div *ngIf="!subjectResults">
<div *ngIf="status == errorCodes.NOT_FOUND || status == errorCodes.ERROR ||
status == errorCodes.NOT_AVAILABLE || status == errorCodes.NONE" class = "alert alert-warning">
<div *ngIf="status == errorCodes.NOT_FOUND && organizationId != ''">
No organization with ID: {{organizationId}} found.
</div>
<div *ngIf="status == errorCodes.ERROR && organizationId != ''">
An error occured.
</div>
<span *ngIf="status == errorCodes.NOT_AVAILABLE && organizationId != ''">
Service temprorarily unavailable. Please try again later.
</span>
<div *ngIf="status == errorCodes.NONE">
No ID for organization.
</div>
</div>
</div>
<div *ngIf="status == errorCodes.DONE && fetchDataproviders.searchUtils.status != errorCodes.DONE
&& fetchDataproviders.searchUtils.status != errorCodes.LOADING" class = "alert alert-warning">
<span *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR">
An error occured.
</div>
<span *ngIf="status == errorCodes.NOT_AVAILABLE && organizationId != ''">
</span>
<span *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NOT_AVAILABLE">
Service temprorarily unavailable. Please try again later.
</span>
<div *ngIf="organizationId == ''">
No ID for organization.
<span *ngIf="fetchDataproviders.searchUtils.status == errorCodes.OUT_OF_BOUND">
Requested page out of bounds.
</span>
<div *ngIf="!subjectResults">
No content providers found for institution:
<a *ngIf="organization['url']!=''" target="_blank" href="{{organization.url}}">
<span>{{organization['name']}} (<i class="custom-external"></i>)</span>
</a>
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
.
</div>
<div *ngIf="subjectResults">
No content providers found<span *ngIf="subject != ''"> with classification "{{subject}}"</span>.
</div>
<!--You can still deposit your {{requestFor}} in
<a href="{{zenodo}}" target="_blank">OpenAIRE's Zenodo catch-all repository (<i class="custom-external"></i>)</a>
hosted by CERN.-->
</div>
</div>
<div class="uk-width-1-5">
<helper position="right" before="true"></helper>
@ -132,9 +209,12 @@ import {ZenodoInformationClass} from './utils/zenodoInformation.class';
</div>
</div>
<div *ngIf="fetchDataproviders.results.length > 0" class="uk-card uk-card-default uk-card-body portal-card uk-margin-small-top">
Compatibility is mpla mpla
</div>
<helper position="right" before="false"></helper>
</div>
<!--helper position="right" styleName=" uk-width-1-5"></helper-->
</div>
<button class=" uk-button uk-button-primary uk-margin-small-top" type="submit" (click)="goToDeposit()">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-left" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="13 16 7 10 13 4"></polyline></svg></span> Back
@ -161,12 +241,18 @@ export class DepositResultComponent {
// Id of the new selected organization to be searched
public selectedId: string = "";
@Input() subjectResults: boolean = false;
@Input() subject: string = "";
public status: number;
public warningMessage: string = "";
public fetchDataproviders : FetchDataproviders;
public linkToSearchDataproviders: string = "";
public parameterNames:string[] =[];
public parameterValues:string[] =[];
public routerHelper:RouterHelper = new RouterHelper();
public errorCodes:ErrorCodes = new ErrorCodes();
@ -187,8 +273,9 @@ export class DepositResultComponent {
this.status = this.errorCodes.LOADING;
var description = "Deposit "+this.requestFor;
var title = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor;
var title = "Deposit "+this.requestFor;
var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor;
this.updateTitle(title);
this.updateDescription(description);
@ -210,19 +297,42 @@ export class DepositResultComponent {
console.info('depositResult init');
this.sub = this.route.queryParams.subscribe(params => {
this.organizationId = params['organizationId'];
console.info("Id is :"+this.organizationId);
if(this.organizationId){
this.getOrganizationInfo();
this.fetchDataproviders.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
if(this.subjectResults) {
this.status = this.errorCodes.DONE;
this.subject = params['subject'];
if(!this.subject) {
this.subject = "";
}
this.parameterNames.push('subject');
this.parameterValues.push(this.subject);
this.searchDataprovidersBySubject();
} else {
if(this.organizationId) {
this.searchDataproviders();
} else {
this.organizationId = params['organizationId'];
this.parameterNames.push('organizationId');
this.parameterValues.push(this.organizationId);
console.info("Id is :"+this.organizationId);
if(this.organizationId){
this.getOrganizationInfo();
}
}
this.selectedId = "";
}
this.selectedId = "";
});
}
ngDoCheck() {
if(this.organizationId == "" || this.organizationId == undefined) {
if(!this.subjectResults && (this.organizationId == "" || this.organizationId == undefined)) {
this.organizationId = "";
this.status = this.errorCodes.ERROR;
this.status = this.errorCodes.NONE;
this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE;
}
}
@ -233,24 +343,41 @@ export class DepositResultComponent {
}
}
public newSubject() {
this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "subject": this.subject } } );
}
public searchDataprovidersBySubject() {
this.parameterNames = [];
this.parameterValues = [];
this.parameterNames.push('subject');
this.parameterValues.push(this.subject);
this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.fetchDataproviders.searchUtils.page, this.fetchDataproviders.searchUtils.size, this.properties);
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;
}
private searchDataproviders() {
// if(this.organization != undefined) {
// this.fetchDataproviders.getResults(this.organization.name, false, 1, 10);
// } else if(this.organizationId != undefined) {
this.fetchDataproviders.getResultsForDeposit( this.organizationId,this.requestFor, 1, 10, this.properties);
this.fetchDataproviders.getResultsForDeposit( this.organizationId,this.requestFor, this.fetchDataproviders.searchUtils.page, this.fetchDataproviders.searchUtils.size, this.properties);
//}
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;
}
private getOrganizationInfo () {
console.info("inside getOrganizationInfo of component");
this.fetchDataproviders.oldTotalResults = 0;
this.fetchDataproviders.searchUtils.totalResults = 0;
this._organizationService.getOrganizationInfo(this.organizationId,this.properties).subscribe(
this._organizationService.getOrganizationNameAndUrlById(this.organizationId,this.properties).subscribe(
data => {
if(data == null) {
this.status = this.errorCodes.NOT_FOUND;
this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE;
} else {
this.organization = data.title;
this.organization = data;
this.status = this.errorCodes.DONE;
this.searchDataproviders();
}
@ -258,6 +385,7 @@ export class DepositResultComponent {
err => {
//console.log(err)
this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE;
if(err.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
console.info("not found");

View File

@ -35,7 +35,7 @@ export class DepositPublicationsComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-demo.html";
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
if(!this.zenodoInformation.url) {
this.zenodoInformation.url = this.properties.zenodo;
}

View File

@ -13,7 +13,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10">
<a [queryParams]="paramsForSearchLink"
routerLinkActive="router-link-active" [routerLink]="linkToSearchDataproviders" class="uk-button uk-button-text">
View all {{fetchDataproviders.searchUtils.totalResults | number}} results
View all compatible results
</a>
</div>
<tab-result [(results)]="fetchDataproviders.results"

View File

@ -23,7 +23,9 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
[tableViewLink]="'/search/content-providers-table'"
searchFormClass="compatibleDatasourcesSearchForm">
searchFormClass="compatibleDatasourcesSearchForm"
[mapUrl]="mapUrl" [mapTooltipType]="'repositories'"
[newQueryButton]="false">
</search-page>
`
@ -51,6 +53,7 @@ export class SearchCompatibleDataprovidersComponent {
public resourcesQuery = '((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
public csvParams: string;
public disableForms: boolean = false;
public mapUrl: string;
properties:EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
@ -72,7 +75,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToCompatibleDataProviders
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
});
this.searchPage.refineFields = this.refineFields;
@ -194,7 +197,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
filters.push(filter);
}
return filters;

View File

@ -23,7 +23,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/content-providers'"
searchFormClass="compatibleDatasourcesTableSearchForm"
formPlaceholderText="Search for OpenAIRE Content Providers">
formPlaceholderText="Search for OpenAIRE Content Providers"
[mapUrl]="mapUrl" [mapTooltipType]="'repositories'">
</search-page-table>
`
@ -40,6 +41,7 @@ export class SearchCompatibleDataprovidersTableComponent {
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
public mapUrl: string;
/*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
@ -63,15 +65,16 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProvidersTable;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
});
this.refineFields.push("datasourcecountryname");
this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
this.searchPage.getParametersFromUrl(params);
this._getResults();
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);
this._getResults(params);
});
}
@ -82,7 +85,7 @@ properties:EnvProperties;
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(){
private _getResults(params){
//this.csvParams = this.resourcesQuery+"&type=datasources";
//var errorCodes:ErrorCodes = new ErrorCodes();
@ -99,6 +102,8 @@ properties:EnvProperties;
if(size > 0) {
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders("", null, 1, size, [],this.properties).subscribe(
data => {
this.filters = this.createFilters(data[1], params);
this.searchUtils.totalResults = data[0];
console.info("search Content Providers [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
@ -166,11 +171,20 @@ properties:EnvProperties;
//TODO set filters from
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
private createFilters(data, params):Filter[] {
let length = Array.isArray(data) ? data.length : 1;
var filter_names=["Type","Compatibility","Country"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname","datasourcecountryname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
filter_original_ids.push("datasourcecountryname");
var filter_valueIsExact = [true, true, false];
//this.refineFields = ["relfunder"];
//this.searchPage.refineFields = this.refineFields;
this.searchPage.getParametersFromUrl(params);
var value_names=[
/*[
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
@ -197,14 +211,39 @@ properties:EnvProperties;
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var countries = new Set<String>();
var value_name = [];
var value_original_id = [];
let i, j;
//console.info(data);
for(i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i] : data;
if(resData.countries) {
let length2 = Array.isArray(resData.countries) ? resData.countries.length : 1;
for(j=0; j<length2; j++) {
let datasourceCountry = Array.isArray(resData.countries) ? resData.countries[j] : resData.countries;
if(!countries.has(datasourceCountry)) {
countries.add(datasourceCountry);
value_name.push(datasourceCountry);
value_original_id.push(datasourceCountry.trim());
}
}
}
}
value_names.push(value_name);
value_original_ids.push(value_original_id);
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
for(i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(var j =0 ; j < value_names[i].length;j++){
for(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}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i] };
filters.push(filter);
}
return filters;

View File

@ -22,7 +22,9 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
[tableViewLink]="'/search/entity-registries-table'"
searchFormClass="entityRegistriesSearchForm">
searchFormClass="entityRegistriesSearchForm"
[mapUrl]="mapUrl" [mapTooltipType]="'registries'"
[newQueryButton]="false">
</search-page>
`
@ -54,6 +56,7 @@ export class SearchEntityRegistriesComponent {
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
public resourcesQuery = "((oaftype exact datasource) and(datasourcetypeuiid = other))";
public csvParams: string;
public mapUrl: string;
properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
@ -74,7 +77,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
});
this.searchPage.refineFields = this.refineFields;
@ -186,7 +189,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
filters.push(filter);
}
return filters;

View File

@ -22,7 +22,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/entity-registries'"
searchFormClass="entityRegistriesTableSearchForm"
formPlaceholderText="Search for Registries/ Databases">
formPlaceholderText="Search for Registries/ Databases"
[mapUrl]="mapUrl" [mapTooltipType]="'registries'">
</search-page-table>
`
@ -42,6 +43,7 @@ export class SearchEntityRegistriesTableComponent {
public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS;
public disableForms: boolean = false;
public enableSearchView: boolean = true;
public mapUrl: string;
properties:EnvProperties;
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
@ -55,16 +57,17 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
});
this.refineFields.push("datasourcecountryname");
this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
//this.filters = this.createFilters();
this.searchPage.getParametersFromUrl(params);
this._getResults("", false, this.searchUtils.page);
//this.searchPage.getParametersFromUrl(params);
this._getResults(params, false, this.searchUtils.page);
});
}
@ -75,7 +78,7 @@ properties:EnvProperties;
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(parameters:string,refine:boolean, page: number){
private _getResults(params,refine:boolean, page: number){
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
@ -90,6 +93,8 @@ properties:EnvProperties;
if(size > 0) {
this.subResults = this._searchDataprovidersService.searchEntityRegistries("",null, page, size, [],this.properties).subscribe(
data => {
this.filters = this.createFilters(data[1], params);
this.searchUtils.totalResults = data[0];
console.info("search Entity Registries [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
@ -187,11 +192,18 @@ properties:EnvProperties;
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility"];
var filter_ids=["datasourcetypename","datasourcecompatibilityname"];
private createFilters(data, params):Filter[] {
let length = Array.isArray(data) ? data.length : 1;
var filter_names=["Type","Compatibility","Country"];
var filter_ids=["datasourcetypename","datasourcecompatibilityname","datasourcecountryname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
filter_original_ids.push("datasourcecountryname");
var filter_valueIsExact = [true, true, false];
this.searchPage.getParametersFromUrl(params);
var value_names=[
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
@ -205,14 +217,38 @@ properties:EnvProperties;
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var countries = new Set<String>();
var value_name = [];
var value_original_id = [];
let i, j;
//console.info(data);
for(i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i] : data;
if(resData.countries) {
let length2 = Array.isArray(resData.countries) ? resData.countries.length : 1;
for(j=0; j<length2; j++) {
let datasourceCountry = Array.isArray(resData.countries) ? resData.countries[j] : resData.countries;
if(!countries.has(datasourceCountry)) {
countries.add(datasourceCountry);
value_name.push(datasourceCountry);
value_original_id.push(datasourceCountry.trim());
}
}
}
}
value_names.push(value_name);
value_original_ids.push(value_original_id);
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
for(i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(var j =0 ; j < value_names[i].length;j++){
for(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}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i] };
filters.push(filter);
}
return filters;

View File

@ -23,7 +23,9 @@ import{EnvProperties} from '../../utils/properties/env-properties';
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
searchFormClass="journalsSearchForm">
searchFormClass="journalsSearchForm"
[mapUrl]="mapUrl" [mapTooltipType]="'journals'"
[newQueryButton]="false">
</search-page>
<!--[tableViewLink]="'/search/journals-table'"-->
`
@ -53,6 +55,7 @@ export class SearchJournalsComponent {
//"&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";
public csvParams: string;
public disableForms: boolean = false;
public mapUrl: string;
properties:EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
@ -74,7 +77,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToJournals;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
});
this.searchPage.refineFields = this.refineFields;
@ -189,7 +192,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
filters.push(filter);
}
return filters;

View File

@ -24,7 +24,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/journals'"
searchFormClass="journalsTableSearchForm"
formPlaceholderText="Search for Journals">
formPlaceholderText="Search for Journals"
[mapUrl]="mapUrl" [mapTooltipType]="'journals'">
</search-page-table>
`
@ -41,6 +42,7 @@ export class SearchJournalsTableComponent {
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.JOURNAL_FIELDS;
public mapUrl: string;
properties:EnvProperties;
/*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
@ -64,7 +66,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToJournalsTable;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
});
this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
@ -201,7 +203,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
filters.push(filter);
}
return filters;

View File

@ -0,0 +1,55 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {AlertModal} from '../../utils/modal/alert';
import {ErrorCodes} from '../../utils/properties/errorCodes';
@Component({
selector: 'search-dataprovider-map',
template: `
<!-- <a class="uk-icon" [href]="mapUrl" target="_blank"> -->
<a *ngIf="mapUrl && searchUtils.status != errorCodes.LOADING"
[attr.uk-tooltip]="''" [title]="'Show all '+mapTooltipType+' in map'"
(click)="openMapModal()" class="clickable">
<span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="location" ratio="1"><path fill="none" stroke="#000" stroke-width="1.01" d="M10,0.5 C6.41,0.5 3.5,3.39 3.5,6.98 C3.5,11.83 10,19 10,19 C10,19 16.5,11.83 16.5,6.98 C16.5,3.39 13.59,0.5 10,0.5 L10,0.5 Z"></path><circle fill="none" stroke="#000" cx="10" cy="6.8" r="2.3"></circle></svg>
</span>
</a>
<span *ngIf="mapUrl && (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"
class="cursor-not-allowed ">
<span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="location" ratio="1"><path fill="none" stroke="#000" stroke-width="1.01" d="M10,0.5 C6.41,0.5 3.5,3.39 3.5,6.98 C3.5,11.83 10,19 10,19 C10,19 16.5,11.83 16.5,6.98 C16.5,3.39 13.59,0.5 10,0.5 L10,0.5 Z"></path><circle fill="none" stroke="#000" cx="10" cy="6.8" r="2.3"></circle></svg>
</span>
</span>
<!-- </a> -->
<modal-alert #AlertModalMap>
<i-frame [url]="mapUrl" width="100%" height="900"></i-frame>
</modal-alert>
`
})
export class SearchDataproviderMapComponent {
@Input() searchUtils;
@Input() oldTotalResults:number = 0;
@Input() loadPaging: boolean = true;
@Input() totalResults:number = 0;
@Input() mapUrl: string;
@Input() mapTooltipType: string ="";
@ViewChild(AlertModal) alertModalMap;
public errorCodes:ErrorCodes = new ErrorCodes();
constructor (private route: ActivatedRoute) {}
ngOnInit() {}
ngOnDestroy() {}
openMapModal() {
this.alertModalMap.isOpen = true;
this.alertModalMap.cancelButton = true;
this.alertModalMap.okButton = false;
this.alertModalMap.alertTitle = "Map of Content Providers";
this.alertModalMap.message = "";
this.alertModalMap.cancelButtonText = "Close";
}
}

View File

@ -0,0 +1,24 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchDataproviderMapComponent} from './searchDataproviderMap.component';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {IFrameModule} from '../../utils/iframe.module';
@NgModule({
imports: [
CommonModule, FormsModule, AlertModalModule, IFrameModule
],
declarations: [
SearchDataproviderMapComponent
],
providers:[
],
exports: [
SearchDataproviderMapComponent
]
})
export class SearchDataproviderMapModule { }

View File

@ -6,12 +6,14 @@ import {ReportsService} from '../../services/reports.service';
import {ModalLoading} from '../../utils/modal/loading.component';
import {PiwikService} from '../../utils/piwik/piwik.service';
import{EnvProperties} from '../../utils/properties/env-properties';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import 'rxjs/Rx' ;
@Component({
selector: 'search-download',
template: `
<a class="uk-margin-large-right" *ngIf="totalResults > 0 && totalResults <= csvLimit">
<a uk-tooltip="title: Download results in csv file" class="" *ngIf="totalResults > 0 && totalResults <= csvLimit">
<span class="clickable" (click)="downloadfile(downloadURLAPI+'?type='+type+'&format=csv'+csvParams,type+'-report-'+totalResults)">
<!--a [href]="downloadURLAPI+'s'+'?type='+type+'&format=csv'+csvParams" target="_blank"-->
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
@ -19,8 +21,10 @@ import 'rxjs/Rx' ;
<!--/a-->
</span>
</a>
<span class="uk-margin-large-right cursor-not-allowed" *ngIf="totalResults > csvLimit"
[attr.uk-tooltip]="'pos:right'"
<!--*ngIf="totalResults > csvLimit" -->
<!-- [attr.uk-tooltip]="'pos:right'" -->
<span class="cursor-not-allowed " *ngIf="(!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING) || totalResults > csvLimit"
[attr.uk-tooltip]="'pos:top'"
[title]="'Download up to '+csvLimit+' results'">
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="download" ratio="1"><polyline fill="none" stroke="#000" points="14,10 9.5,14.5 5,10"></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="13.91" x2="9.5" y2="3"></line></svg></span> (CSV)
@ -31,6 +35,9 @@ import 'rxjs/Rx' ;
})
export class SearchDownloadComponent {
@Input() searchUtils;
@Input() oldTotalResults:number = 0;
@Input() loadPaging: boolean = true;
@Input() totalResults:number = 0;
@Input() csvParams: string;
@Input() type: string;
@ -47,6 +54,8 @@ export class SearchDownloadComponent {
@ViewChild('AlertModalCsvError') alertCsvError;
public isPiwikEnabled;
public properties:EnvProperties;
public errorCodes:ErrorCodes = new ErrorCodes();
constructor (private route: ActivatedRoute, private _reportsService: ReportsService, private _piwikService:PiwikService) {}
ngOnInit() {

View File

@ -6,7 +6,7 @@ export class Filter{
public countSelectedValues: number = 0;
public values: Value[] = [];
public filterOperator: string ='or';
public valueIsExact: boolean = true; // for search table view, if value is contained or is equal with column entry
}

View File

@ -38,7 +38,7 @@
<div id="offcanvas-usage" uk-offcanvas>
<div class="uk-offcanvas-bar">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<div class="uk-width-1-1 uk-margin-small-bottom ">
<div class="uk-width-1-1 uk-margin-small-bottom uk-margin-top">
<div *ngIf="countFilters()>0" class="uk-margin-small-bottom">
@ -55,30 +55,30 @@
<a [title]="'Remove '+value.name"(click) = "removeFilter(value, filter) " [class]="((disableForms)?' uk-disabled':' ')+' portal-color '"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
</span></span></a>
<span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" [title]="value.name"></span>
<span *ngIf="!end" class=" ">, </span>
<span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" [title]="value.name"></span><span *ngIf="!end" class=" ">, </span>
</span>
</span>
</div>
</div>
<div class="uk-margin-small-bottom uk-margin-small-top">
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-margin-small-right portal-link '">
Clear All
<div class="uk-margin-small-bottom uk-margin-small-top uk-grid">
<a *ngIf= "showUnknownFilters" class = " portal-link" (click) = "clearFilters() " >Try new Query</a>
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<a *ngIf= "showUnknownFilters" class = " uk-margin-small-right portal-link " (click) = "clearFilters() " >Try new Query</a>
<span *ngIf="tableViewLink" class="uk-margin-medium-right">
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
<span *ngIf="tableViewLink || mapUrl" class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
</div>
<div class="uk-text-large">Filter By:</div>
@ -114,30 +114,30 @@
<a [title]="'Remove '+value.name"(click) = "removeFilter(value, filter) " [class]="((disableForms)?' uk-disabled':' ')+' portal-color '"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
</span></span></a>
<span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" [title]="value.name"></span>
<span *ngIf="!end" class=" ">, </span>
<span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" [title]="value.name"></span><span *ngIf="!end" class=" ">, </span>
</span>
</span>
</div>
</div>
<div class="uk-margin-small-bottom uk-margin-small-top">
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-margin-small-right portal-link '">
<div class="uk-margin-small-bottom uk-margin-small-top uk-grid">
<a *ngIf= "showUnknownFilters" class = " portal-link" (click) = "clearFilters() " >Try new Query</a>
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<a *ngIf= "showUnknownFilters" class = " portal-link uk-margin-small-right " (click) = "clearFilters() " >Try new Query</a>
<span *ngIf="tableViewLink" class="uk-margin-medium-right">
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
</a>
<span *ngIf="tableViewLink || mapUrl" class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
</div>
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)" [(connectCommunityId)]=connectCommunityId></search-filter>
<helper position="left" before="false"></helper>

View File

@ -52,6 +52,9 @@ export class SearchPageComponent {
@Input() openaireLink: string;
@Input() connectCommunityId: string;
@Input() sort: boolean = false;
@Input() mapUrl: string = "";
@Input() mapTooltipType: string ="content providers";
@Input() newQueryButton: boolean = true;
//@Input() sortBy: string = "";
@ViewChild (ModalLoading) loading : ModalLoading ;
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
@ -481,7 +484,9 @@ export class SearchPageComponent {
}
var errorCodes:ErrorCodes = new ErrorCodes();
if(this.queryParameters.keys() && this.searchUtils.totalResults == 0 && this.searchUtils.status !=errorCodes.LOADING ){
this.showUnknownFilters = true;
if(this.newQueryButton) {
this.showUnknownFilters = true;
}
}
return filters;
}

View File

@ -22,12 +22,12 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
import {HelperModule} from '../../utils/helper/helper.module';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import { SearchDataproviderMapModule } from './searchDataproviderMap.module';
@NgModule({
imports: [
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule,
LoadingModalModule, ReportsServiceModule,
LoadingModalModule, ReportsServiceModule, SearchDataproviderMapModule,
SearchPagingModule, SearchResultsPerPageModule, SearchSortingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule, HelperModule, Schema2jsonldModule, SEOServiceModule
],
declarations: [

View File

@ -61,7 +61,7 @@
<div id="offcanvas-usage" uk-offcanvas>
<div class="uk-offcanvas-bar">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<div *ngIf="isFiltered()" class = " ">
<div class = " uk-margin-top ">
<span *ngIf = "searchUtils.keyword.length > 0"><span class="uk-text-bold">Keywords:</span>
<a (click) = "clearKeywords() " title="Remove keywords" [class]="((disableForms)?' uk-disabled':' ')+' portal-color '"><span class=" clickable " aria-hidden="true"><span class="uk-icon ">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
@ -81,7 +81,7 @@
</span>
</span>
</div>
<div class="uk-margin-small-bottom uk-margin-small-top">
<!-- <div class="uk-margin-small-bottom uk-margin-small-top">
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-margin-small-right portal-link '">
Clear All
</a>
@ -94,6 +94,22 @@
</a>
</p>
</div>
</div> -->
<div class="uk-margin-small-bottom uk-margin-small-top uk-grid">
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<span *ngIf="searchViewLink" class="uk-width-expand">
<p>
<span uk-tooltip="title: Table view" class=" uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg>
</span>
<a uk-tooltip="title: List view" routerLinkActive="router-link-active" [class]="(disableForms && !enableSearchView)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</a>
<search-dataprovider-map [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</p>
</span>
</div>
</div>
@ -128,7 +144,7 @@
</span>
</span>
</div>
<div class="uk-margin-small-bottom ">
<!-- <div class="uk-margin-small-bottom ">
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-margin-small-right portal-link '">
Clear All
</a>
@ -141,6 +157,22 @@
</a>
</p>
</div>
</div> -->
<div class="uk-margin-small-bottom uk-margin-small-top uk-grid">
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<span *ngIf="searchViewLink" class="uk-width-expand">
<p>
<span uk-tooltip="title: Table view" class=" uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
<a uk-tooltip="title: List view" routerLinkActive="router-link-active" [class]="(disableForms && !enableSearchView)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</a>
<search-dataprovider-map class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</p>
</span>
</div>
</div>

View File

@ -59,6 +59,8 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
@Input() enableSearchView: boolean = true;
@Input() searchFormClass: string = "searchForm";
@Input() formPlaceholderText = "Type Keywords...";
@Input() mapUrl: string = "";
@Input() mapTooltipType: string ="content providers";
@ViewChild (ModalLoading) loading : ModalLoading ;
private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>();
@ -126,8 +128,10 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
ngAfterViewInit(): void {
try{
$.fn['dataTable'].ext.search.push((settings, data, dataIndex) => {
if (this.filterData(data, this.searchUtils.keyword, this.filters)) {
//console.info(dataIndex+": "+data);
//console.info(this.results);
//if (this.filterData(this.results[dataIndex], this.searchUtils.keyword, this.filters)) {
if(this.filterAll(this.results[dataIndex], this.searchUtils.keyword.toLowerCase(),this.filters)) {
// console.info("filter true (keyword:"+this.searchUtils.keyword+")");
return true;
@ -359,12 +363,13 @@ Transform initial - not filtered results to get the filtered number
var result = results.filter(row=>this.filterAll(row, this.searchUtils.keyword.toLowerCase(),this.filters));
let oldTotal = this.searchUtils.totalResults;
//console.info(result);
this.searchUtils.totalResults = result.length;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
//this.searchUtils.status = errorCodes.NONE;
}
// if(oldTotal != this.searchUtils.totalResults) {
@ -451,9 +456,16 @@ Transform initial - not filtered results to get the filtered number
field = "compatibility";
} else if(filter.title == "Funder") {
field = "funder";
} else if(filter.title == "Country") {
field = "countries";
}
//console.info(row);
console.info("|"+row[field]+"|"+" "+"|"+value.name+"|");
//if(row[field] == value.name) {
if(row[field] &&
((filter.valueIsExact && (row[field].trim() == value.name.trim()))
|| (!filter.valueIsExact && (row[field].includes(value.name))))){
if(row[field] == value.name) {
returnValue = true;
if(filter.filterOperator == "or") {
break;
@ -519,7 +531,9 @@ Transform initial - not filtered results to get the filtered number
}
}
if(row[field].trim() == value.name.trim()) {
//if(row[field].trim() == value.name.trim()) {
if((filter.valueIsExact && (row[field].trim() == value.name.trim()))
|| (!filter.valueIsExact && (row[field].includes(value.name)))){
returnValue = true;
if(filter.filterOperator == "or") {
break;

View File

@ -23,6 +23,7 @@ import {HelperModule} from '../../utils/helper/helper.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import { SearchDataproviderMapModule } from './searchDataproviderMap.module';
@NgModule({
@ -30,7 +31,7 @@ import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, LoadingModalModule,
ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule,
DataTablesModule, SearchFilterModule, PiwikServiceModule, HelperModule, ErrorMessagesModule,
Schema2jsonldModule, SEOServiceModule, SearchResultsPerPageModule
Schema2jsonldModule, SEOServiceModule, SearchResultsPerPageModule, SearchDataproviderMapModule
],
declarations: [
SearchPageTableViewComponent

View File

@ -15,10 +15,17 @@
</a>
</div> -->
<h5 [title] = result.title.accessMode >
<a [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<a *ngIf="!result.compatibilityUNKNOWN" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<p *ngIf="result['title'].name || result.acronym"><span *ngIf="result.acronym">{{result.acronym}}</span><span *ngIf="result.acronym && result['title'].name">-</span><span *ngIf="result['title'].name" [innerHTML]="result['title'].name"></span><span *ngIf="result.code"> ({{result.code}})</span></p>
<p *ngIf="!result['title'].name && !result.acronym">[no title available]<span *ngIf="result.code"> ({{result.code}})</span></p>
</a>
<p *ngIf="result.compatibilityUNKNOWN && result['title'].name"
title="Incompatible content provider" [innerHTML]="result['title'].name">
</p>
<p *ngIf="result.compatibilityUNKNOWN && !result['title'].name"
title="Incompatible content provider" >[no title available]
</p>
</h5>
<div>

View File

@ -24,7 +24,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[piwikSiteId]=piwikSiteId
searchFormClass="datasourcesSearchForm">
searchFormClass="datasourcesSearchForm"
[mapUrl]="mapUrl">
</search-page>
`
@ -52,6 +53,8 @@ export class SearchDataprovidersComponent {
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
pagingLimit = 0;
public mapUrl: string;
properties: EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
@ -67,7 +70,7 @@ properties: EnvProperties;
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToDataProviders;
this.pagingLimit = data.envSpecific.pagingLimit;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=all";
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;

View File

@ -28,6 +28,16 @@ export class OrganizationService {
}
getOrganizationNameAndUrlById(id: string, properties: EnvProperties): any {
console.info("getOrganizationNameById service");
let url = properties.searchAPIURLLAst+"organizations/"+id+"?format=json";
return this.http.get((properties.useCache) ? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json())
.map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])
.map(res => this.parseOrganizationNameAndUrl(res));
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
@ -163,4 +173,23 @@ export class OrganizationService {
}
parseOrganizationNameAndUrl(organization: any): any {
console.info("parseOrganizationNameAndUrl");
let title: {"name": string, "url": string} = {"name": "", "url": ""};
if(organization != null) {
if(organization.hasOwnProperty("websiteurl")) {
title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
title = {"name": organization.legalshortname, "url": ''};
}
if(title.name == '') {
title.name = organization.legalname;
}
}
return title;
}
}

View File

@ -146,9 +146,11 @@ export class SearchDataprovidersService {
let link = properties.searchResourcesAPIURL;
var compatibilities = "";
if(type == "Research Data"){
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
//compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
compatibilities = " and (datasourcecompatibilityid = openaire2.0_data)";
}else if(type == "Publications"){
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
//compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
compatibilities = " and (datasourcecompatibilityid <> openaire2.0_data)";
}
let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+compatibilities+" ":"")+") and (relorganizationid exact "+id+")";
url += "&page="+(page-1)+"&size="+size+"&format=json";
@ -300,9 +302,13 @@ export class SearchDataprovidersService {
result['OAIPMHURL'] = OAIPMHURL;
}
}
result['compatibility'] = this.getDataproviderCompatibility(resData);
let compatibility = this.getDataproviderCompatibility(resData);
result['compatibility'] = compatibility.classname;
if(compatibility.classid == "UNKNOWN") {
result['compatibilityUNKNOWN'] = true;
}
} else {
result['compatibility'] = '';
result['compatibility'] = "";
}
result['websiteURL'] = resData.websiteurl;
@ -335,11 +341,11 @@ export class SearchDataprovidersService {
}
}
getDataproviderCompatibility(resData: any): string {
getDataproviderCompatibility(resData: any): {"classid": string, "classname": string} {
if(resData.hasOwnProperty('openairecompatibility')) {
return resData['openairecompatibility'].classname;
return {"classid": resData['openairecompatibility'].classid, "classname": resData['openairecompatibility'].classname};
} else {
return '';
return {"classid": "", "classname": ""};
}
}

View File

@ -5,7 +5,7 @@ export class SearchResult {
//publications & datasets & orp & organizations:
projects: {"funderShortname": string, "funderName": string, "acronym": string, "title": string, "code": string, "id": string}[];
//datasets & orp & publications
//datasets & orp & publications & software
description: string;
year: string;
embargoEndDate: string;
@ -36,6 +36,7 @@ export class SearchResult {
websiteURL: string;
OAIPMHURL: string;
compatibility: string;
compatibilityUNKNOWN: boolean;
countries: string[];
subjects: string[];

View File

@ -46,12 +46,23 @@ export class EntitiesSearchService {
let url = link+"?query=";
if(keyword!= null && keyword != '' ) {
url += "((oaftype exact organization and deletedbyinference=false and "+
/*url += "((oaftype exact organization and deletedbyinference=false and "+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " +
"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "*/
// in search there is this filter:
//reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*
//url += "((oaftype exact organization and deletedbyinference=false )"+
url += "((oaftype exact organization and deletedbyinference=false and"+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " +
//"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
")";
}
url += "&page=0&size=10";

View File

@ -14,7 +14,8 @@ export class FetchDataproviders {
};
public CSVDownloaded = false;
public csvParams: string;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
constructor ( private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
@ -174,6 +175,9 @@ export class FetchDataproviders {
public getResultsForDeposit(id:string, type:string, page: number, size: number, properties:EnvProperties){
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.results = [];
this.searchUtils.totalResults = 0;
this.loadPaging = false;
if(id != "") {
@ -188,6 +192,20 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number,
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
this.loadPaging = true;
this.oldTotalResults = this.searchUtils.totalResults;
},
err => {
console.log(err);
@ -204,13 +222,20 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number,
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.loadPaging = true;
this.oldTotalResults = 0;
}
);
}
}
public getResultsBySubjectsForDeposit(subject:string, type:string, page: number, size: number, properties:EnvProperties){
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.results = [];
this.searchUtils.totalResults = 0;
this.loadPaging = false;
this._searchDataprovidersService.searchDataProvidersBySubjects(subject,type, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
@ -222,6 +247,19 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
this.loadPaging = true;
this.oldTotalResults = this.searchUtils.totalResults;
},
err => {
console.log(err);
@ -238,6 +276,8 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.loadPaging = true;
this.oldTotalResults = 0;
}
);