Commit 55406f5a authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon
Browse files

Bug 1853069: Combine export options into one export file



- create class PluginExportAll to unify html, leap2a exports
- alter HTML and Leap2a exports to use updated zip archive file structure
- alter export page info descriptions, progress notifications
- add get_rooth_path()

behatnotneeded

Change-Id: I21c5c5dcd71bdc7e748814b81f6b1f4f4adf1054
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent fa46b9e6
......@@ -146,7 +146,7 @@ function bulkexport_submit(Pieform $form, $values) {
$exporter = new PluginExportLeap($user, PluginExport::EXPORT_ALL_VIEWS_COLLECTIONS, PluginExport::EXPORT_ALL_ARTEFACTS);
}
try {
$exporter->export();
$exporter->export(true);
$zipfile = $exporter->export_compress();
}
catch (Exception $e) {
......
......@@ -41,7 +41,7 @@ class HtmlExportBlog extends HtmlExportArtefactPlugin {
foreach ($this->exporter->get('artefacts') as $artefact) {
if ($artefact->get('artefacttype') == 'blog') {
$blogs[] = array(
'link' => 'files/blog/' . PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename($artefact->get('title'))) . '/index.html',
'link' => 'content/blog/' . PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename($artefact->get('title'))) . '/index.html',
'title' => $artefact->get('title'),
);
}
......
......@@ -84,6 +84,8 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
$smarty->assign('filecount', count(array_filter($this->artefactdata, function($a) { return $a->get("artefacttype") != "folder"; })));
$smarty->assign('foldercount', count(array_filter($this->artefactdata, function($a) { return $a->get("artefacttype") == "folder"; })));
$smarty->assign('spaceused', $this->exporter->get('user')->get('quotaused'));
$smarty->assign('exportdir', $this->exporter->get('exportdir'));
$smarty->assign('filedir', $this->exporter->get('filedir'));
return array(
'title' => get_string('Files', 'artefact.file'),
......@@ -151,7 +153,7 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
}
else {
$artefact = artefact_instance_from_id($artefactid);
if (!$artefact->get_path() || !copy($artefact->get_path(), $filesystemdirectory . PluginExportHtml::sanitise_path($artefact->get('title')))) {
if (!$artefact->get_path() || !copy($artefact->get_path(), $filesystemdirectory . PluginExportHtml::sanitise_path($artefactid . '-' . $artefact->get('title')))) {
$SESSION->add_error_msg(get_string('nonexistentfile', 'export', $artefact->get('title')));
}
}
......@@ -186,6 +188,7 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
$smarty->assign('files', $this->prepare_artefacts_for_smarty($id, false));
$content = $smarty->fetch('export:html/file:index.tpl');
if (false === file_put_contents($filesystemdirectory . 'index.html', $content)) {
throw new SystemException("Unable to create index.html for directory $id");
}
......@@ -213,11 +216,15 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
if ($artefact->get('artefacttype') != 'folder') {
$size = $artefact->get('size');
$size = ($size) ? display_size($size) : '';
$path = PluginExportHtml::sanitise_path($artefact->get('id') . '-' . $artefact->get('title'));
}
else {
$path = PluginExportHtml::sanitise_path($artefact->get('title'));
}
$data[] = array(
'icon' => '',
'title' => $artefact->get('title'),
'path' => PluginExportHtml::sanitise_path($artefact->get('title')),
'path' => $path,
'description' => $artefact->get('description'),
'size' => $size,
'date' => strftime(get_string('strftimedaydatetime'), $artefact->get('ctime')),
......
......@@ -40,7 +40,7 @@ class LeapExportElementFile extends LeapExportElement {
}
public function add_attachments() {
$this->filename = $this->exporter->add_attachment($this->artefact->get_path(), $this->artefact->get('title'));
$this->filename = $this->exporter->add_attachment($this->artefact->get_path(), $this->artefact->get('id') . '-' . $this->artefact->get('title'));
$this->add_enclosure_link($this->filename, $this->get_content_type());
}
......
......@@ -14,6 +14,7 @@ defined('INTERNAL') || die();
class HtmlExportInternal extends HtmlExportArtefactPlugin {
private $profileviewexported = false;
protected $rootpath = '../../../';
public function dump_export_data() {
if (($this->exporter->get('viewexportmode') == PluginExport::EXPORT_LIST_OF_VIEWS
......@@ -23,27 +24,14 @@ class HtmlExportInternal extends HtmlExportArtefactPlugin {
return;
}
$smarty = $this->exporter->get_smarty('../../', 'internal');
$smarty = $this->exporter->get_smarty($this->rootpath, 'internal');
$smarty->assign('page_heading', get_string('profilepage', 'artefact.internal'));
// Profile page
$profileviewid = $this->exporter->get('user')->get_profile_view()->get('id');
foreach ($this->exporter->get('views') as $viewid => $view) {
if ($profileviewid == $viewid) {
$smarty->assign('breadcrumbs', array(array('text' => 'Profile page', 'path' => 'profilepage.html')));
$view = $this->exporter->get('user')->get_profile_view();
$outputfilter = new HtmlExportOutputFilter('../../', $this->exporter);
if (!$view->uses_new_layout()) {
$smarty->assign('view', $outputfilter->filter($view->build_rows(false, true)));
}
else {
$smarty->assign('newlayout', true);
$smarty->assign('blocks', $view->get_blocks(false, true));
}
$content = $smarty->fetch('export:html/internal:profilepage.tpl');
if (!file_put_contents($this->fileroot . 'profilepage.html', $content)) {
throw new SystemException("Unable to write profile page");
}
// We are exporting the profile page so don't need to make a new one
$this->profileviewexported = true;
break;
}
......
......@@ -37,7 +37,7 @@ class HtmlExportPlans extends HtmlExportArtefactPlugin {
foreach ($this->exporter->get('artefacts') as $artefact) {
if ($artefact instanceof ArtefactTypePlan) {
$plans[] = array(
'link' => 'files/plans/' . PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename($artefact->get('title'))) . '/index.html',
'link' => 'content/plans/' . PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename($artefact->get('title'))) . '/index.html',
'title' => $artefact->get('title'),
);
}
......
......@@ -23,7 +23,8 @@ class HtmlExportResume extends HtmlExportArtefactPlugin {
// Dont' care about resume in this case
return;
}
$smarty = $this->exporter->get_smarty('../../', 'resume');
$rootpath = $this->exporter->get_root_path(3);
$smarty = $this->exporter->get_smarty($rootpath, 'resume');
$smarty->assign('page_heading', get_string('resumeofuser', 'artefact.resume', full_name($this->exporter->get('user'))));
$smarty->assign('breadcrumbs', array(
array('text' => get_string('resume', 'artefact.resume'), 'path' => 'index.html'),
......@@ -37,7 +38,6 @@ class HtmlExportResume extends HtmlExportArtefactPlugin {
'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
......
......@@ -12,6 +12,7 @@
define('INTERNAL', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('docroot') . '/lib/htmloutput.php');
require_once(get_config('docroot') . 'export/lib.php');
// Download the export file if it's been generated
$downloadfile = param_variable('file', null);
......@@ -62,46 +63,48 @@ function export_iframe_progress_handler($percent, $status) {
// Bail if we don't have enough data to do an export
if (!isset($exportdata['format'])
|| !isset($exportdata['what'])
if (!isset($exportdata['what'])
|| !isset($exportdata['views'])) {
export_iframe_die(get_string('unabletogenerateexport', 'export'));
exit;
}
safe_require('export', $exportdata['format']);
$exportplugins = plugins_installed('export');
foreach ($exportplugins as $plugin) {
safe_require('export', $plugin->name);
}
$user = new User();
$user->find_by_id($USER->get('id'));
$class = generate_class_name('export', $exportdata['format']);
switch($exportdata['what']) {
case 'all':
$exporter = new $class($user, PluginExport::EXPORT_ALL_VIEWS_COLLECTIONS, PluginExport::EXPORT_ALL_ARTEFACTS, 'export_iframe_progress_handler');
$exporter = new PluginExportAll($user, PluginExport::EXPORT_ALL_VIEWS_COLLECTIONS, PluginExport::EXPORT_ALL_ARTEFACTS, 'export_iframe_progress_handler');
break;
case 'views':
$exporter = new $class($user, $exportdata['views'], PluginExport::EXPORT_ARTEFACTS_FOR_VIEWS, 'export_iframe_progress_handler');
$exporter = new PluginExportAll($user, $exportdata['views'], PluginExport::EXPORT_ARTEFACTS_FOR_VIEWS, 'export_iframe_progress_handler');
break;
case 'collections':
$exporter = new $class($user, $exportdata['views'], PluginExport::EXPORT_LIST_OF_COLLECTIONS, 'export_iframe_progress_handler');
$exporter = new PluginExportAll($user, $exportdata['views'], PluginExport::EXPORT_LIST_OF_COLLECTIONS, 'export_iframe_progress_handler');
break;
default:
export_iframe_die(get_string('unabletoexportportfoliousingoptions', 'export'));
}
$exporter->includefeedback = $exportdata['includefeedback'];
// Get an estimate of how big the unzipped export file would be
// so we can check that we have enough disk space for it
$space = $exporter->is_diskspace_available();
$space = ($exporter->is_diskspace_available());
if (!$space) {
export_iframe_die(get_string('exportfiletoobig', 'mahara'), get_config('wwwroot') . 'view/index.php');
}
try {
$exporter->export();
$zipfile = $exporter->export_compress();
$zipfile = $exporter->export();
}
catch (SystemException $e) {
export_iframe_die($e->getMessage(), get_config('wwwroot') . 'view/index.php');
throw new SystemException('Failed to zip the export file: ' . $e->getMessage());
}
// Store the filename in the session, and redirect the iframe to it to trigger
......
......@@ -22,11 +22,22 @@ class PluginExportHtml extends PluginExport {
protected $zipfile;
/**
* The name of the directory under which all the other directories and
* files will be placed in the export
* The name of the directory under which all the other directories
* will be placed in the export
*/
protected $rootdir;
/**
* The name of the directory under which shared folders such as files will
* be placed in the export
**/
protected $infodir = 'export_info';
/**
* The name of the directory where files will be placed in the export
**/
protected $filedir = 'export_info/files/';
/**
* List of directories of static files provided by artefact plugins
*/
......@@ -60,17 +71,24 @@ class PluginExportHtml extends PluginExport {
public function __construct(User $user, $views, $artefacts, $progresscallback=null) {
global $THEME;
parent::__construct($user, $views, $artefacts, $progresscallback);
$this->rootdir = 'portfolio-for-' . self::text_to_filename($user->get('username'));
$this->rootdir = 'HTML';
// Create basic required directories
foreach (array('files', 'views', 'static', 'static/profileicons') as $directory) {
foreach (array('views', 'static', 'static/profileicons') as $directory) {
$directory = "{$this->exportdir}/{$this->rootdir}/{$directory}/";
if (!check_dir_exists($directory)) {
throw new SystemException("Couldn't create the temporary export directory $directory");
}
}
$this->zipfile = 'mahara-export-html-user'
. $this->get('user')->get('id') . '-' . $this->exporttime . '.zip';
$directory = "{$this->exportdir}{$this->filedir}";
if (!check_dir_exists($directory)) {
throw new SystemException("Couldn't create the attachment export directory $directory");
}
$this->zipfile = 'mahara-export-user'
. $this->get('user')->get('id') . '-' . date('Y-m-d_H-i', $this->exporttime) . '.zip';
// Find what stylesheets need to be included
$themedirs = $THEME->get_path('', true);
......@@ -125,10 +143,26 @@ class PluginExportHtml extends PluginExport {
return true; // need to create a check here
}
public function get_root_path($depth=1, $type=null) {
$parent = str_repeat('../', $depth);
if ($this->exportingoneview && $type) {
return $parent . $this->get('infodir') . '/' . $type . '/';
}
else if ($this->exportingoneview) {
return $parent . 'HTML/';
}
else if ($type) {
return $parent . $type;
}
return $parent;
}
/**
* Main export routine
* @param $createarchive Boolean specifies whether a zipfile will be created here
* or later on, i.e. in PluginExportAll which creates a zipfile of all export formats.
*/
public function export() {
public function export($createarchive=false) {
global $THEME, $SESSION;
raise_memory_limit('128M');
......@@ -234,7 +268,8 @@ class PluginExportHtml extends PluginExport {
$copyproxy = HtmlExportCopyProxy::singleton();
$copydata = $copyproxy->get_copy_data();
foreach ($copydata as $from => $to) {
$to = $this->get('exportdir') . '/' . $this->get('rootdir') . $to;
$to = ltrim($to, './');
$to = $this->get('exportdir') . $to;
if (!check_dir_exists(dirname($to))) {
$SESSION->add_error_msg(get_string('couldnotcreatedirectory', 'export', $to));
}
......@@ -242,7 +277,25 @@ class PluginExportHtml extends PluginExport {
$SESSION->add_error_msg(get_string('couldnotcopystaticfile', 'export', $from));
}
}
return true;
if (!$createarchive) {
return array(
'exportdir' => $this->exportdir,
'zipfile' => $this->zipfile,
'dirs' => array($this->rootdir, $this->infodir),
);
}
// zip everything up
$this->notify_progress_callback(90, get_string('creatingzipfile', 'export'));
try {
create_zip_archive($this->exportdir, $this->zipfile, array($this->rootdir));
}
catch (SystemException $e) {
throw new SystemException('Failed to zip the export file: ' . $e->getMessage());
}
$this->notify_progress_callback(100, get_string('Done', 'export'));
return $this->zipfile;
}
public function cleanup() {
......@@ -265,8 +318,15 @@ class PluginExportHtml extends PluginExport {
$smarty->assign('sitename', get_config('sitename'));
$smarty->assign('stylesheets', $stylesheets);
$smarty->assign('scripts', $this->scripts);
$smarty->assign('scriptspath', $rootpath . $this->theme_path('js/'));
$smarty->assign('maharalogo', $rootpath . $this->theme_path('images/site-logo.png'));
if ($this->exportingoneview) {
$smarty->assign('scriptspath', $rootpath . $this->theme_path('js/'));
}
else {
$smarty->assign('scriptspath', $rootpath . 'HTML/' . $this->theme_path('js/'));
}
$smarty->assign('maharalogo', $this->theme_path('images/site-logo.png'));
$smarty->assign('maharalogosmall', $this->theme_path('images/site-logo-small.png'));
$smarty->assign('exportingoneview', $this->exportingoneview);
return $smarty;
}
......@@ -326,7 +386,7 @@ class PluginExportHtml extends PluginExport {
private function build_index_page($summaries) {
$smarty = $this->get_smarty();
$smarty = $this->get_smarty($this->get_root_path());
$smarty->assign('page_heading', full_name($this->get('user')));
$smarty->assign('summaries', $summaries);
$content = $smarty->fetch('export:html:index.tpl');
......@@ -360,17 +420,17 @@ class PluginExportHtml extends PluginExport {
$progressend = 75;
$i = 0;
$viewcount = count($this->views);
$rootpath = ($this->exportingoneview) ? './' : '../../';
$rootpath = ($this->exportingoneview) ? $this->get_root_path() : $this->get_root_path(3);
$smarty = $this->get_smarty($rootpath);
foreach ($this->views as $viewid => $view) {
$this->notify_progress_callback(intval($progressstart + (++$i / $viewcount) * ($progressend - $progressstart)), get_string('exportingviewsprogress', 'export', $i, $viewcount));
$this->notify_progress_callback(intval($progressstart + (++$i / $viewcount) * ($progressend - $progressstart)), get_string('exportingviewsprogresshtml', 'export', $i, $viewcount));
$smarty->assign('page_heading', $view->get('title'));
$smarty->assign('viewdescription', $view->get('description'));
$smarty->assign('viewinstructions', $view->get('instructions'));
if ($this->exportingoneview) {
$smarty->assign('nobreadcrumbs', true);
$directory = $this->exportdir . '/' . $this->rootdir;
$directory = $this->exportdir . '/' . $this->rootdir . '/';
}
else {
$smarty->assign('breadcrumbs', array(
......@@ -413,8 +473,12 @@ class PluginExportHtml extends PluginExport {
}
else {
$blocks = $view->get_blocks(false, true);
if ($blocks && isset($blocks[0]['content'])) {
$blocks[0]['content'] = $outputfilter->filter($blocks[0]['content']);
if ($blocks) {
foreach ($blocks as $bk => $bv) {
if (isset($blocks[$bk]['content'])) {
$blocks[$bk]['content'] = $outputfilter->filter($blocks[$bk]['content']);
}
}
}
$smarty->assign('newlayout', true);
$smarty->assign('blocks', $blocks);
......@@ -737,7 +801,7 @@ private function get_folder_modals(&$idarray, BlockInstance $bi) {
} #end of foreach block
} #end of if
if (!empty($content)) {
$rootpath = ($this->exportingoneview) ? './' : '../../';
$rootpath = ($this->exportingoneview) ? $this->get_root_path() : $this->get_root_path(3, $this->infodir . '/');
$outputfilter = new HtmlExportOutputFilter($rootpath, $this);
$content = $outputfilter->filter($content);
......@@ -820,7 +884,6 @@ private function get_folder_modals(&$idarray, BlockInstance $bi) {
$SESSION->add_error_msg(get_string('couldnotcopyfilesfromto', 'export', $from, $to));
}
}
}
}
......@@ -832,12 +895,22 @@ abstract class HtmlExportArtefactPlugin {
public function __construct(PluginExportHTML $exporter) {
$this->exporter = $exporter;
$pluginname = strtolower(substr(get_class($this), strlen('HtmlExport')));
$this->fileroot = $this->exporter->get('exportdir') . '/' . $this->exporter->get('rootdir') . '/files/' . $pluginname . '/';
if (!check_dir_exists($this->fileroot)) {
throw new SystemException("Could not create the temporary export directory $this->fileroot");
if ($pluginname != 'file') {
$this->fileroot = $this->exporter->get('exportdir') . '/' . $this->exporter->get('rootdir') . '/content/' . $pluginname . '/';
if (!check_dir_exists($this->fileroot)) {
throw new SystemException("Could not create the temporary export directory $this->fileroot");
}
}
else {
$this->fileroot = $this->exporter->get('exportdir') . $this->exporter->get('filedir');
if (!check_dir_exists($this->fileroot)) {
throw new SystemException("Could not create the export directory $this->fileroot");
}
}
$this->extrafileroot = $this->exporter->get('exportdir') . '/' . $this->exporter->get('rootdir') . '/files/extra/';
$this->extrafileroot = $this->exporter->get('exportdir') . $this->exporter->get('filedir') . '/extra/';
if (!check_dir_exists($this->extrafileroot)) {
throw new SystemException("Could not create the temporary export directory $this->extrafileroot");
}
......@@ -861,7 +934,7 @@ abstract class HtmlExportArtefactPlugin {
$options = $this->pagination_data($artefact);
// Render the first page of the artefact (the only one if there aren't many children)
$smarty = $this->exporter->get_smarty('../../../', $artefact->get('artefacttype'));
$smarty = $this->exporter->get_smarty($this->exporter->get_root_path(4), $artefact->get('artefacttype'));
$smarty->assign('page_heading', $artefact->get('title'));
$smarty->assign('breadcrumbs', array(
array('text' => $options['plural']),
......@@ -869,7 +942,7 @@ abstract class HtmlExportArtefactPlugin {
));
$rendered = $artefact->render_self(array('hidetitle' => true));
$outputfilter = new HtmlExportOutputFilter('../../../', $this->exporter);
$outputfilter = new HtmlExportOutputFilter($this->exporter->get_root_path(3), $this->exporter);
$smarty->assign('rendered', $outputfilter->filter($rendered['html']));
$content = $smarty->fetch('export:html:page.tpl');
......@@ -986,7 +1059,6 @@ class HtmlExportOutputFilter {
* @param string $basepath The relative path to the root of the generated export
*/
public function __construct($basepath, &$exporter=null) {
$this->basepath = preg_replace('#/$#', '', $basepath);
$this->htmlexportcopyproxy = HtmlExportCopyProxy::singleton();
$this->exporter = $exporter;
$this->owner = $exporter->get('user')->get('id');
......@@ -1017,13 +1089,20 @@ class HtmlExportOutputFilter {
$html
);
// Links to views
// Links to personal views
$html = preg_replace_callback(
'#' . $wwwroot . 'view/view\.php\?id=(\d+)#',
array($this, 'replace_view_link'),
$html
);
// Links to other views
$html = preg_replace_callback(
'#<a[^>]+href="(' . $wwwroot . ')?/?(group|user)/view\.php\?id=(\d+)?"[^>]*>([\S\s]*?)</a>#',
array($this, 'replace_other_view_link'),
$html
);
// Links to artefacts
$html = preg_replace_callback(
'#<a[^>]+href="(' . $wwwroot . ')?/?view/artefact\.php\?artefact=(\d+)(&amp;view=\d+)?(&amp;offset=\d+)?"[^>]*>([^<]*)</a>#',
......@@ -1104,7 +1183,25 @@ class HtmlExportOutputFilter {
if (!isset($this->viewtitles[$viewid])) {
$this->viewtitles[$viewid] = PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename(get_field('view', 'title', 'id', $viewid)));
}
return $this->basepath . '/views/' . $this->viewtitles[$viewid] . '/index.html';
$filterpath = $this->exporter->get('exportingoneview') ? $this->exporter->get_root_path() : $this->exporter->get_root_path(2) . 'views/';
return $filterpath . $this->viewtitles[$viewid] . '/index.html';
}
/**
* Callback to remove links to group/user views in
* the HTML export
*/
private function replace_other_view_link($matches) {
$viewid = $matches[3];
// If the user view is in this export
if (isset($this->exporter->views[$viewid])) {
if (!isset($this->viewtitles[$viewid])) {
$this->viewtitles[$viewid] = PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename(get_field('view', 'title', 'id', $viewid)));
}
$filterpath = $this->exporter->get('exportingoneview') ? $this->exporter->get_root_path() : $this->exporter->get_root_path(2) . 'views/';
return '<a href="' . $filterpath . $this->viewtitles[$viewid] . '/index.html">' . $matches[4] . '</a>';
}
return $matches[4];
}
/**
......@@ -1121,6 +1218,7 @@ class HtmlExportOutputFilter {
}
$artefacttype = $artefact->get('artefacttype');
$filterpath = $this->exporter->get('exportingoneview') ? $this->exporter->get_root_path(1, $this->exporter->get('filedir')) : $this->exporter->get_root_path(3, $this->exporter->get('filedir'));
switch ($artefacttype) {
case 'blog':
case 'plan':
......@@ -1135,7 +1233,7 @@ class HtmlExportOutputFilter {
case 'archive':
case 'video':
case 'audio':
return '<a href="' . $this->get_export_path_for_file($artefact, array()) . '">' . $matches[5] . '</a>';
return '<a href="' . $this->get_export_path_for_file($artefact, array(), $filterpath) . '">' . $matches[5] . '</a>';
default:
return $matches[5];
}
......@@ -1165,8 +1263,8 @@ class HtmlExportOutputFilter {
list($key, $value) = explode('=', $matches[$i]);
$options[$key] = $value;
}
return $this->get_export_path_for_file($artefact, $options);
$filterpath = $this->exporter->get('exportingoneview') ? $this->exporter->get_root_path(1, $this->exporter->get('filedir')) : $this->exporter->get_root_path(3, $this->exporter->get('filedir'));
return $this->get_export_path_for_file($artefact, $options, $filterpath);
}
private function replace_inner_link($matches) {
......@@ -1194,7 +1292,8 @@ class HtmlExportOutputFilter {
return $this->get_folder_path_for_file($artefact, $options);
}
return $this->get_export_path_for_file($artefact, $options);
$filterpath = $this->exporter->get('exportingoneview') ? $this->exporter->get_root_path(1, $this->exporter->get('filedir')) : $this->exporter->get_root_path(1);
return $this->get_export_path_for_file($artefact, $options, $filterpath);
}
/**
......@@ -1216,7 +1315,8 @@ class HtmlExportOutputFilter {
return '';
}
return $this->get_export_path_for_file($artefact, array());
$filterpath = $this->exporter->get('exportingoneview') ? $this->exporter->get_root_path(1, $this->exporter->get('filedir')) : $this->exporter->get_root_path(1);
return $this->get_export_path_for_file($artefact, array(), $filterpath);
}
/**
......@@ -1260,7 +1360,8 @@ class HtmlExportOutputFilter {
if ($icon->get_plugin_name() != 'file') {
return '';
}
return $this->get_export_path_for_file($icon, $options, '/static/profileicons/');
$rootpath = ($this->exporter->get('exportingoneview')) ? $this->exporter->get_root_path(2) : $this->exporter->get_root_path(3);
return str_replace($rootpath, $rootpath . 'export_info/', $this->get_export_path_for_file($icon, $options, '/static/profileicons/'));
default:
return '';
}
......@@ -1339,10 +1440,7 @@ class HtmlExportOutputFilter {
global $SESSION;
if (is_null($basefolder)) {
if ($file->get('owner') == $this->owner) {
$basefolder = '/files/file/' . $this->get_folder_path_for_file($file);
}
else {
$basefolder = '/files/extra/';
$basefolder = '/files/' . $this->get_folder_path_for_file($file);
}
}
......@@ -1361,9 +1459,7 @@ class HtmlExportOutputFilter {
$this->htmlexportcopyproxy->add($from, $to);
}
else {
if ($basefolder == '/files/extra/') {
$title = $file->get('id') . '-' . $title;
}
$title = $file->get('id') . '-' . $title;
$to = $basefolder . $title;
}
......
......@@ -39,11 +39,6 @@ foreach ($exportplugins as $plugin) {
}
$elements = array(
'format' => array(
'type' => 'radio',
'options' => $exportoptions,