Merge pull request #12381 from rummatee/master
Move/copy file picker: Remeber last destination and start in current folder
This commit is contained in:
commit
743323ee48
|
@ -648,6 +648,10 @@
|
||||||
if (permissions & OC.PERMISSION_UPDATE) {
|
if (permissions & OC.PERMISSION_UPDATE) {
|
||||||
actions = OC.dialogs.FILEPICKER_TYPE_COPY_MOVE;
|
actions = OC.dialogs.FILEPICKER_TYPE_COPY_MOVE;
|
||||||
}
|
}
|
||||||
|
var dialogDir = context.dir;
|
||||||
|
if (typeof context.fileList.dirInfo.dirLastCopiedTo !== 'undefined') {
|
||||||
|
dialogDir = context.fileList.dirInfo.dirLastCopiedTo;
|
||||||
|
}
|
||||||
OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) {
|
OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) {
|
||||||
if (type === OC.dialogs.FILEPICKER_TYPE_COPY) {
|
if (type === OC.dialogs.FILEPICKER_TYPE_COPY) {
|
||||||
context.fileList.copy(filename, targetPath, false, context.dir);
|
context.fileList.copy(filename, targetPath, false, context.dir);
|
||||||
|
@ -655,7 +659,8 @@
|
||||||
if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) {
|
if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) {
|
||||||
context.fileList.move(filename, targetPath, false, context.dir);
|
context.fileList.move(filename, targetPath, false, context.dir);
|
||||||
}
|
}
|
||||||
}, false, "httpd/unix-directory", true, actions);
|
context.fileList.dirInfo.dirLastCopiedTo = targetPath;
|
||||||
|
}, false, "httpd/unix-directory", true, actions, dialogDir);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -918,6 +918,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var actions = this.isSelectedMovable() ? OC.dialogs.FILEPICKER_TYPE_COPY_MOVE : OC.dialogs.FILEPICKER_TYPE_COPY;
|
var actions = this.isSelectedMovable() ? OC.dialogs.FILEPICKER_TYPE_COPY_MOVE : OC.dialogs.FILEPICKER_TYPE_COPY;
|
||||||
|
var dialogDir = self.getCurrentDirectory();
|
||||||
|
if (typeof self.dirInfo.dirLastCopiedTo !== 'undefined') {
|
||||||
|
dialogDir = self.dirInfo.dirLastCopiedTo;
|
||||||
|
}
|
||||||
OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) {
|
OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) {
|
||||||
self.fileMultiSelectMenu.toggleLoading('copyMove', true);
|
self.fileMultiSelectMenu.toggleLoading('copyMove', true);
|
||||||
if (type === OC.dialogs.FILEPICKER_TYPE_COPY) {
|
if (type === OC.dialogs.FILEPICKER_TYPE_COPY) {
|
||||||
|
@ -926,7 +930,8 @@
|
||||||
if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) {
|
if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) {
|
||||||
self.move(files, targetPath, disableLoadingState);
|
self.move(files, targetPath, disableLoadingState);
|
||||||
}
|
}
|
||||||
}, false, "httpd/unix-directory", true, actions);
|
self.dirInfo.dirLastCopiedTo = targetPath;
|
||||||
|
}, false, "httpd/unix-directory", true, actions, dialogDir);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -189,8 +189,9 @@ var OCdialogs = {
|
||||||
* @param mimetypeFilter mimetype to filter by - directories will always be included
|
* @param mimetypeFilter mimetype to filter by - directories will always be included
|
||||||
* @param modal make the dialog modal
|
* @param modal make the dialog modal
|
||||||
* @param type Type of file picker : Choose, copy, move, copy and move
|
* @param type Type of file picker : Choose, copy, move, copy and move
|
||||||
|
* @param path path to the folder that the the file can be picket from
|
||||||
*/
|
*/
|
||||||
filepicker:function(title, callback, multiselect, mimetypeFilter, modal, type) {
|
filepicker:function(title, callback, multiselect, mimetypeFilter, modal, type, path) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.filepicker.sortField = 'name';
|
this.filepicker.sortField = 'name';
|
||||||
|
@ -214,6 +215,7 @@ var OCdialogs = {
|
||||||
this.filepicker.filesClient = (OCA.Sharing && OCA.Sharing.PublicApp && OCA.Sharing.PublicApp.fileList)? OCA.Sharing.PublicApp.fileList.filesClient: OC.Files.getClient();
|
this.filepicker.filesClient = (OCA.Sharing && OCA.Sharing.PublicApp && OCA.Sharing.PublicApp.fileList)? OCA.Sharing.PublicApp.fileList.filesClient: OC.Files.getClient();
|
||||||
|
|
||||||
this.filelist = null;
|
this.filelist = null;
|
||||||
|
path = path || '';
|
||||||
|
|
||||||
$.when(this._getFilePickerTemplate()).then(function($tmpl) {
|
$.when(this._getFilePickerTemplate()).then(function($tmpl) {
|
||||||
self.filepicker.loading = false;
|
self.filepicker.loading = false;
|
||||||
|
@ -234,7 +236,7 @@ var OCdialogs = {
|
||||||
title: title,
|
title: title,
|
||||||
emptytext: emptyText,
|
emptytext: emptyText,
|
||||||
newtext: newText
|
newtext: newText
|
||||||
}).data('path', '').data('multiselect', multiselect).data('mimetype', mimetypeFilter);
|
}).data('path', path).data('multiselect', multiselect).data('mimetype', mimetypeFilter);
|
||||||
|
|
||||||
if (modal === undefined) {
|
if (modal === undefined) {
|
||||||
modal = false;
|
modal = false;
|
||||||
|
@ -355,7 +357,7 @@ var OCdialogs = {
|
||||||
self.filepicker.sortOrder = self.filepicker.sortOrder === 'asc' ? 'desc' : 'asc';
|
self.filepicker.sortOrder = self.filepicker.sortOrder === 'asc' ? 'desc' : 'asc';
|
||||||
self._fillFilePicker(dir);
|
self._fillFilePicker(dir);
|
||||||
});
|
});
|
||||||
self._fillFilePicker('');
|
self._fillFilePicker(path);
|
||||||
});
|
});
|
||||||
|
|
||||||
// build buttons
|
// build buttons
|
||||||
|
|
Loading…
Reference in New Issue