Skip to content

Commit

Permalink
Merge branch 'MDL-63660-master' of git://github.com/junpataleta/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Nov 16, 2018
2 parents ba88292 + 223e1a6 commit 30538dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 37 deletions.
6 changes: 3 additions & 3 deletions admin/tool/dataprivacy/tests/behat/dataexport.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "100000" bytes
And following "Download" should download between "1" and "130000" bytes
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
And I wait "1" seconds
Expand Down Expand Up @@ -81,7 +81,7 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Export all of my personal data" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "100000" bytes
And following "Download" should download between "1" and "130000" bytes

And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
Expand Down Expand Up @@ -118,7 +118,7 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "100000" bytes
And following "Download" should download between "1" and "130000" bytes

And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
Expand Down
32 changes: 4 additions & 28 deletions privacy/classes/local/request/moodle_content_writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,16 +635,9 @@ protected function write_html_data() {
$this->copy_data($moodleimgpath, ['pix', 'moodlelogo.svg']);

// Additional required css.
// Determine what direction to show the data export page according to the user preference.
$rtl = right_to_left();
if (!$rtl) {
$bootstrapdestination = 'bootstrap.min.css';
$this->write_url_content('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
$bootstrapdestination);
} else {
$rtldestination = 'rtlbootstrap.min.css';
$this->write_url_content('https://cdn.rtlcss.com/bootstrap/v4.0.0/css/bootstrap.min.css', $rtldestination);
}
$csspath = ['theme', 'boost', 'style', 'moodle.css'];
$destination = ['moodle.css'];
$this->copy_data($csspath, $destination);

$csspath = ['privacy', 'export_files', 'general.css'];
$destination = ['general.css'];
Expand All @@ -666,6 +659,7 @@ protected function write_html_data() {
$siteurl = $CFG->wwwroot;

// Create custom index.html file.
$rtl = right_to_left();
$htmlpage = new \core_privacy\output\exported_html_page($navigationhtml, $systemname, $fullusername, $rtl, $siteurl);
$outputpage = $output->render_html_page($htmlpage);
$this->write_data('index.html', $outputpage);
Expand Down Expand Up @@ -720,22 +714,4 @@ protected function get_file_content(string $filepath) : String {
}
return $content;
}

/**
* Write url files to the export.
*
* @param string $url Url of the file.
* @param string $path Path to store the file.
*/
protected function write_url_content(string $url, string $path) {
$filepointer = fopen($url, 'r');
$targetpath = $this->path . DIRECTORY_SEPARATOR . $path;
check_dir_exists(dirname($targetpath), true, true);
$status = file_put_contents($targetpath, $filepointer);
if ($status === false) {
// There was an error. Throw an exception to allow the download status to remain as requiring download.
throw new \moodle_exception('Content download was incomplete');
}
$this->files[$path] = $targetpath;
}
}
7 changes: 1 addition & 6 deletions privacy/templates/htmlpage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@
<head>
<meta charset="UTF-8">
<title>Data export</title>
{{^righttoleft}}
<link rel="stylesheet" href="bootstrap.min.css">
{{/righttoleft}}
{{#righttoleft}}
<link rel="stylesheet" href="rtlbootstrap.min.css">
{{/righttoleft}}
<link rel="stylesheet" type="text/css" href="moodle.css" />
<link rel="stylesheet" type="text/css" href="general.css" />
</head>
<body>
Expand Down

0 comments on commit 30538dc

Please sign in to comment.