webdav portal routes fix

This commit is contained in:
vfedosevich 2015-01-19 01:04:13 -08:00
parent 67aab39780
commit 1da7c6c3b3
6 changed files with 9 additions and 10 deletions

View file

@ -51,7 +51,7 @@ namespace WebsitePanel.WebDav.Core.Managers
_currentFolder = _webDavSession.OpenFolder(string.Format("{0}{1}/{2}", WebDavAppConfigManager.Instance.WebdavRoot, WspContext.User.OrganizationId, pathPart));
}
children = _currentFolder.GetChildren();
children = _currentFolder.GetChildren().Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/'))).ToArray();
}
List<IHierarchyItem> sortedChildren = children.Where(x => x.ItemType == ItemType.Folder).OrderBy(x => x.DisplayName).ToList();

View file

@ -43,7 +43,7 @@ namespace WebsitePanel.WebDavPortal
#endregion
routes.MapRoute(
name: "Office365DocumentRoute",
name: FileSystemRouteNames.OfficeOnlinePath,
url: "office365/{org}/{*pathPart}",
defaults: new { controller = "FileSystem", action = "ShowOfficeDocument", pathPart = UrlParameter.Optional }
);

View file

@ -46,8 +46,6 @@ namespace WebsitePanel.WebDavPortal.Controllers
{
_authenticationService.CreateAuthenticationTicket(user);
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = null;
return RedirectToRoute(FileSystemRouteNames.FilePath, new { org = WspContext.User.OrganizationId });
}
@ -59,8 +57,6 @@ namespace WebsitePanel.WebDavPortal.Controllers
{
_authenticationService.LogOut();
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = null;
return RedirectToRoute(AccountRouteNames.Login);
}
}

View file

@ -57,10 +57,9 @@ namespace WebsitePanel.WebDavPortal.Controllers
try
{
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(pathPart).Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/')));
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(pathPart);
var model = new ModelForWebDav { Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount), UrlSuffix = pathPart };
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount;
return View(model);
}

View file

@ -8,6 +8,7 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
public class FileSystemRouteNames
{
public const string FilePath = "FilePathRoute";
public const string OfficeOnlinePath = "OfficeOnline";
public const string ShowAdditionalContent = "ShowAdditionalContentRoute";
}
}

View file

@ -1,7 +1,9 @@
@using WebsitePanel.WebDav.Core.Client
@using WebsitePanel.WebDav.Core
@using WebsitePanel.WebDav.Core.Client
@using WebsitePanel.WebDav.Core.Config
@using WebsitePanel.WebDavPortal.FileOperations
@using Ninject;
@using WebsitePanel.WebDavPortal.UI.Routes
@model IHierarchyItem
@{
@ -14,7 +16,8 @@
{
case FileOpenerType.OfficeOnline:
isTargetBlank = true;
href = string.Concat(Url.Action("ShowOfficeDocument", "FileSystem"), Model.DisplayName);
var pathPart = Model.Href.AbsolutePath.Replace("/" + WspContext.User.OrganizationId, "");
href = string.Concat(Url.RouteUrl(FileSystemRouteNames.OfficeOnlinePath, new { org = WspContext.User.OrganizationId, pathPart = "" }), pathPart);
break;
default:
isTargetBlank = false;