webdav portal add owa put relative support
This commit is contained in:
parent
a6b57486bd
commit
2968fbb967
16 changed files with 199 additions and 20 deletions
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http.Routing;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Extensions
|
||||
{
|
||||
public static class UrlHelperExtensions
|
||||
{
|
||||
public static String GenerateWopiUrl(this System.Web.Mvc.UrlHelper urlHelper, WebDavAccessToken token, string path)
|
||||
{
|
||||
var urlPart = urlHelper.HttpRouteUrl(OwaRouteNames.CheckFileInfo, new { accessTokenId = token.Id });
|
||||
|
||||
return GenerateWopiUrl(token, urlPart, path);
|
||||
}
|
||||
|
||||
public static String GenerateWopiUrl(this UrlHelper urlHelper, WebDavAccessToken token, string path)
|
||||
{
|
||||
var urlPart = urlHelper.Route(OwaRouteNames.CheckFileInfo, new { accessTokenId = token.Id });
|
||||
|
||||
return GenerateWopiUrl(token, urlPart, path);
|
||||
}
|
||||
|
||||
private static string GenerateWopiUrl(WebDavAccessToken token, string urlPart, string path)
|
||||
{
|
||||
var url = new Uri(HttpContext.Current.Request.Url, urlPart).ToString();
|
||||
|
||||
string wopiSrc = HttpUtility.UrlDecode(url);
|
||||
|
||||
return string.Format("{0}&access_token={1}", wopiSrc, token.AccessToken.ToString("N"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue