diff --git a/apps/files/index.php b/apps/files/index.php index 8d877be8ac9..f0f95b3bac8 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -118,6 +118,10 @@ if ($needUpgrade) { $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user); } + $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); + $fileHeader = (!isset($files) or count($files) > 0); + $emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad; + OCP\Util::addscript('files', 'fileactions'); OCP\Util::addscript('files', 'files'); OCP\Util::addscript('files', 'keyboardshortcuts'); @@ -125,7 +129,7 @@ if ($needUpgrade) { $tmpl->assign('fileList', $list->fetchPage()); $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage()); $tmpl->assign('dir', \OC\Files\Filesystem::normalizePath($dir)); - $tmpl->assign('isCreatable', \OC\Files\Filesystem::isCreatable($dir . '/')); + $tmpl->assign('isCreatable', $isCreatable); $tmpl->assign('permissions', $permissions); $tmpl->assign('files', $files); $tmpl->assign('trash', $trashEnabled); @@ -138,9 +142,12 @@ if ($needUpgrade) { $tmpl->assign('publicUploadEnabled', $publicUploadEnabled); $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles()); $tmpl->assign("mailNotificationEnabled", \OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'yes')); + $tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes')); $tmpl->assign("encryptionInitStatus", $encryptionInitStatus); $tmpl->assign('disableSharing', false); $tmpl->assign('ajaxLoad', $ajaxLoad); + $tmpl->assign('emptyContent', $emptyContent); + $tmpl->assign('fileHeader', $fileHeader); $tmpl->printPage(); } diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 84ff1093253..85bdd509715 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -7,11 +7,9 @@ var FileList={ }); }, update:function(fileListHtml) { - var $fileList = $('#fileList'), - permissions = $('#permissions').val(), - isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; + var $fileList = $('#fileList'); $fileList.empty().html(fileListHtml); - $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); + FileList.updateEmptyContent(); $fileList.find('tr').each(function () { FileActions.display($(this).children('td.filename')); }); @@ -251,12 +249,38 @@ var FileList={ $('.creatable').toggleClass('hidden', !isCreatable); $('.notCreatable').toggleClass('hidden', isCreatable); }, + /** + * Shows/hides action buttons + * + * @param show true for enabling, false for disabling + */ + showActions: function(show){ + $('.actions,#file_action_panel').toggleClass('hidden', !show); + if (show){ + // make sure to display according to permissions + var permissions = $('#permissions').val(); + var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; + $('.creatable').toggleClass('hidden', !isCreatable); + $('.notCreatable').toggleClass('hidden', isCreatable); + } + }, + /** + * Enables/disables viewer mode. + * In viewer mode, apps can embed themselves under the controls bar. + * In viewer mode, the actions of the file list will be hidden. + * @param show true for enabling, false for disabling + */ + setViewerMode: function(show){ + this.showActions(!show); + $('#filestable').toggleClass('hidden', show); + }, remove:function(name){ $('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy'); $('tr').filterAttr('data-file',name).remove(); FileList.updateFileSummary(); if($('tr[data-file]').length==0){ $('#emptycontent').removeClass('hidden'); + $('#filescontent th').addClass('hidden'); } }, insertElement:function(name,type,element){ @@ -287,6 +311,7 @@ var FileList={ $('#fileList').append(element); } $('#emptycontent').addClass('hidden'); + $('#filestable th').removeClass('hidden'); FileList.updateFileSummary(); }, loadingDone:function(name, id){ @@ -505,6 +530,7 @@ var FileList={ procesSelection(); checkTrashStatus(); FileList.updateFileSummary(); + FileList.updateEmptyContent(); } else { $.each(files,function(index,file) { var deleteAction = $('tr').filterAttr('data-file',files[i]).children("td.date").children(".action.delete"); @@ -618,6 +644,13 @@ var FileList={ } } }, + updateEmptyContent: function(){ + var $fileList = $('#fileList'); + var permissions = $('#permissions').val(); + var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0; + $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0); + $('#filestable th').toggleClass('hidden', $fileList.find('tr').length === 0); + }, showMask: function(){ // in case one was shown before var $mask = $('#content .mask'); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index a35ed4add8c..ec2dc7c62ea 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -301,7 +301,7 @@ $(document).ready(function() { }); $('.download').click('click',function(event) { - var files=getSelectedFiles('name'); + var files=getSelectedFilesTrash('name'); var fileslist = JSON.stringify(files); var dir=$('#dir').val()||'/'; OC.Notification.show(t('files','Your download is being prepared. This might take some time if the files are big.')); @@ -315,7 +315,7 @@ $(document).ready(function() { }); $('.delete-selected').click(function(event) { - var files=getSelectedFiles('name'); + var files=getSelectedFilesTrash('name'); event.preventDefault(); FileList.do_delete(files); return false; @@ -433,7 +433,7 @@ var createDragShadow = function(event){ $(event.target).parents('tr').find('td input:first').prop('checked',true); } - var selectedFiles = getSelectedFiles(); + var selectedFiles = getSelectedFilesTrash(); if (!isDragSelected && selectedFiles.length == 1) { //revert the selection @@ -562,7 +562,7 @@ var crumbDropOptions={ } function procesSelection(){ - var selected=getSelectedFiles(); + var selected=getSelectedFilesTrash(); var selectedFiles=selected.filter(function(el){return el.type=='file'}); var selectedFolders=selected.filter(function(el){return el.type=='dir'}); if(selectedFiles.length==0 && selectedFolders.length==0) { @@ -607,7 +607,7 @@ function procesSelection(){ * if property is set, an array with that property for each file is returnd * if it's ommited an array of objects with all properties is returned */ -function getSelectedFiles(property){ +function getSelectedFilesTrash(property){ var elements=$('td.filename input:checkbox:checked').parent().parent(); var files=[]; elements.each(function(i,element){ @@ -663,8 +663,16 @@ function lazyLoadPreview(path, mime, ready, width, height) { $.get(previewURL, function() { previewURL = previewURL.replace('(', '%28'); previewURL = previewURL.replace(')', '%29'); - //set preview thumbnail URL - ready(previewURL + '&reload=true'); + previewURL += '&reload=true'; + + // preload image to prevent delay + // this will make the browser cache the image + var img = new Image(); + img.onload = function(){ + //set preview thumbnail URL + ready(previewURL); + } + img.src = previewURL; }); }); } diff --git a/apps/files/l10n/ru_RU.php b/apps/files/l10n/ru_RU.php new file mode 100644 index 00000000000..0764fef2ed9 --- /dev/null +++ b/apps/files/l10n/ru_RU.php @@ -0,0 +1,14 @@ + "Файлы", +"Error" => "Ошибка", +"Share" => "Сделать общим", +"Rename" => "Переименовать", +"_%n folder_::_%n folders_" => array("","",""), +"_%n file_::_%n files_" => array("","",""), +"_Uploading %n file_::_Uploading %n files_" => array("","",""), +"Upload" => "Загрузка", +"Cancel upload" => "Отмена загрузки", +"Download" => "Загрузка" +); +$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"; diff --git a/apps/files/l10n/sk_SK.php b/apps/files/l10n/sk_SK.php index 962ce7d7e9b..c246492211c 100644 --- a/apps/files/l10n/sk_SK.php +++ b/apps/files/l10n/sk_SK.php @@ -13,10 +13,14 @@ $TRANSLATIONS = array( "Missing a temporary folder" => "Chýba dočasný priečinok", "Failed to write to disk" => "Zápis na disk sa nepodaril", "Not enough storage available" => "Nedostatok dostupného úložného priestoru", +"Upload failed. Could not get file info." => "Nahrávanie zlyhalo. Nepodarilo sa získať informácie o súbore.", +"Upload failed. Could not find uploaded file" => "Nahrávanie zlyhalo. Nepodarilo sa nájsť nahrávaný súbor", "Invalid directory." => "Neplatný priečinok.", "Files" => "Súbory", +"Unable to upload {filename} as it is a directory or has 0 bytes" => "Nemožno nahrať súbor {filename}, pretože je to priečinok, alebo má 0 bitov", "Not enough space available" => "Nie je k dispozícii dostatok miesta", "Upload cancelled." => "Odosielanie zrušené.", +"Could not get result from server." => "Nepodarilo sa dostať výsledky zo servera.", "File upload is in progress. Leaving the page now will cancel the upload." => "Opustenie stránky zruší práve prebiehajúce odosielanie súboru.", "URL cannot be empty." => "URL nemôže byť prázdne.", "Invalid folder name. Usage of 'Shared' is reserved by ownCloud" => "Neplatný názov priečinka. Názov \"Shared\" je rezervovaný pre ownCloud", @@ -33,14 +37,18 @@ $TRANSLATIONS = array( "undo" => "vrátiť", "_%n folder_::_%n folders_" => array("%n priečinok","%n priečinky","%n priečinkov"), "_%n file_::_%n files_" => array("%n súbor","%n súbory","%n súborov"), +"{dirs} and {files}" => "{dirs} a {files}", "_Uploading %n file_::_Uploading %n files_" => array("Nahrávam %n súbor","Nahrávam %n súbory","Nahrávam %n súborov"), "'.' is an invalid file name." => "'.' je neplatné meno súboru.", "File name cannot be empty." => "Meno súboru nemôže byť prázdne", "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nesprávne meno, '\\', '/', '<', '>', ':', '\"', '|', '?' a '*' nie sú povolené hodnoty.", "Your storage is full, files can not be updated or synced anymore!" => "Vaše úložisko je plné. Súbory nemožno aktualizovať ani synchronizovať!", "Your storage is almost full ({usedSpacePercent}%)" => "Vaše úložisko je takmer plné ({usedSpacePercent}%)", +"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "Aplikácia na šifrovanie je zapnutá, ale vaše kľúče nie sú inicializované. Odhláste sa a znovu sa prihláste.", +"Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." => "Chybný súkromný kľúč na šifrovanie aplikácií. Zaktualizujte si heslo súkromného kľúča v svojom osobnom nastavení, aby ste znovu získali prístup k svojim zašifrovaným súborom.", "Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Šifrovanie bolo zakázané, ale vaše súbory sú stále zašifrované. Prosím, choďte do osobného nastavenia pre dešifrovanie súborov.", "Your download is being prepared. This might take some time if the files are big." => "Vaše sťahovanie sa pripravuje. Ak sú sťahované súbory veľké, môže to chvíľu trvať.", +"Error moving file" => "Chyba pri presúvaní súboru", "Name" => "Názov", "Size" => "Veľkosť", "Modified" => "Upravené", diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 32a59f1e1a6..2e88bf2dbb4 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -1,6 +1,6 @@
-
+
t('New'));?>
    @@ -42,14 +42,14 @@
