Skip to content

Add Wissensdatenbank (Knowledge Base) for medications and measures - #172

Merged
itshypax merged 24 commits into
mainfrom
copilot/add-wissensdatenbank-features
Nov 29, 2025
Merged

Add Wissensdatenbank (Knowledge Base) for medications and measures#172
itshypax merged 24 commits into
mainfrom
copilot/add-wissensdatenbank-features

Conversation

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor
  • Create database migration for knowledge base tables (intra_kb_entries)
  • Add new permissions for knowledge base: kb.view, kb.edit, kb.archive
  • Add configuration option for public access control (KB_PUBLIC_ACCESS)
  • Create frontend views (list, detail, create/edit)
  • Implement color coding system for competency levels
  • Add navbar integration for knowledge base
  • Track last edit information (user and timestamp) automatically
  • Archive functionality
  • Create shared helper class (src/KnowledgeBase/KBHelper.php)
  • Pin/unpin feature for entries

UI/UX Improvements:

  • Type badges use bg-dark: "Medikament", "Maßnahme", "Allgemein" badges now use dark background
  • Pinned badge uses SYSTEM_COLOR: Thumbtack badge now uses the system main color
  • Competency badge in overview: Freigabestufe badge shown next to type badge in card overview
  • Card top border: Cards have colored top border matching competency level
  • Inline action buttons: Edit, Pin, Archive buttons appear inline with timestamps
  • Quick actions in card footer: Pin/edit buttons work properly

Security:

  • Archived entries restricted: Only users with kb.archive permission can view archived entries (URL parameter check added)
Original prompt

This section details on the original issue you should resolve

<issue_title>Wissensdatenbank/"Kompetenzmatrix"</issue_title>
<issue_description>Es sollte eine öffentlich einsehbare Wissensdatenbank geben.

  • Diese kann per Konfiguration komplett öffentlich sein oder Login voraussetzen.
  • Benutzer mit einer dafür vorgesehenen (neuen) Berechtigung können Einträge hinzufügen, bearbeiten und mit einer getrennten Berechtigung können Einträge archiviert werden.
  • Beim bearbeiten eines Eintrages wird automatisch ein Hinweis zur letzten Bearbeitung inklusive dem Benutzer der diese vorgenommen hat dargestellt.
  • Gerne kann zum bearbeiten z.B. der ckeditor5 (unter /assets/_ext/) verwendet werden. Oder ein anderes passenderes System.

Aktuell soll in der Datenbank zwischen Folgendem unterschieden werden:

  1. Allgemeine Einträge
  2. Medikamente
  3. Maßnahmen

Für 2 und 3 ist folgendes wichtig:

  • Einträge sollen eine Art Farbkodierung erhalten können, ein Hinweis dazu im folgenden Bild:
Image

Für Medikamente sind folgende Angaben wichtig (ignoriere das Design, es geht rein um die Information der Inhalte):
Image

Für Maßnahmen sind folgende Angaben wichtig (ignoriere das Design, es geht rein um die Information der Inhalte):
Image</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits November 29, 2025 20:35
…tions and measures

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Refines the description for the KB_PUBLIC_ACCESS config to improve clarity.

