diff --git a/portal-2/src/app/deposit/deposit.component.ts b/portal-2/src/app/deposit/deposit.component.ts index 7f6fad8c..75a671e5 100644 --- a/portal-2/src/app/deposit/deposit.component.ts +++ b/portal-2/src/app/deposit/deposit.component.ts @@ -34,7 +34,15 @@ import {SearchOrganizationsService} from '../services/searchOrganizations.servic

Locate data provider via your institution

+
+ +
+ +
+
@@ -85,6 +95,7 @@ export class DepositComponent { public status: number; public errorCodes:ErrorCodes = new ErrorCodes(); + public selectedId = ""; constructor (private _router: Router, private _searchOrganizationsService: SearchOrganizationsService) { @@ -122,11 +133,19 @@ export class DepositComponent { } organizationSelected(id: string) { - if(this.requestFor == "Publications") { - this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } ); - } else if(this.requestFor == "Datasets") { - console.info("call deposit result for datasets") - this._router.navigate( ['deposit-datasets-result'], { queryParams: { "organizationId": id } } ); + if(id && id.length > 0){ + + + if(this.requestFor == "Publications") { + this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } ); + } else if(this.requestFor == "Datasets") { + console.info("call deposit result for datasets") + this._router.navigate( ['deposit-datasets-result'], { queryParams: { "organizationId": id } } ); + } } } + + valueChanged($event){ + this.selectedId = $event.value; + } } diff --git a/portal-2/src/app/landingPages/showTitle.component.ts b/portal-2/src/app/landingPages/showTitle.component.ts index a4c5295f..b7bb72a3 100644 --- a/portal-2/src/app/landingPages/showTitle.component.ts +++ b/portal-2/src/app/landingPages/showTitle.component.ts @@ -4,7 +4,7 @@ import {Component, Input} from '@angular/core'; @Component({ selector: 'showTitle', template: ` -

+

@@ -15,7 +15,7 @@ import {Component, Input} from '@angular/core';

` - + }) export class ShowTitleComponent { diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts index 5e263047..01ef22f4 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts @@ -12,7 +12,7 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
  • -

    +

    diff --git a/portal-2/src/app/services/dataset.service.ts b/portal-2/src/app/services/dataset.service.ts index 4f8e68ec..7e5ef4fd 100644 --- a/portal-2/src/app/services/dataset.service.ts +++ b/portal-2/src/app/services/dataset.service.ts @@ -66,9 +66,11 @@ export class DatasetService { } this.datasetInfo.embargoEndDate = data[0].embargoenddate; } - + this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""}; + if(data[0]['bestlicense'].hasOwnProperty("classid")) { + this.datasetInfo.title.accessMode = data[0]['bestlicense'].classid; + } if(data[1] != null) { - this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""}; if(Array.isArray(data[1])) { this.datasetInfo.title['name'] = data[1][0].content; } else { diff --git a/portal-2/src/app/services/entitySearch.service.ts b/portal-2/src/app/services/entitySearch.service.ts index 385fe69f..41cb409a 100644 --- a/portal-2/src/app/services/entitySearch.service.ts +++ b/portal-2/src/app/services/entitySearch.service.ts @@ -22,6 +22,33 @@ export class EntitiesSearchService { return this.parse(request,"oaf:project","project"); }); } + searchByDepositType(keyword:string, DepositType:string):any { + console.info("In searchOrganizationsforDeposit"); + + let link = OpenaireProperties.getSearchResourcesAPIURL(); + + let url = link+"?query="; + if(keyword!= null && keyword != '' ) { + 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=*))"+ + " and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " + + // "and " + this.quote(params) + " " + + "and (collectedfromdatasourcename exact "+DepositType+")) " + + } + + url += "&page=0&size=10"; + url += "&format=json"; + + // let url = OpenaireProperties. getSearchAPIURLLast()+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json"; + return this.http.get(url).toPromise() + .then(request => + { + request = request.json().results; + console.log(request); + return this.parse(request,"oaf:organization","organization"); + }); + } searchByType(keyword:string,type:string){ if (type == "project"){ return this.searchEntity(keyword,"projects","oaf:project","project"); @@ -91,24 +118,7 @@ private fetch (link,id,oafEntityType,type){ } - // private search (link,keyword,oafEntityType,type){ - // let url = link+"?"; - // if(keyword!= null && keyword != '' ) { - // url += "q="+ keyword; - // } - // - // url += "&page=0&size="+10+"&format=json"; - // return this.http.get(url) - // .map(res => res.json().results) - // .map(res => this.parse(res,oafEntityType,type)); - // // .then(request => - // // { - // // request = request.json().results; - // // return this.parse(request,oafEntityType,type); - // // }); - // - // - // } + private parse(data: any,oafEntityType:string, type:string){ var array:any =[] let length = Array.isArray(data) ? data.length : 1; @@ -130,13 +140,16 @@ private fetch (link,id,oafEntityType,type){ value.label = resData["fullname"]; } }else if(resData["legalname"]){ + if(Array.isArray(resData["legalname"])) { value.label = resData["legalname"][0]; } else { value.label = resData["legalname"]; } + } - value.id = length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; + value.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; + if(type=="project"){ value.projectAcronym = resData['acronym']; value.projectName = value.label; @@ -152,6 +165,7 @@ private fetch (link,id,oafEntityType,type){ } array.push(value); } + console.info("Parsing results.... Size:"+array.length); return array; } diff --git a/portal-2/src/app/services/publication.service.ts b/portal-2/src/app/services/publication.service.ts index 53b38247..1b7a7d5e 100644 --- a/portal-2/src/app/services/publication.service.ts +++ b/portal-2/src/app/services/publication.service.ts @@ -64,8 +64,11 @@ export class PublicationService { this.publicationInfo.embargoEndDate = data[0].embargoenddate; } + this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""}; + if(data[0]['bestlicense'].hasOwnProperty("classid")) { + this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid; + } if(data[1] != null) { - this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""}; if(Array.isArray(data[1])) { this.publicationInfo.title['name'] = data[1][0].content; diff --git a/portal-2/src/app/utils/entitiesAutoComplete.component.ts b/portal-2/src/app/utils/entitiesAutoComplete.component.ts index 68a6efbd..831dc46b 100644 --- a/portal-2/src/app/utils/entitiesAutoComplete.component.ts +++ b/portal-2/src/app/utils/entitiesAutoComplete.component.ts @@ -25,7 +25,7 @@ import {EntitiesSearchService} from '../services/entitySearch.service';

      -
    • +
    • Select:
    • @@ -35,7 +35,7 @@ import {EntitiesSearchService} from '../services/entitySearch.service';
    - +
    @@ -70,13 +70,17 @@ export class EntitiesAutocompleteComponent { @Input() public funderId:string; @Input() public entityType:string ; + @Input() public depositType:string ; constructor (private _search:EntitiesSearchService, private myElement: ElementRef) { + } ngOnInit () { + console.info("init deposit org" +this.entityType +" "+this.depositType); + if(this.entityType == "project" && this.funderId ){ this.filtered = this.searchTermStream .debounceTime(300).distinctUntilChanged() @@ -86,6 +90,19 @@ export class EntitiesAutocompleteComponent { this.numFilteredResults = results.length; return results; }); + }else if(this.entityType == "organization" && this.depositType ){ + console.info("init deposit org") + this.filtered = this.searchTermStream + .debounceTime(300).distinctUntilChanged() + .switchMap((term: string) => { + var results = this._search.searchByDepositType(term, this.depositType); + this.showLoading = false; + this.numFilteredResults = results.length; + console.info("deposit org::: Resuults"+results.length) + + return results; + }); + }else{ this.filtered = this.searchTermStream @@ -96,18 +113,7 @@ export class EntitiesAutocompleteComponent { this.numFilteredResults = results.length; return results; }); - // this.filtered = - // this.searchTermStream - // .debounceTime(300).distinctUntilChanged() - // .switchMap((term: string) => { - // var results = this._search.searchByType(term, this.entityType); - // this.showLoading = false; - // return results; - // }); - // - // .subscribe(term => this.wikipediaService.search(term).then(items => this.items = items)); - // // } this.getSelectedNameFromGivenId(); } diff --git a/portal-2/src/assets/closedAccess.png b/portal-2/src/assets/closedAccess.png new file mode 100644 index 00000000..b1d033ce Binary files /dev/null and b/portal-2/src/assets/closedAccess.png differ diff --git a/portal-2/src/assets/logo.png b/portal-2/src/assets/logo.png deleted file mode 100644 index afea237f..00000000 Binary files a/portal-2/src/assets/logo.png and /dev/null differ diff --git a/portal-2/src/assets/openAccess.png b/portal-2/src/assets/openAccess.png new file mode 100644 index 00000000..2b94251d Binary files /dev/null and b/portal-2/src/assets/openAccess.png differ diff --git a/portal-2/src/index.html b/portal-2/src/index.html index 00e6dae0..1490daa1 100644 --- a/portal-2/src/index.html +++ b/portal-2/src/index.html @@ -23,6 +23,15 @@ .search-form {margin:5px; } .clickable { cursor:pointer; } + .OPEN { + background: rgba(0, 0, 0, 0) url("/assets/openAccess.png") no-repeat scroll right center; + padding-right: 18px; + } + + .EMBARGO, .CLOSED, .RESTRICTED { + background: rgba(0, 0, 0, 0) url("/assets/closedAccess.png") no-repeat scroll right center; + padding-right: 18px; + }