refactor(dom) getSelectedNames: always return array

This commit is contained in:
coderaiser 2014-02-11 07:11:16 -05:00
parent 475633ecc6
commit 6646819746

View file

@ -1395,21 +1395,26 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
return lLink;
};
this.getSelectedNames = function(pSelected) {
var lSelected = pSelected || this.getSelectedFiles(),
lRet = lSelected ? [] : null;
this.getSelectedNames = function(selected) {
var current, first, name, i, n,
ret = [];
if (!selected)
selected = this.getSelectedFiles() || [];
first = selected[0];
name = this.getCurrentName(first);
if (lRet) {
var lFirst = lSelected[0],
lName = this.getCurrentName( lFirst );
if (lName === '..')
this.toggleSelectedFile( lFirst );
for(var i = 0, n = lSelected.length; i < n;i++)
lRet[i] = this.getCurrentName( lSelected[i] );
if (name === '..')
this.toggleSelectedFile(first);
n = selected.length;
for (i = 0; i < n;i++) {
current = selected[i];
ret[i] = this.getCurrentName(current);
}
return lRet;
return ret;
};
/**