diff --git a/src/filemanager.html b/src/filemanager.html
index 357251819..deb4b690a 100644
--- a/src/filemanager.html
+++ b/src/filemanager.html
@@ -352,9 +352,9 @@
| {{ 'filemanager.list.empty' | tr }} |
-
+
|
-
+
|
{{ entry.fileName }}{{ 'filemanager.list.symlink' | tr:{ target: entry.target } }} |
{{ entry.mtime | prettyDate }} |
diff --git a/src/js/filemanager.js b/src/js/filemanager.js
index b84709df0..6d944016a 100644
--- a/src/js/filemanager.js
+++ b/src/js/filemanager.js
@@ -70,7 +70,9 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$scope.rootDirLabel = '';
$scope.title = '';
$scope.entries = [];
- $scope.selected = [];
+ $scope.selected = []; // holds selected entries
+ $scope.clipboard = []; // holds cut or copied entries
+ $scope.clipboardCut = false; // if action is cut or copy
$scope.dropToBody = false;
$scope.sortAsc = true;
$scope.sortProperty = 'fileName';
@@ -118,6 +120,10 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
return filePath;
}
+ $scope.isSelected = function (entry) {
+ return $scope.selected.indexOf(entry) !== -1;
+ };
+
$scope.extractStatus = {
error: null,
busy: false,
@@ -330,6 +336,43 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
}
};
+ $scope.actionCut = function () {
+ $scope.clipboard = $scope.selected.slice();
+ $scope.clipboard.forEach(function (entry) {
+ entry.fullFilePath = sanitize($scope.cwd + '/' + entry.fileName);
+ });
+ $scope.clipboardCut = true;
+ };
+
+ $scope.actionCopy = function () {
+ $scope.clipboard = $scope.selected.slice();
+ $scope.clipboard.forEach(function (entry) {
+ entry.fullFilePath = sanitize($scope.cwd + '/' + entry.fileName);
+ });
+ $scope.clipboardCut = false;
+ };
+
+ $scope.actionPaste = function () {
+ if ($scope.clipboardCut) {
+ // move files
+ async.eachLimit($scope.clipboard, 5, function (entry, callback) {
+ var newFilePath = sanitize($scope.cwd + '/' + entry.fileName);
+
+ // TODO this will overwrite files in destination!
+ Client.filesRename($scope.id, $scope.type, entry.fullFilePath, newFilePath, callback);
+ }, function (error) {
+ if (error) return Client.error(error);
+
+ // clear clipboard
+ $scope.clipboard = [];
+
+ $scope.refresh();
+ });
+ } else {
+ // copy files
+ }
+ };
+
$scope.goDirectoryUp = function () {
$scope.changeDirectory($scope.cwd + '/..');
};
@@ -819,7 +862,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
}
});
- $translate(['filemanager.list.menu.edit', 'filemanager.list.menu.rename', 'filemanager.list.menu.chown', 'filemanager.list.menu.extract', 'filemanager.list.menu.download', 'filemanager.list.menu.delete' ]).then(function (tr) {
+ $translate(['filemanager.list.menu.edit', 'filemanager.list.menu.cut', 'filemanager.list.menu.copy', 'filemanager.list.menu.paste', 'filemanager.list.menu.rename', 'filemanager.list.menu.chown', 'filemanager.list.menu.extract', 'filemanager.list.menu.download', 'filemanager.list.menu.delete' ]).then(function (tr) {
$scope.menuOptions = [
{
text: tr['filemanager.list.menu.edit'],
@@ -827,6 +870,17 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
enabled: function () { return $scope.selected.length === 1; },
hasBottomDivider: true,
click: function ($itemScope, $event, entry) { $scope.open(entry); }
+ }, {
+ text: tr['filemanager.list.menu.cut'],
+ click: function ($itemScope, $event, entry) { $scope.actionCut(); }
+ }, {
+ text: tr['filemanager.list.menu.copy'],
+ click: function ($itemScope, $event, entry) { $scope.actionCopy(); }
+ }, {
+ text: tr['filemanager.list.menu.paste'],
+ hasBottomDivider: true,
+ enabled: function () { return $scope.clipboard.length; },
+ click: function ($itemScope, $event, entry) { $scope.actionPaste(); }
}, {
text: tr['filemanager.list.menu.rename'],
enabled: function () { return $scope.selected.length === 1; },
diff --git a/src/translation/de.json b/src/translation/de.json
index 7c4189f35..28bf9ae13 100644
--- a/src/translation/de.json
+++ b/src/translation/de.json
@@ -1023,7 +1023,7 @@
"newOwner": "Neuer Eigentümer",
"change": "Eigentümer ändern",
"recursiveCheckbox": "Eigentümer rekursiv ändern",
- "title": "Eigentümer ändern für {{ fileName }}"
+ "title": "Eigentümer ändern"
},
"newFileDialog": {
"create": "Erstellen",