Skip to content

Feature/#5454 sso multi problem selection - #48

Open
sabgre wants to merge 10 commits into
devfrom
feature/#5454-sso-multi-problem-selection
Open

Feature/#5454 sso multi problem selection#48
sabgre wants to merge 10 commits into
devfrom
feature/#5454-sso-multi-problem-selection

Conversation

@sabgre

@sabgre sabgre commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

No description provided.

sabgre added 10 commits July 27, 2026 12:52
The multi-problem selector now runs shouldUseSSO() before opening its
popup, same as the single-problem selector: if the configured
problem-selector origin matches the selected MUMIE server's origin, it
opens the SSO auto-submit form (with multiSelect=true) via
ilMumieTaskSSOService instead of the plain URL; otherwise it falls
back to the unauthenticated URL as before.
…and-drop

The problem selector frontend dropped native HTML5 drag-and-drop in
favor of a postMessage-only contract (commit d874826d in lemon-fruit),
so the "Transfer to LMS" button's array payload never reached ILIAS:
ilMumieTaskDropzone.js only listened for a native drop event, and the
single postMessage listener in ilMumieTaskForm.js assumed one object.

addMessageListener now branches on Array.isArray() and forwards a
multi-select payload to the same field/list population logic the
dropzone's drop handler already used, re-encoding each task back into
the double-JSON-encoded string array ilMumieTaskMultiUploadProcessor
expects server-side. The dropzone's own drag/drop handling is left in
place as a fallback.
xmum_task stays empty when creating tasks through the multi-select
dropzone, but checkInput() required it unconditionally for new (dummy)
objects, blocking save even with a valid xmum_multi_problems payload.
Multi-select import now runs entirely through postMessage from the
problem selector popup, so native drag-and-drop into the dropzone box
is no longer functional. Hide the whole box (the bordered
.ui-input-file-input-dropzone wrapper, not just its inner text) and
update the instructional/success copy that still described a manual
drag step.
getCoursebyName() compared course names case-sensitively, so it failed
to match the server's "Problem pool" course against the pool app's
export literal "Problem Pool", returning null and crashing the
subsequent getTaskByLink() call. Compare case-insensitively, and make
isValidProblem() return false instead of crashing when no course
matches at all.
When a MumieTask is created purely through the multi-select dropzone
(no single problem attached), the base object never becomes a real
task and was left behind as an empty, still-dummy repository entry
after save. Reuse the existing cancelDummy() cleanup (remove from the
tree, redirect to the parent container) whenever the object is still a
dummy right after saving.
Comparison with Moodle's mod_mumie multi-select flow surfaced two gaps:
- ilMumieTaskForm.js parsed the incoming postMessage JSON outside any
  try/catch, so a malformed payload threw uncaught instead of notifying
  the popup via sendFailure().
- Multi-select validation had no limit on the number of imported
  problems and silently accepted an empty selection. Reject empty and
  larger-than-50 selections, mirroring Moodle's batch-size guard.
Worksheet links (worksheet_<id>) don't exist in the server's regular
course/task structure, so validating them against it always failed
with "problem could not be found", blocking save whenever a worksheet
was included in a multi-select batch. Moodle's validator never checks
task links against the course structure at all, so this brings ILIAS
closer to that trust model for worksheets specifically. Also carry the
worksheet payload through to the newly created task, like the
single-select flow already does.
The pool app's export payload sends the server URL without a trailing
slash, but ilMumieTaskServer always stores url_prefix with one. Storing
the raw payload value directly made serverConfigExistsForUrl()'s exact
string match fail, showing a false "server configuration deleted"
error on every task created via multi-select. Normalize through
ilMumieTaskServer::fromUrl() before storing.
Both the single- and multi-problem selector popups can return a
worksheet, not just a regular problem, but the section headers, field
labels, button descriptions, and result/error messages across the form
only ever said "problem(s)". Update copy to mention worksheets
wherever it describes selected, created, or missing content; leave
pure tool-naming strings (open_prb_selector, open_dnd_prb_selector,
tab_problem_selector*) as-is, matching the established convention of
keeping "problem selector" as the tool's name even after worksheet
support was added to it.
@sabgre
sabgre requested review from AlexanderW-IL and dung238 July 27, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant