delete unused files | add clipboard js in assets | change citation functionality using citeproc.js | fix #3254|#3255 filter funding values based on the funder selected | fixing query for funder in claiming | add reload routing

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@49858 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-11-09 10:44:48 +00:00
parent 0712b6d665
commit e4f233b016
19 changed files with 16985 additions and 225 deletions

View File

@ -8,8 +8,8 @@
],
"scripts": {
"ng": "ng",
"start": "ng serve --disable-host-check",
"start:dynamic": "npm run build:dynamic && npm run serve:dynamic",
"start": "PORT=5000 ng serve --disable-host-check --host 0.0.0.0",
"start:dynamic": "PORT=5000 npm run build:dynamic && npm run serve:dynamic",
"start:static": "npm run build:static && npm run serve:static",
"build": "ng build",
"build:client-and-server-bundles": "ng build --prod -sm --stats-json && ng build --prod --app 1 --output-hashing=false",

View File

@ -63,6 +63,7 @@ import { ErrorPageComponent } from './error/errorPage.component';
{ path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LinkingGenericModule' },
{ path: 'participate/direct-claim', loadChildren: './claims/directLinking/directLinking.module#DirectLinkingModule' },
{ path: 'claims-project-manager', loadChildren: './claims/claimsByToken/claimsByToken.module#ClaimsByTokenModule' },
{ path: 'reload', loadChildren: './reload/reload.module#ReloadModule' },
{ path: 'user-info', loadChildren: './login/user.module#UserModule' },
{ path: 'error', component: ErrorPageComponent },
{ path: '**',pathMatch: 'full',component: ErrorPageComponent }

View File

@ -14,7 +14,7 @@ declare var UIkit:any;
<div>
<form class=" uk-animation uk-padding-small uk-panel uk-background-muted " >
<table class="uk-width-1-1 uk-table uk-table-responsive" ><tr>
<td >
<td>
Search for projects
</td></tr>
<tr><td >

View File

@ -23,7 +23,7 @@ export class ContextsService {
console.info('ContextsService: request communities '+url);
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url, this.getAuthOptions())
return this.http.get(url, this.getAuthOptions())
.map(request => <any> request.json().data)
// .do(request => console.info("Get claims: offset = "))
.catch(this.handleError);
@ -34,7 +34,7 @@ export class ContextsService {
let key = url;
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url, this.getAuthOptions())
return this.http.get(url, this.getAuthOptions())
.map(request => <any> request.json().data)
// .do(request => console.info("Get claims: offset = " ))
.catch(this.handleError);;
@ -45,7 +45,7 @@ export class ContextsService {
let key = url+"_parsing="+parsing;
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url, this.getAuthOptions())
return this.http.get(url, this.getAuthOptions())
.map(request => <any> request.json().data)
.catch(this.handleError)
.map(res => (parsing)?this.parse(res.concept):res.concept);

View File

@ -1,10 +0,0 @@
<!--div *ngIf="id">
<p>Here is the claim with id : {{id}}</p>
<div *ngIf="claim">
{{claim.id }} || {{claim.userMail }} ||
{{claim | json}} {{claim | json}}
</div>
</div>
<div *ngIf="!id">
<p>No proper id...</p>
</div-->

View File

@ -1,14 +0,0 @@
// import { NgModule} from '@angular/core';
// import { CommonModule } from '@angular/common';
// import { FormsModule } from '@angular/forms';
//
// import { ErrorPageComponent } from './errorPage.component';
// import { ErrorRoutingModule } from './error-routing.module';
// import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
//
// @NgModule({
// imports: [CommonModule, FormsModule, ErrorRoutingModule],
// providers:[PreviousRouteRecorder],
// declarations: [ErrorPageComponent]
// })
// export class ErrorModule { }

View File

@ -12,7 +12,7 @@
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s">
<showTitle [title]="datasetInfo.title"></showTitle>
<span *ngIf="datasetInfo.types.length > 0"class="uk-label custom-label label-blue label-dataset " title="Type">{{datasetInfo.types.join(", ")}}</span>
<span *ngIf="datasetInfo.title && datasetInfo.title.accessMode" [class]="'uk-label custom-label label-green label-'+ datasetInfo.title.accessMode " ><!--span [class]="datasetInfo.title.accessMode" -->{{datasetInfo.title.accessMode}}<!--/span--></span>
<span *ngIf="datasetInfo.title && datasetInfo.title.accessMode" [class]="'uk-label custom-label label-green label-'+ datasetInfo.title.accessMode " >{{datasetInfo.title.accessMode}}</span>
<span *ngIf="datasetInfo.underCurationMessage" class="uk-label custom-label label-yellow " >
<span uk-tooltip="pos:right; delay:10"
title="{{buildCurationTooltip()}}">

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,8 @@
import {Component, ElementRef, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Citation, CitationData} from './citation.class';
declare var CSL:any;
declare var Sys:any;
//<addThis ></addThis>
@Component({
selector: 'citeThis',
@ -11,10 +12,10 @@ import {Citation, CitationData} from './citation.class';
<dl class="uk-description-list-line">
<dt class="title">Cite this {{type}}</dt>
<dd class="line" >
<select class="select" id="citations" name="citeselect" [(ngModel)]="selectedStyle" (click)="styleChanged()">
<select class="select" id="citations" name="citeselect" [(ngModel)]="selectedStyle" (ngModelChange)="styleChanged()">
<option *ngFor=" let style of this.citation.templates let i = index" [value]="style">{{style}}</option>
</select>
<div id="citation" class="box-content">{{citationText}}</div>
<div id="citation" class="box-content" [innerHTML]=citationText></div>
</dd>
</dl>
</div>
@ -29,8 +30,8 @@ export class CiteThisComponent {
@Input() result: any;
@Input() id: string;
@Input() type: string="article";
public data;//= '[ { "id": "Q23571040", "type": "apple", "title": "Correlation of the Base Strengths of Amines 1", "DOI": "10.1021/ja01577a030", "author": [ { "given": "H. K.", "family": "Hall" } ], "issued": [ { "date-parts": [ "1957", "1", "1" ] } ], "container-title": "Journal of the American Chemical Society", "volume": "79", "issue": "20", "page": "5441-5444" } ]';
public citeproc;
public data;
constructor(private route: ActivatedRoute) {
@ -39,10 +40,10 @@ export class CiteThisComponent {
ngOnInit() {
if(typeof window !== 'undefined') {
// this.citeproc = require('./citeproc.js');
// console.log(this.citeproc);
this.parseData();
// var Cite = require('citation-js');
// this.cite = new Cite(this.data,this.citation.getOptionsBy(this.selectedStyle));
// this.citationText = this.cite.get(this.citation.getOptionsBy(this.selectedStyle));
this.updateCitation();
}
}
parseData(){
@ -72,30 +73,54 @@ export class CiteThisComponent {
}else{
citationData.author.push({given:"", family:this.result.authors[i], 'parse-names':true});
}
citationData.authors.push(this.result.authors[i]);
// citationData.authors.push(this.result.authors[i]);
}
}
if(this.result.dateofacceptance != undefined){
citationData.issued = [];
citationData.issued = {};
var date:string = (this.result.dateofacceptance)+""; // transform to string in case it is an integer
var dateArray:string[] = (date && (date).indexOf('-') !== -1)?date.split('-'):[date];
if(dateArray.length < 3){
dateArray.push["01"];
dateArray.push["01"];
// dateArray.push[1];
// dateArray.push[1];
}
citationData.issued.push({"date-parts":[dateArray[0],dateArray[1], dateArray[2]]});
citationData.issued={"date-parts":[[""+dateArray[0],dateArray[1], dateArray[2]]]};
if(this.result.date ){
citationData.date = this.result.date ;
}
}
this.data = JSON.stringify(citationData);
console.log(this.data);
this.data = citationData;
// console.log(this.data);
}
styleChanged(){
// this.citationText = this.cite.get(this.citation.getOptionsBy(this.selectedStyle));
this.updateCitation();
}
updateCitation(){
var Sys =
function Sys(lang, data){
this.lang = lang;
this.data = data;
this.changeName = function (name) {
this.lastName = name;
};
this.retrieveLocale= function (lang){
return this.lang;
}
this.retrieveItem= function(id){
console.log("retrieve id:" + id);
return this.data;
}
};
var citeproc = new CSL.Engine(new Sys(this.citation.locale, this.data ), this.citation[this.selectedStyle]);
citeproc.updateItems([this.data.id]);
this.citationText = citeproc.makeBibliography();
this.citationText = ((this.citationText != null) && (this.citationText.length > 1) && (this.citationText[1].length > 0)) ? this.citationText[1][0] : '';
}

View File

@ -274,15 +274,14 @@ export class ParsingFunctions {
}
// publication & dataset landing : for relatedResearchResults
parseRelatedResearchResults(relatedResearchResults_1: Map<string, { "name": string, "id": string, "date": string,
parseRelatedResearchResults(relatedResearchResults: Map<string, { "name": string, "id": string, "date": string,
"trust": number, "class": string}[]>, relation: any, provenanceAction: string) :
Map<string, { "name": string, "id": string, "date": string,
"trust": number, "class": string}[]> {
// if(relatedResearchResults == undefined) {
let relatedResearchResults = new Map<string, {"name": string, "id": string, "date": string,
if(relatedResearchResults == undefined) {
relatedResearchResults = new Map<string, {"name": string, "id": string, "date": string,
"trust": number, "class": string }[]>();
// }
}
if(!relatedResearchResults.has(provenanceAction)) {
relatedResearchResults.set(provenanceAction,

View File

@ -8,20 +8,21 @@ import {PagingModule} from '../../utils/paging.module';
import {ShowAuthorsComponent} from './showAuthors.component';
import {ShowIdentifiersComponent} from './showIdentifiers.component';
import {ShowSubjectsComponent} from './showSubjects.component';
import {TabTableComponent} from './tabTable.component';
import {FundedByComponent} from './fundedBy.component';
import {PublishedInComponent} from './publishedIn.component';
import {TabTableComponent} from './tabTable.component';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, PagingModule
],
declarations: [
ShowAuthorsComponent,ShowIdentifiersComponent,ShowSubjectsComponent, TabTableComponent, FundedByComponent, PublishedInComponent
ShowAuthorsComponent,ShowIdentifiersComponent,ShowSubjectsComponent,FundedByComponent,PublishedInComponent,TabTableComponent
],
providers:[
],
exports: [
ShowAuthorsComponent,ShowIdentifiersComponent,ShowSubjectsComponent, TabTableComponent, FundedByComponent, PublishedInComponent
ShowAuthorsComponent,ShowIdentifiersComponent,ShowSubjectsComponent,FundedByComponent,PublishedInComponent,TabTableComponent
]
})
export class ResultLandingModule { }

View File

@ -12,7 +12,7 @@
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s">
<showTitle [title]="softwareInfo.title"></showTitle>
<span *ngIf="softwareInfo.types.length > 0"class="uk-label custom-label label-blue label-software " title="Type">{{softwareInfo.types.join(", ")}}</span>
<span *ngIf="softwareInfo.title && softwareInfo.title.accessMode" [class]="'uk-label custom-label label-green label-'+ softwareInfo.title.accessMode " ><!--span [class]="softwareInfo.title.accessMode" -->{{softwareInfo.title.accessMode}}<!--/span--></span>
<span *ngIf="softwareInfo.title && softwareInfo.title.accessMode" [class]="'uk-label custom-label label-green label-'+ softwareInfo.title.accessMode " >{{softwareInfo.title.accessMode}}</span>
<span *ngIf="softwareInfo.underCurationMessage" class="uk-label custom-label label-yellow " >
<span uk-tooltip="pos:right; delay:10"
title="{{buildCurationTooltip()}}">

View File

@ -64,7 +64,7 @@ export class SearchPageComponent {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
this.updateBaseUrlWithParameters(this.filters);
// this.updateBaseUrlWithParameters(this.filters);
this.updateTitle(this.pageTitle);
this.updateDescription("Openaire, search, repositories, open access, type, content provider, funder, project, " + this.type + "," +this.pageTitle);
if(typeof window !== 'undefined') {
@ -106,14 +106,12 @@ export class SearchPageComponent {
var allFqs = "";
this.queryParameters = new Map<string,string>();
for(var i=0; i< this.refineFields.length ; i++){
var filterId = this.refineFields[i];
if(params[filterId] != undefined) {
this.queryParameters[filterId]=StringUtils.URIDecode(params[filterId]);
let values = (StringUtils.URIDecode(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
this.queryParameters.set(filterId, StringUtils.URIDecode(params[filterId]));
let values = (StringUtils.URIDecode(this.queryParameters.get(filterId))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
var countvalues = 0;
var fq = "";
for(let value of values) {
@ -159,8 +157,8 @@ export class SearchPageComponent {
var filterId = this.refineFields[i];
var fq = "";
if(params[filterId] != undefined) {
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
let values = (decodeURIComponent(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
this.queryParameters.set(filterId,decodeURIComponent(params[filterId]));
let values = (decodeURIComponent(this.queryParameters.get(filterId))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
var countvalues = 0
for(let value of values) {
countvalues++;
@ -205,8 +203,8 @@ export class SearchPageComponent {
for(var i=0; i< filters.length ; i++){
var filter:Filter = filters[i];
filter.countSelectedValues = 0;
if(this.queryParameters[filter.filterId] != undefined) {
let values = (decodeURIComponent(this.queryParameters[filter.filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
if(this.queryParameters.get(filter.filterId) != undefined) {
let values = (decodeURIComponent(this.queryParameters.get(filter.filterId))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
for(let filterValue of filter.values) {
if(values.indexOf(StringUtils.quote(filterValue.id)) > -1) {
filterValue.selected = true;
@ -222,10 +220,49 @@ export class SearchPageComponent {
}
}
}
this.filterFilterValues(this.filters);
return filters;
}
/*
* For Funder filters - if funder selected
*/
public filterFilterValues(filters:Filter[]){
var funders = [];
var funder_prefix = [];
for(var i=0; i< filters.length ; i++){
var filter:Filter = filters[i];
// console.log(filter.filterId);
if(filter.filterId.indexOf("funder")!=-1 && this.queryParameters.get(filter.filterId) != undefined) {
let funders = (decodeURIComponent(this.queryParameters.get(filter.filterId))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
for(let funder of funders) {
console.log(funder);
funder_prefix.push(StringUtils.unquote(funder).split("____")[0]);
}
// console.log(funder_prefix );
}else if(filter.filterId.indexOf("funding")!=-1){
// console.log(" funding: "+filter.filterId );
var filteredValues = []
for(let filterValue of filter.values) {
var value_prefix = filterValue.id.split("____")[0];
// console.log("Value prefix: "+value_prefix );
if(funder_prefix.indexOf(value_prefix)!=-1){
// console.log("here" + value_prefix);
filteredValues.push(filterValue);
}
}
console.log("From " +filter.values.length+ "to "+filteredValues.length);
if(filteredValues.length > 0){
filter.values = filteredValues;
}
}
}
return filters;
}
/*
* Update the url with proper parameters. This is used as base url in Paging Component
*/
public updateBaseUrlWithParameters(filters:Filter[]){
@ -234,7 +271,7 @@ export class SearchPageComponent {
}
/*
*
*Get The filters and create url parameters
*/
private createUrlParameters(filters:Filter[], includePage:boolean){
var allLimits="";//location.search.slice(1);
@ -250,7 +287,7 @@ export class SearchPageComponent {
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
}
}
this.queryParameters[filter.filterId]=filterLimits;
this.queryParameters.set(filter.filterId,filterLimits);
if(filterLimits.length > 0){
this.parameterNames.push(filter.filterId);
this.parameterValues.push(filterLimits);
@ -406,7 +443,6 @@ export class SearchPageComponent {
this.location.go(location.pathname,urlParameters);
/* Code For Piwik*/
if (typeof localStorage !== 'undefined') {
console.log("In PreviousRouteRecorder : "+this.router.url );
localStorage.setItem('previousRoute', this.router.url);
}
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){

View File

@ -101,7 +101,7 @@ export class EntitiesAutocompleteComponent {
this.filtered = this.searchTermStream
.debounceTime(300).distinctUntilChanged()
.switchMap((term: string) => {
var results = this._search.searchProjectsByFunder(term, (this.funderId == "0"?"":this.funderId));
var results = this._search.searchProjectsByFunder(term, (this.funderId == "0"?"":encodeURIComponent(this.funderId)));
this.showLoading = false;
this.results = results.length;
return results;

View File

@ -102,6 +102,11 @@ export class OpenaireProperties {
private static logoutUrl ="https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=";
private static logoutUrl_pm ="https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=";
private static logoutOpenaireUrl ="http://dl067.madgik.di.uoa.gr/idp/profile/Logout";
private static logoutOpenaireUrl_pm ="http://dl067.madgik.di.uoa.gr/idp/profile/Logout";
private static cookieDomain =".di.uoa.gr";
private static cookieDomain_pm =".openaire.eu";
@ -363,6 +368,13 @@ export class OpenaireProperties {
return this.logoutUrl;
}
}
public static getLogoutOpenaireURL():string{
if(this.productionMode){
return this.logoutOpenaireUrl_pm;
}else{
return this.logoutOpenaireUrl;
}
}
public static getCookieDomain():string{
if(this.productionMode){
return this.cookieDomain_pm;

View File

@ -1,61 +0,0 @@
// import {Component, Input} from '@angular/core';
//
// @Component({
// selector: 'showDataProviders',
// template: `
//
// <div *ngIf="dataProviders == undefined" class = "alert alert-info ">
// No content providers available
// </div>
// <div *ngIf="dataProviders != undefined">
//
// <div role="separator" class="divider" *ngFor="let item of dataProviders">
// <p *ngIf="item['url'] != undefined && item['url']">
// <a href="{{item['url']}}" target="_blank" class="custom-external custom-icon">
// {{item['name']}}
// </a>
// </p>
// <p *ngIf="item['url'] == undefined || item['url'] == ''">
// {{item['name']}}
// </p>
//
// <p>
// <span *ngFor="let item of dataProviders.organizations">
// <a *ngIf="item['url']!=''" href="{{item['url']}}" target="_blank"
// class="custom-external custom-icon">
// {{item['name']}}
// </a>
// <p *ngIf="item['url']==''">
// {{item['name']}}
// </p>
// </span>
// </p>
//
//
// <p *ngIf="item['type'] != undefined && item['type'] != ''">
// Type: {{item['type']}}
// </p>
//
// <p *ngIf="item['websiteUrl'] != null && item['websiteUrl'] != ''">
// Website URL:
// <a href="{{item['websiteUrl']}}" target="_blank"
// class="custom-external custom-icon">
// {{item['websiteUrl']}}
// </a>
// </p>
// <hr>
// </div>
// </div>
// `
// })
//
// // Possibly should be deleted. Not used anywhere.
// export class ShowDataProvidersComponent {
// @Input() dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string,
// "organizations": {"name": string, "url": string}[]}[];
//
// constructor () {
// }
//
// ngOnInit() {}
// }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -15,8 +15,8 @@
<meta property="og:url" content="https://demo.openaire.eu"/>
<meta property="og:site_name" content="OpenAIRE"/>
<meta property="og:image" content="https://demo.openaire.eu/assets/common/Symbol.png"/>
<meta property="og:image:secure_url" content="https://demo.openaire.eu/assets/common/Symbol.png" />
<meta property="og:image" content="assets/common/Symbol.png"/>
<meta property="og:image:secure_url" content="assets/common/Symbol.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="360" />
<meta property="og:image:height" content="359" />
@ -51,8 +51,11 @@
}
</script>
<!-- <script src="assets/jquery/jquery.min.js" type="text/javascript"></script> -->
<script src="assets/common/jquery.js"></script>
<script src="assets/citeproc.js"></script>
<!-- <script src="assets/common/uikit.js"></script> -->
<script src="assets/common/uikit-icons-max.js"></script>
<script>
@ -61,6 +64,7 @@ $(document).ready(function(){
$.getScript("assets/common/uikit.js");
$.getScript("assets/common/uikit-icons-max.js");
});
</script>
<!-- <script src="assets/common/uikit.js"></script> -->
<!-- <script src="assets/common/uikit-icons-max.js"></script> -->
@ -97,7 +101,7 @@ $(document).ready(function(){
}
</script>
<script src="//cdn.jsdelivr.net/clipboard.js/1.5.16/clipboard.min.js"></script>
<script src="assets/clipboard.min.js"></script>
<!--script type='text/javascript' src="node_modules/clipboard/dist/clipboard.min.js"></script-->
<!--script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script-->
@ -110,7 +114,6 @@ $(document).ready(function(){
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- <script async src="/main.bundle.js"></script> -->
<app-root></app-root>
</div>