From 7c68025010f3aeb91b84663fb3239ae0d038b4e2 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 30 Jan 2014 11:18:46 +0100 Subject: adding share owner information to the file list --- apps/files/templates/part.list.php | 10 +++++----- apps/files_sharing/lib/share/file.php | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index f4fb96a7a7c..9769affc70f 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -34,16 +34,16 @@ $totalsize = 0; ?> + + - - - - - + + t('shared by %s', array($file['displayname_owner']))) ?> + getCache(); if ($item['encrypted'] or ($item['unencrypted_size'] > 0 and $cache->getMimetype($item['mimetype']) === 'httpd/unix-directory')) { -- cgit v1.2.3 From d6e89a9a28986a57010a31701faa7d1981b5a5c1 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 30 Jan 2014 13:55:25 +0100 Subject: store the share owner in a data-attribute instead of a separate span --- apps/files/templates/part.list.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php index 9769affc70f..8a7a1e370eb 100644 --- a/apps/files/templates/part.list.php +++ b/apps/files/templates/part.list.php @@ -17,7 +17,13 @@ $totalsize = 0; ?> data-mime="" data-size="" data-etag="" - data-permissions=""> + data-permissions="" + + + data-share-owner="" + + > + @@ -36,15 +42,13 @@ $totalsize = 0; ?> + - - - - + -- cgit v1.2.3 From 271684dcfec16122b88e03780b41af7120f27e45 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 30 Jan 2014 14:47:00 +0100 Subject: update share owner --- apps/files_sharing/js/share.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'apps') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 36de452a55e..b795b921903 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -5,6 +5,14 @@ $(document).ready(function() { if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) { $('#fileList').on('fileActionsReady',function(){ + + var allShared = $('*[data-share-owner]').find('[data-Action="Share"]'); + allShared.addClass('permanent'); + allShared.find('span').text(function(){ + $owner = $(this).closest('tr').attr('data-share-owner'); + return ' ' + t('files_sharing', 'shared by {owner}', {owner: $owner}); + }); + if (!sharesLoaded){ OC.Share.loadIcons('file'); // assume that we got all shares, so switching directories -- cgit v1.2.3 From 2b84f5e0b91dc41c3bffe0149bfcd19fe39d1377 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 30 Jan 2014 14:49:38 +0100 Subject: remove duplicate selectors and declaration --- apps/files_sharing/js/share.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'apps') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index b795b921903..7df8a05f607 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -25,16 +25,15 @@ $(document).ready(function() { }); FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) { - if ($('#dir').val() == '/') { - var item = $('#dir').val() + filename; - } else { - var item = $('#dir').val() + '/' + filename; + var dir = $('#dir').val(); + var item = $dir + '/' + filename; + if ($dir == '/') { + item = $dir + filename; } var tr = FileList.findFileEl(filename); + var itemType = 'file'; if ($(tr).data('type') == 'dir') { - var itemType = 'folder'; - } else { - var itemType = 'file'; + itemType = 'folder'; } var possiblePermissions = $(tr).data('permissions'); var appendTo = $(tr).find('td.filename'); -- cgit v1.2.3 From 179fbada324bb51cfce6fde1818560b3ea739061 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 30 Jan 2014 15:10:42 +0100 Subject: show share owner within shared folders as well --- apps/files_sharing/lib/cache.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apps') diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index aadc54e4a7f..27602f69abf 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -135,6 +135,7 @@ class Shared_Cache extends Cache { return $files; } else { if ($cache = $this->getSourceCache($folder)) { + $parent = $this->storage->getFile($folder); $sourceFolderContent = $cache->getFolderContents($this->files[$folder]); foreach ($sourceFolderContent as $key => $c) { $ownerPathParts = explode('/', \OC_Filesystem::normalizePath($c['path'])); @@ -144,6 +145,8 @@ class Shared_Cache extends Cache { $usersPath .= '/'.$part; } $sourceFolderContent[$key]['usersPath'] = $usersPath; + $sourceFolderContent[$key]['uid_owner'] = $parent['uid_owner']; + $sourceFolderContent[$key]['displayname_owner'] = $parent['uid_owner']; } return $sourceFolderContent; -- cgit v1.2.3 From d0c8b310b9bd3134c650b4d77a384859519086c6 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 30 Jan 2014 16:29:32 +0100 Subject: uppercase text and fix dialog popup --- apps/files_sharing/js/share.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'apps') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 7df8a05f607..b08f3370c6f 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -10,7 +10,7 @@ $(document).ready(function() { allShared.addClass('permanent'); allShared.find('span').text(function(){ $owner = $(this).closest('tr').attr('data-share-owner'); - return ' ' + t('files_sharing', 'shared by {owner}', {owner: $owner}); + return ' ' + t('files_sharing', 'Shared by {owner}', {owner: $owner}); }); if (!sharesLoaded){ @@ -26,9 +26,9 @@ $(document).ready(function() { FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) { var dir = $('#dir').val(); - var item = $dir + '/' + filename; - if ($dir == '/') { - item = $dir + filename; + var item = dir + '/' + filename; + if (dir == '/') { + item = dir + filename; } var tr = FileList.findFileEl(filename); var itemType = 'file'; -- cgit v1.2.3 From 65843e245996c9ecfd167be2b520bb917b32aa7e Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Sat, 1 Feb 2014 14:52:41 +0100 Subject: Improve jQuery element selector see https://github.com/owncloud/core/pull/7012/files#r9337198 http://24ways.org/2011/your-jquery-now-with-less-suck/ --- apps/files_sharing/js/share.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index b08f3370c6f..9f0ed12f935 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -6,7 +6,7 @@ $(document).ready(function() { if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) { $('#fileList').on('fileActionsReady',function(){ - var allShared = $('*[data-share-owner]').find('[data-Action="Share"]'); + var allShared = $('#fileList').find('[data-share-owner]').find('[data-Action="Share"]'); allShared.addClass('permanent'); allShared.find('span').text(function(){ $owner = $(this).closest('tr').attr('data-share-owner'); -- cgit v1.2.3