summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-05-19 20:52:25 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-05-19 20:52:25 +0200
commit51a6764f3180a258dc17a6744929866aeddb8779 (patch)
tree78452f7027ab7b71d48f1aedc736cd9617430ce8 /apps/files_trashbin
parent2c483fdca21fc32bf6ef8eaf5835e8e4614acd3a (diff)
parentb6d2d6329d99c47fa8a01a7a8db7f8f2de6b9f74 (diff)
downloadnextcloud-server-51a6764f3180a258dc17a6744929866aeddb8779.tar.gz
nextcloud-server-51a6764f3180a258dc17a6744929866aeddb8779.zip
Merge branch 'master' into cleanup-list-code
Conflicts: apps/files_sharing/ajax/list.php
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/ajax/list.php4
-rw-r--r--apps/files_trashbin/appinfo/app.php14
-rw-r--r--apps/files_trashbin/appinfo/routes.php5
-rw-r--r--apps/files_trashbin/css/trash.css13
-rw-r--r--apps/files_trashbin/index.php42
-rw-r--r--apps/files_trashbin/js/app.js82
-rw-r--r--apps/files_trashbin/js/disableDefaultActions.js3
-rw-r--r--apps/files_trashbin/js/filelist.js372
-rw-r--r--apps/files_trashbin/js/trash.js130
-rw-r--r--apps/files_trashbin/l10n/ar.php3
-rw-r--r--apps/files_trashbin/l10n/ast.php5
-rw-r--r--apps/files_trashbin/l10n/bg_BG.php3
-rw-r--r--apps/files_trashbin/l10n/ca.php3
-rw-r--r--apps/files_trashbin/l10n/cs_CZ.php3
-rw-r--r--apps/files_trashbin/l10n/cy_GB.php3
-rw-r--r--apps/files_trashbin/l10n/da.php3
-rw-r--r--apps/files_trashbin/l10n/de.php3
-rw-r--r--apps/files_trashbin/l10n/de_CH.php3
-rw-r--r--apps/files_trashbin/l10n/de_DE.php3
-rw-r--r--apps/files_trashbin/l10n/el.php3
-rw-r--r--apps/files_trashbin/l10n/en_GB.php3
-rw-r--r--apps/files_trashbin/l10n/eo.php3
-rw-r--r--apps/files_trashbin/l10n/es.php3
-rw-r--r--apps/files_trashbin/l10n/es_AR.php3
-rw-r--r--apps/files_trashbin/l10n/es_MX.php3
-rw-r--r--apps/files_trashbin/l10n/et_EE.php3
-rw-r--r--apps/files_trashbin/l10n/eu.php3
-rw-r--r--apps/files_trashbin/l10n/fa.php3
-rw-r--r--apps/files_trashbin/l10n/fi_FI.php3
-rw-r--r--apps/files_trashbin/l10n/fr.php3
-rw-r--r--apps/files_trashbin/l10n/gl.php3
-rw-r--r--apps/files_trashbin/l10n/he.php3
-rw-r--r--apps/files_trashbin/l10n/hu_HU.php3
-rw-r--r--apps/files_trashbin/l10n/id.php3
-rw-r--r--apps/files_trashbin/l10n/it.php3
-rw-r--r--apps/files_trashbin/l10n/ja.php3
-rw-r--r--apps/files_trashbin/l10n/ka_GE.php3
-rw-r--r--apps/files_trashbin/l10n/km.php8
-rw-r--r--apps/files_trashbin/l10n/ko.php3
-rw-r--r--apps/files_trashbin/l10n/lt_LT.php3
-rw-r--r--apps/files_trashbin/l10n/lv.php3
-rw-r--r--apps/files_trashbin/l10n/mk.php3
-rw-r--r--apps/files_trashbin/l10n/ms_MY.php3
-rw-r--r--apps/files_trashbin/l10n/nb_NO.php3
-rw-r--r--apps/files_trashbin/l10n/nl.php3
-rw-r--r--apps/files_trashbin/l10n/nn_NO.php3
-rw-r--r--apps/files_trashbin/l10n/pl.php3
-rw-r--r--apps/files_trashbin/l10n/pt_BR.php3
-rw-r--r--apps/files_trashbin/l10n/pt_PT.php3
-rw-r--r--apps/files_trashbin/l10n/ru.php3
-rw-r--r--apps/files_trashbin/l10n/sk_SK.php3
-rw-r--r--apps/files_trashbin/l10n/sl.php3
-rw-r--r--apps/files_trashbin/l10n/sq.php3
-rw-r--r--apps/files_trashbin/l10n/sr.php2
-rw-r--r--apps/files_trashbin/l10n/sv.php3
-rw-r--r--apps/files_trashbin/l10n/th_TH.php3
-rw-r--r--apps/files_trashbin/l10n/tr.php3
-rw-r--r--apps/files_trashbin/l10n/uk.php3
-rw-r--r--apps/files_trashbin/l10n/ur_PK.php11
-rw-r--r--apps/files_trashbin/l10n/vi.php3
-rw-r--r--apps/files_trashbin/l10n/zh_CN.php3
-rw-r--r--apps/files_trashbin/l10n/zh_TW.php3
-rw-r--r--apps/files_trashbin/lib/helper.php12
-rw-r--r--apps/files_trashbin/lib/hooks.php10
-rw-r--r--apps/files_trashbin/lib/trashbin.php86
-rw-r--r--apps/files_trashbin/list.php11
-rw-r--r--apps/files_trashbin/templates/index.php21
-rw-r--r--apps/files_trashbin/tests/js/appSpec.js69
-rw-r--r--apps/files_trashbin/tests/js/filelistSpec.js309
69 files changed, 851 insertions, 505 deletions
diff --git a/apps/files_trashbin/ajax/list.php b/apps/files_trashbin/ajax/list.php
index 89a55114524..e1f52e814bb 100644
--- a/apps/files_trashbin/ajax/list.php
+++ b/apps/files_trashbin/ajax/list.php
@@ -4,11 +4,13 @@ OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+$sortAttribute = isset( $_GET['sort'] ) ? $_GET['sort'] : 'name';
+$sortDirection = isset( $_GET['sortdirection'] ) ? ($_GET['sortdirection'] === 'desc') : false;
$data = array();
// make filelist
try {
- $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
+ $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir, $sortAttribute, $sortDirection);
} catch (Exception $e) {
header("HTTP/1.0 404 Not Found");
exit();
diff --git a/apps/files_trashbin/appinfo/app.php b/apps/files_trashbin/appinfo/app.php
index d30a601ef56..b8900ee0de3 100644
--- a/apps/files_trashbin/appinfo/app.php
+++ b/apps/files_trashbin/appinfo/app.php
@@ -1,7 +1,15 @@
<?php
-
-//OC::$CLASSPATH['OCA\Files_Trashbin\Hooks'] = 'files_trashbin/lib/hooks.php';
-//OC::$CLASSPATH['OCA\Files_Trashbin\Trashbin'] = 'files_trashbin/lib/trash.php';
+$l = OC_L10N::get('files_trashbin');
// register hooks
\OCA\Files_Trashbin\Trashbin::registerHooks();
+
+\OCA\Files\App::getNavigationManager()->add(
+array(
+ "id" => 'trashbin',
+ "appname" => 'files_trashbin',
+ "script" => 'list.php',
+ "order" => 1,
+ "name" => $l->t('Deleted files')
+)
+);
diff --git a/apps/files_trashbin/appinfo/routes.php b/apps/files_trashbin/appinfo/routes.php
index b1c3f02741e..42398a06c8b 100644
--- a/apps/files_trashbin/appinfo/routes.php
+++ b/apps/files_trashbin/appinfo/routes.php
@@ -1,5 +1,6 @@
<?php
-$this->create('core_ajax_trashbin_preview', '/preview.png')->action(
+/** @var $this \OCP\Route\IRouter */
+$this->create('core_ajax_trashbin_preview', '/preview')->action(
function() {
require_once __DIR__ . '/../ajax/preview.php';
-}); \ No newline at end of file
+});
diff --git a/apps/files_trashbin/css/trash.css b/apps/files_trashbin/css/trash.css
index 7ca3e355fc2..04b4a175c83 100644
--- a/apps/files_trashbin/css/trash.css
+++ b/apps/files_trashbin/css/trash.css
@@ -1,4 +1,13 @@
-#fileList tr[data-type="file"] td a.name,
-#fileList tr[data-type="file"] td a.name span {
+/*
+ * Copyright (c) 2014
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
+#app-content-trashbin tbody tr[data-type="file"] td a.name,
+#app-content-trashbin tbody tr[data-type="file"] td a.name span {
cursor: default;
}
diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php
deleted file mode 100644
index 6e6a8a38307..00000000000
--- a/apps/files_trashbin/index.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-// Check if we are a user
-OCP\User::checkLoggedIn();
-
-OCP\App::setActiveNavigationEntry('files_index');
-
-OCP\Util::addScript('files_trashbin', 'disableDefaultActions');
-OCP\Util::addScript('files', 'fileactions');
-$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
-
-OCP\Util::addStyle('files', 'files');
-OCP\Util::addStyle('files_trashbin', 'trash');
-OCP\Util::addScript('files', 'filesummary');
-OCP\Util::addScript('files', 'breadcrumb');
-OCP\Util::addScript('files', 'filelist');
-// filelist overrides
-OCP\Util::addScript('files_trashbin', 'filelist');
-OCP\Util::addscript('files', 'files');
-OCP\Util::addScript('files_trashbin', 'trash');
-
-$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
-
-$isIE8 = false;
-preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
-if (count($matches) > 0 && $matches[1] <= 8){
- $isIE8 = true;
-}
-
-// if IE8 and "?dir=path" was specified, reformat the URL to use a hash like "#?dir=path"
-if ($isIE8 && isset($_GET['dir'])){
- if ($dir === ''){
- $dir = '/';
- }
- header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
- exit();
-}
-
-$tmpl->assign('dir', $dir);
-$tmpl->assign('disableSharing', true);
-
-$tmpl->printPage();
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js
new file mode 100644
index 00000000000..aa499ae1791
--- /dev/null
+++ b/apps/files_trashbin/js/app.js
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
+
+OCA.Trashbin = {};
+OCA.Trashbin.App = {
+ _initialized: false,
+
+ initialize: function($el) {
+ if (this._initialized) {
+ return;
+ }
+ this._initialized = true;
+ this.fileList = new OCA.Trashbin.FileList(
+ $('#app-content-trashbin'), {
+ scrollContainer: $('#app-content')
+ }
+ );
+ this.registerFileActions(this.fileList);
+ },
+
+ registerFileActions: function(fileList) {
+ var self = this;
+ var fileActions = _.extend({}, OCA.Files.FileActions);
+ fileActions.clear();
+ fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename) {
+ var dir = fileList.getCurrentDirectory();
+ if (dir !== '/') {
+ dir = dir + '/';
+ }
+ fileList.changeDirectory(dir + filename);
+ });
+
+ fileActions.setDefault('dir', 'Open');
+
+ fileActions.register('all', 'Restore', OC.PERMISSION_READ, OC.imagePath('core', 'actions/history'), function(filename) {
+ var tr = fileList.findFileEl(filename);
+ var deleteAction = tr.children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ fileList.disableActions();
+ $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'), {
+ files: JSON.stringify([filename]),
+ dir: fileList.getCurrentDirectory()
+ },
+ _.bind(fileList._removeCallback, fileList)
+ );
+ }, t('files_trashbin', 'Restore'));
+
+ fileActions.register('all', 'Delete', OC.PERMISSION_READ, function() {
+ return OC.imagePath('core', 'actions/delete');
+ }, function(filename) {
+ $('.tipsy').remove();
+ var tr = fileList.findFileEl(filename);
+ var deleteAction = tr.children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ fileList.disableActions();
+ $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'), {
+ files: JSON.stringify([filename]),
+ dir: fileList.getCurrentDirectory()
+ },
+ _.bind(fileList._removeCallback, fileList)
+ );
+ });
+ fileList.setFileActions(fileActions);
+ }
+};
+
+$(document).ready(function() {
+ $('#app-content-trashbin').one('show', function() {
+ var App = OCA.Trashbin.App;
+ App.initialize($('#app-content-trashbin'));
+ // force breadcrumb init
+ // App.fileList.changeDirectory(App.fileList.getCurrentDirectory(), false, true);
+ });
+});
+
diff --git a/apps/files_trashbin/js/disableDefaultActions.js b/apps/files_trashbin/js/disableDefaultActions.js
deleted file mode 100644
index 50ceaf4696f..00000000000
--- a/apps/files_trashbin/js/disableDefaultActions.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/* disable download and sharing actions */
-var disableDownloadActions = true;
-var trashBinApp = true;
diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js
index 3bb3a92b60d..205f879f335 100644
--- a/apps/files_trashbin/js/filelist.js
+++ b/apps/files_trashbin/js/filelist.js
@@ -1,8 +1,14 @@
-/* global OC, t, FileList */
+/*
+ * Copyright (c) 2014
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
(function() {
- FileList.appName = t('files_trashbin', 'Deleted files');
-
- FileList._deletedRegExp = new RegExp(/^(.+)\.d[0-9]+$/);
+ var DELETED_REGEXP = new RegExp(/^(.+)\.d[0-9]+$/);
/**
* Convert a file name in the format filename.d12345 to the real file name.
@@ -11,194 +17,248 @@
* @param name file name
* @return converted file name
*/
- FileList.getDeletedFileName = function(name) {
+ function getDeletedFileName(name) {
name = OC.basename(name);
- var match = FileList._deletedRegExp.exec(name);
+ var match = DELETED_REGEXP.exec(name);
if (match && match.length > 1) {
name = match[1];
}
return name;
- };
-
- var oldSetCurrentDir = FileList._setCurrentDir;
- FileList._setCurrentDir = function(targetDir) {
- oldSetCurrentDir.apply(this, arguments);
-
- var baseDir = OC.basename(targetDir);
- if (baseDir !== '') {
- FileList.setPageTitle(FileList.getDeletedFileName(baseDir));
- }
- };
+ }
- var oldCreateRow = FileList._createRow;
- FileList._createRow = function() {
- // FIXME: MEGAHACK until we find a better solution
- var tr = oldCreateRow.apply(this, arguments);
- tr.find('td.filesize').remove();
- return tr;
+ var FileList = function($el) {
+ this.initialize($el);
};
+ FileList.prototype = _.extend({}, OCA.Files.FileList.prototype, {
+ id: 'trashbin',
+ appName: t('files_trashbin', 'Deleted files'),
- FileList._onClickBreadCrumb = function(e) {
- var $el = $(e.target).closest('.crumb'),
- index = $el.index(),
- $targetDir = $el.data('dir');
- // first one is home, let the link makes it default action
- if (index !== 0) {
- e.preventDefault();
- FileList.changeDirectory($targetDir);
- }
- };
+ initialize: function() {
+ var result = OCA.Files.FileList.prototype.initialize.apply(this, arguments);
+ this.$el.find('.undelete').click('click', _.bind(this._onClickRestoreSelected, this));
- var oldRenderRow = FileList._renderRow;
- FileList._renderRow = function(fileData, options) {
- options = options || {};
- var dir = FileList.getCurrentDirectory();
- var dirListing = dir !== '' && dir !== '/';
- // show deleted time as mtime
- if (fileData.mtime) {
- fileData.mtime = parseInt(fileData.mtime, 10);
- }
- if (!dirListing) {
- fileData.displayName = fileData.name;
- fileData.name = fileData.name + '.d' + Math.floor(fileData.mtime / 1000);
- }
- return oldRenderRow.call(this, fileData, options);
- };
+ this.setSort('mtime', 'desc');
+ /**
+ * Override crumb making to add "Deleted Files" entry
+ * and convert files with ".d" extensions to a more
+ * user friendly name.
+ */
+ this.breadcrumb._makeCrumbs = function() {
+ var parts = OCA.Files.BreadCrumb.prototype._makeCrumbs.apply(this, arguments);
+ for (var i = 1; i < parts.length; i++) {
+ parts[i].name = getDeletedFileName(parts[i].name);
+ }
+ return parts;
+ };
- FileList.linkTo = function(dir){
- return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
- };
+ return result;
+ },
- FileList.updateEmptyContent = function(){
- var $fileList = $('#fileList');
- var exists = $fileList.find('tr:first').exists();
- $('#emptycontent').toggleClass('hidden', exists);
- $('#filestable th').toggleClass('hidden', !exists);
- };
+ /**
+ * Override to only return read permissions
+ */
+ getDirectoryPermissions: function() {
+ return OC.PERMISSION_READ | OC.PERMISSION_DELETE;
+ },
- var oldInit = FileList.initialize;
- FileList.initialize = function() {
- var result = oldInit.apply(this, arguments);
- $('.undelete').click('click', FileList._onClickRestoreSelected);
- return result;
- };
+ _setCurrentDir: function(targetDir) {
+ OCA.Files.FileList.prototype._setCurrentDir.apply(this, arguments);
- FileList._removeCallback = function(result) {
- if (result.status !== 'success') {
- OC.dialogs.alert(result.data.message, t('files_trashbin', 'Error'));
- }
+ var baseDir = OC.basename(targetDir);
+ if (baseDir !== '') {
+ this.setPageTitle(getDeletedFileName(baseDir));
+ }
+ },
- var files = result.data.success;
- var $el;
- for (var i = 0; i < files.length; i++) {
- $el = FileList.remove(OC.basename(files[i].filename), {updateSummary: false});
- FileList.fileSummary.remove({type: $el.attr('data-type'), size: $el.attr('data-size')});
- }
- FileList.fileSummary.update();
- FileList.updateEmptyContent();
- enableActions();
- }
+ _createRow: function() {
+ // FIXME: MEGAHACK until we find a better solution
+ var tr = OCA.Files.FileList.prototype._createRow.apply(this, arguments);
+ tr.find('td.filesize').remove();
+ return tr;
+ },
- FileList._onClickRestoreSelected = function(event) {
- event.preventDefault();
- var allFiles = $('#select_all').is(':checked');
- var files = [];
- var params = {};
- disableActions();
- if (allFiles) {
- FileList.showMask();
- params = {
- allfiles: true,
- dir: FileList.getCurrentDirectory()
- };
- }
- else {
- files = _.pluck(FileList.getSelectedFiles(), 'name');
- for (var i = 0; i < files.length; i++) {
- var deleteAction = FileList.findFileEl(files[i]).children("td.date").children(".action.delete");
- deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ _renderRow: function(fileData, options) {
+ options = options || {};
+ var dir = this.getCurrentDirectory();
+ var dirListing = dir !== '' && dir !== '/';
+ // show deleted time as mtime
+ if (fileData.mtime) {
+ fileData.mtime = parseInt(fileData.mtime, 10);
}
- params = {
- files: JSON.stringify(files),
- dir: FileList.getCurrentDirectory()
- };
- }
+ if (!dirListing) {
+ fileData.displayName = fileData.name;
+ fileData.name = fileData.name + '.d' + Math.floor(fileData.mtime / 1000);
+ }
+ return OCA.Files.FileList.prototype._renderRow.call(this, fileData, options);
+ },
- $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
- params,
- function(result) {
- if (allFiles) {
- if (result.status !== 'success') {
- OC.dialogs.alert(result.data.message, t('files_trashbin', 'Error'));
- }
- FileList.hideMask();
- // simply remove all files
- FileList.setFiles([]);
- enableActions();
- }
- else {
- FileList._removeCallback(result);
- }
+ getAjaxUrl: function(action, params) {
+ var q = '';
+ if (params) {
+ q = '?' + OC.buildQueryString(params);
}
- );
- };
+ return OC.filePath('files_trashbin', 'ajax', action + '.php') + q;
+ },
- FileList._onClickDeleteSelected = function(event) {
- event.preventDefault();
- var allFiles = $('#select_all').is(':checked');
- var files = [];
- var params = {};
- if (allFiles) {
- params = {
- allfiles: true,
- dir: FileList.getCurrentDirectory()
- };
- }
- else {
- files = _.pluck(FileList.getSelectedFiles(), 'name');
- params = {
- files: JSON.stringify(files),
- dir: FileList.getCurrentDirectory()
- };
- }
+ setupUploadEvents: function() {
+ // override and do nothing
+ },
- disableActions();
- if (allFiles) {
- FileList.showMask();
- }
- else {
+ linkTo: function(dir){
+ return OC.linkTo('files', 'index.php')+"?view=trashbin&dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
+ },
+
+ updateEmptyContent: function(){
+ var exists = this.$fileList.find('tr:first').exists();
+ this.$el.find('#emptycontent').toggleClass('hidden', exists);
+ this.$el.find('#filestable th').toggleClass('hidden', !exists);
+ },
+
+ _removeCallback: function(result) {
+ if (result.status !== 'success') {
+ OC.dialogs.alert(result.data.message, t('files_trashbin', 'Error'));
+ }
+
+ var files = result.data.success;
+ var $el;
for (var i = 0; i < files.length; i++) {
- var deleteAction = FileList.findFileEl(files[i]).children("td.date").children(".action.delete");
- deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ $el = this.remove(OC.basename(files[i].filename), {updateSummary: false});
+ this.fileSummary.remove({type: $el.attr('data-type'), size: $el.attr('data-size')});
}
- }
+ this.fileSummary.update();
+ this.updateEmptyContent();
+ this.enableActions();
+ },
- $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
+ _onClickRestoreSelected: function(event) {
+ event.preventDefault();
+ var self = this;
+ var allFiles = this.$el.find('.select-all').is(':checked');
+ var files = [];
+ var params = {};
+ this.disableActions();
+ if (allFiles) {
+ this.showMask();
+ params = {
+ allfiles: true,
+ dir: this.getCurrentDirectory()
+ };
+ }
+ else {
+ files = _.pluck(this.getSelectedFiles(), 'name');
+ for (var i = 0; i < files.length; i++) {
+ var deleteAction = this.findFileEl(files[i]).children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ }
+ params = {
+ files: JSON.stringify(files),
+ dir: this.getCurrentDirectory()
+ };
+ }
+
+ $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
params,
function(result) {
if (allFiles) {
if (result.status !== 'success') {
OC.dialogs.alert(result.data.message, t('files_trashbin', 'Error'));
}
- FileList.hideMask();
+ self.hideMask();
// simply remove all files
- FileList.setFiles([]);
- enableActions();
+ self.setFiles([]);
+ self.enableActions();
}
else {
- FileList._removeCallback(result);
+ self._removeCallback(result);
}
}
- );
- };
+ );
+ },
- var oldClickFile = FileList._onClickFile;
- FileList._onClickFile = function(event) {
- var mime = $(this).parent().parent().data('mime');
- if (mime !== 'httpd/unix-directory') {
+ _onClickDeleteSelected: function(event) {
event.preventDefault();
+ var self = this;
+ var allFiles = this.$el.find('.select-all').is(':checked');
+ var files = [];
+ var params = {};
+ if (allFiles) {
+ params = {
+ allfiles: true,
+ dir: this.getCurrentDirectory()
+ };
+ }
+ else {
+ files = _.pluck(this.getSelectedFiles(), 'name');
+ params = {
+ files: JSON.stringify(files),
+ dir: this.getCurrentDirectory()
+ };
+ }
+
+ this.disableActions();
+ if (allFiles) {
+ this.showMask();
+ }
+ else {
+ for (var i = 0; i < files.length; i++) {
+ var deleteAction = this.findFileEl(files[i]).children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ }
+ }
+
+ $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
+ params,
+ function(result) {
+ if (allFiles) {
+ if (result.status !== 'success') {
+ OC.dialogs.alert(result.data.message, t('files_trashbin', 'Error'));
+ }
+ self.hideMask();
+ // simply remove all files
+ self.setFiles([]);
+ self.enableActions();
+ }
+ else {
+ self._removeCallback(result);
+ }
+ }
+ );
+ },
+
+ _onClickFile: function(event) {
+ var mime = $(this).parent().parent().data('mime');
+ if (mime !== 'httpd/unix-directory') {
+ event.preventDefault();
+ }
+ return OCA.Files.FileList.prototype._onClickFile.apply(this, arguments);
+ },
+
+ generatePreviewUrl: function(urlSpec) {
+ return OC.generateUrl('/apps/files_trashbin/ajax/preview.php?') + $.param(urlSpec);
+ },
+
+ getDownloadUrl: function() {
+ // no downloads
+ return '#';
+ },
+
+ enableActions: function() {
+ this.$el.find('.action').css('display', 'inline');
+ this.$el.find(':input:checkbox').css('display', 'inline');
+ },
+
+ disableActions: function() {
+ this.$el.find('.action').css('display', 'none');
+ this.$el.find(':input:checkbox').css('display', 'none');
+ },
+
+ updateStorageStatistics: function() {
+ // no op because the trashbin doesn't have
+ // storage info like free space / used space
}
- return oldClickFile.apply(this, arguments);
- };
+ });
+
+ OCA.Trashbin.FileList = FileList;
})();
+
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js
deleted file mode 100644
index 5f2436de809..00000000000
--- a/apps/files_trashbin/js/trash.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2014
- *
- * This file is licensed under the Affero General Public License version 3
- * or later.
- *
- * See the COPYING-README file.
- *
- */
-
-/* global OC, t, BreadCrumb, FileActions, FileList, Files */
-$(document).ready(function() {
- var deletedRegExp = new RegExp(/^(.+)\.d[0-9]+$/);
-
- /**
- * Convert a file name in the format filename.d12345 to the real file name.
- * This will use basename.
- * The name will not be changed if it has no ".d12345" suffix.
- * @param name file name
- * @return converted file name
- */
- function getDeletedFileName(name) {
- name = OC.basename(name);
- var match = deletedRegExp.exec(name);
- if (match && match.length > 1) {
- name = match[1];
- }
- return name;
- }
-
- Files.updateStorageStatistics = function() {
- // no op because the trashbin doesn't have
- // storage info like free space / used space
- };
-
- if (typeof FileActions !== 'undefined') {
- FileActions.register('all', 'Restore', OC.PERMISSION_READ, OC.imagePath('core', 'actions/history'), function(filename) {
- var tr = FileList.findFileEl(filename);
- var deleteAction = tr.children("td.date").children(".action.delete");
- deleteAction.removeClass('delete-icon').addClass('progress-icon');
- disableActions();
- $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'), {
- files: JSON.stringify([filename]),
- dir: FileList.getCurrentDirectory()
- },
- FileList._removeCallback
- );
- }, t('files_trashbin', 'Restore'));
- };
-
- FileActions.register('all', 'Delete', OC.PERMISSION_READ, function() {
- return OC.imagePath('core', 'actions/delete');
- }, function(filename) {
- $('.tipsy').remove();
- var tr = FileList.findFileEl(filename);
- var deleteAction = tr.children("td.date").children(".action.delete");
- deleteAction.removeClass('delete-icon').addClass('progress-icon');
- disableActions();
- $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'), {
- files: JSON.stringify([filename]),
- dir: FileList.getCurrentDirectory()
- },
- FileList._removeCallback
- );
- });
-
- /**
- * Override crumb URL maker (hacky!)
- */
- FileList.breadcrumb.getCrumbUrl = function(part, index) {
- if (index === 0) {
- return OC.linkTo('files', 'index.php');
- }
- return OC.linkTo('files_trashbin', 'index.php')+"?dir=" + encodeURIComponent(part.dir);
- };
-
- Files.generatePreviewUrl = function(urlSpec) {
- return OC.generateUrl('/apps/files_trashbin/ajax/preview.php?') + $.param(urlSpec);
- };
-
- Files.getDownloadUrl = function(action, params) {
- // no downloads
- return '#';
- };
-
- Files.getAjaxUrl = function(action, params) {
- var q = '';
- if (params) {
- q = '?' + OC.buildQueryString(params);
- }
- return OC.filePath('files_trashbin', 'ajax', action + '.php') + q;
- };
-
-
- /**
- * Override crumb making to add "Deleted Files" entry
- * and convert files with ".d" extensions to a more
- * user friendly name.
- */
- var oldMakeCrumbs = BreadCrumb.prototype._makeCrumbs;
- BreadCrumb.prototype._makeCrumbs = function() {
- var parts = oldMakeCrumbs.apply(this, arguments);
- // duplicate first part
- parts.unshift(parts[0]);
- parts[1] = {
- dir: '/',
- name: t('files_trashbin', 'Deleted Files')
- };
- for (var i = 2; i < parts.length; i++) {
- parts[i].name = getDeletedFileName(parts[i].name);
- }
- return parts;
- };
-
- FileActions.actions.dir = {
- // only keep 'Open' action for navigation
- 'Open': FileActions.actions.dir.Open
- };
-});
-
-function enableActions() {
- $(".action").css("display", "inline");
- $(":input:checkbox").css("display", "inline");
-}
-
-function disableActions() {
- $(".action").css("display", "none");
- $(":input:checkbox").css("display", "none");
-}
-
diff --git a/apps/files_trashbin/l10n/ar.php b/apps/files_trashbin/l10n/ar.php
index b3abc7df86e..5a6105bda6f 100644
--- a/apps/files_trashbin/l10n/ar.php
+++ b/apps/files_trashbin/l10n/ar.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "تعذّر حذف%s بشكل دائم",
"Couldn't restore %s" => "تعذّر استرجاع %s ",
"Deleted files" => "حذف الملفات",
+"Restore" => "استعيد",
"Error" => "خطأ",
-"Deleted Files" => "الملفات المحذوفه",
"restored" => "تمت الاستعادة",
"Nothing in here. Your trash bin is empty!" => "لا يوجد شيء هنا. سلة المهملات خاليه.",
"Name" => "اسم",
-"Restore" => "استعيد",
"Deleted" => "تم الحذف",
"Delete" => "إلغاء"
);
diff --git a/apps/files_trashbin/l10n/ast.php b/apps/files_trashbin/l10n/ast.php
index 688e1ce3d8f..3240d6751c1 100644
--- a/apps/files_trashbin/l10n/ast.php
+++ b/apps/files_trashbin/l10n/ast.php
@@ -2,11 +2,12 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nun pudo desaniciase %s dafechu",
"Couldn't restore %s" => "Nun pudo restaurase %s",
+"Deleted files" => "Ficheros desaniciaos",
+"Restore" => "Restaurar",
"Error" => "Fallu",
-"Deleted Files" => "Ficheros desaniciaos",
+"restored" => "recuperóse",
"Nothing in here. Your trash bin is empty!" => "Nun hai un res equí. La papelera ta balera!",
"Name" => "Nome",
-"Restore" => "Restaurar",
"Deleted" => "Desaniciáu",
"Delete" => "Desaniciar"
);
diff --git a/apps/files_trashbin/l10n/bg_BG.php b/apps/files_trashbin/l10n/bg_BG.php
index 8c9e658068c..62057538ce4 100644
--- a/apps/files_trashbin/l10n/bg_BG.php
+++ b/apps/files_trashbin/l10n/bg_BG.php
@@ -2,11 +2,10 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Невъзможно перманентното изтриване на %s",
"Couldn't restore %s" => "Невъзможно възтановяване на %s",
+"Restore" => "Възтановяване",
"Error" => "Грешка",
-"Deleted Files" => "Изтрити файлове",
"Nothing in here. Your trash bin is empty!" => "Няма нищо. Кофата е празна!",
"Name" => "Име",
-"Restore" => "Възтановяване",
"Deleted" => "Изтрито",
"Delete" => "Изтриване"
);
diff --git a/apps/files_trashbin/l10n/ca.php b/apps/files_trashbin/l10n/ca.php
index 196d6ac00a4..59b42797cf9 100644
--- a/apps/files_trashbin/l10n/ca.php
+++ b/apps/files_trashbin/l10n/ca.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No s'ha pogut esborrar permanentment %s",
"Couldn't restore %s" => "No s'ha pogut restaurar %s",
"Deleted files" => "Fitxers esborrats",
+"Restore" => "Recupera",
"Error" => "Error",
-"Deleted Files" => "Fitxers eliminats",
"restored" => "restaurat",
"Nothing in here. Your trash bin is empty!" => "La paperera està buida!",
"Name" => "Nom",
-"Restore" => "Recupera",
"Deleted" => "Eliminat",
"Delete" => "Esborra"
);
diff --git a/apps/files_trashbin/l10n/cs_CZ.php b/apps/files_trashbin/l10n/cs_CZ.php
index ed795582e43..3e4f9e0e15a 100644
--- a/apps/files_trashbin/l10n/cs_CZ.php
+++ b/apps/files_trashbin/l10n/cs_CZ.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nelze trvale odstranit %s",
"Couldn't restore %s" => "Nelze obnovit %s",
"Deleted files" => "Odstraněné soubory",
+"Restore" => "Obnovit",
"Error" => "Chyba",
-"Deleted Files" => "Smazané soubory",
"restored" => "obnoveno",
"Nothing in here. Your trash bin is empty!" => "Žádný obsah. Váš koš je prázdný.",
"Name" => "Název",
-"Restore" => "Obnovit",
"Deleted" => "Smazáno",
"Delete" => "Smazat"
);
diff --git a/apps/files_trashbin/l10n/cy_GB.php b/apps/files_trashbin/l10n/cy_GB.php
index 7b1405777dd..4e76a6d25ab 100644
--- a/apps/files_trashbin/l10n/cy_GB.php
+++ b/apps/files_trashbin/l10n/cy_GB.php
@@ -3,11 +3,10 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Methwyd dileu %s yn barhaol",
"Couldn't restore %s" => "Methwyd adfer %s",
"Deleted files" => "Ffeiliau ddilewyd",
+"Restore" => "Adfer",
"Error" => "Gwall",
-"Deleted Files" => "Ffeiliau Ddilewyd",
"Nothing in here. Your trash bin is empty!" => "Does dim byd yma. Mae eich bin sbwriel yn wag!",
"Name" => "Enw",
-"Restore" => "Adfer",
"Deleted" => "Wedi dileu",
"Delete" => "Dileu"
);
diff --git a/apps/files_trashbin/l10n/da.php b/apps/files_trashbin/l10n/da.php
index 7f7b65bca2c..b651d81d1bd 100644
--- a/apps/files_trashbin/l10n/da.php
+++ b/apps/files_trashbin/l10n/da.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kunne ikke slette %s permanent",
"Couldn't restore %s" => "Kunne ikke gendanne %s",
"Deleted files" => "Slettede filer",
+"Restore" => "Gendan",
"Error" => "Fejl",
-"Deleted Files" => "Slettede filer",
"restored" => "Gendannet",
"Nothing in here. Your trash bin is empty!" => "Intet at se her. Din papirkurv er tom!",
"Name" => "Navn",
-"Restore" => "Gendan",
"Deleted" => "Slettet",
"Delete" => "Slet"
);
diff --git a/apps/files_trashbin/l10n/de.php b/apps/files_trashbin/l10n/de.php
index 4778e159e1d..56b7ccfc7bd 100644
--- a/apps/files_trashbin/l10n/de.php
+++ b/apps/files_trashbin/l10n/de.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen",
"Couldn't restore %s" => "Konnte %s nicht wiederherstellen",
"Deleted files" => "Gelöschte Dateien",
+"Restore" => "Wiederherstellen",
"Error" => "Fehler",
-"Deleted Files" => "Gelöschte Dateien",
"restored" => "Wiederhergestellt",
"Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, der Papierkorb ist leer!",
"Name" => "Name",
-"Restore" => "Wiederherstellen",
"Deleted" => "gelöscht",
"Delete" => "Löschen"
);
diff --git a/apps/files_trashbin/l10n/de_CH.php b/apps/files_trashbin/l10n/de_CH.php
index 603d82f5c7a..be54e57d3f3 100644
--- a/apps/files_trashbin/l10n/de_CH.php
+++ b/apps/files_trashbin/l10n/de_CH.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen",
"Couldn't restore %s" => "Konnte %s nicht wiederherstellen",
"Deleted files" => "Gelöschte Dateien",
+"Restore" => "Wiederherstellen",
"Error" => "Fehler",
-"Deleted Files" => "Gelöschte Dateien",
"restored" => "Wiederhergestellt",
"Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, Ihr Papierkorb ist leer!",
"Name" => "Name",
-"Restore" => "Wiederherstellen",
"Deleted" => "Gelöscht",
"Delete" => "Löschen"
);
diff --git a/apps/files_trashbin/l10n/de_DE.php b/apps/files_trashbin/l10n/de_DE.php
index 603d82f5c7a..be54e57d3f3 100644
--- a/apps/files_trashbin/l10n/de_DE.php
+++ b/apps/files_trashbin/l10n/de_DE.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Konnte %s nicht dauerhaft löschen",
"Couldn't restore %s" => "Konnte %s nicht wiederherstellen",
"Deleted files" => "Gelöschte Dateien",
+"Restore" => "Wiederherstellen",
"Error" => "Fehler",
-"Deleted Files" => "Gelöschte Dateien",
"restored" => "Wiederhergestellt",
"Nothing in here. Your trash bin is empty!" => "Nichts zu löschen, Ihr Papierkorb ist leer!",
"Name" => "Name",
-"Restore" => "Wiederherstellen",
"Deleted" => "Gelöscht",
"Delete" => "Löschen"
);
diff --git a/apps/files_trashbin/l10n/el.php b/apps/files_trashbin/l10n/el.php
index 23b23ed93a6..c77bfb7fa16 100644
--- a/apps/files_trashbin/l10n/el.php
+++ b/apps/files_trashbin/l10n/el.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Αδύνατη η μόνιμη διαγραφή του %s",
"Couldn't restore %s" => "Αδυναμία επαναφοράς %s",
"Deleted files" => "Διαγραμμένα αρχεία",
+"Restore" => "Επαναφορά",
"Error" => "Σφάλμα",
-"Deleted Files" => "Διαγραμμένα Αρχεία",
"restored" => "επαναφέρθηκαν",
"Nothing in here. Your trash bin is empty!" => "Δεν υπάρχει τίποτα εδώ. Ο κάδος σας είναι άδειος!",
"Name" => "Όνομα",
-"Restore" => "Επαναφορά",
"Deleted" => "Διαγραμμένα",
"Delete" => "Διαγραφή"
);
diff --git a/apps/files_trashbin/l10n/en_GB.php b/apps/files_trashbin/l10n/en_GB.php
index a660b4b1ca1..b2715dfceb7 100644
--- a/apps/files_trashbin/l10n/en_GB.php
+++ b/apps/files_trashbin/l10n/en_GB.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Couldn't delete %s permanently",
"Couldn't restore %s" => "Couldn't restore %s",
"Deleted files" => "Deleted files",
+"Restore" => "Restore",
"Error" => "Error",
-"Deleted Files" => "Deleted Files",
"restored" => "restored",
"Nothing in here. Your trash bin is empty!" => "Nothing in here. Your recycle bin is empty!",
"Name" => "Name",
-"Restore" => "Restore",
"Deleted" => "Deleted",
"Delete" => "Delete"
);
diff --git a/apps/files_trashbin/l10n/eo.php b/apps/files_trashbin/l10n/eo.php
index d644f0f6420..67617f448d0 100644
--- a/apps/files_trashbin/l10n/eo.php
+++ b/apps/files_trashbin/l10n/eo.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Ne povis foriĝi %s por ĉiam",
"Couldn't restore %s" => "Ne povis restaŭriĝi %s",
"Deleted files" => "Forigitaj dosieroj",
+"Restore" => "Restaŭri",
"Error" => "Eraro",
-"Deleted Files" => "Forigitaj dosieroj",
"restored" => "restaŭrita",
"Nothing in here. Your trash bin is empty!" => "Nenio estas ĉi tie. Via rubujo malplenas!",
"Name" => "Nomo",
-"Restore" => "Restaŭri",
"Deleted" => "Forigita",
"Delete" => "Forigi"
);
diff --git a/apps/files_trashbin/l10n/es.php b/apps/files_trashbin/l10n/es.php
index c0dc6bb45c2..c3db7765154 100644
--- a/apps/files_trashbin/l10n/es.php
+++ b/apps/files_trashbin/l10n/es.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No se puede eliminar %s permanentemente",
"Couldn't restore %s" => "No se puede restaurar %s",
"Deleted files" => "Archivos eliminados",
+"Restore" => "Recuperar",
"Error" => "Error",
-"Deleted Files" => "Archivos Eliminados",
"restored" => "recuperado",
"Nothing in here. Your trash bin is empty!" => "No hay nada aquí. ¡Tu papelera esta vacía!",
"Name" => "Nombre",
-"Restore" => "Recuperar",
"Deleted" => "Eliminado",
"Delete" => "Eliminar"
);
diff --git a/apps/files_trashbin/l10n/es_AR.php b/apps/files_trashbin/l10n/es_AR.php
index b354dd656b1..2991ea507b0 100644
--- a/apps/files_trashbin/l10n/es_AR.php
+++ b/apps/files_trashbin/l10n/es_AR.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No fue posible borrar %s de manera permanente",
"Couldn't restore %s" => "No se pudo restaurar %s",
"Deleted files" => "Archivos borrados",
+"Restore" => "Recuperar",
"Error" => "Error",
-"Deleted Files" => "Archivos eliminados",
"restored" => "recuperado",
"Nothing in here. Your trash bin is empty!" => "No hay nada acá. ¡La papelera está vacía!",
"Name" => "Nombre",
-"Restore" => "Recuperar",
"Deleted" => "Borrado",
"Delete" => "Borrar"
);
diff --git a/apps/files_trashbin/l10n/es_MX.php b/apps/files_trashbin/l10n/es_MX.php
index c0dc6bb45c2..c3db7765154 100644
--- a/apps/files_trashbin/l10n/es_MX.php
+++ b/apps/files_trashbin/l10n/es_MX.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "No se puede eliminar %s permanentemente",
"Couldn't restore %s" => "No se puede restaurar %s",
"Deleted files" => "Archivos eliminados",
+"Restore" => "Recuperar",
"Error" => "Error",
-"Deleted Files" => "Archivos Eliminados",
"restored" => "recuperado",
"Nothing in here. Your trash bin is empty!" => "No hay nada aquí. ¡Tu papelera esta vacía!",
"Name" => "Nombre",
-"Restore" => "Recuperar",
"Deleted" => "Eliminado",
"Delete" => "Eliminar"
);
diff --git a/apps/files_trashbin/l10n/et_EE.php b/apps/files_trashbin/l10n/et_EE.php
index 69d20cb195f..c1c9ea66c4f 100644
--- a/apps/files_trashbin/l10n/et_EE.php
+++ b/apps/files_trashbin/l10n/et_EE.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s jäädavalt kustutamine ebaõnnestus",
"Couldn't restore %s" => "%s ei saa taastada",
"Deleted files" => "Kustutatud failid",
+"Restore" => "Taasta",
"Error" => "Viga",
-"Deleted Files" => "Kustutatud failid",
"restored" => "taastatud",
"Nothing in here. Your trash bin is empty!" => "Siin pole midagi. Sinu prügikast on tühi!",
"Name" => "Nimi",
-"Restore" => "Taasta",
"Deleted" => "Kustutatud",
"Delete" => "Kustuta"
);
diff --git a/apps/files_trashbin/l10n/eu.php b/apps/files_trashbin/l10n/eu.php
index 42476bccfe4..63c1245da06 100644
--- a/apps/files_trashbin/l10n/eu.php
+++ b/apps/files_trashbin/l10n/eu.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Ezin izan da %s betirako ezabatu",
"Couldn't restore %s" => "Ezin izan da %s berreskuratu",
"Deleted files" => "Ezabatutako fitxategiak",
+"Restore" => "Berrezarri",
"Error" => "Errorea",
-"Deleted Files" => "Ezabatutako Fitxategiak",
"restored" => "Berrezarrita",
"Nothing in here. Your trash bin is empty!" => "Ez dago ezer ez. Zure zakarrontzia hutsik dago!",
"Name" => "Izena",
-"Restore" => "Berrezarri",
"Deleted" => "Ezabatuta",
"Delete" => "Ezabatu"
);
diff --git a/apps/files_trashbin/l10n/fa.php b/apps/files_trashbin/l10n/fa.php
index 407524eb620..0823e98ea1c 100644
--- a/apps/files_trashbin/l10n/fa.php
+++ b/apps/files_trashbin/l10n/fa.php
@@ -3,11 +3,10 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s را نمی توان برای همیشه حذف کرد",
"Couldn't restore %s" => "%s را نمی توان بازگرداند",
"Deleted files" => "فایل های حذف شده",
+"Restore" => "بازیابی",
"Error" => "خطا",
-"Deleted Files" => "فایلهای حذف شده",
"Nothing in here. Your trash bin is empty!" => "هیچ چیزی اینجا نیست. سطل زباله ی شما خالی است.",
"Name" => "نام",
-"Restore" => "بازیابی",
"Deleted" => "حذف شده",
"Delete" => "حذف"
);
diff --git a/apps/files_trashbin/l10n/fi_FI.php b/apps/files_trashbin/l10n/fi_FI.php
index da56baf0bd7..158fc7dac55 100644
--- a/apps/files_trashbin/l10n/fi_FI.php
+++ b/apps/files_trashbin/l10n/fi_FI.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kohdetta %s ei voitu poistaa pysyvästi",
"Couldn't restore %s" => "Kohteen %s palautus epäonnistui",
"Deleted files" => "Poistetut tiedostot",
+"Restore" => "Palauta",
"Error" => "Virhe",
-"Deleted Files" => "Poistetut tiedostot",
"restored" => "palautettu",
"Nothing in here. Your trash bin is empty!" => "Tyhjää täynnä! Roskakorissa ei ole mitään.",
"Name" => "Nimi",
-"Restore" => "Palauta",
"Deleted" => "Poistettu",
"Delete" => "Poista"
);
diff --git a/apps/files_trashbin/l10n/fr.php b/apps/files_trashbin/l10n/fr.php
index b71fbea96ad..0e6330bb2d0 100644
--- a/apps/files_trashbin/l10n/fr.php
+++ b/apps/files_trashbin/l10n/fr.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Impossible d'effacer %s de façon permanente",
"Couldn't restore %s" => "Impossible de restaurer %s",
"Deleted files" => "Fichiers supprimés",
+"Restore" => "Restaurer",
"Error" => "Erreur",
-"Deleted Files" => "Fichiers effacés",
"restored" => "restauré",
"Nothing in here. Your trash bin is empty!" => "Il n'y a rien ici. Votre corbeille est vide !",
"Name" => "Nom",
-"Restore" => "Restaurer",
"Deleted" => "Effacé",
"Delete" => "Supprimer"
);
diff --git a/apps/files_trashbin/l10n/gl.php b/apps/files_trashbin/l10n/gl.php
index fe74ab34a02..143cf0e6df5 100644
--- a/apps/files_trashbin/l10n/gl.php
+++ b/apps/files_trashbin/l10n/gl.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Non foi posíbel eliminar %s permanente",
"Couldn't restore %s" => "Non foi posíbel restaurar %s",
"Deleted files" => "Ficheiros eliminados",
+"Restore" => "Restablecer",
"Error" => "Erro",
-"Deleted Files" => "Ficheiros eliminados",
"restored" => "restaurado",
"Nothing in here. Your trash bin is empty!" => "Aquí non hai nada. O cesto do lixo está baleiro!",
"Name" => "Nome",
-"Restore" => "Restablecer",
"Deleted" => "Eliminado",
"Delete" => "Eliminar"
);
diff --git a/apps/files_trashbin/l10n/he.php b/apps/files_trashbin/l10n/he.php
index 6cdc5c05c9d..90b3fd11ab5 100644
--- a/apps/files_trashbin/l10n/he.php
+++ b/apps/files_trashbin/l10n/he.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "לא ניתן למחוק את %s לצמיתות",
"Couldn't restore %s" => "לא ניתן לשחזר את %s",
"Deleted files" => "קבצים שנמחקו",
+"Restore" => "שחזור",
"Error" => "שגיאה",
-"Deleted Files" => "קבצים שנמחקו",
"restored" => "שוחזר",
"Nothing in here. Your trash bin is empty!" => "אין כאן שום דבר. סל המיחזור שלך ריק!",
"Name" => "שם",
-"Restore" => "שחזור",
"Deleted" => "נמחק",
"Delete" => "מחיקה"
);
diff --git a/apps/files_trashbin/l10n/hu_HU.php b/apps/files_trashbin/l10n/hu_HU.php
index 2912821d96f..60f3ebad856 100644
--- a/apps/files_trashbin/l10n/hu_HU.php
+++ b/apps/files_trashbin/l10n/hu_HU.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nem sikerült %s végleges törlése",
"Couldn't restore %s" => "Nem sikerült %s visszaállítása",
"Deleted files" => "Törölt fájlok",
+"Restore" => "Visszaállítás",
"Error" => "Hiba",
-"Deleted Files" => "Törölt fájlok",
"restored" => "visszaállítva",
"Nothing in here. Your trash bin is empty!" => "Itt nincs semmi. Az Ön szemetes mappája üres!",
"Name" => "Név",
-"Restore" => "Visszaállítás",
"Deleted" => "Törölve",
"Delete" => "Törlés"
);
diff --git a/apps/files_trashbin/l10n/id.php b/apps/files_trashbin/l10n/id.php
index 166b9aa811a..bba9e329eeb 100644
--- a/apps/files_trashbin/l10n/id.php
+++ b/apps/files_trashbin/l10n/id.php
@@ -3,11 +3,10 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Tidak dapat menghapus permanen %s",
"Couldn't restore %s" => "Tidak dapat memulihkan %s",
"Deleted files" => "Berkas yang dihapus",
+"Restore" => "Pulihkan",
"Error" => "Galat",
-"Deleted Files" => "Berkas yang Dihapus",
"Nothing in here. Your trash bin is empty!" => "Tempat sampah anda kosong!",
"Name" => "Nama",
-"Restore" => "Pulihkan",
"Deleted" => "Dihapus",
"Delete" => "Hapus"
);
diff --git a/apps/files_trashbin/l10n/it.php b/apps/files_trashbin/l10n/it.php
index 057305ac517..905384b82bb 100644
--- a/apps/files_trashbin/l10n/it.php
+++ b/apps/files_trashbin/l10n/it.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Impossibile eliminare %s definitivamente",
"Couldn't restore %s" => "Impossibile ripristinare %s",
"Deleted files" => "File eliminati",
+"Restore" => "Ripristina",
"Error" => "Errore",
-"Deleted Files" => "File eliminati",
"restored" => "ripristinati",
"Nothing in here. Your trash bin is empty!" => "Qui non c'è niente. Il tuo cestino è vuoto.",
"Name" => "Nome",
-"Restore" => "Ripristina",
"Deleted" => "Eliminati",
"Delete" => "Elimina"
);
diff --git a/apps/files_trashbin/l10n/ja.php b/apps/files_trashbin/l10n/ja.php
index 13ca95e6fb4..b24e40aa23d 100644
--- a/apps/files_trashbin/l10n/ja.php
+++ b/apps/files_trashbin/l10n/ja.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s を完全に削除できませんでした",
"Couldn't restore %s" => "%s を復元できませんでした",
"Deleted files" => "ゴミ箱",
+"Restore" => "復元",
"Error" => "エラー",
-"Deleted Files" => "ゴミ箱",
"restored" => "復元済",
"Nothing in here. Your trash bin is empty!" => "ここには何もありません。ゴミ箱は空です!",
"Name" => "名前",
-"Restore" => "復元",
"Deleted" => "削除済み",
"Delete" => "削除"
);
diff --git a/apps/files_trashbin/l10n/ka_GE.php b/apps/files_trashbin/l10n/ka_GE.php
index 4e3ad4260e3..16e147bd416 100644
--- a/apps/files_trashbin/l10n/ka_GE.php
+++ b/apps/files_trashbin/l10n/ka_GE.php
@@ -3,11 +3,10 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "ფაილი %s–ის სრულად წაშლა ვერ მოხერხდა",
"Couldn't restore %s" => "%s–ის აღდგენა ვერ მოხერხდა",
"Deleted files" => "წაშლილი ფაილები",
+"Restore" => "აღდგენა",
"Error" => "შეცდომა",
-"Deleted Files" => "წაშლილი ფაილები",
"Nothing in here. Your trash bin is empty!" => "აქ არაფერი არ არის. სანაგვე ყუთი ცარიელია!",
"Name" => "სახელი",
-"Restore" => "აღდგენა",
"Deleted" => "წაშლილი",
"Delete" => "წაშლა"
);
diff --git a/apps/files_trashbin/l10n/km.php b/apps/files_trashbin/l10n/km.php
index 1df805de2d6..40119afc878 100644
--- a/apps/files_trashbin/l10n/km.php
+++ b/apps/files_trashbin/l10n/km.php
@@ -1,8 +1,14 @@
<?php
$TRANSLATIONS = array(
+"Couldn't delete %s permanently" => "មិន​អាច​លុប %s ចោល​ជា​អចិន្ត្រៃយ៍​ទេ",
+"Couldn't restore %s" => "មិន​អាច​ស្ដារ %s ឡើង​វិញ​បាន​ទេ",
+"Deleted files" => "ឯកសារ​ដែល​បាន​លុប",
+"Restore" => "ស្ដារ​មក​វិញ",
"Error" => "កំហុស",
+"restored" => "បាន​ស្ដារ​វិញ",
+"Nothing in here. Your trash bin is empty!" => "គ្មាន​អ្វី​នៅ​ទីនេះ​ទេ។ ធុង​សំរាម​របស់​អ្នក​គឺ​ទទេ!",
"Name" => "ឈ្មោះ",
-"Restore" => "ស្ដារ​មក​វិញ",
+"Deleted" => "បាន​លុប",
"Delete" => "លុប"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/apps/files_trashbin/l10n/ko.php b/apps/files_trashbin/l10n/ko.php
index d9d87070804..98800fd2e58 100644
--- a/apps/files_trashbin/l10n/ko.php
+++ b/apps/files_trashbin/l10n/ko.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s을(를_ 영구적으로 삭제할 수 없습니다",
"Couldn't restore %s" => "%s을(를) 복원할 수 없습니다",
"Deleted files" => "삭제된 파일",
+"Restore" => "복원",
"Error" => "오류",
-"Deleted Files" => "삭제된 파일",
"restored" => "복원됨",
"Nothing in here. Your trash bin is empty!" => "휴지통이 비어 있습니다!",
"Name" => "이름",
-"Restore" => "복원",
"Deleted" => "삭제됨",
"Delete" => "삭제"
);
diff --git a/apps/files_trashbin/l10n/lt_LT.php b/apps/files_trashbin/l10n/lt_LT.php
index 2bf545483f6..fa65d7eabac 100644
--- a/apps/files_trashbin/l10n/lt_LT.php
+++ b/apps/files_trashbin/l10n/lt_LT.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nepavyko negrįžtamai ištrinti %s",
"Couldn't restore %s" => "Nepavyko atkurti %s",
"Deleted files" => "Ištrinti failai",
+"Restore" => "Atstatyti",
"Error" => "Klaida",
-"Deleted Files" => "Ištrinti failai",
"restored" => "atstatyta",
"Nothing in here. Your trash bin is empty!" => "Nieko nėra. Jūsų šiukšliadėžė tuščia!",
"Name" => "Pavadinimas",
-"Restore" => "Atstatyti",
"Deleted" => "Ištrinti",
"Delete" => "Ištrinti"
);
diff --git a/apps/files_trashbin/l10n/lv.php b/apps/files_trashbin/l10n/lv.php
index c173d050147..3432f9ac75e 100644
--- a/apps/files_trashbin/l10n/lv.php
+++ b/apps/files_trashbin/l10n/lv.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nevarēja pilnībā izdzēst %s",
"Couldn't restore %s" => "Nevarēja atjaunot %s",
"Deleted files" => "Dzēstās datnes",
+"Restore" => "Atjaunot",
"Error" => "Kļūda",
-"Deleted Files" => "Dzēstās datnes",
"restored" => "atjaunots",
"Nothing in here. Your trash bin is empty!" => "Šeit nekā nav. Jūsu miskaste ir tukša!",
"Name" => "Nosaukums",
-"Restore" => "Atjaunot",
"Deleted" => "Dzēsts",
"Delete" => "Dzēst"
);
diff --git a/apps/files_trashbin/l10n/mk.php b/apps/files_trashbin/l10n/mk.php
index 910b11e21e6..66c2d0a2961 100644
--- a/apps/files_trashbin/l10n/mk.php
+++ b/apps/files_trashbin/l10n/mk.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Не можеше трајно да се избрише %s",
"Couldn't restore %s" => "Не можеше да се поврати %s",
"Deleted files" => "Избришани датотеки",
+"Restore" => "Поврати",
"Error" => "Грешка",
-"Deleted Files" => "Избришани датотеки",
"restored" => "повратени",
"Nothing in here. Your trash bin is empty!" => "Тука нема ништо. Вашата корпа за отпадоци е празна!",
"Name" => "Име",
-"Restore" => "Поврати",
"Deleted" => "Избришан",
"Delete" => "Избриши"
);
diff --git a/apps/files_trashbin/l10n/ms_MY.php b/apps/files_trashbin/l10n/ms_MY.php
index f084f58465d..fdfd922438c 100644
--- a/apps/files_trashbin/l10n/ms_MY.php
+++ b/apps/files_trashbin/l10n/ms_MY.php
@@ -2,12 +2,11 @@
$TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Tidak dapat menghapuskan %s secara kekal",
"Couldn't restore %s" => "Tidak dapat memulihkan %s",
+"Restore" => "Pulihkan",
"Error" => "Ralat",
-"Deleted Files" => "Fail Dihapus",
"restored" => "dipulihkan",
"Nothing in here. Your trash bin is empty!" => "Tiada apa disini. Tong sampah anda kosong!",
"Name" => "Nama",
-"Restore" => "Pulihkan",
"Deleted" => "Dihapuskan",
"Delete" => "Padam"
);
diff --git a/apps/files_trashbin/l10n/nb_NO.php b/apps/files_trashbin/l10n/nb_NO.php
index 2293e5a4e7b..519b4e5aa24 100644
--- a/apps/files_trashbin/l10n/nb_NO.php
+++ b/apps/files_trashbin/l10n/nb_NO.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kunne ikke slette %s fullstendig",
"Couldn't restore %s" => "Kunne ikke gjenopprette %s",
"Deleted files" => "Slettede filer",
+"Restore" => "Gjenopprett",
"Error" => "Feil",
-"Deleted Files" => "Slettede filer",
"restored" => "gjenopprettet",
"Nothing in here. Your trash bin is empty!" => "Ingenting her. Søppelkassen din er tom!",
"Name" => "Navn",
-"Restore" => "Gjenopprett",
"Deleted" => "Slettet",
"Delete" => "Slett"
);
diff --git a/apps/files_trashbin/l10n/nl.php b/apps/files_trashbin/l10n/nl.php
index c8fb1288538..41dfa86b7a7 100644
--- a/apps/files_trashbin/l10n/nl.php
+++ b/apps/files_trashbin/l10n/nl.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kon %s niet permanent verwijderen",
"Couldn't restore %s" => "Kon %s niet herstellen",
"Deleted files" => "Verwijderde bestanden",
+"Restore" => "Herstellen",
"Error" => "Fout",
-"Deleted Files" => "Verwijderde bestanden",
"restored" => "hersteld",
"Nothing in here. Your trash bin is empty!" => "Niets te vinden. Uw prullenbak is leeg!",
"Name" => "Naam",
-"Restore" => "Herstellen",
"Deleted" => "Verwijderd",
"Delete" => "Verwijder"
);
diff --git a/apps/files_trashbin/l10n/nn_NO.php b/apps/files_trashbin/l10n/nn_NO.php
index 38bc64e6ce5..aa18927b1fd 100644
--- a/apps/files_trashbin/l10n/nn_NO.php
+++ b/apps/files_trashbin/l10n/nn_NO.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Klarte ikkje sletta %s for godt",
"Couldn't restore %s" => "Klarte ikkje gjenoppretta %s",
"Deleted files" => "Sletta filer",
+"Restore" => "Gjenopprett",
"Error" => "Feil",
-"Deleted Files" => "Sletta filer",
"restored" => "gjenoppretta",
"Nothing in here. Your trash bin is empty!" => "Ingenting her. Papirkorga di er tom!",
"Name" => "Namn",
-"Restore" => "Gjenopprett",
"Deleted" => "Sletta",
"Delete" => "Slett"
);
diff --git a/apps/files_trashbin/l10n/pl.php b/apps/files_trashbin/l10n/pl.php
index b961efd7dae..16bb9dbfa2f 100644
--- a/apps/files_trashbin/l10n/pl.php
+++ b/apps/files_trashbin/l10n/pl.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nie można trwale usunąć %s",
"Couldn't restore %s" => "Nie można przywrócić %s",
"Deleted files" => "Pliki usunięte",
+"Restore" => "Przywróć",
"Error" => "Błąd",
-"Deleted Files" => "Usunięte pliki",
"restored" => "przywrócony",
"Nothing in here. Your trash bin is empty!" => "Nic tu nie ma. Twój kosz jest pusty!",
"Name" => "Nazwa",
-"Restore" => "Przywróć",
"Deleted" => "Usunięte",
"Delete" => "Usuń"
);
diff --git a/apps/files_trashbin/l10n/pt_BR.php b/apps/files_trashbin/l10n/pt_BR.php
index d524d8879e2..b7dd346b40a 100644
--- a/apps/files_trashbin/l10n/pt_BR.php
+++ b/apps/files_trashbin/l10n/pt_BR.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Não foi possível excluir %s permanentemente",
"Couldn't restore %s" => "Não foi possível restaurar %s",
"Deleted files" => "Arquivos apagados",
+"Restore" => "Restaurar",
"Error" => "Erro",
-"Deleted Files" => "Arquivos Apagados",
"restored" => "restaurado",
"Nothing in here. Your trash bin is empty!" => "Nada aqui. Sua lixeira está vazia!",
"Name" => "Nome",
-"Restore" => "Restaurar",
"Deleted" => "Excluído",
"Delete" => "Excluir"
);
diff --git a/apps/files_trashbin/l10n/pt_PT.php b/apps/files_trashbin/l10n/pt_PT.php
index 94dd0eb707a..8a18d842c93 100644
--- a/apps/files_trashbin/l10n/pt_PT.php
+++ b/apps/files_trashbin/l10n/pt_PT.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Não foi possível eliminar %s de forma permanente",
"Couldn't restore %s" => "Não foi possível restaurar %s",
"Deleted files" => "Ficheiros eliminados",
+"Restore" => "Restaurar",
"Error" => "Erro",
-"Deleted Files" => "Ficheiros Apagados",
"restored" => "Restaurado",
"Nothing in here. Your trash bin is empty!" => "Não hà ficheiros. O lixo está vazio!",
"Name" => "Nome",
-"Restore" => "Restaurar",
"Deleted" => "Apagado",
"Delete" => "Eliminar"
);
diff --git a/apps/files_trashbin/l10n/ru.php b/apps/files_trashbin/l10n/ru.php
index d10369b9ca1..8d00e082418 100644
--- a/apps/files_trashbin/l10n/ru.php
+++ b/apps/files_trashbin/l10n/ru.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s не может быть удалён навсегда",
"Couldn't restore %s" => "%s не может быть восстановлен",
"Deleted files" => "Удалённые файлы",
+"Restore" => "Восстановить",
"Error" => "Ошибка",
-"Deleted Files" => "Удаленные файлы",
"restored" => "восстановлен",
"Nothing in here. Your trash bin is empty!" => "Здесь ничего нет. Ваша корзина пуста!",
"Name" => "Имя",
-"Restore" => "Восстановить",
"Deleted" => "Удалён",
"Delete" => "Удалить"
);
diff --git a/apps/files_trashbin/l10n/sk_SK.php b/apps/files_trashbin/l10n/sk_SK.php
index 3badd3a423b..7588b555d96 100644
--- a/apps/files_trashbin/l10n/sk_SK.php
+++ b/apps/files_trashbin/l10n/sk_SK.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nemožno zmazať %s navždy",
"Couldn't restore %s" => "Nemožno obnoviť %s",
"Deleted files" => "Zmazané súbory",
+"Restore" => "Obnoviť",
"Error" => "Chyba",
-"Deleted Files" => "Zmazané súbory",
"restored" => "obnovené",
"Nothing in here. Your trash bin is empty!" => "Žiadny obsah. Kôš je prázdny!",
"Name" => "Názov",
-"Restore" => "Obnoviť",
"Deleted" => "Zmazané",
"Delete" => "Zmazať"
);
diff --git a/apps/files_trashbin/l10n/sl.php b/apps/files_trashbin/l10n/sl.php
index 08da9b1c6e9..f9dc5112ac3 100644
--- a/apps/files_trashbin/l10n/sl.php
+++ b/apps/files_trashbin/l10n/sl.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Datoteke %s ni mogoče trajno izbrisati.",
"Couldn't restore %s" => "Ni mogoče obnoviti %s",
"Deleted files" => "Izbrisane datoteke",
+"Restore" => "Obnovi",
"Error" => "Napaka",
-"Deleted Files" => "Izbrisane datoteke",
"restored" => "obnovljeno",
"Nothing in here. Your trash bin is empty!" => "Mapa smeti je prazna.",
"Name" => "Ime",
-"Restore" => "Obnovi",
"Deleted" => "Izbrisano",
"Delete" => "Izbriši"
);
diff --git a/apps/files_trashbin/l10n/sq.php b/apps/files_trashbin/l10n/sq.php
index 60d16f9b913..9e16b7a7bfd 100644
--- a/apps/files_trashbin/l10n/sq.php
+++ b/apps/files_trashbin/l10n/sq.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Nuk munda ta eliminoj përfundimisht %s",
"Couldn't restore %s" => "Nuk munda ta rivendos %s",
"Deleted files" => "Skedarë të fshirë ",
+"Restore" => "Rivendos",
"Error" => "Veprim i gabuar",
-"Deleted Files" => "Skedarë të eliminuar",
"restored" => "rivendosur",
"Nothing in here. Your trash bin is empty!" => "Këtu nuk ka asgjë. Koshi juaj është bosh!",
"Name" => "Emri",
-"Restore" => "Rivendos",
"Deleted" => "Eliminuar",
"Delete" => "Elimino"
);
diff --git a/apps/files_trashbin/l10n/sr.php b/apps/files_trashbin/l10n/sr.php
index 7fb4c85ab63..d4abc908c91 100644
--- a/apps/files_trashbin/l10n/sr.php
+++ b/apps/files_trashbin/l10n/sr.php
@@ -1,10 +1,10 @@
<?php
$TRANSLATIONS = array(
"Deleted files" => "Обрисане датотеке",
+"Restore" => "Врати",
"Error" => "Грешка",
"Nothing in here. Your trash bin is empty!" => "Овде нема ништа. Корпа за отпатке је празна.",
"Name" => "Име",
-"Restore" => "Врати",
"Deleted" => "Обрисано",
"Delete" => "Обриши"
);
diff --git a/apps/files_trashbin/l10n/sv.php b/apps/files_trashbin/l10n/sv.php
index fd9ca8653f3..330bcc34821 100644
--- a/apps/files_trashbin/l10n/sv.php
+++ b/apps/files_trashbin/l10n/sv.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Kunde inte radera %s permanent",
"Couldn't restore %s" => "Kunde inte återställa %s",
"Deleted files" => "Raderade filer",
+"Restore" => "Återskapa",
"Error" => "Fel",
-"Deleted Files" => "Raderade filer",
"restored" => "återställd",
"Nothing in here. Your trash bin is empty!" => "Ingenting här. Din papperskorg är tom!",
"Name" => "Namn",
-"Restore" => "Återskapa",
"Deleted" => "Raderad",
"Delete" => "Radera"
);
diff --git a/apps/files_trashbin/l10n/th_TH.php b/apps/files_trashbin/l10n/th_TH.php
index 857737c59e8..47c3450d2ea 100644
--- a/apps/files_trashbin/l10n/th_TH.php
+++ b/apps/files_trashbin/l10n/th_TH.php
@@ -1,10 +1,9 @@
<?php
$TRANSLATIONS = array(
+"Restore" => "คืนค่า",
"Error" => "ข้อผิดพลาด",
-"Deleted Files" => "ไฟล์ที่ลบทิ้ง",
"Nothing in here. Your trash bin is empty!" => "ไม่มีอะไรอยู่ในนี้ ถังขยะของคุณยังว่างอยู่",
"Name" => "ชื่อ",
-"Restore" => "คืนค่า",
"Deleted" => "ลบแล้ว",
"Delete" => "ลบ"
);
diff --git a/apps/files_trashbin/l10n/tr.php b/apps/files_trashbin/l10n/tr.php
index ff4227e38c7..ab7441b8229 100644
--- a/apps/files_trashbin/l10n/tr.php
+++ b/apps/files_trashbin/l10n/tr.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "%s alıcı olarak silinemedi",
"Couldn't restore %s" => "%s geri yüklenemedi",
"Deleted files" => "Silinmiş dosyalar",
+"Restore" => "Geri yükle",
"Error" => "Hata",
-"Deleted Files" => "Silinen Dosyalar",
"restored" => "geri yüklendi",
"Nothing in here. Your trash bin is empty!" => "Burada hiçbir şey yok. Çöp kutunuz tamamen boş!",
"Name" => "İsim",
-"Restore" => "Geri yükle",
"Deleted" => "Silindi",
"Delete" => "Sil"
);
diff --git a/apps/files_trashbin/l10n/uk.php b/apps/files_trashbin/l10n/uk.php
index fa523fa3218..328e8da5e02 100644
--- a/apps/files_trashbin/l10n/uk.php
+++ b/apps/files_trashbin/l10n/uk.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Неможливо видалити %s назавжди",
"Couldn't restore %s" => "Неможливо відновити %s",
"Deleted files" => "Видалено файлів",
+"Restore" => "Відновити",
"Error" => "Помилка",
-"Deleted Files" => "Видалено Файлів",
"restored" => "відновлено",
"Nothing in here. Your trash bin is empty!" => "Нічого немає. Ваший кошик для сміття пустий!",
"Name" => "Ім'я",
-"Restore" => "Відновити",
"Deleted" => "Видалено",
"Delete" => "Видалити"
);
diff --git a/apps/files_trashbin/l10n/ur_PK.php b/apps/files_trashbin/l10n/ur_PK.php
index 49c82f53872..fc71b528ced 100644
--- a/apps/files_trashbin/l10n/ur_PK.php
+++ b/apps/files_trashbin/l10n/ur_PK.php
@@ -1,5 +1,14 @@
<?php
$TRANSLATIONS = array(
-"Error" => "ایرر"
+"Couldn't delete %s permanently" => "حذف نہیں ہو سکتا %s مستقل طور پر",
+"Couldn't restore %s" => "بحال نہيں کيا جا سکتا %s",
+"Deleted files" => "حذف شدہ فائليں",
+"Restore" => "بحال",
+"Error" => "ایرر",
+"restored" => "بحال شدہ",
+"Nothing in here. Your trash bin is empty!" => " یہاں کچھ بھی نہیں .آپکی ردی کی ٹوکری خالی ہے.",
+"Name" => "اسم",
+"Deleted" => "حذف شدہ ",
+"Delete" => "حذف کریں"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_trashbin/l10n/vi.php b/apps/files_trashbin/l10n/vi.php
index 57c82cea5f7..d374effcabb 100644
--- a/apps/files_trashbin/l10n/vi.php
+++ b/apps/files_trashbin/l10n/vi.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "Không thể xóa %s vĩnh viễn",
"Couldn't restore %s" => "Không thể khôi phục %s",
"Deleted files" => "File đã bị xóa",
+"Restore" => "Khôi phục",
"Error" => "Lỗi",
-"Deleted Files" => "File đã xóa",
"restored" => "khôi phục",
"Nothing in here. Your trash bin is empty!" => "Không có gì ở đây. Thùng rác của bạn rỗng!",
"Name" => "Tên",
-"Restore" => "Khôi phục",
"Deleted" => "Đã xóa",
"Delete" => "Xóa"
);
diff --git a/apps/files_trashbin/l10n/zh_CN.php b/apps/files_trashbin/l10n/zh_CN.php
index ef6a63b2959..49cd412299e 100644
--- a/apps/files_trashbin/l10n/zh_CN.php
+++ b/apps/files_trashbin/l10n/zh_CN.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "无法彻底删除文件%s",
"Couldn't restore %s" => "无法恢复%s",
"Deleted files" => "已删除文件",
+"Restore" => "恢复",
"Error" => "错误",
-"Deleted Files" => "已删除文件",
"restored" => "已恢复",
"Nothing in here. Your trash bin is empty!" => "这里没有东西. 你的回收站是空的!",
"Name" => "名称",
-"Restore" => "恢复",
"Deleted" => "已删除",
"Delete" => "删除"
);
diff --git a/apps/files_trashbin/l10n/zh_TW.php b/apps/files_trashbin/l10n/zh_TW.php
index c42d70790e9..014527083e3 100644
--- a/apps/files_trashbin/l10n/zh_TW.php
+++ b/apps/files_trashbin/l10n/zh_TW.php
@@ -3,12 +3,11 @@ $TRANSLATIONS = array(
"Couldn't delete %s permanently" => "無法永久刪除 %s",
"Couldn't restore %s" => "無法還原 %s",
"Deleted files" => "回收桶",
+"Restore" => "還原",
"Error" => "錯誤",
-"Deleted Files" => "已刪除的檔案",
"restored" => "已還原",
"Nothing in here. Your trash bin is empty!" => "您的回收桶是空的!",
"Name" => "名稱",
-"Restore" => "還原",
"Deleted" => "已刪除",
"Delete" => "刪除"
);
diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php
index e6ca73520a6..ebedce31abe 100644
--- a/apps/files_trashbin/lib/helper.php
+++ b/apps/files_trashbin/lib/helper.php
@@ -8,16 +8,19 @@ class Helper
{
/**
* Retrieves the contents of a trash bin directory.
+ *
* @param string $dir path to the directory inside the trashbin
* or empty to retrieve the root of the trashbin
+ * @param string $sortAttribute attribute to sort on or empty to disable sorting
+ * @param bool $sortDescending true for descending sort, false otherwise
* @return \OCP\Files\FileInfo[]
*/
- public static function getTrashFiles($dir){
+ public static function getTrashFiles($dir, $sortAttribute = '', $sortDescending = false){
$result = array();
$timestamp = null;
$user = \OCP\User::getUser();
- $view = new \OC_Filesystemview('/' . $user . '/files_trashbin/files');
+ $view = new \OC\Files\View('/' . $user . '/files_trashbin/files');
if (ltrim($dir, '/') !== '' && !$view->is_dir($dir)) {
throw new \Exception('Directory does not exists');
@@ -57,8 +60,9 @@ class Helper
closedir($dirContent);
}
- usort($result, array('\OCA\Files\Helper', 'fileCmp'));
-
+ if ($sortAttribute !== '') {
+ return \OCA\Files\Helper::sortFiles($result, $sortAttribute, $sortDescending);
+ }
return $result;
}
diff --git a/apps/files_trashbin/lib/hooks.php b/apps/files_trashbin/lib/hooks.php
index b2c6bc1df50..b6f0fb7e547 100644
--- a/apps/files_trashbin/lib/hooks.php
+++ b/apps/files_trashbin/lib/hooks.php
@@ -29,8 +29,8 @@ namespace OCA\Files_Trashbin;
class Hooks {
/**
- * @brief Copy files to trash bin
- * @param array
+ * Copy files to trash bin
+ * @param array $params
*
* This function is connected to the delete signal of OC_Filesystem
* to copy the file to the trash bin
@@ -44,8 +44,8 @@ class Hooks {
}
/**
- * @brief clean up user specific settings if user gets deleted
- * @param array with uid
+ * clean up user specific settings if user gets deleted
+ * @param array $params array with uid
*
* This function is connected to the pre_deleteUser signal of OC_Users
* to remove the used space for the trash bin stored in the database
@@ -56,7 +56,7 @@ class Hooks {
Trashbin::deleteUser($uid);
}
}
-
+
public static function post_write_hook($params) {
Trashbin::resizeTrash(\OCP\User::getUser());
}
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 173eb2164cf..e95f1b13c37 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -62,7 +62,7 @@ class Trashbin {
/**
- * @brief copy file to owners trash
+ * copy file to owners trash
* @param string $sourcePath
* @param string $owner
* @param string $ownerPath
@@ -96,7 +96,7 @@ class Trashbin {
/**
* move file to the trash bin
*
- * @param $file_path path to the deleted file/directory relative to the files root directory
+ * @param string $file_path path to the deleted file/directory relative to the files root directory
*/
public static function move2trash($file_path) {
$user = \OCP\User::getUser();
@@ -155,11 +155,11 @@ class Trashbin {
/**
* Move file versions to trash so that they can be restored later
*
- * @param $file_path path to original file
- * @param $filename of deleted file
+ * @param string $file_path path to original file
+ * @param string $filename of deleted file
* @param integer $timestamp when the file was deleted
*
- * @return size of stored versions
+ * @return int size of stored versions
*/
private static function retainVersions($file_path, $filename, $timestamp) {
$size = 0;
@@ -200,11 +200,11 @@ class Trashbin {
/**
* Move encryption keys to trash so that they can be restored later
*
- * @param $file_path path to original file
- * @param $filename of deleted file
+ * @param string $file_path path to original file
+ * @param string $filename of deleted file
* @param integer $timestamp when the file was deleted
*
- * @return size of encryption keys
+ * @return int size of encryption keys
*/
private static function retainEncryptionKeys($file_path, $filename, $timestamp) {
$size = 0;
@@ -216,7 +216,7 @@ class Trashbin {
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
- $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), $user);
+ $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user);
// disable proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
@@ -299,9 +299,9 @@ class Trashbin {
/**
* restore files from trash bin
*
- * @param $file path to the deleted file
- * @param $filename name of the file
- * @param $timestamp time when the file was deleted
+ * @param string $file path to the deleted file
+ * @param string $filename name of the file
+ * @param int $timestamp time when the file was deleted
*
* @return bool
*/
@@ -373,14 +373,14 @@ class Trashbin {
}
/**
- * @brief restore versions from trash bin
+ * restore versions from trash bin
*
* @param \OC\Files\View $view file view
- * @param $file complete path to file
- * @param $filename name of file once it was deleted
+ * @param string $file complete path to file
+ * @param string $filename name of file once it was deleted
* @param string $uniqueFilename new file name to restore the file without overwriting existing files
- * @param $location location if file
- * @param $timestamp deleteion time
+ * @param string $location location if file
+ * @param int $timestamp deleteion time
*
*/
private static function restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp) {
@@ -421,14 +421,14 @@ class Trashbin {
}
/**
- * @brief restore encryption keys from trash bin
+ * restore encryption keys from trash bin
*
* @param \OC\Files\View $view
- * @param $file complete path to file
- * @param $filename name of file
+ * @param string $file complete path to file
+ * @param string $filename name of file
* @param string $uniqueFilename new file name to restore the file without overwriting existing files
- * @param $location location of file
- * @param $timestamp deleteion time
+ * @param string $location location of file
+ * @param int $timestamp deleteion time
*
*/
private static function restoreEncryptionKeys($view, $file, $filename, $uniqueFilename, $location, $timestamp) {
@@ -441,7 +441,7 @@ class Trashbin {
list($owner, $ownerPath) = self::getUidAndFilename($target);
- $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), $user);
+ $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user);
if ($util->isSystemWideMountPoint($ownerPath)) {
$baseDir = '/files_encryption/';
@@ -498,7 +498,7 @@ class Trashbin {
$rootView->rename($ownerShareKey, $baseDir . '/share-keys/' . $ownerPath . '.' . $user . '.shareKey');
// try to re-share if file is shared
- $filesystemView = new \OC_FilesystemView('/');
+ $filesystemView = new \OC\Files\View('/');
$session = new \OCA\Encryption\Session($filesystemView);
$util = new \OCA\Encryption\Util($filesystemView, $user);
@@ -523,7 +523,7 @@ class Trashbin {
}
/**
- * @brief delete all files from the trash
+ * delete all files from the trash
*/
public static function deleteAll() {
$user = \OCP\User::getUser();
@@ -537,12 +537,12 @@ class Trashbin {
/**
- * @brief delete file from trash bin permanently
+ * delete file from trash bin permanently
*
- * @param $filename path to the file
- * @param $timestamp of deletion time
+ * @param string $filename path to the file
+ * @param int $timestamp of deletion time
*
- * @return size of deleted files
+ * @return int size of deleted files
*/
public static function delete($filename, $timestamp = null) {
$user = \OCP\User::getUser();
@@ -634,9 +634,9 @@ class Trashbin {
/**
* check to see whether a file exists in trashbin
*
- * @param $filename path to the file
- * @param $timestamp of deletion time
- * @return true if file exists, otherwise false
+ * @param string $filename path to the file
+ * @param int $timestamp of deletion time
+ * @return bool true if file exists, otherwise false
*/
public static function file_exists($filename, $timestamp = null) {
$user = \OCP\User::getUser();
@@ -653,10 +653,10 @@ class Trashbin {
}
/**
- * @brief deletes used space for trash bin in db if user was deleted
+ * deletes used space for trash bin in db if user was deleted
*
* @param type $uid id of deleted user
- * @return result of db delete operation
+ * @return bool result of db delete operation
*/
public static function deleteUser($uid) {
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?');
@@ -672,7 +672,7 @@ class Trashbin {
* calculate remaining free space for trash bin
*
* @param integer $trashbinSize current size of the trash bin
- * @return available free space for trash bin
+ * @return int available free space for trash bin
*/
private static function calculateFreeSpace($trashbinSize) {
$softQuota = true;
@@ -707,7 +707,7 @@ class Trashbin {
}
/**
- * @brief resize trash bin if necessary after a new file was added to ownCloud
+ * resize trash bin if necessary after a new file was added to ownCloud
* @param string $user user id
*/
public static function resizeTrash($user) {
@@ -808,8 +808,8 @@ class Trashbin {
/**
* find all versions which belong to the file we want to restore
*
- * @param $filename name of the file which should be restored
- * @param $timestamp timestamp when the file was deleted
+ * @param string $filename name of the file which should be restored
+ * @param int $timestamp timestamp when the file was deleted
*/
private static function getVersionsFromTrash($filename, $timestamp) {
$view = new \OC\Files\View('/' . \OCP\User::getUser() . '/files_trashbin/versions');
@@ -841,8 +841,8 @@ class Trashbin {
/**
* find unique extension for restored file if a file with the same name already exists
*
- * @param $location where the file should be restored
- * @param $filename name of the file
+ * @param string $location where the file should be restored
+ * @param string $filename name of the file
* @param \OC\Files\View $view filesystem view relative to users root directory
* @return string with unique extension
*/
@@ -871,7 +871,7 @@ class Trashbin {
}
/**
- * @brief get the size from a given root folder
+ * get the size from a given root folder
* @param \OC\Files\View $view file view on the root folder
* @return integer size of the folder
*/
@@ -903,7 +903,7 @@ class Trashbin {
/**
* get current size of trash bin from a given user
*
- * @param $user user who owns the trash bin
+ * @param string $user user who owns the trash bin
* @return mixed trash bin size or false if no trash bin size is stored
*/
private static function getTrashbinSize($user) {
@@ -925,7 +925,7 @@ class Trashbin {
}
/**
- * @brief check if trash bin is empty for a given user
+ * check if trash bin is empty for a given user
* @param string $user
*/
public static function isEmpty($user) {
diff --git a/apps/files_trashbin/list.php b/apps/files_trashbin/list.php
new file mode 100644
index 00000000000..b4047b82ef9
--- /dev/null
+++ b/apps/files_trashbin/list.php
@@ -0,0 +1,11 @@
+<?php
+
+// Check if we are a user
+OCP\User::checkLoggedIn();
+
+
+$tmpl = new OCP\Template('files_trashbin', 'index', '');
+OCP\Util::addStyle('files_trashbin', 'trash');
+OCP\Util::addScript('files_trashbin', 'app');
+OCP\Util::addScript('files_trashbin', 'filelist');
+$tmpl->printPage();
diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php
index 323e7495535..fc18e88c41e 100644
--- a/apps/files_trashbin/templates/index.php
+++ b/apps/files_trashbin/templates/index.php
@@ -1,3 +1,4 @@
+<?php /** @var $l OC_L10N */ ?>
<div id="controls">
<div id="file_action_panel"></div>
</div>
@@ -5,29 +6,27 @@
<div id="emptycontent" class="hidden"><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
-<input type="hidden" id="permissions" value="0"></input>
-<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input>
-<input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
+<input type="hidden" name="dir" value="" id="dir">
<table id="filestable">
<thead>
<tr>
- <th id='headerName'>
+ <th id='headerName' class="hidden column-name">
<div id="headerName-container">
- <input type="checkbox" id="select_all" />
- <label for="select_all"></label>
- <span class='name'><?php p($l->t( 'Name' )); ?></span>
- <span class='selectedActions'>
+ <input type="checkbox" id="select_all_trash" class="select-all"/>
+ <label for="select_all_trash"></label>
+ <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a>
+ <span id="selectedActionsList" class='selectedActions'>
<a href="" class="undelete">
<img class="svg" alt="<?php p($l->t( 'Restore' )); ?>"
src="<?php print_unescaped(OCP\image_path("core", "actions/history.svg")); ?>" />
<?php p($l->t('Restore'))?>
</a>
- </span>
+ </span>
</div>
</th>
- <th id="headerDate">
- <span id="modified"><?php p($l->t( 'Deleted' )); ?></span>
+ <th id="headerDate" class="hidden column-mtime">
+ <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Deleted' )); ?></span><span class="sort-indicator"></span></a>
<span class="selectedActions">
<a href="" class="delete-selected">
<?php p($l->t('Delete'))?>
diff --git a/apps/files_trashbin/tests/js/appSpec.js b/apps/files_trashbin/tests/js/appSpec.js
new file mode 100644
index 00000000000..ca7d71831f8
--- /dev/null
+++ b/apps/files_trashbin/tests/js/appSpec.js
@@ -0,0 +1,69 @@
+/**
+* ownCloud
+*
+* @author Vincent Petry
+* @copyright 2014 Vincent Petry <pvince81@owncloud.com>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+describe('OCA.Trashbin.App tests', function() {
+ var App = OCA.Trashbin.App;
+
+ beforeEach(function() {
+ $('#testArea').append(
+ '<div id="app-navigation">' +
+ '<ul><li data-id="files"><a>Files</a></li>' +
+ '<li data-id="trashbin"><a>Trashbin</a></li>' +
+ '</div>' +
+ '<div id="app-content">' +
+ '<div id="app-content-files" class="hidden">' +
+ '</div>' +
+ '<div id="app-content-trashbin" class="hidden">' +
+ '</div>' +
+ '</div>' +
+ '</div>'
+ );
+ App.initialize($('#app-content-trashbin'));
+ });
+ afterEach(function() {
+ App._initialized = false;
+ App.fileList = null;
+ });
+
+ describe('initialization', function() {
+ it('creates a custom filelist instance', function() {
+ App.initialize();
+ expect(App.fileList).toBeDefined();
+ expect(App.fileList.$el.is('#app-content-trashbin')).toEqual(true);
+ });
+
+ it('registers custom file actions', function() {
+ var fileActions;
+ App.initialize();
+
+ fileActions = App.fileList.fileActions;
+
+ expect(fileActions.actions.all).toBeDefined();
+ expect(fileActions.actions.all.Restore).toBeDefined();
+ expect(fileActions.actions.all.Delete).toBeDefined();
+
+ expect(fileActions.actions.all.Rename).not.toBeDefined();
+ expect(fileActions.actions.all.Download).not.toBeDefined();
+
+ expect(fileActions.defaults.dir).toEqual('Open');
+ });
+ });
+});
diff --git a/apps/files_trashbin/tests/js/filelistSpec.js b/apps/files_trashbin/tests/js/filelistSpec.js
new file mode 100644
index 00000000000..d41c24c3cc9
--- /dev/null
+++ b/apps/files_trashbin/tests/js/filelistSpec.js
@@ -0,0 +1,309 @@
+/**
+* ownCloud
+*
+* @author Vincent Petry
+* @copyright 2014 Vincent Petry <pvince81@owncloud.com>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+describe('OCA.Trashbin.FileList tests', function() {
+ var testFiles, alertStub, notificationStub, fileList;
+ var FileActions = OCA.Files.FileActions;
+
+ beforeEach(function() {
+ alertStub = sinon.stub(OC.dialogs, 'alert');
+ notificationStub = sinon.stub(OC.Notification, 'show');
+
+ // init parameters and test table elements
+ $('#testArea').append(
+ '<div id="app-content-trashbin">' +
+ // init horrible parameters
+ '<input type="hidden" id="dir" value="/"></input>' +
+ // set this but it shouldn't be used (could be the one from the
+ // files app)
+ '<input type="hidden" id="permissions" value="31"></input>' +
+ // dummy controls
+ '<div id="controls">' +
+ ' <div class="actions creatable"></div>' +
+ ' <div class="notCreatable"></div>' +
+ '</div>' +
+ // dummy table
+ // TODO: at some point this will be rendered by the fileList class itself!
+ '<table id="filestable">' +
+ '<thead><tr><th id="headerName" class="hidden">' +
+ '<input type="checkbox" id="select_all_trash" class="select-all">' +
+ '<span class="name">Name</span>' +
+ '<span class="selectedActions hidden">' +
+ '<a href class="undelete">Restore</a>' +
+ '<a href class="delete-selected">Delete</a></span>' +
+ '</th></tr></thead>' +
+ '<tbody id="fileList"></tbody>' +
+ '<tfoot></tfoot>' +
+ '</table>' +
+ '<div id="emptycontent">Empty content message</div>' +
+ '</div>'
+ );
+
+ testFiles = [{
+ id: 1,
+ type: 'file',
+ name: 'One.txt',
+ mtime: 11111000,
+ mimetype: 'text/plain',
+ etag: 'abc'
+ }, {
+ id: 2,
+ type: 'file',
+ name: 'Two.jpg',
+ mtime: 22222000,
+ mimetype: 'image/jpeg',
+ etag: 'def',
+ }, {
+ id: 3,
+ type: 'file',
+ name: 'Three.pdf',
+ mtime: 33333000,
+ mimetype: 'application/pdf',
+ etag: '123',
+ }, {
+ id: 4,
+ type: 'dir',
+ mtime: 99999000,
+ name: 'somedir',
+ mimetype: 'httpd/unix-directory',
+ etag: '456'
+ }];
+
+ fileList = new OCA.Trashbin.FileList($('#app-content-trashbin'));
+ OCA.Trashbin.App.registerFileActions(fileList);
+ });
+ afterEach(function() {
+ testFiles = undefined;
+ fileList = undefined;
+
+ FileActions.clear();
+ $('#dir').remove();
+ notificationStub.restore();
+ alertStub.restore();
+ });
+ describe('Initialization', function() {
+ it('Sorts by mtime by default', function() {
+ expect(fileList._sort).toEqual('mtime');
+ expect(fileList._sortDirection).toEqual('desc');
+ });
+ it('Always returns read and delete permission', function() {
+ expect(fileList.getDirectoryPermissions()).toEqual(OC.PERMISSION_READ | OC.PERMISSION_DELETE);
+ });
+ });
+ describe('Breadcrumbs', function() {
+ beforeEach(function() {
+ var data = {
+ status: 'success',
+ data: {
+ files: testFiles,
+ permissions: 1
+ }
+ };
+ fakeServer.respondWith(/\/index\.php\/apps\/files_trashbin\/ajax\/list.php\?dir=%2Fsubdir/, [
+ 200, {
+ "Content-Type": "application/json"
+ },
+ JSON.stringify(data)
+ ]);
+ });
+ it('links the breadcrumb to the trashbin view', function() {
+ fileList.changeDirectory('/subdir', false, true);
+ fakeServer.respond();
+ var $crumbs = fileList.$el.find('#controls .crumb');
+ expect($crumbs.length).toEqual(2);
+ expect($crumbs.eq(0).find('a').text()).toEqual('');
+ expect($crumbs.eq(0).find('a').attr('href'))
+ .toEqual(OC.webroot + '/index.php/apps/files?view=trashbin&dir=/');
+ expect($crumbs.eq(1).find('a').text()).toEqual('subdir');
+ expect($crumbs.eq(1).find('a').attr('href'))
+ .toEqual(OC.webroot + '/index.php/apps/files?view=trashbin&dir=/subdir');
+ });
+ });
+ describe('Rendering rows', function() {
+ it('renders rows with the correct data when in root', function() {
+ // dir listing is false when in root
+ $('#dir').val('/');
+ fileList.setFiles(testFiles);
+ var $rows = fileList.$el.find('tbody tr');
+ var $tr = $rows.eq(0);
+ expect($rows.length).toEqual(4);
+ expect($tr.attr('data-id')).toEqual('1');
+ expect($tr.attr('data-type')).toEqual('file');
+ expect($tr.attr('data-file')).toEqual('One.txt.d11111');
+ expect($tr.attr('data-size')).not.toBeDefined();
+ expect($tr.attr('data-etag')).toEqual('abc');
+ expect($tr.attr('data-permissions')).toEqual('9'); // read and delete
+ expect($tr.attr('data-mime')).toEqual('text/plain');
+ expect($tr.attr('data-mtime')).toEqual('11111000');
+ expect($tr.find('a.name').attr('href')).toEqual('#');
+
+ expect($tr.find('.nametext').text().trim()).toEqual('One.txt');
+
+ expect(fileList.findFileEl('One.txt.d11111')[0]).toEqual($tr[0]);
+ });
+ it('renders rows with the correct data when in subdirectory', function() {
+ // dir listing is true when in a subdir
+ $('#dir').val('/subdir');
+
+ fileList.setFiles(testFiles);
+ var $rows = fileList.$el.find('tbody tr');
+ var $tr = $rows.eq(0);
+ expect($rows.length).toEqual(4);
+ expect($tr.attr('data-id')).toEqual('1');
+ expect($tr.attr('data-type')).toEqual('file');
+ expect($tr.attr('data-file')).toEqual('One.txt');
+ expect($tr.attr('data-size')).not.toBeDefined();
+ expect($tr.attr('data-etag')).toEqual('abc');
+ expect($tr.attr('data-permissions')).toEqual('9'); // read and delete
+ expect($tr.attr('data-mime')).toEqual('text/plain');
+ expect($tr.attr('data-mtime')).toEqual('11111000');
+ expect($tr.find('a.name').attr('href')).toEqual('#');
+
+ expect($tr.find('.nametext').text().trim()).toEqual('One.txt');
+
+ expect(fileList.findFileEl('One.txt')[0]).toEqual($tr[0]);
+ });
+ it('does not render a size column', function() {
+ expect(fileList.$el.find('tbody tr .filesize').length).toEqual(0);
+ });
+ });
+ describe('File actions', function() {
+ describe('Deleting single files', function() {
+ // TODO: checks ajax call
+ // TODO: checks spinner
+ // TODO: remove item after delete
+ // TODO: bring back item if delete failed
+ });
+ describe('Restoring single files', function() {
+ // TODO: checks ajax call
+ // TODO: checks spinner
+ // TODO: remove item after restore
+ // TODO: bring back item if restore failed
+ });
+ });
+ describe('file previews', function() {
+ // TODO: check that preview URL is going through files_trashbin
+ });
+ describe('loading file list', function() {
+ // TODO: check that ajax URL is going through files_trashbin
+ });
+ describe('breadcrumbs', function() {
+ // TODO: test label + URL
+ });
+ describe('Global Actions', function() {
+ beforeEach(function() {
+ fileList.setFiles(testFiles);
+ fileList.findFileEl('One.txt.d11111').find('input:checkbox').click();
+ fileList.findFileEl('Three.pdf.d33333').find('input:checkbox').click();
+ fileList.findFileEl('somedir.d99999').find('input:checkbox').click();
+ });
+ describe('Delete', function() {
+ it('Deletes selected files when "Delete" clicked', function() {
+ var request;
+ $('.selectedActions .delete-selected').click();
+ expect(fakeServer.requests.length).toEqual(1);
+ request = fakeServer.requests[0];
+ expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/delete.php');
+ expect(OC.parseQueryString(request.requestBody))
+ .toEqual({'dir': '/', files: '["One.txt.d11111","Three.pdf.d33333","somedir.d99999"]'});
+ fakeServer.requests[0].respond(
+ 200,
+ { 'Content-Type': 'application/json' },
+ JSON.stringify({
+ status: 'success',
+ data: {
+ success: [
+ {filename: 'One.txt.d11111'},
+ {filename: 'Three.pdf.d33333'},
+ {filename: 'somedir.d99999'}
+ ]
+ }
+ })
+ );
+ expect(fileList.findFileEl('One.txt.d11111').length).toEqual(0);
+ expect(fileList.findFileEl('Three.pdf.d33333').length).toEqual(0);
+ expect(fileList.findFileEl('somedir.d99999').length).toEqual(0);
+ expect(fileList.findFileEl('Two.jpg.d22222').length).toEqual(1);
+ });
+ it('Deletes all files when all selected when "Delete" clicked', function() {
+ var request;
+ $('.select-all').click();
+ $('.selectedActions .delete-selected').click();
+ expect(fakeServer.requests.length).toEqual(1);
+ request = fakeServer.requests[0];
+ expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/delete.php');
+ expect(OC.parseQueryString(request.requestBody))
+ .toEqual({'dir': '/', allfiles: 'true'});
+ fakeServer.requests[0].respond(
+ 200,
+ { 'Content-Type': 'application/json' },
+ JSON.stringify({status: 'success'})
+ );
+ expect(fileList.isEmpty).toEqual(true);
+ });
+ });
+ describe('Restore', function() {
+ it('Restores selected files when "Restore" clicked', function() {
+ var request;
+ $('.selectedActions .undelete').click();
+ expect(fakeServer.requests.length).toEqual(1);
+ request = fakeServer.requests[0];
+ expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/undelete.php');
+ expect(OC.parseQueryString(request.requestBody))
+ .toEqual({'dir': '/', files: '["One.txt.d11111","Three.pdf.d33333","somedir.d99999"]'});
+ fakeServer.requests[0].respond(
+ 200,
+ { 'Content-Type': 'application/json' },
+ JSON.stringify({
+ status: 'success',
+ data: {
+ success: [
+ {filename: 'One.txt.d11111'},
+ {filename: 'Three.pdf.d33333'},
+ {filename: 'somedir.d99999'}
+ ]
+ }
+ })
+ );
+ expect(fileList.findFileEl('One.txt.d11111').length).toEqual(0);
+ expect(fileList.findFileEl('Three.pdf.d33333').length).toEqual(0);
+ expect(fileList.findFileEl('somedir.d99999').length).toEqual(0);
+ expect(fileList.findFileEl('Two.jpg.d22222').length).toEqual(1);
+ });
+ it('Restores all files when all selected when "Restore" clicked', function() {
+ var request;
+ $('.select-all').click();
+ $('.selectedActions .undelete').click();
+ expect(fakeServer.requests.length).toEqual(1);
+ request = fakeServer.requests[0];
+ expect(request.url).toEqual(OC.webroot + '/index.php/apps/files_trashbin/ajax/undelete.php');
+ expect(OC.parseQueryString(request.requestBody))
+ .toEqual({'dir': '/', allfiles: 'true'});
+ fakeServer.requests[0].respond(
+ 200,
+ { 'Content-Type': 'application/json' },
+ JSON.stringify({status: 'success'})
+ );
+ expect(fileList.isEmpty).toEqual(true);
+ });
+ });
+ });
+});