Removing older portal versions

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@52742 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-07-13 10:53:04 +00:00
parent 54fc8a2180
commit 0262f4690c
979 changed files with 0 additions and 103397 deletions

View File

@ -1,15 +0,0 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

18
portal-2/.gitignore vendored
View File

@ -1,18 +0,0 @@
/__build__
/__server_build__
/node_modules
/typings
/tsd_typings/
npm-debug.log
/dist/
.idea
*.ngfactory.ts
*.css.shim.ts
.DS_Store
webpack.records.json
/npm-debug.log.*

View File

@ -1,147 +0,0 @@
<p align="center">
<img src="https://cloud.githubusercontent.com/assets/1016365/10639063/138338bc-7806-11e5-8057-d34c75f3cafc.png" alt="Universal Angular 2" height="320"/>
</p>
# Angular 2 Universal Starter [![Universal Angular 2](https://img.shields.io/badge/universal-angular2-brightgreen.svg?style=flat)](https://github.com/angular/universal)
> Server-Side Rendering for Angular 2
A minimal Angular 2 starter for Universal JavaScript using TypeScript 2 and Webpack 2
> If you're looking for the Angular Universal repo go to [**angular/universal**](https://github.com/angular/universal)
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
## Installation
* `npm install`
## Serve
* `npm start` to build your client app and start a web server
* `npm run build` to prepare a distributable bundle
## Development
* run `npm start` and `npm run watch` in two separate terminals to build your client app, start a web server, and allow file changes to update in realtime
## Watch files
* `npm run watch` to build your client app and start a web server
## AoT and Prod
* `npm run build:prod:ngc` to compile the ngfactory files and build prod
######
npm run build:prod:ngc
PORT = XXXX npm run server
## Universal "Gotchas"
> When building Universal components in Angular 2 there are a few things to keep in mind.
- To use `templateUrl` or `styleUrls` you must use **`angular2-template-loader`** in your TS loaders.
- This is already setup within this starter repo. Look at the webpack.config file [here](https://github.com/angular/universal-starter/blob/master/webpack.config.ts) for details & implementation.
- **`window`**, **`document`**, **`navigator`**, and other browser types - _do not exist on the server_ - so using them, or any library that uses them (jQuery for example) will not work. You do have some options, if you truly need some of this functionality:
- If you need to use them, consider limiting them to only your main.client and wrapping them situationally with the imported *isBrowser / isNode* features from Universal. `import { isBrowser, isNode } from 'angular2-universal'`;
- Another option is using `DOM` from ["@angular/platform-browser"](https://github.com/angular/angular/blob/e3687706c71beb7c9dbdae1bbb5fbbcea588c476/modules/%40angular/platform-browser/src/dom/dom_adapter.ts#L34)
- **Don't manipulate the nativeElement directly**. Use the _Renderer_. We do this to ensure that in any environment we're able to change our view.
```
constructor(element: ElementRef, renderer: Renderer) {
renderer.setElementStyle(element.nativeElement, 'font-size', 'x-large');
}
```
- The application runs XHR requests on the server & once again on the Client-side (when the application bootstraps)
- Use a [UniversalCache](https://github.com/angular/universal-starter/blob/master/src/%2Bapp/shared/model/model.service.ts#L34-L50) instead of regular Http, to save certain requests so they aren't re-ran again on the Client. ([Example useage here](https://github.com/angular/universal-starter/blob/cc71e2d5b2d783f2bb52eebd1b5c6fa0ba23f08a/src/%2Bapp/%2Bhome/home.component.ts#L22-L24))
- Know the difference between attributes and properties in relation to the DOM.
- Keep your directives stateless as much as possible. For stateful directives, you may need to provide an attribute that reflects the corresponding property with an initial string value such as url in img tag. For our native `<img src="">` element the src attribute is reflected as the src property of the element type HTMLImageElement.
### Brotli Compression Support
To enable Brotli compression for server response with fallback for gzip. Install the following packages
```
npm install --save-dev iltorb accepts @types/accepts express-interceptor memory-cache @types/memory-cache
```
and replace the following code from src/server.aot.ts.
```
import * as compression from 'compression';
app.use(compression());
```
with
```
import * as mcache from 'memory-cache';
const { gzipSync } = require('zlib');
const accepts = require('accepts');
const { compressSync } = require('iltorb');
const interceptor = require('express-interceptor');
app.use(interceptor((req, res)=>({
// don't compress responses with this request header
isInterceptable: () => (!req.headers['x-no-compression']),
intercept: ( body, send ) => {
const encodings = new Set(accepts(req).encodings());
const bodyBuffer = new Buffer(body);
// url specific key for response cache
const key = '__response__' + req.originalUrl || req.url;
let output = bodyBuffer;
// check if cache exists
if (mcache.get(key) === null) {
// check for encoding support
if (encodings.has('br')) {
// brotli
res.setHeader('Content-Encoding', 'br');
output = compressSync(bodyBuffer);
mcache.put(key, {output, encoding: 'br'});
} else if (encodings.has('gzip')) {
// gzip
res.setHeader('Content-Encoding', 'gzip');
output = gzipSync(bodyBuffer);
mcache.put(key, {output, encoding: 'gzip'});
}
} else {
const { output, encoding } = mcache.get(key);
res.setHeader('Content-Encoding', encoding);
send(output);
}
send(output);
}
})));
```
this will check the support, compress and cache the response.
## Edge case of server compatibility with Promise polyfills
If you have node modules with promise polyfill dependency on server - there is chance to get the following exception:
```
Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
```
It occurs because [Zone.js](https://github.com/angular/zone.js/) Promise implementation is not
detected as Promise by some polyfills (e.g. [es6-promise](https://github.com/stefanpenner/es6-promise) before 4.x).
To sort it out, you need such polyfills initialized before zone.js. Zone.js is initialized in 'angular2-universal-polyfills'
import of [server.ts](https://github.com/angular/universal-starter/blob/master/src/server.ts#L4). So import problematic
modules before this line.
### Documentation
[Design Doc](https://docs.google.com/document/d/1q6g9UlmEZDXgrkY88AJZ6MUrUxcnwhBGS0EXbVlYicY)
### Videos
Angular 2 Universal Patterns - ng-conf, May 2016
[![Angular 2 Universal Patterns](http://img.youtube.com/vi/TCj_oC3m6_U/0.jpg)](https://www.youtube.com/watch?v=TCj_oC3m6_U)
Angular Universal Source Code - ReadTheSource, January 2016
[![Angular Universal Source Code](http://img.youtube.com/vi/qOjtFjXoebY/0.jpg)](https://www.youtube.com/watch?v=qOjtFjXoebY)
Full Stack Angular 2 - AngularConnect, Oct 2015
[![Full Stack Angular 2](https://img.youtube.com/vi/MtoHFDfi8FM/0.jpg)](https://www.youtube.com/watch?v=MtoHFDfi8FM)
Angular 2 Server Rendering - Angular U, July 2015
[![Angular 2 Server Rendering](http://img.youtube.com/vi/0wvZ7gakqV4/0.jpg)](http://www.youtube.com/watch?v=0wvZ7gakqV4)
## [preboot.js](https://github.com/angular/preboot)
> Control server-rendered page and transfer state before client-side web app loads to the client-side-app.
# License
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](/LICENSE)

View File

@ -1,12 +0,0 @@
{
"name": "Angular 2 Universal Starter",
"description": "Angular 2 Universal starter kit by @AngularClass",
"repository": "https://github.com/angular/universal-starter",
"logo": "https://cloud.githubusercontent.com/assets/1016365/10639063/138338bc-7806-11e5-8057-d34c75f3cafc.png",
"env": {
"NPM_CONFIG_PRODUCTION": {
"description": "Install `webpack` and other development modules when deploying to allow full builds.",
"value": "false"
}
}
}

View File

@ -1,7 +0,0 @@
module.exports = {
NgProbeToken: {},
_createConditionalRootRenderer: function(rootRenderer, extraTokens, coreTokens) {
return rootRenderer;
},
__platform_browser_private__: {}
};

View File

@ -1,36 +0,0 @@
if [ "$1" != "" ]; then
echo "Find html files in $1";
find $1 -name "*.html" -type f
echo " ";
echo " ";
echo " ";
files=( $(find $1 -name "*.html" -type f) )
echo " Minifying...";
echo " ";
total = 0;
for entry in $(find $1 -name "*.html" -type f)
do
echo
s=$(stat -c%s "$entry");
echo "Size of $entry = $s bytes.";
cat $entry | sed -e :a -re 's/<!--.*?-->//g;/<!--/N;//ba'| awk '{printf "%s",$0} END {print ""}' | tr -s " "> $entry".mini";
n=$entry".mini";
ns=$(stat -c%s "$n");
dif=$((s-ns));
total=$((total+dif));
echo Size of $n = $ns bytes.
done
for entry in $(find $1 -name "*.html" -type f)
do
echo
cat $entry".mini" > $entry;
rm $entry".mini";
done
echo Total size $total
else
echo "Give a path";
fi

View File

@ -1,7 +0,0 @@
{
"watch": [
"dist",
"src/index.html"
],
"ext" : "js ts json html"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +0,0 @@
{
"name": "universal-starter",
"version": "2.0.0",
"description": "Angular 2 Universal starter kit by @AngularClass",
"repository": {
"type": "git",
"url": "https://github.com/angular/universal-starter.git"
},
"scripts": {
"watch": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --watch",
"watch:dev": "npm run server & npm run watch",
"clean:dist": "rimraf dist",
"clean:ngc": "rimraf **/*.ngfactory.ts **/*.css.shim.ts",
"prebuild": "npm run clean:dist",
"build": "webpack --progress",
"build:prod:ngc": "npm run clean:ngc && npm run ngc && npm run clean:dist && npm run build:prod",
"build:prod:ngc:json": "npm run clean:ngc && npm run ngc && npm run clean:dist && npm run build:prod:json",
"build:prod": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack.prod.config.ts",
"build:prod:json": "webpack --config webpack.prod.config.ts --json | webpack-bundle-size-analyzer",
"ngc": "ngc -p tsconfig.aot.json",
"prestart": "npm run build",
"minify": "uglifyjs dist/client/main.bundle.js --screw-ie8 --compress --mangle --output dist/client/main.bundle.min.js",
"minify-test": "uglifyjs dist/client/main.bundle.js --output dist/client/main.xmin.js",
"server": "nodemon dist/server/index.js",
"debug:server": "node-nightly --inspect --debug-brk dist/server/index.js",
"start": "npm run server",
"debug:start": "npm run build && npm run debug:server",
"predebug": "npm run build",
"debug:build": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js",
"debug:build:prod": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js --config webpack.prod.config.ts",
"debug": "node --debug-brk dist/server/index.js"
},
"license": "MIT",
"contributors": [
"AngularClass <hello@angularclass.com>",
"PatrickJS <patrick@angularclass.com>",
"Jeff Whelpley <jeff@gethuman.com>",
"Jeff Cross <crossj@google.com>",
"Mark Pieszak <mpieszak84@gmail.com>"
],
"dependencies": {
"@angular/common": "~2.1.2",
"@angular/compiler": "~2.1.2",
"@angular/compiler-cli": "~2.1.2",
"@angular/core": "~2.1.2",
"@angular/forms": "~2.1.2",
"@angular/http": "~2.1.2",
"@angular/platform-browser": "~2.1.2",
"@angular/platform-browser-dynamic": "~2.1.2",
"@angular/platform-server": "~2.1.2",
"@angular/router": "~3.1.2",
"@angular/upgrade": "~2.1.2",
"@angularclass/bootloader": "~1.0.1",
"@angularclass/idle-preload": "~1.0.4",
"@types/clipboard": "^1.5.31",
"angular2-datatable": "^0.6.0",
"angular2-express-engine": "~2.1.0-rc.1",
"angular2-platform-node": "~2.1.0-rc.1",
"angular2-universal": "~2.1.0-rc.1",
"angular2-universal-polyfills": "~2.1.0-rc.1",
"base64url": "^2.0.0",
"body-parser": "^1.15.2",
"citation-js": "^0.3.0-6",
"clipboard": "^1.5.16",
"compression": "^1.6.2",
"express": "^4.14.0",
"js.clone": "0.0.3",
"methods": "~1.1.2",
"morgan": "^1.7.0",
"preboot": "~4.5.2",
"rxjs": "5.0.0-beta.12",
"ts-md5": "^1.2.0",
"webfontloader": "^1.6.26",
"zone.js": "~0.6.26"
},
"devDependencies": {
"@types/morgan": "^1.7.32",
"@types/body-parser": "0.0.29",
"@types/compression": "0.0.29",
"@types/cookie-parser": "1.3.30",
"@types/express": "^4.0.32",
"@types/express-serve-static-core": "^4.0.33",
"@types/hammerjs": "^2.0.32",
"@types/mime": "0.0.28",
"@types/node": "^6.0.38",
"@types/serve-static": "^1.7.27",
"@types/webfontloader": "^1.6.27",
"@ngtools/webpack": "~1.1.7",
"angular2-template-loader": "^0.4.0",
"awesome-typescript-loader": "^2.2.4",
"cookie-parser": "^1.4.3",
"imports-loader": "^0.6.5",
"json-loader": "^0.5.4",
"nodemon": "^1.10.0",
"raw-loader": "^0.5.1",
"reflect-metadata": "0.1.8",
"rimraf": "^2.5.4",
"string-replace-loader": "^1.0.5",
"ts-helpers": "^1.1.2",
"ts-node": "^1.3.0",
"typescript": "2.0.2",
"uglify-js": "^2.7.4",
"v8-lazy-parse-webpack-plugin": "^0.3.0",
"webpack": "2.1.0-beta.27",
"webpack-bundle-analyzer": "1.4.1",
"webpack-dev-middleware": "^1.8.4",
"webpack-dev-server": "2.1.0-beta.11",
"webpack-merge": "~0.16.0"
}
}

View File

@ -1,81 +0,0 @@
{
"name": "universal-starter",
"version": "2.0.0",
"description": "Angular 2 Universal starter kit by @AngularClass",
"repository": {
"type": "git",
"url": "https://github.com/angular/universal-starter.git"
},
"scripts": {
"watch": "webpack --watch",
"prebuild": "rimraf dist",
"build": "webpack",
"build:prod": "webpack --progress -p",
"prestart": "npm run build",
"server": "nodemon dist/server/index.js",
"debug:server": "node-nightly --inspect --debug-brk dist/server/index.js",
"start": "npm run server",
"debug:start": "npm run build && npm run debug:server",
"predebug": "npm run build",
"debug:build": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js",
"debug": "node --debug-brk dist/server/index.js"
},
"license": "MIT",
"contributors": [
"AngularClass <hello@angularclass.com>",
"PatrickJS <patrick@angularclass.com>",
"Jeff Whelpley <jeff@gethuman.com>",
"Jeff Cross <crossj@google.com>",
"Mark Pieszak <mpieszak84@gmail.com>"
],
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/platform-server": "2.0.0",
"@angular/router": "3.0.0",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.6",
"angular2-express-engine": "~2.0.11",
"angular2-platform-node": "~2.0.11",
"angular2-universal": "~2.0.11",
"angular2-universal-polyfills": "~2.0.11",
"body-parser": "^1.15.2",
"bootstrap": "^4.0.0-alpha.4",
"express": "^4.14.0",
"methods": "~1.1.2",
"ng2-webstorage": "^1.2.2",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.23"
},
"devDependencies": {
"@angularclass/resolve-angular-routes": "^1.0.9",
"@types/body-parser": "0.0.29",
"@types/compression": "0.0.29",
"@types/cookie-parser": "^1.3.29",
"@types/express": "^4.0.32",
"@types/express-serve-static-core": "^4.0.33",
"@types/hammerjs": "^2.0.32",
"@types/mime": "0.0.28",
"@types/node": "^6.0.38",
"@types/serve-static": "^1.7.27",
"angular2-template-loader": "^0.4.0",
"cookie-parser": "^1.4.3",
"imports-loader": "^0.6.5",
"json-loader": "^0.5.4",
"nodemon": "^1.10.0",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.4",
"string-replace-loader": "github:gdi2290/string-replace-loader",
"ts-loader": "^0.8.2",
"ts-node": "^1.3.0",
"typescript": "2.0.0",
"webpack": "2.1.0-beta.22",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "^2.1.0-beta.0",
"webpack-merge": "^0.13.0"
}
}

View File

@ -1,21 +0,0 @@
/*
* THIS IS TEMPORARY TO PATCH 2.1.1+ Core bugs
*/
/* tslint:disable */
let __compiler__ = require('@angular/compiler');
import { __platform_browser_private__ } from '@angular/platform-browser';
import { __core_private__ } from '@angular/core';
if (!__core_private__['ViewUtils']) {
__core_private__['ViewUtils'] = __core_private__['view_utils'];
}
if (__compiler__ && __compiler__.SelectorMatcher && __compiler__.CssSelector) {
(__compiler__).__compiler_private__ = {
SelectorMatcher: __compiler__.SelectorMatcher,
CssSelector: __compiler__.CssSelector
}
}

View File

@ -1,44 +0,0 @@
/*
* THIS IS TEMPORARY TO PATCH 2.1.1+ Core bugs
*/
/* tslint:disable */
let __compiler__ = require('@angular/compiler');
import { __platform_browser_private__ } from '@angular/platform-browser';
import { __core_private__ } from '@angular/core';
let patch = false;
if (!__core_private__['ViewUtils']) {
patch = true;
__core_private__['ViewUtils'] = __core_private__['view_utils'];
}
if (__compiler__ && __compiler__.SelectorMatcher && __compiler__.CssSelector) {
patch = true;
(__compiler__).__compiler_private__ = {
SelectorMatcher: __compiler__.SelectorMatcher,
CssSelector: __compiler__.CssSelector
}
}
if (patch) {
var __universal__ = require('angular2-platform-node/__private_imports__');
__universal__.ViewUtils = __core_private__['view_utils'];
__universal__.CssSelector = __universal__.CssSelector || __compiler__.CssSelector;
__universal__.SelectorMatcher = __universal__.SelectorMatcher || __compiler__.SelectorMatcher;
}
// Fix Material Support
function universalMaterialSupports(eventName: string): boolean { return Boolean(this.isCustomEvent(eventName)); }
__platform_browser_private__.HammerGesturesPlugin.prototype.supports = universalMaterialSupports;
// End Fix Material Support
// Fix Universal Style
import { NodeDomRootRenderer, NodeDomRenderer } from 'angular2-universal/node';
function renderComponentFix(componentProto: any) {
return new NodeDomRenderer(this, componentProto, this._animationDriver);
}
NodeDomRootRenderer.prototype.renderComponent = renderComponentFix;
// End Fix Universal Style

View File

@ -1,216 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Injectable, Inject} from '@angular/core';
// es6-modules are used here
import {DomAdapter, getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DOCUMENT} from '@angular/platform-browser';
/**
* Represent meta element.
*
* ### Example
*
* ```ts
* { name: 'application-name', content: 'Name of my application' },
* { name: 'description', content: 'A description of the page', id: 'desc' }
* // ...
* // Twitter
* { name: 'twitter:title', content: 'Content Title' }
* // ...
* // Google+
* { itemprop: 'name', content: 'Content Title' },
* { itemprop: 'description', content: 'Content Title' }
* // ...
* // Facebook / Open Graph
* { property: 'fb:app_id', content: '123456789' },
* { property: 'og:title', content: 'Content Title' }
* ```
*
* @experimental
*/
export interface MetaDefinition {
charset?: string;
content?: string;
httpEquiv?: string;
id?: string;
itemprop?: string;
name?: string;
property?: string;
scheme?: string;
url?: string;
[prop: string]: string;
}
/**
* A service that can be used to get and add meta tags.
*
* @experimental
*/
@Injectable()
export class Meta {
private _dom: DomAdapter = getDOM();
constructor( @Inject(DOCUMENT) private _document: any) { }
/**
* Sets the title of the page
*/
setTitle(title: string) {
this._document.title = title
}
/**
* Adds a new meta tag to the dom.
*
* ### Example
*
* ```ts
* const name: MetaDefinition = {name: 'application-name', content: 'Name of my application'};
* const desc: MetaDefinition = {name: 'description', content: 'A description of the page'};
* const tags: HTMLMetaElement[] = this.meta.addTags([name, desc]);
* ```
*
* @param tags
* @returns {HTMLMetaElement[]}
*/
addTags(...tags: Array<MetaDefinition|MetaDefinition[]>): HTMLMetaElement[] {
const presentTags = this._flattenArray(tags);
if (presentTags.length === 0) return [];
return presentTags.map((tag: MetaDefinition) => this._addInternal(tag));
}
/**
* Gets the meta tag by the given selector. Returns element or null
* if there's no such meta element.
*
* ### Example
*
* ```ts
* const meta: HTMLMetaElement = this.meta.getTag('name=description');
* const twitterMeta: HTMLMetaElement = this.meta.getTag('name="twitter:title"');
* const fbMeta: HTMLMetaElement = this.meta.getTag('property="fb:app_id"');
* ```
*
* @param selector
* @returns {HTMLMetaElement}
*/
getTag(selector: string): HTMLMetaElement {
if (!selector) return null;
return this._dom.query(`meta[${selector}]`);
}
/**
* Updates the meta tag with the given selector.
*
* * ### Example
*
* ```ts
* const meta: HTMLMetaElement = this.meta.updateTag('name=description', {name: 'description',
* content: 'New description'});
* console.log(meta.content); // 'New description'
* ```
*
* @param selector
* @param tag updated tag definition
* @returns {HTMLMetaElement}
*/
updateTag(selector: string, tag: MetaDefinition): HTMLMetaElement {
const meta: HTMLMetaElement = this.getTag(selector);
if (!meta) {
// create element if it doesn't exist
return this._addInternal(tag);
}
return this._prepareMetaElement(tag, meta);
}
updateMeta(name, content) {
const head = this._document.head;
let childNodesAsList = this._dom.childNodesAsList(head);
let metaEl = childNodesAsList.find(el => el['attribs'] ? el['attribs'].name == name : false);
if (metaEl) metaEl['attribs'].content = content;
}
updateProperty(property, content) {
const head = this._document.head;
let childNodesAsList = this._dom.childNodesAsList(head);
let metaEl = childNodesAsList.find(el => el['attribs'] ? el['attribs'].property == property : false);
if (metaEl) metaEl['attribs'].content = content;
}
/**
* Removes meta tag with the given selector from the dom.
*
* ### Example
*
* ```ts
* this.meta.removeTagBySelector('name=description');
* ```
*
* @param selector
*/
removeTagBySelector(selector: string): void {
const meta: HTMLMetaElement = this.getTag(selector);
this.removeTagElement(meta);
}
/**
* Removes given meta element from the dom.
*
* ### Example
* ```ts
* const elem: HTMLMetaElement = this.meta.getTag('name=description');
* this.meta.removeTagElement(elem);
* ```
*
* @param meta meta element
*/
removeTagElement(meta: HTMLMetaElement): void {
if (meta) {
this._removeMetaElement(meta);
}
}
private _addInternal(tag: MetaDefinition): HTMLMetaElement {
const meta: HTMLMetaElement = this._createMetaElement();
this._prepareMetaElement(tag, meta);
this._appendMetaElement(meta);
return meta;
}
private _createMetaElement(): HTMLMetaElement {
return this._dom.createElement('meta') as HTMLMetaElement;
}
private _prepareMetaElement(tag: MetaDefinition, el: HTMLMetaElement): HTMLMetaElement {
Object.keys(tag).forEach((prop: string) => this._dom.setAttribute(el, prop, tag[prop]));
return el;
}
// private _appendMetaElement(meta: HTMLMetaElement): void {
// const head = this._dom.getElementsByTagName(this._dom.defaultDoc(), 'head')[0];
// this._dom.appendChild(head, meta);
// }
private _appendMetaElement(meta: HTMLMetaElement): void {
const head = this._document.head;
this._dom.appendChild(head, meta);
}
private _removeMetaElement(meta: HTMLMetaElement): void {
const head = this._dom.parentElement(meta);
this._dom.removeChild(head, meta);
}
private _flattenArray(input: any[], out: any[] = []): any[] {
if (input) {
for (let i = 0; i < input.length; i++) {
const item: any = input[i];
if (Array.isArray(item)) {
this._flattenArray(item, out);
} else if (item) {
out.push(item);
}
}
}
return out;
}
}

View File

@ -1,213 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
export function getHomeModule() {
return System.import('./home/home.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'HomeModuleNgFactory' : 'HomeModule')]);
}
export function getPublicationModule() {
return System.import('./landingPages/publication/publication.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'PublicationModuleNgFactory' : 'PublicationModule')]);
}
export function getDatasetModule() {
return System.import('./landingPages/dataset/dataset.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DatasetModuleNgFactory' : 'DatasetModule')]);
}
export function getSoftwareModule() {
return System.import('./landingPages/software/software.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SoftwareModuleNgFactory' : 'SoftwareModule')]);
}
export function getProjectModule() {
return System.import('./landingPages/project/project.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'ProjectModuleNgFactory' : 'ProjectModule')]);
}
export function getOrganizationModule() {
return System.import('./landingPages/organization/organization.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'OrganizationModuleNgFactory' : 'OrganizationModule')]);
}
export function getDepositDatasetsModule() {
return System.import('./deposit/datasets/depositDatasets.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositDatasetsModuleNgFactory' : 'DepositDatasetsModule')]);
}
export function getDepositDatasetsResultsModule() {
return System.import('./deposit/datasets/depositDatasetsResults.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositDatasetsResultsModuleNgFactory' : 'DepositDatasetsResultsModule')]);
}
export function getDepositBySubjectResultsModule() {
return System.import('./deposit/datasets/depositBySubjectResults.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositBySubjectResultsModuleNgFactory' : 'DepositBySubjectResultsModule')]);
}
export function getDepositPublicationsModule() {
return System.import('./deposit/publications/depositPublications.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositPublicationsModuleNgFactory' : 'DepositPublicationsModule')]);
}
export function getDepositPublicationsResultsModule() {
return System.import('./deposit/publications/depositPublicationsResults.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositPublicationsResultsModuleNgFactory' : 'DepositPublicationsResultsModule')]);
}
export function getDataProviderModule() {
return System.import('./landingPages/dataProvider/dataProvider.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DataProviderModuleNgFactory' : 'DataProviderModule')]);
}
export function getMainSearchModule() {
return System.import('./searchPages/find/mainSearch.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'MainSearchModuleNgFactory' : 'MainSearchModule')]);
}
export function getSearchPublicationsModule() {
return System.import('./searchPages/simple/searchPublications.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchPublicationsModuleNgFactory' : 'SearchPublicationsModule')]);
}
export function getSearchDatasetsModule() {
return System.import('./searchPages/simple/searchDatasets.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchDatasetsModuleNgFactory' : 'SearchDatasetsModule')]);
}
export function getSearchSoftwareModule() {
return System.import('./searchPages/simple/searchSoftware.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchSoftwareModuleNgFactory' : 'SearchSoftwareModule')]);
}
export function getSearchProjectsModule() {
return System.import('./searchPages/simple/searchProjects.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchProjectsModuleNgFactory' : 'SearchProjectsModule')]);
}
export function getSearchOrganizationsModule() {
return System.import('./searchPages/simple/searchOrganizations.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchOrganizationsModuleNgFactory' : 'SearchOrganizationsModule')]);
}
export function getSearchDataProvidersModule() {
return System.import('./searchPages/simple/searchDataProviders.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'SearchDataProvidersModuleNgFactory' : 'SearchDataProvidersModule')]);
}
export function getCompatibleDataProvidersModule() {
return System.import('./searchPages/dataProviders/compatibleDataProviders.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'CompatibleDataProvidersModuleNgFactory' : 'CompatibleDataProvidersModule')]);
}
export function getCompatibleDataProvidersTableModule() {
return System.import('./searchPages/dataProviders/compatibleDataProvidersTable.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'CompatibleDataProvidersTableModuleNgFactory' : 'CompatibleDataProvidersTableModule')]);
}
export function getEntityRegistriesModule() {
return System.import('./searchPages/dataProviders/entityRegistries.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'EntityRegistriesModuleNgFactory' : 'EntityRegistriesModule')]);
}
export function getEntityRegistriesTableModule() {
return System.import('./searchPages/dataProviders/entityRegistriesTable.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'EntityRegistriesTableModuleNgFactory' : 'EntityRegistriesTableModule')]);
}
export function getJournalsModule() {
return System.import('./searchPages/dataProviders/journals.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'JournalsModuleNgFactory' : 'JournalsModule')]);
}
export function getJournalsTableModule() {
return System.import('./searchPages/dataProviders/journalsTable.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'JournalsTableModuleNgFactory' : 'JournalsTableModule')]);
}
export function getAdvancedSearchPublicationsModule() {
return System.import('./searchPages/advanced/advancedSearchPublications.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchPublicationsModuleNgFactory' : 'AdvancedSearchPublicationsModule')]);
}
export function getAdvancedSearchDatasetsModule() {
return System.import('./searchPages/advanced/advancedSearchDatasets.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchDatasetsModuleNgFactory' : 'AdvancedSearchDatasetsModule')]);
}
export function getAdvancedSearchSoftwareModule() {
return System.import('./searchPages/advanced/advancedSearchSoftware.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchSoftwareModuleNgFactory' : 'AdvancedSearchSoftwareModule')]);
}
export function getAdvancedSearchOrganizationsModule() {
return System.import('./searchPages/advanced/advancedSearchOrganizations.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchOrganizationsModuleNgFactory' : 'AdvancedSearchOrganizationsModule')]);
}
export function getAdvancedSearchDataProvidersModule() {
return System.import('./searchPages/advanced/advancedSearchDataProviders.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchDataProvidersModuleNgFactory' : 'AdvancedSearchDataProvidersModule')]);
}
export function getAdvancedSearchProjectsModule() {
return System.import('./searchPages/advanced/advancedSearchProjects.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchProjectsModuleNgFactory' : 'AdvancedSearchProjectsModule')]);
}
export function gethtmlProjectReportModule() {
return System.import('./landingPages/htmlProjectReport/htmlProjectReport.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'HtmlProjectReportModuleNgFactory' : 'HtmlProjectReportModule')]);
}
export function getMyClaimsModule() {
return System.import('./claims/myClaims/myClaims.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'MyClaimsModuleNgFactory' : 'MyClaimsModule')]);
}
export function getClaimsAdminModule() {
return System.import('./claims/claimsAdmin/claimsAdmin.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'ClaimsAdminModuleNgFactory' : 'ClaimsAdminModule')]);
}
export function getClaimsByTokenModule() {
return System.import('./claims/claimsByToken/claimsByToken.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'ClaimsByTokenModuleNgFactory' : 'ClaimsByTokenModule')]);
}
export function getLinkingModule() {
return System.import('./claims/linking/linkingGeneric.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'LinkingGenericModuleNgFactory' : 'LinkingGenericModule')]);
}
export function getDirectLinkingModule() {
return System.import('./claims/directLinking/directLinking.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DirectLinkingModuleNgFactory' : 'DirectLinkingModule')]);
}
export function getUserModule() {
return System.import('./login/user.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'UserModuleNgFactory' : 'UserModule')]);
}
export function getReloadModule() {
return System.import('./reload/reload.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'ReloadModuleNgFactory' : 'ReloadModule')]);
}
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', loadChildren: getHomeModule},
{ path: 'home', loadChildren: getHomeModule},
{ path: 'search/publication', loadChildren: getPublicationModule },
{ path: 'search/dataset', loadChildren: getDatasetModule },
{ path: 'search/software', loadChildren: getSoftwareModule },
{ path: 'search/organization', loadChildren: getOrganizationModule },
{ path: 'search/project', loadChildren: getProjectModule },
{ path: 'search/dataprovider', loadChildren: getDataProviderModule },
{ path: 'participate/deposit-datasets', loadChildren: getDepositDatasetsModule },
{ path: 'participate/deposit-datasets-result', loadChildren: getDepositDatasetsResultsModule },
{ path: 'participate/deposit-subject-result', loadChildren: getDepositBySubjectResultsModule },
{ path: 'participate/deposit-publications', loadChildren: getDepositPublicationsModule },
{ path: 'participate/deposit-publications-result', loadChildren: getDepositPublicationsResultsModule },
{ path: 'search/find', loadChildren: getMainSearchModule },
{ path: 'search/find/publications', loadChildren: getSearchPublicationsModule },
{ path: 'search/find/datasets', loadChildren: getSearchDatasetsModule },
{ path: 'search/find/software', loadChildren: getSearchSoftwareModule },
{ path: 'search/find/projects', loadChildren: getSearchProjectsModule },
{ path: 'search/find/dataproviders', loadChildren: getSearchDataProvidersModule },
{ path: 'search/find/organizations', loadChildren: getSearchOrganizationsModule },
{ path: 'search/content-providers', loadChildren: getCompatibleDataProvidersModule },
{ path: 'search/content-providers-table', loadChildren: getCompatibleDataProvidersTableModule },
{ path: 'search/entity-registries', loadChildren: getEntityRegistriesModule },
{ path: 'search/entity-registries-table', loadChildren: getEntityRegistriesTableModule },
{ path: 'search/journals', loadChildren: getJournalsModule },
{ path: 'search/journals-table', loadChildren: getJournalsTableModule },
{ path: 'search/advanced/publications', loadChildren: getAdvancedSearchPublicationsModule },
{ path: 'search/advanced/datasets', loadChildren: getAdvancedSearchDatasetsModule },
{ path: 'search/advanced/software', loadChildren: getAdvancedSearchSoftwareModule },
{ path: 'search/advanced/organizations', loadChildren: getAdvancedSearchOrganizationsModule },
{ path: 'search/advanced/dataproviders', loadChildren: getAdvancedSearchDataProvidersModule },
{ path: 'search/advanced/projects', loadChildren: getAdvancedSearchProjectsModule },
{ path: 'project-report', loadChildren: gethtmlProjectReportModule },
{ path: 'myclaims', loadChildren: getMyClaimsModule },
{ path: 'claims', loadChildren: getClaimsAdminModule },
{ path: 'participate/claim', loadChildren: getLinkingModule },
{ path: 'participate/direct-claim', loadChildren: getDirectLinkingModule },
{ path: 'claims-project-manager', loadChildren: getClaimsByTokenModule },
{ path: 'user-info', loadChildren: getUserModule },
{ path: 'reload', loadChildren: getReloadModule },
])
],
})
export class AppRoutingModule { }

