diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.html b/portal-2/src/app/landingPages/dataset/dataset.component.html
index 964acdb5..81df17bb 100644
--- a/portal-2/src/app/landingPages/dataset/dataset.component.html
+++ b/portal-2/src/app/landingPages/dataset/dataset.component.html
@@ -171,21 +171,29 @@
*ngFor="let key of datasetInfo.downloadFrom.keys() let i=index" >
@@ -202,13 +210,57 @@
+ 0">
+
+ - Published in
+ -
+
+
+ -
+
+ View less
+
+
+ - 5">...
+ - 5" class="uk-text-right">
+
+ View more
+
+
+
+
0">
- Funded By
-
-
();
- }
-
- counter2 = this.datasetInfo.downloadFrom.get(key)['url'].length;
- this.datasetInfo.downloadFrom.get(key)['url'][counter2] = url;
-
- if(this.datasetInfo.downloadFrom.get(key)['accessMode'] == null) {
- this.datasetInfo.downloadFrom.get(key)['accessMode'] = new Array();
- }
-
- if(mydata.hasOwnProperty("licence")) {
- this.datasetInfo.downloadFrom.get(key)['accessMode'].push(mydata['licence'].classid);
- //this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = mydata['licence'].classid;
-
- switch (this.datasetInfo.downloadFrom.get(key)['bestAccessMode']) {
- case null:
- this.datasetInfo.downloadFrom.get(key)['bestAccessMode'] = mydata['licence'].classid;
- break;
- case "CLOSED":
- if(mydata['licence'].classid == "OPEN" ||
- mydata['licence'].classid == "EMBARGO" ||
- mydata['licence'].classid == "RESTRICTED") {
- this.datasetInfo.downloadFrom.get(key)['bestAccessMode'] = mydata['licence'].classid;
- }
- break;
- case "RESTRICTED":
- if(mydata['licence'].classid == "OPEN" ||
- mydata['licence'].classid == "EMBARGO") {
- this.datasetInfo.downloadFrom.get(key)['bestAccessMode'] = mydata['licence'].classid;
- }
- break;
- case "EMBARGO":
- if(mydata['licence'].classid == "OPEN") {
- this.datasetInfo.downloadFrom.get(key)['bestAccessMode'] = mydata['licence'].classid;
- }
- break;
- }
- } else {
- //this.datasetInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = "";
- this.datasetInfo.downloadFrom.get(key)['accessMode'].push("");
- }
+ this.parsingFunctions.parseDownloadFrom(this.datasetInfo.downloadFrom, mydata, url);
} else {
- if(data[0] != null && data[0].hasOwnProperty("source")) {
- let key: string;
- if(Array.isArray(data[0].source)) {
- if(!this.datasetInfo.publishedIn.has(data[0]['source'][counter1])) {
- key = data[0]['source'][counter1];
- }
- } else {
- if(!this.datasetInfo.publishedIn.has(data[0]['source'])) {
- key = data[0]['source'];
- }
- }
-
- this.datasetInfo.publishedIn.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
-
- if(this.datasetInfo.publishedIn.get(key)['url'] == null) {
- this.datasetInfo.publishedIn.get(key)['url'] = new Array();
- }
-
- counter2 = this.datasetInfo.publishedIn.get(key)['url'].length;
- this.datasetInfo.publishedIn.get(key)['url'][counter2] = url;
-
- if(this.datasetInfo.publishedIn.get(key)['accessMode'] == null) {
- this.datasetInfo.publishedIn.get(key)['accessMode'] = new Array();
- }
-
- if(mydata.hasOwnProperty("licence")) {
- //this.datasetInfo.publishedIn.get(key)['accessMode'][counter2] = mydata['licence'].classid;
- this.datasetInfo.publishedIn.get(key)['accessMode'].push(mydata['licence'].classid);
- switch (this.datasetInfo.publishedIn.get(key)['bestAccessMode']) {
- case null:
- this.datasetInfo.publishedIn.get(key)['bestAccessMode'] = mydata['licence'].classid;
- break;
- case "CLOSED":
- if(mydata['licence'].classid == "OPEN" ||
- mydata['licence'].classid == "EMBARGO" ||
- mydata['licence'].classid == "RESTRICTED") {
- this.datasetInfo.publishedIn.get(key)['bestAccessMode'] = mydata['licence'].classid;
- }
- break;
- case "RESTRICTED":
- if(mydata['licence'].classid == "OPEN" ||
- mydata['licence'].classid == "EMBARGO") {
- this.datasetInfo.publishedIn.get(key)['bestAccessMode'] = mydata['licence'].classid;
- }
- break;
- case "EMBARGO":
- if(mydata['licence'].classid == "OPEN") {
- this.datasetInfo.publishedIn.get(key)['bestAccessMode'] = mydata['licence'].classid;
- }
- break;
- }
- } else {
- //this.datasetInfo.publishedIn.get(key)['accessMode'][counter2] = "";
- this.datasetInfo.publishedIn.get(key)['accessMode'].push("");
- }
- counter1++;
- }
+ counter1 = this.parsingFunctions.parsePublishedIn(this.datasetInfo.publishedIn, mydata, data[0], url, counter1);
}
if(this.datasetInfo.title != undefined) {
if(this.datasetInfo.title['url'] == undefined) {
diff --git a/portal-2/src/app/landingPages/landing-utils/parsingFunctions.class.ts b/portal-2/src/app/landingPages/landing-utils/parsingFunctions.class.ts
index 2c0700ca..58cbd68b 100644
--- a/portal-2/src/app/landingPages/landing-utils/parsingFunctions.class.ts
+++ b/portal-2/src/app/landingPages/landing-utils/parsingFunctions.class.ts
@@ -5,6 +5,7 @@ export class ParsingFunctions {
public ngOnDestroy() {}
+ // publication & dataset : for fundedByProjects | project landing : for funding
public parseFundingTrees(fundingTree: any): {"funderName": string, "funderShortname": string, "stream": string} {
let funding: {"funderName": string, "funderShortname": string, "stream": string} = {"funderName": "", "funderShortname": "", "stream": ""};
let length = Array.isArray(fundingTree) ? fundingTree.length : 1;
@@ -66,4 +67,94 @@ export class ParsingFunctions {
return fundingStream;
}
+ // publication & dataset landing : for downloadFrom
+ parseDownloadFrom(downloadFrom: Map, instance: any, url: string)
+ {
+ let key: string = instance['hostedby'].name;
+
+ if(key) {
+ this.addUrlAndAccessMode(downloadFrom, instance, key, url);
+ }
+ }
+
+ // publication & dataset landing : for publishedIn
+ parsePublishedIn(publishedIn: Map, instance: any, result: any, url: string, counter: number): number {
+ if(result != null && result.hasOwnProperty("source")) {
+ let key: string;
+ if(Array.isArray(result.source)) {
+ if(counter==result.source.length) {
+ counter--;
+ }
+ key = result['source'][counter];
+ } else {
+ key = result['source'];
+ }
+
+ if(key) {
+ this.addUrlAndAccessMode(publishedIn, instance, key, url);
+ counter++;
+ }
+ }
+ return counter;
+ }
+
+ // publication & dataset landing : for downloadFrom and publishedIn
+ addUrlAndAccessMode(mapStructure: Map, instance: any, key: string, url: string) {
+ if(!mapStructure.has(key)) {
+ mapStructure.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
+ }
+
+ if(mapStructure.get(key)['url'] == null) {
+ mapStructure.get(key)['url'] = new Array();
+ }
+
+ if(url) {
+ mapStructure.get(key)['url'].push(url);
+ }
+
+ if(mapStructure.get(key)['accessMode'] == null) {
+ mapStructure.get(key)['accessMode'] = new Array();
+ }
+
+ if(instance.hasOwnProperty("licence")) {
+ if(url) {
+ mapStructure.get(key)['accessMode'].push(instance['licence'].classid);
+ }
+
+ if(this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['licence'].classid)) {
+ mapStructure.get(key)['bestAccessMode'] = instance['licence'].classid;
+ }
+
+ } else if(url) {
+ mapStructure.get(key)['accessMode'].push("");
+ }
+ }
+
+ // publication & dataset landing : for downloadFrom and publishedIn
+ changeBestAccessMode(currentAccessMode: string, accessMode: string): boolean {
+ switch (currentAccessMode) {
+ case null:
+ return true;
+ case "CLOSED":
+ if(accessMode == "OPEN" ||
+ accessMode == "EMBARGO" ||
+ accessMode == "RESTRICTED") {
+ return true;
+ }
+ return false;
+ case "RESTRICTED":
+ if(accessMode == "OPEN" ||
+ accessMode == "EMBARGO") {
+ return true;
+ }
+ return false;
+ case "EMBARGO":
+ if(accessMode == "OPEN") {
+ return true;
+ }
+ return false;
+ }
+ return false;
+ }
+
}
diff --git a/portal-2/src/app/landingPages/publication/publication.component.html b/portal-2/src/app/landingPages/publication/publication.component.html
index dae6add6..1d7cd49e 100644
--- a/portal-2/src/app/landingPages/publication/publication.component.html
+++ b/portal-2/src/app/landingPages/publication/publication.component.html
@@ -382,21 +382,31 @@
*ngFor="let key of publicationInfo.downloadFrom.keys() let i=index" >
@@ -416,24 +426,31 @@
- 0">
- Published in
- -
+
-
diff --git a/portal-2/src/app/landingPages/publication/publication.service.ts b/portal-2/src/app/landingPages/publication/publication.service.ts
index f030368e..e72f1385 100644
--- a/portal-2/src/app/landingPages/publication/publication.service.ts
+++ b/portal-2/src/app/landingPages/publication/publication.service.ts
@@ -76,7 +76,6 @@ export class PublicationService {
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid;
- console.info("accessmode by bestlicence = "+data[0]['bestlicense'].classid);
}
if(data[1] != null) {
@@ -309,114 +308,15 @@ export class PublicationService {
if(instance.hasOwnProperty("hostedby")) {
if(instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
- let key: string = instance['hostedby'].name;
-
- if(!this.publicationInfo.downloadFrom.has(key)) {
- this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
- }
- if(this.publicationInfo.downloadFrom.get(key)['url'] == null) {
- this.publicationInfo.downloadFrom.get(key)['url'] = new Array();
- }
-
- this.publicationInfo.downloadFrom.get(key)['url'].push(url);
-
- if(this.publicationInfo.downloadFrom.get(key)['accessMode'] == null) {
- this.publicationInfo.downloadFrom.get(key)['accessMode'] = new Array();
- }
-
- if(instance.hasOwnProperty("licence")) {
- this.publicationInfo.downloadFrom.get(key)['accessMode'].push(instance['licence'].classid);
-
- switch (this.publicationInfo.downloadFrom.get(key)['bestAccessMode']) {
- case null:
- this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
- break;
- case "CLOSED":
- if(instance['licence'].classid == "OPEN" ||
- instance['licence'].classid == "EMBARGO" ||
- instance['licence'].classid == "RESTRICTED") {
- this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
- }
- break;
- case "RESTRICTED":
- if(instance['licence'].classid == "OPEN" ||
- instance['licence'].classid == "EMBARGO") {
- this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
- }
- break;
- case "EMBARGO":
- if(instance['licence'].classid == "OPEN") {
- this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
- }
- break;
- }
- } else {
- this.publicationInfo.downloadFrom.get(key)['accessMode'].push("");
- }
+ this.parsingFunctions.parseDownloadFrom(this.publicationInfo.downloadFrom, instance, url);
} else {
- if(data[0] != null && data[0].hasOwnProperty("source")) {
- let key: string;
- if(Array.isArray(data[0].source)) {
- if(counter1==data[0].source.length) {
- counter1--;
- }
- key = data[0]['source'][counter1];
- } else {
- key = data[0]['source'];
- }
- if(key != "") {
- if(!this.publicationInfo.publishedIn.has(key)) {
- this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
- }
-
- if(this.publicationInfo.publishedIn.get(key)['url'] == null) {
- this.publicationInfo.publishedIn.get(key)['url'] = new Array();
- }
-
- this.publicationInfo.publishedIn.get(key)['url'].push(url);
-
- if(this.publicationInfo.publishedIn.get(key)['accessMode'] == null) {
- this.publicationInfo.publishedIn.get(key)['accessMode'] = new Array();
- }
-
- if(instance.hasOwnProperty("licence")) {
- this.publicationInfo.publishedIn.get(key)['accessMode'].push(instance['licence'].classid);
- switch (this.publicationInfo.publishedIn.get(key)['bestAccessMode']) {
- case null:
- this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
- break;
- case "CLOSED":
- if(instance['licence'].classid == "OPEN" ||
- instance['licence'].classid == "EMBARGO" ||
- instance['licence'].classid == "RESTRICTED") {
- this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
- }
- break;
- case "RESTRICTED":
- if(instance['licence'].classid == "OPEN" ||
- instance['licence'].classid == "EMBARGO") {
- this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
- }
- break;
- case "EMBARGO":
- if(instance['licence'].classid == "OPEN") {
- this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
- }
- break;
- }
- } else {
- this.publicationInfo.publishedIn.get(key)['accessMode'].push("");
- }
- counter1++;
- }
- }
+ counter1 = this.parsingFunctions.parsePublishedIn(this.publicationInfo.publishedIn, instance, data[0], url, counter1);
}
if(this.publicationInfo.title != undefined) {
switch (this.publicationInfo.title['accessMode']) {
case undefined:
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
this.publicationInfo.title['url'] = url;
- console.info("accessmode by undefined = "+this.publicationInfo.title.accessMode);
break;
case "CLOSED":
if(instance['licence'].classid == "OPEN" ||
@@ -424,7 +324,6 @@ export class PublicationService {
instance['licence'].classid == "RESTRICTED") {
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
this.publicationInfo.title['url'] = url;
- console.info("accessmode by closed = "+this.publicationInfo.title.accessMode);
}
break;
case "RESTRICTED":
@@ -432,21 +331,18 @@ export class PublicationService {
instance['licence'].classid == "EMBARGO") {
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
this.publicationInfo.title['url'] = url;
- console.info("accessmode by restricted = "+this.publicationInfo.title.accessMode);
}
break;
case "EMBARGO":
if(instance['licence'].classid == "OPEN") {
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
this.publicationInfo.title['url'] = url;
- console.info("accessmode by embargo= "+this.publicationInfo.title.accessMode);
}
break;
case "OPEN":
if(instance['licence'].classid == "OPEN" &&
this.publicationInfo.title['url'] == "") {
this.publicationInfo.title['url'] = url;
- console.info("title url by empty = "+this.publicationInfo.title.url);
}
break;
}