addThis load in every router change - use component | Organizations Landing page execute separate query for projects (filters, paging) | fix browse links from home page

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46237 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-03-13 15:47:35 +00:00
parent 9afdb70b52
commit 2fa9275de9
31 changed files with 371 additions and 58 deletions

View File

@ -0,0 +1,40 @@
import {Component, ElementRef, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
interface addthis {
layers: refresh;
}
interface refresh {
refresh: Function;
}
declare var addthis: addthis;
//<addThis ></addThis>
@Component({
selector: 'addThis',
template: `
<div class="addthis_inline_share_toolbox"></div>
`
})
export class AddThisComponent {
private sub:any;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(data => {
if (typeof document !== 'undefined') {
try{
addthis.layers.refresh();
}catch (e) {
}
}
});
}
}

View File

@ -51,7 +51,7 @@
<dt >Share - Bookmark
</dt>
<dd>
<div class="addthis_inline_share_toolbox"></div>
<addThis ></addThis>
</dd>
</dl>
</li>

View File

@ -296,6 +296,7 @@ private nativeElement : Node;
}
ngOnInit() {
if(this.tabs != undefined && this.tabs.length > 0) {
this.reloadPublications = true;
this.reloadDatasets = true;

View File

@ -114,7 +114,7 @@
<dt >Share - Bookmark
</dt>
<dd>
<div class="addthis_inline_share_toolbox"></div>
<addThis ></addThis>
</dd>
</dl>
</li>

View File

@ -6,19 +6,19 @@ import { FormsModule } from '@angular/forms';
import {TabPagingComponent} from './tabPaging.component';
import {ShowTitleComponent} from './showTitle.component';
import {AddThisComponent} from './addThis.component';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
TabPagingComponent, ShowTitleComponent,
TabPagingComponent, ShowTitleComponent, AddThisComponent
],
providers:[
],
exports: [
TabPagingComponent, ShowTitleComponent,
TabPagingComponent, ShowTitleComponent, AddThisComponent
]
})
export class LandingModule { }

View File

