From a683aebf683343c644c15f3f1268c097b3011254 Mon Sep 17 00:00:00 2001 From: Konstantin Myakshin Date: Fri, 17 Nov 2023 18:53:59 +0200 Subject: [PATCH] Added option to disable EditLocally menu option Signed-off-by: Konstantin Myakshin --- apps/files/lib/Controller/ViewController.php | 3 ++- apps/files/src/actions/editLocallyAction.ts | 4 ++++ apps/files/templates/index.php | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 38e3858cd3846..4be5c0a0b63bf 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -280,7 +280,8 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal $this->initialState->provideInitialState('templates', $this->templateManager->listCreators()); $params = [ - 'fileNotFound' => $fileNotFound ? 1 : 0 + 'fileNotFound' => $fileNotFound ? 1 : 0, + 'disableEditLocally' => $this->config->getSystemValueString('disable_edit_locally', 0), ]; $response = new TemplateResponse( diff --git a/apps/files/src/actions/editLocallyAction.ts b/apps/files/src/actions/editLocallyAction.ts index f52f8191df87e..57593b8c72d72 100644 --- a/apps/files/src/actions/editLocallyAction.ts +++ b/apps/files/src/actions/editLocallyAction.ts @@ -51,6 +51,10 @@ export const action = new FileAction({ // Only works on single files enabled(nodes: Node[]) { + if ($('#disableEditLocally').val() === "1") { + return false + } + // Only works on single node if (nodes.length !== 1) { return false diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index c974a37aa5bcd..4694d025993f0 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -7,3 +7,4 @@ +