From 6ea6e35d549984d64f625cb5ad70fa654a17c320 Mon Sep 17 00:00:00 2001 From: Alexandr Fedorov Date: Fri, 16 Apr 2021 16:07:50 +0300 Subject: [PATCH] python: edit link only for editable format --- .../python/src/utils/docManager.py | 2 +- .../python/templates/index.html | 79 ++++++++++--------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/web/documentserver-example/python/src/utils/docManager.py b/web/documentserver-example/python/src/utils/docManager.py index 012ed077..a63cb980 100644 --- a/web/documentserver-example/python/src/utils/docManager.py +++ b/web/documentserver-example/python/src/utils/docManager.py @@ -173,7 +173,7 @@ def getStoredFiles(req): for f in files: if os.path.isfile(os.path.join(directory, f)): - fileInfos.append({ 'type': fileUtils.getFileType(f), 'title': f, 'url': getFileUri(f, True, req) }) + fileInfos.append({ 'type': fileUtils.getFileType(f), 'title': f, 'url': getFileUri(f, True, req), 'canEdit': isCanEdit(fileUtils.getFileExt(f))}) return fileInfos diff --git a/web/documentserver-example/python/templates/index.html b/web/documentserver-example/python/templates/index.html index 8a812c0d..65a793aa 100644 --- a/web/documentserver-example/python/templates/index.html +++ b/web/documentserver-example/python/templates/index.html @@ -137,47 +137,50 @@ {{ file.title }} - - - Open in editor for full size screens - - - - - Open in editor for mobile devices - - - - {% if file.type == 'word' %} - - Open in editor for review + {% if file.canEdit %} + + + Open in editor for full size screens - {% elif file.type == 'cell' %} - - Open in editor without access to change the filter + + + + Open in editor for mobile devices - {% endif %} - - - - Open in editor for comment - - - - {% if file.type == 'word' %} - - Open in editor for filling in forms + + + {% if file.type == 'word' %} + + Open in editor for review + + {% elif file.type == 'cell' %} + + Open in editor without access to change the filter + + {% endif %} + + + + Open in editor for comment - {% endif %} - - - {% if file.type == 'word' %} - - Open in editor without content control modification - - {% endif %} - - + + + {% if file.type == 'word' %} + + Open in editor for filling in forms + + {% endif %} + + + {% if file.type == 'word' %} + + Open in editor without content control modification + + {% endif %} + + {% else %} + + {% endif %} Open in viewer for full size screens