@ -34,7 +34,7 @@
<li class="uk-active">
<a href="#projectsTab">
Projects
<span class="uk-badge uk-badge-notification">{{projectsNum}}</span>
<span class="uk-badge uk-badge-notification">{{(searchingProjectsTabComponent)?searchingProjectsTabComponent.fetchProjects.totalResults:0}}</span>
</a>
</li>
<li (click)="searchDataprovidersInit()">
@ -58,8 +58,8 @@
<ul id="tab-content" class="uk-switcher uk-margin">
<li id="projectsTab">
<div *ngIf="organizationInfo.projects == undefined" class = "uk-alert">
<searchingProjectsTab [organizationId]=organizationId ></searchingProjectsTab>
<!--div *ngIf="organizationInfo.projects == undefined" class = "uk-alert">
There are no projects
</div>
@ -81,7 +81,7 @@
<span *ngFor="let key of organizationInfo.projects.keys()" class="checkbox">
<label>
<!--input type="checkbox" (ngModelChange)="changeType(key)"-->
<input type="checkbox" (click)='handleClick(key)'>
<!--input type="checkbox" (click)='handleClick(key)'>
{{key}}
</label>
</span>
@ -101,7 +101,7 @@
</td>
<td *ngIf="fundersSet.has(key)">
<!--a *ngIf="item['url'] != '' && item['name'] != ''" href="{{item['url']}}"-->
<a *ngIf="item['id'] != '' && item['name'] != ''"
<!--a *ngIf="item['id'] != '' && item['name'] != ''"
[queryParams]="{projectId: item.id}" routerLinkActive="router-link-active" routerLink="/search/project">
{{item['name']}}
</a>
@ -112,7 +112,7 @@
</tbody>
</table>
</div>
</div-->
</li>
<li id="dataProvidersTab">
@ -152,7 +152,7 @@
<dt >Share - Bookmark
</dt>
<dd>
<div class="addthis_inline_share_toolbox"></div>
<addThis ></addThis>
</dd>
</dl>
</li>

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute} from '@angular/router';
import {OrganizationService} from '../../services/organization.service';
@ -10,7 +10,7 @@ import {SearchPublicationsService} from '../../services/searchPublications.servi
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {SearchingProjectsTabComponent} from '../searchingProjectsInTab.component';
@Component({
selector: 'organization',
templateUrl: 'organization.component.html',
@ -38,6 +38,7 @@ export class OrganizationComponent {
private fetchDataproviders : FetchDataproviders;
private linkToSearchDataproviders = "";
@ViewChild (SearchingProjectsTabComponent) searchingProjectsTabComponent : SearchingProjectsTabComponent ;
constructor (private _organizationService: OrganizationService,
private route: ActivatedRoute,

View File

@ -4,6 +4,7 @@ import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { OrganizationServiceModule} from '../../services/organizationService.module';
// import { ProjectsServiceModule} from '../../services/projectsService.module';
import { OrganizationComponent } from './organization.component';
import { OrganizationRoutingModule } from './organization-routing.module';
@ -13,6 +14,8 @@ import {DataProvidersServiceModule} from '../../services/dataProvidersService.mo
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import { SearchingProjectsTabModule} from '../searchingProjectsInTab.module';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
@ -22,10 +25,13 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
DataProvidersServiceModule,
ReportsServiceModule,
OrganizationServiceModule,
SearchingProjectsTabModule,
OrganizationServiceModule,
PublicationsServiceModule
],
declarations: [
OrganizationComponent
OrganizationComponent,
],
providers:[
],

View File

@ -93,7 +93,7 @@
<dt >Share - Bookmark
</dt>
<dd>
<div class="addthis_inline_share_toolbox"></div>
<addThis ></addThis>
</dd>
</dl>
</li>

View File

@ -49,7 +49,7 @@ export class PersonComponent {
if(this.personId){
this.fetchPersonInfo();
this.searchPublications();
}else{
this.warningMessage="No valid person id";
}

View File

@ -168,7 +168,7 @@
<dt >Share - Bookmark
</dt>
<dd>
<div class="addthis_inline_share_toolbox"></div>
<addThis ></addThis>
</dd>
</dl>
</li>

View File

@ -13,7 +13,7 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
import {ReportsService} from '../../services/reports.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({
selector: 'project',
templateUrl: 'project.component.html',

View File

@ -255,7 +255,7 @@
<dt >Share - Bookmark
</dt>
<dd>
<div class="addthis_inline_share_toolbox"></div>
<addThis></addThis>
</dd>
</dl>
</li>
@ -430,6 +430,7 @@
</div>
</div>
<!--script>
$("#tabs").on('change.uk.tab', function(event, area, previous){
console.info("Switcher switched to ", area);

View File

@ -5,6 +5,9 @@ import {PublicationInfo} from '../../utils/entities/publicationInfo';
import {ActivatedRoute} from '@angular/router';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class';
// declare var switcher:any;
// declare var UIkit:any;
@Component({
selector: 'publication',
@ -42,19 +45,25 @@ export class PublicationComponent {
public warningMessage = "";
public errorMessage = "";
public routerHelper:RouterHelper = new RouterHelper();
constructor (private _publicationService: PublicationService,
private route: ActivatedRoute) {}
private route: ActivatedRoute) {
console.log("******CONSTR");
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(data => {
this.sub = this.route.queryParams.subscribe(data => {
this.articleId = data['articleId'];
console.info("Article id is :"+this.articleId);
if(this.articleId){
this.getPublicationInfo(this.articleId);
// if (typeof document !== 'undefined') {
// switcher(UIkit);
// }
}else{
console.info("Article id not found");
}
this.metricsClicked = false;
this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
@ -91,6 +100,8 @@ export class PublicationComponent {
if(this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) {
this.doi = this.publicationInfo.identifiers.get('doi')[0];
}
},
err => {
console.log(err);

View File

@ -0,0 +1,99 @@
import {Component, Input} from '@angular/core';
import { FetchProjects } from '../utils/fetchEntitiesClasses/fetchProjects.class';
import { SearchProjectsService } from '../services/searchProjects.service';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {StringUtils} from '../utils/string-utils.class';
@Component({
selector: 'searchingProjectsTab',
template: `
<div *ngIf="fetchProjects.searchUtils.totalResults == 0" class = "uk-alert">
There are no projects
</div>
<div *ngIf="fetchProjects.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:feedback@openaire.eu">Let us know how we are doing!</a>
</p>
<div class = "uk-text-right" *ngIf = "fetchProjects.searchUtils.totalResults > 10" ><a [href] = "linkToSearchProjects" >View all {{fetchProjects.totalResults}} results</a></div>
<div class= "searchPaging uk-panel uk-margin-top">
<div class="uk-float-right" *ngIf="fetchProjects.results && fetchProjects.searchUtils.totalResults > fetchProjects.searchUtils.size">
<paging-no-load [currentPage]="page" [totalResults]="fetchProjects.searchUtils.totalResults" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<ul class="uk-list uk-list-line">
<li *ngFor="let filter of fetchProjects.filters " >
<div class="text-bold">Filter by {{filter.title}}:</div>
<span *ngFor = "let value of filter.values" class = "uk-animation-fade">
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<span title = "{{value.name}}"> {{value.name}}</span><span *ngIf = "showResultCount === true" > ({{value.number}})</span>
</span>
</li>
<li *ngIf = "fetchProjects.searchUtils.totalResults !=fetchProjects.totalResults "> Filtered {{fetchProjects.searchUtils.totalResults}} results of {{fetchProjects.totalResults}} total results</li>
<li></li>
</ul>
<search-result [(results)]="fetchProjects.results" [(status)]= "fetchProjects.searchUtils.status"
type="project" urlParam="projectId" showLoading = true>
</search-result>
</div>
`
})
export class SearchingProjectsTabComponent {
public fetchProjects : FetchProjects;
@Input() organizationId:string = "";
public page :number = 1;
public size :number = 10;
public linkToSearchProjects;
private filterQuery:string = "";
public totalResults = 0;
constructor (private _searchProjectsService: SearchProjectsService) {
this.fetchProjects = new FetchProjects(this._searchProjectsService);
}
ngOnInit() {
this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects()+"?organization="+this.organizationId+"or=and";;
this.search(true,"");
}
search(refine:boolean, filterQuery:string){
var refineFields:string [] = ["funderid"];
this.fetchProjects.getResultsForOrganizations(this.organizationId, filterQuery, this.page, this.size,(refine)?refineFields:[]);
}
pageChange($event) {
this.page=$event.value;
this.search(false, this.filterQuery);
}
filterChange($event) {
console.log("Filter Changed");
this.updateFilters();
this.search(true, this.filterQuery);
}
updateFilters (){
this.filterQuery = "";
for (let filter of this.fetchProjects.filters){
var filterLimits="";
for (let value of filter.values){
if(value.selected == true){
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
}
}
if(filterLimits.length > 0){
this.filterQuery+=' and '+filter.filterId + ' exact '+ filterLimits + ' ';
}
}
console.log("Filter Changed"+this.filterQuery);
}
}

View File

@ -0,0 +1,29 @@
/* This module contains all common components for all landing pages */
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { ProjectsServiceModule} from '../services/projectsService.module';
import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module';
import { SearchingProjectsTabComponent} from './searchingProjectsInTab.component';
import {PagingModule } from '../utils/paging.module';
@NgModule({
imports: [
CommonModule, FormsModule, ProjectsServiceModule, SearchResultsModule, PagingModule
],
declarations: [
SearchingProjectsTabComponent
],
providers:[
],
exports: [
SearchingProjectsTabComponent
]
})
export class SearchingProjectsTabModule { }

View File

@ -19,7 +19,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<div *ngIf="filter.values.length == 0" class="uk-alert uk-alert-info" role="alert">No {{filter.title}} statistics found</div>
<ul *ngIf="filter.values.length > 0 && !viewAll" class="uk-list uk-list-line ">
<li *ngFor= "let value of filter.values.slice(0,5)"><!--a [href]="baseUrl+'?'+filter.filterId+'='+value.id">{{_formatName(value)}} ({{value.number}})</a-->
<a [queryParams]="routerHelper.createQueryParam(filter.filterId,value.id)" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{_formatName(value)}} ({{value.number}})</a>
<a [queryParams]="routerHelper.createQueryParam(filter.filterId,quote(value.id))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{_formatName(value)}} ({{value.number}})</a>
</li>
<li *ngIf= " filter.values.length > 5 && !viewAll " (click)="viewAll=true;">
<span ><span class="uk-text-muted clickable">View more </span><a><i class="uk-icon-toggle-right"></i></a></span>
@ -27,7 +27,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
</ul>
<ul *ngIf="filter.values.length > 0 && viewAll" class="uk-list uk-list-line searchFilterBoxValues">
<li *ngFor= "let value of filter.values"><!--a [href]="baseUrl+'?'+filter.filterId+'='+value.id">{{_formatName(value)}} ({{value.number}})</a-->
<a [queryParams]="routerHelper.createQueryParam(filter.filterId,value.id)" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{_formatName(value)}} ({{value.number}})</a>
<a [queryParams]="routerHelper.createQueryParam(filter.filterId,quote(value.id))" routerLinkActive="router-link-active" [routerLink]=baseUrl>{{_formatName(value)}} ({{value.number}})</a>
</li>
<li *ngIf= " filter.values.length > 5 && viewAll " (click)="viewAll=false;">
<span ><span class="uk-text-muted clickable">View less </span><a><i class="uk-icon-toggle-up"></i></a></span>
@ -53,6 +53,9 @@ export class BrowseStatisticComponent {
}
quote(str:string){
return '"'+str+'"';
}
private _formatName(value){
return (((value.name+" ("+value.number+")").length >this._maxCharacters)?(value.name.substring(0,(this._maxCharacters - (" ("+value.number+")").length - ('...').length))+"..."):value.name)

View File

@ -75,7 +75,7 @@ export class SearchPageComponent {
@Input() results = [];
@Input() filters = [];
@Input() type:string = "";
@Input() entityType: string = "aaa";
@Input() entityType: string = "";
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Output() queryChange = new EventEmitter();
@Output() downloadClick = new EventEmitter();
@ -159,8 +159,8 @@ export class SearchPageComponent {
var doiQuery = "";
var keywordQuery = "";
if((keyword && keyword.length > 0)){
if((this.type == 'publications' ||this.type == 'datasets')){
var DOIs:string[] = DOI.getDOIsFromString(keyword);
if((this.type == 'publications' ||this.type == 'datasets')){
var DOIs:string[] = DOI.getDOIsFromString(keyword);
var doisParams = "";
for(var i =0 ;i < DOIs.length; i++){

View File

@ -53,6 +53,7 @@ export class SearchDatasetsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.type = "datasets";
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -62,7 +62,7 @@ export class SearchPublicationsComponent {
public ngOnInit() {
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.type = "publication";
this.searchPage.type = "publications";
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');

View File

@ -94,7 +94,10 @@ export class OrganizationService {
}
}
if(relations != null) {
//Comment Parsing Projects info
/*
if(data[1] != null) {
let counter;
let length = relations.length!=undefined ? relations.length : 1;
@ -153,7 +156,12 @@ export class OrganizationService {
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['endDate'] =
}
}
}
} /*else if(relation['to'].class == "isProvidedBy") {
if(this.organizationInfo.dataProviders == undefined) {
this.organizationInfo.dataProviders = new Array<{ "name": string, "url": string, "type": string, "websiteUrl": string , "organizations": {"name": string, "url": string}[]}>();
}
@ -172,10 +180,11 @@ export class OrganizationService {
}
this.organizationInfo.dataProviders[counter]['websiteUrl'] = relation.websiteurl;
}*/
/* ----->
}
}
}
*/
return this.organizationInfo;
}

View File

@ -89,6 +89,35 @@ export class SearchProjectsService {
})
.map(res => [res['meta'].total, this.parseResults(res['results'])]);
}
getProjectsForOrganizations (organizationId: string, filterquery: string, page: number, size: number, refineFields:string[] ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact project) "
url += "?query=";
if(filterquery!= null && filterquery != '' ) {
url +="( ( "+basicQuery+ " ) and (relorganizationid exact \"" + organizationId + "\")"+" " + filterquery + ")";
}else{
url +=" (( "+basicQuery+ " ) " +" and (relorganizationid exact \"" + organizationId + "\"))";
}
if(refineFields!= null && refineFields.length > 0 ) {
url +="&refine=true";
for(let i=0; i< refineFields.length ; i++ ){
url +="&fields="+refineFields[i];
}
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]);
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.do(res => {
this._cache.set(key, res);
})
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]);
}
getFunders():any {
let url = OpenaireProperties.getSearchAPIURLLast()+"projects?refine=true&fields=funderid&size=0"+ "&format=json";;
let key = url;

View File

@ -1,5 +1,7 @@
import {Component, ElementRef, Input} from '@angular/core';
import {SafeHtmlPipe} from '../utils/pipes/safeHTML.pipe';
import {ActivatedRoute} from '@angular/router';
declare var loadAltmetrics:any;
//<altmetrics [id]="10.7717/peerj.1150" type="doi"></altmetrics>
@Component({
selector: 'altmetrics',
@ -13,17 +15,44 @@ export class AltMetricsComponent {
// public doi="10.7717/peerj.1150";
public altmetrics:string;
private sub:any;
constructor() {
if (typeof document !== 'undefined') {
let yourModule = require('../utils/altmetrics.js');
}
constructor(private route: ActivatedRoute) {
console.log("####constr");
// if (typeof document !== 'undefined') {
// let yourModule = require('../utils/altmetrics.js');
// }
}
ngOnInit() {
if(this.type == "doi"){
this.altmetrics='<div data-badge-popover="right" data-hide-no-mentions="true" data-badge-type="donut" data-doi="'+this.id+'" class="altmetric-embed"> </div>';
}else{
this.altmetrics='<div data-badge-popover="right" data-hide-no-mentions="true" data-badge-type="donut" data-arxiv-id="'+this.id+'" class="altmetric-embed"> </div>';
}
console.log("####init");
this.sub = this.route.queryParams.subscribe(data => {
console.log("####params");
if(this.type == "doi"){
this.altmetrics='<div data-badge-popover="right" data-hide-no-mentions="true" data-badge-type="donut" data-doi="'+this.id+'" class="altmetric-embed"> </div>';
}else{
this.altmetrics='<div data-badge-popover="right" data-hide-no-mentions="true" data-badge-type="donut" data-arxiv-id="'+this.id+'" class="altmetric-embed"> </div>';
}
console.log("####params loadAltmetrics");
if (typeof document !== 'undefined') {
// let yourModule = require('../utils/altmetrics.js');
loadAltmetrics("altmetric-embed-js","https://d1bxh8uas1mnw7.cloudfront.net/assets/altmetric_badges-8f271adb184c21cc5169a7f67f7fe5ab.js");
}
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
update(){
// console.log("Altmetrics update!");
// if (typeof document !== 'undefined') {
// let yourModule = require('../utils/altmetrics.js');
// }
// if(this.type == "doi"){
// this.altmetrics='<div data-badge-popover="right" data-hide-no-mentions="true" data-badge-type="donut" data-doi="'+this.id+'" class="altmetric-embed"> </div>';
// }else{
// this.altmetrics='<div data-badge-popover="right" data-hide-no-mentions="true" data-badge-type="donut" data-arxiv-id="'+this.id+'" class="altmetric-embed"> </div>';
// }
}
}

View File

@ -1 +1,8 @@
!function(e,t,n){var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")}("altmetric-embed-js","https://d1bxh8uas1mnw7.cloudfront.net/assets/altmetric_badges-8f271adb184c21cc5169a7f67f7fe5ab.js");
// !function(e,t,n){
// var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
// return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
// }("altmetric-embed-js","https://d1bxh8uas1mnw7.cloudfront.net/assets/altmetric_badges-8f271adb184c21cc5169a7f67f7fe5ab.js");
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
};

View File

@ -14,10 +14,10 @@ import {EntitiesSearchService} from './entitySearch.service';
'(document:click)': 'handleClick($event)',
},
template: `
<span class="custom-autocomplete">
<span *ngIf = "showSelected && selectedValue != ''">
<span class="uk-alert-default" data-uk-alert="" *ngFor="let item of selected" [title]="showItem(item)" > <span >{{truncate(showItem(item),14)}} </span>
<span class="uk-alert-default" data-uk-alert="" *ngFor="let item of selected" [title]="showItem(item)" > <span >{{showItem(item)}} </span>
<span (click)="remove(item)" aria-hidden="true" title="Remove selection" > <i class="uk-icon-remove clickable"></i> </span>
</span>
</span>
@ -33,7 +33,7 @@ import {EntitiesSearchService} from './entitySearch.service';
<span *ngIf="results == 0 && !showLoading" class="uk-alert uk-alert-info" data-uk-alert=""> No results found</span>
</li>
<li *ngFor=" let item of filtered | async">
<a (click)="select(item)" [title]="showItem(item)">{{truncate(showItem(item),19)}}</a>
<a (click)="select(item)" [title]="showItem(item)" style="text-overflow: ellipsis; ">{{showItem(item)}}</a>
</li>
</ul>

View File

@ -4,6 +4,10 @@ import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class
export class FetchProjects{
public results =[];
public filters; // for getResultsForOrganizations
public totalResults; // for getResultsForOrganizations // this is total results before filtering
public sub: any;
public subResults: any;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -83,5 +87,51 @@ export class FetchProjects{
);
}
public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){
this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
data => {
this.searchUtils.totalResults = data[0]; // the results can be filtered so this number can be no total results
console.info("search Projects for Organization: [Id:"+organizationId+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
if(refineFields && refineFields.length > 0){
this.filters = data[2];
filterquery = decodeURIComponent(filterquery);
console.log("---filterquery:"+filterquery);
for(var i = 0; i < this.filters.length; i++){
if(filterquery.indexOf(this.filters[i].filterId) !== -1){
console.log("this.filters[i].filterId:"+this.filters[i].filterId);
for(var j = 0; j < this.filters[i].values.length; j++){
console.log("this.filters[i].values[j].id:"+this.filters[i].values[j].id);
if(filterquery.indexOf(this.filters[i].values[j].id) !== -1){
this.filters[i].values[j].selected = true;
}
}
}
}
}
if(!this.totalResults && filterquery == ""){
this.totalResults = this.searchUtils.totalResults;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
}
);
}
}

View File

@ -14,7 +14,7 @@ import {RefineFieldResultsService} from '../../services/refineFieldResults.servi
template: `
<span class="custom-autocomplete uk-width-1-1">
<span *ngIf = "showSelected && selectedValue != ''">
<span class="uk-alert-default" data-uk-alert="" *ngFor="let item of selected" [title]="showItem(item)"> <span >{{truncate(showItem(item),14)}} </span>
<span class="uk-alert-default" data-uk-alert="" *ngFor="let item of selected" [title]="showItem(item)"> <span >{{showItem(item)}} </span>
<span (click)="remove(item)" aria-hidden="true" title="Remove selection" > <i class="uk-icon-remove clickable"></i> </span>
</span>
</span>
@ -29,7 +29,7 @@ import {RefineFieldResultsService} from '../../services/refineFieldResults.servi
<span *ngIf="filtered.length == 0" class="uk-alert uk-alert-info" data-uk-alert=""> No results found</span>
</li>
<li *ngFor=" let item of filtered">
<a (click)="select(item)" [title]="showItem(item)">{{truncate(showItem(item),19)}}</a>
<a (click)="select(item)" [title]="showItem(item)" style="text-overflow: ellipsis; ">{{showItem(item)}}</a>
</li>
</ul>
</div>

View File

@ -1,2 +0,0 @@
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
.uk-datepicker{z-index:1050;width:auto;-webkit-animation:uk-fade .2s ease-in-out;animation:uk-fade .2s ease-in-out;-webkit-transform-origin:0 0;transform-origin:0 0}.uk-datepicker-nav{margin-bottom:15px;text-align:center;line-height:20px}.uk-datepicker-nav:after,.uk-datepicker-nav:before{content:"";display:table}.uk-datepicker-nav:after{clear:both}.uk-datepicker-nav a{color:#444;text-decoration:none}.uk-datepicker-nav a:hover{color:#444}.uk-datepicker-previous{float:left}.uk-datepicker-next{float:right}.uk-datepicker-next:after,.uk-datepicker-previous:after{width:20px;font-family:FontAwesome}.uk-datepicker-previous:after{content:"\f053"}.uk-datepicker-next:after{content:"\f054"}.uk-datepicker-table{width:100%}.uk-datepicker-table td,.uk-datepicker-table th{padding:2px}.uk-datepicker-table th{font-size:12px}.uk-datepicker-table a{display:block;width:26px;line-height:24px;text-align:center;color:#444;text-decoration:none;border:1px solid transparent;border-radius:4px}a.uk-datepicker-table-muted{color:#999}.uk-datepicker-table a:focus,.uk-datepicker-table a:hover{background-color:#fafafa;color:#444;outline:0;border-color:rgba(0,0,0,.16);text-shadow:0 1px 0 #fff}.uk-datepicker-table a:active{background-color:#eee;color:#444}.uk-datepicker-table a.uk-active{background:#00a8e6;color:#fff;box-shadow:inset 0 0 5px rgba(0,0,0,.05);text-shadow:0 -1px 0 rgba(0,0,0,.1)}

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
!function(t){"use strict";function i(i,n,e){var s,a=t.$.Deferred(),o=i,r=i;return e[0]===n[0]?(a.resolve(),a.promise()):("object"==typeof i&&(o=i[0],r=i[1]||i[0]),t.$body.css("overflow-x","hidden"),s=function(){n&&n.hide().removeClass("uk-active "+r+" uk-animation-reverse"),e.addClass(o).one(t.support.animation.end,function(){setTimeout(function(){e.removeClass(""+o).css({opacity:"",display:""})},0),a.resolve(),t.$body.css("overflow-x",""),n&&n.css({opacity:"",display:""})}.bind(this)).show()},e.css("animation-duration",this.options.duration+"ms"),n&&n.length?(n.css("animation-duration",this.options.duration+"ms"),n.css("display","none").addClass(r+" uk-animation-reverse").one(t.support.animation.end,function(){s()}.bind(this)).css("display","")):(e.addClass("uk-active"),s()),a.promise())}var n;t.component("switcher",{defaults:{connect:!1,toggle:">*",active:0,animation:!1,duration:200,swiping:!0},animating:!1,boot:function(){t.ready(function(i){t.$("[data-uk-switcher]",i).each(function(){var i=t.$(this);if(!i.data("switcher")){t.switcher(i,t.Utils.options(i.attr("data-uk-switcher")))}})})},init:function(){var i=this;this.on("click.uk.switcher",this.options.toggle,function(t){t.preventDefault(),i.show(this)}),this.options.connect&&(this.connect=t.$(this.options.connect),this.connect.length&&(this.connect.on("click.uk.switcher","[data-uk-switcher-item]",function(n){n.preventDefault();var e=t.$(this).attr("data-uk-switcher-item");if(i.index!=e)switch(e){case"next":case"previous":i.show(i.index+("next"==e?1:-1));break;default:i.show(parseInt(e,10))}}),this.options.swiping&&this.connect.on("swipeRight swipeLeft",function(t){t.preventDefault(),window.getSelection().toString()||i.show(i.index+("swipeLeft"==t.type?1:-1))}),this.update()))},update:function(){this.connect.children().removeClass("uk-active").attr("aria-hidden","true");var t=this.find(this.options.toggle),i=t.filter(".uk-active");if(i.length)this.show(i,!1);else{if(this.options.active===!1)return;i=t.eq(this.options.active),this.show(i.length?i:t.eq(0),!1)}t.not(i).attr("aria-expanded","false"),i.attr("aria-expanded","true")},show:function(e,s){if(!this.animating){var a=this.find(this.options.toggle);isNaN(e)?e=t.$(e):(e=0>e?a.length-1:e,e=a.eq(a[e]?e:0));var o=this,r=t.$(e),c=n[this.options.animation]||function(t,e){if(!o.options.animation)return n.none.apply(o);var s=o.options.animation.split(",");return 1==s.length&&(s[1]=s[0]),s[0]=s[0].trim(),s[1]=s[1].trim(),i.apply(o,[s,t,e])};s!==!1&&t.support.animation||(c=n.none),r.hasClass("uk-disabled")||(a.attr("aria-expanded","false"),r.attr("aria-expanded","true"),a.filter(".uk-active").removeClass("uk-active"),r.addClass("uk-active"),this.options.connect&&this.connect.length&&(this.index=this.find(this.options.toggle).index(r),-1==this.index&&(this.index=0),this.connect.each(function(){var i=t.$(this),n=t.$(i.children()),e=t.$(n.filter(".uk-active")),s=t.$(n.eq(o.index));o.animating=!0,c.apply(o,[e,s]).then(function(){e.removeClass("uk-active"),s.addClass("uk-active"),e.attr("aria-hidden","true"),s.attr("aria-hidden","false"),t.Utils.checkDisplay(s,!0),o.animating=!1})})),this.trigger("show.uk.switcher",[r]))}}}),n={none:function(){var i=t.$.Deferred();return i.resolve(),i.promise()},fade:function(t,n){return i.apply(this,["uk-animation-fade",t,n])},"slide-bottom":function(t,n){return i.apply(this,["uk-animation-slide-bottom",t,n])},"slide-top":function(t,n){return i.apply(this,["uk-animation-slide-top",t,n])},"slide-vertical":function(t,n){var e=["uk-animation-slide-top","uk-animation-slide-bottom"];return t&&t.index()>n.index()&&e.reverse(),i.apply(this,[e,t,n])},"slide-left":function(t,n){return i.apply(this,["uk-animation-slide-left",t,n])},"slide-right":function(t,n){return i.apply(this,["uk-animation-slide-right",t,n])},"slide-horizontal":function(t,n){var e=["uk-animation-slide-right","uk-animation-slide-left"];return t&&t.index()>n.index()&&e.reverse(),i.apply(this,[e,t,n])},scale:function(t,n){return i.apply(this,["uk-animation-scale-up",t,n])}},t.switcher.animations=n}(UIkit);
function switcher(t){"use strict";function i(i,n,e){var s,a=t.$.Deferred(),o=i,r=i;return e[0]===n[0]?(a.resolve(),a.promise()):("object"==typeof i&&(o=i[0],r=i[1]||i[0]),t.$body.css("overflow-x","hidden"),s=function(){n&&n.hide().removeClass("uk-active "+r+" uk-animation-reverse"),e.addClass(o).one(t.support.animation.end,function(){setTimeout(function(){e.removeClass(""+o).css({opacity:"",display:""})},0),a.resolve(),t.$body.css("overflow-x",""),n&&n.css({opacity:"",display:""})}.bind(this)).show()},e.css("animation-duration",this.options.duration+"ms"),n&&n.length?(n.css("animation-duration",this.options.duration+"ms"),n.css("display","none").addClass(r+" uk-animation-reverse").one(t.support.animation.end,function(){s()}.bind(this)).css("display","")):(e.addClass("uk-active"),s()),a.promise())}var n;t.component("switcher",{defaults:{connect:!1,toggle:">*",active:0,animation:!1,duration:200,swiping:!0},animating:!1,boot:function(){t.ready(function(i){t.$("[data-uk-switcher]",i).each(function(){var i=t.$(this);if(!i.data("switcher")){t.switcher(i,t.Utils.options(i.attr("data-uk-switcher")))}})})},init:function(){var i=this;this.on("click.uk.switcher",this.options.toggle,function(t){t.preventDefault(),i.show(this)}),this.options.connect&&(this.connect=t.$(this.options.connect),this.connect.length&&(this.connect.on("click.uk.switcher","[data-uk-switcher-item]",function(n){n.preventDefault();var e=t.$(this).attr("data-uk-switcher-item");if(i.index!=e)switch(e){case"next":case"previous":i.show(i.index+("next"==e?1:-1));break;default:i.show(parseInt(e,10))}}),this.options.swiping&&this.connect.on("swipeRight swipeLeft",function(t){t.preventDefault(),window.getSelection().toString()||i.show(i.index+("swipeLeft"==t.type?1:-1))}),this.update()))},update:function(){this.connect.children().removeClass("uk-active").attr("aria-hidden","true");var t=this.find(this.options.toggle),i=t.filter(".uk-active");if(i.length)this.show(i,!1);else{if(this.options.active===!1)return;i=t.eq(this.options.active),this.show(i.length?i:t.eq(0),!1)}t.not(i).attr("aria-expanded","false"),i.attr("aria-expanded","true")},show:function(e,s){if(!this.animating){var a=this.find(this.options.toggle);isNaN(e)?e=t.$(e):(e=0>e?a.length-1:e,e=a.eq(a[e]?e:0));var o=this,r=t.$(e),c=n[this.options.animation]||function(t,e){if(!o.options.animation)return n.none.apply(o);var s=o.options.animation.split(",");return 1==s.length&&(s[1]=s[0]),s[0]=s[0].trim(),s[1]=s[1].trim(),i.apply(o,[s,t,e])};s!==!1&&t.support.animation||(c=n.none),r.hasClass("uk-disabled")||(a.attr("aria-expanded","false"),r.attr("aria-expanded","true"),a.filter(".uk-active").removeClass("uk-active"),r.addClass("uk-active"),this.options.connect&&this.connect.length&&(this.index=this.find(this.options.toggle).index(r),-1==this.index&&(this.index=0),this.connect.each(function(){var i=t.$(this),n=t.$(i.children()),e=t.$(n.filter(".uk-active")),s=t.$(n.eq(o.index));o.animating=!0,c.apply(o,[e,s]).then(function(){e.removeClass("uk-active"),s.addClass("uk-active"),e.attr("aria-hidden","true"),s.attr("aria-hidden","false"),t.Utils.checkDisplay(s,!0),o.animating=!1})})),this.trigger("show.uk.switcher",[r]))}}}),n={none:function(){var i=t.$.Deferred();return i.resolve(),i.promise()},fade:function(t,n){return i.apply(this,["uk-animation-fade",t,n])},"slide-bottom":function(t,n){return i.apply(this,["uk-animation-slide-bottom",t,n])},"slide-top":function(t,n){return i.apply(this,["uk-animation-slide-top",t,n])},"slide-vertical":function(t,n){var e=["uk-animation-slide-top","uk-animation-slide-bottom"];return t&&t.index()>n.index()&&e.reverse(),i.apply(this,[e,t,n])},"slide-left":function(t,n){return i.apply(this,["uk-animation-slide-left",t,n])},"slide-right":function(t,n){return i.apply(this,["uk-animation-slide-right",t,n])},"slide-horizontal":function(t,n){var e=["uk-animation-slide-right","uk-animation-slide-left"];return t&&t.index()>n.index()&&e.reverse(),i.apply(this,[e,t,n])},scale:function(t,n){return i.apply(this,["uk-animation-scale-up",t,n])}},t.switcher.animations=n}(UIkit);

View File

@ -17,10 +17,6 @@
<!-- Drop down -->
<script src="assets/uikit-2.27.2/js/core/dropdown.min.js" type="text/javascript"></script>
<!-- Datepicker -->
<link href="assets/uikit-2.27.2/css/components/datepicker.almost-flat.min.css" rel="stylesheet" type="text/css" />
<script src="assets/uikit-2.27.2/js/components/datepicker.min.js" type="text/javascript"></script>
<!-- Accordion -->
<link href="assets/uikit-2.27.2/css/components/accordion.almost-flat.min.css" rel="stylesheet" type="text/css" />
<script src="assets/uikit-2.27.2/js/components/accordion.min.js" type="text/javascript"></script>
@ -159,8 +155,14 @@
</div>
</div-->
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-559d24521cd8c080"></script>
<!-- to update addThis: https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-559d24521cd8c080-->
<script type="text/javascript" src="https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-559d24521cd8c080"></script>
<script type="text/javascript" >
function loadAltmetrics(e,t,n){
var d="createElement",c="getElementsByTagName",m="setAttribute",n=document.getElementById(e);
return n&&n.parentNode&&n.parentNode.removeChild(n),n=document[d+"NS"]&&document.documentElement.namespaceURI,n=n?document[d+"NS"](n,"script"):document[d]("script"),n[m]("id",e),n[m]("src",t),(document[c]("head")[0]||document[c]("body")[0]).appendChild(n),n=new Image,void n[m]("src","https://d1uo4w7k31k5mn.cloudfront.net/donut/0.png")
};
</script>
</body>
</html>