Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 90da8487f2 | |||
| b1ca358d41 | |||
| 47cba5865d |
+388
-274
File diff suppressed because it is too large
Load Diff
@@ -232,6 +232,16 @@
|
||||
<h1>📚 Bibliotheksausweise (Bibliothek)</h1>
|
||||
</div>
|
||||
<div class="export-buttons">
|
||||
<form method="GET" action="{{ url_for('student_card_class_barcode_download') }}" style="display: inline-flex; gap: 5px; align-items: center; background: white; padding: 2px; border-radius: 4px; border: 1px solid #ddd;">
|
||||
<select name="class_name" required style="border: none; padding: 8px; outline: none; font-size: 14px; background: transparent; cursor: pointer;">
|
||||
<option value="" disabled selected>-- Klasse wählen --</option>
|
||||
{% for cls in available_classes %}
|
||||
<option value="{{ cls }}">{{ cls }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit" class="btn-print" style="background: #17a2b8; padding: 8px 12px; margin: 0;">📤 PDF</button>
|
||||
</form>
|
||||
|
||||
<a href="{{ url_for('student_card_barcode_download') }}" class="btn-print" style="background: #28a745;">📥 Alle Ausweise (PDF)</a>
|
||||
<a href="{{ url_for('library_admin') }}" class="btn btn-primary">← Zur Bibliotheks-Upload</a>
|
||||
</div>
|
||||
|
||||
@@ -836,7 +836,7 @@
|
||||
<!-- Options will be loaded by JavaScript -->
|
||||
</select>
|
||||
</div>
|
||||
<div class="formupload_admin-group">
|
||||
<div class="form-group">
|
||||
<label for="filter2-4">Wert 4:</label>
|
||||
<select id="filter2-4" name="filter2" class="filter-dropdown-select">
|
||||
<option value="">-- Optional --</option>
|
||||
@@ -876,11 +876,11 @@
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Image upload (hidden for library mode) -->
|
||||
<!-- Image upload -->
|
||||
<div class="form-group">
|
||||
<label for="images">Bilder/Videos:</label>
|
||||
<input type="file" id="images" name="images" accept=".jpg, .jpeg, .png, .gif, .mp4, .mov, .avi, .mkv, .webm, .flv, .m4v, .3gp" multiple>
|
||||
<div class="allowed-formats">Erlaubte Formate: JPG, JPEG, PNG, GIF, MP4, MOV, AVI, MKV, WEBM, FLV, M4V, 3GP</div>
|
||||
<label for="images">Bilder:</label>
|
||||
<input type="file" id="images" name="images" accept=".jpg, .jpeg, .png, .gif" multiple>
|
||||
<div class="allowed-formats">Erlaubte Formate: JPG, JPEG, PNG, GIF</div>
|
||||
<!-- Add image preview area -->
|
||||
<div class="image-preview-container" id="image-preview-container"></div>
|
||||
</div>
|
||||
@@ -1857,28 +1857,25 @@
|
||||
function setupImagePreview() {
|
||||
const imageInput = document.getElementById('images');
|
||||
const previewContainer = document.getElementById('image-preview-container');
|
||||
|
||||
|
||||
if (imageInput && previewContainer) {
|
||||
imageInput.addEventListener('change', function(e) {
|
||||
previewContainer.innerHTML = '';
|
||||
|
||||
|
||||
const files = e.target.files;
|
||||
|
||||
// Validate file types before preview
|
||||
const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif',
|
||||
'video/mp4', 'video/quicktime', 'video/x-msvideo', 'video/x-matroska',
|
||||
'video/webm', 'video/x-flv', 'video/mp4', 'video/3gpp'];
|
||||
let hasInvalidFile = false;
|
||||
|
||||
|
||||
// Validate file types before preview (Strictly Images)
|
||||
const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'];
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
if (!allowedTypes.includes(files[i].type)) {
|
||||
hasInvalidFile = true;
|
||||
// Clear the file input to prevent submission
|
||||
imageInput.value = '';
|
||||
previewContainer.innerHTML = '<div class="error-message">Fehler: Datei "' + files[i].name + '" hat ein nicht unterstütztes Format. Erlaubte Formate: JPG, JPEG, PNG, GIF, MP4, MOV, AVI, MKV, WEBM, FLV, M4V, 3GP</div>';
|
||||
previewContainer.innerHTML = '<div class="error-message">Fehler: Datei "' + files[i].name + '" hat ein nicht unterstütztes Format. Erlaubte Formate: JPG, JPEG, PNG, GIF</div>';
|
||||
return; // Stop processing
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
if (file.type.startsWith('image/')) {
|
||||
@@ -1893,17 +1890,6 @@
|
||||
previewContainer.appendChild(preview);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
} else if (file.type.startsWith('video/')) {
|
||||
const preview = document.createElement('div');
|
||||
preview.className = 'image-preview video-preview';
|
||||
preview.innerHTML = `
|
||||
<div class="video-placeholder">
|
||||
<div class="video-icon">🎥</div>
|
||||
<div class="video-name">${file.name}</div>
|
||||
</div>
|
||||
<button type="button" class="remove-image" onclick="removeImagePreview(this, ${i})">×</button>
|
||||
`;
|
||||
previewContainer.appendChild(preview);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user