mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
python: saving formsdata
This commit is contained in:
@ -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):
|
||||
|
||||
@ -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 don’t belong to any group"
|
||||
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||
"Can’t submit forms"
|
||||
]
|
||||
|
||||
descr_user_3 = [
|
||||
@ -64,7 +66,8 @@ descr_user_3 = [
|
||||
"Can’t download the file",
|
||||
"Can’t print the file",
|
||||
"Can create new files from the editor",
|
||||
"Can see the information about Group2 users"
|
||||
"Can see the information about Group2 users",
|
||||
"Can’t submit forms"
|
||||
]
|
||||
|
||||
descr_user_0 = [
|
||||
@ -80,6 +83,7 @@ descr_user_0 = [
|
||||
"Can't view chat",
|
||||
"Can't protect file",
|
||||
"View file without collaboration",
|
||||
"Can’t submit forms"
|
||||
]
|
||||
|
||||
USERS = [
|
||||
|
||||
@ -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']
|
||||
|
||||
Reference in New Issue
Block a user