Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#140: Question UI Renderer soll gelöschte Antworten erkennen #149

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

MHajoha
Copy link
Member

@MHajoha MHajoha commented Dec 11, 2024

Closes #140

classes/attempt_ui/dom_utils.php Outdated Show resolved Hide resolved
classes/attempt_ui/dom_utils.php Outdated Show resolved Hide resolved
classes/attempt_ui/invalid_option_warning.php Outdated Show resolved Hide resolved
Comment on lines +78 to +76
foreach ($newdoc->documentElement->childNodes as $childnode) {
$imported = $doc->importNode($childnode, deep: true);
if ($imported === false) {
debugging('Could not import HTML node from placeholder value');
return false;
}
$fragment->appendChild($imported);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ist es ein Problem, dass hier im return false-Fall Nodes importiert, aber nicht verwendet werden? Wächst dadurch das Dokument?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es ist leider nicht explizit dokumentiert, aber meine naive Vermutung war, dass das Dokument keine Referenz auf das Fragment (und damit transitiv das importierte Element) erhält, bis das Fragment nicht irgendwo hinzugefügt wird. Mit Blick auf den libxml-Code scheint das auch so zu sein.

Das importNode selbst scheint auch keine direkte Referenz von $doc auf $imported zu erstellen. (Nur andersherum, PHP ext-dom, libxml2). Ich sehe also nicht, warum $fragment nicht nach return false gelöscht werden sollte.

classes/attempt_ui/render_result.php Outdated Show resolved Hide resolved
@@ -49,6 +50,9 @@
$string['question_package_upload'] = 'Upload your own';
$string['remove_packages_button'] = 'Remove Packages';
$string['render_error_section'] = 'An error occurred';
$string['render_warning_invalid_value'] = 'The last submission set the field {$a->name} to the value {$a->value}, but that option is no longer available. The available options are: {$a->availablevalues}.';
$string['render_warnings_hint_contact_trainers'] = 'If you believe this to be in error, contact your trainers. They will also see this notice and may decide to override whichever score you receive.';
$string['render_warnings_hint_editable'] = 'You may set the mentioned field(s) to a valid value, or leave them untouched to preserve the invalid value.';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave them untouched to preserve the invalid value

Gilt das auch für checkboxes und radios?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, durch das hinzugefügte hidden-Input. Im Falle von required-Feldern wird vielleicht eine Warnung angezeigt, das sollte ich nochmal eroieren. Aber durch soften_validation verhindert das ja eh nicht die Submission.

templates/render_warnings.mustache Outdated Show resolved Hide resolved
templates/render_warnings.mustache Outdated Show resolved Hide resolved
@MHajoha MHajoha force-pushed the select-fallback-option branch 2 times, most recently from 917ef53 to f72edf5 Compare December 18, 2024 15:38
@MHajoha MHajoha force-pushed the select-fallback-option branch from f72edf5 to f33fda6 Compare December 18, 2024 16:00
@MHajoha MHajoha requested a review from larsbonczek December 18, 2024 16:25
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.

Question UI Renderer soll gelöschte Antworten erkennen
2 participants