Merge commit '014dc9e5562890b61fbafa7705d2f31d0cbcdb74' into new-theme
This commit is contained in:
commit
e5e1f76635
|
@ -290,7 +290,7 @@ export class DataProviderComponent {
|
|||
this.subscriptions.push(this._searchResearchResultsService.countCollectedResultsWithFundingInfo(this.datasourceId).subscribe(
|
||||
fundedContent => {
|
||||
this.dataProviderInfo.fundedContent = fundedContent;
|
||||
console.log(this.dataProviderInfo.fundedContent);
|
||||
// console.log(this.dataProviderInfo.fundedContent);
|
||||
},
|
||||
err => {
|
||||
this.handleError("Error getting results with funding information for datasource id: " + this.datasourceId, err);
|
||||
|
|
|
@ -25,7 +25,7 @@ import {properties} from "../../../../environments/environment";
|
|||
</div>
|
||||
<div *ngIf="instance.collectedNamesAndIds?.size > 0">
|
||||
<span>Providers: </span>
|
||||
<a *ngFor="let collectedName of instance.collectedNamesAndIds.keys(); let i=index" [routerLink]="dataProviderUrl"
|
||||
<a *ngFor="let collectedName of getKeys(instance.collectedNamesAndIds); let i=index" [routerLink]="dataProviderUrl"
|
||||
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}">
|
||||
{{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container>
|
||||
</a>
|
||||
|
@ -73,4 +73,8 @@ export class AvailableOnComponent {
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public getKeys( map) {
|
||||
return Array.from(map.keys());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import {HostedByCollectedFrom, Journal, Project, RelationResult} from "../../uti
|
|||
import {Reference} from "../../utils/entities/resultLandingInfo";
|
||||
import {Injectable} from '@angular/core';
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {StringUtils} from "../../utils/string-utils.class";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -820,4 +821,20 @@ export class ParsingFunctions {
|
|||
return record["result"]["header"]["dri:objIdentifier"];
|
||||
|
||||
}
|
||||
|
||||
parseDescription(description):string[] {
|
||||
|
||||
let abstracts = [];
|
||||
if(!Array.isArray(description)) {
|
||||
abstracts = [description ? String(description) : ""];
|
||||
} else {
|
||||
abstracts = description.map( x => String(x));
|
||||
}
|
||||
try{
|
||||
abstracts = abstracts.map( x => StringUtils.HTMLToString(x));
|
||||
} catch (e) {}
|
||||
abstracts =abstracts.sort((a,b) => b.length - a.length);
|
||||
return abstracts;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,14 +49,7 @@ export class DeletedByInferenceService {
|
|||
result.dateofacceptance = data.dateofacceptance;
|
||||
result.embargoEndDate = data.embargoenddate;
|
||||
|
||||
if(!Array.isArray(data.description)) {
|
||||
result.description = data.description;
|
||||
} else {
|
||||
result.description = data.description[0];
|
||||
}
|
||||
if(result.description && result.description.length > this.sizeOfDescription) {
|
||||
result.description = result.description.substring(0, this.sizeOfDescription) + "...";
|
||||
}
|
||||
result.description = this.parsingFunctions.parseDescription(data.description);
|
||||
|
||||
if(data['bestaccessright'] && data['bestaccessright'].hasOwnProperty("classname")) {
|
||||
result.accessMode = data['bestaccessright'].classname;
|
||||
|
|
|
@ -165,24 +165,15 @@
|
|||
</div>
|
||||
<div *ngIf="hasPrimaryInfo" class="uk-width-expand uk-padding">
|
||||
<!-- Description -->
|
||||
<div *ngIf="resultLandingInfo.description" class="uk-margin-medium-bottom">
|
||||
<div class="uk-text-justify uk-height-max-medium uk-overflow-auto">
|
||||
<div *ngIf="resultLandingInfo.description && resultLandingInfo.description.length > 0"
|
||||
class="uk-margin-medium-bottom">
|
||||
<div class="uk-text-justify ">
|
||||
<div class="uk-text-muted">Abstract</div>
|
||||
<span>{{resultLandingInfo.description.substring(0, showNumDescription)}}</span>
|
||||
<span *ngIf="showNumDescription == thresholdDescription &&
|
||||
resultLandingInfo.description.length > thresholdDescription">...</span>
|
||||
<div class=" uk-height-max-medium uk-overflow-auto">
|
||||
<div *ngFor="let description of resultLandingInfo.description" class="uk-margin-small-bottom ">
|
||||
{{description}}</div>
|
||||
</div>
|
||||
<div *ngIf="showNumDescription == thresholdDescription &&
|
||||
resultLandingInfo.description.length > thresholdDescription" class="uk-text-right">
|
||||
<a (click)="showNumDescription = resultLandingInfo.description.length;">
|
||||
Read more
|
||||
</a>
|
||||
</div>
|
||||
<div *ngIf="resultLandingInfo.description && showNumDescription > thresholdDescription"
|
||||
class="uk-text-right">
|
||||
<a (click)="showNumDescription = thresholdDescription;">
|
||||
Read less
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Identifiers -->
|
||||
|
|
|
@ -56,9 +56,6 @@ export class ResultLandingComponent {
|
|||
public canonicalUrl: string = null;
|
||||
public linkToSearchPage: string = null;
|
||||
|
||||
public thresholdDescription: number = 670;
|
||||
public showNumDescription: number = 670;
|
||||
|
||||
public citeThisClicked: boolean;
|
||||
|
||||
// Metrics tab variables
|
||||
|
@ -390,7 +387,7 @@ export class ResultLandingComponent {
|
|||
this.addNoIndexFilter();
|
||||
if (this.resultLandingInfo.title) {
|
||||
this.updateTitle(this.resultLandingInfo.title);
|
||||
this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description) : ("," + this.resultLandingInfo.title)));
|
||||
this.updateDescription((this.resultLandingInfo.description && this.resultLandingInfo.description[0] ? (this.resultLandingInfo.description[0].substr(0,157) + (this.resultLandingInfo.description[0].substr(0,157).length == 157?"...":"")) : (this.resultLandingInfo.title)));
|
||||
}
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackViewForCustomUrl(this.properties, this.resultLandingInfo.title, this.linkToLandingPage.split("?")[1] + this.id ,this.piwikSiteId).subscribe());
|
||||
|
@ -472,8 +469,8 @@ export class ResultLandingComponent {
|
|||
}
|
||||
|
||||
private updateDescription(description: string) {
|
||||
this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
|
||||
this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
}
|
||||
|
||||
private updateTitle(title: string) {
|
||||
|
@ -691,6 +688,7 @@ export class ResultLandingComponent {
|
|||
// || (resultLandingInfo.supplementedByResearchResults &&
|
||||
|| (resultLandingInfo.relatedResults && resultLandingInfo.relatedResults.length > 0)
|
||||
)
|
||||
//&& (resultLandingInfo.description && resultLandingInfo.description[0] && resultLandingInfo.description[0].length >=50 && resultLandingInfo.description[0].length <=5000)
|
||||
);
|
||||
// console.log("rich content " + allow)
|
||||
//spam words to exclude - need to be in lower case
|
||||
|
@ -698,7 +696,7 @@ export class ResultLandingComponent {
|
|||
let abstract_words = ["operacao-feliz-natal.blogspot.com", "moviedouban.site", "hack-expert-solution.link"];
|
||||
allow = allow && !(
|
||||
(this.hasKeyword(resultLandingInfo.title,title_authors_words) || (resultLandingInfo.authors && this.hasKeyword(resultLandingInfo.authors.map(o => o.fullName).join(" "),title_authors_words))
|
||||
|| (resultLandingInfo.description && this.hasKeyword(resultLandingInfo.description,abstract_words))
|
||||
|| (resultLandingInfo.description && resultLandingInfo.description[0] && this.hasKeyword(resultLandingInfo.description[0],abstract_words))
|
||||
) &&
|
||||
((resultLandingInfo.publisher && resultLandingInfo.publisher.toLowerCase() == "zenodo") ||
|
||||
resultLandingInfo.hostedBy_collectedFrom.filter(value => {
|
||||
|
@ -710,7 +708,7 @@ export class ResultLandingComponent {
|
|||
let common_abstract = ["international audience","n/a","peer reviewed","national audience","info:eu-repo/semantics/published","-",".","graphical abstract","met lit. opg","international audience; no abstract",'<jats:p>.</jats:p>',"politics","info:eu-repo/semantics/publishedversion","copia digital. madrid : ministerio de educación, cultura y deporte, 2016",'<jats:p />',"peer-reviewed","copia digital. madrid : ministerio de educación, cultura y deporte. subdirección general de coordinación bibliotecaria, 2015","<jats:p>-</jats:p>","imperial users only","yüksek lisans"];
|
||||
let common_authors = ["[s.n.]","null &na;","nn","(:unap)","(:null)","null anonymous","anonymous"];
|
||||
allow = allow && !(
|
||||
this.isKeyword(resultLandingInfo.title,common_titles) || this.isKeyword(resultLandingInfo.description,common_abstract) ||
|
||||
this.isKeyword(resultLandingInfo.title,common_titles) || (resultLandingInfo.description && resultLandingInfo.description[0] && this.isKeyword(resultLandingInfo.description[0],common_abstract)) ||
|
||||
(resultLandingInfo.authors && this.hasKeyword("_"+resultLandingInfo.authors.map(o => o.fullName).join("_")+"_",common_authors, "_"))
|
||||
);
|
||||
// console.log("common content " + allow)
|
||||
|
|
|
@ -136,16 +136,7 @@ export class ResultLandingService {
|
|||
this.resultLandingInfo.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
|
||||
this.resultLandingInfo.dateofacceptance = data[0].dateofacceptance?Dates.getDate(data[0].dateofacceptance):null;
|
||||
this.resultLandingInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
//this.resultLandingInfo.description = String(data[0].description);
|
||||
this.resultLandingInfo.description = (data[0] && data[0].description) ? String(data[0].description) : "";
|
||||
} else {
|
||||
//this.resultLandingInfo.description = String(data[0].description[0]);
|
||||
this.resultLandingInfo.description = (data[0] && data[0].description[0]) ? String(data[0].description[0]) : "";
|
||||
}
|
||||
try{
|
||||
this.resultLandingInfo.description = StringUtils.HTMLToString(this.resultLandingInfo.description);
|
||||
} catch (e) {}
|
||||
this.resultLandingInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].description?data[0].description:[]);
|
||||
this.resultLandingInfo.embargoEndDate = data[0].embargoenddate?Dates.getDate(data[0].embargoenddate):null;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ export class WorkV3_0 {
|
|||
}
|
||||
|
||||
if(resultLandingInfo.description && resultLandingInfo.description.length < description_limit) {
|
||||
work['short-description'] = resultLandingInfo.description;
|
||||
work['short-description'] = resultLandingInfo.description.length > 0 ? resultLandingInfo.description[0] : "";
|
||||
}
|
||||
|
||||
// citation (Citation, optional),
|
||||
|
|
|
@ -42,7 +42,9 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
}
|
||||
|
||||
if((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community")
|
||||
&& Session.isLoggedIn() && this.results && this.results.length > 0) {
|
||||
&& Session.isLoggedIn() && this.results && this.results.length > 0
|
||||
&& (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other")
|
||||
) {
|
||||
this.orcidService.getPutCodes(this.previewResults.map(
|
||||
previewResult => {
|
||||
if(previewResult.identifiers) {
|
||||
|
|
|
@ -344,14 +344,8 @@ export class SearchResearchResultsService {
|
|||
var date: string = (resData.dateofacceptance) + ""; // transform to string in case it is an integer
|
||||
result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
|
||||
|
||||
if (!Array.isArray(resData.description)) {
|
||||
result.description = (resData.description) ? String(resData.description) : "";
|
||||
} else {
|
||||
result.description = (resData.description[0]) ? String(resData.description[0]) : "";
|
||||
}
|
||||
try{
|
||||
result.description = StringUtils.HTMLToString(result.description);
|
||||
} catch (e) {}
|
||||
let abstracts = this.parsingFunctions.parseDescription(resData.description);
|
||||
result.description = abstracts.length > 0 ? abstracts[0] : "";
|
||||
if (result.description && result.description.length > this.sizeOfDescription) {
|
||||
result.description = result.description.substring(0, this.sizeOfDescription) + "...";
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
|
|||
this.handleError('Error getting community information (e.g. pages,entities) for community with id: ' + this.communityId, error);
|
||||
}));
|
||||
}
|
||||
if(this.portal != 'connect' && this.portal != 'connect-admin' && this.properties.adminToolsPortalType == 'community') {
|
||||
if(this.properties.environment == "development" && this.portal != 'connect' && this.portal != 'connect-admin' && this.properties.adminToolsPortalType == 'community') {
|
||||
this.subs.push(
|
||||
this._helpContentService.getMenuItems(this.portal).subscribe(
|
||||
data => {
|
||||
|
|
|
@ -115,13 +115,8 @@ export class JsonldDocumentSerializerService {
|
|||
}
|
||||
|
||||
serializeDescription(doc, buffer){
|
||||
if (doc.description && doc.description.length == 1) {
|
||||
buffer["description"] = doc.description[0];
|
||||
}
|
||||
else if (doc.description && doc.description.length > 1) {
|
||||
buffer["description"] = doc.description;
|
||||
}
|
||||
}
|
||||
serializeIdentifier(doc, buffer){
|
||||
if (doc.identifier && doc.identifier.length == 1) {
|
||||
buffer["identifier"] = this.buildIdentifier(doc.identifier[0]);
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
|
|||
import {Citation, Dataset, Identifier, License, Organization, Person} from '../model/jsonld-document';
|
||||
import * as _ from 'lodash';
|
||||
import {properties} from '../../../../../environments/environment';
|
||||
import {ParsingFunctions} from "../../../landingPages/landing-utils/parsingFunctions.class";
|
||||
|
||||
@Injectable()
|
||||
export class OpenAireJsonldConverterService {
|
||||
|
@ -213,9 +214,10 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
|
|||
}
|
||||
private getDescription(result: any): String[] {
|
||||
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.description", null);
|
||||
if (!item) return this.getTitle(result);
|
||||
let descr = Array.isArray(item) ? item[0]+ "":item + ""; // +"" to make string: if description is number descr.substring returns error
|
||||
return [descr?(descr.substring(0,4997)+(descr.substring(0,4997).length == 4997?'...':'')):"" as String];
|
||||
if (!item) return [ "" + this.getTitle(result)];
|
||||
let parsing = new ParsingFunctions();
|
||||
let abstracts = parsing.parseDescription(item);
|
||||
return [abstracts && abstracts[0] ?(abstracts[0].substring(0,4997)+(abstracts[0].substring(0,4997).length == 4997?'...':'')):"" ];
|
||||
}
|
||||
|
||||
private getDateCreated(result: any): String[] {
|
||||
|
|
|
@ -35,7 +35,7 @@ export class ResultLandingInfo {
|
|||
identifiers: Map<string, string[]>; //key is the classname
|
||||
languages: string[];
|
||||
countries: string[];
|
||||
description: string;
|
||||
description: string[] = [];
|
||||
|
||||
hostedBy_collectedFrom: HostedByCollectedFrom[];
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ export class SearchFields {
|
|||
filterType: null
|
||||
},
|
||||
["resultdescription"]: {
|
||||
name: "Description",
|
||||
name: "Abstract",
|
||||
type: "keyword",
|
||||
param: "description",
|
||||
operator: "ds",
|
||||
|
|
|
@ -148,7 +148,7 @@ export class ResultPreview {
|
|||
resultPreview.accessMode = result.title.accessMode;
|
||||
resultPreview.sc39 = result.title.sc39;
|
||||
if(result.countriesForResults) {
|
||||
resultPreview.countries = result.countries;
|
||||
resultPreview.countries = result.countriesForResults;
|
||||
} else if(result.country) {
|
||||
resultPreview.countries = [result.country];
|
||||
} else {
|
||||
|
@ -202,7 +202,7 @@ export class ResultPreview {
|
|||
resultPreview.accessMode = result.accessMode;
|
||||
resultPreview.countries = result.countries;
|
||||
resultPreview.projects = result.fundedByProjects;
|
||||
resultPreview.description = result.description;
|
||||
resultPreview.description = result.description.length > 0 ? result.description[0] : "";
|
||||
if(result.dateofacceptance) {
|
||||
resultPreview.year = new Date(result.dateofacceptance).getFullYear().toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue