diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-07-07 11:29:46 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-07-07 11:29:46 +0200 |
commit | ba16fd0d337fa26114f55086198979d147a298c1 (patch) | |
tree | 39111cec77d17d5eeb60bd1b609e7a8419310459 /apps/files_sharing | |
parent | 5ace43f43895cba4b398367e10731f92450d7da2 (diff) | |
parent | ed28885d73181e61c06802639910014e8a265e42 (diff) | |
download | nextcloud-server-ba16fd0d337fa26114f55086198979d147a298c1.tar.gz nextcloud-server-ba16fd0d337fa26114f55086198979d147a298c1.zip |
Merge branch 'master' into sync-master
Diffstat (limited to 'apps/files_sharing')
30 files changed, 435 insertions, 70 deletions
diff --git a/apps/files_sharing/ajax/publicpreview.php b/apps/files_sharing/ajax/publicpreview.php index 5999740af31..c02d475a769 100644 --- a/apps/files_sharing/ajax/publicpreview.php +++ b/apps/files_sharing/ajax/publicpreview.php @@ -42,6 +42,13 @@ if($token === ''){ } $linkedItem = \OCP\Share::getShareByToken($token); +$shareManager = \OC::$server->getShareManager(); +$share = $shareManager->getShareByToken($token); +if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + OCP\JSON::error(array('data' => 'Share is not readable.')); + exit(); +} + if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) { \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND); \OCP\Util::writeLog('core-preview', 'Passed token parameter is not valid', \OCP\Util::DEBUG); diff --git a/apps/files_sharing/ajax/shareinfo.php b/apps/files_sharing/ajax/shareinfo.php index acf58a2431a..002d7ab275e 100644 --- a/apps/files_sharing/ajax/shareinfo.php +++ b/apps/files_sharing/ajax/shareinfo.php @@ -71,6 +71,11 @@ $shareManager = \OC::$server->getShareManager(); $share = $shareManager->getShareByToken($token); $sharePermissions= (int)$share->getPermissions(); +if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + OCP\JSON::error(array('data' => 'Share is not readable.')); + exit(); +} + /** * @param \OCP\Files\FileInfo $dir * @param \OC\Files\View $view diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css index d09947dab26..c998501dad6 100644 --- a/apps/files_sharing/css/public.css +++ b/apps/files_sharing/css/public.css @@ -158,3 +158,62 @@ thead { opacity: 1; cursor: pointer; } + +#public-upload .avatardiv { + margin: 0 auto; +} + +#public-upload #emptycontent h2 { + margin: 10px 0 5px 0; +} + +#public-upload #emptycontent h2+p { + margin-bottom: 30px; +} + +#public-upload #emptycontent .icon-folder { + height: 16px; + width: 16px; + background-size: 16px; + display: inline-block; + vertical-align: text-top; + margin-bottom: 0; + margin-right: 5px; + opacity: 1; +} + +#public-upload #emptycontent .button { + background-size: 16px; + height: 16px; + width: 16px; + background-position: 16px; + opacity: .7; + font-size: 20px; + margin: 20px; + padding: 10px 20px; + padding-left: 42px; + font-weight: normal; +} + +#public-upload #emptycontent ul { + width: 160px; + margin: 5px auto; + text-align: left; +} + +#public-upload #emptycontent li { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding: 7px 0; +} + +#public-upload #emptycontent li img { + vertical-align: text-bottom; + margin-right: 5px; +} + +#public-upload li span.icon-loading-small { + padding-left: 18px; + margin-right: 7px; +} diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js new file mode 100644 index 00000000000..984eb06b9e3 --- /dev/null +++ b/apps/files_sharing/js/files_drop.js @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +(function ($) { + var TEMPLATE = + '<li data-toggle="tooltip" title="{{name}}" data-name="{{name}}">' + + '{{#if isUploading}}' + + '<span class="icon-loading-small"></span> {{name}}' + + '{{else}}' + + '<img src="' + OC.imagePath('core', 'actions/error.svg') + '"/> {{name}}' + + '{{/if}}' + + '</li>'; + var Drop = { + /** @type {Function} **/ + _template: undefined, + + initialize: function () { + $(document).bind('drop dragover', function (e) { + // Prevent the default browser drop action: + e.preventDefault(); + }); + var output = this.template(); + $('#public-upload').fileupload({ + url: OC.linkTo('files', 'ajax/upload.php'), + dataType: 'json', + dropZone: $('#public-upload'), + formData: { + dirToken: $('#sharingToken').val() + }, + add: function(e, data) { + var errors = []; + if(data.files[0]['size'] && data.files[0]['size'] > $('#maxFilesizeUpload').val()) { + errors.push('File is too big'); + } + + $('#drop-upload-done-indicator').addClass('hidden'); + $('#drop-upload-progress-indicator').removeClass('hidden'); + _.each(data['files'], function(file) { + if(errors.length === 0) { + $('#public-upload ul').append(output({isUploading: true, name: escapeHTML(file.name)})); + $('[data-toggle="tooltip"]').tooltip(); + data.submit(); + } else { + OC.Notification.showTemporary(OC.L10N.translate('files_sharing', 'Could not upload "{filename}"', {filename: file.name})); + $('#public-upload ul').append(output({isUploading: false, name: escapeHTML(file.name)})); + $('[data-toggle="tooltip"]').tooltip(); + } + }); + }, + success: function (response) { + if(response.status !== 'error') { + var mimeTypeUrl = OC.MimeType.getIconUrl(response['mimetype']); + $('#public-upload ul li[data-name="' + escapeHTML(response['filename']) + '"]').html('<img src="' + escapeHTML(mimeTypeUrl) + '"/> ' + escapeHTML(response['filename'])); + $('[data-toggle="tooltip"]').tooltip(); + } else { + var name = response[0]['data']['filename']; + OC.Notification.showTemporary(OC.L10N.translate('files_sharing', 'Could not upload "{filename}"', {filename: name})); + $('#public-upload ul li[data-name="' + escapeHTML(name) + '"]').html(output({isUploading: false, name: escapeHTML(name)})); + $('[data-toggle="tooltip"]').tooltip(); + } + + }, + progressall: function (e, data) { + var progress = parseInt(data.loaded / data.total * 100, 10); + if(progress === 100) { + $('#drop-upload-done-indicator').removeClass('hidden'); + $('#drop-upload-progress-indicator').addClass('hidden'); + } else { + $('#drop-upload-done-indicator').addClass('hidden'); + $('#drop-upload-progress-indicator').removeClass('hidden'); + } + } + }); + $('#public-upload .button.icon-upload').click(function(e) { + e.preventDefault(); + $('#public-upload #emptycontent input').focus().trigger('click'); + }); + }, + + /** + * @returns {Function} from Handlebars + * @private + */ + template: function () { + if (!this._template) { + this._template = Handlebars.compile(TEMPLATE); + } + return this._template; + } + }; + + $(document).ready(function() { + if($('#upload-only-interface').val() === "1") { + $('.avatardiv').avatar($('#sharingUserId').val(), 128, true); + } + + OCA.Files_Sharing_Drop = Drop; + OCA.Files_Sharing_Drop.initialize(); + }); + + +})(jQuery); + diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 572ccc47b71..f207eff7909 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -302,7 +302,7 @@ OCA.Sharing.PublicApp = { $('#save-button-confirm') .removeClass("icon-loading-small") .addClass("icon-confirm"); - + } else { $('#save-button-confirm') @@ -314,7 +314,7 @@ OCA.Sharing.PublicApp = { toggleLoading(); var location = window.location.protocol + '//' + window.location.host + OC.webroot; - + if(remote.substr(-1) !== '/') { remote += '/' }; diff --git a/apps/files_sharing/l10n/cs_CZ.js b/apps/files_sharing/l10n/cs_CZ.js index fbf9d981d6b..93534911d17 100644 --- a/apps/files_sharing/l10n/cs_CZ.js +++ b/apps/files_sharing/l10n/cs_CZ.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Přidat do svého ownCloudu", "Download" : "Stáhnout", "Download %s" : "Stáhnout %s", - "Direct link" : "Přímý odkaz" + "Direct link" : "Přímý odkaz", + "Upload files to %s" : "Nahrát soubory do %s", + "Select or drop files" : "Vyberte nebo přetáhněte soubory", + "Uploading files…" : "Probíhá nahrávání souborů...", + "Uploaded files:" : "Nahrané soubory:" }, "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"); diff --git a/apps/files_sharing/l10n/cs_CZ.json b/apps/files_sharing/l10n/cs_CZ.json index fc62ee6253b..fb39cf9a7e5 100644 --- a/apps/files_sharing/l10n/cs_CZ.json +++ b/apps/files_sharing/l10n/cs_CZ.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Přidat do svého ownCloudu", "Download" : "Stáhnout", "Download %s" : "Stáhnout %s", - "Direct link" : "Přímý odkaz" + "Direct link" : "Přímý odkaz", + "Upload files to %s" : "Nahrát soubory do %s", + "Select or drop files" : "Vyberte nebo přetáhněte soubory", + "Uploading files…" : "Probíhá nahrávání souborů...", + "Uploaded files:" : "Nahrané soubory:" },"pluralForm" :"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/de.js b/apps/files_sharing/l10n/de.js index 602721d13c1..ffb996b4204 100644 --- a/apps/files_sharing/l10n/de.js +++ b/apps/files_sharing/l10n/de.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Zu Deiner ownCloud hinzufügen", "Download" : "Herunterladen", "Download %s" : "Download %s", - "Direct link" : "Direkter Link" + "Direct link" : "Direkter Link", + "Upload files to %s" : "Dateien auf %s hochladen", + "Select or drop files" : "Dateien auswählen oder hierher ziehen", + "Uploading files…" : "Dateien werden hochgeladen...", + "Uploaded files:" : "Hochgeladene Dateien: " }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/files_sharing/l10n/de.json b/apps/files_sharing/l10n/de.json index 2d8b8e426e5..d10ee06236f 100644 --- a/apps/files_sharing/l10n/de.json +++ b/apps/files_sharing/l10n/de.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Zu Deiner ownCloud hinzufügen", "Download" : "Herunterladen", "Download %s" : "Download %s", - "Direct link" : "Direkter Link" + "Direct link" : "Direkter Link", + "Upload files to %s" : "Dateien auf %s hochladen", + "Select or drop files" : "Dateien auswählen oder hierher ziehen", + "Uploading files…" : "Dateien werden hochgeladen...", + "Uploaded files:" : "Hochgeladene Dateien: " },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/de_DE.js b/apps/files_sharing/l10n/de_DE.js index 56e1ec25c1d..b99e2790adb 100644 --- a/apps/files_sharing/l10n/de_DE.js +++ b/apps/files_sharing/l10n/de_DE.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Zu Ihrer ownCloud hinzufügen", "Download" : "Herunterladen", "Download %s" : "Download %s", - "Direct link" : "Direkte Verlinkung" + "Direct link" : "Direkte Verlinkung", + "Upload files to %s" : "Dateien auf %s hochladen", + "Select or drop files" : "Dateien auswählen oder hierher ziehen", + "Uploading files…" : "Dateien werden hochgeladen...", + "Uploaded files:" : "Hochgeladene Dateien: " }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/files_sharing/l10n/de_DE.json b/apps/files_sharing/l10n/de_DE.json index 205e0eeaadb..d0966273524 100644 --- a/apps/files_sharing/l10n/de_DE.json +++ b/apps/files_sharing/l10n/de_DE.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Zu Ihrer ownCloud hinzufügen", "Download" : "Herunterladen", "Download %s" : "Download %s", - "Direct link" : "Direkte Verlinkung" + "Direct link" : "Direkte Verlinkung", + "Upload files to %s" : "Dateien auf %s hochladen", + "Select or drop files" : "Dateien auswählen oder hierher ziehen", + "Uploading files…" : "Dateien werden hochgeladen...", + "Uploaded files:" : "Hochgeladene Dateien: " },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/en_GB.js b/apps/files_sharing/l10n/en_GB.js index 78d3630c674..6068561339e 100644 --- a/apps/files_sharing/l10n/en_GB.js +++ b/apps/files_sharing/l10n/en_GB.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Add to your ownCloud", "Download" : "Download", "Download %s" : "Download %s", - "Direct link" : "Direct link" + "Direct link" : "Direct link", + "Upload files to %s" : "Upload files to %s", + "Select or drop files" : "Select or drop files", + "Uploading files…" : "Uploading files…", + "Uploaded files:" : "Uploaded files:" }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/files_sharing/l10n/en_GB.json b/apps/files_sharing/l10n/en_GB.json index eda362a6541..c44c7129952 100644 --- a/apps/files_sharing/l10n/en_GB.json +++ b/apps/files_sharing/l10n/en_GB.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Add to your ownCloud", "Download" : "Download", "Download %s" : "Download %s", - "Direct link" : "Direct link" + "Direct link" : "Direct link", + "Upload files to %s" : "Upload files to %s", + "Select or drop files" : "Select or drop files", + "Uploading files…" : "Uploading files…", + "Uploaded files:" : "Uploaded files:" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/es.js b/apps/files_sharing/l10n/es.js index 4ae7c4e177e..8bb1afa8597 100644 --- a/apps/files_sharing/l10n/es.js +++ b/apps/files_sharing/l10n/es.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Agregue su propio ownCloud", "Download" : "Descargar", "Download %s" : "Descargar %s", - "Direct link" : "Enlace directo" + "Direct link" : "Enlace directo", + "Upload files to %s" : "Subir archivos a %s", + "Select or drop files" : "Seleccione o arrastre y suelte archivos", + "Uploading files…" : "Subiendo archivos...", + "Uploaded files:" : "Archivos subidos:" }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/files_sharing/l10n/es.json b/apps/files_sharing/l10n/es.json index 026d7f72e9d..4a6f0133c92 100644 --- a/apps/files_sharing/l10n/es.json +++ b/apps/files_sharing/l10n/es.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Agregue su propio ownCloud", "Download" : "Descargar", "Download %s" : "Descargar %s", - "Direct link" : "Enlace directo" + "Direct link" : "Enlace directo", + "Upload files to %s" : "Subir archivos a %s", + "Select or drop files" : "Seleccione o arrastre y suelte archivos", + "Uploading files…" : "Subiendo archivos...", + "Uploaded files:" : "Archivos subidos:" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/fr.js b/apps/files_sharing/l10n/fr.js index 5fddc9855af..52259e88e5b 100644 --- a/apps/files_sharing/l10n/fr.js +++ b/apps/files_sharing/l10n/fr.js @@ -5,7 +5,7 @@ OC.L10N.register( "The mountpoint name contains invalid characters." : "Le nom du point de montage contient des caractères non valides.", "Not allowed to create a federated share with the same user server" : "Non autorisé à créer un partage fédéré avec un utilisateur du même serveur", "Invalid or untrusted SSL certificate" : "Certificat SSL non valable ou non fiable", - "Could not authenticate to remote share, password might be wrong" : "Impossible de s'authentifier au partage distant : le mot de passe en probablement incorrect", + "Could not authenticate to remote share, password might be wrong" : "Impossible de s'authentifier au partage distant : le mot de passe est probablement incorrect", "Storage not valid" : "Support de stockage non valide", "Couldn't add remote share" : "Impossible d'ajouter le partage distant", "Shared with you" : "Partagés avec vous", @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Ajouter à votre ownCloud", "Download" : "Télécharger", "Download %s" : "Télécharger %s", - "Direct link" : "Lien direct" + "Direct link" : "Lien direct", + "Upload files to %s" : "Téléversement des fichiers vers %s", + "Select or drop files" : "Sélectionner ou glisser-déposer vos fichiers", + "Uploading files…" : "Téléversement des fichiers...", + "Uploaded files:" : "Fichiers téléversés :" }, "nplurals=2; plural=(n > 1);"); diff --git a/apps/files_sharing/l10n/fr.json b/apps/files_sharing/l10n/fr.json index 254da51c315..66ea6fab370 100644 --- a/apps/files_sharing/l10n/fr.json +++ b/apps/files_sharing/l10n/fr.json @@ -3,7 +3,7 @@ "The mountpoint name contains invalid characters." : "Le nom du point de montage contient des caractères non valides.", "Not allowed to create a federated share with the same user server" : "Non autorisé à créer un partage fédéré avec un utilisateur du même serveur", "Invalid or untrusted SSL certificate" : "Certificat SSL non valable ou non fiable", - "Could not authenticate to remote share, password might be wrong" : "Impossible de s'authentifier au partage distant : le mot de passe en probablement incorrect", + "Could not authenticate to remote share, password might be wrong" : "Impossible de s'authentifier au partage distant : le mot de passe est probablement incorrect", "Storage not valid" : "Support de stockage non valide", "Couldn't add remote share" : "Impossible d'ajouter le partage distant", "Shared with you" : "Partagés avec vous", @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Ajouter à votre ownCloud", "Download" : "Télécharger", "Download %s" : "Télécharger %s", - "Direct link" : "Lien direct" + "Direct link" : "Lien direct", + "Upload files to %s" : "Téléversement des fichiers vers %s", + "Select or drop files" : "Sélectionner ou glisser-déposer vos fichiers", + "Uploading files…" : "Téléversement des fichiers...", + "Uploaded files:" : "Fichiers téléversés :" },"pluralForm" :"nplurals=2; plural=(n > 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/it.js b/apps/files_sharing/l10n/it.js index 85231123e53..af19da26a07 100644 --- a/apps/files_sharing/l10n/it.js +++ b/apps/files_sharing/l10n/it.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Aggiungi al tuo ownCloud", "Download" : "Scarica", "Download %s" : "Scarica %s", - "Direct link" : "Collegamento diretto" + "Direct link" : "Collegamento diretto", + "Upload files to %s" : "Carica file su %s", + "Select or drop files" : "Seleziona o deseleziona file", + "Uploading files…" : "Caricamento file in corso...", + "Uploaded files:" : "File caricati:" }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/files_sharing/l10n/it.json b/apps/files_sharing/l10n/it.json index 461b8602a1e..1e179170ea8 100644 --- a/apps/files_sharing/l10n/it.json +++ b/apps/files_sharing/l10n/it.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Aggiungi al tuo ownCloud", "Download" : "Scarica", "Download %s" : "Scarica %s", - "Direct link" : "Collegamento diretto" + "Direct link" : "Collegamento diretto", + "Upload files to %s" : "Carica file su %s", + "Select or drop files" : "Seleziona o deseleziona file", + "Uploading files…" : "Caricamento file in corso...", + "Uploaded files:" : "File caricati:" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/ja.js b/apps/files_sharing/l10n/ja.js index bd40344053a..7640f8f5104 100644 --- a/apps/files_sharing/l10n/ja.js +++ b/apps/files_sharing/l10n/ja.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "ownCloud に追加", "Download" : "ダウンロード", "Download %s" : "%s をダウンロード", - "Direct link" : "リンク" + "Direct link" : "リンク", + "Upload files to %s" : "%s にファイルをアップロード", + "Select or drop files" : "ファイルを選択するか、ドラッグ&ドロップしてください", + "Uploading files…" : "ファイルをアップロード中...", + "Uploaded files:" : "アップロード済ファイル:" }, "nplurals=1; plural=0;"); diff --git a/apps/files_sharing/l10n/ja.json b/apps/files_sharing/l10n/ja.json index 4b98342822d..70f1fa0f32e 100644 --- a/apps/files_sharing/l10n/ja.json +++ b/apps/files_sharing/l10n/ja.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "ownCloud に追加", "Download" : "ダウンロード", "Download %s" : "%s をダウンロード", - "Direct link" : "リンク" + "Direct link" : "リンク", + "Upload files to %s" : "%s にファイルをアップロード", + "Select or drop files" : "ファイルを選択するか、ドラッグ&ドロップしてください", + "Uploading files…" : "ファイルをアップロード中...", + "Uploaded files:" : "アップロード済ファイル:" },"pluralForm" :"nplurals=1; plural=0;" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/nl.js b/apps/files_sharing/l10n/nl.js index 9bd9ba81331..680a9d94bd4 100644 --- a/apps/files_sharing/l10n/nl.js +++ b/apps/files_sharing/l10n/nl.js @@ -8,21 +8,21 @@ OC.L10N.register( "Could not authenticate to remote share, password might be wrong" : "Kon niet authenticeren bij externe share, misschien verkeerd wachtwoord", "Storage not valid" : "Opslag ongeldig", "Couldn't add remote share" : "Kon geen externe share toevoegen", - "Shared with you" : "Gedeeld met u", + "Shared with you" : "Deelde met je", "Shared with others" : "Gedeeld door u", "Shared by link" : "Gedeeld via een link", "Nothing shared with you yet" : "Nog niets met u gedeeld", - "Files and folders others share with you will show up here" : "Bestanden en mappen die anderen met u delen, worden hier getoond", + "Files and folders others share with you will show up here" : "Bestanden en mappen die anderen met je delen, worden hier getoond", "Nothing shared yet" : "Nog niets gedeeld", "Files and folders you share will show up here" : "Bestanden en mappen die u deelt, worden hier getoond", "No shared links" : "Geen gedeelde links", - "Files and folders you share by link will show up here" : "Bestanden en mappen die u via links deelt, worden hier getoond", - "Do you want to add the remote share {name} from {owner}@{remote}?" : "Wilt u de externe share {name} van {owner}@{remote} toevoegen?", + "Files and folders you share by link will show up here" : "Bestanden en mappen die je via links deelt, worden hier getoond", + "Do you want to add the remote share {name} from {owner}@{remote}?" : "Wil je de externe share {name} van {owner}@{remote} toevoegen?", "Remote share" : "Externe share", "Remote share password" : "Wachtwoord externe share", "Cancel" : "Annuleren", "Add remote share" : "Toevoegen externe share", - "You can upload into this folder" : "U kunt uploaden naar deze map", + "You can upload into this folder" : "Je kunt uploaden naar deze map", "No ownCloud installation (7 or higher) found at {remote}" : "Geen recente ownCloud installatie (7 of hoger) gevonden op {remote}", "Invalid ownCloud url" : "Ongeldige ownCloud url", "Shared by" : "Gedeeld door", @@ -49,23 +49,23 @@ OC.L10N.register( "A file or folder has been <strong>shared</strong>" : "Een bestand of map is <strong>gedeeld</strong>", "A file or folder was shared from <strong>another server</strong>" : "Een bestand of map werd gedeeld vanaf <strong>een andere server</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Een openbaar gedeeld bestand of map werd <strong>gedownloaded</strong>", - "You received a new remote share %2$s from %1$s" : "U ontving een nieuwe externe share %2$s van %1$s", - "You received a new remote share from %s" : "U ontving een nieuwe externe share van %s", + "You received a new remote share %2$s from %1$s" : "Je ontving een nieuwe externe share %2$s van %1$s", + "You received a new remote share from %s" : "Je ontving een nieuwe externe share van %s", "%1$s accepted remote share %2$s" : "%1$s accepteerde externe share %2$s", "%1$s declined remote share %2$s" : "%1$s weigerde externe share %2$s", "%1$s unshared %2$s from you" : "%1$s stopte met delen van %2$s met je", "Public shared folder %1$s was downloaded" : "Openbaar gedeelde map %1$s werd gedownloaded", "Public shared file %1$s was downloaded" : "Openbaar gedeeld bestand %1$s werd gedownloaded", - "You shared %1$s with %2$s" : "U deelde %1$s met %2$s", + "You shared %1$s with %2$s" : "Je deelde %1$s met %2$s", "%2$s shared %1$s with %3$s" : "%2$s deelde %1$s met %3$s", - "You removed the share of %2$s for %1$s" : "U heeft de share van %1$s met %2$s verwijderd", + "You removed the share of %2$s for %1$s" : "Je hebt de share van %1$s met %2$s verwijderd", "%2$s removed the share of %3$s for %1$s" : "%2$s heeft de share van %1$s met %3$s verwijderd", - "You shared %1$s with group %2$s" : "U deelde %1$s met groep %2$s", + "You shared %1$s with group %2$s" : "Je deelde %1$s met groep %2$s", "%2$s shared %1$s with group %3$s" : "%2$s deelde %1$s met groep %3$s", - "You removed the share of group %2$s for %1$s" : "U heeft de share van %1$s met de groep %2$s verwijderd", + "You removed the share of group %2$s for %1$s" : "Je heeft de share van %1$s met de groep %2$s verwijderd", "%2$s removed the share of group %3$s for %1$s" : "%2$s heeft de share van %1$s met de groep %3$s verwijderd", "%2$s shared %1$s via link" : "%2$s deelde %1$s via link", - "You shared %1$s via link" : "U deelde %1$s via link", + "You shared %1$s via link" : "Je deelde %1$s via link", "You removed the public link for %1$s" : "U heeft de openbare link voor %1$s verwijderd", "%2$s removed the public link for %1$s" : "%2$s heeft de openbare link voor %1$s verwijderd", "Your public link for %1$s expired" : "Uw openbare link voor %1$s is verlopen", @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Toevoegen aan uw ownCloud", "Download" : "Downloaden", "Download %s" : "Download %s", - "Direct link" : "Directe link" + "Direct link" : "Directe link", + "Upload files to %s" : "Uploaden bestanden naar%s", + "Select or drop files" : "Selecteer of leg bestanden neer", + "Uploading files…" : "Uploaden bestanden...", + "Uploaded files:" : "Geüploade bestanden" }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/files_sharing/l10n/nl.json b/apps/files_sharing/l10n/nl.json index 01558fc5e73..3170ab55186 100644 --- a/apps/files_sharing/l10n/nl.json +++ b/apps/files_sharing/l10n/nl.json @@ -6,21 +6,21 @@ "Could not authenticate to remote share, password might be wrong" : "Kon niet authenticeren bij externe share, misschien verkeerd wachtwoord", "Storage not valid" : "Opslag ongeldig", "Couldn't add remote share" : "Kon geen externe share toevoegen", - "Shared with you" : "Gedeeld met u", + "Shared with you" : "Deelde met je", "Shared with others" : "Gedeeld door u", "Shared by link" : "Gedeeld via een link", "Nothing shared with you yet" : "Nog niets met u gedeeld", - "Files and folders others share with you will show up here" : "Bestanden en mappen die anderen met u delen, worden hier getoond", + "Files and folders others share with you will show up here" : "Bestanden en mappen die anderen met je delen, worden hier getoond", "Nothing shared yet" : "Nog niets gedeeld", "Files and folders you share will show up here" : "Bestanden en mappen die u deelt, worden hier getoond", "No shared links" : "Geen gedeelde links", - "Files and folders you share by link will show up here" : "Bestanden en mappen die u via links deelt, worden hier getoond", - "Do you want to add the remote share {name} from {owner}@{remote}?" : "Wilt u de externe share {name} van {owner}@{remote} toevoegen?", + "Files and folders you share by link will show up here" : "Bestanden en mappen die je via links deelt, worden hier getoond", + "Do you want to add the remote share {name} from {owner}@{remote}?" : "Wil je de externe share {name} van {owner}@{remote} toevoegen?", "Remote share" : "Externe share", "Remote share password" : "Wachtwoord externe share", "Cancel" : "Annuleren", "Add remote share" : "Toevoegen externe share", - "You can upload into this folder" : "U kunt uploaden naar deze map", + "You can upload into this folder" : "Je kunt uploaden naar deze map", "No ownCloud installation (7 or higher) found at {remote}" : "Geen recente ownCloud installatie (7 of hoger) gevonden op {remote}", "Invalid ownCloud url" : "Ongeldige ownCloud url", "Shared by" : "Gedeeld door", @@ -47,23 +47,23 @@ "A file or folder has been <strong>shared</strong>" : "Een bestand of map is <strong>gedeeld</strong>", "A file or folder was shared from <strong>another server</strong>" : "Een bestand of map werd gedeeld vanaf <strong>een andere server</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Een openbaar gedeeld bestand of map werd <strong>gedownloaded</strong>", - "You received a new remote share %2$s from %1$s" : "U ontving een nieuwe externe share %2$s van %1$s", - "You received a new remote share from %s" : "U ontving een nieuwe externe share van %s", + "You received a new remote share %2$s from %1$s" : "Je ontving een nieuwe externe share %2$s van %1$s", + "You received a new remote share from %s" : "Je ontving een nieuwe externe share van %s", "%1$s accepted remote share %2$s" : "%1$s accepteerde externe share %2$s", "%1$s declined remote share %2$s" : "%1$s weigerde externe share %2$s", "%1$s unshared %2$s from you" : "%1$s stopte met delen van %2$s met je", "Public shared folder %1$s was downloaded" : "Openbaar gedeelde map %1$s werd gedownloaded", "Public shared file %1$s was downloaded" : "Openbaar gedeeld bestand %1$s werd gedownloaded", - "You shared %1$s with %2$s" : "U deelde %1$s met %2$s", + "You shared %1$s with %2$s" : "Je deelde %1$s met %2$s", "%2$s shared %1$s with %3$s" : "%2$s deelde %1$s met %3$s", - "You removed the share of %2$s for %1$s" : "U heeft de share van %1$s met %2$s verwijderd", + "You removed the share of %2$s for %1$s" : "Je hebt de share van %1$s met %2$s verwijderd", "%2$s removed the share of %3$s for %1$s" : "%2$s heeft de share van %1$s met %3$s verwijderd", - "You shared %1$s with group %2$s" : "U deelde %1$s met groep %2$s", + "You shared %1$s with group %2$s" : "Je deelde %1$s met groep %2$s", "%2$s shared %1$s with group %3$s" : "%2$s deelde %1$s met groep %3$s", - "You removed the share of group %2$s for %1$s" : "U heeft de share van %1$s met de groep %2$s verwijderd", + "You removed the share of group %2$s for %1$s" : "Je heeft de share van %1$s met de groep %2$s verwijderd", "%2$s removed the share of group %3$s for %1$s" : "%2$s heeft de share van %1$s met de groep %3$s verwijderd", "%2$s shared %1$s via link" : "%2$s deelde %1$s via link", - "You shared %1$s via link" : "U deelde %1$s via link", + "You shared %1$s via link" : "Je deelde %1$s via link", "You removed the public link for %1$s" : "U heeft de openbare link voor %1$s verwijderd", "%2$s removed the public link for %1$s" : "%2$s heeft de openbare link voor %1$s verwijderd", "Your public link for %1$s expired" : "Uw openbare link voor %1$s is verlopen", @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Toevoegen aan uw ownCloud", "Download" : "Downloaden", "Download %s" : "Download %s", - "Direct link" : "Directe link" + "Direct link" : "Directe link", + "Upload files to %s" : "Uploaden bestanden naar%s", + "Select or drop files" : "Selecteer of leg bestanden neer", + "Uploading files…" : "Uploaden bestanden...", + "Uploaded files:" : "Geüploade bestanden" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/pt_BR.js b/apps/files_sharing/l10n/pt_BR.js index 4d2963dba24..dbe3db3dcfa 100644 --- a/apps/files_sharing/l10n/pt_BR.js +++ b/apps/files_sharing/l10n/pt_BR.js @@ -104,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Adiconar ao seu ownCloud", "Download" : "Baixar", "Download %s" : "Baixar %s", - "Direct link" : "Link direto" + "Direct link" : "Link direto", + "Upload files to %s" : "Carregar arquivos para %s", + "Select or drop files" : "Selecione e solte arquivos", + "Uploading files…" : "Carregando arquivos...", + "Uploaded files:" : "Arquivos carregados:" }, "nplurals=2; plural=(n > 1);"); diff --git a/apps/files_sharing/l10n/pt_BR.json b/apps/files_sharing/l10n/pt_BR.json index 2d4397efd94..28396902ccb 100644 --- a/apps/files_sharing/l10n/pt_BR.json +++ b/apps/files_sharing/l10n/pt_BR.json @@ -102,6 +102,10 @@ "Add to your ownCloud" : "Adiconar ao seu ownCloud", "Download" : "Baixar", "Download %s" : "Baixar %s", - "Direct link" : "Link direto" + "Direct link" : "Link direto", + "Upload files to %s" : "Carregar arquivos para %s", + "Select or drop files" : "Selecione e solte arquivos", + "Uploading files…" : "Carregando arquivos...", + "Uploaded files:" : "Arquivos carregados:" },"pluralForm" :"nplurals=2; plural=(n > 1);" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/sl.js b/apps/files_sharing/l10n/sl.js index 8ae00c40bae..79e2e33d994 100644 --- a/apps/files_sharing/l10n/sl.js +++ b/apps/files_sharing/l10n/sl.js @@ -27,6 +27,7 @@ OC.L10N.register( "Invalid ownCloud url" : "Naveden je neveljaven naslov URL strežnika ownCloud", "Shared by" : "V souporabi z", "Sharing" : "Souporaba", + "Share API is disabled" : "API za souporabo je izključen", "Wrong share ID, share doesn't exist" : "Napačen ID mesta uporabe; mesto ne obstaja!", "Could not delete share" : "Tega predmeta v souporabi ni mogoče izbrisati.", "Please specify a file or folder path" : "Določiti je treba datoteko ali pot do mape", @@ -38,6 +39,7 @@ OC.L10N.register( "Public upload disabled by the administrator" : "Javno pošiljanje v oblak je skrbniško onemogočeno", "Public upload is only possible for publicly shared folders" : "Javno pošiljanje v oblak je mogoče le za javne mape v skupni rabi.", "Invalid date, date format must be YYYY-MM-DD" : "Neveljaven zapis časa; biti mora v zapisu YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "Deljenje %s ni uspelo ker sistem ne dovoli souporabe za tip %s", "Unknown share type" : "Neznana vrsta mesta souporabe", "Not a directory" : "Predmet ni mapa", "Could not lock path" : "Poti ni mogoče zakleniti", @@ -57,10 +59,19 @@ OC.L10N.register( "You shared %1$s with %2$s" : "Omogočili ste souporabo %1$s z uporabnikom %2$s", "%2$s shared %1$s with %3$s" : "Uporabnik %2$s je omogočil souporabo %1$s z %3$s", "You removed the share of %2$s for %1$s" : "Odstranili ste mapo v souporabi %2$s za %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s umaknil souporabo %3$s za %1$s", "You shared %1$s with group %2$s" : "Omogočili ste souporabo %1$s s skupino %2$s", + "%2$s shared %1$s with group %3$s" : "%2$s deli %1$s s skupino %3$s", + "You removed the share of group %2$s for %1$s" : "Ukinili ste deljenje s skupino %2$s za %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s ukinil deljenje s skupino %3$s za %1$s", + "%2$s shared %1$s via link" : "%2$s deli %1$s preko povezave", "You shared %1$s via link" : "Omogočili ste souporabo %1$s preko povezave", + "You removed the public link for %1$s" : "Umaknili ste javno povezavo za %1$s", + "%2$s removed the public link for %1$s" : "%2$s umaknil javno povezavo za %1$s", "Your public link for %1$s expired" : "Javna povezava za %1$s je časovno potekla!", + "The public link of %2$s for %1$s expired" : "Javna povezava %2$s za %1$s je potekla", "%2$s shared %1$s with you" : "Uporabnik %2$s je omogočil souporabo %1$s", + "%2$s removed the share for %1$s" : "%2$s je umaknil deljenje za %1$s", "Downloaded via public link" : "Prejeto preko javne povezave", "Shared with %2$s" : "V souporabi z %2$s", "Shared with %3$s by %2$s" : "Souporaba z %3$s in %2$s", @@ -93,6 +104,10 @@ OC.L10N.register( "Add to your ownCloud" : "Dodaj v svoj oblak ownCloud", "Download" : "Prejmi", "Download %s" : "Prejmi %s", - "Direct link" : "Neposredna povezava" + "Direct link" : "Neposredna povezava", + "Upload files to %s" : "Naloži datoteke v %s", + "Select or drop files" : "Izberi ali povleci datoteke", + "Uploading files…" : "Nalaganje datotek...", + "Uploaded files:" : "Naložene datoteke:" }, "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);"); diff --git a/apps/files_sharing/l10n/sl.json b/apps/files_sharing/l10n/sl.json index 36f775d9766..3698b1f3d3f 100644 --- a/apps/files_sharing/l10n/sl.json +++ b/apps/files_sharing/l10n/sl.json @@ -25,6 +25,7 @@ "Invalid ownCloud url" : "Naveden je neveljaven naslov URL strežnika ownCloud", "Shared by" : "V souporabi z", "Sharing" : "Souporaba", + "Share API is disabled" : "API za souporabo je izključen", "Wrong share ID, share doesn't exist" : "Napačen ID mesta uporabe; mesto ne obstaja!", "Could not delete share" : "Tega predmeta v souporabi ni mogoče izbrisati.", "Please specify a file or folder path" : "Določiti je treba datoteko ali pot do mape", @@ -36,6 +37,7 @@ "Public upload disabled by the administrator" : "Javno pošiljanje v oblak je skrbniško onemogočeno", "Public upload is only possible for publicly shared folders" : "Javno pošiljanje v oblak je mogoče le za javne mape v skupni rabi.", "Invalid date, date format must be YYYY-MM-DD" : "Neveljaven zapis časa; biti mora v zapisu YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "Deljenje %s ni uspelo ker sistem ne dovoli souporabe za tip %s", "Unknown share type" : "Neznana vrsta mesta souporabe", "Not a directory" : "Predmet ni mapa", "Could not lock path" : "Poti ni mogoče zakleniti", @@ -55,10 +57,19 @@ "You shared %1$s with %2$s" : "Omogočili ste souporabo %1$s z uporabnikom %2$s", "%2$s shared %1$s with %3$s" : "Uporabnik %2$s je omogočil souporabo %1$s z %3$s", "You removed the share of %2$s for %1$s" : "Odstranili ste mapo v souporabi %2$s za %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s umaknil souporabo %3$s za %1$s", "You shared %1$s with group %2$s" : "Omogočili ste souporabo %1$s s skupino %2$s", + "%2$s shared %1$s with group %3$s" : "%2$s deli %1$s s skupino %3$s", + "You removed the share of group %2$s for %1$s" : "Ukinili ste deljenje s skupino %2$s za %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s ukinil deljenje s skupino %3$s za %1$s", + "%2$s shared %1$s via link" : "%2$s deli %1$s preko povezave", "You shared %1$s via link" : "Omogočili ste souporabo %1$s preko povezave", + "You removed the public link for %1$s" : "Umaknili ste javno povezavo za %1$s", + "%2$s removed the public link for %1$s" : "%2$s umaknil javno povezavo za %1$s", "Your public link for %1$s expired" : "Javna povezava za %1$s je časovno potekla!", + "The public link of %2$s for %1$s expired" : "Javna povezava %2$s za %1$s je potekla", "%2$s shared %1$s with you" : "Uporabnik %2$s je omogočil souporabo %1$s", + "%2$s removed the share for %1$s" : "%2$s je umaknil deljenje za %1$s", "Downloaded via public link" : "Prejeto preko javne povezave", "Shared with %2$s" : "V souporabi z %2$s", "Shared with %3$s by %2$s" : "Souporaba z %3$s in %2$s", @@ -91,6 +102,10 @@ "Add to your ownCloud" : "Dodaj v svoj oblak ownCloud", "Download" : "Prejmi", "Download %s" : "Prejmi %s", - "Direct link" : "Neposredna povezava" + "Direct link" : "Neposredna povezava", + "Upload files to %s" : "Naloži datoteke v %s", + "Select or drop files" : "Izberi ali povleci datoteke", + "Uploading files…" : "Nalaganje datotek...", + "Uploaded files:" : "Naložene datoteke:" },"pluralForm" :"nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);" }
\ No newline at end of file diff --git a/apps/files_sharing/lib/Controllers/ShareController.php b/apps/files_sharing/lib/Controllers/ShareController.php index 96c0a0ca556..56f94b91c80 100644 --- a/apps/files_sharing/lib/Controllers/ShareController.php +++ b/apps/files_sharing/lib/Controllers/ShareController.php @@ -49,7 +49,6 @@ use OCP\ILogger; use OCP\IUserManager; use OCP\ISession; use OCP\IPreview; -use OCA\Files_Sharing\Helper; use OCP\Util; use OCA\Files_Sharing\Activity; use \OCP\Files\NotFoundException; @@ -253,6 +252,7 @@ class ShareController extends Controller { * @param string $path * @return TemplateResponse|RedirectResponse * @throws NotFoundException + * @throws \Exception */ public function showShare($token, $path = '') { \OC_User::setIncognitoMode(true); @@ -314,6 +314,7 @@ class ShareController extends Controller { $shareTmpl['fileSize'] = \OCP\Util::humanFileSize($share->getNode()->getSize()); // Show file list + $hideFileList = false; if ($share->getNode() instanceof \OCP\Files\Folder) { $shareTmpl['dir'] = $rootFolder->getRelativePath($path->getPath()); @@ -329,12 +330,14 @@ class ShareController extends Controller { $uploadLimit = Util::uploadLimit(); $maxUploadFilesize = min($freeSpace, $uploadLimit); + $hideFileList = $share->getPermissions() & \OCP\Constants::PERMISSION_READ ? false : true; $folder = new Template('files', 'list', ''); $folder->assign('dir', $rootFolder->getRelativePath($path->getPath())); $folder->assign('dirToken', $token); $folder->assign('permissions', \OCP\Constants::PERMISSION_READ); $folder->assign('isPublic', true); + $folder->assign('hideFileList', $hideFileList); $folder->assign('publicUploadEnabled', 'no'); $folder->assign('uploadMaxFilesize', $maxUploadFilesize); $folder->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); @@ -345,6 +348,8 @@ class ShareController extends Controller { $shareTmpl['folder'] = $folder->fetchPage(); } + $shareTmpl['hideFileList'] = $hideFileList; + $shareTmpl['shareOwner'] = $this->userManager->get($share->getShareOwner())->getDisplayName(); $shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', array('token' => $token)); $shareTmpl['maxSizeAnimateGif'] = $this->config->getSystemValue('max_filesize_animated_gifs_public_sharing', 10); $shareTmpl['previewEnabled'] = $this->config->getSystemValue('enable_previews', true); @@ -369,13 +374,18 @@ class ShareController extends Controller { * @param string $files * @param string $path * @param string $downloadStartSecret - * @return void|RedirectResponse + * @return void|OCP\AppFramework\Http\Response + * @throws NotFoundException */ public function downloadShare($token, $files = null, $path = '', $downloadStartSecret = '') { \OC_User::setIncognitoMode(true); $share = $this->shareManager->getShareByToken($token); + if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + return new OCP\AppFramework\Http\DataResponse('Share is read-only'); + } + // Share is password protected - check whether the user is permitted to access the share if ($share->getPassword() !== null && !$this->linkShareAuth($share)) { return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.authenticate', diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index e39d1b08076..c15001ad24b 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -9,6 +9,7 @@ OCP\Util::addScript('files_sharing', 'public'); OCP\Util::addScript('files', 'fileactions'); OCP\Util::addScript('files', 'fileactionsmenu'); OCP\Util::addScript('files', 'jquery.fileupload'); +OCP\Util::addScript('files_sharing', 'files_drop'); // JS required for folders OCP\Util::addStyle('files', 'files'); @@ -30,6 +31,7 @@ OCP\Util::addscript('files', 'keyboardshortcuts'); <div id="notification" style="display: none;"></div> </div> +<input type="hidden" id="sharingUserId" value="<?php p($_['owner']) ?>"> <input type="hidden" id="filesApp" name="filesApp" value="1"> <input type="hidden" id="isPublic" name="isPublic" value="1"> <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir"> @@ -39,7 +41,16 @@ OCP\Util::addscript('files', 'keyboardshortcuts'); <input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype"> <input type="hidden" name="previewSupported" value="<?php p($_['previewSupported'] ? 'true' : 'false'); ?>" id="previewSupported"> <input type="hidden" name="mimetypeIcon" value="<?php p(\OC::$server->getMimeTypeDetector()->mimeTypeIcon($_['mimetype'])); ?>" id="mimetypeIcon"> -<input type="hidden" name="filesize" value="<?php p($_['nonHumanFileSize']); ?>" id="filesize"> +<?php +$upload_max_filesize = OC::$server->getIniWrapper()->getBytes('upload_max_filesize'); +$post_max_size = OC::$server->getIniWrapper()->getBytes('post_max_size'); +$maxUploadFilesize = min($upload_max_filesize, $post_max_size); +?> +<input type="hidden" name="maxFilesizeUpload" value="<?php p($maxUploadFilesize); ?>" id="maxFilesizeUpload"> + +<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)): ?> + <input type="hidden" name="filesize" value="<?php p($_['nonHumanFileSize']); ?>" id="filesize"> +<?php endif; ?> <input type="hidden" name="maxSizeAnimateGif" value="<?php p($_['maxSizeAnimateGif']); ?>" id="maxSizeAnimateGif"> @@ -66,27 +77,30 @@ OCP\Util::addscript('files', 'keyboardshortcuts'); <div class="header-right"> <span id="details"> <?php - if ($_['server2serversharing']) { - ?> - <span id="save" data-protected="<?php p($_['protected']) ?>" - data-owner-display-name="<?php p($_['displayName']) ?>" data-owner="<?php p($_['owner']) ?>" data-name="<?php p($_['filename']) ?>"> - <button id="save-button"><?php p($l->t('Add to your ownCloud')) ?></button> - <form class="save-form hidden" action="#"> - <input type="text" id="remote_address" placeholder="example.com/owncloud"/> - <button id="save-button-confirm" class="icon-confirm svg" disabled></button> - </form> - </span> + if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { + if ($_['server2serversharing']) { + ?> + <span id="save" data-protected="<?php p($_['protected']) ?>" + data-owner-display-name="<?php p($_['displayName']) ?>" data-owner="<?php p($_['owner']) ?>" data-name="<?php p($_['filename']) ?>"> + <button id="save-button"><?php p($l->t('Add to your ownCloud')) ?></button> + <form class="save-form hidden" action="#"> + <input type="text" id="remote_address" placeholder="example.com/owncloud"/> + <button id="save-button-confirm" class="icon-confirm svg" disabled></button> + </form> + </span> + <?php } ?> + <a href="<?php p($_['downloadURL']); ?>" id="download" class="button"> + <img class="svg" alt="" src="<?php print_unescaped(image_path("core", "actions/download.svg")); ?>"/> + <span id="download-text"><?php p($l->t('Download'))?></span> + </a> <?php } ?> - <a href="<?php p($_['downloadURL']); ?>" id="download" class="button"> - <img class="svg" alt="" src="<?php print_unescaped(image_path("core", "actions/download.svg")); ?>"/> - <span id="download-text"><?php p($l->t('Download'))?></span> - </a> </span> </div> -</div></header> + </div></header> <div id="content-wrapper"> + <?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?> <div id="content"> - <div id="preview"> + <div id="preview"> <?php if (isset($_['folder'])): ?> <?php print_unescaped($_['folder']); ?> <?php else: ?> @@ -112,7 +126,31 @@ OCP\Util::addscript('files', 'keyboardshortcuts'); </div> <?php endif; ?> </div> + <?php } else { ?> + <input type="hidden" id="upload-only-interface" value="1"/> + <div id="public-upload"> + <div id="emptycontent" class=""> + <div id="displayavatar"><div class="avatardiv"></div></div> + <h2><?php p($l->t('Upload files to %s', [$_['shareOwner']])) ?></h2> + <p><span class="icon-folder"></span> <?php p($_['filename']) ?></p> + <input type="file" name="files[]" class="hidden" multiple> + + <a href="#" class="button icon-upload"><?php p($l->t('Select or drop files')) ?></a> + <div id="drop-upload-progress-indicator" style="padding-top: 25px;" class="hidden"><?php p($l->t('Uploading files…')) ?></div> + <div id="drop-upload-done-indicator" style="padding-top: 25px;" class="hidden"><?php p($l->t('Uploaded files:')) ?></div> + <ul> + </ul> + </div> + </div> + <?php } ?> +</div> +<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] !== true)): ?> + <input type="hidden" name="dir" id="dir" value="" /> + <div class="hiddenuploadfield"> + <input type="file" id="file_upload_start" class="hiddenuploadfield" name="files[]" + data-url="<?php print_unescaped(OCP\Util::linkTo('files', 'ajax/upload.php')); ?>" /> </div> + <?php endif; ?> <footer> <p class="info"> <?php print_unescaped($theme->getLongFooter()); ?> diff --git a/apps/files_sharing/tests/Controllers/ShareControllerTest.php b/apps/files_sharing/tests/Controllers/ShareControllerTest.php index d97b3a14928..0c35449fb1a 100644 --- a/apps/files_sharing/tests/Controllers/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controllers/ShareControllerTest.php @@ -32,6 +32,7 @@ namespace OCA\Files_Sharing\Tests\Controllers; use OC\Files\Filesystem; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\Files_Sharing\Controllers\ShareController; +use OCP\AppFramework\Http\DataResponse; use OCP\Share\Exceptions\ShareNotFound; use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Http\RedirectResponse; @@ -372,6 +373,8 @@ class ShareControllerTest extends \Test\TestCase { 'previewEnabled' => true, 'previewMaxX' => 1024, 'previewMaxY' => 1024, + 'hideFileList' => false, + 'shareOwner' => 'ownerDisplay' ); $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); @@ -430,10 +433,13 @@ class ShareControllerTest extends \Test\TestCase { $this->shareController->showShare('token'); } - public function testDownloadShare() { $share = $this->getMock('\OCP\Share\IShare'); $share->method('getPassword')->willReturn('password'); + $share + ->expects($this->once()) + ->method('getPermissions') + ->willReturn(\OCP\Constants::PERMISSION_READ); $this->shareManager ->expects($this->once()) @@ -452,4 +458,24 @@ class ShareControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $response); } + public function testDownloadShareWithCreateOnlyShare() { + $share = $this->getMock('\OCP\Share\IShare'); + $share->method('getPassword')->willReturn('password'); + $share + ->expects($this->once()) + ->method('getPermissions') + ->willReturn(\OCP\Constants::PERMISSION_CREATE); + + $this->shareManager + ->expects($this->once()) + ->method('getShareByToken') + ->with('validtoken') + ->willReturn($share); + + // Test with a password protected share and no authentication + $response = $this->shareController->downloadShare('validtoken'); + $expectedResponse = new DataResponse('Share is read-only'); + $this->assertEquals($expectedResponse, $response); + } + } |