This commit introduces a complete announcement management system for HVAC trainers with enterprise-grade security, performance optimization, and email notifications. ## Core Features - Custom post type for trainer announcements with categories and tags - Role-based permissions (master trainers can create/edit, all trainers can read) - AJAX-powered admin interface with real-time updates - Modal popup viewing for announcements on frontend - Automated email notifications when announcements are published - Google Drive integration for training resources ## Security Enhancements - Fixed critical capability mapping bug preventing proper permission checks - Added content disclosure protection for draft/private announcements - Fixed XSS vulnerabilities with proper output escaping and sanitization - Implemented permission checks on all AJAX endpoints - Added rate limiting to prevent abuse (30 requests/minute) - Email validation before sending notifications ## Performance Optimizations - Implemented intelligent caching for user queries (5-minute TTL) - Added cache versioning for announcement lists (2-minute TTL) - Automatic cache invalidation on content changes - Batch email processing to prevent timeouts (50 emails per batch) - Retry mechanism for failed email sends (max 3 attempts) ## Technical Implementation - Singleton pattern for all manager classes - WordPress coding standards compliance - Proper nonce verification on all AJAX requests - Comprehensive error handling and logging - Mobile-responsive UI with smooth animations - WCAG accessibility compliance ## Components Added - 6 PHP classes for modular architecture - 2 page templates (master announcements, trainer resources) - Admin and frontend JavaScript with jQuery integration - Comprehensive CSS for both admin and frontend - Email notification system with HTML templates - Complete documentation and implementation plans This system provides a secure, scalable foundation for trainer communications while following WordPress best practices and maintaining high code quality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			363 lines
		
	
	
		
			No EOL
		
	
	
		
			5.9 KiB
		
	
	
	
		
			CSS
		
	
	
	
	
	
			
		
		
	
	
			363 lines
		
	
	
		
			No EOL
		
	
	
		
			5.9 KiB
		
	
	
	
		
			CSS
		
	
	
	
	
	
| /**
 | |
|  * HVAC Announcements Admin Styles
 | |
|  *
 | |
|  * @package HVAC_Community_Events
 | |
|  */
 | |
| 
 | |
| /* Page Layout */
 | |
| .hvac-master-announcements-page {
 | |
|     padding: 20px 0;
 | |
| }
 | |
| 
 | |
| .hvac-announcements-wrapper {
 | |
|     max-width: 1200px;
 | |
|     margin: 0 auto;
 | |
|     padding: 20px;
 | |
|     background: #fff;
 | |
|     border-radius: 8px;
 | |
|     box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
 | |
| }
 | |
| 
 | |
| /* Page Header */
 | |
| .page-header {
 | |
|     display: flex;
 | |
|     justify-content: space-between;
 | |
|     align-items: center;
 | |
|     margin-bottom: 30px;
 | |
|     padding-bottom: 20px;
 | |
|     border-bottom: 2px solid #e0e0e0;
 | |
| }
 | |
| 
 | |
| .page-header h1 {
 | |
|     margin: 0;
 | |
|     font-size: 28px;
 | |
|     color: #003366;
 | |
| }
 | |
| 
 | |
| #add-announcement-btn {
 | |
|     display: flex;
 | |
|     align-items: center;
 | |
|     gap: 5px;
 | |
|     padding: 10px 20px;
 | |
|     font-size: 14px;
 | |
| }
 | |
| 
 | |
| /* Controls */
 | |
| .announcements-controls {
 | |
|     display: flex;
 | |
|     justify-content: space-between;
 | |
|     align-items: center;
 | |
|     margin-bottom: 20px;
 | |
|     padding: 15px;
 | |
|     background: #f5f5f5;
 | |
|     border-radius: 4px;
 | |
| }
 | |
| 
 | |
| .filter-group {
 | |
|     display: flex;
 | |
|     align-items: center;
 | |
|     gap: 10px;
 | |
| }
 | |
| 
 | |
| .filter-select {
 | |
|     padding: 5px 10px;
 | |
|     border: 1px solid #ddd;
 | |
|     border-radius: 4px;
 | |
| }
 | |
| 
 | |
| .search-group {
 | |
|     display: flex;
 | |
|     gap: 5px;
 | |
| }
 | |
| 
 | |
| #announcement-search {
 | |
|     width: 250px;
 | |
|     padding: 5px 10px;
 | |
|     border: 1px solid #ddd;
 | |
