mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
Merge remote-tracking branch 'remotes/origin/develop' into feature/get-files
# Conflicts: # web/documentserver-example/csharp-mvc/WebEditor.ashx.cs # web/documentserver-example/csharp/WebEditor.ashx.cs # web/documentserver-example/java/src/main/java/controllers/IndexServlet.java # web/documentserver-example/php/webeditor-ajax.php # web/documentserver-example/python/src/urls.py # web/documentserver-example/python/src/views/actions.py # web/documentserver-example/ruby/app/controllers/home_controller.rb # web/documentserver-example/ruby/config/routes.rb
This commit is contained in:
@ -93,7 +93,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
public static int GetFileVersion(string historyPath)
|
||||
{
|
||||
if (!Directory.Exists(historyPath)) return 0;
|
||||
return Directory.EnumerateDirectories(historyPath).Count();
|
||||
return Directory.EnumerateDirectories(historyPath).Count() + 1;
|
||||
}
|
||||
|
||||
public static int GetFileVersion(string fileName, string userAddress)
|
||||
@ -142,15 +142,15 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
var histDir = HistoryDir(StoragePath(fileName, null));
|
||||
Directory.CreateDirectory(histDir);
|
||||
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
|
||||
{ "created", DateTime.Now.ToString() },
|
||||
{ "created", DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss") },
|
||||
{ "id", string.IsNullOrEmpty(uid) ? "uid-1" : uid },
|
||||
{ "name", string.IsNullOrEmpty(uname) ? "John Smith" : uname }
|
||||
}));
|
||||
}
|
||||
|
||||
public static string GetFileUri(string fileName)
|
||||
public static string GetFileUri(string fileName, Boolean forDocumentServer)
|
||||
{
|
||||
var uri = new UriBuilder(HttpContext.Current.Request.Url)
|
||||
var uri = new UriBuilder(GetServerUrl(forDocumentServer))
|
||||
{
|
||||
Path = HttpRuntime.AppDomainAppVirtualPath + "/"
|
||||
+ CurUserHostAddress() + "/"
|
||||
@ -163,7 +163,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
|
||||
public static string GetPathUri(string path)
|
||||
{
|
||||
var uri = new UriBuilder(HttpContext.Current.Request.Url)
|
||||
var uri = new UriBuilder(GetServerUrl(true))
|
||||
{
|
||||
Path = HttpRuntime.AppDomainAppVirtualPath + "/"
|
||||
+ path,
|
||||
@ -173,9 +173,26 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
return uri.ToString();
|
||||
}
|
||||
|
||||
public static string GetServerUrl(Boolean forDocumentServer)
|
||||
{
|
||||
if (forDocumentServer && !WebConfigurationManager.AppSettings["files.docservice.url.example"].Equals(""))
|
||||
{
|
||||
return WebConfigurationManager.AppSettings["files.docservice.url.example"];
|
||||
}
|
||||
else
|
||||
{
|
||||
var uri = new UriBuilder(HttpContext.Current.Request.Url) { Query = "" };
|
||||
var requestHost = HttpContext.Current.Request.Headers["Host"];
|
||||
if (!string.IsNullOrEmpty(requestHost))
|
||||
uri = new UriBuilder(uri.Scheme + "://" + requestHost);
|
||||
|
||||
return uri.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetCallback(string fileName)
|
||||
{
|
||||
var callbackUrl = new UriBuilder(HttpContext.Current.Request.Url)
|
||||
var callbackUrl = new UriBuilder(GetServerUrl(true))
|
||||
{
|
||||
Path =
|
||||
HttpRuntime.AppDomainAppVirtualPath
|
||||
|
||||
Reference in New Issue
Block a user