{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/config\/form.php",
"content": "<?php ob_start(); ?>\n\n<h1><?= $isEdit ? 'Bearbeiten: ' . htmlspecialchars($config['name']) : 'Neue Konfiguration' ?><\/h1>\n\n<?php if (isset($_SESSION['error'])): ?>\n<div class=\"alert alert--error\"><?= htmlspecialchars($_SESSION['error']) ?><\/div>\n<?php unset($_SESSION['error']); endif; ?>\n\n<form method=\"post\" action=\"<?= $isEdit ? '\/config\/' . $config['id'] : '\/config' ?>\" class=\"form\">\n <?= $csrfField ?>\n\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"type\">Typ *<\/label>\n <select name=\"type\" id=\"type\" class=\"form-select\" <?= $isEdit ? 'disabled' : 'required' ?>>\n <option value=\"\">-- Typ wählen --<\/option>\n <?php foreach ($types as $type): ?>\n <option value=\"<?= $type ?>\" <?= ($config['type'] ?? '') === $type ? 'selected' : '' ?>><?= $typeLabels[$type] ?? $type ?><\/option>\n <?php endforeach; ?>\n <\/select>\n <?php if ($isEdit): ?>\n <input type=\"hidden\" name=\"type\" value=\"<?= $config['type'] ?>\">\n <?php endif; ?>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"status\">Status<\/label>\n <select name=\"status\" id=\"status\" class=\"form-select\">\n <option value=\"draft\" <?= ($config['status'] ?? 'draft') === 'draft' ? 'selected' : '' ?>>Entwurf<\/option>\n <option value=\"active\" <?= ($config['status'] ?? '') === 'active' ? 'selected' : '' ?>>Aktiv<\/option>\n <option value=\"deprecated\" <?= ($config['status'] ?? '') === 'deprecated' ? 'selected' : '' ?>>Deprecated<\/option>\n <\/select>\n <\/div>\n <\/div>\n\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"name\">Name *<\/label>\n <input type=\"text\" name=\"name\" id=\"name\" class=\"form-input\" value=\"<?= htmlspecialchars($config['name'] ?? '') ?>\" required>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"slug\">Slug *<\/label>\n <input type=\"text\" name=\"slug\" id=\"slug\" class=\"form-input\" value=\"<?= htmlspecialchars($config['slug'] ?? '') ?>\" required pattern=\"[a-z0-9-]+\">\n <small>Nur Kleinbuchstaben, Zahlen und Bindestriche<\/small>\n <\/div>\n <\/div>\n\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"version\"><?= $isEdit ? 'Neue Version *' : 'Version' ?><\/label>\n <input type=\"text\" name=\"<?= $isEdit ? 'new_version' : 'version' ?>\" id=\"version\" class=\"form-input\"\n value=\"<?= $isEdit ? '' : htmlspecialchars($config['version'] ?? '1.0') ?>\"\n placeholder=\"<?= $isEdit ? 'z.B. ' . $this->incrementVersion($config['version'] ?? '1.0') : '1.0' ?>\"\n <?= $isEdit ? 'required' : '' ?>>\n <?php if ($isEdit): ?>\n <small>Aktuelle Version: <?= htmlspecialchars($config['version']) ?><\/small>\n <?php endif; ?>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"parent_id\">Parent (optional)<\/label>\n <select name=\"parent_id\" id=\"parent_id\" class=\"form-select\">\n <option value=\"\">-- Kein Parent --<\/option>\n <?php foreach ($parents as $parent): ?>\n <option value=\"<?= $parent['id'] ?>\" <?= ($config['parent_id'] ?? '') == $parent['id'] ? 'selected' : '' ?>>\n [<?= $typeLabels[$parent['type']] ?? $parent['type'] ?>] <?= htmlspecialchars($parent['name']) ?>\n <\/option>\n <?php endforeach; ?>\n <\/select>\n <small>Nur für Rules: Verknüpfung zu Contract\/Organization<\/small>\n <\/div>\n <\/div>\n\n <div class=\"form-group\">\n <label for=\"description\">Beschreibung<\/label>\n <textarea name=\"description\" id=\"description\" class=\"form-textarea\" rows=\"2\"><?= htmlspecialchars($config['description'] ?? '') ?><\/textarea>\n <\/div>\n\n <?php if ($isEdit): ?>\n <div class=\"form-group\">\n <label for=\"change_description\">Änderungsbeschreibung<\/label>\n <input type=\"text\" name=\"change_description\" id=\"change_description\" class=\"form-input\" placeholder=\"Was wurde geändert?\">\n <\/div>\n <?php endif; ?>\n\n <div class=\"form-group\">\n <label for=\"content\">Content (JSON) *<\/label>\n <textarea name=\"content\" id=\"content\" class=\"form-textarea form-textarea--code\" rows=\"15\" required><?= htmlspecialchars($config['content'] ?? '{}') ?><\/textarea>\n <small>\n <button type=\"button\" class=\"btn btn--small btn--secondary\" onclick=\"formatJson()\">JSON formatieren<\/button>\n <button type=\"button\" class=\"btn btn--small btn--secondary\" onclick=\"validateJson()\">JSON prüfen<\/button>\n <span id=\"json-status\"><\/span>\n <\/small>\n <\/div>\n\n <div class=\"form-actions\">\n <button type=\"submit\" class=\"btn btn--primary\"><?= $isEdit ? 'Speichern' : 'Erstellen' ?><\/button>\n <a href=\"<?= $isEdit ? '\/config\/' . $config['id'] : '\/config' ?>\" class=\"btn btn--secondary\">Abbrechen<\/a>\n <\/div>\n<\/form>\n\n<?php if ($isEdit): ?>\n<hr>\n<h3>Gefahrenzone<\/h3>\n<form method=\"post\" action=\"\/config\/<?= $config['id'] ?>\/delete\" class=\"form-inline\" onsubmit=\"return confirm('Wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.')\">\n <?= $csrfField ?>\n <button type=\"submit\" class=\"btn btn--danger\">Konfiguration löschen<\/button>\n<\/form>\n<?php endif; ?>\n\n<script>\n\/\/ Auto-generate slug from name\ndocument.getElementById('name')?.addEventListener('input', function() {\n const slugField = document.getElementById('slug');\n if (slugField && !slugField.dataset.manual) {\n slugField.value = this.value\n .toLowerCase()\n .replace(\/[äöüß]\/g, m => ({ä:'ae',ö:'oe',ü:'ue',ß:'ss'}[m]))\n .replace(\/[^a-z0-9]+\/g, '-')\n .replace(\/^-|-$\/g, '');\n }\n});\n\ndocument.getElementById('slug')?.addEventListener('input', function() {\n this.dataset.manual = 'true';\n});\n\nfunction formatJson() {\n const textarea = document.getElementById('content');\n try {\n const obj = JSON.parse(textarea.value);\n textarea.value = JSON.stringify(obj, null, 2);\n document.getElementById('json-status').innerHTML = '<span style=\"color:green\">Formatiert<\/span>';\n } catch (e) {\n document.getElementById('json-status').innerHTML = '<span style=\"color:red\">Ungültiges JSON: ' + e.message + '<\/span>';\n }\n}\n\nfunction validateJson() {\n const textarea = document.getElementById('content');\n try {\n JSON.parse(textarea.value);\n document.getElementById('json-status').innerHTML = '<span style=\"color:green\">Gültiges JSON<\/span>';\n } catch (e) {\n document.getElementById('json-status').innerHTML = '<span style=\"color:red\">Ungültiges JSON: ' + e.message + '<\/span>';\n }\n}\n\n\/\/ Initial validation\nvalidateJson();\n<\/script>\n\n<style>\n.form-textarea--code {\n font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;\n font-size: 13px;\n line-height: 1.5;\n tab-size: 2;\n}\n<\/style>\n\n<?php $content = ob_get_clean(); ?>\n<?php require VIEW_PATH . '\/layout.php'; ?>\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/config\/form.php",
"content": "<?php ob_start(); ?>\n\n<h1><?= $isEdit ? 'Bearbeiten: ' . htmlspecialchars($config['name']) : 'Neue Konfiguration' ?><\/h1>\n\n<?php if (isset($_SESSION['error'])): ?>\n<div class=\"alert alert--error\"><?= htmlspecialchars($_SESSION['error']) ?><\/div>\n<?php unset($_SESSION['error']); endif; ?>\n\n<form method=\"post\" action=\"<?= $isEdit ? '\/config\/' . $config['id'] : '\/config' ?>\" class=\"form\">\n <?= $csrfField ?>\n\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"type\">Typ *<\/label>\n <select name=\"type\" id=\"type\" class=\"form-select\" <?= $isEdit ? 'disabled' : 'required' ?>>\n <option value=\"\">-- Typ wählen --<\/option>\n <?php foreach ($types as $type): ?>\n <option value=\"<?= $type ?>\" <?= ($config['type'] ?? '') === $type ? 'selected' : '' ?>><?= $typeLabels[$type] ?? $type ?><\/option>\n <?php endforeach; ?>\n <\/select>\n <?php if ($isEdit): ?>\n <input type=\"hidden\" name=\"type\" value=\"<?= $config['type'] ?>\">\n <?php endif; ?>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"status\">Status<\/label>\n <select name=\"status\" id=\"status\" class=\"form-select\">\n <option value=\"draft\" <?= ($config['status'] ?? 'draft') === 'draft' ? 'selected' : '' ?>>Entwurf<\/option>\n <option value=\"active\" <?= ($config['status'] ?? '') === 'active' ? 'selected' : '' ?>>Aktiv<\/option>\n <option value=\"deprecated\" <?= ($config['status'] ?? '') === 'deprecated' ? 'selected' : '' ?>>Deprecated<\/option>\n <\/select>\n <\/div>\n <\/div>\n\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"name\">Name *<\/label>\n <input type=\"text\" name=\"name\" id=\"name\" class=\"form-input\" value=\"<?= htmlspecialchars($config['name'] ?? '') ?>\" required>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"slug\">Slug *<\/label>\n <input type=\"text\" name=\"slug\" id=\"slug\" class=\"form-input\" value=\"<?= htmlspecialchars($config['slug'] ?? '') ?>\" required pattern=\"[a-z0-9-]+\">\n <small>Nur Kleinbuchstaben, Zahlen und Bindestriche<\/small>\n <\/div>\n <\/div>\n\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"version\"><?= $isEdit ? 'Neue Version *' : 'Version' ?><\/label>\n <input type=\"text\" name=\"<?= $isEdit ? 'new_version' : 'version' ?>\" id=\"version\" class=\"form-input\"\n value=\"<?= $isEdit ? '' : htmlspecialchars($config['version'] ?? '1.0') ?>\"\n placeholder=\"<?= $isEdit ? 'z.B. ' . $this->incrementVersion($config['version'] ?? '1.0') : '1.0' ?>\"\n <?= $isEdit ? 'required' : '' ?>>\n <?php if ($isEdit): ?>\n <small>Aktuelle Version: <?= htmlspecialchars($config['version']) ?><\/small>\n <?php endif; ?>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"parent_id\">Parent (optional)<\/label>\n <select name=\"parent_id\" id=\"parent_id\" class=\"form-select\">\n <option value=\"\">-- Kein Parent --<\/option>\n <?php foreach ($parents as $parent): ?>\n <option value=\"<?= $parent['id'] ?>\" <?= ($config['parent_id'] ?? '') == $parent['id'] ? 'selected' : '' ?>>\n [<?= $typeLabels[$parent['type']] ?? $parent['type'] ?>] <?= htmlspecialchars($parent['name']) ?>\n <\/option>\n <?php endforeach; ?>\n <\/select>\n <small>Nur für Rules: Verknüpfung zu Contract\/Organization<\/small>\n <\/div>\n <\/div>\n\n <div class=\"form-group\">\n <label for=\"description\">Beschreibung<\/label>\n <textarea name=\"description\" id=\"description\" class=\"form-textarea\" rows=\"2\"><?= htmlspecialchars($config['description'] ?? '') ?><\/textarea>\n <\/div>\n\n <?php if ($isEdit): ?>\n <div class=\"form-group\">\n <label for=\"change_description\">Änderungsbeschreibung<\/label>\n <input type=\"text\" name=\"change_description\" id=\"change_description\" class=\"form-input\" placeholder=\"Was wurde geändert?\">\n <\/div>\n <?php endif; ?>\n\n <div class=\"form-group\">\n <label for=\"content\">Content (JSON) *<\/label>\n <textarea name=\"content\" id=\"content\" class=\"form-textarea form-textarea--code\" rows=\"15\" required><?= htmlspecialchars($config['content'] ?? '{}') ?><\/textarea>\n <small>\n <button type=\"button\" class=\"btn btn--small btn--secondary\" onclick=\"formatJson()\">JSON formatieren<\/button>\n <button type=\"button\" class=\"btn btn--small btn--secondary\" onclick=\"validateJson()\">JSON prüfen<\/button>\n <span id=\"json-status\"><\/span>\n <\/small>\n <\/div>\n\n <div class=\"form-actions\">\n <button type=\"submit\" class=\"btn btn--primary\"><?= $isEdit ? 'Speichern' : 'Erstellen' ?><\/button>\n <a href=\"<?= $isEdit ? '\/config\/' . $config['id'] : '\/config' ?>\" class=\"btn btn--secondary\">Abbrechen<\/a>\n <\/div>\n<\/form>\n\n<?php if ($isEdit): ?>\n<hr>\n<h3>Gefahrenzone<\/h3>\n<form method=\"post\" action=\"\/config\/<?= $config['id'] ?>\/delete\" class=\"form-inline\" onsubmit=\"return confirm('Wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.')\">\n <?= $csrfField ?>\n <button type=\"submit\" class=\"btn btn--danger\">Konfiguration löschen<\/button>\n<\/form>\n<?php endif; ?>\n\n<script>\n\/\/ Auto-generate slug from name\ndocument.getElementById('name')?.addEventListener('input', function() {\n const slugField = document.getElementById('slug');\n if (slugField && !slugField.dataset.manual) {\n slugField.value = this.value\n .toLowerCase()\n .replace(\/[äöüß]\/g, m => ({ä:'ae',ö:'oe',ü:'ue',ß:'ss'}[m]))\n .replace(\/[^a-z0-9]+\/g, '-')\n .replace(\/^-|-$\/g, '');\n }\n});\n\ndocument.getElementById('slug')?.addEventListener('input', function() {\n this.dataset.manual = 'true';\n});\n\nfunction formatJson() {\n const textarea = document.getElementById('content');\n try {\n const obj = JSON.parse(textarea.value);\n textarea.value = JSON.stringify(obj, null, 2);\n document.getElementById('json-status').innerHTML = '<span style=\"color:green\">Formatiert<\/span>';\n } catch (e) {\n document.getElementById('json-status').innerHTML = '<span style=\"color:red\">Ungültiges JSON: ' + e.message + '<\/span>';\n }\n}\n\nfunction validateJson() {\n const textarea = document.getElementById('content');\n try {\n JSON.parse(textarea.value);\n document.getElementById('json-status').innerHTML = '<span style=\"color:green\">Gültiges JSON<\/span>';\n } catch (e) {\n document.getElementById('json-status').innerHTML = '<span style=\"color:red\">Ungültiges JSON: ' + e.message + '<\/span>';\n }\n}\n\n\/\/ Initial validation\nvalidateJson();\n<\/script>\n\n<style>\n.form-textarea--code {\n font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;\n font-size: 13px;\n line-height: 1.5;\n tab-size: 2;\n}\n<\/style>\n\n<?php $content = ob_get_clean(); ?>\n<?php require VIEW_PATH . '\/layout.php'; ?>\n",
"structuredPatch": [],
"originalFile": null
}
}