python: saving formsdata

This commit is contained in:
ZEROM22
2023-11-13 09:29:11 +03:00
parent 1d65ec61ea
commit 6207d03984
3 changed files with 24 additions and 5 deletions

View File

@ -159,12 +159,27 @@ def processForceSave(body, filename, usAddr):
if forcesavePath == "":
forcesavePath = docManager.getForcesavePath(filename, usAddr, True)
docManager.saveFile(download, forcesavePath) # save document file
docManager.saveFile(data, forcesavePath) # save document file
if isSubmitForm:
uid = body['actions'][0]['userid'] # get the user id
historyManager.createMetaData(filename, uid, "Filling Form", usAddr) # create meta data for forcesaved file
forms_data_url = body.get('formsdataurl')
if forms_data_url:
data_name = docManager.getCorrectName(fileUtils.getFileNameWithoutExt(filename) + ".txt", usAddr)
data_path = docManager.getStoragePath(data_name, usAddr)
forms_data = docManager.downloadFileFromUri(forms_data_url);
if data is None:
raise Exception("Document editing service didn't return forms_data");
else:
with open(data_path, 'w') as file:
file.write(forms_data.text)
else:
raise Exception('Document editing service did not return forms_data_url')
# create a command request
def commandRequest(method, key, meta=None):

View File

@ -42,7 +42,8 @@ descr_user_1 = [
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users"
"Can see the information about all users",
"Can submit forms"
]
descr_user_2 = [
@ -52,7 +53,8 @@ descr_user_2 = [
"Can remove his own comments only"),
"This file is marked as favorite",
"Can create new files from the editor",
"Can see the information about users from Group2 and users who dont belong to any group"
"Can see the information about users from Group2 and users who dont belong to any group",
"Cant submit forms"
]
descr_user_3 = [
@ -64,7 +66,8 @@ descr_user_3 = [
"Cant download the file",
"Cant print the file",
"Can create new files from the editor",
"Can see the information about Group2 users"
"Can see the information about Group2 users",
"Cant submit forms"
]
descr_user_0 = [
@ -80,6 +83,7 @@ descr_user_0 = [
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Cant submit forms"
]
USERS = [

View File

@ -200,7 +200,7 @@ def edit(request):
edMode = 'fillForms'
canEdit = True
# if the Submit form button is displayed or hidden
submitForm = edMode == 'fillForms' and user.id == 'uid-1' and False
submitForm = edMode == 'fillForms' and user.id == 'uid-1'
mode = 'edit' if canEdit & (edMode != 'view') else 'view' # if the file can't be edited, the mode is view
types = ['desktop', 'mobile', 'embedded']