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

@ -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>