Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
Adjust permissions, include super admins.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhlexPlexico committed Aug 23, 2019
1 parent edf749a commit 39fe8c3
Show file tree
Hide file tree
Showing 10 changed files with 547 additions and 103 deletions.
256 changes: 256 additions & 0 deletions get5/match.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
{% from "macros.html" import score_symbol %}

{% extends "layout.html" %}

{% macro ind_team_table(team, map_stats) %}
<h3>{{team.name}}</h3>
<table class="table table-hover" id="dataTable">
<thead>
<tr>
<th>Player</th>
<th class="text-center">Kills</th>
<th class="text-center">Deaths</th>
<th class="text-center">Assists</th>
<th class="text-center">Flash assists</th>
<th class="text-center">1v1</th>
<th class="text-center">1v2</th>
<th class="text-center">1v3</th>
<th class="text-center">Rating</th>
<th class="text-center"><acronym title="Frags per round">FPR</acronym></th>
<th class="text-center"><acronym title="Average damage per round">ADR</acronym></th>
<th class="text-center"><acronym title="Headshot percentage">HSP</acronym></th>
</tr>
</thead>
<tbody>
{% for player in map_stats.player_stats.filter_by(team_id=team.id)|sort(attribute='kills', reverse=True) %}
{% if player.roundsplayed > 0 %}
<tr>
<td> <a href="/stats/{{player.steam_id}}"> {{ player.get_player_name() }} </a></td>
<td class="text-center"> {{ player.kills }} </td>
<td class="text-center"> {{ player.deaths }} </td>
<td class="text-center"> {{ player.assists }} </td>
<td class="text-center"> {{ player.flashbang_assists }} </td>

<td class="text-center"> {{ player.v1 }} </td>
<td class="text-center"> {{ player.v2 }} </td>
<td class="text-center"> {{ player.v3 }} </td>

<td class="text-center"> {{ player.get_rating() | round(2) }} </td>
<td class="text-center"> {{ player.get_fpr() | round(2) }} </td>
<td class="text-center"> {{ player.get_adr() | round(1) }} </td>
<td class="text-center"> {{ player.get_hsp() | round(2) }} </td>
</tr>
{% endif %}
{% endfor %}
</tbody>

</table>
{% endmacro %}


{% block content %}

