From: mjollnir_ Date: Wed, 10 Sep 2008 09:38:04 +0000 (+0000) Subject: MDL-16423 - upload assignment types get mime detection (and fixed earlier related... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0b88fedf8811c6c485f2db8b33d3c2a181b93b7c;p=moodle.git MDL-16423 - upload assignment types get mime detection (and fixed earlier related regression) --- diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index ce62cc3710..38ea4f8b27 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1718,7 +1718,8 @@ class assignment_base { $output .= ''.$icon.''.s($filename).''; if ($this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) { $p['file'] = $file->get_id(); - $output .= portfolio_add_button('assignment_portfolio_caller', $p, null, PORTFOLIO_ADD_ICON_LINK, null, true); + $formats = array(portfolio_format_from_file($file)); + $output .= portfolio_add_button('assignment_portfolio_caller', $p, null, PORTFOLIO_ADD_ICON_LINK, null, true, $formats); } $output .= '
'; } @@ -3173,12 +3174,12 @@ class assignment_portfolio_caller extends portfolio_module_caller_base { if (!$this->assignment->portfolio_exportable()) { throw new portfolio_caller_exception('notexportable', 'portfolio', $this->get_return_url()); } + $fs = get_file_storage(); if (array_key_exists('file', $callbackargs)) { $this->file = $fs->get_file_by_id($callbackargs['file']); $this->files = array($this->file); $this->supportedformats = array(portfolio_format_from_file($this->file)); } else { - $fs = get_file_storage(); $this->files = $fs->get_area_files($this->assignment->context->id, 'assignment_submission', $this->user->id, '', false); } if (empty($this->supportedformats) && is_callable(array($this->assignment, 'portfolio_supported_formats'))) { diff --git a/mod/assignment/type/upload/assignment.class.php b/mod/assignment/type/upload/assignment.class.php index 59dfc3c846..7b2904cf42 100644 --- a/mod/assignment/type/upload/assignment.class.php +++ b/mod/assignment/type/upload/assignment.class.php @@ -362,7 +362,8 @@ class assignment_upload extends assignment_base { if (has_capability('mod/assignment:exportownsubmission', $this->context)) { $p['file'] = $file->get_id(); - $output .= portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php', PORTFOLIO_ADD_ICON_LINK, null, true); + $formats = array(portfolio_format_from_file($file)); + $output .= portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php', PORTFOLIO_ADD_ICON_LINK, null, true, $formats); } $output .= '
'; }