Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
"MDL-21170, rename filepicker to core_filepicker, upgrade filemanager…
… to yui3 module"
  • Loading branch information
Dongsheng Cai committed Jan 22, 2010
1 parent 3e6161f commit 840912d
Show file tree
Hide file tree
Showing 7 changed files with 664 additions and 828 deletions.
19 changes: 11 additions & 8 deletions files/files_ajax.php
Expand Up @@ -77,9 +77,9 @@
$fs = get_file_storage();
$filepath = file_correct_filepath($filepath);
$return = new stdclass;
if ($file = $fs->get_file($user_context->id, 'user_draft', $itemid, $filepath, $filename)) {
$parent_path = $file->get_parent_directory()->get_filepath();
if($result = $file->delete()) {
if ($stored_file = $fs->get_file($user_context->id, 'user_draft', $itemid, $filepath, $filename)) {
$parent_path = $stored_file->get_parent_directory()->get_filepath();
if($result = $stored_file->delete()) {
$return->filepath = $parent_path;
echo json_encode($return);
} else {
Expand All @@ -93,11 +93,11 @@
case 'renamedir':
$fs = get_file_storage();
$fb = get_file_browser();
$file = $fb->get_file_info($user_context, 'user_draft', $itemid, $filepath, '.');
if ($result = $file->delete()) {
$fs->create_directory($user_context->id, 'user_draft', $itemid, file_correct_filepath($newfilename));
$return = new stdclass;
$return->filepath = file_correct_filepath($newfilename);
$return = new stdclass;
$fileinfo = $fb->get_file_info($user_context, 'user_draft', $itemid, $filepath, '.');
if ($result = $fileinfo->delete()) {
$newdir = $fs->create_directory($user_context->id, 'user_draft', $itemid, file_correct_filepath($newfilename));
$return->filepath = $newdir->get_parent_directory()->get_filepath();
echo json_encode($return);
} else {
echo json_encode(false);
Expand Down Expand Up @@ -192,6 +192,9 @@
}
break;

case 'upload':
break;

default:
break;
}
9 changes: 6 additions & 3 deletions lib/ajax/ajaxlib.php
Expand Up @@ -343,11 +343,14 @@ public function js_module($name, array $module = null) {

if (strpos($name, 'core_') === 0) {
// must be some core stuff
} else {
if ($name === 'filepicker') { // TODO: rename to 'core_filepicker' and move above
if ($name === 'core_filepicker') {
$pathtofilepicker = $CFG->httpswwwroot.'/repository/filepicker.js';
$module = array('fullpath'=>$pathtofilepicker, 'requires' => array('base', 'node', 'json', 'async-queue', 'io', 'yui2-button', 'yui2-container', 'yui2-treeview', 'yui2-layout'));
$module = array('fullpath'=>$pathtofilepicker, 'requires' => array('base', 'node', 'json', 'async-queue', 'io'));
} else if($name === 'core_filemanager') {
$pathtofilemanager = $CFG->httpswwwroot.'/lib/form/filemanager.js';
$module = array('fullpath'=>$pathtofilemanager, 'requires' => array('base', 'io', 'node', 'json', 'yui2-button', 'yui2-container', 'yui2-layout', 'yui2-menu', 'yui2-treeview'));
}
} else {
//TODO: look for plugin info?
}

Expand Down
4 changes: 2 additions & 2 deletions lib/editor/tinymce/extra/tinymce_utils.js
Expand Up @@ -55,14 +55,14 @@ function editor_init_filepicker(editorid, options) {
editor_options[editorid] = options;
}
function mce_moodlefilemanager(target_id, url, type, win) {
YUI(M.yui.loader).use("filepicker", function (Y) {
YUI(M.yui.loader).use('core_filepicker', function (Y) {
var editor_id = tinyMCE.selectedInstance.editorId;
var options = editor_options[editor_id];
var client_id = options.client_id;
options.formcallback = editor_filepicker_callback;
options.editor_target = win.document.getElementById(target_id);
if (!editor_filepickers[client_id]) {
editor_filepickers[client_id] = new Y.filepicker(options);
editor_filepickers[client_id] = new Y.core_filepicker(options);
}
editor_filepickers[client_id].show();
});
Expand Down

0 comments on commit 840912d

Please sign in to comment.