Upload via GUI (396 Dateien)
This commit is contained in:
@@ -2,10 +2,19 @@
|
||||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||||
require_once __DIR__ . '/../includes/ticket_extras.php'; // falls bootstrap.php noch die alte Version ist
|
||||
require_once __DIR__ . '/../includes/imap_spam.php';
|
||||
require_once __DIR__ . '/../includes/mail_reload.php';
|
||||
$staff = require_staff_login();
|
||||
$pdo = get_db();
|
||||
$myDeptIds = staff_department_ids($staff); // null = Admin, alle Abteilungen
|
||||
|
||||
// Bilder von fremden Webseiten in E-Mails: Standard ist "nicht laden" (Datenschutz). Auf Wunsch (Knopf über der Nachricht) lädt nur
|
||||
// dieser eine Seitenaufruf sie; dazu wird die Sicherheitsrichtlinie der Seite für diesen Aufruf erweitert und kein Verweis mitgeschickt.
|
||||
$loadRemoteImages = ($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'GET' && ($_GET['remote_images'] ?? '') === '1';
|
||||
if ($loadRemoteImages) {
|
||||
header("Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self';");
|
||||
header('Referrer-Policy: no-referrer');
|
||||
}
|
||||
|
||||
$number = $_GET['n'] ?? '';
|
||||
$stmt = $pdo->prepare(
|
||||
'SELECT t.*, p.name AS priority_name, p.color AS priority_color, d.name AS department_name,
|
||||
@@ -77,6 +86,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
}
|
||||
$lockedByOther = null; // wird ab jetzt nicht mehr gebraucht (kein Banner-Modus mehr)
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') ticket_ack($pdo, (int) $ticket['id'], (int) $staff['id']); // gesehen: verschwindet aus dem Zähler der Apps
|
||||
|
||||
// Für den "Zeiterfassung läuft"-Hinweis in der Titelzeile
|
||||
$myWorkSessionStmt = $pdo->prepare('SELECT started_at FROM ticket_work_sessions WHERE ticket_id = ? AND staff_id = ?');
|
||||
@@ -87,6 +97,8 @@ $collabStmt = $pdo->prepare('SELECT * FROM ticket_collaborators WHERE ticket_id
|
||||
$collabStmt->execute([$ticket['id']]);
|
||||
$collaborators = $collabStmt->fetchAll();
|
||||
$ticketProblems = ticket_problems_for_ticket($pdo, (int) $ticket['id']);
|
||||
$scheduledReplies = scheduled_replies_pending($pdo, (int) $ticket['id']);
|
||||
$ticketLinks = ticket_links_for($pdo, (int) $ticket['id'], staff_department_ids($staff));
|
||||
$openProblems = ticket_problems($pdo, true);
|
||||
$resolutionReasons = ticket_resolution_reasons();
|
||||
|
||||
@@ -199,10 +211,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||
}
|
||||
};
|
||||
if ($action === 'reply') $requirePerm('reply_ticket');
|
||||
if ($action === 'reply' || $action === 'schedule_reply' || $action === 'cancel_scheduled_reply') $requirePerm('reply_ticket');
|
||||
if ($action === 'note') $requirePerm('post_note');
|
||||
if ($action === 'delete_ticket') $requirePerm('delete_ticket');
|
||||
if ($action === 'mark_spam' || $action === 'restore_spam') $requirePerm('close_ticket');
|
||||
if ($action === 'reload_mail_attachments') $requirePerm('reply_ticket');
|
||||
|
||||
if ($action === 'add_comment') {
|
||||
$threadId = (int)($_POST['thread_id'] ?? 0);
|
||||
@@ -235,6 +248,35 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||
}
|
||||
|
||||
if ($action === 'schedule_reply') {
|
||||
$message = sanitize_staff_html(resolve_canned_vars(trim($_POST['message'] ?? ''), $ticket, $staff));
|
||||
$err = null;
|
||||
if (!empty($_FILES['attachments']['name'][0])) $err = 'Anhänge sind bei zeitversetztem Senden nicht möglich. Bitte ohne Anhang planen oder sofort senden.';
|
||||
$status = (string) ($_POST['set_status'] ?? 'answered');
|
||||
if (!$err && in_array($status, ['resolved', 'closed'], true)) $requirePerm('close_ticket');
|
||||
$sendAt = scheduled_reply_parse_time((string) ($_POST['send_at'] ?? ''));
|
||||
$err = $err ?: scheduled_reply_create($pdo, $ticket, (int) $staff['id'], $message, $sendAt, [
|
||||
'set_status' => $status, 'resolution_code' => (string) ($_POST['resolution_code'] ?? ''), 'resolution_note' => (string) ($_POST['resolution_note'] ?? ''),
|
||||
'signature_choice' => isset($_POST['signature_choice']) ? (string) $_POST['signature_choice'] : null,
|
||||
]);
|
||||
if ($err) { flash('error', $err); }
|
||||
else {
|
||||
log_activity($pdo, (int) $ticket['id'], (int) $staff['id'], 'Antwort eingeplant für ' . format_dt($sendAt));
|
||||
flash('success', 'Antwort eingeplant für ' . format_dt($sendAt) . '. Sie wird dann automatisch gesendet.');
|
||||
}
|
||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||
}
|
||||
|
||||
if ($action === 'cancel_scheduled_reply') {
|
||||
if (scheduled_reply_cancel($pdo, (int) ($_POST['scheduled_id'] ?? 0), (int) $ticket['id'], $staff)) {
|
||||
log_activity($pdo, (int) $ticket['id'], (int) $staff['id'], 'Geplante Antwort abgebrochen');
|
||||
flash('success', 'Geplante Antwort abgebrochen.');
|
||||
} else {
|
||||
flash('error', 'Die geplante Antwort konnte nicht abgebrochen werden (schon gesendet oder nicht von Ihnen).');
|
||||
}
|
||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||
}
|
||||
|
||||
if ($action === 'reply' || $action === 'note') {
|
||||
$raw = trim($_POST['message'] ?? '');
|
||||
// Variablen serverseitig auflösen (Fallback falls JS deaktiviert)
|
||||
@@ -337,6 +379,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
redirect($action === 'restore_spam' ? '/staff/ticket_view.php?n=' . urlencode($number) : '/staff/tickets.php');
|
||||
}
|
||||
|
||||
if ($action === 'reload_mail_attachments') {
|
||||
$r = reload_ticket_mail_attachments($pdo, $ticket, (int) $staff['id']);
|
||||
if ($r['error']) {
|
||||
flash('error', $r['error']);
|
||||
} else {
|
||||
$n = $r['added'] + $r['inline'];
|
||||
$msg = ($n > 0 || $r['html'] > 0) ? ($r['added'] > 0 ? $r['added'] . ' Anhang/Anhänge' : 'Nichts als Anhang') . ($r['inline'] > 0 ? ', ' . $r['inline'] . ' Bild(er) im Text' : '') . ($r['html'] > 0 ? ' und die Formatierung' : '') . ' aus der E-Mail nachgeladen.' : 'Es gab nichts Neues zu laden.';
|
||||
if ($r['existing'] > 0) $msg .= ' ' . $r['existing'] . ' war(en) schon im Ticket.';
|
||||
if ($r['skipped'] > 0) $msg .= ' ' . $r['skipped'] . ' nicht übernommen (Typ nicht erlaubt oder zu groß, siehe Verlauf).';
|
||||
if ($r['failed']) flash('error', $msg . ' ' . implode(' | ', $r['failed']));
|
||||
else flash(($r['added'] + $r['inline'] + $r['html']) > 0 ? 'success' : 'info', $msg);
|
||||
}
|
||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||
}
|
||||
|
||||
if ($action === 'delete_ticket') {
|
||||
delete_ticket($pdo, $ticket, $staff['id']);
|
||||
flash('success', "Ticket #{$number} wurde gelöscht.");
|
||||
@@ -525,6 +582,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||
}
|
||||
|
||||
if ($action === 'link_add' || $action === 'link_remove') {
|
||||
$requirePerm('reply_ticket');
|
||||
if ($action === 'link_add') {
|
||||
$err = ticket_link_add($pdo, (int) $ticket['id'], (string) ($_POST['link_number'] ?? ''), (string) ($_POST['link_type'] ?? 'related'), (int) $staff['id'], staff_department_ids($staff));
|
||||
if ($err) flash('error', $err);
|
||||
else {
|
||||
log_activity($pdo, (int) $ticket['id'], (int) $staff['id'], 'Mit Ticket #' . ltrim(trim((string) $_POST['link_number']), '#') . ' verknüpft');
|
||||
flash('success', 'Tickets verknüpft.');
|
||||
}
|
||||
} elseif (ticket_link_remove($pdo, (int) ($_POST['link_id'] ?? 0), (int) $ticket['id'])) {
|
||||
log_activity($pdo, (int) $ticket['id'], (int) $staff['id'], 'Ticketverknüpfung entfernt');
|
||||
flash('success', 'Verknüpfung entfernt.');
|
||||
}
|
||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||
}
|
||||
|
||||
if ($action === 'problem_link') {
|
||||
if ($staff['role'] !== 'admin') { flash('error', 'Nur Administratoren dürfen Tickets mit Problemen verknüpfen.'); redirect('/staff/ticket_view.php?n=' . urlencode($number)); }
|
||||
$problemIdToLink = (int) ($_POST['problem_id'] ?? 0);
|
||||
@@ -751,6 +824,13 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
<button type="submit" class="btn secondary" style="font-size:.8rem;padding:5px 12px">↩️ Spam-Markierung aufheben</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php if (($ticket['source'] ?? '') === 'email' && function_exists('imap_open') && has_permission($staff, 'reply_ticket', (int) $ticket['department_id'])): ?>
|
||||
<form method="post" style="display:inline" onsubmit="return confirm('Anhänge, Bilder und Formatierung der Original-E-Mail aus dem Postfach nachladen und ins Ticket übernehmen?');">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="action" value="reload_mail_attachments">
|
||||
<button type="submit" class="btn secondary" style="font-size:.8rem;padding:5px 12px" title="Holt Anhänge, Bilder und die Formatierung der E-Mail aus dem Postfach, soweit sie beim Abruf nicht übernommen wurden">📎 Anhänge und Bilder aus E-Mail laden</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<a href="/staff/ticket_print.php?n=<?= urlencode($ticket['ticket_number']) ?>" target="_blank" class="btn secondary" style="font-size:.8rem;padding:5px 12px">🖨 Drucken</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -869,7 +949,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
$isStaffMsg = $m['author_type'] === 'staff';
|
||||
$who = $isStaffMsg ? ($m['staff_name'] ?? 'Mitarbeiter') : ($m['user_name'] ?? $ticket['requester_name']);
|
||||
$body = (string) ($m['message'] ?? '');
|
||||
$bodyIsHtml = preg_match('/<[a-zA-Z][^>]*>/i', $body);
|
||||
$bodyIsHtml = message_is_html($body);
|
||||
$attStmt->execute([$m['id']]);
|
||||
$msgAttachments = $attStmt->fetchAll();
|
||||
?>
|
||||
@@ -905,6 +985,10 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
if ($ticket['source'] === 'chat' && !$msg['is_internal_note']) continue; // s.o., schon im Chatprotokoll gezeigt
|
||||
$attStmt->execute([$msg['id']]);
|
||||
$attachments = $attStmt->fetchAll();
|
||||
// Eingebettete Bilder einer Mail (Logos, Fotos im Text) gehören zur Darstellung der Nachricht und stehen nicht in der Anhangliste
|
||||
$cidMap = [];
|
||||
foreach ($attachments as $a) if (!empty($a['is_inline']) && !empty($a['content_id'])) $cidMap[strtolower((string) $a['content_id'])] = '/download.php?id=' . (int) $a['id'] . '&preview=1';
|
||||
$attachments = array_values(array_filter($attachments, fn($a) => empty($a['is_inline'])));
|
||||
$isStaff = $msg['author_type'] === 'staff';
|
||||
$authorName = $isStaff
|
||||
? ($msg['staff_name'] ?? 'Mitarbeiter')
|
||||
@@ -938,7 +1022,10 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
?>
|
||||
<?php
|
||||
// Quoting-Blöcke einklappen (> ... Linien)
|
||||
$isHtml = preg_match('/<[a-zA-Z][^>]*>/i', $msgBody);
|
||||
// E-Mails mit Formatierung: bereinigte HTML-Fassung (message_html), sonst nur HTML, wenn die Nachricht selbst welches enthält
|
||||
$mailHtml = trim((string) ($msg['message_html'] ?? ''));
|
||||
$htmlSource = $mailHtml !== '' ? $mailHtml : (message_is_html($msgBody) ? $msgBody : null);
|
||||
$isHtml = $htmlSource !== null;
|
||||
$msgId = $msg['id'];
|
||||
?>
|
||||
<!-- Quelltext-Toggle -->
|
||||
@@ -958,14 +1045,26 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
<?php if ($isHtml): ?>
|
||||
<?php
|
||||
// HTML-E-Mail sicher rendern
|
||||
$safe = sanitize_staff_html($msgBody);
|
||||
$safe = sanitize_staff_html((string) $htmlSource, $mailHtml !== '' ? ['remote_images' => $loadRemoteImages ? 'allow' : 'placeholder', 'cid_map' => $cidMap] : []);
|
||||
// Zitat-Blöcke einklappbar machen
|
||||
$safe = preg_replace(
|
||||
'/<blockquote([^>]*)>(.*?)<\/blockquote>/is',
|
||||
'<div class="email-quote-wrap"><button type="button" class="email-quote-toggle" onclick="this.nextElementSibling.style.display=this.nextElementSibling.style.display===\'none\'?\'block\':\'none\';this.textContent=this.nextElementSibling.style.display===\'none\'?\'▶ Zitat anzeigen\':\'▼ Zitat ausblenden\'">▶ Zitat anzeigen</button><blockquote\1 style="display:none">\2</blockquote></div>',
|
||||
$safe
|
||||
);
|
||||
// Zitierter Verlauf früherer Mails (Outlook: Linie und Mailkopf) wird eingeklappt
|
||||
if (empty($msg['is_internal_note'])) {
|
||||
[$safeNew, $safeQuoted] = mail_split_quoted_html($safe);
|
||||
if ($safeQuoted !== '') $safe = $safeNew . mail_quote_wrap($safeQuoted);
|
||||
}
|
||||
?>
|
||||
<?php if ($mailHtml !== '' && $loadRemoteImages && str_contains($safe, '<img')): ?>
|
||||
<div class="muted" style="font-size:.74rem;margin-bottom:8px">🌐 Bilder von fremden Webseiten sind für diese Ansicht geladen. <a href="/staff/ticket_view.php?n=<?= urlencode((string) $ticket['ticket_number']) ?>">Wieder ausblenden</a></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($mailHtml !== '' && str_contains($safe, 'data-blocked-remote')): ?>
|
||||
<div class="muted" style="font-size:.74rem;margin-bottom:8px">🔒 Bilder von fremden Webseiten wurden aus Datenschutzgründen nicht geladen.
|
||||
<a href="/staff/ticket_view.php?n=<?= urlencode((string) $ticket['ticket_number']) ?>&remote_images=1" title="Lädt die Bilder nur für diese Ansicht. Der Absender kann dann sehen, dass und wann die Mail geöffnet wurde." style="margin-left:6px">Bilder jetzt laden</a></div>
|
||||
<?php endif; ?>
|
||||
<div class="email-html-body" style="font-size:.87rem;line-height:1.7;overflow-x:auto">
|
||||
<?= $safe ?>
|
||||
</div>
|
||||
@@ -973,15 +1072,23 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
<?php
|
||||
$text = trim($msgBody);
|
||||
$text = str_replace(["\r\n", "\r"], "\n", $text);
|
||||
$parts = preg_split('/\n{2,}/', $text);
|
||||
if (count($parts) > 1) {
|
||||
foreach ($parts as $p) {
|
||||
$p = trim($p);
|
||||
if ($p !== '') echo '<p style="margin:0 0 12px;line-height:1.7">' . nl2br(htmlspecialchars($p, ENT_QUOTES, 'UTF-8')) . '</p>';
|
||||
$quotedText = '';
|
||||
if (empty($msg['is_internal_note'])) [$text, $quotedText] = mail_split_quoted_text($text);
|
||||
$renderText = function (string $t): string {
|
||||
$out = '';
|
||||
$parts = preg_split('/\n{2,}/', $t);
|
||||
if (count($parts) > 1) {
|
||||
foreach ($parts as $p) {
|
||||
$p = trim($p);
|
||||
if ($p !== '') $out .= '<p style="margin:0 0 12px;line-height:1.7">' . nl2br(htmlspecialchars($p, ENT_QUOTES, 'UTF-8')) . '</p>';
|
||||
}
|
||||
} else {
|
||||
$out .= '<p style="margin:0;line-height:1.7">' . nl2br(htmlspecialchars($t, ENT_QUOTES, 'UTF-8')) . '</p>';
|
||||
}
|
||||
} else {
|
||||
echo '<p style="margin:0;line-height:1.7">' . nl2br(htmlspecialchars($text, ENT_QUOTES, 'UTF-8')) . '</p>';
|
||||
}
|
||||
return $out;
|
||||
};
|
||||
echo $renderText($text);
|
||||
if ($quotedText !== '') echo mail_quote_wrap($renderText($quotedText));
|
||||
?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -997,9 +1104,9 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
<?php if ($imgAtts): ?>
|
||||
<div style="display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px">
|
||||
<?php foreach ($imgAtts as $a): ?>
|
||||
<a href="/download.php?id=<?= $a['id'] ?>&preview=1" target="_blank"
|
||||
<a href="/download.php?id=<?= $a['id'] ?>&preview=1" target="_blank" data-lightbox="1" data-download="/download.php?id=<?= (int) $a['id'] ?>"
|
||||
title="<?= e($a['original_name']) ?>"
|
||||
style="display:block;border:1px solid var(--border);border-radius:6px;overflow:hidden;flex-shrink:0">
|
||||
style="display:block;border:1px solid var(--border);border-radius:6px;overflow:hidden;flex-shrink:0;cursor:zoom-in">
|
||||
<img src="/download.php?id=<?= $a['id'] ?>&preview=1"
|
||||
alt="<?= e($a['original_name']) ?>"
|
||||
style="max-width:200px;max-height:150px;display:block;object-fit:cover">
|
||||
@@ -1156,7 +1263,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
</div>
|
||||
<div id="canned-preview" style="display:none;background:var(--bg-soft);border:1px solid var(--border);border-radius:6px;padding:12px;font-size:.84rem;line-height:1.7;margin-bottom:8px;max-height:200px;overflow-y:auto"></div>
|
||||
<?php endif; ?>
|
||||
<textarea name="message" id="message-field" data-richtext placeholder="Nachricht eingeben..." required></textarea>
|
||||
<textarea name="message" id="message-field" data-richtext data-image-upload-url="/staff/upload_signature_image.php" placeholder="Nachricht eingeben... (Bilder und Screenshots mit Strg + V einfügen)" required></textarea>
|
||||
|
||||
<div id="reply-signature" style="margin:14px 0">
|
||||
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:6px">
|
||||
@@ -1214,9 +1321,35 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
<button type="submit" class="btn" onclick="document.getElementById('form-action').value='reply'">Öffentliche Antwort senden</button>
|
||||
<button type="submit" class="btn secondary" onclick="document.getElementById('form-action').value='note'">Nur interne Notiz speichern</button>
|
||||
</div>
|
||||
<details style="margin-top:12px">
|
||||
<summary style="cursor:pointer;font-weight:600">Später senden</summary>
|
||||
<div style="display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-top:8px">
|
||||
<div><label for="send_at" style="margin-top:0">Senden am</label><input type="datetime-local" id="send_at" name="send_at" min="<?= e(date('Y-m-d\TH:i')) ?>" max="<?= e(date('Y-m-d\TH:i', time() + SCHEDULED_REPLY_MAX_DAYS * 86400)) ?>" style="width:auto"></div>
|
||||
<button type="submit" class="btn secondary" onclick="document.getElementById('form-action').value='schedule_reply'">Antwort einplanen</button>
|
||||
</div>
|
||||
<div class="muted" style="font-size:.78rem;margin-top:4px">Die Antwort geht zur gewählten Zeit (Serverzeit) automatisch an den Kunden. Status und Signatur gelten wie oben gewählt; Anhänge sind hier nicht möglich.</div>
|
||||
</details>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if ($scheduledReplies): ?>
|
||||
<div class="card" style="border-left:4px solid #6366f1">
|
||||
<h3>Geplante Antworten</h3>
|
||||
<?php foreach ($scheduledReplies as $sr): ?>
|
||||
<div style="padding:8px 0;border-top:1px solid var(--border-soft)">
|
||||
<div style="display:flex;justify-content:space-between;gap:10px;align-items:center;flex-wrap:wrap">
|
||||
<strong>Wird gesendet am <?= e(format_dt((string) $sr['send_at'])) ?></strong>
|
||||
<span class="muted" style="font-size:.8rem">von <strong><?= e($sr['staff_name'] ?? '–') ?></strong></span>
|
||||
<?php if ((int) $sr['staff_id'] === (int) $staff['id'] || $staff['role'] === 'admin'): ?>
|
||||
<form method="post" style="margin:0" onsubmit="return confirm('Geplante Antwort abbrechen?')"><?= csrf_field() ?><input type="hidden" name="action" value="cancel_scheduled_reply"><input type="hidden" name="scheduled_id" value="<?= (int) $sr['id'] ?>"><button class="btn secondary" type="submit" style="padding:3px 10px;font-size:.78rem">Abbrechen</button></form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div style="font-size:.86rem;margin-top:6px;max-height:140px;overflow:auto"><?= $sr['message'] ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($activity): ?>
|
||||
<div class="card">
|
||||
<h3>Aktivität</h3>
|
||||
@@ -1228,12 +1361,12 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-top:20px;display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px;align-items:start">
|
||||
<nav class="tv-tabs" id="tv-tabs" role="tablist" aria-label="Ticket-Details">
|
||||
<button type="button" role="tab" class="tv-tab active" data-tab="details">Details</button>
|
||||
<button type="button" role="tab" class="tv-tab" data-tab="manage">Organisation</button>
|
||||
<button type="button" role="tab" class="tv-tab" data-tab="more">Mehr</button>
|
||||
</nav>
|
||||
<div style="margin-top:20px;display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px;align-items:start">
|
||||
<nav class="tv-tabs" id="tv-tabs" role="tablist" aria-label="Ticket-Details">
|
||||
<button type="button" role="tab" class="tv-tab active" data-tab="details">Details</button>
|
||||
<button type="button" role="tab" class="tv-tab" data-tab="manage">Organisation</button>
|
||||
<button type="button" role="tab" class="tv-tab" data-tab="more">Mehr</button>
|
||||
</nav>
|
||||
|
||||
|
||||
<!-- Ticket-Eigenschaften als horizontale Leiste -->
|
||||
@@ -1314,6 +1447,23 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="card" data-ptab="manage" style="padding:14px 20px">
|
||||
<div style="font-size:.71rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)">Verknüpfte Tickets</div>
|
||||
<?php foreach ($ticketLinks as $lk): [$lkLabel, $lkColor] = status_label($lk['status']); ?>
|
||||
<div style="display:flex;gap:8px;align-items:center;justify-content:space-between;padding:7px 0;border-top:1px solid var(--border-soft);margin-top:8px">
|
||||
<div style="min-width:0"><div class="muted" style="font-size:.74rem"><?= e($lk['label']) ?></div><a href="/staff/ticket_view.php?n=<?= urlencode($lk['number']) ?>"><strong>#<?= e($lk['number']) ?></strong> · <?= e($lk['subject']) ?></a> <span class="badge" style="background:<?= $lkColor ?>"><?= e($lkLabel) ?></span></div>
|
||||
<form method="post" style="margin:0" onsubmit="return confirm('Verknüpfung entfernen?')"><?= csrf_field() ?><input type="hidden" name="action" value="link_remove"><input type="hidden" name="link_id" value="<?= (int) $lk['id'] ?>"><button type="submit" title="Verknüpfung entfernen" style="background:none;border:none;color:var(--muted);cursor:pointer">✕</button></form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php if (!$ticketLinks): ?><p class="muted" style="font-size:.84rem">Keine verknüpften Tickets.</p><?php endif; ?>
|
||||
<?php if ($blockers = ticket_open_blockers($pdo, (int) $ticket['id'])): ?><div style="padding:8px 10px;margin-top:8px;border-radius:7px;background:#fef3c7;color:#92400e;font-size:.82rem">Wird noch blockiert durch <?= e(implode(', ', array_map(fn($b) => '#' . $b['number'], $blockers))) ?>.</div><?php endif; ?>
|
||||
<form method="post" style="display:flex;gap:6px;align-items:end;margin-top:8px;flex-wrap:wrap"><?= csrf_field() ?><input type="hidden" name="action" value="link_add">
|
||||
<div style="flex:1;min-width:110px"><label style="font-size:.75rem" for="link_number">Ticketnummer</label><input type="text" id="link_number" name="link_number" required maxlength="40" placeholder="z. B. 923425"></div>
|
||||
<div style="min-width:130px"><label style="font-size:.75rem" for="link_type">Art</label><select id="link_type" name="link_type"><?php foreach (ticket_link_types() as $lt => $ll): ?><option value="<?= e($lt) ?>"><?= e($ll[0]) ?></option><?php endforeach; ?></select></div>
|
||||
<button class="btn secondary" type="submit">Verknüpfen</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card" data-ptab="manage" style="padding:14px 20px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:8px"><span style="font-size:.71rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)">Zugehörige Probleme</span><?php if ($staff['role'] === 'admin'): ?><a class="btn secondary" style="padding:3px 8px;font-size:.75rem" href="/staff/problems.php">Verwalten</a><?php endif; ?></div>
|
||||
<?php if ($ticketProblems): foreach ($ticketProblems as $problemItem): ?>
|
||||
@@ -1568,7 +1718,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
||||
$alreadyBanned = (bool)$bs->fetchColumn();
|
||||
}
|
||||
?>
|
||||
<div data-ptab="more"><?= plugin_filter('ticket.view.sidebar', '', ['ticketId' => (int) $ticket['id'], 'ticket' => $ticket, 'staff' => $staff]) /* Plugins liefern fertiges HTML (vertrauenswürdiger Code) */ ?></div>
|
||||
<div data-ptab="more"><?= plugin_filter('ticket.view.sidebar', '', ['ticketId' => (int) $ticket['id'], 'ticket' => $ticket, 'staff' => $staff]) /* Plugins liefern fertiges HTML (vertrauenswürdiger Code) */ ?></div>
|
||||
<?php if ($requesterEmail): ?>
|
||||
<div class="card" data-ptab="details" style="margin-top:16px;padding:14px 16px">
|
||||
<div style="font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:10px">Absender</div>
|
||||
@@ -1887,31 +2037,38 @@ function toggleRaw(id) {
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.tv-tabs { grid-column:1 / -1; display:flex; gap:2px; margin:0; border-bottom:1px solid var(--border,#e2e8f0); overflow-x:auto; overflow-y:hidden; }
|
||||
.tv-tab { background:none; border:0; border-bottom:3px solid transparent; padding:9px 14px; margin-bottom:-1px; cursor:pointer; font:inherit; font-weight:600; color:var(--muted,#64748b); border-radius:8px 8px 0 0; white-space:nowrap; }
|
||||
.tv-tab:hover { color:var(--text,#0f172a); background:var(--surface,#fff); }
|
||||
.tv-tab.active { color:var(--primary); border-bottom-color:var(--primary); background:var(--surface,#fff); }
|
||||
[data-ptab][hidden] { display:none !important; }
|
||||
</style>
|
||||
<script>
|
||||
// Reiter unter dem Verlauf: zeigt nur die Karten der gewählten Gruppe. Die Wahl bleibt beim Neuladen (z. B. nach dem Speichern) erhalten.
|
||||
(function () {
|
||||
var bar = document.getElementById('tv-tabs');
|
||||
if (!bar) return;
|
||||
var tabs = bar.querySelectorAll('.tv-tab');
|
||||
function show(name) {
|
||||
var found = false;
|
||||
tabs.forEach(function (b) { var on = b.dataset.tab === name; if (on) found = true; b.classList.toggle('active', on); b.setAttribute('aria-selected', on ? 'true' : 'false'); });
|
||||
if (!found) return show('details');
|
||||
document.querySelectorAll('[data-ptab]').forEach(function (el) { el.hidden = el.dataset.ptab !== name; });
|
||||
try { sessionStorage.setItem('tv_tab', name); } catch (e) {}
|
||||
}
|
||||
tabs.forEach(function (b) { b.addEventListener('click', function () { show(b.dataset.tab); }); });
|
||||
var saved = 'details';
|
||||
try { saved = sessionStorage.getItem('tv_tab') || 'details'; } catch (e) {}
|
||||
show(saved);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script src="/assets/js/ticket-lightbox.js?v=<?= @filemtime(__DIR__ . '/../assets/js/ticket-lightbox.js') ?: time() ?>"></script>
|
||||
<style>
|
||||
/* Eingeklappter E-Mail-Verlauf: gleiche Optik wie der Knopf „Quelltext“ */
|
||||
.email-quote-wrap { margin:12px 0 4px; }
|
||||
.email-quote-toggle { display:inline-flex; align-items:center; gap:6px; font:inherit; font-size:.76rem; font-weight:600; line-height:1; padding:6px 12px; border:1px solid var(--border,#e2e8f0); border-radius:999px; background:var(--bg-soft,#f8fafc); color:var(--muted,#64748b); cursor:pointer; transition:background .15s,border-color .15s,color .15s; }
|
||||
.email-quote-toggle:hover { background:var(--surface,#fff); border-color:var(--primary,#0f6f6a); color:var(--primary,#0f6f6a); }
|
||||
.email-quote-toggle:focus-visible { outline:2px solid var(--primary,#0f6f6a); outline-offset:2px; }
|
||||
.email-quoted { margin-top:10px; padding:4px 0 4px 14px; border-left:3px solid var(--border,#e2e8f0); color:var(--muted,#64748b); font-size:.92em; }
|
||||
.tv-tabs { grid-column:1 / -1; display:flex; gap:2px; margin:0; border-bottom:1px solid var(--border,#e2e8f0); overflow-x:auto; overflow-y:hidden; }
|
||||
.tv-tab { background:none; border:0; border-bottom:3px solid transparent; padding:9px 14px; margin-bottom:-1px; cursor:pointer; font:inherit; font-weight:600; color:var(--muted,#64748b); border-radius:8px 8px 0 0; white-space:nowrap; }
|
||||
.tv-tab:hover { color:var(--text,#0f172a); background:var(--surface,#fff); }
|
||||
.tv-tab.active { color:var(--primary); border-bottom-color:var(--primary); background:var(--surface,#fff); }
|
||||
[data-ptab][hidden] { display:none !important; }
|
||||
</style>
|
||||
<script>
|
||||
// Reiter unter dem Verlauf: zeigt nur die Karten der gewählten Gruppe. Die Wahl bleibt beim Neuladen (z. B. nach dem Speichern) erhalten.
|
||||
(function () {
|
||||
var bar = document.getElementById('tv-tabs');
|
||||
if (!bar) return;
|
||||
var tabs = bar.querySelectorAll('.tv-tab');
|
||||
function show(name) {
|
||||
var found = false;
|
||||
tabs.forEach(function (b) { var on = b.dataset.tab === name; if (on) found = true; b.classList.toggle('active', on); b.setAttribute('aria-selected', on ? 'true' : 'false'); });
|
||||
if (!found) return show('details');
|
||||
document.querySelectorAll('[data-ptab]').forEach(function (el) { el.hidden = el.dataset.ptab !== name; });
|
||||
try { sessionStorage.setItem('tv_tab', name); } catch (e) {}
|
||||
}
|
||||
tabs.forEach(function (b) { b.addEventListener('click', function () { show(b.dataset.tab); }); });
|
||||
var saved = 'details';
|
||||
try { saved = sessionStorage.getItem('tv_tab') || 'details'; } catch (e) {}
|
||||
show(saved);
|
||||
})();
|
||||
</script>
|
||||
<?php require __DIR__ . '/_footer.php'; ?>
|
||||
|
||||
Reference in New Issue
Block a user