Skip to content

Commit

Permalink
MDL-16423 - upload assignment types get mime detection (and fixed ear…
Browse files Browse the repository at this point in the history
…lier related regression)
  • Loading branch information
mjollnir_ committed Sep 10, 2008
1 parent e4af1de commit 0b88fed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions mod/assignment/lib.php
Expand Up @@ -1718,7 +1718,8 @@ function print_user_files($userid=0, $return=false) {
$output .= '<a href="'.$path.'" ><img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />'.s($filename).'</a>';
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 .= '<br />';
}
Expand Down Expand Up @@ -3173,12 +3174,12 @@ public function __construct($callbackargs) {
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'))) {
Expand Down
3 changes: 2 additions & 1 deletion mod/assignment/type/upload/assignment.class.php
Expand Up @@ -362,7 +362,8 @@ function print_user_files($userid=0, $return=false) {

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 .= '<br />';
}
Expand Down

0 comments on commit 0b88fed

Please sign in to comment.