MDL-31901: Allow FileManager to re-use FilePicker JS code for view modes:
- when loading core_filepicker we extend the Node element with functions necessary to display files list in different view modes; - repository/filepicker.js is changed to use those functions; - FileManager now has three different view modes (icon view, tree view and table view), JS code is re-used from FilePicker; - files in FileManager no longer have context menu, they have one popup Widget with different actions instead; - Added more templates for JS code to FileManager, use similar CSS class names as FilePicker; - lib/filelib.php : fixed double slashes in path, return more data about files; - lib/form/filemanager.php : pass information to FileManager about available licenses and default author; - repository/draftfiles_ajax.php : return information about directory tree for file moving UI in FileManager, return formatted information; - repository/lib.php : function repository::prepare_listing() now can work also with draftarea files listing;
This commit is contained in:
@@ -290,7 +290,10 @@ class form_filemanager implements renderable {
|
||||
* client_id=>uniqid(),
|
||||
* acepted_types=>'*',
|
||||
* return_types=>FILE_INTERNAL,
|
||||
* context=>$PAGE->context
|
||||
* context=>$PAGE->context,
|
||||
* author=>fullname($USER),
|
||||
* licenses=>array build from $CFG->licenses,
|
||||
* defaultlicense=>$CFG->sitedefaultlicense
|
||||
*/
|
||||
public function __construct(stdClass $options) {
|
||||
global $CFG, $USER, $PAGE;
|
||||
@@ -303,8 +306,22 @@ class form_filemanager implements renderable {
|
||||
'client_id'=>uniqid(),
|
||||
'accepted_types'=>'*',
|
||||
'return_types'=>FILE_INTERNAL,
|
||||
'context'=>$PAGE->context
|
||||
'context'=>$PAGE->context,
|
||||
'author'=>fullname($USER),
|
||||
'licenses'=>array()
|
||||
);
|
||||
if (!empty($CFG->licenses)) {
|
||||
$array = explode(',', $CFG->licenses);
|
||||
foreach ($array as $license) {
|
||||
$l = new stdClass();
|
||||
$l->shortname = $license;
|
||||
$l->fullname = get_string($license, 'license');
|
||||
$defaults['licenses'][] = $l;
|
||||
}
|
||||
}
|
||||
if (!empty($CFG->sitedefaultlicense)) {
|
||||
$defaults['defaultlicense'] = $CFG->sitedefaultlicense;
|
||||
}
|
||||
foreach ($defaults as $key=>$value) {
|
||||
if (empty($options->$key)) {
|
||||
$options->$key = $value;
|
||||
|
||||
Reference in New Issue
Block a user