|     border-radius: 4px;
 | |
| }
 | |
| 
 | |
| /* Table */
 | |
| .announcements-table-wrapper {
 | |
|     overflow-x: auto;
 | |
| }
 | |
| 
 | |
| #announcements-table {
 | |
|     width: 100%;
 | |
|     border-collapse: collapse;
 | |
| }
 | |
| 
 | |
| #announcements-table th {
 | |
|     background: #f0f0f0;
 | |
|     font-weight: 600;
 | |
|     text-align: left;
 | |
|     padding: 10px;
 | |
| }
 | |
| 
 | |
| #announcements-table td {
 | |
|     padding: 10px;
 | |
|     border-top: 1px solid #e0e0e0;
 | |
| }
 | |
| 
 | |
| #announcements-table .no-items {
 | |
|     text-align: center;
 | |
|     color: #666;
 | |
|     font-style: italic;
 | |
| }
 | |
| 
 | |
| /* Status badges */
 | |
| .status-publish {
 | |
|     display: inline-block;
 | |
|     padding: 2px 8px;
 | |
|     background: #4caf50;
 | |
|     color: white;
 | |
|     border-radius: 3px;
 | |
|     font-size: 12px;
 | |
| }
 | |
| 
 | |
| .status-draft {
 | |
|     display: inline-block;
 | |
|     padding: 2px 8px;
 | |
|     background: #ff9800;
 | |
|     color: white;
 | |
|     border-radius: 3px;
 | |
|     font-size: 12px;
 | |
| }
 | |
| 
 | |
| .status-private {
 | |
|     display: inline-block;
 | |
|     padding: 2px 8px;
 | |
|     background: #9c27b0;
 | |
|     color: white;
 | |
|     border-radius: 3px;
 | |
|     font-size: 12px;
 | |
| }
 | |
| 
 | |
| /* Column widths */
 | |
| .column-title { width: 30%; }
 | |
| .column-status { width: 10%; }
 | |
| .column-categories { width: 20%; }
 | |
| .column-author { width: 15%; }
 | |
| .column-date { width: 15%; }
 | |
| .column-actions { width: 10%; text-align: right; }
 | |
| 
 | |
| /* Action buttons */
 | |
| .column-actions .button-small {
 | |
|     padding: 2px 8px;
 | |
|     font-size: 12px;
 | |
|     margin-left: 5px;
 | |
| }
 | |
| 
 | |
| /* Pagination */
 | |
| .announcements-pagination {
 | |
|     display: flex;
 | |
|     justify-content: center;
 | |
|     align-items: center;
 | |
|     gap: 20px;
 | |
|     margin-top: 20px;
 | |
|     padding-top: 20px;
 | |
|     border-top: 1px solid #e0e0e0;
 | |
| }
 | |
| 
 | |
| .page-info {
 | |
|     color: #666;
 | |
| }
 | |
| 
 | |
| /* Modal */
 | |
| .hvac-modal {
 | |
|     position: fixed;
 | |
|     top: 0;
 | |
|     left: 0;
 | |
|     width: 100%;
 | |
|     height: 100%;
 | |
|     background: rgba(0, 0, 0, 0.5);
 | |
|     z-index: 999999;
 | |
|     display: flex;
 | |
|     justify-content: center;
 | |
|     align-items: center;
 | |
| }
 | |
| 
 | |
| .modal-content {
 | |
|     background: white;
 | |
|     width: 90%;
 | |
|     max-width: 800px;
 | |
|     max-height: 90vh;
 | |
|     overflow-y: auto;
 | |
|     border-radius: 8px;
 | |
|     box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
 | |
| }
 | |
| 
 | |
| .modal-header {
 | |
|     display: flex;
 | |
|     justify-content: space-between;
 | |
|     align-items: center;
 | |
|     padding: 20px;
 | |
|     border-bottom: 1px solid #e0e0e0;
 | |
| }
 | |
| 
 | |
| .modal-header h2 {
 | |
|     margin: 0;
 | |
|     color: #003366;
 | |
| }
 | |
| 
 | |
| .modal-close {
 | |
|     background: none;
 | |
|     border: none;
 | |
|     font-size: 28px;
 | |
|     cursor: pointer;
 | |
|     color: #666;
 | |
|     padding: 0;
 | |
|     width: 30px;
 | |
|     height: 30px;
 | |
|     display: flex;
 | |
|     align-items: center;
 | |
|     justify-content: center;
 | |
| }
 | |
