Permalink
Browse files

MDL-38261 Display workshop submission attachments in a preview mode

  • Loading branch information...
1 parent 8f5cbbd commit 57c1c7edfc6f0cc2f31a6633ee4b29ceef9d0da4 @mudrd8mz mudrd8mz committed Feb 28, 2013
Showing with 9 additions and 1 deletion.
  1. +2 −1 mod/workshop/renderer.php
  2. +7 −0 mod/workshop/styles.css
View
3 mod/workshop/renderer.php
@@ -799,6 +799,7 @@ protected function helper_submission_attachments($submissionid, $format = 'html'
$filename = $file->get_filename();
$fileurl = file_encode_url($CFG->wwwroot . '/pluginfile.php',
'/' . $ctx->id . '/mod_workshop/submission_attachment/' . $submissionid . $filepath . $filename, true);
+ $embedurl = new moodle_url($fileurl, array('preview' => 'bigthumb'));
$type = $file->get_mimetype();
$image = $this->output->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon'));
@@ -807,7 +808,7 @@ protected function helper_submission_attachments($submissionid, $format = 'html'
if ($format == 'html') {
if (file_mimetype_in_typegroup($type, 'web_image')) {
- $preview = html_writer::empty_tag('img', array('src' => $fileurl, 'alt' => '', 'class' => 'preview'));
+ $preview = html_writer::empty_tag('img', array('src' => $embedurl, 'alt' => '', 'class' => 'preview'));
$preview = html_writer::tag('a', $preview, array('href' => $fileurl));
$outputimgs .= $this->output->container($preview);
View
7 mod/workshop/styles.css
@@ -137,6 +137,13 @@
margin-right: 5px;
}
+.path-mod-workshop .submission-full .attachments .images div {
+ display: inline-block;
+ margin: 5px;
+ padding: 5px;
+ border: 1px solid #ddd;
+}
+
/**
* Example submission - summary display
*/

0 comments on commit 57c1c7e

Please sign in to comment.