webdav portal owa support check added
This commit is contained in:
parent
5795ffb0bc
commit
010c258502
16 changed files with 246 additions and 20 deletions
|
@ -38,6 +38,12 @@ namespace WebsitePanel.WebDavPortal
|
|||
defaults: new { controller = "FileSystem", action = "UploadFile" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.DownloadFile,
|
||||
url: "download-file/{org}/{*pathPart}",
|
||||
defaults: new { controller = "FileSystem", action = "DownloadFile" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.ShowOfficeOnlinePath,
|
||||
url: "office365/{org}/{*pathPart}",
|
||||
|
|
|
@ -105,6 +105,12 @@ namespace WebsitePanel.WebDavPortal.Controllers.Api
|
|||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Refresh_Lock(int accessTokenId)
|
||||
{
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage UnLock(int accessTokenId)
|
||||
{
|
||||
|
|
|
@ -116,6 +116,26 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
return PartialView("_ResourseCollectionPartial", result);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult DownloadFile(string org, string pathPart)
|
||||
{
|
||||
if (org != WspContext.User.OrganizationId)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
}
|
||||
|
||||
string fileName = pathPart.Split('/').Last();
|
||||
|
||||
if (_webdavManager.IsFile(pathPart) == false)
|
||||
{
|
||||
throw new Exception(Resources.NotAFile);
|
||||
}
|
||||
|
||||
var fileBytes = _webdavManager.GetFileBytes(pathPart);
|
||||
|
||||
return File(fileBytes, MediaTypeNames.Application.Octet, fileName);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult UploadFile(string org, string pathPart)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDavPortal.Extensions;
|
||||
|
||||
|
@ -20,10 +22,23 @@ namespace WebsitePanel.WebDavPortal.FileOperations
|
|||
get
|
||||
{
|
||||
FileOpenerType result;
|
||||
if (_operationTypes.TryGetValue(fileExtension, out result))
|
||||
if (_operationTypes.TryGetValue(fileExtension, out result) && CheckBrowserSupport())
|
||||
return result;
|
||||
return FileOpenerType.Download;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckBrowserSupport()
|
||||
{
|
||||
var request = HttpContext.Current.Request;
|
||||
int supportedVersion;
|
||||
|
||||
if (WebDavAppConfigManager.Instance.OwaSupportedBrowsers.TryGetValue(request.Browser.Browser, out supportedVersion) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return supportedVersion <= request.Browser.MajorVersion;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -159,6 +159,15 @@ namespace WebsitePanel.WebDavPortal.UI {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Not a file..
|
||||
/// </summary>
|
||||
public static string NotAFile {
|
||||
get {
|
||||
return ResourceManager.GetString("NotAFile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Processing.
|
||||
/// </summary>
|
||||
|
|
|
@ -150,6 +150,9 @@
|
|||
<data name="NoFilesAreSelected" xml:space="preserve">
|
||||
<value>No files are selected.</value>
|
||||
</data>
|
||||
<data name="NotAFile" xml:space="preserve">
|
||||
<value>Not a file.</value>
|
||||
</data>
|
||||
<data name="Processing" xml:space="preserve">
|
||||
<value>Processing</value>
|
||||
</data>
|
||||
|
|
|
@ -14,5 +14,7 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
|
|||
public const string UploadFile = "UplaodFIleRoute";
|
||||
|
||||
public const string DeleteFiles = "DeleteFilesRoute";
|
||||
|
||||
public const string DownloadFile = "DownloadFileRoute";
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
</root>
|
||||
</log4net>
|
||||
|
||||
|
||||
<appSettings>
|
||||
<add key="webpages:Version" value="3.0.0.0" />
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
|
@ -72,6 +73,12 @@
|
|||
<add extension=".csv" path="~/Content/Images/csv-icon.png" />
|
||||
<add extension=".zip" path="~/Content/Images/zip-icon.png" />
|
||||
</fileIcons>
|
||||
<owaSupportedBrowsers>
|
||||
<add browser="Chrome" version="20" />
|
||||
<add browser="Firefox" version="6" />
|
||||
<add browser="InternetExplorer" version="8" />
|
||||
<add browser="Safari" version="4" />
|
||||
</owaSupportedBrowsers>
|
||||
<officeOnline isEnabled="True" url="https://vir-owa.virtuworks.net" cobaltFileTtl="1">
|
||||
<add extension=".doc" OwaView="wv/wordviewerframe.aspx?" OwaEditor="wv/wordviewerframe.aspx?" />
|
||||
<add extension=".docx" OwaView="wv/wordviewerframe.aspx?" OwaEditor="we/wordeditorframe.aspx?" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue