Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 372cf7e

Browse files
committed
Add a canWrite attribute on editors declaration, use it in ShareDialog to detect if a file has "writeable" editors and show an additional Edit permission for public links on files.
1 parent 7bff85f commit 372cf7e

File tree

20 files changed

+55
-27
lines changed

20 files changed

+55
-27
lines changed

core/src/plugins/action.share/class.ShareCenter.php

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -907,29 +907,35 @@ public function nodeSharedMetadata(&$ajxpNode)
907907
*/
908908
public function updateNodeSharedData($oldNode=null, $newNode=null, $copy = false){
909909

910-
if($oldNode != null && !$copy){
911-
$this->logDebug("Should update node");
910+
if($oldNode == null || $copy){
911+
// Create or copy, do nothing
912+
return;
913+
}
914+
if($oldNode != null && $newNode != null && $oldNode->getUrl() == $newNode->getUrl()){
915+
// Same path => must be a content update, do nothing
916+
return;
917+
}
912918

913-
$delete = false;
914-
if($newNode == null) {
919+
$this->logDebug("Should update node");
920+
$delete = false;
921+
if($newNode == null) {
922+
$delete = true;
923+
}else{
924+
$repo = $newNode->getRepository();
925+
$recycle = $repo->getOption("RECYCLE_BIN");
926+
if(!empty($recycle) && strpos($newNode->getPath(), $recycle) === 1){
915927
$delete = true;
916-
}else{
917-
$repo = $newNode->getRepository();
918-
$recycle = $repo->getOption("RECYCLE_BIN");
919-
if(!empty($recycle) && strpos($newNode->getPath(), $recycle) === 1){
920-
$delete = true;
921-
}
922-
}
923-
$shareStore = $this->getShareStore();
924-
$modifiedNodes = $shareStore->moveSharesFromMetaRecursive($oldNode, $delete, $oldNode->getPath(), ($newNode != null ? $newNode->getPath() : null));
925-
// Force switching back to correct driver!
926-
if($modifiedNodes > 0){
927-
$oldNode->getRepository()->driverInstance = null;
928-
$oldNode->setDriver(null);
929-
$oldNode->getDriver();
930928
}
931-
return;
932929
}
930+
$shareStore = $this->getShareStore();
931+
$modifiedNodes = $shareStore->moveSharesFromMetaRecursive($oldNode, $delete, $oldNode->getPath(), ($newNode != null ? $newNode->getPath() : null));
932+
// Force switching back to correct driver!
933+
if($modifiedNodes > 0){
934+
$oldNode->getRepository()->driverInstance = null;
935+
$oldNode->setDriver(null);
936+
$oldNode->getDriver();
937+
}
938+
return;
933939

934940
}
935941

core/src/plugins/action.share/res/i18n/ca.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"72" => "Cercar i previsualitzar",
8383
"73" => "Descarregar",
8484
"74" => "Carregar fitxers",
85+
"74b"=>"Edit",
8586
"75" => "Per favor emprau un nombre positiu tant per la caducitat com per el límit de descàrrega.",
8687
"76" => "Per favor habilitau les Cookies per a accedir a aquesta aplicació",
8788
"77" => "Per favor habilitau JavaScript per a accedir a aquesta aplicació",

core/src/plugins/action.share/res/i18n/de.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"72" => "Ansehen",
8484
"73" => "Herunterladen",
8585
"74" => "Hochladen",
86+
"74b"=>"Edit",
8687
"75"=> "Bitte verwenden Sie eine positive Zahl für die Verfall- und Downloadbegrenzung.",
8788
"76"=> "Bitte Cookies aktivieren um auf diese Anwendung zuzugreifen",
8889
"77"=> "Bitte JavaScript aktivieren um auf diese Anwendung zuzugreifen",

core/src/plugins/action.share/res/i18n/en.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"72"=> "Preview",
8484
"73"=> "Download",
8585
"74"=> "Upload files",
86+
"74b"=>"Edit",
8687
"75"=> "Please use a positive number for both Expiration and Download limit fields.",
8788
"76"=> "Please enable Cookies to access this application",
8889
"77"=> "Please enable JavaScript to access this application",

core/src/plugins/action.share/res/i18n/es.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"72"=> "Previsualizar",
8181
"73"=> "Descargar",
8282
"74"=> "Cargar",
83+
"74b"=>"Edit",
8384
"75"=> "Por favor use un número positivo para Caducidad y Límite de Descargas.",
8485
"76"=> "Por favor, habilite las cookies para acceder a esta aplicación",
8586
"77"=> "Por favor, habilite JavaScript para acceder a esta aplicación",

core/src/plugins/action.share/res/i18n/fr.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"72"=> "Prévisualiser",
8383
"73"=> "Télécharger",
8484
"74"=> "Envoyer",
85+
"74b"=>"Editer",
8586
"75"=> "Veuillez utiliser des entiers positifs pour les champs Expiration et Nombre de téléchargements !",
8687
"76"=> "Merci d'activer les cookies pour accéder à cette application",
8788
"77"=> "Merci d'activer JavaScript pour accéder à cette application",

core/src/plugins/action.share/res/i18n/it.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"72"=> "Sfoglia & Anteprima",
8282
"73"=> "Download",
8383
"74"=> "Upload file",
84+
"74b"=>"Edit",
8485
"75"=> "Usare un numero positivo sia per la Scadenza che per il limite di Download.",
8586
"76"=> "Abilitare i Cookies per accedere a questa applicazione",
8687
"77"=> "Abilitare JavScript per accedere a questa applicazione",

core/src/plugins/action.share/res/i18n/pt.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"72"=> "Navegar & Pré-Visualização",
8181
"73"=> "Transferir",
8282
"74"=> "Enviar ficheiros",
83+
"74b"=>"Edit",
8384
"75"=> "Por favor utilize um número positivo tanto para o campo Validade como para o Limite Máximo de Transferências.",
8485
"76"=> "Por favor active as cookies no seu Navegador para poder aceder a esta aplicação",
8586
"77"=> "Por favor active o Javascript no seu Navegador para aceder a esta aplicação",

core/src/plugins/action.share/res/i18n/ru.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"72"=> "Предпросмотр",
8484
"73"=> "Скачивание",
8585
"74"=> "Загрузка файлов",
86+
"74b"=>"Edit",
8687
"75"=> "Используйте положительные значения для срока окончания и количества скачиваний.",
8788
"76"=> "Включите куки для работы с программой",
8889
"77"=> "Включите JavaScript для работы с программой",

core/src/plugins/action.share/res/react/ShareDialog.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,11 @@
997997
NAME:'write',
998998
LABEL:this.context.getMessage('74')
999999
});
1000+
}else if(this.props.shareModel.fileHasWriteableEditors()){
1001+
perms.push({
1002+
NAME:'write',
1003+
LABEL:this.context.getMessage('74b')
1004+
});
10001005
}
10011006
if(this.props.shareModel.isPublicLinkPreviewDisabled() && this.props.shareModel.getPublicLinkPermission(linkId, 'read')){
10021007
previewWarning = <div>{this.context.getMessage('195')}</div>;

0 commit comments

Comments
 (0)