- use latest prettier 3.0 with eslint-plugin-prettier: 5.0.0-alpha.2
All checks were successful
CI Pipeline / japa-tests (push) Successful in 46s

- npm normal updates
- add all xslt and style asstes in extra folder public/assets2
- linting corrections
- delete local .env.test from git tracking: git rm --cached .env.test
- add .env.test into .gitignore file
- add edit functionality for editing by submitter
- npm updates
-added xslt3 packeage for builfing sef files
- added Language.ts class vor language table
- added version to datasetxml2oai-pmh.xslt
This commit is contained in:
Kaimbacher 2023-07-17 19:13:30 +02:00
parent f403c3109f
commit 4714dfdd94
70 changed files with 22920 additions and 17407 deletions

View File

@ -1,3 +0,0 @@
NODE_ENV=test
ASSETS_DRIVER=fake
SESSION_DRIVER=memory

29
.eslintrc.json Normal file
View File

@ -0,0 +1,29 @@
{
"extends": [
"plugin:adonis/typescriptApp",
"prettier"
],
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": [
"error",
{ "singleQuote": true }
],
"@typescript-eslint/indent": ["error", 4, { "ignoredNodes": ["PropertyDefinition", "TSUnionType"] }],
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "interface",
"format": [
"PascalCase"
],
"custom": {
"regex": "^I[A-Z]",
"match": false
}
}
]
}
}

View File

@ -7,63 +7,89 @@ run-name: ${{ github.actor }} is running CI pipeline
on: [push, pull_request]
jobs:
# Label of the container job
japa-tests:
# run build on latest ubuntu
runs-on: ubuntu-latest
container: node:16-bullseye
services:
postgres:
image: postgres
mydb:
image: postgres:latest
env:
POSTGRES_USER: ProjectName
POSTGRES_PASSWORD: password
POSTGRES_DB: ProjectName-test
POSTGRES_USER: alice
POSTGRES_PASSWORD: iEx4Vj7zBb6
POSTGRES_DB: tethys_dev
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
# this will check out the current branch (https://github.com/actions/checkout#Push-a-commit-using-the-built-in-token)
- name: Check out repository code
- name: 1 Check out repository code
uses: actions/checkout@v3
# installing Node
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
# this will use the latest Node 12 version
node-version: 16.x
# - name: 2 Use Node.js 16.x
# uses: actions/setup-node@v1
# with:
# # this will use the latest Node 12 version
# node-version: 16.x
# install dependencies using clean install to avoid package lock updates
# build the project if necessary
# - run: npm run build
# - run: cd build
- name: Install dependencies
- name: 3 Install dependencies
run: npm ci
# - run: npm ci --omit=dev
- name: 4 Create .env.test file
run: cp .env.example .env.test
- name: 5 connection
run: echo "DB_CONNECTION=pg" >> .env.test
&& echo "PG_HOST=172.17.0.2" >> .env.test
&& echo "PG_PORT=5432" >> .env.test
&& echo "PG_USER=alice" >> .env.test
&& echo "PG_PASSWORD=iEx4Vj7zBb6" >> .env.test
&& echo "PG_DB_NAME=tethys_dev" >> .env.test
&& echo "NODE_ENV=test" >> .env.test
&& echo "ASSETS_DRIVER=fake" >> .env.test
&& echo "SESSION_DRIVER=memory" >> .env.test
&& echo "HASH_DRIVER=bcrypt" >> .env.test
&& echo "HOST=127.0.0.1" >> .env.test
&& echo "PORT=3333" >> .env.test
&& echo "APP_NAME=AdonisJs" >> .env.test
&& echo "APP_URL=http://${HOST}:${PORT}" >> .env.test
&& echo "CACHE_VIEWS=false" >> .env.test
&& echo "APP_KEY=pfi5N2ACN4tMJ5d8d8BPHfh3FEuvleej" >> .env.test
&& echo "DRIVE_DISK=local" >> .env.test
# finally run the tests
# - run: npm test
- name: Run tests
run: node ace test
env:
DB_CONNECTION: pg
PG_HOST: postgres
PG_PORT: 5432
PG_USER: ProjectName
PG_PASSWORD: password
PG_DB_NAME: ProjectName-test
PORT: 3333
HOST: 0.0.0.0
APP_KEY: somefakekeythatis>16characters
NODE_ENV: test
ASSETS_DRIVER: fake
SESSION_DRIVER: memory
CACHE_VIEWS: false
DRIVE_DISK: local
- name: 6 Run tests
run: npm run test
# env:
# DB_CONNECTION: pg
# PG_HOST: postgres
# PG_PORT: 5432
# PG_USER: tethys_test
# PG_PASSWORD: iEx4Vj7zBb6
# PG_DB_NAME: tethys_dev
# PORT: 3333
# HOST: 0.0.0.0
# APP_KEY: somefakekeythatis>16characters
# NODE_ENV: test
# ASSETS_DRIVER: fake
# SESSION_DRIVER: memory
# CACHE_VIEWS: false
# DRIVE_DISK: local
# # Save coverage report in Coveralls
# - name: Coveralls
# uses: coverallsapp/github-action@master

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ coverage
.env
tmp
docker-compose.yml
.env.test

View File

