Commit e67644c0 authored by Son Nguyen's avatar Son Nguyen
Browse files

Fix blocks lost when importing leap2a (Bug #1229563)



1. Fix Leap2a export audio and video file
2. Fix text box leap2a import

Change-Id: I6f9f6d082f3796cf74ff134bc632c47e3abf3a63
Signed-off-by: default avatarSon Nguyen <sonn@catalyst.net.nz>
parent 42f72214
......@@ -70,6 +70,8 @@ class LeapExportElementFolder extends LeapExportElement {
}
class LeapExportElementImage extends LeapExportElementFile { }
class LeapExportElementVideo extends LeapExportElementFile { }
class LeapExportElementAudio extends LeapExportElementFile { }
class LeapExportElementProfileIcon extends LeapExportElementFile {
public function add_links() {
......
......@@ -323,8 +323,8 @@ class LeapImportInternal extends LeapImportArtefactPlugin {
'type' => 'html',
'content' => array (
'title' => isset($entry->title) ? (string) $entry->title : '',
'ctime' => strtotime((string)$entry->published),
'mtime' => strtotime((string)$entry->updated),
'ctime' => (string)$entry->published,
'mtime' => (string)$entry->updated,
'description' => $content
)
);
......@@ -397,13 +397,13 @@ class LeapImportInternal extends LeapImportArtefactPlugin {
$introduction->commit();
$artefactmapping[(string)$entry->id] = array($introduction->get('id'));
break;
case 'note':
case 'html':
$note = new ArtefactTypeHtml();
$note->set('title', $entrydata['content']['title']);
$note->set('description', $entrydata['content']['description']);
$note->set('ctime', $entrydata['content']['ctime']);
$note->set('mtime', $entrydata['content']['mtime']);
$note->set('owner', $entrydata['content']['owner']);
$note->set('ctime', strtotime($entrydata['content']['ctime']));
$note->set('mtime', strtotime($entrydata['content']['mtime']));
$note->set('owner', $entrydata['owner']);
$note->commit();
$artefactmapping[(string)$entry->id] = array($note->get('id'));
......
......@@ -114,7 +114,7 @@ function print_upload_form() {
function import_validate(Pieform $form, $values) {
global $USER, $TRANSPORTER;
if (!$values['leap2afile']) {
if (!isset($values['leap2afile'])) {
$form->set_error('leap2afile', $form->i18n('rule', 'required', 'required'));
return;
}
......
......@@ -1866,7 +1866,7 @@ class PluginImportLeap extends PluginImport {
public static function get_leap_myrole(SimpleXMLElement $entry, $namespaces, $ns) {
$myrole = $entry->xpath($namespaces[$ns].':myrole');
// we only expect one role
if($myrole[0]) {
if (isset($myrole[0])) {
return $myrole[0];
}
return '';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment