diff options
Diffstat (limited to 'apps/files_sharing')
34 files changed, 248 insertions, 158 deletions
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 20f1b046d35..8d919d1466f 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -54,9 +54,18 @@ $application->setupPropagation(); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); -\OCP\Util::addScript('files_sharing', 'share'); -\OCP\Util::addScript('files_sharing', 'external'); -\OCP\Util::addStyle('files_sharing', 'sharetabview'); +$eventDispatcher = \OC::$server->getEventDispatcher(); +$eventDispatcher->addListener( + 'OCA\Files::loadAdditionalScripts', + function() { + \OCP\Util::addScript('files_sharing', 'share'); + \OCP\Util::addScript('files_sharing', 'sharetabview'); + \OCP\Util::addScript('files_sharing', 'external'); + \OCP\Util::addStyle('files_sharing', 'sharetabview'); + } +); + +// \OCP\Util::addStyle('files_sharing', 'sharetabview'); \OC::$server->getActivityManager()->registerExtension(function() { return new \OCA\Files_Sharing\Activity( diff --git a/apps/files_sharing/css/sharetabview.css b/apps/files_sharing/css/sharetabview.css index 42c9bee7173..0cc812e917c 100644 --- a/apps/files_sharing/css/sharetabview.css +++ b/apps/files_sharing/css/sharetabview.css @@ -1,3 +1,75 @@ .app-files .shareTabView { min-height: 100px; } + +.shareTabView .oneline { white-space: nowrap; } + +.shareTabView .shareWithLoading { + padding-left: 10px; + position: relative; + right: 30px; + top: 2px; +} + +.shareTabView .shareWithRemoteInfo { + padding: 11px 0 11px 10px +} + +.shareTabView label { + font-weight:400; + white-space: nowrap; +} + +.shareTabView input[type="checkbox"] { + margin:0 3px 0 8px; + vertical-align: middle; +} + +.shareTabView input[type="text"], .shareTabView input[type="password"] { + width: 91%; + margin-left: 7px; +} + +.shareTabView form { + font-size: 100%; + margin-left: 0; + margin-right: 0; +} + +#shareWithList { + list-style-type:none; + padding:8px; +} + +#shareWithList li { + padding-top: 10px; + padding-bottom: 10px; + font-weight: bold; + line-height: 21px; + white-space: normal; +} + +#shareWithList .unshare img, #shareWithList .showCruds img { + vertical-align:text-bottom; /* properly align icons */ +} + +#shareWithList label input[type=checkbox]{ + margin-left: 0; + position: relative; +} +#shareWithList .username{ + padding-right: 8px; + white-space: nowrap; + text-overflow: ellipsis; + max-width: 254px; + display: inline-block; + overflow: hidden; + vertical-align: middle; +} +#shareWithList li label{ + margin-right: 8px; +} + +.shareTabView .icon-loading-small { + margin-left: -30px; +} diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index c124d390d04..5290dfbb7d1 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -79,7 +79,9 @@ $files = fileList.$fileList.find('tr'); } _.each($files, function(file) { - OCA.Sharing.Util.updateFileActionIcon($(file)); + var $tr = $(file); + var shareStatus = OC.Share.statuses[$tr.data('id')]; + OCA.Sharing.Util._updateFileActionIcon($tr, !!shareStatus, shareStatus && shareStatus.link); }); } @@ -104,71 +106,59 @@ permissions: OC.PERMISSION_SHARE, icon: OC.imagePath('core', 'actions/share'), type: OCA.Files.FileActions.TYPE_INLINE, - actionHandler: function(filename, context) { - var $tr = context.$file; - var itemType = 'file'; - if ($tr.data('type') === 'dir') { - itemType = 'folder'; - } - var possiblePermissions = $tr.data('share-permissions'); - if (_.isUndefined(possiblePermissions)) { - possiblePermissions = $tr.data('permissions'); - } - - var appendTo = $tr.find('td.filename'); - // Check if drop down is already visible for a different file - if (OC.Share.droppedDown) { - if ($tr.attr('data-id') !== $('#dropdown').attr('data-item-source')) { - OC.Share.hideDropDown(function () { - $tr.addClass('mouseOver'); - OC.Share.showDropDown(itemType, $tr.data('id'), appendTo, true, possiblePermissions, filename); - }); - } else { - OC.Share.hideDropDown(); - } - } else { - $tr.addClass('mouseOver'); - OC.Share.showDropDown(itemType, $tr.data('id'), appendTo, true, possiblePermissions, filename); - } - $('#dropdown').on('sharesChanged', function(ev) { - // files app current cannot show recipients on load, so we don't update the - // icon when changed for consistency - if (context.fileList.$el.closest('#app-content-files').length) { - return; - } - var recipients = _.pluck(ev.shares[OC.Share.SHARE_TYPE_USER], 'share_with_displayname'); - var groupRecipients = _.pluck(ev.shares[OC.Share.SHARE_TYPE_GROUP], 'share_with_displayname'); - recipients = recipients.concat(groupRecipients); - // note: we only update the data attribute because updateIcon() - // is called automatically after this event - if (recipients.length) { - $tr.attr('data-share-recipients', OCA.Sharing.Util.formatRecipients(recipients)); - } - else { - $tr.removeAttr('data-share-recipients'); - } - }); + actionHandler: function(fileName) { + fileList.showDetailsView(fileName, 'shareTabView'); } }); - OC.addScript('files_sharing', 'sharetabview').done(function() { - fileList.registerTabView(new OCA.Sharing.ShareTabView('shareTabView')); + var shareTab = new OCA.Sharing.ShareTabView('shareTabView'); + // detect changes and change the matching list entry + shareTab.on('sharesChanged', function(shareModel) { + var fileInfoModel = shareModel.fileInfoModel; + var $tr = fileList.findFileEl(fileInfoModel.get('name')); + OCA.Sharing.Util._updateFileListDataAttributes(fileList, $tr, shareModel); + if (!OCA.Sharing.Util._updateFileActionIcon($tr, shareModel.hasUserShares(), shareModel.hasLinkShare())) { + // remove icon, if applicable + OC.Share.markFileAsShared($tr, false, false); + } }); + fileList.registerTabView(shareTab); + }, + + /** + * Update file list data attributes + */ + _updateFileListDataAttributes: function(fileList, $tr, shareModel) { + // files app current cannot show recipients on load, so we don't update the + // icon when changed for consistency + if (fileList.id === 'files') { + return; + } + var recipients = _.pluck(shareModel.get('shares'), 'share_with_displayname'); + // note: we only update the data attribute because updateIcon() + if (recipients.length) { + $tr.attr('data-share-recipients', OCA.Sharing.Util.formatRecipients(recipients)); + } + else { + $tr.removeAttr('data-share-recipients'); + } }, /** * Update the file action share icon for the given file * * @param $tr file element of the file to update + * @param {bool} hasUserShares true if a user share exists + * @param {bool} hasLinkShare true if a link share exists + * + * @return {bool} true if the icon was set, false otherwise */ - updateFileActionIcon: function($tr) { + _updateFileActionIcon: function($tr, hasUserShares, hasLinkShare) { // if the statuses are loaded already, use them for the icon // (needed when scrolling to the next page) - var shareStatus = OC.Share.statuses[$tr.data('id')]; - if (shareStatus || $tr.attr('data-share-recipients') || $tr.attr('data-share-owner')) { + if (hasUserShares || hasLinkShare || $tr.attr('data-share-recipients') || $tr.attr('data-share-owner')) { var permissions = $tr.data('permissions'); - var hasLink = !!(shareStatus && shareStatus.link); - OC.Share.markFileAsShared($tr, true, hasLink); + OC.Share.markFileAsShared($tr, true, hasLinkShare); if ((permissions & OC.PERMISSION_SHARE) === 0 && $tr.attr('data-share-owner')) { // if no share action exists because the admin disabled sharing for this user // we create a share notification action to inform the user about files @@ -187,7 +177,9 @@ return $result; }); } + return true; } + return false; }, /** diff --git a/apps/files_sharing/js/sharetabview.js b/apps/files_sharing/js/sharetabview.js index ee572b747ea..e24320604fb 100644 --- a/apps/files_sharing/js/sharetabview.js +++ b/apps/files_sharing/js/sharetabview.js @@ -10,7 +10,9 @@ (function() { var TEMPLATE = - '<div><ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul></div>'; + '<div>' + + '<div class="dialogContainer"></div>' + + '</div>'; /** * @memberof OCA.Sharing @@ -20,7 +22,12 @@ id: 'shareTabView', className: 'tab shareTabView', - _template: null, + template: function(params) { + if (!this._template) { + this._template = Handlebars.compile(TEMPLATE); + } + return this._template(params); + }, getLabel: function() { return t('files_sharing', 'Sharing'); @@ -30,23 +37,40 @@ * Renders this details view */ render: function() { - this.$el.empty(); - - if (!this._template) { - this._template = Handlebars.compile(TEMPLATE); + var self = this; + if (this._dialog) { + // remove/destroy older instance + this._dialog.model.off(); + this._dialog.remove(); + this._dialog = null; } if (this.model) { - console.log(this.model); - var owner = this.model.get('shareOwner'); - if (owner === OC.currentUser) { - owner = null; - } - this.$el.append(this._template({ - owner: owner - })); + this.$el.html(this.template()); + // TODO: the model should read these directly off the passed fileInfoModel + var attributes = { + itemType: this.model.isDirectory() ? 'folder' : 'file', + itemSource: this.model.get('id'), + possiblePermissions: this.model.get('sharePermissions') + }; + var configModel = new OC.Share.ShareConfigModel(); + var shareModel = new OC.Share.ShareItemModel(attributes, { + configModel: configModel, + fileInfoModel: this.model + }); + this._dialog = new OC.Share.ShareDialogView({ + configModel: configModel, + model: shareModel + }); + this.$el.find('.dialogContainer').append(this._dialog.$el); + this._dialog.render(); + this._dialog.model.fetch(); + this._dialog.model.on('change', function() { + self.trigger('sharesChanged', shareModel); + }); } else { + this.$el.empty(); // TODO: render placeholder text? } } diff --git a/apps/files_sharing/l10n/cs_CZ.js b/apps/files_sharing/l10n/cs_CZ.js index bb8480e2a35..f6b43cf4fa3 100644 --- a/apps/files_sharing/l10n/cs_CZ.js +++ b/apps/files_sharing/l10n/cs_CZ.js @@ -41,7 +41,6 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s s vámi sdílí %1$s", "You shared %1$s via link" : "Sdílíte %1$s přes odkaz", "Shares" : "Sdílení", - "You received %s as a remote share from %s" : "Obdrželi jste %s nově nasdílená vzdáleně od %s ", "Accept" : "Přijmout", "Decline" : "Zamítnout", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Sdílej se mnou pomocí mého #ownCloud sdruženého cloud ID, více na %s", diff --git a/apps/files_sharing/l10n/cs_CZ.json b/apps/files_sharing/l10n/cs_CZ.json index 677e982b6b0..f5822c627ae 100644 --- a/apps/files_sharing/l10n/cs_CZ.json +++ b/apps/files_sharing/l10n/cs_CZ.json @@ -39,7 +39,6 @@ "%2$s shared %1$s with you" : "%2$s s vámi sdílí %1$s", "You shared %1$s via link" : "Sdílíte %1$s přes odkaz", "Shares" : "Sdílení", - "You received %s as a remote share from %s" : "Obdrželi jste %s nově nasdílená vzdáleně od %s ", "Accept" : "Přijmout", "Decline" : "Zamítnout", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Sdílej se mnou pomocí mého #ownCloud sdruženého cloud ID, více na %s", diff --git a/apps/files_sharing/l10n/da.js b/apps/files_sharing/l10n/da.js index 87595f6cc56..7b54b361d8d 100644 --- a/apps/files_sharing/l10n/da.js +++ b/apps/files_sharing/l10n/da.js @@ -41,7 +41,7 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s delt %1$s med dig", "You shared %1$s via link" : "Du delte %1$s via link", "Shares" : "Delt", - "You received %s as a remote share from %s" : "Du modtog %s som et ekstern deling fra %s", + "You received %2$s as a remote share from %1$s" : "Du modtog %2$s som en ekstern deling fra %1$s", "Accept" : "Acceptér", "Decline" : "Afvis", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Del med mig gennem min #ownCloud Federated Cloud ID, se %s", diff --git a/apps/files_sharing/l10n/da.json b/apps/files_sharing/l10n/da.json index c9ac959da2e..f430935e8bc 100644 --- a/apps/files_sharing/l10n/da.json +++ b/apps/files_sharing/l10n/da.json @@ -39,7 +39,7 @@ "%2$s shared %1$s with you" : "%2$s delt %1$s med dig", "You shared %1$s via link" : "Du delte %1$s via link", "Shares" : "Delt", - "You received %s as a remote share from %s" : "Du modtog %s som et ekstern deling fra %s", + "You received %2$s as a remote share from %1$s" : "Du modtog %2$s som en ekstern deling fra %1$s", "Accept" : "Acceptér", "Decline" : "Afvis", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Del med mig gennem min #ownCloud Federated Cloud ID, se %s", diff --git a/apps/files_sharing/l10n/el.js b/apps/files_sharing/l10n/el.js index ef688424777..18ba9bd0d31 100644 --- a/apps/files_sharing/l10n/el.js +++ b/apps/files_sharing/l10n/el.js @@ -41,7 +41,6 @@ OC.L10N.register( "%2$s shared %1$s with you" : "Ο %2$s διαμοιράστηκε το %1$s με εσάς", "You shared %1$s via link" : "Μοιραστήκατε το %1$s μέσω συνδέσμου", "Shares" : "Κοινόχρηστοι φάκελοι", - "You received %s as a remote share from %s" : "Λάβατε το %s ως απομακρυσμένο διαμοιρασμό από %s", "Accept" : "Αποδοχή", "Decline" : "Απόρριψη", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Διαμοιρασμός με εμένα μέσω του #ownCloud Federated Cloud ID μου, δείτε %s", diff --git a/apps/files_sharing/l10n/el.json b/apps/files_sharing/l10n/el.json index 829ff61ceaa..f8e42195d0d 100644 --- a/apps/files_sharing/l10n/el.json +++ b/apps/files_sharing/l10n/el.json @@ -39,7 +39,6 @@ "%2$s shared %1$s with you" : "Ο %2$s διαμοιράστηκε το %1$s με εσάς", "You shared %1$s via link" : "Μοιραστήκατε το %1$s μέσω συνδέσμου", "Shares" : "Κοινόχρηστοι φάκελοι", - "You received %s as a remote share from %s" : "Λάβατε το %s ως απομακρυσμένο διαμοιρασμό από %s", "Accept" : "Αποδοχή", "Decline" : "Απόρριψη", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Διαμοιρασμός με εμένα μέσω του #ownCloud Federated Cloud ID μου, δείτε %s", diff --git a/apps/files_sharing/l10n/fi_FI.js b/apps/files_sharing/l10n/fi_FI.js index 396c4785537..060efce51dd 100644 --- a/apps/files_sharing/l10n/fi_FI.js +++ b/apps/files_sharing/l10n/fi_FI.js @@ -41,7 +41,7 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s jakoi kohteen %1$s kanssasi", "You shared %1$s via link" : "Jaoit kohteen %1$s linkin kautta", "Shares" : "Jaot", - "You received %s as a remote share from %s" : "Sait etäjaon %s käyttäjältä %s", + "You received %2$s as a remote share from %1$s" : "Sait kohteen %2$s etäjakona käyttäjältä %1$s", "Accept" : "Hyväksy", "Decline" : "Kieltäydy", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Jaa kanssani käyttäen #ownCloud ja federoitua pilvitunnistetta, katso %s", diff --git a/apps/files_sharing/l10n/fi_FI.json b/apps/files_sharing/l10n/fi_FI.json index 56d64c0e841..091f7aec81f 100644 --- a/apps/files_sharing/l10n/fi_FI.json +++ b/apps/files_sharing/l10n/fi_FI.json @@ -39,7 +39,7 @@ "%2$s shared %1$s with you" : "%2$s jakoi kohteen %1$s kanssasi", "You shared %1$s via link" : "Jaoit kohteen %1$s linkin kautta", "Shares" : "Jaot", - "You received %s as a remote share from %s" : "Sait etäjaon %s käyttäjältä %s", + "You received %2$s as a remote share from %1$s" : "Sait kohteen %2$s etäjakona käyttäjältä %1$s", "Accept" : "Hyväksy", "Decline" : "Kieltäydy", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Jaa kanssani käyttäen #ownCloud ja federoitua pilvitunnistetta, katso %s", diff --git a/apps/files_sharing/l10n/fr.js b/apps/files_sharing/l10n/fr.js index a59409e008a..3942d18de03 100644 --- a/apps/files_sharing/l10n/fr.js +++ b/apps/files_sharing/l10n/fr.js @@ -42,6 +42,7 @@ OC.L10N.register( "You shared %1$s via link" : "Vous avez partagé %1$s par lien public", "Shares" : "Partages", "Accept" : "Accepter", + "Decline" : "Refuser", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Partagez avec moi grâce à mon identifiant Federated Cloud #owncloud %s", "Share with me through my #ownCloud Federated Cloud ID" : "Partagez avec moi grâce à mon identifiant Federated Cloud #owncloud", "This share is password-protected" : "Ce partage est protégé par un mot de passe", diff --git a/apps/files_sharing/l10n/fr.json b/apps/files_sharing/l10n/fr.json index 0bb6f2b1b9e..75b645ef259 100644 --- a/apps/files_sharing/l10n/fr.json +++ b/apps/files_sharing/l10n/fr.json @@ -40,6 +40,7 @@ "You shared %1$s via link" : "Vous avez partagé %1$s par lien public", "Shares" : "Partages", "Accept" : "Accepter", + "Decline" : "Refuser", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Partagez avec moi grâce à mon identifiant Federated Cloud #owncloud %s", "Share with me through my #ownCloud Federated Cloud ID" : "Partagez avec moi grâce à mon identifiant Federated Cloud #owncloud", "This share is password-protected" : "Ce partage est protégé par un mot de passe", diff --git a/apps/files_sharing/l10n/hu_HU.js b/apps/files_sharing/l10n/hu_HU.js index c78bdce652d..3895a028be8 100644 --- a/apps/files_sharing/l10n/hu_HU.js +++ b/apps/files_sharing/l10n/hu_HU.js @@ -42,6 +42,7 @@ OC.L10N.register( "You shared %1$s via link" : "Megosztottam link segítségével: %1$s", "Shares" : "Megosztások", "Accept" : "Elfogadás", + "Decline" : "Elutasítás", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Ossza meg velem az #ownCloud Egyesített Felhő Azonosító segítségével, lásd %s", "Share with me through my #ownCloud Federated Cloud ID" : "Ossza meg velem az #ownCloud Egyesített Felhő Azonosító segítségével ", "This share is password-protected" : "Ez egy jelszóval védett megosztás", diff --git a/apps/files_sharing/l10n/hu_HU.json b/apps/files_sharing/l10n/hu_HU.json index 22cc1422eb7..e9037d232b0 100644 --- a/apps/files_sharing/l10n/hu_HU.json +++ b/apps/files_sharing/l10n/hu_HU.json @@ -40,6 +40,7 @@ "You shared %1$s via link" : "Megosztottam link segítségével: %1$s", "Shares" : "Megosztások", "Accept" : "Elfogadás", + "Decline" : "Elutasítás", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Ossza meg velem az #ownCloud Egyesített Felhő Azonosító segítségével, lásd %s", "Share with me through my #ownCloud Federated Cloud ID" : "Ossza meg velem az #ownCloud Egyesített Felhő Azonosító segítségével ", "This share is password-protected" : "Ez egy jelszóval védett megosztás", diff --git a/apps/files_sharing/l10n/id.js b/apps/files_sharing/l10n/id.js index f0d9fc2aecb..d39d9e763f1 100644 --- a/apps/files_sharing/l10n/id.js +++ b/apps/files_sharing/l10n/id.js @@ -41,7 +41,6 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s membagikan %1$s dengan Anda", "You shared %1$s via link" : "Anda membagikan %1$s via tautan", "Shares" : "Dibagikan", - "You received %s as a remote share from %s" : "Anda menerima %s sebagai berbagi remote dari %s", "Accept" : "Terima", "Decline" : "Tolak", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Dibagikan pada saya melalui #ownCloud Federated Cloud ID saya, lihat %s", diff --git a/apps/files_sharing/l10n/id.json b/apps/files_sharing/l10n/id.json index b14f4c43789..35b22b53346 100644 --- a/apps/files_sharing/l10n/id.json +++ b/apps/files_sharing/l10n/id.json @@ -39,7 +39,6 @@ "%2$s shared %1$s with you" : "%2$s membagikan %1$s dengan Anda", "You shared %1$s via link" : "Anda membagikan %1$s via tautan", "Shares" : "Dibagikan", - "You received %s as a remote share from %s" : "Anda menerima %s sebagai berbagi remote dari %s", "Accept" : "Terima", "Decline" : "Tolak", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Dibagikan pada saya melalui #ownCloud Federated Cloud ID saya, lihat %s", diff --git a/apps/files_sharing/l10n/it.js b/apps/files_sharing/l10n/it.js index 9ddf9b5f385..0167ef4625d 100644 --- a/apps/files_sharing/l10n/it.js +++ b/apps/files_sharing/l10n/it.js @@ -41,7 +41,7 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s ha condiviso %1$s con te", "You shared %1$s via link" : "Hai condiviso %1$s tramite collegamento", "Shares" : "Condivisioni", - "You received %s as a remote share from %s" : "Hai ricevuto %s come condivisione remota da %s", + "You received %2$s as a remote share from %1$s" : "Hai ricevuto %2$s come condivisione remota da %1$s", "Accept" : "Accetta", "Decline" : "Rifiuta", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Condividi con me attraverso il mio ID di cloud federata #ownCloud, vedi %s", diff --git a/apps/files_sharing/l10n/it.json b/apps/files_sharing/l10n/it.json index 2ff7f2d13b5..ae26579572a 100644 --- a/apps/files_sharing/l10n/it.json +++ b/apps/files_sharing/l10n/it.json @@ -39,7 +39,7 @@ "%2$s shared %1$s with you" : "%2$s ha condiviso %1$s con te", "You shared %1$s via link" : "Hai condiviso %1$s tramite collegamento", "Shares" : "Condivisioni", - "You received %s as a remote share from %s" : "Hai ricevuto %s come condivisione remota da %s", + "You received %2$s as a remote share from %1$s" : "Hai ricevuto %2$s come condivisione remota da %1$s", "Accept" : "Accetta", "Decline" : "Rifiuta", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Condividi con me attraverso il mio ID di cloud federata #ownCloud, vedi %s", diff --git a/apps/files_sharing/l10n/ko.js b/apps/files_sharing/l10n/ko.js index d750f827797..e4b86b528f3 100644 --- a/apps/files_sharing/l10n/ko.js +++ b/apps/files_sharing/l10n/ko.js @@ -41,7 +41,6 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s 님이 내게 %1$s을(를) 공유함", "You shared %1$s via link" : "내가 %1$s을(를) 링크로 공유함", "Shares" : "공유", - "You received %s as a remote share from %s" : "%1$s의 원격 공유로 %2$s을(를) 받았습니다", "Accept" : "수락", "Decline" : "거절", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "내 #ownCloud 연합 클라우드 ID를 통해서 공유됨, 더 알아보기: %s", diff --git a/apps/files_sharing/l10n/ko.json b/apps/files_sharing/l10n/ko.json index e9a169be4f7..383e5038f3c 100644 --- a/apps/files_sharing/l10n/ko.json +++ b/apps/files_sharing/l10n/ko.json @@ -39,7 +39,6 @@ "%2$s shared %1$s with you" : "%2$s 님이 내게 %1$s을(를) 공유함", "You shared %1$s via link" : "내가 %1$s을(를) 링크로 공유함", "Shares" : "공유", - "You received %s as a remote share from %s" : "%1$s의 원격 공유로 %2$s을(를) 받았습니다", "Accept" : "수락", "Decline" : "거절", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "내 #ownCloud 연합 클라우드 ID를 통해서 공유됨, 더 알아보기: %s", diff --git a/apps/files_sharing/l10n/nb_NO.js b/apps/files_sharing/l10n/nb_NO.js index a83ce84d26d..b8b6c634959 100644 --- a/apps/files_sharing/l10n/nb_NO.js +++ b/apps/files_sharing/l10n/nb_NO.js @@ -41,7 +41,6 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s delte %1$s med deg", "You shared %1$s via link" : "Du delte %1$s via lenke", "Shares" : "Delinger", - "You received %s as a remote share from %s" : "Du mottok %s som en ekstern deling fra %s", "Accept" : "Aksepter", "Decline" : "Avslå", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Del med meg gjennom min #ownCloud ID for sammenknyttet sky, se %s", diff --git a/apps/files_sharing/l10n/nb_NO.json b/apps/files_sharing/l10n/nb_NO.json index 6eedd895f4f..9382119e5c4 100644 --- a/apps/files_sharing/l10n/nb_NO.json +++ b/apps/files_sharing/l10n/nb_NO.json @@ -39,7 +39,6 @@ "%2$s shared %1$s with you" : "%2$s delte %1$s med deg", "You shared %1$s via link" : "Du delte %1$s via lenke", "Shares" : "Delinger", - "You received %s as a remote share from %s" : "Du mottok %s som en ekstern deling fra %s", "Accept" : "Aksepter", "Decline" : "Avslå", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Del med meg gjennom min #ownCloud ID for sammenknyttet sky, se %s", diff --git a/apps/files_sharing/l10n/nl.js b/apps/files_sharing/l10n/nl.js index 7468819fda7..2ccddb5d9a7 100644 --- a/apps/files_sharing/l10n/nl.js +++ b/apps/files_sharing/l10n/nl.js @@ -41,7 +41,9 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s deelde %1$s met u", "You shared %1$s via link" : "U deelde %1$s via link", "Shares" : "Gedeeld", + "You received %2$s as a remote share from %1$s" : "U ontving %2$s als een externe share van %1$s", "Accept" : "Accepteren", + "Decline" : "Afwijzen", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Deel met mij via mijn #ownCloud federated Cloud ID, zie %s", "Share with me through my #ownCloud Federated Cloud ID" : "Deel met mij via mijn #ownCloud federated Cloud ID", "This share is password-protected" : "Deze share is met een wachtwoord beveiligd", diff --git a/apps/files_sharing/l10n/nl.json b/apps/files_sharing/l10n/nl.json index 57df2d5c155..53cd8954898 100644 --- a/apps/files_sharing/l10n/nl.json +++ b/apps/files_sharing/l10n/nl.json @@ -39,7 +39,9 @@ "%2$s shared %1$s with you" : "%2$s deelde %1$s met u", "You shared %1$s via link" : "U deelde %1$s via link", "Shares" : "Gedeeld", + "You received %2$s as a remote share from %1$s" : "U ontving %2$s als een externe share van %1$s", "Accept" : "Accepteren", + "Decline" : "Afwijzen", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Deel met mij via mijn #ownCloud federated Cloud ID, zie %s", "Share with me through my #ownCloud Federated Cloud ID" : "Deel met mij via mijn #ownCloud federated Cloud ID", "This share is password-protected" : "Deze share is met een wachtwoord beveiligd", diff --git a/apps/files_sharing/l10n/pt_BR.js b/apps/files_sharing/l10n/pt_BR.js index 35c9f970000..bb455487186 100644 --- a/apps/files_sharing/l10n/pt_BR.js +++ b/apps/files_sharing/l10n/pt_BR.js @@ -41,7 +41,7 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s compartilhou %1$s com você", "You shared %1$s via link" : "Você compartilhou %1$s via link", "Shares" : "Compartilhamentos", - "You received %s as a remote share from %s" : "Você recebeu %s como um compartilhamento remoto de %s", + "You received %2$s as a remote share from %1$s" : "Você recebeu %2$s como um compartilhamento remoto de %1$s", "Accept" : "Aceitar", "Decline" : "Rejeitar", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartilhe comigo através do meu #ownCloud Nuvem Federados ID, veja %s", diff --git a/apps/files_sharing/l10n/pt_BR.json b/apps/files_sharing/l10n/pt_BR.json index ebb2a5a4cce..7db2b1f0494 100644 --- a/apps/files_sharing/l10n/pt_BR.json +++ b/apps/files_sharing/l10n/pt_BR.json @@ -39,7 +39,7 @@ "%2$s shared %1$s with you" : "%2$s compartilhou %1$s com você", "You shared %1$s via link" : "Você compartilhou %1$s via link", "Shares" : "Compartilhamentos", - "You received %s as a remote share from %s" : "Você recebeu %s como um compartilhamento remoto de %s", + "You received %2$s as a remote share from %1$s" : "Você recebeu %2$s como um compartilhamento remoto de %1$s", "Accept" : "Aceitar", "Decline" : "Rejeitar", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartilhe comigo através do meu #ownCloud Nuvem Federados ID, veja %s", diff --git a/apps/files_sharing/l10n/sk_SK.js b/apps/files_sharing/l10n/sk_SK.js index 677b4f24e21..4d596987963 100644 --- a/apps/files_sharing/l10n/sk_SK.js +++ b/apps/files_sharing/l10n/sk_SK.js @@ -42,6 +42,7 @@ OC.L10N.register( "You shared %1$s via link" : "Zdieľate %1$s prostredníctvom odkazu", "Shares" : "Zdieľanie", "Accept" : "Schváliť", + "Decline" : "Odmietnuť", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Zdieľajte so mnou pomocou môjho #ownCloud Federated Cloud ID, viac n %s", "Share with me through my #ownCloud Federated Cloud ID" : "Zdieľajte so mnou pomocou môjho #ownCloud Federated Cloud ID", "This share is password-protected" : "Toto zdieľanie je chránené heslom", @@ -64,8 +65,10 @@ OC.L10N.register( "Open documentation" : "Otvoriť dokumentáciu", "Allow users on this server to send shares to other servers" : "Povoliť používateľom z tohoto servera posielať zdieľania na iné servery", "Allow users on this server to receive shares from other servers" : "Povoliť používateľom z tohoto servera prijímať zdieľania z iných serverov", + "Federated Cloud" : "Združený Cloud", "Your Federated Cloud ID:" : "Vaše združené Cloud ID", "Share it:" : "Zdieľať:", + "Add to your website" : "Pridať na svoju webstránku", "Share with me via ownCloud" : "Zdieľané so mnou cez ownCloud", "HTML Code:" : "HTML kód:" }, diff --git a/apps/files_sharing/l10n/sk_SK.json b/apps/files_sharing/l10n/sk_SK.json index f4f6cc3798b..e8468d1500e 100644 --- a/apps/files_sharing/l10n/sk_SK.json +++ b/apps/files_sharing/l10n/sk_SK.json @@ -40,6 +40,7 @@ "You shared %1$s via link" : "Zdieľate %1$s prostredníctvom odkazu", "Shares" : "Zdieľanie", "Accept" : "Schváliť", + "Decline" : "Odmietnuť", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Zdieľajte so mnou pomocou môjho #ownCloud Federated Cloud ID, viac n %s", "Share with me through my #ownCloud Federated Cloud ID" : "Zdieľajte so mnou pomocou môjho #ownCloud Federated Cloud ID", "This share is password-protected" : "Toto zdieľanie je chránené heslom", @@ -62,8 +63,10 @@ "Open documentation" : "Otvoriť dokumentáciu", "Allow users on this server to send shares to other servers" : "Povoliť používateľom z tohoto servera posielať zdieľania na iné servery", "Allow users on this server to receive shares from other servers" : "Povoliť používateľom z tohoto servera prijímať zdieľania z iných serverov", + "Federated Cloud" : "Združený Cloud", "Your Federated Cloud ID:" : "Vaše združené Cloud ID", "Share it:" : "Zdieľať:", + "Add to your website" : "Pridať na svoju webstránku", "Share with me via ownCloud" : "Zdieľané so mnou cez ownCloud", "HTML Code:" : "HTML kód:" },"pluralForm" :"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;" diff --git a/apps/files_sharing/l10n/th_TH.js b/apps/files_sharing/l10n/th_TH.js index 9db7c600102..07aa56dfe18 100644 --- a/apps/files_sharing/l10n/th_TH.js +++ b/apps/files_sharing/l10n/th_TH.js @@ -41,7 +41,7 @@ OC.L10N.register( "%2$s shared %1$s with you" : "%2$s ถูกแชร์ %1$s กับคุณ", "You shared %1$s via link" : "คุณแชร์ %1$s ผ่านลิงค์", "Shares" : "แชร์", - "You received %s as a remote share from %s" : "คุณได้รับ %s โดยรีโมทแชร์จาก %s", + "You received %2$s as a remote share from %1$s" : "คุณได้รับรีโมทแชร์ %2$s จาก %1$s", "Accept" : "ยอมรับ", "Decline" : "ลดลง", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "แชร์ร่วมกับฉันผ่าน #ownCloud ด้วยไอดีคลาวด์ในเครือ สามารถดูได้ที่ %s", diff --git a/apps/files_sharing/l10n/th_TH.json b/apps/files_sharing/l10n/th_TH.json index f630c062643..3edd0d18ab1 100644 --- a/apps/files_sharing/l10n/th_TH.json +++ b/apps/files_sharing/l10n/th_TH.json @@ -39,7 +39,7 @@ "%2$s shared %1$s with you" : "%2$s ถูกแชร์ %1$s กับคุณ", "You shared %1$s via link" : "คุณแชร์ %1$s ผ่านลิงค์", "Shares" : "แชร์", - "You received %s as a remote share from %s" : "คุณได้รับ %s โดยรีโมทแชร์จาก %s", + "You received %2$s as a remote share from %1$s" : "คุณได้รับรีโมทแชร์ %2$s จาก %1$s", "Accept" : "ยอมรับ", "Decline" : "ลดลง", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "แชร์ร่วมกับฉันผ่าน #ownCloud ด้วยไอดีคลาวด์ในเครือ สามารถดูได้ที่ %s", diff --git a/apps/files_sharing/lib/notifier.php b/apps/files_sharing/lib/notifier.php index cc2deb3f439..02765fcfd1c 100644 --- a/apps/files_sharing/lib/notifier.php +++ b/apps/files_sharing/lib/notifier.php @@ -55,7 +55,7 @@ class Notifier implements INotifier { case 'remote_share': $params = $notification->getSubjectParameters(); $notification->setParsedSubject( - (string) $l->t('You received %s as a remote share from %s', $params) + (string) $l->t('You received %2$s as a remote share from %1$s', $params) ); // Deal with the actions for a known subject diff --git a/apps/files_sharing/tests/js/shareSpec.js b/apps/files_sharing/tests/js/shareSpec.js index b6368b901ee..96a96f1b814 100644 --- a/apps/files_sharing/tests/js/shareSpec.js +++ b/apps/files_sharing/tests/js/shareSpec.js @@ -97,7 +97,6 @@ describe('OCA.Sharing.Util tests', function() { }]); $tr = fileList.$el.find('tbody tr:first'); $action = $tr.find('.action-share'); - expect($action.hasClass('permanent')).toEqual(true); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder.svg'); expect($action.find('img').length).toEqual(1); @@ -116,7 +115,6 @@ describe('OCA.Sharing.Util tests', function() { }]); $tr = fileList.$el.find('tbody tr:first'); $action = $tr.find('.action-share'); - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('Shared'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-shared.svg'); @@ -137,7 +135,6 @@ describe('OCA.Sharing.Util tests', function() { }]); $tr = fileList.$el.find('tbody tr:first'); $action = $tr.find('.action-share'); - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('Shared'); expect(OC.basename($action.find('img').attr('src'))).toEqual('public.svg'); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-public.svg'); @@ -158,7 +155,6 @@ describe('OCA.Sharing.Util tests', function() { }]); $tr = fileList.$el.find('tbody tr:first'); $action = $tr.find('.action-share'); - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('User One'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-shared.svg'); @@ -178,7 +174,6 @@ describe('OCA.Sharing.Util tests', function() { }]); $tr = fileList.$el.find('tbody tr:first'); $action = $tr.find('.action-share'); - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('Shared with User One, User Two'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-shared.svg'); @@ -200,7 +195,6 @@ describe('OCA.Sharing.Util tests', function() { $tr = fileList.$el.find('tbody tr:first'); expect($tr.find('.action-share').length).toEqual(0); $action = $tr.find('.action-share-notification'); - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('User One'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-shared.svg'); @@ -225,7 +219,7 @@ describe('OCA.Sharing.Util tests', function() { }); }); describe('Share action', function() { - var showDropDownStub; + var shareTab; function makeDummyShareItem(displayName) { return { @@ -234,12 +228,35 @@ describe('OCA.Sharing.Util tests', function() { } beforeEach(function() { - showDropDownStub = sinon.stub(OC.Share, 'showDropDown', function() { - $('#testArea').append($('<div id="dropdown"></div>')); - }); + // make it look like not the "All files" list + fileList.id = 'test'; + shareTab = fileList._detailsView._tabViews[0]; }); afterEach(function() { - showDropDownStub.restore(); + shareTab = null; + }); + it('clicking share action opens sidebar and share tab', function() { + var showDetailsViewStub = sinon.stub(fileList, 'showDetailsView'); + + fileList.setFiles([{ + id: 1, + type: 'file', + name: 'One.txt', + path: '/subdir', + mimetype: 'text/plain', + size: 12, + permissions: OC.PERMISSION_ALL, + etag: 'abc' + }]); + + var $tr = fileList.$el.find('tr:first'); + $tr.find('.action-share').click(); + + expect(showDetailsViewStub.calledOnce).toEqual(true); + expect(showDetailsViewStub.getCall(0).args[0]).toEqual('One.txt'); + expect(showDetailsViewStub.getCall(0).args[1]).toEqual('shareTabView'); + + showDetailsViewStub.restore(); }); it('adds share icon after sharing a non-shared file', function() { var $action, $tr; @@ -257,24 +274,20 @@ describe('OCA.Sharing.Util tests', function() { $action = fileList.$el.find('tbody tr:first .action-share'); $tr = fileList.$el.find('tr:first'); - expect($action.hasClass('permanent')).toEqual(true); - $tr.find('.action-share').click(); - expect(showDropDownStub.calledOnce).toEqual(true); - - // simulate what the dropdown does - var shares = {}; - OC.Share.itemShares[OC.Share.SHARE_TYPE_USER] = ['user1', 'user2']; - OC.Share.itemShares[OC.Share.SHARE_TYPE_GROUP] = ['group1', 'group2']; - shares[OC.Share.SHARE_TYPE_USER] = _.map(['User One', 'User Two'], makeDummyShareItem); - shares[OC.Share.SHARE_TYPE_GROUP] = _.map(['Group One', 'Group Two'], makeDummyShareItem); - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: shares})); + // simulate updating shares + shareTab._dialog.model.set({ + shares: [ + {share_with_displayname: 'User One'}, + {share_with_displayname: 'User Two'}, + {share_with_displayname: 'Group One'}, + {share_with_displayname: 'Group Two'} + ] + }); expect($tr.attr('data-share-recipients')).toEqual('Group One, Group Two, User One, User Two'); - OC.Share.updateIcon('file', 1); - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('Shared with Group One, Group Two, User One, User Two'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); }); @@ -294,23 +307,19 @@ describe('OCA.Sharing.Util tests', function() { $action = fileList.$el.find('tbody tr:first .action-share'); $tr = fileList.$el.find('tr:first'); - expect($action.hasClass('permanent')).toEqual(true); - $tr.find('.action-share').click(); - expect(showDropDownStub.calledOnce).toEqual(true); - - // simulate what the dropdown does - var shares = {}; - OC.Share.itemShares[OC.Share.SHARE_TYPE_USER] = ['user1', 'user2', 'user3']; - shares[OC.Share.SHARE_TYPE_USER] = _.map(['User One', 'User Two', 'User Three'], makeDummyShareItem); - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: shares})); + // simulate updating shares + shareTab._dialog.model.set({ + shares: [ + {share_with_displayname: 'User One'}, + {share_with_displayname: 'User Two'}, + {share_with_displayname: 'User Three'} + ] + }); expect($tr.attr('data-share-recipients')).toEqual('User One, User Three, User Two'); - OC.Share.updateIcon('file', 1); - - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('Shared with User One, User Three, User Two'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); }); @@ -331,20 +340,14 @@ describe('OCA.Sharing.Util tests', function() { $action = fileList.$el.find('tbody tr:first .action-share'); $tr = fileList.$el.find('tr:first'); - expect($action.hasClass('permanent')).toEqual(true); - $tr.find('.action-share').click(); - expect(showDropDownStub.calledOnce).toEqual(true); - - // simulate what the dropdown does - OC.Share.itemShares = {}; - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: {}})); + // simulate updating shares + shareTab._dialog.model.set({ + shares: [] + }); expect($tr.attr('data-share-recipients')).not.toBeDefined(); - - OC.Share.updateIcon('file', 1); - expect($action.hasClass('permanent')).toEqual(true); }); it('keep share text after updating reshare', function() { var $action, $tr; @@ -363,23 +366,15 @@ describe('OCA.Sharing.Util tests', function() { $action = fileList.$el.find('tbody tr:first .action-share'); $tr = fileList.$el.find('tr:first'); - expect($action.hasClass('permanent')).toEqual(true); - $tr.find('.action-share').click(); - expect(showDropDownStub.calledOnce).toEqual(true); - - // simulate what the dropdown does - var shares = {}; - OC.Share.itemShares[OC.Share.SHARE_TYPE_USER] = ['user2']; - shares[OC.Share.SHARE_TYPE_USER] = _.map(['User Two'], makeDummyShareItem); - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: shares})); + // simulate updating shares + shareTab._dialog.model.set({ + shares: [{share_with_displayname: 'User Two'}] + }); expect($tr.attr('data-share-recipients')).toEqual('User Two'); - OC.Share.updateIcon('file', 1); - - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('User One'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); }); @@ -401,21 +396,15 @@ describe('OCA.Sharing.Util tests', function() { $action = fileList.$el.find('tbody tr:first .action-share'); $tr = fileList.$el.find('tr:first'); - expect($action.hasClass('permanent')).toEqual(true); - $tr.find('.action-share').click(); - expect(showDropDownStub.calledOnce).toEqual(true); - - // simulate what the dropdown does - OC.Share.itemShares = {}; - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: {}})); + // simulate updating shares + shareTab._dialog.model.set({ + shares: [] + }); expect($tr.attr('data-share-recipients')).not.toBeDefined(); - OC.Share.updateIcon('file', 1); - - expect($action.hasClass('permanent')).toEqual(true); expect($action.find('>span').text().trim()).toEqual('User One'); expect(OC.basename($action.find('img').attr('src'))).toEqual('share.svg'); }); |