commit f2a21e6e8871e1d307dfa305c81068351bfc802f Author: argiro.kokogiannaki Date: Fri Jan 26 15:00:07 2018 +0000 An initial commit for Connect portal git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@50428 d315682c-612b-4755-9ff5-7f18f6832af3 diff --git a/.angular-cli.json b/.angular-cli.json new file mode 100644 index 0000000..975ee35 --- /dev/null +++ b/.angular-cli.json @@ -0,0 +1,110 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "project": { + "name": "ng-universal-demo" + }, + "apps": [ + { + "root": "src", + "outDir": "dist/browser", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.ts", + "polyfills": "polyfills.ts", + "test": "test.ts", + "tsconfig": "tsconfig.app.json", + "testTsconfig": "tsconfig.spec.json", + "prefix": "app", + "styles": [ + "styles.css", + "../node_modules/datatables.net-dt/css/jquery.dataTables.css" + ], + "scripts": [ + "../node_modules/jquery/dist/jquery.js", + "../node_modules/datatables.net/js/jquery.dataTables.js" + ], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } + }, + { + "platform": "server", + "root": "src", + "outDir": "dist/server", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.server.ts", + "test": "test.ts", + "tsconfig": "tsconfig.server.json", + "testTsconfig": "tsconfig.spec.json", + "prefix": "app", + "styles": [ + "styles.css" + ], + "scripts": [], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } + } + ], + "e2e": { + "protractor": { + "config": "./protractor.conf.js" + } + }, + "lint": [ + { + "project": "src/tsconfig.app.json", + "exclude": "**/node_modules/**" + }, + { + "project": "src/tsconfig.spec.json", + "exclude": "**/node_modules/**" + }, + { + "project": "e2e/tsconfig.e2e.json", + "exclude": "**/node_modules/**" + } + ], + "test": { + "karma": { + "config": "./karma.conf.js" + } + }, + "defaults": { + "styleExt": "css", + "component": { + "spec": false, + "inlineStyle": true, + "inlineTemplate": true + }, + "directive": { + "spec": false + }, + "class": { + "spec": false + }, + "guard": { + "spec": false + }, + "module": { + "spec": false + }, + "pipe": { + "spec": false + }, + "service": { + "spec": false + } + } + } diff --git a/README.md b/README.md new file mode 100644 index 0000000..96e55e9 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# Angular Universal & Anguar-CLI minimal starter + +> This demo is built following the [Angular-CLI Wiki guide](https://github.com/angular/angular-cli/wiki/stories-universal-rendering) + +We're utilizing packages from the [Angular Universal @nguniversal](https://github.com/angular/universal) repo, such as [ng-module-map-ngfactory-loader](https://github.com/angular/universal/tree/master/modules/module-map-ngfactory-loader) to enable Lazy Loading. + +--- + +## Static or Dynamic +This repo demonstrates the use of 2 different forms of Server Side Rendering. + +**Static** Also known as "prerendering" +* Happens at build time +* Renders your application and replaces the dist index.html with a version rendered at the route `/`. + +**Dynamic** +* Happens at runtime +* Uses `ngExpressEngine` to render you application on the fly at the requested url. + +--- + +## Installation +* `npm install` or `yarn` + +--- + +## Development (Client-side only rendering) +* run `npm run start` which will start `ng serve` (project served at the standard: localhost:4200) + +--- + +## Production + +Depending on whether you're publishing dynamic or static prerendering, run the build command, and then serve up your dist folder assets. + +> **NOTE**: To deploy your **Static** site to a static hosting platform you will have to deploy the *`dist/browser`* folder, rather than the usual *`dist`* + +ie: `npm run build:dynamic` or `npm run build:static`. All of the files that need to be served will be found within the `/dist` folder. + + + +--- + +## Testing Universal (dynamic or static) builds -Locally- + +**Dynamic** : **`npm run start:dynamic`** + +Compiles your application and spins up a Node Express to dynamically serve your Universal application on `http://localhost:4000`. + +**Static** : **`npm run start:static`** + +- Compiles your application and prerenders your applications files, spinning up a demo http-server so you can view it on `http://127.0.0.1:8080` + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..cd9024c --- /dev/null +++ b/package.json @@ -0,0 +1,62 @@ +{ + "name": "openaire-connect", + "version": "1.0.0", + "license": "Openaire", + "contributors": [ + "Argiro Kokogiannaki ", + "Konstantina Galouni " + ], + "scripts": { + "ng": "ng", + "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", + "build:static": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:static", + "build:dynamic": "npm run build:client-and-server-bundles && npm run webpack:server", + "generate:static": "cd dist && node prerender", + "webpack:server": "webpack --config webpack.server.config.js --progress --colors", + "serve:static": "cd dist/browser && http-server", + "serve:dynamic": "node dist/server" + }, + "private": true, + "dependencies": { + "@angular/animations": "^4.2.4", + "@angular/common": "^4.2.4", + "@angular/compiler": "^4.2.4", + "@angular/core": "^4.2.4", + "@angular/forms": "^4.2.4", + "@angular/http": "^4.2.4", + "@angular/platform-browser": "^4.2.4", + "@angular/platform-browser-dynamic": "^4.2.4", + "@angular/platform-server": "^4.2.4", + "@angular/router": "^4.2.4", + "@nguniversal/express-engine": "^1.0.0-beta.3", + "@nguniversal/module-map-ngfactory-loader": "^1.0.0-beta.3", + "angular-datatables": "^4.4.0", + "citation-js": "^0.3.4", + "clipboard": "^1.5.16", + "core-js": "^2.4.1", + "datatables.net": "^1.10.16", + "datatables.net-dt": "^1.10.16", + "jquery": "^3.2.1", + "rxjs": "^5.4.2", + "ts-md5": "^1.2.0", + "wikidata-sdk": "^5.2.9", + "zone.js": "^0.8.14" + }, + "devDependencies": { + "@angular/cli": "^1.3.0", + "@angular/compiler-cli": "^4.2.4", + "@angular/language-service": "^4.2.4", + "@types/datatables.net": "^1.10.8", + "@types/jquery": "^3.2.17", + "@types/node": "^8.0.30", + "cpy-cli": "^1.0.1", + "http-server": "^0.10.0", + "reflect-metadata": "^0.1.10", + "ts-loader": "^2.3.7", + "typescript": "~2.3.3" + } +} diff --git a/prerender.ts b/prerender.ts new file mode 100644 index 0000000..5ddb8cd --- /dev/null +++ b/prerender.ts @@ -0,0 +1,45 @@ +// Load zone.js for the server. +import 'zone.js/dist/zone-node'; +import 'reflect-metadata'; +import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs'; +import { join } from 'path'; + +import { enableProdMode } from '@angular/core'; +// Faster server renders w/ Prod mode (dev mode never needed) +enableProdMode(); + +// Express Engine +import { ngExpressEngine } from '@nguniversal/express-engine'; +// Import module map for lazy loading +import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader'; +import { renderModuleFactory } from '@angular/platform-server'; +import { ROUTES } from './static.paths'; + +// * NOTE :: leave this as require() since this file is built Dynamically from webpack +const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle'); + +const BROWSER_FOLDER = join(process.cwd(), 'browser'); + +// Load the index.html file containing referances to your application bundle. +const index = readFileSync(join('browser', 'index.html'), 'utf8'); + +let previousRender = Promise.resolve(); + +// Iterate each route path +ROUTES.forEach(route => { + var fullPath = join(BROWSER_FOLDER, route); + + // Make sure the directory structure is there + if(!existsSync(fullPath)){ + mkdirSync(fullPath); + } + + // Writes rendered HTML to index.html, replacing the file if it already exists. + previousRender = previousRender.then(_ => renderModuleFactory(AppServerModuleNgFactory, { + document: index, + url: route, + extraProviders: [ + provideModuleMap(LAZY_MODULE_MAP) + ] + })).then(html => writeFileSync(join(fullPath, 'index.html'), html)); +}); diff --git a/server.ts b/server.ts new file mode 100644 index 0000000..6aeb0fa --- /dev/null +++ b/server.ts @@ -0,0 +1,58 @@ +import 'zone.js/dist/zone-node'; +import 'reflect-metadata'; +import { renderModuleFactory } from '@angular/platform-server'; +import { enableProdMode } from '@angular/core'; + +import * as express from 'express'; +import { join } from 'path'; +import { readFileSync } from 'fs'; + +// Faster server renders w/ Prod mode (dev mode never needed) +enableProdMode(); + +// Express server +const app = express(); + +const PORT = process.env.PORT || 4000; +const DIST_FOLDER = join(process.cwd(), 'dist'); + +// Our index.html we'll use as our template +const template = readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString(); + +// * NOTE :: leave this as require() since this file is built Dynamically from webpack +const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle'); + +// Express Engine +import { ngExpressEngine } from '@nguniversal/express-engine'; +// Import module map for lazy loading +import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader'; + +// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine) +app.engine('html', ngExpressEngine({ + bootstrap: AppServerModuleNgFactory, + providers: [ + provideModuleMap(LAZY_MODULE_MAP) + ] +})); + +app.set('view engine', 'html'); +app.set('views', join(DIST_FOLDER, 'browser')); + +/* - Example Express Rest API endpoints - + app.get('/api/**', (req, res) => { }); +*/ + +// Server static files from /browser +app.get('*.*', express.static(join(DIST_FOLDER, 'browser'), { + maxAge: '1y' +})); + +// ALl regular routes use the Universal engine +app.get('*', (req, res) => { + res.render('index', { req }); +}); + +// Start up the Node server +app.listen(PORT, () => { + console.log(`Node Express server listening on http://localhost:${PORT}`); +}); diff --git a/src/app/app.component.ts b/src/app/app.component.ts new file mode 100644 index 0000000..5ae50da --- /dev/null +++ b/src/app/app.component.ts @@ -0,0 +1,51 @@ +import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import { Properties} from './utils/properties'; +@Component({ + //changeDetection: ChangeDetectionStrategy.Default, + //encapsulation: ViewEncapsulation.Emulated, + selector: 'app-root', + styles: [` + `], + template: ` + + +
+
+ +
+
+ + + OpenAIRE uses cookies in order to function properly.
+ Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible. + By using the OpenAIRE portal you accept our use of cookies. Read more + + +
+ + +` + +}) +export class AppComponent { + isClient:boolean = false; + feedbackmail:string = Properties.getFeedbackMail(); + + userMenuItems = [ + ]; + + menuItems = [ +]; + loginUrl = Properties.getLoginURL(); + logOutUrl = Properties.getLogoutURL(); + ngOnInit() { + + if (typeof document !== 'undefined') { + try{ + this.isClient = true; + }catch (e) { + } + } + } +} diff --git a/src/app/app.module.ts b/src/app/app.module.ts new file mode 100755 index 0000000..4397835 --- /dev/null +++ b/src/app/app.module.ts @@ -0,0 +1,79 @@ +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { SharedModule } from './shared/shared.module'; +import { BrowserModule } from '@angular/platform-browser'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { APP_BASE_HREF, CommonModule } from '@angular/common'; +import { HttpModule } from '@angular/http'; +import { RouterModule } from '@angular/router'; +import { AppComponent } from './app.component'; + +import {NavigationBarModule, FeedbackModule, BottomModule, CookieLawModule, ErrorModule} from 'ng-openaire-library'; + +import { OpenaireErrorPageComponent } from './error/errorPage.component'; + +@NgModule({ + + imports: [ + SharedModule, + NoopAnimationsModule, + CommonModule, + HttpModule, +ErrorModule, +NavigationBarModule, FeedbackModule, BottomModule, + CookieLawModule, + BrowserModule.withServerTransition({appId: 'my-app'}), + RouterModule.forRoot([ + { path: '', loadChildren: './home/home.module#HomeModule'}, + { path: 'home', loadChildren: './home/home.module#HomeModule'}, + { path: 'community', loadChildren: './community/community.module#CommunityModule'}, + { path: 'communities', loadChildren: './communities/communities.module#CommunitiesModule'}, + { path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule' }, + { path: 'search/dataset', loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule' }, + { path: 'search/software', loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule' }, + { path: 'search/project', loadChildren: './landingPages/project/libProject.module#LibProjectModule' }, + { path: 'search/dataprovider', loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule' }, + { path: 'search/organization', loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule' }, + { path: 'participate/deposit-datasets', loadChildren: './deposit/datasets/depositDatasets.module#LibDepositDatasetsModule' }, + { path: 'participate/deposit-datasets-result', loadChildren: './deposit/datasets/depositDatasetsResults.module#LibDepositDatasetsResultsModule' }, + { path: 'participate/deposit-subject-result', loadChildren: './deposit/datasets/depositBySubjectResults.module#LibDepositBySubjectResultsModule' }, + { path: 'participate/deposit-publications', loadChildren: './deposit/publications/depositPublications.module#LibDepositPublicationsModule' }, + { path: 'participate/deposit-publications-result', loadChildren: './deposit/publications/depositPublicationsResults.module#LibDepositPublicationsResultsModule' }, + { path: 'search/find', loadChildren: './searchPages/find/libSearch.module#LibMainSearchModule' }, + { path: 'search/find/publications', loadChildren: './searchPages/simple/searchPublications.module#LibSearchPublicationsModule' }, + { path: 'search/find/datasets', loadChildren: './searchPages/simple/searchDatasets.module#LibSearchDatasetsModule' }, + { path: 'search/find/software', loadChildren: './searchPages/simple/searchSoftware.module#LibSearchSoftwareModule' }, + { path: 'search/find/projects', loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule' }, + { path: 'search/find/dataproviders', loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule' }, + { path: 'search/find/organizations', loadChildren: './searchPages/simple/searchOrganizations.module#LibSearchOrganizationsModule' }, + { path: 'search/content-providers', loadChildren: './searchPages/dataProviders/compatibleDataProviders.module#LibCompatibleDataProvidersModule' }, + { path: 'search/content-providers-table', loadChildren: './searchPages/dataProviders/compatibleDataProvidersTable.module#CompatibleDataProvidersTableModule' }, + { path: 'search/entity-registries', loadChildren: './searchPages/dataProviders/entityRegistries.module#LibEntityRegistriesModule' }, + { path: 'search/entity-registries-table', loadChildren: './searchPages/dataProviders/entityRegistriesTable.module#EntityRegistriesTableModule' }, + { path: 'search/journals', loadChildren: './searchPages/dataProviders/journals.module#LibJournalsModule' }, + { path: 'search/journals-table', loadChildren: './searchPages/dataProviders/journalsTable.module#JournalsTableModule' }, + { path: 'search/advanced/publications', loadChildren: './searchPages/advanced/advancedSearchPublications.module#LibAdvancedSearchPublicationsModule' }, + { path: 'search/advanced/datasets', loadChildren: './searchPages/advanced/advancedSearchDatasets.module#LibAdvancedSearchDatasetsModule' }, + { path: 'search/advanced/software', loadChildren: './searchPages/advanced/advancedSearchSoftware.module#LibAdvancedSearchSoftwareModule' }, + { path: 'search/advanced/organizations', loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule' }, + { path: 'search/advanced/dataproviders', loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule' }, + { path: 'search/advanced/projects', loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule' }, + { path: 'project-report', loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule' }, + { path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule' }, + { path: 'claims', loadChildren: './claims/claimsAdmin/claimsAdmin.module#LibClaimsAdminModule' }, + { path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule' }, + { path: 'participate/direct-claim', loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule' }, + { path: 'claims-project-manager', loadChildren: './claims/claimsByToken/claimsByToken.module#LibClaimsByTokenModule' }, + { path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule' }, + { path: 'user-info', loadChildren: './login/libUser.module#LibUserModule' }, + { path: 'error', component: OpenaireErrorPageComponent }, + { path: '**',pathMatch: 'full',component: OpenaireErrorPageComponent } + ]), + ], + declarations: [ AppComponent, OpenaireErrorPageComponent], + exports: [ AppComponent ], + providers:[ ], + bootstrap: [AppComponent] +}) +// +export class AppModule {} diff --git a/src/app/app.server.module.ts b/src/app/app.server.module.ts new file mode 100644 index 0000000..79602ec --- /dev/null +++ b/src/app/app.server.module.ts @@ -0,0 +1,20 @@ +import {NgModule} from '@angular/core'; +import {ServerModule} from '@angular/platform-server'; +import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader'; + +import {AppModule} from './app.module'; +import {AppComponent} from './app.component'; + +@NgModule({ + imports: [ + // The AppServerModule should import your AppModule followed + // by the ServerModule from @angular/platform-server. + AppModule, + ServerModule, + ModuleMapLoaderModule, + ], + // Since the bootstrapped component is not inherited from your + // imported AppModule, it needs to be repeated here. + bootstrap: [AppComponent], +}) +export class AppServerModule {} diff --git a/src/app/claims/claim.module.ts b/src/app/claims/claim.module.ts new file mode 100644 index 0000000..113e859 --- /dev/null +++ b/src/app/claims/claim.module.ts @@ -0,0 +1,68 @@ +// import { NgModule} from '@angular/core'; +// import { CommonModule } from '@angular/common'; +// import { FormsModule } from '@angular/forms'; +// // +// import {UtilsModule} from '../utils/utils.module'; +// import {ServicesModule} from '../services/services.module'; +// +// import { ClaimsService} from '../services/claims.service'; +// //main +// import {ClaimComponent} from './claim/claim.component'; +// import {ClaimsAdminComponent} from './claims/claimsAdmin.component'; +// import {MyClaimsComponent} from './myClaims/myClaims.component'; +// import {LinkingHomeComponent} from './linking/linkingHome.component'; +// import {LinkingComponent} from './linking/linking.component'; +// import { BulkLinkingComponent } from './linking/bulkLinking.component'; +// +// import {BulkClaimComponent} from './linking/bulkClaim/bulkClaim.component'; +// import {ClaimsComponent} from './claim-utils/claims.component'; +// +// import {ClaimContextComponent} from './claim-utils/claimContext.component'; +// import {ClaimProjectsComponent} from './claim-utils/claimProject.component'; +// import {ClaimResultComponent} from './claim-utils/claimResult.component'; +// import {ClaimPublicationComponent} from './claim-utils/claimPublication.component'; +// import {ClaimDatasetComponent} from './claim-utils/claimDataset.component'; +// +// import {ClaimInsertComponent} from './linking/insertClaim/insertClaim.component'; +// +// import {ClaimSelectedContextsComponent} from './linking/selected/selectedContexts.component'; +// import {ClaimSelectedComponent} from './linking/selected/selected.component'; +// import {ClaimSelectedDatasetsComponent} from './linking/selected/selectedDatasets.component'; +// import {ClaimSelectedResultsComponent} from './linking/selected/selectedResults.component'; +// import {ClaimSelectedProjectsComponent} from './linking/selected/selectedProjects.component'; +// import {ClaimSelectedPublicationsComponent} from './linking/selected/selectedPublications.component'; +// +// import {LinkingGenericComponent} from './linking/linkingGeneric.component'; +// +// import {InlineClaimContextComponent} from './inlineClaims/inlineClaimContext.component'; +// import {InlineClaimProjectComponent} from './inlineClaims/inlineClaimProject.component'; +// import {InlineClaimResultComponent} from './inlineClaims/inlineClaimResult.component'; +// import {ClaimEntityFormatter} from '../utils/claimEntityFormatter.component'; +// +// import { Claim } from '../utils/entities/claim'; +// //helpers +// +// import { ClaimRoutingModule } from './claim-routing.module'; +// @NgModule({ +// imports: [ +// CommonModule, FormsModule, +// UtilsModule, +// ServicesModule, +// ClaimRoutingModule +// +// ], +// declarations: [ +// ClaimsAdminComponent, MyClaimsComponent, ClaimComponent, ClaimsComponent, +// BulkLinkingComponent, LinkingComponent, LinkingHomeComponent, LinkingGenericComponent, +// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent, ClaimSelectedComponent, +// ClaimContextComponent, ClaimSelectedContextsComponent, ClaimInsertComponent, ClaimProjectsComponent, ClaimSelectedProjectsComponent, +// ClaimResultComponent, ClaimSelectedPublicationsComponent, ClaimSelectedDatasetsComponent, ClaimSelectedResultsComponent, ClaimPublicationComponent, +// ClaimDatasetComponent, BulkClaimComponent, +// ClaimEntityFormatter +// ], +// providers: [ ClaimsService ], +// exports: [ +// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent +// ] +// }) +// export class ClaimModule { } diff --git a/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts b/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts new file mode 100644 index 0000000..cd92c4e --- /dev/null +++ b/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { OpenaireClaimsAdminComponent } from './claimsAdmin.component'; +import{ PreviousRouteRecorder, IsRouteEnabled ,AdminLoginGuard} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireClaimsAdminComponent, canActivate: [IsRouteEnabled, AdminLoginGuard], + data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}]) + ] +}) +export class ClaimsAdminRoutingModule { } diff --git a/src/app/claims/claimsAdmin/claimsAdmin.component.ts b/src/app/claims/claimsAdmin/claimsAdmin.component.ts new file mode 100644 index 0000000..d2e13bf --- /dev/null +++ b/src/app/claims/claimsAdmin/claimsAdmin.component.ts @@ -0,0 +1,16 @@ +import {Component, ViewChild, Input} from '@angular/core'; +import {Location} from '@angular/common'; +import {Observable} from 'rxjs/Observable'; + +@Component({ + selector: 'openaire-claims-admin', + template: ` + + + + `, + +}) +export class OpenaireClaimsAdminComponent { + +} diff --git a/src/app/claims/claimsAdmin/claimsAdmin.module.ts b/src/app/claims/claimsAdmin/claimsAdmin.module.ts new file mode 100644 index 0000000..44aafc9 --- /dev/null +++ b/src/app/claims/claimsAdmin/claimsAdmin.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; + +import { SharedModule } from '../../shared/shared.module'; +import { OpenaireClaimsAdminComponent } from './claimsAdmin.component'; +import { ClaimsAdminRoutingModule } from './claimsAdmin-routing.module'; +import{ClaimsAdminModule, PreviousRouteRecorder, IsRouteEnabled ,AdminLoginGuard} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + SharedModule, + ClaimsAdminRoutingModule, + ClaimsAdminModule + ], + providers:[AdminLoginGuard, PreviousRouteRecorder,IsRouteEnabled], + declarations: [ + OpenaireClaimsAdminComponent + ] +}) +export class LibClaimsAdminModule { } diff --git a/src/app/claims/claimsByToken/claimsByToken-routing.module.ts b/src/app/claims/claimsByToken/claimsByToken-routing.module.ts new file mode 100644 index 0000000..91c2961 --- /dev/null +++ b/src/app/claims/claimsByToken/claimsByToken-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { OpenaireClaimsByTokenComponent } from './claimsByToken.component'; +import{ PreviousRouteRecorder, IsRouteEnabled ,LoginGuard} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireClaimsByTokenComponent, canActivate: [IsRouteEnabled, LoginGuard], + data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}]) + ] +}) +export class ClaimsByTokenRoutingModule { } diff --git a/src/app/claims/claimsByToken/claimsByToken.component.ts b/src/app/claims/claimsByToken/claimsByToken.component.ts new file mode 100644 index 0000000..c7108d5 --- /dev/null +++ b/src/app/claims/claimsByToken/claimsByToken.component.ts @@ -0,0 +1,13 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'openaire-claims-project-manager', + template: ` +

