Commit 499ee494 authored by Son Nguyen's avatar Son Nguyen
Browse files

Change message in HTML export when pages have duplicated titles



(bug #1025135)

Add new lang string: 'duplicatepagetitle'
Make more room of the progress bar for long messages.
This change does not affect the current responsive themes.
All themes are still responsive after apply this patch.

Change-Id: I920378dda2fe41577ded745bf047db098109964b
Signed-off-by: default avatarSon Nguyen <son.nguyen@catalyst.net.nz>
parent 013a75fd
......@@ -57,8 +57,8 @@ flush();
*
* @param string $message The message to display to the user
*/
function export_iframe_die($message) {
print_export_iframe_die($message);
function export_iframe_die($message, $link=null) {
print_export_iframe_die($message, $link);
exit;
}
......@@ -104,7 +104,7 @@ $exporter->includefeedback = $exportdata['includefeedback'];
try {
$zipfile = $exporter->export();
} catch (SystemException $e) {
export_iframe_die($e->getMessage());
export_iframe_die($e->getMessage(), get_config('wwwroot') . 'view/');
}
// Store the filename in the session, and redirect the iframe to it to trigger
......
......@@ -35,3 +35,4 @@ $string['preparing'] = 'Preparing %s';
$string['exportingdatafor'] = 'Exporting data for %s';
$string['buildingindexpage'] = 'Building index page';
$string['copyingextrafiles'] = 'Copying extra files';
$string['duplicatepagetitle'] = 'Export failed due to duplicate page titles. Please ensure titles are unique.';
......@@ -378,6 +378,9 @@ class PluginExportHtml extends PluginExport {
array('text' => $view->get('title'), 'path' => 'index.html'),
));
$directory = $this->exportdir . '/' . $this->rootdir . '/views/' . self::text_to_filename($view->get('title'));
if (is_dir($directory)) {
throw new SystemException(get_string('duplicatepagetitle', 'export.html'));
}
if (!check_dir_exists($directory)) {
throw new SystemException("Could not create directory for view $viewid");
}
......
......@@ -50,8 +50,12 @@ function print_export_head($stylesheets) {
<?php
}
function print_export_iframe_die($message) {
echo '<div class="progress-bar" style="width: 100%;"><p>' . hsc($message) . '</p></div></body></html>';
function print_export_iframe_die($message, $link=null) {
$message = hsc($message);
if (isset($link)) {
$message .= ' <a target="_top" href="' . hsc($link) . '">' . get_string('continue', 'admin') . '</a>';
}
echo '<div class="progress-bar" style="width: 100%;"><p>' . $message . '</p></div></body></html>';
}
function print_iframe_progress_handler($percent, $status) {
......
......@@ -2462,7 +2462,7 @@ table.secreturls table tr td {
#progress {
border: 1px solid #5b5b5b;
height: 40px;
width: 600px;
width: 650px;
}
div.progress-bar {
position: absolute;
......
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