mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
python: add mentions
This commit is contained in:
@ -54,3 +54,13 @@ def getUserFromReq(req):
|
|||||||
return user
|
return user
|
||||||
|
|
||||||
return DEFAULT_USER
|
return DEFAULT_USER
|
||||||
|
|
||||||
|
# get users data for mentions
|
||||||
|
def getUsersForMentions(req):
|
||||||
|
uid = req.COOKIES.get('uid')
|
||||||
|
usersData = []
|
||||||
|
|
||||||
|
for user in USERS:
|
||||||
|
if(user.id != uid and user.name != None and user.email != None):
|
||||||
|
usersData.append({'name':user.name, 'email':user.email})
|
||||||
|
return usersData
|
||||||
|
|||||||
@ -238,7 +238,8 @@ def edit(request):
|
|||||||
'apiUrl': config.DOC_SERV_SITE_URL + config.DOC_SERV_API_URL, # the absolute URL to the api
|
'apiUrl': config.DOC_SERV_SITE_URL + config.DOC_SERV_API_URL, # the absolute URL to the api
|
||||||
'dataInsertImage': json.dumps(dataInsertImage)[1 : len(json.dumps(dataInsertImage)) - 1], # the image which will be inserted into the document
|
'dataInsertImage': json.dumps(dataInsertImage)[1 : len(json.dumps(dataInsertImage)) - 1], # the image which will be inserted into the document
|
||||||
'dataCompareFile': dataCompareFile, # document which will be compared with the current document
|
'dataCompareFile': dataCompareFile, # document which will be compared with the current document
|
||||||
'dataMailMergeRecipients': json.dumps(dataMailMergeRecipients) # recipient data for mail merging
|
'dataMailMergeRecipients': json.dumps(dataMailMergeRecipients), # recipient data for mail merging
|
||||||
|
'users': json.dumps(users.getUsersForMentions(request))
|
||||||
}
|
}
|
||||||
return render(request, 'editor.html', context) # execute the "editor.html" template with context data
|
return render(request, 'editor.html', context) # execute the "editor.html" template with context data
|
||||||
|
|
||||||
|
|||||||
@ -134,6 +134,19 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onRequestUsers = function () {
|
||||||
|
docEditor.setUsers({
|
||||||
|
"users": {{ users | safe }}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var onRequestSendNotify = function (event) {
|
||||||
|
var actionLink = JSON.stringify(event.data.actionLink);
|
||||||
|
console.log("onRequestSendNotify:");
|
||||||
|
console.log(event.data);
|
||||||
|
console.log("Link to comment: " + replaceActionLink(location.href, actionLink));
|
||||||
|
};
|
||||||
|
|
||||||
var connectEditor = function () {
|
var connectEditor = function () {
|
||||||
|
|
||||||
config = {{ cfg | safe }}
|
config = {{ cfg | safe }}
|
||||||
@ -150,6 +163,8 @@
|
|||||||
'onRequestInsertImage': onRequestInsertImage,
|
'onRequestInsertImage': onRequestInsertImage,
|
||||||
'onRequestCompareFile': onRequestCompareFile,
|
'onRequestCompareFile': onRequestCompareFile,
|
||||||
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
|
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
|
||||||
|
"onRequestUsers": onRequestUsers,
|
||||||
|
"onRequestSendNotify": onRequestSendNotify,
|
||||||
};
|
};
|
||||||
|
|
||||||
{% if history and historyData %}
|
{% if history and historyData %}
|
||||||
|
|||||||
Reference in New Issue
Block a user