diff --git a/src/Yavsc/wwwroot/js/yavsc-remote-fs.js b/src/Yavsc/wwwroot/js/yavsc-remote-fs.js index 6fb278bf..89202fad 100644 --- a/src/Yavsc/wwwroot/js/yavsc-remote-fs.js +++ b/src/Yavsc/wwwroot/js/yavsc-remote-fs.js @@ -17,8 +17,10 @@ if (typeof XMLHttpRequest === 'undefined') { rmDialog: null, mvDialog: null, flist: null, + fmlist: null, selection: [], - dirBar: null, + curDirBar: null, + subDirsBar: null, destination: null, rootDisplay: null, setRoot: function(sub) { @@ -35,12 +37,13 @@ if (typeof XMLHttpRequest === 'undefined') { this.setRoot(sub); var owner = this.element.data('owner'); this.selection = []; - this.dirBar.empty(); + this.curDirBar.empty(); + this.subDirsBar.empty(); $('') .click(function () { _this.openDir(null); }) - .appendTo(this.dirBar); + .appendTo(this.curDirBar); var npath = null if (_this.root) { @@ -52,49 +55,71 @@ if (typeof XMLHttpRequest === 'undefined') { $('').click( + function() { + var xmlhttp = new XMLHttpRequest(); + xmlhttp.open('DELETE', '/api/fs/' + _this.root, true); + xmlhttp.send(); - $('') - .append($('') + xmlhttp.onreadystatechange = function(event) { + // XMLHttpRequest.DONE === 4 + if (this.readyState === XMLHttpRequest.DONE) { + if (this.status === 200) { + var dnames = _this.root.split('/'); + var dcnt = dnames.length; + var nroot = dnames.slice(0,dcnt-1).join('/'); + _this.openDir(nroot); + } + } + } + }).appendTo(_this.subDirsBar); + } + else + { + $.each(data.SubDirectories, function () { + var item = this; + var spath = _this.root ? _this.root + '/' + item.Name : item.Name; + $('