mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 22:10:16 +02:00
Added Signature Tracker
Added a tool to help track various sites and wormholes
This commit is contained in:
parent
ba34e92694
commit
c9e600dfee
@ -58,6 +58,7 @@ INSTALLED_APPS = (
|
||||
'hrapplications',
|
||||
'timerboard',
|
||||
'srp',
|
||||
'sigtracker',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
|
@ -165,4 +165,11 @@ urlpatterns = patterns('',
|
||||
|
||||
# FLEET FITTINGS
|
||||
url(r'^fits/$', 'services.views.fleet_fits', name='auth_fleet_fits'),
|
||||
|
||||
# Sig Tracker
|
||||
url(r'^sigtracker/$', 'sigtracker.views.sigtracker_view', name='auth_signiture_view'),
|
||||
url(r'^add_signiture/$', 'sigtracker.views.add_signiture_view', name='auth_add_signiture_view'),
|
||||
url(r'^remove_signiture/(\w+)', 'sigtracker.views.remove_signiture', name='auth_remove_signiture')
|
||||
|
||||
|
||||
)
|
||||
|
0
sigtracker/__init__.py
Normal file
0
sigtracker/__init__.py
Normal file
6
sigtracker/admin.py
Normal file
6
sigtracker/admin.py
Normal file
@ -0,0 +1,6 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from models import sigtracker
|
||||
|
||||
admin.site.register(sigtracker)
|
||||
# Register your models here.
|
20
sigtracker/form.py
Normal file
20
sigtracker/form.py
Normal file
@ -0,0 +1,20 @@
|
||||
from django import forms
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
|
||||
|
||||
|
||||
class SignitureForm(forms.Form):
|
||||
sigtype = [('Wormhole', 'Wormhole'), ('Combat', 'Combat'), ('Data', 'Data'),
|
||||
('Relic', 'Relic')]
|
||||
status = [('Open', 'Open'), ('Started', 'Started'), ('Finished', 'Finished')]
|
||||
|
||||
system = forms.CharField(max_length=254, required=True, label='System')
|
||||
ident = forms.CharField(max_length=254, required=True, label="ID")
|
||||
sigtype = forms.ChoiceField(choices=sigtype, required=True, label="Signiture Type")
|
||||
destination = forms.CharField(max_length=254, label="destination", required=True, initial="")
|
||||
status = forms.ChoiceField(choices=status, required=True, label="Status")
|
||||
notes = forms.CharField(max_length=254, label="Notes", required=False, initial="")
|
||||
|
||||
|
||||
|
||||
|
18
sigtracker/models.py
Normal file
18
sigtracker/models.py
Normal file
@ -0,0 +1,18 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from eveonline.models import EveCharacter
|
||||
from eveonline.models import EveCorporationInfo
|
||||
|
||||
|
||||
class sigtracker(models.Model):
|
||||
class Meta:
|
||||
ordering = ['sigtype']
|
||||
ident = models.CharField(max_length=254, default="")
|
||||
system = models.CharField(max_length=254, default="")
|
||||
destination = models.CharField(max_length=254, default="")
|
||||
sigtype = models.CharField(max_length=254, default="")
|
||||
status = models.CharField(max_length=254, default="")
|
||||
notes = models.CharField(max_length=254, default="")
|
||||
|
||||
|
1
sigtracker/tests.py
Normal file
1
sigtracker/tests.py
Normal file
@ -0,0 +1 @@
|
||||
# Create your tests here.
|
72
sigtracker/views.py
Normal file
72
sigtracker/views.py
Normal file
@ -0,0 +1,72 @@
|
||||
import datetime
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render_to_response
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.decorators import permission_required
|
||||
from django.contrib.auth.decorators import user_passes_test
|
||||
|
||||
from util import check_if_user_has_permission
|
||||
from authentication.managers import AuthServicesInfoManager
|
||||
from eveonline.managers import EveManager
|
||||
from form import SignitureForm
|
||||
from models import sigtracker
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def sigtracker_util_test(user):
|
||||
return check_if_user_has_permission(user, 'member') or check_if_user_has_permission(user, 'blue_member')
|
||||
|
||||
|
||||
@login_required
|
||||
@user_passes_test(sigtracker_util_test)
|
||||
@permission_required('auth.signiture_view')
|
||||
def sigtracker_view(request):
|
||||
logger.debug("sigtracker_view called by user %s" % request.user)
|
||||
sigtracker_list = sigtracker.objects.all()
|
||||
render_items = {'sigtracker': sigtracker.objects.all()}
|
||||
|
||||
return render_to_response('registered/signituremanagement.html', render_items, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required('auth.signiture_management')
|
||||
def add_signiture_view(request):
|
||||
logger.debug("add_signiture_view called by user %s" % request.user)
|
||||
if request.method == 'POST':
|
||||
form = SignitureForm(request.POST)
|
||||
logger.debug("Request type POST contains form valid: %s" % form.is_valid())
|
||||
if form.is_valid():
|
||||
# handle valid form
|
||||
sig = sigtracker()
|
||||
sig.ident = form.cleaned_data['ident']
|
||||
sig.system = form.cleaned_data['system']
|
||||
sig.destination = form.cleaned_data['destination']
|
||||
sig.sigtype = form.cleaned_data['sigtype']
|
||||
sig.status = form.cleaned_data['status']
|
||||
sig.notes = form.cleaned_data['notes']
|
||||
sig.save()
|
||||
return HttpResponseRedirect("/sigtracker/")
|
||||
else:
|
||||
logger.debug("Returning new SignitureForm")
|
||||
form = SignitureForm()
|
||||
|
||||
render_items = {'form': form}
|
||||
|
||||
return render_to_response('registered/addsigniture.html', render_items, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required('auth.signiture_management')
|
||||
def remove_signiture(request, sigtracker_id):
|
||||
logger.debug("remove_signiture called by user %s for signiture id %s" % (request.user, sigtracker_id))
|
||||
if sigtracker.objects.filter(id=sigtracker_id).exists():
|
||||
sig = sigtracker.objects.get(id=sigtracker_id)
|
||||
sig.delete()
|
||||
logger.debug("Deleting sigtracker id %s by user %s" % (sigtracker_id, request.user))
|
||||
else:
|
||||
logger.error("Unable to delete signiture id %s for user %s - signiture matching id not found." % (sigtracker_id, request.user))
|
||||
return HttpResponseRedirect("/sigtracker/")
|
@ -137,6 +137,16 @@
|
||||
href="{% url 'auth_fleet_fits' %}"><i
|
||||
class="fa fa-bolt fa-fw grayiconecolor"></i> Fleet Doctrines</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if perms.auth.member or perms.auth.blue_member %}
|
||||
<li>
|
||||
<a {% ifequal request.path "/sigtracker" %} class="active" {% endifequal %}
|
||||
href="{% url 'auth_signiture_view' %}"><i
|
||||
class="fa fa-compass fa-fw grayiconecolor"></i> Signiture Tracker</a>
|
||||
</li>
|
||||
|
||||
|
||||
{% if perms.auth.timer_view %}
|
||||
<li>
|
||||
<a {% ifequal request.path "/timer_management" %} class="active" {% endifequal %}
|
||||
|
38
stock/templates/registered/addsigniture.html
Normal file
38
stock/templates/registered/addsigniture.html
Normal file
@ -0,0 +1,38 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% load bootstrap %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block title %}Alliance Auth - Signiture Create{% endblock %}
|
||||
|
||||
{% block page_title %}Create Signiture{% 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 Signiture</h1>
|
||||
|
||||
<div class="container-fluid">
|
||||
<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">Create Signiture</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
{% block extra_script %}
|
||||
|
||||
$('#id_eve_time').datetimepicker({
|
||||
maskInput: true,
|
||||
format: 'Y-m-d H:i',minDate:0
|
||||
});
|
||||
|
||||
{% endblock extra_script %}
|
67
stock/templates/registered/signituremanagement.html
Normal file
67
stock/templates/registered/signituremanagement.html
Normal file
@ -0,0 +1,67 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block title %}Alliance Auth{% endblock %}
|
||||
|
||||
{% block page_title %}Signiture Management{% endblock page_title %}
|
||||
{% block extra_css %}{% endblock extra_css %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header text-center">Signitures
|
||||
<div class="text-right">
|
||||
<a href="{% url 'auth_add_signiture_view' %}">
|
||||
{% if perms.auth.signiture_management %}
|
||||
<button type="button" class="btn btn-success">Create Signiture</button>
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</h1>
|
||||
<table class="table table-responsive table-bordered">
|
||||
<tr>
|
||||
<th class="text-center">ID</th>
|
||||
<th class="text-center">System</th>
|
||||
<th class="text-center">Destination</th>
|
||||
<th class="text-center">Signiture Type</th>
|
||||
<th class="text-center">Status</th>
|
||||
<th class="text-center">Notes</th>
|
||||
{% if perms.auth.signiture_management %}
|
||||
<th class="text-center">Action</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
||||
{% for sigt in sigtracker %}
|
||||
<tr>
|
||||
<td style="width:150px" class="text-center">{{ sigt.ident }}</td>
|
||||
|
||||
<td class="text-center">
|
||||
<a href="http://evemaps.dotlan.net/system/{{ sigt.system }}">{{ sigt.system }}</a>
|
||||
</td>
|
||||
<td style="width:150px" class="text-center">{{ sigt.destination }}</td>
|
||||
<td style="width:150px" class="text-center">{{ sigt.sigtype }}</td>
|
||||
<td style="width:150px" class="text-center">{{ sigt.status }}</td>
|
||||
<td style="width:150px" class="text-center">{{ sigt.notes }}</td>
|
||||
|
||||
|
||||
|
||||
{% if perms.auth.signiture_management %}
|
||||
<td class="text-center">
|
||||
<a href="/remove_signiture/{{ sigt.id }}">
|
||||
<button type="button" class="btn btn-danger"><span
|
||||
class="glyphicon glyphicon-remove"></span></button>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock content %}
|
45
stock/templates/registered/sigtracker.html
Normal file
45
stock/templates/registered/sigtracker.html
Normal file
@ -0,0 +1,45 @@
|
||||
{% extends "public/base.html" %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block title %}Alliance Auth{% endblock %}
|
||||
|
||||
{% block page_title %}Signiture Tracker{% endblock page_title %}
|
||||
{% block extra_css %}{% endblock extra_css %}
|
||||
|
||||
{% block content %}
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body bgcolor="silver">
|
||||
|
||||
|
||||
<div align="center">
|
||||
<form action="form1.php" method="post">
|
||||
<p>System: <input type="text" name="sys"/>
|
||||
Id: <input type="text" name="id" />
|
||||
Type:
|
||||
<select name="type">
|
||||
<option value="Wormhole">Wormhole</option>
|
||||
<option value="Combat">Combat</option>
|
||||
<option value="Data">Data</option>
|
||||
<option value="Relic">Relic</option></select>
|
||||
|
||||
Name: <input type="text" name="name"/>
|
||||
Status:
|
||||
<select name="status">
|
||||
<option value="Open">Open</option>
|
||||
<option value="Started">Stared</option>
|
||||
<option value="Finished">Finished</option>
|
||||
<option value="Other">Other</option>
|
||||
<option value="Hisec">Hisec</option>
|
||||
<option value="LoSec">LoSec</option>
|
||||
<option value="NullSec">NullSec</option></select>
|
||||
Notes: <input type="text" name="notes" />
|
||||
<input type="Submit" name="Submit" value="Submit" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
||||
|
||||
{% endblock content %}
|
@ -22,6 +22,8 @@ def bootstrap_permissions():
|
||||
Permission.objects.get_or_create(codename="timer_management", content_type=ct, name="timer_management")
|
||||
Permission.objects.get_or_create(codename="timer_view", content_type=ct, name="timer_view")
|
||||
Permission.objects.get_or_create(codename="srp_management", content_type=ct, name="srp_management")
|
||||
Permission.objects.get_or_create(codename="signiture_management", content_type=ct, name="signiture_management")
|
||||
Permission.objects.get_or_create(codename="signiture_view", content_type=ct, name="signiture_view")
|
||||
Group.objects.get_or_create(name=settings.DEFAULT_AUTH_GROUP)
|
||||
Group.objects.get_or_create(name=settings.DEFAULT_BLUE_GROUP)
|
||||
logger.info("Bootstrapped permissions for auth and created default groups.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user