| 
 | |
| .modal-close:hover {
 | |
|     color: #000;
 | |
| }
 | |
| 
 | |
| .modal-body {
 | |
|     padding: 20px;
 | |
| }
 | |
| 
 | |
| .modal-footer {
 | |
|     display: flex;
 | |
|     justify-content: flex-end;
 | |
|     gap: 10px;
 | |
|     padding: 20px;
 | |
|     border-top: 1px solid #e0e0e0;
 | |
|     background: #f5f5f5;
 | |
| }
 | |
| 
 | |
| /* Form */
 | |
| .form-group {
 | |
|     margin-bottom: 20px;
 | |
| }
 | |
| 
 | |
| .form-group label {
 | |
|     display: block;
 | |
|     margin-bottom: 5px;
 | |
|     font-weight: 600;
 | |
|     color: #333;
 | |
| }
 | |
| 
 | |
| .form-group input[type="text"],
 | |
| .form-group input[type="datetime-local"],
 | |
| .form-group textarea,
 | |
| .form-group select {
 | |
|     width: 100%;
 | |
|     padding: 8px 12px;
 | |
|     border: 1px solid #ddd;
 | |
|     border-radius: 4px;
 | |
|     font-size: 14px;
 | |
| }
 | |
| 
 | |
| .form-group textarea {
 | |
|     resize: vertical;
 | |
| }
 | |
| 
 | |
| .form-row {
 | |
|     display: grid;
 | |
|     grid-template-columns: 1fr 1fr;
 | |
|     gap: 20px;
 | |
| }
 | |
| 
 | |
| .required {
 | |
|     color: #d32f2f;
 | |
| }
 | |
| 
 | |
| /* Categories */
 | |
| #categories-container {
 | |
|     display: flex;
 | |
|     flex-wrap: wrap;
 | |
|     gap: 15px;
 | |
| }
 | |
| 
 | |
| .category-checkbox {
 | |
|     display: flex;
 | |
|     align-items: center;
 | |
|     cursor: pointer;
 | |
| }
 | |
| 
 | |
| .category-checkbox input {
 | |
|     margin-right: 5px;
 | |
| }
 | |
| 
 | |
| /* Featured Image */
 | |
| .featured-image-container {
 | |
|     display: flex;
 | |
|     flex-direction: column;
 | |
|     gap: 10px;
 | |
| }
 | |
| 
 | |
| #featured-image-preview {
 | |
|     max-width: 300px;
 | |
| }
 | |
| 
 | |
| #featured-image-preview img {
 | |
|     max-width: 100%;
 | |
|     height: auto;
 | |
|     border: 1px solid #ddd;
 | |
|     border-radius: 4px;
 | |
| }
 | |
| 
 | |
| /* Notices */
 | |
| .notice {
 | |
|     padding: 12px;
 | |
|     margin: 10px 0;
 | |
|     border-left: 4px solid;
 | |
|     background: #fff;
 | |
|     box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
 | |
| }
 | |
| 
 | |
| .notice-success {
 | |
|     border-left-color: #4caf50;
 | |
|     background: #f0f8f0;
 | |
| }
 | |
| 
 | |
| .notice-error {
 | |
|     border-left-color: #d32f2f;
 | |
|     background: #fff5f5;
 | |
| }
 | |
| 
 | |
| /* Responsive */
 | |
| @media (max-width: 768px) {
 | |
|     .page-header {
 | |
|         flex-direction: column;
 | |
|         align-items: flex-start;
 | |
|         gap: 15px;
 | |
|     }
 | |
|     
 | |
|     .announcements-controls {
 | |
|         flex-direction: column;
 | |
|         gap: 15px;
 | |
|     }
 | |
|     
 | |
|     .search-group {
 | |
|         width: 100%;
 | |
|     }
 | |
|     
 | |
|     #announcement-search {
 | |
|         flex: 1;
 | |
|     }
 | |
|     
 | |
|     .form-row {
 | |
|         grid-template-columns: 1fr;
 | |
|     }
 | |
|     
 | |
|     .modal-content {
 | |
|         width: 95%;
 | |
|         margin: 20px;
 | |
|     }
 | |
|     
 | |
|     #announcements-table {
 | |
|         font-size: 14px;
 | |
|     }
 | |
|     
 | |
|     .column-categories,
 | |
|     .column-author {
 | |
|         display: none;
 | |
|     }
 | |
| } |