Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit efeb573

Browse files
committed
Add pagination controllers in folders tree (when in Selector mode only) to allow copying/moving data around even if inside another page. Fix #1179
1 parent 53f1018 commit efeb573

File tree

6 files changed

+79
-13
lines changed

6 files changed

+79
-13
lines changed

core/src/plugins/gui.ajax/res/js/ui/prototype/class.FoldersTree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Class.create("FoldersTree", AjxpPane, {
7070
var filter = this.createFilter();
7171
var fakeRootNode = new AjxpNode("/", true, MessageHash[391], "folder.png");
7272
fakeRootNode._isLoaded = true;
73-
this.tree = new AJXPTree(fakeRootNode, action, filter);
73+
this.tree = new AJXPTree(fakeRootNode, action, filter, false);
7474

7575
this.treeContainer.update(this.tree.toString());
7676
$(this.tree.id).ajxpNode = this.tree.ajxpNode;

core/src/plugins/gui.ajax/res/js/ui/prototype/class.TreeSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Class.create("TreeSelector", {
6161
if(!rootNode){
6262
rootNode = new AjxpNode("/", false, MessageHash[373], "folder.png");
6363
}
64-
this.treeCopy = new AJXPTree(rootNode, this._nodeActionCallback, this.options.nodeFilter);
64+
this.treeCopy = new AJXPTree(rootNode, this._nodeActionCallback, this.options.nodeFilter, true);
6565
this.treeContainer.update(this.treeCopy.toString());
6666
$(this.treeCopy.id).observe("click", function(e){
6767
this.action();

core/src/plugins/gui.ajax/res/js/vendor/webfx/ajxptree.js

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ function splitOverlayClasses(ajxpNode){
3434
return ajxpNode.getMetadata().get("overlay_class").split(",");
3535
}
3636

37-
function AJXPTree(rootNode, sAction, filter) {
37+
function AJXPTree(rootNode, sAction, filter, showPagination) {
3838
this.WebFXTree = WebFXTree;
3939
this.loaded = true;
4040
this.ajxpNode = rootNode;
41+
this.showPagination = showPagination;
4142
var icon = rootNode.getIcon();
4243
if(icon.indexOf(ajxpResourcesFolder+"/") != 0){
4344
icon = resolveImageSource(icon, "/images/mimes/ICON_SIZE", 16);
@@ -109,20 +110,44 @@ AJXPTree.prototype.setAjxpRootNode = function(rootNode){
109110
};
110111

111112
AJXPTree.prototype.attachListeners = function(jsNode, ajxpNode){
113+
var showPagination = this.showPagination;
112114
ajxpNode.observe("child_added", function(childPath){
113115
if(ajxpNode.getMetadata().get('paginationData') && parseInt(ajxpNode.getMetadata().get('paginationData').get('total')) > 1){
114116
var pData = ajxpNode.getMetadata().get('paginationData');
115-
if(!this.paginated){
116-
this.paginated = true;
117-
if(pData.get('dirsCount')!="0"){
118-
var message = pData.get('overflowMessage');
119-
if(MessageHash[message]) message = MessageHash[message];
120-
this.updateLabel(this.text + " (" + message+ ")");
121-
}
122-
}
123-
//return;
117+
this.paginated = true;
118+
if(pData.get('dirsCount')!="0"){
119+
var message = pData.get('overflowMessage');
120+
if(!this.overflowMessage || this.overflowMessage !== message){
121+
this.overflowMessage = message;
122+
var label;
123+
if(showPagination){
124+
label = new Element('span', {className:'treeLabelPaginationWrapper'}).update(this.text + '<span class="treeLabelPaginationPadding"></span>');
125+
var total = parseInt(pData.get("total"));
126+
var current = parseInt(pData.get("current"));
127+
if(current > 1){
128+
var prev = new Element('a', {className:'treeLabelPagination prev icon-chevron-sign-left'}).observe('click', function(){
129+
ajxpNode.getMetadata().get("paginationData").set("current", current-1);
130+
ajxpNode.reload();
131+
});
132+
label.insert(prev);
133+
}
134+
label.insert(message);
135+
if(current < total){
136+
var prev = new Element('a', {className:'treeLabelPagination next icon-chevron-sign-right'}).observe('click', function(){
137+
ajxpNode.getMetadata().get("paginationData").set("current", current+1);
138+
ajxpNode.reload();
139+
});
140+
label.insert(prev);
141+
}
142+
}else{
143+
label = this.text + " (" + message+ ")";
144+
}
145+
this.updateLabel(label);
146+
}
147+
}
124148
}else if(this.paginated){
125149
this.paginated = false;
150+
this.overflowMessage = false;
126151
this.updateLabel(this.text);
127152
}
128153
var child = ajxpNode.findChildByPath(childPath);
@@ -186,6 +211,7 @@ function AJXPTreeItem(ajxpNode, sAction, eParent) {
186211
}
187212

188213
this.folder = true;
214+
this.showPagination = eParent.showPagination;
189215
this.WebFXTreeItem(
190216
ajxpNode.getLabel(),
191217
sAction,

core/src/plugins/gui.ajax/res/themes/orbit/css/allz.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/plugins/gui.ajax/res/themes/orbit/css/components/tree.less

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@
3939
background-repeat: no-repeat;
4040
font-size: 13px;
4141
background-size: 16px;
42+
span.treeLabelPaginationWrapper{
43+
display: inline;
44+
padding: 0;
45+
margin: 0;
46+
span.treeLabelPaginationPadding{
47+
display: inline-block;
48+
margin-right: 8px;
49+
padding: 0;
50+
}
51+
a.treeLabelPagination{
52+
display: inline-block;
53+
margin: 0 3px;
54+
cursor: pointer;
55+
}
56+
}
57+
4258
}
4359
&.selected-focus{
4460
color: white;

core/src/plugins/gui.ajax/res/themes/orbit/css/pydio.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,30 @@ div.dialogBox div#element_overlay {
386386
font-size: 13px;
387387
background-size: 16px;
388388
}
389+
.webfx-tree-item a span span.treeLabelPaginationWrapper,
390+
.webfx-tree-item a:active span span.treeLabelPaginationWrapper,
391+
.webfx-tree-item a:hover span span.treeLabelPaginationWrapper,
392+
.webfx-tree-item a:link span span.treeLabelPaginationWrapper {
393+
display: inline;
394+
padding: 0;
395+
margin: 0;
396+
}
397+
.webfx-tree-item a span span.treeLabelPaginationWrapper span.treeLabelPaginationPadding,
398+
.webfx-tree-item a:active span span.treeLabelPaginationWrapper span.treeLabelPaginationPadding,
399+
.webfx-tree-item a:hover span span.treeLabelPaginationWrapper span.treeLabelPaginationPadding,
400+
.webfx-tree-item a:link span span.treeLabelPaginationWrapper span.treeLabelPaginationPadding {
401+
display: inline-block;
402+
margin-right: 8px;
403+
padding: 0;
404+
}
405+
.webfx-tree-item a span span.treeLabelPaginationWrapper a.treeLabelPagination,
406+
.webfx-tree-item a:active span span.treeLabelPaginationWrapper a.treeLabelPagination,
407+
.webfx-tree-item a:hover span span.treeLabelPaginationWrapper a.treeLabelPagination,
408+
.webfx-tree-item a:link span span.treeLabelPaginationWrapper a.treeLabelPagination {
409+
display: inline-block;
410+
margin: 0 3px;
411+
cursor: pointer;
412+
}
389413
.webfx-tree-item a.selected-focus,
390414
.webfx-tree-item a:active.selected-focus,
391415
.webfx-tree-item a:hover.selected-focus,

0 commit comments

Comments
 (0)