View File

@ -1,56 +0,0 @@
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { ConfigurationService } from './utils/configuration/configuration.service';
import {Observable} from 'rxjs/Observable';
@Component({
changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.Emulated,
selector: 'app',
styles: [`
`],
template: `
<navbar></navbar>
<!--div id="tm-main" class=" uk-section uk-margin-large-top tm-middle custom-main-content" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first "-->
<div class="custom-main-content" >
<main>
<router-outlet></router-outlet>
</main>
</div>
<!--/div>
</div>
</div-->
<feedback *ngIf= "isClient"></feedback>
<cookie-law *ngIf= "isClient" position="bottom">
OpenAIRE uses cookies in order to function properly.<br>
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. <a href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom *ngIf= "isClient"></bottom>
`
})
export class AppComponent {
isClient:boolean = false;
constructor(private config: ConfigurationService) {}
ngOnInit() {
if (typeof document !== 'undefined') {
try{
this.isClient = true;
}catch (e) {
}
}
}
}

View File

@ -1,38 +0,0 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SharedModule } from './shared/shared.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {SharedComponentsModule} from './sharedComponents/sharedComponents.module'; //navbar
import { ErrorModule } from './error/error.module';
import { CacheService } from './shared/cache.service';
import { ConfigurationService } from './utils/configuration/configuration.service';
import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module';
// import { XSRFStrategy, CookieXSRFStrategy, RequestOptions } from '@angular/http';
@NgModule({
declarations: [ AppComponent ],
imports: [
SharedModule,
SharedComponentsModule,
AppRoutingModule,
ErrorModule,
CookieLawModule
], exports:[],
providers:[CacheService, ConfigurationService
// { provide: XSRFStrategy, useFactory: cookieStrategy },
// { provide: RequestOptions, useClass: ExRequestOptions}
]
})
export class AppModule {
}
export { AppComponent } from './app.component';
export function cookieStrategy() {
// return new CookieXSRFStrategy('X-Csrf-Token','X-XSRF-TOKEN');
// return new CookieXSRFStrategy('lalala','lalala');
}

View File

@ -1,15 +0,0 @@
export class Claim {
id: string;
sourceType: string;
targetType: string;
sourceId: string;
targetId: string;
date: string;
DOI: string;
project: Project
userMail: string;
}
export class Project{
}

View File

@ -1,343 +0,0 @@
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router} from '@angular/router';
import {ContextsService} from './service/contexts.service';
import {ClaimContext} from './claimEntities.class';
import { StaticAutoCompleteComponent } from '../../utils/staticAutoComplete/staticAutoComplete.component';
declare var UIkit:any;
import {Session} from '../../login/utils/helper.class';
import {ErrorCodes} from '../../login/utils/guardHelper.class';
@Component({
// moduleId: module.id,
selector: 'claim-contexts-search-form',
template: `
<div class=" uk-animation uk-padding-small uk-panel uk-background-muted " >
<div>Search for Communities</div>
<table class="uk-width-1-1 uk-table uk-table-responsive" ><tr>
<tr>
<td >
<select [(ngModel)]="selectedCommunityId" (ngModelChange)="communityChanged()" class=" " name="select_funder" >
<option value="0" >Select Community:</option>
<option *ngFor="let community of communities" [value]="community.id" >{{community.label}}</option>
</select>
</td>
<td *ngIf="selectedCommunityId != '0' && categories.length > 0">
<select [(ngModel)]="selectedCategoryId" (ngModelChange)="categoryChanged()" class=" " name="select_funder" >
<option value="0" >Select Category:</option>
<option *ngFor="let category of categories" [value]="category.id" >{{category.label}}</option>
</select>
</td><td >
<static-autocomplete [(list)] = concepts [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Type keywords...'" title = "Concepts:" [multipleSelections]=true (addItem) = "select($event)" > </static-autocomplete>
</td></tr>
</table>
<div *ngIf="loading" class="uk-alert uk-alert-primary" role="alert">Loading communities information...</div>
<div *ngIf="error" class="uk-alert uk-alert-warning" role="alert">An error occured while loading communities...</div>
<div>Or <a uk-toggle="target: #browse; animation: uk-animation-fade"> Browse </a> through categories </div>
<div id="browse" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
<a uk-toggle="target: #browse; animation: uk-animation-fade" class="uk-float-right"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></a>
<div *ngIf="selectedCommunityId =='0'" class="uk-alert uk-alert-warning" >Please select community first...</div>
<ul *ngIf="selectedCommunityId !='0'" class="uk-list ">
<li>
<span (click)="displaySubcategory(selectedCommunityId)" >
<span *ngIf="!conceptsClassDisplay[selectedCommunityId]" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-down" ratio="1"><polygon points="5 7 15 7 10 12"></polygon></svg></span>
<span *ngIf="conceptsClassDisplay[selectedCommunityId]" class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-up" ratio="1"><polygon points="5 13 10 8 15 13"></polygon></svg></span>{{selectedCommunityLabel}}
</span>
<a *ngIf="!isSelected(selectedCommunityId)" (click)="addNewContext(selectedCommunityLabel,null,{'id':selectedCommunityId, 'label':selectedCommunityLabel})" class="uk-button-default uk-align-right" class="uk-icon-button uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg> </a>
<ul *ngIf="conceptsClassDisplay[selectedCommunityId]" class="uk-animation-fade" >
<li *ngFor="let category of categories" >
<span (click)="browseConcepts(category.id)" >
<span *ngIf="!conceptsClassDisplay[category.id]" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-down" ratio="1"><polygon points="5 7 15 7 10 12"></polygon></svg></span>
<span *ngIf="conceptsClassDisplay[category.id]" class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-up" ratio="1"><polygon points="5 13 10 8 15 13"></polygon></svg></span>
{{category.label}}</span><a *ngIf="!isSelected(category.id)" (click)="addNewContext(selectedCommunityLabel,category.label,{'id':category.id, 'label':category.label})" class="uk-button-default uk-align-right" class="uk-icon-button" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
<div *ngIf="conceptsCategoryLoading[category.id]" class="uk-alert uk-alert-primary" role="alert">Loading category information...</div>
<ul *ngIf="conceptsClass[category.id] && conceptsClassDisplay[category.id]" class="uk-list uk-animation-fade" id="ul_{{category.id}}" >
<li *ngFor="let concept1 of conceptsClass[category.id]" >
<span (click)="displaySubcategory(concept1.id)" >
<span *ngIf="!conceptsClassDisplay[concept1.id] && concept1.concept" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-down" ratio="1"><polygon points="5 7 15 7 10 12"></polygon></svg></span>
<span *ngIf="conceptsClassDisplay[concept1.id] && concept1.concept" class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-up" ratio="1"><polygon points="5 13 10 8 15 13"></polygon></svg></span>
{{concept1.label}}
</span>
<a *ngIf="!isSelected(concept1.id)" (click)="addNewContext(selectedCommunityLabel,category.label,concept1)" class="uk-button-default uk-align-right" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
<ul *ngIf="concept1.concept && conceptsClassDisplay[concept1.id] " class="uk-animation-fade" >
<li *ngFor="let concept2 of concept1.concept"><span (click)="displaySubcategory(concept2.id)" >
<span *ngIf="!conceptsClassDisplay[concept2.id] && concept2.concept" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-down" ratio="1"><polygon points="5 7 15 7 10 12"></polygon></svg></span>
<span *ngIf="conceptsClassDisplay[concept2.id] && concept2.concept" class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-up" ratio="1"><polygon points="5 13 10 8 15 13"></polygon></svg></span>
{{concept2.label}}</span>
<a *ngIf="!isSelected(concept2.id)" (click)="addNewContext(selectedCommunityLabel,category.label,concept2)" class="uk-button-default uk-align-right" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
<ul *ngIf="concept2.concept && conceptsClassDisplay[concept2.id] " class="uk-animation-fade" >
<li *ngFor="let concept3 of concept2.concept">{{concept3.label}}
<a *ngIf="!isSelected(concept3.id)" (click)="addNewContext(selectedCommunityLabel,category.label,concept3)" class="uk-button-default uk-align-right" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</ul>
</div>
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="uk-alert uk-alert-primary" role="alert">{{infoMessage}}</div>
</div>
`
})
export class ClaimContextSearchFormComponent {
// @Input() public inline:boolean = false ; // for claimed started from landing pages
public showComponent:boolean = true ; // for claimed started from landing pages
@Input() public selectedList;
//The following need to be kept in case we have to save the current state
@Input() public projects;
@Input() public results;
@Input() public inlineEntity;
public selectedCommunityId:string = "0";
public selectedCategoryId:string ="0";
// @Output() contextSelected = new EventEmitter();
@ViewChild (StaticAutoCompleteComponent) autocomplete : StaticAutoCompleteComponent ;
public query = '';
public filteredList = [];
public communities:any;
public selectedCommunityLabel:string = "Community:";
public categories:any;
public selectedCategoryLabel:string ="Category:";
public concepts = [];
public conceptsClass = [];
public conceptsClassDisplay = [];
public conceptsCategoryLoading = [];
public warningMessage = "";
public infoMessage = "";
public loading:boolean = false;
public error:boolean = false;
ngOnInit() {
this.getCommunities();
}
constructor(private _contextService: ContextsService,private router: Router) {
}
select($event){
var item = $event.value;
this.addNewContext( this.selectedCommunityLabel, this.selectedCategoryLabel, item);
}
isSelected(id):boolean{
for (var _i = 0; _i < this.selectedList.length; _i++) {
let item = this.selectedList[_i];
if(item.concept.id == id){
return true;
// this.warningMessage = "Concept already in selected list";
}
}
return false;
}
addNewContext(community,category,concept){
var context: ClaimContext= { community: community, category: category, concept: concept };
var found:boolean = false;
this.warningMessage = "";
if (!this.isSelected(context.concept.id)) {
this.selectedList.push(context);
UIkit.notification({
message : 'A new concept is selected.',
status : 'info',
timeout : 1000,
pos : 'top-center'
});
}else{
UIkit.notification({
message : 'The concept is already on your list.',
status : 'warning',
timeout : 1000,
pos : 'top-center'
});
}
}
getCommunities () {
if(!Session.isValidAndRemove()){
this.saveStateAndRedirectLogin();
}else{
this.loading = true;
var token=Session.getUserJwt();
this._contextService.getCommunities().subscribe(
data => {
this.communities = data.communities;
this.loading = false;
},
err => {
console.log(err);
this.loading = false;
this.error = true;
}
);
}
}
getCategories () {
this.loading = true;
this.categories=[];
if(this.selectedCommunityId != '0'){
if(!Session.isValidAndRemove()){
this.saveStateAndRedirectLogin();
}else{
var token=Session.getUserJwt();
this._contextService.getCategories(this.selectedCommunityId).subscribe(
data => {
this.categories = (Array.isArray(data.category))? data.category:[data.category];
this.concepts = [];
this.addCommunityInConcepts();
this.filteredList = [];
if (this.query !== ""){
var event = {value: ""};
event.value = this.query;
}
this.loading = false;
},
err => {
console.log(err);
this.loading = false;
}
);
}
}
}
getConcepts () {
this.loading = true;
if(this.selectedCategoryId != '0'){
if(!Session.isValidAndRemove()){
this.saveStateAndRedirectLogin();
}else{
this.concepts = [];
var token=Session.getUserJwt();
this._contextService.getConcepts(this.selectedCategoryId, "",true).subscribe(
data => {
this.concepts =data;
this.addCommunityInConcepts();
if (this.query !== ""){
var event = {value: ""};
event.value = this.query;
// this.filter(event);
}
this.loading = false;
},
err => {
console.log(err);
this.loading = false;
}
);
}
}else{
this.concepts=[];
this.loading = false;
}
}
displaySubcategory(id) {
if(this.conceptsClassDisplay[id] != null){
this.conceptsClassDisplay[id] = !this.conceptsClassDisplay[id];
}else{
this.conceptsClassDisplay[id] = true;
}
}
browseConcepts (categoryId) {
if(!Session.isValidAndRemove()){
this.saveStateAndRedirectLogin();
}else{
if(this.conceptsClass[categoryId] != null){
this.conceptsClassDisplay[categoryId] = !this.conceptsClassDisplay[categoryId];
return;
}else{
this.conceptsClassDisplay[categoryId] = true;
}
this.conceptsClass[categoryId] = [];
var token=Session.getUserJwt();
this.conceptsCategoryLoading[categoryId] = true;
this._contextService.getConcepts(categoryId, "",false).subscribe(
data => {
var concepts = (Array.isArray(data))? data:[data];
for(var i=0;i<concepts.length; i++){
console.log("Data"+concepts[i]);
if(concepts[i].id.split("::").length==3){
this.conceptsClass[categoryId].push(concepts[i]);
}
}
console.log(this.conceptsClass[categoryId]);
this.conceptsCategoryLoading[categoryId] = false;
},
err => {
console.log(err);
this.conceptsCategoryLoading[categoryId] = false;
}
);
}
}
communityChanged(){
console.log(this.selectedCommunityId +" ");
this.warningMessage = "";
this.infoMessage = "";
for(var i = 0; i< this.communities.length; i++){
if(this.communities[i].id==this.selectedCommunityId){
this.selectedCommunityLabel = this.communities[i].label;
break;
}
}
this.selectedCategoryId = "0";
this.selectedCategoryLabel="Select Category:";
this.getCategories();
}
categoryChanged(){
this.warningMessage = "";
this.infoMessage = "";
for(var i = 0; i< this.categories.length; i++){
if(this.categories[i].id==this.selectedCategoryId){
this.selectedCategoryLabel = this.categories[i].label;
break;
}
}
this.getConcepts();
}
addCommunityInConcepts(){
this.concepts.push({"id":this.selectedCommunityId, "label":this.selectedCommunityLabel});
this.autocomplete.updateList(this.concepts);
}
saveStateAndRedirectLogin(){
if(this.projects != null){
localStorage.setItem("projects", JSON.stringify(this.projects));
}
localStorage.setItem("contexts", JSON.stringify(this.selectedList));
if(this.results != null){
localStorage.setItem("results", JSON.stringify(this.results));
}
if(this.inlineEntity != null){
localStorage.setItem("inlineEntity", JSON.stringify(this.inlineEntity));
}
this.router.navigate(['/user-info'], { queryParams: { "errorCode": ErrorCodes.NOT_VALID, "redirectUrl": this.router.url } });
}
}

View File

@ -1,20 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { ClaimContextSearchFormComponent } from './claimContextSearchForm.component';
import{ContextsServiceModule} from './service/contextsService.module';
import {StaticAutocompleteModule} from '../../utils/staticAutoComplete/staticAutoComplete.module';
import { RouterModule } from '@angular/router';
@NgModule({
imports: [
SharedModule,RouterModule,
ContextsServiceModule,
StaticAutocompleteModule
],
declarations: [
ClaimContextSearchFormComponent
], exports: [ClaimContextSearchFormComponent ]
})
export class ClaimContextSearchFormModule { }

View File

@ -1,100 +0,0 @@
//Classes used in linking / inlinelinking when selecting an entity
export class ClaimResult{
public id: string;
public type: string;
public source: string;
public title: string;
public url: string;
public result: any;
public accessRights: string = "OPEN";
public embargoEndDate: string;
public date: string;
public authors: string[] =[];
public publisher: string;
public description: string;
public resourceType:string;
public static generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
var result: ClaimResult = new ClaimResult();
result.id = itemId;
result.type = itemType;
result.source = itemSource;
result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle;
result.url = itemUrl;
result.accessRights = 'OPEN';
result.date = date;
result.result = item;
if(item.publisher){
result.publisher = item.publisher;
}
if(itemSource == 'datacite'){
result.publisher = item.attributes['container-title'];
if(item.attributes.author){
result.authors =[]
for(var i=0; i< item.attributes.author.length; i++){
result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal);
}
}
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
}else if (itemSource == 'openaire'){
//TODO put right access rights
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date};
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date};
result.embargoEndDate = accessmode;
}else if(itemSource == 'crossref'){
date = (date == null) ? null : date.substring(0,10);
result.date = date;
result.resourceType = item.type;
result.description = item.abstract;
if(item.author){
result.authors =[]
for(var i=0; i< item.author.length; i++){
result.authors.push(item.author[i].family +" "+ item.author[i].given );
}
}
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
}else if (itemSource == 'orcid'){
date = (date == null) ? null : date + "-01.-01"
result.date = date;
if(item['work-type']){
result.resourceType = item.type;
}
if(item.contributors){
result.authors =[]
for(var i=0; i< item.contributors.length; i++){
result.authors.push(item.contributors[i]);
}
}
}
return result;
}
}
export class ClaimProject{
public funderId: string;
public funderName: string;
public projectId: string;
public projectName: string;
public projectAcronym: string;
public startDate: string;
public endDate: string;
public code: string;
public jurisdiction: string;
public fundingLevel0: string;
}
export class ClaimContext{
public community: string;
public category: string;
public concept:any;
}

View File

