"MDL-21170, fixed pix_url output problem, improve javascript-static.js for new filemanager"

This commit is contained in:
Dongsheng Cai
2010-01-21 06:37:04 +00:00
parent a546e528ec
commit 2539ce37a6
3 changed files with 26 additions and 18 deletions
+2 -2
View File
@@ -566,7 +566,7 @@ function file_get_draft_area_files($draftitemid, $filepath = '/') {
$icon = mimeinfo_from_type('icon', $file->get_mimetype());
$icon = str_replace('.gif', '', $icon);
$item->icon = $OUTPUT->pix_url('f/' . $icon);
$item->icon = $OUTPUT->pix_url('f/' . $icon)->out();
if ($icon == 'zip') {
$item->type = 'zip';
@@ -576,7 +576,7 @@ function file_get_draft_area_files($draftitemid, $filepath = '/') {
if ($file->is_directory()) {
$item->filesize = 0;
$item->icon = $OUTPUT->pix_url('f/folder');
$item->icon = $OUTPUT->pix_url('f/folder')->out();
$item->type = 'folder';
$foldername = explode('/', trim($item->filepath, '/'));
$item->fullname = trim(array_pop($foldername), '/');
+23 -15
View File
@@ -5,8 +5,17 @@
var Y = null;
// Global M object, this helps with solving of namespace and scope issues
var M = {};
var M = M || {};
function launch_filemanager(options) {
Y.use('core_filemanager', function() {
var client_id = options.client_id;
// filemangers defined in lib/form/filemanager.js
if (!filemanagers[client_id]) {
filemanagers[client_id] = new M.core_filemanager(options);
}
});
}
// === old legacy JS code, hopefully to be replaced soon by M.xx.yy and YUI3 code ===
@@ -1206,21 +1215,11 @@ function stripHTML(str) {
}
function json_decode(json) {
try {
var obj = YAHOO.lang.JSON.parse(json);
} catch (e) {
alert(e.toString() + "\n" + stripHTML(json));
}
return obj;
return Y.JSON.parse(json);
}
function json_encode(data) {
try {
var json = YAHOO.lang.JSON.stringify(data);
} catch (e) {
alert(e.toString());
}
return json;
return Y.JSON.stringify(data);
}
/**
@@ -1317,8 +1316,17 @@ function confirm_dialog(event, args) {
if (target.args.callback) {
// args comes from PHP, so callback will be a string, needs to be evaluated by JS
var callback = eval('('+target.args.callback+')');
callback.apply(this);
var callback = null;
if (Y.Lang.isFunction(target.args.callback)) {
callback = target.args.callback;
} else {
callback = eval('('+target.args.callback+')');
}
if (Y.Lang.isObject(target.args.scope)) {
callback.apply(target.args.scope);
} else {
callback();
}
}
if (target.tagName.toLowerCase() == 'a') {
+1 -1
View File
@@ -836,7 +836,7 @@ abstract class repository {
'url'=>$fileinfo->get_url(),
'id'=>$file->get_itemid(),
'file'=>$file->get_filename(),
'icon' => $OUTPUT->pix_url(file_extension_icon($thefile, 32))
'icon' => $OUTPUT->pix_url(file_extension_icon($thefile, 32))->out()
);
} else {
return null;