feat(exam-homework): add audit report, i18n, error boundaries, and permission hardening

- Add comprehensive audit report for exam and homework module

- Create exam-homework i18n message files (zh-CN + en) and register namespace

- Add permission check to gradeHomeworkSubmissionAction to prevent horizontal privilege escalation

- Add Error Boundary + loading.tsx for 5 key pages (exam build/proctoring, homework assignment/submissions, student assignment)

- Refactor exam-columns to createExamColumns(t) factory for i18n support

- Refactor exam-data-table to manage columns internally via useTranslations

- Replace hardcoded strings with i18n keys in all exam/homework components and pages

- Add getHomeworkSubmissionForGrading data-access for secure grading flow
This commit is contained in:
SpecialX
2026-06-22 16:08:39 +08:00
parent fde711ce46
commit 21c7e65fee
26 changed files with 2059 additions and 463 deletions

View File

@@ -0,0 +1,352 @@
{
"exam": {
"list": {
"title": "Exams",
"create": "Create Exam",
"empty": "No exams yet",
"emptyFiltered": "No exams match your filters",
"emptyDescription": "Create your first exam to start assigning and grading.",
"emptyFilteredDescription": "Try clearing filters or adjusting keywords.",
"clearFilters": "Clear filters",
"showing": "Showing",
"examsUnit": "exams",
"searchPlaceholder": "Search exams..."
},
"form": {
"createTitle": "Create Exam",
"createDescription": "Configure a new exam for your classes.",
"buildTitle": "Build Exam",
"buildDescription": "Assemble questions for your exam.",
"title": "Exam Title",
"subject": "Subject",
"grade": "Grade",
"difficulty": "Difficulty",
"totalScore": "Total Score",
"durationMin": "Duration (minutes)",
"scheduledAt": "Scheduled At",
"questions": "Questions",
"missingSubjectOrGrade": "Missing subject or grade configuration",
"previewBeforeCreate": "Please preview and confirm before creating",
"createSuccess": "Exam draft created",
"redirecting": "Redirecting to exam builder...",
"createFailed": "Failed to create exam",
"loadFormFailed": "Failed to load form data",
"loadSubjectsFailed": "Failed to load subjects",
"loadGradesFailed": "Failed to load grades"
},
"status": {
"draft": "Draft",
"published": "Published",
"archived": "Archived"
},
"difficulty": {
"1": "Easy",
"2": "Easy-Med",
"3": "Medium",
"4": "Med-Hard",
"5": "Hard"
},
"actions": {
"preview": "Preview Exam",
"copyId": "Copy ID",
"edit": "Edit",
"build": "Build",
"duplicate": "Duplicate",
"publish": "Publish",
"moveToDraft": "Move to Draft",
"archive": "Archive",
"delete": "Delete",
"deleteConfirmTitle": "Are you absolutely sure?",
"deleteConfirmDescription": "This action cannot be undone. This will permanently delete the exam \"{{title}}\" and remove all associated data.",
"cancel": "Cancel",
"deleteSuccess": "Exam deleted successfully",
"deleteFailed": "Failed to delete exam",
"publishSuccess": "Exam published",
"archiveSuccess": "Exam archived",
"draftSuccess": "Exam moved to draft",
"duplicateSuccess": "Exam duplicated",
"duplicateFailed": "Failed to duplicate exam",
"updateFailed": "Failed to update exam",
"previewFailed": "Failed to load exam preview",
"idCopied": "Exam ID copied to clipboard",
"openMenu": "Open menu",
"selectRow": "Select row",
"selectAll": "Select all",
"noQuestions": "No questions in this exam.",
"loadingPreview": "Loading preview..."
},
"columns": {
"examInfo": "Exam Info",
"status": "Status",
"stats": "Stats",
"difficulty": "Difficulty",
"date": "Date",
"scheduled": "Scheduled",
"created": "Created",
"questions": "Qs",
"points": "Pts"
},
"filters": {
"status": "Status",
"anyStatus": "Any Status",
"difficulty": "Difficulty",
"anyDifficulty": "Any Difficulty"
},
"error": {
"notFound": "Exam not found",
"loadFailed": "Failed to load exam"
}
},
"homework": {
"list": {
"title": "Assignments",
"description": "Manage assignments, view submission rates and grading progress.",
"create": "Create Assignment",
"empty": "No assignments yet",
"emptyFiltered": "No assignments in this class.",
"emptyDescription": "You haven't created any assignments yet.",
"clearFilters": "Clear filters",
"filterByClass": "Filter by class: {{className}}",
"columns": {
"title": "Title",
"status": "Status",
"dueAt": "Due Date",
"submissionRate": "Submission Rate",
"averageScore": "Average Score",
"overdue": "Overdue",
"sourceExam": "Source Exam",
"createdAt": "Created At"
},
"pagination": {
"itemLabel": "assignments"
}
},
"form": {
"createTitle": "Create Assignment",
"quickMode": "Quick Assignment",
"quickModeDescription": "Enter title and description directly, no questions needed",
"examMode": "Exam-based Assignment",
"examModeDescription": "Derive assignment from an existing exam",
"class": "Class",
"selectClass": "Select a class",
"sourceExam": "Source Exam",
"selectExam": "Select an exam",
"assignmentTitle": "Assignment Title",
"titlePlaceholderQuick": "e.g. Recite Lesson 3",
"titlePlaceholderExam": "Defaults to exam title",
"description": "Description (optional)",
"descriptionPlaceholderQuick": "Enter assignment requirements, question content, or instructions...",
"availableAt": "Available At (optional)",
"dueAt": "Due At (optional)",
"allowLate": "Allow late submissions",
"lateDueAt": "Late Due At (optional)",
"maxAttempts": "Max Attempts",
"submit": "Create Assignment",
"submitting": "Creating...",
"creating": "Creating assignment...",
"selectExamRequired": "Please select an exam",
"titleRequired": "Please enter a title",
"selectClassRequired": "Please select a class",
"createSuccess": "Assignment created",
"createFailed": "Failed to create"
},
"take": {
"questions": "Questions",
"question": "Question {{index}}",
"points": "points",
"startAssignment": "Start Assignment",
"submitAssignment": "Submit Assignment",
"submitAll": "Submit All",
"saveAnswer": "Save Answer",
"saved": "Saved",
"saveFailed": "Failed to save",
"starting": "Starting...",
"submitting": "Submitting...",
"started": "Started",
"submitted": "Submitted",
"notStarted": "Not Started",
"readyToStart": "Ready to start?",
"readyDescription": "Click the \"Start Assignment\" button above to begin. Your answers will be saved when you click \"Save Answer\".",
"startNow": "Start Now",
"back": "Back",
"confirmSubmit": "Confirm Submission",
"confirmSubmitDescription": "All questions have been answered. Submitted answers cannot be changed. Are you sure you want to submit?",
"unansweredWarning": "You have {{count}} unanswered question(s). Submitted answers cannot be changed. Are you sure you want to submit?",
"cancel": "Cancel",
"confirmSubmitAction": "Confirm Submit",
"submitSuccess": "Submitted",
"submitFailed": "Failed to submit",
"startSuccess": "Started",
"startFailed": "Failed to start",
"assignmentInfo": "Assignment Info",
"status": "Status",
"dueDate": "Due Date",
"overdue": "Overdue",
"hoursLeft": "{{hours}} hour(s) left",
"lessThanOneHour": "Less than 1 hour left",
"attempts": "Attempts",
"attemptsUsed": "{{used}} / {{max}} used",
"attemptsRemaining": "· {{remaining}} remaining",
"description": "Description",
"noDescription": "No description provided.",
"progress": "Progress",
"jumpToQuestion": "Jump to question {{index}}",
"yourAnswer": "Your answer",
"answerPlaceholder": "Type your answer here...",
"true": "True",
"false": "False",
"unsupportedType": "Unsupported question type",
"teacherFeedback": "Teacher Feedback",
"noFeedback": "No specific feedback provided.",
"makeSureAnswered": "Make sure you have answered all questions."
},
"grade": {
"title": "Grade",
"submissions": "Submissions",
"student": "Student",
"status": "Status",
"submitted": "Submitted",
"score": "Score",
"action": "Action",
"back": "Back",
"openAssignment": "Open Assignment",
"late": "Late",
"targets": "Targets",
"submittedCount": "Submitted",
"gradedCount": "Graded",
"exam": "Exam",
"gradingSummary": "Grading Summary",
"totalScore": "Total Score",
"correct": "Correct",
"incorrect": "Incorrect",
"partial": "Partial",
"questionStatus": "Question Status",
"studentAnswer": "Student Answer",
"referenceAnswer": "Reference Answer",
"noReferenceAnswer": "No reference answer provided.",
"noQuestionText": "No question text",
"autoGraded": "Auto-graded",
"correctButton": "Correct",
"incorrectButton": "Incorrect",
"scoreLabel": "Score",
"addFeedback": "Add Feedback",
"hideFeedback": "Hide Feedback",
"feedbackPlaceholder": "Provide feedback for {{name}}...",
"submitGrades": "Submit Grades",
"saving": "Saving...",
"gradesSaved": "Grading saved successfully",
"gradesSaveFailed": "Failed to save grading",
"previousStudent": "Previous Student",
"nextStudent": "Next Student",
"prev": "Prev",
"next": "Next",
"gradesAutoSaveNote": "Grades are saved automatically when you click Submit. Students will see their grades and feedback immediately after you submit."
},
"review": {
"title": "Review",
"yourAnswer": "Your Answer",
"correctAnswer": "Correct Answer",
"teacherFeedback": "Teacher Feedback",
"score": "Score",
"maxScore": "Max Score"
},
"status": {
"draft": "Draft",
"published": "Published",
"archived": "Archived",
"started": "Started",
"submitted": "Submitted",
"graded": "Graded",
"not_started": "Not Started",
"in_progress": "In Progress"
},
"error": {
"notFound": "Assignment not found",
"submissionNotFound": "Submission not found",
"unauthorized": "Unauthorized",
"submissionLocked": "Submission is locked",
"pastDue": "Past due",
"pastLateDue": "Past late due",
"noActiveStudents": "No active students in this class",
"classNotFound": "Class not found",
"examNotFound": "Exam not found",
"examSubjectNotSet": "Exam subject not set",
"notAssignedToClass": "Not assigned to this class",
"notAssignedToSubject": "Not assigned to this subject",
"notAssigned": "Not assigned",
"notAvailableYet": "Not available yet",
"noAttemptsLeft": "No attempts left",
"assignmentNotFound": "Assignment not found",
"assignmentNotAvailable": "Assignment not available"
}
},
"proctoring": {
"mode": {
"title": "Exam Mode",
"description": "Select exam mode and configure options. Proctored mode enables anti-cheat monitoring.",
"homework": "Homework Mode",
"timed": "Timed Mode",
"proctored": "Proctored Mode",
"homeworkDescription": "Students can answer at any time, no time limit",
"timedDescription": "Timed answering, auto-submit on timeout",
"proctoredDescription": "Timed + anti-cheat + forced fullscreen"
},
"config": {
"duration": "Duration (minutes)",
"durationTimedDescription": "Auto-submit after timeout when student starts",
"durationProctoredDescription": "Required in proctored mode",
"shuffleQuestions": "Shuffle Questions",
"shuffleQuestionsDescription": "Each student sees questions in random order",
"antiCheat": "Enable Anti-cheat Monitoring",
"antiCheatDescription": "Monitor tab switch, copy, right-click, devtools, etc.",
"allowLateStart": "Allow Late Start",
"allowLateStartDescription": "Allow students to enter within a grace period after exam starts",
"lateStartGrace": "Late Start Grace (minutes)",
"lateStartGraceDescription": "No new students allowed after this time"
},
"dashboard": {
"title": "Proctoring Dashboard",
"summary": "Summary",
"students": "Students",
"recentEvents": "Recent Events",
"noEvents": "No events",
"eventCount": "Event Count",
"abnormalCount": "Abnormal Count"
},
"events": {
"tab_switch": "Tab Switch",
"window_blur": "Window Blur",
"copy_attempt": "Copy Attempt",
"paste_attempt": "Paste Attempt",
"right_click": "Right Click",
"devtools_open": "DevTools Open",
"fullscreen_exit": "Fullscreen Exit",
"idle_timeout": "Idle Timeout"
}
},
"common": {
"loading": "Loading...",
"save": "Save",
"cancel": "Cancel",
"confirm": "Confirm",
"back": "Back",
"edit": "Edit",
"delete": "Delete",
"create": "Create",
"search": "Search",
"filter": "Filter",
"noResults": "No results",
"error": "Error",
"success": "Success",
"failed": "Failed",
"retry": "Retry",
"page": "Page",
"of": "of",
"selected": "selected",
"rows": "row(s)",
"view": "View",
"continue": "Continue",
"other": "Other",
"completed": "Completed"
}
}