@ -1,194 +0,0 @@
import {Component, Input,Output, ElementRef, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {ProjectService} from '../../landingPages/project/project.service';
// import {ModalLoading} from '../../utils/modal/loading.component';
import { Subject } from 'rxjs/Subject';
import {ClaimProject} from './claimEntities.class';
declare var UIkit:any;
@Component({
selector: 'claim-projects-search-form',
// styleUrls: ['/autoComplete.component.css'],
template: `
<div>
<form class=" uk-animation uk-padding-small uk-panel uk-background-muted " >
<table class="uk-width-1-1 uk-table uk-table-responsive" ><tr>
<td >
Search for projects
</td></tr>
<tr><td >
<select class="" [(ngModel)]="selectedFunderId" name="select_funder" >
<option value="0" (click)="funderChanged('0','Select funder:')">Select funder:</option>
<option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{funder.name}}</option>
</select></td><td >
<entities-autocomplete entityType="project" [funderId]="selectedFunderId" [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Type Keywords..'" title = "Projects:" [multipleSelections]=true (addItem) = "select($event)" ></entities-autocomplete>
</td></tr></table>
</form>
<!--modal-loading [message]= "'Loading...'"></modal-loading-->
<!--div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="infoMessage.length > 0" class="alert alert-info" role="alert">{{infoMessage}}</div-->
</div>
`
})
export class ClaimProjectsSearchFormComponent {
ngOnInit() {
this.getFunders();
}
// @ViewChild (ModalLoading) loading : ModalLoading ;
// @Input() public inline: boolean = false ; // for claimed started from landing pages
public query = '';
@Input() public selectedProjects=[] ;
public elementRef;
public funders:string[];
public selectedFunderId:string ="0";
selectedFunderName:string ="Select funder:";
@Output() projectSelected = new EventEmitter();
public projects:string[];
public warningMessage = "";
public infoMessage = "";
// public searchTermStream = new Subject<string>();
// filtered: Observable<{}> = this.searchTermStream
// .debounceTime(300).distinctUntilChanged()
// .switchMap((term: string) => this._projectService.searchForProjectsObs(term, this.selectedFunderId));
public tries:number = 0 ;
public keywordlimit = 3;
constructor(private _service: ProjectService, private _projectService: SearchProjectsService, myElement: ElementRef) {
this.elementRef = myElement;
}
// search() {
// console.info("heeere "+this.query );
// this.infoMessage = "";
// // this.filtered = [];
// if(this.query == ""){
// this.tries = 0;
// this.warningMessage = "";
// } else if(this.query && this.query.length < this.keywordlimit){
// this.tries++;
// if(this.tries == this.keywordlimit -1 ){
// this.warningMessage = "Type at least " + this.keywordlimit + " characters";
// this.tries = 0;
// }
// }else{
// console.info("doo the search "+this.query );
//
// this.tries = 0;
// this.warningMessage = "";
// this.searchTermStream.next(this.query);
//
// }
//
// }
select(item){
this.query = "";
// this.searchTermStream.next(this.query); //clear
item = item.value;
var project: ClaimProject = new ClaimProject();
project.funderId = (this.selectedFunderId=="0")?item.funderId:this.selectedFunderId;
project.funderName = (this.selectedFunderId=="0")?item.funderName:this.selectedFunderName;
project.projectId = item.id;
project.projectName = item.projectName;
project.projectAcronym = item.projectAcronym;
project.startDate = item.startDate;
project.endDate = item.endDate;
project.code = item.code;
project.jurisdiction = item.jurisdiction;
project.fundingLevel0 = item.fundingLevel0;
console.log(item);
// this._service.getProjectDates(project.projectId).subscribe(
// data => {
// project.startDate = data.startDate;
// project.endDate = data.endDate;
// },
// err => console.log(err)
// );
var index:number =this.selectedProjects.indexOf(project);
var found:boolean = false;
this.warningMessage = "";
for (var _i = 0; _i < this.selectedProjects.length; _i++) {
let item = this.selectedProjects[_i];
if(item.projectId == project.projectId){
found=true;
this.warningMessage = "Project already in selected list";
}
}
if (!found) {
this.selectedProjects.push(project);
this.projectSelected.emit({
value: true
});
UIkit.notification({
message : 'A new project is selected.',
status : 'info',
timeout : 1000,
pos : 'top-center'
});
}else{
UIkit.notification({
message : 'The project is already on your list.',
status : 'warning',
timeout : 1000,
pos : 'top-center'
});
}
}
showItem(item):string{
return ((item.field[1]['@value'])?item.field[1]['@value']+" - ":"" ) + item.field[3]['@value'];
}
remove(item){
var index:number =this.selectedProjects.indexOf(item);
if (index > -1) {
this.selectedProjects.splice(index, 1);
}
}
handleClick(event){
var clickedComponent = event.target;
var inside = false;
do {
if (clickedComponent === this.elementRef.nativeElement) {
inside = true;
}
clickedComponent = clickedComponent.parentNode;
} while (clickedComponent);
}
getFunders () {
console.info("Getting Funders....");
this._projectService.getFunders().subscribe(
data => {
this.funders = data[1];
console.log("this.funders");
},
err => console.log(err)
);
}
getProjects () {
if(this.selectedFunderId != '0'){
}
}
funderChanged(funderId:string, funderName:string){
this.selectedFunderId = funderId;
this.selectedFunderName = funderName;
console.info("Selected funder:"+this.selectedFunderId+ ' name:'+funderName );
}
}

View File

@ -1,27 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import {ClaimProjectsSearchFormComponent} from './claimProjectSearchForm.component';
// import {LoadingModalModule} from '../../utils/modal/loadingModal.module';
import {ProjectServiceModule} from '../../landingPages/project/projectService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {EntitiesAutocompleteModule} from '../../utils/entitiesAutoComplete/entitiesAutoComplete.module';
@NgModule({
imports: [
SharedModule, CommonModule,
// LoadingModalModule,
ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule
],
providers:[
],
declarations: [
ClaimProjectsSearchFormComponent
],
exports: [ClaimProjectsSearchFormComponent ]
})
export class ClaimProjectsSearchFormModule { }

View File

@ -1,188 +0,0 @@
<form class=" uk-panel uk-padding uk-padding-remove-top uk-background-muted uk-animation">
<div>Search for research results</div>
<select [(ngModel)]="searchSource" name="select_source" (ngModelChange)="searchSourceChanged(searchSource)" class="uk-select uk-width-1-4">
<option value="openaire">in OpenAIRE </option>
<option value="crossref">in Crossref </option>
<option value="datacite">in Datacite </option>
<option value="orcid">in ORCID </option>
<option value="all">Search all</option>
</select>
<input class=" uk-input uk-width-1-2 form-control" [(ngModel)]="keyword" name="keyword" placeholder="Type keywords..."/>
<span class="input-group-btn">
<button (click)="search(false)" type="submit" class=" uk-button uk-button-default">Search</button>
</span>
</form>
<div *ngIf="showSearchResults" class="uk-margin-top uk-animation">
<ul class="uk-tab" uk-tab="animation: uk-animation-fade">
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openairePub')" ><a>Publications <span class="uk-badge uk-badge-notification">{{ (openairePubsNum)?openairePubsNum:0 }}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openaireData')" ><a>Research Data <span class="uk-badge uk-badge-notification">{{(openaireDataNum==null)?'0':openaireDataNum}}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'crossref'" (click)="clickTab('crossref')" ><a>Crossref <span class="uk-badge uk-badge-notification">{{(crossrefResultsNum)?crossrefResultsNum:0}}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'datacite'" (click)="clickTab('datacite')"><a>Datacite <span class="uk-badge uk-badge-notification">{{(dataciteResultsNum==null)?'0':dataciteResultsNum}}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'orcid'" (click)="clickTab('orcid')"><a>Orcid <span class="uk-badge uk-badge-notification">{{(orcidResultsNum)?orcidResultsNum:0}}</span></a></li>
</ul>
<div *ngIf="activeTab == 'crossref'" id="crossref" >
<div class="uk-margin-top" >
<div *ngIf="crossrefStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="crossrefStatus != errorCodes.LOADING && crossrefResults.length == 0" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
<div *ngIf="crossrefStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="crossrefStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="crossrefPage" [totalResults]="crossrefResultsNum" [term]="keyword" [size]="size" (pageChange)="crossrefPageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="crossrefResults.length > 0 " class="uk-list uk-list-divider">
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'uk-block-muted':''">
<div >
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" > <span class="custom-external"></span> {{item.title}}</a>
<span *ngIf="!item.URL" >{{item.title}}</span>
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title, item.created['date-time'],'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
</div>
<span *ngIf="item.publisher" class="uk-article-meta">Publisher: {{item.publisher}}</span><span class="uk-article-meta" *ngIf="(item['published-print'] && item['published-print']['date-parts'] && item['published-print']['date-parts'][0])">({{(item['published-print']['date-parts'][0][0])?item['published-print']['date-parts'][0][0]:item['published-print']['date-parts'][0]}})</span>
<div *ngIf="item.author && item.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of item.author.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (item.author.slice(0,10).length-1))?"; ":""}}{{(i == item.author.slice(0,10).length-1 && item.author.length > 10)?"...":""}}</span></div>
<div *ngIf="item.editor && item.editor.length > 0" class="uk-article-meta">Editors: <span *ngFor="let author of item.editor.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (item.editor.slice(0,10).length-1))?"; ":""}}{{(i == item.editor.slice(0,10).length-1 && item.editor.length > 10)?"...":""}}</span></div>
</li>
</ul>
</div>
</div>
</div>
<div *ngIf="activeTab == 'openairePub'" id="openairePubs" class="uk-animation-fade" >
<div class = "uk-margin-top">
<div *ngIf="openairePubsStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="openairePubsStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
<div *ngIf="openairePubsStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="openairePubsStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="openairePubsNum != null && openairePubsNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="openairePubsPage" [totalResults]="openairePubsNum" [term]="keyword" [size]="size" (pageChange)="openairePubsPageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="openairePubs.length > 0 " class="uk-list uk-list-divider">
<li *ngFor=" let result of openairePubs " [class]="(isSelected(result.id))?'uk-block-muted':''">
<div >
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
<a *ngIf="!isSelected(result.id)" (click)="add(result, result.id, 'openaire', 'publication', result['title'].url, result['title'].name, result.year,result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
</div>
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span class="uk-article-meta" *ngIf="(result.year)">({{result.year}})</span>
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
</li>
</ul>
</div>
</div>
</div>
<div *ngIf="activeTab == 'orcid'" id="orcid" class="uk-animation-fade">
<div class="uk-margin-top" >
<div *ngIf="orcidStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="orcidStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="orcidStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="orcidStatus == errorCodes.NONE && (!authorIds ||authorIds.length == 0)" class = "uk-alert uk-alert-primary " > No results found </div>
<div *ngIf="orcidResultsNum != null" class="panel-body">
<span>Results for
<a target="_blank" href="http://orcid.org/{{authorId}}"> <span class="custom-external"></span> {{authorGivenName}} {{authorFamilyName}} - {{authorId}} </a> :
</span>
<div class = "uk-alert uk-alert-warning " > Not the author you are looking for?
<span class="dropdown">
<select [(ngModel)]="selectAuthorId" name="select_author" (ngModelChange)="getOrcidResultsById(selectAuthorId)" >
<option [value]="0">Choose another one: </option>
<option *ngFor=" let item of authorIds let i = index" [value]="authorIds[i]">{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </option>
</select>
</span>
</div>
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="uk-list uk-list-divider">
<li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+'-'+item['put-code']))?'uk-block-muted':''">
<div>
<span *ngIf="!item.URL" >{{item['work-title']['title'].value}}</span>
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(authorId+item['put-code'])" (click)="add(item,authorId+'-'+item['put-code'],'orcid', 'publication', '', item['work-title']['title'].value, item['publication-date']?item['publication-date'].year.value :null,'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
</div>
<span *ngIf="item['journal-title'] && item['journal-title'].value " class="uk-article-meta">Journal: {{item['journal-title'].value}}</span><span class="uk-article-meta" *ngIf="(item['publication-date']&&item['publication-date'].year&&item['publication-date'].year.value)"> ({{item['publication-date'].year.value}})</span>
<div *ngIf="item.contributors && item.contributors.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of item.contributors.slice(0,10) let i = index">{{author}}{{(i < (item.contributors.slice(0,10).length-1))?"; ":""}}{{(i == item.contributors.slice(0,10).length-1 && item.contributors.length > 10)?"...":""}}</span></div>
</li>
</ul>
<div *ngIf="orcidResultsNum == 0" class = "uk-alert uk-alert-primary " > No results found </div>
</div>
</div>
</div>
</div>
<div *ngIf="activeTab == 'datacite'" id="datacite" class="uk-animation-fade">
<div *ngIf="dataciteStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="dataciteStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
<div *ngIf="dataciteStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="dataciteStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div class = "uk-margin-top">
<div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="datacitePage" [totalResults]="dataciteResultsNum" [term]="keyword" [size]="size" (pageChange)="datacitePageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="dataciteResults.length > 0 " class="uk-list uk-list-divider">
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.attributes.doi))?'uk-block-muted':''" >
<div >
<a *ngIf="item.attributes.doi" target="_blank" href="{{'http://dx.doi.org/'+item.attributes.doi}}" > <span class="custom-external"></span> {{item.attributes.title}}</a>
<span *ngIf="!item.attributes.doi" >{{item.attributes.title}}</span>
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(item.attributes.doi)" (click)="add(item, item.attributes.doi,'datacite','dataset', 'http://dx.doi.org/'+item.attributes.doi, item.attributes.title, item.attributes.published,'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
</div>
<span *ngIf="item.attributes['container-title']" class="uk-article-meta">Publisher: {{item.attributes['container-title']}}</span><span *ngIf="(item.attributes.published)" class="uk-article-meta">({{item.attributes.published}})</span>
<div *ngIf="item.attributes.author && item.attributes.author.length > 0" class="uk-article-meta">Authors:
<span *ngFor="let author of item.attributes.author.slice(0,10) let i = index">{{(author.family)?author.family+', '+author.given:author.literal}}{{(i < (item.attributes.author.slice(0,10).length-1))?"; ":""}}{{(i == item.attributes.author.slice(0,10).length-1 && item.attributes.author.length > 10)?"...":""}}</span></div>
</li>
</ul>
</div>
</div>
</div>
<div *ngIf="activeTab == 'openaireData'" id="openaireData" class="uk-animation-fade">
<div *ngIf="openaireDataStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="openaireDataStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
<div *ngIf="openaireDataStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="openaireDataStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div class = "uk-margin-top">
<div *ngIf="openaireDataNum != null && openaireDataNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="openaireDataPage" [totalResults]="openaireDataNum" [term]="keyword" [size]="size" (pageChange)="openaireDataPageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="openaireData.length > 0 " class="uk-list uk-list-divider">
<li *ngFor=" let result of openaireData " [class]="(isSelected(result.id))?'uk-block-muted':''">
<div >
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
(click)="add(result, result.id, 'openaire','dataset', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
</div>
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span>
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
</li>
</ul>
</div>
</div>
</div>
</div>

View File

@ -1,587 +0,0 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {SearchCrossrefService} from '../claim-utils/service/searchCrossref.service';
import {SearchOrcidService} from '../claim-utils/service/searchOrcid.service';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import { SearchDataciteService } from '../claim-utils/service/searchDatacite.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {ClaimResult} from '../claim-utils/claimEntities.class';
import{DOI} from '../../utils/string-utils.class';
declare var UIkit:any;
@Component({
selector: 'claim-result-search-form',
templateUrl: 'claimResultSearchForm.component.html',
})
export class ClaimResultSearchFormComponent {
constructor (private _searchDataciteService: SearchDataciteService, private _searchDatasetsService:SearchDatasetsService,
private _searchCrossrefService: SearchCrossrefService,private _searchOrcidService: SearchOrcidService, private _searchPublicationsService: SearchPublicationsService,
private route: ActivatedRoute) {
var myDate = new Date();
this.todayDate = myDate.getFullYear()+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate = (myDate.getFullYear()+100)+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
}
ngOnInit() {
if(this.keyword !=null && this.keyword.length > 0){
this.search(false);
}
}
page : number = 1;
size:number = 5;
navigateTo: string = "Search";
source: string = "datacite";
type : string = "dataset";
showSearchResults:boolean=false;
// searchType ="publication";
@Input() public select:boolean = true ;
@Input() public keyword:string = '';
@Input() public selectedResults:ClaimResult[];
// @Output() datasetsChange = new EventEmitter();
// @Output() publicationsChange = new EventEmitter();
// @Output() resultsChange = new EventEmitter();
public errorCodes:ErrorCodes = new ErrorCodes();
dataciteResults=[];
dataciteResultsNum:number = null;
// dataciteResultsNum : Observable<number> = null;
dataciteStatus = this.errorCodes.NONE;
datacitePage : number = 1;
openaireData=[];
openaireDataNum:number = 0 ;
openaireDataStatus = this.errorCodes.NONE;
openaireDataPage : number = 1;
public warningMessage = "";
public infoMessage = "";
public todayDate = '';
public nextDate = '';
public DOIs:string[] = [];
sub: any;
public searchSource:string = "openaire"
public activeTab:string = "openairePub"
crossrefResults=[];
crossrefResultsNum : number = null;
crossrefPage : number = 1;
crossrefStatus:number = this.errorCodes.NONE;
openairePubs = [];
openairePubsNum: number ;
openairePubsPage : number = 1;
openairePubsStatus:number = this.errorCodes.NONE;
orcidResults: string[];
orcidResultsNum: number ;
totalPages: number;
orcidResultsToShow: string[];
orcidPage : number = 1;
orcidStatus:number = this.errorCodes.NONE;
authorId: string;
selectAuthorId: string = "0";
authorGivenName: string;
authorFamilyName: string;
authorIds: string[];
authorGivenNames: string[];
authorFamilyNames: string[];
authorsNum : number ;
reloadOpenaire:boolean = true;
reloadCrossref:boolean = false;
reloadDatacite:boolean = false;
reloadOrcid:boolean = false;
search(sourceChanged){
this.warningMessage = "";
this.infoMessage = "";
if(!sourceChanged){
this.DOIs = DOI.getDOIsFromString(this.keyword);
this.reloadOpenaire = true;
this.reloadCrossref = true;
this.reloadDatacite = true;
this.reloadOrcid = true;
}
if((this.searchSource == "all" || this.searchSource == "openaire") && this.reloadOpenaire){
this.searchOpenairePubs(this.keyword, this.size, 1);
this.searchOpenaireData(this.keyword,this.size,1);
this.reloadOpenaire = false;
}
if((this.searchSource == "all" || this.searchSource == "crossref")&&this.reloadCrossref){
this.getCrossrefResults(this.keyword, this.size,1);
this.reloadCrossref = false;
}
if((this.searchSource == "all" || this.searchSource == "datacite")&& this.reloadDatacite){
this.searchDatacite(this.keyword,this.size,1);
this.reloadDatacite = false;
}
if((this.searchSource == "all" || this.searchSource == "orcid")&& this.reloadOrcid){
this.searchOrcid(this.keyword);
this.reloadOrcid = false;
}
this.showSearchResults = true;
}
private getCrossrefResults (term: string, size : number, page : number) {
this.crossrefStatus = this.errorCodes.LOADING;
if( this.DOIs.length > 0 ){
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs).subscribe(
data => {
if(data != null) {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
if(data.items == 0){
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
data => {
if(data != null) {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
this.crossrefStatus = this.errorCodes.DONE;
}else{
this.crossrefStatus = this.errorCodes.ERROR;
}
},
err =>{
console.log(err.status);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
}else{
this.crossrefStatus = this.errorCodes.DONE;
}
}
},
err => {
//console.log(err);
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
data => {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
this.crossrefStatus = this.errorCodes.DONE;
},
err => {
console.log(err.status);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
}
);
}else{
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
data => {
if(data != null) {
this.crossrefResults = data.items;
this.crossrefPage=page;
this.crossrefResultsNum = data['total-results'];
this.crossrefStatus = this.errorCodes.DONE;
}else{
this.crossrefStatus = this.errorCodes.ERROR;
}
},
err => {
console.log(err.status);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
}
}
private searchOpenairePubs(term: string, size : number, page : number) {
if(this.DOIs.length > 0 ){
this.openairePubsStatus = this.errorCodes.LOADING;
this._searchPublicationsService.searchPublicationsByDois(this.DOIs, null, page, size, []).subscribe(
data => {
if(data != null) {
this.openairePubsPage=page;
this.openairePubsNum = data[0];
this.openairePubs = data[1];
this.openairePubsStatus = this.errorCodes.DONE;
if(this.openairePubsNum == 0){
this.openairePubsStatus = this.errorCodes.NONE;
}
}else {
this.openairePubsStatus = this.errorCodes.ERROR;
}
},
err => {
this.openairePubsStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}else{
this.openairePubsStatus = this.errorCodes.LOADING;
this._searchPublicationsService.searchPublications('q='+term, null, page, size, []).subscribe(
data => {
if(data != null) {
this.openairePubsPage=page;
this.openairePubsNum = data[0];
this.openairePubs = data[1];
this.openairePubsStatus = this.errorCodes.DONE;
if(this.openairePubsNum == 0){
this.openairePubsStatus = this.errorCodes.NONE;
}
}else {
this.openairePubsStatus = this.errorCodes.ERROR;
}
},
err => {
this.openairePubsStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}
}
private searchOrcid (term: string) {
if(this.DOIs.length > 0){
this.orcidStatus = this.errorCodes.NONE;
return;
}
this.orcidStatus = this.errorCodes.LOADING;
this.authorIds = new Array<string>();
this.authorGivenNames = new Array<string>();
this.authorFamilyNames = new Array<string>();
this.getOrcidAuthor(term);
console.info('searchOrcid in searchOrcid file');
}
private readData(data: any) {
this.authorIds.push(data[2].path);
if(data[0] != null) {
this.authorGivenNames.push(data[0].value);
} else {
this.authorGivenNames.push("");
}
if(data[1] != null) {
this.authorFamilyNames.push(data[1].value);
} else {
this.authorFamilyNames.push("");
}
}
private getOrcidAuthor (term: string) {
this.orcidResultsNum = null;
//passing structures in order to fill them in service
this._searchOrcidService.searchOrcidAuthor(term, this.authorIds,
this.authorGivenNames, this.authorFamilyNames).subscribe(
data => {
if(data != null && data == true) {
this.getOrcidResultsByIndex(0);
}
this.orcidStatus = this.errorCodes.NONE;
},
err => this.errorHandler(err, term)
);
}
private errorHandler(err: any, term: string) {
if(err.status == 404){
this.getOrcidAuthors(term);
} else {
this.orcidStatus = this.errorCodes.ERROR;
console.log(err.status);
}
}
private getOrcidAuthors (term: string) {
this.orcidResultsNum = null;
this.selectAuthorId = "0";
this.orcidStatus = this.errorCodes.LOADING;
//passing structures in order to fill them in service
this._searchOrcidService.searchOrcidAuthors(term, this.authorIds,
this.authorGivenNames, this.authorFamilyNames).subscribe(
data => {
if(data != null && data == true) {
this.getOrcidResultsByIndex(0);
}else{
this.orcidStatus = this.errorCodes.ERROR;
}
},
err => {
this.orcidStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}
private getOrcidResultsByIndex (index:number) {
if(this.authorIds.length > index) {
this.orcidStatus = this.errorCodes.LOADING;
let id = this.authorIds[index];
this.authorGivenName = this.authorGivenNames[index];
this.authorFamilyName = this.authorFamilyNames[index];
this.getOrcidResultsById(id);
}
}
private getOrcidResultsById (id:string) {
if(id=="0"){
return;
}
var index = this.authorIds.indexOf(id);
this.authorGivenName = this.authorGivenNames[index];
this.authorFamilyName = this.authorFamilyNames[index];
this.authorId = id;
console.info("getOrcidResultsById: "+id);
this.orcidStatus = this.errorCodes.LOADING;
this._searchOrcidService.searchOrcidPublications(id).subscribe(
data => {
if(data != null) {
this.orcidResults=data['orcid-work'];
this.orcidResultsNum = data['orcid-work'].length;
this.orcidPage = 1;
if((this.orcidResultsNum % this.size) == 0){
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size));
} else{
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size+1));
}
this.orcidResultsToShow = this.orcidResults.slice(0,10);
this.orcidStatus = this.errorCodes.DONE;
if(this.orcidResultsNum == 0){
this.orcidStatus = this.errorCodes.NONE;
}
} else {
this.orcidResultsNum = 0;
this.totalPages=0;
this.orcidStatus = this.errorCodes.NONE;
}
},
err => {
console.log(err.status);
this.orcidStatus = this.errorCodes.ERROR;
}
);
}
/*
Is it USED???
private remove(item){
this.warningMessage = "";
this.infoMessage = "";
var index:number =this.selectedResults.indexOf(item);
item.selected=false;
if (index > -1) {
this.selectedResults.splice(index, 1);
// this.publicationsChange.emit({
// value: this.selectedResults
// });
}
}*/
private crossrefPageChange($event) {
this.crossrefPage=$event.value;
this.crossrefResults=[];
console.log("Crossref chaenged "+this.crossrefPage);
this.getCrossrefResults(this.keyword,this.size,this.crossrefPage);
}
private orcidPageChange($event) {
this.orcidPage=$event.value;
this.orcidResultsToShow=[];
this.orcidResultsToShow = this.orcidResults.slice(($event.value-1)*this.size, $event.value*this.size);
}
private openairePubsPageChange($event) {
this.openairePubsPage=$event.value;
this.searchOpenairePubs(this.keyword,this.size,this.openairePubsPage);
}
datacitePageChange($event) {
this.datacitePage=$event.value;
this.dataciteResults=[];
this.searchDatacite(this.keyword,10,this.datacitePage);
this.warningMessage = "";
this.infoMessage = "";
}
openaireDataPageChange($event) {
this.openaireDataPage=$event.value;
this.openaireData=[];
this.searchOpenaireData(this.keyword,10,this.openaireDataPage);
this.warningMessage = "";
this.infoMessage = "";
}
private isSelected(id:string){
var found:boolean = false;
this.warningMessage = "";
for (var _i = 0; _i < this.selectedResults.length; _i++) {
let item = this.selectedResults[_i];
if(item.id == id){
found=true;
this.warningMessage = "Publication already in selected list";
}
}
return found;
}
// isSelected(id:string){
//
// var found:boolean = false;
// this.warningMessage = "";
// for (var _i = 0; _i < this.selectedResults.length; _i++) {
// let item = this.selectedResults[_i];
// if(item.id == id){
// found=true;
// break;
// }
// }
// return found;
// }
private searchDatacite (term: string, size : number, page : number) {
this.getDataciteResults(term,size,page);
this.warningMessage = "";
this.infoMessage = "";
}
private searchOpenaireData (term: string, size : number, page : number) {
if(this.DOIs.length > 0 ){
this.openaireDataStatus = this.errorCodes.LOADING;
this._searchDatasetsService.searchDatasetsByDois(this.DOIs, null, page, size, []).subscribe(
data => {
if(data != null) {
this.openaireDataPage=page;
this.openaireDataNum = data[0];
this.openaireData = data[1];
this.openaireDataStatus = this.errorCodes.DONE;
if(this.openaireDataNum == 0){
this.openaireDataStatus = this.errorCodes.NONE;
}
}
},
err => {
this.openaireDataStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}else{
this._searchDatasetsService.searchDatasets('q='+term+'', null, page, size, []).subscribe(
data => {
if(data != null) {
this.openaireDataPage=page;
this.openaireDataNum = data[0];
this.openaireData = data[1];
this.openaireDataStatus = this.errorCodes.DONE;
if(this.openaireDataNum == 0){
this.openaireDataStatus = this.errorCodes.NONE;
}
}
},
err => {
this.openaireDataStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}
this.warningMessage = "";
this.infoMessage = "";
}
private getDataciteResults (term: string, size : number, page : number) {
this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
data => {
this.dataciteResults = data.data;
this.datacitePage=page;
this.dataciteResultsNum = data.meta.total;
this.dataciteStatus = this.errorCodes.DONE;
},
err => {
this.dataciteStatus = this.errorCodes.ERROR;
console.log(err);
}
);
}
add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle);
var result: ClaimResult = ClaimResult.generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode);
if (itemSource == 'orcid'){
if(result.authors.length ==0 ){
result.authors.push(this.authorGivenName + ', '+ this.authorFamilyName);
}
}
var found:boolean = this.isSelected( result.id);
this.warningMessage = "";
if (!found) {
this.selectedResults.push(result);
UIkit.notification({
message : 'A new research result is selected.',
status : 'info',
timeout : 1000,
pos : 'top-center'
});
}else{
this.warningMessage = "Research Data already in selected list";
UIkit.notification({
message : 'The research result is already on your list.',
status : 'warning',
timeout : 1000,
pos : 'top-center'
});
}
}
public searchSourceChanged(source){
this.searchSource = source;
this.activeTab = (source == "openaire" || source == "all")?"openairePub":source;
if(this.keyword && this.keyword.length > 0){
this.search(true);
}
}
public clickTab(tab){
this.activeTab = tab;
}
}

View File

@ -1,29 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component';
import {SearchDataciteServiceModule} from './service/searchDataciteService.module';
import {SearchCrossrefServiceModule} from './service/searchCrossrefService.module';
import {SearchOrcidService} from './service/searchOrcid.service';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {PagingModule } from '../../utils/paging.module';
@NgModule({
imports: [
SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule, SearchDataciteServiceModule
],
providers:[
SearchOrcidService
],
declarations: [
ClaimResultSearchFormComponent
],
exports: [ClaimResultSearchFormComponent ]
})
export class ClaimResultSearchFormModule { }

View File

@ -1,110 +0,0 @@
<div class="uk-width-1-1">
<helper position="top"></helper>
</div>
<div class="uk-grid helper-grid">
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
<div class="uk-width-expand">
<form class="">
<div class="-row">
<span class="uk-text-bold">Filter By:</span>
<input type="text" class=" uk-input form-control" placeholder="Search for keywords in titles ..." aria-describedby="sizing-addon2" [(ngModel)]="inputkeyword" (keyup)="changekeyword()" name="claims-keyword" ></div>
<div class="uk-margin-small-top">
<label> <input [(ngModel)]="projectCB" type="checkbox" (ngModelChange)="changeType()" name="project" />
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="5" y="2" width="10" height="1"></rect><rect x="3" y="4" width="14" height="1"></rect><rect fill="none" stroke="#000" x="1.5" y="6.5" width="17" height="11"></rect></svg></span>
Project </label>
<label> <input [(ngModel)]="publicationCB" type="checkbox" (ngModelChange)="changeType()" name="publication" />
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect fill="none" stroke="#000" x="3.5" y="2.5" width="12" height="16"></rect><polyline fill="none" stroke="#000" points="5 0.5 17.5 0.5 17.5 17"></polyline></svg></span>
Publication </label>
<label> <input [(ngModel)]="datasetCB" type="checkbox" (ngModelChange)="changeType()" name="dataset" />
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span>
Research Data </label>
<label> <input [(ngModel)]="contextCB" type="checkbox" (ngModelChange)="changeType()" name="context" />
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg></span>
Context </label>
</div>
</form>
<div class="searchPaging uk-panel uk-margin-top" data-uk-grid-margin="">
<div *ngIf="resultsNum" class="uk-float-right">
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<div *ngIf="resultsNum>0" class="uk-width-1-2">
<span > Show
<select *ngIf="resultsNum>10" class="uk-width-1-2 uk-select" [(ngModel)]="size" name="select_size" (ngModelChange)="changeSize(size)" >
<option *ngFor="let size of sizes" [value]="size">{{size}}</option>
</select>
</span>
<span >Showing {{(size*page - size +1)}} to {{(size*page>resultsNum)?resultsNum:(size*page)}} of {{resultsNum}} claims </span>
</div>
</div>
<div *ngIf="showErrorMessage " class = "uk-alert uk-alert-danger " >
An Error occured.
</div>
<div *ngIf="showForbiddenMessage " class = "uk-alert uk-alert-danger " >
You are not allowed to access this page.
</div>
<div *ngIf="userValidMessage.length > 0 " class = "uk-alert uk-alert-danger " >
User session is not valid. Please login again.
</div>
<!-- Buttons for selecting and Delete Claims -->
<div *ngIf="enableDelete">
<div *ngIf="selected.length>0 && resultsNum > 0 ">
<div class = "uk-alert uk-alert-primary " >
You have selected {{selected.length}} claim(s)
</div>
</div>
<div *ngIf="deleteMessage.length>0 " [innerHTML]="deleteMessage">
</div>
<button class=" uk-button uk-button-default" (click)="confirmOpen()"> <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="trash" ratio="1"><polyline fill="none" stroke="#000" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline><polyline fill="none" stroke="#000" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline><rect x="8" y="7" width="1" height="9"></rect><rect x="11" y="7" width="1" height="9"></rect><rect x="2" y="3" width="16" height="1"></rect></svg></span> Delete</button>
</div>
<br>
<div *ngIf=" claims && claims.length == 0" >
<div class = "uk-alert uk-alert-primary " >No entries found.</div>
</div>
<div class="">
<table *ngIf="claims && claims.length > 0" class="uk-table uk-table-striped">
<thead>
<tr>
<th *ngIf="enableDelete"><input id="checkAll" type="checkbox" (click)="selectAll($event)" [ngModel]="selected.length==claims.length" /></th>
<!--<th>Id</th>
<!-- <th>Target Type</th> -->
<th><a (click)="changeOrderby('target')" >Research Result</a> </th>
<!--<th>Source type</th> -->
<th><a (click)="changeOrderby('source')" >Link to</a> </th>
<th *ngIf="showUserEmail"><a (click)="changeOrderby('user')" >Claimed by</a> </th>
<th><a (click)="changeOrderby('date')"> Claimed Date</a></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let claim of claims " >
<td *ngIf="enableDelete"><input [id]="claim.id" type="checkbox" (click)="select(claim,$event)" [ngModel]="isSelected(claim.id)"/></td>
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td>
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td>
<td *ngIf="showUserEmail">{{claim.userMail}}</td>
<td>{{claim.date}}</td>
</tr>
</tbody>
</table>
</div>
<helper position="right" styleName=" uk-width-1-5"></helper>
</div>
<helper position="bottom"></helper>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
<modal-loading [message]= "'Please wait...'"></modal-loading>

View File

@ -1,486 +0,0 @@
import {Component, ViewChild, Input} from '@angular/core';
import {Location} from '@angular/common';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {ClaimsService} from '../service/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert';
import {Session} from '../../../login/utils/helper.class';
@Component({
selector: 'displayClaims',
templateUrl: 'displayClaims.component.html',
providers:[ ClaimsService]
})
export class DisplayClaimsComponent {
constructor (private _claimService: ClaimsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
if( this.myClaims){
this.fetchBy = "User";
this.fetchId = Session.getUserEmail();
}else{
this.fetchBy = params['fetchBy'];
this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
this.fetchId = params['fetchId'];
this.fetchId = this.fetchId?this.fetchId:'';
}
let page = (params['page']=== undefined)?1:+params['page'];
let size = (params['size']=== undefined)?10:+params['size'];
this.keyword = (params['keyword']?params['keyword']:"");
this.inputkeyword = this.keyword;
this.page = ( page <= 0 ) ? 1 : page;
this.size = ( size <= 0 ) ? 10 : size;
this.entityTypes = []//(params['types']?params['types']:[]);
this.setTypes(params['types']); // check the appropriate checkboxes
this.setSortby(params['sort']);
this.getClaims();
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
//string because comes as input from component directive
@Input() enableDelete: boolean = false;
@Input() showUserEmail: boolean = true;
@Input() myClaims: boolean= false ;
@Input() isAdmin:boolean = false;
page : number;
size:number;
sizes = [10,20,30,50];
keyword:string; // the keyword string to give to the request as parameter
inputkeyword:string; // the string written in the input field (keyword=inputkeyword when its length is bigger than 3 and the user stops typing)
lengths = [10,20,30,50];
types = ["All","Project","Context","Result","User"];
@Input() fetchBy:string;
@Input() fetchId:string;
navigateTo: string = "Claims";
resultsNum: number ;
claims: string[];
@ViewChild (ModalLoading) loading : ModalLoading ;
//checkboxes:
publicationCB = false;
datasetCB = false;
contextCB = false;
projectCB = false;
entityTypes : string[] =[] ;
descending = true;
sortby = "date";
selected=[];
deleteMessage:string = "";
showErrorMessage:boolean = false;
showForbiddenMessage:boolean = false;
userValidMessage:string = "";
//params for pagingFormatter to use when navigate to page
params;
@ViewChild(AlertModal) alert;
claimsDeleted:number = 0;
getClaims () {
if(!Session.isValidAndRemove()){
this.userValidMessage = "User session has expired. Please login again.";
}else{
var token=Session.getUserJwt();
this.selected=[];
var types = '';
this.showErrorMessage = false;
this.showForbiddenMessage = false;
for (var type of this.entityTypes){
types+=(types.length>0?'&':'')+"types="+type;
}
if(this.fetchBy =="Project" ){
this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= data.total;
},
err => {
this.handleErrors(err);
}
);
}else if(this.fetchBy =="User"){
this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= data.total;
},
err => {
this.handleErrors(err);
}
);
}else if(this.fetchBy =="Result"){
this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= data.total;
},
err => {
this.handleErrors(err);
}
);
}else if(this.fetchBy =="Context"){
this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum= null;
this.resultsNum= data.total;//data.length; //TODO get the total results num
},
err => {
this.handleErrors(err);
}
);
}else{
this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types).subscribe(
data => {
this.claims = data.data;
this.resultsNum = null;
this.resultsNum= data.total;//data.length; //TODO get the total results num
},
err => {
this.handleErrors(err);
}
);
}
}
}
handleErrors(err){
this.showErrorMessage = true;
try{
var error = err.json()
var code = error.code;
if(code == 403){
this.showErrorMessage = false;
this.showForbiddenMessage = true;
}
}catch (e) {
console.log("Couldn't parse answer as json")
this.showErrorMessage = true;
}
}
goTo(page:number = 1){
this.page = page;
this.location.go(location.pathname,this.getParametersString());
this.getClaims();
}
getParameters(){
var params = {}
if(this.myClaims){
params={ page: this.page, size: this.size, types: this.entityTypes, keyword : this.keyword, sort: this.getSortby() };
}else{
params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby() };
}
return params;
}
getParametersString(){
var params='';
params+=(this.page==1?"":(params.length>0?'&':'')+"page="+this.page);
params+=(this.size==10?"":(params.length>0?'&':'')+"size="+this.size);
// params+=(this.entityTypes==''?"":(params.length>0?'&':'')+"types="+this.entityTypes);
var types="";
for (var type of this.entityTypes){
types+=(types.length>0?',':'')+type;
}
params+=(types.length>0)?"types="+types:"";
if(this.isAdmin ){
params+=(this.fetchBy=='All'?"":(params.length>0?'&':'')+"fetchBy="+this.fetchBy);
params+=(this.fetchId==''?"":(params.length>0?'&':'')+"fetchId="+this.fetchId);
}
params+=(this. getSortby()=='datedesc'?"":(params.length>0?'&':'')+"sort="+this. getSortby());
params+=(this.keyword==''?"":(params.length>0?'&':'')+"keyword="+this.keyword);
return params;
}
changeSize(size: number ){
this.goTo();
}
clearFilters(){
this.keyword = '';
this.inputkeyword = '';
this.publicationCB = false;
this.projectCB = false;
this.datasetCB = false;
this.contextCB = false;
this.entityTypes = [];
this.goTo();
}
changeOrderby(sortby:string){
if(sortby==this.sortby){
this.descending = !this.descending;
}else{
this.sortby = sortby;
this.descending = false;
}
this.goTo();
}
setSortby(sortby:string){
if(!sortby|| sortby == "datedesc"){
this.descending = true;
this.sortby = "date";
}else if(sortby == "dateasc"){
this.descending = false;
this.sortby = "date";
}else if(sortby == "userasc"){
this.descending = false;
this.sortby = "user";
}else if(sortby == "userdesc"){
this.descending = true;
this.sortby = "user";
}if(sortby =="sourceasc"){
this.descending = false;
this.sortby = "source";
}else if(sortby == "sourcedesc"){
this.descending = true;
this.sortby = "source";
}else if(sortby == "targetasc"){
this.descending = false;
this.sortby = "target";
}else if(sortby == "targetdesc"){
this.descending = true;
this.sortby = "target";
}
}
getSortby():string{
if(this.descending){
return this.sortby+"desc";
}else{
return this.sortby+"asc";
}
}
changeType(){
this.entityTypes = [];
if(this.publicationCB){
this.entityTypes.push('publication');
}
if(this.datasetCB){
this.entityTypes.push('dataset');
}
if(this.projectCB){
this.entityTypes.push('project');
}
if(this.contextCB){
this.entityTypes.push('context');
}
this.goTo();
}
setTypes(types:string){
if(!types){
return;
}
if(types.length > 0){
this.entityTypes = [];
if(types.indexOf("publication")!=-1){
this.publicationCB = true;
this.entityTypes.push("publication");
}
if(types.indexOf("dataset")!=-1){
this.datasetCB = true;
this.entityTypes.push("dataset");
}
if(types.indexOf("project")!=-1){
this.projectCB = true;
this.entityTypes.push("project");
}
if(types.indexOf("context")!=-1){
this.contextCB = true;
this.entityTypes.push("context");
}
}
if(this.publicationCB && this.datasetCB && this.contextCB && this.projectCB){
this.entityTypes=[];
}
}
changekeyword(){
if(this.inputkeyword.length >= 3 || this.inputkeyword.length == 0 ){
this.keyword = this.inputkeyword;
this.page = 1;
this.goTo();
}
}
select(item:any,event){
this.deleteMessage="";
var value = event.currentTarget.checked;
if(value){
this.selected.push(item);
}else{
for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if(claim['id'] == item.id){
this.selected.splice(_i, 1);
}
}
}
}
selectAll(event){
var value = event.currentTarget.checked;
if(value){
this.selected = [];
for (var _i = 0; _i < this.claims.length; _i++) {
let claim = this.claims[_i];
this.selected.push(claim);
}
this.deleteMessage = "";
}else{
this.selected = [];
this.deleteMessage="";
}
}
isSelected(id:string){
for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if(claim['id'] == id){
return true;
}
}
return false;
}
confirmOpen(){
if(this.selected.length <= 0){
}else{
this.alert.cancelButton = true;
this.alert.okButton = true;
this.alert.alertTitle = "Delete "+this.selected.length+" claim(s)";
this.alert.message = this.selected.length+" claims will be deleted. Do you want to proceed? ";
this.alert.okButtonText = "Yes";
this.alert.cancelButtonText = "No";
this.alert.open();
}
}
confirmClose(data){
this.delete();
}
delete(){
this.deleteMessage="";
this.loading.open();
this.claimsDeleted = 0;
var ids = [];
for (var i = 0; i < this.selected.length; i++){
var id =this.selected[i].id;
ids.push(id);
// var selected =this.selected[i].id;
// console.warn("Deleting claim with id:"+id);
// this.deleteById(id);
//TODO for multiple concurrent
}
this.batchDeleteById(ids);
}
deleteById(id:string){
if(!Session.isValidAndRemove()){
this.userValidMessage = "User session has expired. Please login again.";
}else{
var token=Session.getUserJwt();
console.log("Deleting claim with id:"+id);
// this._claimService.deleteClaimById(id);
this._claimService.deleteClaimById(id).subscribe(
res => {
console.log('Delete response'+res.code );
console.log("Deleted claim with id:"+ id);
//remove this claim from the
let newClaims=this.claims;
for (var _i = 0; _i < this.claims.length; _i++) {
let claim = this.claims[_i];
if(claim['id'] == id){
newClaims.splice(_i, 1);
}
}
//TODO should call getClaims???
this.claimsDeleted++;
this.claims = newClaims;
if(this.claimsDeleted == this.selected.length){
this.resultsNum = this.resultsNum - this.selected.length;
this.loading.close();
this.selected = [];
}
});
}
}
batchDeleteById(ids:string[]){
if(!Session.isValidAndRemove()){
this.userValidMessage = "User session has expired. Please login again.";
}else{
var token=Session.getUserJwt();
console.warn("Deleting claim with ids:"+ids);
this._claimService.deleteBulk(ids).subscribe(
res => {
console.info('Delete response'+res.code );
console.warn("Deleted ids:"+ res.deletedIds);
console.warn("Not found ids:"+ res.notFoundIds);
//remove this claim from the
let newClaims=this.claims;
for(var id of res.deletedIds){
for (var _i = 0; _i < this.claims.length; _i++) {
let claim = this.claims[_i];
if(claim['id'] == id){
newClaims.splice(_i, 1);
}
}
for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if(claim['id'] == id){
this.selected.splice(_i, 1);
}
}
}
this.claims = newClaims;
this.resultsNum = this.resultsNum - res.deletedIds.length;
this.loading.close();
if(res.deletedIds.length>0){
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-primary " >'+res.deletedIds.length+' claim(s) successfully deleted.</div>';
}
if(res.notFoundIds.length>0){
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-warning " >'+res.notFoundIds.length+' claim(s) couldn\'t be deleted.</div>';
}
}, err => {
console.log(err);
this.showErrorMessage = true;
this.loading.close();
});
}
}
pageChange($event) {
var page:number = +$event.value
this.goTo(page);
}
}

View File

@ -1,26 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {ClaimServiceModule} from '../service/claimsService.module';
import {DisplayClaimsComponent} from './displayClaims.component';
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
import {ClaimEntityFormatterModule} from '../entityFormatter/claimEntityFormatter.module';
import {PagingModule } from '../../../utils/paging.module';
import {HelperModule} from '../../../utils/helper/helper.module';
@NgModule({
imports: [
CommonModule, FormsModule, ClaimServiceModule, LoadingModalModule, AlertModalModule,
ClaimEntityFormatterModule, PagingModule, HelperModule
],
declarations: [
DisplayClaimsComponent
],
exports: [
DisplayClaimsComponent
]
})
export class DisplayClaimsModule { }

View File

@ -1,39 +0,0 @@
import {Component, Input} from '@angular/core';
//Usage Example "<claim-entity [entity]="" [type]="" > </claim-entity>"
//externalUrl
@Component({
selector: 'claim-entity',
template: `
<div *ngIf="type == 'publication'" title="Publication">
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect fill="none" stroke="#000" x="3.5" y="2.5" width="12" height="16"></rect><polyline fill="none" stroke="#000" points="5 0.5 17.5 0.5 17.5 17"></polyline></svg></span>
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
</div>
<div *ngIf="type == 'dataset'" title="Dataset">
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span>
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
</div>
<div *ngIf="type == 'project' " title="Project">
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="5" y="2" width="10" height="1"></rect><rect x="3" y="4" width="14" height="1"></rect><rect fill="none" stroke="#000" x="1.5" y="6.5" width="17" height="11"></rect></svg></span>
<project-title [project]="entity"></project-title>
</div>
<div *ngIf="type == 'context' " title="Concept">
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg></span>
<span>{{entity.title}}</span>
</div>
`
})
export class ClaimEntityFormatter {
@Input() entity: string[];
@Input() type: string;
constructor () {}
ngOnInit() {
}
}

View File

@ -1,24 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {ProjectTitleFormatter} from './projectTitleFormatter.component';
import {PublicationTitleFormatter} from './publicationTitleFormatter.component';
import {ClaimEntityFormatter} from './claimEntityFormatter.component';
@NgModule({
imports: [
CommonModule, RouterModule
],
declarations: [
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
],
providers: [ ],
exports: [
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
]
})
export class ClaimEntityFormatterModule { }

View File

@ -1,25 +0,0 @@
import {Component, Input} from '@angular/core';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import {RouterHelper} from '../../../utils/routerHelper.class';
//Usage Example "<project-title [project]="X" > </project-title>"
@Component({
selector: 'project-title',
template: `
<span class="project-title">
<span ><a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" routerLinkActive="router-link-active" routerLink="/search/project" >{{project['name']}} ({{project['funderName']}})</a></span>
</span>
`
})
export class ProjectTitleFormatter {
@Input() project: string[];
public url:string;
public routerHelper:RouterHelper = new RouterHelper();
constructor () {}
ngOnInit() {
this.url = OpenaireProperties.getsearchLinkToProject() + "?projectId=" + this.project["openaireId"];
}
}

View File

@ -1,26 +0,0 @@
import {Component, Input} from '@angular/core';
//Usage Example "<publication-title [title]="X" [url]="X" > </publication-title>"
@Component({
selector: 'publication-title',
template: `
<span class="publication-title">
<span *ngIf="url" ><a target="_blank" href="{{url}}" ><span class="custom-external custom-icon" ></span> {{title}}</a></span>
<span *ngIf="!url" >{{title}}</span>
</span>
`
})
export class PublicationTitleFormatter {
@Input() title: string[];
@Input() url: string[];
constructor () {}
ngOnInit() {
}
}

View File

@ -1,154 +0,0 @@
import {Injectable} from '@angular/core';
import {Jsonp, URLSearchParams } from '@angular/http';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
// import {Claim} from '../claim';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../../shared/cache.service';
import { CustomOptions } from './customOptions.class';
@Injectable()
export class ClaimsService {
private baseUrl;
constructor(private jsonp: Jsonp, private http: Http, public _cache: CacheService) {
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
}
private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any {
console.info('ClaimsService: Claims request: '+url);
let key = url;
if (fromCache && this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url, CustomOptions.getAuthOptions())
.map(request => <any> request.json())
.do(request => console.info("Get claims: offset = "+(size*(page-1)) + " limit ="+size ))
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
});
}
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string):any {
console.info('ClaimsService: getClaims ' );
console.info('ClaimsService: Types : '+types );
let url = this.baseUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
return this.getClaimRequest(size,page,url,true);
}
getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string):any {
console.info('ClaimsService: getClaims for user : '+user);
let url = this.baseUrl +"users/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
return this.getClaimRequest(size,page,url,false);
}
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
console.info('ClaimsService: getClaims for context : '+contextId);
let url = this.baseUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
return this.getClaimRequest(size,page,url,true);
}
getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
console.info('ClaimsService: getClaims for result : '+resultId);
let url = this.baseUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
return this.getClaimRequest(size,page,url,true);
}
getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
console.info('ClaimsService: getClaims for project : '+projectId);
let url = this.baseUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
return this.getClaimRequest(size,page,url,true);
}
deleteClaimById(claimId:string ):any{
console.warn('Trying to delete claim with id : '+claimId);
let url = this.baseUrl +"claims/"+claimId;
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.delete( url, CustomOptions.getAuthOptionsWithBody()).map(request => <any> request.json())
// .do(request => console.info("After delete" ))
.catch(this.handleError);
}
deleteBulk(claimIds:string[]):any{
console.warn('Trying to delete claims with ids : '+claimIds);
var url = "";
for(var claimId of claimIds){
url=url+(url.length >0 ?"&":"")+"claimId="+claimId;
}
url= this.baseUrl +"claims/bulk?"+url;
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.delete( url, CustomOptions.getAuthOptions()).map(request => <any> request.json())
// .do(request => console.info("After delete" ))
.catch(this.handleError);
}
insertBulkClaims(claims):any{
console.warn('Trying toinsert claims : '+claims);
let url = this.baseUrl +"claims/bulk";
let body = JSON.stringify( claims );
console.warn('Json body: : '+body);
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
.map(res => res.json())
.do(request => console.info("Insert Response:"+request.status) )
.catch(this.handleError);
}
insertClaim(claim):any{
console.warn('Trying toinsert claim : '+claim);
let url = this.baseUrl +"claims";
let body = JSON.stringify( claim );
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
.map(res => res.json())
.do(request => console.info("Insert Response:"+request.status) )
.catch(this.handleError);
}
insertDirectRecords(records):any{
console.warn('Trying to feedrecords : '+records);
let url = this.baseUrl +"feed/bulk";
let body = JSON.stringify( records );
console.warn('Json body: : '+body);
// let headers = new Headers({ 'Content-Type': 'application/json' });
// let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
.map(res => res.json())
.do(request => console.info("Insert Response:"+request) )
.catch(this.handleError);
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
getClaim(id:string):any {
let url = this.baseUrl+"claims/"+id;
return new Promise((resolve, reject) => {
this.http.get(url)
.map(res => res.json())
.subscribe(
data => {
resolve(data.data);
},
err => {
reject(err);
}
)
;
});
}
}

View File

@ -1,23 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {ClaimsService} from './claims.service';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
],
providers:[
ClaimsService,
],
exports: [
]
})
export class ClaimServiceModule { }

View File

@ -1,100 +0,0 @@
import {Injectable} from '@angular/core';
import {Jsonp, URLSearchParams, RequestOptions, Headers} from '@angular/http';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {Claim} from '../claim';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import {AutoCompleteValue} from '../../../searchPages/searchUtils/searchHelperClasses.class';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../../shared/cache.service';
import { COOKIE } from '../../../login/utils/helper.class';
@Injectable()
export class ContextsService {
private baseUrl;
constructor(private http: Http, public _cache: CacheService) {
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
}
public getCommunities():any {
let url = this.baseUrl + 'communities';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
console.info('ContextsService: request communities '+url);
return this.http.get( url, this.getAuthOptions())
.map(request => <any> request.json().data)
// .do(request => console.info("Get claims: offset = "))
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
});
}
public getCategories(communityId :string):any {
console.info('ContextsService: request categories for community with id '+communityId);
let url= this.baseUrl + 'communities/' + communityId + '/categories';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url, this.getAuthOptions())
.map(request => <any> request.json().data)
// .do(request => console.info("Get claims: offset = " ))
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
});
}
public getConcepts(categoryId :string, keyword: string, parsing:boolean):any {
console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
let url= this.baseUrl + 'categories/' + categoryId+ "/concepts";
let key = url+"_parsing="+parsing;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => (parsing)?this.parse(res.concept):res.concept);
//.do(res => console.info("Result is "+ res.length));
}
return this.http.get( url, this.getAuthOptions())
.map(request => <any> request.json().data)
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
}).map(res => (parsing)?this.parse(res.concept):res.concept);
// .do(res => console.info("Result is "+ res.length ));
}
parse (data: any):AutoCompleteValue[] {
var array:AutoCompleteValue[] =[]
if(!Array.isArray(data) && data.id && data.label){
var value:AutoCompleteValue = new AutoCompleteValue();
value.id = data.id;
value.label = data.label;
array.push(value);
}
for(var i = 0; i < data.length; i++){
var value:AutoCompleteValue = new AutoCompleteValue();
value.id = data[i].id;
value.label = data[i].label;
array.push(value);
}
return array;
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
private getAuthOptions():RequestOptions{
let headers = new Headers();
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
let options = new RequestOptions({ headers: headers, withCredentials:true });
return options;
}
}

View File

@ -1,20 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {ContextsService} from './contexts.service';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
],
providers:[
ContextsService
],
exports: [
]
})
export class ContextsServiceModule { }

View File

@ -1,19 +0,0 @@
import { RequestOptions, Headers} from '@angular/http';
import { COOKIE } from '../../../login/utils/helper.class';
export class CustomOptions{
public static getAuthOptionsWithBody():RequestOptions{
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
let options = new RequestOptions({ headers: headers, withCredentials:true });
return options;
}
public static getAuthOptions():RequestOptions{
let headers = new Headers();
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
let options = new RequestOptions({ headers: headers, withCredentials:true });
return options;
}
}

View File

@ -1,84 +0,0 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class SearchCrossrefService {
constructor( private http: Http, public _cache: CacheService) {}
searchCrossrefResults (term: string, size : number, page : number):any {
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?query='+term+'&rows='+size+'&offset='+(size*(page-1));
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json().message)
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" keyword = "+term))
.do(res => {
this._cache.set(key, res);
});
//.catch(this.handleError);
}
searchCrossrefByDOIs(DOIs: string[]):any {
/*
$request ="http://api.crossref.org/works"."?filter=";
foreach($dois as $doi){
$request.="doi:".urlencode( trim($doi)).",";
}
*/
var doisParams = "";
for(var i =0 ;i < DOIs.length; i++){
doisParams+=(doisParams.length > 0?",":"")+'doi:'+DOIs[i];
}
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter='+doisParams;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json().message)
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" for doi = "+doisParams))
.do(res => {
this._cache.set(key, res);
});
//.catch(this.handleError);
}
searchCrossrefByMultipleDOIs(dois: string[]):any {
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter=doi:';
for(var i=0; i<dois.length; i++){
url=url+(url.length==0?'':',')+'doi:'+dois[i];
}
url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter='+url;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json().message)
.do(items => console.log("Crossref Results: total results = "+items['total-results'])).
do(res => {
this._cache.set(key, res);
});
//.catch(this.handleError);
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
}