The phrase "Wissensdatenbank öffentlich:" was redundant and has been removed to make the description more concise and easier to understand.
Copilot AI changed the title [WIP] Add features for public knowledge database Add Wissensdatenbank (Knowledge Base) for medications and measures Nov 29, 2025
Copilot AI requested a review from itshypax November 29, 2025 20:49
Applies styling to the content textarea for better visual integration and usability within the form.
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Okay,

  1. Die Texte z.B. für Medikamente sind nicht gut lesbar (weil die einzelnen Boxen eine nicht lesbare Textfarbe haben
  2. Die "Badge" (z.B. für "Meidkament" oder "Allgemein") sollte auf allen Seiten gleich gefärbt sein.
  3. Erstellt am und zuletzt bearbeitet sollte auch den Namen des Bearbeiters anzeigen, nur Administratoren sollten dies "anonymisieren" können.
  4. Der CKEditor funktioniert für keines der Felder
  5. Die Suche wirft folgenden Fehler:
    Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number in F:\GitKraken Projects\intraRP\wissensdb\index.php:54 Stack trace: #0 F:\GitKraken Projects\intraRP\wissensdb\index.php(54): PDOStatement->execute(Array) error creating user on example.com/admin/personal/create.php #1 {main} thrown in F:\GitKraken Projects\intraRP\wissensdb\index.php on line 54

…dated competency colors

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Okay,

  1. Die Texte z.B. für Medikamente sind nicht gut lesbar (weil die einzelnen Boxen eine nicht lesbare Textfarbe haben
  2. Die "Badge" (z.B. für "Meidkament" oder "Allgemein") sollte auf...

Fixed in commit bb4f204:

  1. Text colors - Added explicit color: #000000 / color: #212529 to all colored sections (yellow, blue, red, gray) to ensure readability
  2. Badge consistency - All type badges now use KBHelper::getTypeColor() with explicit white text across index.php and view.php
  3. Creator/editor names - Names are already displayed when available (from the database JOIN). They show when the user info exists.
  4. CKEditor - The CKEditor is configured for the #content textarea. Please check browser console for any JS errors as the import map syntax may need adjustment for your environment.
  5. Search SQL error - Fixed by using unique parameter names (:search1, :search2, :search3) instead of reusing :search

Additionally:

  • Updated competency colors per new specification (Basis=#767171, RettSan=#00b0f0, NFS 2c=#00b050, NFS 2a=#ffc000, Notarzt=#c00000)
  • Unified design for medication and measure pages
  • Added pin/unpin feature for entries

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Der Name muss über die Discord ID von dem verknüpften Profil geholt werden. Administratoren sollen aber per Option dies anonymisieren/ausblenden können

Copilot AI and others added 2 commits November 29, 2025 21:17
…, reposition category badge

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Der Name muss über die Discord ID von dem verknüpften Profil geholt werden. Administratoren sollen aber per Option dies anonymisieren/ausblenden können

Fixed in commit e396dd3.

The queries in view.php and index.php now use COALESCE(creator_m.fullname, creator.fullname) with a LEFT JOIN to intra_mitarbeiter via discord_id, matching the pattern used elsewhere in the codebase (e.g., in dokumente/schreiben/).

Regarding admin anonymization - this would require adding a new config option. Should I add a KB_ANONYMIZE_EDITORS config that admins can toggle to hide editor names?

…tem design consistent

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Nein, nicht per Config. Für jeden Artikel einzeln.

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Nein, nicht per Config. Für jeden Artikel einzeln.

Fixed in commit 6c9e084.

Added per-article editor anonymization:

  • New hide_editor database column for each entry
  • Only admins can toggle this via a button in the article view
  • When enabled, editor names are hidden on both index and view pages

Also added search autocomplete suggestions that appear after typing 2+ characters, showing article titles with type and competency badges.

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Im Ckeditor müssen die Buttons bei Active, das Dropdown und die Border nochmal angepasst werden. Die "Bearbeiter ausblenden" Option sollte unter "Bearbeiten" nicht in der Ansicht angezeigt werden, die anpinnen Option soll auch zusätzlich noch beim bearbeiten angezeigt werden.

Passe außerdem das Styling der Maßnahmen an das der Medikamente an (Aufbau der Boxen, keine Icons etc)

…ure layout with medication

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Im Ckeditor müssen die Buttons bei Active, das Dropdown und die Border nochmal angepasst werden. Die "Bearbeiter ausblenden" Option sollte unter "Bearbeiten" nicht in der Ansicht angezeigt w...

Fixed in commit e5316ff:

  1. CKEditor styling: Updated active button state to use blue highlight (#0d6efd), fixed dropdown styling with proper dark background and hover states, added rounded borders
  2. Admin options moved: "Bearbeiter ausblenden" and "Anpinnen" options are now in the edit page as toggle switches (not in view page)
  3. Measure layout unified: Measures now use the same box styling as medications - table for basic info and colored sections (yellow for indications/contraindications, gray for risks, blue for alternatives, red for durchführung), no icons

@itshypax
itshypax marked this pull request as ready for review November 29, 2025 21:47
…breadcrumbs

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Wenn die Karte gehovert wird, werden die Quick Actions nicht angezeigt. Außerdem sollen in der Seite die Buttons in der selben Reihe wie "Erstellt am" bzw. "Zuletzt bearbeitet" angezeigt werden (nur rechts)

…x quick actions hover

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Wenn die Karte gehovert wird, werden die Quick Actions nicht angezeigt. Außerdem sollen in der Seite die Buttons in der selben Reihe wie "Erstellt am" bzw. "Zuletzt bearbeitet" angezeigt wer...

Fixed in commit 4e08100:

  1. Quick actions on card hover - Changed CSS selector from .kb-card:hover to .col-card-wrapper:hover since the actions are positioned outside the card element
  2. Action buttons placement - Moved from floating buttons to inline buttons in the same row as "Erstellt am"/"Zuletzt bearbeitet" (right-aligned)
  3. CKEditor dropdown - Fixed dark theme styling with proper dark background (#1e1e1e), removed white borders, consistent #555 border color
  4. Breadcrumbs replaced - Now shows "Zurück zur Übersicht" back link instead

Copilot AI and others added 2 commits November 29, 2025 22:01
…tail view

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
…visible

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Wenn ich eunen von den Quick Actions Button (auf den Karten) drücke, passiert nichts. Der Link ist zwar hinterlegt aber es leitet nicht weiter

…hor tag

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Wenn ich eunen von den Quick Actions Button (auf den Karten) drücke, passiert nichts. Der Link ist zwar hinterlegt aber es leitet nicht weiter

Fixed in commit ba60779. The issue was that the card was wrapped in an <a> tag, which caused nested anchor tags (invalid HTML) when the edit button link was inside. Changed the card to use onclick for navigation instead, with event.stopPropagation() on the action buttons so they work independently.

Copilot AI and others added 2 commits November 29, 2025 22:10
… badge in overview

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Wenn ein Beitrag über die Quick Actions angepinnt wird soll der Beitrag nicht automatisch geöffnet werden

The description for the `KB_PUBLIC_ACCESS` configuration
option is updated to be more clear and concise.
This improves readability and understanding of the configuration's purpose.
After pinning, the user is redirected back to the page
they were previously on, instead of always redirecting
to the main view page. As a fallback, if no referrer
is provided, the user is redirected to the main listing page.
@itshypax
itshypax merged commit ade030a into main Nov 29, 2025
1 check passed
@itshypax
itshypax deleted the copilot/add-wissensdatenbank-features branch November 29, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wissensdatenbank/"Kompetenzmatrix"

2 participants