Commit 87505fa1 authored by Penny Leach's avatar Penny Leach
Browse files

leap2a updates: change the exporter to use links with enclosure



for enclosed files, rather than content src="" which is deprecated
Signed-off-by: default avatarPenny Leach <penny@mjollnir.org>
parent 200ee40e
......@@ -53,11 +53,11 @@ class LeapExportElementFile extends LeapExportElement {
public function assign_smarty_vars() {
parent::assign_smarty_vars();
$this->smarty->assign('summary', $this->artefact->get('description'));
$this->smarty->assign('contentsrc', $this->exporter->get('filedir') . $this->filename);
}
public function add_attachments() {
$this->filename = $this->exporter->add_attachment($this->artefact->get_path(), $this->artefact->get('title'));
$this->add_enclosure_link($this->filename);
}
public function get_content_type() {
......
......@@ -491,7 +491,7 @@ class PluginExportLeap extends PluginExport {
* @param string $filepath path to file to add
* @param string $newname proper resulting filename
*
* @return filename string use this to substitute into <content src="">
* @return filename string use this to pass to add_enclosure_link
*/
public function add_attachment($filepath, $newname) {
if (!file_exists($filepath)) {
......@@ -726,7 +726,7 @@ class LeapExportElement {
}
if ($attachments = $this->exporter->artefact_attachment_links($id)) {
foreach ($attachments as $a) {
$this->add_artefact_link($a, 'enclosure');
$this->add_artefact_link($a, 'related');
}
}
if ($views = $this->exporter->artefact_view_links($id)) {
......@@ -745,6 +745,22 @@ class LeapExportElement {
}
}
/**
* add an enclosure link to the export
* for where we previously used the src attribute of the content tag.
* this does not attach the file to the expot, you have to use the
* {@link add_attachment} method on the exporter object.
*
* @param string $filename the relative path of the file.
*/
public function add_enclosure_link($filename) {
$this->links[$filename] = (object)array(
'id' => $filename,
'type' => 'enclosure',
'file' => true
);
}
/**
* Path to main entry template.
* this can be overridden per artefact plugin... eg
......
......@@ -9,7 +9,7 @@
{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'} type="{$contenttype}"{/if}{if $contentsrc} src="{$contentsrc}"{/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>
<content{if $contenttype != 'text'} type="{$contenttype}"{/if}{/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>
<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