View File

@ -1,20 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchCrossrefService} from './searchCrossref.service';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
],
providers:[
SearchCrossrefService
],
exports: [
]
})
export class SearchCrossrefServiceModule { }

View File

@ -1,60 +0,0 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class SearchDataciteService {
constructor(private http: Http, public _cache: CacheService) {}
searchDataciteResults (term: string, size : number, page : number):any {
console.info("In search datacite results "+term);
let url = OpenaireProperties.getSearchDataciteAPIURL()+'?query='+term+'&rows='+size+'&start='+(size*(page-1));
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json())
.do(items => console.info(items))
.do(items => console.log("Datacite Results: total results = "+items.meta.total+" keyword = "+term))
.do(res => {
this._cache.set(key, res);
});
//.catch(this.handleError);
}
getDataciteResultByDOI (doi: string):any {
console.info("Fetch datacite resultt by DOI: "+doi);
let url = OpenaireProperties.getSearchDataciteAPIURL()+'/'+doi;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json())
.do(items => console.info(items))
// .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi))
.do(res => {
this._cache.set(key, res);
});
//.catch(this.handleError);
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
private extractData(res: Response) {
if (res.status < 200 || res.status >= 300) {
throw new Error('Bad response status: ' + res.status);
}
let body = res.json();
return body.data || { };
}
}

View File

@ -1,20 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchDataciteService} from './searchDatacite.service';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
],
providers:[
SearchDataciteService
],
exports: [
]
})
export class SearchDataciteServiceModule { }

View File

@ -1,141 +0,0 @@
import {Injectable} from '@angular/core';
import {URLSearchParams} from '@angular/http';
import {Http, Response} from '@angular/http';
import { Headers, RequestOptions } from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../../shared/cache.service';
@Injectable()
export class SearchOrcidService {
constructor( private http: Http, public _cache: CacheService) {}
searchOrcidAuthor (term: string, authorIds: string[],
authorGivenNames: string[], authorFamilyNames: string[]):any {
console.info("In searchOrcidAuthor: "+term);
var headers = new Headers();
headers.append('Accept', 'application/orcid+json');
let url = OpenaireProperties.getSearchOrcidURL()+term+'/orcid-bio';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => this.parseOrcidAuthor(res, authorIds, authorGivenNames, authorFamilyNames));
}
return this.http.get(url, { headers: headers })
.map(res => res.json()['orcid-profile'])
.map(res => [res['orcid-bio']['personal-details']['given-names'],
res['orcid-bio']['personal-details']['family-name'],
res['orcid-identifier']])
.do(res => {
this._cache.set(key, res);
})
.map(res => this.parseOrcidAuthor(res, authorIds, authorGivenNames, authorFamilyNames));
}
searchOrcidAuthors (term: string, authorIds: string[],
authorGivenNames: string[], authorFamilyNames: string[]):any {
console.info("In search Orcid authors for keyword: "+term);
var headers = new Headers();
headers.append('Accept', 'application/orcid+json');
let url = OpenaireProperties.getSearchOrcidURL()+'search/orcid-bio?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => this.parseOrcidAuthors(res, authorIds, authorGivenNames, authorFamilyNames));
}
return this.http.get(url, { headers: headers })
.map(res => res.json()['orcid-search-results']['orcid-search-result'])
.do(res => {
this._cache.set(key, res);
})
.map(res => this.parseOrcidAuthors(res, authorIds, authorGivenNames, authorFamilyNames));
}
searchOrcidPublications (id: string):any {
console.info("In search Orcid publications for author: "+id);
var headers = new Headers();
headers.append('Accept', 'application/orcid+json');
let url = OpenaireProperties.getSearchOrcidURL()+id+'/orcid-works';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url, { headers: headers })
.map(res => res.json()['orcid-profile']['orcid-activities']['orcid-works'])
.do(res => {
this._cache.set(key, res);
});
//.map(res => res['orcid-work']);
}
parseOrcidAuthor (data: any, authorIds: string[],
authorGivenNames: string[], authorFamilyNames: string[]):any {
if(data[2] != null) {
authorIds.push(data[2].path);
if(data[0] != null) {
authorGivenNames.push(data[0].value);
} else {
authorGivenNames.push("");
}
if(data[1] != null) {
authorFamilyNames.push(data[1].value);
} else {
authorFamilyNames.push("");
}
return true;
}
return false;
}
parseOrcidAuthors (data: any, authorIds: string[],
authorGivenNames: string[], authorFamilyNames: string[]):any {
let ret: boolean = false;
let mydata: any;
let length: number;
if(data != null) {
length = data.length!=undefined ? data.length : 1;
for(let i=0; i<length; i++) {
mydata = data.length!=undefined ? data[i] : data;
if(mydata.hasOwnProperty("orcid-profile")) {
if(mydata['orcid-profile'].hasOwnProperty("orcid-identifier")) {
authorIds.push(mydata['orcid-profile']['orcid-identifier'].path);
if(mydata['orcid-profile'].hasOwnProperty("orcid-bio")) {
if(mydata['orcid-profile']['orcid-bio'].hasOwnProperty("personal-details")) {
if(mydata['orcid-profile']['orcid-bio']['personal-details'].hasOwnProperty("given-names")) {
authorGivenNames.push(mydata['orcid-profile']['orcid-bio']['personal-details']['given-names'].value);
} else {
authorGivenNames.push("");
}
if(mydata['orcid-profile']['orcid-bio']['personal-details'].hasOwnProperty("family-name")) {
authorFamilyNames.push(mydata['orcid-profile']['orcid-bio']['personal-details']['family-name'].value);
} else {
authorFamilyNames.push("");
}
}
}
ret = true;
}
}
}
}
return ret;
}
}

View File

@ -1,65 +0,0 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {ClaimResult} from '../claim-utils/claimEntities.class';
import {AlertModal} from '../../utils/modal/alert';
@Component({
selector: 'start-over',
template: `
<button (click)="confirmOpen()" class="uk-button uk-button-danger uk-align-left" > <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="refresh" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg></span> Clear All</button>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
`,
})
export class StartOverComponent {
constructor () {
}
ngOnInit() {
}
// @Input() public inlineEntity = null;
@Input() public type:string;
@Input() public linkTo:string;
@Input() public results;
@Input() public projects;
@Input() public contexts;
@ViewChild(AlertModal) alertApplyAll;
confirmOpen(){
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = true;
this.alertApplyAll.alertTitle = "Remove selected";
this.alertApplyAll.message = "This action will delete every selected entity (projects, communities, research results). Do you wish to continue?";
this.alertApplyAll.okButtonText = "Yes";
this.alertApplyAll.cancelButtonText = "No";
this.alertApplyAll.open();
}
confirmClose(data){
this.startOver();
}
startOver(){
if(this.type != null && this.linkTo != null){
console.log("inline");
if(this.linkTo == "project"){
this.projects.splice(0, this.projects.length);
}else if(this.linkTo == "context"){
this.contexts.splice(0, this.contexts.length);
}else if(this.linkTo == "result"){
this.results.splice(0, this.results.length);
}
}else{
console.log("generic");
this.results.splice(0, this.results.length);
this.projects.splice(0, this.projects.length);
this.contexts.splice(0, this.contexts.length);
}
console.log("projects:"+this.projects.length +" contexts:"+this.contexts.length + " results:"+this.results.length );
}
}

View File

@ -1,16 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import {StartOverComponent} from './startOver.component';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
@NgModule({
imports: [
SharedModule, CommonModule, AlertModalModule
],
declarations: [
StartOverComponent
],
exports: [StartOverComponent ]
})
export class StartOverModule { }

View File

@ -1,68 +0,0 @@
// 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 { }

View File

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

View File

@ -1,43 +0,0 @@
import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {ClaimsService} from '../../services/claims.service';
// import {Claim} from '../../utils/entities/claim';
@Component({
selector: 'claim',
templateUrl: 'claim.component.html',
})
export class ClaimComponent {
constructor (private _claimService: ClaimsService,
private route: ActivatedRoute, private _router:Router) {}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
this.id = params['id'];
console.info("Claim id:"+this.id +" " +params['id']);
if(this.id!=null){
this.getClaim(this.id);
}
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
id : string;
claim : any;
getClaim (id: string) {
this._claimService.getClaim(id)
.then(data => {
this.claim = data;
console.log(data);
}) ;
}
}

View File

@ -1,16 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import { ClaimsAdminComponent } from './claimsAdmin.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ClaimsAdminComponent, canActivate: [IsRouteEnabled, AdminLoginGuard],
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class ClaimsAdminRoutingModule { }

View File

@ -1,38 +0,0 @@
import {Component, ViewChild, Input} from '@angular/core';
import {Location} from '@angular/common';
import {Observable} from 'rxjs/Observable';
import { Meta} from '../../../angular2-meta';
@Component({
selector: 'claims-admin',
template: `
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container">
<div class="uk-article-title">
Claims Administrator
</div>
<div>
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
<displayClaims [enableDelete]=true [myClaims]=false [isAdmin]=true></displayClaims>
</div>
</div>
</div>
</div>
</div>
`,
})
export class ClaimsAdminComponent {
constructor ( private _meta: Meta ) {
this._meta.setTitle("OpenAIRE | Claims Administrator");
}
ngOnInit() {
}
}

View File

@ -1,25 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { ClaimsAdminComponent } from './claimsAdmin.component';
import { ClaimsAdminRoutingModule } from './claimsAdmin-routing.module';
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
SharedModule,
ClaimsAdminRoutingModule,
// ClaimServiceModule,
DisplayClaimsModule
],
providers:[AdminLoginGuard, PreviousRouteRecorder,IsRouteEnabled],
declarations: [
ClaimsAdminComponent
]
})
export class ClaimsAdminModule { }

View File

@ -1,15 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { ClaimsByTokenComponent } from './claimsByToken.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ClaimsByTokenComponent, canActivate: [IsRouteEnabled, LoginGuard],
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class ClaimsByTokenRoutingModule { }

View File

@ -1,433 +0,0 @@
import {Component, ViewChild, Input} from '@angular/core';
import {Location} from '@angular/common';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Params} from '@angular/router';
import {ClaimsByTokenService} from './claimsByToken.service';
import {ModalSelect} from '../../utils/modal/selectModal.component';
import {ModalLoading} from '../../utils/modal/loading.component';
import {Session} from '../../login/utils/helper.class';
import {RouterHelper} from '../../utils/routerHelper.class';
import { Meta} from '../../../angular2-meta';
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
//import {DataTable} from "angular2-datatable";
@Component({
selector: 'claims-project-manager',
template: `
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container">
<!--div *ngIf="accessStatus=='empty'" class="uk-margin-top uk-width-medium-2-3 uk-container-center">
<div class="uk-block uk-block-primary uk-block-large uk-contrast uk-text-center">
<p class="uk-text-large">Please enter your email and then press 'See Claims' button.</p>
<form class="uk-form">
<fieldset data-uk-margin>
<input type="text" placeholder="example@email.com" name="email" [(ngModel)]="email">
<button (click)="validateJWTandToken()" class=" uk-button uk-button-default">See Claims</button>
</fieldset>
</form>
</div>
</div-->
<div *ngIf="accessStatus=='invalid'" class="uk-margin-top uk-width-medium-2-3 uk-container-center">
<div class="uk-block uk-block-primary uk-block-large uk-contrast uk-text-center">
<!--p class="uk-text-large">Oops! There is no entry for you! Please retry with another email or for another project.</p-->
<!--button (click)="accessStatus='empty'" class=" uk-button uk-button-default">Retry</button-->
<p class="uk-text-large">Oops! Your email does not give you the authority to view claims for the selected project. Please contact the administrators.</p>
</div>
</div>
<div *ngIf="accessStatus=='valid'">
<div class="uk-article-title">
Claims Administrator
<a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])"
routerLinkActive="router-link-active"
routerLink="/search/project" >
{{project['name']}} ({{project['funderName']}})
</a>
</div>
<h2> Pending Claims</h2>
<div *ngIf=" pending_claims && pending_claims.length == 0" >
<div class = "uk-alert uk-alert-primary " >No pending claims found.</div>
</div>
<div class="uk-overflow-container custom-dataTable-content">
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
<form class="uk-text-center uk-panel">
<input type="text" class="uk-input uk-width-1-3" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="filterQuery" name="keyword" />
</form>
</div>
<span *ngIf="pending_claims && pending_claims.length > 0 && totalPendingResults.count > 0">
{{totalPendingResults.count}} pending claims, page {{activePendingPage.page}} of {{totalPages(totalPendingResults.count)}}
<paging-no-load class="uk-float-right" [currentPage]="activePendingPage.page" [totalResults]="totalPendingResults.count" [size]="rowsOnPage" (pageChange)="refreshTable(table1, $event, 'pending')"></paging-no-load>
</span>
<table #filtered1 *ngIf="pending_claims && pending_claims.length > 0" class="uk-table uk-table-striped"
[mfData]="pending_claims | claimsDatatable : [filterQuery, totalPendingResults, activePendingPage]" #mf1="mfDataTable" [mfRowsOnPage]="rowsOnPage" [mfActivePage]="1">
<!--[(mfSortBy)]="sortByClaimDate1" (mfSortOrder)="sortOrder"-->
<thead>
<tr>
<th><mfDefaultSorter [by]="sortByTitle1">Research Result</mfDefaultSorter></th>
<th class="uk-text-center"><mfDefaultSorter by="userMail">Claimed By</mfDefaultSorter></th>
<th class="uk-text-center"><mfDefaultSorter [by]="sortByClaimDate1">Claimed Date</mfDefaultSorter></th>
<th class="uk-text-center">Approve</th>
</tr>
</thead>
<tbody>
<tr class="uk-table-middle" *ngFor="let claim1 of mf1.data">
<td class="uk-width-2-5" *ngIf="claim1.targetType != 'project'"><claim-entity [entity]="claim1.target" [type]="claim1.targetType" > </claim-entity></td>
<td class="uk-width-2-5 uk-text-center" *ngIf="claim1.sourceType != 'project'"><claim-entity [entity]="claim1.source" [type]="claim1.sourceType" > </claim-entity></td>
<td class="uk-width-1-5 uk-text-center">{{claim1.userMail}}</td>
<td class="uk-width-1-5 uk-text-center">{{claim1.date}}</td>
<td class="uk-width-1-5 uk-text-center">
<label>
Yes <input [id]="claim1.id" type="checkbox" (click)="selectApprove(claim1.id,$event)" [ngModel]="isSelectedRight(claim1.id)"/>
</label>
<label>
No <input [id]="claim1.id" type="checkbox" (click)="selectDisapprove(claim1.id,$event)" [ngModel]="isSelectedWrong(claim1.id)"/>
</label>
</td>
</tr>
</tbody>
</table>
</div>
<div class="uk-text-small uk-text-right">*Note that claims you did not approved or disapproved are considered as right (but not curated)</div>
<button class="uk-button uk-button-primary uk-float-right" type="submit" (click)="saveChanges()">Save Changes</button>
<h2> Already Curated Claims</h2>
<div *ngIf=" curated_claims && curated_claims.length == 0" >
<div class = "uk-alert uk-alert-primary " >No curated claims found.</div>
</div>
<div class="uk-overflow-container custom-dataTable-content">
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
<form class="uk-text-center uk-panel">
<input type="text" class="uk-input uk-width-1-3" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="filterQuery2" name="keyword" />
</form>
</div>
<span *ngIf="curated_claims && curated_claims.length > 0 && totalCuratedResults.count > 0">
{{totalCuratedResults.count}} curated claims, page {{activeCuratedPage.page}} of {{totalPages(totalCuratedResults.count)}}
<paging-no-load class="uk-float-right" [currentPage]="activeCuratedPage.page" [totalResults]="totalCuratedResults.count" [size]="rowsOnPage" (pageChange)="refreshTable(table2, $event, 'curated')"> </paging-no-load>
</span>
<table *ngIf="curated_claims && curated_claims.length > 0" class="uk-table uk-table-striped"
[mfData]="curated_claims | claimsDatatable : [filterQuery2, totalCuratedResults, activeCuratedPage]" #mf2="mfDataTable" [mfRowsOnPage]="rowsOnPage" [mfActivePage]="1">
<!--[(mfSortBy)]="sortByCurationDate2" [(mfSortOrder)]="sortOrder"-->
<thead>
<!--tr>
<td colspan="6">
<form class="uk-text-center uk-panel uk-background-muted">
<input type="text" class="uk-input uk-width-1-3" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="filterQuery2" name="keyword" />
</form>
</td>
</tr-->
<!--tr>
<td>
Filter curated claims:
<input class="uk-input uk-width-1-3" [(ngModel)]="filterQuery2"/>
</td>
</tr-->
<tr>
<th><mfDefaultSorter [by]="sortByTitle1">Research Result</mfDefaultSorter></th>
<!--th>Link to</th-->
<th class="uk-text-center"><mfDefaultSorter by="userMail">Claimed by</mfDefaultSorter></th>
<th class="uk-text-center"><mfDefaultSorter [by]="sortByClaimDate2">Claimed Date</mfDefaultSorter></th>
<th class="uk-text-center"><mfDefaultSorter by="curatedBy">Curated by</mfDefaultSorter></th>
<th class="uk-text-center"><mfDefaultSorter [by]="sortByCurationDate2">Curation Date</mfDefaultSorter></th>
<th class="uk-text-center">Approved</th>
</tr>
</thead>
<tbody>
<tr class="uk-table-middle" *ngFor="let claim of mf2.data let i=index">
<td class="uk-width-1-6" *ngIf="claim.targetType != 'project'"><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td>
<td class="uk-width-1-6" *ngIf="claim.sourceType != 'project'"><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td>
<td class="uk-width-1-6 uk-text-center">{{claim.userMail}}</td>
<td class="uk-width-1-6 uk-text-center">{{claim.date}}</td>
<td class="uk-width-1-6 uk-text-center">{{claim.curatedBy}}</td>
<td class="uk-width-1-6 uk-text-center">{{claim.curationDate}}</td>
<td class="uk-width-1-6 uk-text-center">
<label>
Yes <input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" [ngModel]="isRight(claim)"/>
</label>
<label>
No <input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" [ngModel]="isWrong(claim)"/>
</label>
</td>
<!--td><input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" (click)="selectDisapprove(claim.id,$event)" [ngModel]="isWrong(claim)"/></td-->
<!--td><button class="uk-button" (click)="editable.add(i)">Edit</button></td-->
</tr>
</tbody>
</table>
</div>
<!--modal-select (alertOutput)="curatorSelected($event)"></modal-select-->
<modal-loading [message]= "'Loading...'"></modal-loading>
</div>
</div>
</div>
</div>
</div>
`,
})
export class ClaimsByTokenComponent {
public token: string = "";
public sub: any;
public project: any;
private claims:any = [];
public pending_claims: any = [];
public curated_claims: any = [];
public selectedRight: Set<string>;
public selectedWrong: Set<string>;
public editable: Set<string>;
public contact_person: string[] = ["Konstantina", "Argiro", "Katerina"];
// when 'valid' show proper claims, when 'invalid' show no matched entry-wanna retry
public accessStatus: string;// = "empty";
public rowsOnPage = 5;
public sortOrder = "asc";
public filterQuery:string = "";
public filterQuery2:string = "";
public activePendingPage:any = {page: 1};
public totalPendingResults:any = {count: 0};
public activeCuratedPage:any = {page: 1};
public totalCuratedResults:any = {count: 0};
@ViewChild('mf1') table1: any;//DataTable;
@ViewChild('mf2') table2: any;//DataTable;
@ViewChild('filtered1') filteredItems1;
@ViewChild (ModalSelect) selectModal : ModalSelect;
@ViewChild (ModalLoading) loading : ModalLoading ;
public routerHelper:RouterHelper = new RouterHelper();
constructor ( private route: ActivatedRoute, private claimsByTokenService: ClaimsByTokenService, private _meta: Meta) {
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
this.token = params['token'];
this.selectedRight = new Set<string>();
this.selectedWrong = new Set<string>();
this.editable = new Set<string>();
//this.openSelect();
//this.setMessageSelect("Please select your identity:");
//this.setOptionsSelect(this.contact_person);
this.validateJWTandToken();
this.updateTitle("Claims For Project Managers");
}
);
}
refreshTable(table:any, $event:any, whichTable: string) {
if(whichTable == "pending") {
this.activePendingPage.page = $event.value;
} else if(whichTable == 'curated') {
this.activeCuratedPage.page = $event.value;
}
table.mfActivePage=$event.value;
table.setPage(table.mfActivePage, this.rowsOnPage);
}
public sortByClaimDate1 = (claim: any) => {
return new Date(claim.date);
}
public sortByCurationDate1 = (claim: any) => {
return new Date(claim.curationDate);
}
public sortByTitle1 = (claim: any) => {
if(claim.targetType != 'project') {
return claim.target.title;
} else {
return claim.source.title;
}
}
public sortByClaimDate2 = (claim: any) => {
return new Date(claim.date);
}
public sortByCurationDate2 = (claim: any) => {
console.info(new Date(claim.curationDate));
return new Date(claim.curationDate);
}
public sortByTitle2= (claim: any) => {
if(claim.targetType != 'project') {
return claim.target.title;
} else {
return claim.source.title;
}
}
validateJWTandToken() {
var jwtToken=Session.getUserJwt();
if(this.token) {
this.claimsByTokenService.getClaims(this.token, jwtToken).subscribe(
data => {
this.closeLoading();
this.accessStatus = "valid";
//console.info(data);
this.claims = data.data;
for(let claim of this.claims) {
if(claim.targetType == "project") {
this.project = claim.target;
} else {
this.project = claim.source;
}
if(claim.curatedBy) {
this.curated_claims.push(claim);
} else {
this.pending_claims.push(claim);
}
}
this.totalPendingResults.count = this.pending_claims.length;
this.totalCuratedResults.count = this.curated_claims.length;
this.updateTitle("Claims For Project Managers - "+this.project.name);
},
err => {
this.accessStatus = "invalid";
console.log(err);
}
);
} else {
this.accessStatus = "invalid";
}
}
selectApprove(id:string, event) {
var value = event.currentTarget.checked;
if(value){
this.selectedRight.add(id);
this.selectedWrong.delete(id);
console.info(this.selectedRight);
}else{
this.selectedRight.delete(id);
console.info(this.selectedRight);
}
}
selectDisapprove(id:string,event) {
var value = event.currentTarget.checked;
if(value){
this.selectedWrong.add(id);
this.selectedRight.delete(id);
}else{
this.selectedWrong.delete(id);
}
}
isSelectedRight(id:string) {
return this.selectedRight.has(id);
}
isSelectedWrong(id:string) {
return this.selectedWrong.has(id);
}
isRight(claim: any) {
//claim.approved = true;
if(this.isSelectedRight(claim.id)) {
return true;
} else if(claim.approved == true && !this.isSelectedWrong(claim.id)) {
return true;
}
return false;
}
isWrong(claim: any) {
if(this.isSelectedWrong(claim.id)) {
return true;
} else if(claim.approved == false && !this.isSelectedRight(claim.id)) {
return true;
}
return false;
}
saveChanges() {
console.info("Changes Saved!");
var jwtToken=Session.getUserJwt();
this.claimsByTokenService.updateClaimsCuration(this.selectedRight, this.selectedWrong).subscribe(
data => {
console.info(data);
},
err => {
console.log(err);
}
);
}
public closeLoading(){
if(this.loading){
this.loading.close();
}
}
curatorSelected(selected: string) {
console.info("selected curator: "+selected);
}
public openSelect(){
if(this.selectModal){
this.selectModal.open();
}
}
public setMessageSelect(message: string){
if(this.selectModal){
this.selectModal.message = message;
}
}
public setOptionsSelect(options: string[]){
if(this.selectModal){
this.selectModal.options = options;
}
}
totalPages(totalResults: number): number {
let totalPages:any = totalResults/(this.rowsOnPage);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
updateTitle(title:string){
var _prefix ="OpenAIRE | ";
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
this._meta.setTitle(_title );
}
}

View File

@ -1,49 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {DataTableModule} from "angular2-datatable";
import { SharedModule } from '../../shared/shared.module';
import { ClaimsByTokenComponent } from './claimsByToken.component';
import { ClaimsByTokenService } from './claimsByToken.service';
import { ClaimsByTokenRoutingModule } from './claimsByToken-routing.module';
import {ClaimEntityFormatterModule} from '../claim-utils/entityFormatter/claimEntityFormatter.module';
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
//import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import {SelectModalModule} from '../../utils/modal/selectModal.module';
import {LoadingModalModule} from '../../utils/modal/loadingModal.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PagingModule} from '../../utils/paging.module';
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule,
DataTableModule,
SharedModule,
ClaimsByTokenRoutingModule,
ClaimEntityFormatterModule,
SelectModalModule,
LoadingModalModule,
PagingModule
// ClaimServiceModule,
//DisplayClaimsModule
],
providers:[
ClaimsByTokenService,
LoginGuard, PreviousRouteRecorder, IsRouteEnabled
],
declarations: [
ClaimsByTokenComponent, ClaimsDatatablePipe
],
exports: [
ClaimsByTokenComponent, ClaimsDatatablePipe
]
})
export class ClaimsByTokenModule { }

View File

@ -1,81 +0,0 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import 'rxjs/add/operator/do';
import { CacheService } from '../../shared/cache.service';
import { CustomOptions } from '../claim-utils/service/customOptions.class';
@Injectable()
export class ClaimsByTokenService {
constructor(private http: Http, public _cache: CacheService) {}
getClaims(token: string, jwtToken: string):any {
console.info("getClaims in service");
let url = OpenaireProperties.getClaimsAPIURL()+"project/claims?projectToken="+token;
let key = url;
//if (this._cache.has(key)) {
// return Observable.of(this._cache.get(key));
//}
return this.http.get(url, CustomOptions.getAuthOptions())
//.map(res => <any> res.text())
.map(request => <any> request.json());
//.do(res => {
// this._cache.set(key, res);
//});
}
/*
getClaims(email: string, token: string, user_token: string):any {
let url = OpenaireProperties.getClaimsAPIURL(); // What else?
let body = JSON.stringify( {"email": email, "token": token} );
console.warn('Json body: : '+body);
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, options)
.map(res => res.json())
.do(request => console.info("Insert Response:"+request.status) )
.catch(this.handleError);
}
*/
updateClaimsCuration( selectedRight: Set<string>, selectedWrong: Set<string>) {
let url = OpenaireProperties.getClaimsAPIURL() + "curate/bulk";
let claimsCurationInfo: any = []; //e.g.: [{"id":"2","approved":true},{"id":"1","approved":true}]
selectedRight.forEach(function(selected) {
console.info(selected);
let claimCurationInfo: {"id": string, "approved": boolean} = {"id": selected, "approved": true};
claimsCurationInfo.push(claimCurationInfo);
});
selectedWrong.forEach(function(selected) {
let claimCurationInfo: any = {"id": selected, "approved": false};
claimsCurationInfo.push(claimCurationInfo);
});
console.info("\n\n"+claimsCurationInfo);
let body = JSON.stringify( claimsCurationInfo );
console.warn('Json body: : '+body);
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
.map(res => res.json())
.do(request => console.info("Insert Response:"+request.status) )
.catch(this.handleError);
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
}

View File

@ -1,19 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { DirectLinkingComponent } from './directLinking.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DirectLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]},
])
]
})
export class DirectLinkingRoutingModule { }

