Integrate web_template design system and fix security/quality issues
Security fixes: - Add HTTP method validation to delete_comment.php (block CSRF via GET) - Remove $_GET fallback in comment deletion (was CSRF bypass vector) - Guard session_start() with session_status() check across API files - Escape json_encode() data attributes with htmlspecialchars in views - Escape inline APP_TIMEZONE config values in DashboardView/TicketView - Validate timezone param against DateTimeZone::listIdentifiers() in index.php - Remove Database::escape() (was using real_escape_string, not safe) - Fix AttachmentModel hardcoded connection; inject via constructor Backend fixes: - Fix CommentModel bind_param type for ticket_id (s→i) - Fix buildCommentThread orphan parent guard - Fix StatsModel JOIN→LEFT JOIN so unassigned tickets aren't excluded - Add ticket ID validation in BulkOperationsModel before implode() - Add duplicate key retry in TicketModel::createTicket() for race conditions - Wrap SavedFiltersModel default filter changes in transactions - Add null result guards in WorkflowModel query methods Frontend JS: - Rewrite toast.js as lt.toast shim (base.js dependency) - Delegate escapeHtml() to lt.escHtml() - Rewrite keyboard-shortcuts.js using lt.keys.on() - Migrate settings.js to lt.api.* and lt.modal.open/close() - Migrate advanced-search.js to lt.api.* and lt.modal.open/close() - Migrate dashboard.js fetch calls to lt.api.*; update all dynamic modals (bulk ops, quick actions, confirm/input) to lt-modal structure - Migrate ticket.js fetchMentionUsers to lt.api.get() - Remove console.log/error/warn calls from JS files Views: - Add /web_template/base.css and base.js to all 10 view files - Call lt.keys.initDefaults() in DashboardView, TicketView, admin views - Migrate all modal HTML from settings-modal/settings-content to lt-modal-overlay/lt-modal/lt-modal-header/lt-modal-body/lt-modal-footer - Replace style="display:none" with aria-hidden="true" on all modals - Replace modal open/close style.display with lt.modal.open/close() - Update modal buttons to lt-btn lt-btn-primary/lt-btn-ghost classes - Remove manual ESC keydown handlers (replaced by lt.keys.initDefaults) - Fix unescaped timezone values in TicketView inline script Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,8 +11,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Create New Ticket</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260126c">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css?v=20260124e">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/utils.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js?v=20260205"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
@@ -61,7 +63,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<div class="ascii-content">
|
||||
<div class="ascii-frame-inner">
|
||||
<div class="error-message" style="color: var(--priority-1); border: 2px solid var(--priority-1); padding: 1rem; background: rgba(231, 76, 60, 0.1);">
|
||||
<strong>⚠ Error:</strong> <?php echo $error; ?>
|
||||
<strong>⚠ Error:</strong> <?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,9 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ticket Dashboard</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260131e">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ascii-banner.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/utils.js"></script>
|
||||
@@ -22,12 +24,12 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
// CSRF Token for AJAX requests
|
||||
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
|
||||
// Timezone configuration (from server)
|
||||
window.APP_TIMEZONE = '<?php echo $GLOBALS['config']['TIMEZONE']; ?>';
|
||||
window.APP_TIMEZONE_OFFSET = <?php echo $GLOBALS['config']['TIMEZONE_OFFSET']; ?>; // minutes from UTC
|
||||
window.APP_TIMEZONE_ABBREV = '<?php echo $GLOBALS['config']['TIMEZONE_ABBREV']; ?>';
|
||||
window.APP_TIMEZONE = '<?php echo htmlspecialchars($GLOBALS['config']['TIMEZONE'] ?? 'UTC', ENT_QUOTES, 'UTF-8'); ?>';
|
||||
window.APP_TIMEZONE_OFFSET = <?php echo (int)($GLOBALS['config']['TIMEZONE_OFFSET'] ?? 0); ?>; // minutes from UTC
|
||||
window.APP_TIMEZONE_ABBREV = '<?php echo htmlspecialchars($GLOBALS['config']['TIMEZONE_ABBREV'] ?? 'UTC', ENT_QUOTES, 'UTF-8'); ?>';
|
||||
</script>
|
||||
</head>
|
||||
<body data-categories='<?php echo json_encode($categories); ?>' data-types='<?php echo json_encode($types); ?>'>
|
||||
<body data-categories='<?php echo htmlspecialchars(json_encode($categories), ENT_QUOTES, 'UTF-8'); ?>' data-types='<?php echo htmlspecialchars(json_encode($types), ENT_QUOTES, 'UTF-8'); ?>'>
|
||||
|
||||
<!-- Terminal Boot Sequence -->
|
||||
<div id="boot-sequence" class="boot-overlay">
|
||||
@@ -573,17 +575,14 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</section>
|
||||
|
||||
<!-- Settings Modal -->
|
||||
<div class="settings-modal" id="settingsModal" style="display: none;" data-action="close-settings-backdrop" role="dialog" aria-modal="true" aria-labelledby="settingsModalTitle">
|
||||
<div class="settings-content">
|
||||
<span class="bottom-left-corner">╚</span>
|
||||
<span class="bottom-right-corner">╝</span>
|
||||
|
||||
<div class="settings-header">
|
||||
<h3 id="settingsModalTitle">⚙ System Preferences</h3>
|
||||
<button class="close-settings" data-action="close-settings" aria-label="Close settings">✗</button>
|
||||
<div class="lt-modal-overlay" id="settingsModal" aria-hidden="true" role="dialog" aria-modal="true" aria-labelledby="settingsModalTitle">
|
||||
<div class="lt-modal">
|
||||
<div class="lt-modal-header">
|
||||
<span class="lt-modal-title" id="settingsModalTitle">⚙ System Preferences</span>
|
||||
<button class="lt-modal-close" data-modal-close aria-label="Close settings">✕</button>
|
||||
</div>
|
||||
|
||||
<div class="settings-body">
|
||||
<div class="lt-modal-body">
|
||||
<!-- Display Preferences -->
|
||||
<div class="settings-section">
|
||||
<h4>╔══ Display Preferences ══╗</h4>
|
||||
@@ -724,23 +723,23 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-footer">
|
||||
<button class="btn btn-primary" data-action="save-settings">Save Preferences</button>
|
||||
<button class="btn btn-secondary" data-action="close-settings">Cancel</button>
|
||||
<div class="lt-modal-footer">
|
||||
<button class="lt-btn lt-btn-primary" data-action="save-settings">Save Preferences</button>
|
||||
<button class="lt-btn lt-btn-ghost" data-action="close-settings">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Advanced Search Modal -->
|
||||
<div class="settings-modal" id="advancedSearchModal" style="display: none;" data-action="close-advanced-search-backdrop" role="dialog" aria-modal="true" aria-labelledby="advancedSearchModalTitle">
|
||||
<div class="settings-content">
|
||||
<div class="settings-header">
|
||||
<h3 id="advancedSearchModalTitle">🔍 Advanced Search</h3>
|
||||
<button class="close-settings" data-action="close-advanced-search" aria-label="Close advanced search">✗</button>
|
||||
<div class="lt-modal-overlay" id="advancedSearchModal" aria-hidden="true" role="dialog" aria-modal="true" aria-labelledby="advancedSearchModalTitle">
|
||||
<div class="lt-modal">
|
||||
<div class="lt-modal-header">
|
||||
<span class="lt-modal-title" id="advancedSearchModalTitle">🔍 Advanced Search</span>
|
||||
<button class="lt-modal-close" data-modal-close aria-label="Close advanced search">✕</button>
|
||||
</div>
|
||||
|
||||
<form id="advancedSearchForm">
|
||||
<div class="settings-body">
|
||||
<div class="lt-modal-body">
|
||||
<!-- Saved Filters -->
|
||||
<div class="settings-section">
|
||||
<h4>╔══ Saved Filters ══╗</h4>
|
||||
@@ -841,10 +840,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-footer">
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="reset-advanced-search">Reset</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="close-advanced-search">Cancel</button>
|
||||
<div class="lt-modal-footer">
|
||||
<button type="submit" class="lt-btn lt-btn-primary">Search</button>
|
||||
<button type="button" class="lt-btn lt-btn-ghost" data-action="reset-advanced-search">Reset</button>
|
||||
<button type="button" class="lt-btn lt-btn-ghost" data-action="close-advanced-search">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -854,6 +853,8 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/keyboard-shortcuts.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/advanced-search.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
// Initialize lt keyboard defaults (ESC closes modals, Ctrl+K focuses search, ? shows help)
|
||||
lt.keys.initDefaults();
|
||||
// Event delegation for all data-action handlers
|
||||
document.addEventListener('click', function(event) {
|
||||
const target = event.target.closest('[data-action]');
|
||||
@@ -882,10 +883,6 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
closeSettingsModal();
|
||||
break;
|
||||
|
||||
case 'close-settings-backdrop':
|
||||
if (event.target === target) closeSettingsModal();
|
||||
break;
|
||||
|
||||
case 'save-settings':
|
||||
saveSettings();
|
||||
break;
|
||||
@@ -906,10 +903,6 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
closeAdvancedSearch();
|
||||
break;
|
||||
|
||||
case 'close-advanced-search-backdrop':
|
||||
if (event.target === target) closeAdvancedSearch();
|
||||
break;
|
||||
|
||||
case 'reset-advanced-search':
|
||||
resetAdvancedSearch();
|
||||
break;
|
||||
|
||||
@@ -50,8 +50,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ticket #<?php echo $ticket['ticket_id']; ?></title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260131e">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css?v=20260131e">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/utils.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260131e"></script>
|
||||
@@ -61,9 +63,9 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
// CSRF Token for AJAX requests
|
||||
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
|
||||
// Timezone configuration (from server)
|
||||
window.APP_TIMEZONE = '<?php echo $GLOBALS['config']['TIMEZONE']; ?>';
|
||||
window.APP_TIMEZONE_OFFSET = <?php echo $GLOBALS['config']['TIMEZONE_OFFSET']; ?>; // minutes from UTC
|
||||
window.APP_TIMEZONE_ABBREV = '<?php echo $GLOBALS['config']['TIMEZONE_ABBREV']; ?>';
|
||||
window.APP_TIMEZONE = '<?php echo htmlspecialchars($GLOBALS['config']['TIMEZONE'] ?? 'UTC', ENT_QUOTES, 'UTF-8'); ?>';
|
||||
window.APP_TIMEZONE_OFFSET = <?php echo (int)($GLOBALS['config']['TIMEZONE_OFFSET'] ?? 0); ?>; // minutes from UTC
|
||||
window.APP_TIMEZONE_ABBREV = '<?php echo htmlspecialchars($GLOBALS['config']['TIMEZONE_ABBREV'] ?? 'UTC', ENT_QUOTES, 'UTF-8'); ?>';
|
||||
</script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
// Store ticket data in a global variable (using json_encode for XSS safety)
|
||||
@@ -653,15 +655,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
});
|
||||
}
|
||||
|
||||
// Settings modal backdrop click
|
||||
var settingsModal = document.getElementById('settingsModal');
|
||||
if (settingsModal) {
|
||||
settingsModal.addEventListener('click', function(e) {
|
||||
if (e.target.classList.contains('settings-modal')) {
|
||||
if (typeof closeSettingsModal === 'function') closeSettingsModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
// Settings modal backdrop click (lt-modal-overlay handles this via data-modal-close)
|
||||
|
||||
// Handle change events for data-action
|
||||
document.addEventListener('change', function(e) {
|
||||
@@ -688,17 +682,14 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</script>
|
||||
|
||||
<!-- Settings Modal (same as dashboard) -->
|
||||
<div class="settings-modal" id="settingsModal" style="display: none;" role="dialog" aria-modal="true" aria-labelledby="ticketSettingsTitle">
|
||||
<div class="settings-content">
|
||||
<span class="bottom-left-corner">╚</span>
|
||||
<span class="bottom-right-corner">╝</span>
|
||||
|
||||
<div class="settings-header">
|
||||
<h3 id="ticketSettingsTitle">⚙ System Preferences</h3>
|
||||
<button class="close-settings" id="closeSettingsBtn" aria-label="Close settings">✗</button>
|
||||
<div class="lt-modal-overlay" id="settingsModal" aria-hidden="true" role="dialog" aria-modal="true" aria-labelledby="ticketSettingsTitle">
|
||||
<div class="lt-modal">
|
||||
<div class="lt-modal-header">
|
||||
<span class="lt-modal-title" id="ticketSettingsTitle">⚙ System Preferences</span>
|
||||
<button class="lt-modal-close" data-modal-close aria-label="Close settings">✕</button>
|
||||
</div>
|
||||
|
||||
<div class="settings-body">
|
||||
<div class="lt-modal-body">
|
||||
<!-- Display Preferences -->
|
||||
<div class="settings-section">
|
||||
<h4>╔══ Display Preferences ══╗</h4>
|
||||
@@ -816,13 +807,15 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-footer">
|
||||
<button class="btn btn-primary" id="saveSettingsBtn">Save Preferences</button>
|
||||
<button class="btn btn-secondary" id="cancelSettingsBtn">Cancel</button>
|
||||
<div class="lt-modal-footer">
|
||||
<button class="lt-btn lt-btn-primary" id="saveSettingsBtn">Save Preferences</button>
|
||||
<button class="lt-btn lt-btn-ghost" id="cancelSettingsBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/keyboard-shortcuts.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/settings.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">lt.keys.initDefaults();</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -12,8 +12,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>API Keys - Admin</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Audit Log - Admin</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
|
||||
<script src="/web_template/base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="user-header">
|
||||
|
||||
@@ -12,8 +12,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Custom Fields - Admin</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
|
||||
</script>
|
||||
@@ -92,15 +94,15 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
|
||||
<!-- Create/Edit Modal -->
|
||||
<div class="settings-modal" id="fieldModal" style="display: none;" data-action="close-modal-backdrop">
|
||||
<div class="settings-content" style="max-width: 500px;">
|
||||
<div class="settings-header">
|
||||
<h3 id="modalTitle">Create Custom Field</h3>
|
||||
<button class="close-settings" data-action="close-modal">×</button>
|
||||
<div class="lt-modal-overlay" id="fieldModal" aria-hidden="true">
|
||||
<div class="lt-modal" style="max-width: 500px;">
|
||||
<div class="lt-modal-header">
|
||||
<span class="lt-modal-title" id="modalTitle">Create Custom Field</span>
|
||||
<button class="lt-modal-close" data-modal-close>✕</button>
|
||||
</div>
|
||||
<form id="fieldForm">
|
||||
<input type="hidden" id="field_id" name="field_id">
|
||||
<div class="settings-body">
|
||||
<div class="lt-modal-body">
|
||||
<div class="setting-row">
|
||||
<label for="field_name">Field Name * (internal)</label>
|
||||
<input type="text" id="field_name" name="field_name" required pattern="[a-z_]+" placeholder="e.g., server_name">
|
||||
@@ -146,9 +148,9 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<label><input type="checkbox" id="is_active" name="is_active" checked> Active</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-footer">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="close-modal">Cancel</button>
|
||||
<div class="lt-modal-footer">
|
||||
<button type="submit" class="lt-btn lt-btn-primary">Save</button>
|
||||
<button type="button" class="lt-btn lt-btn-ghost" data-modal-close>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -162,11 +164,11 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('field_id').value = '';
|
||||
document.getElementById('is_active').checked = true;
|
||||
toggleOptionsField();
|
||||
document.getElementById('fieldModal').style.display = 'flex';
|
||||
lt.modal.open('fieldModal');
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('fieldModal').style.display = 'none';
|
||||
lt.modal.close('fieldModal');
|
||||
}
|
||||
|
||||
// Event delegation for data-action handlers
|
||||
@@ -179,12 +181,6 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
case 'show-create-modal':
|
||||
showCreateModal();
|
||||
break;
|
||||
case 'close-modal':
|
||||
closeModal();
|
||||
break;
|
||||
case 'close-modal-backdrop':
|
||||
if (event.target === target) closeModal();
|
||||
break;
|
||||
case 'edit-field':
|
||||
editField(target.dataset.id);
|
||||
break;
|
||||
@@ -208,12 +204,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
saveField(e);
|
||||
});
|
||||
|
||||
// Close modal on ESC key
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
closeModal();
|
||||
}
|
||||
});
|
||||
lt.keys.initDefaults();
|
||||
|
||||
function toggleOptionsField() {
|
||||
const type = document.getElementById('field_type').value;
|
||||
@@ -255,7 +246,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
if (result.success) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
toast.error(result.error || 'Failed to save');
|
||||
lt.toast.error(result.error || 'Failed to save');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -279,7 +270,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('field_options').value = f.field_options.options.join('\n');
|
||||
}
|
||||
document.getElementById('modalTitle').textContent = 'Edit Custom Field';
|
||||
document.getElementById('fieldModal').style.display = 'flex';
|
||||
lt.modal.open('fieldModal');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,8 +12,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Recurring Tickets - Admin</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
|
||||
</script>
|
||||
@@ -107,15 +109,15 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
|
||||
<!-- Create/Edit Modal -->
|
||||
<div class="settings-modal" id="recurringModal" style="display: none;" data-action="close-modal-backdrop">
|
||||
<div class="settings-content" style="max-width: 800px; width: 90%;">
|
||||
<div class="settings-header">
|
||||
<h3 id="modalTitle">Create Recurring Ticket</h3>
|
||||
<button class="close-settings" data-action="close-modal">×</button>
|
||||
<div class="lt-modal-overlay" id="recurringModal" aria-hidden="true">
|
||||
<div class="lt-modal" style="max-width: 800px; width: 90%;">
|
||||
<div class="lt-modal-header">
|
||||
<span class="lt-modal-title" id="modalTitle">Create Recurring Ticket</span>
|
||||
<button class="lt-modal-close" data-modal-close>✕</button>
|
||||
</div>
|
||||
<form id="recurringForm">
|
||||
<input type="hidden" id="recurring_id" name="recurring_id">
|
||||
<div class="settings-body">
|
||||
<div class="lt-modal-body">
|
||||
<div class="setting-row">
|
||||
<label for="title_template">Title Template *</label>
|
||||
<input type="text" id="title_template" name="title_template" required style="width: 100%;" placeholder="Use {{date}}, {{month}}, etc.">
|
||||
@@ -181,9 +183,9 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-footer">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="close-modal">Cancel</button>
|
||||
<div class="lt-modal-footer">
|
||||
<button type="submit" class="lt-btn lt-btn-primary">Save</button>
|
||||
<button type="button" class="lt-btn lt-btn-ghost" data-modal-close>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -196,11 +198,11 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('recurringForm').reset();
|
||||
document.getElementById('recurring_id').value = '';
|
||||
updateScheduleOptions();
|
||||
document.getElementById('recurringModal').style.display = 'flex';
|
||||
lt.modal.open('recurringModal');
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('recurringModal').style.display = 'none';
|
||||
lt.modal.close('recurringModal');
|
||||
}
|
||||
|
||||
// Event delegation for data-action handlers
|
||||
@@ -213,12 +215,6 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
case 'show-create-modal':
|
||||
showCreateModal();
|
||||
break;
|
||||
case 'close-modal':
|
||||
closeModal();
|
||||
break;
|
||||
case 'close-modal-backdrop':
|
||||
if (event.target === target) closeModal();
|
||||
break;
|
||||
case 'edit-recurring':
|
||||
editRecurring(target.dataset.id);
|
||||
break;
|
||||
@@ -245,12 +241,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
saveRecurring(e);
|
||||
});
|
||||
|
||||
// Close modal on ESC key
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
closeModal();
|
||||
}
|
||||
});
|
||||
lt.keys.initDefaults();
|
||||
|
||||
function updateScheduleOptions() {
|
||||
const type = document.getElementById('schedule_type').value;
|
||||
@@ -296,7 +287,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
if (data.success) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
toast.error(data.error || 'Failed to save');
|
||||
lt.toast.error(data.error || 'Failed to save');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -342,7 +333,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('priority').value = rt.priority || 4;
|
||||
document.getElementById('assigned_to').value = rt.assigned_to || '';
|
||||
document.getElementById('modalTitle').textContent = 'Edit Recurring Ticket';
|
||||
document.getElementById('recurringModal').style.display = 'flex';
|
||||
lt.modal.open('recurringModal');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,8 +12,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Template Management - Admin</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
|
||||
</script>
|
||||
@@ -92,15 +94,15 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
|
||||
<!-- Create/Edit Modal -->
|
||||
<div class="settings-modal" id="templateModal" style="display: none;" data-action="close-modal-backdrop">
|
||||
<div class="settings-content" style="max-width: 800px; width: 90%;">
|
||||
<div class="settings-header">
|
||||
<h3 id="modalTitle">Create Template</h3>
|
||||
<button class="close-settings" data-action="close-modal">×</button>
|
||||
<div class="lt-modal-overlay" id="templateModal" aria-hidden="true">
|
||||
<div class="lt-modal" style="max-width: 800px; width: 90%;">
|
||||
<div class="lt-modal-header">
|
||||
<span class="lt-modal-title" id="modalTitle">Create Template</span>
|
||||
<button class="lt-modal-close" data-modal-close>✕</button>
|
||||
</div>
|
||||
<form id="templateForm">
|
||||
<input type="hidden" id="template_id" name="template_id">
|
||||
<div class="settings-body">
|
||||
<div class="lt-modal-body">
|
||||
<div class="setting-row">
|
||||
<label for="template_name">Template Name *</label>
|
||||
<input type="text" id="template_name" name="template_name" required style="width: 100%;">
|
||||
@@ -152,9 +154,9 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<label><input type="checkbox" id="is_active" name="is_active" checked> Active</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-footer">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="close-modal">Cancel</button>
|
||||
<div class="lt-modal-footer">
|
||||
<button type="submit" class="lt-btn lt-btn-primary">Save</button>
|
||||
<button type="button" class="lt-btn lt-btn-ghost" data-modal-close>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -169,11 +171,11 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('templateForm').reset();
|
||||
document.getElementById('template_id').value = '';
|
||||
document.getElementById('is_active').checked = true;
|
||||
document.getElementById('templateModal').style.display = 'flex';
|
||||
lt.modal.open('templateModal');
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('templateModal').style.display = 'none';
|
||||
lt.modal.close('templateModal');
|
||||
}
|
||||
|
||||
// Event delegation for data-action handlers
|
||||
@@ -186,12 +188,6 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
case 'show-create-modal':
|
||||
showCreateModal();
|
||||
break;
|
||||
case 'close-modal':
|
||||
closeModal();
|
||||
break;
|
||||
case 'close-modal-backdrop':
|
||||
if (event.target === target) closeModal();
|
||||
break;
|
||||
case 'edit-template':
|
||||
editTemplate(target.dataset.id);
|
||||
break;
|
||||
@@ -206,12 +202,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
saveTemplate(e);
|
||||
});
|
||||
|
||||
// Close modal on ESC key
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
closeModal();
|
||||
}
|
||||
});
|
||||
lt.keys.initDefaults();
|
||||
|
||||
function saveTemplate(e) {
|
||||
e.preventDefault();
|
||||
@@ -242,7 +233,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
if (result.success) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
toast.error(result.error || 'Failed to save');
|
||||
lt.toast.error(result.error || 'Failed to save');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -260,7 +251,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('priority').value = tpl.default_priority || 4;
|
||||
document.getElementById('is_active').checked = (tpl.is_active ?? 1) == 1;
|
||||
document.getElementById('modalTitle').textContent = 'Edit Template';
|
||||
document.getElementById('templateModal').style.display = 'flex';
|
||||
lt.modal.open('templateModal');
|
||||
}
|
||||
|
||||
function deleteTemplate(id) {
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>User Activity - Admin</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
|
||||
<script src="/web_template/base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="user-header">
|
||||
|
||||
@@ -12,8 +12,10 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Workflow Designer - Admin</title>
|
||||
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
|
||||
<link rel="stylesheet" href="/web_template/base.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
|
||||
<script nonce="<?php echo $nonce; ?>" src="/web_template/base.js"></script>
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
|
||||
</script>
|
||||
@@ -132,15 +134,15 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
</div>
|
||||
|
||||
<!-- Create/Edit Modal -->
|
||||
<div class="settings-modal" id="workflowModal" style="display: none;" data-action="close-modal-backdrop">
|
||||
<div class="settings-content" style="max-width: 450px;">
|
||||
<div class="settings-header">
|
||||
<h3 id="modalTitle">Create Transition</h3>
|
||||
<button class="close-settings" data-action="close-modal">×</button>
|
||||
<div class="lt-modal-overlay" id="workflowModal" aria-hidden="true">
|
||||
<div class="lt-modal" style="max-width: 450px;">
|
||||
<div class="lt-modal-header">
|
||||
<span class="lt-modal-title" id="modalTitle">Create Transition</span>
|
||||
<button class="lt-modal-close" data-modal-close>✕</button>
|
||||
</div>
|
||||
<form id="workflowForm">
|
||||
<input type="hidden" id="transition_id" name="transition_id">
|
||||
<div class="settings-body">
|
||||
<div class="lt-modal-body">
|
||||
<div class="setting-row">
|
||||
<label for="from_status">From Status *</label>
|
||||
<select id="from_status" name="from_status" required>
|
||||
@@ -169,9 +171,9 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
<label><input type="checkbox" id="is_active" name="is_active" checked> Active</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-footer">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="close-modal">Cancel</button>
|
||||
<div class="lt-modal-footer">
|
||||
<button type="submit" class="lt-btn lt-btn-primary">Save</button>
|
||||
<button type="button" class="lt-btn lt-btn-ghost" data-modal-close>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -186,11 +188,11 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('workflowForm').reset();
|
||||
document.getElementById('transition_id').value = '';
|
||||
document.getElementById('is_active').checked = true;
|
||||
document.getElementById('workflowModal').style.display = 'flex';
|
||||
lt.modal.open('workflowModal');
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('workflowModal').style.display = 'none';
|
||||
lt.modal.close('workflowModal');
|
||||
}
|
||||
|
||||
// Event delegation for data-action handlers
|
||||
@@ -203,12 +205,6 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
case 'show-create-modal':
|
||||
showCreateModal();
|
||||
break;
|
||||
case 'close-modal':
|
||||
closeModal();
|
||||
break;
|
||||
case 'close-modal-backdrop':
|
||||
if (event.target === target) closeModal();
|
||||
break;
|
||||
case 'edit-transition':
|
||||
editTransition(target.dataset.id);
|
||||
break;
|
||||
@@ -223,12 +219,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
saveTransition(e);
|
||||
});
|
||||
|
||||
// Close modal on ESC key
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
closeModal();
|
||||
}
|
||||
});
|
||||
lt.keys.initDefaults();
|
||||
|
||||
function saveTransition(e) {
|
||||
e.preventDefault();
|
||||
@@ -257,7 +248,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
if (result.success) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
toast.error(result.error || 'Failed to save');
|
||||
lt.toast.error(result.error || 'Failed to save');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -273,7 +264,7 @@ $nonce = SecurityHeadersMiddleware::getNonce();
|
||||
document.getElementById('requires_admin').checked = wf.requires_admin == 1;
|
||||
document.getElementById('is_active').checked = wf.is_active == 1;
|
||||
document.getElementById('modalTitle').textContent = 'Edit Transition';
|
||||
document.getElementById('workflowModal').style.display = 'flex';
|
||||
lt.modal.open('workflowModal');
|
||||
}
|
||||
|
||||
function deleteTransition(id) {
|
||||
|
||||
Reference in New Issue
Block a user