First full working version
This commit is contained in:
43
compile.php
43
compile.php
@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/**
|
||||
* Compiles the static parts of the quality assessment web interface.
|
||||
* Compiles the static parts of the concordance checker web interface.
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
@ -21,9 +21,22 @@ function generateTranslationFile(string $lang):string {
|
||||
|
||||
$tlLoader = new MDTlLoader("mdConc", $lang);
|
||||
|
||||
return MD_STD::json_encode([
|
||||
$output = [
|
||||
'concordance_checker' => $tlLoader->tl('concordance', 'concordance', 'concordance_checker'),
|
||||
]);
|
||||
'intro' => $tlLoader->tl('concordance', 'concordance', 'intro'),
|
||||
'one_line_per_entry' => $tlLoader->tl('concordance', 'concordance', 'one_line_per_entry'),
|
||||
'submit' => $tlLoader->tl('concordance', 'concordance', 'submit'),
|
||||
'passed' => $tlLoader->tl('concordance', 'concordance', 'passed'),
|
||||
'not_yet_matched' => $tlLoader->tl('concordance', 'concordance', 'not_yet_matched'),
|
||||
'input' => $tlLoader->tl('concordance', 'concordance', 'input'),
|
||||
'generate_code_snippet' => $tlLoader->tl('concordance', 'concordance', 'generate_code_snippet'),
|
||||
];
|
||||
|
||||
foreach (ConcordanceChecker::getLists() as $list) {
|
||||
$output[$list] = $tlLoader->tl('concordance', 'concordance', $list);
|
||||
}
|
||||
|
||||
return MD_STD::json_encode($output);
|
||||
|
||||
}
|
||||
|
||||
@ -39,7 +52,11 @@ function generateTranslationFilesForMatchOptions(string $lang):array {
|
||||
$tlLoader = new MDTlLoader("mdConc", $lang);
|
||||
$output = [];
|
||||
foreach (ConcordanceChecker::getLists() as $list) {
|
||||
$output[$list] = MD_STD::json_encode((new ConcordanceChecker($list))->getMatchOptions($lang));
|
||||
$options = [];
|
||||
foreach ((new ConcordanceChecker($list))->getMatchOptions($lang) as $value) {
|
||||
$options[(string)$value['id']] = $value['name'];
|
||||
}
|
||||
$output[$list] = MD_STD::json_encode($options);
|
||||
}
|
||||
|
||||
return $output;
|
||||
@ -54,7 +71,10 @@ function generateTranslationFilesForMatchOptions(string $lang):array {
|
||||
function generateAppShell():string {
|
||||
|
||||
return '<!DOCTYPE HTML>
|
||||
<html data-allowed-langs="' . htmlspecialchars(implode(',', ALLOWED_LANGS)) . '">
|
||||
<html
|
||||
data-allowed-langs="' . htmlspecialchars(implode(',', ALLOWED_LANGS)) . '"
|
||||
data-lists="' . htmlspecialchars(implode(',', ConcordanceChecker::getLists())) . '"
|
||||
>
|
||||
<head>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
@ -63,14 +83,14 @@ function generateAppShell():string {
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<meta name="theme-color" content="#aa4400" />
|
||||
|
||||
<title>Quality assessment :: museum-digital</title>
|
||||
<meta name="twitter:title" content="Quality assessment :: museum-digital" />
|
||||
<meta property="og:title" content="Quality assessment :: museum-digital" />
|
||||
<title>Concordance checker :: museum-digital</title>
|
||||
<meta name="twitter:title" content="Concordance checker :: museum-digital" />
|
||||
<meta property="og:title" content="Concordance checker :: museum-digital" />
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:site" content="@museumdigital" />
|
||||
|
||||
<meta name="description" content="Use museum-digital\'s quality assessment tools for your own data" />
|
||||
<meta name="description" content="Use museum-digital\'s concordance list checker to prepare imports" />
|
||||
<meta name="author" content="Joshua Ramon Enslin" />
|
||||
<meta name="dc.creator" content="Joshua Ramon Enslin" />
|
||||
|
||||
@ -82,8 +102,9 @@ function generateAppShell():string {
|
||||
<meta property="og:image" content="/static/img/mdlogo-code.svg" />
|
||||
|
||||
</head>
|
||||
<body class="loading" data-lists="' . htmlspecialchars(json_encode(ConcordanceChecker::getLists())) . '">
|
||||
<body class="loading">
|
||||
|
||||
<!-- <script src="/static/js/qa.js?' . uniqid() . '" type="text/javascript" async></script> -->
|
||||
<script src="/static/js/qa.min.js?' . uniqid() . '" type="text/javascript" async></script>
|
||||
|
||||
</body>
|
||||
@ -91,7 +112,7 @@ function generateAppShell():string {
|
||||
|
||||
}
|
||||
|
||||
const ALLOWED_LANGS = ['de', 'en', 'uk'];
|
||||
const ALLOWED_LANGS = ['de', 'en'];
|
||||
const SERVED_ROOT = __DIR__ . '/public/';
|
||||
const SERVED_JSON_ROOT = __DIR__ . '/public/static/json/';
|
||||
|
||||
|
Reference in New Issue
Block a user