Compare commits

...

22 Commits

Author SHA1 Message Date
70dea64c3c Add magenta.de to list of blocked mail domains 2022-03-12 17:58:20 +01:00
987ebc99ed Update translation files 2022-03-10 16:12:22 +01:00
f64d34d577 Update hungarian translation files 2022-03-09 22:52:27 +01:00
249d42339d Add new marking type "cast", e.g. for iron casting 2022-02-18 15:21:27 +01:00
d9c03d78cd Add marking type "scarified" 2022-02-18 14:51:16 +01:00
f6c5808817 Add marking types "punched" and "hallmarked" 2022-02-18 13:55:48 +01:00
3387c5a292 Add new marking type "nailed" 2022-02-18 13:35:42 +01:00
793a8e08ad Add marking type riveted 2022-02-18 03:17:51 +01:00
01435df405 Add marking type "burnt in" 2022-02-18 03:00:48 +01:00
d061814751 Add marking type "screwed" (on) 2022-02-18 02:51:17 +01:00
e3c77bb556 Add marking type "sewn" 2022-02-18 02:31:24 +01:00
ae49dc2aa4 Add marking type "embroidered" 2022-02-18 02:11:06 +01:00
eefba3ddc2 Fix reference to wrong constant name 2022-02-15 01:23:05 +01:00
e1681976c4 Add translation files for new value sets 2022-02-13 19:43:35 +01:00
af10f52738 Add value sets for event / appointment status, attendance mode, and appointment and
exhibition contributor roles
2022-02-13 18:40:44 +01:00
91bf28ae96 Add source types unpublished and patent 2022-02-09 02:13:10 +01:00
0ff654b3f9 Add MDBlockedMailserverSet for blocking mail servers 2022-01-24 23:14:32 +01:00
dacebedd48 Add unified minimum and max year in MDRequirementsSet 2022-01-07 16:01:00 +01:00
783fe29fc9 Add list of allowed file types in a ZIP for 3D objects 2022-01-04 02:56:32 +01:00
16f0621a9a Use gramms and millimeters as base weight and length units 2021-12-20 02:25:17 +01:00
262972eb54 Add conversion funcs for length (to micrometer), weights (to milligramm) 2021-12-20 01:23:26 +01:00
9801f1a35f Add MDNodaRepositoriesSet to gather linkable noda repositories for tags,
places, actors
2021-12-11 01:07:56 +01:00
11 changed files with 319 additions and 1 deletions

2
l18n

Submodule l18n updated: 98087dfab7...4e3afcf35c

View File

@ -0,0 +1,38 @@
<?PHP
/**
* Contains a class for controlling the list of available attendance modes
* to appointment / event.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available attendance modes.
*/
final class MDAppointmentAttendanceModeSet extends MDValueSet {
const MODES = [
'offline',
'online',
'mixed',
];
const MODES_TO_SCHEMA_ORG = [
'offline' => 'https://schema.org/OfflineEventAttendanceMode',
'online' => 'https://schema.org/OnlineEventAttendanceMode',
'mixed' => 'https://schema.org/MixedEventAttendanceMode',
];
/**
* Gets a list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return parent::getTlSortedList($tlLoader, self::MODES, "appointment_attendance_modes", "appointment_attendance_modes");
}
}

View File

@ -0,0 +1,31 @@
<?PHP
/**
* Contains a class for controlling the list of available contributor types
* to appointment / event.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available contributor roles.
*/
final class MDAppointmentContributorsSet extends MDValueSet {
const AVAILABLE_ROLES = [
'organizer',
'presenter',
];
/**
* Gets a list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return parent::getTlSortedList($tlLoader, self::AVAILABLE_ROLES, "appointment_contributor_roles", "appointment_contributor_roles");
}
}

View File

@ -0,0 +1,39 @@
<?PHP
/**
* Contains a class for controlling the list of available statuses to appointment / event.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available status.
*/
final class MDAppointmentStatusSet extends MDValueSet {
const STATUS = [
'scheduled',
'cancelled',
'moved_online',
'postponed',
];
const STATUS_TO_SCHEMA_ORG = [
'scheduled' => 'https://schema.org/EventScheduled',
'cancelled' => 'https://schema.org/EventCancelled',
'moved_online' => 'https://schema.org/EventMovedOnline',
'postponed' => 'https://schema.org/EventPostponed',
];
/**
* Gets a list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return parent::getTlSortedList($tlLoader, self::STATUS, "appointment_status", "appointment_status");
}
}

View File

@ -0,0 +1,21 @@
<?PHP
/**
* Contains a class listing blocked mailservers. Mail servers may e.g. be blocked
* for not accepting mails from @museum-digital.de.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a class listing blocked mailservers. Mail servers may e.g. be blocked
* for not accepting mails from @museum-digital.de.
*/
final class MDBlockedMailserverSet extends MDValueSet {
const BLOCKED_DOMAINS = [
"@magenta.de",
"@t-online.de",
];
}

View File

@ -0,0 +1,34 @@
<?PHP
/**
* Contains a class for controlling the list of available contributor types
* to exhibitions.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available contributor roles.
*/
final class MDExhibitionContributorsSet extends MDValueSet {
const AVAILABLE_ROLES = [
'concept',
'curator',
'design',
'coordinator',
'protagonist',
];
/**
* Gets a list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return parent::getTlSortedList($tlLoader, self::AVAILABLE_ROLES, "exhibition_contributor_roles", "exhibition_contributor_roles");
}
}

View File

@ -19,7 +19,17 @@ final class MDMarkingTypesSet extends MDValueSet {
'stamp', 'stamp',
'overprint', 'overprint',
'embossing', 'embossing',
'embroidered',
'handwritten', 'handwritten',
'screwed',
'burnt_in',
'riveted',
'nailed',
'punched',
'hallmarked',
'scarified',
'cast',
'sewn',
'glued', 'glued',
]; ];

View File

@ -0,0 +1,81 @@
<?PHP
/**
* Class containing lists of repositories, tags, places, and actors can be linked with.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing lists of repositories, tags, places, and actors can be linked with.
*/
final class MDNodaRepositoriesSet extends MDValueSet {
const REPOSITORIES_ACTOR = [
'allgemein',
'bne',
'bnf',
'edition humboldt digital',
'gnd',
'iconclass',
'lcsh',
'loc',
'MBL',
'NDB/ADB',
'ndl',
'ndp-ikmk',
'nomisma',
'npg',
'orcid',
'pim',
'rkd',
'ulan',
'viaf',
'wikidata',
'Wikipedia',
];
const REPOSITORIES_PLACE = [
'allgemein',
'bne',
'bnf',
'cona',
'gnd',
'lcsh',
'loc',
'ndl',
'ndp-ikmk',
'nomisma',
'npg',
'osm',
'pleiades',
'rkd',
'viaf',
'wikidata',
'Wikipedia',
];
const REPOSITORIES_TAG = [
'aat',
'ackerbau',
'allgemein',
'bne',
'bnf',
'gnd',
'grobsystematik',
'iconclass',
'lcsh',
'loc',
'mindat.org',
'moebeltypologie',
'ndl',
'nomisma',
'npg',
'oberbegriffsdatei',
'rkd',
'viaf',
'wikidata',
'Wikipedia',
];
}

View File

@ -23,6 +23,9 @@ final class MDRequirementsSet {
// Object images need to be at least 500 px wide // Object images need to be at least 500 px wide
const MIN_OBJECT_IMAGE_HEIGHT = 540; const MIN_OBJECT_IMAGE_HEIGHT = 540;
const TIME_EARLIEST_YEAR = -6000000000;
const TIME_LATEST_YEAR = 2099;
const MIMETYPES_USER_PROFILE_IMG = ['image/jpeg', 'image/jpg']; const MIMETYPES_USER_PROFILE_IMG = ['image/jpeg', 'image/jpg'];
const MIMETYPES_OBJECT_IMAGE = ['image/jpeg', 'image/jpg']; const MIMETYPES_OBJECT_IMAGE = ['image/jpeg', 'image/jpg'];
@ -47,4 +50,6 @@ final class MDRequirementsSet {
const MIMETYPES_CATALOGUE_WORK_IMAGE = ['image/jpeg', 'image/jpg']; const MIMETYPES_CATALOGUE_WORK_IMAGE = ['image/jpeg', 'image/jpg'];
const MIMETYPES_CATALOGUE_OBJECT_SUMMARY_IMAGE = ['image/jpeg', 'image/jpg']; const MIMETYPES_CATALOGUE_OBJECT_SUMMARY_IMAGE = ['image/jpeg', 'image/jpg'];
const EXTENSIONS_THREE_D_ZIP = ['obj', 'mtl', 'jpg', 'jpeg', 'png'];
} }

View File

@ -17,6 +17,8 @@ final class MDSourceTypeSet extends MDValueSet {
'book', 'book',
'phdthesis', 'phdthesis',
'electronical', 'electronical',
'patent',
'unpublished',
'misc', 'misc',
]; ];

View File

@ -14,6 +14,63 @@ final class MDUnitsSet extends MDValueSet {
const UNITS_LENGTH = ['', 'm', 'dm', 'cm', 'mm']; const UNITS_LENGTH = ['', 'm', 'dm', 'cm', 'mm'];
const UNITS_WEIGHT = ['', 't', 'kg', 'g']; const UNITS_WEIGHT = ['', 't', 'kg', 'g'];
const UNITS_LENGTH_TO_MILLIMETER = [
'm' => 1000,
'dm' => 100,
'cm' => 10,
'mm' => 1,
];
const UNITS_WEIGHT_TO_GRAMM = [
't' => 1000000,
'kg' => 1000,
'g' => 1,
];
/**
* Converts a given length to millimeters.
*
* @param mixed $value Input value to convert.
* @param string $unit Length unit of the value to convert.
*
* @return float|null
*/
public static function convertLengthToMillimeter(mixed $value, string $unit):float|null {
if (!isset(self::UNITS_LENGTH_TO_MILLIMETER[$unit])) return null;
try {
$number = MD_STD_IN::sanitize_float($value);
return floatval($number * self::UNITS_LENGTH_TO_MILLIMETER[$unit]);
}
catch (MDgenericInvalidInputsException $e) {
return null;
}
}
/**
* Converts a given weight to gramm.
*
* @param mixed $value Input value to convert.
* @param string $unit Weight unit of the value to convert.
*
* @return float|null
*/
public static function convertWeightToGramm(mixed $value, string $unit):float|null {
if (!isset(self::UNITS_WEIGHT_TO_GRAMM[$unit])) return null;
try {
$number = MD_STD_IN::sanitize_float($value);
return floatval($number * self::UNITS_WEIGHT_TO_GRAMM[$unit]);
}
catch (MDgenericInvalidInputsException $e) {
return null;
}
}
/** /**
* Returns a translated list of length units. * Returns a translated list of length units.
* *