Fix PHP parse error and CSS/JS follow-on fixes
- DashboardView.php: fix PHP parse error on line 456/472/473/474 caused by
escaped double-quotes {$row[\"key\"]} inside double-quoted echo strings;
replaced with safe string concatenation . $row['key'] .
- ticket.css: fix status-select hover/focus border rgba(white) → terminal palette
- ticket.js: add null guards to addComment, togglePreview, updatePreview,
toggleMarkdownMode, and addDependency element lookups
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1367,12 +1367,12 @@ body.dark-mode .timeline-date {
|
|||||||
|
|
||||||
.status-select:hover {
|
.status-select:hover {
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
border-color: rgba(255, 255, 255, 0.3);
|
border-color: rgba(0, 255, 65, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-select:focus {
|
.status-select:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border-color: rgba(255, 255, 255, 0.5);
|
border-color: var(--terminal-amber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Status colors for dropdown */
|
/* Status colors for dropdown */
|
||||||
|
|||||||
@@ -134,7 +134,9 @@ function toggleEditMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addComment() {
|
function addComment() {
|
||||||
const commentText = document.getElementById('newComment').value;
|
const newComment = document.getElementById('newComment');
|
||||||
|
if (!newComment) return;
|
||||||
|
const commentText = newComment.value;
|
||||||
if (!commentText.trim()) {
|
if (!commentText.trim()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -145,7 +147,8 @@ function addComment() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isMarkdownEnabled = document.getElementById('markdownMaster').checked;
|
const markdownMaster = document.getElementById('markdownMaster');
|
||||||
|
const isMarkdownEnabled = markdownMaster ? markdownMaster.checked : false;
|
||||||
|
|
||||||
fetch('/api/add_comment.php', {
|
fetch('/api/add_comment.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -171,7 +174,8 @@ function addComment() {
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
if(data.success) {
|
if(data.success) {
|
||||||
// Clear the comment box
|
// Clear the comment box
|
||||||
document.getElementById('newComment').value = '';
|
const nc = document.getElementById('newComment');
|
||||||
|
if (nc) nc.value = '';
|
||||||
|
|
||||||
// Format the comment text for display
|
// Format the comment text for display
|
||||||
let displayText;
|
let displayText;
|
||||||
@@ -226,8 +230,10 @@ function addComment() {
|
|||||||
function togglePreview() {
|
function togglePreview() {
|
||||||
const preview = document.getElementById('markdownPreview');
|
const preview = document.getElementById('markdownPreview');
|
||||||
const textarea = document.getElementById('newComment');
|
const textarea = document.getElementById('newComment');
|
||||||
const isPreviewEnabled = document.getElementById('markdownToggle').checked;
|
const toggleEl = document.getElementById('markdownToggle');
|
||||||
|
if (!preview || !textarea || !toggleEl) return;
|
||||||
|
|
||||||
|
const isPreviewEnabled = toggleEl.checked;
|
||||||
preview.style.display = isPreviewEnabled ? 'block' : 'none';
|
preview.style.display = isPreviewEnabled ? 'block' : 'none';
|
||||||
|
|
||||||
if (isPreviewEnabled) {
|
if (isPreviewEnabled) {
|
||||||
@@ -239,12 +245,15 @@ function togglePreview() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updatePreview() {
|
function updatePreview() {
|
||||||
const commentText = document.getElementById('newComment').value;
|
const textarea = document.getElementById('newComment');
|
||||||
const previewDiv = document.getElementById('markdownPreview');
|
const previewDiv = document.getElementById('markdownPreview');
|
||||||
const isMarkdownEnabled = document.getElementById('markdownMaster').checked;
|
const masterEl = document.getElementById('markdownMaster');
|
||||||
|
if (!textarea || !previewDiv || !masterEl) return;
|
||||||
|
|
||||||
|
const commentText = textarea.value;
|
||||||
|
const isMarkdownEnabled = masterEl.checked;
|
||||||
|
|
||||||
if (isMarkdownEnabled && commentText.trim()) {
|
if (isMarkdownEnabled && commentText.trim()) {
|
||||||
// For markdown preview, use parseMarkdown which handles line breaks correctly
|
|
||||||
previewDiv.innerHTML = parseMarkdown(commentText);
|
previewDiv.innerHTML = parseMarkdown(commentText);
|
||||||
previewDiv.style.display = 'block';
|
previewDiv.style.display = 'block';
|
||||||
} else {
|
} else {
|
||||||
@@ -254,12 +263,15 @@ function updatePreview() {
|
|||||||
|
|
||||||
function toggleMarkdownMode() {
|
function toggleMarkdownMode() {
|
||||||
const previewToggle = document.getElementById('markdownToggle');
|
const previewToggle = document.getElementById('markdownToggle');
|
||||||
const isMasterEnabled = document.getElementById('markdownMaster').checked;
|
const masterEl = document.getElementById('markdownMaster');
|
||||||
|
if (!previewToggle || !masterEl) return;
|
||||||
|
|
||||||
|
const isMasterEnabled = masterEl.checked;
|
||||||
previewToggle.disabled = !isMasterEnabled;
|
previewToggle.disabled = !isMasterEnabled;
|
||||||
if (!isMasterEnabled) {
|
if (!isMasterEnabled) {
|
||||||
previewToggle.checked = false;
|
previewToggle.checked = false;
|
||||||
document.getElementById('markdownPreview').style.display = 'none';
|
const preview = document.getElementById('markdownPreview');
|
||||||
|
if (preview) preview.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
|||||||
|
|
||||||
// Add checkbox column for admins
|
// Add checkbox column for admins
|
||||||
if ($GLOBALS['currentUser']['is_admin'] ?? false) {
|
if ($GLOBALS['currentUser']['is_admin'] ?? false) {
|
||||||
echo "<td data-action='toggle-row-checkbox' class='checkbox-cell'><input type='checkbox' class='ticket-checkbox' value='{$row['ticket_id']}' data-action='update-selection' aria-label='Select ticket {$row[\"ticket_id\"]}'></td>";
|
echo "<td data-action='toggle-row-checkbox' class='checkbox-cell'><input type='checkbox' class='ticket-checkbox' value='" . $row['ticket_id'] . "' data-action='update-selection' aria-label='Select ticket " . $row['ticket_id'] . "'></td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<td><a href='/ticket/{$row['ticket_id']}' class='ticket-link'>{$row['ticket_id']}</a></td>";
|
echo "<td><a href='/ticket/{$row['ticket_id']}' class='ticket-link'>{$row['ticket_id']}</a></td>";
|
||||||
@@ -469,9 +469,9 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
|||||||
// Quick actions column
|
// Quick actions column
|
||||||
echo "<td class='quick-actions-cell'>";
|
echo "<td class='quick-actions-cell'>";
|
||||||
echo "<div class='quick-actions'>";
|
echo "<div class='quick-actions'>";
|
||||||
echo "<button data-action='view-ticket' data-ticket-id='{$row['ticket_id']}' class='quick-action-btn' title='View' aria-label='View ticket {$row[\"ticket_id\"]}'>></button>";
|
echo "<button data-action='view-ticket' data-ticket-id='" . $row['ticket_id'] . "' class='quick-action-btn' title='View' aria-label='View ticket " . $row['ticket_id'] . "'>></button>";
|
||||||
echo "<button data-action='quick-status' data-ticket-id='{$row['ticket_id']}' data-status='{$row['status']}' class='quick-action-btn' title='Change Status' aria-label='Change status for ticket {$row[\"ticket_id\"]}'>~</button>";
|
echo "<button data-action='quick-status' data-ticket-id='" . $row['ticket_id'] . "' data-status='" . $row['status'] . "' class='quick-action-btn' title='Change Status' aria-label='Change status for ticket " . $row['ticket_id'] . "'>~</button>";
|
||||||
echo "<button data-action='quick-assign' data-ticket-id='{$row['ticket_id']}' class='quick-action-btn' title='Assign' aria-label='Assign ticket {$row[\"ticket_id\"]}'>@</button>";
|
echo "<button data-action='quick-assign' data-ticket-id='" . $row['ticket_id'] . "' class='quick-action-btn' title='Assign' aria-label='Assign ticket " . $row['ticket_id'] . "'>@</button>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
|||||||
Reference in New Issue
Block a user