1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

huge commit for webfront facelift

This commit is contained in:
RaidMax
2022-04-19 18:43:58 -05:00
parent 7b78e0803a
commit d5b4c60e5a
105 changed files with 2981 additions and 2545 deletions

View File

@ -2,7 +2,7 @@
@using System.Text.RegularExpressions
@model WebfrontCore.ViewModels.CommunityInfo
@{
IEnumerable<KeyValuePair<(string, long), string[]>> allRules = new[] {new KeyValuePair<(string, long), string[]>((ViewBag.Localization["WEBFRONT_ABOUT_GLOBAL_RULES"], 0), Model.GlobalRules)};
IEnumerable<KeyValuePair<(string, long), string[]>> allRules = new[] { new KeyValuePair<(string, long), string[]>((ViewBag.Localization["WEBFRONT_ABOUT_GLOBAL_RULES"], 0), Model.GlobalRules) };
var serverRules = Model.ServerRules?.Where(server => server.Value != null && server.Value.Any()).ToList();
if (serverRules?.Any() ?? false)
{
@ -10,26 +10,29 @@
}
}
<div class="row text-break">
<div class="content text-wrap mt-20">
@if (Model.CommunityInformation.EnableBanner)
{
<img class="img-fluid mb-3" style="max-height: 250px" src="images/community/banner.png" alt="@Model.CommunityInformation.Name"/>
<img class="img-fluid mb-20" style="max-height: 250px" src="images/community/banner.png" alt="@Model.CommunityInformation.Name"/>
}
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Name))
{
<h2 class="mb-4 p-0 col-12 text-center text-md-left">
<h2 class="content-title">
<color-code value="@Model.CommunityInformation.Name"></color-code>
</h2>
}
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Description))
{
<div class="p-4 bg-dark border border-primary mb-4 text-white-50 col-12">
<h4 class="text-primary">@ViewBag.Localization["WEBFRONT_ABOUT_TITLE"]</h4>
<color-code value="@Model.CommunityInformation.Description"></color-code>
<div class="mt-3">
@foreach (var social in Model.CommunityInformation.SocialAccounts ?? new SocialAccountConfiguration[0])
<div class="card m-0 rounded">
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Description))
{
<h5 class="text-primary mt-0">@ViewBag.Localization["WEBFRONT_ABOUT_TITLE"]</h5>
<div class="text-md-justify">
<color-code value="@Model.CommunityInformation.Description"></color-code>
</div>
<div class="mt-10">
@foreach (var social in Model.CommunityInformation.SocialAccounts ?? Array.Empty<SocialAccountConfiguration>())
{
<div>
<a href="@social.Url" target="_blank" title="@social.Title">
@ -39,8 +42,8 @@
}
else if (!string.IsNullOrWhiteSpace(social.IconUrl))
{
var url = Uri.TryCreate(social.IconUrl, UriKind.Absolute, out var parsedUrl)
? parsedUrl.AbsoluteUri
var url = Uri.TryCreate(social.IconUrl, UriKind.Absolute, out var parsedUrl)
? parsedUrl.AbsoluteUri
: $"images/community/{social.IconUrl}";
<img class="img-fluid" style="max-width: 1rem; fill: white" src="@url" alt="@social.Title"/>
}
@ -49,37 +52,40 @@
</div>
}
</div>
</div>
}
}
</div>
@if (allRules.Any(rule => rule.Value.Any()))
{
<h2 class="pb-3 p-0 col-12 text-center text-md-left">@ViewBag.Localization["WEBFRONT_ABOUT_COMMUNITY_GUIDELINES"]</h2>
<h2 class="content-title mt-20">@ViewBag.Localization["WEBFRONT_ABOUT_COMMUNITY_GUIDELINES"]</h2>
}
@foreach (var ((serverName, id), rules) in allRules)
{
if (!rules.Any())
<div class="card m-0 rounded">
@foreach (var ((serverName, id), rules) in allRules)
{
continue;
}
if (!rules.Any())
{
continue;
}
var start = 1;
<div class="col-12 bg-dark p-4 border border-primary mb-4 col-12">
<div class="text-primary h4">
var start = 1;
<h5 class="text-primary mt-0">
<color-code value="@serverName"></color-code>
</div>
</h5>
@foreach (var rule in rules)
{
<div class="text-white-50">
<div class="rule">
@if (!rule.StartsWith("#") && !Regex.IsMatch(rule, @"^\d+(.|\))"))
{
<span class="text-white">@start.</span>
<span>@start.</span>
}
<color-code value="@rule"></color-code>
<span class="text-muted">
<color-code value="@rule"></color-code>
</span>
</div>
start++;
}
</div>
}
}
</div>
</div>

View File

@ -1,16 +1,22 @@
@model WebfrontCore.ViewModels.ActionInfo
@using Humanizer
@model WebfrontCore.ViewModels.ActionInfo
@{
Layout = null;
}
<h5 class="modal-title mb-10">@Model.Name.Titleize()</h5>
@if (Model.Inputs.Any())
{
<hr class="mb-10"/>
}
<form class="action-form @(Model.ShouldRefresh ? "refreshable" : "")" action="/Action/@Model.Action">
@foreach (var input in Model.Inputs)
{
string inputType = input.Type ?? "text";
string value = input.Value ?? "";
var inputType = input.Type ?? "text";
var value = input.Value ?? "";
if (input.Type != "hidden")
{
<div class="input-group mb-3">
<div class="input-group mb-10">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon-@input.Name">@input.Label</span>
@ -21,7 +27,9 @@
<select name="@input.Name" class="form-control" aria-label="@input.Name" aria-describedby="basic-addon-@input.Name">
@foreach (var item in input.Values)
{
<option value="@item.Key"><color-code value="@item.Value"></color-code></option>
<option value="@item.Key">
<color-code value="@item.Value"></color-code>
</option>
}
</select>
}
@ -37,7 +45,7 @@
else
{
<input type="@inputType" name="@input.Name" value="@value" class="form-control" placeholder="@input.Placeholder" aria-label="@input.Name" aria-describedby="basic-addon-@input.Name">
<input type="@inputType" name="@input.Name" value="@value" class="form-control @(input.Required ? "required" : "")" placeholder="@input.Placeholder" aria-label="@input.Name" aria-describedby="basic-addon-@input.Name">
}
</div>
@ -47,5 +55,12 @@
<input type="@inputType" name="@input.Name" value="@value" hidden="hidden">
}
}
<button type="submit" class="btn btn-block btn-primary">@Model.ActionButtonLabel</button>
@if (Model.Inputs.Any())
{
<hr class="mb-10"/>
}
<div class="ml-auto">
<button type="submit" class="btn btn-primary">@Model.ActionButtonLabel</button>
<a href="#" class="btn mr-5" role="button">Close</a>
</div>
</form>

View File

