From 7e4d4116858eed4bf856eca8e8d8d0fb2e073339 Mon Sep 17 00:00:00 2001 From: moriartyj Date: Mon, 18 Jul 2016 11:07:22 -0700 Subject: [PATCH] Changed timerboard to Future/Past timers (#503) --- services/views.py | 10 +- .../templates/registered/timermanagement.html | 327 +++++++++--------- timerboard/views.py | 4 +- 3 files changed, 173 insertions(+), 168 deletions(-) diff --git a/services/views.py b/services/views.py index 25dcfa97..5fdd3388 100755 --- a/services/views.py +++ b/services/views.py @@ -419,12 +419,18 @@ def activate_teamspeak3(request): logger.debug("activate_teamspeak3 called by user %s" % request.user) authinfo = AuthServicesInfoManager.get_auth_service_info(request.user) character = EveManager.get_character_by_id(authinfo.main_char_id) + ticker = character.corporation_ticker + if check_if_user_has_permission(request.user, "blue_member"): logger.debug("Adding TS3 user for blue user %s with main character %s" % (request.user, character)) - result = Teamspeak3Manager.add_blue_user(character.character_name, character.corporation_ticker) + # Blue members should have alliance ticker (if in alliance) + if EveAllianceInfo.objects.filter(alliance_id=character.alliance_id).exists(): + alliance = EveAllianceInfo.objects.filter(alliance_id=character.alliance_id)[0] + ticker = alliance.alliance_ticker + result = Teamspeak3Manager.add_blue_user(character.character_name, ticker) else: logger.debug("Adding TS3 user for user %s with main character %s" % (request.user, character)) - result = Teamspeak3Manager.add_user(character.character_name, character.corporation_ticker) + result = Teamspeak3Manager.add_user(character.character_name, ticker) # if its empty we failed if result[0] is not "": diff --git a/stock/templates/registered/timermanagement.html b/stock/templates/registered/timermanagement.html index ad029379..eeddad7c 100755 --- a/stock/templates/registered/timermanagement.html +++ b/stock/templates/registered/timermanagement.html @@ -24,107 +24,6 @@ {% trans "Current Eve Time:" %}
-

{% trans "Next Timer" %}

- - - - - - - - - - {% if perms.auth.timer_management %} - - {% endif %} - - {% if closest_timer %} - {% ifequal closest_timer.important True %} - - {% else %} - - {% endifequal %} - - - - - - - - {% if perms.auth.timer_management %} - - {% endif %} - {% endif %} - -
{% trans "Details" %}{% trans "Objective" %}{% trans "System" %}{% trans "Structure" %}{% trans "Eve Time" %}{% trans "Local Time" %}{% trans "Creator" %}{% trans "Action" %}
{{ closest_timer.details }} - {% ifequal closest_timer.objective "Hostile" %} -
- {% trans "Hostile" %} -
- {% endifequal %} - {% ifequal closest_timer.objective "Friendly" %} -
- {% trans "Friendly" %} -
- {% endifequal %} - {% ifequal closest_timer.objective "Neutral" %} -
- {% trans "Neutral" %} -
- {% endifequal %} -
{{ closest_timer.system }} {{ closest_timer.planet_moon }} - - {% ifequal closest_timer.structure "I-HUB" %} -
- I-HUB -
- {% endifequal %} - {% ifequal closest_timer.structure "POCO" %} -
- POCO -
- {% endifequal %} - {% ifequal closest_timer.structure "POS[S]" %} -
- POS [S] -
- {% endifequal %} - {% ifequal closest_timer.structure "POS[M]" %} -
- POS [M] -
- {% endifequal %} - {% ifequal closest_timer.structure "POS[L]" %} -
- POS [L] -
- {% endifequal %} - {% ifequal closest_timer.structure "Station" %} -
- Station -
- {% endifequal %} - {% ifequal closest_timer.structure "TCU" %} -
- TCU -
- {% endifequal %} - {% ifequal closest_timer.structure "Other" %} -
- Other -
- {% endifequal %} -
{{ closest_timer.eve_time | date:"Y-m-d H:i" }}{{ closest_timer.eve_character.character_name }} - - - - - - -
{% if corp_timers %}

{% trans "Corp Timers" %}

@@ -228,7 +127,7 @@ {% endfor %}
{% endif %} -

{% trans "Future Timers" %}

+

{% trans "Next Timers" %}

@@ -242,75 +141,174 @@ {% endif %} - {% for timer in timers %} - {% ifnotequal timer closest_timer %} - {% ifequal timer.important True %} - - {% else %} - - {% endifequal %} + {% for timer in future_timers %} + {% ifequal timer.important True %} + + {% else %} + + {% endifequal %} + + + + {% if perms.auth.timer_management %} + + {% endif %} + + {% endfor %} +
{% trans "Details" %}{% trans "Action" %}
{{ timer.details }} - {% ifequal timer.objective "Hostile" %} -
- {% trans "Hostile" %} -
- {% endifequal %} - {% ifequal timer.objective "Friendly" %} -
- {% trans "Friendly" %} -
- {% endifequal %} - {% ifequal timer.objective "Neutral" %} -
- {% trans "Neutral" %} -
- {% endifequal %} + {% ifequal timer.objective "Hostile" %} +
+ {% trans "Hostile" %} +
+ {% endifequal %} + {% ifequal timer.objective "Friendly" %} +
+ {% trans "Friendly" %} +
+ {% endifequal %} + {% ifequal timer.objective "Neutral" %} +
+ {% trans "Neutral" %} +
+ {% endifequal %}
{{ timer.system }} {{ timer.planet_moon }} - {% ifequal timer.structure "I-HUB" %} -
- I-HUB -
- {% endifequal %} - {% ifequal timer.structure "POCO" %} -
- POCO -
- {% endifequal %} - {% ifequal timer.structure "POS[S]" %} -
- POS [S] -
- {% endifequal %} - {% ifequal timer.structure "POS[M]" %} -
- POS [M] -
- {% endifequal %} - {% ifequal timer.structure "POS[L]" %} -
- POS [L] -
- {% endifequal %} - {% ifequal timer.structure "Station" %} -
- Station -
- {% endifequal %} - {% ifequal timer.structure "TCU" %} -
- TCU -
- {% endifequal %} - {% ifequal timer.structure "Other" %} -
- Other -
- {% endifequal %} + {% ifequal timer.structure "I-HUB" %} +
+ I-HUB +
+ {% endifequal %} + {% ifequal timer.structure "POCO" %} +
+ POCO +
+ {% endifequal %} + {% ifequal timer.structure "POS[S]" %} +
+ POS [S] +
+ {% endifequal %} + {% ifequal timer.structure "POS[M]" %} +
+ POS [M] +
+ {% endifequal %} + {% ifequal timer.structure "POS[L]" %} +
+ POS [L] +
+ {% endifequal %} + {% ifequal timer.structure "Station" %} +
+ Station +
+ {% endifequal %} + {% ifequal timer.structure "TCU" %} +
+ TCU +
+ {% endifequal %} + {% ifequal timer.structure "Other" %} +
+ Other +
+ {% endifequal %} +
{{ timer.eve_time | date:"Y-m-d H:i" }}
{{ timer.eve_character.character_name }} + + + + + +
+

{% trans "Past Timers" %}

+ + + + + + + + + + {% if perms.auth.timer_management %} + + {% endif %} + + {% for timer in past_timers %} + {% ifequal timer.important True %} + + {% else %} + + {% endifequal %} + + + + @@ -327,7 +325,6 @@ {% endif %} - {% endifnotequal %} {% endfor %}
{% trans "Details" %}{% trans "Objective" %}{% trans "System" %}{% trans "Structure" %}{% trans "Eve Time" %}{% trans "Local Time" %}{% trans "Creator" %}{% trans "Action" %}
{{ timer.details }} + {% ifequal timer.objective "Hostile" %} +
+ {% trans "Hostile" %} +
+ {% endifequal %} + {% ifequal timer.objective "Friendly" %} +
+ {% trans "Friendly" %} +
+ {% endifequal %} + {% ifequal timer.objective "Neutral" %} +
+ {% trans "Neutral" %} +
+ {% endifequal %} +
{{ timer.system }} {{ timer.planet_moon }} + + {% ifequal timer.structure "I-HUB" %} +
+ I-HUB +
+ {% endifequal %} + {% ifequal timer.structure "POCO" %} +
+ POCO +
+ {% endifequal %} + {% ifequal timer.structure "POS[S]" %} +
+ POS [S] +
+ {% endifequal %} + {% ifequal timer.structure "POS[M]" %} +
+ POS [M] +
+ {% endifequal %} + {% ifequal timer.structure "POS[L]" %} +
+ POS [L] +
+ {% endifequal %} + {% ifequal timer.structure "Station" %} +
+ Station +
+ {% endifequal %} + {% ifequal timer.structure "TCU" %} +
+ TCU +
+ {% endifequal %} + {% ifequal timer.structure "Other" %} +
+ Other +
+ {% endifequal %}
{{ timer.eve_time | date:"Y-m-d H:i" }}
diff --git a/timerboard/views.py b/timerboard/views.py index 93c6b66c..0ae2f677 100755 --- a/timerboard/views.py +++ b/timerboard/views.py @@ -47,7 +47,9 @@ def timer_view(request): logger.debug("Determined closest timer is %s" % closest_timer) render_items = {'timers': Timer.objects.all().filter(corp_timer=False), 'corp_timers': corp_timers, - 'closest_timer': closest_timer} + 'closest_timer': closest_timer, + 'future_timers': Timer.objects.all().filter(corp_timer=False).filter(eve_time__gte=datetime.datetime.now()), + 'past_timers': Timer.objects.all().filter(corp_timer=False).filter(eve_time__lt=datetime.datetime.now())} return render_to_response('registered/timermanagement.html', render_items, context_instance=RequestContext(request))