webdav portal statistic added

This commit is contained in:
vfedosevich 2015-01-20 04:51:23 -08:00
parent a882072b02
commit d82dfbfb56
11 changed files with 87 additions and 6 deletions

View file

@ -45,4 +45,13 @@ textarea {
#logout :hover {
color: white;
}
.web-dav-folder-progress {
margin-bottom: 0px;
}
.modal-vertical-centered {
margin-top: 25%;
}

View file

@ -7,6 +7,7 @@ using System.Net.Mime;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using log4net;
using WebsitePanel.WebDav.Core;
using WebsitePanel.WebDav.Core.Client;
using WebsitePanel.WebDav.Core.Config;
@ -32,6 +33,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
private readonly IAuthenticationService _authenticationService;
private readonly IAccessTokenManager _tokenManager;
private readonly IWebDavAuthorizationService _webDavAuthorizationService;
private readonly ILog Log;
public FileSystemController(ICryptography cryptography, IWebDavManager webdavManager, IAuthenticationService authenticationService, IAccessTokenManager tokenManager, IWebDavAuthorizationService webDavAuthorizationService)
{
@ -40,6 +42,8 @@ namespace WebsitePanel.WebDavPortal.Controllers
_authenticationService = authenticationService;
_tokenManager = tokenManager;
_webDavAuthorizationService = webDavAuthorizationService;
Log = LogManager.GetLogger(this.GetType());
}
[HttpGet]

View file

@ -87,6 +87,15 @@ namespace WebsitePanel.WebDavPortal.UI {
}
}
/// <summary>
/// Looks up a localized string similar to Gb.
/// </summary>
public static string GigabyteShort {
get {
return ResourceManager.GetString("GigabyteShort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Processing.
/// </summary>

View file

@ -126,6 +126,9 @@
<data name="FileUpload" xml:space="preserve">
<value>File Upload</value>
</data>
<data name="GigabyteShort" xml:space="preserve">
<value>Gb</value>
</data>
<data name="Processing" xml:space="preserve">
<value>Processing</value>
</data>

View file

@ -3,6 +3,7 @@
@using WebsitePanel.WebDav.Core.Config
@using WebsitePanel.WebDavPortal.FileOperations
@using Ninject;
@using WebsitePanel.WebDavPortal.UI
@using WebsitePanel.WebDavPortal.UI.Routes
@model IHierarchyItem
@ -24,10 +25,31 @@
href = Model.Href.AbsolutePath;
break;
}
var resource = Model as IResource;
bool showStatistic = Model.ItemType == ItemType.Folder && Model.IsRootItem && resource != null;
int percent = 0;
if (showStatistic)
{
percent = (int)(resource.AllocatedSpace != 0 ? 100 * resource.ContentLength / resource.AllocatedSpace : 0);
}
}
<div class="col-sm-2 element-container">
<a href="@href" @Html.Raw(isTargetBlank ? "target=\"_blank\"" : string.Empty) title="@name">
<img class="icon-size" src="@Url.Content(actualPath)" />
<p style="word-wrap: break-word;">@name</p>
</a>
@if (showStatistic)
{
<div class="progress web-dav-folder-progress">
<div class="progress-bar" role="progressbar" aria-valuenow="@percent" aria-valuemin="0" aria-valuemax="100" style="width: @percent%;">
@percent%
</div>
</div>
<p>@Math.Round(Convert.ToDecimal(resource.ContentLength) / 1024, 2) / @Math.Round(Convert.ToDecimal(resource.AllocatedSpace) / 1024, 2) @Resources.GigabyteShort</p>
}
</div>

View file

@ -1,10 +1,16 @@
@using WebsitePanel.WebDavPortal.UI
<div id="processDialog" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div id="processDialog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-process-dialog-title" data-backdrop="static" data-keyboard="false" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-vertical-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="modal-process-dialog-title">@Resources.ProcessingWithDots</h4>
</div>
<div class="modal-body">
<h4 class="modal-title">@Resources.ProcessingWithDots</h4>
<div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">
</div>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->

View file

@ -264,7 +264,7 @@
<Content Include="Views\FileSystem\ShowOfficeDocument.cshtml" />
<Content Include="Views\FileSystem\_ResourseCollectionPartial.cshtml" />
<Content Include="Views\FileSystem\_ResoursePartial.cshtml" />
<Content Include="Views\Shared\ProcessDialog.cshtml" />
<Content Include="Views\Shared\_ProcessDialog.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Views\Owa\" />