TODO: fix library issue

+ + `, + +}) +export class OpenaireClaimsByTokenComponent { +} diff --git a/src/app/claims/claimsByToken/claimsByToken.module.ts b/src/app/claims/claimsByToken/claimsByToken.module.ts new file mode 100644 index 0000000..f2260f7 --- /dev/null +++ b/src/app/claims/claimsByToken/claimsByToken.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { SharedModule } from '../../shared/shared.module'; +import { OpenaireClaimsByTokenComponent } from './claimsByToken.component'; +//ClaimsByTokenModule, +import{ PreviousRouteRecorder, IsRouteEnabled ,LoginGuard} from 'ng-openaire-library'; + + + +@NgModule({ + imports: [ + RouterModule, + SharedModule + + ], + providers:[ + LoginGuard, PreviousRouteRecorder, IsRouteEnabled + ], + declarations: [ + OpenaireClaimsByTokenComponent + ], + exports: [ + OpenaireClaimsByTokenComponent + ] +}) +export class LibClaimsByTokenModule { } diff --git a/src/app/claims/directLinking/directLinking-routing.module.ts b/src/app/claims/directLinking/directLinking-routing.module.ts new file mode 100644 index 0000000..f73f859 --- /dev/null +++ b/src/app/claims/directLinking/directLinking-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireDirectLinkingComponent } from './directLinking.component'; +import{ PreviousRouteRecorder, IsRouteEnabled, LoginGuard} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDirectLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder]}, + + ]) + ] +}) +export class DirectLinkingRoutingModule { } diff --git a/src/app/claims/directLinking/directLinking.component.ts b/src/app/claims/directLinking/directLinking.component.ts new file mode 100644 index 0000000..afabe0a --- /dev/null +++ b/src/app/claims/directLinking/directLinking.component.ts @@ -0,0 +1,8 @@ +import {Component, Input} from '@angular/core'; + +@Component({ + selector: 'openaire-directLinking', + template: `` +}) +export class OpenaireDirectLinkingComponent { +} diff --git a/src/app/claims/directLinking/directLinking.module.ts b/src/app/claims/directLinking/directLinking.module.ts new file mode 100644 index 0000000..d5178a4 --- /dev/null +++ b/src/app/claims/directLinking/directLinking.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; + +import { SharedModule } from '../../shared/shared.module'; +import { OpenaireDirectLinkingComponent } from './directLinking.component'; +import{ PreviousRouteRecorder, IsRouteEnabled, LoginGuard, DirectLinkingModule} from 'ng-openaire-library'; +import {DirectLinkingRoutingModule} from './directLinking-routing.module'; + +@NgModule({ + imports: [ + SharedModule, DirectLinkingModule, DirectLinkingRoutingModule + ], + providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled], + declarations: [ + OpenaireDirectLinkingComponent + ], exports:[OpenaireDirectLinkingComponent] +}) +export class LibDirectLinkingModule { } diff --git a/src/app/claims/linking/linking-routing.module.ts b/src/app/claims/linking/linking-routing.module.ts new file mode 100644 index 0000000..4a48405 --- /dev/null +++ b/src/app/claims/linking/linking-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { OpenaireLinkingComponent } from './linkingGeneric.component'; + +import{ PreviousRouteRecorder, IsRouteEnabled, LoginGuard} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder]}, + + ]) + ] +}) +export class LinkingRoutingModule { } diff --git a/src/app/claims/linking/linkingGeneric.component.ts b/src/app/claims/linking/linkingGeneric.component.ts new file mode 100644 index 0000000..ad2bd59 --- /dev/null +++ b/src/app/claims/linking/linkingGeneric.component.ts @@ -0,0 +1,12 @@ +import {Component, Input} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import {ActivatedRoute, Router} from '@angular/router'; + +@Component({ + selector: 'openaire-linking-generic', + template: `` + +}) +export class OpenaireLinkingComponent { + +} diff --git a/src/app/claims/linking/linkingGeneric.module.ts b/src/app/claims/linking/linkingGeneric.module.ts new file mode 100644 index 0000000..a25deb3 --- /dev/null +++ b/src/app/claims/linking/linkingGeneric.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; + +import { SharedModule } from '../../shared/shared.module'; +import {OpenaireLinkingComponent} from './linkingGeneric.component'; +import {LinkingRoutingModule} from './linking-routing.module'; +import{ PreviousRouteRecorder, IsRouteEnabled, LoginGuard, LinkingGenericModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + SharedModule, LinkingRoutingModule, LinkingGenericModule + ], + providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled], + declarations: [ + OpenaireLinkingComponent + ], exports:[ + OpenaireLinkingComponent ] +}) +export class LibLinkingGenericModule { } diff --git a/src/app/claims/myClaims/myClaims-routing.module.ts b/src/app/claims/myClaims/myClaims-routing.module.ts new file mode 100644 index 0000000..665e3b1 --- /dev/null +++ b/src/app/claims/myClaims/myClaims-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import {OpenaireMyClaimsComponent } from './myClaims.component'; +import{ PreviousRouteRecorder, IsRouteEnabled, LoginGuard} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireMyClaimsComponent, canActivate: [IsRouteEnabled, LoginGuard], + data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}]) + ] +}) +export class MyClaimsRoutingModule { } diff --git a/src/app/claims/myClaims/myClaims.component.ts b/src/app/claims/myClaims/myClaims.component.ts new file mode 100644 index 0000000..2bd997b --- /dev/null +++ b/src/app/claims/myClaims/myClaims.component.ts @@ -0,0 +1,21 @@ +import {Component, Input} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; + + +@Component({ + selector: 'openaire-my-claims', + template: ` + + +` + +}) + export class OpenaireMyClaimsComponent { + constructor () { + + } + ngOnInit() { + + } + +} diff --git a/src/app/claims/myClaims/myClaims.module.ts b/src/app/claims/myClaims/myClaims.module.ts new file mode 100644 index 0000000..b3e793f --- /dev/null +++ b/src/app/claims/myClaims/myClaims.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; + +import { SharedModule } from '../../shared/shared.module'; +import { OpenaireMyClaimsComponent } from './myClaims.component'; +import { MyClaimsRoutingModule } from './myClaims-routing.module'; +import{ PreviousRouteRecorder, IsRouteEnabled, LoginGuard, MyClaimsModule} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + SharedModule, + MyClaimsRoutingModule, + MyClaimsModule + + ], + providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled], + declarations: [ + OpenaireMyClaimsComponent + ] +}) +export class LibMyClaimsModule { } diff --git a/src/app/claims/myClaimsDemo.component.ts b/src/app/claims/myClaimsDemo.component.ts new file mode 100644 index 0000000..6490a59 --- /dev/null +++ b/src/app/claims/myClaimsDemo.component.ts @@ -0,0 +1,51 @@ +// import {Component, Input} from '@angular/core'; +// import {Observable} from 'rxjs/Observable'; +// import { Router } from '@angular/router'; +// +// +// +// @Component({ +// selector: 'my-claims-demo', +// template: ` +//

+// +//
+// +// +// +//

Extra parameters for claims admin

+// +// +// +// +// +// +// +//
+//
+// +// +// +// ` +// //(click)="changeOrderby('target')" +// //od_______908::3a5b2885656a91307156325644e73b92 +// +// }) +// export class MyClaimsDemoComponent { +// constructor ( private _router: Router ) { +// } +// user:string="argirok@di.uoa.gr"; +// ngOnInit() { +// +// } +// goToPub(id: number){ +// this._router.navigate( ['Publication', { articleId: id}] ); +// } +// } diff --git a/src/app/communities/communities-routing.module.ts b/src/app/communities/communities-routing.module.ts new file mode 100644 index 0000000..39867b7 --- /dev/null +++ b/src/app/communities/communities-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{CommunitiesComponent} from './communities.component'; +import {FreeGuard,PreviousRouteRecorder} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: CommunitiesComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class CommunitiesRoutingModule { } diff --git a/src/app/communities/communities.component.html b/src/app/communities/communities.component.html new file mode 100644 index 0000000..7a5d9ef --- /dev/null +++ b/src/app/communities/communities.component.html @@ -0,0 +1,5 @@ +
+ +
Communities goes here..
+ +
diff --git a/src/app/communities/communities.component.ts b/src/app/communities/communities.component.ts new file mode 100644 index 0000000..480147f --- /dev/null +++ b/src/app/communities/communities.component.ts @@ -0,0 +1,59 @@ +import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Location} from '@angular/common'; +import "rxjs/add/observable/zip"; +import { Meta, MetaDefinition, ConfigurationService} from 'ng-openaire-library'; + +import { ErrorCodes, RouterHelper, PiwikService} from 'ng-openaire-library'; +import {Properties} from '../utils/properties'; + + +@Component({ + selector: 'communities', + templateUrl: 'communities.component.html', +}) +export class CommunitiesComponent { + public piwiksub: any; + public subfunders: any; + + public pageTitle = "OpenAIRE" + + + + constructor ( + private route: ActivatedRoute, + private _router: Router, + private location: Location, private _meta: Meta,private _piwikService:PiwikService, + private config: ConfigurationService + ) { + + var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; + + var title = "OpenAIRE"; + + var url = Properties.getBaseLink()+this._router.url; + this._meta.setTitle(title); + this._meta.updateMeta("description", description); + this._meta.updateProperty("og:description", description); + this._meta.updateProperty("og:title", title); + this._meta.updateProperty("og:url", url); + + + if(Properties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView("OpenAIRE").subscribe(); + } + + } + + public ngOnInit() { + } + public ngOnDestroy() { + if(this.piwiksub){ + this.piwiksub.unsubscribe(); + } + + + } + +} diff --git a/src/app/communities/communities.module.ts b/src/app/communities/communities.module.ts new file mode 100644 index 0000000..fe45693 --- /dev/null +++ b/src/app/communities/communities.module.ts @@ -0,0 +1,28 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + +import{CommunitiesRoutingModule} from './communities-routing.module'; +import{CommunitiesComponent} from './communities.component'; +import {PiwikService} from 'ng-openaire-library'; + + + +import {Meta, ConfigurationService, FreeGuard, PreviousRouteRecorder,} from 'ng-openaire-library'; +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, + CommunitiesRoutingModule + ], + declarations: [ + CommunitiesComponent + ], + providers:[ + FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService + ], + exports: [ + CommunitiesComponent + ] +}) +export class CommunitiesModule { } diff --git a/src/app/community/community-routing.module.ts b/src/app/community/community-routing.module.ts new file mode 100644 index 0000000..65a6310 --- /dev/null +++ b/src/app/community/community-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{CommunityComponent} from './community.component'; +import {FreeGuard,PreviousRouteRecorder} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: CommunityComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class CommunityRoutingModule { } diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html new file mode 100644 index 0000000..b27f4af --- /dev/null +++ b/src/app/community/community.component.html @@ -0,0 +1,5 @@ +
+ +
Community goes here..
+ +
diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts new file mode 100644 index 0000000..ee0eab4 --- /dev/null +++ b/src/app/community/community.component.ts @@ -0,0 +1,59 @@ +import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Location} from '@angular/common'; +import "rxjs/add/observable/zip"; +import { Meta, MetaDefinition, ConfigurationService} from 'ng-openaire-library'; + +import { ErrorCodes, RouterHelper, PiwikService} from 'ng-openaire-library'; +import {Properties} from '../utils/properties'; + + +@Component({ + selector: 'community', + templateUrl: 'community.component.html', +}) +export class CommunityComponent { + public piwiksub: any; + public subfunders: any; + + public pageTitle = "OpenAIRE" + + + + constructor ( + private route: ActivatedRoute, + private _router: Router, + private location: Location, private _meta: Meta,private _piwikService:PiwikService, + private config: ConfigurationService + ) { + + var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; + + var title = "OpenAIRE"; + + var url = Properties.getBaseLink()+this._router.url; + this._meta.setTitle(title); + this._meta.updateMeta("description", description); + this._meta.updateProperty("og:description", description); + this._meta.updateProperty("og:title", title); + this._meta.updateProperty("og:url", url); + + + if(Properties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView("OpenAIRE").subscribe(); + } + + } + + public ngOnInit() { + } + public ngOnDestroy() { + if(this.piwiksub){ + this.piwiksub.unsubscribe(); + } + + + } + +} diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts new file mode 100644 index 0000000..4ab8e2c --- /dev/null +++ b/src/app/community/community.module.ts @@ -0,0 +1,27 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + +import{CommunityRoutingModule} from './community-routing.module'; +import{CommunityComponent} from './community.component'; +import {PiwikService} from 'ng-openaire-library'; + + +import {Meta, ConfigurationService, FreeGuard, PreviousRouteRecorder,} from 'ng-openaire-library'; +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, + CommunityRoutingModule + ], + declarations: [ + CommunityComponent + ], + providers:[ + FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService + ], + exports: [ + CommunityComponent + ] +}) +export class CommunityModule { } diff --git a/src/app/deposit/datasets/depositBySubject.component.ts b/src/app/deposit/datasets/depositBySubject.component.ts new file mode 100644 index 0000000..ba744b5 --- /dev/null +++ b/src/app/deposit/datasets/depositBySubject.component.ts @@ -0,0 +1,17 @@ +import {Component, Input} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import { Router } from '@angular/router'; + + + +@Component({ + selector: 'openaire-deposit-by-subject', + template: ` + + + ` +}) + +export class OpenaireDepositBySubjectComponent { + +} diff --git a/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts b/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts new file mode 100644 index 0000000..c5039b7 --- /dev/null +++ b/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireDepositBySubjectResultComponent } from './depositBySubjectResult.component'; +import { FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDepositBySubjectResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class DepositBySubjectResultsRoutingModule { } diff --git a/src/app/deposit/datasets/depositBySubjectResult.component.ts b/src/app/deposit/datasets/depositBySubjectResult.component.ts new file mode 100644 index 0000000..7a52c70 --- /dev/null +++ b/src/app/deposit/datasets/depositBySubjectResult.component.ts @@ -0,0 +1,12 @@ +import {Component, Input} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; + + +@Component({ + selector: 'openaire-deposit-by-subject-result', + template:`` +}) + +export class OpenaireDepositBySubjectResultComponent { + +} diff --git a/src/app/deposit/datasets/depositBySubjectResults.module.ts b/src/app/deposit/datasets/depositBySubjectResults.module.ts new file mode 100644 index 0000000..d4aa85f --- /dev/null +++ b/src/app/deposit/datasets/depositBySubjectResults.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { OpenaireDepositBySubjectResultComponent } from './depositBySubjectResult.component'; + +import {DepositBySubjectResultsRoutingModule} from './depositBySubjectResult-routing.module'; +import {DepositBySubjectResultsModule, FreeGuard,PreviousRouteRecorder,IsRouteEnabled } from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DepositBySubjectResultsModule, + DepositBySubjectResultsRoutingModule + ], + declarations: [ + + OpenaireDepositBySubjectResultComponent + + ], + exports: [ + OpenaireDepositBySubjectResultComponent + ], + providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled] +}) +export class LibDepositBySubjectResultsModule { } diff --git a/src/app/deposit/datasets/depositDatasets-routing.module.ts b/src/app/deposit/datasets/depositDatasets-routing.module.ts new file mode 100644 index 0000000..c5e3b1d --- /dev/null +++ b/src/app/deposit/datasets/depositDatasets-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireDepositDatasetsComponent } from './depositDatasets.component'; +import { FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDepositDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class DepositDatasetsRoutingModule { } diff --git a/src/app/deposit/datasets/depositDatasets.component.ts b/src/app/deposit/datasets/depositDatasets.component.ts new file mode 100644 index 0000000..acb3bcf --- /dev/null +++ b/src/app/deposit/datasets/depositDatasets.component.ts @@ -0,0 +1,14 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'openaire-deposit-datasets', + template: ` + + + + ` +}) + +export class OpenaireDepositDatasetsComponent { + +} diff --git a/src/app/deposit/datasets/depositDatasets.module.ts b/src/app/deposit/datasets/depositDatasets.module.ts new file mode 100644 index 0000000..98f0504 --- /dev/null +++ b/src/app/deposit/datasets/depositDatasets.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { OpenaireDepositDatasetsComponent } from './depositDatasets.component'; + import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module'; +import {DepositDatasetsModule, FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DepositDatasetsModule, + DepositDatasetsRoutingModule + ], + declarations: [ + + OpenaireDepositDatasetsComponent + + ], + exports: [ + OpenaireDepositDatasetsComponent + ], + providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled] +}) +export class LibDepositDatasetsModule { } diff --git a/src/app/deposit/datasets/depositDatasetsResult.component.ts b/src/app/deposit/datasets/depositDatasetsResult.component.ts new file mode 100644 index 0000000..4613712 --- /dev/null +++ b/src/app/deposit/datasets/depositDatasetsResult.component.ts @@ -0,0 +1,14 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'openaire-deposit-datasets-result', + template: ` + + + + ` +}) + +export class OpenaireDepositDatasetsResultComponent { + +} diff --git a/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts b/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts new file mode 100644 index 0000000..ab0eb90 --- /dev/null +++ b/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { OpenaireDepositDatasetsResultComponent } from './depositDatasetsResult.component'; +import { FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDepositDatasetsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class DepositDatasetsResultsRoutingModule { } diff --git a/src/app/deposit/datasets/depositDatasetsResults.module.ts b/src/app/deposit/datasets/depositDatasetsResults.module.ts new file mode 100644 index 0000000..35ba3ce --- /dev/null +++ b/src/app/deposit/datasets/depositDatasetsResults.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { OpenaireDepositDatasetsResultComponent } from './depositDatasetsResult.component'; + +import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-routing.module'; +import {DepositDatasetsResultsModule, FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DepositDatasetsResultsModule, + DepositDatasetsResultsRoutingModule + ], + declarations: [ + + OpenaireDepositDatasetsResultComponent, + + ], + exports: [ + OpenaireDepositDatasetsResultComponent, + ], + providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled] +}) +export class LibDepositDatasetsResultsModule { } diff --git a/src/app/deposit/publications/depositPublications-routing.module.ts b/src/app/deposit/publications/depositPublications-routing.module.ts new file mode 100644 index 0000000..3f27028 --- /dev/null +++ b/src/app/deposit/publications/depositPublications-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { OpenaireDepositPublicationsComponent } from './depositPublications.component'; +import { FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDepositPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class DepositPublicationsRoutingModule { } diff --git a/src/app/deposit/publications/depositPublications.component.ts b/src/app/deposit/publications/depositPublications.component.ts new file mode 100644 index 0000000..5708fb0 --- /dev/null +++ b/src/app/deposit/publications/depositPublications.component.ts @@ -0,0 +1,11 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'openaire-deposit-publications', + template: ` + + ` +}) + +export class OpenaireDepositPublicationsComponent { + } diff --git a/src/app/deposit/publications/depositPublications.module.ts b/src/app/deposit/publications/depositPublications.module.ts new file mode 100644 index 0000000..9e0868d --- /dev/null +++ b/src/app/deposit/publications/depositPublications.module.ts @@ -0,0 +1,24 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { OpenaireDepositPublicationsComponent } from './depositPublications.component'; + +import {DepositPublicationsRoutingModule} from './depositPublications-routing.module'; +import {DepositPublicationsModule, FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DepositPublicationsModule, + DepositPublicationsRoutingModule + ], + declarations: [ + OpenaireDepositPublicationsComponent + ], + exports: [ + OpenaireDepositPublicationsComponent, + ], + providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled] +}) +export class LibDepositPublicationsModule { } diff --git a/src/app/deposit/publications/depositPublicationsResult-routing.module.ts b/src/app/deposit/publications/depositPublicationsResult-routing.module.ts new file mode 100644 index 0000000..645a9df --- /dev/null +++ b/src/app/deposit/publications/depositPublicationsResult-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { OpenaireDepositPublicationsResultComponent } from './depositPublicationsResult.component'; +import { FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDepositPublicationsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class DepositPublicationsResultRoutingModule { } diff --git a/src/app/deposit/publications/depositPublicationsResult.component.ts b/src/app/deposit/publications/depositPublicationsResult.component.ts new file mode 100644 index 0000000..0f7c1d6 --- /dev/null +++ b/src/app/deposit/publications/depositPublicationsResult.component.ts @@ -0,0 +1,12 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'openaire-deposit-publications-result', + template: ` + + ` +}) + +export class OpenaireDepositPublicationsResultComponent { + +} diff --git a/src/app/deposit/publications/depositPublicationsResults.module.ts b/src/app/deposit/publications/depositPublicationsResults.module.ts new file mode 100644 index 0000000..3433697 --- /dev/null +++ b/src/app/deposit/publications/depositPublicationsResults.module.ts @@ -0,0 +1,24 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { OpenaireDepositPublicationsResultComponent } from './depositPublicationsResult.component'; + +import {DepositPublicationsResultRoutingModule} from './depositPublicationsResult-routing.module'; +import {DepositPublicationsResultsModule, FreeGuard,PreviousRouteRecorder,IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DepositPublicationsResultsModule, + DepositPublicationsResultRoutingModule + ], + declarations: [ + OpenaireDepositPublicationsResultComponent + ], + exports: [ + OpenaireDepositPublicationsResultComponent + ], + providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled] +}) +export class LibDepositPublicationsResultsModule { } diff --git a/src/app/error/errorPage.component.ts b/src/app/error/errorPage.component.ts new file mode 100644 index 0000000..e96d3dc --- /dev/null +++ b/src/app/error/errorPage.component.ts @@ -0,0 +1,13 @@ +import { Component, Input } from '@angular/core'; +import { Location } from '@angular/common'; + +@Component({ + selector: 'openaire-error', + template: ` + + ` +}) + +export class OpenaireErrorPageComponent { + +} diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts new file mode 100644 index 0000000..8ee1c6a --- /dev/null +++ b/src/app/home/home-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{HomeComponent} from './home.component'; +import {FreeGuard,PreviousRouteRecorder} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: HomeComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class HomeRoutingModule { } diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html new file mode 100644 index 0000000..ca69df5 --- /dev/null +++ b/src/app/home/home.component.html @@ -0,0 +1,38 @@ +
+
+
+
+
+
+
+
+
+

