webdav portal create new ability added

This commit is contained in:
vfedosevich 2015-03-11 05:34:35 -07:00
parent 6b1c1660fe
commit 50e902b94d
26 changed files with 473 additions and 38 deletions

View file

@ -54,22 +54,24 @@ namespace WebsitePanel.WebDavPortal.Controllers.Api
{
var token = _tokenManager.GetToken(accessTokenId);
var fileInfo = _wopiServer.GetCheckFileInfo(token.FilePath);
var fileInfo = _wopiServer.GetCheckFileInfo(token);
var urlPart = Url.Route(FileSystemRouteNames.ShowContentPath, new { org = WspContext.User.OrganizationId, pathPart = token.FilePath });
if (fileInfo.Size <= 1)
{
return fileInfo;
}
var urlPart = Url.Route(FileSystemRouteNames.ShowContentPath, new {org = WspContext.User.OrganizationId, pathPart = token.FilePath});
var url = new Uri(Request.RequestUri, urlPart).ToString();
fileInfo.DownloadUrl = url;
fileInfo.ClientUrl = _webDavManager.GetFileUrl(token.FilePath);
return fileInfo;
}
public HttpResponseMessage GetFile(int accessTokenId)
{
var token = _tokenManager.GetToken(accessTokenId);
var bytes = _webDavManager.GetFileBytes(token.FilePath);
var bytes = _wopiServer.GetFileBytes(accessTokenId);
var result = new HttpResponseMessage(HttpStatusCode.OK);

View file

@ -303,6 +303,36 @@ namespace WebsitePanel.WebDavPortal.Controllers
return Json(model);
}
public ActionResult NewWebDavItem(string org, string pathPart)
{
var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart);
var owaOpener = WebDavAppConfigManager.Instance.OfficeOnline.FirstOrDefault(x => x.Extension == Path.GetExtension(pathPart));
if (permissions.HasFlag(WebDavPermissions.Write) == false || (owaOpener != null && permissions.HasFlag(WebDavPermissions.OwaEdit) == false))
{
return new RedirectToRouteResult(FileSystemRouteNames.ShowContentPath, null);
}
if (owaOpener != null)
{
return ShowOfficeDocument(org, pathPart, owaOpener.OwaNewFileView);
}
return new RedirectToRouteResult(FileSystemRouteNames.ShowContentPath, null);
}
[HttpPost]
public JsonResult ItemExist(string org, string pathPart, string newItemName)
{
var exist = _webdavManager.FileExist(string.Format("{0}/{1}", pathPart, newItemName));
return new JsonResult()
{
Data = !exist
};
}
#region Owa Actions
public ActionResult ShowOfficeDocument(string org, string pathPart, string owaOpenerUri)
@ -345,6 +375,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
return ShowOfficeDocument(org, pathPart, owaOpener.OwaEditor);
}
#endregion
private void FillContentModel(IEnumerable<ResourceTableItemModel> items, string organizationId)