Commit 8d5c020b authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1784778: Fixing problems with peer assessment export/import



This should fix problems:
1) Exporting signoff block to html now works (it puts content into
block itself)
2) Exporting / importing peer assessment block stops complaining about
badly formed xml file

behatnotneeded

Change-Id: Ic1b0efd3fd89a3bd04516f97e1d3701198fffd2a
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 5cedce1f
......@@ -215,9 +215,9 @@ class PluginExportLeap extends PluginExport {
$this->smarty->assign('updated', self::format_rfc3339_date(strtotime($collection->get('mtime'))));
$this->smarty->assign('created', self::format_rfc3339_date(strtotime($collection->get('ctime'))));
$this->smarty->assign('summarytype', 'text');
$this->smarty->assign('summary', $collection->get('description'));
$this->smarty->assign('summary', clean_html($collection->get('description')));
$this->smarty->assign('contenttype', 'text');
$this->smarty->assign('content', $collection->get('description'));
$this->smarty->assign('content', clean_html($collection->get('description')));
$this->smarty->assign('leaptype', 'selection');
$tags = $collection->get('tags');
......@@ -271,14 +271,14 @@ class PluginExportLeap extends PluginExport {
$content = $config['description'];
if ($newcontent = self::parse_xhtmlish_content($content)) {
$this->smarty->assign('summarytype', 'xhtml');
$this->smarty->assign('summary', $newcontent);
$this->smarty->assign('summary', clean_html($newcontent, true));
} else {
$this->smarty->assign('summarytype', 'text');
$this->smarty->assign('summary', $content);
$this->smarty->assign('summary', clean_html($content));
}
$this->smarty->assign('contenttype', 'xhtml');
if ($viewcontent = self::parse_xhtmlish_content($view->build_rows(false, true), $view->get('id'))) {
$this->smarty->assign('content', $viewcontent);
$this->smarty->assign('content', clean_html($viewcontent, true));
}
$this->smarty->assign('viewdata', $config['rows']);
$layout = $view->get_layout();
......@@ -322,6 +322,9 @@ class PluginExportLeap extends PluginExport {
return;
}
if (!isset($this->links)) {
$this->links = new stdClass();
}
$viewlist = join(',', array_keys($this->views));
// Views in collections
......@@ -738,10 +741,10 @@ class LeapExportElement {
// try to coerce it to xhtml
if ($this->get_content_type() != 'text' && $newcontent = PluginExportLeap::parse_xhtmlish_content($content)) {
$this->smarty->assign('contenttype', 'xhtml');
$this->smarty->assign('content', $newcontent);
$this->smarty->assign('content', clean_html($newcontent, true));
} else {
$this->smarty->assign('contenttype', 'text');
$this->smarty->assign('content', $content);
$this->smarty->assign('content', clean_html($content));
}
$this->smarty->assign('leaptype', $this->get_leap_type());
$this->smarty->assign('author', $this->get_entry_author());
......
......@@ -2286,6 +2286,29 @@ class View {
}
else {
$result = $blockinstance->render_viewing($exporting);
if ($exporting) {
// Blocks with toolbars will export with their info withing the block itself instead
$classname = generate_class_name('blocktype', $blockinstance->get('blocktype'));
$instanceinfo = call_static_method(
$classname,
'get_instance_toolbars',
$blockinstance
);
foreach($instanceinfo as $info) {
if (is_array($info)) {
if (isset($info['buttons'])) {
$result .= $info['buttons'];
}
if (isset($info['toolbarhtml'])) {
$result .= $info['toolbarhtml'];
}
}
else if (is_string($info)) {
$result .= $info;
}
}
}
$blockcontent .= $result;
}
}
......
......@@ -7,8 +7,8 @@
{/if}
{if $updated} <updated>{$updated}</updated>{/if}
{if $created} <published>{$created}</published>{/if}
{if $summary} <summary{if $summarytype != 'text'} type="{$summarytype}"{/if}>{if $summarytype == 'xhtml'}<div xmlns="http://www.w3.org/1999/xhtml">{/if}{if $summarytype == 'xhtml'}{$summary|clean_html:true|export_leap_rewrite_links|safe}{elseif $summarytype == 'html'}{$summary|clean_html|export_leap_rewrite_links}{else}{$summary}{/if}{if $summarytype == 'xhtml'}</div>{/if}</summary>{/if}
<content{if $contenttype != 'text' && $contenttype != ''} type="{$contenttype}"{/if}>{if $contenttype == 'xhtml'}<div xmlns="http://www.w3.org/1999/xhtml">{/if}{if $contenttype == 'xhtml'}{$content|clean_html:true|export_leap_rewrite_links|safe}{elseif $contenttype == 'html'}{$content|clean_html|export_leap_rewrite_links}{else}{$content}{/if}{if $contenttype == 'xhtml'}</div>{/if}</content>
{if $summary} <summary{if $summarytype != 'text'} type="{$summarytype}"{/if}>{if $summarytype == 'xhtml'}<div xmlns="http://www.w3.org/1999/xhtml">{/if}{if $summarytype == 'xhtml'}{$summary|export_leap_rewrite_links|safe}{elseif $summarytype == 'html'}{$summary|export_leap_rewrite_links}{else}{$summary}{/if}{if $summarytype == 'xhtml'}</div>{/if}</summary>{/if}
<content{if $contenttype != 'text' && $contenttype != ''} type="{$contenttype}"{/if}>{if $contenttype == 'xhtml'}<div xmlns="http://www.w3.org/1999/xhtml">{/if}{if $contenttype == 'xhtml'}{$content|export_leap_rewrite_links|safe}{elseif $contenttype == 'html'}{$content|export_leap_rewrite_links}{else}{$content}{/if}{if $contenttype == 'xhtml'}</div>{/if}</content>
<rdf:type rdf:resource="leap2:{$leaptype}"/>
{if $artefacttype} <mahara:artefactplugin mahara:type="{$artefacttype}" mahara:plugin="{$artefactplugin}"/>{/if}
{include file="export:leap:links.tpl"}
......
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