diff --git a/portal-2/package.json b/portal-2/package.json index 655adfb8..06548ad4 100644 --- a/portal-2/package.json +++ b/portal-2/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/angular/universal-starter.git" }, "scripts": { - "watch": "webpack --watch", + "watch": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --watch", "watch:dev": "npm run server & npm run watch", "clean:dist": "rimraf dist", "clean:ngc": "rimraf **/*.ngfactory.ts **/*.css.shim.ts", @@ -15,13 +15,13 @@ "build": "webpack --progress", "build:prod:ngc": "npm run clean:ngc && npm run ngc && npm run clean:dist && npm run build:prod", "build:prod:ngc:json": "npm run clean:ngc && npm run ngc && npm run clean:dist && npm run build:prod:json", - "build:prod": "webpack --config webpack.prod.config.ts", + "build:prod": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack.prod.config.ts", "build:prod:json": "webpack --config webpack.prod.config.ts --json | webpack-bundle-size-analyzer", "ngc": "ngc -p tsconfig.aot.json", "prestart": "npm run build", "minify": "uglifyjs dist/client/main.bundle.js --screw-ie8 --compress --mangle --output dist/client/main.bundle.min.js", "minify-test": "uglifyjs dist/client/main.bundle.js --output dist/client/main.xmin.js", - "server": "nodemon dist/server/index.js", + "server": "nodemon dist/server/index.js", "debug:server": "node-nightly --inspect --debug-brk dist/server/index.js", "start": "npm run server", "debug:start": "npm run build && npm run debug:server", @@ -57,6 +57,7 @@ "angular2-platform-node": "~2.1.0-rc.1", "angular2-universal": "~2.1.0-rc.1", "angular2-universal-polyfills": "~2.1.0-rc.1", + "base64url": "^2.0.0", "body-parser": "^1.15.2", "citation-js": "^0.3.0-2", "clipboard": "^1.5.16", @@ -65,9 +66,9 @@ "js.clone": "0.0.3", "methods": "~1.1.2", "morgan": "^1.7.0", - "mydatepicker": "^1.7.3", "preboot": "~4.5.2", "rxjs": "5.0.0-beta.12", + "ts-md5": "^1.2.0", "webfontloader": "^1.6.26", "zone.js": "~0.6.26" }, diff --git a/portal-2/src/app/app-routing.module.ts b/portal-2/src/app/app-routing.module.ts index e1b14ec0..782e7927 100644 --- a/portal-2/src/app/app-routing.module.ts +++ b/portal-2/src/app/app-routing.module.ts @@ -119,18 +119,19 @@ export function getLinkingModule() { return System.import('./claims/linking/linkingGeneric.module' + (process.env.AOT ? '.ngfactory' : '')) .then(mod => mod[(process.env.AOT ? 'LinkingGenericModuleNgFactory' : 'LinkingGenericModule')]); } -// export function getBulkLinkingModule() { -// return System.import('./claims/linking/bulkLinking.module' + (process.env.AOT ? '.ngfactory' : '')) -// .then(mod => mod[(process.env.AOT ? 'BulkLinkingModuleNgFactory' : 'BulkLinkingModule')]); -// } + export function getDirectLinkingModule() { return System.import('./claims/directLinking/directLinking.module' + (process.env.AOT ? '.ngfactory' : '')) .then(mod => mod[(process.env.AOT ? 'DirectLinkingModuleNgFactory' : 'DirectLinkingModule')]); } +export function getUserModule() { + return System.import('./login/user.module' + (process.env.AOT ? '.ngfactory' : '')) + .then(mod => mod[(process.env.AOT ? 'UserModuleNgFactory' : 'UserModule')]); +} @NgModule({ imports: [ RouterModule.forChild([ - { path: '', redirectTo: '/search/find', pathMatch: 'full' }, + { path: '', redirectTo: '/search/find', pathMatch: 'full'}, { path: 'search/publication', loadChildren: getPublicationModule }, { path: 'search/dataset', loadChildren: getDatasetModule }, { path: 'search/person', loadChildren: getPersonModule }, @@ -141,25 +142,14 @@ export function getDirectLinkingModule() { { path: 'participate/deposit-datasets-result', loadChildren: getDepositDatasetsResultsModule }, { path: 'participate/deposit-publications', loadChildren: getDepositPublicationsModule }, { path: 'participate/deposit-publications-result', loadChildren: getDepositPublicationsResultsModule }, - { path: 'search/find', loadChildren: getMainSearchModule , data: { - meta: { - title: 'Home page', - description: 'Description of the home page' - } - }}, + { path: 'search/find', loadChildren: getMainSearchModule }, { path: 'search/find/publications', loadChildren: getSearchPublicationsModule }, { path: 'search/find/datasets', loadChildren: getSearchDatasetsModule }, { path: 'search/find/projects', loadChildren: getSearchProjectsModule }, { path: 'search/find/dataproviders', loadChildren: getSearchDataProvidersModule }, { path: 'search/find/organizations', loadChildren: getSearchOrganizationsModule }, { path: 'search/find/people', loadChildren: getSearchPeopleModule }, - { path: 'search/data-providers', loadChildren: getCompatibleDataProvidersModule, - data: { - meta: { - title: 'Home page', - description: 'Description of the home page' - } - }}, + { path: 'search/data-providers', loadChildren: getCompatibleDataProvidersModule }, { path: 'search/entity-registries', loadChildren: getEntityRegistriesModule }, { path: 'search/advanced/publications', loadChildren: getAdvancedSearchPublicationsModule }, { path: 'search/advanced/datasets', loadChildren: getAdvancedSearchDatasetsModule }, @@ -170,9 +160,10 @@ export function getDirectLinkingModule() { { path: 'project-report', loadChildren: gethtmlProjectReportModule }, { path: 'myclaims', loadChildren: getMyClaimsModule }, { path: 'claims', loadChildren: getClaimsAdminModule }, - // { path: 'participate/bulk-claim', loadChildren: getBulkLinkingModule }, { path: 'participate/claim', loadChildren: getLinkingModule }, { path: 'participate/direct-claim', loadChildren: getDirectLinkingModule }, + { path: 'user-info', loadChildren: getUserModule }, + ]) ], }) diff --git a/portal-2/src/app/app.module.ts b/portal-2/src/app/app.module.ts index 55414537..354e42dc 100755 --- a/portal-2/src/app/app.module.ts +++ b/portal-2/src/app/app.module.ts @@ -6,7 +6,6 @@ import { SharedModule } from './shared/shared.module'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent, XLargeDirective } from './app.component'; - import {SharedComponentsModule} from './sharedComponents/sharedComponents.module'; //navbar import { ErrorModule } from './error/error.module'; import { CacheService } from './shared/cache.service'; @@ -20,8 +19,11 @@ import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module SharedComponentsModule, AppRoutingModule, ErrorModule, - CookieLawModule - ], exports:[], providers:[CacheService] + CookieLawModule, + + ], exports:[], + providers:[CacheService] + }) export class AppModule { } diff --git a/portal-2/src/app/claims/claim-routing.module.ts b/portal-2/src/app/claims/claim-routing.module.ts deleted file mode 100644 index 5749d0a3..00000000 --- a/portal-2/src/app/claims/claim-routing.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -// import { NgModule } from '@angular/core'; -// import { RouterModule } from '@angular/router'; -// -// import {ClaimsAdminComponent} from './claims/claimsAdmin.component'; -// import {ClaimComponent} from './claim/claim.component'; -// import {MyClaimsComponent} from './myClaims/myClaims.component'; -// import { LinkingComponent } from './linking/linking.component'; -// import { BulkLinkingComponent } from './linking/bulkLinking.component'; -// -// @NgModule({ -// imports: [ -// RouterModule.forChild([ -// { path: 'claims', component: ClaimsAdminComponent }, -// { path: 'myclaims', component: MyClaimsComponent }, -// { path: 'claim', component: ClaimComponent }, -// { path: 'linking', component: LinkingComponent }, -// { path: 'bulk-linking', component: BulkLinkingComponent}, -// -// ]) -// ] -// }) -// export class ClaimRoutingModule { } diff --git a/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts b/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts index a3cfed2a..b4f793bb 100644 --- a/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts +++ b/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts @@ -20,7 +20,7 @@ declare var UIkit:any; - @@ -29,7 +29,7 @@ declare var UIkit:any; - + @@ -123,6 +123,7 @@ getCommunities () { data => { this.categories = data.category; this.concepts = []; + this.addCommunityInConcepts(); this.filteredList = []; if (this.query !== ""){ var event = {value: ""}; @@ -140,10 +141,12 @@ getCommunities () { getConcepts () { this.loading = true; if(this.selectedCategoryId != '0'){ + this.concepts = []; + this.addCommunityInConcepts(); this._contextService.getConcepts(this.selectedCategoryId, "").subscribe( data => { this.concepts = data; - this.autocomplete.updateList(this.concepts); + this.addCommunityInConcepts(); if (this.query !== ""){ var event = {value: ""}; event.value = this.query; @@ -167,8 +170,6 @@ getCommunities () { this.warningMessage = ""; this.infoMessage = ""; if(this.selectedCommunityId != communityId){ - console.log( " here"); - this.selectedCommunityId = communityId; this.selectedCommunityLabel = communityLabel; this.getCategories(); @@ -185,5 +186,9 @@ getCommunities () { } } +addCommunityInConcepts(){ + this.concepts.push({"id":this.selectedCommunityId, "label":this.selectedCommunityLabel}); + this.autocomplete.updateList(this.concepts); +} } diff --git a/portal-2/src/app/claims/claim-utils/claimEntities.class.ts b/portal-2/src/app/claims/claim-utils/claimEntities.class.ts index 8af32621..0430d5c7 100644 --- a/portal-2/src/app/claims/claim-utils/claimEntities.class.ts +++ b/portal-2/src/app/claims/claim-utils/claimEntities.class.ts @@ -9,7 +9,10 @@ export class ClaimResult{ public accessRights: string = "OPEN"; public embargoEndDate: string; public date: string; - + public authors: string[] =[]; + public publisher: string; + public description: string; + public resourceType:string; } export class ClaimProject{ public funderId: string; @@ -19,6 +22,10 @@ export class ClaimProject{ public projectAcronym: string; public startDate: string; public endDate: string; + public code: string; + public jurisdiction: string; + public fundingLevel0: string; + } @@ -26,5 +33,5 @@ export class ClaimContext{ public community: string; public category: string; public concept:any; - + } diff --git a/portal-2/src/app/claims/claim-utils/claimProjectSearchForm.component.ts b/portal-2/src/app/claims/claim-utils/claimProjectSearchForm.component.ts index b0e1b322..9edd91f1 100644 --- a/portal-2/src/app/claims/claim-utils/claimProjectSearchForm.component.ts +++ b/portal-2/src/app/claims/claim-utils/claimProjectSearchForm.component.ts @@ -92,7 +92,18 @@ select(item){ this.query = ""; // this.searchTermStream.next(this.query); //clear item = item.value; - var project: ClaimProject = { funderId: (this.selectedFunderId=="0")?item.funderId:this.selectedFunderId,funderName: (this.selectedFunderId=="0")?item.funderName:this.selectedFunderName, projectId: item.id, projectName: item.projectName , projectAcronym: item.projectAcronym, startDate: item.startDate, endDate: item.endDate }; + var project: ClaimProject = new ClaimProject(); + project.funderId = (this.selectedFunderId=="0")?item.funderId:this.selectedFunderId; + project.funderName = (this.selectedFunderId=="0")?item.funderName:this.selectedFunderName; + project.projectId = item.id; + project.projectName = item.projectName; + project.projectAcronym = item.projectAcronym; + project.startDate = item.startDate; + project.endDate = item.endDate; + project.code = item.code; + project.jurisdiction = item.jurisdiction; + project.fundingLevel0 = item.fundingLevel0; + console.log(item); diff --git a/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts b/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts index b43df7ac..185be89b 100644 --- a/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts +++ b/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts @@ -40,11 +40,11 @@ export class ClaimResultSearchFormComponent { // searchType ="publication"; @Input() public select:boolean = true ; @Input() public keyword:string = ''; - @Input() public selectedResults = [] ; + @Input() public selectedResults:ClaimResult[]; // @Output() datasetsChange = new EventEmitter(); // @Output() publicationsChange = new EventEmitter(); - @Output() resultsChange = new EventEmitter(); + // @Output() resultsChange = new EventEmitter(); public errorCodes:ErrorCodes = new ErrorCodes(); @@ -500,34 +500,75 @@ openaireDataPageChange($event) { add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){ console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle); - var result: ClaimResult ; + var result: ClaimResult = new ClaimResult(); + result.id = itemId; + result.type = itemType; + result.source = itemSource; + + result.title = Array.isArray(itemTitle && itemTitle.length > 0 )?itemTitle[0]:itemTitle; + result.url = itemUrl; + result.accessRights = 'OPEN'; + result.embargoEndDate = this.nextDate; + result.date = date; + result.result = item; + if(item.publisher){ + result.publisher = item.publisher; + } + if(itemSource == 'datacite'){ - result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date}; + if(item.creator){ + result.authors =[] + for(var i=0; i< item.creator.length; i++){ + result.authors.push(item.creator[i]); + } + } + + // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date}; }else if (itemSource == 'openaire'){ //TODO put right access rights // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date}; - result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date}; + // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date}; + result.embargoEndDate = accessmode; + }else if(itemSource == 'crossref'){ date = (date == null) ? null : date.substring(0,10); - result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; + result.date = date; + result.resourceType = item.type; + result.description = item.abstract; + if(item.author){ + result.authors =[] + for(var i=0; i< item.author.length; i++){ + result.authors.push(item.author[i].family +" "+ item.author[i].given ); + } + } + // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; }else if (itemSource == 'orcid'){ date = (date == null) ? null : date + "-01.-01" - result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; + result.date = date; + if(item['work-type']){ + result.resourceType = item.type; + + } + if(item.contributors){ + result.authors =[] + for(var i=0; i< item.contributors.length; i++){ + result.authors.push(item.contributors[i]); + } + } + // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; } var found:boolean = this.isSelected( result.id); this.warningMessage = ""; if (!found) { this.selectedResults.push(result); - this.resultsChange.emit({ - value: this.selectedResults - }); + // this.resultsChange.emit({ + // value: this.selectedResults + // }); }else{ this.warningMessage = "Dataset already in selected list"; } } - -Pag } diff --git a/portal-2/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts b/portal-2/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts index 5d2ccd80..7fdd5996 100644 --- a/portal-2/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts +++ b/portal-2/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts @@ -1,12 +1,13 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; +import { AdminLoginGuard} from'../../login/adminLoginGuard.guard'; import { ClaimsAdminComponent } from './claimsAdmin.component'; @NgModule({ imports: [ RouterModule.forChild([ - { path: '', component: ClaimsAdminComponent}, + { path: '', component: ClaimsAdminComponent, canActivate: [AdminLoginGuard]}, ]) ] diff --git a/portal-2/src/app/claims/claimsAdmin/claimsAdmin.module.ts b/portal-2/src/app/claims/claimsAdmin/claimsAdmin.module.ts index 5a1458d2..d1fd96b4 100644 --- a/portal-2/src/app/claims/claimsAdmin/claimsAdmin.module.ts +++ b/portal-2/src/app/claims/claimsAdmin/claimsAdmin.module.ts @@ -5,6 +5,7 @@ import { ClaimsAdminComponent } from './claimsAdmin.component'; import { ClaimsAdminRoutingModule } from './claimsAdmin-routing.module'; // import{ClaimServiceModule} from '../claim-utils/service/claimsService.module'; import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module'; +import { AdminLoginGuard} from'../../login/adminLoginGuard.guard'; @NgModule({ imports: [ @@ -14,6 +15,7 @@ import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.mo DisplayClaimsModule ], + providers:[AdminLoginGuard], declarations: [ ClaimsAdminComponent ] diff --git a/portal-2/src/app/claims/directLinking/directLinking-routing.module.ts b/portal-2/src/app/claims/directLinking/directLinking-routing.module.ts index 448c437b..cf42c202 100644 --- a/portal-2/src/app/claims/directLinking/directLinking-routing.module.ts +++ b/portal-2/src/app/claims/directLinking/directLinking-routing.module.ts @@ -1,12 +1,13 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; +import { LoginGuard} from'../../login/loginGuard.guard'; import { DirectLinkingComponent } from './directLinking.component'; @NgModule({ imports: [ RouterModule.forChild([ - { path: '', component: DirectLinkingComponent}, + { path: '', component: DirectLinkingComponent, canActivate: [LoginGuard]}, ]) ] diff --git a/portal-2/src/app/claims/directLinking/directLinking.component.ts b/portal-2/src/app/claims/directLinking/directLinking.component.ts index cad4d262..97cfea5b 100644 --- a/portal-2/src/app/claims/directLinking/directLinking.component.ts +++ b/portal-2/src/app/claims/directLinking/directLinking.component.ts @@ -142,7 +142,18 @@ export class DirectLinkingComponent { data => { console.log(data); var item =data[0]; - var project: ClaimProject = { funderId: item.funderId,funderName: item.funderName, projectId: id, projectName: item.projectName , projectAcronym: item.projectAcronym, startDate: item.startDate, endDate: item.endDate }; + var project: ClaimProject = new ClaimProject(); + project.funderId = item.funderId; + project.funderName = item.funderName; + project.projectId = id; + project.projectName = item.projectName; + project.projectAcronym = item.projectAcronym; + project.startDate = item.startDate; + project.endDate = item.endDate; + project.code = item.code; + project.jurisdiction = item.jurisdiction; + project.fundingLevel0 = item.fundingLevel0; + this.projects.push( project); this.validInput = this.isValidInput(project); @@ -157,7 +168,15 @@ export class DirectLinkingComponent { this.sub = this.publicationsSearch.searchPublicationById(id).subscribe( data => { var item =data[0]; - var result: ClaimResult = {id: id, type :"publication", source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year}; + var result: ClaimResult = new ClaimResult(); + result.id=id; + result.type="publication"; + result.source="openaire"; + result.title = item['title'].name; + result.url= item['title'].url; + result.result = item; + result.accessRights = item['title'].accessMode; + result.date = item.year; this.displayedResult = result; if(isInlineResult){ this.inlineResult = result; @@ -175,8 +194,15 @@ export class DirectLinkingComponent { this.sub = this.datasetsSearch.searchDatasetById(id).subscribe( data => { var item =data[0]; - var result: ClaimResult = {id: id, type : "dataset", source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year}; - this.displayedResult = result; + var result: ClaimResult = new ClaimResult(); + result.id=id; + result.type="dataset"; + result.source="openaire"; + result.title = item['title'].name; + result.url= item['title'].url; + result.result = item; + result.accessRights = item['title'].accessMode; + result.date = item.year; this.displayedResult = result; if(isInlineResult){ this.inlineResult = result; }else{ diff --git a/portal-2/src/app/claims/directLinking/directLinking.module.ts b/portal-2/src/app/claims/directLinking/directLinking.module.ts index bf283b66..bc216b8f 100644 --- a/portal-2/src/app/claims/directLinking/directLinking.module.ts +++ b/portal-2/src/app/claims/directLinking/directLinking.module.ts @@ -13,6 +13,7 @@ import {StartOverModule} from '../claim-utils/startOver.module'; import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module'; import {PublicationsServiceModule} from '../../services/publicationsService.module'; import {DatasetsServiceModule} from '../../services/datasetsService.module'; +import {LoginGuard} from'../../login/loginGuard.guard'; @@ -24,6 +25,7 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module'; ], + providers:[LoginGuard], declarations: [ DirectLinkingComponent ], exports:[DirectLinkingComponent] diff --git a/portal-2/src/app/claims/linking/bulkLinking-routing.module.ts b/portal-2/src/app/claims/linking/bulkLinking-routing.module.ts deleted file mode 100644 index 4ab17b08..00000000 --- a/portal-2/src/app/claims/linking/bulkLinking-routing.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -// import { NgModule } from '@angular/core'; -// import { RouterModule } from '@angular/router'; -// -// import { BulkLinkingComponent } from './bulkLinking.component'; -// -// @NgModule({ -// imports: [ -// RouterModule.forChild([ -// { path: '', component: BulkLinkingComponent}, -// -// ]) -// ] -// }) -// export class BulkLinkingRoutingModule { } diff --git a/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts b/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts index 4e0c059e..7ba0aa50 100644 --- a/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts +++ b/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts @@ -4,7 +4,7 @@ import {Router} from '@angular/router'; import {ClaimsService} from '../../claim-utils/service/claims.service'; import {ModalLoading} from '../../../utils/modal/loading.component'; import {AlertModal} from '../../../utils/modal/alert'; - +import {Md5} from 'ts-md5/dist/md5'; @Component({ selector: 'claim-insert', @@ -63,12 +63,15 @@ private insert(){ var user="argirok@di.uoa.gr" this.loading.open(); var claims = []; + var directclaims = []; if(this.results){ console.info("results: "+this.results.length); for (var i = 0; i < this.results.length; i++) { - var result=this.results[i]; + if(["crosreff","datacite","orcid"].indexOf(result.source) != -1){ + directclaims.push(this.createDirectClaim(result,this.projects,this.contexts)); + } if(this.contexts){ for (var j = 0; j < this.contexts.length; j++) { var context = this.contexts[j]; @@ -202,26 +205,61 @@ private errorsInClaimsInsertion(insertedIds, errorInClaims){ } createDirectClaim(result, projects, contexts){ var entity = {}; - entity["originalId"]=""; - entity["title"]=""; - entity["authors"]=[]; - entity["publisher"]=""; - entity["description"]=""; - entity["language"]=""; + var md5_id = Md5.hashStr(result.id); + entity["originalId"]="user:claim__"+md5_id; + entity["title"]=result.title; + if(result.authors && result.authors.length > 0){ + entity["authors"]=result.authors; + } + if(result.publisher){ + entity["publisher"]=result.publisher; + } + if(result.description){ + entity["description"]=result.description; + } + // entity["language"]=""; no info entity["type"]=result.type; - entity["pids"]= [];//{type:string, value:string}[]; + if(result.source == "crossref" || result.source == "datacite"){ + entity["pids"]= [];//{type:string, value:string}[]; + entity["pids"].push({type:"DOI",value:result.id}) + } entity["licenseCode"]=result.accessRights; if(result.accessRights == "EMBARGO"){ entity["embargoEndDate"]=result.embargoEndDate; } - entity["resourceType"]=""; - entity["url"]=""; - entity["collectedFromId"]=""; - entity["linksToProjects"]=[]; - entity["contexts"]=[]; - for(var i =0; i < contexts.length; i++){ - entity["contexts"].push(contexts[i].concept.id); + if(result.type =="publication"){ + entity["resourceType"]="0001"; + }else{ + entity["resourceType"]="0021"; } + entity["url"]=result.url; + entity["hostedById"]="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"; + if(result.source == "crossref"){ + entity["collectedFromId"]="openaire____::crossref"; + }else if(result.source == "datacite"){ + entity["collectedFromId"]="openaire____::datacite"; + }else if(result.source == "orcid"){ + entity["collectedFromId"]="openaire____::orcid"; + }else if(result.source == "orpenaire"){ + entity["collectedFromId"]="openaire____::driver"; + } + + if(projects.length>0){ + entity["linksToProjects"]=[]; + for(var i =0; i < projects.length; i++){ + // "info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus", + entity["linksToProjects"].push("info:eu-repo/grantAgreement/"+projects[i].funderName+"/"+projects[i].fundingLevel0+"/"+projects[i].code+"/"+projects[i].jurisdiction+"/"+projects[i].projectName+"/"+projects[i].projectAcronym); + } + } + if(contexts.length > 0){ + entity["contexts"]=[]; + for(var i =0; i < contexts.length; i++){ + entity["contexts"].push(contexts[i].concept.id); + } + } + var json = JSON.stringify(entity); + console.log("\nJSON:\n"+json); + return json; /* { diff --git a/portal-2/src/app/claims/linking/linking-routing.module.ts b/portal-2/src/app/claims/linking/linking-routing.module.ts index 4b0247e5..315f4502 100644 --- a/portal-2/src/app/claims/linking/linking-routing.module.ts +++ b/portal-2/src/app/claims/linking/linking-routing.module.ts @@ -1,12 +1,13 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; +import { LoginGuard} from'../../login/loginGuard.guard'; import { LinkingGenericComponent } from './linkingGeneric.component'; @NgModule({ imports: [ RouterModule.forChild([ - { path: '', component: LinkingGenericComponent}, + { path: '', component: LinkingGenericComponent, canActivate: [LoginGuard]}, ]) ] diff --git a/portal-2/src/app/claims/linking/linkingGeneric.module.ts b/portal-2/src/app/claims/linking/linkingGeneric.module.ts index 6958b742..4c260b22 100644 --- a/portal-2/src/app/claims/linking/linkingGeneric.module.ts +++ b/portal-2/src/app/claims/linking/linkingGeneric.module.ts @@ -11,14 +11,16 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu import {DatasetsServiceModule} from '../../services/datasetsService.module'; import { LinkingRoutingModule } from './linking-routing.module'; import {StartOverModule} from '../claim-utils/startOver.module'; +import {LoginGuard} from'../../login/loginGuard.guard'; @NgModule({ imports: [ SharedModule, SelectedProjectsModule, SelectedContextsModule, SelectedPublicationsModule, InsertClaimsModule, - EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule + EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule, ], + providers:[LoginGuard], declarations: [ LinkingGenericComponent ], exports:[ diff --git a/portal-2/src/app/claims/linking/selected/selectedContexts.component.ts b/portal-2/src/app/claims/linking/selected/selectedContexts.component.ts index 47d73366..a1130095 100644 --- a/portal-2/src/app/claims/linking/selected/selectedContexts.component.ts +++ b/portal-2/src/app/claims/linking/selected/selectedContexts.component.ts @@ -13,7 +13,7 @@ import {ClaimContext} from '../../claim-utils/claimEntities.class'; - +
OpenAIRE
diff --git a/portal-2/src/app/sharedComponents/sharedComponents.module.ts b/portal-2/src/app/sharedComponents/sharedComponents.module.ts index a5d628dc..25684d12 100644 --- a/portal-2/src/app/sharedComponents/sharedComponents.module.ts +++ b/portal-2/src/app/sharedComponents/sharedComponents.module.ts @@ -6,7 +6,7 @@ import { RouterModule } from "@angular/router"; import {NavigationBarComponent} from './navigationBar.component'; import {BottomComponent} from './bottom.component'; -import {LoginComponent} from './login.component'; +import {UserMiniComponent} from '../login/userMini.component'; @NgModule({ @@ -16,13 +16,11 @@ import {LoginComponent} from './login.component'; ], declarations: [ NavigationBarComponent, - BottomComponent, - LoginComponent + BottomComponent,UserMiniComponent ], exports: [ NavigationBarComponent, - BottomComponent, - LoginComponent + BottomComponent,UserMiniComponent ] }) export class SharedComponentsModule{ } diff --git a/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts b/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts index 45d5b198..4633d0b1 100644 --- a/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts +++ b/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts @@ -60,10 +60,9 @@ export class EntitiesAutocompleteComponent { @Input() public keyword = ''; @Input() public fieldId:string ; public currentFieldId: string ; - + public currentFunderId: string ; public warningMessage = ""; public infoMessage = ""; - public tries = 0; public showInput = true; public sub; @@ -80,6 +79,7 @@ export class EntitiesAutocompleteComponent { public focus:boolean = false; constructor (public _search:EntitiesSearchService, private myElement: ElementRef) { this.currentFieldId=this.fieldId; + this.currentFunderId=this.funderId; this.initialize(); } @@ -87,6 +87,9 @@ export class EntitiesAutocompleteComponent { if(this.currentFieldId!=this.fieldId){ //this is going to be called when this.currentFieldId=this.fieldId; this.initialize(); + }else if(this.currentFunderId!=this.funderId){ + this.currentFunderId=this.funderId; + this.initialize(); } } private initialize(){ diff --git a/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts b/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts index 84bd5a4b..81f907f5 100644 --- a/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts +++ b/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts @@ -188,8 +188,31 @@ private fetch (link,id,oafEntityType,type){ value.projectName = value.label; value.endDate = null; value.startDate = null; - value.funderId = (resData['fundingtree'] && resData['fundingtree']['funder'] && resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:""; - value.funderName = (resData['fundingtree'] && resData['fundingtree']['funder'] && resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:""; + value.funderId = ""; + value.funderName = ""; + value.jurisdiction = ""; + value.fundingLevel0 = ""; + value.code = resData['code']; + + if(resData['fundingtree'] && resData['fundingtree']['funder']){ + value.funderId = (resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:""; + value.funderName = (resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:""; + value.jurisdiction = (resData['fundingtree']['funder']['jurisdiction'] )?resData['fundingtree']['funder']['jurisdiction']:""; + if(resData['fundingtree']['funding_level_2']){ + value.fundingLevel0 = (resData['fundingtree']['funding_level_2'] && resData['fundingtree']['funding_level_2']['parent'] && + resData['fundingtree']['funding_level_2']['parent']['funding_level_1'] && resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent'] + && resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0'])? + resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0']['name']:""; + }else if(resData['fundingtree']['funding_level_1']){ + value.fundingLevel0 = (resData['fundingtree']['funding_level_1'] && resData['fundingtree']['funding_level_1']['parent'] && resData['fundingtree']['funding_level_1']['parent']['funding_level_0'])? + resData['fundingtree']['funding_level_1']['parent']['funding_level_0']['name']:""; + }else if(resData['fundingtree']['funding_level_0']){ + value.fundingLevel0 = (resData['fundingtree']['funding_level_0'] )?resData['fundingtree']['funding_level_0']['name']:""; + }else { + value.fundingLevel0=""; + } + } + if(resData.hasOwnProperty("startdate")) { value.startDate = resData.startdate.split('-')[0]; } @@ -198,7 +221,7 @@ private fetch (link,id,oafEntityType,type){ } } - console.info("add:"+value.label+" "+value.id); + // console.info("add:"+value.label+" "+value.id); array.push(value); } diff --git a/portal-2/src/app/utils/my-date-picker/my-date-picker.component.ts b/portal-2/src/app/utils/my-date-picker/my-date-picker.component.ts index 77ad87be..389a5be3 100644 --- a/portal-2/src/app/utils/my-date-picker/my-date-picker.component.ts +++ b/portal-2/src/app/utils/my-date-picker/my-date-picker.component.ts @@ -6,8 +6,8 @@ import { UtilService } from "./services/my-date-picker.util.service"; // webpack1_ declare var require: any; -const myDpStyles: string = require("./my-date-picker.component.css"); -const myDpTpl: string = require("./my-date-picker.component.html"); +// declare var myDpStyles: string = require("./my-date-picker.component.css"); +// declare var myDpTpl: string = require("./my-date-picker.component.html"); // webpack2_ export const MYDP_VALUE_ACCESSOR: any = { @@ -18,8 +18,8 @@ export const MYDP_VALUE_ACCESSOR: any = { @Component({ selector: "my-date-picker", - styles: [myDpStyles], - template: myDpTpl, + styleUrls: ['my-date-picker.component.css'], + templateUrl: 'my-date-picker.component.html', providers: [LocaleService, UtilService, MYDP_VALUE_ACCESSOR], encapsulation: ViewEncapsulation.None }) diff --git a/portal-2/src/browser.module.ts b/portal-2/src/browser.module.ts index ec04ef3f..5b777242 100755 --- a/portal-2/src/browser.module.ts +++ b/portal-2/src/browser.module.ts @@ -53,7 +53,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE'; { provide: 'res', useFactory: getResponse }, { provide: 'LRU', useFactory: getLRU, deps: [] }, CacheService, - Meta, + Meta // { provide: AUTO_PREBOOT, useValue: false } // turn off auto preboot complete ] diff --git a/portal-2/src/index.html b/portal-2/src/index.html index 4a99e0a5..3d357c99 100644 --- a/portal-2/src/index.html +++ b/portal-2/src/index.html @@ -25,7 +25,7 @@ - + @@ -93,10 +93,10 @@ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1); } -.custom-autocomplete .uk-nav-navbar > li > a { - color: #444; -} -.custom-description-list-horizontal{ line-height:200%} + .custom-autocomplete .uk-nav-navbar > li > a { + color: #444; + } + .custom-description-list-horizontal{ line-height:200%} .uk-alert-default { background: #fff none repeat scroll 0 0; border: 1px solid #ddd; @@ -177,6 +177,11 @@ .filterItem span div { overflow: hidden; text-overflow: ellipsis; +} +.browseFilters{ + overflow-y: auto; + overflow-x: hidden; + max-height:200px; } diff --git a/portal-2/src/node.module.ts b/portal-2/src/node.module.ts index 9bbfac37..eb0ac424 100755 --- a/portal-2/src/node.module.ts +++ b/portal-2/src/node.module.ts @@ -48,7 +48,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE'; CacheService, - Meta, + Meta ] }) export class MainModule { diff --git a/portal-2/src/server.routes.ts b/portal-2/src/server.routes.ts index 9e6c1ace..8ca19d00 100644 --- a/portal-2/src/server.routes.ts +++ b/portal-2/src/server.routes.ts @@ -17,7 +17,7 @@ export const routes: string[] = [ 'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result', 'search/data-providers','search/entity-registries', 'project-report', 'claims','myclaims','participate/claim', 'participate/bulk-claim', - 'test', - 'error', 'login' + 'test', 'user-info', + 'error' ];