]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16423 - upload assignment types get mime detection (and fixed earlier related...
authormjollnir_ <mjollnir_>
Wed, 10 Sep 2008 09:38:04 +0000 (09:38 +0000)
committermjollnir_ <mjollnir_>
Wed, 10 Sep 2008 09:38:04 +0000 (09:38 +0000)
mod/assignment/lib.php
mod/assignment/type/upload/assignment.class.php

index ce62cc371026f1906c051dc79e6e36d6260710e8..38ea4f8b2707ffa1d2941b56607c94812fbe3f7b 100644 (file)
@@ -1718,7 +1718,8 @@ class assignment_base {
                 $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 />';
             }
@@ -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'))) {
index 59dfc3c8463c0a9270d5a782812f01eba4aa82d7..7b2904cf427b91cb34ba988295649574780a2df3 100644 (file)
@@ -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 .= '<br />';
             }