Skip to content

Commit

Permalink
[ui:tree] fix #1999 split display of many directories
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed May 12, 2017
1 parent 96070b1 commit 1cb3703
Show file tree
Hide file tree
Showing 9 changed files with 461 additions and 223 deletions.
12 changes: 12 additions & 0 deletions css/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@
opacity: .5; filter:Alpha(Opacity=50);
}

/* pager button */
.elfinder-navbar-pager {
width: 100%;
box-sizing: border-box;
padding-top: 3px;
padding-bottom: 3px;
}
.elfinder-touch .elfinder-navbar-pager {
padding-top: 10x;
padding-bottom: 10px;
}

.elfinder-places {
border: none;
margin: 0;
Expand Down
1 change: 1 addition & 0 deletions js/commands/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ elFinder.prototype.commands.restore = function() {
items = items.concat(r.files);
}
});
fm.cache(items);
getFilesRecursively(items).done(function(res) {
results = results.concat(res);
dfd.resolve(results);
Expand Down
38 changes: 23 additions & 15 deletions js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,12 @@ var elFinder = function(node, opts) {
done = function(data) {
data.warning && self.error(data.warning);

isOpen && open(data);
if (isOpen) {
open(data);
} else {
cache(data.files || []);
cache(data.tree || []);
}

self.lazy(function() {
// fire some event to update cache/ui
Expand Down Expand Up @@ -1836,17 +1841,8 @@ var elFinder = function(node, opts) {
return dfrd.reject(['errMaxTargets', self.maxTargets]);
}

if (defdone) {
dfrd.done(done);
} else if (cmd === 'open'){
dfrd.done(function(data) {
var cwd = data.cwd.hash;
cache(data.files);
if (!files[cwd]) {
cache([data.cwd]);
}
})
}
defdone && dfrd.done(done);

if (notify.type && notify.cnt) {
if (cancel) {
notify.cancel = dfrd;
Expand Down Expand Up @@ -1968,6 +1964,20 @@ var elFinder = function(node, opts) {
return queueingRequest();
};

/**
* Call cache()
* Store info about files/dirs in "files" object.
*
* @param Array files
* @return void
*/
this.cache = function(dataArray) {
if (! Array.isArray(dataArray)) {
dataArray = [ dataArray ];
}
cache(dataArray);
};

/**
* Compare current files cache with new files and return diff
*
Expand Down Expand Up @@ -3256,9 +3266,6 @@ var elFinder = function(node, opts) {

self.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-error"/>'+self.i18n(e.data.error), opts);
})
.bind('tree parents', function(e) {
cache(e.data.tree || []);
})
.bind('tmb', function(e) {
$.each(e.data.images||[], function(hash, tmb) {
if (files[hash]) {
Expand Down Expand Up @@ -3319,6 +3326,7 @@ var elFinder = function(node, opts) {
})
.bind('searchend', function() {
self.searchStatus.state = 0;
self.searchStatus.ininc = false;
self.searchStatus.mixed = false;
})

Expand Down
3 changes: 3 additions & 0 deletions js/elFinder.options.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ elFinder.prototype._options = {
openCwdOnOpen : true,
// auto load current dir parents
syncTree : true,
// Maximum number of display of each child trees
// The tree of directories with children exceeding this number will be split
subTreeMax : 100,
// Numbar of max connctions of subdirs request
subdirsMaxConn : 3,
// Number of max simultaneous processing directory of subdirs
Expand Down
2 changes: 2 additions & 0 deletions js/i18n/elfinder.LANG.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
'btnBackup' : 'Backup', // fromv2.1 added 28.11.2015
'btnRename' : 'Rename', // from v2.1.24 added 6.4.2017
'btnRenameAll' : 'Rename(All)', // from v2.1.24 added 6.4.2017
'btnPrevious' : 'Prev ($1/$2)', // from v2.1.24 added 11.5.2017
'btnNext' : 'Next ($1/$2)', // from v2.1.24 added 11.5.2017

/******************************** notifications ********************************/
'ntfopen' : 'Open folder',
Expand Down
4 changes: 3 additions & 1 deletion js/i18n/elfinder.en.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* English translation
* @author Troex Nevelin <troex@fury.scancode.ru>
* @version 2017-05-02
* @version 2017-05-11
*/
// elfinder.en.js is integrated into elfinder.(full|min).js by jake build
if (typeof elFinder === 'function' && elFinder.prototype.i18) {
Expand Down Expand Up @@ -166,6 +166,8 @@ if (typeof elFinder === 'function' && elFinder.prototype.i18) {
'btnBackup' : 'Backup', // fromv2.1 added 28.11.2015
'btnRename' : 'Rename', // from v2.1.24 added 6.4.2017
'btnRenameAll' : 'Rename(All)', // from v2.1.24 added 6.4.2017
'btnPrevious' : 'Prev ($1/$2)', // from v2.1.24 added 11.5.2017
'btnNext' : 'Next ($1/$2)', // from v2.1.24 added 11.5.2017

/******************************** notifications ********************************/
'ntfopen' : 'Open folder',
Expand Down
4 changes: 3 additions & 1 deletion js/i18n/elfinder.jp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Japanese translation
* @author Tomoaki Yoshida <info@yoshida-studio.jp>
* @author Naoki Sawada <hypweb@gmail.com>
* @version 2017-05-02
* @version 2017-05-11
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down Expand Up @@ -174,6 +174,8 @@
'btnBackup' : 'バックアップ', // fromv2.1 added 28.11.2015
'btnRename' : 'リネーム', // from v2.1.24 added 6.4.2017
'btnRenameAll' : 'リネーム(全て)', // from v2.1.24 added 6.4.2017
'btnPrevious' : '前へ ($1/$2)', // from v2.1.24 added 11.5.2017
'btnNext' : '次へ ($1/$2)', // from v2.1.24 added 11.5.2017

/******************************** notifications ********************************/
'ntfopen' : 'フォルダーを開いています',
Expand Down
3 changes: 3 additions & 0 deletions js/ui/places.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@ $.fn.elfinderplaces = function(fm, opts) {
})
.done(function(data) {
var exists = {};

data.files && fm.cache(data.files);

$.each(data.files, function(i, f) {
var hash = f.hash;
exists[hash] = f;
Expand Down
Loading

0 comments on commit 1cb3703

Please sign in to comment.