Skip to content

Commit

Permalink
Merge pull request #237 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/1.1.0
  • Loading branch information
LinneyS authored Dec 13, 2021
2 parents 3a11a42 + 24cfd66 commit 461a005
Show file tree
Hide file tree
Showing 180 changed files with 2,308 additions and 1,116 deletions.
4 changes: 0 additions & 4 deletions 3rd-Party.license
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ serve-favicon - Node.js middleware for serving a favicon. (https://github.com/ex
License: MIT
License File: serve-favicon.license

sync-request - Make synchronous web requests with cross-platform support. (https://github.com/ForbesLindesay/sync-request/blob/master/LICENSE)
License: MIT
License File: sync-request.license

urllib - Request HTTP URLs in a complex world — basic and digest authentication, redirections, cookies, timeout and more. (https://github.com/node-modules/urllib/blob/master/LICENSE)
License: MIT
License File: urllib.license
Expand Down
4 changes: 2 additions & 2 deletions build/msbuild/zip.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<PropertyGroup>
<To Condition=" '$(To)' == '' ">..\deploy\</To>
<RootDir Condition="$(RootDir)==''">..\..\</RootDir>
<NameCSharp>$(To).Net (C#) Example</NameCSharp>
<NameCSharp>$(To)DotNet (Csharp) Example</NameCSharp>
<DirCSharp>$(RootDir)web\documentserver-example\csharp\</DirCSharp>
<NameMvc>$(To).Net (C# MVC) Example</NameMvc>
<NameMvc>$(To)DotNet (Csharp MVC) Example</NameMvc>
<DirMvc>$(RootDir)web\documentserver-example\csharp-mvc\</DirMvc>
<NameJava>$(To)Java Example</NameJava>
<DirJava>$(RootDir)web\documentserver-example\java\</DirJava>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions web/documentserver-example/csharp-mvc/Content/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ label .checkbox {
background-image: url("images/file_pptx.svg");
}

.try-editor.form {
background-image: url("images/file_docxf.svg");
}

.create-sample {
color: #666666;
line-height: 24px;
Expand Down Expand Up @@ -730,11 +734,6 @@ html {
margin-left: 25px;
}

#portal-info {
display: block;
width: 70vw;
}

.portal-descr:nth-child(3) {
margin-bottom: 20px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static long MaxFileSize
// get all the supported file extensions
public static List<string> FileExts
{
get { return ViewedExts.Concat(EditedExts).Concat(ConvertExts).ToList(); }
get { return ViewedExts.Concat(EditedExts).Concat(ConvertExts).Concat(FillFormExts).ToList(); }
}

// get file extensions that can be viewed
Expand All @@ -53,6 +53,11 @@ public static List<string> ViewedExts
get { return (WebConfigurationManager.AppSettings["files.docservice.viewed-docs"] ?? "").Split(new char[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); }
}

public static List<string> FillFormExts
{
get { return (WebConfigurationManager.AppSettings["files.docservice.fillform-docs"] ?? "").Split(new char[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); }
}

// get file extensions that can be edited
public static List<string> EditedExts
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public static int GetConvertedUri(string documentUri,
string documentRevisionId,
bool isAsync,
out string convertedDocumentUri,
string filePass = null)
string filePass = null,
string lang = null)
{
convertedDocumentUri = string.Empty;

Expand Down Expand Up @@ -114,7 +115,8 @@ public static int GetConvertedUri(string documentUri,
{ "outputtype", toExtension.Trim('.') },
{ "title", title },
{ "url", documentUri },
{ "password", filePass }
{ "password", filePass },
{ "region", lang }
};

if (JwtManager.Enabled)
Expand Down
9 changes: 7 additions & 2 deletions web/documentserver-example/csharp-mvc/Models/FileModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,16 @@ public string GetDocConfig(HttpRequest request, UrlHelper url)
var editorsMode = Mode ?? "edit"; // get editor mode

var canEdit = DocManagerHelper.EditedExts.Contains(ext); // check if the file with such an extension can be edited
var mode = canEdit && editorsMode != "view" ? "edit" : "view"; // set the mode parameter: change it to view if the document can't be edited
var submitForm = canEdit && (editorsMode.Equals("edit") || editorsMode.Equals("fillForms")); // check if the Submit form button is displayed or not

var id = request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id); // get the user

if ((!canEdit && editorsMode.Equals("edit") || editorsMode.Equals("fillForms")) && DocManagerHelper.FillFormExts.Contains(ext)) {
editorsMode = "fillForms";
canEdit = true;
}
var submitForm = editorsMode.Equals("fillForms") && id.Equals("uid-1") && false; // check if the Submit form button is displayed or not
var mode = canEdit && editorsMode != "view" ? "edit" : "view"; // set the mode parameter: change it to view if the document can't be edited

// favorite icon state
bool? favorite = user.favorite;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static FileType GetFileType(string fileName)
".dot", ".dotx", ".dotm",
".odt", ".fodt", ".ott", ".rtf", ".txt",
".html", ".htm", ".mht", ".xml",
".pdf", ".djvu", ".fb2", ".epub", ".xps", ".oxps"
".pdf", ".djvu", ".fb2", ".epub", ".xps", ".oxps", ".oform"
};

// spreadsheet extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,31 +120,38 @@
</ItemGroup>
<ItemGroup>
<Content Include="Content\editor.css" />
<Content Include="Content\images\alert.png" />
<Content Include="Content\images\block-content-24.png" />
<Content Include="Content\images\block-content.svg" />
<Content Include="Content\images\cell.ico" />
<Content Include="Content\images\close.png" />
<Content Include="Content\images\comment-24.png" />
<Content Include="Content\images\corner.png" />
<Content Include="Content\images\delete-24.png" />
<Content Include="Content\images\desktop-24.png" />
<Content Include="Content\images\done.png" />
<Content Include="Content\images\download-24.png" />
<Content Include="Content\images\embeded-24.png" />
<Content Include="Content\images\file_docx.png" />
<Content Include="Content\images\file_pptx.png" />
<Content Include="Content\images\file_upload.png" />
<Content Include="Content\images\file_xlsx.png" />
<Content Include="Content\images\fill-forms-24.png" />
<Content Include="Content\images\filter-24.png" />
<Content Include="Content\images\close.svg" />
<Content Include="Content\images\comment.svg" />
<Content Include="Content\images\delete.svg" />
<Content Include="Content\images\desktop.svg" />
<Content Include="Content\images\done.svg" />
<Content Include="Content\images\download.svg" />
<Content Include="Content\images\embeded.svg" />
<Content Include="Content\images\error.svg" />
<Content Include="Content\images\file_docx.svg" />
<Content Include="Content\images\file_docxf.svg" />
<Content Include="Content\images\file_pptx.svg" />
<Content Include="Content\images\file_upload.svg" />
<Content Include="Content\images\file_xlsx.svg" />
<Content Include="Content\images\fill-forms.svg" />
<Content Include="Content\images\filter.svg" />
<Content Include="Content\images\icon_docx.svg" />
<Content Include="Content\images\icon_pptx.svg" />
<Content Include="Content\images\icon_xlsx.svg" />
<Content Include="Content\images\info.svg" />
<Content Include="Content\images\loader16.gif" />
<Content Include="Content\images\logo.png" />
<Content Include="Content\images\mobile-24.png" />
<Content Include="Content\images\question_small.png" />
<Content Include="Content\images\review-24.png" />
<Content Include="Content\images\logo.svg" />
<Content Include="Content\images\mobile-fill-forms.svg" />
<Content Include="Content\images\mobile.svg" />
<Content Include="Content\images\notdone.svg" />
<Content Include="Content\images\review.svg" />
<Content Include="Content\images\slide.ico" />
<Content Include="Content\images\word.ico" />
<Content Include="Content\jquery-ui.css" />
<Content Include="Content\media.css" />
<Content Include="Content\stylesheet.css" />
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
Expand Down
11 changes: 4 additions & 7 deletions web/documentserver-example/csharp-mvc/Scripts/jscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ if (typeof jQuery != "undefined") {
});

var timer = null;
var checkConvert = function (filePass = null) {
var checkConvert = function (filePass) {
filePass = filePass ? filePass : null;
if (timer != null) {
clearTimeout(timer);
}
Expand Down Expand Up @@ -167,7 +168,7 @@ if (typeof jQuery != "undefined") {
var posExt = fileName.lastIndexOf('.');
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';

if (EditedExtList.indexOf(posExt) != -1) {
if (EditedExtList.indexOf(posExt) != -1 || FillExtList.indexOf(posExt) != -1) {
jq("#beginEdit").removeClass("disable");
}
};
Expand Down Expand Up @@ -226,7 +227,7 @@ if (typeof jQuery != "undefined") {

jq(document).on("click", "#beginView:not(.disable)", function () {
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
var url = UrlEditor + "?mode=view&fileName=" + fileId;
var url = UrlEditor + "?editorsMode=view&fileName=" + fileId;
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
Expand Down Expand Up @@ -289,10 +290,6 @@ if (typeof jQuery != "undefined") {
};

var fileList = jq("tr.tableRow");
if (fileList.length > 0) {
console.log(jq("div#portal-info").is(":visible"));
jq("div#portal-info").hide();
}

var mouseIsOverTooltip = false;
var hideTooltipTimeout = null;
Expand Down
38 changes: 33 additions & 5 deletions web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@
var docEditor;
var innerAlert = function (message) {
var innerAlert = function (message, inEditor) {
if (console && console.log)
console.log(message);
if (inEditor && docEditor)
docEditor.showMessage(message);
};
// the application is loaded into the browser
Expand Down Expand Up @@ -134,6 +136,23 @@
<% Model.GetMailMergeConfig(out dataMailMergeRecipients); %>
docEditor.setMailMergeRecipients(<%= dataMailMergeRecipients%>); // insert recipient data for mail merge into the file
};
var onRequestSaveAs = function (event) { // the user is trying to save file by clicking Save Copy as... button
var title = event.data.title;
var url = event.data.url;
var data = {
title: title,
url: url
};
let xhr = new XMLHttpRequest();
xhr.open("POST", "webeditor.ashx?type=saveas");
xhr.setRequestHeader( 'Content-Type', 'application/json');
xhr.send(JSON.stringify(data));
xhr.onload = function () {
innerAlert(xhr.responseText);
innerAlert(JSON.parse(xhr.responseText).file, true);
}
};
var config = <%= Model.GetDocConfig(Request, Url) %>;
Expand Down Expand Up @@ -185,14 +204,23 @@
};
// the user is mentioned in a comment
config.events['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));
event.data.actionLink = replaceActionLink(location.href, event.data.actionLink);
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
<% } %>
if (config.editorConfig.createUrl) {
config.events.onRequestSaveAs = onRequestSaveAs;
};
var сonnectEditor = function () {
if ((config.document.fileType === "docxf" || config.document.fileType === "oform")
&& DocsAPI.DocEditor.version().split(".")[0] < 7) {
innerAlert("Please update ONLYOFFICE Docs to version 7.0 to work on fillable forms online.");
return;
}
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
};
Expand Down
Loading

0 comments on commit 461a005

Please sign in to comment.