diff --git a/web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx b/web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx index f07a8270..4b0611a1 100644 --- a/web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx +++ b/web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx @@ -197,29 +197,29 @@ <% string hist, histData; %> <% Model.GetHistory(out hist, out histData); %> - <% if (!string.IsNullOrEmpty(hist) && !string.IsNullOrEmpty(histData)) - { %> - // the user is trying to show the document version history - config.events['onRequestHistory'] = function () { - docEditor.refreshHistory(<%= hist %>); // show the document version history - }; - // the user is trying to click the specific document version in the document version history - config.events['onRequestHistoryData'] = function (event) { - var ver = event.data; - var histData = <%= histData %>; - docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history - }; - // the user is trying to go back to the document from viewing the document version history - config.events['onRequestHistoryClose '] = function () { - document.location.reload(); - }; - <% } %> <% string usersForMentions; %> <% Model.GetUsersMentions(Request, out usersForMentions); %> <% if (!string.IsNullOrEmpty(usersForMentions)) // add mentions for not anonymous users { %> + <% if (!string.IsNullOrEmpty(hist) && !string.IsNullOrEmpty(histData)) + { %> + // the user is trying to show the document version history + config.events['onRequestHistory'] = function () { + docEditor.refreshHistory(<%= hist %>); // show the document version history + }; + // the user is trying to click the specific document version in the document version history + config.events['onRequestHistoryData'] = function (event) { + var ver = event.data; + var histData = <%= histData %>; + docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history + }; + // the user is trying to go back to the document from viewing the document version history + config.events['onRequestHistoryClose '] = function () { + document.location.reload(); + }; + <% } %> config.events['onRequestUsers'] = function () { docEditor.setUsers({ // set a list of users to mention in the comments "users": <%= usersForMentions%> diff --git a/web/documentserver-example/csharp/DocEditor.aspx b/web/documentserver-example/csharp/DocEditor.aspx index 24e8bc5b..d34b0bca 100644 --- a/web/documentserver-example/csharp/DocEditor.aspx +++ b/web/documentserver-example/csharp/DocEditor.aspx @@ -207,23 +207,22 @@ "onRequestMailMergeRecipients": onRequestMailMergeRecipients, }; - <% if (!string.IsNullOrEmpty(History) && !string.IsNullOrEmpty(HistoryData)) - { %> - config.events['onRequestHistory'] = function () { // the user is trying to show the document version history - docEditor.refreshHistory(<%= History %>); // show the document version history - }; - config.events['onRequestHistoryData'] = function (event) { // the user is trying to click the specific document version in the document version history - var ver = event.data; - var histData = <%= HistoryData %>; - docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history - }; - config.events['onRequestHistoryClose '] = function () { // the user is trying to go back to the document from viewing the document version history - document.location.reload(); - }; - <% } %> - <% if (!string.IsNullOrEmpty(UsersForMentions)) { %> + <% if (!string.IsNullOrEmpty(History) && !string.IsNullOrEmpty(HistoryData)) + { %> + config.events['onRequestHistory'] = function () { // the user is trying to show the document version history + docEditor.refreshHistory(<%= History %>); // show the document version history + }; + config.events['onRequestHistoryData'] = function (event) { // the user is trying to click the specific document version in the document version history + var ver = event.data; + var histData = <%= HistoryData %>; + docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history + }; + config.events['onRequestHistoryClose '] = function () { // the user is trying to go back to the document from viewing the document version history + document.location.reload(); + }; + <% } %> // add mentions for not anonymous users config.events['onRequestUsers'] = function () { docEditor.setUsers({ // set a list of users to mention in the comments diff --git a/web/documentserver-example/java-spring/src/main/resources/templates/editor.html b/web/documentserver-example/java-spring/src/main/resources/templates/editor.html index 7a92b27c..702e6263 100755 --- a/web/documentserver-example/java-spring/src/main/resources/templates/editor.html +++ b/web/documentserver-example/java-spring/src/main/resources/templates/editor.html @@ -179,24 +179,23 @@ var historyData = histArray[1]; var usersForMentions = [[${usersForMentions}]]; - if (hist && historyData) { - // the user is trying to show the document version history - config.events['onRequestHistory'] = function () { - docEditor.refreshHistory(JSON.parse(hist)); // show the document version history - }; - // the user is trying to click the specific document version in the document version history - config.events['onRequestHistoryData'] = function (event) { - var ver = event.data; - var histData = historyData; - docEditor.setHistoryData(JSON.parse(histData)[ver - 1]); // send the link to the document for viewing the version history - }; - // the user is trying to go back to the document from viewing the document version history - config.events['onRequestHistoryClose'] = function () { - document.location.reload(); - }; - } - - if(usersForMentions){ + if(usersForMentions.length > 0){ + if (hist && historyData) { + // the user is trying to show the document version history + config.events['onRequestHistory'] = function () { + docEditor.refreshHistory(JSON.parse(hist)); // show the document version history + }; + // the user is trying to click the specific document version in the document version history + config.events['onRequestHistoryData'] = function (event) { + var ver = event.data; + var histData = historyData; + docEditor.setHistoryData(JSON.parse(histData)[ver - 1]); // send the link to the document for viewing the version history + }; + // the user is trying to go back to the document from viewing the document version history + config.events['onRequestHistoryClose'] = function () { + document.location.reload(); + }; + } // add mentions for not anonymous users config.events['onRequestUsers'] = function () { docEditor.setUsers({ // set a list of users to mention in the comments diff --git a/web/documentserver-example/java/src/main/webapp/editor.jsp b/web/documentserver-example/java/src/main/webapp/editor.jsp index 61169af2..e625b42d 100644 --- a/web/documentserver-example/java/src/main/webapp/editor.jsp +++ b/web/documentserver-example/java/src/main/webapp/editor.jsp @@ -183,24 +183,23 @@ String usersForMentions = (String) request.getAttribute("usersForMentions"); %> - <% if (!history.isEmpty() && !historyData.isEmpty()) { %> - // the user is trying to show the document version history - config.events['onRequestHistory'] = function () { - docEditor.refreshHistory(<%= history %>); // show the document version history - }; - // the user is trying to click the specific document version in the document version history - config.events['onRequestHistoryData'] = function (event) { - var ver = event.data; - var histData = <%= historyData %>; - docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history - }; - // the user is trying to go back to the document from viewing the document version history - config.events['onRequestHistoryClose'] = function () { - document.location.reload(); - }; - <% } %> - <% if (usersForMentions != null) { %> + <% if (!history.isEmpty() && !historyData.isEmpty()) { %> + // the user is trying to show the document version history + config.events['onRequestHistory'] = function () { + docEditor.refreshHistory(<%= history %>); // show the document version history + }; + // the user is trying to click the specific document version in the document version history + config.events['onRequestHistoryData'] = function (event) { + var ver = event.data; + var histData = <%= historyData %>; + docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history + }; + // the user is trying to go back to the document from viewing the document version history + config.events['onRequestHistoryClose'] = function () { + document.location.reload(); + }; + <% } %> // add mentions for not anonymous users config.events['onRequestUsers'] = function () { docEditor.setUsers({ // set a list of users to mention in the comments diff --git a/web/documentserver-example/nodejs/views/editor.ejs b/web/documentserver-example/nodejs/views/editor.ejs index 8fdc9f4a..f64de8e8 100644 --- a/web/documentserver-example/nodejs/views/editor.ejs +++ b/web/documentserver-example/nodejs/views/editor.ejs @@ -191,9 +191,6 @@ "onDocumentStateChange": onDocumentStateChange, "onRequestEditRights": onRequestEditRights, "onError": onError, - "onRequestHistory": onRequestHistory, - "onRequestHistoryData": onRequestHistoryData, - "onRequestHistoryClose": onRequestHistoryClose, "onOutdatedVersion": onOutdatedVersion, "onMakeActionLink": onMakeActionLink, "onMetaChange": onMetaChange, @@ -204,6 +201,9 @@ }; if (<%- JSON.stringify(usersForMentions) %> != null) { + config.events.onRequestHistory = onRequestHistory; + config.events.onRequestHistoryData = onRequestHistoryData; + config.events.onRequestHistoryClose = onRequestHistoryClose; config.events.onRequestUsers = onRequestUsers; config.events.onRequestSendNotify = onRequestSendNotify; config.events.onRequestRename = onRequestRename; diff --git a/web/documentserver-example/php/doceditor.php b/web/documentserver-example/php/doceditor.php index 585139eb..51373723 100755 --- a/web/documentserver-example/php/doceditor.php +++ b/web/documentserver-example/php/doceditor.php @@ -516,24 +516,24 @@ $history = $out[0]; $historyData = $out[1]; ?> - - // the user is trying to show the document version history - config.events['onRequestHistory'] = function () { - docEditor.refreshHistory(); // show the document version history - }; - // the user is trying to click the specific document version in the document version history - config.events['onRequestHistoryData'] = function (event) { - var ver = event.data; - var histData = ; - docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history - }; - // the user is trying to go back to the document from viewing the document version history - config.events['onRequestHistoryClose'] = function () { - document.location.reload(); - }; - + + // the user is trying to show the document version history + config.events['onRequestHistory'] = function () { + docEditor.refreshHistory(); // show the document version history + }; + // the user is trying to click the specific document version in the document version history + config.events['onRequestHistoryData'] = function (event) { + var ver = event.data; + var histData = ; + docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history + }; + // the user is trying to go back to the document from viewing the document version history + config.events['onRequestHistoryClose'] = function () { + document.location.reload(); + }; + // add mentions for not anonymous users config.events['onRequestUsers'] = function () { docEditor.setUsers({ // set a list of users to mention in the comments diff --git a/web/documentserver-example/python/templates/editor.html b/web/documentserver-example/python/templates/editor.html index aa7569f2..5d0489bd 100644 --- a/web/documentserver-example/python/templates/editor.html +++ b/web/documentserver-example/python/templates/editor.html @@ -193,26 +193,28 @@ "onRequestMailMergeRecipients": onRequestMailMergeRecipients, }; - {% if history and historyData %} - - // the user is trying to show the document version history - config.events['onRequestHistory'] = function () { - docEditor.refreshHistory({{ history | safe }}); // show the document version history - }; - // the user is trying to click the specific document version in the document version history - config.events['onRequestHistoryData'] = function (event) { - var ver = event.data; - var histData = {{ historyData | safe }}; - docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history - }; - // the user is trying to go back to the document from viewing the document version history - config.events['onRequestHistoryClose'] = function () { - document.location.reload(); - }; - - {% endif %} + {% if usersForMentions %} + + {% if history and historyData %} + + // the user is trying to show the document version history + config.events['onRequestHistory'] = function () { + docEditor.refreshHistory({{ history | safe }}); // show the document version history + }; + // the user is trying to click the specific document version in the document version history + config.events['onRequestHistoryData'] = function (event) { + var ver = event.data; + var histData = {{ historyData | safe }}; + docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history + }; + // the user is trying to go back to the document from viewing the document version history + config.events['onRequestHistoryClose'] = function () { + document.location.reload(); + }; + + {% endif %} // add mentions for not anonymous users config.events['onRequestUsers'] = function () { diff --git a/web/documentserver-example/ruby/app/views/home/editor.html.erb b/web/documentserver-example/ruby/app/views/home/editor.html.erb index 5dea4dc4..6b97dc9b 100644 --- a/web/documentserver-example/ruby/app/views/home/editor.html.erb +++ b/web/documentserver-example/ruby/app/views/home/editor.html.erb @@ -171,27 +171,25 @@ <% history = @file.get_history - if history %> - // the user is trying to show the document version history - config.events['onRequestHistory'] = function () { - docEditor.refreshHistory(<%= raw history[:hist].to_json %>); // show the document version history - }; - // the user is trying to click the specific document version in the document version history - config.events['onRequestHistoryData'] = function (event) { - var ver = event.data; - var histData = <%= raw history[:histData].to_json %>; - docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history - }; - // the user is trying to go back to the document from viewing the document version history - config.events['onRequestHistoryClose'] = function () { - document.location.reload(); - }; - <% end - %> - - <% usersMentions = @file.get_users_mentions - if usersMentions %> + + if usersMentions + if history %> + // the user is trying to show the document version history + config.events['onRequestHistory'] = function () { + docEditor.refreshHistory(<%= raw history[:hist].to_json %>); // show the document version history + }; + // the user is trying to click the specific document version in the document version history + config.events['onRequestHistoryData'] = function (event) { + var ver = event.data; + var histData = <%= raw history[:histData].to_json %>; + docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history + }; + // the user is trying to go back to the document from viewing the document version history + config.events['onRequestHistoryClose'] = function () { + document.location.reload(); + }; + <% end %> // add mentions for not anonymous users config.events['onRequestUsers'] = function () { docEditor.setUsers({ // set a list of users to mention in the comments