mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
commit
45e1adf3b3
11
.idea/allianceauth.iml
generated
11
.idea/allianceauth.iml
generated
@ -6,21 +6,16 @@
|
|||||||
<option name="rootFolder" value="$MODULE_DIR$" />
|
<option name="rootFolder" value="$MODULE_DIR$" />
|
||||||
<option name="settingsModule" value="settings.py" />
|
<option name="settingsModule" value="settings.py" />
|
||||||
<option name="manageScript" value="manage.py" />
|
<option name="manageScript" value="manage.py" />
|
||||||
|
<option name="environment" value="<map/>" />
|
||||||
</configuration>
|
</configuration>
|
||||||
</facet>
|
</facet>
|
||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="jdk" jdkName="Python 2.7.6 (/usr/bin/python2.7)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TemplatesService">
|
<component name="TemplatesService">
|
||||||
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||||
<option name="TEMPLATE_FOLDERS">
|
|
||||||
<list>
|
|
||||||
<option value="$MODULE_DIR$/templates" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -66,6 +66,7 @@ Special Permissions In Admin:
|
|||||||
auth | user | jabber_broadcast_all ( Can choose from all groups and the 'all' option when broadcasting)
|
auth | user | jabber_broadcast_all ( Can choose from all groups and the 'all' option when broadcasting)
|
||||||
auth | user | blue_member ( Auto Added to people who register has a blue when adding api key)
|
auth | user | blue_member ( Auto Added to people who register has a blue when adding api key)
|
||||||
auth | user | corp_stats ( View basic corp auth stats *who is authed etc*)
|
auth | user | corp_stats ( View basic corp auth stats *who is authed etc*)
|
||||||
|
auth | user | corputils ( View who has registered APIs, which alts belong to which main, and more. )
|
||||||
auth | user | timer_management ( Access to create and remove timers)
|
auth | user | timer_management ( Access to create and remove timers)
|
||||||
auth | user | timer_view ( Access to timerboard to view timers)
|
auth | user | timer_view ( Access to timerboard to view timers)
|
||||||
auth | user | srp_management ( Allows for an individual to create and remove srp fleets and fleet data)
|
auth | user | srp_management ( Allows for an individual to create and remove srp fleets and fleet data)
|
||||||
|
@ -60,6 +60,7 @@ INSTALLED_APPS = (
|
|||||||
'srp',
|
'srp',
|
||||||
'sigtracker',
|
'sigtracker',
|
||||||
'optimer',
|
'optimer',
|
||||||
|
'corputils',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
@ -448,6 +449,10 @@ LOGGING = {
|
|||||||
'handlers': ['log_file', 'console'],
|
'handlers': ['log_file', 'console'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
},
|
},
|
||||||
|
'corputils': {
|
||||||
|
'handlers': ['log_file', 'console'],
|
||||||
|
'level': 'DEBUG',
|
||||||
|
},
|
||||||
'util': {
|
'util': {
|
||||||
'handlers': ['log_file', 'console'],
|
'handlers': ['log_file', 'console'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
|
@ -162,18 +162,24 @@ urlpatterns = patterns('',
|
|||||||
url(r'srp_request_reject/(\w+)', 'srp.views.srp_request_reject', name='auth_srp_request_reject'),
|
url(r'srp_request_reject/(\w+)', 'srp.views.srp_request_reject', name='auth_srp_request_reject'),
|
||||||
url(r'srp_request_amount_update/(\w+)', 'srp.views.srp_request_update_amount_view',
|
url(r'srp_request_amount_update/(\w+)', 'srp.views.srp_request_update_amount_view',
|
||||||
name="auth_srp_request_update_amount_view"),
|
name="auth_srp_request_update_amount_view"),
|
||||||
|
|
||||||
# FLEET FITTINGS
|
|
||||||
url(r'^fits/$', 'services.views.fleet_fits', name='auth_fleet_fits'),
|
|
||||||
|
|
||||||
# Sig Tracker
|
#corputils
|
||||||
url(r'^sigtracker/$', 'sigtracker.views.sigtracker_view', name='auth_signature_view'),
|
url(r'^corputils/$', 'corputils.views.corp_member_view', name='auth_corp_member_view'),
|
||||||
url(r'^add_signature/$', 'sigtracker.views.add_signature_view', name='auth_add_signature_view'),
|
url(r'^corputils/(?P<corpid>[0-9]+)/$', 'corputils.views.corp_member_view'),
|
||||||
url(r'^remove_signature/(\w+)', 'sigtracker.views.remove_signature', name='auth_remove_signature'),
|
url(r'^corputils/search/$', 'corputils.views.corputils_search', name="auth_corputils_search"),
|
||||||
|
url(r'^corputils/search/(?P<corpid>[0-9]+)/$', 'corputils.views.corputils_search'),
|
||||||
|
|
||||||
|
# FLEET FITTINGS
|
||||||
|
url(r'^fits/$', 'services.views.fleet_fits', name='auth_fleet_fits'),
|
||||||
|
|
||||||
|
# Sig Tracker
|
||||||
|
url(r'^sigtracker/$', 'sigtracker.views.sigtracker_view', name='auth_signature_view'),
|
||||||
|
url(r'^add_signature/$', 'sigtracker.views.add_signature_view', name='auth_add_signature_view'),
|
||||||
|
url(r'^remove_signature/(\w+)', 'sigtracker.views.remove_signature', name='auth_remove_signature'),
|
||||||
|
|
||||||
# Fleet Operations Timers
|
# Fleet Operations Timers
|
||||||
url(r'^optimer/$', 'optimer.views.optimer_view', name='auth_optimer_view'),
|
url(r'^optimer/$', 'optimer.views.optimer_view', name='auth_optimer_view'),
|
||||||
url(r'^add_optimer/$', 'optimer.views.add_optimer_view', name='auth_add_optimer_view'),
|
url(r'^add_optimer/$', 'optimer.views.add_optimer_view', name='auth_add_optimer_view'),
|
||||||
url(r'^remove_optimer/(\w+)', 'optimer.views.remove_optimer', name='auth_remove_optimer'),
|
url(r'^remove_optimer/(\w+)', 'optimer.views.remove_optimer', name='auth_remove_optimer'),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
0
corputils/__init__.py
Normal file
0
corputils/__init__.py
Normal file
0
corputils/admin.py
Normal file
0
corputils/admin.py
Normal file
8
corputils/forms.py
Normal file
8
corputils/forms.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from django import forms
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
from eveonline.models import EveCorporationInfo
|
||||||
|
from eveonline.models import EveAllianceInfo
|
||||||
|
|
||||||
|
class CorputilsSearchForm(forms.Form):
|
||||||
|
search_string = forms.CharField(max_length=254, required=True, label="", widget=forms.TextInput(attrs={'placeholder': 'Search characters...'}))
|
0
corputils/models.py
Normal file
0
corputils/models.py
Normal file
0
corputils/tests.py
Normal file
0
corputils/tests.py
Normal file
158
corputils/views.py
Normal file
158
corputils/views.py
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
from django.shortcuts import render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.contrib.auth.decorators import permission_required
|
||||||
|
from django.shortcuts import HttpResponseRedirect
|
||||||
|
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from authentication.managers import AuthServicesInfoManager
|
||||||
|
from services.managers.eve_api_manager import EveApiManager
|
||||||
|
from services.managers.evewho_manager import EveWhoManager
|
||||||
|
from eveonline.models import EveCorporationInfo
|
||||||
|
from eveonline.models import EveAllianceInfo
|
||||||
|
from eveonline.models import EveCharacter
|
||||||
|
from authentication.models import AuthServicesInfo
|
||||||
|
from forms import CorputilsSearchForm
|
||||||
|
from evelink.api import APIError
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
# Because corp-api only exist for the executor corp, this function will only be available in corporation mode.
|
||||||
|
@login_required
|
||||||
|
@permission_required('auth.corputils')
|
||||||
|
def corp_member_view(request, corpid = None):
|
||||||
|
logger.debug("corp_member_view called by user %s" % request.user)
|
||||||
|
|
||||||
|
if not settings.IS_CORP:
|
||||||
|
alliance = EveAllianceInfo.objects.get(alliance_id=settings.ALLIANCE_ID)
|
||||||
|
alliancecorps = EveCorporationInfo.objects.filter(alliance=alliance)
|
||||||
|
membercorp_list = [(int(membercorp.corporation_id), str(membercorp.corporation_name)) for membercorp in alliancecorps]
|
||||||
|
membercorp_list.sort(key=lambda tup: tup[1])
|
||||||
|
|
||||||
|
if not corpid:
|
||||||
|
if(settings.CORP_ID):
|
||||||
|
corpid = settings.CORP_ID
|
||||||
|
else:
|
||||||
|
corpid = membercorp_list[0][0]
|
||||||
|
|
||||||
|
|
||||||
|
corp = EveCorporationInfo.objects.get(corporation_id=corpid)
|
||||||
|
Player = namedtuple("Player", ["main", "maincorp", "maincorpid", "altlist"])
|
||||||
|
|
||||||
|
if settings.IS_CORP:
|
||||||
|
try:
|
||||||
|
member_list = EveApiManager.get_corp_membertracking(settings.CORP_API_ID, settings.CORP_API_VCODE)
|
||||||
|
except APIError:
|
||||||
|
logger.debug("Corp API does not have membertracking scope, using EveWho data instead.")
|
||||||
|
member_list = EveWhoManager.get_corporation_members(corpid)
|
||||||
|
else:
|
||||||
|
member_list = EveWhoManager.get_corporation_members(corpid)
|
||||||
|
|
||||||
|
characters_with_api = {}
|
||||||
|
characters_without_api = {}
|
||||||
|
|
||||||
|
for char_id, member_data in member_list.items():
|
||||||
|
try:
|
||||||
|
char = EveCharacter.objects.get(character_id=char_id)
|
||||||
|
user = char.user
|
||||||
|
try:
|
||||||
|
mainid = int(AuthServicesInfoManager.get_auth_service_info(user=user).main_char_id)
|
||||||
|
mainchar = EveCharacter.objects.get(character_id=mainid)
|
||||||
|
mainname = mainchar.character_name
|
||||||
|
maincorp = mainchar.corporation_name
|
||||||
|
maincorpid = mainchar.corporation_id
|
||||||
|
except (ValueError, EveCharacter.DoesNotExist):
|
||||||
|
mainname = "User: " + user.username
|
||||||
|
mainchar = char
|
||||||
|
maincorp = "Not set."
|
||||||
|
maincorpid = None
|
||||||
|
characters_with_api.setdefault(mainname, Player(main=mainchar,
|
||||||
|
maincorp=maincorp,
|
||||||
|
maincorpid=maincorpid,
|
||||||
|
altlist=[])
|
||||||
|
).altlist.append(char)
|
||||||
|
|
||||||
|
except EveCharacter.DoesNotExist:
|
||||||
|
characters_without_api.update({member_data["name"]: member_data["id"]})
|
||||||
|
|
||||||
|
|
||||||
|
if not settings.IS_CORP:
|
||||||
|
context = {"membercorp_list": membercorp_list,
|
||||||
|
"corp": corp,
|
||||||
|
"characters_with_api": sorted(characters_with_api.items()),
|
||||||
|
"characters_without_api": sorted(characters_without_api.items()),
|
||||||
|
"search_form": CorputilsSearchForm()}
|
||||||
|
else:
|
||||||
|
logger.debug("corp_member_view running in corportation mode")
|
||||||
|
context = {"corp": corp,
|
||||||
|
"characters_with_api": sorted(characters_with_api.items()),
|
||||||
|
"characters_without_api": sorted(characters_without_api.items()),
|
||||||
|
"search_form": CorputilsSearchForm()}
|
||||||
|
|
||||||
|
|
||||||
|
return render_to_response('registered/corputils.html',context, context_instance=RequestContext(request) )
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@permission_required('auth.corputils')
|
||||||
|
def corputils_search(request, corpid=settings.CORP_ID):
|
||||||
|
logger.debug("corputils_search called by user %s" % request.user)
|
||||||
|
|
||||||
|
corp = EveCorporationInfo.objects.get(corporation_id=corpid)
|
||||||
|
|
||||||
|
if request.method == 'POST':
|
||||||
|
form = CorputilsSearchForm(request.POST)
|
||||||
|
logger.debug("Request type POST contains form valid: %s" % form.is_valid())
|
||||||
|
if form.is_valid():
|
||||||
|
# Really dumb search and only checks character name
|
||||||
|
# This can be improved but it does the job for now
|
||||||
|
searchstring = form.cleaned_data['search_string']
|
||||||
|
logger.debug("Searching for player with character name %s for user %s" % (searchstring, request.user))
|
||||||
|
|
||||||
|
if settings.IS_CORP:
|
||||||
|
try:
|
||||||
|
member_list = EveApiManager.get_corp_membertracking(settings.CORP_API_ID, settings.CORP_API_VCODE)
|
||||||
|
except APIError:
|
||||||
|
logger.debug("Corp API does not have membertracking scope, using EveWho data instead.")
|
||||||
|
member_list = EveWhoManager.get_corporation_members(corpid)
|
||||||
|
else:
|
||||||
|
member_list = EveWhoManager.get_corporation_members(corpid)
|
||||||
|
|
||||||
|
Member = namedtuple('Member', ['name', 'main', 'api_registered'])
|
||||||
|
|
||||||
|
members = []
|
||||||
|
for memberid, member_data in member_list.items():
|
||||||
|
if searchstring.lower() in member_data["name"].lower():
|
||||||
|
try:
|
||||||
|
char = EveCharacter.objects.get(character_name=member_data["name"])
|
||||||
|
user = char.user
|
||||||
|
mainid = int(AuthServicesInfoManager.get_auth_service_info(user=user).main_char_id)
|
||||||
|
mainname = EveCharacter.objects.get(character_id=mainid).character_name
|
||||||
|
api_registered = True
|
||||||
|
except EveCharacter.DoesNotExist:
|
||||||
|
api_registered = False
|
||||||
|
mainname = ""
|
||||||
|
members.append(Member(name=member_data["name"], main=mainname, api_registered=api_registered))
|
||||||
|
|
||||||
|
|
||||||
|
logger.info("Found %s members for user %s matching search string %s" % (len(members), request.user, searchstring))
|
||||||
|
|
||||||
|
context = {'corp': corp, 'members': members, 'search_form': CorputilsSearchForm()}
|
||||||
|
|
||||||
|
return render_to_response('registered/corputilssearchview.html',
|
||||||
|
context, context_instance=RequestContext(request))
|
||||||
|
else:
|
||||||
|
logger.debug("Form invalid - returning for user %s to retry." % request.user)
|
||||||
|
context = {'corp': corp, 'members': None, 'search_form': CorputilsSearchForm()}
|
||||||
|
return render_to_response('registered/corputilssearchview.html',
|
||||||
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
else:
|
||||||
|
logger.debug("Returning empty search form for user %s" % request.user)
|
||||||
|
return HttpResponseRedirect("/corputils/")
|
||||||
|
|
@ -27,6 +27,7 @@ import logging
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def disable_member(user, char_id):
|
def disable_member(user, char_id):
|
||||||
logger.debug("Disabling user %s with character id %s" % (user, char_id))
|
logger.debug("Disabling user %s with character id %s" % (user, char_id))
|
||||||
remove_member_permission(user, 'member')
|
remove_member_permission(user, 'member')
|
||||||
|
@ -22,236 +22,236 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def hr_application_management_view(request):
|
def hr_application_management_view(request):
|
||||||
logger.debug("hr_application_management_view called by user %s" % request.user)
|
logger.debug("hr_application_management_view called by user %s" % request.user)
|
||||||
personal_app = None
|
personal_app = None
|
||||||
corp_applications = None
|
corp_applications = None
|
||||||
|
|
||||||
if request.user.is_superuser:
|
if request.user.is_superuser:
|
||||||
logger.debug("User %s is superuser: returning all applications." % request.user)
|
logger.debug("User %s is superuser: returning all applications." % request.user)
|
||||||
corp_applications = HRApplication.objects.all()
|
corp_applications = HRApplication.objects.all()
|
||||||
else:
|
else:
|
||||||
# Get the corp the member is in
|
# Get the corp the member is in
|
||||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||||
if auth_info.main_char_id != "":
|
if auth_info.main_char_id != "":
|
||||||
try:
|
try:
|
||||||
main_corp_id = EveManager.get_charater_corporation_id_by_id(auth_info.main_char_id)
|
main_corp_id = EveManager.get_charater_corporation_id_by_id(auth_info.main_char_id)
|
||||||
main_alliance_id = EveManager.get_charater_alliance_id_by_id(auth_info.main_char_id)
|
main_alliance_id = EveManager.get_charater_alliance_id_by_id(auth_info.main_char_id)
|
||||||
if (settings.IS_CORP and main_corp_id == settings.CORP_ID) or (not settings.IS_CORP and main_alliance_id == settings.ALLIANCE_ID):
|
if (settings.IS_CORP and main_corp_id == settings.CORP_ID) or (not settings.IS_CORP and main_alliance_id == settings.ALLIANCE_ID):
|
||||||
main_char = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
main_char = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
||||||
if EveCorporationInfo.objects.filter(corporation_id=main_char.corporation_id).exists():
|
if EveCorporationInfo.objects.filter(corporation_id=main_char.corporation_id).exists():
|
||||||
corp = EveCorporationInfo.objects.get(corporation_id=main_char.corporation_id)
|
corp = EveCorporationInfo.objects.get(corporation_id=main_char.corporation_id)
|
||||||
corp_applications = HRApplication.objects.filter(corp=corp).filter(approved_denied=None)
|
corp_applications = HRApplication.objects.filter(corp=corp).filter(approved_denied=None)
|
||||||
else:
|
else:
|
||||||
corp_applications = None
|
corp_applications = None
|
||||||
else:
|
else:
|
||||||
corp_applications = None
|
corp_applications = None
|
||||||
except:
|
except:
|
||||||
logger.error("Unable to determine user %s main character id %s corp. Returning no corp hrapplications." % (request.user, auth_info.main_char_id))
|
logger.error("Unable to determine user %s main character id %s corp. Returning no corp hrapplications." % (request.user, auth_info.main_char_id))
|
||||||
corp_applications = None
|
corp_applications = None
|
||||||
context = {'personal_apps': HRApplication.objects.all().filter(user=request.user),
|
context = {'personal_apps': HRApplication.objects.all().filter(user=request.user),
|
||||||
'applications': corp_applications,
|
'applications': corp_applications,
|
||||||
'search_form': HRApplicationSearchForm()}
|
'search_form': HRApplicationSearchForm()}
|
||||||
|
|
||||||
return render_to_response('registered/hrapplicationmanagement.html',
|
return render_to_response('registered/hrapplicationmanagement.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def hr_application_create_view(request):
|
def hr_application_create_view(request):
|
||||||
logger.debug("hr_application_create_view called by user %s" % request.user)
|
logger.debug("hr_application_create_view called by user %s" % request.user)
|
||||||
success = False
|
success = False
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = HRApplicationForm(request.POST)
|
form = HRApplicationForm(request.POST)
|
||||||
logger.debug("Request type POST with form valid: %s" % form.is_valid())
|
logger.debug("Request type POST with form valid: %s" % form.is_valid())
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
application = HRApplication()
|
application = HRApplication()
|
||||||
application.user = request.user
|
application.user = request.user
|
||||||
application.character_name = form.cleaned_data['character_name']
|
application.character_name = form.cleaned_data['character_name']
|
||||||
application.full_api_id = form.cleaned_data['full_api_id']
|
application.full_api_id = form.cleaned_data['full_api_id']
|
||||||
application.full_api_key = form.cleaned_data['full_api_key']
|
application.full_api_key = form.cleaned_data['full_api_key']
|
||||||
application.corp = EveCorporationInfo.objects.get(corporation_id=form.cleaned_data['corp'])
|
application.corp = EveCorporationInfo.objects.get(corporation_id=form.cleaned_data['corp'])
|
||||||
application.is_a_spi = form.cleaned_data['is_a_spi']
|
application.is_a_spi = form.cleaned_data['is_a_spi']
|
||||||
application.about = form.cleaned_data['about']
|
application.about = form.cleaned_data['about']
|
||||||
application.extra = form.cleaned_data['extra']
|
application.extra = form.cleaned_data['extra']
|
||||||
application.save()
|
application.save()
|
||||||
success = True
|
success = True
|
||||||
logger.info("Created HRApplication for user %s to corp %s" % (request.user, application.corp))
|
logger.info("Created HRApplication for user %s to corp %s" % (request.user, application.corp))
|
||||||
else:
|
else:
|
||||||
logger.debug("Providing empty form.")
|
logger.debug("Providing empty form.")
|
||||||
form = HRApplicationForm()
|
form = HRApplicationForm()
|
||||||
|
|
||||||
context = {'form': form, 'success': success}
|
context = {'form': form, 'success': success}
|
||||||
return render_to_response('registered/hrcreateapplication.html',
|
return render_to_response('registered/hrcreateapplication.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def hr_application_personal_view(request, app_id):
|
def hr_application_personal_view(request, app_id):
|
||||||
logger.debug("hr_application_personal_view called by user %s for app id %s" % (request.user, app_id))
|
logger.debug("hr_application_personal_view called by user %s for app id %s" % (request.user, app_id))
|
||||||
if HRApplication.objects.filter(id=app_id).exists():
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
application = HRApplication.objects.get(id=app_id)
|
application = HRApplication.objects.get(id=app_id)
|
||||||
logger.debug("Got application id %s: %s" % (app_id, application))
|
logger.debug("Got application id %s: %s" % (app_id, application))
|
||||||
if application.user != request.user:
|
if application.user != request.user:
|
||||||
logger.warn("HRApplication id %s user %s does not match request user %s - returning blank application." % (app_id, application.user, request.user))
|
logger.warn("HRApplication id %s user %s does not match request user %s - returning blank application." % (app_id, application.user, request.user))
|
||||||
application = HRApplication()
|
application = HRApplication()
|
||||||
else:
|
else:
|
||||||
logger.error("Unable to locate HRApplication matching id %s - returning blank application to user %s" % (app_id, request.user))
|
logger.error("Unable to locate HRApplication matching id %s - returning blank application to user %s" % (app_id, request.user))
|
||||||
application = HRApplication()
|
application = HRApplication()
|
||||||
context = {'application': application}
|
context = {'application': application}
|
||||||
|
|
||||||
return render_to_response('registered/hrapplicationview.html',
|
return render_to_response('registered/hrapplicationview.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def hr_application_personal_removal(request, app_id):
|
def hr_application_personal_removal(request, app_id):
|
||||||
logger.debug("hr_application_personal_removal called by user %s for app id %s" % (request.user, app_id))
|
logger.debug("hr_application_personal_removal called by user %s for app id %s" % (request.user, app_id))
|
||||||
if HRApplication.objects.filter(id=app_id).exists():
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
application = HRApplication.objects.get(id=app_id)
|
application = HRApplication.objects.get(id=app_id)
|
||||||
if application.user == request.user:
|
if application.user == request.user:
|
||||||
application.delete()
|
application.delete()
|
||||||
logger.info("Deleted HRApplication with id %s for user %s to corp %s" % (app_id, request.user, application.corp))
|
logger.info("Deleted HRApplication with id %s for user %s to corp %s" % (app_id, request.user, application.corp))
|
||||||
else:
|
else:
|
||||||
logger.error("HRapplication id %s user %s does not match request user %s - refusing to delete." % (app_id, application.user, request.user))
|
logger.error("HRapplication id %s user %s does not match request user %s - refusing to delete." % (app_id, application.user, request.user))
|
||||||
return HttpResponseRedirect("/hr_application_management/")
|
return HttpResponseRedirect("/hr_application_management/")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('auth.human_resources')
|
@permission_required('auth.human_resources')
|
||||||
def hr_application_view(request, app_id):
|
def hr_application_view(request, app_id):
|
||||||
logger.debug("hr_application_view called by user %s for app id %s" % (request.user, app_id))
|
logger.debug("hr_application_view called by user %s for app id %s" % (request.user, app_id))
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = HRApplicationCommentForm(request.POST)
|
form = HRApplicationCommentForm(request.POST)
|
||||||
logger.debug("Request type POST contains form valid: %s" % form.is_valid())
|
logger.debug("Request type POST contains form valid: %s" % form.is_valid())
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||||
|
|
||||||
comment = HRApplicationComment()
|
comment = HRApplicationComment()
|
||||||
comment.application = HRApplication.objects.get(id=int(form.cleaned_data['app_id']))
|
comment.application = HRApplication.objects.get(id=int(form.cleaned_data['app_id']))
|
||||||
comment.commenter_user = request.user
|
comment.commenter_user = request.user
|
||||||
comment.commenter_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
comment.commenter_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
||||||
comment.comment = form.cleaned_data['comment']
|
comment.comment = form.cleaned_data['comment']
|
||||||
comment.save()
|
comment.save()
|
||||||
logger.info("Saved comment by user %s to hrapplication %s" % (request.user, comment.application))
|
logger.info("Saved comment by user %s to hrapplication %s" % (request.user, comment.application))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.debug("Returning blank HRApplication comment form.")
|
logger.debug("Returning blank HRApplication comment form.")
|
||||||
form = HRApplicationCommentForm()
|
form = HRApplicationCommentForm()
|
||||||
|
|
||||||
if HRApplication.objects.filter(id=app_id).exists():
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
application = HRApplication.objects.get(id=app_id)
|
application = HRApplication.objects.get(id=app_id)
|
||||||
comments = HRApplicationComment.objects.all().filter(application=application)
|
comments = HRApplicationComment.objects.all().filter(application=application)
|
||||||
logger.debug("Retrieved hrpplication id %s on behalf of user %s with comments %s" % (app_id, request.user, len(comments)))
|
logger.debug("Retrieved hrpplication id %s on behalf of user %s with comments %s" % (app_id, request.user, len(comments)))
|
||||||
else:
|
else:
|
||||||
application = HRApplication()
|
application = HRApplication()
|
||||||
comments = []
|
comments = []
|
||||||
logger.error("HRAppllication with id %s not found - returning blank applicatin to user %s" % request.user)
|
logger.error("HRAppllication with id %s not found - returning blank applicatin to user %s" % request.user)
|
||||||
|
|
||||||
context = {'application': application, 'comments': comments, 'comment_form': form}
|
context = {'application': application, 'comments': comments, 'comment_form': form}
|
||||||
|
|
||||||
return render_to_response('registered/hrapplicationview.html',
|
return render_to_response('registered/hrapplicationview.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('auth.human_resources')
|
@permission_required('auth.human_resources')
|
||||||
def hr_application_remove(request, app_id):
|
def hr_application_remove(request, app_id):
|
||||||
logger.debug("hr_application_remove called by user %s for app id %s" % (request.user, app_id))
|
logger.debug("hr_application_remove called by user %s for app id %s" % (request.user, app_id))
|
||||||
if HRApplication.objects.filter(id=app_id).exists():
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
application = HRApplication.objects.get(id=app_id)
|
application = HRApplication.objects.get(id=app_id)
|
||||||
if application:
|
if application:
|
||||||
logger.info("Deleted HRApplication id %s on behalf of user %s" % (app_id, request.user))
|
logger.info("Deleted HRApplication id %s on behalf of user %s" % (app_id, request.user))
|
||||||
application.delete()
|
application.delete()
|
||||||
else:
|
else:
|
||||||
logger.error("Unable to delete HRApplication with id %s on behalf of user %s: application is NoneType" % (app_id, request.user))
|
logger.error("Unable to delete HRApplication with id %s on behalf of user %s: application is NoneType" % (app_id, request.user))
|
||||||
else:
|
else:
|
||||||
logger.error("Unable to delete HRApplication with id %s on behalf of user %s: application not found." % (app_id, request.user))
|
logger.error("Unable to delete HRApplication with id %s on behalf of user %s: application not found." % (app_id, request.user))
|
||||||
|
|
||||||
return HttpResponseRedirect("/hr_application_management/")
|
return HttpResponseRedirect("/hr_application_management/")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('auth.human_resources')
|
@permission_required('auth.human_resources')
|
||||||
def hr_application_approve(request, app_id):
|
def hr_application_approve(request, app_id):
|
||||||
logger.debug("hr_application_approve called by user %s for app id %s" % (request.user, app_id))
|
logger.debug("hr_application_approve called by user %s for app id %s" % (request.user, app_id))
|
||||||
if HRApplication.objects.filter(id=app_id).exists():
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||||
application = HRApplication.objects.get(id=app_id)
|
application = HRApplication.objects.get(id=app_id)
|
||||||
application.approved_denied = True
|
application.approved_denied = True
|
||||||
application.reviewer_user = request.user
|
application.reviewer_user = request.user
|
||||||
application.reviewer_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
application.reviewer_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
||||||
application.save()
|
application.save()
|
||||||
logger.info("HRApplication for user %s to corp %s approved by %s" % (application.user, application.corp, request.user))
|
logger.info("HRApplication for user %s to corp %s approved by %s" % (application.user, application.corp, request.user))
|
||||||
else:
|
else:
|
||||||
logger.error("User %s unable to approve HRApplication id %s - hrapplication with that id not found." % (request.user, app_id))
|
logger.error("User %s unable to approve HRApplication id %s - hrapplication with that id not found." % (request.user, app_id))
|
||||||
|
|
||||||
return HttpResponseRedirect("/hr_application_management/")
|
return HttpResponseRedirect("/hr_application_management/")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('auth.human_resources')
|
@permission_required('auth.human_resources')
|
||||||
def hr_application_reject(request, app_id):
|
def hr_application_reject(request, app_id):
|
||||||
logger.debug("hr_application_reject called by user %s for app id %s" % (request.user, app_id))
|
logger.debug("hr_application_reject called by user %s for app id %s" % (request.user, app_id))
|
||||||
if HRApplication.objects.filter(id=app_id).exists():
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||||
application = HRApplication.objects.get(id=app_id)
|
application = HRApplication.objects.get(id=app_id)
|
||||||
application.approved_denied = False
|
application.approved_denied = False
|
||||||
application.reviewer_user = request.user
|
application.reviewer_user = request.user
|
||||||
application.reviewer_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
application.reviewer_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
||||||
application.save()
|
application.save()
|
||||||
logger.info("HRApplication for user %s to corp %s rejected by %s" % (application.user, application.corp, request.user))
|
logger.info("HRApplication for user %s to corp %s rejected by %s" % (application.user, application.corp, request.user))
|
||||||
else:
|
else:
|
||||||
logger.error("User %s unable to reject HRApplication id %s - hrapplication with that id not found." % (request.user, app_id))
|
logger.error("User %s unable to reject HRApplication id %s - hrapplication with that id not found." % (request.user, app_id))
|
||||||
|
|
||||||
return HttpResponseRedirect("/hr_application_management/")
|
return HttpResponseRedirect("/hr_application_management/")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('auth.human_resources')
|
@permission_required('auth.human_resources')
|
||||||
def hr_application_search(request):
|
def hr_application_search(request):
|
||||||
logger.debug("hr_application_search called by user %s" % request.user)
|
logger.debug("hr_application_search called by user %s" % request.user)
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = HRApplicationSearchForm(request.POST)
|
form = HRApplicationSearchForm(request.POST)
|
||||||
logger.debug("Request type POST contains form valid: %s" % form.is_valid())
|
logger.debug("Request type POST contains form valid: %s" % form.is_valid())
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
# Really dumb search and only checks character name
|
# Really dumb search and only checks character name
|
||||||
# This can be improved but it does the job for now
|
# This can be improved but it does the job for now
|
||||||
searchstring = form.cleaned_data['search_string']
|
searchstring = form.cleaned_data['search_string']
|
||||||
applications = []
|
applications = []
|
||||||
logger.debug("Searching for application with character name %s for user %s" % (searchstring, request.user))
|
logger.debug("Searching for application with character name %s for user %s" % (searchstring, request.user))
|
||||||
|
|
||||||
for application in HRApplication.objects.all():
|
for application in HRApplication.objects.all():
|
||||||
if searchstring in application.character_name:
|
if searchstring in application.character_name:
|
||||||
applications.append(application)
|
applications.append(application)
|
||||||
logger.info("Found %s HRApplications for user %s matching search string %s" % (len(applications), request.user, searchstring))
|
logger.info("Found %s HRApplications for user %s matching search string %s" % (len(applications), request.user, searchstring))
|
||||||
|
|
||||||
context = {'applications': applications, 'search_form': HRApplicationSearchForm()}
|
context = {'applications': applications, 'search_form': HRApplicationSearchForm()}
|
||||||
|
|
||||||
return render_to_response('registered/hrapplicationsearchview.html',
|
return render_to_response('registered/hrapplicationsearchview.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
else:
|
else:
|
||||||
logger.debug("Form invalid - returning for user %s to retry." % request.user)
|
logger.debug("Form invalid - returning for user %s to retry." % request.user)
|
||||||
context = {'applications': None, 'search_form': form}
|
context = {'applications': None, 'search_form': form}
|
||||||
return render_to_response('registered/hrapplicationsearchview.html',
|
return render_to_response('registered/hrapplicationsearchview.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.debug("Returning empty search form for user %s" % request.user)
|
logger.debug("Returning empty search form for user %s" % request.user)
|
||||||
return HttpResponseRedirect("/hr_application_management/")
|
return HttpResponseRedirect("/hr_application_management/")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('auth.human_resources')
|
@permission_required('auth.human_resources')
|
||||||
def hr_application_mark_in_progress(request, app_id):
|
def hr_application_mark_in_progress(request, app_id):
|
||||||
logger.debug("hr_application_mark_in_progress called by user %s for app id %s" % (request.user, app_id))
|
logger.debug("hr_application_mark_in_progress called by user %s for app id %s" % (request.user, app_id))
|
||||||
if HRApplication.objects.filter(id=app_id).exists():
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||||
application = HRApplication.objects.get(id=app_id)
|
application = HRApplication.objects.get(id=app_id)
|
||||||
application.reviewer_inprogress_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
application.reviewer_inprogress_character = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
||||||
application.save()
|
application.save()
|
||||||
logger.info("Marked HRApplication for user %s to corp %s in progress by user %s" % (application.user, application.corp, request.user))
|
logger.info("Marked HRApplication for user %s to corp %s in progress by user %s" % (application.user, application.corp, request.user))
|
||||||
else:
|
else:
|
||||||
logger.error("Unable to mark HRApplication id %s in progress by user %s - hrapplication matching id not found." % (app_id, request.user))
|
logger.error("Unable to mark HRApplication id %s in progress by user %s - hrapplication matching id not found." % (app_id, request.user))
|
||||||
|
|
||||||
return HttpResponseRedirect("/hr_application_view/" + str(app_id))
|
return HttpResponseRedirect("/hr_application_view/" + str(app_id))
|
||||||
|
@ -5,6 +5,8 @@ evelink
|
|||||||
dnspython
|
dnspython
|
||||||
passlib
|
passlib
|
||||||
requests>=2.9.1
|
requests>=2.9.1
|
||||||
|
requests_cache
|
||||||
|
json
|
||||||
|
|
||||||
# Django Stuff #
|
# Django Stuff #
|
||||||
django==1.6.5
|
django==1.6.5
|
||||||
|
@ -183,7 +183,7 @@ class EveApiManager():
|
|||||||
api = evelink.api.API(api_key=(settings.CORP_API_ID, settings.CORP_API_VCODE))
|
api = evelink.api.API(api_key=(settings.CORP_API_ID, settings.CORP_API_VCODE))
|
||||||
corp = evelink.corp.Corp(api=api)
|
corp = evelink.corp.Corp(api=api)
|
||||||
corpinfo = corp.contacts()
|
corpinfo = corp.contacts()
|
||||||
results = corpinfo[0]
|
results = corpinfo.result
|
||||||
logger.debug("Got corp standings from settings: %s" % results)
|
logger.debug("Got corp standings from settings: %s" % results)
|
||||||
return results
|
return results
|
||||||
except evelink.api.APIError as error:
|
except evelink.api.APIError as error:
|
||||||
@ -192,6 +192,21 @@ class EveApiManager():
|
|||||||
logger.error("No corp API key supplied in settings. Unable to get standings.")
|
logger.error("No corp API key supplied in settings. Unable to get standings.")
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_corp_membertracking(api, vcode):
|
||||||
|
try:
|
||||||
|
logger.debug("Getting corp membertracking with api id %s" % settings.CORP_API_ID)
|
||||||
|
api = evelink.api.API(api_key=(api, vcode))
|
||||||
|
corp = evelink.corp.Corp(api=api)
|
||||||
|
membertracking = corp.members()
|
||||||
|
results = membertracking.result
|
||||||
|
logger.debug("Got corp membertracking from settings: %s" % results)
|
||||||
|
return results
|
||||||
|
except evelink.api.APIError as error:
|
||||||
|
logger.exception("Unhandled APIError occured.", exc_info=True)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_if_id_is_alliance(alliance_id):
|
def check_if_id_is_alliance(alliance_id):
|
||||||
logger.debug("Checking if id %s is an alliance." % alliance_id)
|
logger.debug("Checking if id %s is an alliance." % alliance_id)
|
||||||
@ -199,7 +214,7 @@ class EveApiManager():
|
|||||||
api = evelink.api.API()
|
api = evelink.api.API()
|
||||||
eve = evelink.eve.EVE(api=api)
|
eve = evelink.eve.EVE(api=api)
|
||||||
alliance = eve.alliances()
|
alliance = eve.alliances()
|
||||||
results = alliance[0][int(alliance_id)]
|
results = alliance.result[int(alliance_id)]
|
||||||
if results:
|
if results:
|
||||||
logger.debug("Confirmed id %s is an alliance." % alliance_id)
|
logger.debug("Confirmed id %s is an alliance." % alliance_id)
|
||||||
return True
|
return True
|
||||||
|
20
services/managers/evewho_manager.py
Normal file
20
services/managers/evewho_manager.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import requests
|
||||||
|
import requests_cache
|
||||||
|
import json
|
||||||
|
|
||||||
|
requests_cache.install_cache("evewhocache", backend="sqlite", expire_after=3600)
|
||||||
|
|
||||||
|
class EveWhoManager():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_corporation_members(corpid):
|
||||||
|
url = "http://evewho.com/api.php?type=corplist&id=%s" % corpid
|
||||||
|
jsondata = requests.get(url).content
|
||||||
|
data=json.loads(jsondata.decode())
|
||||||
|
|
||||||
|
return {row["character_id"]:{"name":row["name"], "id":row["character_id"]} for row in data["characters"]}
|
11
stock/static/css/bootstrap.min.css
vendored
11
stock/static/css/bootstrap.min.css
vendored
@ -3401,6 +3401,11 @@ tbody.collapse.in {
|
|||||||
box-shadow: 0 6px 12px rgba(0, 0, 0, .175)
|
box-shadow: 0 6px 12px rgba(0, 0, 0, .175)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-menu.scrollable {
|
||||||
|
overflow: scroll;
|
||||||
|
max-height: 450px;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-menu.pull-right {
|
.dropdown-menu.pull-right {
|
||||||
right: 0;
|
right: 0;
|
||||||
left: auto
|
left: auto
|
||||||
@ -4235,6 +4240,10 @@ textarea.input-group-sm > .form-control, textarea.input-group-sm > .input-group-
|
|||||||
line-height: 20px
|
line-height: 20px
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navbar-wide {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
.navbar-nav .open .dropdown-menu {
|
.navbar-nav .open .dropdown-menu {
|
||||||
position: static;
|
position: static;
|
||||||
@ -6663,4 +6672,4 @@ button.close {
|
|||||||
.hidden-print {
|
.hidden-print {
|
||||||
display: none !important
|
display: none !important
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ body {
|
|||||||
margin: 0 0 0 250px;
|
margin: 0 0 0 250px;
|
||||||
padding: 0 30px;
|
padding: 0 30px;
|
||||||
border-left: 1px solid #e7e7e7;
|
border-left: 1px solid #e7e7e7;
|
||||||
overflow: hidden;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,4 +346,4 @@ table.dataTable thead .sorting:after {
|
|||||||
|
|
||||||
.panel-yellow a:hover {
|
.panel-yellow a:hover {
|
||||||
color: #df8a13;
|
color: #df8a13;
|
||||||
}
|
}
|
||||||
|
@ -117,11 +117,18 @@
|
|||||||
|
|
||||||
{% if perms.auth.corp_stats %}
|
{% if perms.auth.corp_stats %}
|
||||||
<li>
|
<li>
|
||||||
<a {% ifequal request.path "/corporation_stats" %} class="active" {% endifequal %}
|
<a {% ifequal request.path "/corporation_stats/" %} class="active" {% endifequal %}
|
||||||
href="{% url 'auth_corp_stats' %}"><i
|
href="{% url 'auth_corp_stats' %}"><i
|
||||||
class="fa fa-share-alt fa-fw grayiconecolor"></i> Corporation Stats</a>
|
class="fa fa-share-alt fa-fw grayiconecolor"></i> Corporation Stats</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if perms.auth.corputils %}
|
||||||
|
<li>
|
||||||
|
<a {% ifequal request.path "/corputils/" %} class="active" {% endifequal %}
|
||||||
|
href="{% url 'auth_corp_member_view' %}"><i
|
||||||
|
class="fa fa-chain fa-fw grayiconecolor"></i> Member Tracking</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if perms.auth.group_management %}
|
{% if perms.auth.group_management %}
|
||||||
<li>
|
<li>
|
||||||
|
187
stock/templates/registered/corputils.html
Normal file
187
stock/templates/registered/corputils.html
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
{% extends "public/base.html" %}
|
||||||
|
{% load bootstrap %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
|
||||||
|
{% block title %}Alliance Auth{% endblock %}
|
||||||
|
{% block page_title %}Corporation Member Tracking{% endblock page_title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<h1 class="page-header text-center">Corporation Member Data</h1>
|
||||||
|
{% if perms.auth.corputils %}
|
||||||
|
<div class="col-lg-12 container" id="example">
|
||||||
|
{% if corp %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Corporation</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="col-lg-5 col-sm-2">
|
||||||
|
<img class="ra-avatar img-responsive" src="https://image.eveonline.com/Corporation/{{ corp.corporation_id }}_128.png">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-7 col-sm-2">
|
||||||
|
<h4 class="">{{ corp.corporation_name }}</h4>
|
||||||
|
|
||||||
|
<p>Ticker: {{ corp.corporation_ticker }}</p>
|
||||||
|
|
||||||
|
<p>Member count: {{ corp.member_count }}</p>
|
||||||
|
|
||||||
|
<p>Player count: {{characters_with_api|length}}</p>
|
||||||
|
|
||||||
|
<p>Unregistered characters: {{characters_without_api|length}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12 col-sm-5">
|
||||||
|
<b>API Index:</b>
|
||||||
|
<div class="progress">
|
||||||
|
<div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="{{characters_with_api|length}}" aria-valuemin="0" aria-valuemax="{{ corp.member_count }}" style="width: {% widthratio characters_with_api|length corp.member_count 100 %}%;">
|
||||||
|
{{characters_with_api|length}}/{{ corp.member_count }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<nav class="navbar navbar-default">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<ul class="nav navbar-nav navbar-wide">
|
||||||
|
{% if membercorp_list %}
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Choose corporation <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu scrollable">
|
||||||
|
{% for membercorp_id, membercorp_name in membercorp_list %}
|
||||||
|
<li>
|
||||||
|
<a href="/corputils/{{ membercorp_id }}">{{ membercorp_name }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
<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>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li style="float: right">
|
||||||
|
<form class="navbar-form navbar-left" role="search" action={% url 'auth_corputils_search' %}{{ corp.corporation_id }}/ method="POST">
|
||||||
|
<div class="form-group">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ search_form.as_table }}
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-default" type="submit">Search</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="active"><a data-toggle="tab" href="#gotapi">Registered Main Characters <b>({{characters_with_api|length}})</b></a></li>
|
||||||
|
<li><a data-toggle="tab" href="#noapi">Characters without API <b>({{characters_without_api|length}})</b></a></li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div id="gotapi" class="tab-pane fade in active">
|
||||||
|
{% if characters_with_api %}
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-condensed table-hover table-striped">
|
||||||
|
<tr>
|
||||||
|
<th class="col-md-1"></th>
|
||||||
|
<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-5">Killboard</th>
|
||||||
|
</tr>
|
||||||
|
{% for maincharname, player in characters_with_api %}
|
||||||
|
<tr >
|
||||||
|
<td>
|
||||||
|
<img src="http://image.eveonline.com/Character/{{ player.main.character_id }}_32.jpg" class="img-circle">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p>{{ maincharname }}</p>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if not corp.corporation_name == player.maincorp%}
|
||||||
|
<span class="label label-danger">
|
||||||
|
{{ player.maincorp }}
|
||||||
|
</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="label label-success">
|
||||||
|
{{ player.maincorp }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% for char in player.altlist %}
|
||||||
|
<p>{{ char.character_name }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
</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>
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<h3>Seems there are no characters in {{ corp.corporation_name }} tied to a registered API!</h3>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div id="noapi" class="tab-pane fade">
|
||||||
|
{% if characters_without_api %}
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-condensed table-hover table-striped">
|
||||||
|
<tr>
|
||||||
|
<th class="col-md-1"></th>
|
||||||
|
<th class="col-md-2">Character</th>
|
||||||
|
<th class="col-md-5">Killboard</th>
|
||||||
|
</tr>
|
||||||
|
{% for character_name, character_id in characters_without_api %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="http://image.eveonline.com/Character/{{ character_id }}_32.jpg" class="img-circle">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p>{{ character_name }}</p>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://zkillboard.com/character/{{ character_id }}/" class="label label-danger" target="_blank">Killboard</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
<h3>Good job! Every character in {{ corp.corporation_name }} seem to be tied to an API!</h3>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="col-md-4 col-md-offset-4">
|
||||||
|
<div class="row">
|
||||||
|
<div class="alert alert-danger text-center" role="alert">No corporation model found. Contact your admin.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{% if IS_CORP %}
|
||||||
|
<div class="alert alert-danger" role="alert">You are not in the corporation.</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-danger" role="alert">You are not in the alliance.</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
58
stock/templates/registered/corputilssearchview.html
Normal file
58
stock/templates/registered/corputilssearchview.html
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{% extends "public/base.html" %}
|
||||||
|
{% load bootstrap %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
|
||||||
|
{% block title %}Alliance Auth{% endblock %}
|
||||||
|
|
||||||
|
{% block page_title %}Corporation Member Tracking{% endblock page_title %}
|
||||||
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="col-lg-12">
|
||||||
|
{% if perms.auth.corputils %}
|
||||||
|
<h1 class="page-header text-center">Member Search Results
|
||||||
|
</h1>
|
||||||
|
<h2 class="text-center"><a href="{% url 'auth_corp_member_view' %}{{ corp.corporation_id }}">{{ corp.corporation_name }}</a></h2>
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<nav class="navbar navbar-default">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<ul class="nav navbar-nav navbar-wide">
|
||||||
|
<li style="float: right">
|
||||||
|
<form class="navbar-form navbar-right" role="search" action={% url 'auth_corputils_search' %}{{ corp.corporation_id }}/ method="POST">
|
||||||
|
<div class="form-group">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ search_form.as_table }}
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-default" type="submit">Search</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table table-condensed table-hover table-striped">
|
||||||
|
<tr>
|
||||||
|
<th>Character</th>
|
||||||
|
<th>Main Character</th>
|
||||||
|
</tr>
|
||||||
|
{% for member in members %}
|
||||||
|
<tr {% if not member.api_registered%} {% endif %} >
|
||||||
|
<td>{{ member.name }}{{ member.id }}</td>
|
||||||
|
<td>
|
||||||
|
{% if member.api_registered%}
|
||||||
|
{{ member.main }}
|
||||||
|
{% else %}
|
||||||
|
<span class="label label-danger">No API registered!</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
@ -19,6 +19,7 @@ def bootstrap_permissions():
|
|||||||
Permission.objects.get_or_create(codename="human_resources", content_type=ct, name="human_resources")
|
Permission.objects.get_or_create(codename="human_resources", content_type=ct, name="human_resources")
|
||||||
Permission.objects.get_or_create(codename="blue_member", content_type=ct, name="blue_member")
|
Permission.objects.get_or_create(codename="blue_member", content_type=ct, name="blue_member")
|
||||||
Permission.objects.get_or_create(codename="corp_stats", content_type=ct, name="corp_stats")
|
Permission.objects.get_or_create(codename="corp_stats", content_type=ct, name="corp_stats")
|
||||||
|
Permission.objects.get_or_create(codename="corputils", content_type=ct, name="corputils")
|
||||||
Permission.objects.get_or_create(codename="timer_management", content_type=ct, name="timer_management")
|
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="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="srp_management", content_type=ct, name="srp_management")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user