Welcome to Research Community Dashboard!

+

Use a trusted partner to share, link, disseminate and monitor your research.

+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ A logo goes here +
+
+

Neuroinformatics Research Community

+

the France Life Imaging national infrastructure produces data images linking them with methods (software services) producing packages for the context.

+ Subscribe +
+
+
+ +
+
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts new file mode 100644 index 0000000..f1bc8c3 --- /dev/null +++ b/src/app/home/home.component.ts @@ -0,0 +1,174 @@ +import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Location} from '@angular/common'; +import "rxjs/add/observable/zip"; +import { Meta, MetaDefinition, ConfigurationService} from 'ng-openaire-library'; + +import {SearchPublicationsService, SearchDataprovidersService, SearchProjectsService, SearchDatasetsService, SearchOrganizationsService, SearchFields} from 'ng-openaire-library'; +import { ErrorCodes, RouterHelper, NumberUtils, RefineFieldResultsService, PiwikService} from 'ng-openaire-library'; +import {Properties} from '../utils/properties'; + + +@Component({ + selector: 'home', + templateUrl: 'home.component.html', +}) +export class HomeComponent { + public piwiksub: any; + public subfunders: any; + + public pageTitle = "OpenAIRE" + public keyword:string = ""; + + public searchFields:SearchFields = new SearchFields(); + public errorCodes:ErrorCodes = new ErrorCodes(); + public routerHelper:RouterHelper = new RouterHelper(); + + public publicationsSize:any = null; + public datasetsSize:any = null; + public fundersSize:any = null; + public projectsSize:any = null; + public datasourcesSize:any = null; + + showPublications:boolean= false; + showDatasets:boolean= false; + showProjects:boolean= false; + showDataProviders:boolean= false; + +public subPub;public subData;public subProjects;public subOrg; public subDataPr; + + constructor ( + private route: ActivatedRoute, + private _router: Router, + private _searchPublicationsService: SearchPublicationsService, + private _searchDataprovidersService: SearchDataprovidersService, + private _searchProjectsService: SearchProjectsService, + private _searchDatasetsService: SearchDatasetsService, + private _searchOrganizationsService: SearchOrganizationsService, + private _refineFieldResultsService:RefineFieldResultsService, + private location: Location, private _meta: Meta,private _piwikService:PiwikService, + private config: ConfigurationService + ) { + + var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; + + var title = "OpenAIRE"; + + var url = Properties.getBaseLink()+this._router.url; + this._meta.setTitle(title); + this._meta.updateMeta("description", description); + this._meta.updateProperty("og:description", description); + this._meta.updateProperty("og:title", title); + this._meta.updateProperty("og:url", url); + + const entityOne = this.config.isEntityEnabled("publication"); + const entityTwo = this.config.isEntityEnabled("dataset"); + const entityThree = this.config.isEntityEnabled("project"); + const entityFour = this.config.isEntityEnabled("datasource"); + const example = Observable.zip(entityOne,entityTwo,entityThree,entityFour); + + // wait until all observables have emitted a value then emit all as an array + example.subscribe(data => { + this.showPublications = data[0]; + this.showDatasets = data[1]; + this.showProjects = data[2]; + this.showDataProviders = data[3]; + this.getNumbers(); + }); + if(Properties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView("OpenAIRE").subscribe(); + } + + } + + public ngOnInit() { + } + public ngOnDestroy() { + if(this.piwiksub){ + this.piwiksub.unsubscribe(); + } + if(this.subfunders){ + this.subfunders.unsubscribe(); + } + if(this.subPub){ + this.subPub.unsubscribe(); + } + if(this.subData){ + this.subData.unsubscribe(); + } + // if(this.subProjects){ + // this.subProjects.unsubscribe(); + // } + // if(this.subOrg){ + // this.subOrg.unsubscribe(); + // } + if(this.subDataPr){ + this.subDataPr.unsubscribe(); + } + + } + + private getNumbers() { + if(this.showPublications){ + this.subPub = this._searchPublicationsService.numOfSearchPublications("").subscribe( + data => { + console.log("Count results: "+data); + if(data && data != null && data > 0 ){ + this.publicationsSize = NumberUtils.roundNumber(data); + console.log("After round"); + + } + }, + err => { + console.log(err); + } + ); + } + if(this.showDatasets){ + this.subData = this._searchDatasetsService.numOfSearchDatasets("").subscribe( + data => { + if(data && data != null && data > 0 ){ + this.datasetsSize = NumberUtils.roundNumber(data); + } + }, + err => { + console.log(err); + } + ); + } + if(this.showProjects){ + this.subfunders = this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"],"project").subscribe( + data => { + + console.info("Funders: "+data[1][0].title+ " values "+data[1][0].values.length+"]"); + console.info("Projects: "+data[0]); + + if(data[0] && data[0] > 0 ){ + this.projectsSize = NumberUtils.roundNumber(data[0]); + } + if(data[1].length > 0 && data[1][0].filterId == "funder" && data[1][0].values ){ + this.fundersSize = NumberUtils.roundNumber(data[1][0].values.length); + } + + }, + err => { + console.log(err); + }); + } + if(this.showDataProviders){ + this.subDataPr = this._searchDataprovidersService.numOfSearchDataproviders("").subscribe( + data => { + if(data && data != null && data > 0 ){ + this.datasourcesSize = NumberUtils.roundNumber(data); + } + + }, + err => { + console.log(err); + + } + ); + } + } +} diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts new file mode 100644 index 0000000..5e2e2d9 --- /dev/null +++ b/src/app/home/home.module.ts @@ -0,0 +1,36 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + +import{HomeRoutingModule} from './home-routing.module'; +import{HomeComponent} from './home.component'; + + +import {DataProvidersServiceModule, DatasetsServiceModule,ProjectsServiceModule,PublicationsServiceModule, + OrganizationsServiceModule,SearchFormModule,PiwikServiceModule,RefineFieldResultsServiceModule,HelperModule} from 'ng-openaire-library'; +import {Meta, ConfigurationService, FreeGuard, PreviousRouteRecorder,} from 'ng-openaire-library'; +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, + RefineFieldResultsServiceModule, + DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, + PublicationsServiceModule, + OrganizationsServiceModule, + SearchFormModule, + PiwikServiceModule, + HomeRoutingModule, + HelperModule + + ], + declarations: [ + HomeComponent + ], + providers:[ + FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta + ], + exports: [ + HomeComponent + ] +}) +export class HomeModule { } diff --git a/src/app/landingPages/dataProvider/dataProvider-routing.module.ts b/src/app/landingPages/dataProvider/dataProvider-routing.module.ts new file mode 100644 index 0000000..fce156d --- /dev/null +++ b/src/app/landingPages/dataProvider/dataProvider-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireDataProviderComponent } from './dataProvider.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDataProviderComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class DataProviderRoutingModule { } diff --git a/src/app/landingPages/dataProvider/dataProvider.component.ts b/src/app/landingPages/dataProvider/dataProvider.component.ts new file mode 100644 index 0000000..b9d6af7 --- /dev/null +++ b/src/app/landingPages/dataProvider/dataProvider.component.ts @@ -0,0 +1,17 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-dataprovider', + template: ``, + }) +export class OpenaireDataProviderComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/landingPages/dataProvider/libDataProvider.module.ts b/src/app/landingPages/dataProvider/libDataProvider.module.ts new file mode 100644 index 0000000..1a8b3fb --- /dev/null +++ b/src/app/landingPages/dataProvider/libDataProvider.module.ts @@ -0,0 +1,17 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { DataProviderModule } from 'ng-openaire-library'; +import { OpenaireDataProviderComponent } from './dataProvider.component'; +import {DataProviderRoutingModule} from './dataProvider-routing.module'; +import { FreeGuard, PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + + +@NgModule({ + imports: [DataProviderModule, DataProviderRoutingModule], + declarations:[OpenaireDataProviderComponent], + providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled], + exports:[OpenaireDataProviderComponent] +}) +export class LibDataProviderModule { } diff --git a/src/app/landingPages/dataset/dataset-routing.module.ts b/src/app/landingPages/dataset/dataset-routing.module.ts new file mode 100644 index 0000000..aa94134 --- /dev/null +++ b/src/app/landingPages/dataset/dataset-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireDatasetComponent } from './dataset.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireDatasetComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class DatasetRoutingModule { } diff --git a/src/app/landingPages/dataset/dataset.component.ts b/src/app/landingPages/dataset/dataset.component.ts new file mode 100644 index 0000000..8bf5e06 --- /dev/null +++ b/src/app/landingPages/dataset/dataset.component.ts @@ -0,0 +1,17 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-dataset', + template: ``, + }) +export class OpenaireDatasetComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/landingPages/dataset/libDataset.module.ts b/src/app/landingPages/dataset/libDataset.module.ts new file mode 100644 index 0000000..5806e24 --- /dev/null +++ b/src/app/landingPages/dataset/libDataset.module.ts @@ -0,0 +1,17 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; +import { DatasetModule, FreeGuard, PreviousRouteRecorder, IsRouteEnabled } from 'ng-openaire-library'; +import { OpenaireDatasetComponent } from './dataset.component'; + +import {DatasetRoutingModule} from './dataset-routing.module'; + @NgModule({ + imports: [DatasetModule, DatasetRoutingModule], + declarations:[OpenaireDatasetComponent], + providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled], + exports:[OpenaireDatasetComponent] +}) +export class LibDatasetModule { } diff --git a/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts b/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts new file mode 100644 index 0000000..fab0839 --- /dev/null +++ b/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireHtmlProjectReportComponent , canActivate: [FreeGuard, IsRouteEnabled],canDeactivate: [PreviousRouteRecorder]} + ]) +] +}) +export class HtmlProjectReportRoutingModule { } diff --git a/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts new file mode 100644 index 0000000..e834441 --- /dev/null +++ b/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -0,0 +1,17 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-htmlProjectReport', + template: ``, + }) +export class OpenaireHtmlProjectReportComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/landingPages/htmlProjectReport/libHtmlProjectReport.module.ts b/src/app/landingPages/htmlProjectReport/libHtmlProjectReport.module.ts new file mode 100644 index 0000000..8868670 --- /dev/null +++ b/src/app/landingPages/htmlProjectReport/libHtmlProjectReport.module.ts @@ -0,0 +1,18 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; +import { HtmlProjectReportModule , FreeGuard, PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.component'; +import {HtmlProjectReportRoutingModule} from './htmlProjectReport-routing.module'; + +@NgModule({ + imports: [HtmlProjectReportModule, HtmlProjectReportRoutingModule], + declarations:[OpenaireHtmlProjectReportComponent], + providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled], + exports:[OpenaireHtmlProjectReportComponent] +}) +export class LibHtmlProjectReportModule { } diff --git a/src/app/landingPages/organization/libOrganization.module.ts b/src/app/landingPages/organization/libOrganization.module.ts new file mode 100644 index 0000000..f1d7032 --- /dev/null +++ b/src/app/landingPages/organization/libOrganization.module.ts @@ -0,0 +1,18 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; +import { OrganizationModule, FreeGuard, PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +import { OpenaireOrganizationComponent } from './organization.component'; +import {OrganizationRoutingModule} from './organization-routing.module'; + +@NgModule({ + imports: [OrganizationModule, OrganizationRoutingModule], + declarations:[OpenaireOrganizationComponent], + providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled], + exports:[OpenaireOrganizationComponent] +}) +export class LibOrganizationModule { } diff --git a/src/app/landingPages/organization/organization-routing.module.ts b/src/app/landingPages/organization/organization-routing.module.ts new file mode 100644 index 0000000..093a3ec --- /dev/null +++ b/src/app/landingPages/organization/organization-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireOrganizationComponent } from './organization.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireOrganizationComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class OrganizationRoutingModule { } diff --git a/src/app/landingPages/organization/organization.component.ts b/src/app/landingPages/organization/organization.component.ts new file mode 100644 index 0000000..f3df57b --- /dev/null +++ b/src/app/landingPages/organization/organization.component.ts @@ -0,0 +1,17 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-organization', + template: ``, + }) +export class OpenaireOrganizationComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/landingPages/project/libProject.module.ts b/src/app/landingPages/project/libProject.module.ts new file mode 100644 index 0000000..7951c8d --- /dev/null +++ b/src/app/landingPages/project/libProject.module.ts @@ -0,0 +1,18 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; +import { ProjectModule, FreeGuard, PreviousRouteRecorder, IsRouteEnabled } from 'ng-openaire-library'; + +import { OpenaireProjectComponent } from './project.component'; +import {ProjectRoutingModule} from './project-routing.module'; + +@NgModule({ + imports: [ProjectModule, ProjectRoutingModule], + declarations:[OpenaireProjectComponent], + providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled], + exports:[OpenaireProjectComponent] +}) +export class LibProjectModule { } diff --git a/src/app/landingPages/project/project-routing.module.ts b/src/app/landingPages/project/project-routing.module.ts new file mode 100644 index 0000000..0a114c6 --- /dev/null +++ b/src/app/landingPages/project/project-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { OpenaireProjectComponent } from './project.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireProjectComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + ]) + ] +}) +export class ProjectRoutingModule { } diff --git a/src/app/landingPages/project/project.component.ts b/src/app/landingPages/project/project.component.ts new file mode 100644 index 0000000..f4876ba --- /dev/null +++ b/src/app/landingPages/project/project.component.ts @@ -0,0 +1,17 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-project', + template: ``, + }) +export class OpenaireProjectComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/landingPages/publication/libPublication.module.ts b/src/app/landingPages/publication/libPublication.module.ts new file mode 100644 index 0000000..0cbfcbb --- /dev/null +++ b/src/app/landingPages/publication/libPublication.module.ts @@ -0,0 +1,18 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; +import { PublicationModule, FreeGuard, PreviousRouteRecorder, IsRouteEnabled } from 'ng-openaire-library'; + +import { OpenairePublicationComponent } from './publication.component'; +import {PublicationRoutingModule} from './publication-routing.module'; + +@NgModule({ + imports: [PublicationModule, PublicationRoutingModule], + declarations:[OpenairePublicationComponent], + providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled], + exports:[OpenairePublicationComponent] +}) +export class LibPublicationModule { } diff --git a/src/app/landingPages/publication/publication-routing.module.ts b/src/app/landingPages/publication/publication-routing.module.ts new file mode 100644 index 0000000..24057fe --- /dev/null +++ b/src/app/landingPages/publication/publication-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import {OpenairePublicationComponent } from './publication.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenairePublicationComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class PublicationRoutingModule { } diff --git a/src/app/landingPages/publication/publication.component.ts b/src/app/landingPages/publication/publication.component.ts new file mode 100644 index 0000000..4120950 --- /dev/null +++ b/src/app/landingPages/publication/publication.component.ts @@ -0,0 +1,17 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-publication', + template: ``, + }) +export class OpenairePublicationComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/landingPages/software/libSoftware.module.ts b/src/app/landingPages/software/libSoftware.module.ts new file mode 100644 index 0000000..7003941 --- /dev/null +++ b/src/app/landingPages/software/libSoftware.module.ts @@ -0,0 +1,17 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { RouterModule } from '@angular/router'; +import { SoftwareModule, FreeGuard, PreviousRouteRecorder, IsRouteEnabled } from 'ng-openaire-library'; + +import { OpenaireSoftwareComponent } from './software.component'; +import {SoftwareRoutingModule} from './software-routing.module'; +@NgModule({ + imports: [SoftwareModule, SoftwareRoutingModule], + declarations:[OpenaireSoftwareComponent], + providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled], + exports:[OpenaireSoftwareComponent] +}) +export class LibSoftwareModule { } diff --git a/src/app/landingPages/software/software-routing.module.ts b/src/app/landingPages/software/software-routing.module.ts new file mode 100644 index 0000000..bf1956d --- /dev/null +++ b/src/app/landingPages/software/software-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import {OpenaireSoftwareComponent } from './software.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSoftwareComponent, canActivate: [FreeGuard, IsRouteEnabled],canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class SoftwareRoutingModule { } diff --git a/src/app/landingPages/software/software.component.ts b/src/app/landingPages/software/software.component.ts new file mode 100644 index 0000000..b073066 --- /dev/null +++ b/src/app/landingPages/software/software.component.ts @@ -0,0 +1,17 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-software', + template: ``, + }) +export class OpenaireSoftwareComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/login/libUser.module.ts b/src/app/login/libUser.module.ts new file mode 100644 index 0000000..8e543b5 --- /dev/null +++ b/src/app/login/libUser.module.ts @@ -0,0 +1,21 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import {OpenaireUserComponent } from './user.component'; +import { UserRoutingModule } from './user-routing.module'; +import {PreviousRouteRecorder, UserModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + UserRoutingModule, UserModule + + ], + providers:[PreviousRouteRecorder], + declarations: [ +OpenaireUserComponent + +] +}) +export class LibUserModule { } diff --git a/src/app/login/user-routing.module.ts b/src/app/login/user-routing.module.ts new file mode 100644 index 0000000..3d58ea3 --- /dev/null +++ b/src/app/login/user-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import {OpenaireUserComponent } from './user.component'; +import {PreviousRouteRecorder} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireUserComponent, canDeactivate: [PreviousRouteRecorder]}, + + ]) + ] +}) +export class UserRoutingModule { } diff --git a/src/app/login/user.component.ts b/src/app/login/user.component.ts new file mode 100644 index 0000000..0b7e1a3 --- /dev/null +++ b/src/app/login/user.component.ts @@ -0,0 +1,11 @@ +import {Component, ElementRef} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; + +@Component({ + selector: 'openaire-user', + template: `` + }) + +export class OpenaireUserComponent { + +} diff --git a/src/app/reload/libReload.module.ts b/src/app/reload/libReload.module.ts new file mode 100644 index 0000000..9586b0e --- /dev/null +++ b/src/app/reload/libReload.module.ts @@ -0,0 +1,23 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + + import{ReloadModule} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, ReloadModule + ], + declarations: [ + + ], + providers:[ + + ], + exports: [ + + ] +}) +export class LibReloadModule { } diff --git a/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts b/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts new file mode 100644 index 0000000..22919a1 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import{OpenaireAdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireAdvancedSearchDataProvidersComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class AdvancedSearchDataProvidersRoutingModule { } diff --git a/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts b/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts new file mode 100644 index 0000000..f5cc238 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts @@ -0,0 +1,14 @@ +import {Component, Input, ViewChild} from '@angular/core'; + + +@Component({ + selector: 'openaire-advanced-search-dataprovider', + template: ` + + + + ` + }) + +export class OpenaireAdvancedSearchDataProvidersComponent { +} diff --git a/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts b/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts new file mode 100644 index 0000000..3f7613e --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts @@ -0,0 +1,24 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ AdvancedSearchDataProvidersRoutingModule} from './advancedSearchDataProviders-routing.module'; +import{OpenaireAdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component'; +import {AdvancedSearchDataProvidersModule,FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + AdvancedSearchDataProvidersRoutingModule, + AdvancedSearchDataProvidersModule + + ], + declarations: [ + OpenaireAdvancedSearchDataProvidersComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireAdvancedSearchDataProvidersComponent + ] +}) +export class LibAdvancedSearchDataProvidersModule { } diff --git a/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts b/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts new file mode 100644 index 0000000..24e9895 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireAdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireAdvancedSearchDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class AdvancedSearchDatasetsRoutingModule { } diff --git a/src/app/searchPages/advanced/advancedSearchDatasets.component.ts b/src/app/searchPages/advanced/advancedSearchDatasets.component.ts new file mode 100644 index 0000000..86e57d0 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchDatasets.component.ts @@ -0,0 +1,16 @@ +import {Component, Input, ViewChild} from '@angular/core'; + + +@Component({ + selector: 'openaire-advanced-search-datasets', + template: ` + + + + ` + }) + +export class OpenaireAdvancedSearchDatasetsComponent { + + +} diff --git a/src/app/searchPages/advanced/advancedSearchDatasets.module.ts b/src/app/searchPages/advanced/advancedSearchDatasets.module.ts new file mode 100644 index 0000000..f91d6b4 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchDatasets.module.ts @@ -0,0 +1,26 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ AdvancedSearchDatasetsRoutingModule} from './advancedSearchDatasets-routing.module'; +import{OpenaireAdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component'; + + + import {AdvancedSearchDatasetsModule,FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + AdvancedSearchDatasetsModule, + AdvancedSearchDatasetsRoutingModule + + ], + declarations: [ + OpenaireAdvancedSearchDatasetsComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireAdvancedSearchDatasetsComponent + ] +}) +export class LibAdvancedSearchDatasetsModule { } diff --git a/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts b/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts new file mode 100644 index 0000000..c7bf1ad --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireAdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireAdvancedSearchOrganizationsComponent , canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + },canDeactivate: [PreviousRouteRecorder]} + + ]) + ] +}) +export class AdvancedSearchOrganizationsRoutingModule { } diff --git a/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts b/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts new file mode 100644 index 0000000..cc9339e --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts @@ -0,0 +1,16 @@ +import {Component, Input, ViewChild} from '@angular/core'; + + +@Component({ + selector: 'openaire-advanced-search-organizations', + template: ` + + + + ` + }) + +export class OpenaireAdvancedSearchOrganizationsComponent { + + +} diff --git a/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts b/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts new file mode 100644 index 0000000..c4cdd3d --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts @@ -0,0 +1,27 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ AdvancedSearchOrganizationsRoutingModule} from './advancedSearchOrganizations-routing.module'; +import{OpenaireAdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component'; + + + + import {AdvancedSearchOrganizationsModule, FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + AdvancedSearchOrganizationsModule, + AdvancedSearchOrganizationsRoutingModule + + ], + declarations: [ + OpenaireAdvancedSearchOrganizationsComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireAdvancedSearchOrganizationsComponent + ] +}) +export class LibAdvancedSearchOrganizationsModule { } diff --git a/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts b/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts new file mode 100644 index 0000000..ae3381a --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireAdvancedSearchProjectsComponent} from './advancedSearchProjects.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireAdvancedSearchProjectsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class AdvancedSearchProjectsRoutingModule { } diff --git a/src/app/searchPages/advanced/advancedSearchProjects.component.ts b/src/app/searchPages/advanced/advancedSearchProjects.component.ts new file mode 100644 index 0000000..50bf7e4 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchProjects.component.ts @@ -0,0 +1,13 @@ +import {Component, Input, ViewChild} from '@angular/core'; +@Component({ + selector: 'openaire-advanced-search-projects', + template: ` + + + + ` + }) + +export class OpenaireAdvancedSearchProjectsComponent { + +} diff --git a/src/app/searchPages/advanced/advancedSearchProjects.module.ts b/src/app/searchPages/advanced/advancedSearchProjects.module.ts new file mode 100644 index 0000000..41830dc --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchProjects.module.ts @@ -0,0 +1,26 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ AdvancedSearchProjectsRoutingModule} from './advancedSearchProjects-routing.module'; +import{OpenaireAdvancedSearchProjectsComponent} from './advancedSearchProjects.component'; + + + import {AdvancedSearchProjectsModule, FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + AdvancedSearchProjectsModule, + AdvancedSearchProjectsRoutingModule + + ], + declarations: [ + OpenaireAdvancedSearchProjectsComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireAdvancedSearchProjectsComponent + ] +}) +export class LibAdvancedSearchProjectsModule { } diff --git a/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts b/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts new file mode 100644 index 0000000..c4fec9e --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireAdvancedSearchPublicationsComponent} from './advancedSearchPublications.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireAdvancedSearchPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class AdvancedSearchPublicationsRoutingModule { } diff --git a/src/app/searchPages/advanced/advancedSearchPublications.component.ts b/src/app/searchPages/advanced/advancedSearchPublications.component.ts new file mode 100644 index 0000000..26e393d --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchPublications.component.ts @@ -0,0 +1,13 @@ +import {Component, Input, ViewChild} from '@angular/core'; + + +@Component({ + selector: 'openaire-advanced-search-publications', + template: ` + + + ` + }) + +export class OpenaireAdvancedSearchPublicationsComponent { +} diff --git a/src/app/searchPages/advanced/advancedSearchPublications.module.ts b/src/app/searchPages/advanced/advancedSearchPublications.module.ts new file mode 100644 index 0000000..166d8d2 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchPublications.module.ts @@ -0,0 +1,26 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ AdvancedSearchPublicationsRoutingModule} from './advancedSearchPublications-routing.module'; +import{OpenaireAdvancedSearchPublicationsComponent} from './advancedSearchPublications.component'; + + + import {AdvancedSearchPublicationsModule, FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + AdvancedSearchPublicationsModule, + AdvancedSearchPublicationsRoutingModule + + ], + declarations: [ + OpenaireAdvancedSearchPublicationsComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireAdvancedSearchPublicationsComponent + ] +}) +export class LibAdvancedSearchPublicationsModule { } diff --git a/src/app/searchPages/advanced/advancedSearchSoftware-routing.module.ts b/src/app/searchPages/advanced/advancedSearchSoftware-routing.module.ts new file mode 100644 index 0000000..529a16d --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchSoftware-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireAdvancedSearchSoftwareComponent} from './advancedSearchSoftware.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireAdvancedSearchSoftwareComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class AdvancedSearchSoftwareRoutingModule { } diff --git a/src/app/searchPages/advanced/advancedSearchSoftware.component.ts b/src/app/searchPages/advanced/advancedSearchSoftware.component.ts new file mode 100644 index 0000000..4bc30c7 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchSoftware.component.ts @@ -0,0 +1,15 @@ +import {Component, Input, ViewChild} from '@angular/core'; + +@Component({ + selector: 'openaire-advanced-search-software', + template: ` + + + + ` + }) + +export class OpenaireAdvancedSearchSoftwareComponent { + + +} diff --git a/src/app/searchPages/advanced/advancedSearchSoftware.module.ts b/src/app/searchPages/advanced/advancedSearchSoftware.module.ts new file mode 100644 index 0000000..649b1b1 --- /dev/null +++ b/src/app/searchPages/advanced/advancedSearchSoftware.module.ts @@ -0,0 +1,27 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ AdvancedSearchSoftwareRoutingModule} from './advancedSearchSoftware-routing.module'; +import{OpenaireAdvancedSearchSoftwareComponent} from './advancedSearchSoftware.component'; + + + import {AdvancedSearchSoftwareModule, FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + AdvancedSearchSoftwareModule, + AdvancedSearchSoftwareRoutingModule + + ], + declarations: [ + OpenaireAdvancedSearchSoftwareComponent + ], + providers:[FreeGuard + ], + exports: [ + OpenaireAdvancedSearchSoftwareComponent + ] +}) +export class LibAdvancedSearchSoftwareModule { } diff --git a/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts b/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts new file mode 100644 index 0000000..2205c73 --- /dev/null +++ b/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchCompatibleDataprovidersComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class CompatibleDataProvidersRoutingModule { } diff --git a/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts b/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts new file mode 100644 index 0000000..d74440b --- /dev/null +++ b/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -0,0 +1,16 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; + +@Component({ + selector: 'openaire-search-content-providers', + template: ` + + + + + ` + +}) +export class OpenaireSearchCompatibleDataprovidersComponent { + +} diff --git a/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts b/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts new file mode 100644 index 0000000..4196f9a --- /dev/null +++ b/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts @@ -0,0 +1,26 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ CompatibleDataProvidersRoutingModule} from './compatibleDataProviders-routing.module'; +import{OpenaireSearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component'; + + +import { FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CompatibleDataProvidersModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + CompatibleDataProvidersModule, + CompatibleDataProvidersRoutingModule + + ], + declarations: [ + OpenaireSearchCompatibleDataprovidersComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireSearchCompatibleDataprovidersComponent + ] +}) +export class LibCompatibleDataProvidersModule { } diff --git a/src/app/searchPages/dataProviders/compatibleDataProvidersTable-routing.module.ts b/src/app/searchPages/dataProviders/compatibleDataProvidersTable-routing.module.ts new file mode 100644 index 0000000..c5b68a6 --- /dev/null +++ b/src/app/searchPages/dataProviders/compatibleDataProvidersTable-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class CompatibleDataProvidersTableRoutingModule { } diff --git a/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts b/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts new file mode 100644 index 0000000..9639868 --- /dev/null +++ b/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts @@ -0,0 +1,193 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import {Location} from '@angular/common'; +import { ActivatedRoute} from '@angular/router'; +import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; +import { ErrorCodes, SearchFields,SearchDataprovidersService, SearchUtilsClass, Filter, Value } from 'ng-openaire-library'; +import {Properties} from '../../utils/properties'; + +@Component({ + selector: 'search-content-providers-table', + template: ` + + + + ` + +}) +export class SearchCompatibleDataprovidersTableComponent { + private errorCodes: ErrorCodes; + + public results =[]; + public filters =[]; + public baseUrl:string; + public searchUtils:SearchUtilsClass = new SearchUtilsClass(); + public sub: any; public subResults: any; + public _location:Location; + public searchFields:SearchFields = new SearchFields(); + public refineFields: string[] = this.searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; + + /*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], + "export":[] + }; + public CSVDownloaded = false; + public csvParams: string; + public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/ + + public disableForms: boolean = false; + + @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; + + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { + this.errorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + this.baseUrl = Properties.getLinkToSearchCompatibleDataProvidersTable(); + } + + public ngOnInit() { + this.searchPage.refineFields = this.refineFields; + this.sub = this.route.queryParams.subscribe(params => { + this.searchUtils.keyword = (params['keyword']?params['keyword']:''); + //this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; + this.filters = this.createFilters(); + this.searchPage.getParametersFromUrl(params); + this._getResults(); + }); + } + + public ngOnDestroy() { + if(this.sub){ + this.sub.unsubscribe(); + } + if(this.subResults){ + this.subResults.unsubscribe(); + } } + private _getResults(){ + //this.csvParams = this.resourcesQuery+"&type=datasources"; + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; + + let size: number = 0; + this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable().subscribe( + data => { + size = data; + if(size > 0) { + this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders("", null, 1, size, []).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("search Content Providers [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + this.searchPage.checkSelectedFilters(this.filters); + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; + } + this.disableForms = false; + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + }, + 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; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + + this.disableForms = false; + + } + ); + } else { + this.searchPage.checkSelectedFilters(this.filters); + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.NONE; + this.disableForms = false; + } + }, + 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; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + } + ); + + } + private setFilters(){ + //TODO set filters from + } + + private createFilters():Filter[] { + var filter_names=["Type","Compatibility Level"]; + var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; + var value_names=[ + /*[ + "Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", + "Institutional Repositories Aggregators", + "Thematic Repositories Aggregators", "Other Repositories Aggregators", + "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"], + */ + [ + "Institutional Repository", "Thematic Repository", "Publication Repository", + "Institutional Repository Aggregator", + "Thematic Repositories Aggregators", "Publication Repository Aggregator", + "Data Repository", "Data Repository Aggregator", "CRIS Systems", "Publication Catalogue"], + + + + + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + + var value_original_ids=[ + ["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional","aggregator::pubsrepository::thematic","aggregator::pubsrepository::unknown", + "datarepository::unknown", "aggregator::datarepository", "cris", "pubscatalogue::unknown"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + var filters: Filter[] =[]; + for(var i =0 ; i < filter_names.length;i++){ + var values:Value[] = []; + for(var j =0 ; j < value_names[i].length;j++){ + var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false} + values.push(value); + } + var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' }; + filters.push(filter); + } + return filters; + } +} diff --git a/src/app/searchPages/dataProviders/compatibleDataProvidersTable.module.ts b/src/app/searchPages/dataProviders/compatibleDataProvidersTable.module.ts new file mode 100644 index 0000000..ef3d75d --- /dev/null +++ b/src/app/searchPages/dataProviders/compatibleDataProvidersTable.module.ts @@ -0,0 +1,27 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component'; + + +import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module'; +import {CompatibleDataProvidersTableRoutingModule} from './compatibleDataProvidersTable-routing.module'; +import { FreeGuard,PreviousRouteRecorder, IsRouteEnabled, SearchFormModule, DataProvidersServiceModule} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DataProvidersServiceModule, + SearchFormModule, SearchPageTableViewModule, CompatibleDataProvidersTableRoutingModule + + ], providers:[FreeGuard, IsRouteEnabled], + declarations: [ + SearchCompatibleDataprovidersTableComponent + ], + exports: [ + SearchCompatibleDataprovidersTableComponent + ] +}) +export class CompatibleDataProvidersTableModule { } diff --git a/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts b/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts new file mode 100644 index 0000000..425c00e --- /dev/null +++ b/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchEntityRegistriesComponent} from './entityRegistries.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchEntityRegistriesComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class EntityRegistriesRoutingModule { } diff --git a/src/app/searchPages/dataProviders/entityRegistries.component.ts b/src/app/searchPages/dataProviders/entityRegistries.component.ts new file mode 100644 index 0000000..82336f9 --- /dev/null +++ b/src/app/searchPages/dataProviders/entityRegistries.component.ts @@ -0,0 +1,16 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; + +@Component({ + selector: 'openaire-search-entity-registries', + template: ` + + + + + ` + +}) +export class OpenaireSearchEntityRegistriesComponent { + +} diff --git a/src/app/searchPages/dataProviders/entityRegistries.module.ts b/src/app/searchPages/dataProviders/entityRegistries.module.ts new file mode 100644 index 0000000..492125a --- /dev/null +++ b/src/app/searchPages/dataProviders/entityRegistries.module.ts @@ -0,0 +1,24 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ EntityRegistriesRoutingModule} from './entityRegistries-routing.module'; +import{OpenaireSearchEntityRegistriesComponent} from './entityRegistries.component'; + +import {EntityRegistriesModule, FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + EntityRegistriesModule, EntityRegistriesRoutingModule + + ], + declarations: [ + OpenaireSearchEntityRegistriesComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireSearchEntityRegistriesComponent + ] +}) +export class LibEntityRegistriesModule { } diff --git a/src/app/searchPages/dataProviders/entityRegistriesTable-routing.module.ts b/src/app/searchPages/dataProviders/entityRegistriesTable-routing.module.ts new file mode 100644 index 0000000..70004b2 --- /dev/null +++ b/src/app/searchPages/dataProviders/entityRegistriesTable-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class EntityRegistriesTableRoutingModule { } diff --git a/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts b/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts new file mode 100644 index 0000000..21368b8 --- /dev/null +++ b/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts @@ -0,0 +1,202 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; +import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; +import {ErrorCodes, SearchFields,SearchDataprovidersService, SearchUtilsClass, Filter, Value } from 'ng-openaire-library'; + +import {Properties} from '../../utils/properties'; + +@Component({ + selector: 'search-entity-registries-table', + template: ` + + + + + ` + +}) +export class SearchEntityRegistriesTableComponent { + private errorCodes: ErrorCodes; + + public results =[]; + public filters =[]; + public baseUrl:string; + public searchUtils:SearchUtilsClass = new SearchUtilsClass(); + public sub: any; public subResults: any; + public _location:Location; + public searchFields:SearchFields = new SearchFields(); + public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS; + public disableForms: boolean = false; + + @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; + + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { + this.errorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + } + + public ngOnInit() { + this.searchPage.refineFields = this.refineFields; + this.sub = this.route.queryParams.subscribe(params => { + this.searchUtils.keyword = (params['keyword']?params['keyword']:''); + //this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; + this.filters = this.createFilters(); + + this.searchPage.getParametersFromUrl(params); + this._getResults("", false, this.searchUtils.page); + }); + } + + public ngOnDestroy() { + if(this.sub){ + this.sub.unsubscribe(); + } + if(this.subResults){ + this.subResults.unsubscribe(); + } } + private _getResults(parameters:string,refine:boolean, page: number){ + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; + + let size: number = 0; + this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable().subscribe( + data => { + size = data; + if(size > 0) { + this.subResults = this._searchDataprovidersService.searchEntityRegistries("",null, page, size, []).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("search Entity Registries [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + this.searchPage.checkSelectedFilters(this.filters); + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; + } + this.disableForms = false; + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + }, + 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; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + + this.disableForms = false; + + } + ); + } else { + this.searchPage.checkSelectedFilters(this.filters); + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.NONE; + this.disableForms = false; + } + }, + 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; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + } + ); +/* + this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + this.searchPage.checkSelectedFilters(this.filters); + this.searchPage.updateBaseUrlWithParameters(this.filters); + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = errorCodes.NONE; + } + //this.searchPage.closeLoading(); + this.disableForms = false; + + }, + 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; + //this.searchPage.closeLoading(); + this.disableForms = false; + + } + ); +*/ + } + private setFilters(){ + //TODO set filters from + } + + + private createFilters():Filter[] { + var filter_names=["Type","Compatibility Level"]; + var filter_ids=["datasourcetypename","datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS; + var value_names=[ + ["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"], + + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + + var value_original_ids=[ + ["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"], + //["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + + var filters: Filter[] =[]; + for(var i =0 ; i < filter_names.length;i++){ + var values:Value[] = []; + for(var j =0 ; j < value_names[i].length;j++){ + var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false} + values.push(value); + } + var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' }; + filters.push(filter); + } + return filters; + } +} diff --git a/src/app/searchPages/dataProviders/entityRegistriesTable.module.ts b/src/app/searchPages/dataProviders/entityRegistriesTable.module.ts new file mode 100644 index 0000000..8ac5d50 --- /dev/null +++ b/src/app/searchPages/dataProviders/entityRegistriesTable.module.ts @@ -0,0 +1,24 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component'; +import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module'; +import {EntityRegistriesTableRoutingModule} from './entityRegistriesTable-routing.module'; +import { FreeGuard,PreviousRouteRecorder, IsRouteEnabled, SearchFormModule, DataProvidersServiceModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DataProvidersServiceModule, + SearchFormModule, SearchPageTableViewModule, EntityRegistriesTableRoutingModule + + ], providers:[FreeGuard, IsRouteEnabled], + declarations: [ + SearchEntityRegistriesTableComponent + ], + exports: [ + SearchEntityRegistriesTableComponent + ] +}) +export class EntityRegistriesTableModule { } diff --git a/src/app/searchPages/dataProviders/journals-routing.module.ts b/src/app/searchPages/dataProviders/journals-routing.module.ts new file mode 100644 index 0000000..2ed7999 --- /dev/null +++ b/src/app/searchPages/dataProviders/journals-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchJournalsComponent} from './journals.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchJournalsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class JournalsRoutingModule { } diff --git a/src/app/searchPages/dataProviders/journals.component.ts b/src/app/searchPages/dataProviders/journals.component.ts new file mode 100644 index 0000000..e54fae6 --- /dev/null +++ b/src/app/searchPages/dataProviders/journals.component.ts @@ -0,0 +1,14 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; + +@Component({ + selector: 'openaire-search-journals', + template: ` + + + + ` + +}) +export class OpenaireSearchJournalsComponent { +} diff --git a/src/app/searchPages/dataProviders/journals.module.ts b/src/app/searchPages/dataProviders/journals.module.ts new file mode 100644 index 0000000..cafa2b0 --- /dev/null +++ b/src/app/searchPages/dataProviders/journals.module.ts @@ -0,0 +1,22 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ JournalsRoutingModule} from './journals-routing.module'; +import{OpenaireSearchJournalsComponent} from './journals.component'; +import { FreeGuard,PreviousRouteRecorder, IsRouteEnabled, JournalsModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, JournalsRoutingModule, JournalsModule + + ], + declarations: [ + OpenaireSearchJournalsComponent + ], + providers:[FreeGuard, IsRouteEnabled], + exports: [ + OpenaireSearchJournalsComponent + ] +}) +export class LibJournalsModule { } diff --git a/src/app/searchPages/dataProviders/journalsTable-routing.module.ts b/src/app/searchPages/dataProviders/journalsTable-routing.module.ts new file mode 100644 index 0000000..71dfbcb --- /dev/null +++ b/src/app/searchPages/dataProviders/journalsTable-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{SearchJournalsTableComponent} from './journalsTable.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + } , canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class JournalsTableRoutingModule { } diff --git a/src/app/searchPages/dataProviders/journalsTable.component.ts b/src/app/searchPages/dataProviders/journalsTable.component.ts new file mode 100644 index 0000000..0a75c6d --- /dev/null +++ b/src/app/searchPages/dataProviders/journalsTable.component.ts @@ -0,0 +1,188 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; +import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; +import {ErrorCodes, SearchFields,SearchDataprovidersService, SearchUtilsClass, Filter, Value } from 'ng-openaire-library'; +import {Properties} from '../../utils/properties'; + + +@Component({ + selector: 'search-journals-table', + template: ` + + + + ` + +}) +export class SearchJournalsTableComponent { + private errorCodes: ErrorCodes; + + public results =[]; + public filters =[]; + public baseUrl:string; + public searchUtils:SearchUtilsClass = new SearchUtilsClass(); + public sub: any; public subResults: any; + public _location:Location; + public searchFields:SearchFields = new SearchFields(); + public refineFields: string[] = this.searchFields.JOURNAL_FIELDS; + + /*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], + "export":[] + }; + public CSVDownloaded = false; + public csvParams: string; + public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/ + + public disableForms: boolean = false; + + @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; + + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { + this.errorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + this.baseUrl = Properties.getLinkToSearchJournalsTable(); + } + + public ngOnInit() { + this.searchPage.refineFields = this.refineFields; + this.sub = this.route.queryParams.subscribe(params => { + this.searchUtils.keyword = (params['keyword']?params['keyword']:''); + //this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; + this.filters = this.createFilters(); + this.searchPage.getParametersFromUrl(params); + this._getResults(); + }); + } + + public ngOnDestroy() { + if(this.sub){ + this.sub.unsubscribe(); + } + if(this.subResults){ + this.subResults.unsubscribe(); + } } + private _getResults(){ + //this.csvParams = this.resourcesQuery+"&type=datasources"; + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; + + let size: number = 0; + this.subResults = this._searchDataprovidersService.searchJournalsTable().subscribe( + data => { + size = data; + if(size > 0) { + this.subResults = this._searchDataprovidersService.searchJournals("", null, 1, size, []).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("search Journals [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + this.searchPage.checkSelectedFilters(this.filters); + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; + } + this.disableForms = false; + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + }, + 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; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + + this.disableForms = false; + + } + ); + } else { + this.searchPage.checkSelectedFilters(this.filters); + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.NONE; + this.disableForms = false; + } + }, + 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; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + } + ); + + } + private setFilters(){ + //TODO set filters from + } + + private createFilters():Filter[] { + var filter_names=["Type","Compatibility Level"]; + var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.JOURNAL_FIELDS; + var value_names=[ + /*[ + "Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", + "Institutional Repositories Aggregators", + "Thematic Repositories Aggregators", "Other Repositories Aggregators", + "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"], + */ + ["Journal", "Journal Aggregator\/Publisher"], + + + + + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + + var value_original_ids=[ + ["pubsrepository::journal", "aggregator::pubsrepository::journals"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + var filters: Filter[] =[]; + for(var i =0 ; i < filter_names.length;i++){ + var values:Value[] = []; + for(var j =0 ; j < value_names[i].length;j++){ + var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false} + values.push(value); + } + var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' }; + filters.push(filter); + } + return filters; + } +} diff --git a/src/app/searchPages/dataProviders/journalsTable.module.ts b/src/app/searchPages/dataProviders/journalsTable.module.ts new file mode 100644 index 0000000..3e46d8b --- /dev/null +++ b/src/app/searchPages/dataProviders/journalsTable.module.ts @@ -0,0 +1,27 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{SearchJournalsTableComponent} from './journalsTable.component'; + + +import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module'; +import {JournalsTableRoutingModule} from './journalsTable-routing.module'; +import { FreeGuard,PreviousRouteRecorder, IsRouteEnabled, SearchFormModule, DataProvidersServiceModule} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DataProvidersServiceModule, + SearchFormModule, SearchPageTableViewModule, JournalsTableRoutingModule + + ], providers:[FreeGuard, IsRouteEnabled], + declarations: [ + SearchJournalsTableComponent + ], + exports: [ + SearchJournalsTableComponent + ] +}) +export class JournalsTableModule { } diff --git a/src/app/searchPages/find/libSearch.module.ts b/src/app/searchPages/find/libSearch.module.ts new file mode 100644 index 0000000..efbe777 --- /dev/null +++ b/src/app/searchPages/find/libSearch.module.ts @@ -0,0 +1,17 @@ +//import {MaterialModule} from '@angular/material'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; +import {MainSearchModule} from 'ng-openaire-library'; + +import { OpenaireSearchComponent } from './search.component'; +import { MainSearchRoutingModule } from './mainSearch-routing.module'; + +@NgModule({ + imports: [ MainSearchRoutingModule, MainSearchModule], + declarations:[OpenaireSearchComponent], + exports:[OpenaireSearchComponent] +}) +export class LibMainSearchModule { } diff --git a/src/app/searchPages/find/mainSearch-routing.module.ts b/src/app/searchPages/find/mainSearch-routing.module.ts new file mode 100644 index 0000000..193e0c1 --- /dev/null +++ b/src/app/searchPages/find/mainSearch-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchComponent} from './search.component'; +// import {FreeGuard} from'../../login/freeGuard.guard'; +// import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchComponent } + // { path: '', component: OpenaireSearchComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class MainSearchRoutingModule { } diff --git a/src/app/searchPages/find/search.component.ts b/src/app/searchPages/find/search.component.ts new file mode 100644 index 0000000..2eb4d83 --- /dev/null +++ b/src/app/searchPages/find/search.component.ts @@ -0,0 +1,19 @@ +import {Component, ViewChild, ElementRef} from '@angular/core'; + +@Component({ + selector: 'openaire-search-find', + template: ` + + `, + }) +export class OpenaireSearchComponent{ + constructor ( ) { + + } + + ngOnInit() { +} + + + +} diff --git a/src/app/searchPages/searchUtils/searchPageTableView.component.html b/src/app/searchPages/searchUtils/searchPageTableView.component.html new file mode 100644 index 0000000..9acf3b1 --- /dev/null +++ b/src/app/searchPages/searchUtils/searchPageTableView.component.html @@ -0,0 +1,186 @@ +
+
+
+
+
+
+ +
+
+
+ Keywords: {{searchUtils.keyword}} + + + {{filter.title}}: + {{value.name}} + , + + + + + + Clear All + +
+
+
+
+
+ +
+ +
+ + +
+
+ +
Filter By:
+ +
+
+ +
+
+ +
+
+ + +
+ +
+
+
+ + {{searchUtils.totalResults}} content providers, page {{searchUtils.page}} of {{(totalPages())}} + + + + +
+
+ +
+

+ + + + + +

+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Name + + Type + + Country + + Institution + Compatibility +
+ + + + + [no title available] + + + + {{dataprovider.type}} + - + + {{country}}{{(i < ( dataprovider['countries'].slice(0,5).length-1))?", ":""}}{{(i == dataprovider['countries'].slice(0,5).length-1 && dataprovider['countries'].length > 5)?"...":""}} + - + + + {{org.name}}{{org.name}}{{(i < ( dataprovider['organizations'].slice(0,5).length-1))?", ":""}}{{(i == dataprovider['organizations'].slice(0,5).length-1 && dataprovider['organizations'].length > 5)?"...":""}} + + - + + {{dataprovider.compatibility}} + - +
+
+ +
+
+ + {{searchUtils.totalResults}} content providers, page {{searchUtils.page}} of {{(totalPages())}} + + + + +
+
+ + + +
+ +
+

+ + + + + +

+ + +
+
+ + +
+ +
+
+
diff --git a/src/app/searchPages/searchUtils/searchPageTableView.component.ts b/src/app/searchPages/searchUtils/searchPageTableView.component.ts new file mode 100644 index 0000000..607b34a --- /dev/null +++ b/src/app/searchPages/searchUtils/searchPageTableView.component.ts @@ -0,0 +1,453 @@ +import {Component, Input, ViewChild, Output, EventEmitter, ViewEncapsulation, OnInit, AfterViewInit} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import { Subject } from 'rxjs/Subject'; +import {Location} from '@angular/common'; +import { DataTableDirective } from 'angular-datatables'; + +import {SearchFields, DOI, StringUtils,ModalLoading,ErrorCodes, PiwikService, SearchDataprovidersService} from 'ng-openaire-library'; +import {Meta, SearchUtilsClass, Filter, Value, SearchFilterComponent, SearchFilterModalComponent } from 'ng-openaire-library'; +import {Properties} from '../../utils/properties'; + +@Component({ + selector: 'search-page-table', + templateUrl:'searchPageTableView.component.html', + styles: [` + #dpTable_info, #dpTable_paginate, #dpTable_length, #dpTable_filter{ + display: none; + } + + `], + encapsulation: ViewEncapsulation.None // this used in order styles to work + + }) +export class SearchPageTableViewComponent implements OnInit, AfterViewInit { + @Input() pageTitle = ""; + @Input() results; + @Input() filters = []; + @Input() type:string = ""; + @Input() entityType: string = ""; + @Input() searchUtils:SearchUtilsClass;// = new SearchUtilsClass(); + //@Output() downloadClick = new EventEmitter(); + @Input() showResultCount:boolean = true; + @Input() showRefine:boolean = true; + @Input() refineFields = []; + //@Input() csvParams: string; + //@Input() csvPath: string; + @Input() searchViewLink: string; + @Input() disableForms: boolean = false; + @Input() searchFormClass: string = "searchForm"; +@Input() formPlaceholderText = "Type Keywords..."; + @ViewChild (ModalLoading) loading : ModalLoading ; + private searchFieldsHelper:SearchFields = new SearchFields(); + private queryParameters: Map = new Map(); + public countFilters= 0; + public parameterNames:string[] =[]; + public parameterValues:string[] =[]; + + public rowsOnPage:number = 10; + + @ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ; + public currentFilter: Filter; + public errorCodes:ErrorCodes = new ErrorCodes(); + piwiksub: any; + dtOptions: DataTables.Settings = {}; + showTable = false; filteringAdded = false; + @ViewChild(DataTableDirective) datatableElement: DataTableDirective; + dtTrigger: Subject = new Subject(); //necessary + constructor (private location: Location , private _meta: Meta, private _piwikService:PiwikService, private _searchDataprovidersService: SearchDataprovidersService ) { } + + ngOnInit() { + this.dtOptions = { + "paging": true, + "searching": false, + "lengthChange": false, + "pageLength": this.rowsOnPage + }; + this.updateTitle(this.pageTitle); + this.updateDescription("Openaire, search, repositories, open access, type, content provider, funder, project, " + this.type + "," +this.pageTitle); + if(typeof window !== 'undefined') { + this.updateUrl(Properties.getBaseLink()+location.pathname); + } + if(Properties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe(); + } + } + ngOnDestroy() { + if(this.piwiksub){ + this.piwiksub.unsubscribe(); + } + + } + ngAfterViewInit(): void { + $.fn['dataTable'].ext.search.push((settings, data, dataIndex) => { + + if (this.filterData(data, this.searchUtils.keyword, this.filters)) { + return true; + } + return false; + }); + + + } + + + totalPages(): number { + let totalPages:any = this.searchUtils.totalResults/(this.rowsOnPage); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + return totalPages; + } + + toggleModal($event) { + this.currentFilter = $event.value; + this.searchFilterModal.open(); + + } + + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateProperty("og:description", description); + } + updateTitle(title:string){ + var _prefix ="OpenAIRE | "; + var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); + this._meta.setTitle(_title ); + this._meta.updateProperty("og:title",_title); + } + updateUrl(url:string){ + this._meta.updateProperty("og:url", url); + } + +public getParametersFromUrl(params) { + for(var i=0; i< this.refineFields.length ; i++) { + var filterId = this.refineFields[i]; + if(params[filterId] != undefined) { + if(this.queryParameters == undefined){ + this.queryParameters = new Map(); + } + this.queryParameters[filterId]=decodeURIComponent(params[filterId]); + } + } +} + /* + * Mark as check the new filters that are selected, when you get them from search + */ + public checkSelectedFilters(filters:Filter[]){ + + this.filters = filters; + 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); + for(let filterValue of filter.values) { + if(values.indexOf(StringUtils.quote(filterValue.id)) > -1) { + filterValue.selected = true; + filter.countSelectedValues++; + }else{ + filterValue.selected = false; + } + } + }else{ + for(let filterValue of filter.values) { + filterValue.selected = false; + } + } + } + + return filters; + } + + /* + * + */ + private createUrlParameters(filters:Filter[], includePage:boolean){ + var allLimits="";//location.search.slice(1); + this.parameterNames.splice(0,this.parameterNames.length); + this.parameterValues.splice(0,this.parameterValues.length); + + for (let filter of filters){ + var filterLimits=""; + if(filter.countSelectedValues > 0){ + for (let value of filter.values){ + if(value.selected == true){ + filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"'; + } + } + this.queryParameters[filter.filterId]=filterLimits; + if(filterLimits.length > 0){ + this.parameterNames.push(filter.filterId); + this.parameterValues.push(filterLimits); + } + allLimits+=(allLimits.length==0?"?":"&")+((filterLimits.length == 0 )?'':filter.filterId + '='+ filterLimits) ; + } + } + if(this.searchUtils.keyword.length > 0 ){ + allLimits+=(allLimits.length==0?"?":"&")+'keyword=' + this.searchUtils.keyword; + this.parameterNames.push("keyword"); + this.parameterValues.push(this.searchUtils.keyword); + } + + + return allLimits; + } + + public isFiltered(){ + var filtered=false; + for (let filter of this.filters){ + if(filter.countSelectedValues > 0){ + filtered = true; + break; + } + } + if(this.searchUtils.keyword.length > 0 ){ + filtered = true; + } + return filtered; + } + private clearKeywords(){ + if(this.searchUtils.keyword.length > 0 ){ + this.searchUtils.keyword =''; + } + this.goTo(1); + } + private clearFilters(){ + for (var i =0 ; i < this.filters.length; i++) { + for (var j=0; j < this.filters[i].values.length; j++) { + if(this.filters[i].values[j].selected) { + this.filters[i].values[j].selected = false; + } + } + this.filters[i].countSelectedValues = 0; + } + this.clearKeywords(); + } + + private removeFilter(value:Value,filter:Filter){ + filter.countSelectedValues--; + if(value.selected == true){ + value.selected = false; + } + this.goTo(1); + } + goTo(page:number = 1){ + + this.searchUtils.page=page; + var table = $('#dpTable').DataTable(); + table.page( page - 1 ).draw( false ); + // Object { page: 0, pages: 3, start: 0, end: 10, length: 10, recordsTotal: 28, recordsDisplay: 21, serverSide: false } + var info = table.page.info(); + this.searchUtils.totalResults = info.recordsDisplay; + + var urlParameters = this.createUrlParameters(this.filters,true); + this.location.go(location.pathname,urlParameters); + + } + + filterChanged($event){ + this.goTo(1); + } + keywordChanged($event) { + this.searchUtils.keyword = $event.value; + this.goTo(1); + } +/* + downloadClicked($event) { + if($event.value == true) { + var queryParameters = this.createSearchQueryParameters(this.filters); + + this.downloadClick.emit({ + value: queryParameters + }); + } + } +*/ + + + getSelectedValues(filter):any{ + var selected = []; + if(filter.countSelectedValues >0){ + for (var i=0; i < filter.values.length; i++){ + if(filter.values[i].selected){ + selected.push(filter.values[i]); + } + } + } + return selected; + + } + /* + Trigger a table draw in order to get the initial filtering + */ + triggerInitialLoad(){ + setTimeout(function(){ + var table = $('#dpTable').DataTable(); + table.page( 0 ).draw( false ); + + }, 500); + } + +/* +Transform initial - not filtered results to get the filtered number +*/ + transform(results): any { + if(results.length > 0) { + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + + var result = results.filter(row=>this.filterAll(row, this.searchUtils.keyword.toLowerCase(),this.filters)); + + let oldTotal = this.searchUtils.totalResults; + console.log(" Length: "+result.length); + this.searchUtils.totalResults = result.length; + + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = errorCodes.NONE; + } + + // if(oldTotal != this.searchUtils.totalResults) { + // args[3].detectChanges(); + // } + return result; + } + return []; + } + + filterAll(row: any, query: string, filters:Filter[]) { + // console.log(row); + let returnValue: boolean = false; + + if(query) { + if(row.title.name.toLowerCase().indexOf(query) > -1) { + returnValue = true; + } + + if(row.type.toLowerCase().indexOf(query) > -1) { + returnValue = true; + } + + if(row.countries && row.countries.length > 0) { + for(let country of row.countries) { + if(country.toLowerCase().indexOf(query) > -1) { + returnValue = true; + break; + } + } + } + + if(row.compatibility && row.compatibility.toLowerCase().indexOf(query) > -1) { + returnValue = true; + } + + if(row.organizations && row.organizations.length > 0) { + for(let organization of row.organizations) { + if(organization.name.toLowerCase().indexOf(query) > -1) { + returnValue = true; + break; + } + } + } + + if(!returnValue) { + return false; + } + } + + for (let filter of filters){ + if(filter.countSelectedValues > 0){ + for (let value of filter.values){ + if(value.selected == true){ + + // make it generic in future commit + let field:string = ""; + if(filter.title == "Type") { + field = "type"; + } else if(filter.title == "Compatibility Level") { + field = "compatibility"; + } + + if(row[field] == value.name) { + returnValue = true; + if(filter.filterOperator == "or") { + break; + } + } else { + if(filter.filterOperator == "and") { + return false; + } + returnValue = false; + } + } + } + if(!returnValue) { + return false; + } + } + } + + return true; + } + filterQuery(data, query){ + if(data.toLowerCase().indexOf(query.toLowerCase()) > -1){ + return true; + }else{ + return false; + } + } + filterData(row: any, query: string, filters:Filter[]) { + + + let returnValue: boolean = false; + + if(query) { + for(var i=0; i <5; i++){ + var r= this.filterQuery(row[i], query); + // console.log(query+" "+ row+" "+r); + if(r) { + returnValue = true; + break; + } + } + + if(!returnValue) { + return false; + } + } + + for (let filter of filters){ + if(filter.countSelectedValues > 0){ + for (let value of filter.values){ + if(value.selected == true){ + let field = 1; + if(filter.title == "Type") { + field = 1; + } else if(filter.title == "Compatibility Level") { + field = 4; + } + r= this.filterQuery(row[field], value.name); + if(r) { + returnValue = true; + if(filter.filterOperator == "or") { + break; + } + } else { + if(filter.filterOperator == "and") { + return false; + } + returnValue = false; + } + } + } + if(!returnValue) { + return false; + } + } + } + + return true; + } +} diff --git a/src/app/searchPages/searchUtils/searchPageTableView.module.ts b/src/app/searchPages/searchUtils/searchPageTableView.module.ts new file mode 100644 index 0000000..3cb24ff --- /dev/null +++ b/src/app/searchPages/searchUtils/searchPageTableView.module.ts @@ -0,0 +1,33 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + +import{SearchPageTableViewComponent} from './searchPageTableView.component'; + +import{LoadingModalModule, ReportsServiceModule, ModalModule, PagingModule, HelperModule, ErrorMessagesModule} from 'ng-openaire-library'; +import{PiwikServiceModule } from 'ng-openaire-library'; + +import {DataTablesModule} from 'angular-datatables'; + + +import {Meta, PreviousRouteRecorder, SearchFormModule, SearchResultsModule, SearchPagingModule, SearchDownloadModule, SearchFilterModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, LoadingModalModule, + ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, + DataTablesModule, SearchFilterModule, PiwikServiceModule, HelperModule, ErrorMessagesModule + ], + declarations: [ + SearchPageTableViewComponent +], + + providers:[ + PreviousRouteRecorder, Meta + ], + exports: [ + SearchPageTableViewComponent + ] +}) +export class SearchPageTableViewModule { } diff --git a/src/app/searchPages/simple/searchDataProviders-routing.module.ts b/src/app/searchPages/simple/searchDataProviders-routing.module.ts new file mode 100644 index 0000000..21ead85 --- /dev/null +++ b/src/app/searchPages/simple/searchDataProviders-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchDataprovidersComponent} from './searchDataproviders.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchDataprovidersComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchDataProvidersRoutingModule { } diff --git a/src/app/searchPages/simple/searchDataProviders.module.ts b/src/app/searchPages/simple/searchDataProviders.module.ts new file mode 100644 index 0000000..3cc4c94 --- /dev/null +++ b/src/app/searchPages/simple/searchDataProviders.module.ts @@ -0,0 +1,22 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import {OpenaireSearchDataprovidersComponent} from './searchDataproviders.component'; +import{ SearchDataProvidersRoutingModule} from './searchDataProviders-routing.module'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; +import {SearchDataProvidersModule} from 'ng-openaire-library'; +@NgModule({ + imports: [ + CommonModule, FormsModule, +SearchDataProvidersModule, SearchDataProvidersRoutingModule + + ], + declarations: [ + OpenaireSearchDataprovidersComponent + ], + providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled], + exports: [ + OpenaireSearchDataprovidersComponent + ] +}) +export class LibSearchDataProvidersModule { } diff --git a/src/app/searchPages/simple/searchDataproviders.component.ts b/src/app/searchPages/simple/searchDataproviders.component.ts new file mode 100644 index 0000000..d71593a --- /dev/null +++ b/src/app/searchPages/simple/searchDataproviders.component.ts @@ -0,0 +1,14 @@ +import {Component, Input, ViewChild} from '@angular/core'; + +@Component({ + selector: 'openaire-search-dataproviders', + template: ` + + + + + ` +}) +export class OpenaireSearchDataprovidersComponent { + +} diff --git a/src/app/searchPages/simple/searchDatasets-routing.module.ts b/src/app/searchPages/simple/searchDatasets-routing.module.ts new file mode 100644 index 0000000..1d28931 --- /dev/null +++ b/src/app/searchPages/simple/searchDatasets-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchDatasetsComponent} from './searchDatasets.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchDatasetsRoutingModule { } diff --git a/src/app/searchPages/simple/searchDatasets.component.ts b/src/app/searchPages/simple/searchDatasets.component.ts new file mode 100644 index 0000000..8a0231f --- /dev/null +++ b/src/app/searchPages/simple/searchDatasets.component.ts @@ -0,0 +1,14 @@ +import {Component, Input, ViewChild} from '@angular/core'; + +@Component({ + selector: 'openaire-search-datasets', + template: ` + + + + ` +}) + +export class OpenaireSearchDatasetsComponent { + +} diff --git a/src/app/searchPages/simple/searchDatasets.module.ts b/src/app/searchPages/simple/searchDatasets.module.ts new file mode 100644 index 0000000..bad0671 --- /dev/null +++ b/src/app/searchPages/simple/searchDatasets.module.ts @@ -0,0 +1,25 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ SearchDatasetsRoutingModule} from './searchDatasets-routing.module'; +import{OpenaireSearchDatasetsComponent} from './searchDatasets.component'; + +import {SearchDatasetsModule, PreviousRouteRecorder, FreeGuard, IsRouteEnabled} from 'ng-openaire-library'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchDatasetsModule , SearchDatasetsRoutingModule + + ], + declarations: [ + OpenaireSearchDatasetsComponent + ], + providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled], + exports: [ + OpenaireSearchDatasetsComponent + ] +}) +export class LibSearchDatasetsModule { } diff --git a/src/app/searchPages/simple/searchOrganizations-routing.module.ts b/src/app/searchPages/simple/searchOrganizations-routing.module.ts new file mode 100644 index 0000000..6dfabf7 --- /dev/null +++ b/src/app/searchPages/simple/searchOrganizations-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchOrganizationsComponent} from './searchOrganizations.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchOrganizationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchOrganizationsRoutingModule { } diff --git a/src/app/searchPages/simple/searchOrganizations.component.ts b/src/app/searchPages/simple/searchOrganizations.component.ts new file mode 100644 index 0000000..a61a20d --- /dev/null +++ b/src/app/searchPages/simple/searchOrganizations.component.ts @@ -0,0 +1,15 @@ +import {Component, Input, ViewChild} from '@angular/core'; + +@Component({ + selector: 'openaire-search-organizations', + template: ` + + + + + ` + +}) +export class OpenaireSearchOrganizationsComponent { + +} diff --git a/src/app/searchPages/simple/searchOrganizations.module.ts b/src/app/searchPages/simple/searchOrganizations.module.ts new file mode 100644 index 0000000..095adf7 --- /dev/null +++ b/src/app/searchPages/simple/searchOrganizations.module.ts @@ -0,0 +1,25 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ SearchOrganizationsRoutingModule} from './searchOrganizations-routing.module'; +import{OpenaireSearchOrganizationsComponent} from './searchOrganizations.component'; + + +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled, SearchOrganizationsModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchOrganizationsRoutingModule, SearchOrganizationsModule + + ], + declarations: [ + OpenaireSearchOrganizationsComponent + ], + providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled], + exports: [ + OpenaireSearchOrganizationsComponent + ] +}) +export class LibSearchOrganizationsModule { } diff --git a/src/app/searchPages/simple/searchProjects-routing.module.ts b/src/app/searchPages/simple/searchProjects-routing.module.ts new file mode 100644 index 0000000..73fee35 --- /dev/null +++ b/src/app/searchPages/simple/searchProjects-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchProjectsComponent} from './searchProjects.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchProjectsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchProjectsRoutingModule { } diff --git a/src/app/searchPages/simple/searchProjects.component.ts b/src/app/searchPages/simple/searchProjects.component.ts new file mode 100644 index 0000000..3617885 --- /dev/null +++ b/src/app/searchPages/simple/searchProjects.component.ts @@ -0,0 +1,14 @@ +import {Component, Input, ViewChild} from '@angular/core'; + +@Component({ + selector: 'openaire-search-projects', + template: ` + + + + ` + +}) +export class OpenaireSearchProjectsComponent { + +} diff --git a/src/app/searchPages/simple/searchProjects.module.ts b/src/app/searchPages/simple/searchProjects.module.ts new file mode 100644 index 0000000..a54eff6 --- /dev/null +++ b/src/app/searchPages/simple/searchProjects.module.ts @@ -0,0 +1,23 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ SearchProjectsRoutingModule} from './searchProjects-routing.module'; +import{OpenaireSearchProjectsComponent} from './searchProjects.component'; + +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled,SearchProjectsModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, SearchProjectsRoutingModule, SearchProjectsModule + + ], + declarations: [ + OpenaireSearchProjectsComponent + ], + providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled], + exports: [ + OpenaireSearchProjectsComponent + ] +}) +export class LibSearchProjectsModule { } diff --git a/src/app/searchPages/simple/searchPublications-routing.module.ts b/src/app/searchPages/simple/searchPublications-routing.module.ts new file mode 100644 index 0000000..fbe0489 --- /dev/null +++ b/src/app/searchPages/simple/searchPublications-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{OpenaireSearchPublicationsComponent} from './searchPublications.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { + redirect: '/error' + }, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchPublicationsRoutingModule { } diff --git a/src/app/searchPages/simple/searchPublications.component.ts b/src/app/searchPages/simple/searchPublications.component.ts new file mode 100644 index 0000000..d5051da --- /dev/null +++ b/src/app/searchPages/simple/searchPublications.component.ts @@ -0,0 +1,16 @@ +import {Component, Input, ViewChild} from '@angular/core'; + +@Component({ + selector: 'openaire-search-publications', + template: ` + + + + + ` + +}) +export class OpenaireSearchPublicationsComponent { + + +} diff --git a/src/app/searchPages/simple/searchPublications.module.ts b/src/app/searchPages/simple/searchPublications.module.ts new file mode 100644 index 0000000..b66a44e --- /dev/null +++ b/src/app/searchPages/simple/searchPublications.module.ts @@ -0,0 +1,25 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ SearchPublicationsRoutingModule} from './searchPublications-routing.module'; +import{OpenaireSearchPublicationsComponent} from './searchPublications.component'; + +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled, SearchPublicationsModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, SearchPublicationsModule, + + SearchPublicationsRoutingModule + + ], + declarations: [ + OpenaireSearchPublicationsComponent + ], + providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled], + exports: [ + OpenaireSearchPublicationsComponent + ] +}) +export class LibSearchPublicationsModule { } diff --git a/src/app/searchPages/simple/searchSoftware-routing.module.ts b/src/app/searchPages/simple/searchSoftware-routing.module.ts new file mode 100644 index 0000000..a7da5a8 --- /dev/null +++ b/src/app/searchPages/simple/searchSoftware-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import {OpenaireSearchSoftwareComponent} from './searchSoftware.component'; +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: OpenaireSearchSoftwareComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchSoftwareRoutingModule { } diff --git a/src/app/searchPages/simple/searchSoftware.component.ts b/src/app/searchPages/simple/searchSoftware.component.ts new file mode 100644 index 0000000..da673ff --- /dev/null +++ b/src/app/searchPages/simple/searchSoftware.component.ts @@ -0,0 +1,14 @@ +import {Component, Input, ViewChild} from '@angular/core'; + +@Component({ + selector: 'openaire-search-software', + template: ` + + + + ` +}) + +export class OpenaireSearchSoftwareComponent { + +} diff --git a/src/app/searchPages/simple/searchSoftware.module.ts b/src/app/searchPages/simple/searchSoftware.module.ts new file mode 100644 index 0000000..166ec32 --- /dev/null +++ b/src/app/searchPages/simple/searchSoftware.module.ts @@ -0,0 +1,24 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ SearchSoftwareRoutingModule} from './searchSoftware-routing.module'; +import{OpenaireSearchSoftwareComponent} from './searchSoftware.component'; + + +import {FreeGuard,PreviousRouteRecorder, IsRouteEnabled, SearchSoftwareModule} from 'ng-openaire-library'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, SearchSoftwareModule, SearchSoftwareRoutingModule + ], + declarations: [ + OpenaireSearchSoftwareComponent + ], + providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled + ], + exports: [ + OpenaireSearchSoftwareComponent + ] +}) +export class LibSearchSoftwareModule { } diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts new file mode 100644 index 0000000..f0ce0d2 --- /dev/null +++ b/src/app/shared/shared.module.ts @@ -0,0 +1,45 @@ +import { NgModule, ModuleWithProviders } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; + + +const MODULES = [ + // Do NOT include UniversalModule, HttpModule, or JsonpModule here + CommonModule, + RouterModule, + FormsModule, + ReactiveFormsModule +]; + +const PIPES = [ + // put pipes here +]; + +const COMPONENTS = [ + // put shared components here +]; + + + +@NgModule({ + imports: [ + ...MODULES + ], + declarations: [ + ...PIPES, + ...COMPONENTS + ], + exports: [ + ...MODULES, + ...PIPES, + ...COMPONENTS + ] +}) +export class SharedModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: SharedModule, + }; + } +} diff --git a/src/app/utils/properties.ts b/src/app/utils/properties.ts new file mode 100644 index 0000000..86a4ccd --- /dev/null +++ b/src/app/utils/properties.ts @@ -0,0 +1,418 @@ +export class Properties { + private static productionMode:boolean = false; + private static enablePiwikTrack:boolean = false; + private static enableHelper:boolean = false; + private static useCache:boolean = true; + + //base url + private static baseLink = "https://demo.openaire.eu"; + + //landing Pages + private static baseSearchLink="/"; + private static searchLinkToPublication = "search/publication?articleId="; + private static searchLinkToProject = "search/project?projectId="; + private static searchLinkToDataProvider = "search/dataprovider?datasourceId="; + private static searchLinkToDataset = "search/dataset?datasetId="; + private static searchLinkToOrganization = "search/organization?organizationId="; + //Search pages + private static searchLinkToPublications = "search/find/publications"; + private static searchLinkToDataProviders = "search/find/dataproviders"; + private static searchLinkToProjects = "search/find/projects"; + private static searchLinkToDatasets = "search/find/datasets"; + private static searchLinkToSoftware = "search/find/software"; + private static searchLinkToOrganizations = "search/find/organizations"; + private static searchLinkToPeople = "search/find/people"; + public static searchLinkToCompatibleDataProviders = "search/content-providers"; + public static searchLinkToCompatibleDataProvidersTable = "search/content-providers-table"; + public static searchLinkToEntityRegistriesDataProviders = "search/entity-registries"; + public static searchLinkToEntityRegistriesDataProvidersTable = "search/entity-registries-table"; + public static searchLinkToJournals = "search/journals"; + public static searchLinkToJournalsTable = "search/journals-table"; + + //Advanced Search for pages + public static searchLinkToAdvancedPublications = "search/advanced/publications"; + public static searchLinkToAdvancedProjects = "search/advanced/projects"; + public static searchLinkToAdvancedDatasets = "search/advanced/datasets"; + public static searchLinkToAdvancedSoftware = "search/advanced/software"; + public static searchLinkToAdvancedDataProviders = "search/advanced/dataproviders"; + public static searchLinkToAdvancedOrganizations = "search/advanced/organizations"; + public static searchLinkToAdvancedPeople = "search/advanced/people"; + + + private static metricsAPIURL = "https://beta.services.openaire.eu/usagestats/"; + private static framesAPIURL = "https://beta.openaire.eu/stats3/"; + + private static loginAPIURL = "http://rudie.di.uoa.gr:8080/dnet%2Dopenaire%2Dusers%2D1.0.0%2DSNAPSHOT/api/users/authenticates" + //"http://scoobydoo.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates"; + private static loginAPIURL_pm = "https://beta.services.openaire.eu/uoa-user-management/api/users/authenticates"; + + private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/"; + private static claimsAPIURL_pm = "https://beta.services.openaire.eu/claims/rest/claimsService/"; + + private static searchAPIURLLAst_pm = "https://beta.services.openaire.eu/search/v2/api/"; + private static searchAPIURLLAst = "https://beta.services.openaire.eu/search/v2/api/"; +// private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; + + private static searchResourcesAPIURL_pm = "https://beta.services.openaire.eu/search/v2/api/resources"; + private static searchResourcesAPIURL = "https://beta.services.openaire.eu/search/v2/api/resources"; + // private static searchResourcesAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources"; + + + private static csvAPIURL_pm = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv + // private static csvAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";//publications?format=csv + + private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv + + private static searchCrossrefAPIURL = "https://api.crossref.org/works"; + // private static searchDataciteAPIURL = "https://search.datacite.org/api"; + private static searchDataciteAPIURL = "https://api.datacite.org/works"; + + private static searchOrcidURL = "https://pub.orcid.org/"; + + // Identifiers + private static pmidURL = "http://www.ncbi.nlm.nih.gov/pubmed/"; + private static doiURL = "https://dx.doi.org/"; + private static cordisURL = "http://cordis.europa.eu/projects/"; + private static pmcURL = "http://europepmc.org/articles/"; + private static handleURL = "http://hdl.handle.net/"; + + // Zenodo's url + private static zenodo = "https://zenodo.org/"; + // Open access link + private static openAccess = "https://www.openaire.eu/support/faq#article-id-234"; + // Open access repository link + private static openAccessRepo = "https://www.openaire.eu/support/faq#article-id-310"; + // FP7 link + private static fp7Guidlines = "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme"; + // H2020 link + private static h2020Guidlines = "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020"; + // ERC Guidlines + private static ercGuidlines = "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf"; + // helpdesk link + private static helpdesk = "https://www.openaire.eu/support/helpdesk"; + + private static uploadService_pm = "https://demo.openaire.eu/upload"; + private static uploadService = "http://scoobydoo.di.uoa.gr:8000/upload"; + + private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/"; + + private static piwikBaseUrl =" https://analytics.openaire.eu/piwik.php?idsite=6"; + + + private static loginUrl ="http://rudie.di.uoa.gr:8080/dnet-openaire-users-2.0.0-SNAPSHOT/openid_connect_login"; + //"http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login"; + private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login"; + + 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"; + + private static feedbackmail ="openaire.test@gmail.com"; + + private static helperPageUrl ="http://scoobydoo.di.uoa.gr:16000/api/page/route"; + + private static cache ="http://scoobydoo.di.uoa.gr:3000/get?url="; + private static cache_pm ="https://demo.openaire.eu/cache/get?url="; + + + + public static getBaseLink():string{ + return this.baseLink; + } + + //landing Pages' getters + public static getsearchLinkToPublication():string{ + return this.baseSearchLink + this.searchLinkToPublication; + } + public static getsearchLinkToDataset():string{ + return this.baseSearchLink + this.searchLinkToDataset; + } + public static getsearchLinkToProject():string{ + return this.baseSearchLink + this.searchLinkToProject; + } + + public static getsearchLinkToOrganization():string{ + return this.searchLinkToOrganization; + } + public static getsearchLinkToDataProvider():string{ + return this.searchLinkToDataProvider; + } + //searchPages + public static getLinkToSearchPublications():string{ + return this.baseSearchLink + this.searchLinkToPublications; + } + public static getLinkToSearchProjects():string{ + return this.baseSearchLink + this.searchLinkToProjects; + } + public static getLinkToSearchDataProviders():string{ + return this.baseSearchLink + this.searchLinkToDataProviders; + } + public static getLinkToSearchCompatibleDataProviders():string{ + return this.baseSearchLink + this.searchLinkToCompatibleDataProviders; + } + public static getLinkToSearchCompatibleDataProvidersTable():string{ + return this.baseSearchLink + this.searchLinkToCompatibleDataProvidersTable; + } + public static getLinkToSearchEntityRegistries():string{ + return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProviders; + } + public static getLinkToSearchEntityRegistriesTable():string{ + return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProvidersTable; + } + public static getLinkToSearchJournals():string{ + return this.baseSearchLink + this.searchLinkToJournals; + } + public static getLinkToSearchJournalsTable():string{ + return this.baseSearchLink + this.searchLinkToJournalsTable; + } + public static getLinkToSearchDatasets():string{ + return this.baseSearchLink + this.searchLinkToDatasets; + } + public static getLinkToSearchSoftware():string{ + return this.baseSearchLink + this.searchLinkToSoftware; + } + public static getLinkToSearchOrganizations():string{ + return this.baseSearchLink + this.searchLinkToOrganizations; + } + public static getLinkToSearchPeople():string{ + return this.baseSearchLink + this.searchLinkToPeople; + } + + //Advanced searchPages + public static getLinkToAdvancedSearchPublications():string{ + return this.baseSearchLink + this.searchLinkToAdvancedPublications; + } + public static getLinkToAdvancedSearchProjects():string{ + return this.baseSearchLink + this.searchLinkToAdvancedProjects; + } + public static getLinkToAdvancedSearchDataProviders():string{ + return this.baseSearchLink + this.searchLinkToAdvancedDataProviders; + } + public static getLinkToAdvancedSearchDatasets():string{ + return this.baseSearchLink + this.searchLinkToAdvancedDatasets; + } + public static getLinkToAdvancedSearchSoftware():string{ + return this.baseSearchLink + this.searchLinkToAdvancedSoftware; + } + public static getLinkToAdvancedSearchOrganizations():string{ + return this.baseSearchLink + this.searchLinkToAdvancedOrganizations; + } + public static getLinkToAdvancedSearchPeople():string{ + return this.baseSearchLink + this.searchLinkToAdvancedPeople; + } + + // Services - APIs' getters + // public static getSearchAPIURL():string{ + // return this.searchAPIURL; + // } + // Services - APIs' getters + public static getCsvAPIURL(): string { + if(this.productionMode){ + return this.csvAPIURL_pm; + }else{ + return this.csvAPIURL; + } + // return this.csvAPIURL; + } + + public static getFramesAPIURL(): string { + return this.framesAPIURL; + } + + public static getMetricsAPIURL(): string { + return this.metricsAPIURL; + } + + public static getLoginAPIURL(): string { + if(this.productionMode){ + return this.loginAPIURL_pm; + }else{ + return this.loginAPIURL; + } + // return this.loginAPIURL; + } + + public static getSearchAPIURLLast():string{ + if(this.productionMode){ + return this.searchAPIURLLAst_pm; + }else{ + return this.searchAPIURLLAst; + } + // return this.searchAPIURLLAst; + } + //query using full query: + // + public static getSearchResourcesAPIURL():string{ + if(this.productionMode){ + return this.searchResourcesAPIURL_pm; + }else{ + return this.searchResourcesAPIURL; + } + // return this.searchResourcesAPIURL; + } + public static getSearchAPIURLForEntity(entityType:string):string{ + var suffix = ""; + if(entityType == "project"){ + suffix="projects/"; + }else if(entityType == "publication"){ + suffix="publications/"; + }else if(entityType == "dataset"){ + suffix="datasets/"; + } else if(entityType == "software"){ + suffix="software/"; + }else if(entityType == "organization"){ + suffix="organizations/"; + }else if(entityType == "dataprovider"){ + suffix="datasources/"; + }else if(entityType == "person"){ + suffix="people/"; + } + return (this.productionMode?this.searchAPIURLLAst_pm:this.searchAPIURLLAst) + suffix; + } + + public static getClaimsAPIURL():string{ + if(this.productionMode){ + return this.claimsAPIURL_pm; + }else{ + return this.claimsAPIURL; + } + } + public static getSearchCrossrefAPIURL():string{ + return this.searchCrossrefAPIURL; + } + public static getSearchDataciteAPIURL():string{ + return this.searchDataciteAPIURL; + } + public static getSearchOrcidURL():string{ + return this.searchOrcidURL; + } + + // Identifiers' getters + public static getPmidURL():string{ + return this.pmidURL; + } + public static getDoiURL():string{ + return this.doiURL; + } + public static getCordisURL():string{ + return this.cordisURL; + } + public static getPmcURL():string{ + return this.pmcURL; + } + public static getHandleURL():string{ + return this.handleURL; + } + + // Zenodo's getter + public static getZenodoURL():string{ + return this.zenodo; + } + // Open access getter + public static getOpenAccess():string{ + return this.openAccess; + } + // Open access repository getter + public static getOpenAccessRepo():string{ + return this.openAccessRepo; + } + // FP7 link getter + public static getFP7Guidlines():string{ + return this.fp7Guidlines; + } + // H2020 link getter + public static getH2020Guidlines():string{ + return this.h2020Guidlines; + } + // ERC Guidlines getter + public static getERCGuidlines():string{ + return this.ercGuidlines; + } + // helpdesk link getter + public static getHelpdesk():string{ + return this.helpdesk; + } + + + //upload service for bulk claim - upload csv file + public static getUploadServiceUrl():string{ + if(this.productionMode){ + return this.uploadService_pm; + }else{ + return this.uploadService; + } + } + //vocabularies API + public static getVocabulariesAPI():string{ + return this.vocabulariesAPI; + } + public static getPiwikBaseURL():string{ + return this.piwikBaseUrl; + } + public static isPiwikTrackEnabled():boolean{ + return this.enablePiwikTrack; + } + public static getLoginURL():string{ + if(this.productionMode){ + return this.loginUrl_pm; + }else{ + return this.loginUrl; + } + } + public static getLogoutURL():string{ + if(this.productionMode){ + return this.logoutUrl_pm; + }else{ + 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; + }else{ + return this.cookieDomain; + } + } + public static getFeedbackMail():string{ + return this.feedbackmail; + } + public static getHelperPageUrl():string{ + return this.helperPageUrl; + } + public static isHelperEnabled():boolean{ + return this.enableHelper; + } + public static getCacheUrl():string{ + if(this.productionMode){ + return this.cache_pm; + }else{ + return this.cache; + } + } + public static isCacheEnabled():boolean{ + return this.useCache; + } +} +export class ErrorCodes { + public LOADING = 0; + public DONE = 1; + public NONE = 2; + public ERROR = 3; + public NOT_AVAILABLE = 4; + public OUT_OF_BOUND = 5; + public NOT_FOUND = 6; +} diff --git a/src/assets/Home_24white.svg b/src/assets/Home_24white.svg new file mode 100644 index 0000000..db4e815 --- /dev/null +++ b/src/assets/Home_24white.svg @@ -0,0 +1 @@ + diff --git a/src/assets/citeproc.js b/src/assets/citeproc.js new file mode 100644 index 0000000..1aebe87 --- /dev/null +++ b/src/assets/citeproc.js @@ -0,0 +1,16840 @@ +/* + * Copyright (c) 2009-2016 Frank Bennett + * + * This program is free software: you can redistribute it and/or + * modify it under EITHER + * + * * the terms of the Common Public Attribution License (CPAL) as + * published by the Open Source Initiative, either version 1 of + * the CPAL, or (at your option) any later version; OR + * + * * the terms of the GNU Affero General Public License (AGPL) + * as published by the Free Software Foundation, either version + * 3 of the AGPL, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received copies of the Common Public Attribution + * License and of the GNU Affero General Public License along with + * this program. If not, see or + * respectively. + */ + +var CSL = { + PROCESSOR_VERSION: "1.1.178", + CONDITION_LEVEL_TOP: 1, + CONDITION_LEVEL_BOTTOM: 2, + PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/, + LOCATOR_LABELS_REGEXP: new RegExp("^((art|ch|subch|col|fig|l|n|no|op|p|pp|para|subpara|pt|r|sec|subsec|sv|sch|tit|vrs|vol)\\.)\\s+(.*)"), + STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|bk|ch|subch|col|fig|fol|l|n|no|op|p|pp|para|subpara|pt|r|sec|subsec|sv|sch|tit|vrs|vol)\. *)/g, + STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|bk|ch|subch|col|fig|fol|l|n|no|op|p|pp|para|subpara|pt|r|sec|subsec|sv|sch|tit|vrs|vol)\. *)/, + STATUTE_SUBDIV_STRINGS: { + "art.": "article", + "bk.": "book", + "ch.": "chapter", + "subch.": "subchapter", + "p.": "page", + "pp.": "page", + "para.": "paragraph", + "subpara.": "subparagraph", + "pt.": "part", + "r.": "rule", + "sec.": "section", + "subsec.": "subsection", + "sch.": "schedule", + "tit.": "title", + "col.": "column", + "fig.": "figure", + "fol.": "folio", + "l.": "line", + "n.": "note", + "no.": "issue", + "op.": "opus", + "sv.": "sub-verbo", + "vrs.": "verse", + "vol.": "volume" + }, + STATUTE_SUBDIV_STRINGS_REVERSE: { + "article": "art.", + "book": "bk.", + "chapter": "ch.", + "subchapter": "subch.", + "page": "p.", + "paragraph": "para.", + "subparagraph": "subpara.", + "part": "pt.", + "rule": "r.", + "section": "sec.", + "subsection": "subsec.", + "schedule": "sch.", + "title": "tit.", + "column": "col.", + "figure": "fig.", + "folio": "fol.", + "line": "l.", + "note": "n.", + "issue": "no.", + "opus": "op.", + "sub-verbo": "sv.", + "sub verbo": "sv.", + "verse": "vrs.", + "volume": "vol." + }, + LOCATOR_LABELS_MAP: { + "art": "article", + "bk": "book", + "ch": "chapter", + "subch": "subchapter", + "col": "column", + "fig": "figure", + "fol": "folio", + "l": "line", + "n": "note", + "no": "issue", + "op": "opus", + "p": "page", + "pp": "page", + "para": "paragraph", + "subpara": "subparagraph", + "pt": "part", + "r": "rule", + "sec": "section", + "subsec": "subsection", + "sv": "sub-verbo", + "sch": "schedule", + "tit": "title", + "vrs": "verse", + "vol": "volume" + }, + MODULE_MACROS: { + "juris-pretitle": true, + "juris-title": true, + "juris-pretitle-short": true, + "juris-title-short": true, + "juris-main": true, + "juris-main-short": true, + "juris-tail": true, + "juris-tail-short": true, + "juris-locator": true + }, + MODULE_TYPES: { + "legal_case": true, + "legislation": true, + "bill": true, + "hearing": true, + "gazette": true, + "report": true, + "regulation": true, + "standard": true + }, + NestedBraces: [ + ["(", "["], + [")", "]"] + ], + checkNestedBrace: function(state) { + if (state.opt.xclass === "note") { + this.depth = 0; + this.update = function(str) { + var str = str ? str : ''; + var lst = str.split(/([\(\)])/); + for (var i=1,ilen=lst.length;i -1) { + var raw_locator = item.locator; + item.locator = raw_locator.slice(0, idx); + raw_locator = raw_locator.slice(idx + 1); + var m = raw_locator.match(/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*/); + if (m) { + item["locator-date"] = this.fun.dateparser.parseDateToObject(m[1]); + raw_locator = raw_locator.slice(m[1].length); + } + item["locator-extra"] = raw_locator.replace(/^\s+/, "").replace(/\s+$/, ""); + } + } + } + if (item.locator) { + item.locator = ("" + item.locator).replace(/\s+$/, ''); + } + return item; + }, + normalizeLocaleStr: function(str) { + if (!str) return; + var lst = str.split('-'); + lst[0] = lst[0].toLowerCase(); + if (lst[1]) { + lst[1] = lst[1].toUpperCase(); + } + return lst.join("-"); + }, + parseNoteFieldHacks: function(Item, validFieldsForType, allowDateOverride) { + if ("string" !== typeof Item.note) return; + var elems = []; + var lines = Item.note.split('\n'); + var lastline = ""; + for (var i=0, ilen=lines.length; i0 || j>1) && !elems[j-1].match(CSL.NOTE_FIELD_REGEXP)) { + break + } else { + elems[j] = '\n' + elems[j].slice(2,-1).trim() + '\n'; + } + } + lines[i] = elems.join(''); + } + } + lines = lines.join('\n').split('\n'); + var offset = 0; + var names = {}; + for (var i=0,ilen=lines.length;i -1) { + if (allowDateOverride) { + Item[key] = {raw: val}; + if (!validFieldsForType || (validFieldsForType[key] && val.match(/^[0-9]{4}(?:-[0-9]{1,2}(?:-[0-9]{1,2})*)*$/))) { + lines[i] = ""; + } + } + } else if (!Item[key]) { + if (CSL.NAME_VARIABLES.indexOf(key) > -1) { + if (!names[key]) { + names[key] = []; + } + var lst = val.split(/\s*\|\|\s*/); + if (lst.length === 1) { + names[key].push({literal:lst[0]}); + } else if (lst.length === 2) { + var name = {family:lst[0],given:lst[1]}; + CSL.parseParticles(name); + names[key].push(name); + } + } else { + Item[key] = val; + } + if (!validFieldsForType || validFieldsForType[key]) { + lines[i] = ""; + } + } + } + for (var key in names) { + Item[key] = names[key]; + } + if (validFieldsForType) { + if (lines[offset].trim()) { + lines[offset] = '\n' + lines[offset] + } + for (var i=offset-1;i>-1;i--) { + if (!lines[i].trim()) { + lines = lines.slice(0, i).concat(lines.slice(i + 1)); + } + } + } + Item.note = lines.join("\n").trim(); + }, + GENDERS: ["masculine", "feminine"], + ERROR_NO_RENDERED_FORM: 1, + PREVIEW: "Just for laughs.", + ASSUME_ALL_ITEMS_REGISTERED: 2, + START: 0, + END: 1, + SINGLETON: 2, + SEEN: 6, + SUCCESSOR: 3, + SUCCESSOR_OF_SUCCESSOR: 4, + SUPPRESS: 5, + SINGULAR: 0, + PLURAL: 1, + LITERAL: true, + BEFORE: 1, + AFTER: 2, + DESCENDING: 1, + ASCENDING: 2, + ONLY_FIRST: 1, + ALWAYS: 2, + ONLY_LAST: 3, + FINISH: 1, + POSITION_FIRST: 0, + POSITION_SUBSEQUENT: 1, + POSITION_IBID: 2, + POSITION_IBID_WITH_LOCATOR: 3, + MARK_TRAILING_NAMES: true, + POSITION_TEST_VARS: ["position", "first-reference-note-number", "near-note"], + AREAS: ["citation", "citation_sort", "bibliography", "bibliography_sort"], + CITE_FIELDS: ["first-reference-note-number", "locator", "locator-extra"], + MINIMAL_NAME_FIELDS: ["literal", "family"], + SWAPPING_PUNCTUATION: [".", "!", "?", ":", ","], + TERMINAL_PUNCTUATION: [":", ".", ";", "!", "?", " "], + NONE: 0, + NUMERIC: 1, + POSITION: 2, + COLLAPSE_VALUES: ["citation-number", "year", "year-suffix"], + DATE_PARTS: ["year", "month", "day"], + DATE_PARTS_ALL: ["year", "month", "day", "season"], + DATE_PARTS_INTERNAL: ["year", "month", "day", "year_end", "month_end", "day_end"], + NAME_PARTS: ["non-dropping-particle", "family", "given", "dropping-particle", "suffix", "literal"], + DECORABLE_NAME_PARTS: ["given", "family", "suffix"], + DISAMBIGUATE_OPTIONS: [ + "disambiguate-add-names", + "disambiguate-add-givenname", + "disambiguate-add-year-suffix" + ], + GIVENNAME_DISAMBIGUATION_RULES: [ + "all-names", + "all-names-with-initials", + "primary-name", + "primary-name-with-initials", + "by-cite" + ], + NAME_ATTRIBUTES: [ + "and", + "delimiter-precedes-last", + "delimiter-precedes-et-al", + "initialize-with", + "initialize", + "name-as-sort-order", + "sort-separator", + "et-al-min", + "et-al-use-first", + "et-al-subsequent-min", + "et-al-subsequent-use-first", + "form", + "prefix", + "suffix", + "delimiter" + ], + PARALLEL_MATCH_VARS: ["container-title"], + PARALLEL_TYPES: ["bill","gazette","regulation","legislation","legal_case","treaty","article-magazine","article-journal"], + PARALLEL_COLLAPSING_MID_VARSET: ["volume", "issue", "container-title", "section", "collection-number"], + LOOSE: 0, + STRICT: 1, + TOLERANT: 2, + PREFIX_PUNCTUATION: /[.;:]\s*$/, + SUFFIX_PUNCTUATION: /^\s*[.;:,\(\)]/, + NUMBER_REGEXP: /(?:^\d+|\d+$)/, + NAME_INITIAL_REGEXP: /^([A-Z\u0590-\u05ff\u00c0-\u017f\u0400-\u042f\u0600-\u06ff\u0370\u0372\u0376\u0386\u0388-\u03ab\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03fd-\u03ff])([a-zA-Z\u00c0-\u017f\u0400-\u052f\u0600-\u06ff\u0370-\u03ff\u1f00-\u1fff]*|)/, + ROMANESQUE_REGEXP: /[-0-9a-zA-Z\u0590-\u05d4\u05d6-\u05ff\u0080-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/, + ROMANESQUE_NOT_REGEXP: /[^a-zA-Z\u0590-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/g, + STARTSWITH_ROMANESQUE_REGEXP: /^[&a-zA-Z\u0590-\u05d4\u05d6-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/, + ENDSWITH_ROMANESQUE_REGEXP: /[.;:&a-zA-Z\u0590-\u05d4\u05d6-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]$/, + ALL_ROMANESQUE_REGEXP: /^[a-zA-Z\u0590-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]+$/, + VIETNAMESE_SPECIALS: /[\u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]/, + VIETNAMESE_NAMES: /^(?:(?:[.AaBbCcDdEeGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvXxYy \u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]{2,6})(\s+|$))+$/, + NOTE_FIELDS_REGEXP: /\{:(?:[\-_a-z]+|[A-Z]+):[^\}]+\}/g, + NOTE_FIELD_REGEXP: /^([\-_a-z]+|[A-Z]+):\s*([^\}]+)$/, + PARTICLE_GIVEN_REGEXP: /^([^ ]+(?:\u02bb |\u2019 | |\' ) *)(.+)$/, + PARTICLE_FAMILY_REGEXP: /^([^ ]+(?:\-|\u02bb|\u2019| |\') *)(.+)$/, + DISPLAY_CLASSES: ["block", "left-margin", "right-inline", "indent"], + NAME_VARIABLES: [ + "author", + "editor", + "translator", + "contributor", + "collection-editor", + "composer", + "container-author", + "director", + "editorial-director", + "interviewer", + "original-author", + "recipient" + ], + NUMERIC_VARIABLES: [ + "call-number", + "chapter-number", + "collection-number", + "edition", + "page", + "issue", + "locator", + "number", + "number-of-pages", + "number-of-volumes", + "volume", + "citation-number" + ], + DATE_VARIABLES: [ + "locator-date", + "issued", + "event-date", + "accessed", + "container", + "original-date", + "publication-date", + "original-date", + "available-date", + "submitted" + ], + TITLE_FIELD_SPLITS: function(seg) { + var keys = ["title", "short", "main", "sub"]; + var ret = {}; + for (var i=0,ilen=keys.length;i"); + while (open > -1 && close > -1) { + if (open > close) { + end = open + 1; + } else { + end = close + 1; + } + if (open < close && str.slice(open + 1, close).indexOf("<") === -1) { + ret[ret.length - 1] += str.slice(0, open); + ret.push(str.slice(open, close + 1)); + ret.push(""); + str = str.slice(end); + } else { + ret[ret.length - 1] += str.slice(0, close + 1); + str = str.slice(end); + } + open = str.indexOf("<"); + close = str.indexOf(">"); + } + ret[ret.length - 1] += str; + return ret; + }, + demoteNoiseWords: function (state, fld, drop_or_demote) { + var SKIP_WORDS = state.locale[state.opt.lang].opts["leading-noise-words"]; + if (fld && drop_or_demote) { + fld = fld.split(/\s+/); + fld.reverse(); + var toEnd = []; + for (var j = fld.length - 1; j > -1; j += -1) { + if (SKIP_WORDS.indexOf(fld[j].toLowerCase()) > -1) { + toEnd.push(fld.pop()); + } else { + break; + } + } + fld.reverse(); + var start = fld.join(" "); + var end = toEnd.join(" "); + if ("drop" === drop_or_demote || !end) { + fld = start; + } else if ("demote" === drop_or_demote) { + fld = [start, end].join(", "); + } + } + return fld; + }, + extractTitleAndSubtitle: function (Item) { + var segments = ["", "container-"]; + for (var i=0,ilen=segments.length;i -1) { + var callbacks = []; + if (state.opt.development_extensions.thin_non_breaking_space_html_hack && state.opt.mode === "html") { + callbacks.push(function (txt) { + return txt.replace(/\u202f/g, ''); + }); + } + if (callbacks.length) { + return function (txt) { + for (var i = 0, ilen = callbacks.length; i < ilen; i += 1) { + txt = callbacks[i](txt); + } + return CSL.Output.Formats[state.opt.mode].text_escape(txt); + } + } else { + return CSL.Output.Formats[state.opt.mode].text_escape; + } + } else { + return function (txt) { return txt; }; + } + }, + SKIP_WORDS: ["about","above","across","afore","after","against","along","alongside","amid","amidst","among","amongst","anenst","apropos","apud","around","as","aside","astride","at","athwart","atop","barring","before","behind","below","beneath","beside","besides","between","beyond","but","by","circa","despite","down","during","except","for","forenenst","from","given","in","inside","into","lest","like","modulo","near","next","notwithstanding","of","off","on","onto","out","over","per","plus","pro","qua","sans","since","than","through"," thru","throughout","thruout","till","to","toward","towards","under","underneath","until","unto","up","upon","versus","vs.","v.","vs","v","via","vis-à-vis","with","within","without","according to","ahead of","apart from","as for","as of","as per","as regards","aside from","back to","because of","close to","due to","except for","far from","inside of","instead of","near to","next to","on to","out from","out of","outside of","prior to","pursuant to","rather than","regardless of","such as","that of","up to","where as","or", "yet", "so", "for", "and", "nor", "a", "an", "the", "de", "d'", "von", "van", "c", "et", "ca"], + FORMAT_KEY_SEQUENCE: [ + "@strip-periods", + "@font-style", + "@font-variant", + "@font-weight", + "@text-decoration", + "@vertical-align", + "@quotes" + ], + INSTITUTION_KEYS: [ + "font-style", + "font-variant", + "font-weight", + "text-decoration", + "text-case" + ], + SUFFIX_CHARS: "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", + ROMAN_NUMERALS: [ + [ "", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix" ], + [ "", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc" ], + [ "", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm" ], + [ "", "m", "mm", "mmm", "mmmm", "mmmmm"] + ], + CREATORS: [ + "author", + "editor", + "contributor", + "translator", + "recipient", + "interviewer", + "composer", + "original-author", + "container-author", + "collection-editor" + ], + LANGS: { + "af-ZA":"Afrikaans", + "ar":"Arabic", + "bg-BG":"Bulgarian", + "ca-AD":"Catalan", + "cs-CZ":"Czech", + "da-DK":"Danish", + "de-AT":"Austrian", + "de-CH":"German (CH)", + "de-DE":"German (DE)", + "el-GR":"Greek", + "en-GB":"English (GB)", + "en-US":"English (US)", + "es-ES":"Spanish", + "et-EE":"Estonian", + "eu":"European", + "fa-IR":"Persian", + "fi-FI":"Finnish", + "fr-CA":"French (CA)", + "fr-FR":"French (FR)", + "he-IL":"Hebrew", + "hr-HR":"Croatian", + "hu-HU":"Hungarian", + "is-IS":"Icelandic", + "it-IT":"Italian", + "ja-JP":"Japanese", + "km-KH":"Khmer", + "ko-KR":"Korean", + "lt-LT":"Lithuanian", + "lv-LV":"Latvian", + "mn-MN":"Mongolian", + "nb-NO":"Norwegian (Bokmål)", + "nl-NL":"Dutch", + "nn-NO":"Norwegian (Nynorsk)", + "pl-PL":"Polish", + "pt-BR":"Portuguese (BR)", + "pt-PT":"Portuguese (PT)", + "ro-RO":"Romanian", + "ru-RU":"Russian", + "sk-SK":"Slovak", + "sl-SI":"Slovenian", + "sr-RS":"Serbian", + "sv-SE":"Swedish", + "th-TH":"Thai", + "tr-TR":"Turkish", + "uk-UA":"Ukranian", + "vi-VN":"Vietnamese", + "zh-CN":"Chinese (CN)", + "zh-TW":"Chinese (TW)" + }, + LANG_BASES: { + af: "af_ZA", + ar: "ar", + bg: "bg_BG", + ca: "ca_AD", + cs: "cs_CZ", + da: "da_DK", + de: "de_DE", + el: "el_GR", + en: "en_US", + es: "es_ES", + et: "et_EE", + eu: "eu", + fa: "fa_IR", + fi: "fi_FI", + fr: "fr_FR", + he: "he_IL", + hr: "hr-HR", + hu: "hu_HU", + is: "is_IS", + it: "it_IT", + ja: "ja_JP", + km: "km_KH", + ko: "ko_KR", + lt: "lt_LT", + lv: "lv-LV", + mn: "mn_MN", + nb: "nb_NO", + nl: "nl_NL", + nn: "nn-NO", + pl: "pl_PL", + pt: "pt_PT", + ro: "ro_RO", + ru: "ru_RU", + sk: "sk_SK", + sl: "sl_SI", + sr: "sr_RS", + sv: "sv_SE", + th: "th_TH", + tr: "tr_TR", + uk: "uk_UA", + vi: "vi_VN", + zh: "zh_CN" + }, + SUPERSCRIPTS: { + "\u00AA": "\u0061", + "\u00B2": "\u0032", + "\u00B3": "\u0033", + "\u00B9": "\u0031", + "\u00BA": "\u006F", + "\u02B0": "\u0068", + "\u02B1": "\u0266", + "\u02B2": "\u006A", + "\u02B3": "\u0072", + "\u02B4": "\u0279", + "\u02B5": "\u027B", + "\u02B6": "\u0281", + "\u02B7": "\u0077", + "\u02B8": "\u0079", + "\u02E0": "\u0263", + "\u02E1": "\u006C", + "\u02E2": "\u0073", + "\u02E3": "\u0078", + "\u02E4": "\u0295", + "\u1D2C": "\u0041", + "\u1D2D": "\u00C6", + "\u1D2E": "\u0042", + "\u1D30": "\u0044", + "\u1D31": "\u0045", + "\u1D32": "\u018E", + "\u1D33": "\u0047", + "\u1D34": "\u0048", + "\u1D35": "\u0049", + "\u1D36": "\u004A", + "\u1D37": "\u004B", + "\u1D38": "\u004C", + "\u1D39": "\u004D", + "\u1D3A": "\u004E", + "\u1D3C": "\u004F", + "\u1D3D": "\u0222", + "\u1D3E": "\u0050", + "\u1D3F": "\u0052", + "\u1D40": "\u0054", + "\u1D41": "\u0055", + "\u1D42": "\u0057", + "\u1D43": "\u0061", + "\u1D44": "\u0250", + "\u1D45": "\u0251", + "\u1D46": "\u1D02", + "\u1D47": "\u0062", + "\u1D48": "\u0064", + "\u1D49": "\u0065", + "\u1D4A": "\u0259", + "\u1D4B": "\u025B", + "\u1D4C": "\u025C", + "\u1D4D": "\u0067", + "\u1D4F": "\u006B", + "\u1D50": "\u006D", + "\u1D51": "\u014B", + "\u1D52": "\u006F", + "\u1D53": "\u0254", + "\u1D54": "\u1D16", + "\u1D55": "\u1D17", + "\u1D56": "\u0070", + "\u1D57": "\u0074", + "\u1D58": "\u0075", + "\u1D59": "\u1D1D", + "\u1D5A": "\u026F", + "\u1D5B": "\u0076", + "\u1D5C": "\u1D25", + "\u1D5D": "\u03B2", + "\u1D5E": "\u03B3", + "\u1D5F": "\u03B4", + "\u1D60": "\u03C6", + "\u1D61": "\u03C7", + "\u2070": "\u0030", + "\u2071": "\u0069", + "\u2074": "\u0034", + "\u2075": "\u0035", + "\u2076": "\u0036", + "\u2077": "\u0037", + "\u2078": "\u0038", + "\u2079": "\u0039", + "\u207A": "\u002B", + "\u207B": "\u2212", + "\u207C": "\u003D", + "\u207D": "\u0028", + "\u207E": "\u0029", + "\u207F": "\u006E", + "\u2120": "\u0053\u004D", + "\u2122": "\u0054\u004D", + "\u3192": "\u4E00", + "\u3193": "\u4E8C", + "\u3194": "\u4E09", + "\u3195": "\u56DB", + "\u3196": "\u4E0A", + "\u3197": "\u4E2D", + "\u3198": "\u4E0B", + "\u3199": "\u7532", + "\u319A": "\u4E59", + "\u319B": "\u4E19", + "\u319C": "\u4E01", + "\u319D": "\u5929", + "\u319E": "\u5730", + "\u319F": "\u4EBA", + "\u02C0": "\u0294", + "\u02C1": "\u0295", + "\u06E5": "\u0648", + "\u06E6": "\u064A" + }, + SUPERSCRIPTS_REGEXP: new RegExp("[\u00AA\u00B2\u00B3\u00B9\u00BA\u02B0\u02B1\u02B2\u02B3\u02B4\u02B5\u02B6\u02B7\u02B8\u02E0\u02E1\u02E2\u02E3\u02E4\u1D2C\u1D2D\u1D2E\u1D30\u1D31\u1D32\u1D33\u1D34\u1D35\u1D36\u1D37\u1D38\u1D39\u1D3A\u1D3C\u1D3D\u1D3E\u1D3F\u1D40\u1D41\u1D42\u1D43\u1D44\u1D45\u1D46\u1D47\u1D48\u1D49\u1D4A\u1D4B\u1D4C\u1D4D\u1D4F\u1D50\u1D51\u1D52\u1D53\u1D54\u1D55\u1D56\u1D57\u1D58\u1D59\u1D5A\u1D5B\u1D5C\u1D5D\u1D5E\u1D5F\u1D60\u1D61\u2070\u2071\u2074\u2075\u2076\u2077\u2078\u2079\u207A\u207B\u207C\u207D\u207E\u207F\u2120\u2122\u3192\u3193\u3194\u3195\u3196\u3197\u3198\u3199\u319A\u319B\u319C\u319D\u319E\u319F\u02C0\u02C1\u06E5\u06E6]", "g"), + UPDATE_GROUP_CONTEXT_CONDITION: function (state, termtxt, valueTerm) { + if (state.tmp.group_context.tip.condition) { + if (state.tmp.group_context.tip.condition.test) { + var testres; + if (state.tmp.group_context.tip.condition.test === "empty-label") { + testres = !termtxt; + } else if (state.tmp.group_context.tip.condition.test === "comma-safe") { + var empty = !termtxt; + var alpha = termtxt.slice(0,1).match(CSL.ALL_ROMANESQUE_REGEXP); + var num = state.tmp.just_did_number; + if (empty) { + testres = true; + } else if (num) { + if (alpha && !valueTerm) { + testres = true; + } else { + testres = false; + } + } else { + if (alpha && !valueTerm) { + testres = true; + } else { + testres = false; + } + } + } + if (testres) { + state.tmp.group_context.tip.force_suppress = false; + } else { + state.tmp.group_context.tip.force_suppress = true; + } + if (state.tmp.group_context.tip.condition.not) { + state.tmp.group_context.tip.force_suppress = !state.tmp.group_context.tip.force_suppress; + } + } + } else { + if (termtxt.slice(-1).match(/[0-9]/)) { + state.tmp.just_did_number = true; + } else { + state.tmp.just_did_number = false; + } + } + }, + locale: {}, + locale_opts: {}, + locale_dates: {} +}; +if (typeof require !== "undefined" && typeof module !== 'undefined' && "exports" in module) { + var CSL_IS_NODEJS = true; + exports.CSL = CSL; +} +CSL.TERMINAL_PUNCTUATION_REGEXP = new RegExp("^([" + CSL.TERMINAL_PUNCTUATION.slice(0, -1).join("") + "])(.*)"); +CSL.CLOSURES = new RegExp(".*[\\]\\)]"); +if ("undefined" === typeof console) { + CSL.debug = function (str) { + dump("CSL: " + str + "\n"); + }; + CSL.error = function (str) { + dump("CSL error: " + str + "\n"); + }; +} else { + CSL.debug = function (str) { + console.log("CSL: " + str); + }; + CSL.error = function (str) { + console.log("CSL error: " + str); + }; +} +CSL.XmlJSON = function (dataObj) { + this.dataObj = dataObj; + this.institution = { + name:"institution", + attrs:{ + "institution-parts":"long", + "delimiter":", ", + "substitute-use-first":"1", + "use-last":"1" + }, + children:[ + { + name:"institution-part", + attrs:{ + name:"long" + }, + children:[] + } + ] + }; +}; +CSL.XmlJSON.prototype.clean = function (json) { + return json; +}; +CSL.XmlJSON.prototype.getStyleId = function (myjson, styleName) { + var tagName = 'id'; + if (styleName) { + tagName = 'title'; + } + var ret = ""; + var children = myjson.children; + for (var i=0,ilen=children.length;i -1 && !myjson.children[i].attrs.prefix && !myjson.children[i].attrs.suffix) { + mustHaves = mustHaves.slice(0,haveVarname).concat(mustHaves.slice(haveVarname+1)); + } else { + useme = false; + break; + } + } + if (useme && !mustHaves.length) { + myjson.attrs["has-publisher-and-publisher-place"] = true; + } + } + for (var i=0,ilen=myjson.children.length;i 0) { + var myparents = parents.slice(); + var parent = myparents.pop(); + if (parent === "substitute") { + return true; + } else { + return this.isChildOfSubstitute(myparents); + } + } + return false; +}; +CSL.XmlJSON.prototype.addMissingNameNodes = function(myjson,parents) { + if (!parents) { + parents = []; + } + if (myjson.name === "names") { + if (!this.isChildOfSubstitute(parents)) { + var addName = true; + for (var i=0,ilen=myjson.children.length;i -1) { + var institution = this.nodeCopy(this.institution); + for (var i=0,ilen = CSL.INSTITUTION_KEYS.length;i/, ""); + xml = xml.replace(//g, ""); + xml = xml.replace(/^\s+/g, ""); + xml = xml.replace(/\s+$/g, ""); + return xml; +}; +CSL.parseXml = function(str) { + var _pos = 0; + var _obj = {children:[]}; + var _stack = [_obj.children]; + function _listifyString(str) { + str = str.split(/(?:\r\n|\n|\r)/).join(" ").replace(/>[ ]+<").replace(/<\!--.*?-->/g, ""); + var lst = str.split("><"); + var stylePos = null; + for (var i=0,ilen=lst.length;i 0) { + lst[i] = "<" + lst[i]; + } + if (i < (lst.length-1)) { + lst[i] = lst[i] + ">"; + } + if ("number" != typeof stylePos) { + if (lst[i].slice(0, 7) === "