This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
breakpilot-pwa/h5p-service/editors/quiz-editor.html
Benjamin Admin 21a844cb8a fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.

This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).

Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:51:32 +01:00

381 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quiz Editor - BreakPilot H5P</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f5f5f5;
padding: 20px;
}
.container {
background: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 30px;
max-width: 900px;
margin: 0 auto;
}
h1 {
color: #333;
margin-bottom: 24px;
display: flex;
align-items: center;
gap: 12px;
}
.form-group {
margin-bottom: 24px;
}
label {
display: block;
font-weight: 600;
color: #374151;
margin-bottom: 8px;
}
input[type="text"], textarea {
width: 100%;
padding: 10px 14px;
border: 2px solid #e5e7eb;
border-radius: 6px;
font-size: 14px;
font-family: inherit;
transition: border-color 0.2s;
}
input[type="text"]:focus, textarea:focus {
outline: none;
border-color: #667eea;
}
textarea {
resize: vertical;
min-height: 80px;
}
.question-card {
background: #f9fafb;
border: 2px solid #e5e7eb;
border-radius: 8px;
padding: 20px;
margin-bottom: 16px;
}
.question-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
.question-number {
font-weight: 600;
color: #667eea;
font-size: 16px;
}
.answer-option {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
padding: 12px;
background: white;
border-radius: 6px;
border: 2px solid #e5e7eb;
}
.answer-option.correct {
border-color: #10b981;
background: #f0fdf4;
}
.answer-option input[type="text"] {
flex: 1;
border: none;
background: transparent;
padding: 4px 8px;
}
.answer-option input[type="text"]:focus {
background: white;
border: 1px solid #667eea;
border-radius: 4px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #5568d3;
}
.btn-secondary {
background: #e5e7eb;
color: #374151;
}
.btn-secondary:hover {
background: #d1d5db;
}
.btn-danger {
background: #ef4444;
color: white;
}
.btn-danger:hover {
background: #dc2626;
}
.btn-success {
background: #10b981;
color: white;
}
.btn-success:hover {
background: #059669;
}
.btn-group {
display: flex;
gap: 12px;
margin-top: 24px;
}
.checkbox-label {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
font-weight: normal;
}
input[type="checkbox"] {
width: 18px;
height: 18px;
cursor: pointer;
}
.success-message {
background: #d1fae5;
border: 2px solid #10b981;
color: #065f46;
padding: 16px;
border-radius: 6px;
margin-bottom: 20px;
display: none;
}
.add-question-btn {
width: 100%;
padding: 16px;
border: 2px dashed #9ca3af;
background: transparent;
color: #6b7280;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
transition: all 0.2s;
}
.add-question-btn:hover {
border-color: #667eea;
color: #667eea;
background: #f9fafb;
}
</style>
</head>
<body>
<div class="container">
<h1>
<span>✍️</span>
Quiz Editor (Question Set)
</h1>
<div class="success-message" id="successMessage">
✅ Quiz erfolgreich gespeichert!
</div>
<div class="form-group">
<label for="quizTitle">Quiz Titel</label>
<input type="text" id="quizTitle" placeholder="z.B. Mathematik Grundlagen Quiz">
</div>
<div class="form-group">
<label for="quizDescription">Beschreibung (optional)</label>
<textarea id="quizDescription" placeholder="Kurze Beschreibung des Quiz..."></textarea>
</div>
<div id="questionsContainer">
<!-- Questions will be added here -->
</div>
<button class="add-question-btn" onclick="addQuestion()">
+ Neue Frage hinzufügen
</button>
<div class="btn-group">
<button class="btn btn-primary" onclick="saveQuiz()">💾 Quiz speichern</button>
<button class="btn btn-secondary" onclick="previewQuiz()">👁️ Vorschau</button>
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
</div>
</div>
<script>
let questions = [];
function addQuestion() {
const questionId = Date.now();
questions.push({
id: questionId,
text: '',
answers: [
{ text: '', correct: true },
{ text: '', correct: false },
{ text: '', correct: false },
{ text: '', correct: false }
]
});
renderQuestions();
}
function removeQuestion(questionId) {
if (confirm('Frage wirklich löschen?')) {
questions = questions.filter(q => q.id !== questionId);
renderQuestions();
}
}
function toggleCorrectAnswer(questionId, answerIndex) {
const question = questions.find(q => q.id === questionId);
if (question) {
// Toggle correct answer
question.answers[answerIndex].correct = !question.answers[answerIndex].correct;
renderQuestions();
}
}
function updateQuestionText(questionId, text) {
const question = questions.find(q => q.id === questionId);
if (question) {
question.text = text;
}
}
function updateAnswerText(questionId, answerIndex, text) {
const question = questions.find(q => q.id === questionId);
if (question) {
question.answers[answerIndex].text = text;
}
}
function renderQuestions() {
const container = document.getElementById('questionsContainer');
container.innerHTML = '';
questions.forEach((question, qIndex) => {
const questionCard = document.createElement('div');
questionCard.className = 'question-card';
questionCard.innerHTML = `
<div class="question-header">
<span class="question-number">Frage ${qIndex + 1}</span>
<button class="btn btn-danger" onclick="removeQuestion(${question.id})">🗑️ Löschen</button>
</div>
<div class="form-group">
<label>Frage:</label>
<input type="text"
value="${question.text}"
onchange="updateQuestionText(${question.id}, this.value)"
placeholder="Gib hier deine Frage ein...">
</div>
<div class="form-group">
<label>Antwortmöglichkeiten (Markiere richtige Antworten):</label>
${question.answers.map((answer, aIndex) => `
<div class="answer-option ${answer.correct ? 'correct' : ''}">
<label class="checkbox-label">
<input type="checkbox"
${answer.correct ? 'checked' : ''}
onchange="toggleCorrectAnswer(${question.id}, ${aIndex})">
<span>${answer.correct ? '✓ Richtig' : 'Falsch'}</span>
</label>
<input type="text"
value="${answer.text}"
onchange="updateAnswerText(${question.id}, ${aIndex}, this.value)"
placeholder="Antwort ${aIndex + 1}">
</div>
`).join('')}
</div>
`;
container.appendChild(questionCard);
});
}
function saveQuiz() {
const title = document.getElementById('quizTitle').value;
const description = document.getElementById('quizDescription').value;
if (!title) {
alert('Bitte gib einen Titel für das Quiz ein!');
return;
}
if (questions.length === 0) {
alert('Bitte füge mindestens eine Frage hinzu!');
return;
}
// Validate questions
for (let i = 0; i < questions.length; i++) {
const q = questions[i];
if (!q.text) {
alert(`Frage ${i + 1} hat keinen Text!`);
return;
}
const hasCorrectAnswer = q.answers.some(a => a.correct);
if (!hasCorrectAnswer) {
alert(`Frage ${i + 1} hat keine richtige Antwort markiert!`);
return;
}
const filledAnswers = q.answers.filter(a => a.text).length;
if (filledAnswers < 2) {
alert(`Frage ${i + 1} benötigt mindestens 2 Antworten!`);
return;
}
}
const quizData = {
type: 'quiz',
title,
description,
questions,
created: new Date().toISOString()
};
// Save to localStorage for now
const contentId = 'quiz_' + Date.now();
localStorage.setItem(contentId, JSON.stringify(quizData));
// Show success message
const successMsg = document.getElementById('successMessage');
successMsg.style.display = 'block';
setTimeout(() => {
successMsg.style.display = 'none';
}, 3000);
console.log('Quiz gespeichert:', quizData);
}
function previewQuiz() {
const title = document.getElementById('quizTitle').value;
if (!title || questions.length === 0) {
alert('Bitte fülle erst den Titel und mindestens eine Frage aus!');
return;
}
// Open preview in new window
const previewData = encodeURIComponent(JSON.stringify({
title,
description: document.getElementById('quizDescription').value,
questions
}));
window.open(`/h5p/player/quiz?data=${previewData}`, '_blank');
}
// Initialize with one question
addQuestion();
</script>
</body>
</html>