Adding "Paplink" feature (#401)

* Initial testing of paplink functionality. More fancy interfaces coming.

* Removed a invalid view reference.

* Added a link on the front page.

* Fixed some bad references and incorrect in game browser header usages.

* Started work on statistics-pages.

* Added an initial modify-paplink page where the pap itself can be deleted and characters removed.

* Added a very simple statistics page. Also some name change for ~reasons~.

* Small but crucial fix of syntax.

* Added personal statistics page.

* Corputils page now include fatlinkstats.

* Added link to the personal statistics page. Moved other buttons for clarity.

* Removed some unused code and imports

* Added more statistics, and all corps in alliance are now visible even if no paps are registered.

* Now requesting trust for the right domain. And some redundant imports and commented lines are removed.
This commit is contained in:
Joakim Strandberg
2016-04-30 01:00:45 +02:00
committed by Mr McClain
parent 1abeba5658
commit b190b8e191
19 changed files with 874 additions and 7 deletions

View File

@@ -176,6 +176,12 @@
</li>
{% endif %}
<li>
<a {% ifequal request.path "/fat/" %} class="active" {% endifequal %}
href="{% url 'auth_fatlink_view' %}"><i
class="fa fa-users fa-lightbulb-o grayiconecolor"></i> Fleet Activity Tracking</a>
</li>
<li>
<a {% ifequal request.path "/srp/" %} class="active" {% endifequal %}
href="{% url 'auth_srp_management_view' %}"><i

View File

@@ -0,0 +1,90 @@
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Fleet participation</title>
<!-- Bootstrap Core CSS -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom Fonts -->
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/sb-admin-2.css' %}" rel="stylesheet">
{% block extra_css %}{% endblock extra_css %}
<style>
.grayiconecolor {
color: #505050;
}
</style>
</head>
<body onload="CCPEVE.requestTrust({{ DOMAIN }})">
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="navbar-header ">
<a class="navbar-brand " href="/dashboard/">
<div class="fa fa-cog fa-spin"></div>
{% if IS_CORP %}
{{ CORP_NAME }}
{% else %}
{{ ALLIANCE_NAME }}
{% endif %}
</a>
</div>
<!-- /.navbar-header -->
<ul class="nav navbar-top-links navbar-right">
{% if user.is_authenticated %}
<li><a href="{% url 'auth_logout_user' %}">Logout</a></li>
{% else %}
<li><a href="{% url 'auth_login_user' %}">Login</a></li>
{% endif %}
</ul>
<!-- /.navbar-static-side -->
</nav>
</div>
<div class="col-lg-12">
<h1 class="page-header text-center">Character not found!</h1>
<div class="col-lg-12 container" id="example">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">{{ character_name }}</div>
<div class="panel-body">
<div class="col-lg-2 col-sm-2">
<img class="ra-avatar img-responsive" src="https://image.eveonline.com/Character/{{ character_id }}_128.jpg">
</div>
<div class="col-lg-10 col-sm-2">
<div class="alert alert-danger" role="alert">Character not registered!</div>
This character is not part of any registered API-key. You must go to <a href=" {% url 'auth_api_key_management' %}">API key management</a> and add an API with the character on before being able to click fleet attendance links.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/jquery.datetimepicker.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
</body>
</html>

View File

@@ -0,0 +1,96 @@
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Fleet participation</title>
<!-- Bootstrap Core CSS -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom Fonts -->
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/sb-admin-2.css' %}" rel="stylesheet">
{% block extra_css %}{% endblock extra_css %}
<style>
.grayiconecolor {
color: #505050;
}
</style>
</head>
<body onload="CCPEVE.requestTrust({{ DOMAIN }})">
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="navbar-header ">
<a class="navbar-brand " href="/dashboard/">
<div class="fa fa-cog fa-spin"></div>
{% if IS_CORP %}
{{ CORP_NAME }}
{% else %}
{{ ALLIANCE_NAME }}
{% endif %}
</a>
</div>
<!-- /.navbar-header -->
<ul class="nav navbar-top-links navbar-right">
{% if user.is_authenticated %}
<li><a href="{% url 'auth_logout_user' %}">Logout</a></li>
{% else %}
<li><a href="{% url 'auth_login_user' %}">Login</a></li>
{% endif %}
</ul>
<!-- /.navbar-static-side -->
</nav>
</div>
<div class="col-lg-12">
{% if registered %}<h1 class="page-header text-center">Fleet registered!</h1> {% elif expired%}<h1 class="page-header text-center">This link has expired.</h1> {% elif errormessages%}<h1 class="page-header text-center">Something unhappened occured.</h1>{% else %}<h1 class="page-header text-center">Invalid link.</h1>{% endif %}
<div class="col-lg-12 container" id="example">
{% for message in errormessages %}
<div class="alert alert-danger" role="alert">{{ message }}</div>
{% endfor %}
{% if trusted %}
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">Fleet stats</div>
<div class="panel-body">
<div class="col-lg-2 col-sm-2">
<img class="ra-avatar img-responsive" src="https://image.eveonline.com/{% if IS_CORP %}Corporation/{{ CORPORATION_ID }}{% else %}Alliance/{{ ALLIANCE_ID }}{% endif %}_128.png">
</div>
<div class="col-lg-7 col-sm-2">
</div>
</div>
</div>
</div>
</div>
{% else %}
<div class="alert alert-danger" role="alert">This page requires trust to operate.</div>
{% endif %}
</div>
</div>
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/jquery.datetimepicker.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
</body>
</html>

View File

@@ -57,6 +57,23 @@
</ul>
</li>
{% endif %}
<li style="float: right">
<p class="navbar-form">
Statistics for:
<a href="{% url 'auth_corputils_month' corp.corporation_id previous_month|date:"Y" previous_month|date:"m" %}">
<i class="fa fa-arrow-circle-left fa-fw grayiconecolor"></i>
</a>
{{ this_month|date:"M" }}, {{ this_month|date:"Y" }}
{% if next_month %}
<a href="{% url 'auth_corputils_month' corp.corporation_id next_month|date:"Y" next_month|date:"m" %}" >
<i class="fa fa-arrow-circle-right fa-fw grayiconecolor"></i>
</a>
<a href="{% url 'auth_corputils' %}" >
<i class="fa fa-angle-double-right fa-fw grayiconecolor"></i>
</a>
{% endif %}
</p>
</li>
<li style="float: right">
<p class="navbar-btn">
<a href="https://zkillboard.com/corporation/{{ corp.corporation_id }}/" class="btn btn-default" target="_blank">{{ corp.corporation_name }} Killboard</a>
@@ -89,6 +106,7 @@
<th class="col-md-2">Main character</th>
<th class="col-md-2">Main corporation</th>
<th class="col-md-2">Character list</th>
<th class="col-md-1">Fats</th>
<th class="col-md-3">Killboard</th>
<th class="col-md-2">API JackKnife</th>
</tr>
@@ -116,6 +134,9 @@
<p>{{ char.character_name }}</p>
{% endfor %}
</td>
<td>
{{ player.n_fats }}
</td>
<td>
{% for char in player.altlist %}
<p><a href="https://zkillboard.com/character/{{ char.character_id }}/" class="label label-danger" target="_blank">Killboard</a></p>

View File

@@ -0,0 +1,36 @@
{% extends "public/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% block title %}Alliance Auth - Fatlink Create{% endblock %}
{% block page_title %}Create Fatlink{% endblock page_title %}
{% block extra_css %}
<link href="{% static 'css/jquery.datetimepicker.css' %}" rel="stylesheet" type="text/css">{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">Create Fleet Operation</h1>
<div class="container-fluid">
{% if badrequest %}
<div class="alert alert-danger" role="alert">Bad request!</div>
{% endif %}
{% for message in errormessages %}
<div class="alert alert-danger" role="alert">{{ message }}</div>
{% endfor %}
<div class="col-md-4 col-md-offset-4">
<div class="row">
<form class="form-signin" role="form" action="" method="POST">
{% csrf_token %}
{{ form|bootstrap }}
<br/>
<button class="btn btn-lg btn-primary btn-block" type="submit" name="submit_fat">Create fatlink</button>
</form>
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@@ -0,0 +1,54 @@
{% extends "public/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% block title %}Alliance Auth{% endblock %}
{% block page_title %}Fatlink view{% endblock page_title %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">Edit fatlink "{{ fatlink.name }}"
<div class="text-right">
<form>
<button type="submit" onclick="return confirm('Are you sure?')" class="btn btn-danger" name="deletefat" value="True">
Delete fat
</button>
</form>
</div>
</h1>
<h4><b>Registered characters</b></h4>
<table class="table table-responsive table-bordered">
<tr>
<th class="text-center">User</th>
<th class="text-center">Character</th>
<th class="text-center">System</th>
<th class="text-center">Ship</th>
<th class="text-center">Eve Time</th>
<th></th>
</tr>
{% for fat in registered_fats %}
<tr>
<td class="text-center">{{ fat.user }}</td>
<td class="text-center">{{ fat.character.character_name }}</td>
{% if fat.station != "None" %}
<td class="text-center">Docked in {{ fat.system }}</td>
{% else %}
<td class="text-center">{{ fat.system }}</td>
{% endif %}
<td class="text-center">{{ fat.shiptype }}</td>
<td class="text-center">{{ fat.fatlink.fatdatetime }}</td>
<td class="text-center">
<form>
<button type="submit" class="btn btn-warning" name="removechar" value="{{ fat.character.character_id }}"><span
class="glyphicon glyphicon-remove"></span></button>
</form>
</td>
</tr>
{% endfor %}
</table>
</div>
<script src="/static/js/dateformat.js"></script>
{% endblock content %}

View File

@@ -0,0 +1,39 @@
{% extends "public/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% block title %}Alliance Auth{% endblock %}
{% block page_title %}Personal fatlink statistics{% endblock page_title %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">Participation data statistics for {{ year }}
<div class="text-right">
<a href="{% url 'auth_fatlink_view_personal_statistics' previous_year %}">
<button type="button" class="btn btn-info">Previous year</button>
</a>
{% if next_year %}
<a href="{% url 'auth_fatlink_view_personal_statistics' next_year %}">
<button type="button" class="btn btn-info">Next year</button>
</a>
{% endif %}
</div>
</h1>
<table class="table table-responsive table-bordered">
<tr>
<th class="col-md-2 text-center">Month</th>
<th class="col-md-2 text-center">Fats</th>
</tr>
{% for month, n_fats in monthlystats.items %}
<tr>
<td class="text-center">{{ month }}</td>
<td class="text-center">{{ n_fats }}</td>
</tr>
{% endfor %}
</table>
</div>
<script src="/static/js/dateformat.js"></script>
{% endblock content %}

View File

@@ -0,0 +1,49 @@
{% extends "public/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% block title %}Alliance Auth{% endblock %}
{% block page_title %}Fatlink statistics{% endblock page_title %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">Participation data statistics for {{ month }}, {{ year }}
<div class="text-right">
<a href="{% url 'auth_fatlink_view_statistics_month' previous_month|date:"Y" previous_month|date:"m" %}">
<button type="button" class="btn btn-info">Previous month</button>
</a>
{% if next_month %}
<a href="{% url 'auth_fatlink_view_statistics_month' next_month|date:"Y" next_month|date:"m" %}">
<button type="button" class="btn btn-info">Next month</button>
</a>
{% endif %}
</div>
</h1>
<table class="table table-responsive table-bordered">
<tr>
<th class="col-md-1"></th>
<th class="col-md-2 text-center">Ticker</th>
<th class="col-md-5 text-center">Corp</th>
<th class="col-md-2 text-center">Members</th>
<th class="col-md-2 text-center">Fats</th>
<th class="col-md-2 text-center">Average fats</th>
</tr>
{% for corpStat in fatStats %}
<tr>
<td>
<img src="https://image.eveonline.com/Corporation/{{ corpStat.corp.corporation_id }}_32.png" class="ra-avatar img-responsive">
</td>
<td class="text-center">[{{ corpStat.corp.corporation_ticker }}]</td>
<td class="text-center">{{ corpStat.corp.corporation_name }}</td>
<td class="text-center">{{ corpStat.corp.member_count }}</td>
<td class="text-center">{{ corpStat.n_fats }}</td>
<td class="text-center">{{ corpStat.avg_fat }}</td>
</tr>
{% endfor %}
</table>
</div>
<script src="/static/js/dateformat.js"></script>
{% endblock content %}

View File

@@ -0,0 +1,98 @@
{% extends "public/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% block title %}Alliance Auth{% endblock %}
{% block page_title %}Fatlink view{% endblock page_title %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">Participation data</h1>
<table class="table">
<tr>
<th class="col-md-11">
<h4><b>Most recent clicked fatlinks</b>
</h4>
</th>
<th class="col-md-1">
<a href="{% url 'auth_fatlink_view_statistics' %}">
<button type="button" class="btn btn-info">Personal statistics</button>
</a>
</th>
</tr>
</table>
<table class="table table-responsive table-bordered">
<tr>
<th class="text-center">fatname</th>
<th class="text-center">Character</th>
<th class="text-center">System</th>
<th class="text-center">Ship</th>
<th class="text-center">Eve Time</th>
</tr>
{% for fat in fats %}
<tr>
<td class="text-center">{{ fat.fatlink.name }}</td>
<td class="text-center">{{ fat.character.character_name }}</td>
{% if fat.station != "None" %}
<td class="text-center">Docked in {{ fat.system }}</td>
{% else %}
<td class="text-center">{{ fat.system }}</td>
{% endif %}
<td class="text-center">{{ fat.shiptype }}</td>
<td class="text-center">{{ fat.fatlink.fatdatetime }}</td>
</tr>
{% endfor %}
</table>
{% if perms.auth.fleetactivitytracking%}
<table class="table">
<tr>
<th class="col-md-10">
<h4><b>Most recent fatlinks</b>
</h4>
</th>
<th class="col-md-1">
<a href="{% url 'auth_fatlink_view_statistics' %}">
<button type="button" class="btn btn-info">View statistics</button>
</a>
</th>
<th class="col-md-1">
<a href="{% url 'auth_create_fatlink_view' %}">
<button type="button" class="btn btn-success">Create fatlink</button>
</a>
</th>
</tr>
</table>
<table class="table table-bordered">
<tr>
<th class="text-center">Name</th>
<th class="text-center">Creator</th>
<th class="text-center">Fleet</th>
<th class="text-center">Eve Time</th>
<th class="text-center">Duration</th>
<th class="text-center">Edit</th>
</tr>
{% for link in fatlinks %}
<tr>
<td class="text-center"><a href="{% url 'auth_click_fatlink_view' %}{{ link.hash }}/{{ link.name }}">{{ link.name }}</a></td>
<td class="text-center">{{ link.creator.username }}</td>
<td class="text-center">{{ link.fleet }}</td>
<td class="text-center">{{ link.fatdatetime }}</td>
<td class="text-center">{{ link.duration }}</td>
<td class="text-center">
<a href="{% url 'auth_modify_fatlink_view' %}{{ link.hash }}/{{ link.name }}">
<button type="button" class="btn btn-info"><span
class="glyphicon glyphicon-edit"></span></button>
</a>
</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
<script src="/static/js/dateformat.js"></script>
{% endblock content %}