Moodle

Convert forms around Moodle to use filepicker/filemanager component

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Repositories
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

All the places around Moodle that accept files needs to be converted to use the new filepicker/filemanager component from MDL-15348

mod/forum/post.php
mod/assignment/upload.php
user/edit.php
user/editadvanced.php

etc (please add more)

Activity

Hide
Petr Škoda (skodak) added a comment - - edited

noticed the new move_file_to_final_destination() in filelib,
I think it would be better to have
function move_file_to_final_destination($draftfileid, $context, $filearea, $itemid, $filename, $filepath)
file_browser should not be used at all, the file must always come from draft area of current $USER and it might be better to verify it (we do not want to let users steal files from elsewhere)

Show
Petr Škoda (skodak) added a comment - - edited noticed the new move_file_to_final_destination() in filelib, I think it would be better to have function move_file_to_final_destination($draftfileid, $context, $filearea, $itemid, $filename, $filepath) file_browser should not be used at all, the file must always come from draft area of current $USER and it might be better to verify it (we do not want to let users steal files from elsewhere)
Hide
Petr Škoda (skodak) added a comment -

hmm, maybe it might be also better to implement it as a file_storage method

Show
Petr Škoda (skodak) added a comment - hmm, maybe it might be also better to implement it as a file_storage method
Hide
Petr Škoda (skodak) added a comment -

why are the $itemid and $filepath optional? the uploaded file does not have any reasonable values there, right?

Show
Petr Škoda (skodak) added a comment - why are the $itemid and $filepath optional? the uploaded file does not have any reasonable values there, right?
Hide
Mathieu Petit-Clair added a comment -

Well, there are, but no they're not right. Changing this...

Show
Mathieu Petit-Clair added a comment - Well, there are, but no they're not right. Changing this...
Hide
Eloy Lafuente (stronk7) added a comment -

Uhm... just saw some commits related to this.... two questions:

1) What happens in non-javascript environments? I've disabled js here and it seems that there isn't alternative to add one file in that mode.
2) I've seen lot of lines initializing things like js strings and so on. Instead of having all them harcoded on each file manager usage... shouldn't we be using one central place to perform all that init tasks and reuse it elsewhere (One quick grep have shown that MoodleQuickForm_filemanager already has that init available).

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Uhm... just saw some commits related to this.... two questions: 1) What happens in non-javascript environments? I've disabled js here and it seems that there isn't alternative to add one file in that mode. 2) I've seen lot of lines initializing things like js strings and so on. Instead of having all them harcoded on each file manager usage... shouldn't we be using one central place to perform all that init tasks and reuse it elsewhere (One quick grep have shown that MoodleQuickForm_filemanager already has that init available). Ciao
Hide
Dongsheng Cai added a comment -

Hi, Eloy

1) I forgot to add the iframe for using filemanager in non-js, will fix it soon.
2) Most lines are options for filemanager & filepicker, they are different in different places. MoodleQuickForm_filemanager is only used in moodleforms, but some time we use filemanager not in moodleform. I will make some changes to reuse the js strings and make the options simpler.

Thanks for reviewing it.

Show
Dongsheng Cai added a comment - Hi, Eloy 1) I forgot to add the iframe for using filemanager in non-js, will fix it soon. 2) Most lines are options for filemanager & filepicker, they are different in different places. MoodleQuickForm_filemanager is only used in moodleforms, but some time we use filemanager not in moodleform. I will make some changes to reuse the js strings and make the options simpler. Thanks for reviewing it.
Hide
Eloy Lafuente (stronk7) added a comment -

Ho, Dongsheng

cool, ciao

Show
Eloy Lafuente (stronk7) added a comment - Ho, Dongsheng cool, ciao
Hide
Petr Škoda (skodak) added a comment -

oh, we are trying to move all the print_xxx stuff from weblib.php into renders or formslib, please do not add more there

Show
Petr Škoda (skodak) added a comment - oh, we are trying to move all the print_xxx stuff from weblib.php into renders or formslib, please do not add more there
Hide
Petr Škoda (skodak) added a comment -

this looks clearly wrong, from filepicker.php file:
$contextid = optional_param('ctx_id', SITEID, PARAM_INT);

Show
Petr Škoda (skodak) added a comment - this looks clearly wrong, from filepicker.php file: $contextid = optional_param('ctx_id', SITEID, PARAM_INT);
Hide
Dongsheng Cai added a comment -

Hi, Petr

I will deal with these problems tomorrow, thanks.

Show
Dongsheng Cai added a comment - Hi, Petr I will deal with these problems tomorrow, thanks.

Dates

  • Created:
    Updated:
    Resolved: