From a80b2c08bf808c91d787c879142db97b60d0a0f3 Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Sat, 9 May 2026 20:51:44 +0200 Subject: [PATCH] Admin mobile block: fix inline style beating media query --- TODO.md | 5 ++ .../applied/023b_rename_cc4r_to_cc2r.sql | 75 +++++++++++++++++++ app/migrations/run.php | 5 +- app/public/admin/index.php | 2 +- app/public/assets/css/admin.css | 49 +++++++++++- app/src/Controllers/ThesisEditController.php | 6 +- app/src/Database.php | 6 +- app/templates/admin/acces.php | 4 + app/templates/header.php | 8 ++ 9 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 app/migrations/applied/023b_rename_cc4r_to_cc2r.sql diff --git a/TODO.md b/TODO.md index 08ba51f..7a1d082 100644 --- a/TODO.md +++ b/TODO.md @@ -61,3 +61,8 @@ - [x] Remove admin-bulk-meta__default (count bar), clean up layout - [x] Fix nested form issue: per-row publish/unpublish buttons now submit correctly - [x] Fix delete button: stopPropagation prevents row nav on confirm +- [x] CSV import: set is_published=0 by default instead of 1 +- [x] Fix AP column wrapping: CSS selector main > table didn't match (table nested in div) +- [x] Admin mobile block screen: fix inline style beating media query, use CSS default display:none instead +- [x] Fix deploy: add missing 023b migration to rename cc4r→cc2r, make run.php skip 'no such column' errors +- [x] Fix FK constraint violation on edit: pass null instead of 0 for absent orientation/ap/finality diff --git a/app/migrations/applied/023b_rename_cc4r_to_cc2r.sql b/app/migrations/applied/023b_rename_cc4r_to_cc2r.sql new file mode 100644 index 0000000..8101522 --- /dev/null +++ b/app/migrations/applied/023b_rename_cc4r_to_cc2r.sql @@ -0,0 +1,75 @@ +-- Rename cc4r column to cc2r (fix pre-existing naming inconsistency) +-- Must run before 024_remove_duration_size_fields.sql which references cc2r + +ALTER TABLE theses RENAME COLUMN cc4r TO cc2r; + +-- Rebuild views with the new column name +DROP VIEW IF EXISTS v_theses_public; +DROP VIEW IF EXISTS v_theses_full; + +CREATE VIEW IF NOT EXISTS v_theses_full AS +SELECT + t.id, + t.identifier, + t.title, + t.subtitle, + t.year, + t.is_doctoral, + t.objet, + o.name as orientation, + ap.name as ap_program, + ft.name as finality_type, + t.synopsis, + t.context_note, + t.duration_minutes, + t.duration_pages, + t.file_size_info, + at.name as access_type, + lt.name as license_type, + t.license_id, + t.access_type_id, + t.jury_points, + t.submitted_at, + t.defense_date, + t.published_at, + t.is_published, + t.baiu_link, + t.banner_path, + t.exemplaire_baiu, + t.exemplaire_erg, + t.cc2r, + t.remarks, + t.jury_note_added, + GROUP_CONCAT(DISTINCT a.name ORDER BY a.name ASC) as authors, + GROUP_CONCAT(DISTINCT s.name) as supervisors, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'president' THEN s.name END) as jury_president, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'promoteur' AND ts.is_ulb = 0 THEN s.name END) as jury_promoteurs, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'promoteur' AND ts.is_ulb = 1 THEN s.name END) as jury_promoteurs_ulb, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'lecteur' AND ts.is_external = 0 THEN s.name END) as jury_lecteurs_internes, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'lecteur' AND ts.is_external = 1 THEN s.name END) as jury_lecteurs_externes, + GROUP_CONCAT(DISTINCT l.name) as languages, + GROUP_CONCAT(DISTINCT fmt.name) as formats, + GROUP_CONCAT(DISTINCT tg.name) as keywords, + (SELECT a2.email FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as author_email, + (SELECT a2.show_contact FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as author_show_contact +FROM theses t +LEFT JOIN orientations o ON t.orientation_id = o.id +LEFT JOIN ap_programs ap ON t.ap_program_id = ap.id +LEFT JOIN finality_types ft ON t.finality_id = ft.id +LEFT JOIN access_types at ON t.access_type_id = at.id +LEFT JOIN license_types lt ON t.license_id = lt.id +LEFT JOIN thesis_authors ta ON t.id = ta.thesis_id +LEFT JOIN authors a ON ta.author_id = a.id +LEFT JOIN thesis_supervisors ts ON t.id = ts.thesis_id +LEFT JOIN supervisors s ON ts.supervisor_id = s.id +LEFT JOIN thesis_languages tl ON t.id = tl.thesis_id +LEFT JOIN languages l ON tl.language_id = l.id +LEFT JOIN thesis_formats tf ON t.id = tf.thesis_id +LEFT JOIN format_types fmt ON tf.format_id = fmt.id +LEFT JOIN thesis_tags tt ON t.id = tt.thesis_id +LEFT JOIN tags tg ON tt.tag_id = tg.id +GROUP BY t.id; + +CREATE VIEW IF NOT EXISTS v_theses_public AS +SELECT * FROM v_theses_full +WHERE is_published = 1; diff --git a/app/migrations/run.php b/app/migrations/run.php index b150e14..3d773f3 100644 --- a/app/migrations/run.php +++ b/app/migrations/run.php @@ -77,8 +77,9 @@ foreach ($files as $name => $file) { $pdo->exec($stmt . ';'); } catch (PDOException $e) { $msg = $e->getMessage(); - if (stripos($msg, 'duplicate column name') !== false) { - echo " Skipping (column exists): " . substr($stmt, 0, 60) . "...\n"; + if (stripos($msg, 'duplicate column name') !== false + || stripos($msg, 'no such column') !== false) { + echo " Skipping (already applied): " . substr($stmt, 0, 60) . "...\n"; continue; } $errors[] = $msg; diff --git a/app/public/admin/index.php b/app/public/admin/index.php index f48dc03..32da4ce 100644 --- a/app/public/admin/index.php +++ b/app/public/admin/index.php @@ -296,7 +296,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) { synopsis, context_note, remarks, jury_points, baiu_link, access_type_id, is_published, submitted_at - ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,1,CURRENT_TIMESTAMP) + ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,0,CURRENT_TIMESTAMP) "); $s->execute([ !empty($identifier) ? $identifier : null, $title, diff --git a/app/public/assets/css/admin.css b/app/public/assets/css/admin.css index 6927402..b64c37e 100644 --- a/app/public/assets/css/admin.css +++ b/app/public/assets/css/admin.css @@ -349,8 +349,8 @@ padding: var(--space-3xs); } -.admin-body main > table td.admin-ap-col, -.admin-body main > table th.admin-ap-col { +td.admin-ap-col, +th.admin-ap-col { white-space: nowrap; } @@ -1898,3 +1898,48 @@ .fhb-inline-form { margin-top: var(--space-xs); } + +/* ── Mobile: admin unavailable ─────────────────────────────────────────── */ +.admin-mobile-block { + display: none; +} + +@media screen and (max-width: 640px) { + .admin-body header { + display: none; + } + + .admin-body main { + display: none; + } + + .admin-mobile-block { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + padding: var(--space-l); + text-align: center; + color: var(--text-secondary); + } + + .admin-mobile-block svg { + width: 48px; + height: 48px; + fill: var(--text-tertiary); + margin-bottom: var(--space-m); + } + + .admin-mobile-block h2 { + font-size: var(--step-0); + font-weight: 600; + color: var(--text-primary); + margin: 0 0 var(--space-xs); + } + + .admin-mobile-block p { + font-size: var(--step--1); + margin: 0; + } +} diff --git a/app/src/Controllers/ThesisEditController.php b/app/src/Controllers/ThesisEditController.php index 178e56f..546b628 100644 --- a/app/src/Controllers/ThesisEditController.php +++ b/app/src/Controllers/ThesisEditController.php @@ -196,9 +196,9 @@ class ThesisEditController 'title' => trim($post['titre'] ?? ''), 'subtitle' => trim($post['subtitle'] ?? ''), 'year' => intval($post['année'] ?? 0), - 'orientation_id' => intval($post['orientation'] ?? 0), - 'ap_program_id' => intval($post['ap'] ?? 0), - 'finality_id' => intval($post['finality'] ?? 0), + 'orientation_id' => ($v = intval($post['orientation'] ?? 0)) > 0 ? $v : null, + 'ap_program_id' => ($v = intval($post['ap'] ?? 0)) > 0 ? $v : null, + 'finality_id' => ($v = intval($post['finality'] ?? 0)) > 0 ? $v : null, 'synopsis' => trim($post['synopsis'] ?? ''), 'context_note' => trim($post['context_note'] ?? ''), 'baiu_link' => trim($post['lien'] ?? ''), diff --git a/app/src/Database.php b/app/src/Database.php index c15f4cf..6a4b31d 100644 --- a/app/src/Database.php +++ b/app/src/Database.php @@ -1744,9 +1744,9 @@ class Database $data['title'], !empty($data['subtitle']) ? $data['subtitle'] : null, (int)$data['year'], - (int)$data['orientation_id'], - (int)$data['ap_program_id'], - (int)$data['finality_id'], + ($data['orientation_id'] ?? null) ? (int)$data['orientation_id'] : null, + ($data['ap_program_id'] ?? null) ? (int)$data['ap_program_id'] : null, + ($data['finality_id'] ?? null) ? (int)$data['finality_id'] : null, $data['synopsis'], !empty($data['context_note']) ? $data['context_note'] : null, !empty($data['baiu_link']) ? $data['baiu_link'] : null, diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index 3b09d79..e96c782 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -45,6 +45,10 @@ $linkName = $link['name'] ?? ''; $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; $linkLockedYear = $link['locked_year'] ?? null; +%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +\\\\\\\ to: unnnvyqs 357a2fff "Admin mobile block: fix inline style beating media query" (rebased revision) ++ $linkName = $link['name'] ?? ''; ++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; ?> diff --git a/app/templates/header.php b/app/templates/header.php index 5f719d1..9aeb577 100644 --- a/app/templates/header.php +++ b/app/templates/header.php @@ -82,6 +82,14 @@ $_thesisId = $_GET['id'] ?? null; + +
+ +

Section administrateur

+

L'administration n'est pas accessible sur mobile. Veuillez utiliser un ordinateur.

+
+ +