-
0 or $_['ajaxLoad']):?>class="hidden">t('Nothing in here. Upload something!'))?>
+
class="hidden">t('Nothing in here. Upload something!'))?>
- - - +
+ class="hidden" id='headerName'>
@@ -65,8 +65,8 @@
t('Size')); ?> + class="hidden" id="headerSize">t('Size')); ?>class="hidden" id="headerDate"> t( 'Modified' )); ?> @@ -114,3 +114,5 @@ + + diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index d9a76becf25..6e2d360917b 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -555,4 +555,15 @@ class Hooks { } } + /** + * set the init status to 'NOT_INITIALIZED' (0) if the app gets enabled + * @param array $params contains the app ID + */ + public static function postEnable($params) { + if ($params['app'] === 'files_encryption') { + $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); + $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED); + } + } + } diff --git a/apps/files_encryption/l10n/gl.php b/apps/files_encryption/l10n/gl.php index 5a1d8ec750d..399761b0168 100644 --- a/apps/files_encryption/l10n/gl.php +++ b/apps/files_encryption/l10n/gl.php @@ -10,6 +10,8 @@ $TRANSLATIONS = array( "Could not update the private key password. Maybe the old password was not correct." => "Non foi posíbel actualizar o contrasinal da chave privada. É probábel que o contrasinal antigo non sexa correcto.", "Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Non se iniciou o aplicativo de cifrado! Quizais volva a activarse durante a sesión. Tente pechar a sesión e volver iniciala que tamén se inicie o aplicativo de cifrado.", "Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "A chave privada non é correcta! É probábel que o seu contrasinal teña sido cambiado desde o exterior (p.ex. o seu directorio corporativo). Vostede pode actualizar o contrasinal da súa chave privada nos seus axustes persoais para recuperar o acceso aos seus ficheiros", +"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Non foi posíbel descifrar o ficheiro, probabelmente tratase dun ficheiro compartido. Pidalle ao propietario do ficheiro que volva compartir o ficheiro con vostede.", +"Unknown error please check your system settings or contact your administrator" => "Produciuse un erro descoñecido. Comprobe os axustes do sistema ou póñase en contacto co administrador", "Missing requirements." => "Non se cumpren os requisitos.", "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Asegúrese de que está instalado o PHP 5.3.3 ou posterior e de o OpenSSL xunto coa extensión PHP estean activados e configurados correctamente. Polo de agora foi desactivado o aplicativo de cifrado.", "Following users are not set up for encryption:" => "Os seguintes usuarios non teñen configuración para o cifrado:", diff --git a/apps/files_encryption/l10n/it.php b/apps/files_encryption/l10n/it.php index c93afa15729..fa3a9e39782 100644 --- a/apps/files_encryption/l10n/it.php +++ b/apps/files_encryption/l10n/it.php @@ -8,7 +8,10 @@ $TRANSLATIONS = array( "Could not change the password. Maybe the old password was not correct." => "Impossibile cambiare la password. Forse la vecchia password non era corretta.", "Private key password successfully updated." => "Password della chiave privata aggiornata correttamente.", "Could not update the private key password. Maybe the old password was not correct." => "Impossibile aggiornare la password della chiave privata. Forse la vecchia password non era corretta.", +"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Applicazione di cifratura non inizializzata. Forse l'applicazione è stata riabilitata durante la tua sessione. Prova a disconnetterti e ad effettuare nuovamente l'accesso per inizializzarla.", "Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "La chiave privata non è valida! Forse la password è stata cambiata esternamente al sistema di ownCloud (ad es. la directory aziendale). Puoi aggiornare la password della chiave privata nelle impostazioni personali per ottenere nuovamente l'accesso ai file.", +"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Impossibile decifrare questo file, probabilmente è un file condiviso. Chiedi al proprietario del file di condividere nuovamente il file con te.", +"Unknown error please check your system settings or contact your administrator" => "Errore sconosciuto, controlla le impostazioni di sistema o contatta il tuo amministratore", "Missing requirements." => "Requisiti mancanti.", "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Assicurati che sia installato PHP 5.3.3 o versioni successive e che l'estensione OpenSSL di PHP sia abilitata e configurata correttamente. Per ora, l'applicazione di cifratura è disabilitata.", "Following users are not set up for encryption:" => "I seguenti utenti non sono configurati per la cifratura:", diff --git a/apps/files_encryption/l10n/ja_JP.php b/apps/files_encryption/l10n/ja_JP.php index fa536dca9b9..689fb78d074 100644 --- a/apps/files_encryption/l10n/ja_JP.php +++ b/apps/files_encryption/l10n/ja_JP.php @@ -8,20 +8,26 @@ $TRANSLATIONS = array( "Could not change the password. Maybe the old password was not correct." => "パスワードを変更できませんでした。古いパスワードが間違っているかもしれません。", "Private key password successfully updated." => "秘密鍵のパスワードが正常に更新されました。", "Could not update the private key password. Maybe the old password was not correct." => "秘密鍵のパスワードを更新できませんでした。古いパスワードが正確でない場合があります。", +"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "暗号化アプリが初期化されていません。暗号化アプリが接続中に再度有効かされた可能性があります。暗号化アプリを初期化する為に、1回ログアウトしてログインしなおしてください。", "Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "秘密鍵が有効ではありません。パスワードがownCloudシステムの外部(例えば、企業ディレクトリ)から変更された恐れがあります。個人設定で秘密鍵のパスワードを更新して、暗号化されたファイルを回復出来ます。", +"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "このファイルを復号化できません、共有ファイルの可能性があります。ファイルの所有者にお願いして、ファイルを共有しなおしてもらってください。", +"Unknown error please check your system settings or contact your administrator" => "不明なエラーです。システム設定を確認するか、管理者に問い合わせてください。", "Missing requirements." => "必要要件が満たされていません。", "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "必ず、PHP 5.3.3もしくはそれ以上をインストールし、同時にOpenSSLのPHP拡張を有効にした上でOpenSSLも同様にインストール、適切に設定してください。現時点では暗号化アプリは無効になっています。", "Following users are not set up for encryption:" => "以下のユーザーは、暗号化設定がされていません:", "Saving..." => "保存中...", +"Go directly to your " => "あなたのディレクトリへ", "personal settings" => "秘密鍵をアンロックできます", "Encryption" => "暗号化", "Enable recovery key (allow to recover users files in case of password loss):" => "復旧キーを有効化 (万一パスワードを亡くした場合もユーザーのファイルを回復できる):", "Recovery key password" => "復旧キーのパスワード", +"Repeat Recovery key password" => "復旧キーのパスワードをもう一度入力", "Enabled" => "有効", "Disabled" => "無効", "Change recovery key password:" => "復旧キーのパスワードを変更:", "Old Recovery key password" => "古い復旧キーのパスワード", "New Recovery key password" => "新しい復旧キーのパスワード", +"Repeat New Recovery key password" => "新しい復旧キーのパスワードをもう一度入力", "Change Password" => "パスワードを変更", "Your private key password no longer match your log-in password:" => "もはや秘密鍵はログインパスワードと一致しません:", "Set your old private key password to your current log-in password." => "古い秘密鍵のパスワードを現在のログインパスワードに設定する。", diff --git a/apps/files_encryption/l10n/nl.php b/apps/files_encryption/l10n/nl.php index 86d56e40315..5eed2bfe66a 100644 --- a/apps/files_encryption/l10n/nl.php +++ b/apps/files_encryption/l10n/nl.php @@ -10,6 +10,8 @@ $TRANSLATIONS = array( "Could not update the private key password. Maybe the old password was not correct." => "Kon het wachtwoord van de privésleutel niet wijzigen. Misschien was het oude wachtwoord onjuist.", "Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Crypto app niet geïnitialiseerd. Misschien werd de crypto app geheractiveerd tijdens de sessie. Log uit en log daarna opnieuw in om de crypto app te initialiseren.", "Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Uw privésleutel is niet geldig! Misschien was uw wachtwoord van buitenaf gewijzigd. U kunt het wachtwoord van uw privésleutel aanpassen in uw persoonlijke instellingen om toegang tot uw versleutelde bestanden te vergaren.", +"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Kan dit bestand niet ontcijferen, waarschijnlijk is het een gedeeld bestand, Vraag de eigenaar om het bestand opnieuw met u te delen.", +"Unknown error please check your system settings or contact your administrator" => "Onbekende fout, Controleer uw systeeminstellingen of neem contact op met uw systeembeheerder", "Missing requirements." => "Missende benodigdheden.", "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Wees er zeker van dat PHP5.3.3 of nieuwer is geïstalleerd en dat de OpenSSL PHP extensie is ingeschakeld en correct geconfigureerd. De versleutel-app is voorlopig uitgeschakeld.", "Following users are not set up for encryption:" => "De volgende gebruikers hebben geen configuratie voor encryptie:", diff --git a/apps/files_encryption/l10n/sv.php b/apps/files_encryption/l10n/sv.php index f806c3cc3e6..a3ffe18bfa2 100644 --- a/apps/files_encryption/l10n/sv.php +++ b/apps/files_encryption/l10n/sv.php @@ -10,6 +10,8 @@ $TRANSLATIONS = array( "Could not update the private key password. Maybe the old password was not correct." => "Kunde inte uppdatera lösenordet för den privata nyckeln. Kanske var det gamla lösenordet fel.", "Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Krypteringsprogrammet kunde inte initieras! Möjligen blev krypteringsprogrammet återaktiverad under din session. Försök med att logga ut och in igen för att initiera krypteringsprogrammet.", "Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Lösenordet för din privata nyckel är inte giltig! Troligen har ditt lösenord ändrats utanför ownCloud (t.ex. i företagets katalogtjänst). Du kan uppdatera lösenordet för den privata nyckeln under dina personliga inställningar för att återfå tillgång till dina filer.", +"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Kan ej dekryptera denna fil, förmodligen är det en delad fil. Be ägaren av filen att dela den med dig.", +"Unknown error please check your system settings or contact your administrator" => "Oväntat fel, kolla dina system inställningar eller kontakta din administratör", "Missing requirements." => "Krav som saknas", "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Kontrollera att PHP 5.3.3 eller senare är installerad och att tillägget OpenSSL PHP är aktiverad och korrekt konfigurerad. Kryptering är tillsvidare inaktiverad.", "Following users are not set up for encryption:" => "Följande användare har inte aktiverat kryptering:", diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index a754f9f28c4..91dd08ec08d 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -69,6 +69,7 @@ class Helper { public static function registerAppHooks() { \OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable'); + \OCP\Util::connectHook('OC_App', 'post_disable', 'OCA\Encryption\Hooks', 'postEnable'); } /** diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 53d58fbf40d..b9592a32cb2 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1278,7 +1278,7 @@ class Util { // If no record is found if (empty($migrationStatus)) { \OCP\Util::writeLog('Encryption library', "Could not get migration status for " . $this->userId . ", no record found", \OCP\Util::ERROR); - return false; + return self::MIGRATION_OPEN; // If a record is found } else { return (int)$migrationStatus[0]; diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index ffdcbf05109..bdaea64bb90 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -8,6 +8,7 @@ OC::$CLASSPATH['OC\Files\Cache\Shared_Permissions'] = 'files_sharing/lib/permiss OC::$CLASSPATH['OC\Files\Cache\Shared_Updater'] = 'files_sharing/lib/updater.php'; OC::$CLASSPATH['OC\Files\Cache\Shared_Watcher'] = 'files_sharing/lib/watcher.php'; OC::$CLASSPATH['OCA\Files\Share\Api'] = 'files_sharing/lib/api.php'; +OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php'; OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup'); OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); @@ -17,3 +18,4 @@ OCP\Util::addScript('files_sharing', 'share'); \OC_Hook::connect('OC_Filesystem', 'post_rename', '\OC\Files\Cache\Shared_Updater', 'renameHook'); \OC_Hook::connect('OCP\Share', 'post_shared', '\OC\Files\Cache\Shared_Updater', 'shareHook'); \OC_Hook::connect('OCP\Share', 'pre_unshare', '\OC\Files\Cache\Shared_Updater', 'shareHook'); +\OC_Hook::connect('OC_Appconfig', 'post_set_value', '\OCA\Files\Share\Maintainer', 'configChangeHook'); diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css index 3aa4a483041..3e1dec9bbe1 100644 --- a/apps/files_sharing/css/public.css +++ b/apps/files_sharing/css/public.css @@ -132,3 +132,14 @@ thead{ top: -2px; color: #555; } + +.directLink { + margin-bottom: 20px; +} + .directLink label { + font-weight: normal; + } + .directLink input { + margin-left: 10px; + width: 300px; + } diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 67320b1cdb6..eacd4096ed8 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -67,4 +67,6 @@ $(document).ready(function() { procesSelection(); }); + $('#directLink').focus(); + }); diff --git a/apps/files_sharing/l10n/pt_PT.php b/apps/files_sharing/l10n/pt_PT.php index 7fa1876aaac..ce513485497 100644 --- a/apps/files_sharing/l10n/pt_PT.php +++ b/apps/files_sharing/l10n/pt_PT.php @@ -1,5 +1,6 @@ "Esta partilha está protegida por palavra-chave", "The password is wrong. Try again." => "Password errada, por favor tente de novo", "Password" => "Password", "Sorry, this link doesn’t seem to work anymore." => "Desculpe, mas este link parece não estar a funcionar.", diff --git a/apps/files_sharing/l10n/ru_RU.php b/apps/files_sharing/l10n/ru_RU.php new file mode 100644 index 00000000000..2686b1e852d --- /dev/null +++ b/apps/files_sharing/l10n/ru_RU.php @@ -0,0 +1,8 @@ + "Пароль", +"Download" => "Загрузка", +"Upload" => "Загрузка", +"Cancel upload" => "Отмена загрузки" +); +$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"; diff --git a/apps/files_sharing/l10n/sv.php b/apps/files_sharing/l10n/sv.php index 23bf17aba45..64e8a389429 100644 --- a/apps/files_sharing/l10n/sv.php +++ b/apps/files_sharing/l10n/sv.php @@ -1,5 +1,6 @@ "Den här delningen är lösenordsskyddad", "The password is wrong. Try again." => "Lösenordet är fel. Försök igen.", "Password" => "Lösenord", "Sorry, this link doesn’t seem to work anymore." => "Tyvärr, denna länk verkar inte fungera längre.", diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php index bd9beddf063..84e90c71681 100644 --- a/apps/files_sharing/lib/api.php +++ b/apps/files_sharing/lib/api.php @@ -36,10 +36,17 @@ class Api { $params['itemSource'] = self::getFileId($_GET['path']); $params['path'] = $_GET['path']; $params['itemType'] = self::getItemType($_GET['path']); - if (isset($_GET['subfiles']) && $_GET['subfiles'] === 'true') { + + if ( isset($_GET['reshares']) && $_GET['reshares'] !== 'false' ) { + $params['reshares'] = true; + } else { + $params['reshares'] = false; + } + + if (isset($_GET['subfiles']) && $_GET['subfiles'] !== 'false') { return self::getSharesFromFolder($params); } - return self::getShare($params); + return self::collectShares($params); } $share = \OCP\Share::getItemShared('file', null); @@ -59,34 +66,49 @@ class Api { * @return \OC_OCS_Result share information */ public static function getShare($params) { - // either the $params already contains a itemSource if we come from - // getAllShare() or we need to translate the shareID to a itemSource - if(isset($params['itemSource'])) { - $itemSource = $params['itemSource']; - $itemType = $params['itemType']; - $getSpecificShare = true; - } else { - $s = self::getShareFromId($params['id']); - $itemSource = $s['item_source']; - $itemType = $s['item_type']; - $getSpecificShare = false; - } + + $s = self::getShareFromId($params['id']); + $params['itemSource'] = $s['item_source']; + $params['itemType'] = $s['item_type']; + $params['specificShare'] = true; + + return self::collectShares($params); + } + + /** + * @brief collect all share information, either of a specific share or all + * shares for a given path + * @param array $params + * @return \OC_OCS_Result + */ + private static function collectShares($params) { + + $itemSource = $params['itemSource']; + $itemType = $params['itemType']; + $getSpecificShare = isset($params['specificShare']) ? $params['specificShare'] : false; if ($itemSource !== null) { $shares = \OCP\Share::getItemShared($itemType, $itemSource); - $reshare = \OCP\Share::getItemSharedWithBySource($itemType, $itemSource); + $receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $itemSource); // if a specific share was specified only return this one - if ($getSpecificShare === false) { + if ($getSpecificShare === true) { foreach ($shares as $share) { - if ($share['id'] === (int)$params['id']) { + if ($share['id'] === (int) $params['id']) { $shares = array('element' => $share); break; } } } - if ($reshare) { - $shares['received_from'] = $reshare['uid_owner']; - $shares['received_from_displayname'] = \OCP\User::getDisplayName($reshare['uid_owner']); + + // include also reshares in the lists. This means that the result + // will contain every user with access to the file. + if (isset($params['reshares']) && $params['reshares'] === true) { + $shares = self::addReshares($shares, $itemSource); + } + + if ($receivedFrom) { + $shares['received_from'] = $receivedFrom['uid_owner']; + $shares['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']); } } else { $shares = null; @@ -99,6 +121,37 @@ class Api { } } + /** + * @brief add reshares to a array of shares + * @param array $shares array of shares + * @param int $itemSource item source ID + * @return array new shares array which includes reshares + */ + private static function addReshares($shares, $itemSource) { + + // if there are no shares than there are also no reshares + $firstShare = reset($shares); + if ($firstShare) { + $path = $firstShare['path']; + } else { + return $shares; + } + + $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `file_source`, `path` , `permissions`, `stime`, `expiration`, `token`, `storage`, `mail_send`, `mail_send`'; + $getReshares = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` INNER JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE `*PREFIX*share`.`file_source` = ? AND `*PREFIX*share`.`item_type` IN (\'file\', \'folder\') AND `uid_owner` != ?'); + $reshares = $getReshares->execute(array($itemSource, \OCP\User::getUser()))->fetchAll(); + + foreach ($reshares as $key => $reshare) { + if (isset($reshare['share_with']) && $reshare['share_with'] !== '') { + $reshares[$key]['share_with_displayname'] = \OCP\User::getDisplayName($reshare['share_with']); + } + // add correct path to the result + $reshares[$key]['path'] = $path; + } + + return array_merge($shares, $reshares); + } + /** * @brief get share from all files in a given folder (non-recursive) * @param array $params contains 'path' to the folder @@ -119,10 +172,10 @@ class Api { // workaround because folders are named 'dir' in this context $itemType = $file['type'] === 'file' ? 'file' : 'folder'; $share = \OCP\Share::getItemShared($itemType, $file['fileid']); - $reshare = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']); - if ($reshare) { - $share['received_from'] = $reshare['uid_owner']; - $share['received_from_displayname'] = \OCP\User::getDisplayName($reshare['uid_owner']); + $receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']); + if ($receivedFrom) { + $share['received_from'] = $receivedFrom['uid_owner']; + $share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']); } if ($share) { $share['filename'] = $file['name']; diff --git a/apps/files_sharing/lib/maintainer.php b/apps/files_sharing/lib/maintainer.php new file mode 100644 index 00000000000..bbb3268410e --- /dev/null +++ b/apps/files_sharing/lib/maintainer.php @@ -0,0 +1,44 @@ +. + */ + +namespace OCA\Files\Share; + +/** + * Maintains stuff around the sharing functionality + * + * for example: on disable of "allow links" it removes all link shares + */ + +class Maintainer { + + /** + * Keeps track of the "allow links" config setting + * and removes all link shares if the config option is set to "no" + * + * @param array with app, key, value as named values + */ + static public function configChangeHook($params) { + if($params['app'] === 'core' && $params['key'] === 'shareapi_allow_links' && $params['value'] === 'no') { + \OCP\Share::removeAllLinkShares(); + } + } + +} diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 5d935f645e6..ef4c1c433da 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -15,10 +15,10 @@
t('%s shared the folder %s with you', - array($_['displayName'], $_['fileTarget']))) ?> + array($_['displayName'], $_['filename']))) ?> t('%s shared the file %s with you', - array($_['displayName'], $_['fileTarget']))) ?> + array($_['displayName'], $_['filename']))) ?> @@ -88,13 +88,14 @@
  • - t('No preview available for').' '.$_['fileTarget']); ?>
    + t('No preview available for').' '.$_['filename']); ?>
    Download" />t('Download'))?>
+