2 // Author: Dongsheng Cai <dongsheng@moodle.com>
5 api: M.cfg.wwwroot+'/files/filebrowser_ajax.php',
6 request: function(url, node, cb) {
7 var api = this.api + '?action=getfiletree';
9 params['fileurl'] = url;
11 params['sesskey']=M.cfg.sesskey;
15 complete: function(id,o,p) {
17 var data = this.y3.JSON.parse(o.responseText);
22 if (data && data.length==0) {
27 label: data[i].filename,
30 var tmp = new YAHOO.widget.TextNode(mynode, node, false);
35 tmp.target = '_blank';
46 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
48 data: build_querystring(params),
53 init : function(Y, options){
54 var tree = new YAHOO.widget.TreeView('course-file-tree-view');
55 tree.setDynamicLoad(this.dynload);
56 tree.subscribe("clickEvent", this.onclick);
57 var root = tree.getRoot();
58 var children = root.children;
60 if (children[i].className == 'file-tree-folder') {
61 children[i].isLeaf = false;
63 children[i].isLeaf = true;
69 dynload: function(node, oncompletecb) {
70 M.core_filetree.request(node.href, node, oncompletecb);
72 onclick: function(e) {
73 YAHOO.util.Event.preventDefault(e);