Added option to switch themes.

Added standalone pages for:
 - Exhibitions
 - Events
 - Institutions
 - Collections
Added option to limit display to only a given set of institutions.
This commit is contained in:
2018-06-18 10:43:22 +02:00
committed by Stefan Rohde-Enslin
parent 2ae4196546
commit bb8fa74cd6
18 changed files with 916 additions and 33 deletions

View File

@ -19,6 +19,14 @@ require_once __DIR__ . '/standardHTML.php';
*/
function ensureBackendEnv() {
// Ensure secure session cookies are used.
ini_set('session.cookie_secure', '1');
ini_set('session.cookie_httponly', '1');
ini_set('session.use_only_cookies', '1');
// Ensure session is started
if (session_status() != PHP_SESSION_ACTIVE) {
session_start();
}

View File

@ -29,28 +29,42 @@ document.addEventListener("DOMContentLoaded", function() {
let translations = {
"en" : {
"uploadFile" : "Upload file",
"submit" : "Submit",
"generate" : "Generate",
"embedCodeGenerator" : "Generator for embed code",
"helpEmbedCode" : "Here you can create embed code.",
"singleObjectTile" : "Single object (tile)",
"singleObjectDetails": "Single object (details)",
"singleCollection" : "Single collection",
"exhibitionCalendar" : "Exhibition calendar",
"eventCalendar" : "Event calendar",
"uploadFile" : "Upload file",
"submit" : "Submit",
"generate" : "Generate",
"embedCodeGenerator" : "Generator for embed code",
"helpEmbedCode" : "Here you can create embed code.",
"singleObjectTile" : "Single object (tile)",
"singleObjectDetails" : "Single object (details)",
"singleCollectionTile" : "Single collection (tile)",
"singleCollectionDetails" : "Single collection (details)",
"singleInstitutionTile" : "Single institution (tile)",
"singleInstitutionDetails" : "Single institution (details)",
"singleExhibitionTile" : "Single exhibition (tile)",
"singleExhibitionDetails" : "Single exhibition (details)",
"singleEventTile" : "Single event (tile)",
"singleEventDetails" : "Single event (details)",
"exhibitionCalendar" : "Exhibition calendar",
"eventCalendar" : "Event calendar",
},
"de" : {
"uploadFile" : "Eine Datei heraufladen",
"submit" : "Abschicken",
"generate" : "Generieren",
"embedCodeGenerator" : "Generator für Einbettungen",
"helpEmbedCode" : "Hier können sie den embed-code generieren.",
"singleObjectTile" : "Einzelobjekt (Kachel)",
"singleObjectDetails": "Einzelobjekt (Details)",
"singleCollection" : "Einzelsammlung",
"exhibitionCalendar" : "Ausstellungskalender",
"eventCalendar" : "Veranstaltungen (Kalender)",
"uploadFile" : "Eine Datei heraufladen",
"submit" : "Abschicken",
"generate" : "Generieren",
"embedCodeGenerator" : "Generator für Einbettungen",
"helpEmbedCode" : "Hier können sie den embed-code generieren.",
"singleObjectTile" : "Einzelobjekt (Kachel)",
"singleObjectDetails" : "Einzelobjekt (Details)",
"singleCollectionTile" : "Einzelsammlung (Kachel)",
"singleCollectionDetails" : "Einzelsammlung (Details)",
"singleInstitutionTile" : "Einzelinstitution (Kachel)",
"singleInstitutionDetails" : "Einzelinstitution (Details)",
"singleExhibitionTile" : "Einzelne Ausstellung (Kachel)",
"singleExhibitionDetails" : "Einzelne Ausstellung (Details)",
"singleEventTile" : "Einzelne Veranstaltung (Kachel)",
"singleEventDetails" : "Einzelne Veranstaltung (Details)",
"exhibitionCalendar" : "Ausstellungskalender",
"eventCalendar" : "Veranstaltungen (Kalender)",
}
};
@ -273,11 +287,18 @@ document.addEventListener("DOMContentLoaded", function() {
let generatorTypes = [
["", "", false],
["singleObjectTile", getTranslation(translations, "singleObjectTile"), true],
["singleObjectDetails", getTranslation(translations, "singleObjectDetails"), true],
["singleCollectionTile", getTranslation(translations, "singleCollection"), true],
["exhibitionCalendar", getTranslation(translations, "exhibitionCalendar"), true],
["eventCalendar", getTranslation(translations, "eventCalendar"), true],
["singleObjectTile", getTranslation(translations, "singleObjectTile"), true],
["singleObjectDetails", getTranslation(translations, "singleObjectDetails"), true],
["singleCollectionTile", getTranslation(translations, "singleCollectionTile"), true],
["singleCollectionDetails", getTranslation(translations, "singleCollectionDetails"), true],
["singleInstitutionTile", getTranslation(translations, "singleInstitutionTile"), true],
["singleInstitutionDetails", getTranslation(translations, "singleInstitutionDetails"), true],
["singleExhibitionTile", getTranslation(translations, "singleExhibitionTile"), true],
["singleExhibitionDetails", getTranslation(translations, "singleExhibitionDetails"), true],
["singleEventTile", getTranslation(translations, "singleEventTile"), true],
["singleEventDetails", getTranslation(translations, "singleEventDetails"), true],
["exhibitionCalendar", getTranslation(translations, "exhibitionCalendar"), true],
["eventCalendar", getTranslation(translations, "eventCalendar"), true],
];
// Add help tooltip

View File

@ -57,12 +57,13 @@ if (isset($task)) {
else if ($task == "delete") {
if (isset($id)) {
if (!isset($id)) {
echo printErrorPage($translations['specifyToDelete']); return;
}
unlink(__DIR__ . "/../data/static/$id.json");
generateStaticPgCaches();
header('Location: pages.php');
}
}

View File

@ -22,7 +22,7 @@ $pages = loadPages(); // Load overview of pages.
*/
// Check for vars.
loadHttpToGlobals(["task", "startPage", "pageTitle", "logo", "url", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "maxFileSize", "defaultLang"]);
loadHttpToGlobals(["task", "startPage", "pageTitle", "logo", "url", "css", "hideInstitution", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "limitToInstitutions", "maxFileSize", "defaultLang"]);
if (isset($task) and $task == "update") { // Adding new users.
@ -35,7 +35,8 @@ if (isset($task) and $task == "update") { // Adding new users.
if (isset($mdVersion)) $mdVersion = rtrim($mdVersion, "/") . "/";
if (isset($mdImgFolder)) $mdImgFolder = rtrim($mdImgFolder, "/") . "/";
foreach (["startPage", "pageTitle", "logo", "url", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "maxFileSize", "defaultLang"] as $var) {
if (isset($limitToInstitutions)) $settings['limitToInstitutions'] = array_diff(explode(',', $limitToInstitutions), ['']);
foreach (["startPage", "pageTitle", "logo", "url", "css", "hideInstitution", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "maxFileSize", "defaultLang"] as $var) {
if (isset($$var)) $settings[$var] = $$var;
}
@ -109,6 +110,32 @@ echo '
<td>' . generateHelpToolTip("helpURL", $translations['url'], $translations['helpURL']) . '</td>
</tr>
<!-- CSS -->
<tr>
<th><label for="settingsUsedCSS">' . $translations['settingsUsedCSS'] . '</label></th>
<td>
<select name="css" id="settingsUsedCSS">
';
foreach (scanDirConts(__DIR__ . "/../themes") as $cssOption) {
echo '<option value="' . $cssOption . '"';
if ($settings['css'] == $cssOption) echo ' selected';
echo '>' . $cssOption . '</option>';
}
echo '
</select>
</td>
<td>' . generateHelpToolTip("helpSettingsUsedCSS", $translations['settingsUsedCSS'], $translations['helpSettingsUsedCSS']) . '</td>
</tr>
<!-- Hiding attribution (if the page is for only one museum) or not -->
<tr>
<th><label for="hideInstitution">' . $translations['hideInstitution'] . '</label></th>
<td>
<input name="hideInstitution" id="hideInstitution" type="range" min="0" max="1" value="' . (string)$settings['hideInstitution'] . '" />
</td>
<td>' . generateHelpToolTip("helpHideInstitution", $translations['hideInstitution'], $translations['helpHideInstitution']) . '</td>
</tr>
<!-- MD Version -->
<tr>
<th><label for="mdVersion">' . $translations['mdVersion'] . '</label></th>
@ -130,6 +157,13 @@ echo '
<td>' . generateHelpToolTip("helpCacheRefreshInterval", $translations['cacheRefreshInterval'], $translations['helpCacheRefreshInterval']) . '</td>
</tr>
<!-- Restricting inputs to given institutions -->
<tr>
<th><label for="limitToInstitutions">' . $translations['limitToInstitutions'] . '</label></th>
<td><input type="text" id="limitToInstitutions" name="limitToInstitutions" placeholder="' . $translations['limitToInstitutions']. '" value="'.implode(',', $settings['limitToInstitutions']).'" /></td>
<td>' . generateHelpToolTip("helpLimitToInstitutions", $translations['limitToInstitutions'], $translations['helpLimitToInstitutions']) . '</td>
</tr>
<!-- Max Upload Size -->
<tr>
<th><label for="maxFileSize">' . $translations['maxFileSize'] . '</label></th>

View File

@ -109,6 +109,8 @@ table.obj_cha_maintable button:only-child,
table.obj_cha_maintable input:only-child { width: 100%; }
table.obj_cha_maintable textarea:only-child { width: 100%; height: 14em; }
table.obj_cha_maintable input[type="range"]:only-child { margin: .5em -1em 0 0; }
@media screen and (min-width:65em) {
table.obj_cha_maintable th { width: 16em; }
}

View File

@ -51,6 +51,13 @@ $translations = [
<li>Using a high value, means data could be slightly outdated, but makes loading much faster.</li>
</ul>
</p>",
"settingsUsedCSS" => "Theme",
"helpSettingsUsedCSS" => "<p>Select the used theme. New themes can be installed using FTP.</p>",
"hideInstitution" => "Hide institution",
"helpHideInstitution" => "<p>If this page is used for only a single museum, you can opt to not display the institution on tiles for exhibitions, collections, etc. by moving the slider to the right.</p>",
"limitToInstitutions" => "Limit to institutions",
"helpLimitToInstitutions" => "<p>The CMS offers the option to display objects, exhibitions, etc. from museum-digital based on their ID. By default all objects can be accessed using this functionality. To not display data that is not yours, you can restrict the data by the linked institution.</p>
<p>Enter IDs of institutions separated by commas.</p>",
"IDatMD" => "ID at museum-digital",
"embedFromMD" => "Embed from museum-digital",