diff --git a/CHANGELOG.md b/CHANGELOG.md index d0309ad4d..1601e0c77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 1.4.0 +- nodejs: option to send directUrl +- opening file on client by directUrl +- offline viewer for anonymous +- added hy, eu, zh-TW, ms, pt-PT + ## 1.3.1 - charp: fix references - ruby: update rails diff --git a/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs b/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs index 438da1871..b7c56aa21 100644 --- a/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs +++ b/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs @@ -313,9 +313,10 @@ public static string GetCreateUrl(FileUtility.FileType fileType) } // create the public history url - public static string GetHistoryDownloadUrl(string filename, string version, string file) + public static string GetHistoryDownloadUrl(string filename, string version, string file, Boolean isServer = true) { - var downloadUrl = new UriBuilder(GetServerUrl(true)) + var userAddress = "&userAddress=" + HttpUtility.UrlEncode(CurUserHostAddress(HttpContext.Current.Request.UserHostAddress)); + var downloadUrl = new UriBuilder(GetServerUrl(isServer)) { Path = HttpRuntime.AppDomainAppVirtualPath @@ -323,7 +324,7 @@ public static string GetHistoryDownloadUrl(string filename, string version, stri + "webeditor.ashx", Query = "type=downloadhistory" + "&fileName=" + HttpUtility.UrlEncode(filename) - + "&userAddress=" + HttpUtility.UrlEncode(CurUserHostAddress(HttpContext.Current.Request.UserHostAddress)) + + userAddress + "&ver=" + version + "&file="+ file }; @@ -331,9 +332,10 @@ public static string GetHistoryDownloadUrl(string filename, string version, stri } // get url to download a file - public static string GetDownloadUrl(string fileName) + public static string GetDownloadUrl(string fileName, Boolean isServer = true) { - var downloadUrl = new UriBuilder(GetServerUrl(true)) + var userAddress = isServer ? "&userAddress=" + HttpUtility.UrlEncode(CurUserHostAddress(HttpContext.Current.Request.UserHostAddress)) : ""; + var downloadUrl = new UriBuilder(GetServerUrl(isServer)) { Path = HttpRuntime.AppDomainAppVirtualPath @@ -341,7 +343,7 @@ public static string GetDownloadUrl(string fileName) + "webeditor.ashx", Query = "type=download" + "&fileName=" + HttpUtility.UrlEncode(fileName) - + "&userAddress=" + HttpUtility.UrlEncode(CurUserHostAddress(HttpContext.Current.Request.UserHostAddress)) + + userAddress }; return downloadUrl.ToString(); } diff --git a/web/documentserver-example/csharp-mvc/Helpers/Users.cs b/web/documentserver-example/csharp-mvc/Helpers/Users.cs index 107a250b5..848c35d99 100644 --- a/web/documentserver-example/csharp-mvc/Helpers/Users.cs +++ b/web/documentserver-example/csharp-mvc/Helpers/Users.cs @@ -69,6 +69,7 @@ public class Users "Can’t see anyone’s information", "Can't rename files from the editor", "Can't view chat", + "View file without collaboration", }; private static List users = new List() { diff --git a/web/documentserver-example/csharp-mvc/Models/FileModel.cs b/web/documentserver-example/csharp-mvc/Models/FileModel.cs index 93be18804..bfc0c69bd 100755 --- a/web/documentserver-example/csharp-mvc/Models/FileModel.cs +++ b/web/documentserver-example/csharp-mvc/Models/FileModel.cs @@ -97,6 +97,7 @@ public string GetDocConfig(HttpRequest request, UrlHelper url) var actionLink = request.GetOrDefault("actionLink", null); // get the action link (comment or bookmark) if it exists var actionData = string.IsNullOrEmpty(actionLink) ? null : jss.DeserializeObject(actionLink); // get action data for the action link + var directUrl = DocManagerHelper.GetDownloadUrl(FileName, false); var createUrl = DocManagerHelper.GetCreateUrl(FileUtility.GetFileType(FileName)); var templatesImageUrl = DocManagerHelper.GetTemplateImageUrl(FileUtility.GetFileType(FileName)); // image url for templates var templates = new List> @@ -125,6 +126,7 @@ public string GetDocConfig(HttpRequest request, UrlHelper url) { { "title", FileName }, { "url", DownloadUrl }, + { "directUrl", directUrl }, { "fileType", ext.Trim('.') }, { "key", Key }, { @@ -163,6 +165,11 @@ public string GetDocConfig(HttpRequest request, UrlHelper url) { "mode", mode }, { "lang", request.Cookies.GetOrDefault("ulang", "en") }, { "callbackUrl", CallbackUrl }, // absolute URL to the document storage service + { "coEditing", editorsMode == "view" && user.id.Equals("uid-0") ? + new Dictionary{ + {"mode", "strict"}, + {"change", false} + } : null }, { "createUrl", !user.id.Equals("uid-0") ? createUrl : null }, { "templates", user.templates ? templates : null }, { @@ -178,9 +185,9 @@ public string GetDocConfig(HttpRequest request, UrlHelper url) // the parameters for the embedded document type "embedded", new Dictionary { - { "saveUrl", FileUriUser }, // the absolute URL that will allow the document to be saved onto the user personal computer - { "embedUrl", FileUriUser }, // the absolute URL to the document serving as a source file for the document embedded into the web page - { "shareUrl", FileUriUser }, // the absolute URL that will allow other users to share this document + { "saveUrl", directUrl }, // the absolute URL that will allow the document to be saved onto the user personal computer + { "embedUrl", directUrl }, // the absolute URL to the document serving as a source file for the document embedded into the web page + { "shareUrl", directUrl }, // the absolute URL that will allow other users to share this document { "toolbarDocked", "top" } // the place for the embedded viewer toolbar (top or bottom) } }, @@ -263,17 +270,23 @@ public void GetHistory(out string history, out string historyData) dataObj.Add("key", key); // write file url to the data object string prevFileUrl; + string directPrevFileUrl; if (Path.IsPathRooted(storagePath) && !string.IsNullOrEmpty(storagePath)) { prevFileUrl = i == currentVersion ? DocManagerHelper.GetHistoryDownloadUrl(FileName, i.ToString(), "prev" + ext) : DocManagerHelper.GetDownloadUrl(Directory.GetFiles(verDir, "prev.*")[0].Replace(storagePath + "\\", "")); + directPrevFileUrl = i == currentVersion ? DocManagerHelper.GetHistoryDownloadUrl(FileName, i.ToString(), "prev" + ext, false) + : DocManagerHelper.GetDownloadUrl(Directory.GetFiles(verDir, "prev.*")[0].Replace(storagePath + "\\", ""), false); } else { - prevFileUrl = i == currentVersion ? FileUri - : DocManagerHelper.GetHistoryDownloadUrl(FileName, i.ToString(), "prev" + ext); + prevFileUrl = i == currentVersion ? FileUri + : DocManagerHelper.GetHistoryDownloadUrl(FileName, i.ToString(), "prev" + ext); + directPrevFileUrl = i == currentVersion ? DocManagerHelper.GetHistoryDownloadUrl(FileName, i.ToString(), "prev" + ext, false) + : DocManagerHelper.GetDownloadUrl(Directory.GetFiles(verDir, "prev.*")[0].Replace(storagePath + "\\", ""), false); } dataObj.Add("url", prevFileUrl); + dataObj.Add("directUrl", directPrevFileUrl); dataObj.Add("version", i); if (i > 1) // check if the version number is greater than 1 (the file was modified) { @@ -295,6 +308,7 @@ public void GetHistory(out string history, out string historyData) { "fileType", prev["fileType"] }, { "key", prev["key"] }, // write key and url information about previous file version { "url", prev["url"] }, + { "directUrl", prev["directUrl"] }, }); // write the path to the diff.zip archive with differences in this file version var changesUrl = DocManagerHelper.GetHistoryDownloadUrl(FileName, (i - 1).ToString(), "diff.zip"); @@ -333,11 +347,20 @@ public void GetCompareFileData(out string compareConfig) Query = "type=assets&fileName=" + HttpUtility.UrlEncode("sample.docx") }; + var directCompareFileUrl = new UriBuilder(DocManagerHelper.GetServerUrl(false)) + { + Path = HttpRuntime.AppDomainAppVirtualPath + + (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/") + + "webeditor.ashx", + Query = "type=assets&fileName=" + HttpUtility.UrlEncode("sample.docx") + }; + // create an object with the information about the compared file var dataCompareFile = new Dictionary { { "fileType", "docx" }, - { "url", compareFileUrl.ToString() } + { "url", compareFileUrl.ToString() }, + { "directUrl", directCompareFileUrl.ToString()} }; if (JwtManager.Enabled) // if the secret key to generate token exists @@ -362,11 +385,19 @@ public void GetLogoConfig(out string logoUrl) + "Content\\images\\logo.png" }; + var directMailMergeUrl = new UriBuilder(DocManagerHelper.GetServerUrl(false)) + { + Path = HttpRuntime.AppDomainAppVirtualPath + + (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/") + + "Content\\images\\logo.png" + }; + // create a logo config var logoConfig = new Dictionary { { "fileType", "png"}, - { "url", mailMergeUrl.ToString()} + { "url", mailMergeUrl.ToString()}, + { "directUrl", directMailMergeUrl.ToString()} }; if (JwtManager.Enabled) // if the secret key to generate token exists @@ -393,11 +424,21 @@ public void GetMailMergeConfig(out string dataMailMergeRecipients) Query = "type=csv" }; + var directMailMergeUrl = new UriBuilder(DocManagerHelper.GetServerUrl(false)) + { + Path = + HttpRuntime.AppDomainAppVirtualPath + + (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/") + + "webeditor.ashx", + Query = "type=csv" + }; + // create a mail merge config var mailMergeConfig = new Dictionary { { "fileType", "csv" }, - { "url", mailMergeUrl.ToString()} + { "url", mailMergeUrl.ToString()}, + { "directUrl", directMailMergeUrl.ToString()} }; if (JwtManager.Enabled) // if the secret key to generate token exists diff --git a/web/documentserver-example/csharp-mvc/OnlineEditorsExampleMVC.csproj b/web/documentserver-example/csharp-mvc/OnlineEditorsExampleMVC.csproj index 841f69a9a..126648880 100644 --- a/web/documentserver-example/csharp-mvc/OnlineEditorsExampleMVC.csproj +++ b/web/documentserver-example/csharp-mvc/OnlineEditorsExampleMVC.csproj @@ -53,49 +53,49 @@ - + packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll - + packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll - + packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - + packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - + packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll - + packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll - + packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll - + packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll - + packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll - + packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll - + packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll - + packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll - + packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll - + packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll - + packages\WebGrease.1.6.0\lib\WebGrease.dll @@ -185,10 +185,12 @@ + + diff --git a/web/documentserver-example/csharp-mvc/Web.config b/web/documentserver-example/csharp-mvc/Web.config index 18c3c6afe..38ddb1344 100644 --- a/web/documentserver-example/csharp-mvc/Web.config +++ b/web/documentserver-example/csharp-mvc/Web.config @@ -1,4 +1,4 @@ - +