@ -1,26 +1,26 @@
@{
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
}
<h4 class="pb-3 text-center">@ViewBag.Title</h4>
<div class="content mt-0">
<h2 class="content-title mt-20">@ViewBag.Title</h2>
<table class="table table-striped">
<thead class="d-none d-lg-table-header-group">
<tr class="bg-primary pt-2 pb-2">
<table class="table">
<thead class="d-none d-lg-table-header-group">
<tr class="bg-primary text-light pt-2 pb-2">
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<th scope="col">@loc["WEBFRONT_ADMIN_AUDIT_LOG_INFO"]</th>
<!--<th scope="col">@loc["WEBFRONT_ADMIN_AUDIT_LOG_PREVIOUS"]</th>-->
<th scope="col">@loc["WEBFRONT_ADMIN_AUDIT_LOG_CURRENT"]</th>
<th scope="col" class="text-right">@loc["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</th>
</tr>
</thead>
<tbody id="audit_log_table_body" class="border-bottom bg-dark">
<partial name="_ListAuditLog" />
</tbody>
</table>
<span id="load_audit_log_button" class="loader-load-more oi oi-chevron-bottom text-center text-primary w-100 h3 pb-0 mb-0 d-none d-lg-block"></span>
</thead>
<tbody id="audit_log_table_body" class="border-bottom bg-dark">
<partial name="_ListAuditLog"/>
</tbody>
</table>
<i id="loaderLoad" class="loader-load-more oi oi-chevron-bottom text-center text-primary d-none d-lg-block mt-10"></i>
</div>
@section scripts {
<environment include="Development">

View File

@ -1,99 +1,71 @@
@using SharedLibraryCore.Dtos
@model IEnumerable<AuditInfo>
@{
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
var loc = Utilities.CurrentLocalization.LocalizationIndex;
}
@foreach (var info in Model)
{
<!-- mobile -->
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
<td class="text-light">
@info.Action
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.OriginId" class="link-inverse">
<color-code value="@info.OriginName"></color-code>
</a>
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<td>
@if (info.TargetId != null)
{
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.TargetId" class="link-inverse">
<color-code value="@info.TargetName"></color-code>
</a>
}
else
{
<span>--</span>
}
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_ADMIN_AUDIT_LOG_INFO"]</th>
<td class="text-light">
@info.Data
</td>
</tr>
@*<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_ADMIN_AUDIT_LOG_PREVIOUS"]</th>
<td class="text-light">
@info.OldValue
</td>
</tr>*@
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_ADMIN_AUDIT_LOG_CURRENT"]</th>
<td class="text-light">
@info.NewValue
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="w-25 bg-primary" style="border-bottom: 1px solid #222">@loc["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</th>
<td class="text-light mb-2 border-bottom">
@info.When.ToString()
</td>
</tr>
<!-- desktop -->
<tr class="d-none d-lg-table-row">
<td class="text-light font-weight-bold">
<tr class="d-none d-lg-table-row bg-dark-dm bg-light-lm">
<td class="font-weight-bold">
@info.Action
</td>
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.OriginId" class="link-inverse">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@info.OriginId">
<color-code value="@info.OriginName"></color-code>
</a>
</td>
<td>
@if (info.TargetId != null)
{
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.TargetId" class="link-inverse">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@info.TargetId">
<color-code value="@info.TargetName"></color-code>
</a>
}
else
{
<span>--</span>
<span>&ndash;</span>
}
</td>
<td class="text-light">
@info.Data
@*<td class="text-light">
@info.OldValue
</td>*@
<td class="text-light">
<td>
@info.Data
<td >
@info.NewValue
</td>
<td class="text-light text-right">
<td class="text-right">
@info.When.ToString()
</td>
</tr>
<!-- mobile -->
<tr class="d-table-row d-lg-none d-flex bg-dark-dm bg-light-lm">
<td class="bg-primary text-light text-right flex-grow-0">
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_ADMIN_AUDIT_LOG_INFO"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_ADMIN_AUDIT_LOG_CURRENT"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</div>
</td>
<td>
<div class="mt-5 mb-5">@info.Action</div>
<a asp-controller="Client" asp-action="Profile" asp-route-id="@info.OriginId" class="link-inverse">
<color-code value="@info.OriginName"></color-code>
</a>
@if (info.TargetId != null)
{
<a asp-controller="Client" asp-action="Profile" asp-route-id="@info.TargetId" class="mt-5 mb-5">
<color-code value="@info.TargetName"></color-code>
</a>
}
else
{
<div class="mt-5 mb-5">&ndash;</div>
}
<div class="mt-5 mb-5"> @info.Data</div>
<div class="mt-5 mb-5">@info.NewValue</div>
<div class="mt-5 mb-5">@info.When.ToString()</div>
</td>
</tr>
}

View File

@ -3,60 +3,71 @@
var loc = Utilities.CurrentLocalization.LocalizationIndex;
}
<div class="row d-none d-lg-block ">
<h4 class="pb-2 text-center col-12">@ViewBag.Title</h4>
<div class="mr-auto ml-auto col-12 col-lg-8 border-bottom">
<div class="row pt-2 pb-2 bg-primary">
<div class="col-5 ">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</div>
<div class="col-4">@loc["WEBFRONT_PROFILE_LEVEL"]</div>
<div class="col-3 text-right">@loc["WEBFRONT_SEARCH_LAST_CONNECTED"]</div>
</div>
<!-- desktop -->
<div class="content mt-0">
<h2 class="content-title mt-20">@ViewBag.ResultCount result(s) for <span class="badge badge-primary font-size-18">@ViewBag.SearchTerm</span></h2>
<table class="table d-none d-md-table">
<thead>
<tr class="bg-primary text-light">
<td>@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</td>
<td>@loc["WEBFRONT_PROFILE_LEVEL"]</td>
<td class="text-right">@loc["WEBFRONT_SEARCH_LAST_CONNECTED"]</td>
</tr>
</thead>
<tbody>
@foreach (var client in Model)
{
<div class="row pt-2 pb-2 bg-dark">
<div class="col-5">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
<tr class="bg-dark-dm bg-light-lm">
<td class="col-5">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId">
<color-code value="@client.Name"></color-code>
</a>
</div>
</td>
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
{
<div class="col-4 level-color-0">@loc["GLOBAL_PERMISSION_USER"]</div>
<td class="col-3 level-color-0">@loc["GLOBAL_PERMISSION_USER"]</td>
}
else
{
<div class="col-4 level-color-@client.LevelInt">@client.Level</div>
<td class="col-3 level-color-@client.LevelInt">@client.Level</td>
}
<div class="col-3 text-right">@client.LastConnectionText</div>
</div>
<td class="col-4 text-right">@client.LastConnection.HumanizeForCurrentCulture()</td>
</tr>
}
</div>
</div>
<div class="row d-lg-none">
<div class="w-100 bg-primary text-center h3 mb-0 p-3" style="border-bottom: 1px solid #222">@ViewBag.Title</div>
@foreach (var client in Model)
{
<div class="col-5 bg-primary font-weight-bold" style="border-bottom: 1px solid #222">
<div class="p-2">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</div>
<div class="p-2">@loc["WEBFRONT_PROFILE_LEVEL"]</div>
<div class="p-2">@loc["WEBFRONT_SEARCH_LAST_CONNECTED"]</div>
</div>
<div class="col-7 bg-dark border-bottom">
<div class="p-2">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="link-inverse">
<color-code value="@client.Name"></color-code>
</a>
</div>
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
{
<div class="p-2 level-color-0">@loc["GLOBAL_PERMISSION_USER"]</div>
}
else
{
<div class="p-2 level-color-@client.LevelInt">@client.Level</div>
}
<div class="p-2 text-white-50">@client.LastConnectionText</div>
</div>
}
</tbody>
</table>
<!--- mobile -->
<table class="table bg-dark-dm bg-light-lm d-md-none">
<tbody>
@foreach (var client in Model)
{
<tr class="d-flex">
<td class="bg-primary text-light">
<div>@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</div>
<div>@loc["WEBFRONT_PROFILE_LEVEL"]</div>
<div>@loc["WEBFRONT_SEARCH_LAST_CONNECTED"]</div>
</td>
<td class="flex-grow">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="link-inverse">
<color-code value="@client.Name"></color-code>
</a>
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
{
<div class="p-2 level-color-0">@loc["GLOBAL_PERMISSION_USER"]</div>
}
else
{
<div class="p-2 level-color-@client.LevelInt">@client.Level</div>
}
<div>@client.LastConnection.HumanizeForCurrentCulture()</div>
</td>
</tr>
}
</tbody>
</table>
</div>

View File

@ -1,30 +1,33 @@
@using SharedLibraryCore.Dtos.Meta.Responses
@model SharedLibraryCore.Helpers.ResourceQueryHelperResult<MessageResponse>
<div class="content mt-0">
@if (ViewBag.Error != null)
{
<h4 class="text-red">@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_INVALID_QUERY"], ViewBag.Error.Message)</h4>
<h2 class="content-title text-red mt-20">@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_INVALID_QUERY"], ViewBag.Error.Message)</h2>
}
else
{
<h4 class="pb-3 text-center">@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_STATS_MESSAGES_FOUND"], Model.TotalResultCount.ToString("N0"))</h4>
<h2 class="content-title mt-20">@Html.Raw(Utilities.FormatExt(ViewBag.Localization["WEBFRONT_STATS_MESSAGES_FOUND"], $"<span class=\"badge badge-primary font-size-18\">{Model.TotalResultCount.ToString("N0")}</span>"))</h2>
<table class="table table-striped table-hover">
<table class="table bg-dark-dm bg-light-lm rounded" style="table-layout: fixed">
<thead class="d-none d-lg-table-header-group">
<tr class="bg-primary pt-2 pb-2">
<th scope="col">@ViewBag.Localization["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<th scope="col">@ViewBag.Localization["WEBFRONT_ACTION_LABEL_MESSAGE"]</th>
<th scope="col">@ViewBag.Localization["WEBFRONT_STATS_MESSAGE_SERVER_NAME"]</th>
<th scope="col" class="text-right">@ViewBag.Localization["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</th>
<tr class="bg-primary text-light">
<th colspan="20%">@ViewBag.Localization["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<th colspan="45%">@ViewBag.Localization["WEBFRONT_ACTION_LABEL_MESSAGE"]</th>
<th colspan="20%">@ViewBag.Localization["WEBFRONT_STATS_MESSAGE_SERVER_NAME"]</th>
<th colspan="15%" class="text-right">@ViewBag.Localization["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</th>
</tr>
</thead>
<tbody id="message_table_body" class="border-bottom bg-dark">
<tbody id="message_table_body">
<partial name="~/Views/Client/Message/_Item.cshtml" model="@Model.Results" />
</tbody>
</table>
<span id="load_more_messages_button" class="loader-load-more oi oi-chevron-bottom text-center text-primary w-100 h3 pb-0 mb-0 d-none d-lg-block"></span>
<div id="loaderLoad" class="mt-10 m-auto text-center d-none d-lg-block">
<i class="loader-load-more oi oi-chevron-bottom "></i>
</div>
@section scripts {
<environment include="Development">
@ -36,4 +39,5 @@ else
});
</script>
}
}
}
</div>

View File

@ -5,64 +5,56 @@
{
<!-- desktop -->
<tr class="d-none d-lg-table-row">
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@message.ClientId" class="link-inverse">
<td colspan="20%" class="text-break">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@message.ClientId" class="link-inverse">
<color-code value="@message.ClientName"></color-code>
</a>
</td>
<td class="text-light w-50 text-break">
<td colspan="45%" class="text-break">
@if (message.IsHidden && !ViewBag.Authorized)
{
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
<color-code value="@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
}
else
{
<color-code value="@message.Message"></color-code>
}
</td>
<td class="text-light">
<td colspan="20%" class="text-break">
<color-code value="@(message.ServerName ?? "--")"></color-code>
</td>
<td class="text-right text-light">
<td colspan="15%" class="text-right text-break">
@message.When
</td>
</tr>
<!-- mobile -->
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@ViewBag.Localization["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<td class="text-light">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@message.ClientId" class="link-inverse">
<tr class="d-flex d-lg-none">
<td class="bg-primary text-light">
<div>@ViewBag.Localization["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</div>
<div>@ViewBag.Localization["WEBFRONT_ACTION_LABEL_MESSAGE"]</div>
<div>@ViewBag.Localization["WEBFRONT_STATS_MESSAGE_SERVER_NAME"]</div>
<div>@ViewBag.Localization["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</div>
</td>
<td class="flex-fill">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@message.ClientId">
<color-code value="@message.ClientName"></color-code>
</a>
</td>
</tr>
<div>
@if (message.IsHidden && !ViewBag.Authorized)
{
<color-code value="@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
}
else
{
<color-code value="@message.Message"></color-code>
}
</div>
<div>
<color-code value="@(message.ServerName ?? "--")"></color-code>
</div>
<div> @message.When</div>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@ViewBag.Localization["WEBFRONT_ACTION_LABEL_MESSAGE"]</th>
<td class="text-light">
@if (message.IsHidden && !ViewBag.Authorized)
{
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
}
else
{
<color-code value="@message.Message"></color-code>
}
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@ViewBag.Localization["WEBFRONT_STATS_MESSAGE_SERVER_NAME"]</th>
<td class="text-light">
<color-code value="@(message.ServerName ?? "--")"></color-code>
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary" style="border-bottom: 1px solid #222">@ViewBag.Localization["WEBFRONT_ADMIN_AUDIT_LOG_TIME"]</th>
<td class="text-light mb-2 border-bottom">
@message.When
</td>
</tr>
}

View File

@ -1,24 +1,31 @@
@model Dictionary<SharedLibraryCore.Database.Models.EFClient.Permission, IList<SharedLibraryCore.Dtos.ClientInfo>>
<div class="content mt-0">
<h4 class="content-title mt-20">@ViewBag.Title</h4>
<h4 class="pb-3 text-center ">@ViewBag.Title</h4>
<div class="row border-bottom">
@{
foreach (var key in Model.Keys)
{
<div class="col-12 bg-primary pt-2 pb-2">
@Utilities.ToLocalizedLevelName(key)
</div>
<div class="col-12 bg-dark pt-2 pb-2">
@foreach (var client in Model[key])
{
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
<color-code value="@client.Name"></color-code>
</a>
<br />
}
</div>
}
@foreach (var key in Model.Keys)
{
<table class="table mb-20">
<thead>
<tr class="level-bgcolor-@((int)key)">
<th class="text-light">@key.ToLocalizedLevelName()</th>
<th class="text-right font-weight-bold">Last Connected</th>
</tr>
</thead>
<tbody>
@foreach (var client in Model[key].OrderByDescending(client => client.LastConnection))
{
<tr class="bg-dark-dm bg-light-lm">
<td>
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId">
<color-code value="@client.Name"></color-code>
</a>
</td>
<td class="text-right">
@client.LastConnection.HumanizeForCurrentCulture()
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -1,6 +1,8 @@
@using SharedLibraryCore.Interfaces
@using Data.Models
@using Data.Models.Client
@using WebfrontCore.Permissions
@using WebfrontCore.ViewModels
@model SharedLibraryCore.Dtos.PlayerInfo
@{
var match = System.Text.RegularExpressions.Regex.Match(Model.Name.ToUpper(), "[A-Z]").Value;
@ -11,70 +13,39 @@
var isTempBanned = Model.ActivePenalty?.Type == EFPenalty.PenaltyType.TempBan;
var translationKey = $"WEBFRONT_PROFILE_{Model.ActivePenalty?.Type.ToString().ToUpper()}_INFO";
var ignoredMetaTypes = new[] { MetaType.Information, MetaType.Other, MetaType.QuickMessage };
string ClassForPenaltyType(EFPenalty.PenaltyType type)
{
return type switch
{
EFPenalty.PenaltyType.Ban => "alert-danger",
EFPenalty.PenaltyType.Flag => "alert-secondary",
EFPenalty.PenaltyType.TempBan => "alert-secondary",
_ => "alert"
};
}
string ClassForProfileBackground()
{
return (ViewBag.PermissionsSet as IEnumerable<string>).HasPermission(WebfrontEntity.ClientLevel, WebfrontPermission.Read) ? $"level-bgcolor-{Model.LevelInt}" : "level-bgcolor-0";
}
}
<div id="profile_wrapper" class="pb-3 row d-flex flex-column flex-lg-row">
<!-- Initial/Avatar Column -->
<div id="profile_avatar" class="d-block d-lg-inline-flex flex-column mr-auto ml-auto mr-lg-0 ml-lg-0 justify-content-center text-center level-bgcolor-@(!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy ? "0" : Model.LevelInt.ToString()) @(isTempBanned ? "penalties-bgcolor-tempban" : "")" style="background-image:url('@string.Format("https://gravatar.com/avatar/{0}?size=168&default=blank&rating=pg", gravatarUrl)')">
@if (string.IsNullOrEmpty(gravatarUrl))
{
<span class="profile-shortcode">@shortCode</span>
}
</div>
<!-- Name/Level Column -->
<div class="w-50 d-block d-lg-inline-flex flex-column flex-fill text-center text-lg-left pb-3 pb-lg-0 pt-3 pt-lg-0 pl-3 pr-3 ml-auto mr-auto" style="overflow-wrap: anywhere">
<div class="mt-n2 d-block d-lg-inline-flex @(ViewBag.Authorized ? "" : "flex-fill")">
<div id="profile_name" class="client-name h1 mb-0">
<color-code value="@Model.Name"></color-code>
</div>
@if (ViewBag.Authorized)
{
<div id="profile_aliases_btn" class="oi oi-caret-bottom h3 ml-0 ml-lg-2 mb-0 pt-lg-2 mt-lg-1"></div>
}
</div>
@if (ViewBag.Authorized)
{
<div class="d-flex flex-row justify-content-start flex-fill flex-column flex-lg-row mr-lg-2 mb-2 mb-md-0">
<div class="ip-lookup-profile align-self-center mr-0 mr-lg-2 ml-lg-n1" data-ip="@Model.IPAddress"></div>
<div id="ip_lookup_country" class="h4 mb-2 mb-lg-0 align-self-center text-muted"></div>
</div>
<div id="profile_aliases" class="text-muted pt-0 pt-lg-2 pb-2">
@foreach (var linked in Model.LinkedAccounts)
{
<div>
@Html.ActionLink(linked.Value.ToString("X"), "ProfileAsync", "Client", new { id = linked.Key }, new { @class = "link-inverse" })
</div>
}
@foreach (var alias in Model.Aliases)
{
<div>
<color-code value="@alias"></color-code>
</div>
}
@foreach (var ip in Model.IPs)
{
<div>
<a class="ip-locate-link" href="#" data-ip="@ip">@ip</a>
<a href="/Client/FindAsync?clientName=@ip" class="oi oi-magnifying-glass text-muted"></a>
</div>
}
</div>
}
@if (Model.ActivePenalty != null && (Model.ActivePenalty.Type != EFPenalty.PenaltyType.Flag || ViewBag.Authorized))
{
<div class="font-weight-bold h4 mb-0 penalties-color-@Model.ActivePenalty.Type.ToString().ToLower()">
<div class="content row mt-20">
<div class="col-12 col-lg-9 col-xl-10">
@if (Model.ActivePenalty != null)
{
<has-permission entity="ClientLevel" required-permission="Read">
<div class="alert @ClassForPenaltyType(Model.ActivePenalty.Type) mt-10 mb-10" role="alert">
@foreach (var result in Utilities.SplitTranslationTokens(translationKey))
{
switch (result.MatchValue)
{
case "reason":
<span class="text-white font-weight-lighter">@(ViewBag.Authorized ? !string.IsNullOrEmpty(Model.ActivePenalty.AutomatedOffense) && Model.ActivePenalty.Type != EFPenalty.PenaltyType.Warning ? Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_ANTICHEAT_DETECTION"], Model.ActivePenalty.AutomatedOffense) : Model.ActivePenalty.Offense.StripColors() : Model.ActivePenalty.Offense.StripColors())</span>
<span class="text-light-dm font-weight-lighter">@(ViewBag.Authorized ? !string.IsNullOrEmpty(Model.ActivePenalty.AutomatedOffense) && Model.ActivePenalty.Type != EFPenalty.PenaltyType.Warning ? Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_ANTICHEAT_DETECTION"], Model.ActivePenalty.AutomatedOffense) : Model.ActivePenalty.Offense.StripColors() : Model.ActivePenalty.Offense.StripColors())</span>
break;
case "time":
<span class="text-white font-weight-lighter">
<span class="text-light-dm font-weight-lighter">
@((Model.ActivePenalty.Expires.Value - DateTime.UtcNow).HumanizeForCurrentCulture())
</span>
break;
@ -84,121 +55,261 @@
}
}
</div>
}
else
</has-permission>
}
<h2 class="content-title mb-10">Player Profile</h2>
<div id="profile_wrapper" class="mb-10 mt-10">
<!-- online status indicator -->
@if (Model.Online)
{
if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
{
<div id="profile_level" class="font-weight-bold h4 mb-0 level-color-0">
@ViewBag.Localization["GLOBAL_PERMISSION_USER"]
<div class="bg-success rounded-circle position-absolute status-indicator z-20 mt-10 ml-10" data-toggle="tooltip" data-placement="bottom" data-title="Client is online"></div>
<div class="bg-success rounded-circle position-absolute status-indicator with-ripple z-10 mt-10 ml-10"></div>
}
<!-- main profile row -->
<div class="card p-20 ml-0 mr-0 mt-0 mb-10 d-flex flex-fill flex-wrap flex-column flex-md-row justify-content-center">
<div class="d-flex flex-column flex-md-row">
<div id="profile_avatar" class="w-150 w-md-100 h-150 h-md-100 mt-10 mb-10 d-flex justify-content-center align-self-center rounded @ClassForProfileBackground() @(isTempBanned ? "penalties-bgcolor-tempban" : "")" style="background-image:url('@($"https://gravatar.com/avatar/{gravatarUrl}?size=168&default=blank&rating=pg")">
@if (string.IsNullOrEmpty(gravatarUrl))
{
<div class="profile-shortcode align-self-center text-dark-lm">@shortCode</div>
}
</div>
}
<div class="d-flex flex-column align-self-center ml-20 mr-20 mt-10 mb-10 mt-md-0 mb-md-0 text-center text-md-left">
<!-- name -->
<div id="profile_name">
<span class="font-size-20 font-weight-medium">
<color-code value="@Model.Name"></color-code>
</span>
<has-permission entity="MetaAliasUpdate" required-permission="Read">
<div class="dropdown dropright with-arrow">
<div data-toggle="dropdown" id="profileAliasHistory" aria-haspopup="true" aria-expanded="false">
@if (Model.Aliases.Any())
{
<i class="oi oi-caret-bottom font-size-12" aria-hidden="true"></i>
}
</div>
else
{
<div id="profile_level" class="font-weight-bold h4 mb-0 level-color-@Model.LevelInt">
@Model.Level
<div class="dropdown-menu @(Model.Aliases.Where(alias => !alias.Item1.Contains(" ")).Max(alias => (int?)alias.Item1.Length) >= 15 ? "w-250" : "") " aria-labelledby="profileAliasHistory">
@foreach (var (alias, dateAdded) in Model.Aliases.OrderByDescending(alias => alias.Item2).Take(15))
{
<a asp-controller="Client" asp-action="Find" asp-route-clientName="@alias" class="dropdown-item" data-toggle="tooltip" data-title="@dateAdded.HumanizeForCurrentCulture()">
<i class="oi oi-magnifying-glass text-muted mr-5"></i>
<color-code value="@alias"></color-code>
</a>
}
@if (Model.Aliases.Count > 15)
{
<div class="dropdown-divider"></div>
<span class="dropdown-item bg-dark-dm bg-light-lm">...and @(Model.Aliases.Count - 15) more</span>
}
</div>
</div>
</has-permission>
</div>
<!-- permission level -->
<has-permission entity="ClientLevel" required-permission="Read">
<div class="align-self-center align-self-md-start font-weight-bold font-size-16 level-color-@Model.LevelInt">
<div class="d-flex flex-row">
<span>@Model.Level</span>
</div>
</div>
</has-permission>
<!-- guid -->
<has-permission entity="ClientGuid" required-permission="Read">
<div class="dropdown dropup with-arrow">
<div class="text-muted" data-toggle="dropdown" id="altGuidFormatsDropdown" aria-haspopup="true" aria-expanded="false">@Model.NetworkId.ToString("X")</div>
<div class="dropdown-menu" aria-labelledby="altGuidFormatsDropdown">
<div class="p-10 font-size-12">
<div class="">Alternative Formats</div>
<div class="dropdown-divider mt-5 mb-5"></div>
<div class="text-muted font-weight-lighter">@((ulong)Model.NetworkId)</div>
</div>
</div>
</div>
</has-permission>
<!-- ip address -->
<div class="align-self-center align-self-md-start d-flex flex-row">
<span class="text-muted mr-5">@Model.IPAddress</span>
<has-permission entity="MetaAliasUpdate" required-permission="Read">
<div class="dropdown dropright with-arrow">
<div data-toggle="dropdown" id="profileIPAddressHistory" aria-haspopup="true" aria-expanded="false">
@if (Model.IPs.Any(ip => !string.IsNullOrEmpty(ip.Item1)))
{
<i class="oi oi-caret-bottom font-size-12" aria-hidden="true"></i>
}
</div>
<div class="dropdown-menu" aria-labelledby="profileAliasHistory">
@foreach (var (ip, dateAdded) in Model.IPs.OrderByDescending(ip => ip.Item2).Take(15))
{
<a asp-controller="Client" asp-action="Find" asp-route-clientName="@ip" class="dropdown-item" data-toggle="tooltip" data-title="@dateAdded.HumanizeForCurrentCulture()">
<i class="oi oi-magnifying-glass text-muted mr-5"></i>
<color-code value="@ip"></color-code>
</a>
}
@if (Model.IPs.Count > 15)
{
<div class="dropdown-divider"></div>
<span class="dropdown-item bg-dark-dm bg-light-lm">...and @(Model.IPs.Count - 15) more</span>
}
</div>
</div>
</has-permission>
</div>
</div>
}
}
</div>
</div>
<div class="pr-lg-0 text-center text-lg-right">
@if (ViewBag.Authorized)
{
@if (!isPermBanned)
{
<div class="profile-action oi oi-flag h3 ml-2 @(isFlagged ? "text-secondary" : "text-success")" data-action="@(isFlagged ? "unflag" : "flag")" aria-hidden="true"></div>
}
@if (Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty)
{
<div id="profile_action_ban_btn" class="profile-action oi oi-lock-unlocked text-success h3 ml-2" title="Ban Client" data-action="ban" aria-hidden="true"></div>
}
@if (Model.LevelInt < (int)ViewBag.User.Level && Model.HasActivePenalty)
{
@if (isTempBanned)
{
<div id="profile_action_ban_btn" class="profile-action oi oi-lock-unlocked text-success h3 ml-2" title="Ban Client" data-action="ban" aria-hidden="true"></div>
<div id="profile_action_unban_btn" class="profile-action oi oi-lock-locked penalties-color-tempban h3 ml-2" title="Unban Client" data-action="unban" aria-hidden="true"></div>
}
else
{
<div id="profile_action_unban_btn" class="profile-action oi oi-lock-locked text-danger h3 ml-2" title="Unban Client" data-action="unban" aria-hidden="true"></div>
}
}
@if (Model.LevelInt != -1)
{
<div id="profile_action_edit_btn" class="profile-action oi oi-cog text-muted h3 ml-2" title="Client Options" data-action="edit" aria-hidden="true"></div>
}
}
@if (ViewBag.UseNewStats)
{
<a asp-controller="ClientStatistics" asp-action="Advanced" asp-route-id="@Model.ClientId" class="oi oi-graph text-primary h3 ml-2" title="Stats" aria-hidden="true"></a>
}
</div>
</div>
<div id="profile_info" class="row d-block d-lg-flex flex-row border-bottom border-top pt-2 pb-2">
<partial name="Meta/_Information.cshtml" model="@Model.Meta"/>
</div>
<div class="row border-bottom">
<div class="d-md-flex flex-fill">
<div class="bg-dark p-2 pl-3 pr-3 text-center text-muted border-0 align-self-stretch align-middle" id="filter_meta_container_button">
<span class="text-primary" id="meta_filter_dropdown_icon">▼</span>
<a>@ViewBag.Localization["WEBFRONT_CLIENT_META_FILTER"]</a>
</div>
<div id="filter_meta_container" class="d-none d-md-flex flex-md-fill flex-md-wrap">
@{
const int defaultTabCount = 5;
var metaTypes = Enum.GetValues(typeof(MetaType))
.Cast<MetaType>()
.Where(type => !ignoredMetaTypes.Contains(type))
.OrderByDescending(type => type == MetaType.All)
.ToList();
var selectedMeta = metaTypes.FirstOrDefault(meta => metaTypes.IndexOf(Model.MetaFilterType ?? MetaType.All) >= defaultTabCount && meta != MetaType.All && meta == Model.MetaFilterType);
}
@foreach (var type in metaTypes.Take(defaultTabCount - 1).Append(selectedMeta == MetaType.Other ? metaTypes[defaultTabCount - 1] : selectedMeta))
{
<a asp-action="ProfileAsync" asp-controller="Client"
class="meta-filter nav-link p-2 pl-3 pr-3 text-center @(Model.MetaFilterType.HasValue && Model.MetaFilterType.Value.ToString() == type.ToString() ? "btn-primary text-white" : "text-muted")"
asp-route-id="@Model.ClientId"
asp-route-metaFilterType="@type"
data-meta-type="@type">
@type.ToTranslatedName()
</a>
}
<div class="d-md-none" id="additional_meta_filter">
@foreach (var type in (selectedMeta == MetaType.Other ? metaTypes.Skip(defaultTabCount) : metaTypes.Skip(defaultTabCount).Append(metaTypes[defaultTabCount - 1])).Where(meta => selectedMeta == MetaType.Other || meta != selectedMeta))
{
<a asp-action="ProfileAsync" asp-controller="Client"
class="meta-filter nav-link p-2 pl-3 pr-3 text-center @(Model.MetaFilterType.HasValue && Model.MetaFilterType.Value.ToString() == type.ToString() ? "btn-primary text-white" : "text-muted")"
asp-route-id="@Model.ClientId"
asp-route-metaFilterType="@type"
data-meta-type="@type">
@type.ToTranslatedName()
<div class="flex-fill d-flex justify-content-center justify-content-md-end mt-10 mt-md-0">
<!-- country flag -->
<div id="ipGeoDropdown" class="dropdown dropleft with-arrow align-self-center">
<a href="#" data-toggle="dropdown" id="avatar-popover-toggle" aria-haspopup="true" aria-expanded="false">
@if (!string.IsNullOrEmpty(Model.GeoLocationInfo.CountryCode))
{
<div class="ip-lookup-profile w-100 rounded align-self-center" style="height:5rem;background-image: url('https://flagcdn.com/w80/@(Model.GeoLocationInfo.CountryCode.ToLower()).png')" data-ip="@Model.IPAddress"></div>
}
</a>
}
<div class="dropdown-menu dropdown-menu-center z-30" aria-labelledby="avatar-popover-toggle">
<has-permission entity="ClientIPAddress" required-permission="Read">
<h6 class="dropdown-header font-weight-bold">@Model.IPAddress</h6>
<div class="dropdown-divider"></div>
</has-permission>
<div class="dropdown-item geo-country">@Model.GeoLocationInfo.Country</div>
@if (!string.IsNullOrEmpty(Model.GeoLocationInfo.Region))
{
<div class="dropdown-item text-muted geo-region">@Model.GeoLocationInfo.Region</div>
<div class="dropdown-divider"></div>
}
@if (!string.IsNullOrEmpty(Model.GeoLocationInfo.Organization))
{
<div class="dropdown-item geo-organization">@Model.GeoLocationInfo.Organization</div>
}
</div>
</div>
</div>
</div>
</div>
<!-- meta info block -->
<div class="d-flex flex-column flex-md-row text-center text-md-left flex-wrap">
<partial name="Meta/_Information.cshtml" model="@Model.Meta"/>
</div>
<hr class="mt-10 mb-10"/>
<!-- meta filter list -->
<div class="mb-10 mt-10">
@foreach (var type in Enum.GetValues(typeof(MetaType)).Cast<MetaType>().Where(meta => !ignoredMetaTypes.Contains(meta)).OrderByDescending(meta => meta == MetaType.All))
{
var buttonClass = !Model.MetaFilterType.HasValue && type == MetaType.All || Model.MetaFilterType.HasValue && Model.MetaFilterType.Value.ToString() == type.ToString() ? "btn-primary text-light" : "text-muted";
<a asp-action="Profile" asp-controller="Client"
class="meta-filter no-decoration"
asp-route-id="@Model.ClientId"
asp-route-metaFilterType="@type"
data-meta-type="@type">
<button class="btn btn-sm d-none d-md-inline mt-5 mb-5 @buttonClass">@type.ToTranslatedName()</button>
<button class="btn btn-block d-block d-md-none mt-10 mb-10 @buttonClass">@type.ToTranslatedName()</button>
</a>
}
</div>
@if (!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy || ViewBag.Authorized)
{
<div class="row d-md-flex pt-2">
<div id="profile_events" class="text-muted text-left pl-md-0 pr-md-0">
@await Component.InvokeAsync("ProfileMetaList", new { clientId = Model.ClientId, count = 30, offset = 0, startAt = DateTime.UtcNow, metaType = Model.MetaFilterType })
</div>
</div>
}
<hr class="mt-10 mb-10"/>
<div class="text-center">
<i id="loaderLoad" class="oi oi-chevron-bottom loader-load-more text-primary" aria-hidden="true"></i>
</div>
</div>
@if ((!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy) || ViewBag.Authorized)
{
<div class="row d-md-flex pt-2">
<div id="profile_events" class="text-muted text-left pl-4 pr-4 pl-md-0 pr-md-0">
@await Component.InvokeAsync("ProfileMetaList", new { clientId = Model.ClientId, count = 30, offset = 0, startAt = DateTime.UtcNow, metaType = Model.MetaFilterType })
</div>
</div>
}
<!-- actions desktop -->
@{
var menuItems = new SideContextMenuItems
{
MenuTitle = "Actions",
};
if (Model.Online)
{
menuItems.Items.Add(new SideContextMenuItem
{
Title = "Join Game",
IsLink = true,
IsButton = true,
Reference = Model.ConnectProtocolUrl,
Tooltip = $"Playing on {Model.CurrentServerName.StripColors()}",
Icon = "oi-play-circle"
});
}
if (Model.LevelInt != -1 && ViewBag.Authorized)
{
menuItems.Items.Add(new SideContextMenuItem
{
Title = "Change Level",
IsButton = true,
Reference = "edit",
Icon = "oi-cog",
});
}
menuItems.Items.Add(new SideContextMenuItem
{
Title = "View Stats",
IsButton = true,
IsLink = true,
Reference = Url.Action("Advanced", "ClientStatistics", new { id = Model.ClientId }),
Icon = "oi-graph",
});
if (!isPermBanned && ViewBag.Authorized)
{
menuItems.Items.Add(new SideContextMenuItem
{
Title = isFlagged ? "Unflag" : "Flag",
IsButton = true,
Reference = isFlagged ? "unflag" : "flag",
Icon = "oi-flag"
});
}
if ((Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty || isTempBanned) && ViewBag.Authorized)
{
menuItems.Items.Add(new SideContextMenuItem
{
Title = "Ban",
IsButton = true,
Reference = "ban",
Icon = "oi-lock-unlocked",
});
}
if ((Model.LevelInt < (int)ViewBag.User.Level && Model.HasActivePenalty || isTempBanned) && ViewBag.Authorized)
{
menuItems.Items.Add(new SideContextMenuItem
{
Title = "Unban",
IsButton = true,
Reference = "unban",
Icon = "oi-lock-locked",
});
}
}
<partial name="_SideContextMenu" for="@menuItems"></partial>
<div class="row">
<div class="oi oi-chevron-bottom text-center mt-2 btn btn-primary btn-block loader-load-more" title="Load more meta" data-action="unban" aria-hidden="true"></div>
</div>
@section targetid {

View File

@ -1,53 +1,60 @@
@using SharedLibraryCore.Dtos.Meta.Responses
@model AdministeredPenaltyResponse
@{
string localizationKey = $"WEBFRONT_CLIENT_META_PENALIZED_{Model.PenaltyType.ToString().ToUpper()}_V2";
var localizationKey = $"WEBFRONT_CLIENT_META_PENALIZED_{Model.PenaltyType.ToString().ToUpper()}_V2";
}
<div class="d-inline">
@foreach (var match in Utilities.SplitTranslationTokens(localizationKey))
<has-permission entity="Penalty" required-permission="Read">
@if (TempData["ShowMetaHeader"] as bool? ?? false)
{
if (match.IsInterpolation)
{
if (match.MatchValue == "action")
{
<span class="penalties-color-@Model.PenaltyType.ToString().ToLower()">@match.TranslationValue</span>
}
else if (match.MatchValue == "offender")
{
<span class="text-highlight">
<a class="link-inverse" href="@Model.OffenderClientId">
<color-code value="@Model.OffenderName"></color-code>
</a>
</span>
}
else if (match.MatchValue == "reason")
{
<span class="text-white">
@if (ViewBag.Authorized && !string.IsNullOrEmpty(Model.AutomatedOffense) && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Warning)
{
<span>@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_ANTICHEAT_DETECTION"], Model.AutomatedOffense)</span>
<span class="oi oi-list-rich align-top text-primary automated-penalty-info-detailed" data-penalty-id="@Model.PenaltyId" style="margin-top: 0.125rem;" title="@ViewBag.Localization["WEBFRONT_CLIENT_META_AC_METRIC"]"></span>
}
else
{
<color-code value="@Model.Offense"></color-code>
}
</span>
}
else if (match.MatchValue == "time")
{
<span class="text-white">@Model.LengthText</span>
}
}
else
{
<span>@match.MatchValue</span>
}
<partial name="./_MetaHeader.cshtml" for="@Model.When"/>
}
</div>
<div class="d-inline">
@foreach (var match in Utilities.SplitTranslationTokens(localizationKey))
{
if (match.IsInterpolation)
{
if (match.MatchValue == "action")
{
<span class="penalties-color-@Model.PenaltyType.ToString().ToLower()">@match.TranslationValue</span>
}
else if (match.MatchValue == "offender")
{
<span class="text-highlight">
<a class="link-inverse" href="@Model.OffenderClientId">
<color-code value="@Model.OffenderName"></color-code>
</a>
</span>
}
else if (match.MatchValue == "reason")
{
<span class="text-light-dm text-dark-lm">
@if (ViewBag.Authorized && !string.IsNullOrEmpty(Model.AutomatedOffense) && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Warning)
{
<span>@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_ANTICHEAT_DETECTION"], Model.AutomatedOffense)</span>
<span class="oi oi-list-rich align-top text-primary automated-penalty-info-detailed" data-penalty-id="@Model.PenaltyId" style="margin-top: 0.125rem;" title="@ViewBag.Localization["WEBFRONT_CLIENT_META_AC_METRIC"]"></span>
}
else
{
<color-code value="@Model.Offense"></color-code>
}
</span>
}
else if (match.MatchValue == "time")
{
<span class="text-light-dm text-dark-lm">@Model.LengthText</span>
}
}
else
{
<span>@match.MatchValue</span>
}
}
</div>
</has-permission>

View File

@ -4,6 +4,11 @@
var localizationKey = $"WEBFRONT_CLIENT_META_CONNECTION_{Model.ConnectionType.ToString().ToUpper()}";
}
@if (TempData["ShowMetaHeader"] as bool? ?? false)
{
<partial name="./_MetaHeader.cshtml" for="@Model.When"/>
}
@foreach (var token in Utilities.SplitTranslationTokens(localizationKey))
{
if (token.IsInterpolation)
@ -11,10 +16,10 @@
switch (token.MatchValue)
{
case "action":
<span class="@(Model.ConnectionType == Reference.ConnectionType.Connect ? "text-light-green" : "text-warning")">@token.TranslationValue</span>
<span class="@(Model.ConnectionType == Reference.ConnectionType.Connect ? "text-light-green" : "text-secondary")">@token.TranslationValue</span>
break;
case "server":
<span class="text-white">
<span class="text-light-dm text-dark-lm">
<color-code value="@Model.ServerName"></color-code>
</span>
break;

View File

@ -1,20 +1,20 @@
@model IEnumerable<SharedLibraryCore.Dtos.Meta.Responses.InformationResponse>
@{
var informationMeta = Model
.Where(_meta => _meta.Type == SharedLibraryCore.Interfaces.MetaType.Information)
.OrderBy(_meta => _meta.Order)
.GroupBy(_meta => _meta.Column)
.OrderBy(_grouping => _grouping.Key);
.Where(meta => meta.Type == SharedLibraryCore.Interfaces.MetaType.Information)
.OrderBy(meta => meta.Order)
.Select((meta, i) => new { index = i, meta })
.GroupBy(meta => meta.index / 5);
}
@foreach (var metaColumn in informationMeta)
{
<div class="text-center text-lg-left mr-0 mr-lg-4">
<div class="mr-20">
@foreach (var meta in metaColumn)
{
<div class="profile-meta-entry" title="@meta.ToolTipText">
<div class="profile-meta-entry font-size-12" data-toggle="@(!string.IsNullOrEmpty(meta.meta.ToolTipText) ? "tooltip" : "")" data-title="@meta.meta.ToolTipText" data-placement="bottom">
@{var results = Utilities.SplitTranslationTokens(meta.Key);}
@{var results = Utilities.SplitTranslationTokens(meta.meta.Key);}
@if (results.Any(_result => _result.IsInterpolation))
{
@ -22,7 +22,7 @@
{
if (result.IsInterpolation)
{
<span class="profile-meta-value text-primary"><color-code value="@meta.Value"></color-code></span>
<span class="profile-meta-value text-primary"><color-code value="@meta.meta.Value"></color-code></span>
}
else
@ -34,8 +34,8 @@
else
{
<span class="profile-meta-value text-primary"><color-code value="@meta.Value"></color-code></span>
<span class="profile-meta-title text-muted"> @meta.Key</span>
<span class="profile-meta-value text-primary"><color-code value="@meta.meta.Value"></color-code></span>
<span class="profile-meta-title text-muted">@meta.meta.Key</span>
}
</div>
}

View File

@ -1,17 +1,24 @@
@using SharedLibraryCore.Dtos.Meta.Responses
@model MessageResponse
@if (TempData["ShowMetaHeader"] as bool? ?? false)
{
<partial name="./_MetaHeader.cshtml" for="@Model.When"/>
}
<span class="client-message" data-serverid="@Model.ServerId" data-when="@Model.When.ToFileTimeUtc()">
<span class="oi oi-chevron-right text-white-50 align-middle client-message-prefix" title="@ViewBag.Localization["WEBFRONT_PROFILE_MESSAGE_CONTEXT"]" style="font-size: 0.75rem; margin-top: -0.256rem"></span>
<span data-title="View Context" data-toggle="tooltip" data-placement="right">
<span class="oi oi-chevron-right align-middle client-message-prefix" style="font-size: 0.75rem; margin-top: -0.256rem"></span>
</span>
<span class="text-muted @(Model.IsQuickMessage ? "font-weight-bold" : "")">
@if (!Model.SentIngame)
{
<span>[<span class="text-primary">@ViewBag.Localization["WEBFRONT_PROFILE_MESSAGE_EXTERNAL"]</span>]</span>
}
@if (Model.IsHidden && !ViewBag.Authorized)
{
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], Model.HiddenMessage)"></color-code>
<color-code value="@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], Model.HiddenMessage)"></color-code>
}
else

View File

@ -0,0 +1,6 @@
@model DateTime
@{ Layout = null;}
<div class="pt-5 text-light-dm text-dark-lm font-size-18 ">
<span>@Model.HumanizeForCurrentCulture()</span>
</div>
<hr/>

View File

@ -1,29 +1,35 @@
@model SharedLibraryCore.Dtos.Meta.Responses.PermissionLevelChangedResponse
@foreach (var token in Utilities.SplitTranslationTokens("WEBFRONT_CLIENT_META_PERMISSION_CHANGED"))
{
if (token.IsInterpolation)
<has-permission entity="ClientLevel" required-permission="Read">
@if (TempData["ShowMetaHeader"] as bool? ?? false)
{
switch (token.MatchValue)
<partial name="./_MetaHeader.cshtml" for="@Model.When"/>
}
@foreach (var token in Utilities.SplitTranslationTokens("WEBFRONT_CLIENT_META_PERMISSION_CHANGED"))
{
if (token.IsInterpolation)
{
case "permission":
<span class="level-color-@((int)Model.CurrentPermissionLevel)">@Model.CurrentPermissionLevel.ToLocalizedLevelName()</span>
break;
case "originClient":
<span class="text-highlight">
<a class="link-inverse" href="@Model.ChangedById">
<color-code value="@Model.ChangedByName"></color-code>
</a>
</span>
break;
case "type":
<span class="text-white-50">@token.TranslationValue</span>
break;
switch (token.MatchValue)
{
case "permission":
<span class="level-color-@((int)Model.CurrentPermissionLevel)">@Model.CurrentPermissionLevel.ToLocalizedLevelName()</span>
break;
case "originClient":
<span class="text-highlight">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.ChangedById">
<color-code value="@Model.ChangedByName"></color-code>
</a>
</span>
break;
case "type":
<span class="text-white-50">@token.TranslationValue</span>
break;
}
}
else
{
<span class="text-muted">@token.MatchValue</span>
}
}
else
{
<span class="text-muted">@token.MatchValue</span>
}
}
</has-permission>

View File

@ -2,72 +2,79 @@
@model ReceivedPenaltyResponse
@{
string localizationKey = $"WEBFRONT_CLIENT_META_WAS_PENALIZED_{Model.PenaltyType.ToString().ToUpper()}_V2";
var localizationKey = $"WEBFRONT_CLIENT_META_WAS_PENALIZED_{Model.PenaltyType.ToString().ToUpper()}_V2";
}
<div class="d-inline">
@foreach (var match in Utilities.SplitTranslationTokens(localizationKey))
<has-permission entity="ClientLevel" required-permission="Read">
@if (TempData["ShowMetaHeader"] as bool? ?? false)
{
if (match.IsInterpolation)
{
if (match.MatchValue == "action")
{
<span class="penalties-color-@Model.PenaltyType.ToString().ToLower()">@match.TranslationValue</span>
}
else if (match.MatchValue == "punisher")
{
<span class="text-highlight">
<a class="link-inverse" href="@Model.PunisherClientId">
<color-code value="@Model.PunisherName"></color-code>
</a>
</span>
}
else if (match.MatchValue == "reason")
{
<span class="text-white">
@if (ViewBag.Authorized && !string.IsNullOrEmpty(Model.AutomatedOffense) && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Warning && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Kick)
{
<span>@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_ANTICHEAT_DETECTION"], Model.AutomatedOffense)</span>
<span class="oi oi-list-rich align-top text-primary automated-penalty-info-detailed" data-penalty-id="@Model.PenaltyId" style="margin-top: 0.125rem;" title="@ViewBag.Localization["WEBFRONT_CLIENT_META_AC_METRIC"]"></span>
}
else
{
<color-code value="@Model.Offense"></color-code>
}
</span>
}
else if (match.MatchValue == "time")
{
<span class="text-white">@Model.LengthText</span>
}
}
else
{
<span>@match.MatchValue</span>
}
<partial name="./_MetaHeader.cshtml" for="@Model.When"/>
}
@if (Model.ClientId != Model.OffenderClientId)
{
<span>&mdash;</span>
@foreach (var helperResult in Utilities.SplitTranslationTokens("WEBFRONT_PROFILE_LINKED_ACCOUNT"))
<div class="d-inline">
@foreach (var match in Utilities.SplitTranslationTokens(localizationKey))
{
if (!helperResult.IsInterpolation)
if (match.IsInterpolation)
{
<span>@helperResult.MatchValue</span>
if (match.MatchValue == "action")
{
<span class="penalties-color-@Model.PenaltyType.ToString().ToLower()">@match.TranslationValue</span>
}
else if (match.MatchValue == "punisher")
{
<span class="text-highlight">
<a class="link-inverse" href="@Model.PunisherClientId">
<color-code value="@Model.PunisherName"></color-code>
</a>
</span>
}
else if (match.MatchValue == "reason")
{
<span class="text-light-dm text-dark-lm">
@if (ViewBag.Authorized && !string.IsNullOrEmpty(Model.AutomatedOffense) && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Warning && Model.PenaltyType != Data.Models.EFPenalty.PenaltyType.Kick)
{
<span>@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_ANTICHEAT_DETECTION"], Model.AutomatedOffense)</span>
<span class="oi oi-list-rich align-top text-primary automated-penalty-info-detailed" data-penalty-id="@Model.PenaltyId" style="margin-top: 0.125rem;" title="@ViewBag.Localization["WEBFRONT_CLIENT_META_AC_METRIC"]"></span>
}
else
{
<color-code value="@Model.Offense"></color-code>
}
</span>
}
else if (match.MatchValue == "time")
{
<span class="text-light-dm text-dark-lm">@Model.LengthText</span>
}
}
else
{
<a class="link-inverse" href="@Model.OffenderClientId">
<color-code value="@Model.OffenderName"></color-code>
</a>
<span>@match.MatchValue</span>
}
}
}
</div>
@if (Model.ClientId != Model.OffenderClientId)
{
<span>&mdash;</span>
@foreach (var helperResult in Utilities.SplitTranslationTokens("WEBFRONT_PROFILE_LINKED_ACCOUNT"))
{
if (!helperResult.IsInterpolation)
{
<span>@helperResult.MatchValue</span>
}
else
{
<a class="link-inverse" href="@Model.OffenderClientId">
<color-code value="@Model.OffenderName"></color-code>
</a>
}
}
}
</div>
</has-permission>

View File

@ -1,6 +1,11 @@
@using SharedLibraryCore.Dtos.Meta.Responses
@model UpdatedAliasResponse
@if (TempData["ShowMetaHeader"] as bool? ?? false)
{
<partial name="./_MetaHeader.cshtml" for="@Model.When"/>
}
@foreach (var token in Utilities.SplitTranslationTokens("WEBFRONT_PROFILE_META_CONNECT_ALIAS"))
{
if (token.IsInterpolation)
@ -8,12 +13,14 @@
switch (token.MatchValue)
{
case "action":
<span class="text-warning">@token.TranslationValue</span>
<span class="text-secondary">@token.TranslationValue</span>
break;
case "alias":
<span class="text-white">
<span class="text-light-dm text-dark-lm">
<color-code value="@Model.Name"></color-code>
[@Model.IPAddress]
<has-permission entity="ClientIPAddress" required-permission="Read">
[@Model.IPAddress]
</has-permission>
</span>
break;
}

View File

@ -6,26 +6,21 @@
@using Humanizer
@using Humanizer.Localisation
@using IW4MAdmin.Plugins.Stats
@using WebfrontCore.ViewModels
@model Stats.Dtos.AdvancedStatsInfo
@{
ViewBag.Title = "Advanced Client Statistics";
ViewBag.Description = Model.ClientName.StripColors();
const int maxItems = 5;
const string headshotKey = "MOD_HEAD_SHOT";
const string headshotKey2 = "headshot";
const string meleeKey = "MOD_MELEE";
var suicideKeys = new[] {"MOD_SUICIDE", "MOD_FALLING"};
var suicideKeys = new[] { "MOD_SUICIDE", "MOD_FALLING" };
// if they've not copied default settings config this could be null
var config = (GameStringConfiguration) ViewBag.Config ?? new GameStringConfiguration();
var config = (GameStringConfiguration)ViewBag.Config ?? new GameStringConfiguration();
var headerClass = Model.Level == EFClient.Permission.Banned ? "bg-danger" : "bg-primary";
var textClass = Model.Level == EFClient.Permission.Banned ? "text-danger" : "text-primary";
var borderBottomClass = Model.Level == EFClient.Permission.Banned ? "border-bottom-danger border-top-danger" : "border-bottom border-top";
var borderClass = Model.Level == EFClient.Permission.Banned ? "border-danger" : "border-primary";
var buttonClass = Model.Level == EFClient.Permission.Banned ? "btn-danger" : "btn-primary";
string GetWeaponNameForHit(EFClientHitStatistic stat)
{
if (stat == null)
@ -46,7 +41,7 @@
return null;
}
var attachmentText = string.Join('+', new[]
var attachmentText = string.Join(" + ", new[]
{
config.GetStringForGame(attachment.Attachment1.Name, attachment.Attachment1.Game),
config.GetStringForGame(attachment.Attachment2?.Name, attachment.Attachment2?.Game),
@ -58,11 +53,11 @@
var weapons = Model.ByWeapon
.Where(hit => hit.DamageInflicted > 0 || (hit.DamageInflicted == 0 && hit.HitCount > 0))
.GroupBy(hit => new {hit.WeaponId})
.GroupBy(hit => new { hit.WeaponId })
.Select(group =>
{
var withoutAttachments = group.FirstOrDefault(hit => hit.WeaponAttachmentComboId == null);
var mostUsedAttachment = group.Except(new[] {withoutAttachments})
var mostUsedAttachment = group.Except(new[] { withoutAttachments })
.OrderByDescending(g => g.DamageInflicted)
.GroupBy(g => g.WeaponAttachmentComboId)
.FirstOrDefault()
@ -72,7 +67,7 @@
{
return withoutAttachments;
}
withoutAttachments.WeaponAttachmentComboId = mostUsedAttachment.WeaponAttachmentComboId;
withoutAttachments.WeaponAttachmentCombo = mostUsedAttachment.WeaponAttachmentCombo;
@ -107,15 +102,15 @@
.Where(weapon => weapon.DamageInflicted > 0)
.GroupBy(weapon => weapon.WeaponId)
.Count()
: (int?) null; // want to default to -- in ui instead of 0
: (int?)null; // want to default to -- in ui instead of 0
var activeTime = weapons.Any()
? TimeSpan.FromSeconds(weapons.Sum(weapon => weapon.UsageSeconds ?? 0))
: (TimeSpan?) null; // want to default to -- in ui instead of 0
: (TimeSpan?)null; // want to default to -- in ui instead of 0
var kdr = aggregate == null
? null
: Math.Round(aggregate.KillCount / (float) aggregate.DeathCount, 2).ToString(Utilities.CurrentLocalization.Culture);
: Math.Round(aggregate.KillCount / (float)aggregate.DeathCount, 2).ToString(Utilities.CurrentLocalization.Culture);
var serverLegacyStat = Model.LegacyStats
.FirstOrDefault(stat => stat.ServerId == Model.ServerId);
@ -140,15 +135,15 @@
var headShots = allPerServer.Any()
? allPerServer.Where(hit => hit.MeansOfDeath?.Name == headshotKey || hit.HitLocation?.Name == headshotKey2).Sum(hit => hit.HitCount)
: (int?) null; // want to default to -- in ui instead of 0
: (int?)null; // want to default to -- in ui instead of 0
var meleeKills = allPerServer.Any()
? allPerServer.Where(hit => hit.MeansOfDeath?.Name == meleeKey).Sum(hit => hit.KillCount)
: (int?) null;
: (int?)null;
var suicides = allPerServer.Any()
? allPerServer.Where(hit => suicideKeys.Contains(hit.MeansOfDeath?.Name ?? "")).Sum(hit => hit.KillCount)
: (int?) null;
: (int?)null;
var statCards = new[]
{
@ -172,7 +167,7 @@
Name = (ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"] as string).Titleize(),
Value = score.ToNumericalString()
},
new
new
{
Name = (ViewBag.Localization["WEBFRONT_ADV_STATS_ZSCORE"] as string),
Value = Model.ZScore.ToNumericalString(2)
@ -235,205 +230,170 @@
};
}
<div class="w-100 @headerClass mb-1">
<select class="w-100 @headerClass text-white pl-4 pr-4 pt-2 pb-2 m-auto h5 @borderClass"
id="server_selector"
onchange="if (this.value) window.location.href=this.value">
@if (Model.ServerId == null)
{
<option value="@Url.Action("Advanced", "ClientStatistics")" selected>@ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"]</option>
}
else
{
<option value="@Url.Action("Advanced", "ClientStatistics")">@ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"]</option>
}
@foreach (var server in Model.Servers)
{
if (server.Endpoint == Model.ServerEndpoint)
{
<option value="@Url.Action("Advanced", "ClientStatistics", new {serverId = server.Endpoint})" selected>@server.Name.StripColors()</option>
}
else
{
<option value="@Url.Action("Advanced", "ClientStatistics", new {serverId = server.Endpoint})">@server.Name.StripColors()</option>
}
}
</select>
</div>
<div class="@headerClass p-4 mb-0 d-flex flex-wrap">
<div class="content row mt-20">
<!-- main content -->
<div class="col-12 col-lg-9 col-xl-10 mt-0">
<h2 class="content-title mb-0">Player Stats</h2>
<span class="text-muted">
<color-code value="@(Model.Servers.FirstOrDefault(server => server.Endpoint == Model.ServerEndpoint)?.Name ?? ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"])"></color-code>
</span>
<div class="align-self-center d-flex flex-column flex-lg-row text-center text-lg-left mb-3 mb-md-0 p-2 ml-lg-0 mr-lg-0 ml-auto mr-auto">
<div class="mr-lg-3 m-auto">
<img class="img-fluid align-self-center" id="rank_icon" src="~/images/stats/ranks/rank_@(Model.ZScore.RankIconIndexForZScore()).png" alt="@performance"/>
</div>
<div class="d-flex flex-column align-self-center" id="client_stats_summary">
<div class="h1 mb-0 font-weight-bold">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.ClientId">@Model.ClientName.StripColors()</a>
<!-- top card -->
<div class="card p-20 m-0 mt-15 mb-15">
<div class="align-self-center d-flex flex-column flex-lg-row flex-fill mb-15">
<!-- rank icon -->
<img class="img-fluid align-self-center w-75" id="rank_icon" src="~/images/stats/ranks/rank_@(Model.ZScore.RankIconIndexForZScore()).png" alt="@performance"/>
<!-- summary -->
<div class="d-flex flex-column align-self-center m-10 text-center text-lg-left" id="client_stats_summary">
<div class="font-size-20 mb-0 font-weight-bold">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.ClientId" class="no-decoration">@Model.ClientName.StripColors()</a>
</div>
@if (Model.Level == EFClient.Permission.Banned)
{
<div class="h5 mb-0 text-danger">@ViewBag.Localization["GLOBAL_PERMISSION_BANNED"]</div>
}
else if (Model.ZScore != null)
{
if (Model.Ranking > 0)
{
<div class="h5 mb-0">@Html.Raw((ViewBag.Localization["WEBFRONT_ADV_STATS_RANKED"] as string).FormatExt(Model.Ranking))</div>
}
else
{
<div class="h5 mb-0">@ViewBag.Localization["WEBFRONT_ADV_STATS_EXPIRED"]</div>
}
if (Model.ServerId != null)
{
<div class="h5 mb-0">@Html.Raw((ViewBag.Localization["WEBFRONT_ADV_STATS_PERFORMANCE"] as string).FormatExt($"<span class=\"text-primary\">{performance.ToNumericalString()}</span>"))</div>
}
else
{
<div class="h5 mb-0">@Html.Raw((ViewBag.Localization["WEBFRONT_ADV_STATS_RATING"] as string).FormatExt($"<span class=\"text-primary\">{Model.Rating.ToNumericalString()}</span>"))</div>
}
}
else
{
<div class="h5 mb-0">@ViewBag.Localization["WEBFRONT_STATS_INDEX_UNRANKED"]</div>
}
</div>
<!-- history graph -->
@if (performanceHistory.Count() > 5)
{
<div class="w-half m-auto ml-lg-auto " id="client_performance_history_container">
<canvas id="client_performance_history" data-history="@Html.Raw(Json.Serialize(performanceHistory))"></canvas>
</div>
}
</div>
@if (Model.Level == EFClient.Permission.Banned)
{
<div class="h5 mb-0">@ViewBag.Localization["GLOBAL_PERMISSION_BANNED"]</div>
}
else if (Model.ZScore != null)
{
if (Model.ServerId != null)
<hr class="m-10"/>
<div class="d-flex flex-row flex-wrap rounded">
@foreach (var card in statCards)
{
<div class="h5 mb-0">@((ViewBag.Localization["WEBFRONT_ADV_STATS_PERFORMANCE"] as string).FormatExt(performance.ToNumericalString()))</div>
<div class="stat-card bg-very-dark-dm bg-light-ex-lm p-15 m-md-5 w-half w-md-200 rounded flex-fill">
@if (string.IsNullOrWhiteSpace(card.Value))
{
<div class="m-0">&mdash;</div>
}
else
{
<div class="m-0 font-size-16 text-primary">@card.Value</div>
}
<div class="font-size-12 text-muted">@card.Name</div>
</div>
}
else
{
<div class="h5 mb-0">@((ViewBag.Localization["WEBFRONT_ADV_STATS_RATING"] as string).FormatExt(Model.Rating.ToNumericalString()))</div>
}
if (Model.Ranking > 0)
{
<div class="h5 mb-0">@((ViewBag.Localization["WEBFRONT_ADV_STATS_RANKED"] as string).FormatExt(Model.Ranking.ToNumericalString()))</div>
}
else
{
<div class="h5 mb-0">@ViewBag.Localization["WEBFRONT_ADV_STATS_EXPIRED"]</div>
}
}
else
{
<div class="h5 mb-0">@ViewBag.Localization["WEBFRONT_STATS_INDEX_UNRANKED"]</div>
}
</div>
</div>
</div>
<div class="w-50 m-auto ml-md-auto mr-md-0" id="client_performance_history_container">
<canvas id="client_performance_history" data-history="@Html.Raw(Json.Serialize(performanceHistory))"></canvas>
</div>
</div>
<div class="mb-4 bg-dark @borderBottomClass d-flex flex-wrap">
@foreach (var card in statCards)
{
<div class="pl-3 pr-4 pb-3 pt-3 stat-card flex-fill w-50 w-md-auto">
@if (string.IsNullOrWhiteSpace(card.Value))
{
<h5 class="card-title @textClass">&mdash;</h5>
}
else
{
<h5 class="card-title @textClass">@card.Value</h5>
}
<h6 class="card-subtitle mb-0 text-muted">@card.Name</h6>
</div>
}
</div>
<div class="row">
<!-- WEAPONS USED -->
<div class="col-12 mb-4">
<div class="@headerClass h4 mb-1 p-2">
<div class="text-center">@ViewBag.Localization["WEBFRONT_ADV_STATS_WEAP_USAGE"]</div>
</div>
<table class="table mb-0">
<tr class="@headerClass">
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_WEAPON"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_FAV_ATTACHMENTS"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_HITS"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_DAMAGE"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_USAGE"]</th>
</tr>
@foreach (var weaponHit in weapons.Take(maxItems))
{
<tr class="bg-dark">
<td class="@textClass text-force-break">@GetWeaponNameForHit(weaponHit)</td>
@{ var attachments = GetWeaponAttachmentName(weaponHit.WeaponAttachmentCombo); }
@if (string.IsNullOrWhiteSpace(attachments))
{
<td class="text-muted text-force-break">&mdash;</td>
}
else
{
<td class="text-muted text-force-break">@attachments</td>
}
<td class="text-success text-force-break">@weaponHit.KillCount.ToNumericalString()</td>
<td class="text-muted text-force-break">@weaponHit.HitCount.ToNumericalString()</td>
<td class="text-muted text-force-break">@weaponHit.DamageInflicted.ToNumericalString()</td>
<td class="text-muted text-force-break">@TimeSpan.FromSeconds(weaponHit.UsageSeconds ?? 0).HumanizeForCurrentCulture(minUnit: TimeUnit.Second)</td>
</tr>
}
<!-- OVERFLOW -->
@foreach (var weaponHit in weapons.Skip(maxItems))
{
<tr class="bg-dark hidden-row" style="display:none">
<td class="@textClass text-force-break">@GetWeaponNameForHit(weaponHit)</td>
@{ var attachments = GetWeaponAttachmentName(weaponHit.WeaponAttachmentCombo); }
@if (string.IsNullOrWhiteSpace(attachments))
{
<td class="text-muted text-force-break">&mdash;</td>
}
else
{
<td class="text-muted text-force-break">@attachments</td>
}
<td class="text-success text-force-break">@weaponHit.KillCount.ToNumericalString()</td>
<td class="text-muted text-force-break">@weaponHit.HitCount.ToNumericalString()</td>
<td class="text-muted text-force-break">@weaponHit.DamageInflicted.ToNumericalString()</td>
<td class="text-muted text-force-break">@TimeSpan.FromSeconds(weaponHit.UsageSeconds ?? 0).HumanizeForCurrentCulture()</td>
</tr>
}
<tr>
</table>
<button class="btn @buttonClass btn-block table-slide">
<span class="oi oi-chevron-bottom"></span>
</button>
</div>
</div>
<div class="row">
<!-- HIT LOCATIONS -->
<div class="col-lg-6 col-12 pr-3 pr-lg-0" id="hit_location_table">
<div class="@headerClass h4 mb-1 p-2">
<div class="text-center">@ViewBag.Localization["WEBFRONT_ADV_STATS_HIT_LOCATIONS"]</div>
</div>
<table class="table @borderBottomClass bg-dark mb-0 pb-0">
<tr class="@headerClass">
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_LOCATION"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_HITS"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_PERCENTAGE"]</th>
<th class="text-force-break">@ViewBag.Localization["WEBFRONT_ADV_STATS_DAMAGE"]</th>
</tr>
<div class="d-flex flex-wrap flex-column-reverse flex-xl-row">
<!-- hit locations -->
@{
var totalHits = filteredHitLocations.Sum(hit => hit.HitCount);
}
@foreach (var hitLocation in filteredHitLocations.Take(8))
{
<tr>
<td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name, hitLocation.HitLocation.Game)</td>
<td class="text-success text-force-break">@hitLocation.HitCount</td>
<td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td>
<td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td>
</tr>
var hitLocationsTable = new TableInfo(5)
{
Header = ViewBag.Localization["WEBFRONT_ADV_STATS_HIT_LOCATIONS"]
};
hitLocationsTable.WithColumns(new string[]
{
ViewBag.Localization["WEBFRONT_ADV_STATS_LOCATION"],
ViewBag.Localization["WEBFRONT_ADV_STATS_HITS"],
ViewBag.Localization["WEBFRONT_ADV_STATS_PERCENTAGE"],
ViewBag.Localization["WEBFRONT_ADV_STATS_DAMAGE"],
}).WithRows(filteredHitLocations, hitLocation => new[]
{
config.GetStringForGame(hitLocation.HitLocation.Name, hitLocation.HitLocation.Game),
hitLocation.HitCount.ToString(),
$"{Math.Round((hitLocation.HitCount / (float)totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)}%",
hitLocation.DamageInflicted.ToNumericalString()
});
}
@foreach (var hitLocation in filteredHitLocations.Skip(8))
{
<tr class="bg-dark hidden-row" style="display:none;">
<td class="@textClass text-force-break">@config.GetStringForGame(hitLocation.HitLocation.Name, hitLocation.HitLocation.Game)</td>
<td class="text-success text-force-break">@hitLocation.HitCount</td>
<td class="text-muted text-force-break">@Math.Round((hitLocation.HitCount / (float) totalHits) * 100.0).ToString(Utilities.CurrentLocalization.Culture)%</td>
<td class="text-muted text-force-break">@hitLocation.DamageInflicted.ToNumericalString()</td>
</tr>
<div class="mr-0 mr-xl-20 flex-fill flex-xl-grow-1">
<partial name="_DataTable" for="@hitLocationsTable"></partial>
<div class="h-250 p-15 card m-0 d-flex justify-content-center rounded-bottom" id="hitlocation_container">
<canvas id="hitlocation_model">
</canvas>
</div>
</div>
<!-- weapons used -->
@{
var weaponsUsedTable = new TableInfo(10)
{
Header = ViewBag.Localization["WEBFRONT_ADV_STATS_WEAP_USAGE"]
};
weaponsUsedTable.WithColumns(new string[]
{
ViewBag.Localization["WEBFRONT_ADV_STATS_WEAPON"],
ViewBag.Localization["WEBFRONT_ADV_STATS_FAV_ATTACHMENTS"],
ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"],
ViewBag.Localization["WEBFRONT_ADV_STATS_HITS"],
ViewBag.Localization["WEBFRONT_ADV_STATS_DAMAGE"],
ViewBag.Localization["WEBFRONT_ADV_STATS_USAGE"]
}).WithRows(weapons, weapon => new[]
{
GetWeaponNameForHit(weapon),
GetWeaponAttachmentName(weapon.WeaponAttachmentCombo) ?? "--",
weapon.KillCount.ToNumericalString(),
weapon.HitCount.ToNumericalString(),
weapon.DamageInflicted.ToNumericalString(),
TimeSpan.FromSeconds(weapon.UsageSeconds ?? 0).HumanizeForCurrentCulture(minUnit: TimeUnit.Second)
});
}
</table>
<button class="btn @buttonClass btn-block table-slide">
<span class="oi oi-chevron-bottom"></span>
</button>
</div>
<div class="col-lg-6 col-12 pl-3 pl-lg-0">
<div class="@borderBottomClass text-center h-100" id="hitlocation_container">
<canvas id="hitlocation_model">
</canvas>
<div class="flex-fill flex-xl-grow-1">
<partial name="_DataTable" for="@weaponsUsedTable"/>
</div>
</div>
</div>
<!-- side context menu -->
@{
var menuItems = new SideContextMenuItems
{
MenuTitle = "Game", Items = Model.Servers.Select(server => new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("Advanced", "ClientStatistics", new { serverId = server.Endpoint }),
Title = server.Name.StripColors(),
IsActive = Model.ServerEndpoint == server.Endpoint
}).Prepend(new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("Advanced", "ClientStatistics"),
Title = ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"],
IsActive = Model.ServerEndpoint is null
}).ToList()
};
}
<partial name="_SideContextMenu" for="@menuItems"></partial>
</div>
@{
var projection = filteredHitLocations.Select(loc => new
{
@ -441,7 +401,7 @@
// we want to count head and neck as the same
percentage = (loc.HitLocation.Name == "head"
? filteredHitLocations.FirstOrDefault(c => c.HitLocation.Name == "neck")?.HitCount ?? 0 + loc.HitCount
: loc.HitCount) / (float) totalHits
: loc.HitCount) / (float)totalHits
}).ToList();
var maxPercentage = projection.Any() ? projection.Max(p => p.percentage) : 0;
}
@ -456,4 +416,4 @@
<environment include="Development">
<script type="text/javascript" src="~/js/advanced_stats.js"></script>
</environment>
}
}

View File

@ -3,149 +3,90 @@
@{
Layout = null;
var loc = Utilities.CurrentLocalization.LocalizationIndex.Set;
double getDeviation(double deviations) => Math.Pow(Math.E, 5.259 + (deviations * 0.812));
string rankIcon(double? elo)
{
if (elo >= getDeviation(-0.75) && elo < getDeviation(1.25))
{
return "0_no-place/menu_div_no_place.png";
}
if (elo >= getDeviation(0.125) && elo < getDeviation(0.625))
{
return "1_iron/menu_div_iron_sub03.png";
}
if (elo >= getDeviation(0.625) && elo < getDeviation(1.0))
{
return "2_bronze/menu_div_bronze_sub03.png";
}
if (elo >= getDeviation(1.0) && elo < getDeviation(1.25))
{
return "3_silver/menu_div_silver_sub03.png";
}
if (elo >= getDeviation(1.25) && elo < getDeviation(1.5))
{
return "4_gold/menu_div_gold_sub03.png";
}
if (elo >= getDeviation(1.5) && elo < getDeviation(1.75))
{
return "5_platinum/menu_div_platinum_sub03.png";
}
if (elo >= getDeviation(1.75) && elo < getDeviation(2.0))
{
return "6_semipro/menu_div_semipro_sub03.png";
}
if (elo >= getDeviation(2.0))
{
return "7_pro/menu_div_pro_sub03.png";
}
return "0_no-place/menu_div_no_place.png";
}
}
@if (Model.Count == 0)
{
<div class="p-2 text-center">@Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_NOQUALIFY"]</div>
<div class="card m-0 mt-15">
<div class="d-flex">
<i class="oi oi-timer align-self-center mb-10" style="font-size: 6rem;"></i>
<div class="p-15">
<h2 class="content-title mb-0">@Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_NOQUALIFY"]</h2>
<span class="text-muted">Check back after some more time has passed</span>
</div>
</div>
</div>
}
@foreach (var stat in Model)
{
<div class="row ml-0 mr-0 pt-2 pb-2">
@if (ViewBag.UseNewStats)
{
<img class="align-self-center d-block d-md-none m-auto pb-3 pt-3" src="~/images/stats/ranks/rank_@(stat.ZScore.RankIconIndexForZScore()).png" alt="@stat.Performance"/>
}
<div class="col-md-4 text-md-left text-center">
<div class="h2 d-flex flex-row justify-content-center justify-content-md-start align-items-center">
<div class="text-muted">#@stat.Ranking</div>
@if (stat.RatingChange > 0)
{
<div class="d-flex flex-column text-center pl-1">
<div class="oi oi-caret-top text-success client-rating-change-up"></div>
<div class="client-rating-change-amount text-success">@stat.RatingChange</div>
<div class="card m-0 mt-15 p-20 d-flex flex-column flex-md-row justify-content-between">
<div class="d-flex flex-column w-full w-md-quarter">
<div class="d-flex align-items-center mb-15">
<div class="d-flex text-muted">
<span class="font-size-20">#</span>
<div style="font-size: 4.5rem; line-height: 4.5rem;font-family: SFMono-Regular,Menlo,Monaco,Consolas,'Liberation Mono','Courier New',monospace;">@stat.Ranking</div>
</div>
<div class="ml-10">
<div class="d-flex flex-row">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@stat.ClientId" class="no-decoration text-light-dm text-dark-lm font-size-20 text-force-break" style="line-height: 2.5rem;">
<color-code value="@stat.Name" allow="@ViewBag.EnableColorCodes"></color-code>
</a>
@if (stat.RatingChange > 0)
{
<div class="d-flex flex-column text-center ml-5 mr-5 align-self-center">
<div class="oi oi-caret-top text-success client-rating-change-up"></div>
<div class="client-rating-change-amount text-success">@stat.RatingChange</div>
</div>
}
@if (stat.RatingChange < 0)
{
<div class="d-flex flex-column text-center ml-5 mr-5 align-self-center">
<div class="client-rating-change-amount client-rating-change-amount-down text-danger">@Math.Abs(stat.RatingChange)</div>
<div class="oi oi-caret-bottom text-danger client-rating-change-down"></div>
</div>
}
</div>
}
@if (stat.RatingChange < 0)
{
<div class="d-flex flex-column text-center pl-1">
<div class="client-rating-change-amount client-rating-change-amount-down text-danger">@Math.Abs(stat.RatingChange)</div>
<div class="oi oi-caret-bottom text-danger client-rating-change-down"></div>
</div>
}
<span class="text-muted pr-1 pl-1">&ndash;</span>
@if (!ViewBag.UseNewStats)
{
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@stat.ClientId">
<color-code value="@stat.Name" allow="ViewBag.EnableColorCodes"></color-code>
</a>
}
else
{
<a asp-controller="ClientStatistics" asp-action="Advanced" asp-route-id="@stat.ClientId">
<color-code value="@stat.Name" allow="ViewBag.EnableColorCodes"></color-code>
</a>
}
</div>
@if (ViewBag.UseNewStats)
{
<div class="d-flex flex-column">
<div>
<span class="text-primary font-weight-bold h5">
<div class="font-size-14">
<span class="text-primary">
@stat.Performance.ToNumericalString()
</span>
@if (stat.ServerId == null)
{
<span class="text-muted font-weight-bold h5">@loc["WEBFRONT_ADV_STATS_RATING"].FormatExt("").ToLower()</span>
<span class="text-muted">@loc["WEBFRONT_ADV_STATS_RATING"].FormatExt("").ToLower()</span>
}
else
{
<span class="text-muted font-weight-bold h5">@loc["WEBFRONT_ADV_STATS_PERFORMANCE"].FormatExt("").ToLower()</span>
<span class="text-muted">@loc["WEBFRONT_ADV_STATS_PERFORMANCE"].FormatExt("").ToLower()</span>
}
</div>
<div>
<span class="text-primary">@stat.Kills.ToNumericalString()</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KILLS"]</span>
</div>
<div>
<span class="text-primary">@stat.Deaths.ToNumericalString()</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_DEATHS"]</span><br />
</div>
<div>
<span class="text-primary">@stat.KDR</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KDR"]</span>
</div>
<div>
<span class="text-primary">@stat.TimePlayedValue.HumanizeForCurrentCulture() </span><span class="text-muted">@loc["WEBFRONT_PROFILE_PLAYER"]</span>
</div>
<div>
<span class="text-primary"> @stat.LastSeenValue.HumanizeForCurrentCulture() </span><span class="text-muted">@loc["WEBFRONT_PROFILE_LSEEN"]</span>
</div>
</div>
}
else
{
<span class="text-primary">@stat.Performance</span> <span class="text-muted"> @loc["PLUGINS_STATS_COMMANDS_PERFORMANCE"]</span>
<br/>
<span class="text-primary">@stat.KDR</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KDR"]</span>
<span class="text-primary">@stat.Kills</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KILLS"]</span>
<span class="text-primary">@stat.Deaths</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_DEATHS"]</span><br />
<span class="text-muted">@loc["WEBFRONT_PROFILE_PLAYER"]</span> <span class="text-primary"> @stat.TimePlayed </span><span class="text-muted">@loc["GLOBAL_TIME_HOURS"]</span><br />
<span class="text-muted">@loc["WEBFRONT_PROFILE_LSEEN"]</span><span class="text-primary"> @stat.LastSeen </span><span class="text-muted">@loc["WEBFRONT_PENALTY_TEMPLATE_AGO"]</span>
}
</div>
<div class="d-flex flex-column font-size-12 text-right text-md-left">
<div>
<span class="text-primary">@stat.Kills.ToNumericalString()</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KILLS"]</span>
</div>
<div>
<span class="text-primary">@stat.Deaths.ToNumericalString()</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_DEATHS"]</span><br/>
</div>
<div>
<span class="text-primary">@stat.KDR</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KDR"]</span>
</div>
<div>
<span class="text-primary">@stat.TimePlayedValue.HumanizeForCurrentCulture() </span><span class="text-muted">@loc["WEBFRONT_PROFILE_PLAYER"]</span>
</div>
<div>
<span class="text-primary"> @stat.LastSeenValue.HumanizeForCurrentCulture() </span><span class="text-muted">@loc["WEBFRONT_PROFILE_LSEEN"]</span>
</div>
</div>
</div>
<div class="col-md-6 client-rating-graph" id="rating_history_@(stat.ClientId + "_" + stat.Id)" data-history="@Html.Raw(Json.Serialize(stat.PerformanceHistory))">
<div class="w-full w-md-half client-rating-graph" id="rating_history_@(stat.ClientId + "_" + stat.Id)" data-history="@Html.Raw(Json.Serialize(stat.PerformanceHistory))">
</div>
<div class="col-md-2 client-rating-icon text-md-right text-center align-items-center d-flex justify-content-center">
@if (ViewBag.UseNewStats)
{
<img class="align-self-center d-none d-md-block" src="~/images/stats/ranks/rank_@(stat.ZScore.RankIconIndexForZScore()).png" alt="@stat.Performance"/>
}
else
{
<img src="/images/icons/@rankIcon(stat.Performance)"/>
}
<div class="w-quarter align-self-center d-flex justify-content-center">
<img class="w-100 h-100" src="~/images/stats/ranks/rank_@(stat.ZScore.RankIconIndexForZScore()).png" alt="@stat.Performance"/>
</div>
</div>
}

View File

@ -1,34 +1,48 @@
<ul class="nav nav-tabs border-top border-bottom nav-fill row" role="tablist" id="stats_top_players">
<li class="nav-item">
<a class="nav-link active top-players-link" href="#server_0" role="tab" data-toggle="tab" aria-selected="true" data-serverid="0">@ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"]</a>
</li>
@model IEnumerable<SharedLibraryCore.Dtos.ServerInfo>
@using WebfrontCore.ViewModels
@foreach (var server in ViewBag.Servers)
{
<li class="nav-item ">
<a class="nav-link top-players-link" href="#server_@server.ID" role="tab" data-toggle="tab" aria-selected="false" data-serverid="@server.ID">
<color-code value="@server.Name"></color-code>
</a>
</li>
}
</ul>
<div class="tab-content border-bottom row">
<div role="tabpanel" class="tab-pane active striped flex-fill" id="server_0">
@await Component.InvokeAsync("TopPlayers", new { count = 25, offset = 0 })
<div class="content mt-20 row">
<div class="col-12 col-lg-9 col-xl-10 mt-0">
<h2 class="content-title mb-0">Top Players</h2>
<span class="text-muted">
<color-code value="@(ViewBag.SelectedServerName ?? ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"])"></color-code>
</span>
<div id="topPlayersContainer">
@await Component.InvokeAsync("TopPlayers", new { count = 25, offset = 0, serverEndpoint = ViewBag.SelectedServerId })
</div>
<div class="text-center">
<i id="loaderLoad" class="oi oi-chevron-bottom loader-load-more text-primary mt-5" aria-hidden="true"></i>
</div>
</div>
@foreach (var server in ViewBag.Servers)
{
<div role="tabpanel" class="tab-pane striped flex-fill" id="server_@server.ID">
</div>
<!-- side context menu -->
@{
var menuItems = new SideContextMenuItems
{
MenuTitle = "Game", Items = Model.Select(server => new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("TopPlayers", "Stats", new { serverId = server.Endpoint }),
Title = server.Name.StripColors(),
IsActive = ViewBag.SelectedServerId == server.Endpoint
}).Prepend(new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("TopPlayers", "Stats"),
Title = ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"],
IsActive = ViewBag.SelectedServerId is null
}).ToList()
};
}
<partial name="_SideContextMenu" for="@menuItems"></partial>
</div>
@section scripts
{
{
<environment include="Development">
<script type="text/javascript" src="~/js/loader.js"></script>
<script type="text/javascript" src="~/js/stats.js"></script>
</environment>
<script>initLoader('/Stats/GetTopPlayersAsync', '#server_0', 25);</script>
<script>initLoader('/Stats/GetTopPlayersAsync', '#topPlayersContainer', 25);</script>
}

View File

@ -1,24 +1,25 @@
@using SharedLibraryCore.Dtos.Meta.Responses
@using Humanizer
@model IList<MessageResponse>
@{
Layout = null;
}
<div class="client-message-context">
<h5 class="bg-primary pt-2 pb-2 pl-3 mb-0 mt-2 text-white">@Model.First().When.ToString()</h5>
<div class="bg-dark p-3 mb-2 border-bottom">
<div class="client-message-context mt-10 mb-10">
<h5 class="rounded-top bg-primary text-light mb-0 p-10 pt-5 pb-5">@Model.First().When.Humanize()</h5>
<div class="bg-dark-dm bg-light-lm p-10 pr-20 rounded-bottom">
@foreach (var message in Model)
{
<span class="text-white">
<color-code value="@message.ClientName" allow="ViewBag.EnableColorCodes"></color-code>
<span>
<color-code value="@message.ClientName" allow="@ViewBag.EnableColorCodes"></color-code>
</span>
<span>
&mdash;
<span class="@(message.IsQuickMessage ? "font-italic" : "")">
<color-code value="@(message.IsHidden ? message.HiddenMessage : message.Message)" allow="ViewBag.EnableColorCodes"></color-code>
<span class="@(message.IsQuickMessage ? "font-italic" : "") text-light-dm text-dark-lm">
<color-code value="@(message.IsHidden ? message.HiddenMessage : message.Message)" allow="@ViewBag.EnableColorCodes"></color-code>
</span>
</span>
<br />
}
</div>
</div>
</div>

View File

@ -3,7 +3,7 @@
Layout = null;
}
<div class="penalty-info-context bg-dark p-2 mt-2 mb-2 border-top border-bottom">
<div class="penalty-info-context bg-dark-dm bg-light-lm p-20 mt-5 mb-5 rounded-top rounded-bottom border-top border-bottom">
@foreach (var snapshot in Model)
{
<!-- this is not ideal, but I didn't want to manually write out all the properties-->
@ -15,9 +15,9 @@
continue;
}
<span class="text-white">@prop.Name </span>
<span class="text-light-dm text-dark-lm">@prop.Name </span>
<span>&mdash; @prop.GetValue(snapshot)?.ToString()?.StripColors()</span><br/>
}
<div class="w-100 mt-1 mb-1 border-bottom"></div>
<hr class="mt-10 mb-10"/>
}
</div>
</div>

View File

@ -12,53 +12,36 @@
}
<div class="row">
<div class="col-12 text-white-50 ">
<h3 class="text-white">@ViewData["Title"]</h3>
<h5 class="mb-4">@noticeText</h5>
<div class="content mt-0">
<h4 class="content-title mt-20 mb-0">@ViewData["Title"]</h4>
<span class="text-muted">@noticeText</span>
<ul class="nav nav-tabs border-bottom-dark">
<li class="nav-item">
<a class="nav-link" asp-action="Edit">@ViewBag.Localization["WEBFRONT_CONFIGURATION_GUI"]</a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#files">@ViewBag.Localization["WEBFRONT_CONFIGURATION_FILES"]</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="editor">
@foreach (var file in Model.OrderByDescending(f => f.FileName.Contains("IW4MAdmin")))
{
<div class="card m-0 p-0 mt-20 mb-20">
<div class="bg-primary p-10 rounded-top text-light">
<i class="oi oi-expand-down mr-5 expand-file-icon" data-editor-id="#edit_file_@FormatHtmlId(file.FileName)"></i>
<span>@file.FileName</span>
</div>
<div class="tab-pane active" id="files">
@foreach (var file in Model)
{
<div class="bg-primary mb-0 pl-3 pr-3 p-2 text-white d-flex border-bottom-dark">
<span class="oi oi-expand-down align-self-center mr-2 expand-file-icon" data-editor-id="#edit_file_@FormatHtmlId(file.FileName)" title="Toggle Expand"></span>
<span>@file.FileName</span>
</div>
<div class="edit-file bg-dark d-none" id="edit_file_@FormatHtmlId(file.FileName)" data-file-name="@file.FileName">
<pre class="mb-0 mr-auto" spellcheck="false"><code class="language-json bg-dark editable" contenteditable="true" id="edit_file_code_@FormatHtmlId(file.FileName)">@file.FileContent</code></pre>
<button type="button" class="btn btn-primary align-self-end m-3 file-save-button" data-file-name="@file.FileName">Save</button>
</div>
}
<div class="edit-file d-none flex-column" id="edit_file_@FormatHtmlId(file.FileName)" data-file-name="@file.FileName">
<pre class="mt-0 font-size-12 flex-fill border-bottom" spellcheck="false"><code class="code language-json editable" contenteditable="true" id="edit_file_code_@FormatHtmlId(file.FileName)">@file.FileContent</code></pre>
<button type="button" class="btn btn-primary m-15 mt-0 align-self-start file-save-button" data-file-name="@file.FileName">Save</button>
</div>
</div>
}
</div>
</div>
@section scripts
{
<!-- I don't want to include the entire highlight js into the bundle for this 1 page -->
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
<script>
@section scripts
{
<!-- I don't want to include the entire highlight js into the bundle for this 1 page -->
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
<script>
if (hljs !== undefined) {
hljs.highlightAll();
hljs.highlightAll();
}
</script>
<environment include="Development">
<script type="text/javascript" src="~/js/configuration.js"></script>
</environment>
}
</div>
<environment include="Development">
<script type="text/javascript" src="~/js/configuration.js"></script>
</environment>
}

View File

@ -140,4 +140,4 @@
<environment include="Development">
<script type="text/javascript" src="~/js/configuration.js"></script>
</environment>
}
}

View File

@ -1,16 +1,54 @@
@model IEnumerable<SharedLibraryCore.Dtos.ServerInfo>
<div class="row justify-content-center">
<div id="console" class="col-md-8">
@Html.DropDownList("Server", Model.Select(s => new SelectListItem() { Text = SharedLibraryCore.Utilities.StripColors(s.Name), Value = s.ID.ToString() }).ToList(), new { @class = "form-control bg-dark text-light", id = "console_server_select" })
<div id="console_command_response" class="bg-dark p-3">
<div class="content mt-0">
<h2 class="content-title mt-20">Web Console</h2>
<div id="console" class="card m-0 mb-20">
<div id="console_command_response" class="bg-dark-dm bg-light-lm p-10 code rounded">
<pre style="font-size: 8px;"> /(((((((*
./((((((((((((((((,
.*/(((((((((((((((((((((((((.
*((((((((((((((((((((((((((((((((((
./(((((((((((((((((((((((((((((((((((/ ,**,
./(((((((((((((((((((((((((((((((/ ,******,
,(((((((((((((((((((((((((((((* ********//**.
*/(((((((((((((((((((((((((* ***************
,*** ,(((((((((((((((((((((((, ,***************.
,****/**,*/(((((((((((((((((((. *************,
************,,((((((((((((((((*. ,************
.***********, *((((((((((((( .*//*********
.,**********, ,(((((((((/ ***********
,**********, *(((((((/ ,**********
,/*********, .*(((* **********,
,/*********, .*. ***********.
,**********, ***********
.*********** ***********
.************ .***********
************. .************,
,************* .**************,
.***************** *****************.
*******************************************,
.*//***********************************.
********************************,.
.************************,
,.**,
</pre>
</div>
<div class="form-row">
<div class="col-12 col-sm-9 pr-1 pr-sm-0">
<input id="console_command_value" class="form-control m-0 bg-dark text-light" type="text" />
</div>
<div class="card m-0 rounded">
<div class="input-group mb-10">
<div class="input-group-prepend">
<span class="input-group-text">Server</span>
</div>
<div class="col pl-1 pl-sm-0">
<button id="console_command_button" class="btn btn-primary btn-block m-0">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONSOLE_EXECUTE"]</button>
@Html.DropDownList("Server", Model.Select(s => new SelectListItem { Text = s.Name.StripColors(), Value = s.ID.ToString() }).ToList(), new { @class = "form-control", id = "console_server_select" })
</div>
<div class="input-group">
<input id="console_command_value" class="form-control" placeholder="Enter command..." type="text" required="required"/>
<div class="input-group-append">
<button id="console_command_button" class="btn btn-primary">
@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CONSOLE_EXECUTE"]
</button>
</div>
</div>
</div>

View File

@ -1,74 +1,58 @@
@model IEnumerable<(string, IEnumerable<SharedLibraryCore.Interfaces.IManagerCommand>)>
@{
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
var loc = Utilities.CurrentLocalization.LocalizationIndex;
}
@foreach ((var pluginName, var commandList) in Model)
{
<h4 class="text-center pb-0 pb-xl-3 pt-3 pt-xl-0">@pluginName</h4>
<!-- desktop -->
<table class="table table-striped border-bottom col-10 ml-auto mr-auto d-none d-lg-table mb-4 text-light">
<thead>
<tr class="bg-primary text-white">
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_NAME"]</th>
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_ALIAS"]</th>
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_DESCRIPTION"]</th>
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRES_TARGET"]</th>
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_SYNTAX"]</th>
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRED_LEVEL"]</th>
<div class="content mt-20">
@foreach (var (pluginName, commandList) in Model)
{
<h2 class="content-title mb-lg-20 mt-20 ">@(pluginName == "Native" ? "Command List" : pluginName)</h2>
<table class="table rounded">
<thead>
<!-- desktop -->
<tr class="bg-primary text-light d-none d-lg-table-row ">
<th>@loc["WEBFRONT_HELP_COMMAND_DESC_NAME"]</th>
<th>@loc["WEBFRONT_HELP_COMMAND_DESC_ALIAS"]</th>
<th>@loc["WEBFRONT_HELP_COMMAND_DESC_DESCRIPTION"]</th>
<th>@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRES_TARGET"]</th>
<th>@loc["WEBFRONT_HELP_COMMAND_DESC_SYNTAX"]</th>
<th class="text-right">@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRED_LEVEL"]</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
@foreach (var command in commandList)
{
<tr class="bg-dark">
<th scope="row">@command.Name</th>
<!-- desktop -->
<tr class="d-none d-lg-table-row bg-dark-dm bg-light-lm">
<td>@command.Name</td>
<td>@command.Alias</td>
<td>@command.Description</td>
<td>@command.RequiresTarget</td>
<td>@ViewBag.CommandPrefix@command.Syntax.Split(@ViewBag.CommandPrefix)[1]</td>
<td>@command.Permission.ToLocalizedLevelName()</td>
<td>@ViewBag.CommandPrefix@command.Syntax.Split(ViewBag.CommandPrefix)[1]</td>
<td class="text-right level-color-@((int)command.Permission)">@command.Permission.ToLocalizedLevelName()</td>
</tr>
<!-- mobile -->
<tr class="d-table-row d-lg-none d-flex bg-dark-dm bg-light-lm">
<td class="bg-primary text-right" style="min-width: 124px;">
<div class="mt-5 mb-5">@loc["WEBFRONT_HELP_COMMAND_DESC_NAME"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_HELP_COMMAND_DESC_ALIAS"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_HELP_COMMAND_DESC_DESCRIPTION"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRES_TARGET"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_HELP_COMMAND_DESC_SYNTAX"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRED_LEVEL"]</div>
</td>
<td>
<div class="mt-5 mb-5">@command.Name</div>
<div class="mt-5 mb-5">@command.Alias</div>
<div class="mt-5 mb-5">@command.Description</div>
<div class="mt-5 mb-5">@command.RequiresTarget</div>
<div class="mt-5 mb-5">@ViewBag.CommandPrefix@command.Syntax.Split(ViewBag.CommandPrefix)[1]</div>
<div class="mt-5 mb-5 @($"level-color-{(int)command.Permission}")">@command.Permission.ToLocalizedLevelName()</div>
</td>
</tr>
}
</tbody>
</table>
<!-- mobile -->
<table class="table border-bottomb d-table d-lg-none">
<thead>
<tr>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach (var command in commandList)
{
<tr>
<td scope="row" class="bg-primary">@loc["WEBFRONT_HELP_COMMAND_DESC_NAME"]</td>
<td class="bg-dark text-light">@command.Name</td>
</tr>
<tr>
<td scope="row" class="bg-primary">@loc["WEBFRONT_HELP_COMMAND_DESC_ALIAS"]</td>
<td class="bg-dark text-light">@command.Alias</td>
</tr>
<tr>
<td scope="row" class="bg-primary">@loc["WEBFRONT_HELP_COMMAND_DESC_DESCRIPTION"]</td>
<td class="bg-dark text-light">@command.Description</td>
</tr>
<tr>
<td scope="row" class="bg-primary">@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRES_TARGET"]</td>
<td class="bg-dark text-light">@command.RequiresTarget</td>
</tr>
<tr>
<td scope="row" class="bg-primary">@loc["WEBFRONT_HELP_COMMAND_DESC_SYNTAX"]</td>
<td class="bg-dark text-light">@ViewBag.CommandPrefix@command.Syntax.Split(@ViewBag.CommandPrefix)[1]</td>
</tr>
<tr>
<td scope="row" class="bg-primary" style="border-bottom: #222 1px solid;">@loc["WEBFRONT_HELP_COMMAND_DESC_REQUIRED_LEVEL"]</td>
<td class="bg-dark border-bottom @($"level-color-{(int)command.Permission}")">@command.Permission.ToLocalizedLevelName()</td>
</tr>
}
</tbody>
</table>
}
</tbody>
</table>
}
</div>

View File

@ -1,44 +1,57 @@
@model SharedLibraryCore.Dtos.IW4MAdminInfo
@{
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
string formatTranslation(string translationKey, params object[] values)
@using WebfrontCore.ViewModels
@using Humanizer
@model SharedLibraryCore.Dtos.IW4MAdminInfo
@{
var loc = Utilities.CurrentLocalization.LocalizationIndex;
string FormatTranslation(string translationKey, params object[] values)
{
var split = loc[translationKey].Split("::");
return split.Count() == 2 ? $"<span class='font-weight-bold text-primary'>{SharedLibraryCore.Utilities.FormatExt(split[0], values)}</span><span>{split[1]}</span>" : translationKey;
return split.Length == 2 ? $"<span class='font-weight-bold text-primary'>{split[0].FormatExt(values)}</span><span>{split[1]}</span>" : translationKey;
}
}
<div class="row mb-4 border-bottom border-top pt-3 pb-3 bg-dark">
<div class="col-xl-3 col-12">
<div class="text-muted text-center text-xl-left">@Html.Raw(formatTranslation("WEBFRONT_HOME_CLIENTS_ONLINE", Model.TotalOccupiedClientSlots, Model.TotalAvailableClientSlots))</div>
</div>
<div class="col-xl-3 col-12 moment-date" title="@Model.MaxConcurrentClientsTime">
<div class="text-muted text-center text-xl-left">@Html.Raw(formatTranslation("WEBFRONT_HOME_MAX_CONCURRENT_CLIENTS", Model.MaxConcurrentClients.ToString("#,##0")))</div>
</div>
<div class="col-xl-3 col-12">
<div class="text-muted text-center">@Html.Raw(formatTranslation("WEBFRONT_HOME_RECENT_CLIENTS", Model.RecentClientCount.ToString("#,##0")))</div>
</div>
<div class="col-xl-3 col-12">
<div class="text-muted text-center text-xl-right">@Html.Raw(formatTranslation("WEBFRONT_HOME_TOTAL_CLIENTS", Model.TotalClientCount.ToString("#,##0")))</div>
</div>
</div>
@if (Model.ActiveServerGames.Length > 1)
{
<ul class="nav nav-tabs border-top border-bottom nav-fill row mb-4" role="tablist">
<li class="nav-item">
<a class="nav-link @(Model.Game.HasValue ? "" : "active")" href="/" role="tab" aria-selected="true">@loc["GAME_ALL"]</a>
</li>
@foreach (var gameName in Model.ActiveServerGames)
<div class="content mt-20 row">
<div class="col-12 col-lg-9 col-xl-10">
<h2 class="content-title mb-0">Server Overview</h2>
@if (Model.Game.HasValue)
{
<li class="nav-item">
<a asp-action="Index" asp-controller="Home" asp-route-game="@gameName" class="nav-link @(Model.Game == gameName ? "active" : "")" role="tab" aria-selected="false">@loc[$"GAME_{gameName}"]</a>
</li>
<span class="text-muted">@loc[$"GAME_{Model.Game.Value}"]</span>
}
</ul>
}
@await Component.InvokeAsync("ServerList", Model.Game)
else
{
<span class="text-muted">@ViewBag.Localization["WEBFRONT_STATS_INDEX_ALL_SERVERS"]</span>
}
<div class="card p-0 m-0">
<div class="d-flex flex-column flex-md-row justify-content-md-between bg-dark-dm bg-light-lm p-10 mt-15 mb-15 rounded">
<div class="align-self-center align-content-md-start">@Html.Raw(FormatTranslation("WEBFRONT_HOME_CLIENTS_ONLINE", Model.TotalOccupiedClientSlots, Model.TotalAvailableClientSlots))</div>
<div class="align-self-center align-content-md-start" data-toggle="tooltip" data-title="@Model.MaxConcurrentClientsTime.HumanizeForCurrentCulture().Titleize()">@Html.Raw(FormatTranslation("WEBFRONT_HOME_MAX_CONCURRENT_CLIENTS", Model.MaxConcurrentClients.ToString("#,##0")))</div>
<div class="align-self-center align-content-md-start">@Html.Raw(FormatTranslation("WEBFRONT_HOME_RECENT_CLIENTS", Model.RecentClientCount.ToString("#,##0")))</div>
<div class="align-self-center align-content-md-start">@Html.Raw(FormatTranslation("WEBFRONT_HOME_TOTAL_CLIENTS", Model.TotalClientCount.ToString("#,##0")))</div>
</div>
</div>
@await Component.InvokeAsync("ServerList", Model.Game)
</div>
@{
var menuItems = new SideContextMenuItems
{
MenuTitle = "Game", Items = Model.ActiveServerGames.Select(game => new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("Index", "Home", new { game }),
Title = loc[$"GAME_{game}"],
IsActive = game == Model.Game
}).Prepend(new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("Index", "Home"),
Title = loc["GAME_ALL"],
IsActive = !Model.Game.HasValue
}).ToList()
};
}
<partial name="_SideContextMenu" for="@menuItems"></partial>
</div>
@section scripts {
<environment include="Development">

View File

@ -1,86 +1,101 @@
@model Data.Models.EFPenalty.PenaltyType
@using Humanizer
@using Data.Models
@model Data.Models.EFPenalty.PenaltyType
@{
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
var loc = Utilities.CurrentLocalization.LocalizationIndex;
}
<h4 class="pb-3 text-center">@ViewBag.Title</h4>
<div class="row">
<div class="d-block d-md-flex w-100 pb-2">
<select class="form-control bg-dark text-muted" id="penalty_filter_selection">
@{
foreach (var penaltyType in Enum.GetValues(typeof(Data.Models.EFPenalty.PenaltyType)))
{
if ((Data.Models.EFPenalty.PenaltyType)penaltyType == Data.Models.EFPenalty.PenaltyType.Any)
{
if (Model == Data.Models.EFPenalty.PenaltyType.Any)
<div class="content mt-20">
<h2 class="content-title mt-15">@ViewBag.Title</h2>
<table class="table with-fixed-layout bg-dark-dm bg-light-lm">
<thead>
<tr class="bg-primary text-light d-none d-lg-table-row">
<th colspan="20%">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<th colspan="10%">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
<th colspan="35%">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</th>
<th colspan="20%">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<th colspan="15%" class="text-right">@loc["WEBFRONT_PENALTY_TEMPLATE_TIME"]</th>
</tr>
<tr class="d-flex d-lg-table-row flex-column">
<td colspan="20%" class="p-10 pb-10">
<div class="d-flex p-5 pr-15 bg-dark-dm bg-light-lm rounded">
<div class="custom-switch">
@if (ViewBag.HideAutomatedPenalties)
{
<option value="@Convert.ToInt32(penaltyType)" selected="selected" )>@loc["WEBFRONT_PENALTY_TEMPLATE_SHOW"] @penaltyType.ToString()</option>
<input type="checkbox" id="hide_automated_penalties_checkbox" checked="checked"/>
}
else
{
<option value="@Convert.ToInt32(penaltyType)" )>@loc["WEBFRONT_PENALTY_TEMPLATE_SHOW"] @penaltyType.ToString()</option>
<input type="checkbox" id="hide_automated_penalties_checkbox"/>
}
}
else
{
if ((Data.Models.EFPenalty.PenaltyType)penaltyType == Model)
<label for="hide_automated_penalties_checkbox">@loc["WEBFRONT_PENALTY_HIDE_AUTOMATED"]</label>
</div>
</div>
</td>
<td colspan="46%" class="p-10 pt-5 pb-5">
<div class="input-group mb-10 mb-lg-0">
<div class="input-group-prepend">
<span class="input-group-text">@loc["WEBFRONT_PENALTY_TEMPLATE_SHOWONLY"].Titleize()</span>
</div>
<select class="pl-15 form-control" id="penalty_filter_selection">
@foreach (var penaltyType in Enum.GetValues(typeof(EFPenalty.PenaltyType)).Cast<EFPenalty.PenaltyType>().OrderByDescending(penalty => penalty == EFPenalty.PenaltyType.Any))
{
<option value="@Convert.ToInt32(penaltyType)" selected="selected">@loc["WEBFRONT_PENALTY_TEMPLATE_SHOWONLY"] @penaltyType.ToString()s</option>
if (penaltyType == EFPenalty.PenaltyType.Any)
{
if (Model == EFPenalty.PenaltyType.Any)
{
<option value="@Convert.ToInt32(penaltyType)" selected="selected">@penaltyType.ToString()</option>
}
else
{
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option>
}
}
else
{
if (penaltyType == Model)
{
<option value="@Convert.ToInt32(penaltyType)" selected="selected">@penaltyType.ToString()</option>
}
else
{
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option>
}
}
}
else
{
<option value="@Convert.ToInt32(penaltyType)" )>@loc["WEBFRONT_PENALTY_TEMPLATE_SHOWONLY"] @penaltyType.ToString()s</option>
}
}
}
}
</select>
<div class="pl-md-2 pr-md-2 pt-2 pt-md-0">
<label class="toggle-switch">
@if (ViewBag.HideAutomatedPenalties)
{
<input type="checkbox" id="hide_automated_penalties_checkbox" checked="checked" />
}
else
{
<input type="checkbox" id="hide_automated_penalties_checkbox" />
}
<span class="toggle-switch-slider"></span>
</label>
</div>
<div class="align-self-center">
<span class="text-light text-nowrap">@loc["WEBFRONT_PENALTY_HIDE_AUTOMATED"]</span>
</div>
</div>
</div>
<div class="row">
<table class="table table-striped">
<thead class="d-none d-lg-table-header-group">
<tr class="bg-primary pt-2 pb-2">
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</th>
<th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<th scope="col" class="text-right">@loc["WEBFRONT_PENALTY_TEMPLATE_TIME"]</th>
</tr>
</select>
</div>
</td>
</tr>
</thead>
<tbody id="penalty_table" class="border-bottom bg-dark">
@await Component.InvokeAsync("PenaltyList", new WebfrontCore.ViewModels.PenaltyFilterInfo()
{
Offset = 0,
ShowOnly = Model,
IgnoreAutomated = ViewBag.HideAutomatedPenalties
})
<tbody id="penalty_table">
@await Component.InvokeAsync("PenaltyList", new WebfrontCore.ViewModels.PenaltyFilterInfo
{
Offset = 0,
Count = 30,
ShowOnly = Model,
IgnoreAutomated = ViewBag.HideAutomatedPenalties,
})
</tbody>
</table>
<table class="table d-table d-lg-none">
<tbody></tbody>
</table>
<span id="load_penalties_button" class="oi oi-chevron-bottom text-center text-primary w-100 h3 pb-0 mb-0 d-none d-lg-block"></span>
<div class="w-full text-center">
<i id="loaderLoad" class="oi oi-chevron-bottom mt-10 loader-load-more text-primary m-auto" aria-hidden="true"></i>
</div>
</div>
@section scripts {
<environment include="Development">
<script type="text/javascript" src="~/js/loader.js"></script>
<script type="text/javascript" src="~/js/penalty.js"></script>
</environment>
<script>
initLoader('/Penalty/ListAsync', '#penalty_table', 30, 30, [{
'name': 'hideAutomatedPenalties',
'value': () => document.getElementById('hide_automated_penalties_checkbox').checked
}, {
'name': 'showOnly',
'value': () => $('#penalty_filter_selection').val()
}]);
</script>
}

View File

@ -4,4 +4,4 @@
@model WebfrontCore.ViewModels.PenaltyFilterInfo
@await Component.InvokeAsync("PenaltyList", new { offset = Model.Offset, showOnly = Model.ShowOnly, ignoreAutomated = Model.IgnoreAutomated })
@await Component.InvokeAsync("PenaltyList", new { offset = Model.Offset, count= Model.Count, showOnly = Model.ShowOnly, ignoreAutomated = Model.IgnoreAutomated })

View File

@ -1,84 +1,70 @@
@{
Layout = null;
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
var loc = Utilities.CurrentLocalization.LocalizationIndex;
var canSeeLevel = (ViewBag.PermissionsSet as IEnumerable<string>).HasPermission(WebfrontEntity.ClientLevel, WebfrontPermission.Read) && Model.PunisherLevel != 0;
var punisherLevelClass = canSeeLevel ? $"level-color-{(int)Model.PunisherLevel}" : "text-light-dm text-dark-lm";
}
@using WebfrontCore.Permissions
@model SharedLibraryCore.Dtos.PenaltyInfo
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.OffenderId" class="link-inverse">
<color-code value="@Model.OffenderName"></color-code>
</a>
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
<td class="penalties-color-@Model.PenaltyTypeText.ToLower()">
@Model.PenaltyType
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</th>
<td class="text-light">
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<td>
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync",
"Client",
new { id = Model.PunisherId },
new { @class = !ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy
? "level-color-0"
: "level-color-" + (int)Model.PunisherLevel })
</td>
</tr>
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="w-25 bg-primary" style="border-bottom: 1px solid #222">@loc["WEBFRONT_PENALTY_TEMPLATE_TIME"]</th>
<td class="text-light mb-2 border-bottom">
@{
if (Model.Expired)
{
<span>@Model.TimePunishedString</span>
}
else
{
<span>@Model.TimeRemaining</span>
}
}
</td>
</tr>
<!-- desktop -->
<tr class="d-none d-lg-table-row">
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.OffenderId" class="link-inverse">
<td colspan="20%">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.OffenderId" class="link-inverse">
<color-code value="@Model.OffenderName"></color-code>
</a>
</td>
<td class="penalties-color-@Model.PenaltyTypeText.ToLower()">
<td colspan="10%" class="penalties-color-@Model.PenaltyTypeText.ToLower()">
@Model.PenaltyType
</td>
<td class="text-light w-50">
<td colspan="35%">
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
</td>
<td>
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync",
"Client",
new { id = Model.PunisherId },
new { @class = !ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy
? "level-color-0"
: "level-color-" + (int)Model.PunisherLevel })
<td colspan="20%">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.PunisherId" class="@punisherLevelClass">
<color-code value="@Model.PunisherName"></color-code>
</a>
</td>
<td class="text-right text-light">
@{
if (Model.Expired)
<td colspan="15%" class="text-right">
@if (Model.Expired)
{
<span>@Model.TimePunishedString</span>
}
else
{
<span>@Model.TimeRemaining</span>
}
</td>
</tr>
<!-- mobile -->
<tr class="d-table-row d-lg-none d-flex border-bottom">
<td class="bg-primary text-light text-right">
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</div>
<div class="mt-5 mb-5">@loc["WEBFRONT_PENALTY_TEMPLATE_TIME"]</div>
</td>
<td class="flex-fill">
<div class="mt-5 mb-5">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.OffenderId" >
<color-code value="@Model.OffenderName"></color-code>
</a>
</div>
<div class="mt-5 mb-5 penalties-color-@Model.PenaltyTypeText.ToLower()">
@Model.PenaltyType
</div>
<div class="mt-5 mb-5">
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
</div>
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.PunisherId" class="mt-5 mb-5 @((!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy) || Model.PunisherLevel == 0 ? "text-dark-lm text-light-dm" : "level-color-" + (int)Model.PunisherLevel)">
<color-code value="@Model.PunisherName"></color-code>
</a>
<div class="mt-5 mb-5">
@if (Model.Expired)
{
<span>@Model.TimePunishedString</span>
}
@ -86,6 +72,6 @@
{
<span>@Model.TimeRemaining</span>
}
}
</div>
</td>
</tr>

View File

@ -1,26 +1,28 @@
@model IEnumerable<WebfrontCore.ViewModels.ScoreboardInfo>
@using WebfrontCore.ViewModels
@model IEnumerable<WebfrontCore.ViewModels.ScoreboardInfo>
<ul class="nav nav-tabs border-top border-bottom nav-fill row" role="tablist" id="scoreboard_servers">
@{ var i = 0; }
@foreach (var server in Model)
{
<li class="nav-item">
<a class="nav-link" href="#server_@server.ServerId" role="tab" data-toggle="tab" id="server_@(server.ServerId)_nav" data-serverid="@server.ServerId">
<color-code value="@server.ServerName"></color-code>
</a>
</li>
i++;
}
</ul>
<div class="tab-content border-bottom row">
@{ i = 0; }
@foreach (var server in Model)
{
<div role="tabpanel" class="scoreboard-container tab-pane striped flex-fill" id="server_@server.ServerId" data-server-id="@server.ServerId">
@await Html.PartialAsync("_Scoreboard", server)
</div>
i++;
<div class="content mt-20 row">
<div class="col-12 col-lg-9 col-xl-10">
@if (Model is not null)
{
<div class=" scoreboard-container" data-server-id="@ViewBag.SelectedServerId">
@await Html.PartialAsync("_Scoreboard", Model.FirstOrDefault(server => server.ServerId == ViewBag.SelectedServerId) ?? Model.First())
</div>
}
</div>
@{
var menuItems = new SideContextMenuItems
{
MenuTitle = "Server", Items = Model.Select(server => new SideContextMenuItem
{
IsLink = true,
Reference = Url.Action("Scoreboard", "Server", new { serverId = server.ServerId }),
Title = server.ServerName.StripColors(),
IsActive = ViewBag.SelectedServerId == server.ServerId
}).ToList()
};
}
<partial name="_SideContextMenu" for="@menuItems"></partial>
</div>
@section scripts {

View File

@ -2,146 +2,81 @@
@{
Layout = null;
int half = Model.ClientCount == 0 || Model.Players.Count == 0 ? 0 : (int)Math.Ceiling(Model.ClientCount / 2.0);
}
<div class="col-12 col-md-7 d-none d-md-block">
@{
for (int i = 0; i < Model.ChatHistory.Count; i++)
var half = Model.ClientCount == 0 || Model.Players.Count == 0 ? 0 : (int)Math.Ceiling(Model.ClientCount / 2.0);
var groupedClients = Model.Players.Select((client, i) => new { index = i, client })
.OrderBy(client => client.client.Name)
.GroupBy(client => client.index >= half).Select((group, index) => new
{
if (Model.ChatHistory[i] == null ||
Model.ChatHistory[i].Message == null ||
Model.ChatHistory[i].Name == null)
{
continue;
}
group,
index
}).ToList();
string message = Model.ChatHistory[i].IsHidden && !ViewBag.Authorized ? Model.ChatHistory[i].HiddenMessage : Model.ChatHistory[i].Message;
if (Model.ChatHistory[i].Message == "CONNECTED")
{
<span class="text-light">
<span class="oi oi-account-login mr-2 text-success"> </span>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message == "DISCONNECTED")
{
<span class="text-light">
<span class="oi oi-account-logout mr-2 text-danger"> </span>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
{
<span class="text-light">
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span>
<span>
&mdash;
<color-code value="@message.CapClientName(48)"></color-code>
</span><br />
}
}
string GetIconForState(string messageState)
{
return messageState switch
{
"CONNECTED" => "oi-account-login text-success mr-5",
"DISCONNECTED" => "oi-account-logout text-danger mr-5",
_ => ""
};
}
</div>
<div class="col-md-5">
<div class="row" style="overflow-wrap: anywhere">
<div class="col-6 text-left text-md-right">
@{
for (int i = 0; i < half; i++)
{
if (i > Model.Players.Count - 1)
}
<div class="pt-15 pl-15 pr-15 d-flex flex-wrap flex-column flex-md-row justify-content-between w-full w-auto-lg">
@if (groupedClients.Count > 0)
{
<div class="flex-fill flex-lg-grow-0 w-half-md mr-md-10 mb-md-10">
@foreach (var chat in Model.ChatHistory)
{
var message = chat.IsHidden && !ViewBag.Authorized ? chat.HiddenMessage : chat.Message;
var stateIcon = GetIconForState(chat.Message);
<div>
<i class="oi @stateIcon"></i>
<span>
<color-code value="@chat.Name"></color-code>
</span>
@if (stateIcon == "")
{
continue;
<span class="text-truncate">
&mdash;
<span class="text-white-dm text-black-lm">
<color-code value="@message?.CapClientName(48)"></color-code>
</span>
</span>
}
string levelColorClass = !ViewBag.Authorized ? "" : $"level-color-{Model.Players[i].LevelInt}";
<div class="d-inline-flex">
@if (ViewBag.Authorized)
{
<div class="oi oi-circle-x ml-0 mr-1 profile-action action-kick-button d-inline d-md-none" data-action="kick" data-action-id="@Model.Players[i].ClientId" aria-hidden="true"></div>
}
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.Players[i].ClientId" class="@levelColorClass">
<color-code value="@Model.Players[i].Name"></color-code>
</a>
@if (ViewBag.Authorized)
{
<div class="oi oi-circle-x ml-1 profile-action action-kick-button d-none d-md-inline" data-action="kick" data-action-id="@Model.Players[i].ClientId" aria-hidden="true"></div>
}
</div>
<br />
}
</div>
}
<hr class="d-block d-md-none"/>
</div>
<div class="col-6 text-right w-50">
@{
for (int i = half; i < Math.Min(Model.ClientCount, Model.Players.Count); i++)
}
<div class="d-flex flex-row flex-fill flex-lg-grow-0 w-half-md">
@foreach (var clientIndex in groupedClients)
{
<div class="@(clientIndex.index == 1 ? "pl-md-10 text-right" : "pr-md-10") flex-fill">
@foreach (var client in clientIndex.group)
{
if (i > Model.Players.Count - 1)
{
continue;
}
string levelColorClass = !ViewBag.Authorized ? "" : $"level-color-{Model.Players[i].LevelInt}";
<div>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.Players[i].ClientId" class="@levelColorClass">
<color-code value="@Model.Players[i].Name"></color-code>
var levelColorClass = !ViewBag.Authorized || client.client.LevelInt == 0 ? "text-light-dm text-dark-lm" : $"level-color-{client.client.LevelInt}";
<div class="d-flex @(clientIndex.index == 1 ? "flex-row-reverse" : "") w-xl-150">
<has-permission entity="AdminMenu" required-permission="Update">
<a href="#actionModal" class="profile-action" data-action="kick" data-action-id="@client.client.ClientId" aria-hidden="true">
<i class="oi oi-circle-x font-size-12 @levelColorClass"></i>
</a>
</has-permission>
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.client.ClientId" class="@(clientIndex.index == 1 ? "mr-5" : "ml-5") @levelColorClass no-decoration">
<color-code value="@client.client.Name"></color-code>
</a>
@if (ViewBag.Authorized)
{
<span class="oi oi-circle-x profile-action align-baseline action-kick-button flex-column mt-0" data-action="kick" data-action-id="@Model.Players[i].ClientId" aria-hidden="true"></span>
}
<br />
</div>
}
}
</div>
</div>
}
@if (groupedClients.Count > 0)
{
<br/>
}
</div>
</div>
@if (Model.ChatHistory.Count > 0)
{
<div class="w-100 border-bottom d-md-none d-block mt-1 mb-1"></div>
}
<div class="col-12 col-md-8 d-md-none d-block text-left">
@{
for (int i = 0; i < Model.ChatHistory.Count; i++)
{
if (Model.ChatHistory[i] == null ||
Model.ChatHistory[i].Message == null ||
Model.ChatHistory[i].Name == null)
{
continue;
}
string message = Model.ChatHistory[i].IsHidden && !ViewBag.Authorized ? Model.ChatHistory[i].HiddenMessage : Model.ChatHistory[i].Message;
if (Model.ChatHistory[i].Message == "CONNECTED")
{
<span class="text-light">
<span class="oi oi-account-login mr-2 text-success"> </span>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message == "DISCONNECTED")
{
<span class="text-light">
<span class="oi oi-account-logout mr-2 text-danger"> </span>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
{
<span class="text-light">
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span>
<span>
&mdash;
<color-code value="@message.CapClientName(48)"></color-code>
</span><br />
}
}
}
</div>

View File

@ -1,5 +1,6 @@
@using WebfrontCore.ViewModels
@using System.Globalization
@using SharedLibraryCore.Database.Models
@model WebfrontCore.ViewModels.ScoreboardInfo
@{
Layout = null;
@ -16,17 +17,29 @@
{
if (propertyName == (Model.OrderByKey ?? nameof(ClientScoreboardInfo.Score)))
{
return Model.ShouldOrderDescending ? "<span class=\"ml-2\">▼</span>" : "<span class=\"ml-2\">▲</span>";
return Model.ShouldOrderDescending ? "<span class=\"ml-5 font-size-12\">▼</span>" : "<span class=\"ml-5 font-size-12\">▲</span>";
}
return null;
}
string GetTeamBackgroundColorClass(ClientScoreboardInfo client)
{
return $"team-{client.Team.ToString().ToLower()}-bg {(client.Team == EFClient.TeamType.Unknown ? "bg-dark-dm bg-light-lm" : "")}";
}
}
<table class="table thead-light bg-dark mb-0 table-responsive-md table-sort"
<h4 class="content-title mb-0">
Scoreboard
</h4>
<span class="text-muted">
<color-code value="@Model.ServerName"></color-code>
</span>
<table class="table table-sort mt-15"
data-sort-column="@(Model.OrderByKey ?? nameof(ClientScoreboardInfo.Score))"
data-sort-down="@Model.ShouldOrderDescending.ToString().ToLower()">
<tr class="bg-dark border-bottom">
<tr class="bg-dark-dm bg-white-lm d-none d-lg-table-row">
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.ClientName)">@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PLAYER"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.ClientName)))</th>
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.Score)">@ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Score)))</th>
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.Kills)">@ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Kills)))</th>
@ -38,9 +51,10 @@
</tr>
@foreach (var client in Model.ShouldOrderDescending ? Model.ClientInfo.OrderByDescending(OrderByFunc) : Model.ClientInfo.OrderBy(OrderByFunc))
{
<tr class="team-@client.Team.ToString().ToLower()-bg">
<!-- desktop -->
<tr class="@GetTeamBackgroundColorClass(client) d-none d-lg-table-row">
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="no-decoration text-light-dm text-dark-lm">
<color-code value="@client.ClientName"></color-code>
</a>
</td>
@ -52,5 +66,31 @@
<td>@(client.ZScore is null or 0 ? "--" : Math.Round(client.ZScore.Value, 2).ToString(CultureInfo.CurrentCulture))</td>
<td class="text-right">@client.Ping</td>
</tr>
<tr class="d-table-row d-lg-none d-flex">
<td class="text-right bg-primary text-light flex-grow-0">
<div>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PLAYER"]</div>
<div>@ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"]</div>
<div>@ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]</div>
<div>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_DEATHS"]</div>
<div>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_RATIO"]</div>
<div>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_SPM"]</div>
<div>@ViewBag.Localization["WEBFRONT_ADV_STATS_ZSCORE"]</div>
<div>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PING"]</div>
</td>
<td class="@GetTeamBackgroundColorClass(client) flex-fill">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="no-decoration text-light-dm text-dark-lm">
<color-code value="@client.ClientName"></color-code>
</a>
<div>@client.Score</div>
<div>@(client.Kills ?? 0)</div>
<div>@(client.Deaths ?? 0)</div>
<div>@Math.Round(client.Kdr ?? 0, 2)</div>
<div>@Math.Round(client.ScorePerMinute ?? 0)</div>
<div>@(client.ZScore is null or 0 ? "--" : Math.Round(client.ZScore.Value, 2).ToString(CultureInfo.CurrentCulture))</div>
<div>@client.Ping</div>
</td>
</tr>
}
</table>

View File

@ -18,65 +18,70 @@
}
}
<div class="row server-header pt-1 pb-1 bg-primary " id="server_header_@Model.ID">
<div class="col-md-4 text-center text-md-left d-inline-flex justify-content-center justify-content-md-start">
<color-code value="@Model.Name"></color-code>
<a href="@Model.ConnectProtocolUrl" class="ml-2 mr-2 align-self-center d-none d-md-flex server-join-button" title="@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HOME_JOIN_DESC"]">
<span class="oi oi-play-circle mr-1 align-self-center"></span>
<span class="server-header-ip-address" style="display:none;">@Model.IPAddress</span>
</a>
@if (ViewBag.Authorized)
{
<span class="oi oi-chat align-self-center profile-action d-none d-md-flex mr-2" data-action="chat" data-action-id="@Model.ID"></span>
}
<a asp-controller="Server" asp-action="Scoreboard" asp-fragment="server_@Model.ID" title="@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]"
class="align-self-center d-none d-md-flex">
<span class="oi oi-spreadsheet ml-1"></span>
</a>
</div>
<div class="text-center col-md-4 align-self-center">
<span>@Model.Map</span>
@if (!string.IsNullOrEmpty(Model.GameType) && Model.GameType.Length > 1)
{
<span>&ndash;</span>
<span>@Model.GameType</span>
}
</div>
<div class="text-center text-md-right col-md-4 d-flex align-self-center justify-content-center justify-content-md-end flex-column-reverse flex-sm-row">
@if (Model.LobbyZScore != null)
{
<div title="@ViewBag.Localization["WEBFRONT_HOME_RATING_DESC"]" class="cursor-help d-flex flex-row-reverse flex-md-row justify-content-center">
<span>@(Model.LobbyZScore ?? 0)</span>
<span class="oi oi-bolt align-self-center mr-1 ml-1"></span>
<div class="card mt-20 mb-20 ml-0 mr-0 p-0">
<div class="p-5 pl-10 pr-10 bg-primary rounded-top d-flex flex-column flex-md-row flex-wrap justify-content-between text-light" id="server_header_@Model.ID">
<div class="d-flex align-self-center flex-column-reverse flex-md-row">
<div class="ml-5 mr-5 text-center">
<color-code value="@Model.Name"></color-code>
</div>
<div class="d-flex justify-content-center">
<!-- connect button -->
<a href="@Model.ConnectProtocolUrl" class="text-light align-self-center" title="@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HOME_JOIN_DESC"]">
<i class="oi oi-play-circle ml-5 mr-5"></i>
<span class="server-header-ip-address" style="display:none;">@(Model.ExternalIPAddress):@(Model.Port)</span>
</a>
<has-permission entity="AdminMenu" required-permission="Update">
<!-- send message button -->
<a href="#actionModal" class="profile-action text-light align-self-center" data-action="chat" data-action-id="@Model.ID">
<i class="oi oi-chat ml-5 mr-5"></i>
</a>
</has-permission>
<!-- scoreboard button -->
<a asp-controller="Server" asp-action="Scoreboard" asp-route-serverId="@Model.Endpoint" title="@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]"
class="text-light align-self-center">
<i class="oi oi-spreadsheet ml-5 mr-5"></i>
</a>
</div>
</div>
<div class="align-self-center">
<span>@Model.Map</span>
@if (!string.IsNullOrEmpty(Model.GameType) && Model.GameType.Length > 1)
{
<span>&ndash;</span>
<span>@Model.GameType</span>
}
</div>
<div class="align-self-center d-flex flex-column flex-md-row">
@if (Model.LobbyZScore != null)
{
<div data-toggle="tooltip" data-title="@ViewBag.Localization["WEBFRONT_HOME_RATING_DESC"]" class="cursor-help d-flex flex-row-reverse flex-md-row justify-content-center">
<span>@(Model.LobbyZScore ?? 0)</span>
<span class="oi oi-bolt align-self-center" style="margin-right: 2px; margin-left: 2px"></span>
</div>
}
<div class="mr-5 ml-5 align-self-center">
<span class="server-clientcount">@Model.ClientCount</span>/<span class="server-maxclients">@Model.MaxClients</span>
</div>
}
<div>
<span class="server-clientcount">@Model.ClientCount</span>/<span class="server-maxclients">@Model.MaxClients</span>
</div>
</div>
@if (ViewBag.Authorized)
<div id="server_clientactivity_@Model.ID" class="bg-dark-dm bg-light-lm server-activity">
<partial name="../Server/_ClientActivity" for="@Model"/>
</div>
@if (Model.Players.Any())
{
<div class="p-1 d-flex d-md-none justify-content-center col-12">
<span class="oi oi-chat align-self-center profile-action d-flex d-md-none" data-action="chat" data-action-id="@Model.ID"></span>
<div class="ml-15 mr-15">
<hr/>
</div>
}
<a asp-controller="Server" asp-action="Scoreboard" title="@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]"
class="p-1 d-flex d-md-none justify-content-center col-12">
<span class="oi oi-spreadsheet ml-1"></span>
</a>
</div>
<div id="server_clientactivity_@Model.ID" class="bg-dark row server-activity @(Model.ClientCount > 0 ? "pt-2 pb-2" : "")">
@await Html.PartialAsync("../Server/_ClientActivity", Model)
</div>
<div class="row server-history mb-4">
<div class="server-history-row m-auto" style="position:relative; width: 100%" id="server_history_@Model.ID" data-serverid="@Model.ID"
data-clienthistory='@Html.Raw(Json.Serialize(Model.ClientHistory))'
data-clienthistory-ex='@Html.Raw(Json.Serialize(Model.ClientHistory.ClientCounts))'
data-online="@Model.Online">
<canvas id="server_history_canvas_@Model.ID" height="100"></canvas>
<div class="server-history">
<div class="server-history-row m-auto bg-dark-dm bg-light-lm rounded-bottom" style="position:relative; width: 100%" id="server_history_@Model.ID" data-serverid="@Model.ID"
data-clienthistory='@Html.Raw(Json.Serialize(Model.ClientHistory))'
data-clienthistory-ex='@Html.Raw(Json.Serialize(Model.ClientHistory.ClientCounts))'
data-online="@Model.Online">
<canvas id="server_history_canvas_@Model.ID" class="rounded-bottom" height="100"></canvas>
</div>
</div>
</div>

View File

@ -19,7 +19,7 @@
{
<tr>
<td class="w-25">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="link-inverse">@client.Name</a>
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="link-inverse">@client.Name</a>
</td>
<td class="w-25">
@client.IPAddress
@ -39,7 +39,7 @@
{
<div class="p-2 mb-3 border-bottom" style="background-color: #222;">
<div class="d-flex flex-row">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="h4 mr-auto">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="h4 mr-auto">
<color-code value="@client.Name"></color-code>
</a>
<div class="client-location-flag align-self-center" data-ip="@client.IPAddress"></div>

View File

@ -6,9 +6,9 @@
var lastHeaderEventDate = DateTime.UtcNow;
TimeSpan timeSpanForEvent(DateTime When)
TimeSpan TimeSpanForEvent(DateTime occuredAt)
{
var timePassed = (DateTime.UtcNow - When);
var timePassed = DateTime.UtcNow - occuredAt;
var daysPassed = timePassed.TotalDays;
var minutesPassed = timePassed.TotalMinutes;
@ -22,45 +22,43 @@
return TimeSpan.FromHours(1);
}
if (daysPassed > 1 && daysPassed <= 7)
if (daysPassed is > 1 and <= 7)
{
return TimeSpan.FromDays(1);
}
if (daysPassed > 7 && daysPassed <= 31)
if (daysPassed is > 7 and <= 31)
{
return TimeSpan.FromDays(31);
}
if (daysPassed > 31 && daysPassed <= 365)
if (daysPassed is > 31 and <= 365)
{
return TimeSpan.FromDays(31);
}
else
{
return TimeSpan.FromDays(365);
}
return TimeSpan.FromDays(365);
}
}
@if (Model.Count() == 0)
@{ var start = 0; }
@foreach (var meta in Model.OrderByDescending(meta => meta.When))
{
<div class="p2 text-muted profile-event-timestep">@ViewBag.Localization["WEBFRONT_CLIENT_META_NONE"]</div>
}
@foreach (var meta in Model.OrderByDescending(_meta => _meta.When))
{
@if ((lastHeaderEventDate - meta.When) > timeSpanForEvent(lastHeaderEventDate))
if (lastHeaderEventDate - meta.When > TimeSpanForEvent(lastHeaderEventDate) && (start > 0 || (DateTime.UtcNow - meta.When).TotalDays > 3))
{
<div class="p2 text-white profile-event-timestep">
<span class="text-primary">&mdash;</span>
<span>@meta.When.HumanizeForCurrentCulture()</span>
</div>
TempData["ShowMetaHeader"] = true;
lastHeaderEventDate = meta.When;
}
else
{
TempData["ShowMetaHeader"] = false;
}
start++;
<div class="profile-meta-entry loader-data-time" data-time="@meta.When.ToFileTimeUtc()" title="@Utilities.FormatExt(ViewBag.Localization["WEBFRONT_PROFILE_META_DATE_OCCURRED"], meta.When.ToString())">
<partial name="~/Views/Client/Profile/Meta/_@(meta.GetType().Name).cshtml" model="meta" />
<div class="profile-meta-entry loader-data-time" data-time="@meta.When.ToFileTimeUtc()" onclick="$('#metaContextDateToggle@(start)').show()">
<partial name="~/Views/Client/Profile/Meta/_@(meta.GetType().Name).cshtml" model="meta"/>
<div style="display:none" id="metaContextDateToggle@(start)">
Event occured at <span class="text-light">@meta.When.ToString()</span>
</div>
</div>
}

View File

@ -1,15 +1,16 @@
@model Exception
@using SharedLibraryCore
@{
ViewData["Title"] = "Error";
}
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_TITLE"]</h4>
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_DESC"]</h4>
<strong class="text-warning">
@if (Model != null)
{
@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_CODE"].FormatExt(Model.Message);
}
</strong>
<div class="content">
<h2 class="content-title text-danger">@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_TITLE"]</h2>
<h2 class="content-title text-muted">@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_DESC"]</h2>
<strong class="text-warning">
@if (Model != null)
{
@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_CODE"].FormatExt(Model.Message)
}
</strong>
</div>

View File

@ -2,12 +2,20 @@
@{
ViewData["Title"] = "Error";
}
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_TITLE"]</h4>
<h4 class="text-danger">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_DESC"]</h4>
<strong class="text-warning">
@if (Model.HasValue && Model.Value == 404)
{
@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_NOTFOUND"]
}
</strong>
<div class="content">
<div class="card m-0">
<div class="d-flex">
<div class="align-self-center w-100 h-100 mr-20 ui-error-icon"></div>
<div>
<h2 class="content-title text-primary mb-0">@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_TITLE"]</h2>
<h2 class="content-title">@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_GENERIC_DESC"]</h2>
<div class="text-muted">
@if (Model is 404)
{
@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_ERROR_NOTFOUND"]
}
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,69 @@
@model WebfrontCore.ViewModels.TableInfo
@{
Layout = null;
}
<h4 class="content-title mb-15 mt-15">
<color-code value="@Model.Header"></color-code>
</h4>
<table class="table">
<thead>
<tr class="bg-primary text-light d-none d-lg-table-row">
@foreach (var column in Model.Columns)
{
<th>@column.Title</th>
}
</tr>
</thead>
<tbody>
@{ var start = 0;}
@if (!Model.Rows.Any())
{
<!-- desktop -->
<tr class="bg-dark-dm bg-light-lm d-none d-lg-table-row">
<td colspan="@Model.Columns.Count">No data...</td>
</tr>
<!-- mobile -->
<tr class="d-flex d-table-row d-lg-none">
<td class="bg-primary text-light text-right w-125">
&mdash;
</td>
<td class="bg-dark-dm bg-light-lm flex-fill w-200">No data...</td>
</tr>
}
@foreach (var row in Model.Rows)
{
<!-- desktop -->
<tr class="bg-dark-dm bg-light-lm @(Model.InitialRowCount > 0 && start >= Model.InitialRowCount ? "d-none hidden-row-lg": "d-none d-lg-table-row")">
@for (var i = 0; i < Model.Columns.Count; i++)
{
<td>@row.Datum[i]</td>
}
</tr>
<!-- mobile -->
<tr class="@(Model.InitialRowCount > 0 && start >= Model.InitialRowCount ? "d-none hidden-row": "d-flex d-table-row d-lg-none")">
<td class="bg-primary text-light text-right w-125">
@foreach (var column in Model.Columns)
{
<div class="mt-5 mb-5 text-truncate">@column.Title</div>
}
</td>
<td class="bg-dark-dm bg-light-lm flex-fill w-200">
@for (var i = 0; i < Model.Columns.Count; i++)
{
<div class="mt-5 mb-5 text-truncate" style="min-width:0">@row.Datum[i]</div>
}
</td>
</tr>
start++;
}
</tbody>
</table>
@if (Model.InitialRowCount > 0 && Model.Rows.Count > 0)
{
<button class="btn btn-block table-slide" data-toggle="tooltip" data-title="Show @(Model.Rows.Count - Model.InitialRowCount) more rows">
<span class="oi oi-chevron-bottom"></span>
</button>
}

View File

@ -1,10 +1,7 @@
@{
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
}
<!DOCTYPE html>
<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/html" lang="@ViewBag.Language">
<head>
<meta charset="utf-8" />
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>@ViewBag.Title | IW4MAdmin</title>
<meta property="og:title" content="@ViewBag.Title | IW4MAdmin">
@ -16,111 +13,109 @@
<meta name="keywords" content="@ViewBag.Keywords">
<link rel="icon" type="image/png" href="~/images/icon.png">
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<environment include="Development">
<link rel="stylesheet" href="~/dynamic/css/global.css?version=@ViewBag.Version" />
<link rel="stylesheet" href="~/lib/halfmoon/css/halfmoon-variables.css"/>
<link rel="stylesheet" href="/css/src/main.css"/>
@if (ViewBag.Configuration.WebfrontPrimaryColor is not null)
{
<style>
:root {
--blue-color: @ViewBag.Configuration.WebfrontPrimaryColor;
}
</style>
}
@if (ViewBag.Configuration.WebfrontSecondaryColor is not null)
{
<style>
:root {
--yellow-color: @ViewBag.Configuration.WebfrontSecondaryColor;
}
</style>
}
</environment>
<environment include="Production">
<link rel="stylesheet" href="~/dynamic/css/global.min.css?version=@ViewBag.Version" />
<link rel="stylesheet" href="~/dynamic/css/global.min.css?version=@ViewBag.Version"/>
</environment>
@await RenderSectionAsync("styles", false)
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
@Html.ActionLink((string)ViewBag.CustomBranding, "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "Index", "Home", new {area = ""}, new {@class = "nav-link nav-icon oi oi-hard-drive", title=@loc["WEBFRONT_NAV_SERVERS"]})</li>
<li class="nav-item text-center d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_SERVERS"], "Index", "Home", new {area = ""}, new {@class = "nav-link"})</li>
@if (ViewBag.Configuration.CommunityInformation.IsEnabled)
{
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "Index", "About", new {area = ""}, new {@class = "nav-link nav-icon oi oi-list-rich", title = loc["WEBFRONT_NAV_ABOUT"]})</li>
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_ABOUT"], "Index", "About", new {area = ""}, new {@class = "nav-link"})</li>
}
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "List", "Penalty", new {area = ""}, new {@class = "nav-link nav-icon oi oi-lock-locked", title=loc["WEBFRONT_NAV_PENALTIES"]})</li>
<li class="nav-item text-center d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_PENALTIES"], "List", "Penalty", new {area = ""}, new {@class = "nav-link"})</li>
@if (ViewBag.Authorized)
{
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link nav-icon oi oi-people", title=loc["WEBFRONT_NAV_PRIVILEGED"]})</li>
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
}
else if (!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy)
{
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link nav-icon oi oi-people", title=loc["WEBFRONT_NAV_PRIVILEGED"]})</li>
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
}
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "Help", "Home", new {area = ""}, new {@class = "nav-link nav-icon oi oi-question-mark", title=loc["WEBFRONT_NAV_HELP"]})</li>
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_HELP"], "Help", "Home", new {area = ""}, new {@class = "nav-link"})</li>
@foreach (var _page in ViewBag.Pages)
{
if (_page.Location == "/Stats/TopPlayersAsync")
{
<li class="nav-item d-none d-lg-inline-block d-xl-none">
<a class="nav-link nav-icon oi oi-bar-chart" href="@_page.Location" title="@_page.Name"></a>
</li>
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">
<a class="nav-link" href="@_page.Location">@_page.Name</a>
</li>
}
else
{
<li class="nav-item text-center text-lg-left">
<a class="nav-link" href="@_page.Location">@_page.Name</a>
</li>
}
}
<li class="nav-item text-center text-lg-left"></li>
@if (!string.IsNullOrEmpty(ViewBag.SocialLink))
{
<li class="nav-item text-center text-lg-left"><a href="@ViewBag.SocialLink" class="nav-link" target="_blank">@ViewBag.SocialTitle</a></li>
}
@if (ViewBag.Authorized)
{
<li class="nav-link dropdown text-center text-lg-left p-0">
<a href="#" class="nav-link oi oi-person dropdown-toggle oi-fix-navbar w-100" id="account_dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a>
<body class="dark-mode with-custom-webkit-scrollbars with-custom-css-scrollbars" data-set-preferred-mode-onload="true">
<div class="dropdown-menu p-0" aria-labelledby="account_dropdown">
<a asp-controller="Console" asp-action="Index" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_CONSOLE"]</a>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@ViewBag.User.ClientId" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_PROFILE"]</a>
@if (ViewBag.User.Level >= SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
{
<a asp-controller="Configuration" asp-action="Edit" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_EDIT_CONFIGURATION"]</a>
}
<a asp-controller="Admin" asp-action="AuditLog" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_AUDIT_LOG"]</a>
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="RecentClients" title="@loc["WEBFRONT_ACTION_RECENT_CLIENTS"]">@loc["WEBFRONT_ACTION_RECENT_CLIENTS"]</a>
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="GenerateLoginToken" title="@loc["WEBFRONT_ACTION_TOKEN"]">@loc["WEBFRONT_ACTION_TOKEN"]</a>
<a asp-controller="Account" asp-action="LogoutAsync" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_LOGOUT"]</a>
</div>
</li>
}
else
{
<li class="nav-item text-center text-md-left">
<a href="#" id="profile_action_login_btn" class="nav-link profile-action oi oi-key oi-fix-navbar w-100" title="Login" data-action="login" aria-hidden="true"></a>
</li>
}
</ul>
<form class="form-inline text-primary pt-3 pb-3" method="get" action="/Client/FindAsync">
<input id="client_search" name="clientName" class="form-control mr-lg-2 w-100" type="text" placeholder="@loc["WEBFRONT_NAV_SEARCH"]" />
</form>
<!-- Action Modal -->
<div class="modal" id="actionModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div id="modalLoadingBar" class="progress-bar position-absolute flex-fill position-fixed z-30" style="display:none">
<div class="progress-bar-value"></div>
</div>
<div class="modal-content">
<div class="modal-content">
<a href="#" class="btn close" role="button" aria-label="Close">
<span aria-hidden="true">&times;</span>
</a>
<div id="actionModalContent">
<h4 class="mt-20">No content available yet...</h4>
</div>
</div>
</nav>
</header>
</div>
</div>
</div>
<!-- loading icon -->
<div class="oi oi-loop-circular layout-loading-icon"></div>
<div class="page-wrapper with-navbar with-sidebar" data-sidebar-type="overlayed-sm-and-down">
<!-- toast notifications -->
<div class="sticky-alerts"></div>
<!-- top menu bar -->
<nav class="navbar">
<button id="toggle-sidebar-btn" class="btn btn-action" type="button" onclick="halfmoon.toggleSidebar()">
<i class="oi oi-menu" aria-hidden="true"></i>
</button>
<!-- branding -->
<a asp-controller="Home" asp-action="Index" class="navbar-brand mr-20 mr-md-0">
<div>@ViewBag.CustomBranding</div>
</a>
<!-- client badges -->
<div class="d-none d-md-block">
<div class="badge-group ml-20" role="group" aria-label="...">
<span class="badge badge-primary">@(ViewBag.ClientCount ?? "-")</span>
<span class="badge bg-dark-dm bg-light-lm">Clients</span>
</div>
<has-permission entity="PrivilegedClientsPage" required-permission="Read">
<div class="badge-group ml-10" role="group" aria-label="...">
<span class="badge badge-success">@(ViewBag.AdminCount ?? "-")</span>
<span class="badge bg-dark-dm bg-light-lm">Admins</span>
</div>
</has-permission>
<has-permission entity="AdminMenu" required-permission="Read">
<div class="badge-group ml-10" role="group">
<span class="badge badge-danger">@(ViewBag.ReportCount ?? "-")</span>
<span class="badge bg-dark-dm bg-light-lm">Reports</span>
</div>
</has-permission>
</div>
<div class="d-flex d-lg-none ml-auto">
<a href="#contextMenuModal">
<button class="btn" type="button">
<i class="oi oi-ellipses"></i>
</button>
</a>
</div>
@*<div class="d-none d-md-flex ml-auto">
<div class="btn oi btn-square btn-action mr-10" data-glyph="moon" onclick="halfmoon.toggleDarkMode()" title="Toggle display mode"></div>
</div>*@
<div class="d-none d-lg-block ml-auto">
<partial name="_SearchResourceForm"/>
</div>
</nav>
<partial name="_LeftNavBar"/>
<!-- Main Modal -->
<div class="modal fade" id="mainModal" tabindex="-1" role="dialog" aria-labelledby="mainModalLabel" aria-hidden="true">
<!--<div class="modal fade" id="mainModal" tabindex="-1" role="dialog" aria-labelledby="mainModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content bg-dark">
<div class="modal-header">
@ -133,75 +128,46 @@
</div>
</div>
</div>
</div>
</div>-->
<!-- End Main Modal -->
<!-- Action Modal -->
<div class="modal fade" id="actionModal" tabindex="-1" role="dialog" aria-labelledby="actionModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title" id="actionModalLabel">IW4MAdmin</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" class="text-danger">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="modal-message text-danger mb-3"></div>
<div class="modal-body-content"></div>
</div>
<!--<div class="modal-footer">
<button type="button" class="btn btn-primary">Action</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>-->
</div>
<div id="target_id">
@await RenderSectionAsync("targetid", required: false)
</div>
<!-- End Action Modal -->
<div class="container-fluid content-wrapper">
<div id="mainLoadingBar" class="progress-bar position-absolute flex-fill position-fixed z-30" style="display: none">
<div class="progress-bar-value"></div>
</div>
@RenderBody()
<div class="content">
<div class="badge text-muted">threadsafe.pw</div>
</div>
</div>
<div id="target_id">
@RenderSection("targetid", required: false)
</div>
<!-- End Action Modal -->
<div class="@(ViewBag.IsFluid ?? false ? "container-fluid" : "container") pt-4 pb-4 pl-3 pr-3 pr-lg-4 pl-lg-4">
@RenderBody()
<footer id="footer_text">
<div class="d-lg-none d-block text-center pt-4 pb-4">
<a href="https://github.com/RaidMax/IW4M-Admin/releases" target="_blank">
@Program.Manager.Version
</a>
<br />
<span class="text-muted">Developed by RaidMax</span>
</div>
<div class="footer-mobile d-lg-block d-none text-center">
<a href="https://github.com/RaidMax/IW4M-Admin/releases" target="_blank">
@Program.Manager.Version
</a>
<br />
<span class="text-muted">Developed by RaidMax</span>
</div>
</footer>
</div>
<environment include="Development">
<script type="text/javascript" src="~/lib/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="~/lib/popper.js/dist/umd/popper.js"></script>
<script type="text/javascript" src="~/lib/moment.js/moment.js"></script>
<script type="text/javascript" src="~/lib/moment-timezone/moment-timezone.js"></script>
<script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script type="text/javascript" src="~/lib/canvas.js/canvasjs.js"></script>
<script type="text/javascript" src="~/lib/chart.js/dist/Chart.bundle.min.js"></script>
<script type="text/javascript" src="~/js/action.js"></script>
<script type="text/javascript" src="~/js/search.js"></script>
</environment>
<environment include="Production">
<script type="text/javascript" src="~/js/global.min.js?version=@ViewBag.Version"></script>
</environment>
<script>
</div>
<environment include="Development">
<script type="text/javascript" src="~/lib/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="~/lib/moment.js/moment.js"></script>
<script type="text/javascript" src="~/lib/moment-timezone/moment-timezone.js"></script>
<script type="text/javascript" src="~/lib/chart.js/dist/Chart.bundle.min.js"></script>
<script type="text/javascript" src="~/lib/halfmoon/js/halfmoon.js"></script>
<script type="text/javascript" src="~/js/action.js"></script>
<script type="text/javascript" src="~/js/search.js"></script>
</environment>
<environment include="Production">
<script type="text/javascript" src="~/js/global.min.js?version=@ViewBag.Version"></script>
</environment>
<script>
let _localizationTmp = @Html.Raw(Json.Serialize(ViewBag.Localization));
const _localization = [];
$.each(_localizationTmp.set, function (key, value) {
_localization[key] = value;
});
</script>
@await RenderSectionAsync("scripts", required: false)
@Html.Raw(ViewBag.ScriptInjection)
@await RenderSectionAsync("scripts", required: false)
@Html.Raw(ViewBag.ScriptInjection)
</body>
</html>
</html>

View File

@ -0,0 +1,166 @@
@using SharedLibraryCore.Configuration
@using SharedLibraryCore.Dtos
@using Data.Models.Client
<!-- left side navigation -->
<div class="sidebar-overlay" onclick="halfmoon.toggleSidebar()"></div>
<div class="sidebar">
<div class="sidebar-menu list">
<div class="sidebar-content m-0">
<div class="pr-20 pl-20 mb-20 d-block d-lg-none">
<partial name="_SearchResourceForm"/>
</div>
<span class="sidebar-title ">Main</span>
<div class="sidebar-divider"></div>
<!-- servers -->
<a asp-controller="Home" asp-action="Index" class="sidebar-link">
<i class="oi oi-hard-drive mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_SERVERS"]</span>
</a>
<!-- about -->
<a asp-controller="About" asp-action="Index" class="sidebar-link">
<i class="oi oi-info mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_ABOUT"]</span>
</a>
<!-- penalties -->
<a asp-controller="Penalty" asp-action="List" class="sidebar-link">
<i class="oi oi-lock-locked mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_PENALTIES"]</span>
</a>
<!-- privileged -->
<has-permission entity="PrivilegedClientsPage" required-permission="Read">
<a asp-controller="Client" asp-action="Privileged" class="sidebar-link">
<i class="oi oi-people mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_PRIVILEGED"]</span>
</a>
</has-permission>
<!-- help -->
<has-permission entity="HelpPage" required-permission="Read">
<a asp-controller="Home" asp-action="Help" class="sidebar-link">
<i class="oi oi-question-mark mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_HELP"]</span>
</a>
</has-permission>
<!-- profile -->
<has-permission entity="ProfilePage" required-permission="Read">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@ViewBag.User.ClientId" class="sidebar-link">
<i class="oi oi-person mr-5"></i>
<span class="name">Profile</span>
</a>
</has-permission>
@if (!ViewBag.Authorized)
{
<a href="#actionModal" class="profile-action sidebar-link" data-action="login">
<i class="oi oi-key mr-5"></i>
<span class="name">Login</span>
</a>
}
<br/>
<!-- stats -->
<div class="sidebar-title ">Stats</div>
<div class="sidebar-divider"></div>
@foreach (Page pageLink in ViewBag.Pages)
{
<a class="sidebar-link" href="@pageLink.Location">
<i class="oi @(pageLink.Location.EndsWith("Radar/All") ? "oi-wifi" : "oi-bar-chart") mr-5"></i>
<span class="name">@pageLink.Name</span>
</a>
}
<!-- scoreboard -->
<a asp-controller="Server" asp-action="Scoreboard" class="sidebar-link">
<i class="oi oi-spreadsheet mr-5"></i>
<span class="name">Scoreboard</span>
</a>
<br/>
<!-- socials -->
@if (ViewBag.CommunityInformation?.IsEnabled && ViewBag.CommunityInformation.SocialAccounts.Length > 0)
{
<span class="sidebar-title ">Socials</span>
<div class="sidebar-divider"></div>
}
@foreach (var social in ViewBag.CommunityInformation?.SocialAccounts ?? Array.Empty<SocialAccountConfiguration>())
{
<a href="@social.Url" class="sidebar-link" target="_blank" title="@social.Title">
@if (!string.IsNullOrWhiteSpace(social.IconId))
{
<i class="oi @social.IconId mr-5"></i>
}
else if (!string.IsNullOrWhiteSpace(social.IconUrl))
{
var url = Uri.TryCreate(social.IconUrl, UriKind.Absolute, out Uri parsedUrl)
? parsedUrl.AbsoluteUri
: $"/images/community/{social.IconUrl}";
<img class="img-fluid mr-5" style="max-height: 1.2rem" src="@url" alt="@social.Title"/>
}
<span class="name">@social.Title</span>
</a>
}
<br/>
<!-- admin -->
<has-permission entity="AdminMenu" required-permission="Read">
<div class="sidebar-title ">Admin</div>
<div class="sidebar-divider"></div>
<has-permission entity="ConsolePage" required-permission="Read">
<a asp-controller="Console" asp-action="Index" class="sidebar-link">
<i class="oi oi-terminal mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_CONSOLE"]</span>
</a>
</has-permission>
@if (ViewBag.User.Level == EFClient.Permission.Owner)
{
<a asp-controller="Configuration" asp-action="Edit" class="sidebar-link">
<i class="oi oi-cog mr-5"></i>
<span class="name">Configuration</span>
</a>
}
<has-permission entity="AuditPage" required-permission="Read">
<a asp-controller="Admin" asp-action="AuditLog" class="sidebar-link">
<i class="oi oi-book mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_AUDIT_LOG"]</span>
</a>
</has-permission>
@*<has-permission entity="RecentPlayersPage" required-permission="Read">
<a class="sidebar-link profile-action" href="#actionModal" data-action="RecentClients" title="@ViewBag.Localization["WEBFRONT_ACTION_RECENT_CLIENTS"]">
<i class="oi oi-timer mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_ACTION_RECENT_CLIENTS"]</span>
</a>
</has-permission>*@
<a class="sidebar-link profile-action" href="#actionModal" data-action="GenerateLoginToken" title="@ViewBag.Localization["WEBFRONT_ACTION_TOKEN"]">
<i class="oi oi-key mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_ACTION_TOKEN"]</span>
</a>
</has-permission>
@if (ViewBag.Authorized)
{
<a asp-controller="Account" asp-action="Logout" class="sidebar-link">
<i class="oi oi-account-logout mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_LOGOUT"]</span>
</a>
}
<br/>
<!-- version -->
<div class="sidebar-link font-size-12 font-weight-light">
@if (ViewBag.Authorized)
{
<span>Logged in as <color-code value="@ViewBag.User.Name"></color-code></span>
}
else
{
<span>Not logged in</span>
}
</div>
<div class="sidebar-divider mt-0 mb-0"></div>
<a href="https://github.com/RaidMax/IW4M-Admin/releases" class="sidebar-link" target="_blank">
<span class="name font-size-12 font-weight-light">IW4MAdmin <span class="text-primary">@Program.Manager.Version</span></span>
</a>
</div>
</div>
</div>

View File

@ -0,0 +1,19 @@
@{
Layout = null;
}
<form class="action-form" asp-action="Login" asp-controller="Account">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon-clientId">Client ID</span>
</div>
<input type="text" name="clientId" value="" class="form-control" aria-label="clientId" aria-describedby="basic-addon-clientId">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon-Password">Token/Password</span>
</div>
<input type="password" name="Password" value="" class="form-control" aria-label="Password" aria-describedby="basic-addon-Password">
</div>
<button type="submit" class="btn btn-block btn-primary">Login</button>
</form>

View File

@ -0,0 +1,12 @@
<form class="form-inline ml-auto" method="get" asp-controller="Client" asp-action="Find">
<div class="input-group">
<input id="client_search_mobile" name="clientName" class="form-control" type="text" placeholder="@ViewBag.Localization["WEBFRONT_NAV_SEARCH"]" required="required"/>
<div class="input-group-append">
<button class="btn" type="submit">
<i class="oi oi-magnifying-glass"></i>
</button>
</div>
</div>
<br/>
</form>

View File

@ -0,0 +1,44 @@
@model WebfrontCore.ViewModels.SideContextMenuItems
@{ Layout = null; }
<div class="d-none d-lg-flex col-3 col-xl-2">
<div class="content mt-0">
<div class="on-this-page-nav pt-0">
<div class="title">@Model.MenuTitle</div>
@foreach (var item in Model.Items)
{
<a href="@(item.IsLink ? item.Reference : "#actionModal")" class="@(item.IsLink ? "" : "profile-action")" data-action="@(item.IsLink ? "" : item.Reference)">
<div class="@(item.IsButton ? "btn btn-block" : "")" data-title="@item.Tooltip" data-placement="left" data-toggle="@(string.IsNullOrEmpty(item.Tooltip) ? "" : "tooltip")">
<i class="@(string.IsNullOrEmpty(item.Icon) ? "" : $"oi {item.Icon}") mr-5 font-size-12"></i>
<span class="@(item.IsActive ? "text-primary" : "") text-truncate">@item.Title</span>
</div>
</a>
}
</div>
</div>
</div>
<div class="modal" id="contextMenuModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-content">
<div class="content-title">@Model.MenuTitle</div>
<hr/>
@foreach (var item in Model.Items)
{
<div class="mt-15 mb-15">
<a href="@(item.IsLink ? item.Reference : "#actionModal")" class="@(item.IsLink ? "" : "profile-action") no-decoration" data-action="@(item.IsLink ? "" : item.Reference)">
<div class="btn btn-block btn-lg @(item.IsActive ? "btn-primary" : "") text-truncate" data-title="@item.Tooltip" data-toggle="@(string.IsNullOrEmpty(item.Tooltip) ? "" : "tooltip")">
<i class="@(string.IsNullOrEmpty(item.Icon) ? "" : $"oi {item.Icon}") mr-5 font-size-12"></i>
<span>@item.Title</span>
</div>
</a>
</div>
}
<hr/>
<a href="#" class="btn btn-lg btn-danger btn-block mt-15" role="button">Close</a>
</div>
</div>
</div>
</div>