From 80aff7db49b7b1b7bd5435d4fb864d0fb858a779 Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Wed, 14 Nov 2018 13:38:39 +0000 Subject: [PATCH] MDL-63660 privacy: Include CSS locally for data export --- .../local/request/moodle_content_writer.php | 32 +++------------------- privacy/templates/htmlpage.mustache | 7 +---- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/privacy/classes/local/request/moodle_content_writer.php b/privacy/classes/local/request/moodle_content_writer.php index 8ca2d001068..0d614c0feeb 100644 --- a/privacy/classes/local/request/moodle_content_writer.php +++ b/privacy/classes/local/request/moodle_content_writer.php @@ -635,16 +635,9 @@ class moodle_content_writer implements content_writer { $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']; @@ -666,6 +659,7 @@ class moodle_content_writer implements content_writer { $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); @@ -720,22 +714,4 @@ class moodle_content_writer implements content_writer { } 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; - } } diff --git a/privacy/templates/htmlpage.mustache b/privacy/templates/htmlpage.mustache index 5e4a2724d87..3139ce781a6 100644 --- a/privacy/templates/htmlpage.mustache +++ b/privacy/templates/htmlpage.mustache @@ -49,12 +49,7 @@ Data export - {{^righttoleft}} - - {{/righttoleft}} - {{#righttoleft}} - - {{/righttoleft}} + -- 2.11.4.GIT