- Map links (/map.php?karte=…&x=…&y=…&zoom=…&ort=…) open the region at that spot with a pin
- "Share location" button on the map: click a spot, optional name, copy the link
- Calendar entries: "Pick location on the map" opens the map in a window, "Use this location" stores the meeting point
- Map links in comments, captions and descriptions render as "📍 Region – Location" and do not count as external links for moderation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
49 lines
2.3 KiB
PHP
49 lines
2.3 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/bootstrap.php';
|
|
require_once __DIR__ . '/includes/tactics.php';
|
|
require_permission('map.view');
|
|
|
|
// Bestehende Installationen kennen die Taktik-Tabellen noch nicht. Die Karte selbst
|
|
// funktioniert trotzdem, nur die Taktiken brauchen die Datenbank.
|
|
try {
|
|
$missingTables = tactics_missing_tables();
|
|
} catch (Throwable $e) {
|
|
$missingTables = TACTIC_TABLES;
|
|
}
|
|
|
|
// Die Karte ist ein eigenstaendiger Viewer (assets/map/) mit eigenem Stylesheet, das
|
|
// global auf body/button/* greift. Im iframe bleibt er vom Seitenlayout getrennt.
|
|
// Die Taktiken laedt und speichert er selbst ueber tactics_api.php.
|
|
// Geteilter Ort (/map.php?karte=verteron&x=1234&y=2345&zoom=5&ort=Treffpunkt): an den Viewer weiterreichen.
|
|
$linkParams = array_filter([
|
|
'karte' => preg_match('/^[a-z0-9-]{1,40}$/', (string) ($_GET['karte'] ?? '')) ? (string) $_GET['karte'] : '',
|
|
'x' => is_numeric($_GET['x'] ?? null) ? (string) (int) $_GET['x'] : '',
|
|
'y' => is_numeric($_GET['y'] ?? null) ? (string) (int) $_GET['y'] : '',
|
|
'zoom' => is_numeric($_GET['zoom'] ?? null) ? (string) (int) $_GET['zoom'] : '',
|
|
'ort' => mb_substr(trim((string) ($_GET['ort'] ?? '')), 0, 60),
|
|
], static fn (string $v): bool => $v !== '');
|
|
$frameSrc = '/assets/map/index.html' . ($linkParams ? '?' . http_build_query($linkParams) : '');
|
|
|
|
$pageTitle = 'Karte';
|
|
$containerWide = true;
|
|
include __DIR__ . '/includes/header.php';
|
|
?>
|
|
<?php if (!empty($missingTables)): ?>
|
|
<div class="panel map-setup">
|
|
<p>
|
|
<strong>Taktiken einrichten:</strong>
|
|
<span class="text-muted">Der Datenbank fehlen noch die Tabellen für Taktiken
|
|
(<?= e(implode(', ', $missingTables)) ?>). Die Karte funktioniert auch ohne sie.</span>
|
|
</p>
|
|
<?php if (user_has_permission('roles.manage')): ?>
|
|
<form method="post" action="/tactics_install_action.php">
|
|
<?= csrf_field() ?>
|
|
<button type="submit">Tabellen jetzt anlegen</button>
|
|
</form>
|
|
<?php else: ?>
|
|
<p class="text-muted">Dafür fehlt dir die Berechtigung <code>roles.manage</code> - bitte einen Administrator.</p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<iframe class="map-frame" src="<?= e($frameSrc) ?>" title="Interaktive Karte"></iframe>
|
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|