aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-11-23 09:38:01 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-11-23 09:38:01 +0100
commit79bbda994bb8dd2231f68f57785237f79f86f6c7 (patch)
tree65585aed0d21cc679cdf7e2509efd6fa3d33b458 /apps/files_sharing/js
parent2f89eef334bd445a7e046d845d5d5d1b3e4b6b8c (diff)
parent418fefc93c3332c77ec617ef108138efb6a34544 (diff)
downloadnextcloud-server-79bbda994bb8dd2231f68f57785237f79f86f6c7.tar.gz
nextcloud-server-79bbda994bb8dd2231f68f57785237f79f86f6c7.zip
Merge pull request #16902 from owncloud/jsocclient
Web UI uses Webdav instead of ajax/* calls
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/app.js2
-rw-r--r--apps/files_sharing/js/public.js16
-rw-r--r--apps/files_sharing/js/share.js22
-rw-r--r--apps/files_sharing/js/sharedfilelist.js4
4 files changed, 37 insertions, 7 deletions
diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js
index 3168e930829..af198208de2 100644
--- a/apps/files_sharing/js/app.js
+++ b/apps/files_sharing/js/app.js
@@ -142,7 +142,7 @@ OCA.Sharing.App = {
// folder in the files app instead of opening it directly
fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
OCA.Files.App.setActiveView('files', {silent: true});
- OCA.Files.App.fileList.changeDirectory(context.$file.attr('data-path') + '/' + filename, true, true);
+ OCA.Files.App.fileList.changeDirectory(OC.joinPaths(context.$file.attr('data-path'), filename), true, true);
});
fileActions.setDefault('dir', 'Open');
return fileActions;
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 246b639f652..82691129926 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -48,8 +48,20 @@ OCA.Sharing.PublicApp = {
this._initialized = true;
this.initialDir = $('#dir').val();
+ var token = $('#sharingToken').val();
+
// file list mode ?
if ($el.find('#filestable').length) {
+ var filesClient = new OC.Files.Client({
+ host: OC.getHost(),
+ port: OC.getPort(),
+ userName: token,
+ // note: password not be required, the endpoint
+ // will recognize previous validation from the session
+ root: OC.getRootPath() + '/public.php/webdav',
+ useHTTPS: OC.getProtocol() === 'https'
+ });
+
this.fileList = new OCA.Files.FileList(
$el,
{
@@ -58,7 +70,8 @@ OCA.Sharing.PublicApp = {
dragOptions: dragOptions,
folderDropOptions: folderDropOptions,
fileActions: fileActions,
- detailsViewEnabled: false
+ detailsViewEnabled: false,
+ filesClient: filesClient
}
);
this.files = OCA.Files.Files;
@@ -88,7 +101,6 @@ OCA.Sharing.PublicApp = {
// dynamically load image previews
- var token = $('#sharingToken').val();
var bottomMargin = 350;
var previewWidth = Math.ceil($(window).width() * window.devicePixelRatio);
var previewHeight = Math.ceil(($(window).height() - bottomMargin) * window.devicePixelRatio);
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 63225a0d8ec..3d105f283d8 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -50,7 +50,7 @@
if (fileData.shareOwner) {
tr.attr('data-share-owner', fileData.shareOwner);
// user should always be able to rename a mount point
- if (fileData.isShareMountPoint) {
+ if (fileData.mountType === 'shared-root') {
tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE);
}
}
@@ -68,6 +68,26 @@
return fileInfo;
};
+ var NS_OC = 'http://owncloud.org/ns';
+
+ var oldGetWebdavProperties = fileList._getWebdavProperties;
+ fileList._getWebdavProperties = function() {
+ var props = oldGetWebdavProperties.apply(this, arguments);
+ props.push('{' + NS_OC + '}owner-display-name');
+ return props;
+ };
+
+ fileList.filesClient.addFileInfoParser(function(response) {
+ var data = {};
+ var props = response.propStat[0].properties;
+ var permissionsProp = props['{' + NS_OC + '}permissions'];
+
+ if (permissionsProp && permissionsProp.indexOf('S') >= 0) {
+ data.shareOwner = props['{' + NS_OC + '}owner-display-name'];
+ }
+ return data;
+ });
+
// use delegate to catch the case with multiple file lists
fileList.$el.on('fileActionsReady', function(ev){
var fileList = ev.fileList;
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index 68bfd63ec89..a799d4a94c2 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -231,6 +231,7 @@
files = _.chain(files)
// convert share data to file data
.map(function(share) {
+ // TODO: use OC.Files.FileInfo
var file = {
id: share.file_source,
icon: OC.MimeType.getIconUrl(share.mimetype),
@@ -242,9 +243,6 @@
}
else {
file.type = 'file';
- if (share.isPreviewAvailable) {
- file.isPreviewAvailable = true;
- }
}
file.share = {
id: share.id,