{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/content\/edit.php",
"old_string": " \/\/ Critic card selection toggle\n document.querySelectorAll('.critic-card input[type=\"checkbox\"]').forEach(checkbox => {\n checkbox.addEventListener('change', function() {\n this.closest('.critic-card').classList.toggle('critic-card--selected', this.checked);\n });\n });\n});\n<\/script>",
"new_string": " \/\/ Critic card selection toggle\n document.querySelectorAll('.critic-card input[type=\"checkbox\"]').forEach(checkbox => {\n checkbox.addEventListener('change', function() {\n this.closest('.critic-card').classList.toggle('critic-card--selected', this.checked);\n });\n });\n\n \/\/ Inline Editor Functionality\n const editorConfig = {\n system_prompt: {\n editorId: 'systemPromptEditor',\n contentId: 'systemPromptContent',\n versionId: 'systemPromptVersion'\n },\n author_profile: {\n editorId: 'authorProfileEditor',\n contentId: 'authorProfileContent',\n versionId: 'authorProfileVersion'\n }\n };\n\n \/\/ Toggle inline editors\n document.querySelectorAll('.inline-edit-toggle').forEach(btn => {\n btn.addEventListener('click', async function() {\n const configType = this.dataset.configType;\n const selectId = this.dataset.selectId;\n const select = document.getElementById(selectId);\n const configId = select?.value;\n const config = editorConfig[configType];\n\n if (!config) return;\n\n const editor = document.getElementById(config.editorId);\n const textarea = document.getElementById(config.contentId);\n const versionSpan = document.getElementById(config.versionId);\n\n if (editor.classList.contains('inline-editor--hidden')) {\n if (!configId) {\n alert('Bitte zuerst ein Element auswählen.');\n return;\n }\n \/\/ Load content\n try {\n const resp = await fetch(`\/api\/v1\/config\/${configId}`);\n if (!resp.ok) throw new Error('Laden fehlgeschlagen');\n const data = await resp.json();\n textarea.value = data.content || '';\n versionSpan.textContent = data.version ? `v${data.version}` : '';\n editor.classList.remove('inline-editor--hidden');\n editor.dataset.configId = configId;\n } catch (e) {\n alert('Fehler beim Laden: ' + e.message);\n }\n } else {\n editor.classList.add('inline-editor--hidden');\n }\n });\n });\n\n \/\/ Save inline editors\n document.querySelectorAll('.inline-editor__save').forEach(btn => {\n btn.addEventListener('click', async function() {\n const configType = this.dataset.configType;\n const config = editorConfig[configType];\n if (!config) return;\n\n const editor = document.getElementById(config.editorId);\n const textarea = document.getElementById(config.contentId);\n const configId = editor.dataset.configId;\n\n if (!configId) return;\n\n try {\n const resp = await fetch(`\/api\/v1\/config\/${configId}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application\/json',\n 'X-CSRF-TOKEN': '<?= $csrfToken ?>'\n },\n body: JSON.stringify({ content: textarea.value })\n });\n if (!resp.ok) throw new Error('Speichern fehlgeschlagen');\n const data = await resp.json();\n if (data.version) {\n document.getElementById(config.versionId).textContent = `v${data.version}`;\n }\n editor.classList.add('inline-editor--hidden');\n alert('Gespeichert!');\n } catch (e) {\n alert('Fehler: ' + e.message);\n }\n });\n });\n});\n<\/script>"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/content\/edit.php",
"oldString": " \/\/ Critic card selection toggle\n document.querySelectorAll('.critic-card input[type=\"checkbox\"]').forEach(checkbox => {\n checkbox.addEventListener('change', function() {\n this.closest('.critic-card').classList.toggle('critic-card--selected', this.checked);\n });\n });\n});\n<\/script>",
"newString": " \/\/ Critic card selection toggle\n document.querySelectorAll('.critic-card input[type=\"checkbox\"]').forEach(checkbox => {\n checkbox.addEventListener('change', function() {\n this.closest('.critic-card').classList.toggle('critic-card--selected', this.checked);\n });\n });\n\n \/\/ Inline Editor Functionality\n const editorConfig = {\n system_prompt: {\n editorId: 'systemPromptEditor',\n contentId: 'systemPromptContent',\n versionId: 'systemPromptVersion'\n },\n author_profile: {\n editorId: 'authorProfileEditor',\n contentId: 'authorProfileContent',\n versionId: 'authorProfileVersion'\n }\n };\n\n \/\/ Toggle inline editors\n document.querySelectorAll('.inline-edit-toggle').forEach(btn => {\n btn.addEventListener('click', async function() {\n const configType = this.dataset.configType;\n const selectId = this.dataset.selectId;\n const select = document.getElementById(selectId);\n const configId = select?.value;\n const config = editorConfig[configType];\n\n if (!config) return;\n\n const editor = document.getElementById(config.editorId);\n const textarea = document.getElementById(config.contentId);\n const versionSpan = document.getElementById(config.versionId);\n\n if (editor.classList.contains('inline-editor--hidden')) {\n if (!configId) {\n alert('Bitte zuerst ein Element auswählen.');\n return;\n }\n \/\/ Load content\n try {\n const resp = await fetch(`\/api\/v1\/config\/${configId}`);\n if (!resp.ok) throw new Error('Laden fehlgeschlagen');\n const data = await resp.json();\n textarea.value = data.content || '';\n versionSpan.textContent = data.version ? `v${data.version}` : '';\n editor.classList.remove('inline-editor--hidden');\n editor.dataset.configId = configId;\n } catch (e) {\n alert('Fehler beim Laden: ' + e.message);\n }\n } else {\n editor.classList.add('inline-editor--hidden');\n }\n });\n });\n\n \/\/ Save inline editors\n document.querySelectorAll('.inline-editor__save').forEach(btn => {\n btn.addEventListener('click', async function() {\n const configType = this.dataset.configType;\n const config = editorConfig[configType];\n if (!config) return;\n\n const editor = document.getElementById(config.editorId);\n const textarea = document.getElementById(config.contentId);\n const configId = editor.dataset.configId;\n\n if (!configId) return;\n\n try {\n const resp = await fetch(`\/api\/v1\/config\/${configId}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application\/json',\n 'X-CSRF-TOKEN': '<?= $csrfToken ?>'\n },\n body: JSON.stringify({ content: textarea.value })\n });\n if (!resp.ok) throw new Error('Speichern fehlgeschlagen');\n const data = await resp.json();\n if (data.version) {\n document.getElementById(config.versionId).textContent = `v${data.version}`;\n }\n editor.classList.add('inline-editor--hidden');\n alert('Gespeichert!');\n } catch (e) {\n alert('Fehler: ' + e.message);\n }\n });\n });\n});\n<\/script>",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\n\/\/ @responsibility: Edit-Formular für Content-Aufträge mit HTMX-Submit\n\nob_start();\n$orderModel = $order['model'] ?? 'claude-sonnet-4-20250514';\n$orderCollections = json_decode($order['collections'] ?? '[\"documents\"]', true) ?: ['documents'];\n$orderContextLimit = (int) ($order['context_limit'] ?? 5);\n$orderTemperature = (float) ($order['temperature'] ?? 0.5);\n$orderMaxTokens = (int) ($order['max_tokens'] ?? 4096);\n$orderSystemPromptId = $order['system_prompt_id'] ?? null;\n$orderQualityCheck = (bool) ($order['quality_check'] ?? false);\n$orderSelectedCritics = json_decode($order['selected_critics'] ?? '[]', true) ?: [];\n?>\n\n<nav class=\"breadcrumb\">\n <a href=\"\/content\">Content Studio<\/a> » <a href=\"\/content\/<?= $order['id'] ?>\">Auftrag #<?= $order['id'] ?><\/a> » Bearbeiten\n<\/nav>\n\n<h1>Auftrag bearbeiten<\/h1>\n\n<form id=\"order-form\" class=\"form\" style=\"max-width: 700px;\"\n hx-put=\"\/api\/v1\/content\/<?= $order['id'] ?>\"\n hx-headers='{\"X-CSRF-TOKEN\": \"<?= $csrfToken ?>\"}'\n hx-target=\"#form-message\"\n hx-swap=\"innerHTML\"\n hx-indicator=\"#save-btn\"\n hx-disabled-elt=\"#save-btn\">\n\n <fieldset>\n <legend>Inhalt<\/legend>\n <div class=\"form-group\">\n <label for=\"title\">Titel *<\/label>\n <input type=\"text\" id=\"title\" name=\"title\" class=\"form-input\" required\n value=\"<?= htmlspecialchars($order['title']) ?>\">\n <\/div>\n <div class=\"form-group\">\n <label for=\"briefing\">Briefing *<\/label>\n <textarea id=\"briefing\" name=\"briefing\" class=\"form-textarea\" rows=\"6\" required><?= htmlspecialchars($order['briefing']) ?><\/textarea>\n <\/div>\n <\/fieldset>\n\n <fieldset>\n <legend>KI-Einstellungen<\/legend>\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"model\">Sprachmodell<\/label>\n <select id=\"model\" name=\"model\" class=\"form-select\">\n <?php foreach ($models ?? [] as $modelId => $modelName): ?>\n <option value=\"<?= $modelId ?>\" <?= $modelId === $orderModel ? 'selected' : '' ?>><?= htmlspecialchars($modelName) ?><\/option>\n <?php endforeach; ?>\n <\/select>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"context_limit\">Kontext-Quellen<\/label>\n <select id=\"context_limit\" name=\"context_limit\" class=\"form-select\">\n <option value=\"3\" <?= $orderContextLimit === 3 ? 'selected' : '' ?>>3 Quellen<\/option>\n <option value=\"5\" <?= $orderContextLimit === 5 ? 'selected' : '' ?>>5 Quellen<\/option>\n <option value=\"10\" <?= $orderContextLimit === 10 ? 'selected' : '' ?>>10 Quellen<\/option>\n <option value=\"15\" <?= $orderContextLimit === 15 ? 'selected' : '' ?>>15 Quellen<\/option>\n <\/select>\n <\/div>\n <\/div>\n <div class=\"form-group\">\n <label>Collections (Wissensquellen)<\/label>\n <?php\n $selected = $orderCollections;\n$variant = 'checkbox';\ninclude __DIR__ . '\/..\/partials\/form\/collections-select.php';\n?>\n <\/div>\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"temperature\">Temperatur: <span id=\"tempValue\"><?= number_format($orderTemperature, 1) ?><\/span><\/label>\n <input type=\"range\" id=\"temperature\" name=\"temperature\" class=\"form-slider\"\n min=\"0\" max=\"1\" step=\"0.1\" value=\"<?= $orderTemperature ?>\">\n <div class=\"preset-buttons\">\n <button type=\"button\" class=\"preset-btn<?= $orderTemperature == 0.3 ? ' preset-btn--active' : '' ?>\" data-temp=\"0.3\" data-tokens=\"2048\">Präzise<\/button>\n <button type=\"button\" class=\"preset-btn<?= $orderTemperature == 0.5 ? ' preset-btn--active' : '' ?>\" data-temp=\"0.5\" data-tokens=\"4096\">Ausgewogen<\/button>\n <button type=\"button\" class=\"preset-btn<?= $orderTemperature == 0.9 ? ' preset-btn--active' : '' ?>\" data-temp=\"0.9\" data-tokens=\"4096\">Kreativ<\/button>\n <\/div>\n <\/div>\n <div class=\"form-group form-group--half\">\n <label for=\"max_tokens\">Max Tokens<\/label>\n <select id=\"max_tokens\" name=\"max_tokens\" class=\"form-select\">\n <option value=\"1024\" <?= $orderMaxTokens === 1024 ? 'selected' : '' ?>>1024<\/option>\n <option value=\"2048\" <?= $orderMaxTokens === 2048 ? 'selected' : '' ?>>2048<\/option>\n <option value=\"4096\" <?= $orderMaxTokens === 4096 ? 'selected' : '' ?>>4096<\/option>\n <option value=\"8192\" <?= $orderMaxTokens === 8192 ? 'selected' : '' ?>>8192<\/option>\n <\/select>\n <\/div>\n <\/div>\n <div class=\"form-row\">\n <div class=\"form-group form-group--half\">\n <label for=\"system_prompt_id\">System Prompt<\/label>\n <div class=\"inline-edit-group\">\n <select id=\"system_prompt_id\" name=\"system_prompt_id\" class=\"form-select\">\n <option value=\"\">-- Standard --<\/option>\n <?php foreach ($systemPrompts ?? [] as $prompt): ?>\n <option value=\"<?= $prompt['id'] ?>\" <?= $orderSystemPromptId !== null && (int) $orderSystemPromptId === (int) $prompt['id'] ? 'selected' : '' ?>><?= htmlspecialchars($prompt['name']) ?><\/option>\n <?php endforeach; ?>\n <\/select>\n <button type=\"button\" class=\"inline-edit-toggle\" data-config-type=\"system_prompt\" data-select-id=\"system_prompt_id\" aria-label=\"Bearbeiten\">✎<\/button>\n <\/div>\n <div id=\"systemPromptEditor\" class=\"inline-editor inline-editor--hidden\">\n <textarea id=\"systemPromptContent\" class=\"inline-editor__textarea\" rows=\"6\" placeholder=\"Inhalt wird geladen...\"><\/textarea>\n <div class=\"inline-editor__footer\">\n <span class=\"inline-editor__version\" id=\"systemPromptVersion\"><\/span>\n <button type=\"button\" class=\"inline-editor__save\" data-config-type=\"system_prompt\">Speichern<\/button>\n <\/div>\n <\/div>\n <\/div>\n <div class=\"form-group form-group--half form-group--checkbox\">\n <label class=\"checkbox-toggle\">\n <input type=\"checkbox\" id=\"quality_check\" name=\"quality_check\" value=\"1\" <?= $orderQualityCheck ? 'checked' : '' ?>>\n <span class=\"checkbox-toggle__label\">Qualitätsprüfung (LLM-Validierung)<\/span>\n <\/label>\n <\/div>\n <\/div>\n <\/fieldset>\n\n <fieldset>\n <legend>Content-Konfiguration<\/legend>\n <div class=\"form-row\">\n <div class=\"form-group form-group--third\">\n <label for=\"author_profile_id\">Autorenprofil<\/label>\n <div class=\"inline-edit-group\">\n <select id=\"author_profile_id\" name=\"author_profile_id\" class=\"form-select\">\n <option value=\"\">-- Kein Profil --<\/option>\n <?php foreach ($profiles ?? [] as $profile): ?>\n <option value=\"<?= $profile['id'] ?>\" <?= ($order['author_profile_id'] ?? '') == $profile['id'] ? 'selected' : '' ?>><?= htmlspecialchars($profile['name']) ?><\/option>\n <?php endforeach; ?>\n <\/select>\n <button type=\"button\" class=\"inline-edit-toggle\" data-config-type=\"author_profile\" data-select-id=\"author_profile_id\" aria-label=\"Bearbeiten\">✎<\/button>\n <\/div>\n <div id=\"authorProfileEditor\" class=\"inline-editor inline-editor--hidden\">\n <textarea id=\"authorProfileContent\" class=\"inline-editor__textarea\" rows=\"6\" placeholder=\"Inhalt wird geladen...\"><\/textarea>\n <div class=\"inline-editor__footer\">\n <span class=\"inline-editor__version\" id=\"authorProfileVersion\"><\/span>\n <button type=\"button\" class=\"inline-editor__save\" data-config-type=\"author_profile\">Speichern<\/button>\n <\/div>\n <\/div>\n <\/div>\n <div class=\"form-group form-group--third\">\n <label for=\"contract_id\">Contract<\/label>\n <select id=\"contract_id\" name=\"contract_id\" class=\"form-select\">\n <option value=\"\">-- Kein Contract --<\/option>\n <?php foreach ($contracts ?? [] as $contract): ?>\n <option value=\"<?= $contract['id'] ?>\" <?= ($order['contract_id'] ?? '') == $contract['id'] ? 'selected' : '' ?>><?= htmlspecialchars($contract['name']) ?><\/option>\n <?php endforeach; ?>\n <\/select>\n <\/div>\n <div class=\"form-group form-group--third\">\n <label for=\"structure_id\">Struktur<\/label>\n <select id=\"structure_id\" name=\"structure_id\" class=\"form-select\">\n <option value=\"\">-- Keine Struktur --<\/option>\n <?php foreach ($structures ?? [] as $structure): ?>\n <option value=\"<?= $structure['id'] ?>\" <?= ($order['structure_id'] ?? '') == $structure['id'] ? 'selected' : '' ?>><?= htmlspecialchars($structure['name']) ?><\/option>\n <?php endforeach; ?>\n <\/select>\n <\/div>\n <\/div>\n <\/fieldset>\n\n <?php if (!empty($critics)): ?>\n <fieldset>\n <legend>Kritiker <span class=\"legend-hint\">(für Qualitätsprüfung)<\/span><\/legend>\n <p class=\"fieldset-info\">Wähle die Kritiker, die den generierten Content prüfen sollen. <a href=\"\/config?type=critic\" class=\"link-muted\">Kritiker verwalten →<\/a><\/p>\n <div ... [TRUNCATED-406f6133fee71ccf]",
"structuredPatch": [
{
"oldStart": 293,
"oldLines": 6,
"newStart": 293,
"newLines": 93,
"lines": [
" this.closest('.critic-card').classList.toggle('critic-card--selected', this.checked);",
" });",
" });",
"+",
"+ \/\/ Inline Editor Functionality",
"+ const editorConfig = {",
"+ system_prompt: {",
"+ editorId: 'systemPromptEditor',",
"+ contentId: 'systemPromptContent',",
"+ versionId: 'systemPromptVersion'",
"+ },",
"+ author_profile: {",
"+ editorId: 'authorProfileEditor',",
"+ contentId: 'authorProfileContent',",
"+ versionId: 'authorProfileVersion'",
"+ }",
"+ };",
"+",
"+ \/\/ Toggle inline editors",
"+ document.querySelectorAll('.inline-edit-toggle').forEach(btn => {",
"+ btn.addEventListener('click', async function() {",
"+ const configType = this.dataset.configType;",
"+ const selectId = this.dataset.selectId;",
"+ const select = document.getElementById(selectId);",
"+ const configId = select?.value;",
"+ const config = editorConfig[configType];",
"+",
"+ if (!config) return;",
"+",
"+ const editor = document.getElementById(config.editorId);",
"+ const textarea = document.getElementById(config.contentId);",
"+ const versionSpan = document.getElementById(config.versionId);",
"+",
"+ if (editor.classList.contains('inline-editor--hidden')) {",
"+ if (!configId) {",
"+ alert('Bitte zuerst ein Element auswählen.');",
"+ return;",
"+ }",
"+ \/\/ Load content",
"+ try {",
"+ const resp = await fetch(`\/api\/v1\/config\/${configId}`);",
"+ if (!resp.ok) throw new Error('Laden fehlgeschlagen');",
"+ const data = await resp.json();",
"+ textarea.value = data.content || '';",
"+ versionSpan.textContent = data.version ? `v${data.version}` : '';",
"+ editor.classList.remove('inline-editor--hidden');",
"+ editor.dataset.configId = configId;",
"+ } catch (e) {",
"+ alert('Fehler beim Laden: ' + e.message);",
"+ }",
"+ } else {",
"+ editor.classList.add('inline-editor--hidden');",
"+ }",
"+ });",
"+ });",
"+",
"+ \/\/ Save inline editors",
"+ document.querySelectorAll('.inline-editor__save').forEach(btn => {",
"+ btn.addEventListener('click', async function() {",
"+ const configType = this.dataset.configType;",
"+ const config = editorConfig[configType];",
"+ if (!config) return;",
"+",
"+ const editor = document.getElementById(config.editorId);",
"+ const textarea = document.getElementById(config.contentId);",
"+ const configId = editor.dataset.configId;",
"+",
"+ if (!configId) return;",
"+",
"+ try {",
"+ const resp = await fetch(`\/api\/v1\/config\/${configId}`, {",
"+ method: 'POST',",
"+ headers: {",
"+ 'Content-Type': 'application\/json',",
"+ 'X-CSRF-TOKEN': '<?= $csrfToken ?>'",
"+ },",
"+ body: JSON.stringify({ content: textarea.value })",
"+ });",
"+ if (!resp.ok) throw new Error('Speichern fehlgeschlagen');",
"+ const data = await resp.json();",
"+ if (data.version) {",
"+ document.getElementById(config.versionId).textContent = `v${data.version}`;",
"+ }",
"+ editor.classList.add('inline-editor--hidden');",
"+ alert('Gespeichert!');",
"+ } catch (e) {",
"+ alert('Fehler: ' + e.message);",
"+ }",
"+ });",
"+ });",
" });",
" <\/script>",
" "
]
}
],
"userModified": false,
"replaceAll": false
}
}