Skip to content

Commit

Permalink
MDL-24375, fixed mulilt main files in filemanager
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed Oct 6, 2010
1 parent ef106e5 commit 1a79133
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions lib/form/filemanager.js
Expand Up @@ -505,6 +505,26 @@ M.form_filemanager.init = function(Y, options) {
{text: M.str.moodle.download, url:fileinfo.url},
{text: M.str.moodle.unzip, onclick: {fn: unzip, obj: data, scope: this}}
];
function setmainfile(type, ev, obj) {
var file = obj[node.get('id')];
//Y.one(mainid).set('value', file.filepath+file.filename);
var params = {};
params['filepath'] = file.filepath;
params['filename'] = file.filename;
this.request({
action: 'setmainfile',
scope: scope,
params: params,
callback: function(id, obj, args) {
scope.refresh(scope.currentpath);
}
});
}
if (this.enablemainfile && (fileinfo.sortorder != 1)) {
var mainid = '#id_'+this.enablemainfile;
var menu = {text: M.str.repository.setmainfile, onclick:{fn: setmainfile, obj:data, scope:this}};
menuitems.push(menu);
}
this.create_menu(e, 'zipmenu', menuitems, fileinfo, data);
},
create_menu: function(ev, menuid, menuitems, fileinfo, options) {
Expand Down
2 changes: 1 addition & 1 deletion repository/recent/lib.php
Expand Up @@ -175,7 +175,7 @@ public function copy_to_area($encoded, $draftitemid, $new_filepath, $new_filenam
throw new moodle_exception('errornotyourfile', 'repository');
}
$file_record = array('contextid'=>$user_context->id, 'component'=>'user', 'filearea'=>'draft',
'itemid'=>$draftitemid, 'filepath'=>$new_filepath, 'filename'=>$new_filename);
'itemid'=>$draftitemid, 'filepath'=>$new_filepath, 'filename'=>$new_filename, 'sortorder'=>0);
if ($file = $fs->get_file($user_context->id, 'user', 'draft', $draftitemid, $new_filepath, $new_filename)) {
$info = array();
$info['title'] = $file->get_filename();
Expand Down

0 comments on commit 1a79133

Please sign in to comment.