Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1da8eabd4 | ||
|
|
d1d748f760
|
||
|
|
7475f096ea | ||
|
|
6c77470824
|
||
|
|
7a80794ded
|
||
|
|
ebaf6fbe53 | ||
|
|
b496032604
|
||
|
|
9e869ef979 | ||
|
|
dbac9e93c7
|
||
|
|
6cdab11898 | ||
|
|
d6432911ed
|
||
|
|
1b48ce7852 | ||
|
|
3916678b1f | ||
|
|
27771e7470
|
||
|
|
1ad1063772
|
||
|
|
722e845cff | ||
|
|
0dfbf1d04a
|
||
|
|
918270540f | ||
|
|
3b2bff6116 | ||
|
|
12ab64312b
|
||
|
|
a16aff6b88
|
||
|
|
ab033d5216 | ||
|
|
bf9f86d24a
|
||
|
|
2f7a401522
|
||
|
|
cad09163d9 | ||
|
|
7fd4a0da8c
|
||
|
|
4d9ce7e5f5 | ||
|
|
e4790fcc27 | ||
|
|
76d8311e50
|
||
|
|
4aaabb85ed | ||
|
|
bd57f23be6
|
||
|
|
0f91377de3 | ||
|
|
a2ffb8085b | ||
|
|
8e9313bd10 | ||
|
|
e1e521cb83 | ||
|
|
be9ebe7c3c | ||
|
|
8471e5bef8 | ||
|
|
56c9177eae | ||
|
|
f48cccbf48 | ||
|
|
30a5c10635 | ||
|
|
592c2d8f5f | ||
|
|
c8a5464a98 | ||
|
|
ea8115957e | ||
|
|
29b565facc
|
||
|
|
ebfab0ef20
|
||
|
|
09ed675e08 | ||
|
|
d3fdb63b8e | ||
|
|
749e4c8242 | ||
|
|
27a45e12e0 | ||
|
|
a1348cc40e | ||
|
|
7085eb17f8
|
||
|
|
b933d2065d | ||
|
|
945fc94e77
|
||
|
|
26648adca8 | ||
|
|
f3871269de | ||
|
|
a9b14af8bf | ||
|
|
9fed0a046d
|
No files matched your search
@@ -41,7 +41,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
php: ['8.4', '8.5']
|
php: ['8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
@@ -82,7 +82,7 @@ jobs:
|
|||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy via SSH
|
- name: Deploy via SSH
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
uses: appleboy/ssh-action@v1.2.5
|
||||||
with:
|
with:
|
||||||
host: ${{ vars.SSH_HOST }}
|
host: ${{ vars.SSH_HOST }}
|
||||||
port: ${{ vars.SSH_PORT || 22 }}
|
port: ${{ vars.SSH_PORT || 22 }}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Check tag is a semantic version
|
- name: Check tag is a semantic version
|
||||||
env:
|
env:
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -138,13 +138,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Login to registry
|
- name: Login to registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.DOCKER_REPO }}
|
registry: ${{ vars.DOCKER_REPO }}
|
||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
@@ -152,7 +152,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Image tags
|
- name: Image tags
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v6
|
||||||
with:
|
with:
|
||||||
images: ${{ vars.DOCKER_REPO }}/${{ gitea.repository_owner }}/${{ vars.IMAGE_NAME }}
|
images: ${{ vars.DOCKER_REPO }}/${{ gitea.repository_owner }}/${{ vars.IMAGE_NAME }}
|
||||||
tags: |
|
tags: |
|
||||||
@@ -161,7 +161,7 @@ jobs:
|
|||||||
type=semver,pattern={{major}},enable=${{ !contains(gitea.ref_name, '-') && !startsWith(gitea.ref_name, 'v0.') }}
|
type=semver,pattern={{major}},enable=${{ !contains(gitea.ref_name, '-') && !startsWith(gitea.ref_name, 'v0.') }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Dependency updates with Renovate (Composer packages, Docker base images, workflow actions).
|
||||||
|
#
|
||||||
|
# Runs daily and on demand. Renovate opens pull requests on `renovate/*` branches; the normal CI
|
||||||
|
# (ci.yml, job `test`) runs on them, and they are merged by hand like every other PR.
|
||||||
|
# Rules live in renovate.json. Renovate is restricted to this repository (no autodiscovery).
|
||||||
|
#
|
||||||
|
# Repository secret (Settings → Actions → Secrets):
|
||||||
|
# RENOVATE_TOKEN Gitea access token with scopes repository (read/write), issue (read/write),
|
||||||
|
# user (read); plus organization (read) if the repo belongs to an organization.
|
||||||
|
name: Renovate
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 4 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
renovate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Run Renovate
|
||||||
|
uses: renovatebot/github-action@v46.3.14
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.RENOVATE_TOKEN }}
|
||||||
|
env:
|
||||||
|
RENOVATE_PLATFORM: gitea
|
||||||
|
RENOVATE_ENDPOINT: ${{ gitea.server_url }}/api/v1
|
||||||
|
RENOVATE_REPOSITORIES: ${{ gitea.repository }}
|
||||||
|
RENOVATE_GIT_AUTHOR: Renovate Bot <renovate@noreply.invalid>
|
||||||
|
GITHUB_COM_TOKEN: ${{ secrets._GITHUB_COM_TOKEN }}
|
||||||
|
LOG_LEVEL: info
|
||||||
@@ -34,7 +34,7 @@ E-Mail anlegen, kein Login, Verwaltung über einen geheimen Admin-Link, Teilnahm
|
|||||||
| Coding Standard | `vendor/bin/phpcs` / Autofix `vendor/bin/phpcbf` |
|
| Coding Standard | `vendor/bin/phpcs` / Autofix `vendor/bin/phpcbf` |
|
||||||
| Neue Migration | `bin/cake bake migration NameDerMigration` |
|
| Neue Migration | `bin/cake bake migration NameDerMigration` |
|
||||||
| Verwaiste Folienbilder löschen | `bin/cake images_cleanup [--dry-run]` |
|
| Verwaiste Folienbilder löschen | `bin/cake images_cleanup [--dry-run]` |
|
||||||
| Umfragen verwalten (Admin-CLI) | `bin/cake polls list\|show\|delete\|remind\|cleanup` (siehe [docs/operations.md](docs/operations.md)) |
|
| Umfragen verwalten (Admin-CLI) | `bin/cake polls list\|show\|delete\|remind\|cleanup\|seed` (siehe [docs/operations.md](docs/operations.md)) |
|
||||||
|
|
||||||
**Vor jedem Commit:** `vendor/bin/phpunit` und `vendor/bin/phpcs` müssen grün sein
|
**Vor jedem Commit:** `vendor/bin/phpunit` und `vendor/bin/phpcs` müssen grün sein
|
||||||
(Warnungen zur Zeilenlänge bei langen deutschen Texten sind ok).
|
(Warnungen zur Zeilenlänge bei langen deutschen Texten sind ok).
|
||||||
@@ -53,10 +53,10 @@ passende Dokument und pflegt es danach** (Details zu Verhalten, Settings, Tests
|
|||||||
| Verzeichnisstruktur, Klassen, Tabellen | [docs/architecture.md](docs/architecture.md) |
|
| Verzeichnisstruktur, Klassen, Tabellen | [docs/architecture.md](docs/architecture.md) |
|
||||||
| Folientypen (Wortwolke, Quiz, Q&A, Reihenfolge, YouTube, Skala/Sterne, Kommentare), Checkliste „Neuen Folientyp hinzufügen“ | [docs/slide-types.md](docs/slide-types.md) |
|
| Folientypen (Wortwolke, Quiz, Q&A, Reihenfolge, YouTube, Skala/Sterne, Kommentare), Checkliste „Neuen Folientyp hinzufügen“ | [docs/slide-types.md](docs/slide-types.md) |
|
||||||
| Folienbilder (Upload, Ablage, Löschen) | [docs/images.md](docs/images.md) |
|
| Folienbilder (Upload, Ablage, Löschen) | [docs/images.md](docs/images.md) |
|
||||||
| Live-Schaltung, Referentenansicht, Pause, Ausblenden, Zurücksetzen, Duplizieren, Einbettung, internes Feedback | [docs/presenter.md](docs/presenter.md) |
|
| Live-Schaltung, Referentenansicht, Pause, Ausblenden, Zurücksetzen, Duplizieren, Umfrage kopieren, Einbettung, internes Feedback | [docs/presenter.md](docs/presenter.md) |
|
||||||
| Dashboard-Fragmente, Farbschema, Textformatierung, Vollbild | [docs/frontend.md](docs/frontend.md) |
|
| Dashboard-Fragmente, Farbschema, Textformatierung, Vollbild | [docs/frontend.md](docs/frontend.md) |
|
||||||
| PDF-Export | [docs/pdf-export.md](docs/pdf-export.md) |
|
| PDF-Export | [docs/pdf-export.md](docs/pdf-export.md) |
|
||||||
| Ablauf/Cleanup von Umfragen, CI/Deploy, Releases, Docker | [docs/operations.md](docs/operations.md) |
|
| Ablauf/Cleanup von Umfragen, CI/Deploy, Releases, Docker, Renovate | [docs/operations.md](docs/operations.md) |
|
||||||
| Betreiber-Anleitung (Docker, Cronjob, Releases) und Umgebungsvariablen | [docs/deployment.md](docs/deployment.md), [docs/configuration.md](docs/configuration.md) |
|
| Betreiber-Anleitung (Docker, Cronjob, Releases) und Umgebungsvariablen | [docs/deployment.md](docs/deployment.md), [docs/configuration.md](docs/configuration.md) |
|
||||||
|
|
||||||
## Architektur in Kürze
|
## Architektur in Kürze
|
||||||
@@ -70,7 +70,7 @@ src/
|
|||||||
QaService, SlideControlService, ResetService, ReportService
|
QaService, SlideControlService, ResetService, ReportService
|
||||||
Model/ Polls → Slides → SlideOptions, Slides → Responses
|
Model/ Polls → Slides → SlideOptions, Slides → Responses
|
||||||
Middleware/ HostHeader, SecurityHeaders (CSP mit Nonce, Framing, Referrer-Policy)
|
Middleware/ HostHeader, SecurityHeaders (CSP mit Nonce, Framing, Referrer-Policy)
|
||||||
Command/ images_cleanup, polls list|show|delete|remind|cleanup
|
Command/ images_cleanup, polls list|show|delete|remind|cleanup|seed
|
||||||
Mailer/ PollMailer
|
Mailer/ PollMailer
|
||||||
templates/ Deutsche UI; Layouts: default, present, error, email, fragment, pdf
|
templates/ Deutsche UI; Layouts: default, present, error, email, fragment, pdf
|
||||||
webroot/ css/plenario.css (eigenes CSS, Tokens), js/plenario.js (Vanilla JS)
|
webroot/ css/plenario.css (eigenes CSS, Tokens), js/plenario.js (Vanilla JS)
|
||||||
@@ -104,7 +104,11 @@ Vollständige Struktur und Datenmodell: [docs/architecture.md](docs/architecture
|
|||||||
Q&A nutzt eigenes `qa`. Es gibt keinen Schalter dafür pro Umfrage.
|
Q&A nutzt eigenes `qa`. Es gibt keinen Schalter dafür pro Umfrage.
|
||||||
- **Quiz:** Zählungen und `is_correct` dürfen vor `finished` nie im JSON/HTML landen (weder Presenter noch Teilnehmende);
|
- **Quiz:** Zählungen und `is_correct` dürfen vor `finished` nie im JSON/HTML landen (weder Presenter noch Teilnehmende);
|
||||||
„offen“ heißt immer `Slide::isVotingOpen()`, nicht nur `is_voting_open`. Details: [docs/slide-types.md](docs/slide-types.md).
|
„offen“ heißt immer `Slide::isVotingOpen()`, nicht nur `is_voting_open`. Details: [docs/slide-types.md](docs/slide-types.md).
|
||||||
- **Reihenfolge:** richtige Reihenfolge und Zählungen erst nach dem Schließen der Abstimmung im JSON.
|
- **Reihenfolge:** richtige Reihenfolge und Zählungen erst nach dem Schließen der Abstimmung im JSON, nie vor dem Start eines Countdowns
|
||||||
|
(`Slide::isOrderRevealed()` ist in der Phase `ready` falsch).
|
||||||
|
- **Countdown:** jede Folie mit Antworten außer Q&A kann ein Zeitlimit haben (`time_limit`, 0 = keins). Mit Countdown startet sie geschlossen
|
||||||
|
(`ready`), zeigt nur die Frage, „Weiter“ startet/beendet ihn wie beim Quiz. Auf die Bühne gehen Ergebnisse dafür nur über
|
||||||
|
`ResultsService::forStage()`. Details: [docs/slide-types.md](docs/slide-types.md).
|
||||||
- **Pause/Live-Folie:** `current_slide_id`/`paused_slide_id` nur über `Poll::showSlide()` / `showEmbeddedSlide()` / `pause()` /
|
- **Pause/Live-Folie:** `current_slide_id`/`paused_slide_id` nur über `Poll::showSlide()` / `showEmbeddedSlide()` / `pause()` /
|
||||||
`forgetSlide()` setzen, nie direkt. Details: [docs/presenter.md](docs/presenter.md).
|
`forgetSlide()` setzen, nie direkt. Details: [docs/presenter.md](docs/presenter.md).
|
||||||
- `Poll`/`Response` haben `_hidden` für sensible Felder; mass assignment über `_accessible` restriktiv halten.
|
- `Poll`/`Response` haben `_hidden` für sensible Felder; mass assignment über `_accessible` restriktiv halten.
|
||||||
|
|||||||
Generated
+51
-50
@@ -858,30 +858,31 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laminas/laminas-httphandlerrunner",
|
"name": "laminas/laminas-httphandlerrunner",
|
||||||
"version": "2.14.0",
|
"version": "2.15.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laminas/laminas-httphandlerrunner.git",
|
"url": "https://github.com/laminas/laminas-httphandlerrunner.git",
|
||||||
"reference": "14d5182a4ba180c998dfbba9d19f9a70337c02b4"
|
"reference": "459cf8e2cbf93abb582990f4243c31d42e965472"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laminas/laminas-httphandlerrunner/zipball/14d5182a4ba180c998dfbba9d19f9a70337c02b4",
|
"url": "https://api.github.com/repos/laminas/laminas-httphandlerrunner/zipball/459cf8e2cbf93abb582990f4243c31d42e965472",
|
||||||
"reference": "14d5182a4ba180c998dfbba9d19f9a70337c02b4",
|
"reference": "459cf8e2cbf93abb582990f4243c31d42e965472",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
|
"php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0",
|
||||||
"psr/http-message": "^1.0 || ^2.0",
|
"psr/http-message": "^1.0 || ^2.0",
|
||||||
"psr/http-message-implementation": "^1.0 || ^2.0",
|
"psr/http-message-implementation": "^1.0 || ^2.0",
|
||||||
"psr/http-server-handler": "^1.0"
|
"psr/http-server-handler": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"laminas/internal-tooling": "^1.2",
|
||||||
"laminas/laminas-coding-standard": "~3.1.0",
|
"laminas/laminas-coding-standard": "~3.1.0",
|
||||||
"laminas/laminas-diactoros": "^3.6.0",
|
"laminas/laminas-diactoros": "^3.10.0",
|
||||||
"phpunit/phpunit": "^10.5.46",
|
"phpunit/phpunit": "^10.5.66",
|
||||||
"psalm/plugin-phpunit": "^0.19.5",
|
"psalm/plugin-phpunit": "^0.22.2",
|
||||||
"vimeo/psalm": "^6.10.3"
|
"vimeo/psalm": "^6.20.11"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
@@ -921,8 +922,8 @@
|
|||||||
"type": "custom"
|
"type": "custom"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-09-21T10:14:52+00:00",
|
"time": "2026-11-12T14:06:40+00:00",
|
||||||
"published-time": "2026-09-21T10:15:58+00:00"
|
"published-time": "2026-11-12T14:07:18+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/container",
|
"name": "league/container",
|
||||||
@@ -2243,16 +2244,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/composer",
|
"name": "composer/composer",
|
||||||
"version": "2.11.1",
|
"version": "2.11.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/composer/composer.git",
|
"url": "https://github.com/composer/composer.git",
|
||||||
"reference": "472b418967419c6124edd91dc6310a3bec091dae"
|
"reference": "12c820dbc3f030954b1d09f5884fcf1e9d29d6cb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/composer/composer/zipball/472b418967419c6124edd91dc6310a3bec091dae",
|
"url": "https://api.github.com/repos/composer/composer/zipball/12c820dbc3f030954b1d09f5884fcf1e9d29d6cb",
|
||||||
"reference": "472b418967419c6124edd91dc6310a3bec091dae",
|
"reference": "12c820dbc3f030954b1d09f5884fcf1e9d29d6cb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2342,7 +2343,7 @@
|
|||||||
"irc": "ircs://irc.libera.chat:6697/composer",
|
"irc": "ircs://irc.libera.chat:6697/composer",
|
||||||
"issues": "https://github.com/composer/composer/issues",
|
"issues": "https://github.com/composer/composer/issues",
|
||||||
"security": "https://github.com/composer/composer/security/policy",
|
"security": "https://github.com/composer/composer/security/policy",
|
||||||
"source": "https://github.com/composer/composer/tree/2.11.1"
|
"source": "https://github.com/composer/composer/tree/2.11.2"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2354,8 +2355,8 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-10-30T13:52:10+00:00",
|
"time": "2026-11-10T09:09:37+00:00",
|
||||||
"published-time": "2026-10-30T14:03:09+00:00"
|
"published-time": "2026-11-10T09:12:59+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/metadata-minifier",
|
"name": "composer/metadata-minifier",
|
||||||
@@ -3371,16 +3372,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "14.5.1",
|
"version": "14.5.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||||
"reference": "4063552c678ce3beb4b7f131a5b7354a19ff3e2a"
|
"reference": "2f122b9b48af71ad9b4448368febc26af86534c9"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4063552c678ce3beb4b7f131a5b7354a19ff3e2a",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2f122b9b48af71ad9b4448368febc26af86534c9",
|
||||||
"reference": "4063552c678ce3beb4b7f131a5b7354a19ff3e2a",
|
"reference": "2f122b9b48af71ad9b4448368febc26af86534c9",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3398,7 +3399,7 @@
|
|||||||
"sebastian/version": "^7.0.1"
|
"sebastian/version": "^7.0.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^13.4.5"
|
"phpunit/phpunit": "^13.4.6"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-pcov": "PHP extension that provides line coverage",
|
"ext-pcov": "PHP extension that provides line coverage",
|
||||||
@@ -3436,7 +3437,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/14.5.1"
|
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/14.5.2"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3456,8 +3457,8 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-11-02T11:47:37+00:00",
|
"time": "2026-11-09T05:24:08+00:00",
|
||||||
"published-time": "2026-11-02T11:49:08+00:00"
|
"published-time": "2026-11-09T05:25:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-file-iterator",
|
"name": "phpunit/php-file-iterator",
|
||||||
@@ -3758,16 +3759,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "13.4.6",
|
"version": "13.4.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "4821376960d0e1e5a7b7b700955ebcab33ecd71b"
|
"reference": "291e66a76eb39f2fb8f880d38edc30dbd7acd9a2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4821376960d0e1e5a7b7b700955ebcab33ecd71b",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/291e66a76eb39f2fb8f880d38edc30dbd7acd9a2",
|
||||||
"reference": "4821376960d0e1e5a7b7b700955ebcab33ecd71b",
|
"reference": "291e66a76eb39f2fb8f880d38edc30dbd7acd9a2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3781,7 +3782,7 @@
|
|||||||
"phar-io/manifest": "^2.0.4",
|
"phar-io/manifest": "^2.0.4",
|
||||||
"phar-io/version": "^3.2.1",
|
"phar-io/version": "^3.2.1",
|
||||||
"php": ">=8.4.1",
|
"php": ">=8.4.1",
|
||||||
"phpunit/php-code-coverage": "^14.5.0",
|
"phpunit/php-code-coverage": "^14.5.2",
|
||||||
"phpunit/php-file-iterator": "^7.0.2",
|
"phpunit/php-file-iterator": "^7.0.2",
|
||||||
"phpunit/php-invoker": "^7.0.0",
|
"phpunit/php-invoker": "^7.0.0",
|
||||||
"phpunit/php-text-template": "^6.0.1",
|
"phpunit/php-text-template": "^6.0.1",
|
||||||
@@ -3797,7 +3798,7 @@
|
|||||||
"sebastian/object-enumerator": "^8.1.0",
|
"sebastian/object-enumerator": "^8.1.0",
|
||||||
"sebastian/recursion-context": "^8.0.1",
|
"sebastian/recursion-context": "^8.0.1",
|
||||||
"sebastian/type": "^7.0.2",
|
"sebastian/type": "^7.0.2",
|
||||||
"sebastian/version": "^7.0.1",
|
"sebastian/version": "^7.1.0",
|
||||||
"staabm/side-effects-detector": "^1.0.5"
|
"staabm/side-effects-detector": "^1.0.5"
|
||||||
},
|
},
|
||||||
"bin": [
|
"bin": [
|
||||||
@@ -3838,7 +3839,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/13.4.6"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/13.4.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3846,8 +3847,8 @@
|
|||||||
"type": "other"
|
"type": "other"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-11-02T07:12:28+00:00",
|
"time": "2026-11-19T12:17:15+00:00",
|
||||||
"published-time": "2026-11-02T07:13:08+00:00"
|
"published-time": "2026-11-19T12:18:28+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "react/promise",
|
"name": "react/promise",
|
||||||
@@ -4979,16 +4980,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/version",
|
"name": "sebastian/version",
|
||||||
"version": "7.0.1",
|
"version": "7.1.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/version.git",
|
"url": "https://github.com/sebastianbergmann/version.git",
|
||||||
"reference": "f1598cf1d8d1ca4c0f194a52f2fe72a559a7b0b1"
|
"reference": "08e41d0c7e146bfc8cef7e63989b1294453a6d6a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/f1598cf1d8d1ca4c0f194a52f2fe72a559a7b0b1",
|
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/08e41d0c7e146bfc8cef7e63989b1294453a6d6a",
|
||||||
"reference": "f1598cf1d8d1ca4c0f194a52f2fe72a559a7b0b1",
|
"reference": "08e41d0c7e146bfc8cef7e63989b1294453a6d6a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -4997,7 +4998,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "7.0-dev"
|
"dev-main": "7.1-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -5021,7 +5022,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/version/issues",
|
"issues": "https://github.com/sebastianbergmann/version/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/version/security/policy",
|
"security": "https://github.com/sebastianbergmann/version/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/version/tree/7.0.1"
|
"source": "https://github.com/sebastianbergmann/version/tree/7.1.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -5041,8 +5042,8 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-10-04T05:51:14+00:00",
|
"time": "2026-11-09T06:31:27+00:00",
|
||||||
"published-time": "2026-10-04T05:52:22+00:00"
|
"published-time": "2026-11-09T06:31:50+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "seld/jsonlint",
|
"name": "seld/jsonlint",
|
||||||
@@ -6407,16 +6408,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-php85",
|
"name": "symfony/polyfill-php85",
|
||||||
"version": "v1.43.0",
|
"version": "v1.44.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-php85.git",
|
"url": "https://github.com/symfony/polyfill-php85.git",
|
||||||
"reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6"
|
"reference": "94c794cb5ba51784bc259f11e9f128593297d8dc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/86a42cbcc07adc331481a5ab310a4024bfc227f6",
|
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/94c794cb5ba51784bc259f11e9f128593297d8dc",
|
||||||
"reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6",
|
"reference": "94c794cb5ba51784bc259f11e9f128593297d8dc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -6463,7 +6464,7 @@
|
|||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/polyfill-php85/tree/v1.43.0"
|
"source": "https://github.com/symfony/polyfill-php85/tree/v1.44.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -6483,8 +6484,8 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-09-25T15:46:47+00:00",
|
"time": "2026-10-30T15:20:09+00:00",
|
||||||
"published-time": "2026-09-30T10:23:32+00:00"
|
"published-time": "2026-11-15T14:20:22+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/process",
|
"name": "symfony/process",
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ POLL_INTERVAL_MS=2000
|
|||||||
# UPLOADS_PATH=/var/www/plenario-uploads
|
# UPLOADS_PATH=/var/www/plenario-uploads
|
||||||
IMAGE_MAX_UPLOAD_MB=10
|
IMAGE_MAX_UPLOAD_MB=10
|
||||||
IMAGE_MAX_PER_POLL=20
|
IMAGE_MAX_PER_POLL=20
|
||||||
|
# Countdown music of a presentation: largest upload in MB (PHP's upload_max_filesize and post_max_size must allow it)
|
||||||
|
AUDIO_MAX_UPLOAD_MB=10
|
||||||
# Embedded slides (/e/{key}/{slide}, e.g. Canva): heartbeat interval and timeout until pause (s)
|
# Embedded slides (/e/{key}/{slide}, e.g. Canva): heartbeat interval and timeout until pause (s)
|
||||||
EMBED_HEARTBEAT_SECONDS=5
|
EMBED_HEARTBEAT_SECONDS=5
|
||||||
EMBED_TIMEOUT_SECONDS=20
|
EMBED_TIMEOUT_SECONDS=20
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Migrations\BaseMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional audio file per presentation, played in the presenter view while a quiz countdown runs.
|
||||||
|
* The file lives in the upload directory, see \App\Service\AudioService; the table only holds its
|
||||||
|
* random file name.
|
||||||
|
*/
|
||||||
|
class AddAudioToPolls extends BaseMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$table = $this->table('polls');
|
||||||
|
if (!$table->hasColumn('audio')) {
|
||||||
|
$table->addColumn('audio', 'string', ['null' => true, 'default' => null, 'limit' => 40])->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
$table = $this->table('polls');
|
||||||
|
if ($table->hasColumn('audio')) {
|
||||||
|
$table->removeColumn('audio')->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,6 +69,11 @@ return [
|
|||||||
// Slides with an image per poll.
|
// Slides with an image per poll.
|
||||||
'maxPerPoll' => (int)env('IMAGE_MAX_PER_POLL', 20),
|
'maxPerPoll' => (int)env('IMAGE_MAX_PER_POLL', 20),
|
||||||
],
|
],
|
||||||
|
// Countdown audio of a presentation (see \App\Service\AudioService): stored as uploaded next to the images.
|
||||||
|
'audio' => [
|
||||||
|
// Largest accepted upload. PHP's upload_max_filesize/post_max_size must allow it.
|
||||||
|
'maxUploadBytes' => (int)env('AUDIO_MAX_UPLOAD_MB', 10) * 1024 * 1024,
|
||||||
|
],
|
||||||
// Slides embedded in other presentation software (/e/{key}/{slide}, e.g. Canva).
|
// Slides embedded in other presentation software (/e/{key}/{slide}, e.g. Canva).
|
||||||
'embed' => [
|
'embed' => [
|
||||||
// A visible embedded slide reports every N seconds that it is still on screen ...
|
// A visible embedded slide reports every N seconds that it is still on screen ...
|
||||||
|
|||||||
+9
-1
@@ -37,7 +37,11 @@ return function (RouteBuilder $routes): void {
|
|||||||
$builder->connect('/p/{code}/img/{file}', 'Participate::image', ['_name' => 'participate:image'])
|
$builder->connect('/p/{code}/img/{file}', 'Participate::image', ['_name' => 'participate:image'])
|
||||||
->setPatterns(['code' => '[A-Za-z0-9-]{4,16}', 'file' => '[a-f0-9]{24}\.webp'])
|
->setPatterns(['code' => '[A-Za-z0-9-]{4,16}', 'file' => '[a-f0-9]{24}\.webp'])
|
||||||
->setPass(['code', 'file']);
|
->setPass(['code', 'file']);
|
||||||
$builder->connect('/p/{code}/vote', 'Participate::vote', ['_name' => 'participate:vote'])
|
// Countdown audio of a poll (played by the presenter view): random file name, only files of this poll.
|
||||||
|
$builder->connect('/p/{code}/audio/{file}', 'Participate::audio', ['_name' => 'participate:audio'])
|
||||||
|
->setPatterns(['code' => '[A-Za-z0-9-]{4,16}', 'file' => '[a-f0-9]{24}\.(mp3|ogg|wav|m4a)'])
|
||||||
|
->setPass(['code', 'file']);
|
||||||
|
$builder->connect('/p/{code}/vote','Participate::vote', ['_name' => 'participate:vote'])
|
||||||
->setPatterns(['code' => '[A-Za-z0-9-]{4,16}'])
|
->setPatterns(['code' => '[A-Za-z0-9-]{4,16}'])
|
||||||
->setPass(['code'])
|
->setPass(['code'])
|
||||||
->setMethods(['POST']);
|
->setMethods(['POST']);
|
||||||
@@ -67,12 +71,16 @@ return function (RouteBuilder $routes): void {
|
|||||||
$admin->connect('/', 'Admin::index', ['_name' => 'admin'])->setPatterns($token);
|
$admin->connect('/', 'Admin::index', ['_name' => 'admin'])->setPatterns($token);
|
||||||
$admin->connect('/settings', 'Admin::settings', ['_name' => 'admin:settings'])
|
$admin->connect('/settings', 'Admin::settings', ['_name' => 'admin:settings'])
|
||||||
->setPatterns($token)->setMethods(['POST']);
|
->setPatterns($token)->setMethods(['POST']);
|
||||||
|
$admin->connect('/audio', 'Admin::audio', ['_name' => 'admin:audio'])
|
||||||
|
->setPatterns($token)->setMethods(['POST']);
|
||||||
$admin->connect('/rotate-token', 'Admin::rotateToken', ['_name' => 'admin:rotate'])
|
$admin->connect('/rotate-token', 'Admin::rotateToken', ['_name' => 'admin:rotate'])
|
||||||
->setPatterns($token)->setMethods(['POST']);
|
->setPatterns($token)->setMethods(['POST']);
|
||||||
$admin->connect('/rotate-embed-key', 'Admin::rotateEmbedKey', ['_name' => 'admin:rotate-embed'])
|
$admin->connect('/rotate-embed-key', 'Admin::rotateEmbedKey', ['_name' => 'admin:rotate-embed'])
|
||||||
->setPatterns($token)->setMethods(['POST']);
|
->setPatterns($token)->setMethods(['POST']);
|
||||||
$admin->connect('/reset', 'Admin::reset', ['_name' => 'admin:reset'])
|
$admin->connect('/reset', 'Admin::reset', ['_name' => 'admin:reset'])
|
||||||
->setPatterns($token)->setMethods(['POST']);
|
->setPatterns($token)->setMethods(['POST']);
|
||||||
|
$admin->connect('/clone', 'Admin::cloneAll', ['_name' => 'admin:clone'])
|
||||||
|
->setPatterns($token)->setMethods(['POST']);
|
||||||
$admin->connect('/delete', 'Admin::delete', ['_name' => 'admin:delete'])
|
$admin->connect('/delete', 'Admin::delete', ['_name' => 'admin:delete'])
|
||||||
->setPatterns($token)->setMethods(['POST']);
|
->setPatterns($token)->setMethods(['POST']);
|
||||||
$admin->connect('/present', 'Admin::present', ['_name' => 'admin:present'])->setPatterns($token);
|
$admin->connect('/present', 'Admin::present', ['_name' => 'admin:present'])->setPatterns($token);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ src/
|
|||||||
`protect()` (no-referrer/noindex/no-store für Seiten mit Geheimnis in der URL: Admin, Embed)
|
`protect()` (no-referrer/noindex/no-store für Seiten mit Geheimnis in der URL: Admin, Embed)
|
||||||
HomeController Startseite, Anlegen (/create), Bestätigung, Join, Recover
|
HomeController Startseite, Anlegen (/create), Bestätigung, Join, Recover
|
||||||
AdminAppController Basis für /admin/{token}: löst Poll über Token-Hash auf (404 sonst), setzt Privacy-Header (no-referrer, no-store)
|
AdminAppController Basis für /admin/{token}: löst Poll über Token-Hash auf (404 sonst), setzt Privacy-Header (no-referrer, no-store)
|
||||||
AdminController Dashboard, Settings, Present, State-JSON, Control, QR, PDF-Export, Token rotieren, Zurücksetzen, Löschen
|
AdminController Dashboard, Settings, Present, State-JSON, Control, QR, PDF-Export, Token rotieren, Zurücksetzen, Kopieren (`cloneAll`), Löschen
|
||||||
SlidesController Folien-CRUD, Ein-/Ausblenden (`visibility`), Duplizieren (`duplicate` → `SlidesTable::duplicate()`, Kopie direkt dahinter, öffnet das Formular der Kopie), Antworten offener Fragen bzw. Skala-Auswertung (`answers`), Sortieren (Drag & Drop/Pfeiltasten via `reorder`, JSON; erfordert JS), Antworten zurücksetzen,
|
SlidesController Folien-CRUD, Ein-/Ausblenden (`visibility`), Duplizieren (`duplicate` → `SlidesTable::duplicate()`, Kopie direkt dahinter, öffnet das Formular der Kopie), Antworten offener Fragen bzw. Skala-Auswertung (`answers`), Sortieren (Drag & Drop/Pfeiltasten via `reorder`, JSON; erfordert JS), Antworten zurücksetzen,
|
||||||
YouTube-Link prüfen (`youtubeCheck`, JSON)
|
YouTube-Link prüfen (`youtubeCheck`, JSON)
|
||||||
ParticipateController /p/{code}: Ansicht, State-JSON, Abstimmen, eigene Antwort/Kommentar bearbeiten; anonymes Cookie plenario_pid
|
ParticipateController /p/{code}: Ansicht, State-JSON, Abstimmen, eigene Antwort/Kommentar bearbeiten; anonymes Cookie plenario_pid
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ Folienbilder landen in `data/uploads` (anderer Ort: `UPLOADS_PATH`), nie unter `
|
|||||||
Datensicherung. Voraussetzungen: PHP-Erweiterung `gd` mit WebP sowie `upload_max_filesize` und `post_max_size` passend zu
|
Datensicherung. Voraussetzungen: PHP-Erweiterung `gd` mit WebP sowie `upload_max_filesize` und `post_max_size` passend zu
|
||||||
`IMAGE_MAX_UPLOAD_MB` (Standard 10 MB, PHP-Standard sind nur 2 MB bzw. 8 MB). Dateien ohne Folie (z. B. nach einem Absturz)
|
`IMAGE_MAX_UPLOAD_MB` (Standard 10 MB, PHP-Standard sind nur 2 MB bzw. 8 MB). Dateien ohne Folie (z. B. nach einem Absturz)
|
||||||
entfernt `bin/cake images_cleanup` (`--dry-run` zeigt sie nur an).
|
entfernt `bin/cake images_cleanup` (`--dry-run` zeigt sie nur an).
|
||||||
|
Die Quiz-Musik (eine Audiodatei je Präsentation) liegt im selben Verzeichnis; ihre Obergrenze steht in `AUDIO_MAX_UPLOAD_MB`
|
||||||
|
(Standard 10 MB), auch dafür müssen `upload_max_filesize` und `post_max_size` reichen.
|
||||||
|
|
||||||
Bei Updates: Code aktualisieren, `composer install --no-dev`, Migrationen und `cache clear_all` wiederholen.
|
Bei Updates: Code aktualisieren, `composer install --no-dev`, Migrationen und `cache clear_all` wiederholen.
|
||||||
|
|
||||||
|
|||||||
@@ -31,3 +31,20 @@ vendor/bin/phpcs # CakePHP Coding Standard (Autofix: vendor/bin/phpcbf)
|
|||||||
```
|
```
|
||||||
|
|
||||||
Vor jedem Commit müssen beide grün sein. `main` ist geschützt: Änderungen auf einem eigenen Branch pushen und per Pull Request mergen.
|
Vor jedem Commit müssen beide grün sein. `main` ist geschützt: Änderungen auf einem eigenen Branch pushen und per Pull Request mergen.
|
||||||
|
|
||||||
|
## Lasttest (JMeter)
|
||||||
|
|
||||||
|
`tests/load/plenario.jmx` simuliert Teilnehmende: Seite `/p/{code}` laden, kurz lesen, einmal auf der aktuellen
|
||||||
|
Auswahlfrage abstimmen (CSRF-Token, Folien- und Options-ID werden aus der Seite gelesen) und danach im
|
||||||
|
`Plenario.pollIntervalMs`-Takt `/p/{code}/state` abfragen. Jeder Thread hat eigene Cookies, ist also ein eigener Teilnehmer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
jmeter -n -t tests/load/plenario.jmx -Jhost=localhost -Jport=8765 -Jcode=ABCD \
|
||||||
|
-Jusers=200 -Jrampup=60 -Jduration=300 -l tmp/load.jtl -e -o tmp/load-report
|
||||||
|
```
|
||||||
|
|
||||||
|
Parameter: `protocol` (http), `host`, `port`, `code` (Join-Code), `users`, `rampup` (s), `duration` (s), `pollms` (2000).
|
||||||
|
Passende Testdaten legt `bin/cake polls seed` an: jeder Aufruf erzeugt eine **neue** Umfrage (neue ID und neuer Code)
|
||||||
|
mit je einer Folie pro interaktivem Typ; die erste Folie (Auswahlfrage) ist live und offen. `--json` liefert Code und
|
||||||
|
Admin-Link für Skripte, `--title`/`--email` passen die Daten an. Aufräumen: `bin/cake polls delete <id> -y`. Alle Last kommt von einer IP: bei
|
||||||
|
`THROTTLE_VOTES_PER_MINUTE` (Standard 600) antwortet die Abstimmung sonst mit 429. Nur gegen eigene Instanzen testen.
|
||||||
+7
-7
@@ -5,7 +5,7 @@ Dashboard-Fragmente, Farbschema, Textformatierung, Vollbild. CSP-Regeln stehen i
|
|||||||
## Dashboard ohne Neuladen
|
## Dashboard ohne Neuladen
|
||||||
|
|
||||||
- **Einklappbare Seitenleiste** der Verwaltung: `<details class="card collapsible">` mit `<summary><h2>`. Standard: Teilnahme,
|
- **Einklappbare Seitenleiste** der Verwaltung: `<details class="card collapsible">` mit `<summary><h2>`. Standard: Teilnahme,
|
||||||
Einstellungen (direkt unter dem QR-Code) offen; „Ergebnisse als PDF“, „In Präsentation einbetten“ und „Sicherheit“ zu.
|
Einstellungen (direkt unter dem QR-Code; beim Hover/Fokus erscheint „Als PNG speichern“, `data-qr-download` rendert das SVG per Canvas als 1024-px-PNG, nur im Admin) offen; „Ergebnisse als PDF“, „In Präsentation einbetten“ und „Sicherheit“ zu.
|
||||||
Offene Karten trennt eine Linie zwischen Überschrift und Inhalt.
|
Offene Karten trennt eine Linie zwischen Überschrift und Inhalt.
|
||||||
Anker-Links wie `#export` öffnen ihre Karte (`openCollapsible()` in `plenario.js`).
|
Anker-Links wie `#export` öffnen ihre Karte (`openCollapsible()` in `plenario.js`).
|
||||||
|
|
||||||
@@ -37,13 +37,13 @@ Neue Farben als Token in beiden Dark-Blöcken von `plenario.css` pflegen; auf de
|
|||||||
(Presenter/Embed; baut DOM-Knoten, kein `innerHTML`). Regeln in beiden gleich halten (Regex `INLINE`/`LIST_ITEM`),
|
(Presenter/Embed; baut DOM-Knoten, kein `innerHTML`). Regeln in beiden gleich halten (Regex `INLINE`/`LIST_ITEM`),
|
||||||
Tests: `FormatHelperTest.php`.
|
Tests: `FormatHelperTest.php`.
|
||||||
|
|
||||||
## Vollbild & Display anlassen
|
## Verwaltung: Menü-Drawer
|
||||||
|
|
||||||
- **Vollbild & Display anlassen** (Teilnehmeransicht, `initScreenTools` in `plenario.js`): zwei optionale Icon-Buttons im Header neben dem Farbschema-Schalter (Layout-Block `headerTools`)
|
- Die Seitenleiste der Verwaltung (Teilnahme, Einstellungen inkl. Einbetten und Kopieren, PDF, Sicherheit) wird unter 900 px zu einem Drawer von rechts.
|
||||||
(`data-fullscreen-toggle`, `data-wakelock-toggle`), bleiben ohne Browser-Unterstützung versteckt (iPhone-Safari kennt kein Vollbild).
|
Der Menü-Button (`data-drawer-toggle`, Layout-Block `headerMenu`) sitzt im Header rechts neben dem Farbschema-Schalter.
|
||||||
Der Wake Lock ist standardmäßig an (braucht keine Nutzergeste); nur ein bewusstes Ausschalten wird gemerkt.
|
`initDrawer` in `plenario.js` fügt dem `<aside>` die Klasse `sidebar--drawer` hinzu und zeigt den Button; ohne JS bleibt die
|
||||||
Die Seite lädt bei Folienwechsel neu: der Wake Lock wird per `sessionStorage` (`plenario-wakelock`) wieder angefordert,
|
Leiste ein normaler Block unter den Folien. Schließen: ✕, Klick auf den Hintergrund, Esc oder Anker-Link in der Leiste (`#export`, `#embed`).
|
||||||
Vollbild braucht eine Nutzergeste und muss nach dem Wechsel ggf. neu gewählt werden.
|
- Teilnehmeransicht: kein Vollbild- und kein Display-anlassen-Schalter (bewusst entfernt).
|
||||||
|
|
||||||
## Favicon
|
## Favicon
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,18 @@ Deploy erfolgt über Git (Remote: Gitea) mit `.gitea/workflows/ci.yml`:
|
|||||||
- Benötigte Variablen/Secrets sind im Kopf der Workflow-Datei dokumentiert. Zugangsdaten nur als
|
- Benötigte Variablen/Secrets sind im Kopf der Workflow-Datei dokumentiert. Zugangsdaten nur als
|
||||||
Gitea-Secret, nie ins Repo.
|
Gitea-Secret, nie ins Repo.
|
||||||
|
|
||||||
|
## Abhängigkeiten (Renovate)
|
||||||
|
|
||||||
|
`.gitea/workflows/renovate.yml` startet täglich (04:00 UTC) und manuell ([Actions → Renovate → Run workflow]) Renovate.
|
||||||
|
Es prüft Composer-Pakete (CakePHP-Version und Plugins), Docker-Basisimages und Actions in den Workflows und legt
|
||||||
|
PRs auf `renovate/*`-Branches an; dort läuft die normale CI, gemergt wird von Hand. Regeln in `renovate.json`:
|
||||||
|
CakePHP-Pakete in einem PR (auch das nächste Minor, da `5.4.*` gepinnt ist), Dev-Tools gebündelt, `composer.lock`-Pflege
|
||||||
|
montags, die PHP-Constraint wird nie automatisch angehoben. Außerdem pflegt Renovate das Issue „Dependency Dashboard“
|
||||||
|
mit allen offenen Updates. Das Secret `RENOVATE_TOKEN` (Gitea-Token mit `repository`, `issue`, `user`) liegt nur in den
|
||||||
|
Repo-Secrets, nie im Repo. Renovate ist per `RENOVATE_REPOSITORIES` auf dieses Repo beschränkt. Läuft unter dem Token-Besitzer
|
||||||
|
(PRs erscheinen unter dessen Namen, ohne Benachrichtigung für ihn); ein eigener Bot-Account lässt sich später durch Austausch
|
||||||
|
des Secrets einsetzen.
|
||||||
|
|
||||||
## Container (Docker)
|
## Container (Docker)
|
||||||
|
|
||||||
**Container (Docker) – nur für Testzwecke, nicht für den Produktivbetrieb geeignet** (eingebauter PHP-Server, SQLite; das steht
|
**Container (Docker) – nur für Testzwecke, nicht für den Produktivbetrieb geeignet** (eingebauter PHP-Server, SQLite; das steht
|
||||||
|
|||||||
+10
-2
@@ -23,8 +23,8 @@ Kein WebSocket: Presenter (`/admin/{token}/state`) und Teilnehmende (`/p/{code}/
|
|||||||
|
|
||||||
- **Pause:** `current_slide_id = null` + `paused_slide_id` = Pause (Teilnehmende sehen „Kurze Pause“), ohne
|
- **Pause:** `current_slide_id = null` + `paused_slide_id` = Pause (Teilnehmende sehen „Kurze Pause“), ohne
|
||||||
`paused_slide_id` = noch nicht gestartet. Immer über `Poll::showSlide()` / `showEmbeddedSlide()` / `pause()` /
|
`paused_slide_id` = noch nicht gestartet. Immer über `Poll::showSlide()` / `showEmbeddedSlide()` / `pause()` /
|
||||||
`forgetSlide()` setzen, nie `current_slide_id` direkt. Presenter: P bzw. der Pause-Button schaltet um (Aktionen `stop`/`resume`, beide idempotent, kein Server-Toggle),
|
`forgetSlide()` setzen, nie `current_slide_id` direkt. Presenter: B (Break; P funktioniert weiterhin) bzw. der Pause-Button schaltet um (Aktionen `stop`/`resume`, beide idempotent, kein Server-Toggle),
|
||||||
←/→ setzt ebenfalls bei der pausierten Folie fort.
|
←/→ setzt ebenfalls bei der pausierten Folie fort. Tasten zum Weiterschalten: →, ↓, Bild ab, Leertaste (vor) und ←, ↑, Bild auf (zurück); Presenter-Fernbedienungen senden oft ↑/↓.
|
||||||
Wird die Live- oder pausierte Folie gelöscht, pausiert die Umfrage und setzt mit der nachrückenden Folie fort
|
Wird die Live- oder pausierte Folie gelöscht, pausiert die Umfrage und setzt mit der nachrückenden Folie fort
|
||||||
(`forgetSlide()`, keine FKs auf `current_slide_id`/`paused_slide_id`, sie dürfen nie auf gelöschte Folien zeigen).
|
(`forgetSlide()`, keine FKs auf `current_slide_id`/`paused_slide_id`, sie dürfen nie auf gelöschte Folien zeigen).
|
||||||
|
|
||||||
@@ -56,6 +56,14 @@ Kein WebSocket: Presenter (`/admin/{token}/state`) und Teilnehmende (`/p/{code}/
|
|||||||
(`Slide::startFresh()`: Quiz `ready`, Q&A `collect`, sonst offen) – auch `add()` nutzt `startFresh()`.
|
(`Slide::startFresh()`: Quiz `ready`, Q&A `collect`, sonst offen) – auch `add()` nutzt `startFresh()`.
|
||||||
Tests: `DuplicateSlideTest.php`.
|
Tests: `DuplicateSlideTest.php`.
|
||||||
|
|
||||||
|
## Ganze Umfrage kopieren
|
||||||
|
|
||||||
|
- **Umfrage kopieren** (`admin:clone`, POST, Abschnitt unter „Einstellungen“ in der Verwaltung; `PollsTable::clonePoll()` + `SlidesTable::copyAllToPoll()`):
|
||||||
|
neue Umfrage „… (Kopie)“ mit gleicher E-Mail, `comment_speed`, allen Folien (Einstellungen, Optionen inkl. richtiger Antworten,
|
||||||
|
Ausblenden-Flag, Bilder als eigene Dateien) – **ohne Antworten**, nicht gestartet, mit neuem Code und neuem Admin-Link.
|
||||||
|
Der Link geht wie beim Anlegen per Mail an den Besitzer, danach Weiterleitung zur Verwaltung der Kopie. Alles in einer Transaktion,
|
||||||
|
bei Fehlern werden kopierte Bilddateien wieder gelöscht. Nutzt das Throttle-Bucket `create`.
|
||||||
|
|
||||||
## Einbettung
|
## Einbettung
|
||||||
|
|
||||||
- **Einbettung** (`/e/{key}/{id}`, `EmbedController`): eigener `embed_key` statt Admin-Token (darf nur diese Folie zeigen,
|
- **Einbettung** (`/e/{key}/{id}`, `EmbedController`): eigener `embed_key` statt Admin-Token (darf nur diese Folie zeigen,
|
||||||
|
|||||||
+47
-2
@@ -12,9 +12,14 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw.
|
|||||||
jeder Begriff einmal pro Person, beliebig viele Begriffe. Einen vorhandenen Begriff erneut nennen
|
jeder Begriff einmal pro Person, beliebig viele Begriffe. Einen vorhandenen Begriff erneut nennen
|
||||||
bzw. in der Wolke anklicken = Upvote (gleiche Zeile in `responses`). Mit `allow_upvotes` sehen Teilnehmende
|
bzw. in der Wolke anklicken = Upvote (gleiche Zeile in `responses`). Mit `allow_upvotes` sehen Teilnehmende
|
||||||
die Wolke live; Vorschläge inkl. Kölner Phonetik in `plenario.js` (`Words`).
|
die Wolke live; Vorschläge inkl. Kölner Phonetik in `plenario.js` (`Words`).
|
||||||
|
Teilnehmende sehen sie als kompakte Liste (`Results.wordList()`: feste Schriftgröße, Gewichtsbalken, große „+“/„−“-Buttons, wie beim Q&A-Voting),
|
||||||
|
die Bühne als Wolke, deren Schrift mit der Wortzahl kleiner wird (`--cloud-scale`).
|
||||||
Downvotes (`vote=down`, Setting `allow_downvotes`, nur zusammen mit Upvotes): Zeile mit `numeric_value = VoteService::DOWNVOTE` (-1),
|
Downvotes (`vote=down`, Setting `allow_downvotes`, nur zusammen mit Upvotes): Zeile mit `numeric_value = VoteService::DOWNVOTE` (-1),
|
||||||
nur auf fremde, vorhandene Begriffe, ein Rating pro Begriff und Person.
|
nur auf fremde, vorhandene Begriffe, ein Rating pro Begriff und Person.
|
||||||
Wortgröße richtet sich nur nach den Upvotes (`count`), Downvotes stehen separat in `down`.
|
Wortgröße richtet sich nur nach den Upvotes (`count`), Downvotes stehen separat in `down`.
|
||||||
|
Darstellung: Die Bühne zeigt die Wolke (`Results.wordcloud`); die Schriftgröße wird über `--cloud-scale` mit der Wortanzahl
|
||||||
|
kleiner, damit viele Begriffe nicht überlaufen. Teilnehmende sehen mit Upvotes stattdessen eine Liste
|
||||||
|
(`Results.wordList`, Klassen `wc-*`) mit „+“/„−“-Buttons und Gewichtsbalken, ähnlich dem Q&A-Voting.
|
||||||
`vote=remove` nimmt den eigenen Eintrag zu einem Begriff zurück (genannt/Upvote oder Downvote, `VoteService::removeWord()`,
|
`vote=remove` nimmt den eigenen Eintrag zu einem Begriff zurück (genannt/Upvote oder Downvote, `VoteService::removeWord()`,
|
||||||
löscht nur Zeilen mit dem eigenen `participant_hash`); Tippfehler = entfernen und neu eingeben, kein Bearbeiten (die Zeile
|
löscht nur Zeilen mit dem eigenen `participant_hash`); Tippfehler = entfernen und neu eingeben, kein Bearbeiten (die Zeile
|
||||||
ist zugleich die Stimme). Teilnehmende bekommen dafür `words.own` (eigene Begriffe wie eingegeben) und sehen sie als Chips mit „ד.
|
ist zugleich die Stimme). Teilnehmende bekommen dafür `words.own` (eigene Begriffe wie eingegeben) und sehen sie als Chips mit „ד.
|
||||||
@@ -28,10 +33,38 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw.
|
|||||||
`SlidesTable::closeIfExpired()` beim State-Abruf. **Zählungen und `is_correct` dürfen vor `finished` nie im
|
`SlidesTable::closeIfExpired()` beim State-Abruf. **Zählungen und `is_correct` dürfen vor `finished` nie im
|
||||||
JSON/HTML landen** (weder Presenter noch Teilnehmende); danach sehen Teilnehmende die Lösung und ob sie
|
JSON/HTML landen** (weder Presenter noch Teilnehmende); danach sehen Teilnehmende die Lösung und ob sie
|
||||||
richtig lagen (ohne Verteilung). Zurücksetzen setzt das Quiz wieder auf `ready`.
|
richtig lagen (ohne Verteilung). Zurücksetzen setzt das Quiz wieder auf `ready`.
|
||||||
|
- **Quiz-Musik:** je **Präsentation** (nicht je Folie) eine Audiodatei (`polls.audio`), hochgeladen im Menü unter „Einstellungen →
|
||||||
|
Musik zum Quiz-Countdown“ (gilt für alle Countdowns) (`Admin::audio`, Route `admin:audio`; Entfernen = Feld `remove`; Dropzone wie bei Folienbildern, nur kompakter: `initAudioForm()` sendet die Datei sofort nach Auswahl/Drop, ohne JavaScript der Button „Hochladen“). Gespeichert wird die Datei unverändert
|
||||||
|
(`AudioService`: Format nur an den ersten Bytes erkannt – MP3, M4A, OGG, WAV –, Zufallsname mit fester Endung, Obergrenze
|
||||||
|
`Plenario.audio.maxUploadBytes`) im Upload-Verzeichnis der Umfrage, ausgeliefert über `participate:audio` (`/p/{code}/audio/{file}`,
|
||||||
|
nur die Datei dieser Umfrage, feste Content-Type, Range-Anfragen). Im State steht `poll.audioUrl`. Abgespielt wird nur in der
|
||||||
|
Referentenansicht/Einbettung (`StageAudio` in `plenario.js`): als Schleife, solange irgendeine Folie mit Countdown (Quiz oder Zeitlimit) `running` ist, Stopp bei
|
||||||
|
Ende/Folienwechsel/Pause. Teilnehmende hören nichts. Blockiert der Browser den Start (keine Nutzeraktion), wird er beim
|
||||||
|
nächsten Klick/Tastendruck wiederholt. „Umfrage kopieren“ kopiert die Datei, Löschen der Umfrage und `images_cleanup` räumen sie mit auf.
|
||||||
**Klicker/Presenter-Stick** (sendet nur →/← bzw. Bild↑/↓): `AdminController::control` behandelt `next` auf einem Quiz als
|
**Klicker/Presenter-Stick** (sendet nur →/← bzw. Bild↑/↓): `AdminController::control` behandelt `next` auf einem Quiz als
|
||||||
Schritt – `ready` → starten, `running` → beenden (Lösung), erst `finished` → nächste Folie. `prev` geht immer zur vorigen Folie
|
Schritt – `ready` → starten, `running` → beenden (Lösung), erst `finished` → nächste Folie. `prev` geht immer zur vorigen Folie
|
||||||
und startet nie ein Quiz. Tests: `QuizClickerTest.php`.
|
und startet nie ein Quiz. Tests: `QuizClickerTest.php`.
|
||||||
|
|
||||||
|
## Countdown für alle Folien mit Antworten
|
||||||
|
|
||||||
|
- Jede Folie, auf der geantwortet wird, außer Q&A (`Slide::supportsTimer()`: Auswahl, Wortwolke, offene Frage, Skala, Reihenfolge, Quiz),
|
||||||
|
hat die Einstellung `time_limit` (Sekunden, `Slide::TIME_LIMITS`, **0 = kein Countdown**, Standard bei allen außer dem Quiz).
|
||||||
|
Formularfeld: `element/slide_time_limit`; das Quiz behält sein eigenes Feld (dort heißt 0 „ich beende selbst“).
|
||||||
|
- Mit Countdown (`Slide::usesPhases()`, beim Quiz immer) durchläuft die Folie dieselben **Phasen wie das Quiz**: `ready` → `running` →
|
||||||
|
`finished` (`Slide::phase()`, `null` ohne Countdown). `startFresh()` lässt sie geschlossen starten (`ready`), `setVotingOpen(true)`
|
||||||
|
startet das Zeitfenster (Start + Deadline), `SlidesTable::closeIfExpired()` schließt nach Ablauf. Nach dem Speichern im Formular wird eine
|
||||||
|
noch nicht gezeigte Folie neu initialisiert (`startFresh()`), damit eine geänderte Zeit sofort wirkt.
|
||||||
|
- Ablauf im Presenter (`AdminController::control()`): „Weiter“ startet den Countdown (`ready` → `running`), das nächste „Weiter“ beendet
|
||||||
|
ihn vorzeitig, erst das dritte geht zur nächsten Folie (wie beim Quiz; „Zurück“ rührt ihn nie an). **V** schaltet ebenso (erneutes
|
||||||
|
Öffnen startet den Countdown neu). Ohne Countdown wechselt das erste „Weiter“ direkt zur nächsten Folie.
|
||||||
|
- **`ready` zeigt nur die Frage:** `ResultsService::forStage()` (Presenter/Einbettung) liefert dann nur `{ready: true, timer}`, nie
|
||||||
|
Antworten, Zählungen oder Lösung; die Auswertung/PDF nutzt weiter `forSlide()` (ungegatet). `Slide::isOrderRevealed()` ist in `ready`
|
||||||
|
falsch, sonst würde die Reihenfolge-Lösung vor dem Start verraten. Teilnehmende sehen „Die Abstimmung startet gleich“ und können nicht
|
||||||
|
abstimmen (`VoteService`: „… noch nicht begonnen“). Private Folien zeigen wie sonst nur die Anzahl.
|
||||||
|
- State: `results.timer` = `{phase, timeLimit, remaining}` (Presenter/Einbettung, auch beim Quiz), `timer` im Teilnehmer-State (nicht beim
|
||||||
|
Quiz, der hat `quiz`). Die Bühne zeigt den Countdown unter der Frage (`[data-stage-timer]`, beim Quiz im Ergebnis); die Musik
|
||||||
|
(`poll.audioUrl`) läuft bei jeder laufenden Phase. Tests: `TimedSlideTest.php`, `QuizClickerTest.php`.
|
||||||
|
|
||||||
## Fragen & Antworten (Q&A)
|
## Fragen & Antworten (Q&A)
|
||||||
|
|
||||||
- Q&A-Folie (`qa`, „Fragen & Antworten“): Phasen `collect` → `vote` → `discuss` (`Slide::qaStage()`, `QaService`),
|
- Q&A-Folie (`qa`, „Fragen & Antworten“): Phasen `collect` → `vote` → `discuss` (`Slide::qaStage()`, `QaService`),
|
||||||
@@ -50,8 +83,9 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw.
|
|||||||
Teilnehmende sehen alle Fragen in Eingangsreihenfolge **ohne** Zählung; die Bühne (Presenter/Embed) zeigt in `vote` keine Fragen,
|
Teilnehmende sehen alle Fragen in Eingangsreihenfolge **ohne** Zählung; die Bühne (Presenter/Embed) zeigt in `vote` keine Fragen,
|
||||||
sondern nur den Hinweis „Schau auf dein Gerät und stimme ab“ mit Fragenzahl, Budget und vergebener Gesamtsumme (`Results.qa`); auch sonst gibt es dort
|
sondern nur den Hinweis „Schau auf dein Gerät und stimme ab“ mit Fragenzahl, Budget und vergebener Gesamtsumme (`Results.qa`); auch sonst gibt es dort
|
||||||
keine Zählungen je Frage und keine Rangfolge (`ResultsService::qa()`, nur die Summe `upvotes`), damit niemand beeinflusst wird. `discuss`: Abstimmung zu, Fragen nach Upvotes
|
keine Zählungen je Frage und keine Rangfolge (`ResultsService::qa()`, nur die Summe `upvotes`), damit niemand beeinflusst wird. `discuss`: Abstimmung zu, Fragen nach Upvotes
|
||||||
sortiert (Gleichstand: älteste zuerst), `focus_response_id` = aktuelle Frage. In `discuss` blättern next/prev
|
sortiert (Gleichstand: älteste zuerst), `focus_response_id` = aktuelle Frage. „Weiter“ (next, →/Klicker) geht
|
||||||
(→/←, Klicker) zuerst durch die Fragen, erst danach durch die Folien. Fokuswechsel per `updateAll` ohne `modified`,
|
zuerst durch die Phasen (`collect` → `vote` → `discuss`, `QaService::advance()`), dann durch die Fragen, erst danach zur nächsten Folie;
|
||||||
|
„Zurück“ blättert nur in `discuss` durch die Fragen. Fokuswechsel per `updateAll` ohne `modified`,
|
||||||
damit Teilnehmerseiten nicht neu laden. Teilnehmende bekommen nie `results`, sondern `qa` aus `PollStateService::qaState()`.
|
damit Teilnehmerseiten nicht neu laden. Teilnehmende bekommen nie `results`, sondern `qa` aus `PollStateService::qaState()`.
|
||||||
Zurücksetzen startet wieder bei `collect`.
|
Zurücksetzen startet wieder bei `collect`.
|
||||||
**Vorab eingereichte Fragen** (z. B. per Mail): Textarea `prepared_text` im Folienformular (eine Frage pro Zeile, höchstens
|
**Vorab eingereichte Fragen** (z. B. per Mail): Textarea `prepared_text` im Folienformular (eine Frage pro Zeile, höchstens
|
||||||
@@ -81,6 +115,7 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw.
|
|||||||
per Drag & Drop/Pfeiltasten sortierbar, ids bleiben beim Umsortieren erhalten). Teilnehmende bekommen sie per
|
per Drag & Drop/Pfeiltasten sortierbar, ids bleiben beim Umsortieren erhalten). Teilnehmende bekommen sie per
|
||||||
`Slide::shuffledOptions(participantHash)` gemischt (stabil, nie schon richtig), sortieren und senden `order[]` (alle ids genau einmal),
|
`Slide::shuffledOptions(participantHash)` gemischt (stabil, nie schon richtig), sortieren und senden `order[]` (alle ids genau einmal),
|
||||||
einmal pro Person. Startet offen wie normale Folien; **aufgelöst wird beim Schließen der Abstimmung** (`Slide::isOrderRevealed()`).
|
einmal pro Person. Startet offen wie normale Folien; **aufgelöst wird beim Schließen der Abstimmung** (`Slide::isOrderRevealed()`).
|
||||||
|
„Weiter“ (→/Leertaste) schließt eine noch offene Reihenfolge-Folie zuerst (Auflösung) und wechselt erst beim nächsten Druck.
|
||||||
Vorher landen weder richtige Reihenfolge noch Zählungen im JSON (Presenter sieht die Einträge gemischt mit Seed `slide:{id}`);
|
Vorher landen weder richtige Reihenfolge noch Zählungen im JSON (Presenter sieht die Einträge gemischt mit Seed `slide:{id}`);
|
||||||
danach sieht der Presenter die Lösung inkl. „X von N komplett richtig“ und je Eintrag, wie oft er an der richtigen Stelle lag;
|
danach sieht der Presenter die Lösung inkl. „X von N komplett richtig“ und je Eintrag, wie oft er an der richtigen Stelle lag;
|
||||||
Teilnehmende nur die Lösung mit eigenen Platzierungen und `order.isCorrect`. Tests: `OrderTest.php`, `OrderSlideTest.php`.
|
Teilnehmende nur die Lösung mit eigenen Platzierungen und `order.isCorrect`. Tests: `OrderTest.php`, `OrderSlideTest.php`.
|
||||||
@@ -117,6 +152,16 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw.
|
|||||||
(`Results.scaleLayout()` / `Results.donut()`). Setting `scale_view` (`Slide::SCALE_VIEWS`: `both` | `average` | `chart`,
|
(`Results.scaleLayout()` / `Results.donut()`). Setting `scale_view` (`Slide::SCALE_VIEWS`: `both` | `average` | `chart`,
|
||||||
Dropdown im Formular) zeigt nur einen Teil, dann zentriert; im JSON `results.view`, die Daten bleiben vollständig.
|
Dropdown im Formular) zeigt nur einen Teil, dann zentriert; im JSON `results.view`, die Daten bleiben vollständig.
|
||||||
Gilt nur für Presenter/Embed, Auswertung und PDF zeigen immer beides.
|
Gilt nur für Presenter/Embed, Auswertung und PDF zeigen immer beides.
|
||||||
|
- **Nur Kommentar ohne Bewertung/Auswahl** (Skala/Sterne und Auswahlfolien, Setting `comment_only` zusätzlich zu `comments`, `Slide::hasCommentOnly()`; im Formular ein Dropdown
|
||||||
|
`comment_mode`: kein Kommentarfeld | Kommentar optional, Bewertung Pflicht | auch Kommentar ohne Bewertung genügt, `SlidesTable::sanitizeSettings()` übersetzt es in
|
||||||
|
`comments`/`comment_only`): die Bewertung ist dann nicht mehr Pflicht (die Radios sind nicht `required`), ein nicht leerer Kommentar genügt. `VoteService::scaleRows()` speichert eine Zeile **ohne** `numeric_value`: zählt als Teilnahme (einmal pro Person),
|
||||||
|
geht aber nicht in Verteilung und Durchschnitt ein. Weder Bewertung noch Kommentar = Fehler, es gibt keinen leeren „Überspringen“-Knopf.
|
||||||
|
`ResultsService::scaleResults()` liefert die Zahl als `commentOnly` (Bühne: „· N× nur Kommentar“, Auswertung, PDF; private Folien strippen sie
|
||||||
|
mit `withoutContents()`). Der Kommentar läuft wie die anderen durch, `value` ist `null` (mit `comment_ratings` zeigt die Bühne „Ohne Bewertung“, damit
|
||||||
|
die Box gleich hoch bleibt). Nachträglich bearbeiten geht, aber der Kommentar darf dann nicht leer werden (`editText()`).
|
||||||
|
**Auswahlfolien** (Mehrfachauswahl wie Einzelauswahl) verhalten sich genauso: Zeile ohne `slide_option_id` (`ResultsService::choice()` zählt sie nur als `commentOnly`, nicht in Stimmen/Prozenten); `commentSettings()` in `SlidesTable` ist für beide Typen gleich. Tests: `VoteServiceTest`, `ParticipateControllerTest`.
|
||||||
|
- **Enthaltung bei Auswahlfolien:** kein eigenes Feature, sondern eine normale Option (zählt in Prozenten mit, wie bei Vereinsabstimmungen üblich).
|
||||||
|
Im Folienformular fügt der Button „Option ‚Enthaltung‘ hinzufügen“ (`data-add-option`, `initAddOption()` in `plenario.js`, idempotent, nur mit JS sichtbar) die Zeile ein.
|
||||||
- **Antwort nachträglich bearbeiten** (gegen Tippfehler, `VoteService::hasEditableText()`): Antwort einer offenen Frage
|
- **Antwort nachträglich bearbeiten** (gegen Tippfehler, `VoteService::hasEditableText()`): Antwort einer offenen Frage
|
||||||
(darf nicht leer werden) bzw. Kommentar einer Skala (ändern, ergänzen, leeren; die Bewertung bleibt unveränderlich),
|
(darf nicht leer werden) bzw. Kommentar einer Skala (ändern, ergänzen, leeren; die Bewertung bleibt unveränderlich),
|
||||||
nur solange die Abstimmung offen ist. `participate:edit` → `VoteService::editText()`, gleiche Vorbedingungen wie
|
nur solange die Abstimmung offen ist. `participate:edit` → `VoteService::editText()`, gleiche Vorbedingungen wie
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": ["config:recommended"],
|
||||||
|
"timezone": "Europe/Berlin",
|
||||||
|
"labels": ["dependencies"],
|
||||||
|
"prConcurrentLimit": 5,
|
||||||
|
"lockFileMaintenance": {
|
||||||
|
"enabled": true,
|
||||||
|
"schedule": ["before 6am on monday"]
|
||||||
|
},
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"description": "CakePHP core and its official plugins in one PR (also proposes the next minor, e.g. 5.4.* -> 5.5.*)",
|
||||||
|
"matchPackageNames": ["cakephp/**"],
|
||||||
|
"groupName": "CakePHP",
|
||||||
|
"rangeStrategy": "replace"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Dev tools (phpunit, phpcs, bake, debug_kit) as one PR",
|
||||||
|
"matchDepTypes": ["require-dev"],
|
||||||
|
"groupName": "dev dependencies",
|
||||||
|
"matchPackageNames": [
|
||||||
|
"!cakephp/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Keep the PHP constraint in step with the CI matrix; never bump it automatically",
|
||||||
|
"matchPackageNames": ["php"],
|
||||||
|
"enabled": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ class ImagesCleanupCommand extends Command
|
|||||||
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
|
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
|
||||||
{
|
{
|
||||||
return $parser
|
return $parser
|
||||||
->setDescription(__('Löscht Bilddateien, die zu keiner Folie mehr gehören.'))
|
->setDescription(__('Löscht Bild- und Audiodateien, die zu keiner Folie mehr gehören.'))
|
||||||
->addOption('dry-run', [
|
->addOption('dry-run', [
|
||||||
'help' => __('Nur anzeigen, nichts löschen.'),
|
'help' => __('Nur anzeigen, nichts löschen.'),
|
||||||
'boolean' => true,
|
'boolean' => true,
|
||||||
@@ -57,6 +57,15 @@ class ImagesCleanupCommand extends Command
|
|||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$referenced[(int)$row['poll_id']][] = (string)$row['image'];
|
$referenced[(int)$row['poll_id']][] = (string)$row['image'];
|
||||||
}
|
}
|
||||||
|
// The countdown audio of a poll shares the upload directory with its images.
|
||||||
|
$audio = $this->fetchTable('Polls')->find()
|
||||||
|
->select(['id', 'audio'])
|
||||||
|
->where(['audio IS NOT' => null])
|
||||||
|
->disableHydration()
|
||||||
|
->all();
|
||||||
|
foreach ($audio as $row) {
|
||||||
|
$referenced[(int)$row['id']][] = (string)$row['audio'];
|
||||||
|
}
|
||||||
|
|
||||||
$dryRun = (bool)$args->getOption('dry-run');
|
$dryRun = (bool)$args->getOption('dry-run');
|
||||||
$removed = (new ImageService())->cleanup($referenced, $dryRun);
|
$removed = (new ImageService())->cleanup($referenced, $dryRun);
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use App\Model\Entity\Slide;
|
||||||
|
use Cake\Console\Arguments;
|
||||||
|
use Cake\Console\ConsoleIo;
|
||||||
|
use Cake\Console\ConsoleOptionParser;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a fresh demo poll with one slide of every interactive type, e.g. as target of the JMeter load test
|
||||||
|
* (tests/load/plenario.jmx). Every run creates a NEW poll (new id and join code); the first slide, a choice
|
||||||
|
* question, is live and open for voting. Remove them again with `bin/cake polls delete`.
|
||||||
|
*
|
||||||
|
* Usage: bin/cake polls seed [--title "..."] [--email "..."] [--json]
|
||||||
|
*/
|
||||||
|
class PollsSeedCommand extends PollsCommand
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function defaultName(): string
|
||||||
|
{
|
||||||
|
return 'polls seed';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Cake\Console\ConsoleOptionParser $parser Parser
|
||||||
|
* @return \Cake\Console\ConsoleOptionParser
|
||||||
|
*/
|
||||||
|
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
|
||||||
|
{
|
||||||
|
return $parser
|
||||||
|
->setDescription(__('Legt eine neue Demo-Umfrage mit Beispielfolien an (z. B. für den Lasttest). Jeder Aufruf erzeugt eine neue Umfrage.'))
|
||||||
|
->addOption('title', [
|
||||||
|
'help' => __('Titel der Umfrage.'),
|
||||||
|
'default' => 'Lasttest',
|
||||||
|
])
|
||||||
|
->addOption('email', [
|
||||||
|
'help' => __('E-Mail-Adresse des Besitzers (es wird nichts verschickt).'),
|
||||||
|
'default' => 'lasttest@example.org',
|
||||||
|
])
|
||||||
|
->addOption('json', [
|
||||||
|
'help' => __('Ausgabe als JSON statt als Text (für Skripte), inkl. Admin-Link.'),
|
||||||
|
'boolean' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Cake\Console\Arguments $args Arguments
|
||||||
|
* @param \Cake\Console\ConsoleIo $io Console
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function execute(Arguments $args, ConsoleIo $io): int
|
||||||
|
{
|
||||||
|
$polls = $this->polls();
|
||||||
|
$slides = $this->fetchTable('Slides');
|
||||||
|
|
||||||
|
$result = $polls->getConnection()->transactional(function () use ($polls, $slides, $args): array {
|
||||||
|
[$poll, $token] = $polls->createPoll([
|
||||||
|
'title' => (string)$args->getOption('title'),
|
||||||
|
'email' => (string)$args->getOption('email'),
|
||||||
|
]);
|
||||||
|
if ($token === null) {
|
||||||
|
return [$poll, null, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$first = null;
|
||||||
|
$count = 0;
|
||||||
|
foreach ($this->definitions() as [$type, $question, $options, $correct]) {
|
||||||
|
$slide = $slides->newEntity([
|
||||||
|
'type' => $type,
|
||||||
|
'question' => $question,
|
||||||
|
'settings' => Slide::DEFAULT_SETTINGS[$type] ?? [],
|
||||||
|
]);
|
||||||
|
$slide->poll_id = $poll->id;
|
||||||
|
$slides->saveOrFail($slide);
|
||||||
|
if ($options !== []) {
|
||||||
|
$slides->syncOptions($slide, $options, $correct);
|
||||||
|
}
|
||||||
|
$first ??= $slide;
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$poll->showSlide($first->id);
|
||||||
|
$polls->saveOrFail($poll);
|
||||||
|
|
||||||
|
return [$poll, $token, $count];
|
||||||
|
});
|
||||||
|
|
||||||
|
[$poll, $token, $count] = $result;
|
||||||
|
if ($token === null) {
|
||||||
|
$io->err(__('Umfrage konnte nicht angelegt werden: {0}', (string)json_encode($poll->getErrors())));
|
||||||
|
|
||||||
|
return static::CODE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
$adminUrl = Router::url(['_name' => 'admin', 'token' => $token], true);
|
||||||
|
if ($args->getOption('json')) {
|
||||||
|
$this->printJson($io, $this->pollData($poll) + ['slides' => $count, 'adminUrl' => $adminUrl]);
|
||||||
|
|
||||||
|
return static::CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
$io->out([
|
||||||
|
__('Umfrage #{0} angelegt mit {1} Folien (erste Folie live, Abstimmung offen).', $poll->id, $count),
|
||||||
|
__('Beitrittscode: {0}', $poll->join_code),
|
||||||
|
__('Teilnahme-Link: {0}', $this->joinLink($poll)),
|
||||||
|
__('Admin-Link: {0}', $adminUrl),
|
||||||
|
__('Lasttest: jmeter -n -t tests/load/plenario.jmx -Jcode={0} …', $poll->join_code),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return static::CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<array{0: string, 1: string, 2: list<string>, 3: list<string>}> Type, question, options, correct options
|
||||||
|
*/
|
||||||
|
protected function definitions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[Slide::TYPE_CHOICE, 'Wie gefällt dir PlenarIO?', ['Super', 'Gut', 'Geht so', 'Gar nicht'], []],
|
||||||
|
[Slide::TYPE_WORDCLOUD, 'Was fällt dir zu Live-Umfragen ein?', [], []],
|
||||||
|
[Slide::TYPE_OPEN, 'Was wünschst du dir für heute?', [], []],
|
||||||
|
[Slide::TYPE_SCALE, 'Wie zufrieden bist du?', [], []],
|
||||||
|
[Slide::TYPE_QUIZ, 'Wie viele Kontinente gibt es?', ['7', '5', '6', '8'], ['7']],
|
||||||
|
[Slide::TYPE_QA, 'Stell deine Frage', [], []],
|
||||||
|
[Slide::TYPE_ORDER, 'Bringe die Planeten in die richtige Reihenfolge', ['Merkur', 'Venus', 'Erde', 'Mars'], []],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ use App\Mailer\PollMailer;
|
|||||||
use App\Model\Entity\Slide;
|
use App\Model\Entity\Slide;
|
||||||
use App\Model\Table\ResponsesTable;
|
use App\Model\Table\ResponsesTable;
|
||||||
use App\Model\Table\SlidesTable;
|
use App\Model\Table\SlidesTable;
|
||||||
|
use App\Service\AudioService;
|
||||||
|
use App\Service\ImageException;
|
||||||
use App\Service\PollStateService;
|
use App\Service\PollStateService;
|
||||||
use App\Service\QaService;
|
use App\Service\QaService;
|
||||||
use App\Service\ReportService;
|
use App\Service\ReportService;
|
||||||
@@ -20,6 +22,8 @@ use Cake\Routing\Router;
|
|||||||
use chillerlan\QRCode\Output\QRMarkupSVG;
|
use chillerlan\QRCode\Output\QRMarkupSVG;
|
||||||
use chillerlan\QRCode\QRCode;
|
use chillerlan\QRCode\QRCode;
|
||||||
use chillerlan\QRCode\QROptions;
|
use chillerlan\QRCode\QROptions;
|
||||||
|
use Psr\Http\Message\UploadedFileInterface;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Poll level admin actions: dashboard, settings, presenter mode, export.
|
* Poll level admin actions: dashboard, settings, presenter mode, export.
|
||||||
@@ -88,6 +92,53 @@ class AdminController extends AdminAppController
|
|||||||
return $this->redirect($this->adminUrl());
|
return $this->redirect($this->adminUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Countdown music of the presentation: uploads a new file (replaces the old one) or, with
|
||||||
|
* `remove` = 1, deletes it. Old files are deleted after saving, never before.
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
*/
|
||||||
|
public function audio(): ?Response
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post']);
|
||||||
|
$service = new AudioService();
|
||||||
|
$old = $this->poll->audio;
|
||||||
|
$upload = $this->request->getUploadedFile('audio');
|
||||||
|
$hasUpload = $upload instanceof UploadedFileInterface && $upload->getError() !== UPLOAD_ERR_NO_FILE;
|
||||||
|
$back = $this->adminUrl() + ['#' => 'audio'];
|
||||||
|
|
||||||
|
if ($hasUpload) {
|
||||||
|
try {
|
||||||
|
$new = $service->store($upload, $this->poll->id);
|
||||||
|
} catch (ImageException $e) {
|
||||||
|
$this->Flash->error($e->getMessage());
|
||||||
|
|
||||||
|
return $this->redirect($back);
|
||||||
|
}
|
||||||
|
} elseif (filter_var($this->request->getData('remove'), FILTER_VALIDATE_BOOLEAN)) {
|
||||||
|
$new = null;
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('Bitte wähle eine Audiodatei aus.'));
|
||||||
|
|
||||||
|
return $this->redirect($back);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->poll->set('audio', $new);
|
||||||
|
try {
|
||||||
|
$this->Polls->saveOrFail($this->poll);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
$service->delete($this->poll->id, $new);
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
if ($old !== null && $old !== $new) {
|
||||||
|
$service->delete($this->poll->id, $old);
|
||||||
|
}
|
||||||
|
$this->Flash->success($new === null ? __('Audiodatei entfernt.') : __('Audiodatei gespeichert.'));
|
||||||
|
|
||||||
|
return $this->redirect($back);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalidates the current admin link and mails a new one.
|
* Invalidates the current admin link and mails a new one.
|
||||||
*
|
*
|
||||||
@@ -141,6 +192,43 @@ class AdminController extends AdminAppController
|
|||||||
return $this->redirect($this->adminUrl());
|
return $this->redirect($this->adminUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clones the whole presentation (slides, settings, images) without any responses into a new poll with
|
||||||
|
* its own admin link, which is mailed to the owner like after creating a poll.
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
*/
|
||||||
|
public function cloneAll(): ?Response
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post']);
|
||||||
|
if (!$this->throttle('create', 'Plenario.throttle.createPerHour')) {
|
||||||
|
$this->Flash->error(__('Zu viele Umfragen in kurzer Zeit. Bitte versuche es später noch einmal.'));
|
||||||
|
|
||||||
|
return $this->redirect($this->adminUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
[$copy, $token] = $this->Polls->clonePoll($this->poll, $this->Slides->listForPoll($this->poll->id));
|
||||||
|
} catch (Throwable) {
|
||||||
|
$token = null;
|
||||||
|
}
|
||||||
|
if ($token === null) {
|
||||||
|
$this->Flash->error(__('Die Umfrage konnte nicht kopiert werden.'));
|
||||||
|
|
||||||
|
return $this->redirect($this->adminUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
$adminUrl = $this->adminUrlFor($token);
|
||||||
|
$sent = (new PollMailer())->sendSafely('adminLink', [$copy, $adminUrl, $this->joinUrl($copy)]);
|
||||||
|
if ($sent) {
|
||||||
|
$this->Flash->success(__('Kopie angelegt, ohne Antworten. Der Admin-Link der Kopie wurde per E-Mail verschickt – speichere dir diese Seite als Lesezeichen.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->warning(__('Kopie angelegt, ohne Antworten. Die E-Mail mit dem Admin-Link konnte nicht verschickt werden – speichere dir diese Seite unbedingt als Lesezeichen!'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect($this->adminUrlFor($token));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the whole poll incl. slides and responses.
|
* Deletes the whole poll incl. slides and responses.
|
||||||
*
|
*
|
||||||
@@ -235,8 +323,9 @@ class AdminController extends AdminAppController
|
|||||||
* SlideControlService (open, close, toggle, stage, question).
|
* SlideControlService (open, close, toggle, stage, question).
|
||||||
*
|
*
|
||||||
* On a Q&A slide that is being discussed, next/prev step through the questions
|
* On a Q&A slide that is being discussed, next/prev step through the questions
|
||||||
* first (like builds in presentation software); on a quiz, next starts it and then ends it
|
* first (like builds in presentation software); on a slide with a countdown (quiz, or any slide with a time limit), next starts it and then ends it
|
||||||
* before moving on, prev always goes to the previous slide. While paused, next/prev resume
|
* before moving on, on an open ordering slide next closes it (reveals the solution),
|
||||||
|
* prev always goes to the previous slide. While paused, next/prev resume
|
||||||
* the slide that was live before.
|
* the slide that was live before.
|
||||||
*
|
*
|
||||||
* Answers with the new state as JSON for XHR requests, otherwise redirects back.
|
* Answers with the new state as JSON for XHR requests, otherwise redirects back.
|
||||||
@@ -252,17 +341,18 @@ class AdminController extends AdminAppController
|
|||||||
$ids = array_map(fn(Slide $s) => $s->id, $slides);
|
$ids = array_map(fn(Slide $s) => $s->id, $slides);
|
||||||
$index = array_search($this->poll->current_slide_id, $ids, true);
|
$index = array_search($this->poll->current_slide_id, $ids, true);
|
||||||
$current = $index === false ? null : $slides[$index];
|
$current = $index === false ? null : $slides[$index];
|
||||||
if (
|
// Q&A: forward first walks through the stages (collect → vote → discuss), then through the questions,
|
||||||
$current !== null
|
// only after the last one it goes to the next slide. Back only steps through the questions.
|
||||||
&& $current->isQa()
|
if ($current !== null && $current->isQa() && in_array($action, ['next', 'prev'], true)) {
|
||||||
&& in_array($action, ['next', 'prev'], true)
|
$qa = new QaService();
|
||||||
&& (new QaService())->moveFocus($current, $action === 'next' ? 1 : -1)
|
if ($qa->moveFocus($current, $action === 'next' ? 1 : -1) || ($action === 'next' && $qa->advance($current))) {
|
||||||
) {
|
|
||||||
$action = 'none';
|
$action = 'none';
|
||||||
}
|
}
|
||||||
// Forward on a quiz is a build step too: start it, then end it, only then the next slide.
|
}
|
||||||
// Back never touches the quiz, so a clicker can page through the slides afterwards.
|
// Forward on a slide with a countdown (every quiz, any other slide with a time limit) is a build step too:
|
||||||
if ($current !== null && $current->isQuiz() && $action === 'next') {
|
// start it, then end it, only then the next slide.
|
||||||
|
// Back never touches it, so a clicker can page through the slides afterwards.
|
||||||
|
if ($current !== null && $current->usesPhases() && $action === 'next') {
|
||||||
$phase = $current->quizPhase();
|
$phase = $current->quizPhase();
|
||||||
if ($phase !== Slide::QUIZ_FINISHED) {
|
if ($phase !== Slide::QUIZ_FINISHED) {
|
||||||
(new SlideControlService())->apply($current, $phase === Slide::QUIZ_READY ? 'open' : 'close');
|
(new SlideControlService())->apply($current, $phase === Slide::QUIZ_READY ? 'open' : 'close');
|
||||||
@@ -270,6 +360,12 @@ class AdminController extends AdminAppController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// An ordering slide without countdown: forward first closes the voting (reveals the solution).
|
||||||
|
if ($current !== null && $current->isOrder() && $action === 'next' && $current->isVotingOpen()) {
|
||||||
|
(new SlideControlService())->apply($current, 'close');
|
||||||
|
$action = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'none':
|
case 'none':
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace App\Controller;
|
|||||||
use App\Model\Entity\Poll;
|
use App\Model\Entity\Poll;
|
||||||
use App\Model\Entity\Slide;
|
use App\Model\Entity\Slide;
|
||||||
use App\Model\Table\PollsTable;
|
use App\Model\Table\PollsTable;
|
||||||
|
use App\Service\AudioService;
|
||||||
use App\Service\ImageService;
|
use App\Service\ImageService;
|
||||||
use App\Service\PollStateService;
|
use App\Service\PollStateService;
|
||||||
use App\Service\VoteException;
|
use App\Service\VoteException;
|
||||||
@@ -50,7 +51,7 @@ class ParticipateController extends AppController
|
|||||||
public function beforeFilter(EventInterface $event): void
|
public function beforeFilter(EventInterface $event): void
|
||||||
{
|
{
|
||||||
parent::beforeFilter($event);
|
parent::beforeFilter($event);
|
||||||
if ($this->request->getParam('action') === 'image') {
|
if (in_array($this->request->getParam('action'), ['image', 'audio'], true)) {
|
||||||
// Cacheable static content: no participant id, no cookie.
|
// Cacheable static content: no participant id, no cookie.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -124,6 +125,29 @@ class ParticipateController extends AppController
|
|||||||
->withHeader('Cache-Control', 'private, max-age=31536000, immutable');
|
->withHeader('Cache-Control', 'private, max-age=31536000, immutable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serves the countdown audio of this poll (random file name, cached for good, supports range
|
||||||
|
* requests so browsers can loop and seek). Content type is fixed by the extension, never sniffed.
|
||||||
|
*
|
||||||
|
* @param string $code Join code
|
||||||
|
* @param string $file Stored file name
|
||||||
|
* @return \Cake\Http\Response
|
||||||
|
*/
|
||||||
|
public function audio(string $code, string $file): Response
|
||||||
|
{
|
||||||
|
$poll = $this->loadPoll($code);
|
||||||
|
$path = $poll->audio === $file ? (new AudioService())->path($poll->id, $file) : null;
|
||||||
|
if ($path === null) {
|
||||||
|
throw new NotFoundException(__('Audiodatei nicht gefunden.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response
|
||||||
|
->withFile($path)
|
||||||
|
->withHeader('Content-Type', AudioService::contentType($file))
|
||||||
|
->withHeader('X-Content-Type-Options', 'nosniff')
|
||||||
|
->withHeader('Cache-Control', 'private, max-age=31536000, immutable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $code Join code
|
* @param string $code Join code
|
||||||
* @return \Cake\Http\Response
|
* @return \Cake\Http\Response
|
||||||
|
|||||||
@@ -302,7 +302,13 @@ class SlidesController extends AdminAppController
|
|||||||
// is_voting_open is presenter state (SlideControlService), never editable via the form.
|
// is_voting_open is presenter state (SlideControlService), never editable via the form.
|
||||||
$fields = ['type', 'question', 'description', 'settings'];
|
$fields = ['type', 'question', 'description', 'settings'];
|
||||||
$youtube = $slide->isYouTube() ? $this->prepareYouTube($data) : ['errors' => [], 'warning' => null];
|
$youtube = $slide->isYouTube() ? $this->prepareYouTube($data) : ['errors' => [], 'warning' => null];
|
||||||
|
// A slide that has not been presented yet starts again after the (possibly changed) time limit is known:
|
||||||
|
// with a countdown it waits for the presenter, without it is open.
|
||||||
|
$fresh = $slide->isNew() || $slide->isFresh();
|
||||||
$this->Slides->patchEntity($slide, $data, ['fields' => $fields, 'associated' => []]);
|
$this->Slides->patchEntity($slide, $data, ['fields' => $fields, 'associated' => []]);
|
||||||
|
if ($fresh) {
|
||||||
|
$slide->startFresh();
|
||||||
|
}
|
||||||
foreach ($youtube['errors'] as $field => $message) {
|
foreach ($youtube['errors'] as $field => $message) {
|
||||||
$slide->setError($field, $message);
|
$slide->setError($field, $message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use Cake\ORM\Entity;
|
|||||||
* @property int|null $paused_slide_id
|
* @property int|null $paused_slide_id
|
||||||
* @property bool $is_active
|
* @property bool $is_active
|
||||||
* @property int $comment_speed Speed of rotating scale comments in percent, see COMMENT_SPEEDS
|
* @property int $comment_speed Speed of rotating scale comments in percent, see COMMENT_SPEEDS
|
||||||
|
* @property string|null $audio File name of the audio played during quiz countdowns (see AudioService)
|
||||||
* @property \Cake\I18n\DateTime|null $last_admin_access
|
* @property \Cake\I18n\DateTime|null $last_admin_access
|
||||||
* @property \Cake\I18n\DateTime|null $expiry_reminded_at When the reminder before the expiry was mailed
|
* @property \Cake\I18n\DateTime|null $expiry_reminded_at When the reminder before the expiry was mailed
|
||||||
* @property \Cake\I18n\DateTime $created
|
* @property \Cake\I18n\DateTime $created
|
||||||
@@ -36,6 +37,14 @@ class Poll extends Entity
|
|||||||
*/
|
*/
|
||||||
public const COMMENT_SPEEDS = [50, 75, 100, 125, 150, 200];
|
public const COMMENT_SPEEDS = [50, 75, 100, 125, 150, 200];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasAudio(): bool
|
||||||
|
{
|
||||||
|
return $this->audio !== null && $this->audio !== '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only harmless fields are mass assignable. Tokens, join code and the
|
* Only harmless fields are mass assignable. Tokens, join code and the
|
||||||
* current slide are always set explicitly in code.
|
* current slide are always set explicitly in code.
|
||||||
|
|||||||
+72
-12
@@ -61,6 +61,13 @@ class Slide extends Entity
|
|||||||
*/
|
*/
|
||||||
public const QUIZ_TIME_LIMITS = [0, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300];
|
public const QUIZ_TIME_LIMITS = [0, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selectable time limits of every slide with a countdown (same list as for quizzes).
|
||||||
|
*
|
||||||
|
* @var list<int>
|
||||||
|
*/
|
||||||
|
public const TIME_LIMITS = self::QUIZ_TIME_LIMITS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display styles of a scale: numbered steps or a star rating (always starts at 1 star).
|
* Display styles of a scale: numbered steps or a star rating (always starts at 1 star).
|
||||||
*/
|
*/
|
||||||
@@ -108,14 +115,15 @@ class Slide extends Entity
|
|||||||
public const DEFAULT_SETTINGS = [
|
public const DEFAULT_SETTINGS = [
|
||||||
// comments: optional comment field (stored in text_value of the participant's first row),
|
// comments: optional comment field (stored in text_value of the participant's first row),
|
||||||
// comments rotate in the presentation like those of a scale
|
// comments rotate in the presentation like those of a scale
|
||||||
self::TYPE_CHOICE => ['multiple' => false, 'comments' => false],
|
self::TYPE_CHOICE => ['multiple' => false, 'comments' => false, 'comment_only' => false, 'time_limit' => 0],
|
||||||
// allow_downvotes only takes effect together with allow_upvotes
|
// allow_downvotes only takes effect together with allow_upvotes
|
||||||
self::TYPE_WORDCLOUD => ['allow_upvotes' => true, 'allow_downvotes' => true],
|
self::TYPE_WORDCLOUD => ['allow_upvotes' => true, 'allow_downvotes' => true, 'time_limit' => 0],
|
||||||
// private: anonymous feedback, answers only visible in the admin area (never on the stage)
|
// private: anonymous feedback, answers only visible in the admin area (never on the stage)
|
||||||
self::TYPE_OPEN => ['private' => false],
|
self::TYPE_OPEN => ['private' => false, 'time_limit' => 0],
|
||||||
// private: internal feedback, ratings only visible in the admin area (never on the stage)
|
// private: internal feedback, ratings only visible in the admin area (never on the stage)
|
||||||
// comments: optional comment field, comments rotate in the presentation (unless private)
|
// comments: optional comment field, comments rotate in the presentation (unless private)
|
||||||
// comment_ratings: show the rating next to each comment in the presentation
|
// comment_ratings: show the rating next to each comment in the presentation
|
||||||
|
// comment_only: with comments, a comment alone is enough (row without numeric_value, not part of the average)
|
||||||
// (time per comment depends on its length, see Comments.delay() in plenario.js)
|
// (time per comment depends on its length, see Comments.delay() in plenario.js)
|
||||||
// style: numbers or stars (SCALE_*), stars always start at scale_min = 1
|
// style: numbers or stars (SCALE_*), stars always start at scale_min = 1
|
||||||
// scale_view: parts of the result shown in the presentation (presenter/embed, SCALE_VIEWS);
|
// scale_view: parts of the result shown in the presentation (presenter/embed, SCALE_VIEWS);
|
||||||
@@ -123,8 +131,9 @@ class Slide extends Entity
|
|||||||
self::TYPE_SCALE => [
|
self::TYPE_SCALE => [
|
||||||
'style' => self::SCALE_NUMBERS,
|
'style' => self::SCALE_NUMBERS,
|
||||||
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false,
|
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false,
|
||||||
'comments' => false, 'comment_ratings' => false,
|
'comments' => false, 'comment_only' => false, 'comment_ratings' => false,
|
||||||
'scale_view' => self::SCALE_VIEW_BOTH,
|
'scale_view' => self::SCALE_VIEW_BOTH,
|
||||||
|
'time_limit' => 0,
|
||||||
],
|
],
|
||||||
self::TYPE_CONTENT => [],
|
self::TYPE_CONTENT => [],
|
||||||
// time_limit in seconds, 0 = no limit (presenter ends the quiz)
|
// time_limit in seconds, 0 = no limit (presenter ends the quiz)
|
||||||
@@ -136,10 +145,12 @@ class Slide extends Entity
|
|||||||
// max_upvotes_per_question: own upvotes per question (0 = no limit besides the budget);
|
// max_upvotes_per_question: own upvotes per question (0 = no limit besides the budget);
|
||||||
// allow_self_upvote: upvotes on own questions (for prioritizing topics, off by default)
|
// allow_self_upvote: upvotes on own questions (for prioritizing topics, off by default)
|
||||||
self::TYPE_QA => ['upvote_share' => 25, 'max_upvotes_per_question' => 0, 'allow_self_upvote' => false],
|
self::TYPE_QA => ['upvote_share' => 25, 'max_upvotes_per_question' => 0, 'allow_self_upvote' => false],
|
||||||
|
// time_limit (all slides with answers but Q&A): seconds, 0 = no countdown. With a countdown the slide waits
|
||||||
|
// ("ready") until the presenter starts it, like a quiz (see usesPhases()).
|
||||||
// The correct order is the order of the slide_options (position), revealed when voting closes.
|
// The correct order is the order of the slide_options (position), revealed when voting closes.
|
||||||
// ranking: no correct order, everyone sorts by personal preference; the presenter sees the
|
// ranking: no correct order, everyone sorts by personal preference; the presenter sees the
|
||||||
// average ranking live (nothing to hide), participants never get results
|
// average ranking live (nothing to hide), participants never get results
|
||||||
self::TYPE_ORDER => ['ranking' => false],
|
self::TYPE_ORDER => ['ranking' => false, 'time_limit' => 0],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,6 +184,20 @@ class Slide extends Entity
|
|||||||
return $type !== self::TYPE_YOUTUBE;
|
return $type !== self::TYPE_YOUTUBE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether slides of this type can have a countdown: every type that collects answers except Q&A (its three
|
||||||
|
* stages take as long as the discussion needs). A quiz always has the ready/running/finished phases.
|
||||||
|
*
|
||||||
|
* @param string $type Slide type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function supportsTimer(string $type): bool
|
||||||
|
{
|
||||||
|
return in_array($type, [
|
||||||
|
self::TYPE_CHOICE, self::TYPE_WORDCLOUD, self::TYPE_OPEN, self::TYPE_SCALE, self::TYPE_QUIZ, self::TYPE_ORDER,
|
||||||
|
], true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -344,7 +369,8 @@ class Slide extends Entity
|
|||||||
*/
|
*/
|
||||||
public function isOrderRevealed(): bool
|
public function isOrderRevealed(): bool
|
||||||
{
|
{
|
||||||
return $this->isOrder() && !$this->isRanking() && !$this->isVotingOpen();
|
// Not yet started (phase "ready") is closed too, but nothing may be resolved before the countdown ran.
|
||||||
|
return $this->isOrder() && !$this->isRanking() && !$this->isVotingOpen() && $this->phase() !== self::QUIZ_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -461,6 +487,28 @@ class Slide extends Entity
|
|||||||
return in_array($this->type, [self::TYPE_WORDCLOUD, self::TYPE_QA], true);
|
return in_array($this->type, [self::TYPE_WORDCLOUD, self::TYPE_QA], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the slide goes through the phases ready (shows only the question), running (countdown, answers
|
||||||
|
* accepted) and finished: every quiz, and any other slide with a time limit.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function usesPhases(): bool
|
||||||
|
{
|
||||||
|
return $this->isQuiz() || (self::supportsTimer($this->type) && (int)$this->setting('time_limit') > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Phase of a slide with a countdown (one of the QUIZ_* constants), null for slides without.
|
||||||
|
*
|
||||||
|
* @param \Cake\I18n\DateTime|null $now Reference time (default: now)
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function phase(?DateTime $now = null): ?string
|
||||||
|
{
|
||||||
|
return $this->usesPhases() ? $this->quizPhase($now) : null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phase of a quiz: ready (not started yet), running, finished (time up or
|
* Phase of a quiz: ready (not started yet), running, finished (time up or
|
||||||
* closed by the presenter). Results and correct answers are only revealed
|
* closed by the presenter). Results and correct answers are only revealed
|
||||||
@@ -498,13 +546,14 @@ class Slide extends Entity
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the state of a slide that has not been presented yet (new slide, copy):
|
* Sets the state of a slide that has not been presented yet (new slide, copy):
|
||||||
* a quiz waits for the presenter to start it, Q&A collects questions, others are open.
|
* a quiz or a slide with a countdown waits for the presenter to start it, Q&A collects questions,
|
||||||
|
* others are open.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function startFresh(): void
|
public function startFresh(): void
|
||||||
{
|
{
|
||||||
$this->is_voting_open = !$this->isQuiz();
|
$this->is_voting_open = !$this->usesPhases();
|
||||||
$this->voting_started_at = null;
|
$this->voting_started_at = null;
|
||||||
$this->voting_ends_at = null;
|
$this->voting_ends_at = null;
|
||||||
$this->stage = $this->isQa() ? self::QA_COLLECT : null;
|
$this->stage = $this->isQa() ? self::QA_COLLECT : null;
|
||||||
@@ -519,7 +568,7 @@ class Slide extends Entity
|
|||||||
*/
|
*/
|
||||||
public function isFresh(): bool
|
public function isFresh(): bool
|
||||||
{
|
{
|
||||||
return $this->is_voting_open === !$this->isQuiz()
|
return $this->is_voting_open === !$this->usesPhases()
|
||||||
&& $this->voting_started_at === null
|
&& $this->voting_started_at === null
|
||||||
&& $this->voting_ends_at === null
|
&& $this->voting_ends_at === null
|
||||||
&& $this->stage === ($this->isQa() ? self::QA_COLLECT : null)
|
&& $this->stage === ($this->isQa() ? self::QA_COLLECT : null)
|
||||||
@@ -527,8 +576,8 @@ class Slide extends Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens or closes voting. Opening a quiz that is not running (re)starts its
|
* Opens or closes voting. Opening a slide with a countdown that is not running (re)starts its
|
||||||
* voting window and timer; opening a running quiz changes nothing.
|
* voting window and timer; opening a running one changes nothing.
|
||||||
*
|
*
|
||||||
* @param bool $open Open or close
|
* @param bool $open Open or close
|
||||||
* @param \Cake\I18n\DateTime|null $now Reference time (default: now)
|
* @param \Cake\I18n\DateTime|null $now Reference time (default: now)
|
||||||
@@ -537,7 +586,7 @@ class Slide extends Entity
|
|||||||
public function setVotingOpen(bool $open, ?DateTime $now = null): void
|
public function setVotingOpen(bool $open, ?DateTime $now = null): void
|
||||||
{
|
{
|
||||||
$now ??= DateTime::now();
|
$now ??= DateTime::now();
|
||||||
if ($open && $this->isQuiz() && !$this->isVotingOpen($now)) {
|
if ($open && $this->usesPhases() && !$this->isVotingOpen($now)) {
|
||||||
$limit = (int)$this->setting('time_limit');
|
$limit = (int)$this->setting('time_limit');
|
||||||
$this->voting_started_at = $now;
|
$this->voting_started_at = $now;
|
||||||
$this->voting_ends_at = $limit > 0 ? $now->addSeconds($limit) : null;
|
$this->voting_ends_at = $limit > 0 ? $now->addSeconds($limit) : null;
|
||||||
@@ -587,6 +636,17 @@ class Slide extends Entity
|
|||||||
return in_array($this->type, [self::TYPE_CHOICE, self::TYPE_SCALE], true) && (bool)$this->setting('comments');
|
return in_array($this->type, [self::TYPE_CHOICE, self::TYPE_SCALE], true) && (bool)$this->setting('comments');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scale or multiple choice with a comment field where a comment alone is enough
|
||||||
|
* (the rating or selection is optional).
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasCommentOnly(): bool
|
||||||
|
{
|
||||||
|
return $this->hasComments() && (bool)$this->setting('comment_only');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale shown as a star rating (1 to scale_max stars) instead of numbered steps.
|
* Scale shown as a star rating (1 to scale_max stars) instead of numbered steps.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Model\Table;
|
namespace App\Model\Table;
|
||||||
|
|
||||||
use App\Model\Entity\Poll;
|
use App\Model\Entity\Poll;
|
||||||
|
use App\Service\AudioService;
|
||||||
use App\Service\ImageService;
|
use App\Service\ImageService;
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use Cake\Core\Configure;
|
use Cake\Core\Configure;
|
||||||
@@ -16,6 +17,7 @@ use Cake\ORM\Table;
|
|||||||
use Cake\Utility\Security;
|
use Cake\Utility\Security;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Polls ("presentations"). Access control works exclusively via the secret
|
* Polls ("presentations"). Access control works exclusively via the secret
|
||||||
@@ -257,6 +259,51 @@ class PollsTable extends Table
|
|||||||
return [$poll, $token];
|
return [$poll, $token];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clones a poll: new poll (same e-mail, new admin token and join code) with a copy of all slides,
|
||||||
|
* but without any responses, and not started. Nothing is left behind if copying fails.
|
||||||
|
*
|
||||||
|
* @param \App\Model\Entity\Poll $poll Original
|
||||||
|
* @param list<\App\Model\Entity\Slide> $slides Slides of the original incl. slide_options, in order
|
||||||
|
* @return array{0: \App\Model\Entity\Poll, 1: string|null} The new poll and its plain token (null on failure)
|
||||||
|
*/
|
||||||
|
public function clonePoll(Poll $poll, array $slides): array
|
||||||
|
{
|
||||||
|
$copy = $this->newPoll([
|
||||||
|
'title' => mb_substr(__('{0} (Kopie)', $poll->title), 0, 200),
|
||||||
|
'email' => $poll->email,
|
||||||
|
]);
|
||||||
|
if ($copy->hasErrors()) {
|
||||||
|
return [$copy, null];
|
||||||
|
}
|
||||||
|
$copy->set('comment_speed', $poll->comment_speed);
|
||||||
|
|
||||||
|
$token = null;
|
||||||
|
$audio = new AudioService();
|
||||||
|
$audioCopy = null;
|
||||||
|
try {
|
||||||
|
$this->getConnection()->transactional(function () use ($poll, $copy, $slides, $audio, &$token, &$audioCopy): void {
|
||||||
|
[, $token] = $this->insertPoll($copy);
|
||||||
|
if ($token === null) {
|
||||||
|
throw new RuntimeException('Poll could not be saved');
|
||||||
|
}
|
||||||
|
$this->Slides->copyAllToPoll($slides, $copy->id);
|
||||||
|
// The copy gets its own audio file: deleting one poll never takes the music of the other.
|
||||||
|
$audioCopy = $poll->hasAudio() ? $audio->copy($copy->id, (string)$poll->audio, $poll->id) : null;
|
||||||
|
if ($audioCopy !== null) {
|
||||||
|
$copy->set('audio', $audioCopy);
|
||||||
|
$this->saveOrFail($copy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
$audio->delete((int)$copy->id, $audioCopy);
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$copy, $token];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Cake\ORM\Query\SelectQuery $query Query
|
* @param \Cake\ORM\Query\SelectQuery $query Query
|
||||||
* @param string $token Plain admin token
|
* @param string $token Plain admin token
|
||||||
|
|||||||
+111
-27
@@ -155,7 +155,7 @@ class SlidesTable extends Table
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case Slide::TYPE_CHOICE:
|
case Slide::TYPE_CHOICE:
|
||||||
$settings['multiple'] = filter_var($input['multiple'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings['multiple'] = filter_var($input['multiple'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||||
$settings['comments'] = filter_var($input['comments'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings = array_merge($settings, static::commentSettings($input));
|
||||||
break;
|
break;
|
||||||
case Slide::TYPE_WORDCLOUD:
|
case Slide::TYPE_WORDCLOUD:
|
||||||
$settings['allow_upvotes'] = filter_var($input['allow_upvotes'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
$settings['allow_upvotes'] = filter_var($input['allow_upvotes'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
||||||
@@ -175,7 +175,7 @@ class SlidesTable extends Table
|
|||||||
$settings['min_label'] = mb_substr(trim((string)($input['min_label'] ?? '')), 0, 60);
|
$settings['min_label'] = mb_substr(trim((string)($input['min_label'] ?? '')), 0, 60);
|
||||||
$settings['max_label'] = mb_substr(trim((string)($input['max_label'] ?? '')), 0, 60);
|
$settings['max_label'] = mb_substr(trim((string)($input['max_label'] ?? '')), 0, 60);
|
||||||
$settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||||
$settings['comments'] = filter_var($input['comments'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings = array_merge($settings, static::commentSettings($input));
|
||||||
$settings['comment_ratings'] = filter_var($input['comment_ratings'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings['comment_ratings'] = filter_var($input['comment_ratings'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||||
$view = $input['scale_view'] ?? null;
|
$view = $input['scale_view'] ?? null;
|
||||||
$settings['scale_view'] = in_array($view, Slide::SCALE_VIEWS, true) ? $view : Slide::SCALE_VIEW_BOTH;
|
$settings['scale_view'] = in_array($view, Slide::SCALE_VIEWS, true) ? $view : Slide::SCALE_VIEW_BOTH;
|
||||||
@@ -184,10 +184,7 @@ class SlidesTable extends Table
|
|||||||
$settings['ranking'] = filter_var($input['ranking'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings['ranking'] = filter_var($input['ranking'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||||
break;
|
break;
|
||||||
case Slide::TYPE_QUIZ:
|
case Slide::TYPE_QUIZ:
|
||||||
$limit = (int)($input['time_limit'] ?? $settings['time_limit']);
|
// The time limit is validated for every slide with a countdown below.
|
||||||
if (in_array($limit, Slide::QUIZ_TIME_LIMITS, true)) {
|
|
||||||
$settings['time_limit'] = $limit;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Slide::TYPE_QA:
|
case Slide::TYPE_QA:
|
||||||
$share = (int)($input['upvote_share'] ?? $settings['upvote_share']);
|
$share = (int)($input['upvote_share'] ?? $settings['upvote_share']);
|
||||||
@@ -214,10 +211,35 @@ class SlidesTable extends Table
|
|||||||
$settings['autoplay'] = filter_var($input['autoplay'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
$settings['autoplay'] = filter_var($input['autoplay'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (Slide::supportsTimer($type)) {
|
||||||
|
$limit = (int)($input['time_limit'] ?? $settings['time_limit']);
|
||||||
|
$settings['time_limit'] = in_array($limit, Slide::TIME_LIMITS, true)
|
||||||
|
? $limit
|
||||||
|
: Slide::DEFAULT_SETTINGS[$type]['time_limit'];
|
||||||
|
}
|
||||||
|
|
||||||
return $settings;
|
return $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment settings of choice and scale slides. The form sends one dropdown `comment_mode`
|
||||||
|
* (off | rating: optional comment | only: a comment alone is enough); the plain flags
|
||||||
|
* `comments`/`comment_only` stay accepted.
|
||||||
|
*
|
||||||
|
* @param array<string, mixed> $input Raw settings
|
||||||
|
* @return array{comments: bool, comment_only: bool}
|
||||||
|
*/
|
||||||
|
protected static function commentSettings(array $input): array
|
||||||
|
{
|
||||||
|
$mode = $input['comment_mode'] ?? match (true) {
|
||||||
|
!filter_var($input['comments'] ?? false, FILTER_VALIDATE_BOOLEAN) => 'off',
|
||||||
|
filter_var($input['comment_only'] ?? false, FILTER_VALIDATE_BOOLEAN) => 'only',
|
||||||
|
default => 'rating',
|
||||||
|
};
|
||||||
|
|
||||||
|
return ['comments' => in_array($mode, ['rating', 'only'], true), 'comment_only' => $mode === 'only'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a textarea (one option per line) into a clean list of labels.
|
* Parses a textarea (one option per line) into a clean list of labels.
|
||||||
*
|
*
|
||||||
@@ -353,18 +375,75 @@ class SlidesTable extends Table
|
|||||||
*/
|
*/
|
||||||
public function duplicate(Slide $slide): Slide
|
public function duplicate(Slide $slide): Slide
|
||||||
{
|
{
|
||||||
$copy = $this->newEmptyEntity();
|
$images = new ImageService();
|
||||||
$copy->poll_id = $slide->poll_id;
|
$copy = $this->prepareCopy($slide, $slide->poll_id, $slide->position + 1, $images);
|
||||||
$copy->type = $slide->type;
|
|
||||||
$copy->question = mb_substr(__('{0} (Kopie)', $slide->question), 0, 500);
|
$copy->question = mb_substr(__('{0} (Kopie)', $slide->question), 0, 500);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return $this->persistCopy($slide, $copy);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
// Rolled back: the copied file belongs to no slide.
|
||||||
|
$images->delete($slide->poll_id, $copy->image);
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies all slides of a poll (settings, options, correct answers, images, hidden flag) into another poll,
|
||||||
|
* in the same order. Responses are not copied. All or nothing: on failure no slide and no image file remains.
|
||||||
|
*
|
||||||
|
* @param list<\App\Model\Entity\Slide> $slides Original slides incl. slide_options, in order
|
||||||
|
* @param int $targetPollId Poll that receives the copies
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyAllToPoll(array $slides, int $targetPollId): void
|
||||||
|
{
|
||||||
|
$images = new ImageService();
|
||||||
|
$files = [];
|
||||||
|
try {
|
||||||
|
$this->getConnection()->transactional(function () use ($slides, $targetPollId, $images, &$files): void {
|
||||||
|
foreach ($slides as $index => $slide) {
|
||||||
|
$copy = $this->prepareCopy($slide, $targetPollId, $index + 1, $images);
|
||||||
|
if ($copy->image !== null) {
|
||||||
|
$files[] = $copy->image;
|
||||||
|
}
|
||||||
|
$copy->is_hidden = $slide->is_hidden;
|
||||||
|
$this->saveOrFail($copy);
|
||||||
|
$this->copyOptions($slide, $copy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$images->delete($targetPollId, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds an unsaved copy of a slide for a poll; a fresh slide (nothing started) with its own image file.
|
||||||
|
*
|
||||||
|
* @param \App\Model\Entity\Slide $slide Original
|
||||||
|
* @param int $pollId Poll of the copy
|
||||||
|
* @param int $position Position of the copy
|
||||||
|
* @param \App\Service\ImageService $images Image storage
|
||||||
|
* @return \App\Model\Entity\Slide
|
||||||
|
*/
|
||||||
|
protected function prepareCopy(Slide $slide, int $pollId, int $position, ImageService $images): Slide
|
||||||
|
{
|
||||||
|
$copy = $this->newEmptyEntity();
|
||||||
|
$copy->poll_id = $pollId;
|
||||||
|
$copy->type = $slide->type;
|
||||||
|
$copy->question = $slide->question;
|
||||||
$copy->description = $slide->description;
|
$copy->description = $slide->description;
|
||||||
$copy->settings = $slide->settings;
|
$copy->settings = $slide->settings;
|
||||||
$copy->position = $slide->position + 1;
|
$copy->position = $position;
|
||||||
$copy->startFresh();
|
$copy->startFresh();
|
||||||
|
|
||||||
// The copy gets its own file, so deleting one slide never takes the image of the other.
|
// The copy gets its own file, so deleting one slide never takes the image of the other.
|
||||||
$images = new ImageService();
|
$imageCopy = $slide->hasImage() ? $images->copy($pollId, (string)$slide->image, $slide->poll_id) : null;
|
||||||
$imageCopy = $slide->hasImage() ? $images->copy($slide->poll_id, (string)$slide->image) : null;
|
|
||||||
if ($imageCopy !== null) {
|
if ($imageCopy !== null) {
|
||||||
$copy->image = $imageCopy;
|
$copy->image = $imageCopy;
|
||||||
$copy->image_alt = $slide->image_alt;
|
$copy->image_alt = $slide->image_alt;
|
||||||
@@ -373,13 +452,26 @@ class SlidesTable extends Table
|
|||||||
$copy->image_height = $slide->image_height;
|
$copy->image_height = $slide->image_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
return $copy;
|
||||||
return $this->persistCopy($slide, $copy);
|
}
|
||||||
} catch (Throwable $e) {
|
|
||||||
// Rolled back: the copied file belongs to no slide.
|
|
||||||
$images->delete($slide->poll_id, $imageCopy);
|
|
||||||
|
|
||||||
throw $e;
|
/**
|
||||||
|
* Copies the options (with the correct answers) of a slide to its saved copy.
|
||||||
|
*
|
||||||
|
* @param \App\Model\Entity\Slide $slide Original incl. slide_options
|
||||||
|
* @param \App\Model\Entity\Slide $copy Saved copy
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function copyOptions(Slide $slide, Slide $copy): void
|
||||||
|
{
|
||||||
|
foreach ($slide->slide_options ?? [] as $option) {
|
||||||
|
$newOption = $this->SlideOptions->newEntity([
|
||||||
|
'label' => $option->label,
|
||||||
|
'position' => $option->position,
|
||||||
|
]);
|
||||||
|
$newOption->set('slide_id', $copy->id);
|
||||||
|
$newOption->set('is_correct', $option->is_correct);
|
||||||
|
$this->SlideOptions->saveOrFail($newOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,15 +490,7 @@ class SlidesTable extends Table
|
|||||||
['poll_id' => $slide->poll_id, 'position >' => $slide->position],
|
['poll_id' => $slide->poll_id, 'position >' => $slide->position],
|
||||||
);
|
);
|
||||||
$this->saveOrFail($copy);
|
$this->saveOrFail($copy);
|
||||||
foreach ($slide->slide_options ?? [] as $option) {
|
$this->copyOptions($slide, $copy);
|
||||||
$newOption = $this->SlideOptions->newEntity([
|
|
||||||
'label' => $option->label,
|
|
||||||
'position' => $option->position,
|
|
||||||
]);
|
|
||||||
$newOption->set('slide_id', $copy->id);
|
|
||||||
$newOption->set('is_correct', $option->is_correct);
|
|
||||||
$this->SlideOptions->saveOrFail($newOption);
|
|
||||||
}
|
|
||||||
$this->normalizePositions($slide->poll_id);
|
$this->normalizePositions($slide->poll_id);
|
||||||
|
|
||||||
return $this->get($copy->id, contain: ['SlideOptions']);
|
return $this->get($copy->id, contain: ['SlideOptions']);
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Service;
|
||||||
|
|
||||||
|
use Cake\Core\Configure;
|
||||||
|
use Psr\Http\Message\UploadedFileInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the audio file of a presentation (played in the presenter view while a quiz countdown runs).
|
||||||
|
*
|
||||||
|
* Audio is not re-encoded: the format is recognised by its leading bytes (never by the client-sent
|
||||||
|
* name or type), the file is stored under a random name with a fixed extension, and served with a
|
||||||
|
* fixed content type by ParticipateController::audio(). Files live next to the slide images in
|
||||||
|
* `{Plenario.images.path}/{poll id}/`, so deleting a poll removes them as well; `bin/cake images_cleanup`
|
||||||
|
* sweeps leftovers of both kinds.
|
||||||
|
*
|
||||||
|
* Deleting is idempotent: a missing file is fine.
|
||||||
|
*/
|
||||||
|
class AudioService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Accepted formats: extension => content type.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public const FORMATS = [
|
||||||
|
'mp3' => 'audio/mpeg',
|
||||||
|
'ogg' => 'audio/ogg',
|
||||||
|
'wav' => 'audio/wav',
|
||||||
|
'm4a' => 'audio/mp4',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether a stored name has the shape generated by store() (guards file system access).
|
||||||
|
*
|
||||||
|
* @param string $name File name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isValidName(string $name): bool
|
||||||
|
{
|
||||||
|
return (bool)preg_match('/^[a-f0-9]{24}\.(mp3|ogg|wav|m4a)$/', $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Content type for a stored name.
|
||||||
|
*
|
||||||
|
* @param string $name File name
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function contentType(string $name): string
|
||||||
|
{
|
||||||
|
return self::FORMATS[pathinfo($name, PATHINFO_EXTENSION)] ?? 'application/octet-stream';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recognises MP3 (ID3 tag or frame sync), Ogg, WAV and MPEG-4 audio by the first bytes.
|
||||||
|
*
|
||||||
|
* @param string $bytes File content
|
||||||
|
* @return string|null Extension (a key of FORMATS) or null for anything else
|
||||||
|
*/
|
||||||
|
public static function detectFormat(string $bytes): ?string
|
||||||
|
{
|
||||||
|
if (strlen($bytes) < 12) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (str_starts_with($bytes, 'OggS')) {
|
||||||
|
return 'ogg';
|
||||||
|
}
|
||||||
|
if (str_starts_with($bytes, 'RIFF') && substr($bytes, 8, 4) === 'WAVE') {
|
||||||
|
return 'wav';
|
||||||
|
}
|
||||||
|
if (substr($bytes, 4, 4) === 'ftyp') {
|
||||||
|
return 'm4a';
|
||||||
|
}
|
||||||
|
if (str_starts_with($bytes, 'ID3')) {
|
||||||
|
return 'mp3';
|
||||||
|
}
|
||||||
|
// Frame sync: 11 set bits, then a valid version and layer (not reserved).
|
||||||
|
$second = ord($bytes[1]);
|
||||||
|
if (ord($bytes[0]) === 0xFF && ($second & 0xE0) === 0xE0 && ($second & 0x18) !== 0x08 && ($second & 0x06) !== 0x00) {
|
||||||
|
return 'mp3';
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates and stores an upload.
|
||||||
|
*
|
||||||
|
* @param \Psr\Http\Message\UploadedFileInterface $file Uploaded file
|
||||||
|
* @param int $pollId Poll the audio belongs to
|
||||||
|
* @return string Stored file name
|
||||||
|
* @throws \App\Service\ImageException If the file cannot be used
|
||||||
|
*/
|
||||||
|
public function store(UploadedFileInterface $file, int $pollId): string
|
||||||
|
{
|
||||||
|
$this->assertUploaded($file);
|
||||||
|
$bytes = (string)$file->getStream();
|
||||||
|
$extension = self::detectFormat($bytes);
|
||||||
|
if ($extension === null) {
|
||||||
|
throw new ImageException(__('Bitte wähle eine Audiodatei im Format MP3, M4A, OGG oder WAV aus.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = bin2hex(random_bytes(12)) . '.' . $extension;
|
||||||
|
$directory = $this->directory($pollId);
|
||||||
|
if (!is_dir($directory) && !@mkdir($directory, 0775, true) && !is_dir($directory)) {
|
||||||
|
throw new ImageException(__('Die Audiodatei konnte nicht gespeichert werden (Upload-Verzeichnis nicht beschreibbar).'));
|
||||||
|
}
|
||||||
|
// Write under a temporary name first: a half written file must never be served.
|
||||||
|
$temporary = $directory . DS . $name . '.tmp';
|
||||||
|
if (@file_put_contents($temporary, $bytes) !== strlen($bytes) || !@rename($temporary, $directory . DS . $name)) {
|
||||||
|
@unlink($temporary);
|
||||||
|
throw new ImageException(__('Die Audiodatei konnte nicht gespeichert werden.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies a stored file (duplicated slides get their own file).
|
||||||
|
*
|
||||||
|
* @param int $pollId Poll id that receives the copy
|
||||||
|
* @param string $name Source file name
|
||||||
|
* @param int|null $sourcePollId Poll id of the source file (default: the same poll)
|
||||||
|
* @return string|null Name of the copy, null if the source is gone or the copy failed
|
||||||
|
*/
|
||||||
|
public function copy(int $pollId, string $name, ?int $sourcePollId = null): ?string
|
||||||
|
{
|
||||||
|
$source = $this->path($sourcePollId ?? $pollId, $name);
|
||||||
|
if ($source === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$directory = $this->directory($pollId);
|
||||||
|
if (!is_dir($directory) && !@mkdir($directory, 0775, true) && !is_dir($directory)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$copy = bin2hex(random_bytes(12)) . '.' . pathinfo($name, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
return @copy($source, $directory . DS . $copy) ? $copy : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Absolute path of a stored file, null if the name is invalid or the file does not exist.
|
||||||
|
*
|
||||||
|
* @param int $pollId Poll id
|
||||||
|
* @param string $name File name
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function path(int $pollId, string $name): ?string
|
||||||
|
{
|
||||||
|
if (!self::isValidName($name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$path = $this->directory($pollId) . DS . $name;
|
||||||
|
|
||||||
|
return is_file($path) ? $path : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes one file. Idempotent, ignores unknown names and missing files.
|
||||||
|
*
|
||||||
|
* @param int $pollId Poll id
|
||||||
|
* @param string|null $name File name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function delete(int $pollId, ?string $name): void
|
||||||
|
{
|
||||||
|
if ($name === null || !self::isValidName($name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@unlink($this->directory($pollId) . DS . $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $pollId Poll id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function directory(int $pollId): string
|
||||||
|
{
|
||||||
|
return rtrim((string)Configure::read('Plenario.images.path'), '/\\') . DS . $pollId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Psr\Http\Message\UploadedFileInterface $file Uploaded file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function assertUploaded(UploadedFileInterface $file): void
|
||||||
|
{
|
||||||
|
switch ($file->getError()) {
|
||||||
|
case UPLOAD_ERR_OK:
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_INI_SIZE:
|
||||||
|
case UPLOAD_ERR_FORM_SIZE:
|
||||||
|
throw new ImageException(__(
|
||||||
|
'Die Datei ist größer, als der Server erlaubt ({0}). Bitte wähle eine kleinere Audiodatei.',
|
||||||
|
(string)ini_get('upload_max_filesize'),
|
||||||
|
));
|
||||||
|
default:
|
||||||
|
throw new ImageException(__('Die Audiodatei konnte nicht hochgeladen werden. Bitte versuche es noch einmal.'));
|
||||||
|
}
|
||||||
|
$max = (int)Configure::read('Plenario.audio.maxUploadBytes', 10 * 1024 * 1024);
|
||||||
|
if (($file->getSize() ?? 0) > $max) {
|
||||||
|
throw new ImageException(__('Die Audiodatei ist zu groß (höchstens {0} MB).', (int)round($max / 1024 / 1024)));
|
||||||
|
}
|
||||||
|
if (($file->getSize() ?? 0) === 0) {
|
||||||
|
throw new ImageException(__('Die Datei ist leer.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,19 +119,24 @@ class ImageService
|
|||||||
/**
|
/**
|
||||||
* Copies a stored image (duplicated slides get their own file, so deleting one never affects the other).
|
* Copies a stored image (duplicated slides get their own file, so deleting one never affects the other).
|
||||||
*
|
*
|
||||||
* @param int $pollId Poll id
|
* @param int $pollId Poll id that receives the copy
|
||||||
* @param string $name Source file name
|
* @param string $name Source file name
|
||||||
* @return string|null Name of the copy, null if the source file is gone
|
* @param int|null $sourcePollId Poll id of the source file (default: the same poll)
|
||||||
|
* @return string|null Name of the copy, null if the source file is gone or the copy failed
|
||||||
*/
|
*/
|
||||||
public function copy(int $pollId, string $name): ?string
|
public function copy(int $pollId, string $name, ?int $sourcePollId = null): ?string
|
||||||
{
|
{
|
||||||
$source = $this->path($pollId, $name);
|
$source = $this->path($sourcePollId ?? $pollId, $name);
|
||||||
if ($source === null) {
|
if ($source === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
$directory = $this->directory($pollId);
|
||||||
|
if (!is_dir($directory) && !@mkdir($directory, 0775, true) && !is_dir($directory)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$copy = bin2hex(random_bytes(12)) . '.webp';
|
$copy = bin2hex(random_bytes(12)) . '.webp';
|
||||||
|
|
||||||
return @copy($source, $this->directory($pollId) . DS . $copy) ? $copy : null;
|
return @copy($source, $directory . DS . $copy) ? $copy : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ class PollStateService
|
|||||||
'next' => $this->nextPreview($poll, $slides, $index),
|
'next' => $this->nextPreview($poll, $slides, $index),
|
||||||
'hiddenCount' => $this->Slides->find()->where(['poll_id' => $poll->id, 'is_hidden' => true])->count(),
|
'hiddenCount' => $this->Slides->find()->where(['poll_id' => $poll->id, 'is_hidden' => true])->count(),
|
||||||
'slide' => $current ? $this->slidePayload($current, $poll) : null,
|
'slide' => $current ? $this->slidePayload($current, $poll) : null,
|
||||||
'results' => $current ? $this->results->forSlide($current) : null,
|
'results' => $current ? $this->results->forStage($current) : null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ class PollStateService
|
|||||||
'index' => null,
|
'index' => null,
|
||||||
'count' => null,
|
'count' => null,
|
||||||
'slide' => $this->slidePayload($slide, $poll),
|
'slide' => $this->slidePayload($slide, $poll),
|
||||||
'results' => $this->results->forSlide($slide),
|
'results' => $this->results->forStage($slide),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,6 +250,8 @@ class PollStateService
|
|||||||
]),
|
]),
|
||||||
'slide' => $showResults ? $this->slidePayload($slide, $poll) : null,
|
'slide' => $showResults ? $this->slidePayload($slide, $poll) : null,
|
||||||
'results' => $showResults ? $this->participantResults($slide) : null,
|
'results' => $showResults ? $this->participantResults($slide) : null,
|
||||||
|
// Countdown of a slide that is not a quiz (a quiz has its own state below)
|
||||||
|
'timer' => $slide !== null && !$slide->isQuiz() && $slide->usesPhases() ? $this->results->timer($slide) : null,
|
||||||
'words' => $words,
|
'words' => $words,
|
||||||
'quiz' => $quiz,
|
'quiz' => $quiz,
|
||||||
'qa' => $qa,
|
'qa' => $qa,
|
||||||
@@ -422,7 +424,7 @@ class PollStateService
|
|||||||
* Poll part of the presenter and embed state.
|
* Poll part of the presenter and embed state.
|
||||||
*
|
*
|
||||||
* @param \App\Model\Entity\Poll $poll Poll
|
* @param \App\Model\Entity\Poll $poll Poll
|
||||||
* @return array{title: string, joinCode: string, joinCodeFormatted: string, isActive: bool, isPaused: bool}
|
* @return array{title: string, joinCode: string, joinCodeFormatted: string, isActive: bool, isPaused: bool, commentSpeed: float|int, audioUrl: string|null}
|
||||||
*/
|
*/
|
||||||
protected function pollPayload(Poll $poll): array
|
protected function pollPayload(Poll $poll): array
|
||||||
{
|
{
|
||||||
@@ -434,6 +436,10 @@ class PollStateService
|
|||||||
'isPaused' => $poll->isPaused(),
|
'isPaused' => $poll->isPaused(),
|
||||||
// Factor for the rotating scale comments on stage (1 = normal, 2 = twice as fast)
|
// Factor for the rotating scale comments on stage (1 = normal, 2 = twice as fast)
|
||||||
'commentSpeed' => ($poll->comment_speed ?? 100) / 100,
|
'commentSpeed' => ($poll->comment_speed ?? 100) / 100,
|
||||||
|
// Music for quiz countdowns: looped by the presenter view while a quiz runs (participants never play it)
|
||||||
|
'audioUrl' => $poll->hasAudio()
|
||||||
|
? Router::url(['_name' => 'participate:audio', 'code' => $poll->join_code, 'file' => $poll->audio])
|
||||||
|
: null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
|||||||
* - open: 'answers' => [['text', 'created']] newest first, 'private' (bool);
|
* - open: 'answers' => [['text', 'created']] newest first, 'private' (bool);
|
||||||
* - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null,
|
* - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null,
|
||||||
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool), 'stars' (bool: star rating, min = 1);
|
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool), 'stars' (bool: star rating, min = 1);
|
||||||
|
* 'commentOnly' (int: participants who sent only a comment without a rating, not part of buckets/average);
|
||||||
* 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else [];
|
* 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else [];
|
||||||
* 'value' is null unless the setting comment_ratings is on;
|
* 'value' is null unless the setting comment_ratings is on;
|
||||||
* 'view' (both|average|chart): parts shown in the presentation (setting scale_view,
|
* 'view' (both|average|chart): parts shown in the presentation (setting scale_view,
|
||||||
@@ -78,6 +79,9 @@ class ResultsService
|
|||||||
'type' => $slide->type,
|
'type' => $slide->type,
|
||||||
'participants' => $slide->isInteractive() ? $this->Responses->countParticipants($slide->id) : 0,
|
'participants' => $slide->isInteractive() ? $this->Responses->countParticipants($slide->id) : 0,
|
||||||
];
|
];
|
||||||
|
if ($slide->usesPhases()) {
|
||||||
|
$result['timer'] = $this->timer($slide);
|
||||||
|
}
|
||||||
|
|
||||||
return $result + match ($slide->type) {
|
return $result + match ($slide->type) {
|
||||||
Slide::TYPE_CHOICE => $this->choice($slide, $limit),
|
Slide::TYPE_CHOICE => $this->choice($slide, $limit),
|
||||||
@@ -91,6 +95,45 @@ class ResultsService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Results for the stage (presenter view and embed). A slide with a countdown that has not been started yet
|
||||||
|
* shows only its question: no answers, no counts, no solution (`ready`), whatever is stored for it.
|
||||||
|
* The evaluation (admin, PDF) uses forSlide(), which is never gated.
|
||||||
|
*
|
||||||
|
* @param \App\Model\Entity\Slide $slide Slide
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function forStage(Slide $slide): array
|
||||||
|
{
|
||||||
|
if ($slide->phase() === Slide::QUIZ_READY && !$slide->isQuiz()) {
|
||||||
|
return [
|
||||||
|
'type' => $slide->type,
|
||||||
|
'participants' => 0,
|
||||||
|
'ready' => true,
|
||||||
|
'timer' => $this->timer($slide),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->forSlide($slide);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Countdown of a slide: phase (ready|running|finished), the limit and the seconds left while running.
|
||||||
|
*
|
||||||
|
* @param \App\Model\Entity\Slide $slide Slide with a countdown
|
||||||
|
* @return array{phase: string|null, timeLimit: int, remaining: int|null}
|
||||||
|
*/
|
||||||
|
public function timer(Slide $slide): array
|
||||||
|
{
|
||||||
|
$phase = $slide->phase();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'phase' => $phase,
|
||||||
|
'timeLimit' => (int)$slide->setting('time_limit'),
|
||||||
|
'remaining' => $phase === Slide::QUIZ_RUNNING ? $slide->remainingSeconds() : null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \App\Model\Entity\Slide $slide Slide
|
* @param \App\Model\Entity\Slide $slide Slide
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
@@ -240,7 +283,10 @@ class ResultsService
|
|||||||
$comments[] = ['id' => $comment['id'], 'text' => $comment['text'], 'value' => null];
|
$comments[] = ['id' => $comment['id'], 'text' => $comment['text'], 'value' => null];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['options' => $options, 'votes' => $total, 'comments' => $comments];
|
// Comment only: taking part without a selection, not part of the counts
|
||||||
|
$commentOnly = $this->Responses->find()->where(['slide_id' => $slide->id, 'slide_option_id IS' => null])->count();
|
||||||
|
|
||||||
|
return ['options' => $options, 'votes' => $total, 'comments' => $comments, 'commentOnly' => $commentOnly];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -444,6 +490,7 @@ class ResultsService
|
|||||||
if (isset($results['buckets'])) {
|
if (isset($results['buckets'])) {
|
||||||
$results['buckets'] = [];
|
$results['buckets'] = [];
|
||||||
$results['average'] = null;
|
$results['average'] = null;
|
||||||
|
$results['commentOnly'] = 0;
|
||||||
$results['comments'] = [];
|
$results['comments'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,11 +508,10 @@ class ResultsService
|
|||||||
public function comments(Slide $slide, ?int $limit = null): array
|
public function comments(Slide $slide, ?int $limit = null): array
|
||||||
{
|
{
|
||||||
// Scale: the rating row carries the comment. Choice: the comment sits in the first of the
|
// Scale: the rating row carries the comment. Choice: the comment sits in the first of the
|
||||||
// participant's rows, which always has an option.
|
// participant's rows. Without a rating or selection the row holds only the comment.
|
||||||
$answered = $slide->type === Slide::TYPE_CHOICE ? 'slide_option_id IS NOT' : 'numeric_value IS NOT';
|
|
||||||
$query = $this->Responses->find()
|
$query = $this->Responses->find()
|
||||||
->select(['id', 'text_value', 'numeric_value', 'created'])
|
->select(['id', 'text_value', 'numeric_value', 'created'])
|
||||||
->where(['slide_id' => $slide->id, 'text_value IS NOT' => null, $answered => null])
|
->where(['slide_id' => $slide->id, 'text_value IS NOT' => null])
|
||||||
->orderBy(['id' => 'DESC']);
|
->orderBy(['id' => 'DESC']);
|
||||||
if ($limit !== null) {
|
if ($limit !== null) {
|
||||||
$query->limit($limit);
|
$query->limit($limit);
|
||||||
@@ -488,7 +534,7 @@ class ResultsService
|
|||||||
* Distribution and average of a scale.
|
* Distribution and average of a scale.
|
||||||
*
|
*
|
||||||
* @param \App\Model\Entity\Slide $slide Scale slide
|
* @param \App\Model\Entity\Slide $slide Scale slide
|
||||||
* @return array{buckets: list<array{value: int, count: int, percent: float|int}>, average: float|null, min: int, max: int, minLabel: string, maxLabel: string, stars: bool}
|
* @return array{buckets: list<array{value: int, count: int, percent: float|int}>, average: float|null, min: int, max: int, minLabel: string, maxLabel: string, stars: bool, commentOnly: int}
|
||||||
*/
|
*/
|
||||||
public function scaleResults(Slide $slide): array
|
public function scaleResults(Slide $slide): array
|
||||||
{
|
{
|
||||||
@@ -503,6 +549,9 @@ class ResultsService
|
|||||||
->combine('numeric_value', 'n')
|
->combine('numeric_value', 'n')
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
// Comment only: taking part without a rating, never part of the average or the distribution
|
||||||
|
$commentOnly = $this->Responses->find()->where(['slide_id' => $slide->id, 'numeric_value IS' => null])->count();
|
||||||
|
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$sum = 0;
|
$sum = 0;
|
||||||
foreach ($counts as $value => $count) {
|
foreach ($counts as $value => $count) {
|
||||||
@@ -527,6 +576,7 @@ class ResultsService
|
|||||||
'minLabel' => (string)$slide->setting('min_label'),
|
'minLabel' => (string)$slide->setting('min_label'),
|
||||||
'maxLabel' => (string)$slide->setting('max_label'),
|
'maxLabel' => (string)$slide->setting('max_label'),
|
||||||
'stars' => $slide->isStarRating(),
|
'stars' => $slide->isStarRating(),
|
||||||
|
'commentOnly' => $commentOnly,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,6 +179,15 @@ class VoteService
|
|||||||
default => __('Bitte gib zuerst deine Bewertung ab.'),
|
default => __('Bitte gib zuerst deine Bewertung ab.'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
$withoutAnswer = match ($slide->type) {
|
||||||
|
Slide::TYPE_SCALE => $row->numeric_value === null,
|
||||||
|
Slide::TYPE_CHOICE => $row->slide_option_id === null,
|
||||||
|
default => false,
|
||||||
|
};
|
||||||
|
if ($withoutAnswer && $text === null) {
|
||||||
|
// Without a rating or selection the comment is the whole answer.
|
||||||
|
throw new VoteException(__('Ohne Bewertung oder Auswahl darf der Kommentar nicht leer sein.'));
|
||||||
|
}
|
||||||
$row->text_value = $text;
|
$row->text_value = $text;
|
||||||
$this->Responses->saveOrFail($row);
|
$this->Responses->saveOrFail($row);
|
||||||
});
|
});
|
||||||
@@ -226,6 +235,8 @@ class VoteService
|
|||||||
throw new VoteException(match (true) {
|
throw new VoteException(match (true) {
|
||||||
$slide->isQuiz() && $slide->voting_started_at === null => __('Das Quiz hat noch nicht begonnen.'),
|
$slide->isQuiz() && $slide->voting_started_at === null => __('Das Quiz hat noch nicht begonnen.'),
|
||||||
$slide->isQuiz() => __('Die Zeit für dieses Quiz ist abgelaufen.'),
|
$slide->isQuiz() => __('Die Zeit für dieses Quiz ist abgelaufen.'),
|
||||||
|
$slide->usesPhases() && $slide->voting_started_at === null => __('Die Abstimmung hat noch nicht begonnen.'),
|
||||||
|
$slide->usesPhases() => __('Die Zeit für diese Frage ist abgelaufen.'),
|
||||||
$slide->isQa() => __('Die Fragerunde läuft – Fragen und Stimmen sind nicht mehr möglich.'),
|
$slide->isQa() => __('Die Fragerunde läuft – Fragen und Stimmen sind nicht mehr möglich.'),
|
||||||
default => __('Die Abstimmung zu dieser Frage ist geschlossen.'),
|
default => __('Die Abstimmung zu dieser Frage ist geschlossen.'),
|
||||||
});
|
});
|
||||||
@@ -279,6 +290,15 @@ class VoteService
|
|||||||
$validIds = $slide->optionIds();
|
$validIds = $slide->optionIds();
|
||||||
$selected = array_values(array_intersect($selected, $validIds));
|
$selected = array_values(array_intersect($selected, $validIds));
|
||||||
|
|
||||||
|
if ($selected === [] && $slide->hasCommentOnly()) {
|
||||||
|
// Comment only: no selection, but a comment is required (this is not a way to skip).
|
||||||
|
$comment = self::comment($data);
|
||||||
|
if ($comment === null) {
|
||||||
|
throw new VoteException(__('Bitte wähle eine Antwort aus oder schreibe einen Kommentar.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [['slide_option_id' => null, 'text_value' => $comment]];
|
||||||
|
}
|
||||||
if ($selected === []) {
|
if ($selected === []) {
|
||||||
throw new VoteException(__('Bitte wähle eine Antwort aus.'));
|
throw new VoteException(__('Bitte wähle eine Antwort aus.'));
|
||||||
}
|
}
|
||||||
@@ -680,6 +700,17 @@ class VoteService
|
|||||||
*/
|
*/
|
||||||
protected function scaleRows(Slide $slide, array $data): array
|
protected function scaleRows(Slide $slide, array $data): array
|
||||||
{
|
{
|
||||||
|
if (self::stringField($data, 'value') === '' && $slide->hasCommentOnly()) {
|
||||||
|
// Comment only: no rating, but a comment is required (this is not a way to skip).
|
||||||
|
$comment = self::comment($data);
|
||||||
|
if ($comment === null) {
|
||||||
|
throw new VoteException($slide->isStarRating()
|
||||||
|
? __('Bitte vergib Sterne oder schreibe einen Kommentar.')
|
||||||
|
: __('Bitte wähle einen Wert oder schreibe einen Kommentar.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [['numeric_value' => null, 'text_value' => $comment]];
|
||||||
|
}
|
||||||
$value = filter_var($data['value'] ?? null, FILTER_VALIDATE_INT);
|
$value = filter_var($data['value'] ?? null, FILTER_VALIDATE_INT);
|
||||||
$min = (int)$slide->setting('scale_min');
|
$min = (int)$slide->setting('scale_min');
|
||||||
$max = (int)$slide->setting('scale_max');
|
$max = (int)$slide->setting('scale_max');
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ $bar = function (float $percent, bool $ok = false): string {
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<?php if (!empty($r['commentOnly'])) : ?>
|
||||||
|
<p class="muted"><?= __('{0}× nur Kommentar (nicht in den Stimmen)', (int)$r['commentOnly']) ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
<?php if ($slide->hasComments()) : ?>
|
<?php if ($slide->hasComments()) : ?>
|
||||||
<h3><?= __n('{0} Kommentar', '{0} Kommentare', count($r['comments']), count($r['comments'])) ?></h3>
|
<h3><?= __n('{0} Kommentar', '{0} Kommentare', count($r['comments']), count($r['comments'])) ?></h3>
|
||||||
<?php if ($r['comments'] === []) : ?>
|
<?php if ($r['comments'] === []) : ?>
|
||||||
@@ -205,6 +208,9 @@ $bar = function (float $percent, bool $ok = false): string {
|
|||||||
<span class="muted"><?= !empty($r['stars'])
|
<span class="muted"><?= !empty($r['stars'])
|
||||||
? __('von {0} Sternen', (int)$r['max'])
|
? __('von {0} Sternen', (int)$r['max'])
|
||||||
: __('auf einer Skala von {0} bis {1}', (int)$r['min'], (int)$r['max']) ?></span>
|
: __('auf einer Skala von {0} bis {1}', (int)$r['min'], (int)$r['max']) ?></span>
|
||||||
|
<?php if (!empty($r['commentOnly'])) : ?>
|
||||||
|
· <span class="muted"><?= __('{0}× nur Kommentar (nicht im Durchschnitt)', (int)$r['commentOnly']) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
</p>
|
</p>
|
||||||
<table>
|
<table>
|
||||||
<thead><tr><th><?= !empty($r['stars']) ? __('Sterne') : __('Wert') ?></th><th class="num"><?= __('Anzahl') ?></th><th class="num"><?= __('Anteil') ?></th><th></th></tr></thead>
|
<thead><tr><th><?= !empty($r['stars']) ? __('Sterne') : __('Wert') ?></th><th class="num"><?= __('Anzahl') ?></th><th class="num"><?= __('Anteil') ?></th><th></th></tr></thead>
|
||||||
|
|||||||
+81
-12
@@ -18,6 +18,16 @@ $this->assign('noindex', '1');
|
|||||||
$url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $adminToken] + $params;
|
$url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $adminToken] + $params;
|
||||||
$hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide->isInteractive() && $slide->isPrivate()) !== [];
|
$hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide->isInteractive() && $slide->isPrivate()) !== [];
|
||||||
?>
|
?>
|
||||||
|
<?php // Phone/tablet: the sidebar (participation, settings, …) becomes a menu drawer opened from the header, right of the colour scheme switch. ?>
|
||||||
|
<?php $this->start('headerMenu'); ?>
|
||||||
|
<button type="button" class="theme-switch menu-toggle" data-drawer-toggle hidden aria-expanded="false" aria-controls="admin-menu"
|
||||||
|
aria-label="<?= h(__('Menü: Teilnahme, Einstellungen und mehr')) ?>" title="<?= h(__('Menü')) ?>">
|
||||||
|
<svg class="theme-switch__icon" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||||
|
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||||
|
<path d="M4 6h16M4 12h16M4 18h16"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<?php $this->end(); ?>
|
||||||
<div class="admin-head" data-refresh="head" data-live>
|
<div class="admin-head" data-refresh="head" data-live>
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow"><?= __('Verwaltung') ?></p>
|
<p class="eyebrow"><?= __('Verwaltung') ?></p>
|
||||||
@@ -109,6 +119,12 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
|||||||
'running' => __('Quiz läuft'),
|
'running' => __('Quiz läuft'),
|
||||||
'finished' => __('Quiz beendet'),
|
'finished' => __('Quiz beendet'),
|
||||||
][$slide->quizPhase()]) ?></span>
|
][$slide->quizPhase()]) ?></span>
|
||||||
|
<?php elseif ($slide->usesPhases()) : ?>
|
||||||
|
<span class="muted">· ⏱ <?= __('{0} s', (int)$slide->setting('time_limit')) ?> · <?= h([
|
||||||
|
'ready' => __('noch nicht gestartet'),
|
||||||
|
'running' => __('Countdown läuft'),
|
||||||
|
'finished' => __('beendet'),
|
||||||
|
][$slide->phase()]) ?></span>
|
||||||
<?php elseif ($slide->isQa()) : ?>
|
<?php elseif ($slide->isQa()) : ?>
|
||||||
<span class="muted">· <?= h([
|
<span class="muted">· <?= h([
|
||||||
'collect' => __('Fragen sammeln'),
|
'collect' => __('Fragen sammeln'),
|
||||||
@@ -226,11 +242,20 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<aside class="sidebar">
|
<aside class="sidebar" id="admin-menu" aria-label="<?= h(__('Menü')) ?>">
|
||||||
|
<div class="sidebar__bar" data-drawer-bar>
|
||||||
|
<strong><?= __('Menü') ?></strong>
|
||||||
|
<button type="button" class="modal__close sidebar__close" data-drawer-close
|
||||||
|
aria-label="<?= h(__('Menü schließen')) ?>" title="<?= h(__('Schließen (Esc)')) ?>">✕</button>
|
||||||
|
</div>
|
||||||
<details class="card collapsible" open>
|
<details class="card collapsible" open>
|
||||||
<summary><h2><?= __('Teilnahme') ?></h2></summary>
|
<summary><h2><?= __('Teilnahme') ?></h2></summary>
|
||||||
<p class="join-code"><?= h($poll->formattedJoinCode()) ?></p>
|
<p class="join-code"><?= h($poll->formattedJoinCode()) ?></p>
|
||||||
|
<div class="qr-wrap">
|
||||||
<img class="qr" src="<?= $this->Url->build($url('admin:qr')) ?>" alt="<?= __('QR-Code zur Teilnahme') ?>" width="160" height="160">
|
<img class="qr" src="<?= $this->Url->build($url('admin:qr')) ?>" alt="<?= __('QR-Code zur Teilnahme') ?>" width="160" height="160">
|
||||||
|
<button type="button" class="button button--small qr-wrap__download" data-qr-download
|
||||||
|
data-filename="plenario-qr-<?= h($poll->join_code) ?>.png" hidden><?= __('Als PNG speichern') ?></button>
|
||||||
|
</div>
|
||||||
<div class="copy-field">
|
<div class="copy-field">
|
||||||
<input type="text" readonly value="<?= h($joinUrl) ?>" aria-label="<?= __('Teilnahme-Link') ?>" data-copy-source>
|
<input type="text" readonly value="<?= h($joinUrl) ?>" aria-label="<?= __('Teilnahme-Link') ?>" data-copy-source>
|
||||||
<button type="button" class="button button--small" data-copy><?= __('Kopieren') ?></button>
|
<button type="button" class="button button--small" data-copy><?= __('Kopieren') ?></button>
|
||||||
@@ -261,6 +286,59 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
|||||||
<p class="hint" id="comment-speed-hint"><?= __('Gilt für die Kommentare von Skala-Folien, die nacheinander durchlaufen. Die Anzeigedauer richtet sich weiter nach der Textlänge und wird mit diesem Faktor verkürzt oder verlängert.') ?></p>
|
<p class="hint" id="comment-speed-hint"><?= __('Gilt für die Kommentare von Skala-Folien, die nacheinander durchlaufen. Die Anzeigedauer richtet sich weiter nach der Textlänge und wird mit diesem Faktor verkürzt oder verlängert.') ?></p>
|
||||||
<?= $this->Form->button(__('Speichern'), ['class' => 'button']) ?>
|
<?= $this->Form->button(__('Speichern'), ['class' => 'button']) ?>
|
||||||
<?= $this->Form->end() ?>
|
<?= $this->Form->end() ?>
|
||||||
|
<section class="card-section">
|
||||||
|
<h3 id="audio"><?= __('Musik zum Quiz-Countdown') ?></h3>
|
||||||
|
<?php
|
||||||
|
$audioMb = (int)round((int)\Cake\Core\Configure::read('Plenario.audio.maxUploadBytes', 10 * 1024 * 1024) / 1024 / 1024);
|
||||||
|
$audioUrl = $poll->hasAudio()
|
||||||
|
? $this->Url->build(['_name' => 'participate:audio', 'code' => $poll->join_code, 'file' => $poll->audio])
|
||||||
|
: null;
|
||||||
|
?>
|
||||||
|
<p class="hint" id="audio-hint"><?= __('Läuft in der Präsentation, solange ein Quiz läuft, und wiederholt sich bei Bedarf. Teilnehmende hören nichts.') ?></p>
|
||||||
|
<?= $this->Form->create(null, ['url' => $url('admin:audio'), 'type' => 'file', 'class' => 'image-fields', 'data-audio-form' => '']) ?>
|
||||||
|
<input type="file" id="audio-file" name="audio" class="sr-only" aria-describedby="audio-hint"
|
||||||
|
accept="audio/mpeg,audio/mp4,audio/ogg,audio/wav,.mp3,.m4a,.ogg,.wav">
|
||||||
|
<?php if ($audioUrl === null) : ?>
|
||||||
|
<label class="image-drop image-drop--compact" for="audio-file" data-audio-drop>
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"
|
||||||
|
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||||
|
<path d="M9 18V5l11-2v13"/><circle cx="6.5" cy="18" r="2.5"/><circle cx="17.5" cy="16" r="2.5"/>
|
||||||
|
</svg>
|
||||||
|
<span class="image-drop__title"><?= __('Audiodatei auswählen') ?><span data-audio-drop-extra hidden> <?= __('oder hierher ziehen') ?></span></span>
|
||||||
|
<span class="image-drop__hint"><?= __('MP3, M4A, OGG, WAV · bis {0} MB', $audioMb) ?></span>
|
||||||
|
</label>
|
||||||
|
<?php else : ?>
|
||||||
|
<div class="image-fields__row audio-row" data-audio-drop>
|
||||||
|
<audio controls preload="none" class="audio-row__player" src="<?= h($audioUrl) ?>"></audio>
|
||||||
|
<div class="image-fields__buttons">
|
||||||
|
<label class="button button--small" for="audio-file"><?= __('Ersetzen') ?></label>
|
||||||
|
<button type="submit" name="remove" value="1" class="button button--danger button--small"
|
||||||
|
data-confirm="<?= h(__('Die Audiodatei entfernen?')) ?>"><?= __('Entfernen') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php // Without JavaScript the chosen file is sent with this button; with it, choosing a file sends it right away. ?>
|
||||||
|
<button type="submit" class="button button--small" data-audio-submit><?= __('Hochladen') ?></button>
|
||||||
|
<?= $this->Form->end() ?>
|
||||||
|
</section>
|
||||||
|
<section class="card-section">
|
||||||
|
<h3 id="embed"><?= __('In Präsentation einbetten') ?></h3>
|
||||||
|
<p class="hint"><?= __('Jede Folie hat einen eigenen Einbett-Link (unter „Einbett-Link“ in der Folienliste). Füge ihn z. B. in Canva als Einbettung auf einer Folie ein.') ?></p>
|
||||||
|
<p class="hint"><?= __('Sobald die eingebettete Folie im Vortrag zu sehen ist, wird sie live geschaltet. Bei allen anderen Folien sehen Teilnehmende eine Pause-Seite.') ?></p>
|
||||||
|
<p class="hint"><?= __('Der Link zeigt nur diese Folie und kann sie live schalten – die Umfrage bearbeiten kann damit niemand.') ?></p>
|
||||||
|
<?= $this->Form->postButton(__('Neue Einbett-Links erzeugen'), $url('admin:rotate-embed'), [
|
||||||
|
'class' => 'button button--small',
|
||||||
|
'data-confirm' => __('Neue Einbett-Links erzeugen? Alle bisher eingebetteten Folien funktionieren danach nicht mehr.'),
|
||||||
|
]) ?>
|
||||||
|
</section>
|
||||||
|
<section class="card-section">
|
||||||
|
<h3 id="clone"><?= __('Umfrage kopieren') ?></h3>
|
||||||
|
<p class="hint"><?= __('Legt eine neue Umfrage mit allen Folien, Einstellungen und Bildern an – ohne Antworten und noch nicht gestartet. Die Kopie bekommt einen eigenen Teilnahme-Code und Admin-Link, der an dieselbe E-Mail-Adresse geschickt wird.') ?></p>
|
||||||
|
<?= $this->Form->postButton(__('Umfrage kopieren'), $url('admin:clone'), [
|
||||||
|
'class' => 'button button--small',
|
||||||
|
'data-confirm' => __('Die Umfrage mit allen Folien (ohne Antworten) kopieren?'),
|
||||||
|
]) ?>
|
||||||
|
</section>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details class="card collapsible" id="export">
|
<details class="card collapsible" id="export">
|
||||||
@@ -290,17 +368,6 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
|||||||
<?= $this->Form->end() ?>
|
<?= $this->Form->end() ?>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details class="card collapsible" id="embed">
|
|
||||||
<summary><h2><?= __('In Präsentation einbetten') ?></h2></summary>
|
|
||||||
<p class="hint"><?= __('Jede Folie hat einen eigenen Einbett-Link (unter „Einbett-Link“ in der Folienliste). Füge ihn z. B. in Canva als Einbettung auf einer Folie ein.') ?></p>
|
|
||||||
<p class="hint"><?= __('Sobald die eingebettete Folie im Vortrag zu sehen ist, wird sie live geschaltet. Bei allen anderen Folien sehen Teilnehmende eine Pause-Seite.') ?></p>
|
|
||||||
<p class="hint"><?= __('Der Link zeigt nur diese Folie und kann sie live schalten – die Umfrage bearbeiten kann damit niemand.') ?></p>
|
|
||||||
<?= $this->Form->postButton(__('Neue Einbett-Links erzeugen'), $url('admin:rotate-embed'), [
|
|
||||||
'class' => 'button button--small',
|
|
||||||
'data-confirm' => __('Neue Einbett-Links erzeugen? Alle bisher eingebetteten Folien funktionieren danach nicht mehr.'),
|
|
||||||
]) ?>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details class="card card--danger collapsible">
|
<details class="card card--danger collapsible">
|
||||||
<summary><h2><?= __('Sicherheit') ?></h2></summary>
|
<summary><h2><?= __('Sicherheit') ?></h2></summary>
|
||||||
<?php if ($poll->expiresAt() !== null) : ?>
|
<?php if ($poll->expiresAt() !== null) : ?>
|
||||||
@@ -350,6 +417,8 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
|||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="drawer-backdrop" data-drawer-close aria-hidden="true"></div>
|
||||||
|
|
||||||
<?php // Slide form in a dialog (loaded via fetch, see [data-modal] in plenario.js); without JS the links open the full page. ?>
|
<?php // Slide form in a dialog (loaded via fetch, see [data-modal] in plenario.js); without JS the links open the full page. ?>
|
||||||
<dialog class="modal" data-modal-dialog aria-labelledby="modal-title">
|
<dialog class="modal" data-modal-dialog aria-labelledby="modal-title">
|
||||||
<button type="button" class="modal__close" data-modal-close
|
<button type="button" class="modal__close" data-modal-close
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Presenter screen. Rendered empty and filled by webroot/js/plenario.js
|
* Presenter screen. Rendered empty and filled by webroot/js/plenario.js
|
||||||
* (Plenario.presenter) from /admin/{token}/state.
|
* (Plenario.presenter) from /admin/{token}/state.
|
||||||
*
|
*
|
||||||
* Keyboard: ←/→ slides, P pause/resume (→ resumes too), V voting on/off, H hide results, F fullscreen, Q QR code, T light/dark.
|
* Keyboard: ←/→ (also ↑/↓ and PageUp/PageDown, as sent by presenter remotes) slides, B (Break) pause/resume (P works too) (→ resumes too), V voting on/off, H hide results, F fullscreen, Q QR code, T light/dark.
|
||||||
* The speaker view (admin:speaker) is this page plus a preview of the next slide, meant for the presenter's own screen.
|
* The speaker view (admin:speaker) is this page plus a preview of the next slide, meant for the presenter's own screen.
|
||||||
* Q&A slides: V switches to the next stage; while discussing ←/→ step through the questions first.
|
* Q&A slides: V switches to the next stage; while discussing ←/→ step through the questions first.
|
||||||
*
|
*
|
||||||
@@ -43,6 +43,7 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl);
|
|||||||
<p class="stage__status" data-status></p>
|
<p class="stage__status" data-status></p>
|
||||||
<h1 class="stage__question" data-question><?= __('Lade …') ?></h1>
|
<h1 class="stage__question" data-question><?= __('Lade …') ?></h1>
|
||||||
<div class="stage__description formatted" data-description></div>
|
<div class="stage__description formatted" data-description></div>
|
||||||
|
<div class="stage__timer" data-stage-timer></div>
|
||||||
<div class="stage__media" data-media hidden></div>
|
<div class="stage__media" data-media hidden></div>
|
||||||
<figure class="stage__image" data-image hidden></figure>
|
<figure class="stage__image" data-image hidden></figure>
|
||||||
<div class="stage__results" data-results></div>
|
<div class="stage__results" data-results></div>
|
||||||
@@ -66,18 +67,18 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl);
|
|||||||
<span aria-hidden="true">⧉</span><span class="sr-only"><?= __('Referentenansicht öffnen') ?></span>
|
<span aria-hidden="true">⧉</span><span class="sr-only"><?= __('Referentenansicht öffnen') ?></span>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<button type="button" class="ctrl" data-action="prev" aria-keyshortcuts="ArrowLeft PageUp" title="<?= __('Vorherige Folie (←)') ?>">
|
<button type="button" class="ctrl" data-action="prev" aria-keyshortcuts="ArrowLeft ArrowUp PageUp" title="<?= __('Vorherige Folie (←)') ?>">
|
||||||
<span aria-hidden="true">←</span><span class="sr-only"><?= __('Vorherige Folie') ?></span>
|
<span aria-hidden="true">←</span><span class="sr-only"><?= __('Vorherige Folie') ?></span>
|
||||||
</button>
|
</button>
|
||||||
<span class="ctrl-counter" data-counter>–</span>
|
<span class="ctrl-counter" data-counter>–</span>
|
||||||
<button type="button" class="ctrl" data-action="next" aria-keyshortcuts="ArrowRight PageDown Space" title="<?= __('Nächste Folie (→ oder Leertaste)') ?>">
|
<button type="button" class="ctrl" data-action="next" aria-keyshortcuts="ArrowRight ArrowDown PageDown Space" title="<?= __('Nächste Folie (→ oder Leertaste)') ?>">
|
||||||
<span aria-hidden="true">→</span><span class="sr-only"><?= __('Nächste Folie') ?></span>
|
<span aria-hidden="true">→</span><span class="sr-only"><?= __('Nächste Folie') ?></span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="ctrl" data-action="stop" data-pause aria-keyshortcuts="P" title="<?= __('Pause: Teilnehmende sehen eine Pause-Seite (P)') ?>"
|
<button type="button" class="ctrl" data-action="stop" data-pause aria-keyshortcuts="B P" title="<?= __('Pause: Teilnehmende sehen eine Pause-Seite (B)') ?>"
|
||||||
data-title-pause="<?= h(__('Pause: Teilnehmende sehen eine Pause-Seite (P)')) ?>"
|
data-title-pause="<?= h(__('Pause: Teilnehmende sehen eine Pause-Seite (B)')) ?>"
|
||||||
data-title-resume="<?= h(__('Fortsetzen: pausierte Folie wieder zeigen (P)')) ?>">
|
data-title-resume="<?= h(__('Fortsetzen: pausierte Folie wieder zeigen (B)')) ?>">
|
||||||
<span aria-hidden="true" data-pause-icon>⏸</span><span class="sr-only" data-pause-label><?= __('Pause') ?></span>
|
<span aria-hidden="true" data-pause-icon>⏸</span><span class="sr-only" data-pause-label><?= __('Pause') ?></span>
|
||||||
<kbd class="ctrl__key" aria-hidden="true">[P]</kbd>
|
<kbd class="ctrl__key" aria-hidden="true">[B]</kbd>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="ctrl ctrl--wide" data-action="toggle" data-voting aria-keyshortcuts="V" title="<?= __('Abstimmung öffnen/schließen (V)') ?>">
|
<button type="button" class="ctrl ctrl--wide" data-action="toggle" data-voting aria-keyshortcuts="V" title="<?= __('Abstimmung öffnen/schließen (V)') ?>">
|
||||||
<span data-label></span> <kbd class="ctrl__key" aria-hidden="true">[V]</kbd>
|
<span data-label></span> <kbd class="ctrl__key" aria-hidden="true">[V]</kbd>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ $this->assign('bodyClass', 'participant');
|
|||||||
$voteUrl = ['_name' => 'participate:vote', 'code' => $poll->join_code];
|
$voteUrl = ['_name' => 'participate:vote', 'code' => $poll->join_code];
|
||||||
$words = $state['words'] ?? null;
|
$words = $state['words'] ?? null;
|
||||||
$quiz = $state['quiz'] ?? null;
|
$quiz = $state['quiz'] ?? null;
|
||||||
|
$timer = $state['timer'] ?? null;
|
||||||
$qa = $state['qa'] ?? null;
|
$qa = $state['qa'] ?? null;
|
||||||
$order = $state['order'] ?? null;
|
$order = $state['order'] ?? null;
|
||||||
$countdown = function (?int $remaining): string {
|
$countdown = function (?int $remaining): string {
|
||||||
@@ -40,27 +41,6 @@ $countdown = function (?int $remaining): string {
|
|||||||
|
|
||||||
<p class="eyebrow eyebrow--poll center"><?= h($poll->title) ?></p>
|
<p class="eyebrow eyebrow--poll center"><?= h($poll->title) ?></p>
|
||||||
|
|
||||||
<?php // Icon buttons in the header, next to the theme switch. Hidden unless the browser supports the API (no fullscreen on iPhone). ?>
|
|
||||||
<?php $this->start('headerTools'); ?>
|
|
||||||
<button type="button" class="theme-switch" data-fullscreen-toggle hidden aria-pressed="false"
|
|
||||||
data-label-on="<?= h(__('Vollbild beenden')) ?>" data-label-off="<?= h(__('Vollbild')) ?>"
|
|
||||||
aria-label="<?= h(__('Vollbild')) ?>" title="<?= h(__('Vollbild')) ?>">
|
|
||||||
<svg class="theme-switch__icon" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
||||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
||||||
<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="theme-switch" data-wakelock-toggle hidden aria-pressed="false"
|
|
||||||
data-label-on="<?= h(__('Display bleibt an – tippen zum Ausschalten')) ?>"
|
|
||||||
data-label-off="<?= h(__('Display bleibt nicht an – tippen zum Anlassen')) ?>"
|
|
||||||
aria-label="<?= h(__('Display anlassen')) ?>" title="<?= h(__('Display anlassen')) ?>">
|
|
||||||
<svg class="theme-switch__icon" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
||||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
||||||
<path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<?php $this->end(); ?>
|
|
||||||
|
|
||||||
<?php if (!$poll->is_active) : ?>
|
<?php if (!$poll->is_active) : ?>
|
||||||
<section class="card center">
|
<section class="card center">
|
||||||
<h1><?= __('Diese Umfrage ist geschlossen.') ?></h1>
|
<h1><?= __('Diese Umfrage ist geschlossen.') ?></h1>
|
||||||
@@ -121,6 +101,13 @@ $countdown = function (?int $remaining): string {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?= $this->element('slide_image', compact('slide', 'poll')) ?>
|
<?= $this->element('slide_image', compact('slide', 'poll')) ?>
|
||||||
|
|
||||||
|
<?php if ($timer !== null && $timer['phase'] === 'ready') : ?>
|
||||||
|
<div class="waiting center">
|
||||||
|
<div class="pulse" aria-hidden="true"></div>
|
||||||
|
<p class="muted"><?= __('Die Abstimmung startet gleich. Die Antwortmöglichkeiten erscheinen, sobald es losgeht.') ?></p>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<?= $timer !== null && $timer['phase'] === 'running' ? $countdown($timer['remaining']) : '' ?>
|
||||||
<?php if ($quiz !== null) : ?>
|
<?php if ($quiz !== null) : ?>
|
||||||
<?php if ($quiz['phase'] === 'ready') : ?>
|
<?php if ($quiz['phase'] === 'ready') : ?>
|
||||||
<div class="waiting center">
|
<div class="waiting center">
|
||||||
@@ -295,13 +282,16 @@ $countdown = function (?int $remaining): string {
|
|||||||
<label class="choice">
|
<label class="choice">
|
||||||
<input type="<?= $multiple ? 'checkbox' : 'radio' ?>"
|
<input type="<?= $multiple ? 'checkbox' : 'radio' ?>"
|
||||||
name="<?= $multiple ? 'option_ids[]' : 'option_id' ?>"
|
name="<?= $multiple ? 'option_ids[]' : 'option_id' ?>"
|
||||||
value="<?= (int)$option->id ?>" <?= $multiple ? '' : 'required' ?>>
|
value="<?= (int)$option->id ?>" <?= $multiple || $slide->hasCommentOnly() ? '' : 'required' ?>>
|
||||||
<span><?= h($option->label) ?></span>
|
<span><?= h($option->label) ?></span>
|
||||||
</label>
|
</label>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($slide->hasComments()) : ?>
|
<?php if ($slide->hasComments()) : ?>
|
||||||
<label class="scale-comment" for="choice-comment"><?= __('Kommentar (optional)') ?></label>
|
<label class="scale-comment" for="choice-comment"><?= __('Kommentar (optional)') ?></label>
|
||||||
|
<?php if ($slide->hasCommentOnly()) : ?>
|
||||||
|
<p class="hint"><?= __('Du kannst auch nur einen Kommentar abgeben, ohne etwas auszuwählen.') ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
<textarea id="choice-comment" name="comment" rows="3" maxlength="500"
|
<textarea id="choice-comment" name="comment" rows="3" maxlength="500"
|
||||||
placeholder="<?= __('Möchtest du deine Auswahl begründen?') ?>"></textarea>
|
placeholder="<?= __('Möchtest du deine Auswahl begründen?') ?>"></textarea>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -322,7 +312,7 @@ $countdown = function (?int $remaining): string {
|
|||||||
<div class="stars<?= $maxValue > 6 ? ' stars--many' : '' ?>" role="radiogroup" aria-label="<?= __('Bewertung in Sternen') ?>"<?= $slide->isPrivate() ? ' aria-describedby="private-hint"' : '' ?>>
|
<div class="stars<?= $maxValue > 6 ? ' stars--many' : '' ?>" role="radiogroup" aria-label="<?= __('Bewertung in Sternen') ?>"<?= $slide->isPrivate() ? ' aria-describedby="private-hint"' : '' ?>>
|
||||||
<?php for ($v = 1; $v <= $maxValue; $v++) : ?>
|
<?php for ($v = 1; $v <= $maxValue; $v++) : ?>
|
||||||
<label class="stars__star">
|
<label class="stars__star">
|
||||||
<input type="radio" name="value" value="<?= $v ?>" required>
|
<input type="radio" name="value" value="<?= $v ?>" <?= $slide->hasCommentOnly() ? '' : 'required' ?>>
|
||||||
<span class="stars__icon" aria-hidden="true">★</span>
|
<span class="stars__icon" aria-hidden="true">★</span>
|
||||||
<span class="sr-only"><?= __('{0} von {1} Sternen', $v, $maxValue) ?></span>
|
<span class="sr-only"><?= __('{0} von {1} Sternen', $v, $maxValue) ?></span>
|
||||||
</label>
|
</label>
|
||||||
@@ -332,7 +322,7 @@ $countdown = function (?int $remaining): string {
|
|||||||
<div class="scale"<?= $slide->isPrivate() ? ' aria-describedby="private-hint"' : '' ?>>
|
<div class="scale"<?= $slide->isPrivate() ? ' aria-describedby="private-hint"' : '' ?>>
|
||||||
<?php for ($v = (int)$slide->setting('scale_min'); $v <= $maxValue; $v++) : ?>
|
<?php for ($v = (int)$slide->setting('scale_min'); $v <= $maxValue; $v++) : ?>
|
||||||
<label class="scale__step">
|
<label class="scale__step">
|
||||||
<input type="radio" name="value" value="<?= $v ?>" required>
|
<input type="radio" name="value" value="<?= $v ?>" <?= $slide->hasCommentOnly() ? '' : 'required' ?>>
|
||||||
<span><?= $v ?></span>
|
<span><?= $v ?></span>
|
||||||
</label>
|
</label>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
@@ -344,6 +334,9 @@ $countdown = function (?int $remaining): string {
|
|||||||
</div>
|
</div>
|
||||||
<?php if ($slide->hasComments()) : ?>
|
<?php if ($slide->hasComments()) : ?>
|
||||||
<label class="scale-comment" for="scale-comment"><?= __('Kommentar (optional)') ?></label>
|
<label class="scale-comment" for="scale-comment"><?= __('Kommentar (optional)') ?></label>
|
||||||
|
<?php if ($slide->hasCommentOnly()) : ?>
|
||||||
|
<p class="hint"><?= __('Du kannst auch nur einen Kommentar abgeben, ohne zu bewerten.') ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
<textarea id="scale-comment" name="comment" rows="3" maxlength="500"
|
<textarea id="scale-comment" name="comment" rows="3" maxlength="500"
|
||||||
placeholder="<?= __('Möchtest du deine Bewertung begründen?') ?>"></textarea>
|
placeholder="<?= __('Möchtest du deine Bewertung begründen?') ?>"></textarea>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -357,6 +350,7 @@ $countdown = function (?int $remaining): string {
|
|||||||
<?= $this->Form->button(__('Absenden'), ['class' => 'button button--primary button--block']) ?>
|
<?= $this->Form->button(__('Absenden'), ['class' => 'button button--primary button--block']) ?>
|
||||||
<?= $this->Form->end() ?>
|
<?= $this->Form->end() ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="card results-card" data-results-card <?= $state['results'] ? '' : 'hidden' ?>>
|
<section class="card results-card" data-results-card <?= $state['results'] ? '' : 'hidden' ?>>
|
||||||
@@ -368,8 +362,8 @@ $countdown = function (?int $remaining): string {
|
|||||||
} ?></h2>
|
} ?></h2>
|
||||||
<?php if ($words !== null && $words['allowUpvotes'] && $slide->is_voting_open) : ?>
|
<?php if ($words !== null && $words['allowUpvotes'] && $slide->is_voting_open) : ?>
|
||||||
<p class="hint" data-upvote-hint><?= $words['allowDownvotes']
|
<p class="hint" data-upvote-hint><?= $words['allowDownvotes']
|
||||||
? __('Tippe auf einen Begriff, um ihn zu unterstützen, oder auf „−“, um ihn abzulehnen.')
|
? __('Tippe auf „+“, um einen Begriff zu unterstützen, oder auf „−“, um ihn abzulehnen.')
|
||||||
: __('Tippe auf einen Begriff, um ihn zu unterstützen.') ?></p>
|
: __('Tippe auf „+“, um einen Begriff zu unterstützen.') ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div data-results></div>
|
<div data-results></div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ $count = match (true) {
|
|||||||
</p>
|
</p>
|
||||||
<h1 id="modal-title"><?= h($slide->question) ?></h1>
|
<h1 id="modal-title"><?= h($slide->question) ?></h1>
|
||||||
<?php if ($scale !== null) : ?>
|
<?php if ($scale !== null) : ?>
|
||||||
<p class="muted"><?= __n('{0} Bewertung', '{0} Bewertungen', $count, $count) ?></p>
|
<p class="muted"><?= __n('{0} Bewertung', '{0} Bewertungen', $count, $count) ?><?php if (!empty($scale['commentOnly'])) : ?> · <?= __('{0}× nur Kommentar', (int)$scale['commentOnly']) ?><?php endif; ?></p>
|
||||||
<?php elseif ($isChoice) : ?>
|
<?php elseif ($isChoice) : ?>
|
||||||
<p class="muted"><?= __n('{0} Kommentar, neueste zuerst', '{0} Kommentare, neueste zuerst', $count, $count) ?></p>
|
<p class="muted"><?= __n('{0} Kommentar, neueste zuerst', '{0} Kommentare, neueste zuerst', $count, $count) ?></p>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
@@ -86,7 +86,7 @@ $count = match (true) {
|
|||||||
$created = new DateTime($comment['created']); ?>
|
$created = new DateTime($comment['created']); ?>
|
||||||
<li>
|
<li>
|
||||||
<?= h($comment['text']) ?>
|
<?= h($comment['text']) ?>
|
||||||
<time datetime="<?= h($comment['created']) ?>"><?= __('Bewertung') ?> <?= $this->element('rating', ['slide' => $slide, 'value' => (int)$comment['value']]) ?> · <?= h($created->i18nFormat('dd.MM.yyyy, HH:mm')) ?></time>
|
<time datetime="<?= h($comment['created']) ?>"><?php if ($comment['value'] !== null) : ?><?= __('Bewertung') ?> <?= $this->element('rating', ['slide' => $slide, 'value' => (int)$comment['value']]) ?><?php else : ?><?= __('ohne Bewertung') ?><?php endif; ?> · <?= h($created->i18nFormat('dd.MM.yyyy, HH:mm')) ?></time>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ol>
|
</ol>
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ $optionsError = $slide->getError('options_text');
|
|||||||
<div class="input textarea<?= $optionsError ? ' error' : '' ?>">
|
<div class="input textarea<?= $optionsError ? ' error' : '' ?>">
|
||||||
<label for="options-text"><?= __('Antwortoptionen (eine pro Zeile, max. 20)') ?></label>
|
<label for="options-text"><?= __('Antwortoptionen (eine pro Zeile, max. 20)') ?></label>
|
||||||
<textarea id="options-text" name="options_text" rows="6" required><?= h($optionsText) ?></textarea>
|
<textarea id="options-text" name="options_text" rows="6" required><?= h($optionsText) ?></textarea>
|
||||||
|
<?php // Shortcut for formal votes; needs JavaScript, so it stays hidden without it. ?>
|
||||||
|
<button type="button" class="button button--small button--ghost" hidden
|
||||||
|
data-add-option="<?= h(__('Enthaltung')) ?>" data-add-option-target="options-text"
|
||||||
|
data-add-option-max="20">+ <?= __('Option „Enthaltung“ hinzufügen') ?></button>
|
||||||
<?php if ($optionsError) : ?>
|
<?php if ($optionsError) : ?>
|
||||||
<div class="error-message"><?= h(implode(' ', (array)$optionsError)) ?></div>
|
<div class="error-message"><?= h(implode(' ', (array)$optionsError)) ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -134,10 +138,15 @@ $optionsError = $slide->getError('options_text');
|
|||||||
'label' => __('Mehrfachauswahl erlauben'),
|
'label' => __('Mehrfachauswahl erlauben'),
|
||||||
'checked' => (bool)$settings['multiple'],
|
'checked' => (bool)$settings['multiple'],
|
||||||
]) ?>
|
]) ?>
|
||||||
<?= $this->Form->control('settings.comments', [
|
<?= $this->Form->control('settings.comment_mode', [
|
||||||
'type' => 'checkbox',
|
'type' => 'select',
|
||||||
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Auswahl optional begründen)'),
|
'label' => __('Kommentarfeld'),
|
||||||
'checked' => (bool)$settings['comments'],
|
'options' => [
|
||||||
|
'off' => __('Kein Kommentarfeld'),
|
||||||
|
'rating' => __('Kommentar optional, die Auswahl ist Pflicht'),
|
||||||
|
'only' => __('Kommentar optional, auch ein Kommentar ohne Auswahl genügt'),
|
||||||
|
],
|
||||||
|
'value' => empty($settings['comments']) ? 'off' : (empty($settings['comment_only']) ? 'rating' : 'only'),
|
||||||
]) ?>
|
]) ?>
|
||||||
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander unter dem Ergebnis durch (nicht bei den Teilnehmenden). Das Tempo stellst du für die ganze Umfrage in den Einstellungen im Dashboard ein.') ?></p>
|
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander unter dem Ergebnis durch (nicht bei den Teilnehmenden). Das Tempo stellst du für die ganze Umfrage in den Einstellungen im Dashboard ein.') ?></p>
|
||||||
<?php elseif ($slide->type === 'open') : ?>
|
<?php elseif ($slide->type === 'open') : ?>
|
||||||
@@ -202,10 +211,15 @@ $optionsError = $slide->getError('options_text');
|
|||||||
'value' => $settings['scale_view'],
|
'value' => $settings['scale_view'],
|
||||||
]) ?>
|
]) ?>
|
||||||
<p class="hint"><?= __('Die Auswertung in der Verwaltung und der PDF-Export enthalten immer beides.') ?></p>
|
<p class="hint"><?= __('Die Auswertung in der Verwaltung und der PDF-Export enthalten immer beides.') ?></p>
|
||||||
<?= $this->Form->control('settings.comments', [
|
<?= $this->Form->control('settings.comment_mode', [
|
||||||
'type' => 'checkbox',
|
'type' => 'select',
|
||||||
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'),
|
'label' => __('Kommentarfeld'),
|
||||||
'checked' => (bool)$settings['comments'],
|
'options' => [
|
||||||
|
'off' => __('Kein Kommentarfeld'),
|
||||||
|
'rating' => __('Kommentar optional, die Bewertung ist Pflicht'),
|
||||||
|
'only' => __('Kommentar optional, auch ein Kommentar ohne Bewertung genügt'),
|
||||||
|
],
|
||||||
|
'value' => empty($settings['comments']) ? 'off' : (empty($settings['comment_only']) ? 'rating' : 'only'),
|
||||||
]) ?>
|
]) ?>
|
||||||
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden), jeder so lange, wie man zum Lesen braucht: kurze etwa 5 Sekunden, lange bis zu 30 Sekunden. Das Tempo stellst du für die ganze Umfrage in den Einstellungen im Dashboard ein. Bei internem Feedback erst, wenn du die Ergebnisse einblendest.') ?></p>
|
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden), jeder so lange, wie man zum Lesen braucht: kurze etwa 5 Sekunden, lange bis zu 30 Sekunden. Das Tempo stellst du für die ganze Umfrage in den Einstellungen im Dashboard ein. Bei internem Feedback erst, wenn du die Ergebnisse einblendest.') ?></p>
|
||||||
<?= $this->Form->control('settings.comment_ratings', [
|
<?= $this->Form->control('settings.comment_ratings', [
|
||||||
@@ -354,6 +368,8 @@ $optionsError = $slide->getError('options_text');
|
|||||||
<p class="hint"><?= __('Ablauf in der Präsentation: 1. Fragen sammeln, 2. abstimmen, 3. besprechen – die Frage mit den meisten Upvotes zuerst. Ohne Upvotes entfällt Schritt 2. Du schaltest die Schritte selbst weiter.') ?></p>
|
<p class="hint"><?= __('Ablauf in der Präsentation: 1. Fragen sammeln, 2. abstimmen, 3. besprechen – die Frage mit den meisten Upvotes zuerst. Ohne Upvotes entfällt Schritt 2. Du schaltest die Schritte selbst weiter.') ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?= $this->element('slide_time_limit', ['slide' => $slide]) ?>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<?= $this->Form->button($isNew ? __('Folie anlegen') : __('Speichern'), ['class' => 'button button--primary']) ?>
|
<?= $this->Form->button($isNew ? __('Folie anlegen') : __('Speichern'), ['class' => 'button button--primary']) ?>
|
||||||
<a class="button button--ghost" data-modal-close href="<?= $this->Url->build(['_name' => 'admin', 'token' => $adminToken]) ?>"><?= __('Abbrechen') ?></a>
|
<a class="button button--ghost" data-modal-close href="<?= $this->Url->build(['_name' => 'admin', 'token' => $adminToken]) ?>"><?= __('Abbrechen') ?></a>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Countdown of a slide (not for quizzes, which have their own field, nor Q&A): without a limit the slide is
|
||||||
|
* open as soon as it is live; with one it first shows only the question, the next step starts the countdown.
|
||||||
|
*
|
||||||
|
* @var \App\View\AppView $this
|
||||||
|
* @var \App\Model\Entity\Slide $slide
|
||||||
|
*/
|
||||||
|
|
||||||
|
use App\Model\Entity\Slide;
|
||||||
|
|
||||||
|
if ($slide->isQuiz() || !Slide::supportsTimer($slide->type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$limits = [];
|
||||||
|
foreach (Slide::TIME_LIMITS as $seconds) {
|
||||||
|
$limits[$seconds] = match (true) {
|
||||||
|
$seconds === 0 => __('Kein Countdown'),
|
||||||
|
$seconds < 60 => __('{0} Sekunden', $seconds),
|
||||||
|
$seconds % 60 === 0 => __n('{0} Minute', '{0} Minuten', intdiv($seconds, 60), intdiv($seconds, 60)),
|
||||||
|
default => __('{0} Minuten', number_format($seconds / 60, 1, ',', '')),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?= $this->Form->control('settings.time_limit', [
|
||||||
|
'type' => 'select',
|
||||||
|
'options' => $limits,
|
||||||
|
'label' => __('Countdown'),
|
||||||
|
'value' => $slide->getSettings()['time_limit'],
|
||||||
|
'aria-describedby' => 'time-limit-hint',
|
||||||
|
]) ?>
|
||||||
|
<p class="hint" id="time-limit-hint"><?= __('Mit Countdown zeigt die Präsentation zuerst nur die Frage. „Weiter“ startet den Countdown und die Abstimmung, am Ende (oder mit „Weiter“) wird geschlossen und das Ergebnis gezeigt. Ohne Countdown ist die Folie sofort offen.') ?></p>
|
||||||
@@ -33,8 +33,8 @@ $title = $this->fetch('title');
|
|||||||
<a href="<?= $this->Url->build(['_name' => 'recover']) ?>"><?= __('Admin-Link verloren?') ?></a>
|
<a href="<?= $this->Url->build(['_name' => 'recover']) ?>"><?= __('Admin-Link verloren?') ?></a>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="header-tools">
|
<div class="header-tools">
|
||||||
<?= $this->fetch('headerTools') ?>
|
|
||||||
<?= $this->element('theme_switch') ?>
|
<?= $this->element('theme_switch') ?>
|
||||||
|
<?= $this->fetch('headerMenu') ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -51,6 +51,24 @@ class PollsCommandsTest extends TestCase
|
|||||||
$this->assertTrue($this->pollsTable()->get($poll->id)->isExpired());
|
$this->assertTrue($this->pollsTable()->get($poll->id)->isExpired());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSeedCreatesNewPollWithLiveFirstSlideEveryTime(): void
|
||||||
|
{
|
||||||
|
$this->exec('polls seed --json');
|
||||||
|
$this->assertExitSuccess();
|
||||||
|
$first = json_decode(implode('', $this->_out->messages()), true);
|
||||||
|
$this->exec('polls seed --json');
|
||||||
|
$second = json_decode(implode('', $this->_out->messages()), true);
|
||||||
|
|
||||||
|
$this->assertNotSame($first['id'], $second['id']);
|
||||||
|
$this->assertNotSame($first['joinCode'], $second['joinCode']);
|
||||||
|
$this->assertSame(7, $second['slides']);
|
||||||
|
|
||||||
|
$poll = $this->pollsTable()->get($second['id']);
|
||||||
|
$slide = $this->slidesTable()->get($poll->current_slide_id);
|
||||||
|
$this->assertSame('choice', $slide->type);
|
||||||
|
$this->assertTrue($slide->isVotingOpen());
|
||||||
|
}
|
||||||
|
|
||||||
public function testSettingsAreRespected(): void
|
public function testSettingsAreRespected(): void
|
||||||
{
|
{
|
||||||
[$poll] = $this->createPoll();
|
[$poll] = $this->createPoll();
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class AdminControllerTest extends TestCase
|
|||||||
$slide = $this->slidesTable()->find()->contain(['SlideOptions'])->firstOrFail();
|
$slide = $this->slidesTable()->find()->contain(['SlideOptions'])->firstOrFail();
|
||||||
$this->assertSame($poll->id, $slide->poll_id);
|
$this->assertSame($poll->id, $slide->poll_id);
|
||||||
$this->assertSame(['Pizza', 'Pasta'], array_map(fn($o) => $o->label, $slide->slide_options));
|
$this->assertSame(['Pizza', 'Pasta'], array_map(fn($o) => $o->label, $slide->slide_options));
|
||||||
$this->assertSame(['multiple' => true, 'comments' => false], $slide->settings);
|
$this->assertSame(['multiple' => true, 'comments' => false, 'comment_only' => false, 'time_limit' => 0], $slide->settings);
|
||||||
$this->assertSame(1, $slide->position);
|
$this->assertSame(1, $slide->position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +172,24 @@ class AdminControllerTest extends TestCase
|
|||||||
$this->assertSame(Slide::QUIZ_READY, $slide->quizPhase());
|
$this->assertSame(Slide::QUIZ_READY, $slide->quizPhase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testForwardOnQaWalksThroughStagesBeforeNextSlide(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$qa = $this->createSlide($poll, Slide::TYPE_QA, [], []);
|
||||||
|
$this->createSlide($poll);
|
||||||
|
$this->goLive($poll, $qa);
|
||||||
|
|
||||||
|
$this->post("/admin/$token/control", ['action' => 'next']);
|
||||||
|
$this->assertSame(Slide::QA_VOTE, $this->slidesTable()->get($qa->id)->qaStage());
|
||||||
|
$this->post("/admin/$token/control", ['action' => 'next']);
|
||||||
|
$this->assertSame(Slide::QA_DISCUSS, $this->slidesTable()->get($qa->id)->qaStage());
|
||||||
|
$this->assertSame($qa->id, $this->pollsTable()->get($poll->id)->current_slide_id);
|
||||||
|
|
||||||
|
// No questions to step through: now it goes to the next slide.
|
||||||
|
$this->post("/admin/$token/control", ['action' => 'next']);
|
||||||
|
$this->assertNotSame($qa->id, $this->pollsTable()->get($poll->id)->current_slide_id);
|
||||||
|
}
|
||||||
|
|
||||||
public function testEditKeepsVotesOfUnchangedOptions(): void
|
public function testEditKeepsVotesOfUnchangedOptions(): void
|
||||||
{
|
{
|
||||||
[$poll, $token] = $this->createPoll();
|
[$poll, $token] = $this->createPoll();
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class ChoiceCommentsTest extends TestCase
|
|||||||
{
|
{
|
||||||
[, $token] = $this->createPoll();
|
[, $token] = $this->createPoll();
|
||||||
$this->get("/admin/$token/slides/add?type=choice");
|
$this->get("/admin/$token/slides/add?type=choice");
|
||||||
$this->assertResponseContains('name="settings[comments]"');
|
$this->assertResponseContains('name="settings[comment_mode]"');
|
||||||
|
|
||||||
$this->post("/admin/$token/slides/add?type=choice", [
|
$this->post("/admin/$token/slides/add?type=choice", [
|
||||||
'type' => 'choice',
|
'type' => 'choice',
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Test\TestCase\Controller;
|
||||||
|
|
||||||
|
use App\Model\Entity\Slide;
|
||||||
|
use App\Service\VoteService;
|
||||||
|
use App\Test\TestCase\PlenarioTestTrait;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\TestSuite\IntegrationTestTrait;
|
||||||
|
use Cake\TestSuite\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cloning a whole poll without responses (admin:clone).
|
||||||
|
*/
|
||||||
|
class ClonePollTest extends TestCase
|
||||||
|
{
|
||||||
|
use IntegrationTestTrait;
|
||||||
|
use PlenarioTestTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses'];
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->enableCsrfToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCopiesSlidesButNoResponses(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$first = $this->createSlide($poll, Slide::TYPE_CHOICE, ['description' => '*Wichtig*'], ['Rot', 'Grün']);
|
||||||
|
$quiz = $this->createSlide($poll, Slide::TYPE_QUIZ, [], ['Richtig', 'Falsch']);
|
||||||
|
$hidden = $this->createSlide($poll, Slide::TYPE_OPEN);
|
||||||
|
$hidden->is_hidden = true;
|
||||||
|
$this->slidesTable()->saveOrFail($hidden);
|
||||||
|
$poll = $this->goLive($poll, $first);
|
||||||
|
(new VoteService())->submit($poll, $first, VoteService::participantHash(str_repeat('a', 32), $poll->id), [
|
||||||
|
'option_id' => $first->slide_options[0]->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->post("/admin/$token/clone");
|
||||||
|
|
||||||
|
$polls = $this->pollsTable()->find()->orderBy(['id' => 'ASC'])->all()->toList();
|
||||||
|
$this->assertCount(2, $polls);
|
||||||
|
$copy = $polls[1];
|
||||||
|
$this->assertNotSame($poll->join_code, $copy->join_code);
|
||||||
|
$this->assertSame($poll->email, $copy->email);
|
||||||
|
$this->assertStringEndsWith('(Kopie)', $copy->title);
|
||||||
|
$this->assertNull($copy->current_slide_id, 'copy is not started');
|
||||||
|
$this->assertSame($first->id, $this->pollsTable()->get($poll->id)->current_slide_id, 'original stays live');
|
||||||
|
|
||||||
|
$slides = $this->slidesTable()->listForPoll($copy->id);
|
||||||
|
$this->assertSame([1, 2, 3], array_map(fn($s) => $s->position, $slides));
|
||||||
|
$this->assertSame(
|
||||||
|
[$first->question, $quiz->question, $hidden->question],
|
||||||
|
array_map(fn($s) => $s->question, $slides),
|
||||||
|
);
|
||||||
|
$this->assertSame('*Wichtig*', $slides[0]->description);
|
||||||
|
$this->assertSame(['Rot', 'Grün'], array_map(fn($o) => $o->label, $slides[0]->slide_options));
|
||||||
|
$this->assertSame([true, false], array_map(fn($o) => $o->is_correct, $slides[1]->slide_options));
|
||||||
|
$this->assertTrue($slides[2]->is_hidden);
|
||||||
|
$this->assertSame(Slide::QUIZ_READY, $slides[1]->quizPhase());
|
||||||
|
|
||||||
|
$responses = TableRegistry::getTableLocator()->get('Responses');
|
||||||
|
$this->assertSame(0, $responses->find()->matching('Slides', fn($q) => $q->where(['Slides.poll_id' => $copy->id]))->count());
|
||||||
|
$this->assertSame(1, $responses->find()->where(['slide_id' => $first->id])->count(), 'original keeps its votes');
|
||||||
|
$this->assertCount(3, $this->slidesTable()->listForPoll($poll->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRedirectsToAdminOfTheCopyOnlyViaPost(): void
|
||||||
|
{
|
||||||
|
[, $token] = $this->createPoll();
|
||||||
|
|
||||||
|
$this->get("/admin/$token/clone");
|
||||||
|
$this->assertResponseCode(404);
|
||||||
|
|
||||||
|
$this->post("/admin/$token/clone");
|
||||||
|
$this->assertResponseCode(302);
|
||||||
|
$this->assertRedirectContains('/admin/');
|
||||||
|
$this->assertHeaderNotContains('Location', $token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDashboardOffersCloneAndMenu(): void
|
||||||
|
{
|
||||||
|
[, $token] = $this->createPoll();
|
||||||
|
$this->get("/admin/$token");
|
||||||
|
$this->assertResponseContains("/admin/$token/clone");
|
||||||
|
$this->assertResponseContains('data-drawer-toggle');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -93,6 +93,24 @@ class OrderSlideTest extends TestCase
|
|||||||
$this->assertStringContainsString('komplett richtig sortiert', $html);
|
$this->assertStringContainsString('komplett richtig sortiert', $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNextRevealsAnOpenOrderSlideBeforeMovingOn(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$order = $this->createSlide($poll, Slide::TYPE_ORDER, [], ['Eins', 'Zwei', 'Drei']);
|
||||||
|
$next = $this->createSlide($poll, Slide::TYPE_CONTENT);
|
||||||
|
$this->goLive($poll, $order);
|
||||||
|
|
||||||
|
// First forward closes the voting (solution), the slide stays live.
|
||||||
|
$this->post("/admin/$token/control", ['action' => 'next']);
|
||||||
|
$poll = $this->pollsTable()->get($poll->id);
|
||||||
|
$this->assertSame($order->id, $poll->current_slide_id);
|
||||||
|
$this->assertFalse($this->slidesTable()->get($order->id)->isVotingOpen());
|
||||||
|
|
||||||
|
// A second forward (and a repeated one) really moves on.
|
||||||
|
$this->post("/admin/$token/control", ['action' => 'next']);
|
||||||
|
$this->assertSame($next->id, $this->pollsTable()->get($poll->id)->current_slide_id);
|
||||||
|
}
|
||||||
|
|
||||||
public function testRankingHasNoSolutionAndShowsAverageOrder(): void
|
public function testRankingHasNoSolutionAndShowsAverageOrder(): void
|
||||||
{
|
{
|
||||||
[$poll, $token] = $this->createPoll();
|
[$poll, $token] = $this->createPoll();
|
||||||
|
|||||||
@@ -238,4 +238,29 @@ class ParticipateControllerTest extends TestCase
|
|||||||
$this->assertFlashMessage('Diese Antwort kann nicht mehr geändert werden.');
|
$this->assertFlashMessage('Diese Antwort kann nicht mehr geändert werden.');
|
||||||
$this->assertFalse(TableRegistry::getTableLocator()->get('Responses')->exists(['text_value' => 'Hack']));
|
$this->assertFalse(TableRegistry::getTableLocator()->get('Responses')->exists(['text_value' => 'Hack']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testScaleCommentOnlyWithoutRating(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true]]);
|
||||||
|
$this->goLive($poll, $slide);
|
||||||
|
$this->cookie('plenario_pid', self::PID);
|
||||||
|
$this->get('/p/' . $poll->join_code);
|
||||||
|
$this->assertResponseNotContains('auch nur einen Kommentar');
|
||||||
|
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true, 'comment_only' => true]]);
|
||||||
|
$this->goLive($poll, $slide);
|
||||||
|
$this->cookie('plenario_pid', self::PID);
|
||||||
|
$this->get('/p/' . $poll->join_code);
|
||||||
|
$this->assertResponseContains('auch nur einen Kommentar');
|
||||||
|
$this->assertResponseNotContains('required>');
|
||||||
|
|
||||||
|
$this->cookie('plenario_pid', self::PID);
|
||||||
|
$this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'comment' => 'Keine Meinung dazu']);
|
||||||
|
$this->assertFlashMessage('Danke für deine Antwort!');
|
||||||
|
|
||||||
|
$this->cookie('plenario_pid', self::PID);
|
||||||
|
$this->get('/p/' . $poll->join_code);
|
||||||
|
$this->assertResponseContains('Keine Meinung dazu');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Test\TestCase\Controller;
|
||||||
|
|
||||||
|
use App\Command\ImagesCleanupCommand;
|
||||||
|
use App\Service\AudioService;
|
||||||
|
use App\Service\PollStateService;
|
||||||
|
use App\Test\TestCase\ImageTestTrait;
|
||||||
|
use App\Test\TestCase\PlenarioTestTrait;
|
||||||
|
use Cake\Console\Arguments;
|
||||||
|
use Cake\Console\ConsoleIo;
|
||||||
|
use Cake\Console\TestSuite\StubConsoleOutput;
|
||||||
|
use Cake\TestSuite\IntegrationTestTrait;
|
||||||
|
use Cake\TestSuite\TestCase;
|
||||||
|
use Laminas\Diactoros\UploadedFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Countdown music of a presentation: upload, replace, remove, delivery, state and copying.
|
||||||
|
*/
|
||||||
|
class PollAudioTest extends TestCase
|
||||||
|
{
|
||||||
|
use ImageTestTrait;
|
||||||
|
use IntegrationTestTrait;
|
||||||
|
use PlenarioTestTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses'];
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->enableCsrfToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
$this->clearImages();
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a small file with the given leading bytes.
|
||||||
|
*
|
||||||
|
* @param string $head First bytes
|
||||||
|
* @return string Path
|
||||||
|
*/
|
||||||
|
protected function makeAudio(string $head = "ID3\x03\x00\x00\x00\x00\x00\x00"): string
|
||||||
|
{
|
||||||
|
$path = tempnam(sys_get_temp_dir(), 'plen');
|
||||||
|
file_put_contents($path, $head . str_repeat("\x00", 2000));
|
||||||
|
$this->imageFiles[] = $path;
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function upload(string $token, ?string $path, array $data = []): void
|
||||||
|
{
|
||||||
|
$this->_request['files'] = $path === null ? [] : [
|
||||||
|
'audio' => new UploadedFile($path, (int)filesize($path), UPLOAD_ERR_OK, 'musik.mp3', 'audio/mpeg'),
|
||||||
|
];
|
||||||
|
try {
|
||||||
|
$this->post("/admin/$token/audio", $data);
|
||||||
|
} finally {
|
||||||
|
$this->_request['files'] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUploadServeReplaceAndRemove(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
|
||||||
|
$this->upload($token, $this->makeAudio());
|
||||||
|
$this->assertRedirect(['_name' => 'admin', 'token' => $token, '#' => 'audio']);
|
||||||
|
$first = (string)$this->pollsTable()->get($poll->id)->audio;
|
||||||
|
$this->assertMatchesRegularExpression('/^[a-f0-9]{24}\.mp3$/', $first);
|
||||||
|
$this->assertSame([$first], $this->storedImages($poll->id));
|
||||||
|
|
||||||
|
$this->get("/admin/$token");
|
||||||
|
$this->assertResponseOk();
|
||||||
|
$this->assertResponseContains('<audio controls');
|
||||||
|
$this->assertResponseContains('Audiodatei entfernen');
|
||||||
|
|
||||||
|
// The presenter state carries the URL, the participant page never plays it but the file is served.
|
||||||
|
$fresh = $this->pollsTable()->get($poll->id);
|
||||||
|
$state = (new PollStateService())->forPresenter($fresh);
|
||||||
|
$this->assertStringContainsString("/p/{$poll->join_code}/audio/$first", (string)$state['poll']['audioUrl']);
|
||||||
|
|
||||||
|
$this->get("/p/{$poll->join_code}/audio/$first");
|
||||||
|
$this->assertResponseOk();
|
||||||
|
$this->assertContentType('audio/mpeg');
|
||||||
|
$this->assertHeader('X-Content-Type-Options', 'nosniff');
|
||||||
|
|
||||||
|
// Replacing: new random name, the old file is gone and no longer served.
|
||||||
|
$this->upload($token, $this->makeAudio("RIFF\x00\x00\x00\x00WAVE"));
|
||||||
|
$second = (string)$this->pollsTable()->get($poll->id)->audio;
|
||||||
|
$this->assertMatchesRegularExpression('/^[a-f0-9]{24}\.wav$/', $second);
|
||||||
|
$this->assertSame([$second], $this->storedImages($poll->id));
|
||||||
|
$this->get("/p/{$poll->join_code}/audio/$first");
|
||||||
|
$this->assertResponseCode(404);
|
||||||
|
|
||||||
|
// Removing is explicit and repeatable.
|
||||||
|
foreach ([1, 2] as $ignored) {
|
||||||
|
$this->post("/admin/$token/audio", ['remove' => '1']);
|
||||||
|
$this->assertRedirect();
|
||||||
|
$this->assertNull($this->pollsTable()->get($poll->id)->audio);
|
||||||
|
$this->assertSame([], $this->storedImages($poll->id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRejectsOtherFilesAndEmptyRequests(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
|
||||||
|
$this->upload($token, $this->makeAudio('<html><script>alert(1)</script>'));
|
||||||
|
$this->assertRedirect();
|
||||||
|
$this->assertNull($this->pollsTable()->get($poll->id)->audio);
|
||||||
|
$this->assertSame([], $this->storedImages($poll->id));
|
||||||
|
|
||||||
|
$this->upload($token, null);
|
||||||
|
$this->assertRedirect();
|
||||||
|
$this->assertNull($this->pollsTable()->get($poll->id)->audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFileOfAnotherPollIsNotServed(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
[$other] = $this->createPoll();
|
||||||
|
$this->upload($token, $this->makeAudio());
|
||||||
|
$file = (string)$this->pollsTable()->get($poll->id)->audio;
|
||||||
|
|
||||||
|
$this->get("/p/{$other->join_code}/audio/$file");
|
||||||
|
$this->assertResponseCode(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFormatDetection(): void
|
||||||
|
{
|
||||||
|
$this->assertSame('mp3', AudioService::detectFormat("\xFF\xFB\x90\x00" . str_repeat("\x00", 20)));
|
||||||
|
$this->assertSame('mp3', AudioService::detectFormat("ID3\x04" . str_repeat("\x00", 20)));
|
||||||
|
$this->assertSame('ogg', AudioService::detectFormat('OggS' . str_repeat("\x00", 20)));
|
||||||
|
$this->assertSame('m4a', AudioService::detectFormat("\x00\x00\x00\x20ftypM4A " . str_repeat("\x00", 20)));
|
||||||
|
$this->assertNull(AudioService::detectFormat('GIF89a' . str_repeat("\x00", 20)));
|
||||||
|
$this->assertNull(AudioService::detectFormat("\xFF\xE1\x00\x00" . str_repeat("\x00", 20)), 'reserved layer');
|
||||||
|
$this->assertNull(AudioService::detectFormat('short'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCloneCopiesTheFileAndCleanupKeepsIt(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$this->createSlide($poll, 'quiz');
|
||||||
|
$this->upload($token, $this->makeAudio());
|
||||||
|
$original = (string)$this->pollsTable()->get($poll->id)->audio;
|
||||||
|
|
||||||
|
$slides = $this->slidesTable()->listForPoll($poll->id);
|
||||||
|
[$copy] = $this->pollsTable()->clonePoll($this->pollsTable()->get($poll->id), $slides);
|
||||||
|
$copied = (string)$this->pollsTable()->get($copy->id)->audio;
|
||||||
|
$this->assertNotSame($original, $copied, 'own file per poll');
|
||||||
|
$this->assertSame([$copied], $this->storedImages($copy->id));
|
||||||
|
$this->assertSame([$original], $this->storedImages($poll->id));
|
||||||
|
|
||||||
|
// The sweep for leftovers must not take the music.
|
||||||
|
$command = new ImagesCleanupCommand();
|
||||||
|
$command->execute(new Arguments([], ['dry-run' => false], []), new ConsoleIo(new StubConsoleOutput(), new StubConsoleOutput()));
|
||||||
|
$this->assertSame([$original], $this->storedImages($poll->id));
|
||||||
|
$this->assertSame([$copied], $this->storedImages($copy->id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Test\TestCase\Controller;
|
||||||
|
|
||||||
|
use App\Model\Entity\Poll;
|
||||||
|
use App\Model\Entity\Slide;
|
||||||
|
use App\Service\PollStateService;
|
||||||
|
use App\Service\ResultsService;
|
||||||
|
use App\Test\TestCase\PlenarioTestTrait;
|
||||||
|
use Cake\TestSuite\IntegrationTestTrait;
|
||||||
|
use Cake\TestSuite\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Slides with a countdown that are not quizzes: they wait ("ready") showing only the question, the
|
||||||
|
* presenter's next step starts the countdown, the next one ends it, the third moves on.
|
||||||
|
*/
|
||||||
|
class TimedSlideTest extends TestCase
|
||||||
|
{
|
||||||
|
use IntegrationTestTrait;
|
||||||
|
use PlenarioTestTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses'];
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->enableCsrfToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
protected function control(string $token, string $action): array
|
||||||
|
{
|
||||||
|
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
|
||||||
|
$this->post("/admin/$token/control", ['action' => $action]);
|
||||||
|
$this->assertResponseOk();
|
||||||
|
|
||||||
|
return json_decode((string)$this->_response->getBody(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A fresh slide of the given type with a time limit (waits for the presenter).
|
||||||
|
*/
|
||||||
|
protected function createTimed(Poll $poll, string $type = Slide::TYPE_CHOICE, int $limit = 30): Slide
|
||||||
|
{
|
||||||
|
$slide = $this->createSlide($poll, $type, ['settings' => ['time_limit' => $limit] + Slide::DEFAULT_SETTINGS[$type]]);
|
||||||
|
$slide->startFresh();
|
||||||
|
|
||||||
|
return $this->slidesTable()->saveOrFail($slide);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSlideWithoutLimitStaysOpenAndHasNoPhases(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll);
|
||||||
|
$slide->startFresh();
|
||||||
|
|
||||||
|
$this->assertFalse($slide->usesPhases());
|
||||||
|
$this->assertNull($slide->phase());
|
||||||
|
$this->assertTrue($slide->isVotingOpen());
|
||||||
|
$this->assertTrue($slide->isFresh());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testTimedSlideWaitsUntilStartedAndShowsNoResults(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createTimed($poll);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$this->assertTrue($slide->usesPhases());
|
||||||
|
$this->assertSame(Slide::QUIZ_READY, $slide->phase());
|
||||||
|
$this->assertFalse($slide->isVotingOpen());
|
||||||
|
$this->assertTrue($slide->isFresh());
|
||||||
|
|
||||||
|
// Presenter: only the question, no answers, no counts.
|
||||||
|
$state = (new PollStateService())->forPresenter($poll);
|
||||||
|
$this->assertTrue($state['results']['ready']);
|
||||||
|
$this->assertSame(0, $state['results']['participants']);
|
||||||
|
$this->assertArrayNotHasKey('options', $state['results']);
|
||||||
|
$this->assertSame(Slide::QUIZ_READY, $state['results']['timer']['phase']);
|
||||||
|
|
||||||
|
// Participants know about the timer, can not vote yet.
|
||||||
|
$participant = (new PollStateService())->forParticipant($poll, str_repeat('a', 32));
|
||||||
|
$this->assertSame(Slide::QUIZ_READY, $participant['timer']['phase']);
|
||||||
|
$this->assertFalse($participant['isVotingOpen']);
|
||||||
|
$this->post('/p/' . $poll->join_code . '/vote', ['slide_id' => $slide->id, 'option_id' => $slide->slide_options[0]->id]);
|
||||||
|
$this->assertRedirect();
|
||||||
|
$this->assertFlashMessage('Die Abstimmung hat noch nicht begonnen.');
|
||||||
|
$this->get('/p/' . $poll->join_code);
|
||||||
|
$this->assertResponseContains('Die Abstimmung startet gleich');
|
||||||
|
$this->assertResponseNotContains('name="option_id"');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOrderSolutionDoesNotLeakBeforeTheCountdownStarts(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createTimed($poll, Slide::TYPE_ORDER);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$this->assertFalse($slide->isOrderRevealed());
|
||||||
|
$state = (new PollStateService())->forPresenter($poll);
|
||||||
|
$this->assertTrue($state['results']['ready']);
|
||||||
|
$this->assertArrayNotHasKey('items', $state['results']);
|
||||||
|
$participant = (new PollStateService())->forParticipant($poll, str_repeat('b', 32));
|
||||||
|
$this->assertFalse($participant['order']['revealed']);
|
||||||
|
$this->assertNull($participant['results']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNextStartsEndsAndMovesOn(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$slide = $this->createTimed($poll);
|
||||||
|
$after = $this->createSlide($poll, Slide::TYPE_CONTENT);
|
||||||
|
$this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
// 1st: start the countdown, the slide stays.
|
||||||
|
$state = $this->control($token, 'next');
|
||||||
|
$this->assertSame($slide->id, $state['slide']['id']);
|
||||||
|
$running = $this->slidesTable()->get($slide->id);
|
||||||
|
$this->assertSame(Slide::QUIZ_RUNNING, $running->phase());
|
||||||
|
$this->assertNotNull($running->voting_ends_at);
|
||||||
|
$this->assertSame(Slide::QUIZ_RUNNING, $state['results']['timer']['phase']);
|
||||||
|
$this->assertGreaterThan(0, $state['results']['timer']['remaining']);
|
||||||
|
$this->assertArrayNotHasKey('ready', $state['results']);
|
||||||
|
|
||||||
|
// 2nd: end it, results stay on stage.
|
||||||
|
$state = $this->control($token, 'next');
|
||||||
|
$this->assertSame($slide->id, $state['slide']['id']);
|
||||||
|
$this->assertSame(Slide::QUIZ_FINISHED, $this->slidesTable()->get($slide->id)->phase());
|
||||||
|
|
||||||
|
// 3rd: next slide. Back goes straight back without restarting.
|
||||||
|
$state = $this->control($token, 'next');
|
||||||
|
$this->assertSame($after->id, $state['slide']['id']);
|
||||||
|
$state = $this->control($token, 'prev');
|
||||||
|
$this->assertSame($slide->id, $state['slide']['id']);
|
||||||
|
$this->assertSame(Slide::QUIZ_FINISHED, $this->slidesTable()->get($slide->id)->phase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSlideWithoutLimitMovesOnWithTheFirstNext(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll);
|
||||||
|
$after = $this->createSlide($poll, Slide::TYPE_CONTENT);
|
||||||
|
$this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$state = $this->control($token, 'next');
|
||||||
|
$this->assertSame($after->id, $state['slide']['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRestartingTheCountdownWithTheToggle(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$slide = $this->createTimed($poll, Slide::TYPE_WORDCLOUD, 10);
|
||||||
|
$this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$this->control($token, 'toggle');
|
||||||
|
$this->assertSame(Slide::QUIZ_RUNNING, $this->slidesTable()->get($slide->id)->phase());
|
||||||
|
$this->control($token, 'toggle');
|
||||||
|
$this->assertSame(Slide::QUIZ_FINISHED, $this->slidesTable()->get($slide->id)->phase());
|
||||||
|
$this->control($token, 'toggle');
|
||||||
|
$reopened = $this->slidesTable()->get($slide->id);
|
||||||
|
$this->assertSame(Slide::QUIZ_RUNNING, $reopened->phase());
|
||||||
|
$this->assertLessThanOrEqual(10, $reopened->remainingSeconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRunningVotingResultsAreShownLive(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$slide = $this->createTimed($poll);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
$this->control($token, 'next');
|
||||||
|
|
||||||
|
$this->cookie('plenario_pid', str_repeat('c', 32));
|
||||||
|
$this->post('/p/' . $poll->join_code . '/vote', ['slide_id' => $slide->id, 'option_id' => $slide->slide_options[0]->id]);
|
||||||
|
$this->assertRedirect();
|
||||||
|
|
||||||
|
$state = (new PollStateService())->forPresenter($this->pollsTable()->get($poll->id));
|
||||||
|
$this->assertArrayNotHasKey('ready', $state['results']);
|
||||||
|
$this->assertSame(1, $state['results']['participants']);
|
||||||
|
$this->assertSame(1, $state['results']['options'][0]['count']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testExpiredCountdownClosesTheSlide(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createTimed($poll);
|
||||||
|
$slide->setVotingOpen(true);
|
||||||
|
$slide->voting_ends_at = $slide->voting_started_at->subSeconds(1);
|
||||||
|
$this->slidesTable()->saveOrFail($slide);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$state = (new PollStateService())->forPresenter($poll);
|
||||||
|
$this->assertSame(Slide::QUIZ_FINISHED, $state['results']['timer']['phase']);
|
||||||
|
$this->assertFalse($state['slide']['isVotingOpen']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFormSavesTheLimitAndStartsTheNewSlideReady(): void
|
||||||
|
{
|
||||||
|
[$poll, $token] = $this->createPoll();
|
||||||
|
$this->post("/admin/$token/slides/add?type=choice", [
|
||||||
|
'type' => 'choice', 'question' => 'Mit Zeit?', 'options_text' => "Ja\nNein", 'settings' => ['time_limit' => '45'],
|
||||||
|
]);
|
||||||
|
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
|
||||||
|
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->firstOrFail();
|
||||||
|
$this->assertSame(45, $slide->setting('time_limit'));
|
||||||
|
$this->assertSame(Slide::QUIZ_READY, $slide->phase());
|
||||||
|
|
||||||
|
// Removing the countdown from a slide nobody started opens it again.
|
||||||
|
$this->post("/admin/$token/slides/{$slide->id}/edit", [
|
||||||
|
'type' => 'choice', 'question' => 'Mit Zeit?', 'options_text' => "Ja\nNein", 'settings' => ['time_limit' => '0'],
|
||||||
|
]);
|
||||||
|
$slide = $this->slidesTable()->get($slide->id);
|
||||||
|
$this->assertNull($slide->phase());
|
||||||
|
$this->assertTrue($slide->isVotingOpen());
|
||||||
|
|
||||||
|
// An invalid limit falls back to "none".
|
||||||
|
$this->post("/admin/$token/slides/{$slide->id}/edit", [
|
||||||
|
'type' => 'choice', 'question' => 'Mit Zeit?', 'options_text' => "Ja\nNein", 'settings' => ['time_limit' => '7'],
|
||||||
|
]);
|
||||||
|
$this->assertSame(0, $this->slidesTable()->get($slide->id)->setting('time_limit'));
|
||||||
|
|
||||||
|
// Q&A has no countdown.
|
||||||
|
$this->assertFalse(Slide::supportsTimer(Slide::TYPE_QA));
|
||||||
|
$this->assertArrayNotHasKey('time_limit', Slide::DEFAULT_SETTINGS[Slide::TYPE_QA]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEvaluationIsNotGatedByTheCountdown(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createTimed($poll);
|
||||||
|
|
||||||
|
$results = (new ResultsService())->forSlide($slide);
|
||||||
|
$this->assertArrayNotHasKey('ready', $results);
|
||||||
|
$this->assertSame(Slide::QUIZ_READY, $results['timer']['phase']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -71,6 +71,93 @@ class VoteServiceTest extends TestCase
|
|||||||
(new VoteService())->submit($poll, $slide, 'p1', ['value' => '4']);
|
(new VoteService())->submit($poll, $slide, 'p1', ['value' => '4']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testScaleCommentOnlyCountsAsParticipantButNotInAverage(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['scale_min' => 1, 'scale_max' => 5, 'comments' => true, 'comment_only' => true]]);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
$service = new VoteService();
|
||||||
|
$service->submit($poll, $slide, 'p1', ['value' => '4']);
|
||||||
|
$service->submit($poll, $slide, 'p2', ['comment' => 'Kann ich nicht beurteilen']);
|
||||||
|
|
||||||
|
$results = (new ResultsService())->forSlide($slide);
|
||||||
|
$this->assertSame(2, $results['participants']);
|
||||||
|
$this->assertSame(1, $results['commentOnly']);
|
||||||
|
$this->assertSame(4.0, (float)$results['average']);
|
||||||
|
$this->assertSame(1, array_sum(array_column($results['buckets'], 'count')));
|
||||||
|
$this->assertSame(['Kann ich nicht beurteilen'], array_column($results['comments'], 'text'));
|
||||||
|
$this->assertSame([null], array_column((new ResultsService())->comments($slide), 'value'));
|
||||||
|
|
||||||
|
// Only once per person, like any answer.
|
||||||
|
$this->expectExceptionMessage('bereits abgestimmt');
|
||||||
|
$service->submit($poll, $slide, 'p2', ['value' => '2']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testScaleWithoutRatingNeedsCommentOnlySetting(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true]]);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$this->expectExceptionMessage('zwischen 1 und 5');
|
||||||
|
(new VoteService())->submit($poll, $slide, 'p1', ['comment' => 'Nur Kommentar']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testScaleNeedsRatingOrComment(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true, 'comment_only' => true]]);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$this->expectExceptionMessage('oder schreibe einen Kommentar');
|
||||||
|
(new VoteService())->submit($poll, $slide, 'p1', ['comment' => ' ']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCommentOnlyAnswerCanBeEditedButNotEmptied(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true, 'comment_only' => true]]);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
$service = new VoteService();
|
||||||
|
$service->submit($poll, $slide, 'p1', ['comment' => 'Erst']);
|
||||||
|
$service->editText($poll, $slide, 'p1', ['comment' => 'Dann']);
|
||||||
|
$this->assertSame('Dann', $service->ownText($slide, 'p1'));
|
||||||
|
|
||||||
|
$this->expectExceptionMessage('nicht leer sein');
|
||||||
|
$service->editText($poll, $slide, 'p1', ['comment' => '']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testChoiceCommentOnlyIsNotCountedAsVote(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_CHOICE, ['settings' => ['comments' => true, 'comment_only' => true]], ['A', 'B']);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
$service = new VoteService();
|
||||||
|
$service->submit($poll, $slide, 'p1', ['option_id' => $slide->slide_options[0]->id]);
|
||||||
|
$service->submit($poll, $slide, 'p2', ['comment' => 'Keine passt']);
|
||||||
|
|
||||||
|
$results = (new ResultsService())->forSlide($slide);
|
||||||
|
$this->assertSame(2, $results['participants']);
|
||||||
|
$this->assertSame(1, $results['votes']);
|
||||||
|
$this->assertSame(1, $results['commentOnly']);
|
||||||
|
$this->assertEquals([100, 0], array_column($results['options'], 'percent'));
|
||||||
|
$this->assertSame(['Keine passt'], array_column($results['comments'], 'text'));
|
||||||
|
|
||||||
|
$service->editText($poll, $slide, 'p2', ['comment' => 'Keine passt wirklich']);
|
||||||
|
$this->expectExceptionMessage('nicht leer sein');
|
||||||
|
$service->editText($poll, $slide, 'p2', ['comment' => '']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testChoiceWithoutSelectionNeedsCommentOnlySetting(): void
|
||||||
|
{
|
||||||
|
[$poll] = $this->createPoll();
|
||||||
|
$slide = $this->createSlide($poll, Slide::TYPE_CHOICE, ['settings' => ['comments' => true]], ['A', 'B']);
|
||||||
|
$poll = $this->goLive($poll, $slide);
|
||||||
|
|
||||||
|
$this->expectExceptionMessage('Bitte wähle eine Antwort aus.');
|
||||||
|
(new VoteService())->submit($poll, $slide, 'p1', ['comment' => 'Nur Kommentar']);
|
||||||
|
}
|
||||||
|
|
||||||
public function testMultipleChoiceResults(): void
|
public function testMultipleChoiceResults(): void
|
||||||
{
|
{
|
||||||
[$poll] = $this->createPoll();
|
[$poll] = $this->createPoll();
|
||||||
@@ -143,9 +230,9 @@ class VoteServiceTest extends TestCase
|
|||||||
public function testWordcloudSettingsSanitizing(): void
|
public function testWordcloudSettingsSanitizing(): void
|
||||||
{
|
{
|
||||||
$settings = SlidesTable::sanitizeSettings(Slide::TYPE_WORDCLOUD, ['max_words' => '3', 'allow_upvotes' => '0']);
|
$settings = SlidesTable::sanitizeSettings(Slide::TYPE_WORDCLOUD, ['max_words' => '3', 'allow_upvotes' => '0']);
|
||||||
$this->assertSame(['allow_upvotes' => false, 'allow_downvotes' => true], $settings);
|
$this->assertSame(['allow_upvotes' => false, 'allow_downvotes' => true, 'time_limit' => 0], $settings);
|
||||||
$settings = SlidesTable::sanitizeSettings(Slide::TYPE_WORDCLOUD, ['allow_downvotes' => '0']);
|
$settings = SlidesTable::sanitizeSettings(Slide::TYPE_WORDCLOUD, ['allow_downvotes' => '0']);
|
||||||
$this->assertSame(['allow_upvotes' => true, 'allow_downvotes' => false], $settings);
|
$this->assertSame(['allow_upvotes' => true, 'allow_downvotes' => false, 'time_limit' => 0], $settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWordcloudDownvotes(): void
|
public function testWordcloudDownvotes(): void
|
||||||
|
|||||||
@@ -0,0 +1,357 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
|
||||||
|
<hashTree>
|
||||||
|
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="PlenarIO Teilnehmer-Lasttest" enabled="true">
|
||||||
|
<boolProp name="TestPlan.functional_mode">false</boolProp>
|
||||||
|
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
|
||||||
|
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="Variablen" enabled="true">
|
||||||
|
<collectionProp name="Arguments.arguments">
|
||||||
|
<elementProp name="PROTOCOL" elementType="Argument">
|
||||||
|
<stringProp name="Argument.name">PROTOCOL</stringProp>
|
||||||
|
<stringProp name="Argument.value">${__P(protocol,http)}</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="HOST" elementType="Argument">
|
||||||
|
<stringProp name="Argument.name">HOST</stringProp>
|
||||||
|
<stringProp name="Argument.value">${__P(host,localhost)}</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="PORT" elementType="Argument">
|
||||||
|
<stringProp name="Argument.name">PORT</stringProp>
|
||||||
|
<stringProp name="Argument.value">${__P(port,8765)}</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="CODE" elementType="Argument">
|
||||||
|
<stringProp name="Argument.name">CODE</stringProp>
|
||||||
|
<stringProp name="Argument.value">${__P(code,ABCD)}</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="POLL_MS" elementType="Argument">
|
||||||
|
<stringProp name="Argument.name">POLL_MS</stringProp>
|
||||||
|
<stringProp name="Argument.value">${__P(pollms,2000)}</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
</collectionProp>
|
||||||
|
</elementProp>
|
||||||
|
</TestPlan>
|
||||||
|
<hashTree>
|
||||||
|
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Teilnehmende" enabled="true">
|
||||||
|
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
|
||||||
|
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
|
||||||
|
<intProp name="LoopController.loops">-1</intProp>
|
||||||
|
<boolProp name="LoopController.continue_forever">false</boolProp>
|
||||||
|
</elementProp>
|
||||||
|
<stringProp name="ThreadGroup.num_threads">${__P(users,100)}</stringProp>
|
||||||
|
<stringProp name="ThreadGroup.ramp_time">${__P(rampup,60)}</stringProp>
|
||||||
|
<boolProp name="ThreadGroup.scheduler">true</boolProp>
|
||||||
|
<stringProp name="ThreadGroup.duration">${__P(duration,300)}</stringProp>
|
||||||
|
<stringProp name="ThreadGroup.delay"></stringProp>
|
||||||
|
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
|
||||||
|
</ThreadGroup>
|
||||||
|
<hashTree>
|
||||||
|
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP-Standardwerte" enabled="true">
|
||||||
|
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
|
||||||
|
<collectionProp name="Arguments.arguments"/>
|
||||||
|
</elementProp>
|
||||||
|
<stringProp name="HTTPSampler.domain">${HOST}</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.port">${PORT}</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.protocol">${PROTOCOL}</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.contentEncoding">UTF-8</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
|
||||||
|
</ConfigTestElement>
|
||||||
|
<hashTree/>
|
||||||
|
<CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="Cookies (je Teilnehmer)" enabled="true">
|
||||||
|
<collectionProp name="CookieManager.cookies"/>
|
||||||
|
<boolProp name="CookieManager.clearEachIteration">false</boolProp>
|
||||||
|
<boolProp name="CookieManager.controlledByThreadGroup">false</boolProp>
|
||||||
|
</CookieManager>
|
||||||
|
<hashTree/>
|
||||||
|
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="Header" enabled="true">
|
||||||
|
<collectionProp name="HeaderManager.headers">
|
||||||
|
<elementProp name="" elementType="Header">
|
||||||
|
<stringProp name="Header.name">User-Agent</stringProp>
|
||||||
|
<stringProp name="Header.value">JMeter-Lasttest</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
</collectionProp>
|
||||||
|
</HeaderManager>
|
||||||
|
<hashTree/>
|
||||||
|
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="Startwerte je Teilnehmer" enabled="true">
|
||||||
|
<collectionProp name="Arguments.arguments">
|
||||||
|
<elementProp name="PAGE_VERSION" elementType="Argument">
|
||||||
|
<stringProp name="Argument.name">PAGE_VERSION</stringProp>
|
||||||
|
<stringProp name="Argument.value">NONE</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="VOTE_YES" elementType="Argument">
|
||||||
|
<stringProp name="Argument.name">VOTE_YES</stringProp>
|
||||||
|
<stringProp name="Argument.value">0</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
</collectionProp>
|
||||||
|
</Arguments>
|
||||||
|
<hashTree/>
|
||||||
|
|
||||||
|
<!-- 1) Wie der Browser: Zustand im Poll-Intervall abfragen (leicht gestreut, damit nicht alle im Gleichtakt feuern) -->
|
||||||
|
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="01 Status abfragen (Polling)" enabled="true">
|
||||||
|
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
|
||||||
|
<collectionProp name="Arguments.arguments"/>
|
||||||
|
</elementProp>
|
||||||
|
<stringProp name="HTTPSampler.path">/p/${CODE}/state</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.method">GET</stringProp>
|
||||||
|
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
|
||||||
|
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||||
|
</HTTPSamplerProxy>
|
||||||
|
<hashTree>
|
||||||
|
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="AJAX" enabled="true">
|
||||||
|
<collectionProp name="HeaderManager.headers">
|
||||||
|
<elementProp name="" elementType="Header">
|
||||||
|
<stringProp name="Header.name">Accept</stringProp>
|
||||||
|
<stringProp name="Header.value">application/json</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="" elementType="Header">
|
||||||
|
<stringProp name="Header.name">X-Requested-With</stringProp>
|
||||||
|
<stringProp name="Header.value">XMLHttpRequest</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
</collectionProp>
|
||||||
|
</HeaderManager>
|
||||||
|
<hashTree/>
|
||||||
|
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="HTTP 200" enabled="true">
|
||||||
|
<collectionProp name="Asserion.test_strings">
|
||||||
|
<stringProp name="49586">200</stringProp>
|
||||||
|
</collectionProp>
|
||||||
|
<stringProp name="Assertion.custom_message"></stringProp>
|
||||||
|
<stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
|
||||||
|
<boolProp name="Assertion.assume_success">false</boolProp>
|
||||||
|
<intProp name="Assertion.test_type">8</intProp>
|
||||||
|
</ResponseAssertion>
|
||||||
|
<hashTree/>
|
||||||
|
<JSONPostProcessor guiclass="JSONPostProcessorGui" testclass="JSONPostProcessor" testname="version" enabled="true">
|
||||||
|
<stringProp name="JSONPostProcessor.referenceNames">VERSION</stringProp>
|
||||||
|
<stringProp name="JSONPostProcessor.jsonPathExprs">$.version</stringProp>
|
||||||
|
<stringProp name="JSONPostProcessor.match_numbers">1</stringProp>
|
||||||
|
<stringProp name="JSONPostProcessor.defaultValues">NOT_FOUND</stringProp>
|
||||||
|
</JSONPostProcessor>
|
||||||
|
<hashTree/>
|
||||||
|
<UniformRandomTimer guiclass="UniformRandomTimerGui" testclass="UniformRandomTimer" testname="Poll-Intervall (± Streuung)" enabled="true">
|
||||||
|
<stringProp name="ConstantTimer.delay">${POLL_MS}</stringProp>
|
||||||
|
<stringProp name="RandomTimer.range">500</stringProp>
|
||||||
|
</UniformRandomTimer>
|
||||||
|
<hashTree/>
|
||||||
|
</hashTree>
|
||||||
|
|
||||||
|
<!-- 2) Hat sich die Version geändert (neue Folie, Abstimmung auf/zu, eigene Antwort), lädt der Browser die Seite neu -->
|
||||||
|
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="Version geändert: Seite neu laden" enabled="true">
|
||||||
|
<stringProp name="IfController.condition">${__jexl3("${VERSION}" != "${PAGE_VERSION}" && "${VERSION}" != "NOT_FOUND")}</stringProp>
|
||||||
|
<boolProp name="IfController.evaluateAll">false</boolProp>
|
||||||
|
<boolProp name="IfController.useExpression">true</boolProp>
|
||||||
|
</IfController>
|
||||||
|
<hashTree>
|
||||||
|
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="02 Teilnehmerseite laden" enabled="true">
|
||||||
|
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
|
||||||
|
<collectionProp name="Arguments.arguments"/>
|
||||||
|
</elementProp>
|
||||||
|
<stringProp name="HTTPSampler.path">/p/${CODE}</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.method">GET</stringProp>
|
||||||
|
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
|
||||||
|
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||||
|
</HTTPSamplerProxy>
|
||||||
|
<hashTree>
|
||||||
|
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="HTTP 200" enabled="true">
|
||||||
|
<collectionProp name="Asserion.test_strings">
|
||||||
|
<stringProp name="49586">200</stringProp>
|
||||||
|
</collectionProp>
|
||||||
|
<stringProp name="Assertion.custom_message"></stringProp>
|
||||||
|
<stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
|
||||||
|
<boolProp name="Assertion.assume_success">false</boolProp>
|
||||||
|
<intProp name="Assertion.test_type">8</intProp>
|
||||||
|
</ResponseAssertion>
|
||||||
|
<hashTree/>
|
||||||
|
<RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="CSRF-Token" enabled="true">
|
||||||
|
<stringProp name="RegexExtractor.useHeaders">false</stringProp>
|
||||||
|
<stringProp name="RegexExtractor.refname">CSRF</stringProp>
|
||||||
|
<stringProp name="RegexExtractor.regex">name="csrf-token" content="([^"]+)"</stringProp>
|
||||||
|
<stringProp name="RegexExtractor.template">$1$</stringProp>
|
||||||
|
<stringProp name="RegexExtractor.default">NOT_FOUND</stringProp>
|
||||||
|
<stringProp name="RegexExtractor.match_number">1</stringProp>
|
||||||
|
</RegexExtractor>
|
||||||
|
<hashTree/>
|
||||||
|
<!-- Liest die Seite wie ein Mensch: erkennt das Formular der aktuellen Folie und baut eine passende Antwort -->
|
||||||
|
<JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="Formular erkennen und Antwort bauen" enabled="true">
|
||||||
|
<stringProp name="scriptLanguage">groovy</stringProp>
|
||||||
|
<stringProp name="parameters"></stringProp>
|
||||||
|
<stringProp name="filename"></stringProp>
|
||||||
|
<stringProp name="cacheKey">true</stringProp>
|
||||||
|
<stringProp name="script"><![CDATA[
|
||||||
|
def html = prev.getResponseDataAsString()
|
||||||
|
def rnd = new Random()
|
||||||
|
def first = { String re -> def m = (html =~ re); m.find() ? m.group(1) : null }
|
||||||
|
|
||||||
|
vars.put('PAGE_VERSION', first(/data-version="([^"]*)"/) ?: 'NOT_FOUND')
|
||||||
|
|
||||||
|
def words = ['Zukunft', 'Teamgeist', 'Digital', 'Nachhaltig', 'Agil', 'Vertrauen', 'Mut', 'Tempo', 'Kommunikation',
|
||||||
|
'Fortschritt', 'Respekt', 'Kreativ', 'Klarheit', 'Wandel', 'Zusammenhalt', 'Qualität']
|
||||||
|
def texts = ['Mehr Praxisbeispiele bitte', 'Gerne kürzere Pausen', 'Alles gut so', 'Mehr Zeit für Fragen',
|
||||||
|
'Das Thema ist spannend', 'Bitte langsamer sprechen']
|
||||||
|
|
||||||
|
def slideId = first(/name="slide_id"[^>]*value="(\d+)"/)
|
||||||
|
def parts = null
|
||||||
|
def kind = ''
|
||||||
|
|
||||||
|
// Wer schon geantwortet hat, sieht kein Formular mehr (nur "Deine Antwort ist angekommen").
|
||||||
|
if (slideId != null && !html.contains('class="done"')) {
|
||||||
|
def order = []
|
||||||
|
def m = (html =~ /name="order\[\]" value="(\d+)"/)
|
||||||
|
while (m.find()) { order << m.group(1) }
|
||||||
|
def options = []
|
||||||
|
m = (html =~ /name="(option_ids?(?:\[\])?)" value="(\d+)"/)
|
||||||
|
while (m.find()) { options << [m.group(1), m.group(2)] }
|
||||||
|
def values = []
|
||||||
|
m = (html =~ /name="value" value="(\d+)"/)
|
||||||
|
while (m.find()) { values << m.group(1) }
|
||||||
|
|
||||||
|
if (order) {
|
||||||
|
Collections.shuffle(order, rnd)
|
||||||
|
parts = order.collect { 'order%5B%5D=' + it }
|
||||||
|
kind = 'order'
|
||||||
|
} else if (options) {
|
||||||
|
def pick = options[rnd.nextInt(options.size())]
|
||||||
|
parts = [(pick[0].startsWith('option_ids') ? 'option_ids%5B%5D=' : 'option_id=') + pick[1]]
|
||||||
|
kind = 'choice'
|
||||||
|
} else if (values) {
|
||||||
|
parts = ['value=' + values[rnd.nextInt(values.size())]]
|
||||||
|
kind = 'scale'
|
||||||
|
} else if (html.contains('name="word"')) {
|
||||||
|
parts = ['word=' + words[rnd.nextInt(words.size())]]
|
||||||
|
kind = 'wordcloud'
|
||||||
|
} else if (html.contains('name="question"')) {
|
||||||
|
parts = ['question=' + java.net.URLEncoder.encode('Frage ' + rnd.nextInt(100000) + '?', 'UTF-8')]
|
||||||
|
kind = 'qa'
|
||||||
|
} else if (html.contains('name="text"')) {
|
||||||
|
parts = ['text=' + java.net.URLEncoder.encode(texts[rnd.nextInt(texts.size())], 'UTF-8')]
|
||||||
|
kind = 'open'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parts != null) {
|
||||||
|
vars.put('VOTE_BODY', (['slide_id=' + slideId] + parts).join('&'))
|
||||||
|
vars.put('VOTE_KIND', kind)
|
||||||
|
vars.put('VOTE_YES', '1')
|
||||||
|
} else {
|
||||||
|
vars.put('VOTE_YES', '0')
|
||||||
|
}
|
||||||
|
]]></stringProp>
|
||||||
|
</JSR223PostProcessor>
|
||||||
|
<hashTree/>
|
||||||
|
</hashTree>
|
||||||
|
|
||||||
|
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Lesen / Überlegen (2-8 s)" enabled="true">
|
||||||
|
<intProp name="ActionProcessor.action">1</intProp>
|
||||||
|
<intProp name="ActionProcessor.target">0</intProp>
|
||||||
|
<stringProp name="ActionProcessor.duration">0</stringProp>
|
||||||
|
</TestAction>
|
||||||
|
<hashTree>
|
||||||
|
<UniformRandomTimer guiclass="UniformRandomTimerGui" testclass="UniformRandomTimer" testname="Denkzeit" enabled="true">
|
||||||
|
<stringProp name="ConstantTimer.delay">2000</stringProp>
|
||||||
|
<stringProp name="RandomTimer.range">6000</stringProp>
|
||||||
|
</UniformRandomTimer>
|
||||||
|
<hashTree/>
|
||||||
|
</hashTree>
|
||||||
|
|
||||||
|
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="Formular vorhanden: abstimmen" enabled="true">
|
||||||
|
<stringProp name="IfController.condition">${__jexl3("${VOTE_YES}" == "1")}</stringProp>
|
||||||
|
<boolProp name="IfController.evaluateAll">false</boolProp>
|
||||||
|
<boolProp name="IfController.useExpression">true</boolProp>
|
||||||
|
</IfController>
|
||||||
|
<hashTree>
|
||||||
|
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="03 Abstimmen (${VOTE_KIND})" enabled="true">
|
||||||
|
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
|
||||||
|
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
|
||||||
|
<collectionProp name="Arguments.arguments">
|
||||||
|
<elementProp name="" elementType="HTTPArgument">
|
||||||
|
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||||
|
<stringProp name="Argument.value">${VOTE_BODY}</stringProp>
|
||||||
|
<stringProp name="Argument.metadata">=</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
</collectionProp>
|
||||||
|
</elementProp>
|
||||||
|
<stringProp name="HTTPSampler.path">/p/${CODE}/vote</stringProp>
|
||||||
|
<stringProp name="HTTPSampler.method">POST</stringProp>
|
||||||
|
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
|
||||||
|
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||||
|
</HTTPSamplerProxy>
|
||||||
|
<hashTree>
|
||||||
|
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="Formular + AJAX + CSRF" enabled="true">
|
||||||
|
<collectionProp name="HeaderManager.headers">
|
||||||
|
<elementProp name="" elementType="Header">
|
||||||
|
<stringProp name="Header.name">Content-Type</stringProp>
|
||||||
|
<stringProp name="Header.value">application/x-www-form-urlencoded; charset=UTF-8</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="" elementType="Header">
|
||||||
|
<stringProp name="Header.name">X-CSRF-Token</stringProp>
|
||||||
|
<stringProp name="Header.value">${CSRF}</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
<elementProp name="" elementType="Header">
|
||||||
|
<stringProp name="Header.name">X-Requested-With</stringProp>
|
||||||
|
<stringProp name="Header.value">XMLHttpRequest</stringProp>
|
||||||
|
</elementProp>
|
||||||
|
</collectionProp>
|
||||||
|
</HeaderManager>
|
||||||
|
<hashTree/>
|
||||||
|
<!-- "Frage nicht mehr aktiv" (Folie wurde zwischen Laden und Absenden gewechselt) ist im Live-Betrieb normal und kein Fehler -->
|
||||||
|
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Stimme angenommen" enabled="true">
|
||||||
|
<collectionProp name="Asserion.test_strings">
|
||||||
|
<stringProp name="1">"ok":true</stringProp>
|
||||||
|
<stringProp name="2">nicht mehr aktiv</stringProp>
|
||||||
|
</collectionProp>
|
||||||
|
<stringProp name="Assertion.custom_message"></stringProp>
|
||||||
|
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
|
||||||
|
<boolProp name="Assertion.assume_success">false</boolProp>
|
||||||
|
<intProp name="Assertion.test_type">34</intProp>
|
||||||
|
</ResponseAssertion>
|
||||||
|
<hashTree/>
|
||||||
|
</hashTree>
|
||||||
|
</hashTree>
|
||||||
|
</hashTree>
|
||||||
|
</hashTree>
|
||||||
|
|
||||||
|
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Übersicht (Summary Report)" enabled="true">
|
||||||
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
||||||
|
<objProp>
|
||||||
|
<name>saveConfig</name>
|
||||||
|
<value class="SampleSaveConfiguration">
|
||||||
|
<time>true</time>
|
||||||
|
<latency>true</latency>
|
||||||
|
<timestamp>true</timestamp>
|
||||||
|
<success>true</success>
|
||||||
|
<label>true</label>
|
||||||
|
<code>true</code>
|
||||||
|
<message>true</message>
|
||||||
|
<threadName>true</threadName>
|
||||||
|
<dataType>true</dataType>
|
||||||
|
<encoding>false</encoding>
|
||||||
|
<assertions>true</assertions>
|
||||||
|
<subresults>true</subresults>
|
||||||
|
<responseData>false</responseData>
|
||||||
|
<samplerData>false</samplerData>
|
||||||
|
<xml>false</xml>
|
||||||
|
<fieldNames>true</fieldNames>
|
||||||
|
<responseHeaders>false</responseHeaders>
|
||||||
|
<requestHeaders>false</requestHeaders>
|
||||||
|
<responseDataOnError>false</responseDataOnError>
|
||||||
|
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
|
||||||
|
<assertionsResultsToSave>0</assertionsResultsToSave>
|
||||||
|
<bytes>true</bytes>
|
||||||
|
<sentBytes>true</sentBytes>
|
||||||
|
<url>true</url>
|
||||||
|
<threadCounts>true</threadCounts>
|
||||||
|
<idleTime>true</idleTime>
|
||||||
|
<connectTime>true</connectTime>
|
||||||
|
</value>
|
||||||
|
</objProp>
|
||||||
|
<stringProp name="filename"></stringProp>
|
||||||
|
</ResultCollector>
|
||||||
|
<hashTree/>
|
||||||
|
</hashTree>
|
||||||
|
</hashTree>
|
||||||
|
</jmeterTestPlan>
|
||||||
@@ -140,6 +140,32 @@ h3 { font-size: 1.05rem; margin-top: 1.6em; }
|
|||||||
.grid--sidebar { grid-template-columns: 1fr; }
|
.grid--sidebar { grid-template-columns: 1fr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sidebar as menu drawer (JS adds .sidebar--drawer; without JS the sidebar stays below the slides). */
|
||||||
|
.menu-toggle { display: none; }
|
||||||
|
.sidebar__bar { display: none; }
|
||||||
|
.drawer-backdrop { display: none; }
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.menu-toggle:not([hidden]) { display: inline-flex; }
|
||||||
|
.sidebar--drawer {
|
||||||
|
position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
|
||||||
|
width: min(92vw, 400px); padding: 0 16px 24px; overflow-y: auto; overscroll-behavior: contain;
|
||||||
|
background: var(--bg); box-shadow: -8px 0 32px rgba(20, 22, 50, .25);
|
||||||
|
visibility: hidden; transform: translateX(100%);
|
||||||
|
transition: transform .2s ease, visibility 0s linear .2s;
|
||||||
|
}
|
||||||
|
.drawer-open .sidebar--drawer { visibility: visible; transform: none; transition: transform .2s ease; }
|
||||||
|
.sidebar--drawer .sidebar__bar {
|
||||||
|
position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
|
||||||
|
margin: 0 -16px 16px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
.sidebar--drawer .sidebar__close { position: static; }
|
||||||
|
.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(20, 22, 50, .45); }
|
||||||
|
.drawer-open { overflow: hidden; }
|
||||||
|
}
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.sidebar--drawer { transition: none; }
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------- components */
|
/* ---------------------------------------------------------------- components */
|
||||||
.card {
|
.card {
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
@@ -347,6 +373,11 @@ textarea { resize: vertical; }
|
|||||||
|
|
||||||
.join-code { font-size: 2rem; font-weight: 800; letter-spacing: .12em; text-align: center; margin: 0 0 12px; }
|
.join-code { font-size: 2rem; font-weight: 800; letter-spacing: .12em; text-align: center; margin: 0 0 12px; }
|
||||||
.qr { display: block; margin: 0 auto 16px; background: #fff; border-radius: 8px; padding: 6px; }
|
.qr { display: block; margin: 0 auto 16px; background: #fff; border-radius: 8px; padding: 6px; }
|
||||||
|
.qr-wrap { position: relative; width: fit-content; margin: 0 auto; }
|
||||||
|
.qr-wrap .qr { margin-bottom: 16px; }
|
||||||
|
.qr-wrap__download { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); white-space: nowrap; opacity: 0; transition: opacity .15s; }
|
||||||
|
.qr-wrap:hover .qr-wrap__download, .qr-wrap:focus-within .qr-wrap__download { opacity: 1; }
|
||||||
|
@media (hover: none) { .qr-wrap__download { opacity: 1; } }
|
||||||
.copy-field { display: flex; gap: 8px; }
|
.copy-field { display: flex; gap: 8px; }
|
||||||
.copy-field input { font-size: .85rem; }
|
.copy-field input { font-size: .85rem; }
|
||||||
|
|
||||||
@@ -498,7 +529,7 @@ textarea { resize: vertical; }
|
|||||||
.donut__label { font-weight: 600; overflow-wrap: anywhere; }
|
.donut__label { font-weight: 600; overflow-wrap: anywhere; }
|
||||||
.donut__value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
.donut__value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||||
|
|
||||||
.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .2em .6em; line-height: 1.15; padding: 8px; }
|
.cloud { font-size: calc(1rem * var(--cloud-scale, 1)); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .2em .6em; line-height: 1.15; padding: 8px; }
|
||||||
.cloud__word { font-weight: 800; color: var(--c0); transition: font-size .6s ease; }
|
.cloud__word { font-weight: 800; color: var(--c0); transition: font-size .6s ease; }
|
||||||
.cloud__word--c1 { color: var(--c1); }
|
.cloud__word--c1 { color: var(--c1); }
|
||||||
.cloud__word--c2 { color: var(--c2); }
|
.cloud__word--c2 { color: var(--c2); }
|
||||||
@@ -511,13 +542,23 @@ textarea { resize: vertical; }
|
|||||||
.cloud__count--down { color: var(--danger); }
|
.cloud__count--down { color: var(--danger); }
|
||||||
.stage .cloud__count { font-size: max(.9rem, .4em); }
|
.stage .cloud__count { font-size: max(.9rem, .4em); }
|
||||||
/* Participant cloud: word (+) and − are separate buttons */
|
/* Participant cloud: word (+) and − are separate buttons */
|
||||||
.cloud--interactive .cloud__word { gap: .1em; }
|
/* Participant list (replaces the cloud on phones): fixed text size, weight bar, big tap targets */
|
||||||
.cloud__vote { font: inherit; font-weight: inherit; color: inherit; line-height: 1.15; background: none; border: 2px solid transparent; border-radius: 10px; padding: .05em .3em; cursor: pointer; display: inline-flex; align-items: baseline; gap: .25em; }
|
.wc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
|
||||||
.cloud__vote:hover:not(:disabled), .cloud__vote:focus-visible { border-color: currentColor; }
|
.wc-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px 14px; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
|
||||||
.cloud__vote:disabled { cursor: default; }
|
.wc-item__text { flex: 1; min-width: 0; font-weight: 700; word-break: break-word; }
|
||||||
.cloud__vote--down { padding: .05em .25em; }
|
.wc-item__actions { flex: none; display: inline-flex; gap: 6px; }
|
||||||
.cloud__word.is-mine .cloud__vote--up, .cloud__word.is-down .cloud__vote--down { background: var(--surface-2); }
|
.wc-item__bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--c0); border-radius: 0 4px 4px 0; transition: width .6s ease; }
|
||||||
.cloud__word.is-down .cloud__vote--up { opacity: .55; }
|
.wc-item.is-mine { box-shadow: inset 0 0 0 2px var(--ok); }
|
||||||
|
.wc-item.is-down { opacity: .7; }
|
||||||
|
.wc-vote { min-width: 56px; min-height: 40px; padding: 0 10px; border-radius: 999px; border: 2px solid currentColor; background: var(--surface); font: inherit; font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; }
|
||||||
|
.wc-vote--up { color: var(--ok); }
|
||||||
|
.wc-vote--down { color: var(--danger); }
|
||||||
|
.wc-vote.is-active { background: currentColor; }
|
||||||
|
.wc-vote.is-active span { color: var(--surface); }
|
||||||
|
.wc-vote:disabled { cursor: default; }
|
||||||
|
.wc-vote:disabled:not(.is-active) { opacity: .5; }
|
||||||
|
.wc-vote:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
|
||||||
|
.wc-count--down { color: var(--danger); font-weight: 700; }
|
||||||
|
|
||||||
/* quiz results */
|
/* quiz results */
|
||||||
.quiz-status { color: var(--muted); font-style: italic; margin: 0 0 1em; }
|
.quiz-status { color: var(--muted); font-style: italic; margin: 0 0 1em; }
|
||||||
@@ -760,9 +801,11 @@ body.present {
|
|||||||
.stage .donut__chart { width: clamp(150px, 28vh, 340px); }
|
.stage .donut__chart { width: clamp(150px, 28vh, 340px); }
|
||||||
.stage .donut__count { font-size: clamp(.85rem, 1.3vw, 1.2rem); }
|
.stage .donut__count { font-size: clamp(.85rem, 1.3vw, 1.2rem); }
|
||||||
.stage .donut__legend { font-size: clamp(.9rem, 1.4vw, 1.3rem); }
|
.stage .donut__legend { font-size: clamp(.9rem, 1.4vw, 1.3rem); }
|
||||||
.stage .cloud { font-size: clamp(1.4rem, 2.6vw, 2.6rem); }
|
.stage .cloud { font-size: calc(clamp(1.2rem, 2.2vw, 2.2rem) * var(--cloud-scale, 1)); gap: .15em .5em; }
|
||||||
.stage .answers { columns: 340px; }
|
.stage .answers { columns: 340px; }
|
||||||
.stage .quiz-timer { font-size: clamp(3rem, 7vw, 6rem); }
|
.stage .quiz-timer { font-size: clamp(3rem, 7vw, 6rem); }
|
||||||
|
.stage__timer:empty { display: none; }
|
||||||
|
.stage__timer .quiz-timer { margin: .2em 0 0; }
|
||||||
.stage .quiz-tile { font-size: clamp(1.2rem, 2.2vw, 2rem); }
|
.stage .quiz-tile { font-size: clamp(1.2rem, 2.2vw, 2rem); }
|
||||||
.stage .quiz-summary strong, .stage .bar--correct .bar__label { color: var(--stage-ok); }
|
.stage .quiz-summary strong, .stage .bar--correct .bar__label { color: var(--stage-ok); }
|
||||||
.stage .bar--correct .bar__fill { background: var(--stage-ok); }
|
.stage .bar--correct .bar__fill { background: var(--stage-ok); }
|
||||||
@@ -838,6 +881,9 @@ body:has(dialog[open]) { overflow: hidden; }
|
|||||||
/* slide images: participant page and slide form */
|
/* slide images: participant page and slide form */
|
||||||
.slide-image { margin: 1em 0; }
|
.slide-image { margin: 1em 0; }
|
||||||
.slide-image img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 8px; }
|
.slide-image img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 8px; }
|
||||||
|
/* Sections inside one card (e.g. settings): divider across the card, own heading. */
|
||||||
|
.card-section { margin: 24px -24px 0; padding: 0 24px; border-top: 1px solid var(--border); }
|
||||||
|
.card-section > h3 { margin-top: 24px; }
|
||||||
/* Full width dividers: reach through the 24px padding of .card. */
|
/* Full width dividers: reach through the 24px padding of .card. */
|
||||||
.image-section { margin: 24px -24px; padding: 16px 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
|
.image-section { margin: 24px -24px; padding: 16px 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
|
||||||
.image-fields, .image-layout { border: 0; padding: 0; margin: 0; min-width: 0; }
|
.image-fields, .image-layout { border: 0; padding: 0; margin: 0; min-width: 0; }
|
||||||
@@ -861,6 +907,11 @@ body:has(dialog[open]) { overflow: hidden; }
|
|||||||
.image-drop__title { font-weight: 600; color: var(--text); }
|
.image-drop__title { font-weight: 600; color: var(--text); }
|
||||||
.image-drop__hint { font-size: .875rem; }
|
.image-drop__hint { font-size: .875rem; }
|
||||||
|
|
||||||
|
/* compact variant (countdown music in the menu) */
|
||||||
|
.image-drop--compact { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 12px; padding: 10px 12px; }
|
||||||
|
.audio-row { padding: 8px 10px; }
|
||||||
|
.audio-row__player { flex: 1 1 200px; min-width: 0; max-width: 100%; height: 36px; }
|
||||||
|
|
||||||
/* current or chosen image: thumbnail, info, buttons */
|
/* current or chosen image: thumbnail, info, buttons */
|
||||||
.image-fields__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
|
.image-fields__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
|
||||||
.image-fields__row[hidden] { display: none; }
|
.image-fields__row[hidden] { display: none; }
|
||||||
|
|||||||
+359
-134
@@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Modules (auto-initialised by data attributes):
|
* Modules (auto-initialised by data attributes):
|
||||||
* - [data-copy] copy the value of the sibling [data-copy-source]
|
* - [data-copy] copy the value of the sibling [data-copy-source]
|
||||||
|
* - [data-qr-download] save the sibling QR <img> (SVG) as PNG via canvas
|
||||||
* - [data-share] native share sheet (Web Share API), fallback: copy like [data-copy]
|
* - [data-share] native share sheet (Web Share API), fallback: copy like [data-copy]
|
||||||
* - [data-youtube-form] slide form: "Link prüfen" for YouTube slides (status + preview)
|
* - [data-youtube-form] slide form: "Link prüfen" for YouTube slides (status + preview)
|
||||||
* - [data-presenter] presenter screen, polls /admin/{token}/state;
|
* - [data-presenter] presenter screen, polls /admin/{token}/state;
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
* - [data-participant] participant page, polls /p/{code}/state
|
* - [data-participant] participant page, polls /p/{code}/state
|
||||||
* - [data-countdown] quiz timer (data-remaining = seconds), fires `plenario:timeup` on document
|
* - [data-countdown] quiz timer (data-remaining = seconds), fires `plenario:timeup` on document
|
||||||
* - [data-quiz-options] slide form: "add answer" button for quiz slides
|
* - [data-quiz-options] slide form: "add answer" button for quiz slides
|
||||||
|
* - [data-audio-form] admin menu: countdown music dropzone, sends the file as soon as it is chosen or dropped
|
||||||
* - [data-sortable] admin slide list: drag & drop / arrow keys via [data-drag-handle], POSTs ids[] to the URL
|
* - [data-sortable] admin slide list: drag & drop / arrow keys via [data-drag-handle], POSTs ids[] to the URL
|
||||||
* - [data-order-options] slide form of ordering slides: sortable rows (correct order), "add entry"
|
* - [data-order-options] slide form of ordering slides: sortable rows (correct order), "add entry"
|
||||||
* - [data-order-form] participant answer of ordering slides: sortable items posting order[]
|
* - [data-order-form] participant answer of ordering slides: sortable items posting order[]
|
||||||
@@ -203,6 +205,70 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ stage audio
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Music of the presentation (presenter view only): plays in a loop while a quiz runs, so it also covers a
|
||||||
|
* countdown that is longer than the file, and stops when the quiz ends or the slide changes.
|
||||||
|
* Browsers may refuse to start audio without a previous click or key press; the presenter has
|
||||||
|
* always pressed something to start the quiz, and a refused start is retried on the next one.
|
||||||
|
*/
|
||||||
|
var StageAudio = {
|
||||||
|
element: null,
|
||||||
|
url: null,
|
||||||
|
wanted: false,
|
||||||
|
|
||||||
|
/** @param {string|null} url audio URL of the poll, only passed while a quiz is running */
|
||||||
|
sync: function (url) {
|
||||||
|
StageAudio.wanted = !!url;
|
||||||
|
if (!url) {
|
||||||
|
StageAudio.stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!StageAudio.element) {
|
||||||
|
StageAudio.element = new Audio();
|
||||||
|
StageAudio.element.loop = true;
|
||||||
|
StageAudio.element.preload = 'auto';
|
||||||
|
}
|
||||||
|
var audio = StageAudio.element;
|
||||||
|
if (StageAudio.url !== url) {
|
||||||
|
StageAudio.url = url;
|
||||||
|
audio.src = url;
|
||||||
|
}
|
||||||
|
if (audio.paused) {
|
||||||
|
StageAudio.play();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
play: function () {
|
||||||
|
var attempt = StageAudio.element && StageAudio.element.play();
|
||||||
|
if (attempt && attempt.catch) {
|
||||||
|
attempt.catch(function () {
|
||||||
|
// Blocked (no user activation yet): try again on the next click or key press.
|
||||||
|
var retry = function () {
|
||||||
|
document.removeEventListener('click', retry, true);
|
||||||
|
document.removeEventListener('keydown', retry, true);
|
||||||
|
if (StageAudio.wanted && StageAudio.element && StageAudio.element.paused) {
|
||||||
|
StageAudio.play();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('click', retry, true);
|
||||||
|
document.addEventListener('keydown', retry, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
stop: function () {
|
||||||
|
StageAudio.wanted = false;
|
||||||
|
if (StageAudio.element && !StageAudio.element.paused) {
|
||||||
|
StageAudio.element.pause();
|
||||||
|
}
|
||||||
|
if (StageAudio.element && StageAudio.element.currentTime) {
|
||||||
|
StageAudio.element.currentTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// ------------------------------------------------------------------ word matching
|
// ------------------------------------------------------------------ word matching
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -550,7 +616,11 @@
|
|||||||
'Kommentar ' + (Comments.index + 1) + ' von ' + Comments.items.length;
|
'Kommentar ' + (Comments.index + 1) + ' von ' + Comments.items.length;
|
||||||
text.textContent = item.text;
|
text.textContent = item.text;
|
||||||
var value = node.querySelector('[data-comment-value]');
|
var value = node.querySelector('[data-comment-value]');
|
||||||
value.textContent = item.value === null || item.value === undefined ? '' : 'Bewertung: ' + Comments.format(item.value);
|
// With ratings shown, comments sent without one say so (keeps the box at the same height).
|
||||||
|
var rated = Comments.items.some(function (other) { return other.value !== null && other.value !== undefined; });
|
||||||
|
value.textContent = item.value === null || item.value === undefined
|
||||||
|
? (rated ? 'Ohne Bewertung' : '')
|
||||||
|
: 'Bewertung: ' + Comments.format(item.value);
|
||||||
value.hidden = value.textContent === '';
|
value.hidden = value.textContent === '';
|
||||||
// Only announce changes the viewer triggered, not every automatic rotation.
|
// Only announce changes the viewer triggered, not every automatic rotation.
|
||||||
node.setAttribute('aria-live', Comments.paused ? 'polite' : 'off');
|
node.setAttribute('aria-live', Comments.paused ? 'polite' : 'off');
|
||||||
@@ -586,7 +656,8 @@
|
|||||||
var active = document.activeElement;
|
var active = document.activeElement;
|
||||||
var focusKey = active && container.contains(active) ? active.getAttribute('data-comment-action') : null;
|
var focusKey = active && container.contains(active) ? active.getAttribute('data-comment-action') : null;
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
if (!results) {
|
if (!results || results.ready) {
|
||||||
|
// A slide with a countdown that has not started shows only its question.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var renderer = Results[results.type];
|
var renderer = Results[results.type];
|
||||||
@@ -619,10 +690,13 @@
|
|||||||
el('div', { class: 'bar__value', text: formatNumber(option.percent) + ' % (' + option.count + ')' })
|
el('div', { class: 'bar__value', text: formatNumber(option.percent) + ' % (' + option.count + ')' })
|
||||||
]);
|
]);
|
||||||
}));
|
}));
|
||||||
|
var commentOnly = results.commentOnly
|
||||||
|
? el('p', { class: 'choice-results__note', text: results.commentOnly + '× nur Kommentar' })
|
||||||
|
: null;
|
||||||
if (!results.comments || !results.comments.length) {
|
if (!results.comments || !results.comments.length) {
|
||||||
return bars;
|
return commentOnly ? el('div', { class: 'choice-results' }, [bars, commentOnly]) : bars;
|
||||||
}
|
}
|
||||||
return el('div', { class: 'choice-results' }, [bars, Comments.render(results.comments, String)]);
|
return el('div', { class: 'choice-results' }, [bars, commentOnly, Comments.render(results.comments, String)]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -727,7 +801,11 @@
|
|||||||
el('span', { class: 'average__of', text: ofText })
|
el('span', { class: 'average__of', text: ofText })
|
||||||
]),
|
]),
|
||||||
visual,
|
visual,
|
||||||
el('span', { class: 'average__count', text: total + (total === 1 ? ' Bewertung' : ' Bewertungen') })
|
el('span', {
|
||||||
|
class: 'average__count',
|
||||||
|
text: total + (total === 1 ? ' Bewertung' : ' Bewertungen')
|
||||||
|
+ (results.commentOnly ? ' · ' + results.commentOnly + '× nur Kommentar' : '')
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -800,6 +878,55 @@
|
|||||||
return el('div', { class: 'scale-results' }, [row, comments]);
|
return el('div', { class: 'scale-results' }, [row, comments]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Participant view of a word cloud: a compact list (like Q&A voting) with fixed text size,
|
||||||
|
* a bar for the relative weight and "+"/"−" buttons. Scales to any number of words.
|
||||||
|
*/
|
||||||
|
wordList: function (results, options) {
|
||||||
|
var mine = (options && options.mine) || [];
|
||||||
|
var down = (options && options.down) || [];
|
||||||
|
var onUpvote = options.onUpvote;
|
||||||
|
var onDownvote = options.onDownvote;
|
||||||
|
return el('ul', { class: 'wc-list' }, results.words.map(function (word) {
|
||||||
|
var isMine = mine.indexOf(word.key) >= 0;
|
||||||
|
var isDown = down.indexOf(word.key) >= 0;
|
||||||
|
var rated = isMine || isDown;
|
||||||
|
var downCount = word.down || 0;
|
||||||
|
var up = el('button', {
|
||||||
|
type: 'button',
|
||||||
|
class: 'wc-vote wc-vote--up' + (isMine ? ' is-active' : ''),
|
||||||
|
'aria-pressed': isMine ? 'true' : 'false',
|
||||||
|
'aria-label': word.text + ', ' + word.count + ' Stimmen'
|
||||||
|
+ (isMine ? ', von dir genannt' : (isDown ? '' : ', unterstützen'))
|
||||||
|
}, [el('span', { 'aria-hidden': 'true', text: (isMine ? '✓ ' : '+') + word.count })]);
|
||||||
|
up.disabled = rated;
|
||||||
|
if (!rated) {
|
||||||
|
up.addEventListener('click', function () { onUpvote(word); });
|
||||||
|
}
|
||||||
|
var downEl = null;
|
||||||
|
if (onDownvote) {
|
||||||
|
downEl = el('button', {
|
||||||
|
type: 'button',
|
||||||
|
class: 'wc-vote wc-vote--down' + (isDown ? ' is-active' : ''),
|
||||||
|
'aria-pressed': isDown ? 'true' : 'false',
|
||||||
|
'aria-label': word.text + ', ' + downCount + ' Ablehnungen'
|
||||||
|
+ (isDown ? ', von dir abgelehnt' : (isMine ? '' : ', ablehnen'))
|
||||||
|
}, [el('span', { 'aria-hidden': 'true', text: (isDown ? '✓ ' : '−') + downCount })]);
|
||||||
|
downEl.disabled = rated;
|
||||||
|
if (!rated) {
|
||||||
|
downEl.addEventListener('click', function () { onDownvote(word); });
|
||||||
|
}
|
||||||
|
} else if (downCount > 0) {
|
||||||
|
downEl = el('span', { class: 'wc-count--down', text: '−' + downCount });
|
||||||
|
}
|
||||||
|
return el('li', { class: 'wc-item' + (isMine ? ' is-mine' : '') + (isDown ? ' is-down' : '') }, [
|
||||||
|
el('span', { class: 'wc-item__text', text: word.text }),
|
||||||
|
el('span', { class: 'wc-item__actions' }, [up, downEl]),
|
||||||
|
el('span', { class: 'wc-item__bar', 'aria-hidden': 'true', style: 'width:' + Math.max(3, Math.round(word.weight * 100)) + '%' })
|
||||||
|
]);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* options: {mine: [keys], down: [keys], onUpvote: fn(word)|null, onDownvote: fn(word)|null}
|
* options: {mine: [keys], down: [keys], onUpvote: fn(word)|null, onDownvote: fn(word)|null}
|
||||||
* Counts are shown as "+up" and "−down" (down only when > 0 or clickable).
|
* Counts are shown as "+up" and "−down" (down only when > 0 or clickable).
|
||||||
@@ -819,8 +946,12 @@
|
|||||||
ordered.unshift(word);
|
ordered.unshift(word);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return el('div', { class: 'cloud' + (onUpvote ? ' cloud--interactive' : '') }, ordered.map(function (word, index) {
|
if (onUpvote) {
|
||||||
var size = 0.9 + word.weight * 2.6;
|
return Results.wordList(results, options);
|
||||||
|
}
|
||||||
|
var scale = Math.max(0.45, Math.min(1, 1.1 - ordered.length * 0.035));
|
||||||
|
return el('div', { class: 'cloud', style: '--cloud-scale:' + scale.toFixed(2) }, ordered.map(function (word, index) {
|
||||||
|
var size = 0.9 + word.weight * 1.6;
|
||||||
var isMine = mine.indexOf(word.key) >= 0;
|
var isMine = mine.indexOf(word.key) >= 0;
|
||||||
var isDown = down.indexOf(word.key) >= 0;
|
var isDown = down.indexOf(word.key) >= 0;
|
||||||
var rated = isMine || isDown;
|
var rated = isMine || isDown;
|
||||||
@@ -831,49 +962,12 @@
|
|||||||
title: '+' + word.count + ' / −' + downCount
|
title: '+' + word.count + ' / −' + downCount
|
||||||
+ (isMine ? ' – von dir genannt' : (isDown ? ' – von dir abgelehnt' : ''))
|
+ (isMine ? ' – von dir genannt' : (isDown ? ' – von dir abgelehnt' : ''))
|
||||||
};
|
};
|
||||||
if (!onUpvote) {
|
|
||||||
// Presenter (and participants without upvotes): show the counts next to the word.
|
// Presenter (and participants without upvotes): show the counts next to the word.
|
||||||
return el('span', attrs, [
|
return el('span', attrs, [
|
||||||
el('span', { text: word.text }),
|
el('span', { text: word.text }),
|
||||||
el('span', { class: 'cloud__count cloud__count--up', text: '+' + word.count }),
|
el('span', { class: 'cloud__count cloud__count--up', text: '+' + word.count }),
|
||||||
downCount > 0 ? el('span', { class: 'cloud__count cloud__count--down', text: '−' + downCount }) : null
|
downCount > 0 ? el('span', { class: 'cloud__count cloud__count--down', text: '−' + downCount }) : null
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
|
|
||||||
var up = el('button', {
|
|
||||||
type: 'button',
|
|
||||||
class: 'cloud__vote cloud__vote--up',
|
|
||||||
'aria-pressed': isMine ? 'true' : 'false',
|
|
||||||
'aria-label': word.text + ', ' + word.count + ' Stimmen'
|
|
||||||
+ (isMine ? ', von dir genannt' : (isDown ? '' : ', unterstützen'))
|
|
||||||
}, [
|
|
||||||
el('span', { text: word.text }),
|
|
||||||
el('span', { class: 'cloud__count cloud__count--up', 'aria-hidden': 'true', text: (isMine ? '✓ ' : '+') + word.count })
|
|
||||||
]);
|
|
||||||
up.disabled = rated;
|
|
||||||
if (!rated) {
|
|
||||||
up.addEventListener('click', function () { onUpvote(word); });
|
|
||||||
}
|
|
||||||
|
|
||||||
var downEl = null;
|
|
||||||
if (onDownvote) {
|
|
||||||
downEl = el('button', {
|
|
||||||
type: 'button',
|
|
||||||
class: 'cloud__vote cloud__vote--down',
|
|
||||||
'aria-pressed': isDown ? 'true' : 'false',
|
|
||||||
'aria-label': word.text + ', ' + downCount + ' Ablehnungen'
|
|
||||||
+ (isDown ? ', von dir abgelehnt' : (isMine ? '' : ', ablehnen'))
|
|
||||||
}, [
|
|
||||||
el('span', { class: 'cloud__count cloud__count--down', 'aria-hidden': 'true', text: (isDown ? '✓ ' : '') + '−' + downCount })
|
|
||||||
]);
|
|
||||||
downEl.disabled = rated;
|
|
||||||
if (!rated) {
|
|
||||||
downEl.addEventListener('click', function () { onDownvote(word); });
|
|
||||||
}
|
|
||||||
} else if (downCount > 0) {
|
|
||||||
downEl = el('span', { class: 'cloud__count cloud__count--down', text: '−' + downCount });
|
|
||||||
}
|
|
||||||
return el('span', attrs, [up, downEl]);
|
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1165,6 +1259,49 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ QR download
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [data-qr-download]: renders the SVG QR code (the sibling <img>) onto a canvas and saves it as PNG.
|
||||||
|
* data-filename sets the file name. Hidden without JS / canvas support.
|
||||||
|
*/
|
||||||
|
function initQrDownload() {
|
||||||
|
document.querySelectorAll('[data-qr-download]').forEach(function (button) {
|
||||||
|
var img = button.parentNode.querySelector('img');
|
||||||
|
if (!img || !document.createElement('canvas').toBlob) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
button.hidden = false;
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
var size = 1024;
|
||||||
|
// The SVG has only a viewBox; an explicit size keeps Firefox from refusing to draw it.
|
||||||
|
var source = new Image(size, size);
|
||||||
|
source.onload = function () {
|
||||||
|
var canvas = document.createElement('canvas');
|
||||||
|
canvas.width = size;
|
||||||
|
canvas.height = size;
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
ctx.fillStyle = '#fff';
|
||||||
|
ctx.fillRect(0, 0, size, size);
|
||||||
|
ctx.drawImage(source, 0, 0, size, size);
|
||||||
|
canvas.toBlob(function (blob) {
|
||||||
|
if (!blob) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var link = document.createElement('a');
|
||||||
|
link.href = URL.createObjectURL(blob);
|
||||||
|
link.download = button.getAttribute('data-filename') || 'qr-code.png';
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
link.remove();
|
||||||
|
setTimeout(function () { URL.revokeObjectURL(link.href); }, 1000);
|
||||||
|
}, 'image/png');
|
||||||
|
};
|
||||||
|
source.src = img.currentSrc || img.src;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------ share
|
// ------------------------------------------------------------------ share
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1398,30 +1535,36 @@
|
|||||||
var allHidden = state.count === 0 && state.hiddenCount > 0;
|
var allHidden = state.count === 0 && state.hiddenCount > 0;
|
||||||
q('[data-question]').textContent = state.count === 0
|
q('[data-question]').textContent = state.count === 0
|
||||||
? (allHidden ? 'Alle Folien sind ausgeblendet' : 'Noch keine Folien angelegt')
|
? (allHidden ? 'Alle Folien sind ausgeblendet' : 'Noch keine Folien angelegt')
|
||||||
: state.poll.title;
|
: (state.poll.isPaused ? 'Gerade ist keine Frage aktiv' : state.poll.title);
|
||||||
q('[data-description]').textContent = state.count === 0
|
q('[data-description]').textContent = state.count === 0
|
||||||
? (allHidden ? 'Blende in der Verwaltung mindestens eine Folie ein.' : 'Lege in der Verwaltung Fragen an.')
|
? (allHidden ? 'Blende in der Verwaltung mindestens eine Folie ein.' : 'Lege in der Verwaltung Fragen an.')
|
||||||
: (state.poll.isPaused
|
: (state.poll.isPaused ? '' : 'Drücke → um zu starten.');
|
||||||
? 'Teilnehmende sehen gerade eine Pause-Seite. Drücke P oder → zum Fortsetzen.'
|
|
||||||
: 'Drücke → um zu starten.');
|
|
||||||
q('[data-results]').innerHTML = '';
|
q('[data-results]').innerHTML = '';
|
||||||
|
q('[data-stage-timer]').textContent = '';
|
||||||
renderMedia(null);
|
renderMedia(null);
|
||||||
renderImage(null);
|
renderImage(null);
|
||||||
root.classList.remove('stage--video');
|
root.classList.remove('stage--video');
|
||||||
q('[data-voting]').hidden = true;
|
q('[data-voting]').hidden = true;
|
||||||
setText('[data-participants]', '');
|
setText('[data-participants]', '');
|
||||||
|
StageAudio.stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var quizPhase = slide.type === 'quiz' && state.results ? state.results.phase : null;
|
var quizPhase = slide.type === 'quiz' && state.results ? state.results.phase : null;
|
||||||
var qaStage = slide.type === 'qa' && state.results ? state.results.stage : null;
|
var qaStage = slide.type === 'qa' && state.results ? state.results.stage : null;
|
||||||
var orderRevealed = slide.type === 'order' && state.results ? state.results.revealed : null;
|
var orderRevealed = slide.type === 'order' && state.results ? state.results.revealed : null;
|
||||||
var closed = slide.isInteractive && !slide.isVotingOpen && !quizPhase && !qaStage && !orderRevealed;
|
// Countdown of any slide that has one (a quiz shows its timer inside its results).
|
||||||
|
var timer = state.results && state.results.timer ? state.results.timer : null;
|
||||||
|
var phase = timer ? timer.phase : null;
|
||||||
|
var timed = phase && !quizPhase ? phase : null;
|
||||||
|
var closed = slide.isInteractive && !slide.isVotingOpen && !quizPhase && !qaStage && !orderRevealed && timed !== 'ready';
|
||||||
// Status line above the question: only what the room needs to know, not the slide type.
|
// Status line above the question: only what the room needs to know, not the slide type.
|
||||||
q('[data-status]').textContent = quizPhase
|
q('[data-status]').textContent = quizPhase
|
||||||
? { ready: 'Bereit', running: 'Läuft', finished: 'Auflösung' }[quizPhase]
|
? { ready: 'Bereit', running: 'Läuft', finished: 'Auflösung' }[quizPhase]
|
||||||
: (qaStage ? Qa.labels[qaStage]
|
: (qaStage ? Qa.labels[qaStage]
|
||||||
: (orderRevealed ? 'Auflösung' : (closed ? 'Abstimmung geschlossen' : '')));
|
: (orderRevealed ? 'Auflösung'
|
||||||
|
: (timed === 'ready' ? 'Bereit' : (timed === 'running' ? 'Läuft' : (closed ? 'Abstimmung geschlossen' : '')))));
|
||||||
|
renderStageTimer(timed === 'running' && timer.remaining !== null ? timer.remaining : null);
|
||||||
q('[data-question]').textContent = slide.question;
|
q('[data-question]').textContent = slide.question;
|
||||||
Format.render(q('[data-description]'), slide.description);
|
Format.render(q('[data-description]'), slide.description);
|
||||||
root.classList.toggle('stage--content', !slide.isInteractive);
|
root.classList.toggle('stage--content', !slide.isInteractive);
|
||||||
@@ -1438,12 +1581,14 @@
|
|||||||
? { ready: 'Quiz starten', running: 'Quiz beenden', finished: 'Quiz erneut öffnen' }[quizPhase]
|
? { ready: 'Quiz starten', running: 'Quiz beenden', finished: 'Quiz erneut öffnen' }[quizPhase]
|
||||||
: (qaStage
|
: (qaStage
|
||||||
? { collect: 'Einreichen beenden', vote: 'Abstimmung beenden', discuss: '' }[qaStage]
|
? { collect: 'Einreichen beenden', vote: 'Abstimmung beenden', discuss: '' }[qaStage]
|
||||||
: (slide.type === 'order'
|
: (timed
|
||||||
|
? { ready: 'Countdown starten', running: 'Abstimmung schließen', finished: 'Countdown erneut starten' }[timed]
|
||||||
|
: slide.type === 'order'
|
||||||
? (slide.isVotingOpen ? 'Schließen & auflösen' : 'Abstimmung wieder öffnen')
|
? (slide.isVotingOpen ? 'Schließen & auflösen' : 'Abstimmung wieder öffnen')
|
||||||
: (slide.isVotingOpen ? 'Abstimmung schließen' : 'Abstimmung öffnen')));
|
: (slide.isVotingOpen ? 'Abstimmung schließen' : 'Abstimmung öffnen')));
|
||||||
|
|
||||||
var count = qaStage ? state.results.questions.length : (slide.isInteractive ? state.results.participants : 0);
|
var count = qaStage ? state.results.questions.length : (slide.isInteractive ? state.results.participants : 0);
|
||||||
setText('[data-participants]', !slide.isInteractive ? '' : (qaStage
|
setText('[data-participants]', !slide.isInteractive || timed === 'ready' ? '' : (qaStage
|
||||||
? count + (count === 1 ? ' Frage' : ' Fragen')
|
? count + (count === 1 ? ' Frage' : ' Fragen')
|
||||||
: count + ' ' + (count === 1 ? 'Antwort' : 'Antworten')));
|
: count + ' ' + (count === 1 ? 'Antwort' : 'Antworten')));
|
||||||
|
|
||||||
@@ -1454,6 +1599,22 @@
|
|||||||
}
|
}
|
||||||
renderResults();
|
renderResults();
|
||||||
Countdown.start();
|
Countdown.start();
|
||||||
|
StageAudio.sync(phase === 'running' ? state.poll.audioUrl : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Big countdown below the question for slides that are not a quiz; null removes it. */
|
||||||
|
function renderStageTimer(remaining) {
|
||||||
|
var box = q('[data-stage-timer]');
|
||||||
|
box.textContent = '';
|
||||||
|
if (remaining === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
box.appendChild(el('p', {
|
||||||
|
class: 'quiz-timer',
|
||||||
|
role: 'timer',
|
||||||
|
'data-countdown': '',
|
||||||
|
'data-remaining': String(remaining)
|
||||||
|
}, [el('strong', { 'data-countdown-value': '', text: formatSeconds(remaining) })]));
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPrivate() {
|
function isPrivate() {
|
||||||
@@ -1599,21 +1760,25 @@
|
|||||||
if ((event.key === ' ' || event.key === 'Enter') && event.target.closest('[data-comments]')) {
|
if ((event.key === ' ' || event.key === 'Enter') && event.target.closest('[data-comments]')) {
|
||||||
return; // activates the focused comment button, not the next slide
|
return; // activates the focused comment button, not the next slide
|
||||||
}
|
}
|
||||||
if (embedded && ['ArrowRight', 'ArrowLeft', 'PageUp', 'PageDown', ' ', 'p', 'P', 'f', 'F', 'q', 'Q'].indexOf(event.key) >= 0) {
|
if (embedded && ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', ' ', 'b', 'B', 'p', 'P', 'f', 'F', 'q', 'Q'].indexOf(event.key) >= 0) {
|
||||||
return; // slide navigation belongs to the surrounding presentation
|
return; // slide navigation belongs to the surrounding presentation
|
||||||
}
|
}
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
case 'b':
|
||||||
|
case 'B':
|
||||||
case 'p':
|
case 'p':
|
||||||
case 'P':
|
case 'P':
|
||||||
control(state && !state.slide && state.poll.isPaused ? 'resume' : 'stop');
|
control(state && !state.slide && state.poll.isPaused ? 'resume' : 'stop');
|
||||||
break;
|
break;
|
||||||
case 'ArrowRight':
|
case 'ArrowRight':
|
||||||
|
case 'ArrowDown':
|
||||||
case 'PageDown':
|
case 'PageDown':
|
||||||
case ' ':
|
case ' ':
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
control('next');
|
control('next');
|
||||||
break;
|
break;
|
||||||
case 'ArrowLeft':
|
case 'ArrowLeft':
|
||||||
|
case 'ArrowUp':
|
||||||
case 'PageUp':
|
case 'PageUp':
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
control('prev');
|
control('prev');
|
||||||
@@ -1660,88 +1825,7 @@
|
|||||||
|
|
||||||
// ------------------------------------------------------------------ participant
|
// ------------------------------------------------------------------ participant
|
||||||
|
|
||||||
// Fullscreen and screen wake lock for the participant view (both optional, buttons stay hidden if unsupported).
|
|
||||||
function initScreenTools(root) {
|
|
||||||
function setPressed(button, on) {
|
|
||||||
var text = button.getAttribute(on ? 'data-label-on' : 'data-label-off');
|
|
||||||
button.setAttribute('aria-pressed', on ? 'true' : 'false');
|
|
||||||
button.setAttribute('aria-label', text);
|
|
||||||
button.title = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The buttons live in the layout header, outside the participant root.
|
|
||||||
var fsButton = document.querySelector('[data-fullscreen-toggle]');
|
|
||||||
if (fsButton && document.fullscreenEnabled) {
|
|
||||||
fsButton.hidden = false;
|
|
||||||
fsButton.addEventListener('click', function () {
|
|
||||||
if (document.fullscreenElement) {
|
|
||||||
document.exitFullscreen();
|
|
||||||
} else {
|
|
||||||
document.documentElement.requestFullscreen().catch(function () {});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Also fires when leaving with Esc/back gesture.
|
|
||||||
document.addEventListener('fullscreenchange', function () {
|
|
||||||
setPressed(fsButton, !!document.fullscreenElement);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var wlButton = document.querySelector('[data-wakelock-toggle]');
|
|
||||||
if (wlButton && 'wakeLock' in navigator) {
|
|
||||||
// The page reloads on every slide change, so the choice is kept per tab and re-applied on load.
|
|
||||||
var STORE = 'plenario-wakelock';
|
|
||||||
// On by default; only an explicit "off" is remembered.
|
|
||||||
var wanted = true;
|
|
||||||
var sentinel = null;
|
|
||||||
try {
|
|
||||||
wanted = sessionStorage.getItem(STORE) !== '0';
|
|
||||||
} catch (e) {
|
|
||||||
// storage blocked: choice only lasts until the next slide
|
|
||||||
}
|
|
||||||
var remember = function () {
|
|
||||||
try {
|
|
||||||
sessionStorage.setItem(STORE, wanted ? '1' : '0');
|
|
||||||
} catch (e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var acquire = function () {
|
|
||||||
if (!wanted || sentinel || document.visibilityState !== 'visible') {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
return navigator.wakeLock.request('screen').then(function (lock) {
|
|
||||||
sentinel = lock;
|
|
||||||
// The browser releases the lock when the tab is hidden; re-acquired on return.
|
|
||||||
lock.addEventListener('release', function () {
|
|
||||||
sentinel = null;
|
|
||||||
});
|
|
||||||
}).catch(function () {
|
|
||||||
wanted = false; // denied (e.g. battery saver)
|
|
||||||
remember();
|
|
||||||
setPressed(wlButton, false);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
wlButton.hidden = false;
|
|
||||||
setPressed(wlButton, wanted);
|
|
||||||
acquire();
|
|
||||||
wlButton.addEventListener('click', function () {
|
|
||||||
wanted = !wanted;
|
|
||||||
remember();
|
|
||||||
setPressed(wlButton, wanted);
|
|
||||||
if (wanted) {
|
|
||||||
acquire();
|
|
||||||
} else if (sentinel) {
|
|
||||||
sentinel.release();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
document.addEventListener('visibilitychange', acquire);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initParticipant(root) {
|
function initParticipant(root) {
|
||||||
initScreenTools(root);
|
|
||||||
var stateUrl = root.getAttribute('data-state-url');
|
var stateUrl = root.getAttribute('data-state-url');
|
||||||
var voteUrl = root.getAttribute('data-vote-url');
|
var voteUrl = root.getAttribute('data-vote-url');
|
||||||
var version = root.getAttribute('data-version');
|
var version = root.getAttribute('data-version');
|
||||||
@@ -2408,6 +2492,59 @@
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Countdown music upload (admin menu): like the image dropzone, but the file is sent as soon as it is
|
||||||
|
* chosen or dropped. Without JavaScript the "Hochladen" button does it.
|
||||||
|
*/
|
||||||
|
function initAudioForm(form) {
|
||||||
|
var file = form.querySelector('input[type="file"]');
|
||||||
|
var zone = form.querySelector('[data-audio-drop]');
|
||||||
|
var submit = form.querySelector('[data-audio-submit]');
|
||||||
|
if (!file || !zone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (submit) {
|
||||||
|
submit.hidden = true;
|
||||||
|
}
|
||||||
|
var extra = form.querySelector('[data-audio-drop-extra]');
|
||||||
|
if (extra) {
|
||||||
|
extra.hidden = false;
|
||||||
|
}
|
||||||
|
function send() {
|
||||||
|
if (file.files && file.files.length > 0) {
|
||||||
|
if (form.requestSubmit) {
|
||||||
|
form.requestSubmit();
|
||||||
|
} else {
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.addEventListener('change', send);
|
||||||
|
zone.addEventListener('dragover', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
zone.classList.add('is-dragover');
|
||||||
|
});
|
||||||
|
zone.addEventListener('dragleave', function () {
|
||||||
|
zone.classList.remove('is-dragover');
|
||||||
|
});
|
||||||
|
zone.addEventListener('drop', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
zone.classList.remove('is-dragover');
|
||||||
|
var dropped = event.dataTransfer && event.dataTransfer.files;
|
||||||
|
if (!dropped || dropped.length === 0 || typeof DataTransfer === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var transfer = new DataTransfer();
|
||||||
|
transfer.items.add(dropped[0]);
|
||||||
|
file.files = transfer.files;
|
||||||
|
send();
|
||||||
|
} catch (e) {
|
||||||
|
// Browser without assignable file lists: the file dialog still works.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** Quiz slide form: add further answer rows (the server renders a few already). */
|
/** Quiz slide form: add further answer rows (the server renders a few already). */
|
||||||
function initQuizOptions(fieldset) {
|
function initQuizOptions(fieldset) {
|
||||||
var list = fieldset.querySelector('[data-quiz-list]');
|
var list = fieldset.querySelector('[data-quiz-list]');
|
||||||
@@ -2731,6 +2868,45 @@
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ quick option (choice form)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Button that appends a ready-made option (e.g. "Enthaltung") to the option textarea.
|
||||||
|
* Idempotent: an existing line with the same text is not added again; the maximum is respected.
|
||||||
|
*/
|
||||||
|
function initAddOption(button) {
|
||||||
|
var area = document.getElementById(button.getAttribute('data-add-option-target'));
|
||||||
|
if (!area) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var label = button.getAttribute('data-add-option');
|
||||||
|
var max = parseInt(button.getAttribute('data-add-option-max'), 10) || 20;
|
||||||
|
|
||||||
|
function lines() {
|
||||||
|
return area.value.split(/\r?\n/).map(function (line) { return line.trim(); }).filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
var current = lines();
|
||||||
|
var present = current.some(function (line) { return line.toLowerCase() === label.toLowerCase(); });
|
||||||
|
button.disabled = present || current.length >= max;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.hidden = false;
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
var current = lines();
|
||||||
|
if (button.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
current.push(label);
|
||||||
|
area.value = current.join('\n');
|
||||||
|
update();
|
||||||
|
area.focus();
|
||||||
|
});
|
||||||
|
area.addEventListener('input', update);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------ theme switch
|
// ------------------------------------------------------------------ theme switch
|
||||||
|
|
||||||
var THEME_ICONS = { auto: '◐', light: '☀', dark: '☾' };
|
var THEME_ICONS = { auto: '◐', light: '☀', dark: '☾' };
|
||||||
@@ -3049,9 +3225,11 @@
|
|||||||
root.querySelectorAll('[data-youtube-form]').forEach(initYouTubeForm);
|
root.querySelectorAll('[data-youtube-form]').forEach(initYouTubeForm);
|
||||||
root.querySelectorAll('[data-quiz-options]').forEach(initQuizOptions);
|
root.querySelectorAll('[data-quiz-options]').forEach(initQuizOptions);
|
||||||
root.querySelectorAll('[data-image-fields]').forEach(initImageFields);
|
root.querySelectorAll('[data-image-fields]').forEach(initImageFields);
|
||||||
|
root.querySelectorAll('[data-audio-form]').forEach(initAudioForm);
|
||||||
root.querySelectorAll('[data-sortable]').forEach(initSortable);
|
root.querySelectorAll('[data-sortable]').forEach(initSortable);
|
||||||
root.querySelectorAll('[data-order-options]').forEach(initOrderOptions);
|
root.querySelectorAll('[data-order-options]').forEach(initOrderOptions);
|
||||||
root.querySelectorAll('[data-scale-style]').forEach(initScaleStyle);
|
root.querySelectorAll('[data-scale-style]').forEach(initScaleStyle);
|
||||||
|
root.querySelectorAll('[data-add-option]').forEach(initAddOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flash messages: click hides them (delegated, no inline handlers because of the CSP).
|
// Flash messages: click hides them (delegated, no inline handlers because of the CSP).
|
||||||
@@ -3117,10 +3295,57 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Admin menu drawer: below 900px the sidebar slides in from the right (CSS), opened by the header button.
|
||||||
|
// Without JS the button stays hidden and the sidebar remains a normal block below the slides.
|
||||||
|
function initDrawer() {
|
||||||
|
var toggle = document.querySelector('[data-drawer-toggle]');
|
||||||
|
var drawer = toggle ? document.getElementById(toggle.getAttribute('aria-controls')) : null;
|
||||||
|
if (!toggle || !drawer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var root = document.body;
|
||||||
|
drawer.classList.add('sidebar--drawer');
|
||||||
|
toggle.hidden = false;
|
||||||
|
|
||||||
|
function setOpen(open) {
|
||||||
|
root.classList.toggle('drawer-open', open);
|
||||||
|
toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||||
|
if (open) {
|
||||||
|
var close = drawer.querySelector('[data-drawer-close]');
|
||||||
|
if (close) {
|
||||||
|
close.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toggle.addEventListener('click', function () {
|
||||||
|
setOpen(!root.classList.contains('drawer-open'));
|
||||||
|
});
|
||||||
|
document.addEventListener('click', function (event) {
|
||||||
|
var target = event.target.closest ? event.target.closest('[data-drawer-close], a[href^="#"]') : null;
|
||||||
|
if (target && root.classList.contains('drawer-open') && (target.hasAttribute('data-drawer-close') || drawer.contains(target))) {
|
||||||
|
setOpen(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.addEventListener('keydown', function (event) {
|
||||||
|
if (event.key === 'Escape' && root.classList.contains('drawer-open') && !document.querySelector('dialog[open]')) {
|
||||||
|
setOpen(false);
|
||||||
|
toggle.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Back to a wide screen: the sidebar is a normal column again.
|
||||||
|
window.addEventListener('resize', function () {
|
||||||
|
if (window.innerWidth > 900 && root.classList.contains('drawer-open')) {
|
||||||
|
setOpen(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
document.querySelectorAll('[data-theme-switch]').forEach(initThemeSwitch);
|
document.querySelectorAll('[data-theme-switch]').forEach(initThemeSwitch);
|
||||||
initWidgets(document);
|
initWidgets(document);
|
||||||
initShare();
|
initShare();
|
||||||
|
initDrawer();
|
||||||
|
initQrDownload();
|
||||||
initAdminDashboard();
|
initAdminDashboard();
|
||||||
document.querySelectorAll('[data-presenter]').forEach(initPresenter);
|
document.querySelectorAll('[data-presenter]').forEach(initPresenter);
|
||||||
document.querySelectorAll('[data-participant]').forEach(initParticipant);
|
document.querySelectorAll('[data-participant]').forEach(initParticipant);
|
||||||
|
|||||||
Reference in new issue
Block a user