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

return $this->data->getOriginalLocation(); return $this->data->getOriginalLocation();
} }


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

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

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



public function getOriginalLocation(): string; public function getOriginalLocation(): string;


public function getTitle(): string;

public function getDeletionTime(): int; public function getDeletionTime(): int;


public function getSize(); public function getSize();

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

const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename'; const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location'; const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time'; const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title';


/** @var Server */ /** @var Server */
private $server; private $server;
return $node->getOriginalLocation(); return $node->getOriginalLocation();
}); });


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

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

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

* @since 15.0.0 * @since 15.0.0
*/ */
public function getUser(): IUser; public function getUser(): IUser;

public function getTitle(): string;
} }

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

public function getExtension(): string { public function getExtension(): string {
return $this->fileInfo->getExtension(); return $this->fileInfo->getExtension();
} }

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

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

var FILENAME_PROP = '{http://nextcloud.org/ns}trashbin-filename' var FILENAME_PROP = '{http://nextcloud.org/ns}trashbin-filename'
var DELETION_TIME_PROP = '{http://nextcloud.org/ns}trashbin-deletion-time' var DELETION_TIME_PROP = '{http://nextcloud.org/ns}trashbin-deletion-time'
var TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location' 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. * Convert a file name in the format filename.d12345 to the real file name.
} }
FileList.prototype = _.extend({}, OCA.Files.FileList.prototype, FileList.prototype = _.extend({}, OCA.Files.FileList.prototype,
/** @lends OCA.Trashbin.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 * @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 * Override crumb making to add "Deleted Files" entry
* and convert files with ".d" extensions to a more * and convert files with ".d" extensions to a more
* user friendly name. * user friendly name.
* Returns list of webdav properties to request * Returns list of webdav properties to request
*/ */
_getWebdavProperties: function() { _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