Leap2A package content not fully imported

Bug #1640837 reported by David Mudrák
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Robert Lyon

Bug Description

This has been discovered while testing the new feature in Moodle 3.2 that allows you to export Workshop module submissions. See https://tracker.moodle.org/browse/MDL-56888 for details of the problem and what workaround was done in Moodle.

Summary:

It seems that Mahara expects an extra wrapping element around the content of the <content> item in leap2a.xml file.

From the following leap2a package, only the first line "by Eric Cartman" is imported. The rest is not:

<content type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">
    <div>by Eric Cartman</div>
    <div>
      <h1>This sucks</h1>
      <img src="portfolio:storedfile863" alt="cat" width="150" height="106" class="img-responsive atto_image_button_text-bottom" rel="enclosure"/>
    </div>
  </div>
</content>

If there is an extra wrapper added, the content is correctly imported:

<content type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">
    <div>
      <div>by Eric Cartman</div>
      <div>
        <h1>This sucks</h1>
        <img src="portfolio:storedfile863" alt="cat" width="150" height="106" class="img-responsive atto_image_button_text-bottom" rel="enclosure"/>
      </div>
    </div>
  </div>
</content>

Interestingly, when previewing the content during the import (by clicking the title), it the content is displayed in the expandable area, even if it is not imported.

I have not found any related info in the Leap2A spec and I assume this is a bug (or at least undocumented feature). This may or may not be related to #1229563

Tested with: Mahara 16.10.1testing (2016090208, git rev da3c2342b7) and Moodle 3.2-beta, both running on PostgreSQL 9.3.12 on Gentoo Linux.

Tags: leap2a
Revision history for this message
David Mudrák (mudrd8mz) wrote :
Revision history for this message
David Mudrák (mudrd8mz) wrote :
Revision history for this message
David Mudrák (mudrd8mz) wrote :
Revision history for this message
David Mudrák (mudrd8mz) wrote :
Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi David

As you say the importing the info from the Leap2A file works fine - it inserts the information into the import_entry_request table correctly, both the unpatched and patched files.

What goes wrong is saving that import entry into a blogpost artefact.

I'm wondering if this problem is due to the embedding of an inline image, via the lib/embedded.php file and that the process is removing some of the information.

I'll try to look into it more once I get some time.

Changed in mahara:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/7251

Robert Lyon (robertl-9)
Changed in mahara:
status: Confirmed → In Progress
milestone: none → 17.04.0
assignee: nobody → Robert Lyon (robertl-9)
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi David,

It would be great if you could test the patch at https://reviews.mahara.org/7251 and checked if it worked for you.

Cheers
Kristina

Revision history for this message
David Mudrák (mudrd8mz) wrote :

Thanks guys for your work on this. I can confirm that Robert's patch fixes the issue for me. Once the patch was applied, I could successfully import the leap2A package from the comment #1 here

Note that mahara still throws various warnings during the import such as

   [WAR] 08 (artefact/file/import/leap/lib.php:464) Only variables should be passed by reference

that I guess are handled in a separate issue.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/7251
Committed: https://git.mahara.org/mahara/mahara/commit/5493669372b59321aa9ff76e6b79755261b11f42
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 5493669372b59321aa9ff76e6b79755261b11f42
Author: Robert Lyon <email address hidden>
Date: Mon Nov 14 16:20:37 2016 +1300

Bug 1640837: Proper import of blogposts

If we didn't wrap the blogpost description in a <div></div> it failed
to fully make the content. This is fine for our made leap2a but fails
for ones made via 3rd party systems, like moodle.

The problem was how we extracted the info from the DOM $xml

Test with the leap2a files in the bug report

behatnotneeded

Change-Id: Iedb88a05b332a38305e9304f358d3e424b1973f4
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.