Leap2A package content not fully imported

Bug #1640837 reported by David Mudrák on 2016-11-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
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.

David Mudrák (mudrd8mz) wrote :
David Mudrák (mudrd8mz) wrote :
David Mudrák (mudrd8mz) wrote :
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
Robert Lyon (robertl-9) on 2016-11-14
Changed in mahara:
status: Confirmed → In Progress
milestone: none → 17.04.0
assignee: nobody → Robert Lyon (robertl-9)

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

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.

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) on 2016-12-28
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2017-04-27
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers