Commit e6b6ecf9 authored by Lisa Seeto's avatar Lisa Seeto

Bug 1827811: Exports task

This change creates the modals for exported html pages.
Modals are hard-coded onto page with id's of modal_[artefactid]
Bootstrap and jquery files are copied into export js folder.
Profile page is also exported with any modal content.
Add tagged posts modals
get rid of export warning when no $commentcount set in viewposts.tpl
Add recent posts modals so that first journal post was also a modal
Set Parent journal link text to plain text for exports
Add entire resume modals and one resume field modals
Add File(s) to download modals
refactor export_artefact_metadata_modals
add metadata but not comments to resume page
add metata (license info) but not comments to journal pages
add comment count default to 0 in .tpl's if comment count not present (during export)
remove updating comments modals for profile page as this is no longer needed.

Change-Id: Iff50138285951a4f9a1573423f4f74feba97886f
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 1885a18d
......@@ -37,6 +37,7 @@ class HtmlExportBlog extends HtmlExportArtefactPlugin {
public function get_summary() {
$smarty = $this->exporter->get_smarty();
$blogs = array();
foreach ($this->exporter->get('artefacts') as $artefact) {
if ($artefact->get('artefacttype') == 'blog') {
$blogs[] = array(
......
......@@ -2492,7 +2492,7 @@ class ArtefactTypeImage extends ArtefactTypeFile {
$smarty->assign('title', $this->get('title'));
$smarty->assign('description', $this->get('description'));
$smarty->assign('downloadpath', $downloadpath);
$smarty->assign('metadataurl', $metadataurl);
// $smarty->assign('metadataurl', $metadataurl);
return array('html' => $smarty->fetch('artefact:file:image_render_self.tpl'), 'javascript' => '');
}
$result = parent::render_self($options);
......
......@@ -106,8 +106,7 @@ class PluginBlocktypePlans extends MaharaCoreBlocktype {
$configdata['versioning'] = $versioning;
ArtefactTypeTask::render_tasks($tasks, $template, $configdata, $pagination, $editing, $versioning);
if (($exporter || $versioning) && $tasks['count'] > $tasks['limit']) {
$artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $planid
. '&view=' . $instance->get('view');
$artefacturl = get_config('wwwroot') . 'view/view.php?id=' . $instance->get('view') .'&modal=1&artefact=' . $planid;
$tasks['pagination'] = '<a href="' . $artefacturl . '">' . get_string('alltasks', 'artefact.plans') . '</a>';
}
if ($versioning) {
......
......@@ -29,6 +29,17 @@ class HtmlExportResume extends HtmlExportArtefactPlugin {
array('text' => get_string('resume', 'artefact.resume'), 'path' => 'index.html'),
));
$attachmentids = array();
$exportedmodals = '';
$options = array(
'details' => true,
'metadata' => 1,
'modal' => true,
);
require_once(get_config('docroot') . 'export/html/lib.php');
$rootpath = '../../';
$outputfilter = new HtmlExportOutputFilter($rootpath, $this->exporter);
if ($artefacts = get_column_sql("SELECT id
FROM {artefact}
WHERE \"owner\" = ?
......@@ -38,10 +49,33 @@ class HtmlExportResume extends HtmlExportArtefactPlugin {
foreach ($artefacts as $id) {
$artefact = artefact_instance_from_id($id);
$rendered = $artefact->render_self(array());
$attachments = $artefact->get_attachments();
if (!empty($attachments)) {
foreach ($attachments as $file) {
if (!in_array($file->{'id'}, $attachmentids)) {
array_push($attachmentids, $file->{'id'});
$html = '';
$a = artefact_instance_from_id($file->{'id'});
$modalcontent = $a->render_self($options);
if (!empty($modalcontent['javascript'])) {
$html = '<script>' . $modalcontent['javascript'] . '</script>';
}
$html .= $modalcontent['html'];
$smarty->assign('artefactid', $file->{'id'});
$smarty->assign('content', $html);
$smarty->assign('title', $a->get('title'));
$exportedmodals .= $smarty->fetch('export:html:modal.tpl');
}
}
}
$content = $outputfilter->filter($rendered['html']);
$smarty->assign($artefact->get('artefacttype'), $rendered['html']);
}
}
$content = $smarty->fetch('export:html/resume:index.tpl');
$exportedmodals = $outputfilter->filter($exportedmodals);
$content .= $exportedmodals;
if (false === file_put_contents($this->fileroot . 'index.html', $content)) {
throw new SystemException("Unable to create index.html for resume");
......
This diff is collapsed.
......@@ -46,7 +46,7 @@ jQuery(function($) {
}
else {
// Open form here even though it's currently empty (its quicker)
newblock.find('.modal-title').html(get_string('loading'));
newblock.find('.modal-title').html('loading');
if (replaceContent) {
contentArea.html(content);
......
function modal_handler(e) {
var modal = $('#' + e.target.attributes.getNamedItem('data-target').value);
modal.addClass('active').removeClass('closed');
$(modal).find('.deletebutton').on('click', function(e) {
modal.addClass('closed').removeClass('active');
dock.hide();
});
$('.feedbacktable .list-group-lite').addClass('fullwidth');
}
jQuery(function($) {
"use strict";
$('[data-target="#configureblock"]').each(function(i, obj) {
$(obj).attr('data-target', 'modal_' + $(obj).attr('data-artefactid'));
});
var deletebutton = $('#configureblock').find('.deletebutton');
$('.commentlink').on('click', function(e){
modal_handler(e);
});
$('.modal_link').on('click', function(e){
modal_handler(e);
});
});
......@@ -2,7 +2,7 @@
<div class="image">
{if !$editing}
<a class="modal_link" data-toggle="modal-docked" data-target="#configureblock" href="#" >
<img src="{$src}" alt="{$description}" itemprop="contentURL" data-blockid="{$blockid}" data-artefactid="{$artefactid}">
<img src="{$src}" alt="{$description}" itemprop="contentURL" data-blockid="{$blockid}" data-artefactid="{$artefactid}" data-target="#configureblock">
</a>
{else}
<img src="{$src}" alt="{$description}" itemprop="contentURL">
......
......@@ -4,6 +4,6 @@
</a>
<p>{$description}</p>
<div>
<a href="{$metadataurl}">{str tag=Details section=artefact.file}</a>
<!-- <a href="{$metadataurl}">{str tag=Details section=artefact.file}</a> -->
</div>
</div>
......@@ -5,6 +5,9 @@
<title>{str tag=usersportfolio section=export.html args=$user|full_name|escape}</title>
{foreach from=$stylesheets item=sheet}
<link rel="stylesheet" type="text/css" href="{$rootpath}static/{$sheet}">
{/foreach}
{foreach from=$scripts item=script}
<script type='text/javascript' src='{$scriptspath}{$script}.js'></script>
{/foreach}
</head>
<body>
......
<div class="modal modal-shown modal-docked-right modal-docked closed blockinstance configure" id="modal_{$artefactid}" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content" data-height=".modal-body">
<div class="modal-header">
<button class="deletebutton close" name="close_configuration">
<span class="times">&times;</span>
<span class="sr-only">{str tag=closeconfiguration section=view}</span>
</button>
<h4 class="modal-title text-inline">{$title}</h4>
</div>
<div class="modal-body blockinstance-content">
{$content|safe}
</div>
</div>
</div>
</div>
......@@ -7,7 +7,6 @@
<span class="sr-only">{str tag=closeconfiguration section=view}</span>
</button>
<h4 class="modal-title blockinstance-header text-inline"></h4>
<span class="icon icon-cogs icon-2x float-right" role="presentation" aria-hidden="true"></span>
</div>
<div id="modal_messages"></div>
<div class="modal-body blockinstance-content">
......
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