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';
0 " class="suggestions" >
Loading...
- - 0 " class="list-group-item" >
+
- 0 " class="list-group-item" >
Select:
-
@@ -35,7 +35,7 @@ import {EntitiesSearchService} from '../services/entitySearch.service';
0" class="alert alert-warning row-fluid " role="alert"> {{warningMessage}}
-
=3 " class="alert alert-info row-fluid " role="alert"> No results found
+
=3 " class="alert alert-info row-fluid " role="alert"> No results found
@@ -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;
+ }