View File

@ -1,118 +0,0 @@
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container uk-margin-top">
<div class="uk-article-title">
Link
</div>
<div class="uk-width-1-1">
<helper position="top"></helper>
</div>
<div class="uk-grid helper-grid">
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
<div class="uk-width-expand">
<div *ngIf="validInput != null && !validInput" class="uk-alert uk-alert-warning" role="alert">No valid arguments provided in order to start linking openAIRE entities. </div>
<div *ngIf="validInput != null && validInput">
<!--div class="uk-clearfix">
<a class="uk-float-right" uk-toggle="target: #linkingInfo; animation: uk-animation-fade"><span class="uk-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
</span> More Information </a>
</div>
<div id="linkingInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
<a uk-toggle="target: #linkingInfo; animation: uk-animation-fade" class="uk-float-right"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></a>
<div class="uk-text-bold"><span class="uk-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
</span> Linking Functionality:</div>
<p>Through linking functioanilty you are able to create links from {{type}} to {{(linkTo =='context')?"communities/ concepts":((linkTo =='project')?"projects":"research results")}}. You have to select at least one {{(linkTo =='context')?"community/ concept":((linkTo =='project')?"project":"research result")}} in order to be able to proceed.</p>
<p *ngIf="linkTo=='project'"><span class="uk-text-bold">Projects:</span> Search & add projects using keyword search. Limit the search space by specifying project Funder. </p>
<p *ngIf="linkTo=='context'"><span class="uk-text-bold">Communities:</span> Search & add communities/ concepts by selecting community, category and using keyword search for . Or browse through the categories and add communities. </p>
<p *ngIf="linkTo=='result'"><span class="uk-text-bold">Research Results:</span> You can search for reasearch results (publication and/ or research data) to link, in openaire, crossref, Orcid, and/ or Datacite. Use search mode, to search and add results through keyword search. Use upload mode, to upload a list of DOIs of results. </p>
<p *ngIf="show=='claim' && linkTo=='result'"><span class="uk-text-bold">Review Metadata of research results:</span> The selected research results that came from 3rd party repositories (Datacite, Crossreff, Orcid), need review and change of metadata (such as access mode, and type) before they are included in openaire information space.
Please have in mind that ignoring this step, the research results will get the default values, that may be wrong.
</p>
</div-->
<div *ngIf=" ! (linkTo =='result' && show=='claim') " >
<div class="uk-clearfix">
<a class="uk-float-right" uk-toggle="target: #selected; animation: uk-animation-fade">
<span class="uk-icon"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="my-box" x="0px" y="0px" width="28px" height="28px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"><g> <path d="M480,320v128H32V320h78.859l64.016,96h162.25l64-96H480 M384,32H128L0,288v192h512V288L384,32L384,32z M35.781,288l112-224 h216.438l112,224H384l-64,96H192l-64.016-96H35.781L35.781,288z" fill="#b5b5b5"/></g>
</svg>
</span>
</a>
</div>
<div id="selected" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
<claim-selected-projects *ngIf=" linkTo == 'project' " title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType
(showChange)="showChange($event)" > </claim-selected-projects>
<claim-selected-contexts *ngIf=" linkTo == 'context' " title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [inlineEntity] = "inlineResult" [show]="show" [linkType]=linkType
(showChange)="showChange($event)" > </claim-selected-contexts>
<claim-selected-results *ngIf=" linkTo == 'result' " title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch=false showAccessRights=false>
</claim-selected-results>
</div>
</div>
<div class="uk-text-large">
Link {{(type=="project")?'Project':' Research result'}}:
</div>
<div class="uk-clearfix">
<!--start-over [results]="results" [contexts]="contexts" [projects]="projects" [linkTo]="linkTo" [type]="type" ></start-over-->
</div>
<!-- inline result -->
<div *ngIf="displayedResult != null && (type =='publication' || type =='dataset' )" class="uk-padding uk-panel uk-background-muted">
<div class="uk-width-1-1" >
<div>
<a *ngIf="displayedResult.url" target="_blank" href="{{displayedResult.url}}" > <span class="custom-external"></span> {{displayedResult.title}}</a>
<span *ngIf="!displayedResult.url" >{{displayedResult.title}}</span>
</div>
<div *ngIf="displayedResult.result.authors && displayedResult.result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of displayedResult.result.authors.slice(0,10) let i = index">{{author}}{{(i < (displayedResult.result.authors.slice(0,10).length-1))?"; ":""}}{{(i == displayedResult.result.authors.slice(0,10).length-1 && displayedResult.result.authors.length > 10)?"...":""}}</span></div>
</div>
</div>
<!-- inline project -->
<div *ngIf=" type == 'project' && projects.length > 0 " class="uk-padding uk-panel uk-background-muted">
{{projects[0].funderName}} | {{projects[0].projectName}} {{(projects[0].projectAcronym)?'('+projects[0].projectAcronym+')':''}}
</div>
<!-- search for entity -->
<div class = "uk-margin-top">
<claim-projects-search-form *ngIf=" linkTo =='project' " [(selectedProjects)]="projects" > </claim-projects-search-form>
<claim-contexts-search-form *ngIf=" linkTo =='context' " [(selectedList)]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineResult" > </claim-contexts-search-form>
<claim-result-search-form *ngIf=" linkTo =='result' && show!='claim' " [selectedResults]="results" > </claim-result-search-form>
</div>
<div *ngIf=" show == 'claim' " class="uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l ">
<claim-selected-results *ngIf=" linkTo =='result' " title= "Selected Research Results" [results]="results" [bulkMode]=false showSearch = false showAccessRights = true>
</claim-selected-results>
<div class="uk-width-1-1 uk-margin-small-top">
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [inlineEntity] = "inlineResult" [show] = "show"
(showChange)="showChange($event)" ></claim-insert>
</div>
</div>
<ul *ngIf="linkTo == 'result'" class="uk-pagination">
<li *ngIf="show == 'claim'" (click)="show='result';"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
<li *ngIf="show != 'claim'"(click)="show='claim';" class="uk-margin-auto-left">
<a>Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
</ul>
</div>
</div>
<helper position="right" styleName=" uk-width-1-5"></helper>
</div>
<helper position="bottom"></helper>
</div>
</div>
</div>
</div>

View File

@ -1,188 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import { Meta} from '../../../angular2-meta';
@Component({
selector: 'directLinking',
templateUrl: 'directLinking.component.html'
})
export class DirectLinkingComponent {
contexts=[];
projects=[];
results = [];
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
/* url Parameters for inline linking */
id:string = null; //entity id
type:string = null; // entity type (publication or dataset)
linkTo:string = null; // entity type (project or context or result)
entityTypes=["dataset", "publication", "project","context"];
inlineResult:ClaimResult =null;
displayedResult:ClaimResult =null;
sub:any =null;
show:string="claim"; //{claim,result}
validInput:boolean = null;//'true;
constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private _meta: Meta) {
this._meta.setTitle("OpenAIRE | Direct Linking");
}
ngOnInit() {
if(localStorage.getItem("projects")){
this.projects = JSON.parse(localStorage.getItem("projects"));
}
if(localStorage.getItem("contexts")){
this.contexts = JSON.parse(localStorage.getItem("contexts"));
}
if(localStorage.getItem("results")){
this.results = JSON.parse(localStorage.getItem("results"));
}
if(localStorage.getItem("results")){
this.results = JSON.parse(localStorage.getItem("results"));
}
if(localStorage.getItem("inlineEntity")){
this.inlineResult = JSON.parse(localStorage.getItem("inlineEntity"));
}
localStorage.removeItem("projects");
localStorage.removeItem("contexts");
localStorage.removeItem("results");
localStorage.removeItem("inlineEntity");
this.sub = this.route.queryParams.subscribe(params => {
this.id = params['id'];
this.type = params['type'];
this.linkTo = params['linkTo'];
if(this.type!=null && this.linkTo!=null){
this.type = (this.entityTypes.indexOf(this.type) != -1)? this.type:'publication';
this.linkTo = (this.entityTypes.indexOf(this.linkTo) != -1 || this.linkTo == "result")? this.linkTo:'project';
this.show = (this.linkTo != "result")?"claim":"result";
this.linkType = this.linkTo;
var isInlineResult:boolean = false; // is a link result - result
if((this.type == "publication" || this.type == "dataset") && ((this.linkTo == "publication" || this.linkTo == "dataset") || this.linkTo == "result" )){
isInlineResult = true;
}
if(this.type == "project"){
this.linkType = "project";
this.getProjectById(this.id);
}else if(this.type == "publication"){
this.getPublicationById(this.id,isInlineResult);
}else if(this.type == "dataset"){
this.getDatasetById(this.id,isInlineResult);
}else{
this.validInput = this.isValidInput(null);
}
}else{
this.validInput = this.isValidInput(null);
}
});
}
isValidInput(result){
if(result == null){
return false;
}else if(this.type == "project" && this.linkTo != "result"){
return false;
}else if(["dataset","publication"].indexOf(this.type) != -1 && (["project","context","result"].indexOf(this.linkTo) == -1)){
return false;
}else if(["project","dataset","publication"].indexOf(this.type) == -1){
return false;
}else{
return true;
}
}
getProjectById(id:string){
this.sub = this.entitySearch.fetchByType(id,"project").subscribe(
data => {
console.log(data);
var item =data[0];
var project: ClaimProject = new ClaimProject();
project.funderId = item.funderId;
project.funderName = item.funderName;
project.projectId = id;
project.projectName = item.projectName;
project.projectAcronym = item.projectAcronym;
project.startDate = item.startDate;
project.endDate = item.endDate;
project.code = item.code;
project.jurisdiction = item.jurisdiction;
project.fundingLevel0 = item.fundingLevel0;
this.projects.push( project);
this.validInput = this.isValidInput(project);
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
});
}
getPublicationById(id:string, isInlineResult:boolean){
this.sub = this.publicationsSearch.searchPublicationById(id).subscribe(
data => {
var item =data[0];
var result: ClaimResult = new ClaimResult();
result.id=id;
result.type="publication";
result.source="openaire";
result.title = item['title'].name;
result.url= item['title'].url;
result.result = item;
result.accessRights = item['title'].accessMode;
result.date = item.year;
this.displayedResult = result;
if(isInlineResult){
this.inlineResult = result;
}else{
this.results.push( result);
}
this.validInput = this.isValidInput(result);
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
});
}
getDatasetById(id:string, isInlineResult:boolean){
this.sub = this.datasetsSearch.searchDatasetById(id).subscribe(
data => {
var item =data[0];
var result: ClaimResult = new ClaimResult();
result.id=id;
result.type="dataset";
result.source="openaire";
result.title = item['title'].name;
result.url= item['title'].url;
result.result = item;
result.accessRights = item['title'].accessMode;
result.date = item.year; this.displayedResult = result;
if(isInlineResult){
this.inlineResult = result;
}else{
this.results.push( result);
}
this.validInput = this.isValidInput(result);
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
});
}
}

View File

@ -1,39 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { DirectLinkingComponent } from './directLinking.component';
import { DirectLinkingRoutingModule } from './directLinking-routing.module';
import {SelectedProjectsModule} from '../linking/selected/selectedProjects.module';
import {SelectedContextsModule} from '../linking/selected/selectedContexts.module';
import {SelectedPublicationsModule} from '../linking/selected/selectedResults.module';
import {InsertClaimsModule} from '../linking/insertClaim/insertClaim.module';
import {StartOverModule} from '../claim-utils/startOver.module';
import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {HelperModule} from '../../utils/helper/helper.module';
import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchForm.module';
import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module';
import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
SharedModule,
DirectLinkingRoutingModule,SelectedProjectsModule, SelectedContextsModule, SelectedPublicationsModule, InsertClaimsModule,
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, StartOverModule, HelperModule,
ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, ClaimResultSearchFormModule
],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [
DirectLinkingComponent
], exports:[DirectLinkingComponent]
})
export class DirectLinkingModule { }

View File

@ -1,256 +0,0 @@
import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.service';
import {SearchDataciteService} from '../../claim-utils/service/searchDatacite.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {Dates, DOI} from '../../../utils/string-utils.class';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import {ClaimResult} from '../../claim-utils/claimEntities.class';
@Component({
selector: 'bulk-claim',
template: `
<div class="uk-animation " style=" ">
<form class=" uk-padding uk-panel uk-background-muted ">
<div class="uk-clearfix">
<a class="uk-float-right" uk-toggle="target: #uploadInfo; animation: uk-animation-fade"><span class="uk-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
</span> What is upload mode? </a>
</div>
<div id="uploadInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></a>
<div class="uk-text-bold"><span class="uk-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
</span> Upload information:</div>
Upload a csv file containing a list of DOIs. For each DOI found in the file, metadata will be fetched from CrossRef or Datacite.
Available results will be added to your selected resarch results list in order to be linked with the selected Projects and Contexts.
<div class="uk-article-meta">
CSV format:
<ul class="uk-list">
<li>The format of CSV file should be "DOI","ACCESS_MODE","DATE".</li>
<li>The value "DOI" is required </li>
<li>Access mode column should have values: "OPEN","CLOSED" or "EMBARGO".</li>
<li>Date column valid format is YYYY-MM-DD and is required when access mode has value EMBARGO.</li>
<li>In case access mode is not available default value is "OPEN".</li>
</ul>
</div>
</div>
<div for="exampleInputFile">Upload a DOI csv file:</div>
<label for="exampleInputFile">Select a file</label>
<input id="exampleInputFile" class="uk-width-1-2" type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." />
<button class="uk-button uk-button-success" [class.disabled]="!enableUpload" type="button" (click)="upload()">Upload</button>
<div *ngIf="showReport" uk-alert class="uk-alert uk-alert-primary" role="alert" >
<a class="uk-alert-close" uk-close></a>
<div>Uploaded file contains {{allIds.length}} rows. {{foundIds.length}} results were sucefully fetched from CrossRef and Datacite.</div>
<div *ngIf ="duplicateIds.length > 0" >{{duplicateIds.length}} duplicate DOIs.</div>
<div *ngIf = "notFoundIds.length > 0" >Couldn't be found:
<ul class="">
<li *ngFor="let id of notFoundIds">"{{id}}"</li>
</ul>
</div>
<div *ngIf = "noValidIds.length > 0" >No valid DOIs:
<ul class="">
<li *ngFor="let id of noValidIds">"{{id}}"</li>
</ul>
</div>
<div *ngIf = "allIds.length == 0 || foundIds.length == 0" > Please make sure you are using the right format for the csv file... </div>
</div>
<div *ngIf="errorMessage.length > 0 " class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
<modal-loading [message]= "'Uploading, reading and fetching results from your document. Please give us a moment..'"></modal-loading>
</form>
</div>
`
})
//[(ngModel)]="date"
export class BulkClaimComponent {
filesToUpload: Array<File>;
navigateTo: string = "Search";
source: string = "crossref";
type : string = "publication";
resultsFromSearch:number;
@Input() public select:boolean = true ;
@Input() public results;
allIds:string[] = [];
foundIds:string[] = [];
duplicateIds:string[] = [];
notFoundIds:string[] = [];
noValidIds:string[] = [];
showReport:boolean = false;
showInfo :boolean = false;
@ViewChild (ModalLoading) loading : ModalLoading ;
errorMessage = "";
infoMEssage = "";
enableUpload:boolean = true;
constructor(private _searchCrossrefService: SearchCrossrefService, private _searchDataciteService: SearchDataciteService) {
this.filesToUpload = [];
}
ngOnInit() {}
upload() {
this.enableUpload = false;
this.showReport = false;
this.errorMessage = "";
if(this.filesToUpload.length == 0){
this.errorMessage = "There is no selected file to upload.";
return ;
}
this.loading.open();
this.makeFileRequest(OpenaireProperties.getUploadServiceUrl(), [], this.filesToUpload).then((result) => {
var rows = (result as any).split('\n'); // I have used space, you can use any thing.
var i = 0;
this.duplicateIds = [];
this.allIds = [];
this.foundIds = [];
this.noValidIds = [];
this.results.slice(0,this.results.length);
this.notFoundIds = [];
for(i=0;i<rows.length;i++){
if(rows[i] && rows[i] != null ){
console.log("Row is:" + rows[i]);
var values = rows[i].split(',');
var id=this.removeDoubleQuotes(values[0]);
if(DOI.isValidDOI(id)){
var accessMode = (values[1] != undefined) ? this.removeDoubleQuotes(values[1]):"OPEN";
accessMode = (this.validateAccessMode(accessMode)?accessMode:"OPEN");
var embargoDate =(values[2] != undefined) ? this.removeDoubleQuotes(values[2]):Dates.getDateToday();
embargoDate = (Dates.isValidDate(embargoDate)?embargoDate:Dates.getDateToday());
if(this.allIds.indexOf(id)>-1){
this.duplicateIds.push(id);
}else{
this.allIds.push(id);
this.fetchResult(id,accessMode,embargoDate);
}
}else{
this.noValidIds.push(id);
}
}
}
}, (error) => {
this.enableUpload = true;
console.log(error);
this.loading.close();
this.errorMessage = "An error occured while uploading...";
});
}
private removeDoubleQuotes(value){
if(value.indexOf('"')== 0){
value = value.substring(1,value.length);
}
var index =+value.indexOf('"');
if(index == (value.length - 1) || index == (value.length - 2) ){
value = value.substring(0,index);
}
return value;
}
private validateAccessMode(value){
var accessModes = ["OPEN", "CLOSED", "EMBARGO"];
if(accessModes.indexOf(value) > -1){
return true;
}
return false;
}
fileChangeEvent(fileInput: any){
this.filesToUpload = <Array<File>> fileInput.target.files;
}
makeFileRequest(url: string, params: Array<string>, files: Array<File>) {
return new Promise((resolve, reject) => {
var formData: any = new FormData();
var xhr = new XMLHttpRequest();
for(var i = 0; i < files.length; i++) {
formData.append("uploads[]", files[i], files[i].name);
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
resolve(xhr.response);
} else {
reject(xhr.response);
}
}
}
xhr.open("POST", url, true);
xhr.send(formData);
});
}
fetchResult(id:string,accessMode:string,date:string){
this._searchCrossrefService.searchCrossrefByDOIs([id]).subscribe(
data => {
var crossrefResult = data.items[0];
if(data.items.length > 0){
this.foundIds.push(id);
var result: ClaimResult = ClaimResult.generateResult(crossrefResult, id,"crossref","publication", crossrefResult.URL, crossrefResult.title, crossrefResult.created['date-time'], accessMode);
result.embargoEndDate = date;
this.results.push(result);
this.endOfFetching();
}else{
this.searchInDatacite(id,accessMode,date);
// this.notFoundIds.push(id);
}
},
err => {
console.log(err);
this.notFoundIds.push(id);
this.endOfFetching();
}
);
}
searchInDatacite(id:string,accessMode:string,date:string){
this._searchDataciteService.getDataciteResultByDOI(id).subscribe(
item => {
var dataciteResult = item.data;
if(dataciteResult != null && dataciteResult.attributes!= null ){
this.foundIds.push(id);
var result: ClaimResult = ClaimResult.generateResult(dataciteResult, id,"datacite","dataset", 'http://dx.doi.org/'+dataciteResult.attributes.doi, dataciteResult.attributes.title, dataciteResult.attributes.published, accessMode);
result.embargoEndDate = date;
this.results.push(result);
}else{
this.notFoundIds.push(id);
}
this.endOfFetching();
},
err => {
console.log(err);
this.notFoundIds.push(id);
this.endOfFetching();
}
);
}
endOfFetching(){
if(this.allIds.length == this.foundIds.length+this.notFoundIds.length+ this.duplicateIds.length ){
this.showReport = true;
this.enableUpload = true;
this.loading.close();
}
}
}

View File

@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
import {BulkClaimComponent} from './bulkClaim.component';
import {SearchCrossrefServiceModule} from '../../claim-utils/service/searchCrossrefService.module';
import {SearchDataciteServiceModule} from '../../claim-utils/service/searchDataciteService.module';
@NgModule({
imports: [
SharedModule, LoadingModalModule, SearchCrossrefServiceModule
],
declarations: [
BulkClaimComponent
], exports:[ BulkClaimComponent]
})
export class BulkClaimModule { }

View File

@ -1,16 +0,0 @@
// import {Component, Input} from '@angular/core';
// import {Observable} from 'rxjs/Observable';
//
// @Component({
// selector: 'bulk-linking',
// //providers: [MdRadioDispatcher],
// template: `
// <linking-generic [bulkMode]=true> </linking-generic>
// `
//
// })
// //[(ngModel)]="date"
// export class BulkLinkingComponent {
// constructor () {
// }
// }

View File

@ -1,20 +0,0 @@
// import { NgModule } from '@angular/core';
//
// import { SharedModule } from '../../shared/shared.module';
// import { BulkLinkingComponent } from './bulkLinking.component';
// import { BulkLinkingRoutingModule } from './bulkLinking-routing.module';
// import {LinkingGenericModule} from './linkingGeneric.module';
// import {BulkClaimModule} from './bulkClaim/bulkClaim.module';
// @NgModule({
// imports: [
// SharedModule,
// BulkLinkingRoutingModule,
// LinkingGenericModule,
// BulkClaimModule
//
// ],
// declarations: [
// BulkLinkingComponent
// ], exports:[BulkLinkingComponent]
// })
// export class BulkLinkingModule { }

View File

