').appendTo($tr);
$tr.appendTo(_this.ftable);
});
});
},
SetItemSelected: function (name, selected) {
if (selected) this.selection.push(name);
else this.selection = this.selection.filter(function(ele) {
return ele != name;
});
},
RemoveSelectedFiles: function () {
$.each(this.selection, function() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('DELETE', '/api/fs/' + this, true);
xmlhttp.send();
});
this.selection = [];
// FIXME this could fail for a very long list of big files
setTimeout(500, function() { this.openDir(this.root); });
},
askForRemoval: function () {
this.flist.empty();
var _this = this;
$.each(this.selection, function () {
_this.flist.append('
' + this + '
');
});
this.rmAlert.modal({ show: true });
},
_create: function () {
var $view = this.element;
var _this = this;
this.dirBar = $('');
this.dirBar.appendTo($view);
this.ftable = $('
').css('border-spacing', '6px')
.css('border-collapse', 'separate');
this.openDir($view.data('path'));
var btnRm = $('').click(function() { _this.askForRemoval(); });
var tr = $('
');
_this.ftable.append(tr);
tr.append($('
').append(btnRm)).append('
Nom
Taille
Modification
');
_this.ftable.appendTo($view);
this.rmAlert = $('');
this.rmAlert.addClass('modal');
this.rmAlert.addClass('fade');
var md = $('');
md.addClass('modal-dialog');
this.rmAlert.append(md);
var mdCnt = $('');
mdCnt.addClass('modal-content');
var mdHeader = $('');
mdHeader.append('
File removal
');
mdHeader.append('');
mdCnt.append(mdHeader);
var mdBody = $('');
mdBody.append('