diff --git a/appinfo/info.xml b/appinfo/info.xml
index 6d777cc..2c7f49e 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,7 +5,7 @@
MagentaCLOUD sharingCustomisation of sharing.
- 2.0.1
+ 3.0.1agplAleksei EfremovNmcsharing
diff --git a/l10n/de.js b/l10n/de.js
index 5c77b3c..584bf0a 100644
--- a/l10n/de.js
+++ b/l10n/de.js
@@ -1,20 +1,33 @@
OC.L10N.register(
'nmcsharing',
{
- Sharing: 'Teilen',
+ 'Sharing': 'Teilen',
'Add link': 'Link erstellen',
+ 'Add new link': 'Neuen Link erstellen',
'Read only': 'Nur lesen',
'Can edit': 'Kann bearbeiten',
'File drop': 'Sammelbox',
- User: 'Benutzer',
- Permissions: 'Berechtigungen',
+ 'User': 'Benutzer',
+ 'Permissions': 'Berechtigungen',
'Read, write and upload': 'Kann bearbeiten',
'Read and write': 'Kann bearbeiten',
'File drop (upload only)': 'Sammelbox',
'With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.': 'Bei der Sammelbox ist nur das Hochladen erlaubt. Nur Sie sehen Dateien und Ordner die hochgeladen worden sind.',
- Advanced: 'Erweiterte',
+ 'Advanced': 'Erweiterte',
'Set password': 'Passwortschutz',
'Your shares': 'Ihre Freigaben',
+ 'Manage access': 'Zugriff verwalten',
+ 'Send': 'Send',
+ 'Send link via E-Mail': 'Link per E-Mail senden',
+ 'Links sent via E-Mail': 'Links per E-Mail versandt',
+ 'Accept settings': 'Übernehmen',
+ 'Or': 'Oder',
+ 'Links to Copy': 'Links zum Kopieren',
+ 'Anyone with the link can edit': 'Jeder mit dem Link kann bearbeiten',
+ 'Anyone with the link can only view': 'Jeder mit dem Link kann nur anzeigen',
+ 'Anyone with the link can file drop': 'Jeder mit dem Link kann Dateien hinzufügen',
+ 'Create new link': 'Neuen Link erstellen',
+ 'Shares': 'Geteilte Inhalte',
'No shares created yet.': 'Noch keine Freigaben erstellt.',
'Advanced permissions': 'Erweiterte Berechtigungen',
'Allow resharing': 'Weiterteilen erlauben',
diff --git a/l10n/de.json b/l10n/de.json
index 437e986..c4b537d 100644
--- a/l10n/de.json
+++ b/l10n/de.json
@@ -1,19 +1,45 @@
{
"translations": {
"Sharing": "Teilen",
+ "Manage shares": "Freigaben verwalten",
"Add link": "Link erstellen",
+ "Add new link": "Neuen Link erstellen",
"Read only": "Nur lesen",
"Can edit": "Kann bearbeiten",
"File drop": "Sammelbox",
"User": "Benutzer",
"Permissions": "Berechtigungen",
+ "Shared with me": "Mit mir geteilt",
"Read, write and upload": "Kann bearbeiten",
"Read and write": "Kann bearbeiten",
"File drop (upload only)": "Sammelbox",
"With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.": "Bei der Sammelbox ist nur das Hochladen erlaubt. Nur Sie sehen Dateien und Ordner die hochgeladen worden sind.",
- "Advanced": "Erweiterte",
- "Set password": "Passwortschutz",
+ "Please note that file drop is not available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Bitte beachten sie, dass beim internen teilen, also dem Teilen an andere MagentaCLOUD Nutzer, die Sammelbox nicht verfügbar ist.",
+ "Please note that resharing is only available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Bitte beachten sie, dass das Weiterteilen, nur beim internen Teilen, also dem Teilen an andere MagentaCLOUD Nutzer, verfügbar ist.",
+ "Advanced settings": "Erweiterte Einstellungen",
+ "Set password": "Passwort setzen",
"Your shares": "Ihre Freigaben",
+ "Manage access": "Zugriff verwalten",
+ "Here you can see who has access to your file/folder.": "Hier sehen Sie wer Zugriff auf Ihre Datei/Ihren Ordner hat.",
+ "You haven't shared your file/folder yet. Share to give others access.": "Sie haben Ihre Datei/Ihren Ordner noch nicht geteilt. Teilen Sie um Anderen Zugriff zu geben.",
+ "Send": "Senden",
+ "Send link via E-Mail": "Link per E-Mail senden",
+ "Links sent via E-Mail": "Links per E-Mail versandt",
+ "Accept settings": "Übernehmen",
+ "or": "oder",
+ "Link to \"{fileName}\" was sent.": "Link zu \"{fileName}\" gesendet.",
+ "To": "An",
+ "Link to copy": "Link zum Kopieren",
+ "Copy": "Kopieren",
+ "Copied": "Kopiert",
+ "Anyone with the link can": "Jeder mit dem Link kann",
+ "only view": "nur anzeigen",
+ "edit": "bearbeiten",
+ "Anyone with the link can edit": "Jeder mit dem Link kann bearbeiten",
+ "Anyone with the link can only view": "Jeder mit dem Link kann nur anzeigen",
+ "Anyone with the link can file drop": "Jeder mit dem Link kann Dateien hinzufügen",
+ "Create new link": "Neuen Link erstellen",
+ "Shares": "Geteilte Inhalte",
"No shares created yet.": "Noch keine Freigaben erstellt.",
"Advanced permissions": "Erweiterte Berechtigungen",
"Allow resharing": "Weiterteilen erlauben",
@@ -21,7 +47,10 @@
"Resharing is allowed": "Weiterteilen ist erlaubt",
"You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration.": "Sie können Links erstellen oder Freigaben per Mail versenden. Wenn Sie MagentaCLOUD Nutzer einladen, bieten sich Ihnen mehr Möglichkeiten der Zusammenarbeit.",
"Share updated": "Freigabe aktualisiert",
- "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "Diese Freigabe ist auf {limit} Downloads beschränkt. Es sind noch {downloadsLeft} Downloads zugelassen."
+ "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "Diese Freigabe ist auf {limit} Downloads beschränkt. Es sind noch {downloadsLeft} Downloads zugelassen.",
+ "Deny download": "Download verhindern",
+ "Name, email": "Name, E-Mail-Adresse",
+ "Password must be at least 6 characters long": "Passwort muss mindestens 6 Zeichen lang sein"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/de_DE.json b/l10n/de_DE.json
index 437e986..cfc634b 100644
--- a/l10n/de_DE.json
+++ b/l10n/de_DE.json
@@ -1,19 +1,45 @@
{
"translations": {
"Sharing": "Teilen",
+ "Manage shares": "Zugriff verwalten",
"Add link": "Link erstellen",
+ "Add new link": "Neuen Link erstellen",
"Read only": "Nur lesen",
"Can edit": "Kann bearbeiten",
"File drop": "Sammelbox",
"User": "Benutzer",
"Permissions": "Berechtigungen",
+ "Shared with me": "Mit mir geteilt",
"Read, write and upload": "Kann bearbeiten",
"Read and write": "Kann bearbeiten",
"File drop (upload only)": "Sammelbox",
"With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.": "Bei der Sammelbox ist nur das Hochladen erlaubt. Nur Sie sehen Dateien und Ordner die hochgeladen worden sind.",
- "Advanced": "Erweiterte",
- "Set password": "Passwortschutz",
+ "Please note that file drop is not available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Bitte beachten sie, dass beim internen teilen, also dem Teilen an andere MagentaCLOUD Nutzer, die Sammelbox nicht verfügbar ist.",
+ "Please note that resharing is only available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Bitte beachten sie, dass das Weiterteilen, nur beim internen Teilen, also dem Teilen an andere MagentaCLOUD Nutzer, verfügbar ist.",
+ "Advanced settings": "Erweiterte Einstellungen",
+ "Set password": "Passwort setzen",
"Your shares": "Ihre Freigaben",
+ "Manage access": "Zugriff verwalten",
+ "Here you can see who has access to your file/folder.": "Hier sehen Sie wer Zugriff auf Ihre Datei/Ihren Ordner hat.",
+ "You haven't shared your file/folder yet. Share to give others access.": "Sie haben Ihre Datei/Ihren Ordner noch nicht geteilt. Teilen Sie um Anderen Zugriff zu geben.",
+ "Send": "Senden",
+ "Send link via E-Mail": "Link per E-Mail senden",
+ "Links sent via E-Mail": "Links per E-Mail versandt",
+ "Accept settings": "Übernehmen",
+ "or": "oder",
+ "Link to \"{fileName}\" was sent.": "Link zu \"{fileName}\" gesendet.",
+ "To": "An",
+ "Link to copy": "Link zum Kopieren",
+ "Copy": "Kopieren",
+ "Copied": "Kopiert",
+ "Anyone with the link can": "Jeder mit dem Link kann",
+ "only view": "nur anzeigen",
+ "edit": "bearbeiten",
+ "Anyone with the link can edit": "Jeder mit dem Link kann bearbeiten",
+ "Anyone with the link can only view": "Jeder mit dem Link kann nur anzeigen",
+ "Anyone with the link can file drop": "Jeder mit dem Link kann Dateien hinzufügen",
+ "Create new link": "Neuen Link erstellen",
+ "Shares": "Geteilte Inhalte",
"No shares created yet.": "Noch keine Freigaben erstellt.",
"Advanced permissions": "Erweiterte Berechtigungen",
"Allow resharing": "Weiterteilen erlauben",
@@ -21,7 +47,10 @@
"Resharing is allowed": "Weiterteilen ist erlaubt",
"You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration.": "Sie können Links erstellen oder Freigaben per Mail versenden. Wenn Sie MagentaCLOUD Nutzer einladen, bieten sich Ihnen mehr Möglichkeiten der Zusammenarbeit.",
"Share updated": "Freigabe aktualisiert",
- "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "Diese Freigabe ist auf {limit} Downloads beschränkt. Es sind noch {downloadsLeft} Downloads zugelassen."
+ "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "Diese Freigabe ist auf {limit} Downloads beschränkt. Es sind noch {downloadsLeft} Downloads zugelassen.",
+ "Deny download": "Download verhindern",
+ "Name, email": "Name, E-Mail-Adresse",
+ "Password must be at least 6 characters long": "Passwort muss mindestens 6 Zeichen lang sein"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/en.json b/l10n/en.json
index d914374..5a5db09 100644
--- a/l10n/en.json
+++ b/l10n/en.json
@@ -1,19 +1,45 @@
{
"translations": {
"Sharing": "Sharing",
+ "Manage shares": "Manage shares",
"Add link": "Add link",
+ "Add new link": "Add new link",
"Read only": "Read only",
"Can edit": "Can edit",
"File drop": "File drop",
"User": "User",
"Permissions": "Permissions",
+ "Shared with me": "Shared with me",
"Read, write and upload": "Read, write and upload",
"Read and write": "Read and write",
"File drop (upload only)": "File drop (upload only)",
"With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.": "With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.",
- "Advanced": "Advanced",
+ "Please note that file drop is not available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Please note that file drop is not available for internal sharing, i.e. sharing with other MagentaCLOUD users.",
+ "Please note that resharing is only available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Please note that resharing is only available for internal sharing, i.e. sharing with other MagentaCLOUD users.",
+ "Advanced settings": "Advanced settings",
"Set password": "Set password",
"Your shares": "Your shares",
+ "Manage access": "Manage Access",
+ "Here you can see who has access to your file/folder.": "Here you can see who has access to your file/folder.",
+ "You haven't shared your file/folder yet. Share to give others access.": "You haven't shared your file/folder yet. Share to give others access.",
+ "Send": "Send",
+ "Send link via E-Mail": "Send link via E-Mail",
+ "Links sent via E-Mail": "Links sent via E-Mail",
+ "Accept settings": "Accept settings",
+ "or": "or",
+ "Link to \"{fileName}\" was sent.": "Link to \"{fileName}\" was sent.",
+ "To": "To",
+ "Link to copy": "Link to Copy",
+ "Copy": "Copy",
+ "Copied": "Copied",
+ "Anyone with the link can": "Anyone with the link can",
+ "only view": "only view",
+ "edit": "edit",
+ "Anyone with the link can edit": "Anyone with the link can edit",
+ "Anyone with the link can only view": "Anyone with the link can only view",
+ "Anyone with the link can file drop": "Anyone with the link can file drop",
+ "Create new link": "Create new link",
+ "Shares": "Shares",
"No shares created yet.": "No shares created yet.",
"Advanced permissions": "Advanced permissions",
"Allow resharing": "Allow resharing",
@@ -21,7 +47,10 @@
"Resharing is allowed": "Resharing is allowed",
"You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration.": "You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration.",
"Share updated": "Share updated",
- "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed."
+ "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.",
+ "Deny download": "Deny download",
+ "Name, email": "Name, email",
+ "Password must be at least 6 characters long": "Password must be at least 6 characters long"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/en_GB.js b/l10n/en_GB.js
index 21eaf07..aa18cba 100644
--- a/l10n/en_GB.js
+++ b/l10n/en_GB.js
@@ -1,20 +1,33 @@
OC.L10N.register(
'nmcsharing',
{
- Sharing: 'Sharing',
+ 'Sharing': 'Sharing',
'Add link': 'Add link',
+ 'Add new link': 'Add new link',
'Read only': 'Read only',
'Can edit': 'Can edit',
'File drop': 'File drop',
- User: 'User',
- Permissions: 'Permissions',
+ 'User': 'User',
+ 'Permissions': 'Permissions',
'Read, write and upload': 'Read, write and upload',
'Read and write': 'Read and write',
'File drop (upload only)': 'File drop (upload only)',
'With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.': 'With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.',
- Advanced: 'Advanced',
+ 'Advanced': 'Advanced',
'Set password': 'Set password',
'Your shares': 'Your shares',
+ 'Manage access': 'Manage Access',
+ 'Send': 'Send',
+ 'Send link via E-Mail': 'Send link via E-Mail',
+ 'Links sent via E-Mail': 'Links sent via E-Mail',
+ 'Accept settings': 'Accept settings',
+ 'Or': 'Or',
+ 'Links to Copy': 'Links to Copy',
+ 'Anyone with the link can edit': 'Anyone with the link can edit',
+ 'Anyone with the link can only view': 'Anyone with the link can only view',
+ 'Anyone with the link can file drop': 'Anyone with the link can file drop',
+ 'Create new link': 'Create new link',
+ 'Shares': 'Shares',
'No shares created yet.': 'No shares created yet.',
'Advanced permissions': 'Advanced permissions',
'Allow resharing': 'Allow resharing',
diff --git a/l10n/en_GB.json b/l10n/en_GB.json
index d914374..5a5db09 100644
--- a/l10n/en_GB.json
+++ b/l10n/en_GB.json
@@ -1,19 +1,45 @@
{
"translations": {
"Sharing": "Sharing",
+ "Manage shares": "Manage shares",
"Add link": "Add link",
+ "Add new link": "Add new link",
"Read only": "Read only",
"Can edit": "Can edit",
"File drop": "File drop",
"User": "User",
"Permissions": "Permissions",
+ "Shared with me": "Shared with me",
"Read, write and upload": "Read, write and upload",
"Read and write": "Read and write",
"File drop (upload only)": "File drop (upload only)",
"With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.": "With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded.",
- "Advanced": "Advanced",
+ "Please note that file drop is not available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Please note that file drop is not available for internal sharing, i.e. sharing with other MagentaCLOUD users.",
+ "Please note that resharing is only available for internal sharing, i.e. sharing with other MagentaCLOUD users.": "Please note that resharing is only available for internal sharing, i.e. sharing with other MagentaCLOUD users.",
+ "Advanced settings": "Advanced settings",
"Set password": "Set password",
"Your shares": "Your shares",
+ "Manage access": "Manage Access",
+ "Here you can see who has access to your file/folder.": "Here you can see who has access to your file/folder.",
+ "You haven't shared your file/folder yet. Share to give others access.": "You haven't shared your file/folder yet. Share to give others access.",
+ "Send": "Send",
+ "Send link via E-Mail": "Send link via E-Mail",
+ "Links sent via E-Mail": "Links sent via E-Mail",
+ "Accept settings": "Accept settings",
+ "or": "or",
+ "Link to \"{fileName}\" was sent.": "Link to \"{fileName}\" was sent.",
+ "To": "To",
+ "Link to copy": "Link to Copy",
+ "Copy": "Copy",
+ "Copied": "Copied",
+ "Anyone with the link can": "Anyone with the link can",
+ "only view": "only view",
+ "edit": "edit",
+ "Anyone with the link can edit": "Anyone with the link can edit",
+ "Anyone with the link can only view": "Anyone with the link can only view",
+ "Anyone with the link can file drop": "Anyone with the link can file drop",
+ "Create new link": "Create new link",
+ "Shares": "Shares",
"No shares created yet.": "No shares created yet.",
"Advanced permissions": "Advanced permissions",
"Allow resharing": "Allow resharing",
@@ -21,7 +47,10 @@
"Resharing is allowed": "Resharing is allowed",
"You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration.": "You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration.",
"Share updated": "Share updated",
- "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed."
+ "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.",
+ "Deny download": "Deny download",
+ "Name, email": "Name, email",
+ "Password must be at least 6 characters long": "Password must be at least 6 characters long"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/lib/Listener/BeforeTemplateRenderedListener.php b/lib/Listener/BeforeTemplateRenderedListener.php
index 9c20560..30a8ea2 100644
--- a/lib/Listener/BeforeTemplateRenderedListener.php
+++ b/lib/Listener/BeforeTemplateRenderedListener.php
@@ -41,7 +41,8 @@ public function handle(Event $event): void {
// you can add additional styles, links and scripts before rendering
// keep src for future use: \OCP\Util::addScript("nmctheme", "../dist/l10nappender");
- \OCP\Util::addScript("nmcsharing", "nmcsharing-sharing");
+ \OCP\Util::addScript("nmcsharing", "nmcsharing-tab");
+ \OCP\Util::addScript("nmcsharing", "nmcsharing-popup");
\OCP\Util::addScript("nmcsharing", "nmcsharing-action");
}
}
diff --git a/src/action.ts b/src/action.ts
index c7d2d1f..2143f77 100644
--- a/src/action.ts
+++ b/src/action.ts
@@ -1,4 +1,8 @@
import { registerFileAction } from '@nextcloud/files'
-import { action } from './actions/sharingStatusAction'
+import { action as statusAtion } from './actions/sharingStatusAction'
+import { action as popupAction } from './actions/sharingPopupAction'
+import { action as popupMenuAction } from './actions/sharingPopupMenuAction'
-registerFileAction(action)
+registerFileAction(statusAtion)
+registerFileAction(popupAction)
+registerFileAction(popupMenuAction)
diff --git a/src/actions/popupAction.js b/src/actions/popupAction.js
new file mode 100644
index 0000000..b8afba6
--- /dev/null
+++ b/src/actions/popupAction.js
@@ -0,0 +1,45 @@
+import { Permission, FileAction } from '@nextcloud/files'
+import { translate as t } from '@nextcloud/l10n'
+
+export const ACTION_DETAILS = 'details'
+
+export const action = new FileAction({
+ id: ACTION_DETAILS,
+ displayName: () => t('files', 'Open details'),
+ iconSvgInline: () => '',
+
+ // Sidebar currently supports user folder only, /files/USER
+ enabled: (nodes) => {
+ // Only works on single node
+ if (nodes.length !== 1) {
+ return false
+ }
+
+ if (!nodes[0]) {
+ return false
+ }
+
+ return (nodes[0].root?.startsWith('/files/') && nodes[0].permissions !== Permission.NONE) ?? false
+ },
+
+ async exec(node, view, dir) {
+ try {
+ // TODO: migrate Sidebar to use a Node instead
+ await window.OCA.Files.Sidebar.open(node.path)
+
+ // Silently update current fileid
+ window.OCP.Files.Router.goToRoute(
+ null,
+ { view: view.id, fileid: node.fileid },
+ { dir },
+ true,
+ )
+
+ return null
+ } catch (error) {
+ return false
+ }
+ },
+
+ order: -50,
+})
diff --git a/src/actions/sharingPopupAction.js b/src/actions/sharingPopupAction.js
new file mode 100644
index 0000000..1ff0f8f
--- /dev/null
+++ b/src/actions/sharingPopupAction.js
@@ -0,0 +1,98 @@
+import { FileAction, Permission } from '@nextcloud/files'
+import { translate as t } from '@nextcloud/l10n'
+
+export const action = new FileAction({
+ id: 'sharing-popup',
+ displayName(nodes) {
+ const node = nodes[0]
+ const sharedWithMe = node?.attributes?.['mount-type'] === 'shared'
+
+ if (sharedWithMe) {
+ return t('nmcsharing', 'Shared with me')
+ }
+
+ const shareTypes = Object.values(node?.attributes?.['share-types'] || {}).flat()
+
+ if (shareTypes.length > 0) {
+ return t('files_sharing', 'Shared')
+ }
+
+ return ''
+ },
+
+ title(nodes) {
+ /*
+ const node = nodes[0]
+
+ if (Array.isArray(node.attributes?.['share-types'])) {
+ return t('files_sharing', 'Shared multiple times with different people')
+ }
+ */
+ return t('files_sharing', 'Show sharing options')
+ },
+
+ iconSvgInline() {
+ return ''
+ },
+
+ enabled(nodes) {
+ if (nodes.length !== 1) {
+ return false
+ }
+
+ if (window.OCP.Files.Router.params.view === 'trashbin') {
+ return false
+ }
+
+ const node = nodes[0]
+
+ if (node.attributes?.['is-encrypted'] === 1) {
+ return false
+ }
+
+ const shareTypes = node.attributes?.['share-types']
+ const isMixed = Array.isArray(shareTypes) && shareTypes.length > 0
+
+ // If the node is shared multiple times with
+ // different share types to the current user
+ if (isMixed) {
+ return true
+ }
+
+ // enable popup button in any case
+ return true
+ // return (node.permissions & Permission.SHARE) !== 0
+ },
+
+ async exec(node, view, dir) {
+ // You need read permissions to see the sidebar
+ if ((node.permissions & Permission.READ) !== 0) {
+
+ window.OCA.Files.Sidebar.close()
+
+ window.OCA.Files.Sidebar.setActiveTab('sharing-manage')
+ window.OCA.Files.Sidebar.setActiveTab('sharing')
+ window.OCA.Files.Sidebar.setFullScreenMode(true)
+
+ // TODO: migrate Sidebar to use a Node instead
+ window.OCA.Files.Sidebar.open(node.path)
+
+ try {
+ // Silently update current fileid
+ window.OCP.Files.Router.goToRoute(
+ null,
+ { view: view.id, fileid: node.fileid },
+ { ...window.OCP.Files.Router.query, dir, popup: 'true' },
+ true,
+ )
+
+ return null
+ } catch (error) {
+ return false
+ }
+ }
+ },
+
+ inline: () => true,
+
+})
diff --git a/src/actions/sharingPopupMenuAction.js b/src/actions/sharingPopupMenuAction.js
new file mode 100644
index 0000000..58841c4
--- /dev/null
+++ b/src/actions/sharingPopupMenuAction.js
@@ -0,0 +1,83 @@
+import { FileAction, Permission } from '@nextcloud/files'
+import { translate as t } from '@nextcloud/l10n'
+
+export const action = new FileAction({
+ id: 'sharing-popup-menu',
+ displayName(nodes) {
+ return t('files_sharing', 'Share')
+ },
+
+ title(nodes) {
+ /*
+ const node = nodes[0]
+
+ if (Array.isArray(node.attributes?.['share-types'])) {
+ return t('files_sharing', 'Shared multiple times with different people')
+ }
+ */
+ return t('files_sharing', 'Show sharing options')
+ },
+
+ iconSvgInline() {
+ return ''
+ },
+
+ enabled(nodes) {
+ if (nodes.length !== 1) {
+ return false
+ }
+
+ if (window.OCP.Files.Router.params.view === 'trashbin') {
+ return false
+ }
+
+ const node = nodes[0]
+
+ if (node.attributes?.['is-encrypted'] === 1) {
+ return false
+ }
+
+ const shareTypes = node.attributes?.['share-types']
+ const isMixed = Array.isArray(shareTypes) && shareTypes.length > 0
+
+ // If the node is shared multiple times with
+ // different share types to the current user
+ if (isMixed) {
+ return true
+ }
+
+ return (node.permissions & Permission.SHARE) !== 0
+ },
+
+ async exec(node, view, dir) {
+ // You need read permissions to see the sidebar
+ if ((node.permissions & Permission.READ) !== 0) {
+
+ window.OCA.Files.Sidebar.close()
+
+ window.OCA.Files.Sidebar.setActiveTab('sharing-manage')
+ window.OCA.Files.Sidebar.setActiveTab('sharing')
+ window.OCA.Files.Sidebar.setFullScreenMode(true)
+
+ // TODO: migrate Sidebar to use a Node instead
+ window.OCA.Files.Sidebar.open(node.path)
+
+ try {
+ // Silently update current fileid
+ window.OCP.Files.Router.goToRoute(
+ null,
+ { view: view.id, fileid: node.fileid },
+ { ...window.OCP.Files.Router.query, dir, popup: 'true' },
+ true,
+ )
+
+ return null
+ } catch (error) {
+ return false
+ }
+ }
+ },
+
+ order: -61,
+
+})
diff --git a/src/actions/sharingStatusAction.js b/src/actions/sharingStatusAction.js
index aaf14a5..7fac5cd 100644
--- a/src/actions/sharingStatusAction.js
+++ b/src/actions/sharingStatusAction.js
@@ -1,29 +1,14 @@
import { FileAction, Permission } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
-import { action as sidebarAction } from './sidebarAction.js'
-
export const action = new FileAction({
- id: 'sharing-status-magentacloud',
- displayName(nodes) {
- const node = nodes[0]
- const shareTypes = Object.values(node?.attributes?.['share-types'] || {}).flat()
-
- if (shareTypes.length > 0) {
- return t('files_sharing', 'Shared')
- }
-
- return ''
+ id: 'sharing-manage',
+ displayName() {
+ return t('nmcsharing', 'Manage shares')
},
- title(nodes) {
- const node = nodes[0]
-
- if (Array.isArray(node.attributes?.['share-types'])) {
- return t('files_sharing', 'Shared multiple times with different people')
- }
-
- return t('files_sharing', 'Show sharing options')
+ title() {
+ return t('nmcsharing', 'Manage shares')
},
iconSvgInline() {
@@ -35,24 +20,57 @@ export const action = new FileAction({
return false
}
+ if (window.OCP.Files.Router.params.view === 'trashbin') {
+ return false
+ }
+
const node = nodes[0]
- const isMixed = Array.isArray(node.attributes?.['share-types'])
+ if (node.attributes?.['is-encrypted'] === 1) {
+ return false
+ }
+
+ const shareTypes = node.attributes?.['share-types']
+ const isMixed = Array.isArray(shareTypes) && shareTypes.length > 0
+
+ // If the node is shared multiple times with
+ // different share types to the current user
if (isMixed) {
return true
}
- return (node.permissions & Permission.SHARE) !== 0
+ // enable sharing button in any case
+ return true
+ // return (node.permissions & Permission.SHARE) !== 0
},
async exec(node, view, dir) {
+ // You need read permissions to see the sidebar
if ((node.permissions & Permission.READ) !== 0) {
- window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing')
- return sidebarAction.exec(node, view, dir)
+
+ window.OCA.Files.Sidebar.close()
+
+ window.OCA.Files.Sidebar.setActiveTab('sharing')
+ window.OCA.Files.Sidebar.setActiveTab('sharing-manage')
+
+ try {
+ // Silently update current fileid
+ window.OCP.Files.Router.goToRoute(
+ null,
+ { view: view.id, fileid: node.fileid },
+ { dir },
+ true,
+ )
+
+ // TODO: migrate Sidebar to use a Node instead
+ await window.OCA.Files.Sidebar.open(node.path)
+
+ return null
+ } catch (error) {
+ return false
+ }
}
- return null
},
- inline: () => true,
-
+ order: -60,
})
diff --git a/src/components/AddLinkButton.vue b/src/components/AddLinkButton.vue
index 2e23562..fd2aecb 100644
--- a/src/components/AddLinkButton.vue
+++ b/src/components/AddLinkButton.vue
@@ -1,7 +1,7 @@
+ {{ isSharedWithMe ? `${t('nmcsharing', 'Resharing is allowed')}. ` : '' }}
+
+ {{ t('nmcsharing', "You haven't shared your file/folder yet. Share to give others access.") }}
+
+
+ {{ t('nmcsharing', 'Here you can see who has access to your file/folder.') }}
+
+
+
+ {{ t('files_sharing', 'Resharing is not allowed') }}
+