csvxml/public/index.php

88 lines
4.0 KiB
PHP
Raw Normal View History

2019-08-25 21:45:52 +02:00
<?PHP
2019-09-01 20:49:16 +02:00
/**
* New start page for CSVXML.
*
* @link https://groupit.museum-digital.de/csvxml/
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
require_once __DIR__ . "/../functions/functions.php";
2019-09-01 20:49:16 +02:00
2022-03-15 10:29:19 +01:00
$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl', 'pt'];
2022-11-07 00:31:57 +01:00
$lang = MD_STD::get_user_lang($allowed_langs, "en");
$tlLoader = new MDTlLoader("csxml_start_v2", $lang);
2019-09-01 20:49:16 +02:00
$outFormat = MD_STD_IN::get_http_input_text("output", "html", ['html', 'json']);
2022-11-07 00:31:57 +01:00
if ($outFormat === 'json') {
2019-09-01 20:49:16 +02:00
2022-11-07 00:31:57 +01:00
$fieldsGetter = new CsvxmlAvailableFields($lang);
$availableFields = $fieldsGetter->getFields();
header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-PINGOTHER, Content-Type, Accept-Encoding, cache-control");
header("Access-Control-Max-Age: 86400");
header('content-type: application/json');
echo json_encode($availableFields);
return;
}
2019-09-01 20:49:16 +02:00
echo '
2022-11-07 00:31:57 +01:00
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Validate import CSV files for museum-digital" />
<script src="assets/js/jszip/dist/jszip.min.js" type="text/javascript" async defer></script>
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.css" />
<meta name="theme-color" content="#aa4400" />
<link rel="shortcut icon" sizes="128x128" href="assets/img/mdlogo-csvxml.svg" />
<meta name="robots" content="noindex" />
<title>CSVXML :: museum-digital</title>
<meta name="keywords" content="Imports, museum-digital" />
</head>
<body class="loading" data-tls="' . htmlspecialchars(MD_STD::json_encode([
'remarks' => $tlLoader->tl('basis', 'basis', 'remarks'),
'download' => $tlLoader->tl('export', 'export', 'download'),
'upload' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'upload'),
'select_csv_file_for_upload' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'select_csv_file_for_upload'),
'currently_approved_tags' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'currently_approved_tags'),
'download_csv_all' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'download_csv_all'),
'download_csv_by_selection' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'download_csv_by_selection'),
'select_required_fields' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'select_required_fields'),
'select_all_fields' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'select_all_fields'),
'unset_selection' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'unset_selection'),
'file_format' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'file_format'),
'validation_errors' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'validation_errors'),
'errors_parsing' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_parsing'),
'errors_mandatoryTags' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_mandatoryTags'),
'errors_duplicateInvNos' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_duplicateInvNos'),
'errors_dependentColumns' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_dependentColumns'),
'errors_controlledLists' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_controlledLists'),
'errors_mainImageResource' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_mainImageResource'),
'allowed_values' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'allowed_values'),
])) . '">
<h1>
<img src="assets/img/mdlogo-csvxml.svg" alt="" />
<span>museum-digital:csvxml</span>
</h1>
<script src="assets/js/csvxmlV2.js" type="text/javascript" async></script>
2019-09-01 20:49:16 +02:00
</body>
2022-11-07 00:31:57 +01:00
</html>';