@ -1,369 +0,0 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Router} from '@angular/router';
import {ClaimsService} from '../../claim-utils/service/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert';
import {Md5} from 'ts-md5/dist/md5';
import {Session} from '../../../login/utils/helper.class';
import {ErrorCodes} from '../../../login/utils/guardHelper.class';
@Component({
selector: 'claim-insert',
template: `
<div *ngIf="errorMessage.length > 0">
<div class="uk-alert uk-alert-danger" role="alert" [innerHTML]="errorMessage"></div>
<div *ngIf="insertedClaims.length>0">There are {{insertedClaims.length}} claims, follow <a routerLinkActive="router-link-active" routerLink="/myclaims">the link</a> to manage your claims</div>
</div>
<div *ngIf="warningMessage.length > 0">
<div class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
</div>
<modal-loading [message]= "'Please wait...'"></modal-loading>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
<button *ngIf="!claiming && showButton" (click)="validateInsertions()" class="uk-button uk-button-primary uk-align-right" >Finish</button>
`
})
export class ClaimInsertComponent {
constructor (private claimService: ClaimsService, private _router:Router) {}
ngOnInit() {
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
}
@Input() public contexts;
@Input() public projects;
@Input() public results;
@Input() public showButton:boolean = true;
@Input() show='claim';
@Input() inlineEntity = null; // the entity from the landing page
@Output() showChange = new EventEmitter();
@ViewChild (ModalLoading) loading : ModalLoading ;
@ViewChild(AlertModal) alert;
public claiming =false;
public error = false;
public errorMessage = "";
public warningMessage = "";
public claimsTODO:number = 0;
public claims:number = 0;
private servicesRespond:number = 0;
private insertedClaims=[];
private errorInClaims=[];
private insertedRecords=[];
private errorInRecords=[];
public validateInsertions(){
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
if(this.validate()){
if(this.validateDates()){
this.insertActions();
return true;
}
}
return
}
private insertActions(){
this.servicesRespond = 0;
this.insertedClaims=[];
this.errorInClaims=[];
this.insertedRecords=[];
this.errorInRecords=[];
if(!Session.isValidAndRemove()){
this.showButton = false;
localStorage.setItem("projects", JSON.stringify(this.projects));
localStorage.setItem("contexts", JSON.stringify(this.contexts));
localStorage.setItem("results", JSON.stringify(this.results));
if(this.inlineEntity != null){
localStorage.setItem("inlineEntity", JSON.stringify(this.inlineEntity));
}
this._router.navigate(['/user-info'], { queryParams: { "errorCode": ErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
}else{
this.claiming = true;
var user=Session.getUserEmail();
this.loading.open();
var claims = [];
var directclaims = [];
if(this.results){
console.info("results: "+this.results.length);
for (var i = 0; i < this.results.length; i++) {
var result=this.results[i];
if(["crossref","datacite","orcid"].indexOf(result.source) != -1){
directclaims.push({"id":result.id, "record":this.createDirectClaim(result,this.projects,this.contexts)});
}
if(this.contexts){
for (var j = 0; j < this.contexts.length; j++) {
var context = this.contexts[j];
var claim = this.createContextClaim(result, context, user);
claims.push(claim);
}
}
if(this.projects){
for (var k = 0; k < this.projects.length; k++) {
var project = this.projects[k];
var projectClaim = this.createProjectClaim(result, project, user);
claims.push(projectClaim);
}
}
if(this.inlineEntity != null){
var resultClaim = this.createResultClaim(this.inlineEntity, result, user);
claims.push(resultClaim);
}
}
}
//first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
this.claimService.insertDirectRecords(directclaims).subscribe(
data => {
this.insertedRecords = data.insertedIds;
this.errorInRecords = data.errorInClaims;
this.isertBulkClaims(claims);
},
err => {
err=err.json();
if(err.insertedIds && err.insertedIds.length >0){
this.insertedRecords = err.insertedIds;
}
if(err.errorInClaims && err.errorInClaims.length >0){
this.errorInRecords = err.errorInClaims;
}
this.isertBulkClaims(claims);
}
);
}
}
private isertBulkClaims(claims){
console.info("try to insert "+claims.length+" claims");
this.claimService.insertBulkClaims(claims).subscribe(
data => {
this.insertedClaims = data.insertedIds;
this.errorInClaims = data.errorInClaims;
this.afterclaimsInsertion();
},
err => {
err=err.json();
if(err.insertedIds && err.insertedIds.length >0){
this.insertedClaims = err.insertedIds;
}
if(err.errorInClaims && err.errorInClaims.length >0){
this.errorInClaims = err.errorInClaims;
}
this.afterclaimsInsertion();
}
);
}
private validate(){
this.warningMessage = "";
this.errorMessage = "";
if( this.results && this.results.length == 0){
this.warningMessage = "There are no research results selected.";
}else if((!this.contexts|| this.contexts.length==0 )&&(!this.projects|| this.projects.length==0 )&& ( this.inlineEntity == null)){
this.warningMessage = "There are no projects or communities to link.";
// }else if (this.inline && !this.inlineEntity){
// this.errorMessage = "No inline entity";
// console.log(this.inline + " "+ this.inlineEntity);
}else{
return true;
}
return false;
}
private validateDates(){
if(this.projects){
for (var k = 0; k < this.projects.length; k++) {
var project = this.projects[k];
console.info(project.startDate+" "+project.endDate + " "+project.projectAcronym);
if(this.results){
for (var i = 0; i < this.results.length; i++) {
var result = this.results[i];
if(result.date && result.date != null){
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
if((project.startDate && result.date < project.startDate) || ( project.endDate && result.date > (project.endDate+5)) ){
this.confirmOpen();
return false;
}
}
}
}
}
}
if(this.results){
for (var i = 0; i < this.results.length; i++) {
var result = this.results[i];
if(result.date && result.date != null){
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
if((result.embargoEndDate && result.embargoEndDate != null) && result.date >result.embargoEndDate ){
this.confirmOpen();
return false;
}
}
}
}
return true;
}
private afterclaimsInsertion(){
// this.servicesRespond++;
// if(this.servicesRespond == 2){
this.loading.close();
this.claiming = false;
if(this.errorInClaims.length == 0 && this.insertedClaims.length > 0 && this.errorInRecords.length == 0){
this._router.navigate( ['/myclaims'] );
this.showChange.emit({
value: this.show
});
}else{
this.errorsInClaimsInsertion();
}
// }
}
private errorsInClaimsInsertion(){
this.errorMessage = "";
this.loading.close();
this.error = true;
this.claiming = false;
this.showButton = false;
var text =""
console.log("Errors: this.errorInRecords.length: "+this.errorInRecords.length+" - this.errorInClaims.length: "+this.errorInClaims.length);
if(this.errorInRecords.length>0){
text+="<div>The following records couldn't automatically inserted to the Openaire Info space: <ul>";
for(var i=0; i< this.errorInRecords.length ; i++){
for(var k=0; k< this.results.length ; k++){
if(this.results[k].id == this.errorInRecords[i]){
text+="<li>"+this.results[i].title+" from "+this.results[i].source+"</li>";
}
}
}
text+="</ul></div>";
}
if(this.errorInClaims.length > 0){
text+="<div>The following links couldn't be saved: <ul>";
for(var i=0; i< this.errorInClaims.length ; i++){
// var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"no", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)};
text+="<li>"+this.errorInClaims[i].sourceType+": "+this.errorInClaims[i].sourceId +"(from "+this.errorInClaims[i].sourceCollectedFrom+") link to "+this.errorInClaims[i].targetType+": "+this.errorInClaims[i].targetId +"(from "+this.errorInClaims[i].targetCollectedFrom+") </li>";
}
text+="</ul></div>";
}
this.errorMessage+="<div>An error occured:</div>"+text;
console.log(text);
// if(this.inline){
// this.show = "error";
// this.showChange.emit({
// value: this.show
// });
// }
}
private createContextClaim(result:any, context:any, user:any){
var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"no", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)};
return claim;
}
private createProjectClaim(result:any, project:any, user:any){
//project.projectId
// var dummyID = "dummyID";
var claim = { claimedBy : user, sourceId : project.projectId, sourceType : "project", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)};
return claim;
}
private createResultClaim(inlineResult:any, result:any, user:any){
var claim = { claimedBy : user, sourceId : result.id, sourceType : result.type, sourceCollectedFrom: result.source, sourceAccessRights: result.accessRights, sourceEmbargoEndDate: result.embargoEndDate, targetId : inlineResult.id , targetType : inlineResult.type, targetCollectedFrom: inlineResult.source, targetAccessRights: inlineResult.accessRights, targetEmbargoEndDate: (inlineResult.embargoEndDate == null?"":inlineResult.embargoEndDate)};
return claim;
}
createDirectClaim(result, projects, contexts){
var entity = {};
var md5_id = Md5.hashStr(result.id);
entity["originalId"]="userclaim___::"+md5_id;
entity["openaireId"]="userclaim___::"+md5_id;
entity["title"]=result.title;
entity["title"] =(Array.isArray(result.title) && result.title.length > 0 )?result.title[0]:result.title;
if(result.authors && result.authors.length > 0){
entity["authors"]=result.authors;
}
if(result.publisher){
entity["publisher"]=result.publisher;
}
if(result.description){
entity["description"]=result.description;
}
// entity["language"]=""; no info
entity["type"]=result.type;
if(result.source == "crossref" || result.source == "datacite"){
entity["pids"]= [];//{type:string, value:string}[];
entity["pids"].push({type:"doi",value:result.id})
}
entity["licenseCode"]=result.accessRights;
if(result.accessRights == "EMBARGO"){
entity["embargoEndDate"]=result.embargoEndDate;
}
if(result.type =="publication"){
entity["resourceType"]="0001";
}else{
entity["resourceType"]="0021";
}
entity["url"]=result.url;
entity["hostedById"]="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18";
if(result.source == "crossref"){
entity["collectedFromId"]="openaire____::crossref";
}else if(result.source == "datacite"){
entity["collectedFromId"]="openaire____::datacite";
}else if(result.source == "orcid"){
entity["collectedFromId"]="openaire____::orcid";
}else if(result.source == "orpenaire"){
entity["collectedFromId"]="openaire____::driver";
}
if(projects.length>0){
entity["linksToProjects"]=[];
for(var i =0; i < projects.length; i++){
// "info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
entity["linksToProjects"].push("info:eu-repo/grantAgreement/"+projects[i].funderName+"/"+projects[i].fundingLevel0+"/"+projects[i].code+"/"+projects[i].jurisdiction+"/"+projects[i].projectName+"/"+projects[i].projectAcronym);
}
}
if(contexts.length > 0){
entity["contexts"]=[];
for(var i =0; i < contexts.length; i++){
entity["contexts"].push(contexts[i].concept.id);
}
}
var json = JSON.stringify(entity);
console.log("\nJSON:\n"+json);
return entity;
}
confirmOpen(){
this.alert.cancelButton = true;
this.alert.okButton = true;
this.alert.alertTitle = "Invalid dates";
this.alert.message = "There is a research result whose publication date is after project end date or before project start date. Or embargo end date of a research result is before research result's publication date.";
this.alert.okButtonText = "Proceed anyway";
this.alert.cancelButtonText = "Cancel";
this.alert.open();
}
confirmClose(data){
this.insertActions();
}
}

View File

@ -1,16 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
import {ClaimInsertComponent} from './insertClaim.component';
import {ClaimServiceModule} from '../../claim-utils/service/claimsService.module';
@NgModule({
imports: [
SharedModule, AlertModalModule, LoadingModalModule, ClaimServiceModule
],
declarations: [ClaimInsertComponent],
exports:[ ClaimInsertComponent]
})
export class InsertClaimsModule { }

View File

@ -1,19 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { LinkingGenericComponent } from './linkingGeneric.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: LinkingGenericComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]},
])
]
})
export class LinkingRoutingModule { }

View File

@ -1,16 +0,0 @@
// import {Component, Input} from '@angular/core';
// import {Observable} from 'rxjs/Observable';
// import {LinkingGenericComponent} from './linkingGeneric.component';
//
// @Component({
// selector: 'linking',
// template: `
// <linking-generic [bulkMode]=false> </linking-generic>
// `
//
// })
// export class LinkingComponent {
// constructor () {
// }
//
// }

View File

@ -1,144 +0,0 @@
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container uk-margin-top">
<div class="uk-article-title">
Link
</div>
<div class="uk-width-1-1">
<helper position="top"></helper>
</div>
<div class="uk-grid helper-grid">
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
<div class="uk-width-expand">
<ul class="uk-breadcrumb">
<li [class]="(step==1)?'uk-active':''" ><a (click)="step=1;"><span class="step uk-text-large">1</span> Select Projects <span >or Communities <span ></span></span></a></li>
<li [class]="(step==2)?'uk-active':''" ><a (click)="step=2;"><span class="step uk-text-large">2</span> Select Research Results <span ></span></a></li>
<li [class]="(step==3)?'uk-active':''" (click)="step=3;"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" ><span class="step uk-text-large">3</span> Review metadata</a></li>
</ul>
<!--start-over [results]="results" [contexts]="contexts" [projects]="projects" ></start-over-->
<div class="uk-clearfix">
<a class="uk-float-right" uk-toggle="target: #selected; animation: uk-animation-fade">
<span class="uk-icon"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="my-box" x="0px" y="0px" width="28px" height="28px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"><g> <path d="M480,320v128H32V320h78.859l64.016,96h162.25l64-96H480 M384,32H128L0,288v192h512V288L384,32L384,32z M35.781,288l112-224 h216.438l112,224H384l-64,96H192l-64.016-96H35.781L35.781,288z" fill="#b5b5b5"/></g>
</svg>
</span>
</a>
</div>
<div id="selected" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
<!--Close Button -->
<!--div class="uk-clearfix">
<a uk-toggle="target: #selected; animation: uk-animation-fade" class="uk-float-right">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></a>
</div-->
<claim-selected-projects title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType
(showChange)="showChange($event)" > </claim-selected-projects>
<claim-selected-contexts title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [inlineEntity] = "inlineResult" [show]="show" [linkType]=linkType
(showChange)="showChange($event)" > </claim-selected-contexts>
<claim-selected-results *ngIf="step!=3" title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch=false showAccessRights=false>
</claim-selected-results>
</div>
<!--ul class="uk-pagination uk-margin-remove-bottom">
<li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
<li *ngIf="show != 'claim' " (click)="next()" class="uk-margin-auto-left"><a>Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
<li *ngIf="show == 'claim' " (click)="next()" class="uk-margin-auto-left">
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [show] = "show"
(showChange)="showChange($event)" ></claim-insert>
</li>
</ul-->
<!-- link with Projects & Contexts -->
<!--div class="uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-grid">
<div class="uk-width-1-1@s uk-width-1-2@m uk-width-1-2@l uk-width-1-2@xl "-->
<div *ngIf="step==1">
<ul class=" uk-tab " uk-tab="connect: #tabs; animation: uk-animation-fade">
<li>
<a>Projects ({{projects.length}})</a>
</li>
<li>
<a>Communities ({{contexts.length}})</a>
</li>
</ul>
<ul id="tabs" class="uk-switcher uk-margin-left uk-width-1-1">
<li>
<!--claim-selected-projects title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType
(showChange)="showChange($event)" > </claim-selected-projects-->
<claim-projects-search-form [(selectedProjects)]="projects" > </claim-projects-search-form>
</li>
<li>
<!--claim-selected-contexts title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [inlineEntity] = "inlineResult" [show]="show" [linkType]=linkType
(showChange)="showChange($event)" > </claim-selected-contexts-->
<claim-contexts-search-form [(selectedList)]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineResult" > </claim-contexts-search-form>
</li>
<!--/div>
<div class="uk-width-1-1@s uk-width-1-2@m uk-width-1-2@l uk-width-1-2@xl "-->
</ul>
</div>
<!--/div-->
<!--/div-->
<!--hr-->
<!-- Research Results -->
<div *ngIf="step==2 ">
<div class="uk-width-1-1 ">
<div class=" uk-padding-small uk-padding-remove-bottom uk-panel uk-background-muted ">
<span *ngIf="bulkMode" class=" uk-animation uk-float-right">
<span title= "Bulk mode"><i class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="upload" ratio="1"><polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></i></span>
<a title= "Switch to Search mode" (click)="bulkMode = !bulkMode;"> <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
</span></a>
</span>
<span *ngIf="!bulkMode" class=" uk-animation uk-float-right">
<a title= "Switch to Bulk mode" (click)="bulkMode = !bulkMode;"><i class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="upload" ratio="1"><polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></i></a>
<span title= "Search mode"> <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
</span></span>
</span>
</div>
<claim-result-search-form *ngIf="!bulkMode" [selectedResults]="results" > </claim-result-search-form>
<bulk-claim *ngIf="bulkMode" [results]="results" > </bulk-claim>
</div>
</div>
<div *ngIf="step==3" class="uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l">
<claim-selected-results title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch = false showAccessRights = true>
</claim-selected-results>
</div>
<ul class="uk-pagination">
<li *ngIf="step !=1 " (click)="step=step-1;"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
<!--li *ngIf="show != 'claim' && this.results.length > 0 " (click)="canProceedToMetadata()" class="uk-margin-auto-left"><a> Review Metadata <span class="uk-margin-small-left" uk-pagination-next></span></a></li-->
<li *ngIf="step !=3 " (click)="step=step + 1;" class="uk-margin-auto-left">
<a>Next <span class="uk-margin-small-left" uk-pagination-next></span></a>
</li>
<li *ngIf=" step == 3 " (click)="next()" class="uk-margin-auto-left uk-width-1-1">
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [show] = "show"
(showChange)="showChange($event)" ></claim-insert>
</li>
</ul>
</div>
<helper position="right" styleName=" uk-width-1-5"></helper>
</div>
<helper position="bottom"></helper>
</div>
</div>
</div>
</div>

View File

@ -1,117 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import { Meta} from '../../../angular2-meta';
declare var UIkit:any;
@Component({
selector: 'linking-generic',
templateUrl: 'linkingGeneric.component.html'
})
export class LinkingGenericComponent {
@Input() bulkMode: boolean = false;
sourceType:string;
targetType:string;
step:number = 1;
contexts=[];
projects=[];
results = [];
show = "project";
date='8-6-2016';
keyword: string = "";
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
/* url Parameters for inline linking */
id:string = null; //entity id
type:string = null; // entity type (publication or research data)
linkTo:string = null; // entity type (project or context or result)
entityTypes=["dataset", "publication", "project","context"];
inlineResult:ClaimResult =null;
sub:any =null;
constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private _meta: Meta) {
this._meta.setTitle("OpenAIRE | Linking");
}
ngOnInit() {
if( typeof localStorage !== 'undefined') {
if(localStorage.getItem("projects")){
this.projects = JSON.parse(localStorage.getItem("projects"));
}
if(localStorage.getItem("contexts")){
this.contexts = JSON.parse(localStorage.getItem("contexts"));
}
if(localStorage.getItem("results")){
this.results = JSON.parse(localStorage.getItem("results"));
}
localStorage.removeItem("projects");
localStorage.removeItem("contexts");
localStorage.removeItem("results");
}
}
next(){
if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
this.show='claim';
}
}
prev(){
if(this.show == 'claim'){
this.show='result';
}
}
resultsChange($event) {
this.results=$event.value;
}
projectsChange($event) {
this.projects=$event.value;
}
linkTypeChange($event) {
this.linkType =$event.value;
this.show="result";
if(this.bulkMode){
this.show="claim";
}
}
showChange($event) {
this.show=$event.value;
this.showChangedType($event.value);
}
showChangedType(type:string) {
this.show=type;
if(this.show == 'project' || this.show == 'context' || this.show == 'software'){
this.linkType = this.show;
}
}
canProceedToMetadata(){
if(this.results.length == 0){
UIkit.notification({
message : 'No research results selected!<br>Please select research results to link with projects and/ or ommunities.',
status : 'warning',
timeout : 1000,
pos : 'top-center'
});
}else{
this.show = 'claim';
this.step = 3;
}
}
}

View File

@ -1,37 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import {SelectedProjectsModule} from './selected/selectedProjects.module';
import {SelectedContextsModule} from './selected/selectedContexts.module';
import {SelectedPublicationsModule} from './selected/selectedResults.module';
import {InsertClaimsModule} from './insertClaim/insertClaim.module';
import {LinkingGenericComponent} from './linkingGeneric.component';
import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import { LinkingRoutingModule } from './linking-routing.module';
import {StartOverModule} from '../claim-utils/startOver.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchForm.module';
import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module';
import {BulkClaimModule} from './bulkClaim/bulkClaim.module';
import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module';
import {HelperModule} from '../../utils/helper/helper.module';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
SharedModule, SelectedProjectsModule, SelectedContextsModule,
SelectedPublicationsModule,
InsertClaimsModule,
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule,
ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, BulkClaimModule, ClaimResultSearchFormModule, HelperModule
],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [
LinkingGenericComponent
], exports:[
LinkingGenericComponent ]
})
export class LinkingGenericModule { }

View File

@ -1,90 +0,0 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimContext} from '../../claim-utils/claimEntities.class';
@Component({
selector: 'claim-selected-contexts',
template: `
<!-- Contexts -->
<div class="uk-placeholder" >
<!--div class="uk-width-1-2 ">
<div class="uk-clearfix"><button *ngIf=" !showsearch " (click)="showsearch = true;" class="uk-button uk-button-default uk-animation uk-float-right">Add more <span><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span></button></div>
<claim-contexts-search-form *ngIf=" showsearch " [selectedList]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineEntity" > </claim-contexts-search-form>
</div-->
<div *ngIf="contexts.length > 0 " class=" ">
<h3 > Selected Communities ({{contexts.length}}) </h3>
<ul class="uk-list uk-list-divider">
<li class="list-group-item" *ngFor="let context of contexts" >
<span *ngIf="context.community != context.concept.label">{{context.community }} > {{context.category}} ></span><span> {{context.concept.label}} </span>
<span (click)="removeContext(context)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span>
</li>
</ul>
</div>
<div *ngIf="contexts.length == 0 " class="uk-text-center">There are no selected communities</div>
</div>
`
})
export class ClaimSelectedContextsComponent {
ngOnInit() {
var myDate = new Date();
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
//2015-05-01
// if(this.linkType == "context"){
this.showsearch = true
// }else{
// this.showsearch = false;
// }
}
@Input() contexts:ClaimContext[];
//The following need to be kept in case we have to save the current state
@Input() public projects;
@Input() public results;
@Input() public inlineEntity;
@Input() componentClass:string = ""; //"" or "col-sm-6" for horizontal display (besides projects)
@Input() show='home';
@Input() title='Communities';
@Input() linkType:string = "project";
@Input() hideType;
@Input() bulkMode:boolean = false;
@Output() showChange = new EventEmitter();
showsearch:boolean = false;
todayDate = '';
nextDate = '';
showType(type){
if(type != this.show){
this.show = type;
this.showChange.emit({
value: this.show
});
}
}
removeContext(item:any){
var index:number =this.contexts.indexOf(item);
if (index > -1) {
this.contexts.splice(index, 1);
}
}
contextSelected($event) {
// this.showsearch = false;
}
}

View File

@ -1,16 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedContextsComponent} from './selectedContexts.component';
// import {ClaimContextSearchFormModule} from '../../claim-utils/claimContextSearchForm.module';
@NgModule({
imports: [
SharedModule,
// ClaimContextSearchFormModule
],
declarations: [
ClaimSelectedContextsComponent
], exports:[ClaimSelectedContextsComponent]
})
export class SelectedContextsModule { }

View File

@ -1,88 +0,0 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
import {ClaimProject} from '../../claim-utils/claimEntities.class';
import {RouterHelper} from '../../../utils/routerHelper.class';
@Component({
selector: 'claim-selected-projects',
template: `
<div class="uk-placeholder" >
<!--div class="uk-width-1-2 ">
<!--div class="uk-clearfix"><button *ngIf=" !showsearch " (click)="showsearch = true;" class="uk-button-default uk-float-right uk-animation ">Add more <span><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span></button></div>
<claim-projects-search-form *ngIf=" showsearch " [selectedProjects]="projects" (projectSelected)="projectSelected($event)" > </claim-projects-search-form>
</div>
<div class="uk-width-1-2 "-->
<div>
<h3 *ngIf="projects.length > 0 "> Selected Projects ({{projects.length}}) </h3>
<ul class="uk-list uk-list-divider">
<li class="list-group-item" *ngFor="let project of projects">
<a [queryParams]="routerHelper.createQueryParam('projectId',project.projectId)" routerLinkActive="router-link-active" routerLink="/search/project" >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></a>
<span (click)="removeProject(project)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span>
</li>
</ul>
</div>
<div *ngIf="projects.length == 0 " class="uk-text-center">There are no selected projects</div>
</div>
`
})
export class ClaimSelectedProjectsComponent {
ngOnInit() {
var myDate = new Date();
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
// if(this.linkType == "project"){
this.showsearch = true
// }else{
// this.showsearch = false;
// }
//2015-05-01
}
@Input() projects: ClaimProject[];
@Input() show='home';
@Input() title='Projects';
@Input() linkType:string = "project";
@Input() hideType;
@Input() bulkMode:boolean = false;
@Input() linkToResults:boolean = true;
@Output() projectsChange = new EventEmitter();
@Output() showChange = new EventEmitter();
showsearch:boolean = false;
todayDate = '';
nextDate = '';
public routerHelper:RouterHelper = new RouterHelper();
removeProject(item:any){
var index:number =this.projects.indexOf(item);
if (index > -1) {
this.projects.splice(index, 1);
}
this.projectsChange.emit({
value: this.projects
});
}
showType(type){
if(type != this.show){
this.show = type;
this.showChange.emit({
value: this.show
});
}
}
projectSelected($event) {
// this.showsearch = false;
}
}

View File

@ -1,18 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedProjectsComponent} from './selectedProjects.component';
// import {ClaimProjectsSearchFormModule} from '../../claim-utils/claimProjectSearchForm.module';
@NgModule({
imports: [
SharedModule, RouterModule,
// ClaimProjectsSearchFormModule
],
declarations: [
ClaimSelectedProjectsComponent
], exports:[ClaimSelectedProjectsComponent]
})
export class SelectedProjectsModule { }

View File

@ -1,224 +0,0 @@
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {AlertModal} from '../../../utils/modal/alert';
import {ClaimResult} from '../../claim-utils/claimEntities.class';
import {IMyOptions, IMyDateModel} from '../../../utils/my-date-picker/interfaces/index';
import {Dates} from '../../../utils/string-utils.class';
@Component({
selector: 'claim-selected-results',
template: `
<!--div *ngIf="showSearch " class="uk-width-1-2 ">
<div class="uk-clearfix"><a (click)="bulkMode = !bulkMode;" class=" uk-animation uk-float-right">
<span *ngIf="!bulkMode">Switch to Upload mode <i class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="upload" ratio="1"><polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></i></span>
<span *ngIf="bulkMode">Switch to Search mode <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
</span></span>
</a></div>
<claim-result-search-form *ngIf="!bulkMode" [selectedResults]="results" > </claim-result-search-form>
<bulk-claim *ngIf="bulkMode" [results]="results" > </bulk-claim>
</div-->
<div class="uk-placeholder" >
<div *ngIf="results.length == 0 " class="uk-text-center">There are no selected research results</div>
<div *ngIf="results.length > 0 ">
<h3 > {{title}} ({{results.length}}) </h3>
<table class="uk-table uk-table-responsive">
<thead *ngIf="showAccessRights">
<tr>
<th> Research Result</th>
<th> Change type and access mode</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let pub of results" >
<td >
<div>
<span *ngIf="showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span>
<a *ngIf="pub.url" target="_blank" href="{{pub.url}}" > <span class="custom-external"></span> {{pub.title}}</a>
<span *ngIf="!pub.url" >{{pub.title}}</span>
<span *ngIf="!showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span>
</div>
<span *ngIf="pub.publisher" >Publisher: {{pub.publisher}}</span>
<!--Orcid --><span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " >Journal: {{pub.result['journal-title'].value}}</span>
<span *ngIf="pub.date" >({{pub.date.substring(0,4)}})</span>
<div *ngIf="pub.authors && pub.authors.length > 0" >Authors: <span *ngFor="let author of pub.authors.slice(0,10) let i = index">{{author}}{{(i < (pub.authors.slice(0,10).length-1))?"; ":""}}{{(i == pub.authors.slice(0,10).length-1 && pub.authors.length > 10)?"...":""}}</span></div>
<!-- Crossref -->
<!--span *ngIf="pub.result.publisher" class="uk-article-meta">Publisher: {{pub.result.publisher}}</span><span *ngIf="pub.date" class="uk-article-meta" >({{pub.date.substring(0,4)}})</span>
<div *ngIf="pub.result.author && pub.result.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.author.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.author.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.author.slice(0,10).length-1 && pub.result.author.length > 10)?"...":""}}</span></div-->
<div *ngIf="pub.result.editor && pub.result.editor.length > 0" >Editors: <span *ngFor="let author of pub.result.editor.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.editor.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.editor.slice(0,10).length-1 && pub.result.editor.length > 10)?"...":""}}</span></div>
<!-- Openaire -->
<div *ngIf="pub.result.authors && pub.result.authors.length >0 " >Authors: <span *ngFor="let author of pub.result.authors.slice(0,10) let i = index">{{author}}{{(i < (pub.result.authors.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.authors.slice(0,10).length-1 && pub.result.authors.length > 10)?"...":""}}</span></div>
<!-- Orcid -->
<!--span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " class="uk-article-meta">Journal: {{pub.result['journal-title'].value}}</span>
<div *ngIf="pub.result.contributors && pub.result.contributors.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.contributors.slice(0,10) let i = index">{{author}}{{(i < (pub.result.contributors.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.contributors.slice(0,10).length-1 && pub.result.contributors.length > 10)?"...":""}}</span></div-->
<!-- Datacite -->
<!--span *ngIf="pub.result.attributes['container-title']" class="uk-article-meta">Publisher: {{pub.result.attributes['container-title']}}</span><span *ngIf="pub.date" class="uk-article-meta" >({{pub.date.substring(0,4)}})</span>
<div *ngIf="pub.result.attributes.author && pub.result.attributes.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.attributes.author.slice(0,10) let i = index">{{(author.family)?author.family+', '+author.given:author.literal}}{{(i < (pub.result.attributes.author.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.attributes.author.slice(0,10).length-1 && pub.result.attributes.author.length > 10)?"...":""}}</span></div-->
<div><span class="uk-label">{{pub.source}}</span>
<span *ngIf="pub.accessRights" class=" uk-label label-grey" > {{pub.accessRights}}</span>
<span *ngIf="pub.type" class="uk-label label-grey" > {{pub.type}}</span>
</div>
</td>
<td *ngIf="showAccessRights && pub.source != 'openaire' " >
<select [(ngModel)]="pub.type" name="{{'select_type_'+pub.id}}" >
<option [value]="'publication'" (click)="onTypeChanged('publication',pub)" >Publication</option>
<option [value]="'dataset'" (click)="onTypeChanged('dataset',pub)" >Research Data</option>
</select>
<select [(ngModel)]="pub.accessRights" name="{{'select_rights_'+pub.id}}" >
<option *ngFor="let type of accessTypes" [value]="type" (click)="accessRightsTypeChanged(type,pub)">{{type}}</option>
</select>
<my-date-picker *ngIf="pub.accessRights== 'EMBARGO'" name="{{'date'+pub.id}}" [options]="myDatePickerOptions"
[(ngModel)]="nextDate" (dateChanged)="onDateChanged($event,pub)" ></my-date-picker>
</td>
<td *ngIf="showAccessRights && pub.source == 'openaire' " >
Currently you cannot change metadata from OpenAIRE
</td>
</tr>
</tbody>
</table>
<div>
<modal-alert (alertOutput)="confirmClose($event)">
</modal-alert>
</div>
</div>
</div>
`
})
export class ClaimSelectedResultsComponent {
ngOnInit() {
var myDate = new Date();
this.nextDate = { date: { year: myDate.getFullYear()+10, month: (myDate.getMonth()+1), day: myDate.getDate() } };
//2015-05-01
}
@Input() results: ClaimResult[];
@Input() title:string = "Research Results";
@Input() showAccessRights:boolean = false;
@Input() bulkMode:boolean = false;
// @Output()resultsChange = new EventEmitter();
@Input() showSearch:boolean = false;
nextDate = {};
@ViewChild(AlertModal) alertApplyAll;
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every result
public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when user apply a change to every result
public commonType; // for research result type - changes when user apply a change to every result
public typeChanged:boolean = true; //
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
private myDatePickerOptions: IMyOptions = {
// other options...
dateFormat: 'yyyy-mm-dd',
selectionTxtFontSize: '15px',
height:'28px',
width: '100%',
editableDateField: false,
showClearDateBtn: false
};
removePublication(item:any){
var index:number =this.results.indexOf(item);
if (index > -1) {
this.results.splice(index, 1);
}
// this.resultsChange.emit({
// value: this.results
// });
}
onDateChanged (event:any, item:any) {
item.embargoEndDate = Dates.getDateFromString(event.formatted);
if(this.results.length > 1 ){
this.commonAccessRights = "EMBARGO";
this.commonEmbargoEndDate = item.embargoEndDate;
this.confirmOpen(false,"Do you wish to apply the change to every result?");
}
}
onTypeChanged (event:any, item:any) {
item.type =(event);
if(this.results.length > 1 ){
this.commonType = item.type;
this.confirmOpen(true, "Do you wish to apply the change to every result?");
}
}
// resultsChanged($event) {
// this.results=$event.value;
// this.resultsChange.emit({
// value: this.results
// });
// }
/* The following methods:
*typeChanged
*confirmOpen
*confirmClose
implement the functionality: change accessRights of a publication - apply to all if asked */
accessRightsTypeChanged (type:any, item:any) {
item.accessRights = type;
if(this.results.length > 1 ){
this.commonAccessRights = type;
if(this.commonAccessRights != "EMBARGO"){
this.commonEmbargoEndDate = item.embargoEndDate;
this.confirmOpen(false, "Do you wish to apply the change to every result?");
}
}
}
confirmOpen(type: boolean, message: string){
this.typeChanged = type;
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = true;
this.alertApplyAll.alertTitle = "Change metadata";
this.alertApplyAll.message = "Do you wish to apply the change to every result?";
this.alertApplyAll.okButtonText = "Yes";
this.alertApplyAll.cancelButtonText = "No";
this.alertApplyAll.open();
}
confirmClose(data){
if(this.typeChanged){
for (var i = 0; i < this.results.length; i++) {
if(this.results[i].source != 'openaire' ){
this.results[i].type = this.commonType;
}
}
}else{
for (var i = 0; i < this.results.length; i++) {
if(this.results[i].source != 'openaire' ){
this.results[i].accessRights = this.commonAccessRights;
if(this.commonAccessRights == "EMBARGO"){
this.results[i].embargoEndDate = this.commonEmbargoEndDate;
}
}
}
}
}
}