@ -20,14 +20,14 @@ export default class RoleController {
if (request.input('sort')) {
type SortOrder = 'asc' | 'desc' | undefined;
let attribute = request.input('sort');
let sort_order: SortOrder = 'asc';
let sortOrder: SortOrder = 'asc';
if (attribute.substr(0, 1) == '-') {
sort_order = 'desc';
if (attribute.substr(0, 1) === '-') {
sortOrder = 'desc';
// attribute = substr(attribute, 1);
attribute = attribute.substr(1);
}
roles.orderBy(attribute, sort_order);
roles.orderBy(attribute, sortOrder);
} else {
// users.orderBy('created_at', 'desc');
roles.orderBy('id', 'asc');

View File

@ -23,16 +23,16 @@ export default class UsersController {
if (request.input('sort')) {
type SortOrder = 'asc' | 'desc' | undefined;
let attribute = request.input('sort');
let sort_order: SortOrder = 'asc';
let sortOrder: SortOrder = 'asc';
// if (strncmp($attribute, '-', 1) === 0) {
if (attribute.substr(0, 1) == '-') {
sort_order = 'desc';
if (attribute.substr(0, 1) === '-') {
sortOrder = 'desc';
// attribute = substr(attribute, 1);
attribute = attribute.substr(1);
}
// $users->orderBy($attribute, $sort_order);
users.orderBy(attribute, sort_order);
users.orderBy(attribute, sortOrder);
} else {
// users.orderBy('created_at', 'desc');
users.orderBy('id', 'asc');

View File

@ -0,0 +1,189 @@
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
import { RequestContract } from '@ioc:Adonis/Core/Request';
import { XMLBuilder } from 'xmlbuilder2/lib/interfaces';
import { create } from 'xmlbuilder2';
import dayjs, { Dayjs } from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
import { readFileSync } from 'fs';
import { StatusCodes } from 'http-status-codes';
import { transform } from 'saxon-js';
// import { Xslt, xmlParse } from 'xslt-processor'
import { OaiErrorCodes, OaiModelError } from 'App/Exceptions/OaiErrorCodes';
import { OaiModelException } from 'App/Exceptions/OaiModelException';
interface XslTParameter {
[key: string]: any;
}
interface Dictionary {
[index: string]: string;
}
export default class OaiController {
// private deliveringDocumentStates = ["published", "deleted"];
// private sampleRegEx = /^[A-Za-zäüÄÜß0-9\-_.!~]+$/;
private xsltParameter: XslTParameter;
/**
* Holds xml representation of document information to be processed.
*
* @var xmlbuilder.XMLDocument | null Defaults to null.
*/
private xml: XMLBuilder;
private proc;
constructor() {
// Load the XSLT file
this.proc = readFileSync('public/assets2/datasetxml2oai.sef.json');
// tests
// const xslPath = 'assets/datasetxml2oai-pmh.xslt'; // Replace with the actual path to your XSLT file
// this.proc = readFileSync(xslPath, 'utf-8');
// this.configuration = new Configuration();
dayjs.extend(utc);
dayjs.extend(timezone);
}
public async index({ response, request }: HttpContextContract): Promise<void> {
this.xml = create({ version: '1.0', encoding: 'UTF-8', standalone: true }, '<root></root>');
// this.proc = new XSLTProcessor();
// const stylesheet = readFileSync(__dirname + "/datasetxml2oai.sef.json");
const xsltParameter = (this.xsltParameter = {});
let oaiRequest: Dictionary = {};
if (request.method() === 'POST') {
oaiRequest = request.body();
} else if (request.method() === 'GET') {
oaiRequest = request.qs();
} else {
xsltParameter['oai_error_code'] = 'unknown';
xsltParameter['oai_error_message'] = 'Only POST and GET methods are allowed for OAI-PMH.';
}
// const oaiRequest: OaiParameter = request.body;
try {
this.handleRequest(oaiRequest, request);
} catch (error) {
if (error instanceof OaiModelException) {
const code = error.oaiCode;
let oaiErrorCode: string | undefined = 'Unknown oai error code ' + code;
if (OaiModelError.has(error.oaiCode) && OaiModelError.get(code) !== undefined) {
oaiErrorCode = OaiModelError.get(error.oaiCode);
}
this.xsltParameter['oai_error_code'] = oaiErrorCode;
this.xsltParameter['oai_error_message'] = error.message;
} else {
// // return next(error); // passing to default express middleware error handler
this.xsltParameter['oai_error_code'] = 'unknown';
this.xsltParameter['oai_error_message'] = 'An internal error occured.';
}
}
const xmlString = this.xml.end({ prettyPrint: true });
let xmlOutput;
try {
const result = await transform({
// stylesheetFileName: `${config.TMP_BASE_DIR}/data-quality/rules/iati.sef.json`,
stylesheetText: this.proc,
destination: 'serialized',
// sourceFileName: sourceFile,
sourceText: xmlString,
stylesheetParams: xsltParameter,
// logLevel: 10,
});
xmlOutput = result.principalResult;
} catch (error) {
return response.status(500).json({
message: 'An error occurred while creating the user',
error: error.message,
});
}
response
.header('Content-Type', 'application/xml; charset=utf-8')
.header('Access-Control-Allow-Origin', '*')
.header('Access-Control-Allow-Methods', 'GET,POST');
response.status(StatusCodes.OK).send(xmlOutput);
}
protected handleRequest(oaiRequest: Dictionary, request: RequestContract) {
// Setup stylesheet
// $this->loadStyleSheet('datasetxml2oai-pmh.xslt');
// Set response time
const now: Dayjs = dayjs();
this.xsltParameter['responseDate'] = now.format('YYYY-MM-DDTHH:mm:ss[Z]');
this.xsltParameter['unixTimestamp'] = now.unix();
// set OAI base url
const baseDomain = process.env.BASE_DOMAIN || 'localhost';
this.xsltParameter['baseURL'] = baseDomain + '/oai';
this.xsltParameter['repURL'] = request.protocol() + '://' + request.hostname();
this.xsltParameter['downloadLink'] = request.protocol() + '://' + request.hostname() + '/file/download/';
this.xsltParameter['doiLink'] = 'https://doi.org/';
this.xsltParameter['doiPrefix'] = 'info:eu-repo/semantics/altIdentifier/doi/';
if (oaiRequest['verb']) {
const verb = oaiRequest['verb'];
this.xsltParameter['oai_verb'] = verb;
if (verb === 'Identify') {
this.handleIdentify();
} else if (verb === 'ListMetadataFormats') {
this.handleListMetadataFormats();
}
// else if (verb == "GetRecord") {
// await this.handleGetRecord(oaiRequest);
// } else if (verb == "ListRecords") {
// await this.handleListRecords(oaiRequest);
// } else if (verb == "ListIdentifiers") {
// await this.handleListIdentifiers(oaiRequest);
// } else if (verb == "ListSets") {
// await this.handleListSets();
// }
else {
this.handleIllegalVerb();
}
} else {
// // try {
// // console.log("Async code example.")
// const err = new PageNotFoundException("verb not found");
// throw err;
// // } catch (error) { // manually catching
// // next(error); // passing to default middleware error handler
// // }
throw new OaiModelException(
StatusCodes.INTERNAL_SERVER_ERROR,
'The verb provided in the request is illegal.',
OaiErrorCodes.BADVERB,
);
}
}
protected handleIdentify() {
const email = process.env.OAI_EMAIL || 'repository@geosphere.at';
const repositoryName = 'Tethys RDR';
const repIdentifier = 'tethys.at';
const sampleIdentifier = 'oai:' + repIdentifier + ':1'; //$this->_configuration->getSampleIdentifier();
// Dataset::earliestPublicationDate()->server_date_published->format('Y-m-d\TH:i:s\Z') : null;
// earliestDateFromDb!= null && (this.xsltParameter['earliestDatestamp'] = earliestDateFromDb?.server_date_published);
// set parameters for oai-pmh.xslt
this.xsltParameter['email'] = email;
this.xsltParameter['repositoryName'] = repositoryName;
this.xsltParameter['repIdentifier'] = repIdentifier;
this.xsltParameter['sampleIdentifier'] = sampleIdentifier;
// $this->proc->setParameter('', 'earliestDatestamp', $earliestDateFromDb);
this.xml.root().ele('Datasets');
}
protected handleListMetadataFormats() {
this.xml.root().ele('Datasets');
}
private handleIllegalVerb() {
this.xsltParameter['oai_error_code'] = 'badVerb';
this.xsltParameter['oai_error_message'] = 'The verb provided in the request is illegal.';
}
}

View File

@ -1,12 +1,11 @@
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
import User from 'App/Models/User';
import Dataset from 'App/Models/Dataset';
// import Role from 'App/Models/Role';
// import Database from '@ioc:Adonis/Lucid/Database';
import License from 'App/Models/License';
import Project from 'App/Models/Project';
import Title from 'App/Models/Title';
import Description from 'App/Models/Description';
import Language from 'App/Models/Language';
// import CreateUserValidator from 'App/Validators/CreateUserValidator';
// import UpdateUserValidator from 'App/Validators/UpdateUserValidator';
import { schema, CustomMessages, rules } from '@ioc:Adonis/Core/Validator';
@ -16,7 +15,7 @@ import Database from '@ioc:Adonis/Lucid/Database';
import { TransactionClientContract } from '@ioc:Adonis/Lucid/Database';
import Subject from 'App/Models/Subject';
import CreateDatasetValidator from 'App/Validators/CreateDatasetValidator';
import { TitleTypes, DescriptionTypes } from 'Contracts/enums';
import { TitleTypes, DescriptionTypes, ContributorTypes, PersonNameTypes } from 'Contracts/enums';
import type { ModelQueryBuilderContract } from '@ioc:Adonis/Lucid/Orm';
export default class DatasetController {
@ -34,14 +33,14 @@ export default class DatasetController {
if (request.input('sort')) {
type SortOrder = 'asc' | 'desc' | undefined;
let attribute = request.input('sort');
let sort_order: SortOrder = 'asc';
let sortOrder: SortOrder = 'asc';
if (attribute.substr(0, 1) == '-') {
sort_order = 'desc';
if (attribute.substr(0, 1) === '-') {
sortOrder = 'desc';
// attribute = substr(attribute, 1);
attribute = attribute.substr(1);
}
datasets.orderBy(attribute, sort_order);
datasets.orderBy(attribute, sortOrder);
} else {
// users.orderBy('created_at', 'desc');
datasets.orderBy('id', 'asc');
@ -73,7 +72,7 @@ export default class DatasetController {
datasets: myDatasets.serialize(),
filters: request.all(),
can: {
// create: await auth.user?.can(['user-create']),
// create: await auth.user?.can(['dataset-submit']),
edit: await auth.user?.can(['dataset-edit']),
delete: await auth.user?.can(['dataset-delete']),
},
@ -391,7 +390,7 @@ export default class DatasetController {
// $dataKeyword = new Subject($keyword);
// $dataset->subjects()->save($dataKeyword);
const keyword = await Subject.firstOrNew({ value: keywordData.value, type: keywordData.type }, keywordData);
if (keyword.$isNew == true) {
if (keyword.$isNew === true) {
await dataset.useTransaction(trx).related('subjects').save(keyword);
} else {
await dataset.useTransaction(trx).related('subjects').attach([keyword.id]);
@ -485,7 +484,7 @@ export default class DatasetController {
};
// public async release({ params, view }) {
public async release({ request, inertia }: HttpContextContract) {
public async release({ request, inertia, response }: HttpContextContract) {
const id = request.param('id');
const dataset = await Dataset.query()
@ -495,11 +494,17 @@ export default class DatasetController {
.where('id', id)
.firstOrFail();
// const editors = await User.query()
// .whereHas('roles', (builder) => {
// builder.where('name', 'editor');
// })
// .pluck('login', 'id');
const validStates = ['inprogress', 'rejected_editor'];
if (!validStates.includes(dataset.server_state)) {
// session.flash('errors', 'Invalid server state!');
return response
.flash(
'warning',
`Invalid server state. Dataset with id ${id} cannot be released to editor. Datset has server state ${dataset.server_state}.`,
)
.redirect()
.back();
}
return inertia.render('Submitter/Dataset/Release', {
dataset,
@ -509,8 +514,16 @@ export default class DatasetController {
public async releaseUpdate({ request, response }: HttpContextContract) {
const id = request.param('id');
const dataset = await Dataset.query().preload('files').where('id', id).firstOrFail();
const validStates = ['inprogress', 'rejected_editor'];
if (!validStates.includes(dataset.server_state)) {
// throw new Error('Invalid server state!');
// return response.flash('warning', 'Invalid server state. Dataset cannot be released to editor').redirect().back();
return dataset.serialize();
}
if (dataset.files.length === 0) {
return response.flash('message', 'At least minimum one file is required.').redirect('back');
return response.flash('warning', 'At least minimum one file is required.').redirect('back');
}
const preferation = request.input('preferation', '');
@ -561,11 +574,106 @@ export default class DatasetController {
input.reject_reviewer_note = null;
}
// if (await dataset.merge(input).save()) {
// return response.redirect().route('publish.workflow.submit.index').flash('flash_message', 'You have released your dataset!');
// }
return response.toRoute('dataset.list').flash('message', 'You have released your dataset');
if (await dataset.merge(input).save()) {
return response.toRoute('dataset.list').flash('message', 'You have released your dataset!');
}
// throw new GeneralException(trans('exceptions.publish.release.update_error'));
}
public async edit({ params, inertia }) {
const dataset = await Dataset.query().where('id', params.id).preload('titles').firstOrFail();
// await dataset.loadMany([
// 'licenses',
// 'authors',
// 'contributors',
// 'titles',
// 'abstracts',
// 'files',
// 'coverage',
// 'subjects',
// 'references',
// ]);
const titleTypes = Object.entries(TitleTypes)
// .filter(([value]) => value !== 'Main')
.map(([key, value]) => ({ value: key, label: value }));
const descriptionTypes = Object.entries(DescriptionTypes)
// .filter(([value]) => value !== 'Abstract')
.map(([key, value]) => ({ value: key, label: value }));
const languages = await Language.query().where('active', true).pluck('part1', 'part1');
// const contributorTypes = Config.get('enums.contributor_types');
const contributorTypes = Object.entries(ContributorTypes).map(([key, value]) => ({ value: key, label: value }));
// const nameTypes = Config.get('enums.name_types');
const nameTypes = Object.entries(PersonNameTypes).map(([key, value]) => ({ value: key, label: value }));
// const messages = await Database.table('messages')
// .pluck('help_text', 'metadata_element');
const projects = await Project.query().pluck('label', 'id');
const currentDate = new Date();
const currentYear = currentDate.getFullYear();
const years = Array.from({ length: currentYear - 1990 + 1 }, (_, index) => 1990 + index);
// const licenses = await License.query()
// .select('id', 'name_long', 'link_licence')
// .orderBy('sort_order')
// .fetch();
const licenses = await License.query().select('id', 'name_long', 'link_licence').orderBy('sort_order');
// const checkeds = dataset.licenses.first().id;
const keywordTypes = {
uncontrolled: 'uncontrolled',
swd: 'swd',
};
const referenceTypes = ['DOI', 'Handle', 'ISBN', 'ISSN', 'URL', 'URN'];
const relationTypes = [
'IsSupplementTo',
'IsSupplementedBy',
'IsContinuedBy',
'Continues',
'IsNewVersionOf',
'IsPartOf',
'HasPart',
'Compiles',
'IsVariantFormOf',
];
const doctypes = {
analysisdata: { label: 'Analysis', value: 'analysisdata' },
measurementdata: { label: 'Measurements', value: 'measurementdata' },
monitoring: 'Monitoring',
remotesensing: 'Remote Sensing',
gis: 'GIS',
models: 'Models',
mixedtype: 'Mixed Type',
};
return inertia.render('Submitter/Dataset/Edit', {
dataset,
titletypes : titleTypes,
descriptionTypes,
contributorTypes,
nameTypes,
languages,
// messages,
projects,
licenses,
// checkeds,
years,
// languages,
keywordTypes,
referenceTypes,
relationTypes,
doctypes,
});
}
}

View File

@ -22,14 +22,14 @@ export default class InvalidCredentialException extends Exception {
/**
* Unable to find user
*/
static invalidUid() {
public static invalidUid() {
const error = new this('User not found', 400, 'E_INVALID_AUTH_UID');
return error;
}
/**
* Invalid user password
*/
static invalidPassword() {
public static invalidPassword() {
const error = new this('Password mis-match', 400, 'E_INVALID_AUTH_PASSWORD');
return error;
}
@ -59,7 +59,7 @@ export default class InvalidCredentialException extends Exception {
* Handle this exception by itself
*/
handle(error, ctx) {
public handle(error, ctx) {
// return response.status(403).view.render("errors/unauthorized", {
// error: error,
// });

View File

@ -0,0 +1,48 @@
export enum OaiErrorCodes {
BADVERB = 1010,
BADARGUMENT = 1011,
CANNOTDISSEMINATEFORMAT = 1012,
BADRESUMPTIONTOKEN = 1013,
NORECORDSMATCH = 1014,
IDDOESNOTEXIST = 1015,
}
// 👇️ default export
// export { OaiErrorCodes };
// https://medium.com/@juliapassynkova/map-your-typescript-enums-e402d406b229
export const OaiModelError = new Map<number, string>([
[OaiErrorCodes.BADVERB, 'badVerb'],
[OaiErrorCodes.BADARGUMENT, 'badArgument'],
[OaiErrorCodes.NORECORDSMATCH, 'noRecordsMatch'],
[OaiErrorCodes.CANNOTDISSEMINATEFORMAT, 'cannotDisseminateFormat'],
[OaiErrorCodes.BADRESUMPTIONTOKEN, 'badResumptionToken'],
[OaiErrorCodes.IDDOESNOTEXIST, 'idDoesNotExist'],
]);
// class OaiModelError {
// // const BADVERB = 1010;
// // const BADARGUMENT = 1011;
// // const CANNOTDISSEMINATEFORMAT = 1012;
// // const BADRESUMPTIONTOKEN = 1013;
// // const NORECORDSMATCH = 1014;
// // const IDDOESNOTEXIST = 1015;
// protected static $oaiErrorCodes = {
// OaiErrorCodes. 'badVerb',
// BADARGUMENT : 'badArgument',
// NORECORDSMATCH: 'noRecordsMatch',
// CANNOTDISSEMINATEFORMAT: 'cannotDisseminateFormat',
// BADRESUMPTIONTOKEN: 'badResumptionToken',
// IDDOESNOTEXIST: 'idDoesNotExist',
// };
// public static function mapCode($code)
// {
// if (false === array_key_exists($code, self::$oaiErrorCodes)) {
// throw new OaiModelException("Unknown oai error code $code");
// }
// return self::$oaiErrorCodes[$code];
// }
// }

View File

@ -0,0 +1,77 @@
import { StatusCodes } from 'http-status-codes';
// import HTTPException from './HttpException';
import { OaiErrorCodes } from './OaiErrorCodes';
export class ErrorCode {
public static readonly Unauthenticated = 'Unauthenticated';
public static readonly NotFound = 'NotFound';
public static readonly MaximumAllowedGrade = 'MaximumAllowedGrade';
public static readonly AsyncError = 'AsyncError';
public static readonly UnknownError = 'UnknownError';
}
export class ErrorModel {
/**
* Unique error code which identifies the error.
*/
public code: string;
/**
* Status code of the error.
*/
public status: number;
/**
* Any additional data that is required for translation.
*/
// public metaData?: any;
}
export class OaiModelException extends Error {
public status: number;
public message: string;
public oaiCode: number;
// constructor(status: number, message: string) {
// super(message);
// this.status = status;
// this.message = message;
// }
constructor(status: number, message: string, oaiCode: number) {
super(message);
this.status = status;
this.message = message;
this.oaiCode = oaiCode;
}
// constructor(code: string = ErrorCode.UnknownError, message: any = null) {
// super(code);
// Object.setPrototypeOf(this, new.target.prototype);
// this.name = code;
// this.status = 500;
// this.message = message;
// // switch (code) {
// // case ErrorCode.Unauthenticated:
// // this.status = 401;
// // break;
// // case ErrorCode.MaximumAllowedGrade:
// // this.status = 400;
// // break;
// // case ErrorCode.AsyncError:
// // this.status = 400;
// // break;
// // case ErrorCode.NotFound:
// // this.status = 404;
// // break;
// // default:
// // this.status = 500;
// // break;
// // }
// }
}
export class BadOaiModelException extends OaiModelException {
constructor(message?: string) {
super(StatusCodes.INTERNAL_SERVER_ERROR, message || 'bad Request', OaiErrorCodes.BADARGUMENT);
this.stack = '';
}
}
// export default OaiModelexception;

View File

@ -16,7 +16,7 @@ class FlashResponse extends Response implements ResponseContract {
) {
super(request, response, flashEncryption, flashConfig, flashRouter);
}
nonce: string;
public nonce: string;
public flash(key: string, message: any): this {
// Store the flash message in the session

View File

@ -30,7 +30,7 @@ export default class Dataset extends BaseModel {
public id: number;
@column({})
public server_state: boolean;
public server_state: string;
@column({})
public publisherName: string;
@ -57,10 +57,10 @@ export default class Dataset extends BaseModel {
public reviewer_id: number | null = null;
@column({})
public reject_editor_note: string;
public reject_editor_note: string | null;
@column({})
public reject_reviewer_note: string;
public reject_reviewer_note: string | null;
@column.dateTime({ columnName: 'server_date_published' })
public serverDatePublished: DateTime;
@ -111,10 +111,6 @@ export default class Dataset extends BaseModel {
})
public licenses: ManyToMany<typeof License>;
// public function subjects()
// {
// return $this->belongsToMany(\App\Models\Subject::class, 'link_dataset_subjects', 'document_id', 'subject_id');
// }
@manyToMany(() => Subject, {
pivotForeignKey: 'document_id',
pivotRelatedForeignKey: 'subject_id',

View File

@ -10,7 +10,7 @@ export default class HashValue extends BaseModel {
// return 'type, value'
// }
static get incrementing() {
public static get incrementing() {
return false;
}

35
app/Models/Language.ts Normal file
View File

@ -0,0 +1,35 @@
import { column, BaseModel, SnakeCaseNamingStrategy } from '@ioc:Adonis/Lucid/Orm';
// import { DateTime } from 'luxon';
export default class Language extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
public static primaryKey = 'id';
public static table = 'languages';
public static selfAssignPrimaryKey = false;
@column({
isPrimary: true,
})
public id: number;
@column({})
public part2_b: string;
@column({})
public part2_T: string;
@column({})
public description: string;
@column({})
public part1: string;
@column({})
public type: string;
@column({})
public ref_name: string;
@column({})
public active: boolean;
}

View File

@ -55,7 +55,7 @@ export default class ValidateChecksum extends BaseCommand {
continue;
}
if (hashValue['md5'] == calculatedMd5FileHash) {
if (hashValue['md5'] === calculatedMd5FileHash) {
Logger.info(`File id ${file.id}: stored md5 checksum: ${calculatedMd5FileHash}, control md5 checksum: ${hashValue['md5']}`);
} else {
Logger.error(

View File

@ -42,7 +42,7 @@ const databaseConfig: DatabaseConfig = {
password: Env.get('PG_PASSWORD', ''),
database: Env.get('PG_DB_NAME'),
},
searchPath: ['gba'],
searchPath: ['gba', 'public'],
migrations: {
naturalSort: true,
},

View File

@ -29,8 +29,4 @@ export default class Roles extends BaseSchema {
// updated_at timestamp(0) without time zone,
// CONSTRAINT roles_pkey PRIMARY KEY (id)
// )
// ALTER TABLE IF EXISTS roles
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE roles FROM tethys_app;
// GRANT ALL ON TABLE roles TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE roles TO tethys_app;

View File

@ -32,8 +32,4 @@ export default class Permissions extends BaseSchema {
// CONSTRAINT permissions_pkey PRIMARY KEY (id),
// CONSTRAINT permissions_name_unique UNIQUE (name)
// )
// ALTER TABLE IF EXISTS permissions
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE permissions FROM tethys_app;
// GRANT ALL ON TABLE permissions TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE permissions TO tethys_app;

View File

@ -45,8 +45,4 @@ export default class RoleHasPermissions extends BaseSchema {
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )
// ALTER TABLE IF EXISTS role_has_permissions
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE role_has_permissions FROM tethys_app;
// GRANT ALL ON TABLE role_has_permissions TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE role_has_permissions TO tethys_app;

View File

@ -36,8 +36,3 @@ export default class Accounts extends BaseSchema {
// CONSTRAINT accounts_pkey PRIMARY KEY (id),
// CONSTRAINT accounts_email_unique UNIQUE (email)
// )
// ALTER TABLE IF EXISTS accounts
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE accounts FROM tethys_app;
// GRANT ALL ON TABLE accounts TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE accounts TO tethys_app;

View File

@ -45,8 +45,4 @@ export default class LinkAccountsRoles extends BaseSchema {
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )
// ALTER TABLE IF EXISTS link_accounts_roles
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE link_accounts_roles FROM tethys_app;
// GRANT ALL ON TABLE link_accounts_roles TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE link_accounts_roles TO tethys_app;

View File

@ -62,11 +62,6 @@ export default class LinkDocumentsPersons extends BaseSchema {
// CONSTRAINT link_documents_persons_contributor_type_check CHECK (contributor_type::text = ANY (ARRAY['ContactPerson'::character varying::text, 'DataCollector'::character varying::text, 'DataCurator'::character varying::text, 'DataManager'::character varying::text, 'Distributor'::character varying::text, 'Editor'::character varying::text, 'HostingInstitution'::character varying::text, 'Producer'::character varying::text, 'ProjectLeader'::character varying::text, 'ProjectManager'::character varying::text, 'ProjectMember'::character varying::text, 'RegistrationAgency'::character varying::text, 'RegistrationAuthority'::character varying::text, 'RelatedPerson'::character varying::text, 'Researcher'::character varying::text, 'ResearchGroup'::character varying::text, 'RightsHolder'::character varying::text, 'Sponsor'::character varying::text, 'Supervisor'::character varying::text, 'WorkPackageLeader'::character varying::text, 'Other'::character varying::text])),
// CONSTRAINT link_documents_persons_role_check CHECK (role::text = ANY (ARRAY['author'::character varying::text, 'contributor'::character varying::text, 'other'::character varying::text]))
// )
// ALTER TABLE IF EXISTS link_documents_persons
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE link_documents_persons FROM tethys_app;
// GRANT ALL ON TABLE link_documents_persons TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE link_documents_persons TO tethys_app;
// -- Index: ix_fk_link_documents_persons_persons
// -- DROP INDEX IF EXISTS ix_fk_link_documents_persons_persons;

View File

@ -35,7 +35,4 @@ export default class DatasetSubjects extends BaseSchema {
// CONSTRAINT dataset_subjects_pkey PRIMARY KEY (id),
// CONSTRAINT dataset_subjects_type_check CHECK (type::text = 'uncontrolled'::text)
// )
// ALTER TABLE IF EXISTS dataset_subjects OWNER to tethys_admin;
// REVOKE ALL ON TABLE dataset_subjects FROM tethys_app;
// GRANT ALL ON TABLE dataset_subjects TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE dataset_subjects TO tethys_app;

View File

@ -44,11 +44,6 @@ export default class LinkDatasetSubjects extends BaseSchema {
// ON UPDATE NO ACTION
// ON DELETE NO ACTION
// )
// ALTER TABLE IF EXISTS .link_dataset_subjects
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE link_dataset_subjects FROM tethys_app;
// GRANT ALL ON TABLE link_dataset_subjects TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE link_dataset_subjects TO tethys_app;
// -- Index: link_dataset_subjects_document_id_index
// -- DROP INDEX IF EXISTS link_dataset_subjects_document_id_index;

View File

@ -30,8 +30,4 @@ export default class Projects extends BaseSchema {
// updated_at timestamp(0) without time zone,
// CONSTRAINT projects_pkey PRIMARY KEY (id)
// )
// ALTER TABLE IF EXISTS projects
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE projects FROM tethys_app;
// GRANT ALL ON TABLE projects TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE projects TO tethys_app;

View File

@ -86,8 +86,4 @@ export default class Documents extends BaseSchema {
// CONSTRAINT documents_server_state_check CHECK (server_state::text = ANY (ARRAY['deleted'::character varying::text, 'inprogress'::character varying::text, 'published'::character varying::text, 'released'::character varying::text, 'editor_accepted'::character varying::text, 'approved'::character varying::text, 'rejected_reviewer'::character varying::text, 'rejected_editor'::character varying::text, 'reviewed'::character varying::text])),
// CONSTRAINT documents_type_check CHECK (type::text = ANY (ARRAY['analysisdata'::character varying::text, 'measurementdata'::character varying::text, 'monitoring'::character varying::text, 'remotesensing'::character varying::text, 'gis'::character varying::text, 'models'::character varying::text, 'mixedtype'::character varying::text]))
// )
// ALTER TABLE IF EXISTS documents
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE documents FROM tethys_app;
// GRANT ALL ON TABLE documents TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE documents TO tethys_app;

View File

@ -41,8 +41,4 @@ export default class DatasetTitles extends BaseSchema {
// ON DELETE CASCADE,
// CONSTRAINT dataset_titles_type_check CHECK (type::text = ANY (ARRAY['Main'::character varying::text, 'Sub'::character varying::text, 'Alternative'::character varying::text, 'Translated'::character varying::text, 'Other'::character varying::text]))
// )
// ALTER TABLE IF EXISTS dataset_titles
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE dataset_titles FROM tethys_app;
// GRANT ALL ON TABLE dataset_titles TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE dataset_titles TO tethys_app;

View File

@ -41,8 +41,4 @@ export default class DatasetTitles extends BaseSchema {
// ON DELETE CASCADE,
// CONSTRAINT dataset_titles_type_check CHECK (type::text = ANY (ARRAY['Main'::character varying::text, 'Sub'::character varying::text, 'Alternative'::character varying::text, 'Translated'::character varying::text, 'Other'::character varying::text]))
// )
// ALTER TABLE IF EXISTS dataset_titles
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE dataset_titles FROM tethys_app;
// GRANT ALL ON TABLE dataset_titles TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE dataset_titles TO tethys_app;

View File

@ -32,8 +32,4 @@ export default class CollectionsRoles extends BaseSchema {
// visible_oai boolean NOT NULL DEFAULT true,
// CONSTRAINT collections_roles_pkey PRIMARY KEY (id)
// )
// ALTER TABLE IF EXISTS collections_roles
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE collections_roles FROM tethys_app;
// GRANT ALL ON TABLE collections_roles TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE collections_roles TO tethys_app;

View File

@ -54,8 +54,3 @@ export default class Collections extends BaseSchema {
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )
// ALTER TABLE IF EXISTS collections
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE collections FROM tethys_app;
// GRANT ALL ON TABLE collections TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE collections TO tethys_app;

View File

@ -43,11 +43,6 @@ export default class LinkDocumentsCollections extends BaseSchema {
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )
// ALTER TABLE IF EXISTS link_documents_collections
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE link_documents_collections FROM tethys_app;
// GRANT ALL ON TABLE link_documents_collections TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE link_documents_collections TO tethys_app;
// -- Index: link_documents_collections_collection_id_index
// -- DROP INDEX IF EXISTS link_documents_collections_collection_id_index;

View File

@ -49,8 +49,4 @@ export default class Persons extends BaseSchema {
// CONSTRAINT persons_name_type_check CHECK (name_type::text = ANY (ARRAY['Organizational'::character varying::text, 'Personal'::character varying::text]))
// )
// ALTER TABLE IF EXISTS persons
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE persons FROM tethys_app;
// GRANT ALL ON TABLE persons TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE persons TO tethys_app;

View File

@ -54,8 +54,4 @@ export default class DocumentFiles extends BaseSchema {
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )
// ALTER TABLE IF EXISTS document_files
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE document_files FROM tethys_app;
// GRANT ALL ON TABLE document_files TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE document_files TO tethys_app;

View File

@ -35,8 +35,4 @@ export default class FileHashvalues extends BaseSchema {
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )
// ALTER TABLE IF EXISTS file_hashvalues
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE file_hashvalues FROM tethys_app;
// GRANT ALL ON TABLE file_hashvalues TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE file_hashvalues TO tethys_app;

View File

@ -46,8 +46,4 @@ export default class DocumentLicences extends BaseSchema {
// sort_order smallint NOT NULL,
// CONSTRAINT document_licences_pkey PRIMARY KEY (id)
// )
// ALTER TABLE IF EXISTS document_licences
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE document_licences FROM tethys_app;
// GRANT ALL ON TABLE document_licences TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE document_licences TO tethys_app;

View File

@ -46,11 +46,6 @@ export default class LinkDocumentsLicences extends BaseSchema {
// ON UPDATE NO ACTION
// ON DELETE NO ACTION,
// )
// ALTER TABLE IF EXISTS link_documents_licences
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE link_documents_licences FROM tethys_app;
// GRANT ALL ON TABLE link_documents_licences TO tethys_admin;
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE link_documents_licences TO tethys_app;
// -- Index: link_documents_licences_document_id_index
// CREATE INDEX IF NOT EXISTS link_documents_licences_document_id_index

View File

@ -30,8 +30,4 @@ export default class MimeTypes extends BaseSchema {
// updated_at timestamp(0) without time zone,
// CONSTRAINT mime_types_pkey PRIMARY KEY (id)
// )
// ALTER TABLE IF EXISTS mime_types
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE mime_types FROM tethys_app;
// GRANT ALL ON TABLE mime_types TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE mime_types TO tethys_app;

View File

@ -34,8 +34,3 @@ export default class Languages extends BaseSchema {
// active boolean NOT NULL DEFAULT true,
// CONSTRAINT languages_pkey PRIMARY KEY (id)
// )
// ALTER TABLE IF EXISTS languages
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE languages FROM tethys_app;
// GRANT ALL ON TABLE languages TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE languages TO tethys_app;

View File

@ -26,8 +26,3 @@ export default class DocumentXmlCache extends BaseSchema {
// xml_data text,
// CONSTRAINT document_xml_cache_pkey PRIMARY KEY (document_id)
// )
// ALTER TABLE IF EXISTS document_xml_cache
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE document_xml_cache FROM tethys_app;
// GRANT ALL ON TABLE document_xml_cache TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE document_xml_cache TO tethys_app;

View File

@ -1,32 +0,0 @@
docker exec -it tethys_db /bin/bash
su -l postgres
psql
drop database test with (force);
create database test;
\q
psql -d test -U postgres -p 5432
CREATE SCHEMA IF NOT EXISTS gba AUTHORIZATION tethys_admin;
CREATE EXTENSION adminpack;
\q
exit
exit
node ace migration:run
migrated database/migrations/acl_1_roles
migrated database/migrations/acl_2_permissions
migrated database/migrations/acl_3_role_has_permissions
migrated database/migrations/acl_4_accounts
migrated database/migrations/acl_5_link_accounts_roles
migrated database/migrations/files_1681720090636_documents
migrated database/migrations/files_1681720091636_document_files
migrated database/migrations/files_1681720092636_file_hashvalues
node ace migration:rollback

34557
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +1,93 @@
{
"name": "myapp",
"version": "1.0.0",
"private": true,
"scripts": {
"type-check": "tsc --noEmit",
"dev": "node ace serve --watch",
"build": "node ace build --production",
"start": "node server.js",
"lint": "eslint . --ext=.ts",
"format": "prettier --write .",
"format-check": "prettier --check ./**/*.{ts,js}",
"test": "node ace test"
},
"eslintConfig": {
"extends": [
"plugin:adonis/typescriptApp",
"prettier"
"name": "myapp",
"version": "1.0.0",
"private": true,
"scripts": {
"type-check": "tsc --noEmit",
"dev": "node ace serve --watch",
"build": "node ace build --production",
"start": "node server.js",
"lint": "eslint . --ext=.ts",
"format": "prettier --write .",
"format-check": "prettier --check ./**/*.{ts,js}",
"test": "node ace test"
},
"eslintIgnore": [
"build"
],
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": [
"error"
]
"alias": {
"vue": "./node_modules/vue/dist/vue.esm-bundler.js"
},
"devDependencies": {
"@adonisjs/assembler": "^5.7.0",
"@babel/core": "^7.20.12",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.20.13",
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@japa/preset-adonis": "^1.0.16",
"@japa/runner": "^2.0.8",
"@mdi/js": "^7.1.96",
"@symfony/webpack-encore": "^4.2.0",
"@tailwindcss/forms": "^0.5.2",
"@types/leaflet": "^1.9.3",
"@types/node": "^20.1.1",
"@types/proxy-addr": "^2.0.0",
"@types/source-map-support": "^0.5.6",
"@vue/tsconfig": "^0.4.0",
"adonis-preset-ts": "^2.1.0",
"autoprefixer": "^10.4.13",
"babel-preset-typescript-vue3": "^2.0.17",
"chart.js": "^4.2.0",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-adonis": "^2.1.1",
"eslint-plugin-prettier": "^5.0.0-alpha.2",
"naive-ui": "^2.34.3",
"numeral": "^2.0.6",
"pinia": "^2.0.30",
"pino-pretty": "^10.0.0",
"postcss-loader": "^7.0.2",
"prettier": "^3.0.0",
"supertest": "^6.3.3",
"tailwindcss": "^3.2.4",
"ts-loader": "^9.4.2",
"typescript": "^5.1.3",
"vue": "^3.2.47",
"vue-loader": "^17.0.1",
"xslt3": "^2.5.0",
"youch": "^3.2.0",
"youch-terminal": "^2.1.4"
},
"dependencies": {
"@adonisjs/auth": "^8.2.3",
"@adonisjs/core": "^5.9.0",
"@adonisjs/lucid": "^18.3.0",
"@adonisjs/repl": "^3.1.11",
"@adonisjs/session": "^6.4.0",
"@adonisjs/shield": "^7.1.0",
"@adonisjs/view": "^6.1.5",
"@eidellev/adonis-stardust": "^3.0.0",
"@eidellev/inertia-adonisjs": "^8.0.0",
"@fontsource/archivo-black": "^5.0.1",
"@fontsource/inter": "^5.0.1",
"@inertiajs/inertia": "^0.11.1",
"@inertiajs/vue3": "^1.0.0",
"bcryptjs": "^2.4.3",
"crypto": "^1.0.1",
"dayjs": "^1.11.7",
"http-status-codes": "^2.2.0",
"leaflet": "^1.9.3",
"luxon": "^3.2.1",
"notiwind": "^2.0.0",
"pg": "^8.9.0",
"proxy-addr": "^2.0.7",
"reflect-metadata": "^0.1.13",
"saxon-js": "^2.5.0",
"source-map-support": "^0.5.21",
"vue-facing-decorator": "^2.1.13",
"vuedraggable": "^4.1.0",
"xmlbuilder2": "^3.1.1"
}
},
"eslintIgnore": [
"build"
],
"alias": {
"vue": "./node_modules/vue/dist/vue.esm-bundler.js"
},
"devDependencies": {
"@adonisjs/assembler": "^5.7.0",
"@babel/core": "^7.20.12",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.20.13",
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@japa/preset-adonis": "^1.0.16",
"@japa/runner": "^2.0.8",
"@mdi/js": "^7.1.96",
"@symfony/webpack-encore": "^4.2.0",
"@tailwindcss/forms": "^0.5.2",
"@types/leaflet": "^1.9.3",
"@types/node": "^20.1.1",
"@types/proxy-addr": "^2.0.0",
"@types/source-map-support": "^0.5.6",
"@vue/tsconfig": "^0.4.0",
"adonis-preset-ts": "^2.1.0",
"autoprefixer": "^10.4.13",
"babel-preset-typescript-vue3": "^2.0.17",
"chart.js": "^4.2.0",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-adonis": "^2.1.1",
"eslint-plugin-prettier": "^4.2.1",
"naive-ui": "^2.34.3",
"numeral": "^2.0.6",
"pinia": "^2.0.30",
"pino-pretty": "^10.0.0",
"postcss-loader": "^7.0.2",
"prettier": "^2.8.8",
"tailwindcss": "^3.2.4",
"ts-loader": "^9.4.2",
"typescript": "^5.1.3",
"vue": "^3.2.47",
"vue-loader": "^17.0.1",
"youch": "^3.2.0",
"youch-terminal": "^2.1.4"
},
"dependencies": {
"@adonisjs/auth": "^8.2.3",
"@adonisjs/core": "^5.9.0",
"@adonisjs/lucid": "^18.3.0",
"@adonisjs/repl": "^3.1.11",
"@adonisjs/session": "^6.4.0",
"@adonisjs/shield": "^7.1.0",
"@adonisjs/view": "^6.1.5",
"@eidellev/adonis-stardust": "^3.0.0",
"@eidellev/inertia-adonisjs": "^8.0.0",
"@fontsource/archivo-black": "^5.0.1",
"@fontsource/inter": "^5.0.1",
"@inertiajs/inertia": "^0.11.1",
"@inertiajs/vue3": "^1.0.0",
"bcryptjs": "^2.4.3",
"crypto": "^1.0.1",
"dayjs": "^1.11.7",
"leaflet": "^1.9.3",
"luxon": "^3.2.1",
"notiwind": "^2.0.0",
"pg": "^8.9.0",
"proxy-addr": "^2.0.7",
"reflect-metadata": "^0.1.13",
"source-map-support": "^0.5.21",
"vue-facing-decorator": "^2.1.13",
"vuedraggable": "^4.1.0"
}
}

View File

@ -5,8 +5,8 @@ import bcrypt from 'bcryptjs';
const saltRounds = 10;
export class LaravelHash implements HashDriverContract {
public async make(value: string) {
const _hashedValue = bcrypt.hashSync(value, saltRounds);
return _hashedValue;
const hashedValue = bcrypt.hashSync(value, saltRounds);
return hashedValue;
}
public async verify(hashedValue: string, plainValue: string) {

View File

@ -0,0 +1,760 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0"
xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<!-- add include here for each new metadata format -->
<xsl:include href="oai_datacite.xslt" />
<xsl:include href="oai_2_iso19139.xslt" />
<xsl:output method="xml" indent="yes" encoding="utf-8" />
<xsl:param name="responseDate" />
<xsl:param name="unixTimestamp" />
<xsl:param name="email" />
<xsl:param name="earliestDatestamp" />
<xsl:param name="repositoryName" />
<xsl:param name="repIdentifier" />
<xsl:param name="doiPrefix" />
<xsl:param name="sampleIdentifier" />
<xsl:param name="dateDelete" />
<xsl:param name="totalIds" />
<xsl:param name="res" />
<xsl:param name="cursor" />
<xsl:param name="oai_verb" />
<xsl:param name="oai_metadataPrefix" />
<xsl:param name="oai_error_code" />
<xsl:param name="oai_error_message" />
<xsl:param name="baseURL" />
<!-- <xsl:param name="setPubType" />
<xsl:param name="downloadLink" />
<xsl:param name="doiLink" />
<xsl:param name="docId" />
<xsl:param name="repURL" />
<xsl:param name="oai_resumptionToken" />
<xsl:param name="oai_identifier" />
<xsl:param name="oai_from" />
<xsl:param name="oai_until" />
<xsl:param name="oai_set" /> -->
<xsl:variable name="langCodes" select="document('langCodeMap.xml')/langCodeMap/langCode"/>
<!-- Characters we'll support.
We could add control chars 0-31 and 127-159, but we won't. -->
<xsl:variable name="ascii"> !"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:variable>
<xsl:variable name="latin1">&#160;&#161;&#162;&#163;&#164;&#165;&#166;&#167;&#168;&#169;&#170;&#171;&#172;&#173;&#174;&#175;&#176;&#177;&#178;&#179;&#180;&#181;&#182;&#183;&#184;&#185;&#186;&#187;&#188;&#189;&#190;&#191;&#192;&#193;&#194;&#195;&#196;&#197;&#198;&#199;&#200;&#201;&#202;&#203;&#204;&#205;&#206;&#207;&#208;&#209;&#210;&#211;&#212;&#213;&#214;&#215;&#216;&#217;&#218;&#219;&#220;&#221;&#222;&#223;&#224;&#225;&#226;&#227;&#228;&#229;&#230;&#231;&#232;&#233;&#234;&#235;&#236;&#237;&#238;&#239;&#240;&#241;&#242;&#243;&#244;&#245;&#246;&#247;&#248;&#249;&#250;&#251;&#252;&#253;&#254;&#255;</xsl:variable>
<!-- Characters that usually don't need to be escaped -->
<xsl:variable name="safe">!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:variable>
<xsl:variable name="hex" >0123456789ABCDEF</xsl:variable>
<xsl:template name="url-encode">
<xsl:param name="str"/>
<xsl:if test="$str">
<xsl:variable name="first-char" select="substring($str,1,1)"/>
<xsl:choose>
<xsl:when test="contains($safe,$first-char)">
<xsl:value-of select="$first-char"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="codepoint">
<xsl:choose>
<xsl:when test="contains($ascii,$first-char)">
<xsl:value-of select="string-length(substring-before($ascii,$first-char)) + 32"/>
</xsl:when>
<xsl:when test="contains($latin1,$first-char)">
<xsl:value-of select="string-length(substring-before($latin1,$first-char)) + 160"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="no">Warning: string contains a character that is out of range! Substituting "?".</xsl:message>
<xsl:text>63</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="hex-digit1" select="substring($hex,floor($codepoint div 16) + 1,1)"/>
<xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
<xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length($str) &gt; 1">
<xsl:call-template name="url-encode">
<xsl:with-param name="str" select="substring($str,2)"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
<!--create the head of oai response -->
<xsl:template match="/root">
<!-- stylesheet for browser -->
<xsl:processing-instruction name="xml-stylesheet">
<xsl:text>type="text/xsl" href="assets2/oai2_style.xslt"</xsl:text>
</xsl:processing-instruction>
<OAI-PMH xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>
<xsl:value-of select="$responseDate" />
</responseDate>
<request>
<xsl:if test="$oai_verb != ''">
<xsl:attribute name="verb">
<xsl:value-of select="$oai_verb" />
</xsl:attribute>
</xsl:if>
<xsl:if test="$oai_metadataPrefix != ''">
<xsl:attribute name="metadataPrefix">
<xsl:value-of select="$oai_metadataPrefix" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$baseURL" />
</request>
<xsl:if test="string($oai_error_code) != ''">
<error>
<xsl:attribute name="code">
<xsl:value-of select="string($oai_error_code)" />
</xsl:attribute>
<xsl:value-of select="$oai_error_message" />
</error>
</xsl:if>
<!--create the rest of oai response depending on oai_verb -->
<xsl:choose>
<xsl:when test="$oai_verb='GetRecord'">
<xsl:apply-templates select="Datasets" mode="GetRecord" />
</xsl:when>
<xsl:when test="$oai_verb='Identify'">
<xsl:apply-templates select="Datasets" mode="Identify" />
</xsl:when>
<xsl:when test="$oai_verb='ListIdentifiers'">
<xsl:apply-templates select="Datasets" mode="ListIdentifiers" />
</xsl:when>
<xsl:when test="$oai_verb='ListMetadataFormats'">
<xsl:apply-templates select="Datasets" mode="ListMetadataFormats" />
</xsl:when>
<xsl:when test="$oai_verb='ListRecords'">
<xsl:apply-templates select="Datasets" mode="ListRecords" />
</xsl:when>
<xsl:when test="$oai_verb='ListSets'">
<xsl:apply-templates select="Datasets" mode="ListSets" />
</xsl:when>
</xsl:choose>
</OAI-PMH>
</xsl:template>
<!-- template for Identiy -->
<xsl:template match="Datasets" mode="Identify">
<Identify>
<repositoryName>
<xsl:value-of select="$repositoryName" />
</repositoryName>
<baseURL>
<xsl:value-of select="$baseURL" />
</baseURL>
<protocolVersion>
<xsl:text>2.0</xsl:text>
</protocolVersion>
<adminEmail>
<xsl:value-of select="$email" />
</adminEmail>
<earliestDatestamp>
<xsl:value-of select="$earliestDatestamp" />
</earliestDatestamp>
<deletedRecord>
<xsl:text>persistent</xsl:text>
</deletedRecord>
<granularity>
<xsl:text>YYYY-MM-DDThh:mm:ssZ</xsl:text>
</granularity>
<description>
<oai-identifier xmlns="http://www.openarchives.org/OAI/2.0/oai-identifier" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai-identifier http://www.openarchives.org/OAI/2.0/oai-identifier.xsd">
<scheme>
<xsl:text>oai</xsl:text>
</scheme>
<repositoryIdentifier>
<xsl:value-of select="$repIdentifier" />
</repositoryIdentifier>
<delimiter>
<xsl:text>:</xsl:text>
</delimiter>
<sampleIdentifier>
<xsl:value-of select="$sampleIdentifier" />
</sampleIdentifier>
</oai-identifier>
</description>
<!-- <description>
<eprints xmlns="http://www.openarchives.org/OAI/1.1/eprints" xsi:schemaLocation="http://www.openarchives.org/OAI/1.1/eprints http://www.openarchives.org/OAI/1.1/eprints.xsd">
<content>
<text>
Tethys RDR ist ein Datenverlag der Geologischen Bundesanstalt (GBA), der ausschließlich an der GBA generierte geowissenschaftliche Forschungsdaten publiziert.
Die Datenpublikationen können sowohl in deutscher, als auch in englischer Sprache publiziert werden.
Durch die Bereitstellung der Datenpublikation zusammen mit Metadaten nach standardisierten Schemata werden die Publikationen auffindbar und zitierbar.
</text>
<URL>https://tethys.at/help</URL>
</content>
<metadataPolicy>
<text>
All bibliographic metadata provided via this interface, except abstracts, is hereby made available under CC0 license, free to share and re-use.
</text>
<URL>http://creativecommons.org/publicdomain/zero/1.0/deed.de</URL>
</metadataPolicy>
<comment>
This institutional repository is powered by the Tethys repository software,
which is an enhancement of OPSUS4 (https://www.kobv.de/entwicklung/software/opus-4/).
See https://gitea.geologie.ac.at/geolba/tethys/ for more information.
</comment>
</eprints>
</description> -->
</Identify>
</xsl:template>
<!-- template for ListMetadataFormats -->
<xsl:template match="Datasets" mode="ListMetadataFormats">
<ListMetadataFormats>
<metadataFormat>
<metadataPrefix>
<xsl:text>oai_dc</xsl:text>
</metadataPrefix>
<schema>
<xsl:text>http://www.openarchives.org/OAI/2.0/oai_dc.xsd</xsl:text>
</schema>
<metadataNamespace>
<xsl:text>http://www.openarchives.org/OAI/2.0/oai_dc/</xsl:text>
</metadataNamespace>
</metadataFormat>
<metadataFormat>
<metadataPrefix>
<xsl:text>oai_datacite</xsl:text>
</metadataPrefix>
<schema>
<xsl:text>http://schema.datacite.org/meta/kernel-4.3/metadata.xsd</xsl:text>
</schema>
<metadataNamespace>
<xsl:text>http://datacite.org/schema/kernel-4</xsl:text>
</metadataNamespace>
</metadataFormat>
<metadataFormat>
<metadataPrefix>iso19139</metadataPrefix>
<schema>http://www.isotc211.org/2005/gmd/gmd.xsd</schema>
<metadataNamespace>http://www.isotc211.org/2005/gmd</metadataNamespace>
</metadataFormat>
</ListMetadataFormats>
</xsl:template>
<xsl:template match="Datasets" mode="ListSets">
<ListSets>
<xsl:apply-templates select="Rdr_Sets" />
</ListSets>
</xsl:template>
<xsl:template match="Rdr_Sets">
<set>
<setSpec>
<xsl:value-of select="@Type" />
</setSpec>
<setName>
<xsl:value-of select="@TypeName" />
</setName>
</set>
</xsl:template>
<xsl:template match="Datasets" mode="ListIdentifiers">
<xsl:if test="count(Rdr_Dataset) > 0">
<ListIdentifiers>
<xsl:apply-templates select="Rdr_Dataset" />
<xsl:if test="number($totalIds) > 0">
<resumptionToken>
<xsl:attribute name="expirationDate">
<xsl:value-of select="$dateDelete" />
</xsl:attribute>
<xsl:attribute name="completeListSize">
<xsl:value-of select="$totalIds" />
</xsl:attribute>
<xsl:attribute name="cursor">
<xsl:value-of select="$cursor" />
</xsl:attribute>
<xsl:value-of select="$res" />
</resumptionToken>
</xsl:if>
</ListIdentifiers>
</xsl:if>
</xsl:template>
<xsl:template match="Datasets" mode="ListRecords">
<xsl:if test="count(Rdr_Dataset) > 0">
<ListRecords>
<xsl:apply-templates select="Rdr_Dataset" />
<xsl:if test="number($totalIds) > 0">
<resumptionToken>
<xsl:attribute name="expirationDate">
<xsl:value-of select="$dateDelete" />
</xsl:attribute>
<xsl:attribute name="completeListSize">
<xsl:value-of select="$totalIds" />
</xsl:attribute>
<xsl:attribute name="cursor">
<xsl:value-of select="$cursor" />
</xsl:attribute>
<xsl:value-of select="$res" />
</resumptionToken>
</xsl:if>
</ListRecords>
</xsl:if>
</xsl:template>
<xsl:template match="Datasets" mode="GetRecord">
<GetRecord>
<xsl:apply-templates select="Rdr_Dataset" />
</GetRecord>
</xsl:template>
<xsl:template match="Rdr_Dataset">
<xsl:choose>
<xsl:when test="$oai_verb='ListIdentifiers'">
<xsl:call-template name="Rdr_Dataset_Data" />
</xsl:when>
<xsl:otherwise>
<record>
<xsl:call-template name="Rdr_Dataset_Data" />
</record>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="Rdr_Dataset_Data">
<header>
<xsl:if test="@ServerState='deleted'">
<xsl:attribute name="status">
<xsl:text>deleted</xsl:text>
</xsl:attribute>
</xsl:if>
<identifier>
<xsl:text>oai:</xsl:text>
<xsl:value-of select="$repIdentifier" />
<xsl:text>:</xsl:text>
<xsl:value-of select="@PublishId" />
</identifier>
<datestamp>
<xsl:choose>
<xsl:when test="ServerDateModified">
<xsl:variable name="dateModified" select="concat(
ServerDateModified/@Year, '-',
format-number(number(ServerDateModified/@Month),'00'), '-',
format-number(number(ServerDateModified/@Day),'00'), 'T',
format-number(number(ServerDateModified/@Hour),'00'), ':',
format-number(number(ServerDateModified/@Minute),'00'), ':',
format-number(number(ServerDateModified/@Second),'00'), 'Z'
)" />
<xsl:value-of select="$dateModified" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="datePublished" select="concat(
ServerDatePublished/@Year, '-',
format-number(number(ServerDatePublished/@Month),'00'), '-',
format-number(number(ServerDatePublished/@Day),'00'), 'T',
format-number(number(ServerDatePublished/@Hour),'00'), ':',
format-number(number(ServerDatePublished/@Minute),'00'), ':',
format-number(number(ServerDatePublished/@Second),'00'), 'Z'
)" />
<xsl:value-of select="$datePublished" />
</xsl:otherwise>
</xsl:choose>
</datestamp>
<!--<setSpec>
<xsl:value-of select="SetSpec/@Value"/>
</setSpec>-->
<!--loop-->
<xsl:apply-templates select="SetSpec" />
<setSpec>
<xsl:text>open_access</xsl:text>
</setSpec>
<setSpec>
<xsl:text>doc-type:ResearchData</xsl:text>
</setSpec>
</header>
<xsl:choose>
<!-- nicht bei ListIdentifiers und auch nicht bei gelöschten Datensätzen-->
<xsl:when test="$oai_verb!='ListIdentifiers' and @ServerState!='deleted'">
<metadata>
<!-- <xsl:value-of select="$oai_metadataPrefix" /> -->
<xsl:choose>
<xsl:when test="$oai_metadataPrefix='oai_dc'">
<xsl:apply-templates select="." mode="oai_dc" />
</xsl:when>
<xsl:when test="$oai_metadataPrefix='oai_datacite'">
<xsl:apply-templates select="." mode="oai_datacite" />
</xsl:when>
<xsl:when test="$oai_metadataPrefix='iso19139'">
<xsl:apply-templates select="." mode="iso19139" />
</xsl:when>
</xsl:choose>
</metadata>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="SetSpec">
<setSpec>
<xsl:value-of select="@Value" />
</setSpec>
</xsl:template>
<xsl:template match="Rdr_Dataset" mode="oai_dc">
<oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<!-- dc:title -->
<xsl:apply-templates select="TitleMain" mode="oai_dc" />
<!-- dc:title -->
<xsl:apply-templates select="TitleAdditional" mode="oai_dc" />
<!--<dc:creator>-->
<!-- Creator: Autor (falls vorhanden), sonst Herausgeber (falls vorhanden), sonst Urhebende Koerperschaft -->
<xsl:choose>
<xsl:when test="PersonAuthor">
<xsl:apply-templates select="PersonAuthor" mode="oai_dc">
<xsl:sort select="@SortOrder"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@CreatingCorporation">
<dc:creator>
<xsl:value-of select="@CreatingCorporation" />
</dc:creator>
</xsl:when>
</xsl:choose>
<!-- dc:subject -->
<xsl:apply-templates select="Subject" mode="oai_dc" />
<xsl:apply-templates select="Collection" mode="oai_dc" />
<!-- dc:description -->
<xsl:apply-templates select="TitleAbstract" mode="oai_dc" />
<!-- dc:description -->
<xsl:apply-templates select="TitleAbstractAdditional" mode="oai_dc" />
<!-- dc:publisher -->
<dc:publisher>
<!-- <xsl:value-of select="@PublisherName" /> -->
<xsl:value-of select="@CreatingCorporation" />
</dc:publisher>
<!-- dc:contributor -->
<xsl:apply-templates select="PersonContributor" mode="oai_dc">
<xsl:sort select="@SortOrder"/>
</xsl:apply-templates>
<!-- dc:date (call-template, weil die 'Funktion' nur einmal aufgerufen werden soll, nicht einmal für jedes Date-->
<xsl:call-template name="RdrDate" />
<!-- dc:date: embargo date -->
<xsl:apply-templates select="EmbargoDate" mode="oai_dc" />
<!-- dc:type -->
<dc:type> <xsl:text>Dataset</xsl:text></dc:type>
<dc:type>
<xsl:text>doc-type:ResearchData</xsl:text>
</dc:type>
<!-- dc:format -->
<xsl:apply-templates select="File/@MimeType" mode="oai_dc" />
<!-- <dc:format> -->
<xsl:apply-templates select="File" mode="oai_dc" />
<!-- dc:identifier -->
<!-- <xsl:if test="Identifier">
<xsl:apply-templates select="Identifier" mode="oai_dc" />
</xsl:if> -->
<dc:identifier>
<xsl:value-of select="string(@landingpage)" />
<!-- <xsl:call-template name="url-encode">
<xsl:with-param name="str" select="@landingpage"/>
</xsl:call-template> -->
</dc:identifier>
<!-- dc:language -->
<xsl:apply-templates select="@Language" mode="oai_dc" />
<!-- dc:relation -->
<xsl:if test="Identifier">
<xsl:apply-templates select="Identifier" mode="oai_dc" />
</xsl:if>
<xsl:apply-templates select="Reference" mode="oai_dc" />
<!-- dc:coverage -->
<xsl:apply-templates select="Coverage" mode="oai_dc" />
<!-- dc:rights -->
<xsl:apply-templates select="Licence" mode="oai_dc" />
<xsl:if test="EmbargoDate and ($unixTimestamp &lt; EmbargoDate/@UnixTimestamp)">
<dc:rights>embargo</dc:rights>
</xsl:if>
<!-- dc:source -->
<xsl:call-template name="citation"/>
</oai_dc:dc>
</xsl:template>
<xsl:template name="citation">
<dc:source>
<xsl:variable name="creatorName">
<xsl:for-each select="*[name() = 'PersonAuthor']">
<xsl:variable name="person" select="."/>
<xsl:variable name="uppercase" select="'ABC..XYZ'"/>
<xsl:variable name="lowercase" select="'abc..zyz'"/>
<xsl:variable name="authorName">
<xsl:choose>
<xsl:when test="string($person/@FirstName)">
<xsl:variable name="name" select="concat(
$person/@LastName, ', ', concat(translate(substring($person/@FirstName, 1, 1), $lowercase, $uppercase), '.')
)" />
<xsl:value-of select="$name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$person/@LastName"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="normalize-space($authorName)"/>
<xsl:choose>
<xsl:when test="position() != last()">,</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="year" select="concat( ' (', string(ServerDatePublished/@Year), '): ' )" />
<xsl:variable name="mainTitle" select="string(TitleMain/@Value)" />
<xsl:variable name="creatingCorporation" select="concat('.', string(@CreatingCorporation), ', ')" />
<xsl:variable name="publisherName" select="string(@PublisherName)" />
<xsl:value-of select="concat($creatorName, $year, $mainTitle, $creatingCorporation, $publisherName, ', Wien')"/>
</dc:source>
</xsl:template>
<xsl:template match="Coverage" mode="oai_dc">
<dc:coverage>
<xsl:variable name="geolocation" select="concat(
'SOUTH-BOUND LATITUDE: ', @YMin,
' * WEST-BOUND LONGITUDE: ', @XMin,
' * NORTH-BOUND LATITUDE: ', @YMax,
' * EAST-BOUND LONGITUDE: ', @XMax
)" />
<xsl:value-of select="$geolocation" />
<!-- <xsl:text>&#xA;</xsl:text> -->
<xsl:if test="@ElevationMin != '' and @ElevationMax != ''">
<xsl:value-of select="concat(' * ELEVATION MIN: ', @ElevationMin, ' * ELEVATION MAX: ', @ElevationMax)" />
</xsl:if>
<xsl:if test="@ElevationAbsolut != ''">
<xsl:value-of select="concat(' * ELEVATION ABSOLUT: ', @ElevationAbsolut)" />
</xsl:if>
<!-- <xsl:text>&#xA;</xsl:text> -->
<xsl:if test="@DepthMin != '' and @DepthMax != ''">
<xsl:value-of select="concat(' * DEPTH MIN: ', @DepthMin, ' * DEPTH MAX: ', @DepthMax)" />
</xsl:if>
<xsl:if test="@DepthAbsolut != ''">
<xsl:value-of select="concat(' * DEPTH ABSOLUT: ', @DepthAbsolut)" />
</xsl:if>
<!-- <xsl:text>&#xA;</xsl:text> -->
<xsl:if test="@TimeMin != '' and @TimeMax != ''">
<xsl:value-of select="concat(' * TIME MIN: ', @TimeMin, ' * TIME MAX: ', @TimeMax)" />
</xsl:if>
<xsl:if test="@TimeAbsolut != ''">
<xsl:value-of select="concat(' * TIME ABSOLUT: ', @TimeAbsolut)" />
</xsl:if>
</dc:coverage>
</xsl:template>
<xsl:template match="TitleMain" mode="oai_dc">
<dc:title>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
<xsl:value-of select="@Value" />
</dc:title>
</xsl:template>
<xsl:template match="TitleAdditional" mode="oai_dc">
<dc:title>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
<xsl:value-of select="@Value" />
</dc:title>
</xsl:template>
<xsl:template match="TitleAbstract" mode="oai_dc">
<dc:description>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
<xsl:value-of select="@Value" />
</dc:description>
</xsl:template>
<xsl:template match="TitleAbstractAdditional" mode="oai_dc">
<dc:description>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
<xsl:value-of select="@Value" />
</dc:description>
</xsl:template>
<xsl:template match="Subject" mode="oai_dc">
<dc:subject>
<xsl:if test="@Language != ''">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@Value" />
</dc:subject>
</xsl:template>
<xsl:template match="Collection" mode="oai_dc">
<dc:subject>
<!-- <xsl:if test="@Language != ''">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
</xsl:if> -->
<xsl:value-of select="concat(string(@Collectionrole.Name), ':', string(@Number))" />
</dc:subject>
</xsl:template>
<xsl:template match="Reference" mode="oai_dc">
<dc:relation>
<xsl:value-of select="string(@Value)" />
<!-- <xsl:call-template name="url-encode">
<xsl:with-param name="str" select="@Value"/>
</xsl:call-template> -->
</dc:relation>
</xsl:template>
<xsl:template match="PersonAuthor|PersonEditor" mode="oai_dc">
<dc:creator>
<xsl:value-of select="@LastName" />
<xsl:if test="@FirstName != ''">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@FirstName" />
<xsl:if test="@AcademicTitle != ''">
<xsl:text> (</xsl:text>
<xsl:value-of select="@AcademicTitle" />
<xsl:text>)</xsl:text>
</xsl:if>
</dc:creator>
</xsl:template>
<xsl:template match="PersonContributor" mode="oai_dc">
<dc:contributor>
<xsl:value-of select="@LastName" />
<xsl:if test="@FirstName != ''">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@FirstName" />
<xsl:if test="@AcademicTitle != ''">
<xsl:text> (</xsl:text>
<xsl:value-of select="@AcademicTitle" />
<xsl:text>)</xsl:text>
</xsl:if>
</dc:contributor>
</xsl:template>
<xsl:template name="RdrDate">
<dc:date>
<xsl:choose>
<xsl:when test="PublishedDate">
<xsl:variable name="publishedDate" select="concat(
PublishedDate/@Year, '-',
format-number(number(PublishedDate/@Month),'00'), '-',
format-number(number(PublishedDate/@Day),'00')
)" />
<xsl:value-of select="$publishedDate" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="serverDatePublished" select="concat(
ServerDatePublished/@Year, '-',
format-number(number(ServerDatePublished/@Month),'00'), '-',
format-number(number(ServerDatePublished/@Day),'00')
)" />
<xsl:value-of select="$serverDatePublished" />
</xsl:otherwise>
</xsl:choose>
</dc:date>
</xsl:template>
<xsl:template match="EmbargoDate" mode="oai_dc">
<xsl:if test="$unixTimestamp &lt; ./@UnixTimestamp">
<dc:date>
<xsl:text>info:eu-repo/date/embargoEnd/</xsl:text>
<xsl:value-of select="./@Year" />
-
<xsl:value-of select="format-number(number(./@Month),'00')" />
-
<xsl:value-of select="format-number(number(./@Day),'00')" />
</dc:date>
</xsl:if>
</xsl:template>
<!-- für ListRecords -->
<!-- <xsl:template match="@Type" mode="oai_dc">
<dc:type>
<xsl:value-of select="." />
</dc:type>
<dc:type>
<xsl:text>data-type:</xsl:text>
<xsl:value-of select="." />
</dc:type>
</xsl:template> -->
<xsl:template match="File/@MimeType" mode="oai_dc">
<dc:format>
<xsl:choose>
<xsl:when test=". = 'application/x-sqlite3'">
<xsl:text>application/geopackage+sqlite3</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</dc:format>
</xsl:template>
<!-- <xsl:template match="File" mode="oai_dc">
<dc:identifier>
<xsl:value-of select="@PathName" />
<xsl:value-of select="concat($downloadLink, @Id)" />
</dc:identifier>
</xsl:template> -->
<xsl:template match="Identifier" mode="oai_dc">
<dc:relation>
<!-- <xsl:value-of select="concat($doiLink, @Value)" /> -->
<xsl:value-of select="concat($doiPrefix, string(@Value))" />
<!-- <xsl:call-template name="url-encode">
<xsl:with-param name="str" select="concat($doiPrefix, @Value)"/>
</xsl:call-template> -->
</dc:relation>
</xsl:template>
<xsl:template match="@CreatingCorporation" mode="oai_dc">
<dc:language>
<xsl:value-of select="." />
</dc:language>
</xsl:template>
<xsl:template match="@Language" mode="oai_dc">
<xsl:variable name="language" select="string(.)"/>
<dc:language>
<!-- <xsl:value-of select="." /> -->
<xsl:value-of select="$langCodes[@iso639-1 = $language]/@iso639-2" />
</dc:language>
</xsl:template>
<xsl:template match="Licence" mode="oai_dc">
<dc:rights>
<xsl:value-of select="@NameLong" />
</dc:rights>
<xsl:if test="@Name = 'CC-BY-4.0' or @Name = 'CC-BY-SA-4.0'">
<dc:rights>
<xsl:text>info:eu-repo/semantics/openAccess</xsl:text>
</dc:rights>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because one or more lines are too long

BIN
public/assets2/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,915 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://example.com/functions"
xmlns:gml="http://www.opgeris.net/gml/3.2"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
exclude-result-prefixes="#all"
expand-text="yes"
version="3.0">
<xsl:variable name="resourcetype">
<!-- <xsl:value-of select="//*[local-name() = 'resourceType']/@resourceTypeGeneral"/> -->
<xsl:text>Dataset</xsl:text>
</xsl:variable>
<xsl:variable name="MDScopecode">
<xsl:choose>
<xsl:when test="$resourcetype = 'Dataset'">dataset</xsl:when>
<xsl:when test="$resourcetype = 'Software'">software</xsl:when>
<xsl:when test="$resourcetype = 'Service'">service</xsl:when>
<xsl:when test="$resourcetype = 'Model'">model</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$resourcetype"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="MDScopelist">
<xsl:choose>
<xsl:when test="$resourcetype = 'Dataset' or $resourcetype = 'Software' or $resourcetype = 'Service' or $resourcetype = 'Model'">http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode</xsl:when>
<xsl:otherwise>http://datacite.org/schema/kernel-4</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="datacentre">
<xsl:choose>
<xsl:when test="string-length(normalize-space(@CreatingCorporation)) > 0">
<xsl:value-of select="normalize-space(@CreatingCorporation)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('Tethys RDR')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- <xsl:function name="fn:FormatDate" as="xs:string">
<xsl:param name="DateTime" as="xs:string" />
<xsl:variable name="date">
<xsl:value-of select="substring-before($DateTime,'T')" />
</xsl:variable>
<xsl:if test="string-length($date) = 10">
<xsl:value-of select="$date"/>
</xsl:if>
</xsl:function> -->
<!--gmd:hierarchyLevel template-->
<xsl:template name="hierarchylevel">
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode>
<xsl:attribute name="codeList">
<xsl:value-of select="$MDScopelist"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="$MDScopecode"/>
</xsl:attribute>
<xsl:value-of select="$MDScopecode"/>
</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
</xsl:template>
<!-- gmd:contact template-->
<xsl:template name="metadatacontact">
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Research Data Repository</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Neulinggasse 38</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>Vienna</gco:CharacterString>
</gmd:city>
<gmd:administrativeArea>
<gco:CharacterString>Vienna</gco:CharacterString>
</gmd:administrativeArea>
<gmd:postalCode>
<gco:CharacterString>1030</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>AT</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>repository@geologie.ac.at</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<!-- only allow one online resource; choose the logo...-->
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://tethys.at</gmd:URL>
</gmd:linkage>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="information">information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
</xsl:template>
<!-- retrieves basic reference dates of the resource
Handles created date, publication (Available) date, and revision date-->
<!-- stower 2022, Created auf created geändert -->
<xsl:template name="resourcedates">
<xsl:if test="*[name() = 'CreatedAt']">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<!-- <xsl:variable name="theDate" select="normalize-space(*[name() = 'CreatedAt'])"/> -->
<xsl:variable name="theDate">
<xsl:value-of select="normalize-space(concat(
CreatedAt/@Year, '-',
format-number(number(CreatedAt/@Month),'00'), '-',
format-number(number(CreatedAt/@Day),'00'), 'T',
format-number(number(CreatedAt/@Hour),'00'), ':',
format-number(number(CreatedAt/@Minute),'00'), ':',
format-number(number(CreatedAt/@Second),'00'), 'Z'
))"/>
</xsl:variable>
<!-- ieda dataCite labels metadata update date in the date string to avoid ambiguity -->
<xsl:choose>
<xsl:when test="$theDate != ''">
<xsl:choose>
<xsl:when test="contains($theDate, 'T')">
<gco:DateTime>
<xsl:value-of select="$theDate"/>
</gco:DateTime>
</xsl:when>
<xsl:when test="contains($theDate, ' ')">
<gco:DateTime>
<xsl:value-of select="translate($theDate, ' ', 'T')"/>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:value-of select="$theDate"/>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- other write the output of missing -->
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="string('created date missing')"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:if>
<xsl:choose>
<!-- Take 'Available' (embargo) date first because that is YYYY-MM-DD -->
<xsl:when test="*[local-name() = 'EmbargoDate']">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="embargoDate" select="concat(
EmbargoDate/@Year, '-',
format-number(number(EmbargoDate/@Month),'00'), '-',
format-number(number(EmbargoDate/@Day),'00')
)" />
<gco:Date>
<xsl:value-of select="$embargoDate"/>
</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:when>
<xsl:when test="*[local-name() = 'ServerDatePublished']">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="publicationDate" select="concat(
ServerDatePublished/@Year, '-',
format-number(number(ServerDatePublished/@Month),'00'), '-',
format-number(number(ServerDatePublished/@Day),'00'), 'T',
format-number(number(ServerDatePublished/@Hour),'00'), ':',
format-number(number(ServerDatePublished/@Minute),'00'), ':',
format-number(number(ServerDatePublished/@Second),'00'), 'Z'
)" />
<gco:DateTime>
<xsl:value-of select="$publicationDate"/>
</gco:DateTime>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:when>
<xsl:otherwise>
<gmd:date gco:nilReason="missing"/>
</xsl:otherwise>
</xsl:choose>
<!-- the following test is designed to filter out update-metadata dates if these follow the convention
that metadata update date strings are prefixed with 'metadata'-->
<xsl:if test="@ServerDateModified">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="updateDate" select="normalize-space(@ServerDateModified)"/>
<!-- ieda dataCite labels metadata update date in the date string to avoid ambiguity -->
<xsl:choose>
<xsl:when test="$updateDate != ''">
<xsl:choose>
<xsl:when test="contains($updateDate, 'T')">
<gco:DateTime>
<xsl:value-of select="$updateDate"/>
</gco:DateTime>
</xsl:when>
<xsl:when test="contains($updateDate, ' ')">
<gco:DateTime>
<xsl:value-of select="translate($updateDate, ' ', 'T')"/>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:value-of select="$updateDate"/>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="string('missing')"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:if>
</xsl:template>
<xsl:template name="ci_responsibleparty">
<xsl:param name="individual"/>
<xsl:param name="httpuri"/>
<xsl:param name="personidtype"/>
<xsl:param name="organisation"/>
<xsl:param name="position"/>
<xsl:param name="role"/>
<xsl:param name="email"/>
<xsl:param name="datacite-creatorname"/>
<!-- <xsl:variable name="datacite-creatorname" select="//*[name() = 'creatorName'][@nameType = 'Organizational']"/> -->
<gmd:CI_ResponsibleParty>
<!-- stower 2022, wenn Autor oder Creator nur Organisation und Individual = missing -->
<xsl:if test="$individual != ''">
<xsl:choose>
<xsl:when test="$individual = 'missing'">
<gmd:individualName gco:nilReason="missing"/>
</xsl:when>
<xsl:otherwise>
<gmd:individualName>
<gco:CharacterString>
<xsl:value-of select="$individual"/>
</gco:CharacterString>
</gmd:individualName>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- stower 2022, wenn Autor oder Creator nur Organisation -->
<xsl:if test="$individual = 'missing' or ''">
<gmd:organisationName>
<gco:CharacterString>
<xsl:value-of select="$datacite-creatorname"/>
</gco:CharacterString>
</gmd:organisationName>
</xsl:if>
<xsl:if test="$organisation != ''">
<gmd:organisationName>
<gco:CharacterString>
<xsl:value-of select="$organisation"/>
</gco:CharacterString>
</gmd:organisationName>
</xsl:if>
<xsl:if test="$position != ''">
<gmd:positionName>
<gco:CharacterString>
<xsl:value-of select="$position"/>
</gco:CharacterString>
</gmd:positionName>
</xsl:if>
<gmd:contactInfo>
<gmd:CI_Contact>
<!-- gmd:address -->
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<xsl:choose>
<xsl:when test="$email != ''">
<gco:CharacterString>
<xsl:value-of select="$email"/>
</gco:CharacterString>
</xsl:when>
<xsl:otherwise>
<!-- stower 2022 -->
<gco:CharacterString>
<xsl:value-of select="string('repository@geologie.ac.at')"/>
</gco:CharacterString>
</xsl:otherwise>
</xsl:choose>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<xsl:if test="$httpuri != ''">
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:value-of select="$httpuri"/>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>
<xsl:value-of select="$personidtype"/>
</gco:CharacterString>
</gmd:protocol>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</xsl:if>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- <gmd:role> -->
<gmd:role>
<gmd:CI_RoleCode>
<xsl:attribute name="codeList">http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="$role"/>
</xsl:attribute>
<xsl:value-of select="$role"/>
</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</xsl:template>
<!-- <gmd:pointOfContact> -->
<xsl:template name="pointofcontact_custodian">
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>repository@geologie.ac.at</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://www.tethys.at/</gmd:URL>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- <gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role> -->
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="custodian">custodian</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
</xsl:template>
<!-- <gmd:pointOfContact> -->
<xsl:template name="pointofcontact_originator">
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Tethys RDR</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>repository@geologie.ac.at</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://www.tethys.at/</gmd:URL>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- <gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role> -->
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="originator">originator</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
</xsl:template>
<!-- gmd:graphicOverview - retrieves tethys logo as browse graphic, stower 2022 -->
<xsl:template name="browseGraphictethys">
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<gco:CharacterString>https://tethys.at/assets/TETHYS-Logo.svg</gco:CharacterString>
</gmd:fileName>
<gmd:fileDescription>
<gco:CharacterString>TETHYS RDR</gco:CharacterString>
</gmd:fileDescription>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
</xsl:template>
<!-- gmd:descriptiveKeywords - retrieves non-thesaurus keywords -->
<xsl:template name="freekeywords">
<xsl:if test="//*[name() = 'Subject' and normalize-space(@Type) = 'Uncontrolled']">
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<xsl:for-each select="*[name() = 'Subject' and normalize-space(@Type) = 'Uncontrolled']">
<gmd:keyword>
<gco:CharacterString>
<xsl:value-of select="normalize-space(@Value)"/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<gmd:type>
<gmd:MD_KeywordTypeCode xmlns="http://www.isotc211.org/2005/gmd" codeList="https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_KeywordTypeCode" codeListValue="theme">theme</gmd:MD_KeywordTypeCode>
</gmd:type>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:if>
</xsl:template>
<!-- gmd:descriptiveKeywords - for datacenter -->
<xsl:template name="datacenter_keyword">
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>
<xsl:value-of select="$datacentre"/>
</gco:CharacterString>
</gmd:keyword>
<gmd:type>
<gmd:MD_KeywordTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode" codeListValue="dataCentre">Tethys RDR</gmd:MD_KeywordTypeCode>
</gmd:type>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:template>
<!-- <gmd:extent> -->
<xsl:template name="spatialcoverage">
<gmd:extent>
<gmd:EX_Extent>
<xsl:if test="//*[name() = 'Coverage']">
<!-- <xsl:variable name="thebox" select="//*[name() = 'Coverage']"/> -->
<xsl:variable name="sLat">
<xsl:choose>
<xsl:when test="string(Coverage/@YMin) != ''">
<xsl:value-of select="number(Coverage/@YMin)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="wLong">
<xsl:choose>
<xsl:when test="string(Coverage/@XMin) != ''">
<xsl:value-of select="number(Coverage/@XMin)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nLat">
<xsl:choose>
<xsl:when test="string(Coverage/@YMax) != ''">
<xsl:value-of select="number(Coverage/@YMax)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="eLong">
<xsl:choose>
<xsl:when test="string(Coverage/@XMax) != ''">
<xsl:value-of select="number(Coverage/@XMax)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="
string($nLat) != 'NaN' and string($wLong) != 'NaN' and
string($sLat) != 'NaN' and string($eLong) != 'NaN'">
<!-- <xsl:value-of select="$nLat"/> -->
<xsl:choose>
<!-- check for degenerate bbox -->
<xsl:when test="$nLat = $sLat and $eLong = $wLong">
<gmd:geographicElement>
<gmd:EX_BoundingPolygon>
<gmd:polygon>
<gml:Point>
<!-- generate a unique id of the source xml node -->
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id(.)"/>
</xsl:attribute>
<gml:pos>
<xsl:value-of select="$sLat"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$wLong"/>
</gml:pos>
</gml:Point>
</gmd:polygon>
</gmd:EX_BoundingPolygon>
</gmd:geographicElement>
</xsl:when>
<!-- check to see if box crosses 180 with west side either in east long (positive) or <-180, or east side
>180. If so, create two bounding box geographicElements-->
<xsl:when test="($wLong &gt;0 and $eLong &lt;0)">
<!-- use east longitude coordinates -->
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$wLong"/>
</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>
<xsl:value-of select="180"/>
</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$sLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$nLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$sLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>
<xsl:value-of select="-180"/>
</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$eLong"/>
</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$sLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$nLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$sLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</xsl:when>
<xsl:otherwise>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:extentTypeCode>
<gco:Boolean>true</gco:Boolean>
</gmd:extentTypeCode>
<gmd:westBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$wLong"/>
</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>
<xsl:value-of select="$eLong"/>
</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$sLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$nLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>
<xsl:choose>
<xsl:when test="number($sLat) &lt; number($nLat)">
<xsl:value-of select="$nLat"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$sLat"/>
</xsl:otherwise>
</xsl:choose>
</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
</gmd:EX_Extent>
</gmd:extent>
</xsl:template>
<!-- <gmd:onLine> -->
<xsl:template name="datacite_identifier">
<xsl:for-each select="*[name() = 'Identifier']">
<xsl:variable name="identifier" select="."/>
<xsl:if test="starts-with($identifier/@Value, 'doi:') or $identifier/@Type = 'Doi' or starts-with($identifier/@Value, 'http://')">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:choose>
<xsl:when test="starts-with($identifier/@Value, 'doi:')">
<!-- stower http auf https gesetzt -->
<xsl:value-of select="concat('http://dx.doi.org/', substring-after($identifier/@Value, 'doi:'))"/>
</xsl:when>
<xsl:when test="$identifier/@Type = 'Doi'">
<xsl:value-of select="concat('http://dx.doi.org/', normalize-space($identifier/@Value))"/>
</xsl:when>
<xsl:when test="starts-with($identifier/@Value, 'http://')">
<xsl:value-of select="normalize-space($identifier/@Value)"/>
</xsl:when>
</xsl:choose>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>Landing Page</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(
'Link to DOI landing page or data facility landing page if no DOI is assigned.'))"/>
</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="information">information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- <gmd:onLine> -->
<xsl:template name="alternate_identifier">
<xsl:if test="@landingpage != '' and starts-with(normalize-space(string(@landingpage)), 'http')">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:value-of select="string(@landingpage)"/>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>
<xsl:value-of select="string('url')"/>
</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>Link to a web page related to the resource.</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="information">information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:if>
</xsl:template>
<!-- <gmd:dataQualityInfo> -->
<xsl:template name="data_quality">
<gmd:dataQualityInfo>
<gmd:DQ_DataQuality>
<gmd:scope>
<gmd:DQ_Scope>
<gmd:level>
<gmd:MD_ScopeCode xmlns="http://www.isotc211.org/2005/gmd" codeList="http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" />
</gmd:level>
<gmd:levelDescription xmlns:gco="http://www.isotc211.org/2005/gco" gco:nilReason="inapplicable" />
</gmd:DQ_Scope>
</gmd:scope>
<gmd:report>
<gmd:DQ_DomainConsistency>
<gmd:result>
<gmd:DQ_ConformanceResult>
<gmd:specification>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString xmlns:gco="http://www.isotc211.org/2005/gco">VERORDNUNG (EG) Nr. 1089/2010 DER KOMMISSION vom 23. November 2010 zur Durchführung der Richtlinie 2007/2/EG des Europäischen Parlaments und des Rates hinsichtlich der Interoperabilität von Geodatensätzen und -diensten</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date xmlns:gco="http://www.isotc211.org/2005/gco">2010-12-08</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode xmlns="http://www.isotc211.org/2005/gmd" codeList="https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication" />
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:specification>
<gmd:explanation>
<gco:CharacterString xmlns:gco="http://www.isotc211.org/2005/gco">Datenstruktur entspricht INSPIRE</gco:CharacterString>
</gmd:explanation>
<gmd:pass>
<gco:Boolean xmlns:gco="http://www.isotc211.org/2005/gco">true</gco:Boolean>
</gmd:pass>
</gmd:DQ_ConformanceResult>
</gmd:result>
</gmd:DQ_DomainConsistency>
</gmd:report>
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString xmlns:gco="http://www.isotc211.org/2005/gco">Digitalisierung</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
</gmd:DQ_DataQuality>
</gmd:dataQualityInfo>
</xsl:template>
<!-- <gmd:distributor> -->
<xsl:variable name="distributorOrganisation" select="string('Geological Survey of Austria')"/>
<xsl:variable name="distributorContactEmail" select="string('repository@geologie.ac.at')"/>
<xsl:template name="distributor">
<gmd:distributor>
<gmd:MD_Distributor>
<gmd:distributorContact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString>
<xsl:value-of select="$distributorOrganisation"/>
</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>
<xsl:value-of select="$distributorContactEmail"/>
</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="distributor" codeSpace="ISOTC211/19115">distributor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:distributorContact>
</gmd:MD_Distributor>
</gmd:distributor>
</xsl:template>
<xsl:variable name="maintenanceContactID" select="string('https://www.re3data.org/repository/r3d100013400')"/>
<xsl:variable name="maintenanceContactName" select="string('Tethys RDR')"/>
<xsl:variable name="maintenanceContactEmail" select="string('repository@geologie.ac.at')"/>
<xsl:template name="metadata_maintenance">
<gmd:metadataMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">asNeeded</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
<gmd:contact>
<xsl:if test="$maintenanceContactID != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$maintenanceContactID"/>
</xsl:attribute>
</xsl:if>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>
<xsl:value-of select="$maintenanceContactName"/>
</gco:CharacterString>
</gmd:individualName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>
<xsl:value-of select="$maintenanceContactEmail"/>
</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="processor">processor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
</gmd:MD_MaintenanceInformation>
</gmd:metadataMaintenance>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- langCodeMap.xml -->
<langCodeMap>
<langCode iso639-1="de" iso639-2="ger"/>
<langCode iso639-1="en" iso639-2="eng"/>
<langCode iso639-1="es" iso639-2="spa"/>
<langCode iso639-1="it" iso639-2="ita"/>
</langCodeMap>

645
public/assets2/marc21.xslt Normal file
View File

@ -0,0 +1,645 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* This file is part of OPUS. The software OPUS has been originally developed
* at the University of Stuttgart with funding from the German Research Net,
* the Federal Department of Higher Education and Research and the Ministry
* of Science, Research and the Arts of the State of Baden-Wuerttemberg.
*
* OPUS 4 is a complete rewrite of the original OPUS software and was developed
* by the Stuttgart University Library, the Library Service Center
* Baden-Wuerttemberg, the North Rhine-Westphalian Library Service Center,
* the Cooperative Library Network Berlin-Brandenburg, the Saarland University
* and State Library, the Saxon State Library - Dresden State and University
* Library, the Bielefeld University Library and the University Library of
* Hamburg University of Technology with funding from the German Research
* Foundation and the European Regional Development Fund.
*
* LICENCE
* OPUS is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or any later version.
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Application
* @package Module_Export
* @author Alexander Weimar <alexander.weimar@bsz-bw.de>
* @author Sascha Szott <opus-development@saschaszott.de>
* @copyright Copyright (c) 2008-2019, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/
-->
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:marc="http://www.loc.gov/MARC21/slim"
xmlns:php="http://php.net/xsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="Rdr_Dataset" mode="marc21">
<marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim"
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
<marc:record>
<xsl:variable name="aufnahmeart">
<xsl:choose>
<xsl:when test="./@Type='article'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='bachelorthesis'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='book'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='bookpart'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='conferenceobject'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='contributiontoperiodical'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='coursematerial'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='diplom'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='doctoralthesis'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='examen'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='habilitation'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='image'"> <xsl:value-of select="'k'"/></xsl:when>
<xsl:when test="./@Type='lecture'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='magister'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='masterthesis'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='movingimage'"> <xsl:value-of select="'g'"/></xsl:when>
<xsl:when test="./@Type='other'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='periodical'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='periodicalpart'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='preprint'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='report'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='review'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='sound'"> <xsl:value-of select="'i'"/></xsl:when>
<xsl:when test="./@Type='studythesis'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='workingpaper'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:otherwise>
<xsl:text>a</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="bibliographischesLevel">
<xsl:choose>
<xsl:when test="./@Type='article'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='bachelorthesis'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='book'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='bookpart'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='conferenceobject'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='contributiontoperiodical'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='coursematerial'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='diplom'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='doctoralthesis'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='examen'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='habilitation'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='image'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='lecture'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='magister'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='masterthesis'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='movingimage'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='other'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='periodical'"> <xsl:value-of select="'s'"/></xsl:when>
<xsl:when test="./@Type='periodicalpart'"> <xsl:value-of select="'a'"/></xsl:when>
<xsl:when test="./@Type='preprint'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='report'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='review'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='sound'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='studythesis'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:when test="./@Type='workingpaper'"> <xsl:value-of select="'m'"/></xsl:when>
<xsl:otherwise>
<xsl:text>m</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Reihenfolge Verwendung Jahr:
1. CompletedYear
2. CompletedDate
3. PublishedYear
4. PublishedDate
5. ServerDatePublished (Fallback; ist immer vorhanden, wenn das Dokument freigeschaltet wurde)
-->
<xsl:variable name="year">
<xsl:choose>
<xsl:when test="./@CompletedYear">
<xsl:value-of select="./@CompletedYear"/>
</xsl:when>
<xsl:when test="./CompletedDate/@Year">
<xsl:value-of select="./CompletedDate/@Year"/>
</xsl:when>
<xsl:when test="./@PublishedYear">
<xsl:value-of select="./@PublishedYear"/>
</xsl:when>
<xsl:when test="./PublishedDate/@Year">
<xsl:value-of select="./PublishedDate/@Year"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./ServerDatePublished/@Year"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<marc:leader>
<xsl:text>00000n</xsl:text>
<xsl:value-of select="$aufnahmeart"/>
<xsl:value-of select="$bibliographischesLevel"/>
<xsl:text> a22000005 4500</xsl:text>
</marc:leader>
<marc:controlfield tag="001">
<xsl:text>docId-</xsl:text>
<xsl:value-of select="@Id"/>
</marc:controlfield>
<!-- ISIL der Bibliothek-->
<xsl:variable name="isil">
<xsl:value-of select="php:functionString('Application_Xslt::optionValue', 'isil', 'marc21')"/>
</xsl:variable>
<xsl:if test="$isil != ''">
<marc:controlfield tag="003">
<xsl:value-of select="$isil"/>
</marc:controlfield>
</xsl:if>
<marc:controlfield tag="007">
<xsl:text>cr uuu---uunan</xsl:text>
</marc:controlfield>
<xsl:if test="not(./TitleParent) and ./Identifier[@Type = 'isbn']">
<xsl:for-each select="./Identifier[@Type = 'isbn']">
<marc:datafield ind1=" " ind2=" " tag="020">
<marc:subfield code="a">
<xsl:value-of select="./@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
</xsl:if>
<xsl:if test="not(./TitleParent) and ./Identifier[@Type = 'issn']">
<xsl:for-each select="./Identifier[@Type = 'issn']">
<marc:datafield ind1=" " ind2=" " tag="022">
<marc:subfield code="a">
<xsl:value-of select="./@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
</xsl:if>
<xsl:if test="./Identifier[@Type = 'urn']">
<marc:datafield ind1="7" ind2=" " tag="024">
<marc:subfield code="a">
<xsl:value-of select="./Identifier[@Type = 'urn']/@Value"/>
</marc:subfield>
<marc:subfield code="2">
<xsl:text>urn</xsl:text>
</marc:subfield>
</marc:datafield>
</xsl:if>
<marc:datafield ind1=" " ind2=" " tag="041">
<marc:subfield code="a">
<xsl:choose>
<xsl:when test="./@Language='fra'">
<xsl:text>fre</xsl:text>
</xsl:when>
<xsl:when test="./@Language='deu'">
<xsl:text>ger</xsl:text>
</xsl:when>
<xsl:when test="./@Language='ces'">
<xsl:text>cze</xsl:text>
</xsl:when>
<xsl:when test="./@Language='slk'">
<xsl:text>slo</xsl:text>
</xsl:when>
<xsl:when test="./@Language='zho'">
<xsl:text>chi</xsl:text>
</xsl:when>
<xsl:when test="./@Language='nld'">
<xsl:text>dut</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@Language"/>
</xsl:otherwise>
</xsl:choose>
</marc:subfield>
</marc:datafield>
<!-- DDC -->
<xsl:for-each select="./Collection[@RoleName='ddc' and @Visible = 1]">
<marc:datafield ind1="0" ind2="4" tag="082">
<!-- alternativ bei DDC-Sachgruppen der DNB: <marc:datafield ind1="7" ind2="4" tag="082"> -->
<marc:subfield code="a">
<xsl:value-of select="@Number"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
<!-- PersonAutor, nur der erste Autor -->
<xsl:apply-templates select="./PersonAuthor[position() = 1]" mode="marc21">
<xsl:with-param name="tag">100</xsl:with-param>
<xsl:with-param name="role">aut</xsl:with-param>
</xsl:apply-templates>
<!-- CreatingCorporation -->
<xsl:if test="./@CreatingCorporation">
<marc:datafield ind1="2" ind2=" " tag="110">
<marc:subfield code="a">
<xsl:value-of select="./@CreatingCorporation"/>
</marc:subfield>
</marc:datafield>
</xsl:if>
<!-- TitleMain in Dokumentsprache-->
<xsl:if test="./TitleMain[@Language = ../@Language]">
<marc:datafield ind1="0" ind2="0" tag="245">
<marc:subfield code="a">
<xsl:value-of select="./TitleMain[@Language = ../@Language]/@Value"/>
</marc:subfield>
<xsl:if test="./TitleSub[@Language = ../@Language]">
<marc:subfield code="b">
<xsl:value-of select="./TitleSub[@Language = ../@Language]/@Value"/>
</marc:subfield>
</xsl:if>
</marc:datafield>
</xsl:if>
<!-- Berücksichtigung aller TitleMain, die nicht in Dokumentsprache vorliegen -->
<xsl:if test="count(./TitleMain) &gt; 1">
<xsl:for-each select="./TitleMain[@Language != ../@Language]">
<xsl:variable name="lang">
<xsl:value-of select="@Language"/>
</xsl:variable>
<marc:datafield ind1="1" ind2="1" tag="246">
<marc:subfield code="a">
<xsl:value-of select="@Value"/>
</marc:subfield>
<xsl:if test="../TitleSub[@Language = $lang]">
<marc:subfield code="b">
<xsl:value-of select="../TitleSub[@Language = $lang]/@Value"/>
</marc:subfield>
</xsl:if>
</marc:datafield>
</xsl:for-each>
</xsl:if>
<xsl:variable name="publisherName">
<xsl:value-of select="php:functionString('Application_Xslt::optionValue', 'publisherName', 'marc21')"/>
</xsl:variable>
<xsl:variable name="publisherCity">
<xsl:value-of select="php:functionString('Application_Xslt::optionValue', 'publisherCity', 'marc21')"/>
</xsl:variable>
<!-- Jahr nur beim ersten ThesisPublisher ausgeben -->
<xsl:if test="./ThesisPublisher or ./@PublisherName or ./@PublisherPlace or $publisherName != '' or $publisherCity != '' or $year != ''">
<marc:datafield ind1=" " ind2="1" tag="264"> <!-- Das Feld 260 wird mit der Einführung von RDA nicht mehr gebildet -->
<xsl:choose>
<xsl:when test="./ThesisPublisher"><!-- City und Name sind Pflichtfelder, daher kein zusätzlicher Test -->
<marc:subfield code="a">
<xsl:value-of select="./ThesisPublisher[1]/@City"/>
</marc:subfield>
<marc:subfield code="b">
<xsl:value-of select="./ThesisPublisher[1]/@Name"/>
</marc:subfield>
</xsl:when>
<xsl:when test="./@PublisherName or ./@PublisherPlace">
<xsl:if test="./@PublisherPlace">
<marc:subfield code="a">
<xsl:value-of select="./@PublisherPlace"/>
</marc:subfield>
</xsl:if>
<xsl:if test="./@PublisherName">
<marc:subfield code="b">
<xsl:value-of select="./@PublisherName"/>
</marc:subfield>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<!-- Fallback nur dann verwenden, wenn bislang kein Wert für Subfield a oder b erzeugt werden konnte -->
<xsl:if test="$publisherCity != ''">
<marc:subfield code="a">
<xsl:value-of select="$publisherCity"/>
</marc:subfield>
</xsl:if>
<xsl:if test="$publisherName != ''">
<marc:subfield code="b">
<xsl:value-of select="$publisherName"/>
</marc:subfield>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$year != ''">
<marc:subfield code="c">
<xsl:value-of select="$year"/>
</marc:subfield>
</xsl:if>
</marc:datafield>
</xsl:if>
<!-- ab dem 2. ThesisPublisher keine Jahresangabe in 264c ausgeben -->
<xsl:if test="count(./ThesisPublisher) &gt; 1">
<xsl:for-each select="./ThesisPublisher">
<xsl:if test="position() != 1">
<marc:datafield ind1=" " ind2="1" tag="264">
<!-- City und Name sind Pflichtfelder, daher kein zusätzlicher Test -->
<marc:subfield code="a">
<xsl:value-of select="@City"/>
</marc:subfield>
<marc:subfield code="b">
<xsl:value-of select="@Name"/>
</marc:subfield>
</marc:datafield>
</xsl:if>
</xsl:for-each>
</xsl:if>
<!-- Seitenanzahl -->
<xsl:if test="./@PageNumber">
<marc:datafield ind1=" " ind2=" " tag="300">
<marc:subfield code="a">
<xsl:value-of select="./@PageNumber"/>
</marc:subfield>
</marc:datafield>
</xsl:if>
<!-- Schriftenreihen -->
<xsl:for-each select="./Series">
<xsl:if test="./@Visible = 1">
<marc:datafield ind1="1" ind2=" " tag="490">
<marc:subfield code="a">
<xsl:value-of select="./@Title"/>
</marc:subfield>
<marc:subfield code="v">
<xsl:value-of select="./@Number"/>
</marc:subfield>
</marc:datafield>
</xsl:if>
</xsl:for-each>
<!-- TitleAbstract in Dokumentsprache zuerst ausgeben -->
<xsl:if test="./TitleAbstract[@Language = ../@Language]">
<marc:datafield ind1=" " ind2=" " tag="520">
<marc:subfield code="a">
<xsl:value-of select="./TitleAbstract[@Language = ../@Language]/@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:if>
<!-- Behandlung von allen weiteren TitleAbstracs -->
<xsl:for-each select="./TitleAbstract[@Language != ../@Language]">
<marc:datafield ind1=" " ind2=" " tag="520">
<marc:subfield code="a">
<xsl:value-of select="./@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
<!-- Schlagworte -->
<xsl:for-each select="Subject[@Type='uncontrolled' or @Type='swd']">
<marc:datafield ind1=" " ind2=" " tag="653">
<marc:subfield code="a">
<xsl:value-of select="./@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
<marc:datafield ind1=" " ind2="4" tag="655">
<marc:subfield code="a">
<xsl:choose>
<xsl:when test="./@Type='article'"> <xsl:text>article</xsl:text></xsl:when>
<xsl:when test="./@Type='bachelorthesis'"> <xsl:text>bachelorThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='book'"> <xsl:text>book</xsl:text></xsl:when>
<xsl:when test="./@Type='bookpart'"> <xsl:text>bookPart</xsl:text></xsl:when>
<xsl:when test="./@Type='conferenceobject'"> <xsl:text>conferenceObject</xsl:text></xsl:when>
<xsl:when test="./@Type='contributiontoperiodical'"> <xsl:text>contributionToPeriodical</xsl:text></xsl:when>
<xsl:when test="./@Type='coursematerial'"> <xsl:text>CourseMaterial</xsl:text></xsl:when>
<xsl:when test="./@Type='diplom'"> <xsl:text>masterThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='doctoralthesis'"> <xsl:text>doctoralThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='examen'"> <xsl:text>masterThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='habilitation'"> <xsl:text>doctoralThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='image'"> <xsl:text>Image</xsl:text></xsl:when>
<xsl:when test="./@Type='lecture'"> <xsl:text>lecture</xsl:text></xsl:when>
<xsl:when test="./@Type='magister'"> <xsl:text>masterThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='masterthesis'"> <xsl:text>masterThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='movingimage'"> <xsl:text>MovingImage</xsl:text></xsl:when>
<xsl:when test="./@Type='other'"> <xsl:text>Other</xsl:text></xsl:when>
<xsl:when test="./@Type='periodical'"> <xsl:text>Periodical</xsl:text></xsl:when>
<xsl:when test="./@Type='periodicalpart'"> <xsl:text>PeriodicalPart</xsl:text></xsl:when>
<xsl:when test="./@Type='preprint'"> <xsl:text>preprint</xsl:text></xsl:when>
<xsl:when test="./@Type='report'"> <xsl:text>report</xsl:text></xsl:when>
<xsl:when test="./@Type='review'"> <xsl:text>review</xsl:text></xsl:when>
<xsl:when test="./@Type='sound'"> <xsl:text>Sound</xsl:text></xsl:when>
<xsl:when test="./@Type='studythesis'"> <xsl:text>StudyThesis</xsl:text></xsl:when>
<xsl:when test="./@Type='workingpaper'"> <xsl:text>workingPaper</xsl:text></xsl:when>
<xsl:otherwise>
<xsl:text>Other</xsl:text>
</xsl:otherwise>
</xsl:choose>
</marc:subfield>
</marc:datafield>
<!-- Sonstige Autoren -->
<xsl:apply-templates select="./PersonAuthor[position() &gt; 1]" mode="marc21">
<xsl:with-param name="tag">700</xsl:with-param>
<xsl:with-param name="role">aut</xsl:with-param>
</xsl:apply-templates>
<!-- PersonEditor -->
<xsl:apply-templates select="./PersonEditor" mode="marc21">
<xsl:with-param name="tag">700</xsl:with-param>
<xsl:with-param name="role">edt</xsl:with-param>
</xsl:apply-templates>
<!-- PersonAdvisor -->
<xsl:apply-templates select="./PersonAdvisor" mode="marc21">
<xsl:with-param name="tag">700</xsl:with-param>
<xsl:with-param name="role">dgs</xsl:with-param>
</xsl:apply-templates>
<!-- PersonContributor -->
<xsl:apply-templates select="./PersonContributor" mode="marc21">
<xsl:with-param name="tag">700</xsl:with-param>
<xsl:with-param name="role">ctb</xsl:with-param>
</xsl:apply-templates>
<xsl:if test="((not(./TitleParent) or count(TitleParent) &gt; 1)) and (./@Volume or ./@Issue or (./@PageFirst or ./@PageLast))">
<marc:datafield ind1="0" ind2=" " tag="773">
<xsl:call-template name="subfieldG">
<xsl:with-param name="volume" select="./@Volume"/>
<xsl:with-param name="issue" select="./@Issue"/>
<xsl:with-param name="pageFirst" select="./@PageFirst"/>
<xsl:with-param name="pageLast" select="./@PageLast"/>
</xsl:call-template>
</marc:datafield>
</xsl:if>
<!-- Behandlung von TitleParent (genau ein TitleParent): TitleParent und Volume, Issue, Pages in gemeinsames 773-Feld -->
<xsl:if test="count(./TitleParent) = 1">
<marc:datafield ind1="0" ind2=" " tag="773">
<marc:subfield code="t">
<xsl:value-of select="./TitleParent/@Value"/>
</marc:subfield>
<xsl:call-template name="subfieldG">
<xsl:with-param name="volume" select="./@Volume"/>
<xsl:with-param name="issue" select="./@Issue"/>
<xsl:with-param name="pageFirst" select="./@PageFirst"/>
<xsl:with-param name="pageLast" select="./@PageLast"/>
</xsl:call-template>
<xsl:if test="(count(./Identifier[@Type = 'issn']) = 1) and not(./Identifier[@Type = 'isbn'])">
<marc:subfield code="x">
<xsl:value-of select="./Identifier[@Type = 'issn']/@Value"/>
</marc:subfield>
</xsl:if>
<xsl:if test="(count(./Identifier[@Type = 'isbn']) = 1) and not (./Identifier[@Type = 'issn'])">
<marc:subfield code="z">
<xsl:value-of select="./Identifier[@Type = 'isbn']/@Value"/>
</marc:subfield>
</xsl:if>
</marc:datafield>
</xsl:if>
<!-- Behandlung von TitleParent (mehr als ein TitleParent): jeder TitleParent in ein eigenes 773-Feld -->
<xsl:if test="count(./TitleParent) &gt; 1">
<xsl:for-each select="./TitleParent">
<marc:datafield ind1="0" ind2=" " tag="773">
<marc:subfield code="t">
<xsl:value-of select="./@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
</xsl:if>
<!-- beim Vorhandensein mindestens eines TitleParent: ISSNs werden einzeln ausgegeben,
wenn es mehr als eine gibt oder mehr als einen TitleParent oder gleichzeitig eine ISBN existiert -->
<xsl:if test="./TitleParent and not((count(./TitleParent) = 1) and (count(./Identifier[@Type = 'issn']) = 1) and not(./Identifier[@Type = 'isbn']))">
<xsl:for-each select="./Identifier[@Type = 'issn']">
<marc:datafield ind1="0" ind2=" " tag="773">
<marc:subfield code="x">
<xsl:value-of select="./@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
</xsl:if>
<!-- beim Vorhandensein mindestens eines TitleParent: ISBNs werden einzeln ausgegeben,
wenn es mehr als eine gibt oder mehr als einen TitleParent oder gleichzeitig eine ISSN existiert -->
<xsl:if test="./TitleParent and not((count(./TitleParent) = 1) and (count(./Identifier[@Type = 'isbn']) = 1) and not(./Identifier[@Type = 'issn']))">
<xsl:for-each select="./Identifier[@Type = 'isbn']">
<marc:datafield ind1="0" ind2=" " tag="773">
<marc:subfield code="z">
<xsl:value-of select="./@Value"/>
</marc:subfield>
</marc:datafield>
</xsl:for-each>
</xsl:if>
<xsl:if test="./Identifier[@Type = 'urn']">
<marc:datafield ind1="4" ind2="0" tag="856">
<marc:subfield code="u">
<xsl:value-of select="php:functionString('Application_Xslt::optionValue', 'resolverUrl', 'urn')"/>
<xsl:value-of select="./Identifier[@Type = 'urn']/@Value"/>
</marc:subfield>
<marc:subfield code="x">Resolving-URL</marc:subfield>
</marc:datafield>
</xsl:if>
<marc:datafield ind1="4" ind2="0" tag="856">
<marc:subfield code="u">
<xsl:value-of select="php:functionString('Application_Xslt::frontdoorUrl', @Id)"/>
</marc:subfield>
<marc:subfield code="q">
<xsl:text>text/html</xsl:text>
</marc:subfield>
<marc:subfield code="x">
<xsl:text>Frontdoor-URL</xsl:text>
</marc:subfield>
</marc:datafield>
<!-- wenn mindestens eine Datei (mit visibleInOai = 1) vorhanden ist, erzeuge Transfer-URL für den OAI-Container -->
<xsl:if test="./File[@VisibleInOai = 1]">
<marc:datafield ind1="4" ind2="0" tag="856">
<marc:subfield code="u">
<xsl:value-of select="php:functionString('Application_Xslt::transferUrl', ./@Id)"/>
</marc:subfield>
<marc:subfield code="x">
<xsl:text>Transfer-URL</xsl:text>
</marc:subfield>
<xsl:if test="./Licence">
<marc:subfield code="z">
<xsl:value-of select="./Licence[1]/@NameLong"/>
</marc:subfield>
</xsl:if>
</marc:datafield>
</xsl:if>
<xsl:for-each select="./File[@VisibleInOai = 1]">
<marc:datafield ind1="4" ind2="0" tag="856">
<marc:subfield code="u">
<xsl:value-of select="php:functionString('Application_Xslt::fileUrl', ../@Id, ./@PathName)"/>
</marc:subfield>
<xsl:if test="./@MimeType">
<marc:subfield code="q">
<xsl:value-of select="./@MimeType"/>
</marc:subfield>
</xsl:if>
<xsl:if test="../Licence">
<marc:subfield code="z">
<xsl:value-of select="../Licence[1]/@NameLong"/>
</marc:subfield>
</xsl:if>
</marc:datafield>
</xsl:for-each>
</marc:record>
</marc:collection>
</xsl:template>
<xsl:template match="PersonAuthor|PersonEditor|PersonAdvisor|PersonContributor" mode="marc21">
<xsl:param name="tag"/>
<xsl:param name="role"/>
<marc:datafield ind1="1" ind2=" " tag='{$tag}'>
<marc:subfield code="a">
<xsl:value-of select="@LastName"/>
<xsl:if test="@FirstName">
<xsl:text>, </xsl:text>
<xsl:value-of select="@FirstName"/>
</xsl:if>
</marc:subfield>
<marc:subfield code="4">
<xsl:value-of select="$role"/>
</marc:subfield>
</marc:datafield>
</xsl:template>
<xsl:template name="subfieldG">
<xsl:param name="volume"/>
<xsl:param name="issue"/>
<xsl:param name="pageFirst"/>
<xsl:param name="pageLast"/>
<xsl:if test="$volume or $issue or ($pageFirst and $pageLast)">
<marc:subfield code="g">
<xsl:if test="$volume">
<xsl:text>Jahrgang </xsl:text>
<xsl:value-of select="$volume"/>
<xsl:if test="($issue) or (not($issue) and ($pageFirst and $pageLast))">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="$issue">
<xsl:text>Heft </xsl:text>
<xsl:value-of select="$issue"/>
<xsl:if test="$pageFirst and $pageLast">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="$pageFirst and $pageLast">
<xsl:text>Seiten </xsl:text>
<xsl:value-of select="$pageFirst"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="$pageLast"/>
</xsl:if>
</marc:subfield>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,576 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
http://ws.pangaea.de/oai/oai2.xsl
XSL Transform to convert OAI 2.0 responses into XHTML
By Christopher Gutteridge, University of Southampton
-->
<!--
Copyright (c) 2000-2004 University of Southampton, UK. SO17 1BJ.
EPrints 2 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
EPrints 2 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with EPrints 2; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<!--
All the elements really needed for EPrints are done but if
you want to use this XSL for other OAI archive you may want
to make some minor changes or additions.
Not Done
The 'about' section of 'record'
The 'compession' part of 'identify'
The optional attributes of 'resumptionToken'
The optional 'setDescription' container of 'set'
All the links just link to oai_dc versions of records.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:id="http://www.openarchives.org/OAI/2.0/oai-identifier"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:ep="http://www.openarchives.org/OAI/1.1/eprints"
xmlns:fr="http://www.openarchives.org/OAI/2.0/friends/"
xmlns:br="http://www.openarchives.org/OAI/2.0/branding/"
xmlns:gw="http://www.openarchives.org/OAI/2.0/gateway/x"
expand-text="yes"
version="3.0">
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes" doctype-system="about:legacy-compat"/>
<!-- define variables -->
<xsl:variable name='identifier' select="substring-before(concat(substring-after(/oai:OAI-PMH/oai:request,'identifier='),'&amp;'),'&amp;')" />
<!-- root template -->
<xsl:template match="/">
<html>
<head>
<title>TETHYS OAI 2.0 Request Results</title>
<!-- <style><xsl:call-template name="style"/></style> -->
<link rel="stylesheet" type="text/css" href="assets2/style.css" />
<!-- Favicon
-->
<!-- <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png"/>
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon/favicon-32x32.png"/>
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png"/>
<link rel="manifest" href="/images/favicon/site.webmanifest"/>
<link rel="mask-icon" href="/images/favicon/safari-pinned-tab.svg" color="#5bbad5"/> -->
<link rel="shortcut icon" href="/assets2/favicon.ico"/>
<!-- <style>h2{font-size:22pt;text-decoration:underline}para{color:green}</style> -->
</head>
<body>
<h1>TETHYS OAI 2.0 Request Results</h1>
<xsl:call-template name="quicklinks"/>
<p class="intro">
You are viewing an HTML version of the XML OAI response. To see the underlying XML use your web browsers view source option. More information about this XSLT is at the <a href="#moreinfo">bottom of the page</a>.
</p>
<xsl:apply-templates select="/oai:OAI-PMH" />
<xsl:call-template name="quicklinks"/>
<h2><a name="moreinfo">About the XSLT</a></h2>
<p>An XSLT file has converted the <a href="http://www.openarchives.org">OAI-PMH 2.0</a> responses into XHTML which looks nice in a browser which supports XSLT such as Mozilla, Firebird and Internet Explorer. The XSLT file was created by <a href="http://www.ecs.soton.ac.uk/people/cjg">Christopher Gutteridge</a> at the University of Southampton as part of the <a href="http://software.eprints.org">GNU EPrints system</a>, and is freely redistributable under the <a href="http://www.gnu.org">GPL</a>.</p><p>If you want to use the XSL file on your own OAI interface you may but due to the way XSLT works you must install the XSL file on the same server as the OAI script, you can't just link to this copy.</p><p>For more information or to download the XSL file please see the <a href="http://software.eprints.org/xslt.php">OAI to XHTML XSLT homepage</a>.</p>
</body>
</html>
</xsl:template>
<xsl:template name="quicklinks">
<ul class="quicklinks">
<li><a href="?verb=Identify">Identify</a> | </li>
<li><a href="?verb=ListRecords&amp;metadataPrefix=oai_dc">ListRecords</a> | </li>
<li><a href="?verb=ListSets">ListSets</a> | </li>
<li><a href="?verb=ListMetadataFormats">ListMetadataFormats</a> | </li>
<li><a href="?verb=ListIdentifiers&amp;metadataPrefix=oai_dc">ListIdentifiers</a></li>
</ul>
</xsl:template>
<xsl:template match="/oai:OAI-PMH">
<table class="values">
<tr><td class="key">Datestamp of response</td>
<td class="value"><xsl:value-of select="oai:responseDate"/></td></tr>
<tr><td class="key">Request URL</td>
<td class="value"><xsl:value-of select="oai:request"/></td></tr>
</table>
<!-- verb: [<xsl:value-of select="oai:request/@verb" />]<br /> -->
<xsl:choose>
<xsl:when test="oai:error">
<h2>OAI Error(s)</h2>
<p>The request could not be completed due to the following error or errors.</p>
<div class="results">
<xsl:apply-templates select="oai:error"/>
</div>
</xsl:when>
<xsl:otherwise>
<p>Request was of type <xsl:value-of select="oai:request/@verb"/>.</p>
<div class="results">
<xsl:apply-templates select="oai:Identify" />
<xsl:apply-templates select="oai:GetRecord"/>
<xsl:apply-templates select="oai:ListRecords"/>
<xsl:apply-templates select="oai:ListSets"/>
<xsl:apply-templates select="oai:ListMetadataFormats"/>
<xsl:apply-templates select="oai:ListIdentifiers"/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ERROR -->
<xsl:template match="/oai:OAI-PMH/oai:error">
<table class="values">
<tr><td class="key">Error Code</td>
<td class="value"><xsl:value-of select="@code"/></td></tr>
</table>
<p class="error"><xsl:value-of select="." /></p>
</xsl:template>
<!-- IDENTIFY -->
<xsl:template match="/oai:OAI-PMH/oai:Identify">
<table class="values">
<tr><td class="key">Repository Name</td>
<td class="value"><xsl:value-of select="oai:repositoryName"/></td></tr>
<tr><td class="key">Base URL</td>
<td class="value"><xsl:value-of select="oai:baseURL"/></td></tr>
<tr><td class="key">Protocol Version</td>
<td class="value"><xsl:value-of select="oai:protocolVersion"/></td></tr>
<tr><td class="key">Earliest Datestamp</td>
<td class="value"><xsl:value-of select="oai:earliestDatestamp"/></td></tr>
<tr><td class="key">Deleted Record Policy</td>
<td class="value"><xsl:value-of select="oai:deletedRecord"/></td></tr>
<tr><td class="key">Granularity</td>
<td class="value"><xsl:value-of select="oai:granularity"/></td></tr>
<xsl:apply-templates select="oai:adminEmail"/>
</table>
<xsl:apply-templates select="oai:description"/>
<!--no warning about unsupported descriptions -->
</xsl:template>
<xsl:template match="/oai:OAI-PMH/oai:Identify/oai:adminEmail">
<tr>
<td class="key">Admin Email</td>
<td class="value"><xsl:value-of select="."/></td>
</tr>
</xsl:template>
<!--
Identify / Unsupported Description
-->
<xsl:template match="oai:description/*" priority="-100">
<h2>Unsupported Description Type</h2>
<p>The XSL currently does not support this type of description.</p>
<div class="xmlSource">
<xsl:apply-templates select="." mode='xmlMarkup' />
</div>
</xsl:template>
<!--
Identify / OAI-Identifier
-->
<xsl:template match="id:oai-identifier" xmlns:id="http://www.openarchives.org/OAI/2.0/oai-identifier">
<h2>OAI-Identifier</h2>
<table class="values">
<tr><td class="key">Scheme</td>
<td class="value"><xsl:value-of select="id:scheme"/></td></tr>
<tr><td class="key">Repository Identifier</td>
<td class="value"><xsl:value-of select="id:repositoryIdentifier"/></td></tr>
<tr><td class="key">Delimiter</td>
<td class="value"><xsl:value-of select="id:delimiter"/></td></tr>
<tr><td class="key">Sample OAI Identifier</td>
<td class="value"><xsl:value-of select="id:sampleIdentifier"/></td></tr>
</table>
</xsl:template>
<!--
Identify / EPrints
-->
<xsl:template match="ep:eprints" xmlns:ep="http://www.openarchives.org/OAI/1.1/eprints">
<h2>EPrints Description</h2>
<h3>Content</h3>
<xsl:apply-templates select="ep:content"/>
<xsl:if test="ep:submissionPolicy">
<h3>Submission Policy</h3>
<xsl:apply-templates select="ep:submissionPolicy"/>
</xsl:if>
<h3>Metadata Policy</h3>
<xsl:apply-templates select="ep:metadataPolicy"/>
<h3>Data Policy</h3>
<xsl:apply-templates select="ep:dataPolicy"/>
<xsl:if test="ep:content">
<h3>Content</h3>
<xsl:apply-templates select="ep:content"/>
</xsl:if>
<xsl:apply-templates select="ep:comment"/>
</xsl:template>
<xsl:template match="ep:content|ep:dataPolicy|ep:metadataPolicy|ep:submissionPolicy" xmlns:ep="http://www.openarchives.org/OAI/1.1/eprints">
<xsl:if test="ep:text">
<p><xsl:value-of select="ep:text" /></p>
</xsl:if>
<xsl:if test="ep:URL">
<div><a href="{ep:URL}"><xsl:value-of select="ep:URL" /></a></div>
</xsl:if>
</xsl:template>
<xsl:template match="ep:comment" xmlns:ep="http://www.openarchives.org/OAI/1.1/eprints">
<h3>Comment</h3>
<div><xsl:value-of select="."/></div>
</xsl:template>
<!--
Identify / Friends
-->
<xsl:template match="fr:friends" xmlns:fr="http://www.openarchives.org/OAI/2.0/friends/">
<h2>Friends</h2>
<ul>
<xsl:apply-templates select="fr:baseURL"/>
</ul>
</xsl:template>
<xsl:template match="fr:baseURL" xmlns:fr="http://www.openarchives.org/OAI/2.0/friends/">
<li><xsl:value-of select="."/>
<xsl:text> </xsl:text>
<a class="link" href="{.}?verb=Identify">Identify</a></li>
</xsl:template>
<!--
Identify / Branding
-->
<xsl:template match="br:branding" xmlns:br="http://www.openarchives.org/OAI/2.0/branding/">
<h2>Branding</h2>
<xsl:apply-templates select="br:collectionIcon"/>
<xsl:apply-templates select="br:metadataRendering"/>
</xsl:template>
<xsl:template match="br:collectionIcon" xmlns:br="http://www.openarchives.org/OAI/2.0/branding/">
<h3>Icon</h3>
<xsl:choose>
<xsl:when test="link!=''">
<a href="{br:link}"><img src="{br:url}" alt="{br:title}" width="{br:width}" height="{br:height}" border="0" /></a>
</xsl:when>
<xsl:otherwise>
<img src="{br:url}" alt="{br:title}" width="{br:width}" height="{br:height}" border="0" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="br:metadataRendering" xmlns:br="http://www.openarchives.org/OAI/2.0/branding/">
<h3>Metadata Rendering Rule</h3>
<table class="values">
<tr><td class="key">URL</td>
<td class="value"><xsl:value-of select="."/></td></tr>
<tr><td class="key">Namespace</td>
<td class="value"><xsl:value-of select="@metadataNamespace"/></td></tr>
<tr><td class="key">Mime Type</td>
<td class="value"><xsl:value-of select="@mimetype"/></td></tr>
</table>
</xsl:template>
<!--
Identify / Gateway
-->
<xsl:template match="gw:gateway" xmlns:gw="http://www.openarchives.org/OAI/2.0/gateway/x">
<h2>Gateway Information</h2>
<table class="values">
<tr><td class="key">Source</td>
<td class="value"><xsl:value-of select="gw:source"/></td></tr>
<tr><td class="key">Description</td>
<td class="value"><xsl:value-of select="gw:gatewayDescription"/></td></tr>
<xsl:apply-templates select="gw:gatewayAdmin"/>
<xsl:if test="gw:gatewayURL">
<tr><td class="key">URL</td>
<td class="value"><xsl:value-of select="gw:gatewayURL"/></td></tr>
</xsl:if>
<xsl:if test="gw:gatewayNotes">
<tr><td class="key">Notes</td>
<td class="value"><xsl:value-of select="gw:gatewayNotes"/></td></tr>
</xsl:if>
</table>
</xsl:template>
<xsl:template match="gw:gatewayAdmin" xmlns:gw="http://www.openarchives.org/OAI/2.0/gateway/">
<tr><td class="key">Admin</td>
<td class="value"><xsl:value-of select="."/></td></tr>
</xsl:template>
<!-- GetRecord -->
<xsl:template match="oai:GetRecord">
<xsl:apply-templates select="oai:record" />
</xsl:template>
<!-- ListRecords -->
<xsl:template match="oai:ListRecords">
<xsl:apply-templates select="oai:record" />
<xsl:apply-templates select="oai:resumptionToken" />
</xsl:template>
<!-- ListIdentifiers -->
<xsl:template match="oai:ListIdentifiers">
<xsl:apply-templates select="oai:header" />
<xsl:apply-templates select="oai:resumptionToken" />
</xsl:template>
<!-- ListSets -->
<xsl:template match="oai:ListSets">
<xsl:apply-templates select="oai:set" />
<xsl:apply-templates select="oai:resumptionToken" />
</xsl:template>
<xsl:template match="oai:set">
<h2>Set</h2>
<table class="values">
<tr><td class="key">setName</td>
<td class="value"><xsl:value-of select="oai:setName"/></td></tr>
<xsl:apply-templates select="oai:setSpec" />
</table>
</xsl:template>
<!-- ListMetadataFormats -->
<xsl:template match="oai:ListMetadataFormats">
<xsl:choose>
<xsl:when test="$identifier">
<p>This is a list of metadata formats available for the record "<xsl:value-of select='$identifier' />". Use these links to view the metadata: <xsl:apply-templates select="oai:metadataFormat/oai:metadataPrefix" /></p>
</xsl:when>
<xsl:otherwise>
<p>This is a list of metadata formats available from this archive.</p>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="oai:metadataFormat" />
</xsl:template>
<xsl:template match="oai:metadataFormat">
<h2>Metadata Format</h2>
<table class="values">
<tr>
<td class="key">metadataPrefix</td>
<!-- <td class="value"><xsl:value-of select="oai:metadataPrefix"/></td> -->
<td class="value">
<a class="link" href="?verb=ListRecords&amp;metadataPrefix={oai:metadataPrefix}"><xsl:value-of select="oai:metadataPrefix"/></a>
</td>
</tr>
<tr>
<td class="key">metadataNamespace</td>
<td class="value"><xsl:value-of select="oai:metadataNamespace"/></td>
</tr>
<tr>
<td class="key">schema</td>
<td class="value"><a href="{oai:schema}"><xsl:value-of select="oai:schema"/></a></td>
</tr>
</table>
</xsl:template>
<xsl:template match="oai:metadataPrefix">
<xsl:text> </xsl:text><a class="link" href="?verb=GetRecord&amp;metadataPrefix={.}&amp;identifier={$identifier}"><xsl:value-of select='.' /></a>
</xsl:template>
<!-- record object -->
<xsl:template match="oai:record">
<h2 class="oaiRecordTitle">OAI Record: <xsl:value-of select="oai:header/oai:identifier"/></h2>
<div class="oaiRecord">
<xsl:apply-templates select="oai:header" />
<xsl:apply-templates select="oai:metadata" />
<xsl:apply-templates select="oai:about" />
</div>
</xsl:template>
<xsl:template match="oai:header">
<h3>OAI Record Header</h3>
<table class="values">
<tr><td class="key">OAI Identifier</td>
<td class="value">
<xsl:value-of select="oai:identifier"/>
<xsl:text> </xsl:text><a class="link" href="?verb=GetRecord&amp;metadataPrefix=oai_dc&amp;identifier={oai:identifier}">oai_dc</a>
<xsl:text> </xsl:text><a class="link" href="?verb=ListMetadataFormats&amp;identifier={oai:identifier}">formats</a>
</td></tr>
<tr><td class="key">Datestamp</td>
<td class="value"><xsl:value-of select="oai:datestamp"/></td></tr>
<xsl:apply-templates select="oai:setSpec" />
</table>
<xsl:if test="@status='deleted'">
<p>This record has been deleted.</p>
</xsl:if>
</xsl:template>
<xsl:template match="oai:about">
<p>"about" part of record container not supported by the XSL</p>
</xsl:template>
<xsl:template match="oai:metadata">
&#160;
<div class="metadata">
<xsl:apply-templates select="*" />
</div>
</xsl:template>
<!-- oai setSpec object -->
<xsl:template match="oai:setSpec">
<tr><td class="key">setSpec</td>
<td class="value"><xsl:value-of select="."/>
<xsl:text> </xsl:text><a class="link" href="?verb=ListIdentifiers&amp;metadataPrefix=oai_dc&amp;set={.}">Identifiers</a>
<xsl:text> </xsl:text><a class="link" href="?verb=ListRecords&amp;metadataPrefix=oai_dc&amp;set={.}">Records</a>
</td></tr>
</xsl:template>
<!-- oai resumptionToken -->
<xsl:template match="oai:resumptionToken">
<p>There are more results.</p>
<table class="values">
<tr><td class="key">resumptionToken:</td>
<td class="value"><xsl:value-of select="."/>
<xsl:text> </xsl:text>
<a class="link" href="?verb={/oai:OAI-PMH/oai:request/@verb}&amp;resumptionToken={.}">Resume</a></td></tr>
</table>
</xsl:template>
<!-- unknown metadata format -->
<xsl:template match="oai:metadata/*" priority='-100'>
<h3>Unknown Metadata Format</h3>
<div class="xmlSource">
<xsl:apply-templates select="." mode='xmlMarkup' />
</div>
</xsl:template>
<!-- oai_dc record -->
<xsl:template match="oai_dc:dc" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" >
<div class="dcdata">
<h3>Dublin Core Metadata (oai_dc)</h3>
<table class="dcdata">
<xsl:apply-templates select="*" />
</table>
</div>
</xsl:template>
<xsl:template match="dc:title" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr>
<td class="key">Title</td>
<td class="value">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:template>
<xsl:template match="dc:creator" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Author or Creator</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:subject" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Subject and Keywords</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:description" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Description</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:publisher" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Publisher</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:contributor" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Other Contributor</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:date" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Date</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:type" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Resource Type</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:format" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Format</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:identifier" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Resource Identifier</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:source" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Source</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:language" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Language</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:relation" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Relation</td><td class="value">
<xsl:choose>
<xsl:when test='starts-with(.,"http" )'>
<xsl:choose>
<xsl:when test='string-length(.) &gt; 50'>
<a class="link" href="{.}">URL</a>
<i> URL not shown as it is very long.</i>
</xsl:when>
<xsl:otherwise>
<a href="{.}"><xsl:value-of select="."/></a>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</td></tr></xsl:template>
<xsl:template match="dc:coverage" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Coverage</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<xsl:template match="dc:rights" xmlns:dc="http://purl.org/dc/elements/1.1/">
<tr><td class="key">Rights Management</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
<!-- XML Pretty Maker -->
<xsl:template match="node()" mode='xmlMarkup'>
<div class="xmlBlock">
&lt;<span class="xmlTagName"><xsl:value-of select='name(.)' /></span><xsl:apply-templates select="@*" mode='xmlMarkup'/>&gt;<xsl:apply-templates select="node()" mode='xmlMarkup' />&lt;/<span class="xmlTagName"><xsl:value-of select='name(.)' /></span>&gt;
</div>
</xsl:template>
<xsl:template match="text()" mode='xmlMarkup'><span class="xmlText"><xsl:value-of select='.' /></span></xsl:template>
<xsl:template match="@*" mode='xmlMarkup'>
<xsl:text> </xsl:text>
<span class="xmlAttrName">
<xsl:value-of select='name()' /></span>="<span class="xmlAttrValue"><xsl:value-of select='.' />
</span>"
</xsl:template>
<!-- <xsl:template name="xmlstyle">
.xmlSource {
font-size: 70%;
border: solid #c0c0a0 1px;
background-color: #ffffe0;
padding: 2em 2em 2em 0em;
}
.xmlBlock {
padding-left: 2em;
}
.xmlTagName {
color: #800000;
font-weight: bold;
}
.xmlAttrName {
font-weight: bold;
}
.xmlAttrValue {
color: #0000c0;
}
</xsl:template> -->
</xsl:stylesheet>

View File

@ -0,0 +1,753 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* This file is part of TETHYS.
*
* LICENCE
* TETHYS is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or any later version.
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Application
* @package Module Oai
* @author Arno Kaimbacher <arno.kaimbacher@geologie.ac.at>
* @copyright Copyright (c) 2022, GBA TETHYS development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://example.com/functions"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
expand-text="yes"
version="3.0">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:mode on-no-match="shallow-copy"/>
<xsl:import href="functions.xslt"/>
<!-- variables -->
<!-- <xsl:variable name="datacite-identifier_org" select="//*[name() = 'Identifier']"/> -->
<!-- <xsl:variable name="datacite-identifier" select="//*[name() = 'Identifier'][@Type = 'Doi']"/> -->
<xsl:variable name="fileIdentifierPrefix" select="string('at.tethys.dataset')"/>
<xsl:variable name="datacentre">
<xsl:choose>
<xsl:when test="string-length(normalize-space(@CreatingCorporation)) > 0">
<xsl:value-of select="normalize-space(@CreatingCorporation)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('Tethys RDR')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- main template for is 19139 -->
<xsl:template match="Rdr_Dataset" mode="iso19139">
<!-- <gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opgeris.net/gml/3.2" xmlns:gmx="http://www.isotc211.org/2005/gmx"
xsi:schemaLocation="http://www.isotc211.org/2005/gmd https://www.isotc211.org/2005/gmd/metadataApplication.xsd http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd http://www.isotc211.org/2005/gmx http://schemas.opengis.net/iso/19139/20060504/gmx/gmx.xsd"> -->
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd http://www.isotc211.org/2005/gmx http://schemas.opengis.net/iso/19139/20060504/gmx/gmx.xsd http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd">
<!-- gmd:fileIdentifier -->
<xsl:if test="Identifier">
<xsl:apply-templates select="Identifier" mode="iso19139" />
</xsl:if>
<!-- Ressourensprache in der Eingabemaske von Tethys nicht erfasst-->
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/" codeListValue="ger"/>
</gmd:language>
<gmd:characterSet>
<gmd:MD_CharacterSetCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_CharacterSetCode" codeListValue="utf8"/>
</gmd:characterSet>
<!--gmd:hierarchyLevel template-->
<xsl:call-template name="hierarchylevel"/>
<gmd:hierarchyLevelName>
<gco:CharacterString>
<xsl:text>Dataset</xsl:text>
</gco:CharacterString>
</gmd:hierarchyLevelName>
<!-- gmd:contact - The contact for the metadata - static value assigned in template at the top of this file; -->
<xsl:call-template name="metadatacontact"/>
<!-- gmd:dateStamp -->
<xsl:call-template name="datestamp"/>
<gmd:metadataStandardName>
<gco:CharacterString>ISO 19139 Geographic Information - Metadata - Implementation Specification</gco:CharacterString>
</gmd:metadataStandardName>
<gmd:metadataStandardVersion>
<gco:CharacterString>2007</gco:CharacterString>
</gmd:metadataStandardVersion>
<gmd:referenceSystemInfo>
<gmd:MD_ReferenceSystem>
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<!-- <gmx:Anchor xlink:href="https://www.opengis.net/def/crs/EPSG/0/25832">EPSG:25832</gmx:Anchor> -->
<gco:CharacterString>https://www.opengis.net/def/crs/EPSG/0/31287</gco:CharacterString>
</gmd:code>
<gmd:version>
<gco:CharacterString>6.11.2</gco:CharacterString>
</gmd:version>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
</gmd:MD_ReferenceSystem>
</gmd:referenceSystemInfo>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<!-- gmd:citation> -->
<gmd:citation>
<gmd:CI_Citation>
<!-- gmd:title -->
<xsl:call-template name="title"/>
<!-- <gmd:alternateTitle -->
<xsl:apply-templates select="TitleAdditional" mode="iso19139" />
<!-- gmd:date -->
<xsl:call-template name="resourcedates"/>
<!-- gmd:identifier -->
<!-- stower 2022, identifer gba https://doi.org/10.24341/tethys.53 -->
<gmd:identifier>
<xsl:for-each select="*[name() = 'Identifier']">
<!-- <xsl:variable name="datacite-identifier" select="Identifier[@Type = 'Doi']"/> -->
<xsl:variable name="datacite-identifier" select=".[@Type = 'Doi']"/>
<xsl:if test="string-length(.[@Type = 'Doi']/@Value) &gt; 0 and count([.[@Type = 'Doi']/@Type = 'Doi']) &gt; 0">
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:choose>
<xsl:when test="starts-with(.[@Type = 'Doi']/@Value, 'doi:') or contains(.[@Type = 'Doi']/@Value, 'doi.org')">
<xsl:value-of select=".[@Type = 'Doi']/@Value"/>
</xsl:when>
<xsl:when test="count(.[@Type = 'Doi']) &gt; 0 and $datacentre='Tethys RDR'">
<xsl:value-of select="concat(
'https://doi.org/',
string(.[@Type = 'Doi']/@Value)
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=".[@Type = 'Doi']/@Value"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</xsl:if>
</xsl:for-each>
</gmd:identifier>
<!-- gmd:citedResponsibleParty - creator -->
<xsl:apply-templates select="PersonAuthor" mode="iso19139">
<xsl:sort select="@SortOrder"/>
</xsl:apply-templates>
<!-- gmd:citedResponsibleParty - contributor -->
<xsl:apply-templates select="PersonContributor" mode="iso19139">
<xsl:sort select="@SortOrder"/>
</xsl:apply-templates>
<!-- publisher -->
<gmd:citedResponsibleParty>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="organisation">
<xsl:value-of select="@CreatingCorporation"/>
</xsl:with-param>
<xsl:with-param name="role">publisher</xsl:with-param>
</xsl:call-template>
</gmd:citedResponsibleParty>
</gmd:CI_Citation>
</gmd:citation>
<!-- gmd:abstract -->
<xsl:call-template name="abstract"/>
<gmd:status>
<gmd:MD_ProgressCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ProgressCode" codeListValue="Complete" codeSpace="ISOTC211/19115"/>
</gmd:status>
<!-- gmd:pointOfContact custodian -->
<xsl:call-template name="pointofcontact_custodian"/>
<!-- gmd:pointOfContact originator -->
<xsl:call-template name="pointofcontact_originator"/>
<!-- gmd:resourceMaintenance -->
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">asNeeded</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
<!-- gmd:credit -->
<!-- <xsl:if test="count(//*[name() = 'fundingReferences']) &gt; 0">
<xsl:for-each select="//*[local-name() = 'fundingReferences']/*[name() = 'fundingReference']">
<gmd:credit>
<gco:CharacterString>
<xsl:value-of select="normalize-space(concat(string('funderName:'), string(*[name() = 'funderName'])))"/>
<xsl:if test="count(*[local-name() = 'funderIdentifier']) &gt; 0">
<xsl:text>
</xsl:text>
<xsl:value-of select="normalize-space(concat(string('funderIdentifier:'), string(*[name() = 'funderIdentifier'])))"/>
<xsl:value-of select="normalize-space(concat(string('; IDType:'), string(*[name() = 'funderIdentifier']/@funderIdentifierType)))"/>
</xsl:if>
<xsl:if test="count(*[name() = 'awardNumber']) &gt; 0">
<xsl:text>
</xsl:text>
<xsl:value-of select="normalize-space(concat(string('awardNumber:'), string(*[name() = 'awardNumber'])))"/>
</xsl:if>
<xsl:if test="count(*[name() = 'awardTitle']) &gt; 0">
<xsl:text>
</xsl:text>
<xsl:value-of select="normalize-space(concat(string('awardTitle:'), string(*[name() = 'awardTitle'])))"/>
</xsl:if>
</gco:CharacterString>
</gmd:credit>
</xsl:for-each>
</xsl:if> -->
<!-- <gmd:graphicOverview> -->
<xsl:call-template name="browseGraphictethys"/>
<!-- gmd:descriptiveKeywords without thesaurus-->
<xsl:call-template name="freekeywords"/>
<xsl:call-template name="datacenter_keyword"/>
<!-- gmd:resourceConstraints -->
<xsl:apply-templates select="Licence" mode="iso19139" />
<gmd:resourceConstraints>
<gmd:MD_SecurityConstraints>
<gmd:classification>
<gmd:MD_ClassificationCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_ClassificationCode" codeListValue="unclassified"/>
</gmd:classification>
</gmd:MD_SecurityConstraints>
</gmd:resourceConstraints>
<!-- relatedresources mapped to gmd:aggregationInfo, -->
<!-- <xsl:call-template name="relatedResources">
<xsl:with-param name="relres" select="//*[local-name() = 'relatedIdentifiers']"/>
</xsl:call-template> -->
<!-- <gmd:aggregationInfo> -->
<xsl:apply-templates select="Reference" mode="iso19139" />
<gmd:spatialResolution>
<xsl:variable name="mainTitle">
<!-- <xsl:for-each select="$datacite-titles/*[name() = 'title']"> -->
<xsl:for-each select="*[name() = 'TitleMain']">
<xsl:if test="normalize-space(@Type) = 'Main'">
<xsl:value-of select="@Value"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<gmd:MD_Resolution>
<xsl:choose>
<xsl:when test="contains($mainTitle, '50.000')">
<gmd:equivalentScale>
<gmd:MD_RepresentativeFraction>
<gmd:denominator>
<!-- <gco:Integer>{$mainTitle}</gco:Integer> -->
<gco:Integer>50000</gco:Integer>
</gmd:denominator>
</gmd:MD_RepresentativeFraction>
</gmd:equivalentScale>
</xsl:when>
<xsl:otherwise>
<gmd:distance>
<gco:Distance uom="m">-1</gco:Distance>
</gmd:distance>
</xsl:otherwise>
</xsl:choose>
</gmd:MD_Resolution>
</gmd:spatialResolution>
<!-- assume ger for now, stower 2022 -->
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/" codeListValue="ger"/>
</gmd:language>
<!-- ISOTopic19115, stower 2022 -->
<gmd:topicCategory>
<gmd:MD_TopicCategoryCode>geoscientificInformation</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
<!-- gmd:geographicElement> -->
<xsl:call-template name="spatialcoverage"/>
<!-- <xsl:call-template name="temporalcoverage"/> -->
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<!-- gmd:distributionInfo -->
<gmd:distributionInfo>
<gmd:MD_Distribution>
<!-- kaiarn 2022 gmd:distributionFormat -->
<xsl:apply-templates select="File" mode="iso19139" />
<!-- gmd:distributor -->
<xsl:call-template name="distributor" />
<!-- gmd:transferOptions -->
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<!-- <xsl:call-template name="size"/> -->
<!-- <gmd:onLine> -->
<xsl:call-template name="datacite_identifier" />
<!-- <gmd:onLine> -->
<xsl:call-template name="alternate_identifier" />
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
<!-- gmd:dataQualityInfo -->
<xsl:call-template name="data_quality"/>
<!-- <gmd:metadataMaintenance> -->
<xsl:call-template name="metadata_maintenance" />
</gmd:MD_Metadata>
</xsl:template>
<!-- further helper templates -->
<!-- gmd:resourceConstraints -->
<xsl:template match="Licence" mode="iso19139">
<gmd:resourceConstraints xlink:href="https://creativecommons.org/licenses/by/4.0/deed.en">
<gmd:MD_Constraints>
<gmd:useLimitation>
<gco:CharacterString>
<xsl:value-of select="string(@NameLong)"/>
</gco:CharacterString>
</gmd:useLimitation>
</gmd:MD_Constraints>
</gmd:resourceConstraints>
<gmd:resourceConstraints>
<gmd:MD_LegalConstraints>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode" codeListValue="otherRestrictions"/>
</gmd:accessConstraints>
<gmd:otherConstraints>
<gco:CharacterString>
<xsl:value-of select="string(@NameLong)"/>
</gco:CharacterString>
</gmd:otherConstraints>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
</xsl:template>
<!-- gmd:fileIdentifier -->
<xsl:template match="Identifier" mode="iso19139">
<gmd:fileIdentifier>
<gco:CharacterString>
<!-- <xsl:value-of select="@Value" /> -->
<xsl:choose>
<xsl:when test="string-length(@Value) &gt; 0 and count([@Type = 'Doi']) &gt; 0">
<xsl:value-of select="concat($fileIdentifierPrefix, normalize-space(substring-after(@Value, '/tethys.')))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(@Value)"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:fileIdentifier>
</xsl:template>
<!-- gmd:dateStamp template-->
<xsl:template name="datestamp">
<gmd:dateStamp>
<!-- define vriable theDate -->
<xsl:variable name="theDate">
<xsl:choose>
<xsl:when test="ServerDateModified">
<xsl:value-of select="concat(
ServerDateModified/@Year, '-',
format-number(number(ServerDateModified/@Month),'00'), '-',
format-number(number(ServerDateModified/@Day),'00')
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(
ServerDatePublished/@Year, '-',
format-number(number(ServerDatePublished/@Month),'00'), '-',
format-number(number(ServerDatePublished/@Day),'00')
)" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<gco:Date>
<xsl:value-of select="string($theDate)"/>
</gco:Date>
</gmd:dateStamp>
</xsl:template>
<!-- gmd:title -->
<xsl:template name="title">
<gmd:title>
<gco:CharacterString>
<xsl:for-each select="*[name() = 'TitleMain' or name() = 'TitleAdditional']">
<xsl:choose>
<xsl:when test="string(@Type) = 'Main'">
<xsl:value-of select="@Value"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Sub' and @Value != ''">
<xsl:value-of select="concat('; Subtitle: ', @Value)"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Translated' and @Value != ''">
<xsl:value-of select="concat('; Translated title: ', @Value)"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Other' and @Value != ''">
<xsl:value-of select="concat('; Other title: ', @Value)"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</gco:CharacterString>
</gmd:title>
</xsl:template>
<!-- <gmd:alternateTitle> -->
<xsl:template match="TitleAdditional" mode="iso19139">
<xsl:if test="string(@Type) = 'Alternative' and @Value != ''">
<gmd:alternateTitle>
<gco:CharacterString>
<xsl:value-of select="string(@Value)"/>
</gco:CharacterString>
</gmd:alternateTitle>
</xsl:if>
</xsl:template>
<!-- <gmd:citedResponsibleParty> -->
<xsl:template match="PersonAuthor" mode="iso19139">
<gmd:citedResponsibleParty>
<xsl:variable name="http-uri">
<xsl:choose>
<xsl:when test="string-length(@IdentifierOrcid) > 0">
<xsl:value-of select="concat(
'http://orcid.org/',
string(@IdentifierOrcid)
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- set attribute xlink:href -->
<xsl:if test="$http-uri != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$http-uri"/>
</xsl:attribute>
</xsl:if>
<xsl:variable name="nameidscheme">
<xsl:choose>
<xsl:when test="starts-with($http-uri, 'http://orcid.org/')">
<xsl:value-of select="string('ORCID')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="email">
<xsl:choose>
<xsl:when test="@Email != ''">
<xsl:value-of select="@Email"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="affiliation">
<xsl:choose>
<xsl:when test="@NameType = 'Personal'">
<xsl:value-of select="string('GBA')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="creatorname">
<xsl:value-of select="@LastName" />
<xsl:if test="@FirstName != ''">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@FirstName" />
<xsl:if test="@AcademicTitle != ''">
<xsl:text> (</xsl:text>
<xsl:value-of select="@AcademicTitle" />
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="namestring">
<xsl:choose>
<xsl:when test="normalize-space(@LastName) != ''">
<xsl:value-of select="
concat(
normalize-space(@LastName),
', ',
normalize-space(@FirstName))"/>
</xsl:when>
<!-- <xsl:when test="normalize-space(*[local-name() = 'creatorName']) != ''">
<xsl:value-of select="normalize-space(*[local-name() = 'creatorName'])"/>
</xsl:when> -->
<xsl:otherwise>
<xsl:value-of select="string('missing')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="individual">
<xsl:value-of select="$namestring"/>
</xsl:with-param>
<xsl:with-param name="personidtype">
<xsl:value-of select="$nameidscheme"/>
</xsl:with-param>
<xsl:with-param name="organisation">
<xsl:value-of select="$affiliation"/>
</xsl:with-param>
<xsl:with-param name="role">author</xsl:with-param>
<xsl:with-param name="email">
<xsl:value-of select="$email"/>
</xsl:with-param>
<xsl:with-param name="datacite-creatorname">
<xsl:value-of select="$creatorname"/>
</xsl:with-param>
</xsl:call-template>
<!-- <xsl:value-of select="$namestring"/> -->
</gmd:citedResponsibleParty>
</xsl:template>
<xsl:template match="PersonContributor" mode="iso19139">
<xsl:variable name="dcrole" select="normalize-space(./@ContributorType)"/>
<xsl:variable name="role">
<xsl:choose>
<xsl:when test="$dcrole = 'ContactPerson'">pointOfContact</xsl:when>
<xsl:when test="$dcrole = 'DataCollector'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'DataCurator'">custodian</xsl:when>
<xsl:when test="$dcrole = 'DataManager'">custodian</xsl:when>
<xsl:when test="$dcrole = 'Distributor'">originator</xsl:when>
<xsl:when test="$dcrole = 'Editor'">editor</xsl:when>
<xsl:when test="$dcrole = 'Funder'">funder</xsl:when>
<xsl:when test="$dcrole = 'HostingInstitution'">distributor</xsl:when>
<xsl:when test="$dcrole = 'ProjectLeader'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'ProjectManager'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'ProjectMember'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'ResearchGroup'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'Researcher'">collaborator</xsl:when>
<xsl:when test="$dcrole = 'RightsHolder'">rightsHolder</xsl:when>
<xsl:when test="$dcrole = 'Sponsor'">funder</xsl:when>
<xsl:when test="$dcrole = 'WorkPackageLeader'">collaborator</xsl:when>
<xsl:otherwise>contributor</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<gmd:citedResponsibleParty>
<xsl:variable name="http-uri">
<xsl:choose>
<xsl:when test="string-length(@IdentifierOrcid) > 0">
<xsl:value-of select="concat(
'http://orcid.org/',
string(@IdentifierOrcid)
)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- set attribute xlink:href -->
<xsl:if test="$http-uri != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$http-uri"/>
</xsl:attribute>
</xsl:if>
<xsl:variable name="nameidscheme">
<xsl:choose>
<xsl:when test="starts-with($http-uri, 'http://orcid.org/')">
<xsl:value-of select="string('ORCID')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="email">
<xsl:choose>
<xsl:when test="@Email != ''">
<xsl:value-of select="@Email"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="affiliation">
<xsl:choose>
<xsl:when test="@NameType = 'Personal'">
<xsl:value-of select="string('GBA')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="contrnamestring">
<xsl:choose>
<xsl:when test="normalize-space(@LastName) != ''">
<xsl:value-of select="
concat(
normalize-space(@LastName),
', ',
normalize-space(@FirstName))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('missing')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="individual">
<xsl:value-of select="$contrnamestring"/>
</xsl:with-param>
<xsl:with-param name="httpuri">
<xsl:value-of select="$http-uri"/>
</xsl:with-param>
<xsl:with-param name="personidtype">
<xsl:value-of select="$nameidscheme"/>
</xsl:with-param>
<xsl:with-param name="organisation">
<xsl:value-of select="$affiliation"/>
</xsl:with-param>
<xsl:with-param name="position">
<xsl:value-of select="$dcrole"/>
</xsl:with-param>
<xsl:with-param name="email">
<xsl:value-of select="$email"/>
</xsl:with-param>
<xsl:with-param name="role" select="$role"/>
</xsl:call-template>
</gmd:citedResponsibleParty>
</xsl:template>
<xsl:variable name="nl" select="string('&#10;')"/>
<!-- gmd:abstract -->
<xsl:template name="abstract">
<gmd:abstract>
<gco:CharacterString>
<xsl:for-each select="*[name() = 'TitleAbstract' or name() = 'TitleAbstractAdditional']">
<!-- <xsl:text>&#10;</xsl:text> -->
<xsl:choose>
<xsl:when test="string(@Type) = 'Abstract'">
<!-- <xsl:value-of select="@Value"/> -->
<xsl:value-of select="concat('&#10;Abstract: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Translated'">
<xsl:value-of select="concat('&#10;Translated Description: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'SeriesInformation' and @Value != ''">
<xsl:value-of select="concat('&#10;Series Information: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'TableOfContents' and @Value != ''">
<xsl:value-of select="concat('&#10;Table of Contents: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'TechnicalInfo' and @Value != ''">
<xsl:value-of select="concat('&#10;Technical Info: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Methods' and @Value != ''">
<xsl:value-of select="concat('&#10;Methods: ', string(@Value))"/>
</xsl:when>
<xsl:when test="string(@Type) = 'Other' and @Value != ''">
<xsl:if test="not(contains(string(@Value), 'Related publications:'))">
<xsl:value-of select="concat('&#10;Other Description: ', string(@Value))"/>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- <xsl:value-of select="$nl" disable-output-escaping="no"/> -->
</gco:CharacterString>
</gmd:abstract>
</xsl:template>
<!-- <gmd:aggregationInfo> -->
<xsl:template match="Reference" mode="iso19139">
<xsl:if test="
not(contains(normalize-space(string(@Value)), 'missing')) and
not(contains(normalize-space(string(@Value)), 'unknown'))">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(@Value))"/>
</gco:CharacterString>
</gmd:code>
<gmd:codeSpace>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(@Type))"/>
</gco:CharacterString>
</gmd:codeSpace>
</gmd:RS_Identifier>
</gmd:aggregateDataSetIdentifier>
<gmd:associationType>
<xsl:element name="gmd:DS_AssociationTypeCode">
<xsl:attribute name="codeList">
<xsl:value-of select="string('http://datacite.org/schema/kernel-4')"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="normalize-space(string(@Type))"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(string(@Type))"/>
</xsl:element>
</gmd:associationType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:if>
</xsl:template>
<xsl:template match="File" mode="iso19139">
<xsl:if test="string-length(normalize-space(string(@MimeType))) > 0">
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(@MimeType))"/>
</gco:CharacterString>
</gmd:name>
<gmd:version gco:nilReason="missing"/>
</gmd:MD_Format>
</gmd:distributionFormat>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,440 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* This file is part of TETHYS.
*
* LICENCE
* TETHYS is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or any later version.
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Application
* @package Module_Oai
* @author Arno Kaimbacher <arno.kaimbacher@geologie.ac.at>
* @copyright Copyright (c) 2018-2019, GBA TETHYS development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/
-->
<!--
/**
* Transforms the xml representation of an TETHYS model dataset to datacite
* xml as required by the OAI-PMH protocol.
*/
-->
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" encoding="utf-8" indent="yes" />
<xsl:template match="Rdr_Dataset" mode="oai_datacite">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.3/metadata.xsd">
<!-- <isReferenceQuality>true</isReferenceQuality>
<schemaVersion>4.3</schemaVersion>
<datacentreSymbol>RDR.GBA</datacentreSymbol> -->
<xsl:choose>
<xsl:when test="Identifier">
<xsl:apply-templates select="Identifier" mode="oai_datacite" />
</xsl:when>
<xsl:otherwise>
<identifier>
<xsl:text>oai:</xsl:text>
<xsl:value-of select="$repIdentifier" />
<xsl:text>:</xsl:text>
<xsl:value-of select="@PublishId" />
</identifier>
</xsl:otherwise>
</xsl:choose>
<!--<datacite:creator>-->
<creators>
<xsl:apply-templates select="PersonAuthor" mode="oai_datacite">
<xsl:sort select="@SortOrder"/>
</xsl:apply-templates>
</creators>
<titles>
<xsl:apply-templates select="TitleMain" mode="oai_datacite" />
<xsl:apply-templates select="TitleAdditional" mode="oai_datacite" />
</titles>
<publisher>
<!-- <xsl:value-of select="@PublisherName" /> -->
<xsl:value-of select="@CreatingCorporation" />
</publisher>
<publicationYear>
<xsl:value-of select="ServerDatePublished/@Year" />
</publicationYear>
<subjects>
<xsl:apply-templates select="Subject" mode="oai_datacite" />
</subjects>
<language>
<xsl:value-of select="@Language" />
</language>
<xsl:if test="PersonContributor">
<contributors>
<xsl:apply-templates select="PersonContributor" mode="oai_datacite">
<xsl:sort select="@SortOrder"/>
</xsl:apply-templates>
</contributors>
</xsl:if>
<dates>
<xsl:call-template name="RdrDate2" />
</dates>
<version>
<xsl:choose>
<xsl:when test="@Version">
<xsl:value-of select="@Version" />
</xsl:when>
<xsl:otherwise>
<xsl:text>1</xsl:text>
</xsl:otherwise>
</xsl:choose>
</version>
<resourceType resourceTypeGeneral="Dataset">
<xsl:text>Dataset</xsl:text>
<!-- <xsl:value-of select="@Type" /> -->
</resourceType>
<alternateIdentifiers>
<xsl:call-template name="AlternateIdentifier" />
</alternateIdentifiers>
<xsl:if test="Reference">
<relatedIdentifiers>
<xsl:apply-templates select="Reference" mode="oai_datacite" />
</relatedIdentifiers>
</xsl:if>
<rightsList>
<xsl:apply-templates select="Licence" mode="oai_datacite" />
</rightsList>
<sizes>
<size>
<xsl:value-of select="count(File)" />
<xsl:text> datasets</xsl:text>
</size>
</sizes>
<formats>
<xsl:apply-templates select="File/@MimeType" mode="oai_datacite" />
</formats>
<descriptions>
<xsl:apply-templates select="TitleAbstract" mode="oai_datacite" />
<xsl:apply-templates select="TitleAbstractAdditional" mode="oai_datacite" />
</descriptions>
<geoLocations>
<xsl:apply-templates select="Coverage" mode="oai_datacite" />
<!-- <geoLocation>
<geoLocationBox>
<westBoundLongitude>6.58987</westBoundLongitude>
<eastBoundLongitude>6.83639</eastBoundLongitude>
<southBoundLatitude>50.16</southBoundLatitude>
<northBoundLatitude>50.18691</northBoundLatitude>
</geoLocationBox>
</geoLocation> -->
</geoLocations>
</resource>
</xsl:template>
<xsl:template name="RdrDate2"
xmlns="http://datacite.org/schema/kernel-4">
<xsl:if test="EmbargoDate and ($unixTimestamp &lt; EmbargoDate/@UnixTimestamp)">
<date>
<xsl:attribute name="dateType">Available</xsl:attribute>
<xsl:variable name="embargoDate" select="concat(
EmbargoDate/@Year, '-',
format-number(number(EmbargoDate/@Month),'00'), '-',
format-number(number(EmbargoDate/@Day),'00')
)" />
<xsl:value-of select="$embargoDate" />
</date>
</xsl:if>
<xsl:if test="CreatedAt">
<date>
<xsl:attribute name="dateType">created</xsl:attribute>
<xsl:variable name="createdAt" select="concat(
CreatedAt/@Year, '-',
format-number(number(CreatedAt/@Month),'00'), '-',
format-number(number(CreatedAt/@Day),'00')
)" />
<xsl:value-of select="$createdAt" />
</date>
</xsl:if>
</xsl:template>
<xsl:template match="Coverage" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<geoLocation>
<geoLocationBox>
<westBoundLongitude>
<xsl:value-of select="@XMin" />
</westBoundLongitude>
<eastBoundLongitude>
<xsl:value-of select="@XMax" />
</eastBoundLongitude>
<southBoundLatitude>
<xsl:value-of select="@YMin" />
</southBoundLatitude>
<northBoundLatitude>
<xsl:value-of select="@YMax" />
</northBoundLatitude>
</geoLocationBox>
</geoLocation>
</xsl:template>
<xsl:template match="TitleAbstract" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<description>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
<xsl:if test="@Type != ''">
<xsl:attribute name="descriptionType">
<!-- <xsl:value-of select="@Type" /> -->
<xsl:text>Abstract</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@Value" />
</description>
</xsl:template>
<xsl:template match="TitleAbstractAdditional" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<description>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
<xsl:if test="@Type != ''">
<xsl:attribute name="descriptionType">
<xsl:call-template name="CamelCaseWord">
<xsl:with-param name="text" select="@Type" />
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@Value" />
</description>
</xsl:template>
<xsl:template name="CamelCaseWord">
<xsl:param name="text" />
<xsl:param name="firstLower" select="true()" />
<xsl:variable name="Upper">ABCDEFGHIJKLMNOPQRSTUVQXYZ</xsl:variable>
<xsl:variable name="Lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:for-each select="tokenize($text,'_')">
<xsl:choose>
<xsl:when test="position()=1 and $firstLower = true()">
<xsl:value-of select="substring(.,1,1)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(substring(.,1,1),$Lower,$Upper)" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="substring(.,2,string-length(.))" />
</xsl:for-each>
</xsl:template>
<xsl:template match="Identifier" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<identifier>
<xsl:attribute name="identifierType">
<xsl:text>DOI</xsl:text>
</xsl:attribute>
<xsl:value-of select="@Value" />
</identifier>
</xsl:template>
<xsl:template match="TitleMain" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<title>
<xsl:if test="@Language != ''">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
</xsl:if>
<xsl:if test="@Type != '' and @Type != 'Main'">
<xsl:attribute name="titleType">
<xsl:value-of select="@Type" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@Value" />
</title>
</xsl:template>
<xsl:template match="TitleAdditional" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<title>
<xsl:if test="@Language != ''">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="@Type != '' and @Type != 'Sub' and @Type != 'Main'">
<xsl:attribute name="titleType">
<xsl:value-of select="@Type" />
<xsl:text>Title</xsl:text>
</xsl:attribute>
</xsl:when>
<xsl:when test="@Type = 'Sub'">
<xsl:attribute name="titleType">
<xsl:value-of select="@Type" />
<xsl:text>title</xsl:text>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:value-of select="@Value" />
</title>
</xsl:template>
<xsl:template match="Subject" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<subject>
<xsl:if test="@Language != ''">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@Value" />
</subject>
</xsl:template>
<xsl:template name="AlternateIdentifier" match="AlternateIdentifier" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<alternateIdentifier>
<xsl:attribute name="alternateIdentifierType">
<xsl:text>url</xsl:text>
</xsl:attribute>
<!-- <xsl:variable name="identifier" select="concat($repURL, '/dataset/', @Id)" /> -->
<xsl:value-of select="@landingpage" />
</alternateIdentifier>
</xsl:template>
<xsl:template match="Reference" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<relatedIdentifier>
<xsl:attribute name="relatedIdentifierType">
<xsl:value-of select="@Type" />
</xsl:attribute>
<xsl:attribute name="relationType">
<xsl:value-of select="@Relation" />
</xsl:attribute>
<xsl:value-of select="@Value" />
</relatedIdentifier>
</xsl:template>
<xsl:template match="PersonContributor" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<contributor>
<xsl:if test="@ContributorType != ''">
<xsl:attribute name="contributorType">
<xsl:value-of select="@ContributorType" />
</xsl:attribute>
</xsl:if>
<contributorName>
<!-- <xsl:if test="@NameType != ''">
<xsl:attribute name="nameType">
<xsl:value-of select="@NameType" />
</xsl:attribute>
</xsl:if> -->
<xsl:value-of select="concat(@FirstName, ' ',@LastName)" />
</contributorName>
</contributor>
</xsl:template>
<xsl:template match="PersonAuthor" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<creator>
<creatorName>
<xsl:if test="@NameType != ''">
<xsl:attribute name="nameType">
<xsl:value-of select="@NameType" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@LastName" />
<xsl:if test="@FirstName != ''">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@FirstName" />
<xsl:if test="@AcademicTitle != ''">
<xsl:text> (</xsl:text>
<xsl:value-of select="@AcademicTitle" />
<xsl:text>)</xsl:text>
</xsl:if>
</creatorName>
<xsl:if test="@NameType = 'Personal'">
<givenName>
<xsl:value-of select="@FirstName" />
</givenName>
<familyName>
<xsl:value-of select="@LastName" />
</familyName>
<affiliation>GBA</affiliation>
</xsl:if>
<xsl:if test="@IdentifierOrcid != ''">
<nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">
<xsl:value-of select="@IdentifierOrcid" />
</nameIdentifier>
</xsl:if>
<!--
<nameType><xsl:value-of select="@NameType" /></nameType>
</xsl:if> -->
</creator>
</xsl:template>
<xsl:template match="File/@MimeType" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<format>
<xsl:choose>
<xsl:when test=". = 'application/x-sqlite3'">
<xsl:text>application/geopackage+sqlite3</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</format>
</xsl:template>
<xsl:template match="Licence" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<rights>
<xsl:attribute name="xml:lang">
<xsl:value-of select="@Language" />
</xsl:attribute>
<xsl:if test="@LinkLicence != ''">
<xsl:attribute name="rightsURI">
<xsl:value-of select="@LinkLicence" />
</xsl:attribute>
</xsl:if>
<xsl:attribute name="schemeURI">
<xsl:text>https://spdx.org/licenses/</xsl:text>
</xsl:attribute>
<xsl:attribute name="rightsIdentifierScheme">
<xsl:text>SPDX</xsl:text>
</xsl:attribute>
<xsl:attribute name="rightsIdentifier">
<xsl:value-of select="@Name" />
</xsl:attribute>
<xsl:value-of select="@NameLong" />
</rights>
<xsl:if test="@Name = 'CC-BY-4.0' or @Name = 'CC-BY-SA-4.0'">
<rights>
<xsl:attribute name="rightsURI">
<xsl:text>info:eu-repo/semantics/openAccess</xsl:text>
</xsl:attribute>
<xsl:text>Open Access</xsl:text>
</rights>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

145
public/assets2/style.css Normal file
View File

@ -0,0 +1,145 @@
html,
button,
input,
select,
textarea,
.pure-g [class*="pure-u"] {
font-family: "Open Sans", sans-serif;
}
td.value {
vertical-align: top;
padding-left: 1em;
padding: 3px;
}
td.key {
background-color: #3abac4;
padding: 3px;
text-align: right;
border: 1px solid #c0c0c0;
white-space: nowrap;
/* font-weight: bold; */
vertical-align: top;
}
.dcdata td.key {
background-color: #f4f8f4;
}
body {
margin: 1em 2em 1em 2em;
}
h1,
h2,
h3 {
font-family: sans-serif;
clear: left;
}
h1 {
padding-bottom: 4px;
margin-bottom: 0px;
}
h2 {
margin-bottom: 0.5em;
}
h3 {
margin-bottom: 0.3em;
font-size: medium;
}
.link {
border: 1px outset #88f;
background-color: #00beff;
padding: 1px 4px 1px 4px;
font-size: 80%;
text-decoration: none;
font-weight: bold;
font-family: sans-serif;
color: #6c6e6b;
}
.link:hover {
color: #d0d0d0;
}
.link:active {
color: #d0d0d0;
background-color: #00beff;
}
.oaiRecord,
.oaiRecordTitle {
background-color: #eee;
border-style: solid;
border-color: #d0d0d0;
}
h2.oaiRecordTitle {
background-color: #51565c;
color: #fff;
font-size: medium;
font-weight: bold;
padding: 10px;
border-width: 0px 0px 0px 0px;
margin: 0px;
}
.oaiRecord {
margin-bottom: 3em;
border-width: 2px;
padding: 10px;
}
.results {
margin-bottom: 1.5em;
}
ul.quicklinks {
margin-top: 2px;
padding: 4px;
text-align: left;
border-bottom: 2px solid #ccc;
border-top: 2px solid #ccc;
clear: left;
}
ul.quicklinks li {
font-size: 80%;
display: inline;
list-style: none;
font-family: sans-serif;
}
p.intro {
font-size: 80%;
}
.xmlSource {
font-size: 70%;
border: solid #c0c0a0 1px;
/* background-color: #ffffe0; */
background-color: #f4f8f4;
padding: 2em 2em 2em 0em;
}
.xmlBlock {
padding-left: 2em;
}
.xmlTagName {
color: #800000;
font-weight: bold;
}
.xmlAttrName {
font-weight: bold;
}
.xmlAttrValue {
color: #0000c0;
}

View File

@ -76,7 +76,7 @@ const is = computed(() => {
<!-- <component :is="itemHref ? 'div' : Link" :href="itemHref ? itemHref : itemRoute" -->
<component :is="is" :href="itemRoute ? stardust.route(props.item.route) : props.item.href"
class="flex cursor-pointer dark:text-slate-300 dark:hover:text-white" :class="componentClass"
@click.prevent="menuClick" v-bind:target="props.item.target ?? null">
@click="menuClick" v-bind:target="props.item.target ?? null">
<BaseIcon v-if="item.icon" :path="item.icon" class="flex-none" :class="activeInactiveStyle" w="w-16"
:size="18" />
<span class="grow text-ellipsis line-clamp-1" :class="activeInactiveStyle">

View File

@ -5,7 +5,7 @@ import type { Map } from 'leaflet/src/map/index';
export abstract class Control<T> extends EventEmitter<T> {
// @section
// @aka Control options
options = {
public options = {
position: 'topright',
};
protected _map;
@ -20,19 +20,19 @@ export abstract class Control<T> extends EventEmitter<T> {
// // util.setOptions(this, defaults);
// }
getPosition() {
public getPosition() {
return this.options.position;
}
getContainer() {
public getContainer() {
return this._container;
}
abstract onRemove(map): void;
public abstract onRemove(map): void;
abstract onAdd(map: any): HTMLElement;
public abstract onAdd(map: any): HTMLElement;
addTo(map: Map): Control<T> {
public addTo(map: Map): Control<T> {
this._map = map;
let container = (this._container = this.onAdd(map));
@ -51,9 +51,9 @@ export abstract class Control<T> extends EventEmitter<T> {
return this;
}
removeFrom(map) {
let pos = this.getPosition(),
corner = map._controlCorners[pos];
public removeFrom(map) {
let pos = this.getPosition();
let corner = map._controlCorners[pos];
corner.removeChild(this._container);
this._map = null;

View File

@ -165,23 +165,23 @@ export class EventEmitter<T> {
private listeners: Listener<T>[] = [];
private listenersOncer: Listener<T>[] = [];
on = (listener: Listener<T>): Disposable => {
public on = (listener: Listener<T>): Disposable => {
this.listeners.push(listener);
return {
dispose: () => this.off(listener),
};
};
once = (listener: Listener<T>): void => {
public once = (listener: Listener<T>): void => {
this.listenersOncer.push(listener);
};
off = (listener: Listener<T>) => {
public off = (listener: Listener<T>) => {
var callbackIndex = this.listeners.indexOf(listener);
if (callbackIndex > -1) this.listeners.splice(callbackIndex, 1);
};
emit = (event: T) => {
public emit = (event: T) => {
/** Update any general listeners */
this.listeners.forEach((listener) => listener(event));
@ -193,7 +193,7 @@ export class EventEmitter<T> {
}
};
pipe = (te: EventEmitter<T>): Disposable => {
public pipe = (te: EventEmitter<T>): Disposable => {
return this.on((e) => te.emit(e));
};
}

View File

@ -1,9 +1,11 @@
// extend an object with properties of one or more other objects
export function extend(dest) {
var i, j, len, src;
let i;
let j;
let len;
for (j = 1, len = arguments.length; j < len; j++) {
src = arguments[j];
let src = arguments[j];
for (i in src) {
dest[i] = src[i];
}

View File

@ -10,9 +10,9 @@ import { stardust } from '@eidellev/adonis-stardust/client';
defineProps({
user: {
type: Object,
default: () => ({}),
},
type: Object,
default: () => ({}),
},
roles: {
type: Object,
default: () => ({}),
@ -25,7 +25,7 @@ defineProps({
</script>
<template>
<LayoutAuthenticated :user="user">
<LayoutAuthenticated>
<Head title="View user" />
<SectionMain>
<SectionTitleLineWithButton :icon="mdiAccountKey" title="View user" main>

View File

@ -71,9 +71,9 @@ const datasets = computed(() => mainService.datasets);
<div class="grid grid-cols-1 gap-6 lg:grid-cols-3 mb-6">
<CardBoxWidget trend="12%" trend-type="up" color="text-emerald-500" :icon="mdiAccountMultiple"
:number="authors.length" label="Authors" />
<CardBoxWidget trend="193" trend-type="info" color="text-blue-500" :icon="mdiDatabaseOutline" :number="datasets.length"
label="Publications" />
<!-- <CardBoxWidget trend="193" trend-type="info" color="text-blue-500" :icon="mdiCartOutline" :number="datasets.length"
<CardBoxWidget trend="193" trend-type="info" color="text-blue-500" :icon="mdiDatabaseOutline"
:number="datasets.length" label="Publications" />
<!-- <CardBoxWidget trend="193" trend-type="info" color="text-blue-500" :icon="mdiCartOutline" :number="datasets.length"
prefix="$" label="Publications" /> -->
<CardBoxWidget trend="Overflow" trend-type="alert" color="text-red-500" :icon="mdiChartTimelineVariant"
:number="256" suffix="%" label="Performance" />
@ -81,20 +81,14 @@ const datasets = computed(() => mainService.datasets);
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
<div class="flex flex-col justify-between">
<CardBoxClient
v-for="client in authorBarItems"
:key="client.id"
:name="client.name"
:email="client.email"
:date="client.created_at"
:text="client.datasetCount"
/>
<CardBoxClient v-for="client in authorBarItems" :key="client.id" :name="client.name"
:email="client.email" :date="client.created_at" :text="client.datasetCount" />
</div>
<div class="flex flex-col justify-between">
<CardBoxTransaction v-for="(transaction, index) in transactionBarItems" :key="index"
:amount="transaction.amount" :date="transaction.date" :business="transaction.business"
:type="transaction.type" :name="transaction.name" :account="transaction.account" />
</div>
</div>
</div>
<SectionBannerStarOnGitHub />
@ -116,6 +110,33 @@ const datasets = computed(() => mainService.datasets);
<CardBox :icon="mdiMonitorCellphone" title="Responsive table" has-table>
<TableSampleClients />
</CardBox>
<CardBox>
<p class="mb-3 text-gray-500 dark:text-gray-400">
Discover the power of Tethys, the cutting-edge web backend solution that revolutionizes the way you
handle
research data. At the heart of Tethys lies our meticulously developed research data repository, which
leverages state-of-the-art CI/CD techniques to deliver a seamless and efficient experience.
</p>
<p class="mb-3 text-gray-500 dark:text-gray-400">
CI/CD, or Continuous Integration and Continuous Deployment, is a modern software development approach
that
ensures your code undergoes automated testing, continuous integration, and frequent deployment. By
embracing
CI/CD techniques, we ensure that every code change in our research data repository is thoroughly
validated,
enhancing reliability and accelerating development cycles.
</p>
<p class="mb-3 text-gray-500 dark:text-gray-400">
With Tethys, you can say goodbye to the complexities of manual deployments and embrace a streamlined
process
that eliminates errors and minimizes downtime. Our CI/CD pipeline automatically verifies each code
commit,
runs comprehensive tests, and deploys the repository seamlessly, ensuring that your research data is
always
up-to-date and accessible.
</p>
</CardBox>
</SectionMain>
<!-- </section> -->

View File

@ -0,0 +1,278 @@
<template>
<LayoutAuthenticated>
<Head title="Edit dataset" />
<SectionMain>
<SectionTitleLineWithButton :icon="mdiImageText" title="Update dataset" main>
<BaseButton :route-name="stardust.route('dataset.list')" :icon="mdiArrowLeftBoldOutline" label="Back"
color="white" rounded-full small />
</SectionTitleLineWithButton>
<!-- max-w-2xl max-width: 42rem; /* 672px */ -->
<!-- <div class="max-w-2xl mx-auto"> -->
<CardBox :form="true">
<div class="mb-4">
<!-- <label for="title" class="block text-gray-700 font-bold mb-2">Title:</label>
<input
type="text"
id="title"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
v-model="form.language"
/> -->
<div class="flex flex-col md:flex-row">
<FormField label="Language *" help="required: select dataset main language"
:class="{ 'text-red-400': errors.language }" class="w-full flex-1">
<FormControl required v-model="form.language" :type="'select'" placeholder="[Enter Language]"
:errors="form.errors.language" :options="{ de: 'de', en: 'en' }">
<div class="text-red-400 text-sm" v-if="form.errors.language">
{{ form.errors.language.join(', ') }}
</div>
</FormControl>
</FormField>
</div>
<FormField label="Dataset Type *" help="required: dataset type"
:class="{ 'text-red-400': form.errors.type }">
<FormControl required v-model="form.type" :type="'select'" placeholder="-- select type --"
:errors="errors.type" :options="doctypes">
<div class="text-red-400 text-sm" v-if="form.errors.type && Array.isArray(form.errors.type)">
{{ form.errors.type.join(', ') }}
</div>
</FormControl>
</FormField>
<!-- titles -->
<CardBox class="mb-6 shadow" :has-form-data="true" title="Titles" :icon="mdiFinance"
:header-icon="mdiPlusCircle" v-on:header-icon-click="addTitle()">
<div class="flex flex-col md:flex-row">
<FormField label="Main Title *" help="required: main title"
:class="{ 'text-red-400': form.errors['titles.0.value'] }" class="w-full mr-1 flex-1">
<FormControl required v-model="form.titles[0].value" type="text"
placeholder="[enter main title]">
<div class="text-red-400 text-sm"
v-if="form.errors['titles.0.value'] && Array.isArray(form.errors['titles.0.value'])">
{{ form.errors['titles.0.value'].join(', ') }}
</div>
</FormControl>
</FormField>
<FormField label="Main Title Language*" help="required: main title language"
:class="{ 'text-red-400': form.errors['titles.0.language'] }" class="w-full ml-1 flex-1">
<FormControl required v-model="form.titles[0].language" type="text" :is-read-only="true">
<div class="text-red-400 text-sm"
v-if="form.errors['titles.0.language'] && Array.isArray(form.errors['titles.0.language'])">
{{ form.errors['titles.0.language'].join(', ') }}
</div>
</FormControl>
</FormField>
</div>
<label v-if="form.titles.length > 1">additional titles </label>
<!-- <BaseButton :icon="mdiPlusCircle" @click.prevent="addTitle()" color="modern" rounded-full small /> -->
<table class="table-auto">
<thead>
<tr>
<!-- <th v-if="checkable" /> -->
<th scope="col">Title Value *</th>
<th>Title Type*</th>
<th>Title Language*</th>
<th />
</tr>
</thead>
<tbody>
<template v-for="(item, index) in form.titles" :key="index">
<tr v-if="item.type != 'Main'">
<!-- <td scope="row">{{ index + 1 }}</td> -->
<td scope="row">
<FormControl required v-model="form.titles[index].value" type="text"
placeholder="[enter main title]">
<div class="text-red-400 text-sm"
v-if="form.errors[`titles.${index}.value`]">
{{ form.errors[`titles.${index}.value`].join(', ') }}
</div>
</FormControl>
</td>
<td>
<FormControl required v-model="form.titles[index].type" type="select"
:options="titletypes" placeholder="[select title type]">
<div class="text-red-400 text-sm"
v-if="Array.isArray(form.errors[`titles.${index}.type`])">
{{ form.errors[`titles.${index}.type`].join(', ') }}
</div>
</FormControl>
</td>
<td>
<FormControl required v-model="form.titles[index].language" type="select"
:options="{ de: 'de', en: 'en' }" placeholder="[select title language]">
<div class="text-red-400 text-sm"
v-if="form.errors[`titles.${index}.language`]">
{{ form.errors[`titles.${index}.language`].join(', ') }}
</div>
</FormControl>
</td>
<td>
<td class="before:hidden lg:w-1 whitespace-nowrap">
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<!-- <BaseButton color="info" :icon="mdiEye" small @click="isModalActive = true" /> -->
<BaseButton color="danger" :icon="mdiTrashCan" small
@click.prevent="removeTitle(index)" />
</BaseButtons>
</td>
</td>
</tr>
</template>
</tbody>
</table>
</CardBox>
</div>
<div class="mb-4">
<label for="description" class="block text-gray-700 font-bold mb-2">Description:</label>
<textarea id="description"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
v-model="form.type"></textarea>
</div>
<div class="mb-4">
<!-- <label for="project" class="block text-gray-700 font-bold mb-2">Project:</label>
<select
id="project"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
v-model="dataset.project_id"
>
<option v-for="project in projects" :key="project.id" :value="project.id" class="block px-4 py-2 text-gray-700">
{{ project.label }}
</option>
</select> -->
</div>
<div class="mb-4">
<label for="license" class="block text-gray-700 font-bold mb-2">License:</label>
<!-- <select
id="license"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
v-model="dataset.license_id"
>
<option v-for="license in licenses" :key="license.id" :value="license.id" class="block px-4 py-2 text-gray-700">
{{ license.name_long }}
</option>
</select> -->
</div>
<!-- Add more input fields for the other properties of the dataset -->
<!-- <button
type="submit"
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"
>
Save
</button> -->
<template #footer>
<BaseButtons>
<BaseButton type="submit" label="Submit" color="info" :class="{ 'opacity-25': form.processing }"
:disabled="form.processing">
</BaseButton>
</BaseButtons>
</template>
</CardBox>
<!-- </div> -->
</SectionMain>
</LayoutAuthenticated>
</template>
<script setup lang="ts">
import { Head, useForm } from '@inertiajs/vue3';
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
import { Dataset, Title } from '@/Dataset';
import FormField from '@/Components/FormField.vue';
import FormControl from '@/Components/FormControl.vue';
import SectionMain from '@/Components/SectionMain.vue';
import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue';
import { mdiImageText, mdiArrowLeftBoldOutline, mdiPlusCircle, mdiFinance, mdiTrashCan } from '@mdi/js';
// import BaseDivider from '@/Components/BaseDivider.vue';
import BaseButton from '@/Components/BaseButton.vue';
import BaseButtons from '@/Components/BaseButtons.vue';
import CardBox from '@/Components/CardBox.vue';
import { stardust } from '@eidellev/adonis-stardust/client';
const props = defineProps({
dataset: {
type: Object,
default: () => ({}),
},
languages: {},
doctypes: {
type: Object,
default: () => ({}),
},
titletypes: {
type: Object,
default: () => ({}),
},
errors: {
type: Object,
default: () => ({}),
},
});
// const projects = reactive([]);
// const licenses = reactive([]);
let form = useForm<Dataset>(props.dataset as Dataset);
// const form = useForm({
// _method: 'put',
// login: props.user.login,
// email: props.user.email,
// password: '',
// password_confirmation: '',
// roles: props.userHasRoles, // fill actual user roles from db
// });
// async created() {
// // Fetch the list of projects and licenses from the server
// const response = await fetch('/api/datasets/edit/' + this.dataset.id);
// const data = await response.json();
// this.projects = data.projects;
// this.licenses = data.licenses;
// }
const addTitle = () => {
let newTitle: Title = { value: '', language: '', type: '' };
//this.dataset.files.push(uploadedFiles[i]);
form.titles.push(newTitle);
};
const removeTitle = (key) => {
form.titles.splice(key, 1);
};
</script>
<!-- <style>
.max-w-2xl {
max-width: 2xl;
}
.text-2xl {
font-size: 2xl;
}
.font-bold {
font-weight: bold;
}
.mb-4 {
margin-bottom: 1rem;
}
.block {
display: block;
}
.text-gray-700 {
color: #4b5563;
}
.shadow {
box-shadow:
0 0 0 1px rgba(66, 72, 78, 0.05),
0 1px 2px 0 rgba(66, 72, 78, 0.08),
0 2px 4px 0 rgba(66, 72, 78, 0.12),
0 4px 8px 0 rgba(66, 72, 78, 0.16);
}
</style> -->

View File

@ -2,7 +2,7 @@
// import { Head, Link, useForm, usePage } from '@inertiajs/inertia-vue3';
import { Head, usePage } from '@inertiajs/vue3';
import { ComputedRef } from 'vue';
import { mdiSquareEditOutline, mdiTrashCan, mdiAlertBoxOutline } from '@mdi/js';
import { mdiSquareEditOutline, mdiTrashCan, mdiAlertBoxOutline, mdiLockOpen } from '@mdi/js';
import { computed } from 'vue';
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
import SectionMain from '@/Components/SectionMain.vue';
@ -44,6 +44,10 @@ const flash: ComputedRef<any> = computed(() => {
return usePage().props.flash;
});
// const errors: ComputedRef<any> = computed(() => {
// return usePage().props.errors;
// });
// const form = useForm({
// search: props.filters.search,
// });
@ -62,9 +66,13 @@ const flash: ComputedRef<any> = computed(() => {
<LayoutAuthenticated>
<Head title="Submit Dataset" />
<SectionMain>
<!-- <FormValidationErrors v-bind:errors="errors" /> -->
<NotificationBar v-if="flash.message" color="success" :icon="mdiAlertBoxOutline">
{{ flash.message }}
</NotificationBar>
<NotificationBar v-if="flash.warning" color="warning" :icon="mdiAlertBoxOutline">
{{ flash.warning }}
</NotificationBar>
<!-- table -->
<CardBox class="mb-6" has-table>
@ -105,13 +113,22 @@ const flash: ComputedRef<any> = computed(() => {
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<!-- release created dataset -->
<BaseButton
v-if="can.delete && (dataset.server_state === 'inprogress' || dataset.server_state === 'rejected_editor')"
v-if="can.edit"
:route-name="stardust.route('dataset.release', [dataset.id])"
color="info"
:icon="mdiSquareEditOutline"
:icon="mdiLockOpen"
:label="'Release'"
small
/>
<!-- && (dataset.server_state === 'inprogress' || dataset.server_state === 'rejected_editor')" -->
<BaseButton
v-if="can.edit"
:route-name="stardust.route('dataset.edit', [dataset.id])"
color="info"
:icon="mdiSquareEditOutline"
:label="'Edit'"
small
/>
<!-- @click="destroy(dataset.id)" -->
<BaseButton v-if="can.delete" color="danger" :icon="mdiTrashCan" small />
</BaseButtons>

View File

@ -107,10 +107,10 @@ const handleSubmit = async (e) => {
{{ flash.message }}
class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4"
</NotificationBar> -->
<div v-if="flash && flash.message" class="flex flex-col mt-6 animate-fade-in">
<div v-if="flash && flash.warning" class="flex flex-col mt-6 animate-fade-in">
<div class="bg-yellow-500 border-l-4 border-orange-400 text-white p-4" role="alert">
<p class="font-bold">Be Warned</p>
<p>{{ flash.message }}</p>
<p>{{ flash.warning }}</p>
</div>
</div>

View File

@ -52,15 +52,15 @@ export default class RegisterViewComponent extends Vue {
type: Object,
default: () => ({}),
})
errors: IErrorMessage;
public errors: IErrorMessage;
// Data Property
form: InertiaForm<any> = useForm({
public form: InertiaForm<any> = useForm({
email: '',
password: '',
});
results: Array<any> = [];
public results: Array<any> = [];
// Component method
public async submit(): Promise<void> {

View File

@ -26,6 +26,12 @@ export default [
icon: mdiAccountEye,
label: 'Roles',
},
{
href: '/oai',
icon: mdiAccountEye,
label: 'OAI',
target: '_blank',
},
{
// route: 'dataset.create',
icon: mdiDatabasePlus,

View File

@ -19,6 +19,7 @@ Inertia.share({
flash: (ctx) => {
return {
message: ctx.session.flashMessages.get('message'),
warning: ctx.session.flashMessages.get('warning'),
};
},

View File

@ -35,6 +35,11 @@ Route.get('/', async ({ view }) => {
return view.render('welcome');
}).as('dashboard2');
// Route.get( '/oai', 'Oai/RequestController.index').as('oai');
Route.group(() => {
Route.get('/oai', 'Oai/OaiController.index').as('get');
Route.post('/oai', 'Oai/OaiController.index').as('post');
}).as('oai');
// Route.inertia('/about', 'App');
Route.group(() => {
@ -155,10 +160,14 @@ Route.group(() => {
Route.get('/dataset/:id/release', 'DatasetController.release')
.as('dataset.release')
.where('id', Route.matchers.number())
.middleware(['auth', 'can:dataset-submit']);
.middleware(['auth']); //, 'can:dataset-submit']);
Route.put('/dataset/:id/releaseupdate', 'DatasetController.releaseUpdate')
.as('dataset.releaseUpdate')
.middleware(['auth', 'can:dataset-submit']);
Route.get('/dataset/:id/edit', 'DatasetController.edit')
.as('dataset.edit')
.where('id', Route.matchers.number())
.middleware(['auth', 'can:dataset-submit']);
// Route.get('/user/:id', 'UsersController.show').as('user.show').where('id', Route.matchers.number());
// Route.get('/user/:id/edit', 'UsersController.edit').as('user.edit').where('id', Route.matchers.number());

View File

@ -50,8 +50,8 @@ validator.rule(
const mainLanguage = validator.helpers.getFieldValue(mainLanguageField, root, tip);
const type = validator.helpers.getFieldValue(typeField, root, tip);
if (type && type == 'Translated') {
if (value == mainLanguage) {
if (type && type === 'Translated') {
if (value === mainLanguage) {
errorReporter.report(
pointer,
'translatedLanguage', // Keep an eye on this

View File

@ -47,7 +47,7 @@ export const reporters: Required<Config>['reporters'] = [specReporter()];
|
*/
export const runnerHooks: Pick<Required<Config>, 'setup' | 'teardown'> = {
setup: [() => TestUtils.ace().loadCommands()],
setup: [() => TestUtils.ace().loadCommands(), () => TestUtils.db().migrate()],
teardown: [],
};

View File

@ -0,0 +1,83 @@
import { test } from '@japa/runner';
import supertest from 'supertest';
import Database from '@ioc:Adonis/Lucid/Database';
import Dataset from 'App/Models/Dataset';
import server from '@ioc:Adonis/Core/Server'; // Import the server instance
import User from 'App/Models/User';
test.group('DatasetController', (group) => {
// Write your test here
// beforeEach(async () => {
// await Database.beginGlobalTransaction();
// });
// In the following example, we start a global transaction before all the tests and roll back it after the tests.
group.each.setup(async () => {
await Database.beginGlobalTransaction();
return () => Database.rollbackGlobalTransaction();
});
test('should render dataset release page', async ({ assert }) => {
// var agent = supertest(server.instance);
// const user = await loginUser(agent);
const user = await User.create({
login: 'test',
email: 'alice@email.com',
password: 'password',
});
const dataset = new Dataset();
dataset.type = 'analysisdata';
dataset.creatingCorporation = 'Tethys RDR';
dataset.language = 'de';
dataset.server_state = 'inprogress'; // Set the desired server state here
await dataset.save();
await user.related('datasets').save(dataset);
// Perform the login request to establish the session
const loginResponse = await supertest(server.instance)
.post('/app/login')
// .field('email', user.email)
// .field('password', user.password)
// .set('Content-Type', 'application/x-www-form-urlencoded')
.send({ email: user.email, password: 'password' })
.set('Content-Type', 'application/json')
.expect(302); // Assuming the login endpoint redirects, if succesful
// Extract the session cookies from the login response
assert.exists(loginResponse.headers['set-cookie']);
const cookie = loginResponse.headers['set-cookie'];
// const response = await supertest(server.instance).get(`/submitter/dataset/${dataset.id}/release`).expect(302); //302 if authenticated, else 200
const response = await supertest(server.instance)
.get(`/submitter/dataset/${dataset.id}/release`)
.set('Cookie', cookie)
.set('X-Requested-With', 'XMLHttpRequest') // Set the X-Requested-With header to mimic an AJAX request
.set('X-Inertia', 'true')
// .set('X-Inertia-Version', '97c0899ca6e04e77a69f1ad5320e4ebe')
.set('Accept', 'text/html, application/xhtml+xml')
.set('Accept-Encoding', 'gzip, deflate, br')
.set('Connection', 'keep-alive')
.set(
'User-Agent',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
)
.set('Host', 'localhost:4001')
// .set('Referer', 'http://localhost:3333/submitter/dataset')
// .set('Authorization', `Bearer ${authToken}`) // Set the Authorization header with the authentication token .
.expect(200);
// assert.equal(response.statusCode, 302);
// Add more assertions based on the expected behavior
// assert.equal(response.header('X-Inertia'), 'true');
// assert.equal(response.header('Content-Type'), 'application/json');
assert.equal(response.headers['x-inertia'], 'true');
assert.equal(response.headers['content-type'], 'application/json; charset=utf-8');
const responseData = response.body as { component: string; props: { dataset: any }; url: string };
// assert.equal(responseData.component, 'DatasetReleasePage');
assert.equal(responseData.props.dataset.id, dataset.id);
});
});