{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="panel panel-primary">
<div class="panel-heading">Command response</div>

<div class="panel-body">
{% for message in messages %}
<b>{{ message[1] }}</b>
<br>
{% endfor %}
</div>

</div>
<br>
{% endif %}
{% endwith %}

<div id="content">

<div class="container">

<h1>
{{ team1.get_logo_or_flag_html(1.0, team2) }} <a href="/team/{{team1.id}}"> {{team1.name}}</a>
{{ match.team1_score }}
{{ score_symbol(match.team1_score, match.team2_score) }}
{{ match.team2_score }}
{{ team2.get_logo_or_flag_html(1.0, team1) }} <a href="/team/{{team2.id}}"> {{team2.name}}</a>

{% if (admin_access or match_owner or super_admin_access) and (match.live() or match.pending()) %}
<div class="dropdown dropdown-header pull-right">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="true">
Admin tools
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
{% if match.live() %}
<li><a id="pause" href="{{request.path}}/pause">Pause match</a></li>
<li><a id="unpause" href="{{request.path}}/unpause">Unpause match</a></li>
{% endif %}
{% if (super_admin_access or admin_access or server_owner) %}
<li><a id="addplayer_team1" href="#">Add player to team1</a></li>
<li><a id="addplayer_team2" href="#">Add player to team2</a></li>
<li><a id="addplayer_spec" href="#">Add player to specator list</a></li>
{% else %}
<li><a id="addplayer_spec" href="#">Add player to specator list</a></li>
{% endif %}
{% if server_owner or super_admin_access %}
<li><a id="rcon_command" href="#">Send rcon command</a></li>
{% endif %}
<li role="separator" class="divider"></li>
<li><a id="backup_manager" href="{{request.path}}/backup">Load a backup file</a></li>
{% if super_admin_access or admin_access %}
<li><a id="ffteam1" href="{{request.path}}/forfeit/2">Forfeit Team 1</a></li>
<li><a id="ffteam2" href="{{request.path}}/forfeit/1">Forfeit Team 2</a></li>

{% endif %}
<li><a href="{{request.path}}/cancel">Cancel match</a></li>
</ul>
</div>
{% endif %}

</h1>


<br>
{% if match.cancelled %}
<div class="alert alert-danger" role="alert">
<span class="fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
This match has been cancelled.
</div>
{% endif %}

{% if match.forfeit %}
<div class="alert alert-warning" role="alert">
<span class="fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
This match was forfeit by {{match.get_loser().name}}.
</div>
{% endif %}

{% if connect_string is not none and not match.finalized() and not match.live() %}
<div class="alert alert-notice" role="alert">
<span class="fa fa-exclamation-circle" aria-hidden="true"></span>
<b>Please make sure to have CS:GO open before pressing the "Connect" button. There
is a known bug that will say bad password if you do not have CS:GO open! </b>
</div>
<a type="button" class="btn btn-success" href="{{ connect_string }}">Connect</a>

{% endif %}

{% if gotv_string is not none and not match.finalized() and not match.live() %}
<a type="button" class="btn btn-info" href="{{ gotv_string }}">Connect to GoTV</a>
{% endif %}

{% if match.start_time is none %}
<div class="panel panel-default" role="alert">
<div class="panel-body">
This match is pending start.
</div>
</div>
{% endif %}


{% if vetoes.count() > 0 %}
<div class="panel panel-primary">
<div class="panel-heading">Vetoes</div>

<table class="table table-hover" id="dataTable">
<thead>
<tr>
<th>Veto/Pick</th>
<th class="text-center">Map</th>
<th class="text-center">Team Name</th>
</tr>
</thead>
<tbody>

{% for veto in vetoes %}
<tr>
<td> {{ veto.pick_or_veto }} </td>
<td class="text-center"> {{ veto.map }} </td>
<td class="text-center"> {{ veto.team_name }} </td>
</tr>
{% endfor %}

</tbody>

</table>
</div>
{% endif %}
{% for map_stats in map_stat_list %}
<br>
<div class="panel panel-primary">
<div class="panel-heading">
Map {{map_stats.map_number + 1}}: {{ map_stats.map_name }},
{{team1.name}} {{ score_symbol(map_stats.team1_score, map_stats.team2_score) }} {{team2.name}},
{{map_stats.team1_score}}:{{map_stats.team2_score}}
</div>

<div class="panel-body">
{% if map_stats.demoFile is not none and map_stats.demoFile != '' %}
<a type="button" class="btn btn-success" href="{{ map_stats.demoFile }}">Download Demo</a>
{% endif %}
<p>Started at {{ map_stats.start_time.strftime('%Y-%m-%d %H:%M') }}</p>

{% if map_stats.end_time is not none %}
<p>Ended at {{ map_stats.end_time.strftime('%Y-%m-%d %H:%M') }}</p>
{% endif %}

{{ind_team_table(team1, map_stats)}}
{{ind_team_table(team2, map_stats)}}

</div>

</div>
{% endfor %}

</div>


<br>
</div>

<script>
jQuery("#addplayer_team1").click(function (e) {
var input = prompt("Please enter a steamid to add to {{team1.name}}", "");
if (input != null) {
window.location.href = "{{request.path}}/adduser?team=team1&auth=" + encodeURIComponent(input);
}
});

jQuery("#addplayer_team2").click(function (e) {
var input = prompt("Please enter a steamid to add to {{team2.name}}", "");
if (input != null) {
window.location.href = "{{request.path}}/adduser?team=team2&auth=" + encodeURIComponent(input);
}
});

jQuery("#addplayer_spec").click(function (e) {
var input = prompt("Please enter a steamid to add to the spectators list", "");
if (input != null) {
window.location.href = "{{request.path}}/adduser?team=spec&auth=" + encodeURIComponent(input);
}
});

jQuery("#rcon_command").click(function (e) {
var input = prompt("Enter a command to send", "");
if (input != null) {
window.location.href = "{{request.path}}/rcon?command=" + encodeURIComponent(input);
}
});
</script>
<script>
$('table.table').DataTable({
paging: false,
"order": [],
"filter": false,
"bInfo" : false
});
</script>

{% endblock %}
Loading

0 comments on commit 39fe8c3

Please sign in to comment.