View File

@ -1,21 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedResultsComponent} from './selectedResults.component';
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
import { MyDatePickerModule } from '../../../utils/my-date-picker/my-date-picker.module';
// import {BulkClaimModule} from '../bulkClaim/bulkClaim.module';
// import {ClaimResultSearchFormModule} from '../../claim-utils/claimResultSearchForm.module';
@NgModule({
imports: [
SharedModule,
AlertModalModule,
MyDatePickerModule,
// BulkClaimModule, ClaimResultSearchFormModule,
],
declarations: [
ClaimSelectedResultsComponent
], exports:[ClaimSelectedResultsComponent]
})
export class SelectedPublicationsModule { }

View File

@ -1,16 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { MyClaimsComponent } from './myClaims.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: MyClaimsComponent, canActivate: [IsRouteEnabled, LoginGuard],
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class MyClaimsRoutingModule { }

View File

@ -1,36 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Meta} from '../../../angular2-meta';
@Component({
selector: 'my-claims',
template: `
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container uk-margin-top">
<div class="uk-article-title">
My Claims
</div>
<div>
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
<displayClaims [enableDelete]=true [myClaims]=true [isAdmin]=false [showUserEmail]=false ></displayClaims>
</div>
</div>
</div>
</div>
</div>
`
})
export class MyClaimsComponent {
constructor ( private _meta: Meta ) {
this._meta.setTitle("OpenAIRE | My Claims");
}
ngOnInit() {
}
}

View File

@ -1,25 +0,0 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { MyClaimsComponent } from './myClaims.component';
import { MyClaimsRoutingModule } from './myClaims-routing.module';
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
SharedModule,
MyClaimsRoutingModule,
// ClaimServiceModule,
DisplayClaimsModule
],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [
MyClaimsComponent
]
})
export class MyClaimsModule { }

View File

@ -1,51 +0,0 @@
// import {Component, Input} from '@angular/core';
// import {Observable} from 'rxjs/Observable';
// import { Router } from '@angular/router';
//
//
//
// @Component({
// selector: 'my-claims-demo',
// template: `
// <div *ngIf="user" class="container">
// <div class="page-header">
// <h1> My Claims Demo</h1>
// </div>
// <div>
// <div class=""><a routerLink="/Linking">Linking</a></div>
// <div class=""><a routerLink]="/MyClaims">MyClaims</a></div>
// <div class=""><a routerLink="/Claims">Claims Admin</a></div>
// <p> Extra parameters for claims admin</p>
// <div class=""><a href="claims?fetchBy=User&fetchId=amelie.baecker@uni-bielefeld.de">Claims By user</a></div>
// <div class=""><a href="claims?fetchBy=Project&fetchId=corda_______::2c37878a0cede85dbbd1081bb9b4a2f8">Claims By project</a></div>
// <div class=""><a href="claims?fetchBy=Context&fetchId=egi::country::gr">Claims By context</a></div>
//
// <!-- <p>Orcid
// <p>N.M.
// 0000-0002-3477-3082
// </p>
// </p> -->
// <div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
// <!--<div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
// <div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>-->
// </div>
// </div>
//
//
//
// `
// //(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}] );
// }
// }

View File

@ -1,34 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({
selector: 'deposit-by-subject',
template: `
<div class="uk-margin-top">
<h3>Or search for domain specific repositories</h3>
<form class= "uk-grid">
<input type="text" [(ngModel)]="subjectKeyword" class="uk-margin-medium-left uk-padding-remove-left uk-input" name="subject" placeholder="Type keywords (e.g Biology, Natural sciences, Social Sciences, Engineering Sciences... )" style="width: 580px;" />
<button class=" uk-button uk-button-default" type="submit" (click)="search()" >
Search
</button>
</form>
</div>
`
})
export class DepositBySubjectComponent {
@Input() subjectKeyword: string='';
constructor (private _router: Router) { }
public search() {
this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "q": this.subjectKeyword } } );
}
}

View File

@ -1,19 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]
})
export class DepositBySubjectResultsRoutingModule { }

View File

@ -1,79 +0,0 @@
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container uk-margin-top">
<div class="uk-article-title">
Deposit {{requestFor}}
</div>
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
<form class= "uk-margin uk-text-center uk-margin-top">
<input type="text" [(ngModel)]="newSubject" class=" uk-input uk-width-1-2" name="subject" placeholder="Search for classifications..." />
<button class=" uk-button uk-button-default" type="submit" (click)="searchDataproviders()" >
Search
</button>
</form>
<div *ngIf="subject.length > 0" class=" uk-text-center ">
<span>Keywords: {{subject}}<span><a class="uk-icon-button" (click) = "subject = ''"><span aria-hidden="true" class=" clickable "><span class="clickable uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span></a></span>
</span>
</div>
</div>
<div class="uk-width-1-1">
<helper position="top"></helper>
</div>
<div class="uk-grid helper-grid">
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
<div class="uk-width-expand">
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING"
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading">
</div>
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<p>Please use the information/contacts shown below to deposit your {{requestFor}}.</p>
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
<div *ngIf="fetchDataproviders.searchUtils.totalResults" class="">
<paging-no-load [currentPage]="page" [totalResults]="fetchDataproviders.searchUtils.totalResults" size=10 (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<div class="" *ngIf="fetchDataproviders.results && fetchDataproviders.searchUtils.totalResults > 0">
{{fetchDataproviders.searchUtils.totalResults}} content providers, page {{fetchDataproviders.searchUtils.page}} of {{(totalPages())}}
</div>
<search-result [(results)]="fetchDataproviders.results"
type="dataprovider" urlParam="datasourceId" [showSubjects]=true
[custom_class]="'other-results'">
</search-result>
</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE && subject != ''" class = "uk-alert uk-alert-primary">
No content providers found with classification "{{subject}}".
</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR && subject != ''" class = "uk-alert uk-alert-danger">
An error occured.
</div>
<div *ngIf="(fetchDataproviders.searchUtils.totalResults == 0 && fetchDataproviders.searchUtils.status == errorCodes.DONE)
|| fetchDataproviders.searchUtils.status == errorCodes.NONE || fetchDataproviders.searchUtils.status == errorCodes.ERROR" class = "uk-alert ">
You can still deposit your {{requestFor}} in
<a href="{{zenodo}}" target="_blank">OpenAIRE's Zenodo catch-all repository (<i class="custom-external"></i>)</a>
hosted by CERN.
</div>
</div>
<helper position="right" styleName=" uk-width-1-5"></helper>
</div>
<button class=" uk-button uk-button-default uk-margin-small-top" type="submit" (click)="goToDeposit()">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-left" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="13 16 7 10 13 4"></polyline></svg></span> Back
</button>
<helper position="bottom"></helper>
</div>
</div>
</div>
</div>

View File

@ -1,127 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import { Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
import {OrganizationService} from '../../services/organization.service';
import { Meta} from '../../../angular2-meta';
import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'deposit-by-subject-result',
templateUrl: 'depositBySubjectResult.component.html'
})
export class DepositBySubjectResultComponent {
@Input() compatibility: string = '';
// Type of entity: Publication or Research Data
@Input() requestFor: string = "Research Data";
@Input() subject: string = "";
public newSubject: string= "";
public fetchDataproviders : FetchDataproviders;
public linkToSearchDataproviders = "";
// url of Zenodo
public zenodo: string;
public page: number = 1;
public status: number;
public routerHelper:RouterHelper = new RouterHelper();
public errorCodes:ErrorCodes = new ErrorCodes();
sub: any;
piwiksub: any;
constructor ( private _router: Router,
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService,
private _meta: Meta, private _piwikService:PiwikService) {
this.zenodo = OpenaireProperties.getZenodoURL();
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.status = this.errorCodes.LOADING;
this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor);
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
}
}
ngOnInit() {
console.info('depositResult init');
this.sub = this.route.queryParams.subscribe(params => {
this.subject = params['q'];
this.newSubject = this.subject;
this.searchDataproviders();
});
}
// ngDoCheck() {
// if(this.organizationId == "" || this.organizationId == undefined) {
// this.organizationId = "";
// this.status = this.errorCodes.ERROR;
// }
// }
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
public totalPages(): number {
let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
public searchDataproviders() {
this.subject = this.newSubject;
this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10);
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();
}
public goToDeposit() {
if(this.requestFor == "Publications") {
this._router.navigate( ['participate/deposit-publications'] );
} else if(this.requestFor == "Research Data") {
this._router.navigate( ['participate/deposit-datasets'] );
}
}
public pageChange($event) {
this.page = +$event.value;
this.searchDataproviders();
}
private updateDescription(description:string){
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
}
private 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);
}
private updateUrl(url:string){
this._meta.updateProperty("og:url", url);
}
}

View File

@ -1,34 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
import {DepositBySubjectResultsRoutingModule} from './depositBySubjectResult-routing.module';
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {PagingModule } from '../../utils/paging.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
import {HelperModule} from '../../utils/helper/helper.module';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DepoditModule,
DepositBySubjectResultsRoutingModule, SearchResultsModule, DataProvidersServiceModule, PagingModule,
HelperModule
],
declarations: [
DepositBySubjectResultComponent
],
exports: [
DepositBySubjectResultComponent
],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositBySubjectResultsModule { }

View File

@ -1,20 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { DepositDatasetsComponent } from './depositDatasets.component';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]
})
export class DepositDatasetsRoutingModule { }

View File

@ -1,21 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'deposit-datasets',
template: `
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container">
<deposit [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'" [searchBySubjects]=true></deposit>
<div>
</div>
</div>
</div>
`
})
export class DepositDatasetsComponent {
}

View File

@ -1,29 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DepositDatasetsComponent } from './depositDatasets.component';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module';
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DepoditModule,
DepositDatasetsRoutingModule
],
declarations: [
DepositDatasetsComponent
],
exports: [
DepositDatasetsComponent
],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositDatasetsModule { }

View File

@ -1,14 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'deposit-datasets-result',
template: `
<deposit-result [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit-result>
`
})
export class DepositDatasetsResultComponent {
}

View File

@ -1,18 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]
})
export class DepositDatasetsResultsRoutingModule { }

View File

@ -1,29 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-routing.module';
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DepoditModule,
DepositDatasetsResultsRoutingModule
],
declarations: [
DepositDatasetsResultComponent,
],
exports: [
DepositDatasetsResultComponent,
],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositDatasetsResultsModule { }

View File

@ -1,56 +0,0 @@
<div class="uk-margin-top">
<div class="uk-article-title">
Deposit {{requestFor}}
</div>
<div class="uk-width-1-1">
<helper position="top"></helper>
</div>
<div class="uk-grid helper-grid">
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
<div class="uk-width-expand">
<div>
<p>
<i>
Are you a grant recipient from the following: H2020; FP7 with SC39; or ERC?
</i>
Then you are required to publish in
<a href="{{openAccess}}" target="_blank">open access (<i class="custom-external"></i>)</a>.
One way to do this is to deposit your {{requestFor}} into an
<a href="{{openAccessRepo}}" target="_blank">open access repository (<i class="custom-external"></i>)</a>.
</p>
<p>
Click the following to find more information:
<a href="{{fp7Guidlines}}" target="_blank">FP7 guidelines (<i class="custom-external"></i>)</a>,
<a href="{{h2020Guidlines}}" target="_blank">H2020 guidelines (<i class="custom-external"></i>)</a>,
<a href="{{ercGuidlines}}" target="_blank">ERC guidelines (<i class="custom-external"></i>)</a> OR
<a href="{{helpdesk}}" target="_blank">ask a question (<i class="custom-external"></i>)</a> to OpenAIREs national representative.
</p>
</div>
<h3>Locate repository via your institution</h3>
<form class= "uk-grid">
<div class="uk-width-1-2 ">
<entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true
[placeHolderMessage] = "'Search for Organizations'" [title] = "'Organizations'" [multipleSelections]=false
(selectedValueChanged)="valueChanged($event)">
</entities-autocomplete>
</div>
<button class=" uk-button uk-button-default" type="submit" (click)="organizationSelected(selectedId)" >
Locate
</button>
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">{{warningMessage}}</div>
</form>
<div *ngIf="searchBySubjects" >
<deposit-by-subject></deposit-by-subject>
</div>
<div *ngIf="mapUrl">
<h3>Or locate repository in map</h3>
<div class="uk-margin-top">
<i-frame [url]="mapUrl" width="100%" height="900"></i-frame>
</div>
</div>
</div>
<helper position="right" styleName=" uk-width-1-5"></helper>
</div>
<helper position="bottom"></helper>
</div>

View File

@ -1,91 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import { Meta} from '../../angular2-meta';
import {PiwikService} from '../utils/piwik/piwik.service';
@Component({
selector: 'deposit',
templateUrl: 'deposit.component.html'
})
export class DepositComponent {
@Input() compatibility: string = '';
@Input() mapUrl: string = null; // optional in case i-frame is needed
@Input() searchBySubjects: boolean = false; // optional: in case search by subjects is needed
public status: number;
// Type of entity: Publication or Research Data
@Input() requestFor: string = "Publications";
// url's needed for information text
public openAccess: string;
public openAccessRepo: string;
public fp7Guidlines: string;
public h2020Guidlines: string;
public ercGuidlines: string;
public helpdesk: string;
// Id of the new selected organization to be searched
public selectedId: string = "";
public warningMessage: string = "";
piwiksub:any;
constructor (private _router: Router, private _meta: Meta, private _piwikService:PiwikService) {
this.openAccess = OpenaireProperties.getOpenAccess();
this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
this.fp7Guidlines = OpenaireProperties.getFP7Guidlines();
this.h2020Guidlines = OpenaireProperties.getH2020Guidlines();
this.ercGuidlines = OpenaireProperties.getERCGuidlines();
this.helpdesk = OpenaireProperties.getHelpdesk();
this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor);
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
}
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
public organizationSelected(id: string) {
console.info("organization selected");
if(id && id.length > 0){
if(this.requestFor == "Publications") {
this._router.navigate( ['participate/deposit-publications-result'], { queryParams: { "organizationId": id } } );
} else if(this.requestFor == "Research Data") {
this._router.navigate( ['participate/deposit-datasets-result'], { queryParams: { "organizationId": id } } );
}
} else {
this.warningMessage = "No organization selected";
}
}
public valueChanged($event){
this.selectedId = $event.value;
}
private updateDescription(description:string){
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
}
private 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);
}
private updateUrl(url:string){
this._meta.updateProperty("og:url", url);
}
}

View File

@ -1,45 +0,0 @@
/* Common Component of deposit for both research data & ppublications*/
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { DepositComponent } from './deposit.component';
import { DepositResultComponent } from './depositResult.component';
import {EntitiesAutocompleteModule} from '../utils/entitiesAutoComplete/entitiesAutoComplete.module';
import {DataProvidersServiceModule} from '../services/dataProvidersService.module';
import {OrganizationServiceModule} from '../services/organizationService.module';
import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module';
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
import {HelperModule} from '../utils/helper/helper.module';
import { DepositBySubjectComponent } from './datasets/depositBySubject.component';
import {IFrameModule} from '../utils/iframe.module';
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule,
EntitiesAutocompleteModule,
DataProvidersServiceModule,
OrganizationServiceModule,
SearchResultsModule,
PiwikServiceModule,
HelperModule,
IFrameModule
],
declarations: [
DepositComponent,
DepositResultComponent,
DepositBySubjectComponent
],
exports: [
DepositComponent,
DepositResultComponent
],
providers: [
]
})
export class DepoditModule { }

View File

@ -1,284 +0,0 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import { Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { FetchDataproviders } from '../utils/fetchEntitiesClasses/fetchDataproviders.class';
import { SearchDataprovidersService } from '../services/searchDataproviders.service';
import {OrganizationService} from '../services/organization.service';
import { Meta} from '../../angular2-meta';
import {RouterHelper} from '../utils/routerHelper.class';
import {PiwikService} from '../utils/piwik/piwik.service';
@Component({
selector: 'deposit-result',
template: `
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container uk-margin-top">
<div class="uk-article-title">
Deposit {{requestFor}}
</div>
<helper position="top"></helper>
<div class="uk-grid helper-grid">
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
<div class="uk-width-expand">
<div *ngIf="status == errorCodes.LOADING || (status == errorCodes.LOADING && fetchDataproviders.searchUtils.status == errorCodes.LOADING)"
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading">
</div>
<div *ngIf="status != errorCodes.LOADING" class="uk-margin-bottom">
<h3>Locate repository via your institution</h3>
<form class= "uk-grid">
<div class="uk-width-1-2 ">
<entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'"
[depositType]=compatibility [showSelected]=true [placeHolderMessage] = "'Search for Organizations'"
[title] = "'Organizations'" [multipleSelections]=false (selectedValueChanged)="valueChanged($event)">
</entities-autocomplete>
</div>
<button class=" uk-button uk-button-default" type="submit" (click)="organizationSelected(selectedId)" >
Locate
</button>
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">{{warningMessage}}</div>
</form>
</div>
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<h2 *ngIf="organization">
<span>content providers for institution: </span>
<a *ngIf="organization['url']!=''" href="{{organization.url}}" target="_blank">
<span>{{organization['name']}} (<i class="custom-external"></i>)</span>
</a>
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
</h2>
</div>
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<p>Please use the information/contacts shown below to deposit your {{requestFor}}.</p>
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10">
<!--a [href] = "linkToSearchDataproviders">
View all {{fetchDataproviders.searchUtils.totalResults}} results <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span>
</a-->
<a [queryParams]="routerHelper.createQueryParams(['organizationId', 'or'], [organizationId, 'and'])"
routerLinkActive="router-link-active" [routerLink]="linkToSearchDataproviders" class="uk-button uk-button-text">
View all {{fetchDataproviders.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchDataproviders.results"
[(status)]= "fetchDataproviders.searchUtils.status"
type="dataprovider" urlParam="datasourceId"
[custom_class]="'other-results'">
</search-result>
</div>
<div *ngIf="(fetchDataproviders.searchUtils.totalResults == 0 && status == errorCodes.DONE)
|| status == errorCodes.NOT_FOUND || status == errorCodes.ERROR || status == errorCodes.NOT_AVAILABLE" class = "alert alert-warning">
<div *ngIf="organization">
<span *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR">
An error occured.
</span>
No content providers found for institution:
<a *ngIf="organization['url']!=''" target="_blank" href="{{organization.url}}">
<span>{{organization['name']}} (<i class="custom-external"></i>)</span>
</a>
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
.
</div>
<div *ngIf="status == errorCodes.NOT_FOUND && organizationId != ''">
No organization with ID: {{organizationId}} found.
</div>
<div *ngIf="status == errorCodes.ERROR && organizationId != ''">
An error occured.
</div>
<span *ngIf="status == errorCodes.NOT_AVAILABLE && organizationId != ''">
Service temprorarily unavailable. Please try again later.
</span>
<div *ngIf="organizationId == ''">
No ID for organization.
</div>
You can still deposit your {{requestFor}} in
<a href="{{zenodo}}" target="_blank">OpenAIRE's Zenodo catch-all repository (<i class="custom-external"></i>)</a>
hosted by CERN.
</div>
</div>
<helper position="right" styleName=" uk-width-1-5"></helper>
</div>
<button class=" uk-button uk-button-default uk-margin-small-top" type="submit" (click)="goToDeposit()">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-left" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="13 16 7 10 13 4"></polyline></svg></span> Back
</button>
<helper position="bottom"></helper>
</div>
</div>
</div>
</div>
`
})
export class DepositResultComponent {
@Input() compatibility: string = '';
// Type of entity: Publication or Research Data
@Input() requestFor: string = "Publications";
public organization: {"name": string, "url": string};
public organizationId: string = "";
// Id of the new selected organization to be searched
public selectedId: string = "";
public status: number;
public warningMessage: string = "";
public fetchDataproviders : FetchDataproviders;
public linkToSearchDataproviders: string = "";
// url of Zenodo
public zenodo: string;
public routerHelper:RouterHelper = new RouterHelper();
public errorCodes:ErrorCodes = new ErrorCodes();
sub: any; piwiksub: any;
constructor ( private _router: Router,
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService,
private _organizationService: OrganizationService,
private _meta: Meta, private _piwikService:PiwikService) {
this.zenodo = OpenaireProperties.getZenodoURL();
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.status = this.errorCodes.LOADING;
this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor);
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
}
}
ngOnInit() {
console.info('depositResult init');
this.sub = this.route.queryParams.subscribe(params => {
this.organizationId = params['organizationId'];
console.info("Id is :"+this.organizationId);
if(this.organizationId){
this.getOrganizationInfo();
}
this.selectedId = "";
});
}
ngDoCheck() {
if(this.organizationId == "" || this.organizationId == undefined) {
this.organizationId = "";
this.status = this.errorCodes.ERROR;
}
}
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
private searchDataproviders() {
// if(this.organization != undefined) {
// this.fetchDataproviders.getResults(this.organization.name, false, 1, 10);
// } else if(this.organizationId != undefined) {
this.fetchDataproviders.getResultsForDeposit( this.organizationId,this.requestFor, 1, 10);
//}
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();
}
private getOrganizationInfo () {
console.info("inside getOrganizationInfo of component");
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
data => {
if(data == null) {
this.status = this.errorCodes.NOT_FOUND;
} else {
this.organization = data.title;
this.status = this.errorCodes.DONE;
this.searchDataproviders();
}
},
err => {
//console.log(err)
if(err.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
console.info("not found");
} else if(err.status == '500') {
this.status = this.errorCodes.ERROR;
console.info("error");
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
console.info("not available");
}
}
);
}
public goToDeposit() {
if(this.requestFor == "Publications") {
this._router.navigate( ['participate/deposit-publications'] );
} else if(this.requestFor == "Research Data") {
this._router.navigate( ['participate/deposit-datasets'] );
}
}
public valueChanged($event){
this.selectedId = $event.value;
}
public organizationSelected(id: string) {
console.info("organization selected");
if(id && id.length > 0 && id != this.organizationId){
this.organization = null;
this.status = this.errorCodes.LOADING;
if(this.requestFor == "Publications") {
this._router.navigate( ['participate/deposit-publications-result'], { queryParams: { "organizationId": id } } );
} else if(this.requestFor == "Research Data") {
this._router.navigate( ['participate/deposit-datasets-result'], { queryParams: { "organizationId": id } } );
}
} else {
this.warningMessage = "No new organization selected";
}
}
private updateDescription(description:string){
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
}
private 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);
}
private updateUrl(url:string){
this._meta.updateProperty("og:url", url);
}
}

View File

@ -1,18 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsComponent } from './depositPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]
})
export class DepositPublicationsRoutingModule { }

View File

@ -1,21 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'deposit-publications',
template: `
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container">
<deposit [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'" [mapUrl]=mapUrl></deposit>
</div>
</div>
</div>
</div>
`
})
export class DepositPublicationsComponent {
public mapUrl ="https://beta.openaire.eu/stats/markers-demo.html";
}

View File

@ -1,27 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DepositPublicationsComponent } from './depositPublications.component';
import {DepositPublicationsRoutingModule} from './depositPublications-routing.module';
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DepoditModule,
DepositPublicationsRoutingModule
],
declarations: [
DepositPublicationsComponent
],
exports: [
DepositPublicationsComponent,
],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositPublicationsModule { }

View File

@ -1,18 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]
})
export class DepositPublicationsResultRoutingModule { }

View File

@ -1,12 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'deposit-publications-result',
template: `
<deposit-result [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'"></deposit-result>
`
})
export class DepositPublicationsResultComponent {
}

View File

@ -1,27 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
import {DepositPublicationsResultRoutingModule} from './depositPublicationsResult-routing.module';
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DepoditModule,
DepositPublicationsResultRoutingModule
],
declarations: [
DepositPublicationsResultComponent
],
exports: [
DepositPublicationsResultComponent
],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositPublicationsResultsModule { }

Some files were not shown because too many files have changed in this diff Show More