Browse Source

allow trash backends to overwrite the tooltip for trash items (#17374)

allow trash backends to overwrite the tooltip for trash items
tags/v18.0.0beta1
John Molakvoæ 4 years ago
parent
commit
79c59fb2b9
No account linked to committer's email address

+ 1
- 1
apps/files_trashbin/js/files_trashbin.js
File diff suppressed because it is too large
View File


+ 1
- 1
apps/files_trashbin/js/files_trashbin.js.map
File diff suppressed because it is too large
View File


+ 4
- 0
apps/files_trashbin/lib/Sabre/AbstractTrash.php View File

@@ -79,6 +79,10 @@ abstract class AbstractTrash implements ITrash {
return $this->data->getOriginalLocation();
}

public function getTitle(): string {
return $this->data->getTitle();
}

public function delete() {
$this->trashManager->removeItem($this->data);
}

+ 2
- 0
apps/files_trashbin/lib/Sabre/ITrash.php View File

@@ -32,6 +32,8 @@ interface ITrash {

public function getOriginalLocation(): string;

public function getTitle(): string;

public function getDeletionTime(): int;

public function getSize();

+ 5
- 0
apps/files_trashbin/lib/Sabre/PropfindPlugin.php View File

@@ -37,6 +37,7 @@ class PropfindPlugin extends ServerPlugin {
const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title';

/** @var Server */
private $server;
@@ -70,6 +71,10 @@ class PropfindPlugin extends ServerPlugin {
return $node->getOriginalLocation();
});

$propFind->handle(self::TRASHBIN_TITLE, function () use ($node) {
return $node->getTitle();
});

$propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) {
return $node->getDeletionTime();
});

+ 2
- 0
apps/files_trashbin/lib/Trash/ITrashItem.php View File

@@ -75,4 +75,6 @@ interface ITrashItem extends FileInfo {
* @since 15.0.0
*/
public function getUser(): IUser;

public function getTitle(): string;
}

+ 4
- 0
apps/files_trashbin/lib/Trash/TrashItem.php View File

@@ -173,4 +173,8 @@ class TrashItem implements ITrashItem {
public function getExtension(): string {
return $this->fileInfo->getExtension();
}

public function getTitle(): string {
return $this->getOriginalLocation();
}
}

+ 24
- 22
apps/files_trashbin/src/filelist.js View File

@@ -13,6 +13,7 @@
var FILENAME_PROP = '{http://nextcloud.org/ns}trashbin-filename'
var DELETION_TIME_PROP = '{http://nextcloud.org/ns}trashbin-deletion-time'
var TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location'
var TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title'

/**
* Convert a file name in the format filename.d12345 to the real file name.
@@ -45,32 +46,33 @@
}
FileList.prototype = _.extend({}, OCA.Files.FileList.prototype,
/** @lends OCA.Trashbin.FileList.prototype */ {
id: 'trashbin',
appName: t('files_trashbin', 'Deleted files'),
/** @type {OC.Files.Client} */
client: null,
id: 'trashbin',
appName: t('files_trashbin', 'Deleted files'),
/** @type {OC.Files.Client} */
client: null,

/**
/**
* @private
*/
initialize: function() {
this.client.addFileInfoParser(function(response, data) {
var props = response.propStat[0].properties
var path = props[TRASHBIN_ORIGINAL_LOCATION]
return {
displayName: props[FILENAME_PROP],
mtime: parseInt(props[DELETION_TIME_PROP], 10) * 1000,
hasPreview: true,
path: path,
extraData: path
}
})
initialize: function() {
this.client.addFileInfoParser(function(response, data) {
var props = response.propStat[0].properties
var path = props[TRASHBIN_ORIGINAL_LOCATION]
var title = props[TRASHBIN_TITLE]
return {
displayName: props[FILENAME_PROP],
mtime: parseInt(props[DELETION_TIME_PROP], 10) * 1000,
hasPreview: true,
path: path,
extraData: title
}
})

var result = OCA.Files.FileList.prototype.initialize.apply(this, arguments)
this.$el.find('.undelete').click('click', _.bind(this._onClickRestoreSelected, this))
var result = OCA.Files.FileList.prototype.initialize.apply(this, arguments)
this.$el.find('.undelete').click('click', _.bind(this._onClickRestoreSelected, this))

this.setSort('mtime', 'desc')
/**
this.setSort('mtime', 'desc')
/**
* Override crumb making to add "Deleted Files" entry
* and convert files with ".d" extensions to a more
* user friendly name.
@@ -252,7 +254,7 @@
* Returns list of webdav properties to request
*/
_getWebdavProperties: function() {
return [FILENAME_PROP, DELETION_TIME_PROP, TRASHBIN_ORIGINAL_LOCATION].concat(this.filesClient.getPropfindProperties())
return [FILENAME_PROP, DELETION_TIME_PROP, TRASHBIN_ORIGINAL_LOCATION, TRASHBIN_TITLE].concat(this.filesClient.getPropfindProperties())
},

/**

Loading…
Cancel
Save