Skip to content

Warn teachers when a SCORM export has no navigation menu - #160

Open
erseco wants to merge 2 commits into
mainfrom
hotfix/2477-scorm-export-navigation
Open

erseco wants to merge 2 commits into
mainfrom
hotfix/2477-scorm-export-navigation

Conversation

@erseco

@erseco erseco commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An activity installed from an eXeLearning SCORM or IMS export (uploaded directly, or created by "Migrate to eXeLearning" from a mod_exescorm activity) shows its pages without the navigation menu. On a multi-page package, pages 2 and later cannot be reached at all.

This PR detects that case and tells the teacher how to fix it: open the activity with Edit with eXeLearning and click Save to Moodle. That rebuilds it as a website with its menu.

Original issue

Related to exelearning/exelearning#2477, reported by @ignaciogros. Thank you for the clear description of the migration path; it made the case easy to reproduce.

Root cause

  • eXeLearning's SCORM 1.2 exporter renders pages with hideNavigation: true and hideNavButtons: true: there is no <nav id="siteNav"> in the HTML, because the LMS is expected to provide navigation from imsmanifest.xml.
  • The export still ships content.xml "for re-editing". So package_probe (migration) and validate_content_xml() (upload form) accept it, and the plugin serves its index.html as-is.
  • An editor-saved .elpx contains a full website export with #siteNav. The plugin has no server-side exporter, so only the embedded editor can rebuild the HTML.

Both fixtures in research/fixtures/ show the difference: same content.xml, but the SCORM zip has imsmanifest.xml and no <nav>, the .elpx has #siteNav and no manifest.

Fix

  • package_manager::content_is_lms_export(): the installed revision has a root imsmanifest.xml.
  • view.php: when that is true and the user can open the editor, show a warning with the steps. Students see nothing new.
  • New string lmsexportnonavigation in the five languages.

Saving from the editor stores an .elpx without the manifest, so the warning disappears on its own.

Why not rebuild automatically? That needs the browser exporter: either reimplementing eXeLearning's page renderer in PHP (it would drift from upstream), or running the editor hidden after each migration (large and fragile). The warning plus the one-click editor path fixes the activity today without either. A cleaner long-term fix belongs upstream: the SCORM exporter could keep the menu in the HTML and hide it.

TDD

RED

tests/lib_extract_test.php::test_content_is_lms_export, with the SCORM zip and the .elpx fixtures:

Error: Call to undefined method mod_exelearning\local\package_manager::content_is_lms_export()
Tests: 2, Assertions: 0, Errors: 2

GREEN

vendor/bin/phpunit mod/exelearning/tests/lib_extract_test.php → 5 tests OK (Moodle 5.0.7)
vendor/bin/phpcs --standard=moodle view.php classes/local/package_manager.php tests/lib_extract_test.php lang/*/exelearning.php version.php → 0 errors, 0 warnings
make check-version → OK

How to test

  1. Create an activity uploading research/fixtures/scorm/actividad-evaluable_scorm.zip (or migrate a mod_exescorm activity that holds an eXeLearning SCORM export).
  2. As a teacher, open it: the page has no side menu, and the warning above is shown.
  3. Click Edit with eXeLearning, then Save to Moodle.
  4. Reload: the menu is there and the warning is gone.
  5. As a student, the warning is never shown.

Screenshots

Before: SCORM export installed, no menu and no hint

2477-before.png

After: the teacher sees the warning

2477-notice.png

After saving from the editor: menu rebuilt, warning gone

2477-after-editor-save.png

Notes

  • version.php: 2026092614 (new language string). Other open PRs of this batch also bump it; whichever merges later rebases its version.

Moodle Playground Preview

The changes in this pull request can be previewed and tested using a Moodle Playground instance.

Preview in Moodle Playground

ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELPX upload, viewer and preview work normally.

eXeLearning's SCORM and IMS exports leave the navigation menu to the LMS,
but they carry content.xml, so the upload form and the sibling migration
install them. The activity then shows its pages without a menu, and
further pages cannot be reached.

Detect those exports by their root imsmanifest.xml and show a warning to
anyone who can open the editor: saving from it rebuilds the website with
its menu. Related to exelearning/exelearning#2477.
@codecov-commenter

codecov-commenter commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.92%. Comparing base (48a82fc) to head (a36b9ff).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #160   +/-   ##
=========================================
  Coverage     93.92%   93.92%           
- Complexity      810      811    +1     
=========================================
  Files            46       46           
  Lines          3554     3556    +2     
=========================================
+ Hits           3338     3340    +2     
  Misses          216      216           
Flag Coverage Δ
javascript 96.00% <ø> (ø)
php 93.83% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
PHP (server-side) 93.83% <100.00%> (+<0.01%) ⬆️
JavaScript (SCORM tracker) 96.00% <ø> (ø)
Files with missing lines Coverage Δ
classes/local/package_manager.php 96.56% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants