Commit cea413f5 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge changes from topics 'WR 331987 PDF export', 'WR 324917'

* changes:
  Bug 1762845: HTML export still contains the 'details' / 'add comment' links for blocks on the pages
  Bug 1826284: Allow HTML exports have multiple pages with same name
  Bug 1853069: Combine export options into one export file
parents e4fb8325 4c567b3c
......@@ -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'),
);
}
......
......@@ -96,6 +96,20 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype {
return $html;
}
public static function render_instance_export(BlockInstance $instance, $editing=false, $versioning=false, $exporting=null) {
global $USER;
$view = new View($instance->get('view'));
safe_require('artefact', 'comment');
$commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->view = $instance->get_view();
$feedback = ArtefactTypeComment::get_comments($commentoptions);
$smarty = smarty_core();
$smarty->assign('feedback', $feedback);
$html = $smarty->fetch('blocktype:comment:comment.tpl');
return $html;
}
public static function has_instance_config() {
return false;
}
......
......@@ -787,7 +787,7 @@ class ArtefactTypeComment extends ArtefactType {
$is_export_preview = param_integer('export',0);
// Comment authors can edit recent comments if they're private or if no one has replied yet.
if (!$item->deletedby && $item->isauthor && !$is_export_preview && !$data->versioning
if (!$data->export && !$item->deletedby && $item->isauthor && !$is_export_preview && !$data->versioning
&& ($item->private || $item->id == $lastcomment->id) && $item->ts > $editableafter) {
$item->canedit = 1;
}
......
......@@ -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,28 +24,15 @@ 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");
}
$this->profileviewexported = true;
// We are exporting the profile page so don't need to make a new one
$this->profileviewexported = 'views/' . $view->get('id') . '_' . PluginExportHtml::text_to_filename($view->get('title')) . '/index.html';
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
......
......@@ -50,6 +50,7 @@ interface IPluginBlocktype {
public static function get_categories();
public static function render_instance(BlockInstance $instance, $editing=false, $versioning=false);
public static function render_instance_export(BlockInstance $instance, $editing=false, $versioning=false, $exporting=null);
}
/**
......@@ -93,6 +94,10 @@ abstract class PluginBlocktype extends Plugin implements IPluginBlocktype {
return true;
}
public static function render_instance_export(BlockInstance $instance, $editing=false, $versioning=false, $exporting=null) {
return static::render_instance($instance, $editing, $versioning);
}
/**
* To define a pluginwide configuration
*/
......@@ -1322,6 +1327,14 @@ class BlockInstance {
$content = '';
$smarty->assign('loadbyajax', true);
}
else if ($exporting !== false) {
try {
$content = call_static_method($classname, 'render_instance_export', $this, false, $versioning, $exporting);
}
catch (NotFoundException $e) {
$content = '';
}
}
else {
$smarty->assign('loadbyajax', false);
try {
......
......@@ -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
......
This diff is collapsed.
......@@ -39,11 +39,6 @@ foreach ($exportplugins as $plugin) {
}
$elements = array(
'format' => array(
'type' => 'radio',
'options' => $exportoptions,
'defaultvalue' => 'html',
),
'what' => array(
'type' => 'radio',
'options' => array(
......@@ -172,7 +167,7 @@ function export_submit(Pieform $form, $values) {
}
}
if ($values['format'] == 'leap' && get_config('exporttoqueue') == 1) {
if (get_config('exporttoqueue') == 1) {
// insert into the export_queue;
require_once(get_config('docroot') . 'export/lib.php');
$objectarray = array();
......@@ -194,7 +189,6 @@ function export_submit(Pieform $form, $values) {
}
else {
$exportdata = array(
'format' => $values['format'],
'what' => $values['what'],
'views' => $views,
'includefeedback' => $values['includefeedback'],
......@@ -212,6 +206,6 @@ $smarty = smarty(
$jsfiles
);
setpageicon($smarty, 'icon-upload');
$smarty->assign('pagedescription', get_string('exportportfoliodescription', 'export'));
$smarty->assign('pagedescriptionhtml', get_string('exportportfoliodescription1', 'export'));
$smarty->assign('form', $form);
$smarty->display('form.tpl');
......@@ -47,7 +47,7 @@ class PluginExportLeap extends PluginExport {
/**
* attachment directory for files
*/
protected $filedir = 'files/';
protected $filedir = 'export_info/files/';
/**
* name of resultant zipfile
......@@ -72,7 +72,7 @@ class PluginExportLeap extends PluginExport {
public function __construct(User $user, $views, $artefacts, $progresshandler=null) {
parent::__construct($user, $views, $artefacts, $progresshandler);
$this->smarty = smarty_core();
$this->exporttype = 'leap';
if (!check_dir_exists($this->exportdir . '/' . $this->filedir)) {
throw new SystemException("Couldn't create the temporary export directory $this->exportdir");
}
......@@ -119,9 +119,11 @@ class PluginExportLeap extends PluginExport {
}
/**
* main export routine
*/
public function export() {
* 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($createarchive=false) {
global $SESSION;
// the xml stuff
$this->export_header();
......@@ -169,11 +171,30 @@ class PluginExportLeap extends PluginExport {
foreach ($this->attachments as $id => $fileinfo) {
$existingfile = $fileinfo->file;
$desiredname = $fileinfo->name;
if (!is_file($existingfile) || !copy($existingfile, $this->exportdir . $this->filedir . $id . '-' . $desiredname)) {
if (!is_file($existingfile) || !copy($existingfile, $this->exportdir . $this->filedir . $desiredname)) {
$SESSION->add_error_msg(get_string('couldnotcopyattachment', 'export', $desiredname));
}
}
return true;
if (!$createarchive) {
return array(
'exportdir' => $this->exportdir,
'dirs' => array(
$this->leapfile,
$this->filedir,
),
);
}
// zip everything up
try {
create_zip_archive($this->exportdir, $this->zipfile, array($this->leapfile, $this->filedir));
}
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() {
......@@ -251,7 +272,7 @@ class PluginExportLeap extends PluginExport {
$i = 0;
foreach ($views as $view) {
$percent = intval($progressstart + ($i++ / $viewcount) * ($progressend - $progressstart));
$this->notify_progress_callback($percent, get_string('exportingviewsprogress', 'export', $i, $viewcount));
$this->notify_progress_callback($percent, get_string('exportingviewsprogressleap', 'export', $i, $viewcount));
$config = $this->rewrite_artefact_ids($view->export_config('leap'));
$this->smarty->assign('title', $config['title']);
......@@ -281,7 +302,7 @@ class PluginExportLeap extends PluginExport {
$this->smarty->assign('contenttype', 'xhtml');
if (!$view->uses_new_layout()) {
if ($viewcontent = self::parse_xhtmlish_content($view->build_rows(false, true), $view->get('id'))) {
if ($viewcontent = self::parse_xhtmlish_content($view->build_rows(false, $this->exporttype), $view->get('id'))) {
$this->smarty->assign('content', clean_html($viewcontent, true));
}
$this->smarty->assign('viewdata', $config['rows']);
......@@ -294,7 +315,7 @@ class PluginExportLeap extends PluginExport {
$this->smarty->assign('layout', $widths);
}
else {
if ($viewblocks = self::parse_xhtmlish_content($view->get_blocks(false, true), $view->get('id'))) {
if ($viewblocks = self::parse_xhtmlish_content($view->get_blocks(false, $this->exporttype), $view->get('id'))) {
$this->smarty->assign('content', clean_html($viewblocks, true));
$this->smarty->assign('blocks', $config['grid']);
}
......@@ -634,7 +655,8 @@ class PluginExportLeap extends PluginExport {
}
$newname = substr(str_replace('/', '_', $newname), 0, 245);
$this->attachments[] = (object)array('file' => $filepath, 'name' => $newname);
return (count($this->attachments) -1) . '-' . $newname;
// return (count($this->attachments) -1) . '-' . $newname;
return $newname;
}
/**
......
......@@ -152,6 +152,12 @@ abstract class PluginExport extends Plugin implements IPluginExport {
*/
public $views = array();
/**
* The exporter type - to allow it to be used as a string variable
*/
public $exporttype;
/**
* Whether the user requested to export comments as well
*/
......@@ -374,6 +380,8 @@ abstract class PluginExport extends Plugin implements IPluginExport {
throw new SystemException("Couldn't create the temporary export directory $this->exportdir");
}
$this->messages = array();
$this->notify_progress_callback(10, 'Setup');
......@@ -930,3 +938,59 @@ function create_zip_archive($exportdir, $filename, $files) {
throw new SystemException('could not open zip file');
}
}
class PluginExportAll extends PluginExport {
protected $htmlexporter;
protected $leapexporter;
protected $exportdir;
protected $zipfile;
public function __construct(User $user, $views, $artefacts, $progresscallback=null) {
safe_require('export', 'html');
safe_require('export', 'leap');
$this->htmlexporter = new PluginExportHtml($user, $views, $artefacts, $progresscallback);
$this->leapexporter = new PluginExportLeap($user, $views, $artefacts, $progresscallback);
$this->exportdir = $this->htmlexporter->get('exportdir');
$this->zipfile = 'mahara-export-user'
. $user->get('id') . '-' . date('Y-m-d_H-i', time()) . '.zip';
}
public function is_diskspace_available() {
return ($this->htmlexporter->is_diskspace_available() && $this->leapexporter->is_diskspace_available());
}
public static function get_title() {}
public static function get_description() {}
public function export() {
$this->htmlexporter->includefeedback = $this->includefeedback;
$this->leapexporter->includefeedback = $this->includefeedback;
$this->notify_progress_callback(0, get_string('startinghtmlexport', 'export'));
try {
$html = $this->htmlexporter->export();
}
catch (SystemException $e) {
throw new SystemException('Failed create html export: ' . $e->getMessage());
}
$this->notify_progress_callback(0, get_string('startingleapexport', 'export'));
try {
$leap = $this->leapexporter->export();
}
catch (SystemException $e) {
throw new SystemException('Failed to create leap2a export: ' . $e->getMessage());
}
$this->notify_progress_callback(95, get_string('creatingzipfile', 'export'));
try {
create_zip_archive($this->exportdir, $this->zipfile, array_merge($html['dirs'], $leap['dirs']));
}
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;
}
}
......@@ -13,6 +13,7 @@ defined('INTERNAL') || die();
$string['allmydata'] = 'All my data';
$string['chooseanexportformat'] = 'Choose an export format';
$string['exportarchivedescription1'] = 'You will receive a ZIP archive that includes the content, which you selected to export, in both HTML and Leap2A. You can view your portfolio in a browser via the index.html file or import the content in another portfolio platform that supports the Leap2A format.';
$string['clicktopreview'] = 'Click to preview';
$string['collectionstoexport'] = 'Collections to export';
$string['creatingzipfile'] = 'Creating zip file';
......@@ -20,6 +21,8 @@ $string['Done'] = 'Done';
$string['Export'] = 'Export';
$string['clickheretodownload'] = 'Click here to download it';
$string['continue'] = 'Continue';
$string['startinghtmlexport'] = 'Starting HTML export';
$string['startingleapexport'] = 'Starting Leap2A export';
$string['exportgeneratedsuccessfully'] = 'Export generated successfully. %sClick here to download it%s';
$string['exportgeneratedsuccessfully1'] = 'Export generated successfully.';
$string['exportgeneratedwitherrors'] = 'Export generated with some errors.';
......@@ -29,8 +32,10 @@ $string['exportingartefactsprogress'] = 'Exporting artefacts: %s/%s';
$string['exportingfooter'] = 'Exporting footer';
$string['exportingviews'] = 'Exporting pages';
$string['exportingcollections'] = 'Exporting collections';
$string['exportingviewsprogress'] = 'Exporting pages: %s/%s';
$string['exportportfoliodescription'] = 'This tool exports all of your portfolio information and pages. It does not export your site settings or any of the content you uploaded or created in groups.';
$string['exportingviewsprogresshtml'] = 'Exporting pages for HTML: %s/%s';
$string['exportingviewsprogressleap'] = 'Exporting pages for Leap2A: %s/%s';
$string['exportportfoliodescription1'] = '<p class="lead">This tool exports all of your portfolio information and pages. It does not export your site settings or any of the content you uploaded or created in groups.
</p><p p class="lead">You can export your personal portfolio content. Your account settings or content uploaded or created in groups are not exported.</p>';
$string['exportyourportfolio'] = 'Export your portfolio';
$string['generateexport'] = 'Generate export';
$string['noexportpluginsenabled'] = 'No export plugins have been enabled by the site administrator, so you are unable to use this feature';
......
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Export your portfolio</h3>
<p>You can export your portfolio to keep your files and content offline. You can create an export at any time and as often as you wish. You have two options for the export:</p>
<p><strong>Standalone HTML website:</strong> A zip file containing a website with your portfolio data is created. You cannot import this into Mahara or another portfolio system again, but it is readable in a standard web browser and you do not need Mahara in order to view it. To view, extract the zip file and click on the index.html file that is in the folder.</p>
<p><strong>Leap2A:</strong> A zip file containing a folder in the Leap2A standard format is created. You can then import this into another Leap2A-compliant system.
<p>You can export your portfolio to keep your files and content offline. You can create an export at any time and as often as you wish. When you export you will recive a zip file containing the following:</p>
<p><strong>Standalone HTML website:</strong> Files containing a website with your portfolio data are created. You cannot import this into Mahara or another portfolio system again, but it is readable in a standard web browser and you do not need Mahara in order to view it. To view, extract the zip file and click on the index.html file that is in the HTML folder.</p>
<p><strong>Leap2A:</strong> A file containing a folder in the Leap2A standard format is created. You can then import this into another Leap2A-compliant system.
</p>
......@@ -2265,28 +2265,6 @@ class View {
}
else {
$result = $blockinstance->render_viewing($exporting, $versioning);
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;
}
}
......
......@@ -34,10 +34,7 @@ function display_artefacts($array, $itemsinrow) {
}
echo $form_tag;
echo '<h2 class="heading">' . get_string('chooseanexportformat', 'export') . '</h2>';
echo '<div class="element form-group" id="exportformat-buttons">';
echo '<div>' . $elements['format']['html'] . '</div>';
echo '</div>';
echo '<p class="lead">' . get_string('exportarchivedescription1', 'export') . '</p>';
echo '<h2 class="heading">' . get_string('whatdoyouwanttoexport', 'export') . '</h2>';
echo '<div class="element form-group" id="whattoexport-buttons">';
echo '<div>'. $elements['what']['html'] . '</div>';
......
<p><a href="{$rootpath}files/file/index.html">Browse your file collection</a></p>
<p><a href="../{$filedir}index.html">Browse your file collection</a></p>
<ul>
<li>{str tag=Files section=artefact.file}: {$filecount}</li>
<li>{str tag=Folders section=artefact.file}: {$foldercount}</li>
......
{if $icon}<div id="profile-icon">{$icon|safe}</div>{/if}
<div id="profile-introduction">{$introduction|clean_html|safe}</div>
<ul id="profile-links">
{if $profileviewexported} <li><a href="files/internal/profilepage.html">{str tag=viewprofilepage section=artefact.internal}</a></li>{/if}
<li><a href="files/internal/index.html">{str tag=viewallprofileinformation section=artefact.internal}</a></li>
{if $profileviewexported}
<li><a href="{$profileviewexported}">{str tag=viewprofilepage section=artefact.internal}</a></li>
{/if}
<li><a href="content/internal/index.html">{str tag=viewallprofileinformation section=artefact.internal}</a></li>
</ul>
<div class="cb"></div>
<p><a href="files/resume/index.html">{str tag=viewyourresume section=artefact.resume}</a></p>
<p><a href="content/resume/index.html">{str tag=viewyourresume section=artefact.resume}</a></p>
......@@ -4,7 +4,7 @@
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<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}">
<link rel="stylesheet" type="text/css" href="{$rootpath}{if !$exportingoneview}HTML/{/if}static/{$sheet}">
{/foreach}
{foreach from=$scripts item=script}
<script type='text/javascript' src='{$scriptspath}{$script}.js'></script>
......@@ -16,10 +16,10 @@
<div class="container">
<div id="logo-area" class="logo-area">
<a class="logo change-to-small" href="https://mahara.org/">
<img src="{$maharalogo}" alt="Mahara">
<img src="{$rootpath}{if !$exportingoneview}HTML/{/if}{$maharalogo}" alt="Mahara">
</a>
<a href="https://mahara.org/" class="logoxs change-to-small-default">
<img src="{$maharalogosmall}" alt="Mahara">
<img src="{$rootpath}{if !$exportingoneview}HTML/{/if}{$maharalogosmall}" alt="Mahara">
</a>
</div>
</div>
......
......@@ -25,7 +25,7 @@ $(function () {
<ul>
<li class="collectionname">{$collectionname}</li>
{foreach from=$collectionmenu item=item}
| <li{if $item.id == $viewid} class="selected"{/if}><a href="{$rootpath}views/{$item.url}">{$item.text}</a></li>
| <li{if $item.id == $viewid} class="selected"{/if}><a href="{$rootpath}HTML/views/{$item.url}">{$item.text}</a></li>
{/foreach}
</ul>
</div>
......
......@@ -4,7 +4,7 @@
{foreach from=$list item=item}
{if $item.views}
{foreach from=$item.views item=view}
<li><a href="views/{$view.folder}/index.html">{$view.title}</a></li>
<li><a href="views/{$item.id}_{$view.folder}/index.html">{$view.title}</a></li>
{/foreach}
{else}
<li><a href="views/{$item.folder}/index.html">{$item.title}</a></li>
......
......@@ -26,10 +26,9 @@ And the following "collections" exist:
| Collection UserA_02 | Collection 02 | user | UserA | Page UserA_02 |
| Collection UserA_03 | Collection 02 | user | UserA | Page UserA_03 |
Scenario: Export collections in bulk as HTML
Scenario: Export collections in bulk
Given I log in as "UserA" with password "Kupuh1pa!"
And I choose "Export" in "Manage" from main menu
# this tests the page default option "Standalone HTML website"
When I select the radio "Just some of my collections"
Then I should see "Select all"
Then I should see "Reverse selection"
......@@ -44,23 +43,6 @@ Scenario: Export collections in bulk as HTML
When I click on "Generate export"
Then I should see "You must select at least one collection to export"
And I should see "There was an error with submitting this form. Please check the marked fields and try again."
Scenario: Export collections in bulk as Leap2A
Given I log in as "UserA" with password "Kupuh1pa!"
And I choose "Export" in "Manage" from main menu
# this tests the Leap2A export
When I select the radio "Leap2A"
And I select the radio "Just some of my collections"
Then I should see "Select all"
Then I should see "Reverse selection"
When I follow "selection_all_collections"
Then the "Collection UserA_01" checkbox should be checked
And the "Collection UserA_02" checkbox should be checked
And the "Collection UserA_03" checkbox should be checked
When I follow "selection_reverse_collections"
Then the "Collection UserA_01" checkbox should not be checked
And the "Collection UserA_02" checkbox should not be checked
And the "Collection UserA_03" checkbox should not be checked
When I follow "selection_all_collections"
Then the "Collection UserA_01" checkbox should be checked