Skip to content

Commit

Permalink
MDL-23308, fixed course files tree file download link
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed Sep 13, 2010
1 parent b285c5a commit 3ac06cc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions files/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ M.core_filetree = {
var tmp = new YAHOO.widget.HTMLNode('<div>'+data[i].icon+'&nbsp;<a href="'+data[i].url+'">'+data[i].filename+'</a></div>', node, false);
if (data[i].isdir) {
tmp.isLeaf = false;
tmp.isDir = true;
} else {
tmp.isLeaf = true;
tmp.target = '_blank';
tmp.isFile = true;
}
}
}
Expand All @@ -60,8 +61,10 @@ M.core_filetree = {
for (i in children) {
if (children[i].className == 'file-tree-folder') {
children[i].isLeaf = false;
children[i].isDir = true;
} else {
children[i].isLeaf = true;
children[i].isFile = true;
}
}
tree.render();
Expand All @@ -71,10 +74,18 @@ M.core_filetree = {
var tmp = document.createElement('p');
tmp.innerHTML = node.html;
var links = tmp.getElementsByTagName('a');
M.core_filetree.request(links[0].href, node, oncompletecb);
var link = links[0].href;
M.core_filetree.request(link, node, oncompletecb);
},
onclick: function(e) {
YAHOO.util.Event.preventDefault(e);
if (e.node.isFile) {
var tmp = document.createElement('p');
tmp.innerHTML = e.node.html;
var links = tmp.getElementsByTagName('a');
var link = links[0].href;
window.location = link;
}
},
get_param: function(url, name, val) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
Expand Down

0 comments on commit 3ac06cc

Please sign in to comment.