Merge branch 'wip-MDL-61876-fix' of https://github.com/marinaglancy/moodle
This commit is contained in:
+13
-1
@@ -1084,6 +1084,11 @@ class cm_info implements IteratorAggregate {
|
||||
*/
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $contentisformatted;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@@ -1338,6 +1343,10 @@ class cm_info implements IteratorAggregate {
|
||||
if (empty($this->content)) {
|
||||
return '';
|
||||
}
|
||||
if ($this->contentisformatted) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
// Improve filter performance by preloading filter setttings for all
|
||||
// activities on the course (this does nothing if called multiple
|
||||
// times)
|
||||
@@ -1619,10 +1628,13 @@ class cm_info implements IteratorAggregate {
|
||||
/**
|
||||
* Sets content to display on course view page below link (if present).
|
||||
* @param string $content New content as HTML string (empty string if none)
|
||||
* @param bool $isformatted Whether user content is already passed through format_text/format_string and should not
|
||||
* be formatted again. This can be useful when module adds interactive elements on top of formatted user text.
|
||||
* @return void
|
||||
*/
|
||||
public function set_content($content) {
|
||||
public function set_content($content, $isformatted = false) {
|
||||
$this->content = $content;
|
||||
$this->contentisformatted = $isformatted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -1918,13 +1918,12 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order='
|
||||
}
|
||||
|
||||
// actual replacement of the tags
|
||||
$newtext = preg_replace($patterns, $replacement, $data->asearchtemplate);
|
||||
|
||||
$options = new stdClass();
|
||||
$options->para=false;
|
||||
$options->noclean=true;
|
||||
echo '<tr><td>';
|
||||
echo format_text($newtext, FORMAT_HTML, $options);
|
||||
echo preg_replace($patterns, $replacement, format_text($data->asearchtemplate, FORMAT_HTML, $options));
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '<tr><td colspan="4"><br/>' .
|
||||
|
||||
+1
-1
@@ -470,7 +470,7 @@ function folder_cm_info_view(cm_info $cm) {
|
||||
}
|
||||
// display folder
|
||||
$renderer = $PAGE->get_renderer('mod_folder');
|
||||
$cm->set_content($renderer->display_folder($folder));
|
||||
$cm->set_content($renderer->display_folder($folder), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,14 +134,15 @@ class mod_folder_renderer extends plugin_renderer_base {
|
||||
$filename = $file->get_filename();
|
||||
$url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
|
||||
$file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $filename, false);
|
||||
$filenamedisplay = clean_filename($filename);
|
||||
if (file_extension_in_typegroup($filename, 'web_image')) {
|
||||
$image = $url->out(false, array('preview' => 'tinyicon', 'oid' => $file->get_timemodified()));
|
||||
$image = html_writer::empty_tag('img', array('src' => $image));
|
||||
} else {
|
||||
$image = $this->output->pix_icon(file_file_icon($file, 24), $filename, 'moodle');
|
||||
$image = $this->output->pix_icon(file_file_icon($file, 24), $filenamedisplay, 'moodle');
|
||||
}
|
||||
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')).
|
||||
html_writer::tag('span', $filename, array('class' => 'fp-filename'));
|
||||
html_writer::tag('span', $filenamedisplay, array('class' => 'fp-filename'));
|
||||
$filename = html_writer::tag('span',
|
||||
html_writer::link($url->out(false, array('forcedownload' => 1)), $filename),
|
||||
array('class' => 'fp-filename-icon'));
|
||||
|
||||
+5
-2
@@ -3,8 +3,11 @@ information provided here is intended especially for developers.
|
||||
|
||||
=== 3.5 ===
|
||||
|
||||
Required changes in code:
|
||||
* use new make_backup_temp_directory()
|
||||
* Backup directory now can be outside of temp directory. Use make_backup_temp_directory($name) instead of
|
||||
make_temp_directory('/backup/'.$name)
|
||||
* Modules that provide their own interactive content and call cm_info::set_content() from [MODULENAME]_cm_info_view()
|
||||
callback should format all user input and call set_content() with parameter $isformatted=true . Otherwise
|
||||
scripts will be cleaned on the course page in case of $CFG->forceclean=1. See example in mod_folder.
|
||||
|
||||
=== 3.4 ===
|
||||
|
||||
|
||||
Reference in New Issue
Block a user