diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs index 4df1d52a..560b6964 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/OfficeOnlineElement.cs @@ -7,6 +7,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections private const string ExtensionKey = "extension"; private const string OwaViewKey = "OwaView"; private const string OwaEditorKey = "OwaEditor"; + private const string OwaMobileViewKey = "OwaMobileView"; [ConfigurationProperty(ExtensionKey, IsKey = true, IsRequired = true)] public string Extension @@ -28,5 +29,13 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections get { return this[OwaEditorKey].ToString(); } set { this[OwaEditorKey] = value; } } + + + [ConfigurationProperty(OwaMobileViewKey, IsKey = true, IsRequired = true)] + public string OwaMobileViev + { + get { return this[OwaMobileViewKey].ToString(); } + set { this[OwaMobileViewKey] = value; } + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs index c9f69adb..f37b9f94 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs @@ -418,6 +418,7 @@ namespace WebsitePanel.WebDav.Core SetComment(item.Comment); SetCreatorDisplayName(item.CreatorDisplayName); SetLastModified(item.LastModified); + foreach (Property property in item.Properties) { SetProperty(property); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IHierarchyItem.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IHierarchyItem.cs index 55369709..9617281c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IHierarchyItem.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IHierarchyItem.cs @@ -159,7 +159,7 @@ namespace WebsitePanel.WebDav.Core { _creationDate = DateTime.Parse(creationDate); } - + public void SetCreationDate(DateTime creationDate) { _creationDate = creationDate; diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs index 5beead86..81ba89af 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs @@ -2,6 +2,7 @@ using System.IO; using System.Linq; using System.Net; +using System.Net.Mime; using System.Net.Security; using System.Net.Sockets; using System.Reflection; @@ -28,7 +29,6 @@ namespace WebsitePanel.WebDav.Core private bool _checkedOut = false; private string _comment = ""; private long _contentLength; - private string _contentType = ""; private DateTime _creationDate = new DateTime(0); private string _creatorDisplayName = ""; private ICredentials _credentials = new NetworkCredential(); @@ -79,7 +79,14 @@ namespace WebsitePanel.WebDav.Core public string ContentType { - get { return _contentType; } + get + { + { + var property = _properties.FirstOrDefault(x => x.Name.Name == "getcontenttype"); + + return property == null ? MediaTypeNames.Application.Octet : property.StringValue; + } + } } /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs index c878cd25..d837bbe4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs @@ -47,25 +47,14 @@ namespace WebsitePanel.WebDav.Core.Managers if (string.IsNullOrWhiteSpace(pathPart)) { - var resources = ConnectToWebDavServer().Select(x => new WebDavResource { Href = new Uri(x.Url), ItemType = ItemType.Folder }).ToArray(); - - var items = WSP.Services.EnterpriseStorage.GetEnterpriseFolders(WspContext.User.ItemId); - - foreach (var resource in resources) + children = ConnectToWebDavServer().Select(x => new WebDavResource { - var folder = items.FirstOrDefault(x => x.Name == resource.DisplayName); - - if (folder == null) - { - continue; - } - - resource.ContentLength = folder.Size; - resource.AllocatedSpace = folder.FRSMQuotaMB; - resource.IsRootItem = true; - } - - children = resources; + Href = new Uri(x.Url), + ItemType = ItemType.Folder, + ContentLength = x.Size, + AllocatedSpace = x.FRSMQuotaMB, + IsRootItem = true + }).ToArray(); } else { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css index 1d465903..27a7eb02 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css @@ -27,6 +27,10 @@ textarea { margin-bottom: 15px; /*text-align:center;*/ cursor: pointer; + margin-top: 14px; + margin-left: 1px; + margin-right: 1px; + padding: 3px; } .element-container .element { @@ -235,6 +239,10 @@ tr.selected-file { display: none; } +.file-actions-menu .file-upload { + display: inline-block; +} + #message-area { margin-top: 15px; } @@ -249,6 +257,7 @@ tr.selected-file { } .search-block { + float: right; } .search-block input, .search-block label { @@ -257,6 +266,39 @@ tr.selected-file { font-weight: normal; } +.elements-container { + padding-top: 10px; +} + +@media (min-width: 768px) { + .col-sm-2.element-container { + width: 15.666667%; + } +} + +@media (max-width: 768px) { + .col-sm-2.element-container { + float: left; + width: 48%; + } +} + + +@media (max-width: 250px) { + .col-sm-2.element-container { + float: left; + width: 100%; + } +} + +.back-button { + font-size: 30px; + color: white; + padding-left: 10px; + padding-top: 3px; + display: block; +} + /* Theme Mods */ input,div{border-radius:0px!important;} diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs index e6c80e1f..b2832b55 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs @@ -15,6 +15,7 @@ using WebsitePanel.WebDav.Core.Client; using WebsitePanel.WebDav.Core.Config; using WebsitePanel.WebDav.Core.Entities.Account.Enums; using WebsitePanel.WebDav.Core.Exceptions; +using WebsitePanel.WebDav.Core.Extensions; using WebsitePanel.WebDav.Core.Interfaces.Managers; using WebsitePanel.WebDav.Core.Interfaces.Managers.Users; using WebsitePanel.WebDav.Core.Interfaces.Security; @@ -79,12 +80,11 @@ namespace WebsitePanel.WebDavPortal.Controllers return new HttpStatusCodeResult(HttpStatusCode.NoContent); } - string fileName = pathPart.Split('/').Last(); - if (_webdavManager.IsFile(pathPart)) { - var fileBytes = _webdavManager.GetFileBytes(pathPart); - return File(fileBytes, MediaTypeNames.Application.Octet, fileName); + var resource = _webdavManager.GetResource(pathPart); + + return new FileStreamResult(resource.GetReadStream(), resource.ContentType); } try @@ -293,22 +293,25 @@ namespace WebsitePanel.WebDavPortal.Controllers var uri = string.Format("{0}/{1}WOPISrc={2}&access_token={3}", WebDavAppConfigManager.Instance.OfficeOnline.Url, owaOpenerUri, Server.UrlEncode(wopiSrc), Server.UrlEncode(accessToken.AccessToken.ToString("N"))); string fileName = fileUrl.Split('/').Last(); + string folder = pathPart.ReplaceLast(fileName, "").Trim('/'); - return View("ShowOfficeDocument", new OfficeOnlineModel(uri, fileName)); + return View("ShowOfficeDocument", new OfficeOnlineModel(uri, fileName, folder)); } public ActionResult ViewOfficeDocument(string org, string pathPart) { var owaOpener = WebDavAppConfigManager.Instance.OfficeOnline.Single(x => x.Extension == Path.GetExtension(pathPart)); - return ShowOfficeDocument(org, pathPart, owaOpener.OwaView); + var owaOpenerUrl = Request.Browser.IsMobileDevice ? owaOpener.OwaMobileViev : owaOpener.OwaView; + + return ShowOfficeDocument(org, pathPart, owaOpenerUrl); } public ActionResult EditOfficeDocument(string org, string pathPart) { var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart); - if (permissions.HasFlag(WebDavPermissions.Write) == false) + if (permissions.HasFlag(WebDavPermissions.Write) == false || Request.Browser.IsMobileDevice) { return new RedirectToRouteResult(FileSystemRouteNames.ViewOfficeOnline, null); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/OfficeOnlineModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/OfficeOnlineModel.cs index 1fe27ec1..c1b61cac 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/OfficeOnlineModel.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/OfficeOnlineModel.cs @@ -6,11 +6,13 @@ namespace WebsitePanel.WebDavPortal.Models { public string Url { get; set; } public string FileName { get; set; } + public string Backurl { get; set; } - public OfficeOnlineModel(string url, string fileName) + public OfficeOnlineModel(string url, string fileName, string backUrl) { Url = url; FileName = fileName; + Backurl = backUrl; } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml index c7e77f2c..b36be144 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml @@ -19,7 +19,7 @@ else { @Html.Partial("_ShowContentTopMenu", Model) - + @Html.Action("ContentList", "FileSystem", new { model = Model }); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowOfficeDocument.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowOfficeDocument.cshtml index 2ace119b..eef2ce6b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowOfficeDocument.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowOfficeDocument.cshtml @@ -1,6 +1,7 @@ -@model WebsitePanel.WebDavPortal.Models.OfficeOnlineModel +@using WebsitePanel.WebDavPortal.UI.Routes +@model WebsitePanel.WebDavPortal.Models.OfficeOnlineModel @{ - Layout = null; + Layout = null; } @@ -8,9 +9,25 @@ @Html.Raw(Model.FileName) + @if (Request.Browser.IsMobileDevice) + { + @Styles.Render("~/Content/css") + } -