Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a section for groups in share overview #14413

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/files/css/files.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
}
.nav-icon-sharingin,
.nav-icon-sharingout,
.nav-icon-sharinggroups,
.nav-icon-shareoverview {
@include icon-color('share', 'files', $color-black);
}
Expand Down Expand Up @@ -251,6 +252,7 @@ table th#headerName {
table th#headerSize, table td.filesize {
text-align: right;
}
table th#headerGroup,
table th#headerDate, table td.date,
table th.column-last, table td.column-last {
-moz-box-sizing: border-box;
Expand Down Expand Up @@ -941,8 +943,9 @@ table.dragshadow td.size {
}
}

/* No space for filesize and date in grid view */
/* No space for filesize ,groups and date in grid view */
&.filesize,
&.groups,
&.date {
display: none;
}
Expand Down
9 changes: 9 additions & 0 deletions apps/files_sharing/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ function() {
'name' => $l->t('Shared with you'),
]);

array_push($sharingSublistArray, [
'id' => 'sharinggroups',
'appname' => 'files_sharing',
'script' => 'list.php',
'order' => 20,
'name' => $l->t('Shared with groups'),
]);


if (\OCP\Util::isSharingDisabledForUser() === false) {
// Check if sharing by link is enabled
if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
Expand Down
50 changes: 50 additions & 0 deletions apps/files_sharing/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OCA.Sharing.App = {
_inFileList: null,
_outFileList: null,
_overviewFileList: null,
_groupsFileList: null,

initSharingIn: function($el) {
if (this._inFileList) {
Expand Down Expand Up @@ -76,6 +77,43 @@ OCA.Sharing.App = {
return this._outFileList;
},

initSharingGroups: function($el) {
if (this._groupsFileList) {
return this._groupsFileList;
}
this._groupsFileList = new OCA.Sharing.FileList(
$el,
{
id: 'shares.groups',
sharedWithUser: true,
sharedWithGroups: true,
fileActions: this._createFileActions(),
config: OCA.Files.App.getFilesConfig(),
// The file list is created when a "show" event is handled, so
// it should be marked as "shown" like it would have been done
// if handling the event with the file list already created.
shown: true
}
);

this._extendFileList(this._groupsFileList);
this._groupsFileList.appName = t('files_sharing', 'Shared with groups');
this._groupsFileList.$el.find('#emptycontent').html('<div class="icon-shared"></div>' +
'<h2>' + t('files_sharing', 'Nothing shared with your groups yet') + '</h2>' +
'<p>' + t('files_sharing', 'Files and folders others share with your groups will show up here') + '</p>');

//add col for group name
this._groupsFileList.$table.find("thead tr").append('<th id=headerGroup class="column-groups">' +
'<a class="columntitle" data-sort="groups">'+
'<span>' + t('files_sharing','Group') + '</span>' +
'<span class="sort-indicator icon-triangle-s"></span>'+
'</a>' +
'</td>') ; ;

return this._groupsFileList;
},


initSharingLinks: function($el) {
if (this._linkFileList) {
return this._linkFileList;
Expand Down Expand Up @@ -184,6 +222,12 @@ OCA.Sharing.App = {
}
},

removeSharingGroups: function() {
if (this._groupsFileList) {
this._groupsFileList.$fileList.empty();
}
},

/**
* Destroy the app
*/
Expand Down Expand Up @@ -303,4 +347,10 @@ $(document).ready(function() {
$('#app-content-shareoverview').on('hide', function() {
OCA.Sharing.App.removeSharingOverview();
});
$('#app-content-sharinggroups').on('show', function(e) {
OCA.Sharing.App.initSharingGroups($(e.target));
});
$('#app-content-sharinggroups').on('hide', function() {
OCA.Sharing.App.removeSharingGroups();
});
});
29 changes: 29 additions & 0 deletions apps/files_sharing/js/sharedfilelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
_clientSideSort: true,
_allowSelection: false,
_isOverview: false,
_sharedWithGroups: false,

/**
* @private
Expand All @@ -64,6 +65,9 @@
if (options && options.isOverview) {
this._isOverview = true;
}
if (options && options.sharedWithGroups) {
this._sharedWithGroups = true;
}
},

_renderRow: function() {
Expand All @@ -86,11 +90,25 @@
var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE;
$tr.attr('data-permissions', permission);
}

if (this._showDeleted) {
var permission = fileData.permissions;
$tr.attr('data-share-permissions', permission);
}
if (this._sharedWithGroups) {
var group = fileData.group ;
$tr.attr('data-share-groups',group);

// add group name
td = $('<td></td>').attr({"class": "groups"});
td.append($('<span></span>').attr({
"class": "modified",
"title": group
}).text(group)
.tooltip({placement: 'top'})
);
$tr.append(td);
}
// add row with expiration date for link only shares - influenced by _createRow of filelist
if (this._linksOnly) {
var expirationTimestamp = 0;
Expand Down Expand Up @@ -326,6 +344,12 @@
return share.share_type === OC.Share.SHARE_TYPE_LINK;
});
}
if (this._sharedWithGroups) {
files = _.filter(data, function(share) {
return share.share_type === OC.Share.SHARE_TYPE_GROUP;
});
}


// OCS API uses non-camelcased names
files = _.chain(files)
Expand Down Expand Up @@ -361,6 +385,11 @@
if (file.path) {
file.extraData = share.file_target;
}

if (share.share_type == OC.Share.SHARE_TYPE_GROUP) {
file.group = share.share_with_displayname;
file.groupId = share.share_with;
}
}
else {
if (share.share_type !== OC.Share.SHARE_TYPE_LINK) {
Expand Down
2 changes: 2 additions & 0 deletions apps/files_sharing/l10n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ OC.L10N.register(
"Shared with others" : "Partagés avec d'autres",
"Shared with you" : "Partagés avec vous",
"Shared by link" : "Partagés par lien",
"Shared with groups" : "Partagés avec des groupes",
"Deleted shares" : "Partages supprimés",
"Shares" : "Partages",
"Nothing shared with you yet" : "Aucun fichier n'est partagé avec vous pour l'instant",
"Nothing shared with your groups yet" : "Aucun fichier n'est partagé avec vos groupes pour l'instant",
"Files and folders others share with you will show up here" : "Les fichiers et dossiers partagés avec vous apparaîtront ici",
"Nothing shared yet" : "Rien n'est partagé pour l'instant",
"Files and folders you share will show up here" : "Les fichiers et dossiers que vous partagez apparaîtront ici",
Expand Down
4 changes: 3 additions & 1 deletion apps/files_sharing/l10n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"Shared with others" : "Partagés avec d'autres",
"Shared with you" : "Partagés avec vous",
"Shared by link" : "Partagés par lien",
"Shared with groups" : "Partagés avec des groupes",
"Deleted shares" : "Partages supprimés",
"Shares" : "Partages",
"Nothing shared with you yet" : "Aucun fichier n'est partagé avec vous pour l'instant",
"Nothing shared with your groups yet" : "Aucun fichier n'est partagé avec vos groupes pour l'instant",
"Files and folders others share with you will show up here" : "Les fichiers et dossiers partagés avec vous apparaîtront ici",
"Nothing shared yet" : "Rien n'est partagé pour l'instant",
"Files and folders you share will show up here" : "Les fichiers et dossiers que vous partagez apparaîtront ici",
Expand Down Expand Up @@ -135,4 +137,4 @@
"The password is wrong. Try again." : "Le mot de passe est incorrect. Veuillez réessayer.",
"Password" : "Mot de passe"
},"pluralForm" :"nplurals=2; plural=(n > 1);"
}
}