MDL-22281 file resource module, select main file

This commit is contained in:
Dongsheng Cai 2010-05-04 03:48:00 +00:00
parent 0dcf112b67
commit f45dfeeb76
4 changed files with 17 additions and 1 deletions

View File

@ -144,6 +144,7 @@ $string['searching'] = 'Search in';
$string['select'] = 'Select';
$string['settings'] = 'Settings';
$string['setupdefaultplugins'] = 'Setting up default repository plugins';
$string['setmainfile'] = 'Set main file';
$string['siteinstances'] = 'Repositories instances of the site';
$string['size'] = 'Size';
$string['submit'] = 'Submit';

View File

@ -54,6 +54,9 @@ M.form_filemanager.init = function(Y, options) {
menus: {},
initializer: function(options) {
this.options = options;
if (options.mainfile) {
this.mainfile = options.mainfile;
}
this.client_id = options.client_id;
this.currentpath = '/';
this.maxfiles = options.maxfiles;
@ -333,7 +336,7 @@ M.form_filemanager.init = function(Y, options) {
var url = "###";
// check main file
//var ismainfile = false;
var ismainfile = false;
//if (fm_cfg[this.client_id].mainfilename && (fm_cfg[this.client_id].mainfilename.toLowerCase() == list[i].fullname.toLowerCase())) {
//ismainfile = true;
//}
@ -410,12 +413,22 @@ M.form_filemanager.init = function(Y, options) {
this.refresh(file.filepath);
},
create_filemenu: function(e, data) {
var options = this.options;
var node = e.currentTarget;
var file = data[node.get('id')];
var menuitems = [
{text: M.str.moodle.download, url:file.url}
];
function setmainfile(type, ev, obj) {
var file = obj[node.get('id')];
Y.one(mainid).set('value', file.filepath+file.filename);
}
if (this.mainfile) {
var mainid = '#id_'+this.mainfile;
var menu = {text: M.str.repository.setmainfile, onclick:{fn: setmainfile, obj:data, scope:this}};
menuitems.push(menu);
}
this.create_menu(e, 'filemenu', menuitems, file, data);
},
create_foldermenu: function(e, data) {

View File

@ -2756,6 +2756,7 @@ function print_filemanager($options, $return = false) {
$PAGE->requires->string_for_js('popupblockeddownload', 'repository');
$PAGE->requires->string_for_js('draftareanofiles', 'repository');
$PAGE->requires->string_for_js('path', 'moodle');
$PAGE->requires->string_for_js('setmainfile', 'repository');
// language strings
$straddfile = get_string('add', 'repository') . '...';
$strmakedir = get_string('makeafolder', 'moodle');

View File

@ -158,6 +158,7 @@ $string['printintro'] = 'Display resource description';
$string['printintroexplain'] = 'Display resource description bellow content? Some display types may not display description even if enabled.';
$string['redeploy'] = 'Deploy again';
$string['repository'] = 'IMS repository';
$string['resourceadministration'] = 'Resource administration';
$string['resourcecontent'] = 'Files and subfolders';
$string['resourcedefaulturl'] = 'Default URL';
$string['resource:exportresource'] = 'Export resource';