Reformatted code for easy reading.

This commit is contained in:
Raynaldo Rivera 2014-10-26 16:47:21 -07:00
parent 6e99823252
commit 19e19d89e4
97 changed files with 22820 additions and 10377 deletions

30
.idea/dataSources.xml generated Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" hash="1026499400">
<data-source source="LOCAL" name="Django default" uuid="3eb61453-647a-4832-8320-f3561f039abc">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1:3306/alliance_auth</jdbc-url>
<user-name>allianceauth</user-name>
<user-password>dfcbdfc6dfc6dfc3dfcbdfc4dfc9dfcfdfcbdfdfdfdedfc2</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Django phpbb3" uuid="2de247c2-1951-4e74-8276-6a1c89c396fa">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1:3306/alliance_forum</jdbc-url>
<user-name>allianceauth</user-name>
<user-password>dfcbdfc6dfc6dfc3dfcbdfc4dfc9dfcfdfcbdfdfdfdedfc2</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Django mumble" uuid="9963e5ca-7f2f-4dd3-9175-bc7102dfd48c">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1:3306/alliance_mumble</jdbc-url>
<user-name>allianceauth</user-name>
<user-password>dfcbdfc6dfc6dfc3dfcbdfc4dfc9dfcfdfcbdfdfdfdedfc2</user-password>
<libraries />
</data-source>
</component>
</project>

View File

@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

View File

@ -10,7 +10,10 @@ https://docs.djangoproject.com/en/1.6/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import djcelery
djcelery.setup_loader()
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
@ -154,7 +157,7 @@ STATIC_URL = '/static/'
DEFAULT_ALLIANCE_GROUP = 'AllianceMember'
# ALLIANCE INFO
ALLIANCE_ID = '0'
ALLIANCE_ID = '99001336'
ALLIANCE_NAME = 'Somealliance'
# Forum URL
@ -167,7 +170,7 @@ JABBER_SERVER = "someadddress.com"
OPENFIRE_ADDRESS = "http://someaddress.com:9090/"
OPENFIRE_SECRET_KEY = "somekey"
BROADCAST_USER = "broadcast@"+JABBER_URL
BROADCAST_USER = "broadcast@" + JABBER_URL
BROADCAST_USER_PASSWORD = "somepassword"
# Mumble settings

View File

@ -1,6 +1,7 @@
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
@ -17,11 +18,16 @@ urlpatterns = patterns('',
url(r'^register_user/', 'registration.views.register_user_view', name='auth_register_user'),
url(r'^user/password/$', 'django.contrib.auth.views.password_change', name='password_change'),
url(r'^user/password/done/$', 'django.contrib.auth.views.password_change_done', name='password_change_done'),
url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset', name='password_reset'),
url(r'^user/password/password/reset/done/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'),
url(r'^user/password/reset/complete/$', 'django.contrib.auth.views.password_reset_complete', name='password_reset_complete'),
url(r'^user/password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'),
url(r'^user/password/done/$', 'django.contrib.auth.views.password_change_done',
name='password_change_done'),
url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset',
name='password_reset'),
url(r'^user/password/password/reset/done/$', 'django.contrib.auth.views.password_reset_done',
name='password_reset_done'),
url(r'^user/password/reset/complete/$', 'django.contrib.auth.views.password_reset_complete',
name='password_reset_complete'),
url(r'^user/password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'),
# Portal Urls
url(r'^dashboard/$', 'portal.views.dashboard_view', name='auth_dashboard'),
@ -29,44 +35,62 @@ urlpatterns = patterns('',
# Eveonline Urls
url(r'^add_api_key/', 'eveonline.views.add_api_key', name='auth_add_api_key'),
url(r'^api_key_management/', 'eveonline.views.api_key_management_view', name='auth_api_key_management'),
url(r'^api_key_management/', 'eveonline.views.api_key_management_view',
name='auth_api_key_management'),
url(r'^delete_api_pair/(\w+)/$', 'eveonline.views.api_key_removal', name='auth_api_key_removal'),
url(r'^characters/', 'eveonline.views.characters_view', name='auth_characters'),
url(r'^main_character_change/(\w+)/$', 'eveonline.views.main_character_change', name='auth_main_character_change'),
url(r'^main_character_change/(\w+)/$', 'eveonline.views.main_character_change',
name='auth_main_character_change'),
# Group management
url(r'^groups/', 'groupmanagement.views.groups_view', name='auth_groups'),
url(r'^group/management/', 'groupmanagement.views.group_management', name='auth_group_management'),
url(r'^group/request_add/(\w+)', 'groupmanagement.views.group_request_add', name='auth_group_request_add'),
url(r'^group/request/accept/(\w+)', 'groupmanagement.views.group_accept_request', name='auth_group_accept_request'),
url(r'^group/request/reject/(\w+)', 'groupmanagement.views.group_reject_request', name='auth_group_reject_request'),
url(r'^group/management/', 'groupmanagement.views.group_management',
name='auth_group_management'),
url(r'^group/request_add/(\w+)', 'groupmanagement.views.group_request_add',
name='auth_group_request_add'),
url(r'^group/request/accept/(\w+)', 'groupmanagement.views.group_accept_request',
name='auth_group_accept_request'),
url(r'^group/request/reject/(\w+)', 'groupmanagement.views.group_reject_request',
name='auth_group_reject_request'),
url(r'^group/request_leave/(\w+)', 'groupmanagement.views.group_request_leave', name='auth_group_request_leave'),
url(r'^group/request_leave/(\w+)', 'groupmanagement.views.group_request_leave',
name='auth_group_request_leave'),
url(r'group/leave_request/accept/(\w+)', 'groupmanagement.views.group_leave_accept_request',
name='auth_group_leave_accept_request'),
url(r'^group/leave_request/reject/(\w+)', 'groupmanagement.views.group_leave_reject_request',
name='auth_group_leave_reject_request'),
# HR Application Management
url(r'^hr_application_management/', 'hrapplications.views.hr_application_management_view',
name="auth_hrapplications_view"),
url(r'^hr_application_create/', 'hrapplications.views.hr_application_create_view',
name="auth_hrapplication_create_view"),
# Service Urls
url(r'^services/', 'services.views.services_view', name='auth_services'),
url(r'^serivces/jabber_broadcast/$', 'services.views.jabber_broadcast_view', name='auth_jabber_broadcast_view'),
url(r'^serivces/jabber_broadcast/$', 'services.views.jabber_broadcast_view',
name='auth_jabber_broadcast_view'),
# Forum Service Control
url(r'^activate_forum/$', 'services.views.activate_forum', name='auth_activate_forum'),
url(r'^deactivate_forum/$', 'services.views.deactivate_forum', name='auth_deactivate_forum'),
url(r'^reset_forum_password/$', 'services.views.reset_forum_password', name='auth_reset_forum_password'),
url(r'^reset_forum_password/$', 'services.views.reset_forum_password',
name='auth_reset_forum_password'),
# Jabber Service Control
url(r'^activate_jabber/$', 'services.views.activate_jabber', name='auth_activate_jabber'),
url(r'^deactivate_jabber/$', 'services.views.deactivate_jabber', name='auth_deactivate_jabber'),
url(r'^reset_jabber_password/$', 'services.views.reset_jabber_password', name='auth_reset_jabber_password'),
url(r'^reset_jabber_password/$', 'services.views.reset_jabber_password',
name='auth_reset_jabber_password'),
# Mumble service contraol
url(r'^activate_mumble/$', 'services.views.activate_mumble', name='auth_activate_mumble'),
url(r'^deactivate_mumble/$', 'services.views.deactivate_mumble', name='auth_deactivate_mumble'),
url(r'^reset_mumble_password/$', 'services.views.reset_mumble_password', name='auth_reset_mumble_password'),
url(r'^reset_mumble_password/$', 'services.views.reset_mumble_password',
name='auth_reset_mumble_password'),
# Tools
url(r'^tool/fleet_formatter_tool/$', 'services.views.fleet_formatter_view', name='auth_fleet_format_tool_view'),
url(r'^tool/fleet_formatter_tool/$', 'services.views.fleet_formatter_view',
name='auth_fleet_format_tool_view'),
)

View File

@ -8,7 +8,9 @@ https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alliance_auth.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

View File

@ -1,5 +1,7 @@
from django.contrib import admin
from models import AuthServicesInfo
# Register your models here.
admin.site.register(AuthServicesInfo)

View File

@ -4,7 +4,6 @@ from models import AuthServicesInfo
class AuthServicesInfoManager:
def __init__(self):
pass

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -4,6 +4,7 @@ from django.contrib.auth import authenticate
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from forms import LoginForm

View File

@ -1,5 +1,7 @@
from django.contrib import admin
from models import SyncGroupCache
# Register your models here.
admin.site.register(SyncGroupCache)

View File

@ -1,5 +1,4 @@
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User

View File

@ -1,8 +1,9 @@
from models import SyncGroupCache
from django.conf import settings
from celery.task import periodic_task
from celery.task.schedules import crontab
from django.contrib.auth.models import User
from models import SyncGroupCache
from celery.task.schedules import crontab
from services.managers.jabber_manager import JabberManager
from services.managers.mumble_manager import MumbleManager
from services.managers.forum_manager import ForumManager
@ -52,7 +53,6 @@ def update_forum_groups(user):
def add_to_databases(user, groups, syncgroups):
authserviceinfo = None
try:
authserviceinfo = AuthServicesInfo.objects.get(user=user)
@ -134,14 +134,15 @@ def run_api_refresh():
authserviceinfo = AuthServicesInfo.objects.get(user=user)
# We do a check on the authservice info to insure that we shoud run the check
# No point in running the check on people who arn't on services
print 'Running update on user: '+user.username
print 'Running update on user: ' + user.username
if authserviceinfo.main_char_id:
if authserviceinfo.main_char_id != "":
for api_key_pair in api_key_pairs:
print 'Running on '+api_key_pair.api_id+':'+api_key_pair.api_key
print 'Running on ' + api_key_pair.api_id + ':' + api_key_pair.api_key
if EveApiManager.api_key_is_valid(api_key_pair.api_id, api_key_pair.api_key):
# Update characters
characters = EveApiManager.get_characters_from_api(api_key_pair.api_id, api_key_pair.api_key)
characters = EveApiManager.get_characters_from_api(api_key_pair.api_id,
api_key_pair.api_key)
EveManager.update_characters_from_list(characters)
valid_key = True
else:
@ -156,7 +157,14 @@ def run_api_refresh():
else:
deactivate_services(user)
else:
#nuke it
# nuke it
deactivate_services(user)
else:
print 'No main_char_id set'
# Run Every 2 hours
@periodic_task(run_every=crontab(minute=0, hour="*/2"))
def run_alliance_corp_update():
alliance_info = EveApiManager.get_alliance_information(settings.ALLIANCE_ID)

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,3 +1 @@
from django.shortcuts import render
# Create your views here.

View File

@ -1,6 +1,8 @@
from django.contrib import admin
from models import EveCharacter
from models import EveApiKeyPair
admin.site.register(EveCharacter)
admin.site.register(EveApiKeyPair)

View File

@ -1,4 +1,5 @@
from django import forms
from services.managers.eve_api_manager import EveApiManager
from eveonline.managers import EveManager

View File

@ -1,10 +1,12 @@
from models import EveCharacter
from models import EveApiKeyPair
from models import EveAllianceInfo
from models import EveCorporationInfo
from services.managers.eve_api_manager import EveApiManager
class EveManager:
def __init__(self):
pass
@ -35,7 +37,8 @@ class EveManager:
chars.result[char]['name'],
chars.result[char]['corp']['id'],
chars.result[char]['corp']['name'],
EveApiManager.get_corporation_ticker_from_id(chars.result[char]['corp']['id']),
EveApiManager.get_corporation_ticker_from_id(
chars.result[char]['corp']['id']),
chars.result[char]['alliance']['id'],
chars.result[char]['alliance']['name'],
user, api_id)
@ -47,7 +50,8 @@ class EveManager:
eve_char = EveManager.get_character_by_character_name(chars.result[char]['name'])
eve_char.corporation_id = chars.result[char]['corp']['id']
eve_char.corporation_name = chars.result[char]['corp']['name']
eve_char.corporation_ticker = EveApiManager.get_corporation_ticker_from_id(chars.result[char]['corp']['id'])
eve_char.corporation_ticker = EveApiManager.get_corporation_ticker_from_id(
chars.result[char]['corp']['id'])
eve_char.alliance_id = chars.result[char]['alliance']['id']
eve_char.alliance_name = chars.result[char]['alliance']['name']
eve_char.save()
@ -62,6 +66,38 @@ class EveManager:
api_pair.user = user_id
api_pair.save()
@staticmethod
def create_alliance_info(alliance_id, alliance_name, alliance_ticker, alliance_executor_corp_id,
alliance_member_count):
if EveManager.check_if_alliance_exists_by_id(alliance_id):
alliance_info = EveAllianceInfo()
alliance_info.alliance_id = alliance_id
alliance_info.alliance_name = alliance_name
alliance_info.alliance_ticker = alliance_ticker
alliance_info.executor_corp_id = alliance_executor_corp_id
alliance_info.member_count = alliance_member_count
alliance_info.save()
@staticmethod
def update_alliance_info(alliance_id, alliance_executor_corp_id, alliance_member_count):
if EveManager.check_if_alliance_exists_by_id(alliance_id):
alliance_info = EveAllianceInfo.objects.get(alliance_id=alliance_id)
alliance_info.executor_corp_id = alliance_executor_corp_id
alliance_info.member_count = alliance_member_count
alliance_info.save()
@staticmethod
def create_corporation_info(corp_id, corp_name, corp_ticker, corp_member_count, alliance):
if EveManager.check_if_corporation_exists_by_id(corp_id):
corp_info = EveCorporationInfo()
corp_info.corporation_id = corp_id
corp_info.corporation_name = corp_name
corp_info.corporation_ticker = corp_ticker
corp_info.member_count = corp_member_count
corp_info.alliance = alliance
corp_info.save()
@staticmethod
def get_api_key_pairs(user):
if EveApiKeyPair.objects.filter(user=user).exists():
@ -128,3 +164,11 @@ class EveManager:
return True
return False
@staticmethod
def check_if_alliance_exists_by_id(alliance_id):
return EveAllianceInfo.objects.filter(alliance_id=alliance_id).exists()
@staticmethod
def check_if_corporation_exists_by_id(corp_id):
return EveCorporationInfo.objects.filter(corporation_id=corp_id).exists()

View File

@ -24,3 +24,26 @@ class EveApiKeyPair(models.Model):
def __str__(self):
return self.user.username + " - ApiKeyPair"
class EveAllianceInfo(models.Model):
alliance_id = models.CharField(max_length=254)
alliance_name = models.CharField(max_length=254)
alliance_ticker = models.CharField(max_length=254)
executor_corp_id = models.CharField(max_length=254)
member_count = models.IntegerField()
def __str__(self):
return self.alliance_name
class EveCorporationInfo(models.Model):
corporation_id = models.CharField(max_length=254)
corporation_name = models.CharField(max_length=254)
corporation_ticker = models.CharField(max_length=254)
member_count = models.IntegerField()
alliance = models.ForeignKey(EveAllianceInfo)
def __str__(self):
return self.corporation_name

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,15 +1,14 @@
from util import add_member_permission
from util import remove_member_permission
from util import check_if_user_has_permission
from django.conf import settings
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from util import add_member_permission
from util import remove_member_permission
from util import check_if_user_has_permission
from forms import UpdateKeyForm
from managers import EveManager
from authentication.managers import AuthServicesInfoManager
from services.managers.eve_api_manager import EveApiManager
from util.common_task import add_user_to_group
@ -29,7 +28,8 @@ def add_api_key(request):
request.user)
# Grab characters associated with the key pair
characters = EveApiManager.get_characters_from_api(form.cleaned_data['api_id'], form.cleaned_data['api_key'])
characters = EveApiManager.get_characters_from_api(form.cleaned_data['api_id'],
form.cleaned_data['api_key'])
EveManager.create_characters_from_list(characters, request.user, form.cleaned_data['api_id'])
return HttpResponseRedirect("/api_key_management/")
else:
@ -67,7 +67,6 @@ def api_key_removal(request, api_id):
@login_required
def characters_view(request):
render_items = {'characters': EveManager.get_characters_by_owner_id(request.user.id),
'authinfo': AuthServicesInfoManager.get_auth_service_info(request.user)}
return render_to_response('registered/characters.html', render_items, context_instance=RequestContext(request))
@ -75,7 +74,6 @@ def characters_view(request):
@login_required
def main_character_change(request, char_id):
if EveManager.check_if_character_owned_by_user(char_id, request.user):
previousmainid = AuthServicesInfoManager.get_auth_service_info(request.user).main_char_id
AuthServicesInfoManager.update_main_char_Id(char_id, request.user)
@ -86,12 +84,13 @@ def main_character_change(request, char_id):
add_user_to_group(request.user,
generate_corp_group_name(EveManager.get_character_by_id(char_id).corporation_name))
else:
#TODO: disable serivces
# TODO: disable serivces
if check_if_user_has_permission(request.user, 'alliance_member'):
remove_member_permission(request.user, 'alliance_member')
remove_user_from_group(request.user, settings.DEFAULT_ALLIANCE_GROUP)
remove_user_from_group(request.user,
generate_corp_group_name(EveManager.get_character_by_id(previousmainid).corporation_name))
generate_corp_group_name(
EveManager.get_character_by_id(previousmainid).corporation_name))
deactivate_services(request.user)
return HttpResponseRedirect("/characters")

View File

@ -1,6 +1,8 @@
from django.contrib import admin
from models import GroupDescription
from models import GroupRequest
admin.site.register(GroupDescription)
admin.site.register(GroupRequest)

View File

@ -1,6 +1,7 @@
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from eveonline.models import EveCharacter

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -4,11 +4,9 @@ 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.models import Group
from django.contrib.auth.models import User
from models import GroupDescription
from models import GroupRequest
from authentication.managers import AuthServicesInfoManager
from eveonline.managers import EveManager
@ -88,9 +86,9 @@ def group_leave_reject_request(request, group_request_id):
return HttpResponseRedirect("/group/management/")
@login_required
def groups_view(request):
paired_list = []
for group in Group.objects.all():
@ -119,6 +117,7 @@ def groups_view(request):
return render_to_response('registered/groups.html',
render_items, context_instance=RequestContext(request))
@login_required
def group_request_add(request, group_id):
auth_info = AuthServicesInfoManager.get_auth_service_info(request.user)

View File

@ -1,6 +1,8 @@
from django.contrib import admin
from models import HRApplications
from models import HRApplicationComment
admin.site.register(HRApplications)
admin.site.register(HRApplicationComment)

View File

@ -1 +1,11 @@
__author__ = 'r4stl1n'
from django import forms
class HRApplicationForm(forms.Form):
character_name = forms.CharField(max_length=254, required=True, label="Main Character Name")
full_api_id = forms.CharField(max_length=254, required=True, label="API ID")
full_api_key = forms.CharField(max_length=254, required=True, label="API Verification Code")
preferred_corp = forms.CharField(max_length=254, required=True, label="Preferred Corp")
is_a_spi = forms.ChoiceField(choices=[('Yes', 'Yes'), ('No', 'No')], required=True, label='Are you a spy?')
about = forms.CharField(widget=forms.Textarea, required=False, label="About You")
extra = forms.CharField(widget=forms.Textarea, required=False, label="Extra Application Info")

View File

@ -6,8 +6,8 @@ class HRApplications(models.Model):
character_name = models.CharField(max_length=254, default="")
full_api_id = models.CharField(max_length=254, default="")
full_api_key = models.CharField(max_length=254, default="")
prefered_corp = models.CharField(max_length=254, default="")
is_a_spi = models.BooleanField(default=False)
preferred_corp = models.CharField(max_length=254, default="")
is_a_spi = models.CharField(max_length=254, default="")
about = models.TextField(default="")
extra = models.TextField(default="")

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,3 +1,27 @@
from django.shortcuts import render
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
# Create your views here.
from forms import HRApplicationForm
@login_required
def hr_application_management_view(request):
context = {}
return render_to_response('registered/hrapplicationmanagement.html',
context, context_instance=RequestContext(request))
@login_required
def hr_application_create_view(request):
if request.method == 'POST':
form = HRApplicationForm(request.POST)
if form.is_valid():
pass
else:
form = HRApplicationForm
context = {'form': form}
return render_to_response('registered/hrcreateapplication.html',
context, context_instance=RequestContext(request))

View File

@ -1,3 +1 @@
from django.contrib import admin
# Register your models here.

View File

@ -1,3 +1 @@
from django.db import models
# Create your models here.

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,13 +1,11 @@
from django.conf import settings
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 eveonline.managers import EveManager
from authentication.managers import AuthServicesInfoManager
# Create your views here.
def index_view(request):
return render_to_response('public/index.html', None, context_instance=RequestContext(request))

View File

@ -1,3 +1 @@
from django.contrib import admin
# Register your models here.

View File

@ -1,3 +1 @@
from django.db import models
# Create your models here.

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -2,11 +2,11 @@ from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from forms import RegistrationForm
def register_user_view(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)

View File

@ -1,3 +1 @@
from django.contrib import admin
# Register your models here.

View File

@ -4,7 +4,6 @@ import evelink.eve
class EveApiManager():
def __init__(self):
pass
@ -34,6 +33,32 @@ class EveApiManager():
return ticker
@staticmethod
def get_alliance_information(alliance_id):
results = {}
try:
api = evelink.api.API()
eve = evelink.eve.EVE(api=api)
alliance = eve.alliances()
results = alliance[0][int(alliance_id)]
except evelink.api.APIError as error:
print error
return results
@staticmethod
def get_corporation_information(corp_id):
results = {}
try:
api = evelink.api.API()
corp = evelink.corp.Corp(api=api)
corpinfo = corp.corporation_sheet(corp_id=int(corp_id))
results = corpinfo[0]
except evelink.api.APIError as error:
print error
return results
@staticmethod
def check_api_is_type_account(api_id, api_key):
try:

View File

@ -1,12 +1,12 @@
import os
import calendar
from datetime import datetime
from passlib.apps import phpbb3_context
from django.db import connections
class ForumManager:
SQL_ADD_USER = r"INSERT INTO phpbb_users (username, username_clean, " \
r"user_password, user_email, group_id, user_regdate, user_permissions, " \
r"user_sig, user_occ, user_interests) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
@ -89,7 +89,7 @@ class ForumManager:
@staticmethod
def __create_group(groupname):
cursor = connections['phpbb3'].cursor()
cursor.execute(ForumManager.SQL_ADD_GROUP, [groupname,groupname])
cursor.execute(ForumManager.SQL_ADD_GROUP, [groupname, groupname])
return ForumManager.__get_group_id(groupname)
@staticmethod

View File

@ -1,18 +1,17 @@
import os
import time
from urlparse import urlparse
import xmpp
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.conf import settings
from openfire import exception
from openfire import UserService
from urlparse import urlparse
from authentication.managers import AuthServicesInfoManager
from eveonline.managers import EveManager
class JabberManager:
def __init__(self):
pass
@ -83,7 +82,7 @@ class JabberManager:
@staticmethod
def delete_user_groups(username, groups):
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
api.delete_group(username,groups)
api.delete_group(username, groups)
@staticmethod
def send_broadcast_message(group_name, broadcast_message):
@ -98,7 +97,7 @@ class JabberManager:
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
if auth_info:
if auth_info.jabber_username != "":
to_address = auth_info.jabber_username+'@'+settings.JABBER_URL
to_address = auth_info.jabber_username + '@' + settings.JABBER_URL
message = xmpp.Message(to_address, broadcast_message)
message.setAttr('type', 'chat')
client.send(message)
@ -108,11 +107,10 @@ class JabberManager:
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
if auth_info:
if auth_info.jabber_username != "":
to_address = auth_info.jabber_username+'@'+settings.JABBER_URL
to_address = auth_info.jabber_username + '@' + settings.JABBER_URL
message = xmpp.Message(to_address, broadcast_message)
message.setAttr('type', 'chat')
client.send(message)
client.Process(1)
client.disconnect()

View File

@ -1,11 +1,11 @@
import os
import hashlib
from django.db import connections
from django.conf import settings
class MumbleManager:
SQL_SELECT_USER_MAX_ID = r"SELECT max(user_id)+1 as next_id from murmur_users"
SQL_SELECT_GROUP_MAX_ID = r"SELECT MAX(group_id)+1 FROM murmur_groups"
@ -54,7 +54,7 @@ class MumbleManager:
@staticmethod
def __generate_username(username, corp_ticker):
return "["+corp_ticker+"]"+username
return "[" + corp_ticker + "]" + username
@staticmethod
def _gen_pwhash(password):

View File

@ -1,3 +1 @@
from django.db import models
# Create your models here.

View File

@ -1,3 +1 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,21 +1,17 @@
from django.template import RequestContext
from django.shortcuts import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import permission_required
from managers.jabber_manager import JabberManager
from managers.forum_manager import ForumManager
from managers.mumble_manager import MumbleManager
from authentication.managers import AuthServicesInfoManager
from eveonline.managers import EveManager
from celerytask.tasks import update_jabber_groups
from celerytask.tasks import update_mumble_groups
from celerytask.tasks import update_forum_groups
from forms import JabberBroadcastForm
from forms import FleetFormatterForm
@ -25,16 +21,18 @@ def fleet_formatter_view(request):
if request.method == 'POST':
form = FleetFormatterForm(request.POST)
if form.is_valid():
generated = "Fleet Name: "+form.cleaned_data['fleet_name']+"\n"
generated = generated + "FC: "+form.cleaned_data['fleet_commander']+"\n"
generated = generated + "Comms: "+form.cleaned_data['fleet_comms']+"\n"
generated = generated + "Fleet Type: "+form.cleaned_data['fleet_type'] + " || " + form.cleaned_data['ship_priorities']+"\n"
generated = generated + "Form Up: "+form.cleaned_data['formup_location']+" @ "+form.cleaned_data['formup_time']+"\n"
generated = generated + "Duration: "+form.cleaned_data['expected_duration']+"\n"
generated = generated + "Reimbursable: "+form.cleaned_data['reimbursable']+"\n"
generated = generated + "Important: "+form.cleaned_data['important']+"\n"
generated = "Fleet Name: " + form.cleaned_data['fleet_name'] + "\n"
generated = generated + "FC: " + form.cleaned_data['fleet_commander'] + "\n"
generated = generated + "Comms: " + form.cleaned_data['fleet_comms'] + "\n"
generated = generated + "Fleet Type: " + form.cleaned_data['fleet_type'] + " || " + form.cleaned_data[
'ship_priorities'] + "\n"
generated = generated + "Form Up: " + form.cleaned_data['formup_location'] + " @ " + form.cleaned_data[
'formup_time'] + "\n"
generated = generated + "Duration: " + form.cleaned_data['expected_duration'] + "\n"
generated = generated + "Reimbursable: " + form.cleaned_data['reimbursable'] + "\n"
generated = generated + "Important: " + form.cleaned_data['important'] + "\n"
if form.cleaned_data['comments'] != "":
generated = generated + "Why: "+form.cleaned_data['comments']+"\n"
generated = generated + "Why: " + form.cleaned_data['comments'] + "\n"
else:
form = FleetFormatterForm()
generated = ""
@ -64,7 +62,8 @@ def jabber_broadcast_view(request):
def services_view(request):
authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
return render_to_response('registered/services.html', {'authinfo': authinfo}, context_instance=RequestContext(request))
return render_to_response('registered/services.html', {'authinfo': authinfo},
context_instance=RequestContext(request))
@login_required

View File

@ -6,7 +6,7 @@ body {
margin: 0;
padding: 0;
font-size: 12px;
font-family: "Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;
font-family: "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
color: #333;
background: #fff;
}
@ -42,7 +42,7 @@ p {
line-height: 140%;
}
h1,h2,h3,h4,h5 {
h1, h2, h3, h4, h5 {
font-weight: bold;
}
@ -328,7 +328,7 @@ thead th.sorted .text {
table thead th .text span {
padding: 2px 5px;
display:block;
display: block;
}
table thead th .text a {
@ -405,7 +405,7 @@ table.orderable tbody tr td:first-child {
background-repeat: repeat-y;
}
table.orderable-initalized .order-cell, body>tr>td.order-cell {
table.orderable-initalized .order-cell, body > tr > td.order-cell {
display: none;
}
@ -469,7 +469,6 @@ textarea, select, .vTextField {
opacity: 0.4;
}
/* MODULES */
.module {
@ -526,11 +525,11 @@ ul.messagelist li {
background: #ffc url(../img/icon_success.gif) 5px .3em no-repeat;
}
ul.messagelist li.warning{
ul.messagelist li.warning {
background-image: url(../img/icon_alert.gif);
}
ul.messagelist li.error{
ul.messagelist li.error {
background-image: url(../img/icon_error.gif);
}
@ -642,7 +641,7 @@ a.deletelink:hover {
.object-tools {
font-size: 10px;
font-weight: bold;
font-family: Arial,Helvetica,sans-serif;
font-family: Arial, Helvetica, sans-serif;
padding-left: 0;
float: right;
position: relative;

View File

@ -9,7 +9,9 @@
width: 100%;
}
.change-list .hiddenfields { display:none; }
.change-list .hiddenfields {
display: none;
}
.change-list .filtered table {
border-right: 1px solid #ddd;
@ -75,7 +77,7 @@
}
#changelist table tbody td.action-checkbox {
text-align:center;
text-align: center;
}
#changelist table tfoot {

View File

@ -154,7 +154,7 @@ fieldset.collapsed .collapse-toggle {
/* MONOSPACE TEXTAREAS */
fieldset.monospace textarea {
font-family: "Bitstream Vera Sans Mono",Monaco,"Courier New",Courier,monospace;
font-family: "Bitstream Vera Sans Mono", Monaco, "Courier New", Courier, monospace;
}
/* SUBMIT ROW */

View File

@ -129,10 +129,10 @@ thead th.sorted .text {
}
.filtered .actions {
border-left:1px solid #DDDDDD;
margin-left:160px !important;
border-left: 1px solid #DDDDDD;
margin-left: 160px !important;
border-right: 0 none;
margin-right:0 !important;
margin-right: 0 !important;
}
#changelist table tbody td:first-child, #changelist table tbody th:first-child {
@ -231,7 +231,7 @@ fieldset .field-box {
padding-left: inherit;
left: 10px;
right: inherit;
float:left;
float: left;
}
.inline-related h3 span.delete label {

View File

@ -1,6 +1,6 @@
var SelectBox = {
cache: new Object(),
init: function(id) {
init: function (id) {
var box = document.getElementById(id);
var node;
SelectBox.cache[id] = new Array();
@ -9,7 +9,7 @@ var SelectBox = {
cache.push({value: node.value, text: node.text, displayed: 1});
}
},
redisplay: function(id) {
redisplay: function (id) {
// Repopulate HTML select box from cache
var box = document.getElementById(id);
box.options.length = 0; // clear all options
@ -20,7 +20,7 @@ var SelectBox = {
}
}
},
filter: function(id, text) {
filter: function (id, text) {
// Redisplay the HTML select box, displaying only the choices containing ALL
// the words in text. (It's an AND search.)
var tokens = text.toLowerCase().split(/\s+/);
@ -35,7 +35,7 @@ var SelectBox = {
}
SelectBox.redisplay(id);
},
delete_from_cache: function(id, value) {
delete_from_cache: function (id, value) {
var node, delete_index = null;
for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
if (node.value == value) {
@ -45,14 +45,14 @@ var SelectBox = {
}
var j = SelectBox.cache[id].length - 1;
for (var i = delete_index; i < j; i++) {
SelectBox.cache[id][i] = SelectBox.cache[id][i+1];
SelectBox.cache[id][i] = SelectBox.cache[id][i + 1];
}
SelectBox.cache[id].length--;
},
add_to_cache: function(id, option) {
add_to_cache: function (id, option) {
SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1});
},
cache_contains: function(id, value) {
cache_contains: function (id, value) {
// Check if an item is contained in the cache
var node;
for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
@ -62,7 +62,7 @@ var SelectBox = {
}
return false;
},
move: function(from, to) {
move: function (from, to) {
var from_box = document.getElementById(from);
var to_box = document.getElementById(to);
var option;
@ -75,7 +75,7 @@ var SelectBox = {
SelectBox.redisplay(from);
SelectBox.redisplay(to);
},
move_all: function(from, to) {
move_all: function (from, to) {
var from_box = document.getElementById(from);
var to_box = document.getElementById(to);
var option;
@ -88,8 +88,8 @@ var SelectBox = {
SelectBox.redisplay(from);
SelectBox.redisplay(to);
},
sort: function(id) {
SelectBox.cache[id].sort( function(a, b) {
sort: function (id) {
SelectBox.cache[id].sort(function (a, b) {
a = a.text.toLowerCase();
b = b.text.toLowerCase();
try {
@ -100,9 +100,9 @@ var SelectBox = {
// silently fail on IE 'unknown' exception
}
return 0;
} );
});
},
select_all: function(id) {
select_all: function (id) {
var box = document.getElementById(id);
for (var i = 0; i < box.options.length; i++) {
box.options[i].selected = 'selected';

View File

@ -1,20 +1,20 @@
/*
SelectFilter2 - Turns a multiple-select box into a filter interface.
SelectFilter2 - Turns a multiple-select box into a filter interface.
Requires core.js, SelectBox.js and addevent.js.
*/
(function($) {
function findForm(node) {
Requires core.js, SelectBox.js and addevent.js.
*/
(function ($) {
function findForm(node) {
// returns the node of the form containing the given node
if (node.tagName.toLowerCase() != 'form') {
return findForm(node.parentNode);
}
return node;
}
}
window.SelectFilter = {
init: function(field_id, field_name, is_stacked, admin_static_prefix) {
if (field_id.match(/__prefix__/)){
window.SelectFilter = {
init: function (field_id, field_name, is_stacked, admin_static_prefix) {
if (field_id.match(/__prefix__/)) {
// Don't intialize on empty forms.
return;
}
@ -23,7 +23,7 @@ window.SelectFilter = {
from_box.className = 'filtered';
var ps = from_box.parentNode.getElementsByTagName('p');
for (var i=0; i<ps.length; i++) {
for (var i = 0; i < ps.length; i++) {
if (ps[i].className.indexOf("info") != -1) {
// Remove <p class="info">, because it just gets in the way.
from_box.parentNode.removeChild(ps[i]);
@ -83,13 +83,29 @@ window.SelectFilter = {
from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
// Set up the JavaScript event handlers for the select box filter interface
addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
addEvent(from_box, 'change', function(e) { SelectFilter.refresh_icons(field_id) });
addEvent(to_box, 'change', function(e) { SelectFilter.refresh_icons(field_id) });
addEvent(from_box, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); SelectFilter.refresh_icons(field_id); });
addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); SelectFilter.refresh_icons(field_id); });
addEvent(findForm(from_box), 'submit', function() { SelectBox.select_all(field_id + '_to'); });
addEvent(filter_input, 'keyup', function (e) {
SelectFilter.filter_key_up(e, field_id);
});
addEvent(filter_input, 'keydown', function (e) {
SelectFilter.filter_key_down(e, field_id);
});
addEvent(from_box, 'change', function (e) {
SelectFilter.refresh_icons(field_id)
});
addEvent(to_box, 'change', function (e) {
SelectFilter.refresh_icons(field_id)
});
addEvent(from_box, 'dblclick', function () {
SelectBox.move(field_id + '_from', field_id + '_to');
SelectFilter.refresh_icons(field_id);
});
addEvent(to_box, 'dblclick', function () {
SelectBox.move(field_id + '_to', field_id + '_from');
SelectFilter.refresh_icons(field_id);
});
addEvent(findForm(from_box), 'submit', function () {
SelectBox.select_all(field_id + '_to');
});
SelectBox.init(field_id + '_from');
SelectBox.init(field_id + '_to');
// Move selected from_box options to to_box
@ -99,7 +115,9 @@ window.SelectFilter = {
// In horizontal mode, give the same height to the two boxes.
var j_from_box = $(from_box);
var j_to_box = $(to_box);
var resize_filters = function() { j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight()); }
var resize_filters = function () {
j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight());
}
if (j_from_box.outerHeight() > 0) {
resize_filters(); // This fieldset is already open. Resize now.
} else {
@ -111,7 +129,7 @@ window.SelectFilter = {
// Initial icon refresh
SelectFilter.refresh_icons(field_id);
},
refresh_icons: function(field_id) {
refresh_icons: function (field_id) {
var from = $('#' + field_id + '_from');
var to = $('#' + field_id + '_to');
var is_from_selected = from.find('option:selected').length > 0;
@ -123,7 +141,7 @@ window.SelectFilter = {
$('#' + field_id + '_add_all_link').toggleClass('active', from.find('option').length > 0);
$('#' + field_id + '_remove_all_link').toggleClass('active', to.find('option').length > 0);
},
filter_key_up: function(event, field_id) {
filter_key_up: function (event, field_id) {
var from = document.getElementById(field_id + '_from');
// don't submit form if user pressed Enter
if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
@ -137,7 +155,7 @@ window.SelectFilter = {
from.selectedIndex = temp;
return true;
},
filter_key_down: function(event, field_id) {
filter_key_down: function (event, field_id) {
var from = document.getElementById(field_id + '_from');
// right arrow -- move across
if ((event.which && event.which == 39) || (event.keyCode && event.keyCode == 39)) {
@ -156,6 +174,6 @@ window.SelectFilter = {
}
return true;
}
}
}
})(django.jQuery);

View File

@ -1,9 +1,9 @@
(function($) {
$.fn.actions = function(opts) {
(function ($) {
$.fn.actions = function (opts) {
var options = $.extend({}, $.fn.actions.defaults, opts);
var actionCheckboxes = $(this);
var list_editable_changed = false;
var checker = function(checked) {
var checker = function (checked) {
if (checked) {
showQuestion();
} else {
@ -12,14 +12,14 @@
$(actionCheckboxes).prop("checked", checked)
.parent().parent().toggleClass(options.selectedClass, checked);
},
updateCounter = function() {
updateCounter = function () {
var sel = $(actionCheckboxes).filter(":checked").length;
$(options.counterContainer).html(interpolate(
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
sel: sel,
cnt: _actions_icnt
}, true));
$(options.allToggle).prop("checked", function() {
$(options.allToggle).prop("checked", function () {
if (sel == actionCheckboxes.length) {
value = true;
showQuestion();
@ -30,25 +30,25 @@
return value;
});
},
showQuestion = function() {
showQuestion = function () {
$(options.acrossClears).hide();
$(options.acrossQuestions).show();
$(options.allContainer).hide();
},
showClear = function() {
showClear = function () {
$(options.acrossClears).show();
$(options.acrossQuestions).hide();
$(options.actionContainer).toggleClass(options.selectedClass);
$(options.allContainer).show();
$(options.counterContainer).hide();
},
reset = function() {
reset = function () {
$(options.acrossClears).hide();
$(options.acrossQuestions).hide();
$(options.allContainer).hide();
$(options.counterContainer).show();
},
clearAcross = function() {
clearAcross = function () {
reset();
$(options.acrossInput).val(0);
$(options.actionContainer).removeClass(options.selectedClass);
@ -56,23 +56,23 @@
// Show counter by default
$(options.counterContainer).show();
// Check state of checkboxes and reinit state if needed
$(this).filter(":checked").each(function(i) {
$(this).filter(":checked").each(function (i) {
$(this).parent().parent().toggleClass(options.selectedClass);
updateCounter();
if ($(options.acrossInput).val() == 1) {
showClear();
}
});
$(options.allToggle).show().click(function() {
$(options.allToggle).show().click(function () {
checker($(this).prop("checked"));
updateCounter();
});
$("div.actions span.question a").click(function(event) {
$("div.actions span.question a").click(function (event) {
event.preventDefault();
$(options.acrossInput).val(1);
showClear();
});
$("div.actions span.clear a").click(function(event) {
$("div.actions span.clear a").click(function (event) {
event.preventDefault();
$(options.allToggle).prop("checked", false);
clearAcross();
@ -80,14 +80,16 @@
updateCounter();
});
lastChecked = null;
$(actionCheckboxes).click(function(event) {
if (!event) { event = window.event; }
$(actionCheckboxes).click(function (event) {
if (!event) {
event = window.event;
}
var target = event.target ? event.target : event.srcElement;
if (lastChecked && $.data(lastChecked) != $.data(target) && event.shiftKey === true) {
var inrange = false;
$(lastChecked).prop("checked", target.checked)
.parent().parent().toggleClass(options.selectedClass, target.checked);
$(actionCheckboxes).each(function() {
$(actionCheckboxes).each(function () {
if ($.data(this) == $.data(lastChecked) || $.data(this) == $.data(target)) {
inrange = (inrange) ? false : true;
}
@ -101,17 +103,17 @@
lastChecked = target;
updateCounter();
});
$('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function() {
$('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function () {
list_editable_changed = true;
});
$('form#changelist-form button[name="index"]').click(function(event) {
$('form#changelist-form button[name="index"]').click(function (event) {
if (list_editable_changed) {
return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."));
}
});
$('form#changelist-form input[name="_save"]').click(function(event) {
$('form#changelist-form input[name="_save"]').click(function (event) {
var action_changed = false;
$('div.actions select option:selected').each(function() {
$('div.actions select option:selected').each(function () {
if ($(this).val()) {
action_changed = true;
}

View File

@ -1,6 +1,96 @@
(function(a){a.fn.actions=function(n){var b=a.extend({},a.fn.actions.defaults,n),e=a(this),g=false,k=function(c){c?i():j();a(e).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},f=function(){var c=a(e).filter(":checked").length;a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:_actions_icnt},true));a(b.allToggle).prop("checked",function(){if(c==e.length){value=true;i()}else{value=false;l()}return value})},i=
function(){a(b.acrossClears).hide();a(b.acrossQuestions).show();a(b.allContainer).hide()},m=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},j=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},l=function(){j();a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)};a(b.counterContainer).show();
a(this).filter(":checked").each(function(){a(this).parent().parent().toggleClass(b.selectedClass);f();a(b.acrossInput).val()==1&&m()});a(b.allToggle).show().click(function(){k(a(this).prop("checked"));f()});a("div.actions span.question a").click(function(c){c.preventDefault();a(b.acrossInput).val(1);m()});a("div.actions span.clear a").click(function(c){c.preventDefault();a(b.allToggle).prop("checked",false);l();k(0);f()});lastChecked=null;a(e).click(function(c){if(!c)c=window.event;var d=c.target?
c.target:c.srcElement;if(lastChecked&&a.data(lastChecked)!=a.data(d)&&c.shiftKey===true){var h=false;a(lastChecked).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked);a(e).each(function(){if(a.data(this)==a.data(lastChecked)||a.data(this)==a.data(d))h=h?false:true;h&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);lastChecked=d;f()});a("form#changelist-form table#result_list tr").find("td:gt(0) :input").change(function(){g=
true});a('form#changelist-form button[name="index"]').click(function(){if(g)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))});a('form#changelist-form input[name="_save"]').click(function(){var c=false;a("div.actions select option:selected").each(function(){if(a(this).val())c=true});if(c)return g?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")):
confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})};a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"}})(django.jQuery);
(function (a) {
a.fn.actions = function (n) {
var b = a.extend({}, a.fn.actions.defaults, n), e = a(this), g = false, k = function (c) {
c ? i() : j();
a(e).prop("checked", c).parent().parent().toggleClass(b.selectedClass, c)
}, f = function () {
var c = a(e).filter(":checked").length;
a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected", "%(sel)s of %(cnt)s selected", c), {sel: c, cnt: _actions_icnt}, true));
a(b.allToggle).prop("checked", function () {
if (c == e.length) {
value = true;
i()
} else {
value = false;
l()
}
return value
})
}, i =
function () {
a(b.acrossClears).hide();
a(b.acrossQuestions).show();
a(b.allContainer).hide()
}, m = function () {
a(b.acrossClears).show();
a(b.acrossQuestions).hide();
a(b.actionContainer).toggleClass(b.selectedClass);
a(b.allContainer).show();
a(b.counterContainer).hide()
}, j = function () {
a(b.acrossClears).hide();
a(b.acrossQuestions).hide();
a(b.allContainer).hide();
a(b.counterContainer).show()
}, l = function () {
j();
a(b.acrossInput).val(0);
a(b.actionContainer).removeClass(b.selectedClass)
};
a(b.counterContainer).show();
a(this).filter(":checked").each(function () {
a(this).parent().parent().toggleClass(b.selectedClass);
f();
a(b.acrossInput).val() == 1 && m()
});
a(b.allToggle).show().click(function () {
k(a(this).prop("checked"));
f()
});
a("div.actions span.question a").click(function (c) {
c.preventDefault();
a(b.acrossInput).val(1);
m()
});
a("div.actions span.clear a").click(function (c) {
c.preventDefault();
a(b.allToggle).prop("checked", false);
l();
k(0);
f()
});
lastChecked = null;
a(e).click(function (c) {
if (!c)c = window.event;
var d = c.target ?
c.target : c.srcElement;
if (lastChecked && a.data(lastChecked) != a.data(d) && c.shiftKey === true) {
var h = false;
a(lastChecked).prop("checked", d.checked).parent().parent().toggleClass(b.selectedClass, d.checked);
a(e).each(function () {
if (a.data(this) == a.data(lastChecked) || a.data(this) == a.data(d))h = h ? false : true;
h && a(this).prop("checked", d.checked).parent().parent().toggleClass(b.selectedClass, d.checked)
})
}
a(d).parent().parent().toggleClass(b.selectedClass, d.checked);
lastChecked = d;
f()
});
a("form#changelist-form table#result_list tr").find("td:gt(0) :input").change(function () {
g =
true
});
a('form#changelist-form button[name="index"]').click(function () {
if (g)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))
});
a('form#changelist-form input[name="_save"]').click(function () {
var c = false;
a("div.actions select option:selected").each(function () {
if (a(this).val())c = true
});
if (c)return g ? confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")) :
confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))
})
};
a.fn.actions.defaults = {actionContainer: "div.actions", counterContainer: "span.action-counter", allContainer: "div.actions span.all", acrossInput: "div.actions input.select-across", acrossQuestions: "div.actions span.question", acrossClears: "div.actions span.clear", allToggle: "#action-toggle", selectedClass: "selected"}
})(django.jQuery);

View File

@ -15,7 +15,7 @@ var DateTimeShortcuts = {
clockLinkName: 'clocklink', // name of the link that is used to toggle
shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
admin_media_prefix: '',
init: function() {
init: function () {
// Get admin_media_prefix by grabbing it off the window object. It's
// set in the admin/base.html template, so if it's not there, someone's
// overridden the template. In that case, we'll set a clearly-invalid
@ -27,7 +27,7 @@ var DateTimeShortcuts = {
}
var inputs = document.getElementsByTagName('input');
for (i=0; i<inputs.length; i++) {
for (i = 0; i < inputs.length; i++) {
var inp = inputs[i];
if (inp.getAttribute('type') == 'text' && inp.className.match(/vTimeField/)) {
DateTimeShortcuts.addClock(inp);
@ -38,10 +38,13 @@ var DateTimeShortcuts = {
}
},
// Add clock widget to a given field
addClock: function(inp) {
addClock: function (inp) {
var num = DateTimeShortcuts.clockInputs.length;
DateTimeShortcuts.clockInputs[num] = inp;
DateTimeShortcuts.dismissClockFunc[num] = function() { DateTimeShortcuts.dismissClock(num); return true; };
DateTimeShortcuts.dismissClockFunc[num] = function () {
DateTimeShortcuts.dismissClock(num);
return true;
};
// Shortcut links (clock icon and "Now" link)
var shortcuts_span = document.createElement('span');
@ -93,7 +96,7 @@ var DateTimeShortcuts = {
var cancel_p = quickElement('p', clock_box, '');
cancel_p.className = 'calendar-cancel';
quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissClock(' + num + ');');
django.jQuery(document).bind('keyup', function(event) {
django.jQuery(document).bind('keyup', function (event) {
if (event.which == 27) {
// ESC key closes popup
DateTimeShortcuts.dismissClock(num);
@ -101,13 +104,13 @@ var DateTimeShortcuts = {
}
});
},
openClock: function(num) {
var clock_box = document.getElementById(DateTimeShortcuts.clockDivName+num)
var clock_link = document.getElementById(DateTimeShortcuts.clockLinkName+num)
openClock: function (num) {
var clock_box = document.getElementById(DateTimeShortcuts.clockDivName + num)
var clock_link = document.getElementById(DateTimeShortcuts.clockLinkName + num)
// Recalculate the clockbox position
// is it left-to-right or right-to-left layout ?
if (getStyle(document.body,'direction')!='rtl') {
if (getStyle(document.body, 'direction') != 'rtl') {
clock_box.style.left = findPosX(clock_link) + 17 + 'px';
}
else {
@ -123,21 +126,24 @@ var DateTimeShortcuts = {
clock_box.style.display = 'block';
addEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
},
dismissClock: function(num) {
dismissClock: function (num) {
document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
removeEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
},
handleClockQuicklink: function(num, val) {
handleClockQuicklink: function (num, val) {
DateTimeShortcuts.clockInputs[num].value = val;
DateTimeShortcuts.clockInputs[num].focus();
DateTimeShortcuts.dismissClock(num);
},
// Add calendar widget to a given field.
addCalendar: function(inp) {
addCalendar: function (inp) {
var num = DateTimeShortcuts.calendars.length;
DateTimeShortcuts.calendarInputs[num] = inp;
DateTimeShortcuts.dismissCalendarFunc[num] = function() { DateTimeShortcuts.dismissCalendar(num); return true; };
DateTimeShortcuts.dismissCalendarFunc[num] = function () {
DateTimeShortcuts.dismissCalendar(num);
return true;
};
// Shortcut links (calendar icon and "Today" link)
var shortcuts_span = document.createElement('span');
@ -182,9 +188,9 @@ var DateTimeShortcuts = {
// next-prev links
var cal_nav = quickElement('div', cal_box, '');
var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');');
var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev(' + num + ');');
cal_nav_prev.className = 'calendarnav-previous';
var cal_nav_next = quickElement('a', cal_nav, '>', 'href', 'javascript:DateTimeShortcuts.drawNext('+num+');');
var cal_nav_next = quickElement('a', cal_nav, '>', 'href', 'javascript:DateTimeShortcuts.drawNext(' + num + ');');
cal_nav_next.className = 'calendarnav-next';
// main box
@ -206,7 +212,7 @@ var DateTimeShortcuts = {
var cancel_p = quickElement('p', cal_box, '');
cancel_p.className = 'calendar-cancel';
quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissCalendar(' + num + ');');
django.jQuery(document).bind('keyup', function(event) {
django.jQuery(document).bind('keyup', function (event) {
if (event.which == 27) {
// ESC key closes popup
DateTimeShortcuts.dismissCalendar(num);
@ -214,9 +220,9 @@ var DateTimeShortcuts = {
}
});
},
openCalendar: function(num) {
var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num)
var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName+num)
openCalendar: function (num) {
var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1 + num)
var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName + num)
var inp = DateTimeShortcuts.calendarInputs[num];
// Determine if the current value in the input has a valid date.
@ -232,7 +238,7 @@ var DateTimeShortcuts = {
// Recalculate the clockbox position
// is it left-to-right or right-to-left layout ?
if (getStyle(document.body,'direction')!='rtl') {
if (getStyle(document.body, 'direction') != 'rtl') {
cal_box.style.left = findPosX(cal_link) + 17 + 'px';
}
else {
@ -247,17 +253,17 @@ var DateTimeShortcuts = {
cal_box.style.display = 'block';
addEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
},
dismissCalendar: function(num) {
document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'none';
dismissCalendar: function (num) {
document.getElementById(DateTimeShortcuts.calendarDivName1 + num).style.display = 'none';
removeEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
},
drawPrev: function(num) {
drawPrev: function (num) {
DateTimeShortcuts.calendars[num].drawPreviousMonth();
},
drawNext: function(num) {
drawNext: function (num) {
DateTimeShortcuts.calendars[num].drawNextMonth();
},
handleCalendarCallback: function(num) {
handleCalendarCallback: function (num) {
format = get_format('DATE_INPUT_FORMATS')[0];
// the format needs to be escaped a little
format = format.replace('\\', '\\\\');
@ -275,7 +281,7 @@ var DateTimeShortcuts = {
num,
").style.display='none';}"].join('');
},
handleCalendarQuickLink: function(num, offset) {
handleCalendarQuickLink: function (num, offset) {
var d = new Date();
d.setDate(d.getDate() + offset)
DateTimeShortcuts.calendarInputs[num].value = d.strftime(get_format('DATE_INPUT_FORMATS')[0]);

View File

@ -1,25 +1,25 @@
/*
calendar.js - Calendar functions by Adrian Holovaty
depends on core.js for utility functions like removeChildren or quickElement
*/
calendar.js - Calendar functions by Adrian Holovaty
depends on core.js for utility functions like removeChildren or quickElement
*/
// CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
var CalendarNamespace = {
monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
daysOfWeek: gettext('S M T W T F S').split(' '),
firstDayOfWeek: parseInt(get_format('FIRST_DAY_OF_WEEK')),
isLeapYear: function(year) {
return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
isLeapYear: function (year) {
return (((year % 4) == 0) && ((year % 100) != 0) || ((year % 400) == 0));
},
getDaysInMonth: function(month,year) {
getDaysInMonth: function (month, year) {
var days;
if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) {
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
days = 31;
}
else if (month==4 || month==6 || month==9 || month==11) {
else if (month == 4 || month == 6 || month == 9 || month == 11) {
days = 30;
}
else if (month==2 && CalendarNamespace.isLeapYear(year)) {
else if (month == 2 && CalendarNamespace.isLeapYear(year)) {
days = 29;
}
else {
@ -27,10 +27,10 @@ var CalendarNamespace = {
}
return days;
},
draw: function(month, year, div_id, callback) { // month = 1-12, year = 1-9999
draw: function (month, year, div_id, callback) { // month = 1-12, year = 1-9999
var today = new Date();
var todayDay = today.getDate();
var todayMonth = today.getMonth()+1;
var todayMonth = today.getMonth() + 1;
var todayYear = today.getFullYear();
var todayClass = '';
@ -39,7 +39,7 @@ var CalendarNamespace = {
var calDiv = document.getElementById(div_id);
removeChildren(calDiv);
var calTable = document.createElement('table');
quickElement('caption', calTable, CalendarNamespace.monthsOfYear[month-1] + ' ' + year);
quickElement('caption', calTable, CalendarNamespace.monthsOfYear[month - 1] + ' ' + year);
var tableBody = quickElement('tbody', calTable);
// Draw days-of-week header
@ -48,7 +48,7 @@ var CalendarNamespace = {
quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
}
var startingPos = new Date(year, month-1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
var startingPos = new Date(year, month - 1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
var days = CalendarNamespace.getDaysInMonth(month, year);
// Draw blanks before first of month
@ -61,17 +61,17 @@ var CalendarNamespace = {
// Draw days of month
var currentDay = 1;
for (var i = startingPos; currentDay <= days; i++) {
if (i%7 == 0 && currentDay != 1) {
if (i % 7 == 0 && currentDay != 1) {
tableRow = quickElement('tr', tableBody);
}
if ((currentDay==todayDay) && (month==todayMonth) && (year==todayYear)) {
todayClass='today';
if ((currentDay == todayDay) && (month == todayMonth) && (year == todayYear)) {
todayClass = 'today';
} else {
todayClass='';
todayClass = '';
}
var cell = quickElement('td', tableRow, '', 'class', todayClass);
quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));');
quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '(' + year + ',' + month + ',' + currentDay + '));');
currentDay++;
}
@ -99,15 +99,15 @@ function Calendar(div_id, callback) {
this.currentYear = this.today.getFullYear();
}
Calendar.prototype = {
drawCurrent: function() {
drawCurrent: function () {
CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback);
},
drawDate: function(month, year) {
drawDate: function (month, year) {
this.currentMonth = month;
this.currentYear = year;
this.drawCurrent();
},
drawPreviousMonth: function() {
drawPreviousMonth: function () {
if (this.currentMonth == 1) {
this.currentMonth = 12;
this.currentYear--;
@ -117,7 +117,7 @@ Calendar.prototype = {
}
this.drawCurrent();
},
drawNextMonth: function() {
drawNextMonth: function () {
if (this.currentMonth == 12) {
this.currentMonth = 1;
this.currentYear++;
@ -127,11 +127,11 @@ Calendar.prototype = {
}
this.drawCurrent();
},
drawPreviousYear: function() {
drawPreviousYear: function () {
this.currentYear--;
this.drawCurrent();
},
drawNextYear: function() {
drawNextYear: function () {
this.currentYear++;
this.drawCurrent();
}

View File

@ -1,16 +1,16 @@
(function($) {
$(document).ready(function() {
(function ($) {
$(document).ready(function () {
// Add anchor tag for Show/Hide link
$("fieldset.collapse").each(function(i, elem) {
$("fieldset.collapse").each(function (i, elem) {
// Don't hide if fields in this fieldset have errors
if ($(elem).find("div.errors").length == 0) {
$(elem).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser' +
i +'" class="collapse-toggle" href="#">' + gettext("Show") +
i + '" class="collapse-toggle" href="#">' + gettext("Show") +
'</a>)');
}
});
// Add toggle to anchor tag
$("fieldset.collapse a.collapse-toggle").click(function(ev) {
$("fieldset.collapse a.collapse-toggle").click(function (ev) {
if ($(this).closest("fieldset").hasClass("collapsed")) {
// Show
$(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]);

View File

@ -1,2 +1,12 @@
(function(a){a(document).ready(function(){a("fieldset.collapse").each(function(c,b){0==a(b).find("div.errors").length&&a(b).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser'+c+'" class="collapse-toggle" href="#">'+gettext("Show")+"</a>)")});a("fieldset.collapse a.collapse-toggle").click(function(){a(this).closest("fieldset").hasClass("collapsed")?a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset",[a(this).attr("id")]):a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset",
[a(this).attr("id")]);return!1})})})(django.jQuery);
(function (a) {
a(document).ready(function () {
a("fieldset.collapse").each(function (c, b) {
0 == a(b).find("div.errors").length && a(b).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser' + c + '" class="collapse-toggle" href="#">' + gettext("Show") + "</a>)")
});
a("fieldset.collapse a.collapse-toggle").click(function () {
a(this).closest("fieldset").hasClass("collapsed") ? a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [a(this).attr("id")]) : a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset",
[a(this).attr("id")]);
return!1
})
})
})(django.jQuery);

View File

@ -1,7 +1,7 @@
// Core javascript helper functions
// basic browser identification & version
var isOpera = (navigator.userAgent.indexOf("Opera")>=0) && parseFloat(navigator.appVersion);
var isOpera = (navigator.userAgent.indexOf("Opera") >= 0) && parseFloat(navigator.appVersion);
var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]);
// Cross-browser event handlers.
@ -44,7 +44,7 @@ function quickElement() {
}
var len = arguments.length;
for (var i = 3; i < len; i += 2) {
obj.setAttribute(arguments[i], arguments[i+1]);
obj.setAttribute(arguments[i], arguments[i + 1]);
}
arguments[1].appendChild(obj);
return obj;
@ -71,9 +71,9 @@ var xmlhttp;
xmlhttp = false;
}
}
@else
@else
xmlhttp = false;
@end @*/
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
@ -90,7 +90,7 @@ function findPosX(obj) {
obj = obj.offsetParent;
}
// IE offsetParent does not include the top-level
if (isIE && obj.parentElement){
if (isIE && obj.parentElement) {
curleft += obj.offsetLeft - obj.scrollLeft;
}
} else if (obj.x) {
@ -107,7 +107,7 @@ function findPosY(obj) {
obj = obj.offsetParent;
}
// IE offsetParent does not include the top-level
if (isIE && obj.parentElement){
if (isIE && obj.parentElement) {
curtop += obj.offsetTop - obj.scrollTop;
}
} else if (obj.y) {
@ -120,49 +120,49 @@ function findPosY(obj) {
// Date object extensions
// ----------------------------------------------------------------------------
Date.prototype.getTwelveHours = function() {
Date.prototype.getTwelveHours = function () {
hours = this.getHours();
if (hours == 0) {
return 12;
}
else {
return hours <= 12 ? hours : hours-12
return hours <= 12 ? hours : hours - 12
}
}
Date.prototype.getTwoDigitMonth = function() {
return (this.getMonth() < 9) ? '0' + (this.getMonth()+1) : (this.getMonth()+1);
Date.prototype.getTwoDigitMonth = function () {
return (this.getMonth() < 9) ? '0' + (this.getMonth() + 1) : (this.getMonth() + 1);
}
Date.prototype.getTwoDigitDate = function() {
Date.prototype.getTwoDigitDate = function () {
return (this.getDate() < 10) ? '0' + this.getDate() : this.getDate();
}
Date.prototype.getTwoDigitTwelveHour = function() {
Date.prototype.getTwoDigitTwelveHour = function () {
return (this.getTwelveHours() < 10) ? '0' + this.getTwelveHours() : this.getTwelveHours();
}
Date.prototype.getTwoDigitHour = function() {
Date.prototype.getTwoDigitHour = function () {
return (this.getHours() < 10) ? '0' + this.getHours() : this.getHours();
}
Date.prototype.getTwoDigitMinute = function() {
Date.prototype.getTwoDigitMinute = function () {
return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes();
}
Date.prototype.getTwoDigitSecond = function() {
Date.prototype.getTwoDigitSecond = function () {
return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds();
}
Date.prototype.getHourMinute = function() {
Date.prototype.getHourMinute = function () {
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute();
}
Date.prototype.getHourMinuteSecond = function() {
Date.prototype.getHourMinuteSecond = function () {
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute() + ':' + this.getTwoDigitSecond();
}
Date.prototype.strftime = function(format) {
Date.prototype.strftime = function (format) {
var fields = {
c: this.toString(),
d: this.getTwoDigitDate(),
@ -177,7 +177,7 @@ Date.prototype.strftime = function(format) {
X: this.toLocaleTimeString(),
y: ('' + this.getFullYear()).substr(2, 4),
Y: '' + this.getFullYear(),
'%' : '%'
'%': '%'
};
var result = '', i = 0;
while (i < format.length) {
@ -196,7 +196,7 @@ Date.prototype.strftime = function(format) {
// ----------------------------------------------------------------------------
// String object extensions
// ----------------------------------------------------------------------------
String.prototype.pad_left = function(pad_length, pad_string) {
String.prototype.pad_left = function (pad_length, pad_string) {
var new_string = this;
for (var i = 0; new_string.length < pad_length; i++) {
new_string = pad_string + new_string;
@ -207,13 +207,13 @@ String.prototype.pad_left = function(pad_length, pad_string) {
// ----------------------------------------------------------------------------
// Get the computed style for and element
// ----------------------------------------------------------------------------
function getStyle(oElm, strCssRule){
function getStyle(oElm, strCssRule) {
var strValue = "";
if(document.defaultView && document.defaultView.getComputedStyle){
if (document.defaultView && document.defaultView.getComputedStyle) {
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
}
else if(oElm.currentStyle){
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
else if (oElm.currentStyle) {
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1) {
return p1.toUpperCase();
});
strValue = oElm.currentStyle[strCssRule];

View File

@ -14,12 +14,12 @@
* Licensed under the New BSD License
* See: http://www.opensource.org/licenses/bsd-license.php
*/
(function($) {
$.fn.formset = function(opts) {
(function ($) {
$.fn.formset = function (opts) {
var options = $.extend({}, $.fn.formset.defaults, opts);
var $this = $(this);
var $parent = $this.parent();
var updateElementIndex = function(el, prefix, ndx) {
var updateElementIndex = function (el, prefix, ndx) {
var id_regex = new RegExp("(" + prefix + "-(\\d+|__prefix__))");
var replacement = prefix + "-" + ndx;
if ($(el).prop("for")) {
@ -37,8 +37,8 @@
var maxForms = $("#id_" + options.prefix + "-MAX_NUM_FORMS").prop("autocomplete", "off");
// only show the add button if we are allowed to add more items,
// note that max_num = None translates to a blank string.
var showAddButton = maxForms.val() === '' || (maxForms.val()-totalForms.val()) > 0;
$this.each(function(i) {
var showAddButton = maxForms.val() === '' || (maxForms.val() - totalForms.val()) > 0;
$this.each(function (i) {
$(this).not("." + options.emptyCssClass).addClass(options.formCssClass);
});
if ($this.length && showAddButton) {
@ -54,7 +54,7 @@
$this.filter(":last").after('<div class="' + options.addCssClass + '"><a href="javascript:void(0)">' + options.addText + "</a></div>");
addButton = $this.filter(":last").next().find("a");
}
addButton.click(function(e) {
addButton.click(function (e) {
e.preventDefault();
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
var template = $("#" + options.prefix + "-empty");
@ -65,17 +65,17 @@
if (row.is("tr")) {
// If the forms are laid out in table rows, insert
// the remove button into the last table cell:
row.children(":last").append('<div><a class="' + options.deleteCssClass +'" href="javascript:void(0)">' + options.deleteText + "</a></div>");
row.children(":last").append('<div><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText + "</a></div>");
} else if (row.is("ul") || row.is("ol")) {
// If they're laid out as an ordered/unordered list,
// insert an <li> after the last list item:
row.append('<li><a class="' + options.deleteCssClass +'" href="javascript:void(0)">' + options.deleteText + "</a></li>");
row.append('<li><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText + "</a></li>");
} else {
// Otherwise, just insert the remove button as the
// last child element of the form's container:
row.children(":first").append('<span><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText + "</a></span>");
}
row.find("*").each(function() {
row.find("*").each(function () {
updateElementIndex(this, options.prefix, totalForms.val());
});
// Insert the new form when it has been fully edited
@ -84,11 +84,11 @@
$(totalForms).val(parseInt(totalForms.val(), 10) + 1);
nextIndex += 1;
// Hide add button in case we've hit the max, except we want to add infinitely
if ((maxForms.val() !== '') && (maxForms.val()-totalForms.val()) <= 0) {
if ((maxForms.val() !== '') && (maxForms.val() - totalForms.val()) <= 0) {
addButton.parent().hide();
}
// The delete button of each row triggers a bunch of other things
row.find("a." + options.deleteCssClass).click(function(e) {
row.find("a." + options.deleteCssClass).click(function (e) {
e.preventDefault();
// Remove the parent form containing this button:
var row = $(this).parents("." + options.formCssClass);
@ -102,15 +102,14 @@
var forms = $("." + options.formCssClass);
$("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
// Show add button again once we drop below max
if ((maxForms.val() === '') || (maxForms.val()-forms.length) > 0) {
if ((maxForms.val() === '') || (maxForms.val() - forms.length) > 0) {
addButton.parent().show();
}
// Also, update names and ids for all remaining form controls
// so they remain in sequence:
for (var i=0, formCount=forms.length; i<formCount; i++)
{
for (var i = 0, formCount = forms.length; i < formCount; i++) {
updateElementIndex($(forms).get(i), options.prefix, i);
$(forms.get(i)).find("*").each(function() {
$(forms.get(i)).find("*").each(function () {
updateElementIndex(this, options.prefix, i);
});
}
@ -139,15 +138,15 @@
// Tabular inlines ---------------------------------------------------------
$.fn.tabularFormset = function(options) {
$.fn.tabularFormset = function (options) {
var $rows = $(this);
var alternatingRows = function(row) {
var alternatingRows = function (row) {
$($rows.selector).not(".add-row").removeClass("row1 row2")
.filter(":even").addClass("row1").end()
.filter(":odd").addClass("row2");
};
var reinitDateTimeShortCuts = function() {
var reinitDateTimeShortCuts = function () {
// Reinitialize the calendar and clock widgets by force
if (typeof DateTimeShortcuts != "undefined") {
$(".datetimeshortcuts").remove();
@ -155,28 +154,28 @@
}
};
var updateSelectFilter = function() {
var updateSelectFilter = function () {
// If any SelectFilter widgets are a part of the new form,
// instantiate a new SelectFilter instance for it.
if (typeof SelectFilter != 'undefined'){
$('.selectfilter').each(function(index, value){
if (typeof SelectFilter != 'undefined') {
$('.selectfilter').each(function (index, value) {
var namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length-1], false, options.adminStaticPrefix );
SelectFilter.init(value.id, namearr[namearr.length - 1], false, options.adminStaticPrefix);
});
$('.selectfilterstacked').each(function(index, value){
$('.selectfilterstacked').each(function (index, value) {
var namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length-1], true, options.adminStaticPrefix );
SelectFilter.init(value.id, namearr[namearr.length - 1], true, options.adminStaticPrefix);
});
}
};
var initPrepopulatedFields = function(row) {
row.find('.prepopulated_field').each(function() {
var initPrepopulatedFields = function (row) {
row.find('.prepopulated_field').each(function () {
var field = $(this),
input = field.find('input, select, textarea'),
dependency_list = input.data('dependency_list') || [],
dependencies = [];
$.each(dependency_list, function(i, field_name) {
$.each(dependency_list, function (i, field_name) {
dependencies.push('#' + row.find('.field-' + field_name).find('input, select, textarea').attr('id'));
});
if (dependencies.length) {
@ -193,7 +192,7 @@
deleteText: options.deleteText,
emptyCssClass: "empty-form",
removed: alternatingRows,
added: function(row) {
added: function (row) {
initPrepopulatedFields(row);
reinitDateTimeShortCuts();
updateSelectFilter();
@ -205,16 +204,16 @@
};
// Stacked inlines ---------------------------------------------------------
$.fn.stackedFormset = function(options) {
$.fn.stackedFormset = function (options) {
var $rows = $(this);
var updateInlineLabel = function(row) {
$($rows.selector).find(".inline_label").each(function(i) {
var updateInlineLabel = function (row) {
$($rows.selector).find(".inline_label").each(function (i) {
var count = i + 1;
$(this).html($(this).html().replace(/(#\d+)/g, "#" + count));
});
};
var reinitDateTimeShortCuts = function() {
var reinitDateTimeShortCuts = function () {
// Reinitialize the calendar and clock widgets by force, yuck.
if (typeof DateTimeShortcuts != "undefined") {
$(".datetimeshortcuts").remove();
@ -222,27 +221,27 @@
}
};
var updateSelectFilter = function() {
var updateSelectFilter = function () {
// If any SelectFilter widgets were added, instantiate a new instance.
if (typeof SelectFilter != "undefined"){
$(".selectfilter").each(function(index, value){
if (typeof SelectFilter != "undefined") {
$(".selectfilter").each(function (index, value) {
var namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length-1], false, options.adminStaticPrefix);
SelectFilter.init(value.id, namearr[namearr.length - 1], false, options.adminStaticPrefix);
});
$(".selectfilterstacked").each(function(index, value){
$(".selectfilterstacked").each(function (index, value) {
var namearr = value.name.split('-');
SelectFilter.init(value.id, namearr[namearr.length-1], true, options.adminStaticPrefix);
SelectFilter.init(value.id, namearr[namearr.length - 1], true, options.adminStaticPrefix);
});
}
};
var initPrepopulatedFields = function(row) {
row.find('.prepopulated_field').each(function() {
var initPrepopulatedFields = function (row) {
row.find('.prepopulated_field').each(function () {
var field = $(this),
input = field.find('input, select, textarea'),
dependency_list = input.data('dependency_list') || [],
dependencies = [];
$.each(dependency_list, function(i, field_name) {
$.each(dependency_list, function (i, field_name) {
dependencies.push('#' + row.find('.form-row .field-' + field_name).find('input, select, textarea').attr('id'));
});
if (dependencies.length) {
@ -259,7 +258,7 @@
deleteText: options.deleteText,
emptyCssClass: "empty-form",
removed: updateInlineLabel,
added: (function(row) {
added: (function (row) {
initPrepopulatedFields(row);
reinitDateTimeShortCuts();
updateSelectFilter();

View File

@ -1,9 +1,107 @@
(function(b){b.fn.formset=function(d){var a=b.extend({},b.fn.formset.defaults,d),c=b(this),d=c.parent(),i=function(a,e,g){var d=RegExp("("+e+"-(\\d+|__prefix__))"),e=e+"-"+g;b(a).prop("for")&&b(a).prop("for",b(a).prop("for").replace(d,e));a.id&&(a.id=a.id.replace(d,e));a.name&&(a.name=a.name.replace(d,e))},f=b("#id_"+a.prefix+"-TOTAL_FORMS").prop("autocomplete","off"),g=parseInt(f.val(),10),e=b("#id_"+a.prefix+"-MAX_NUM_FORMS").prop("autocomplete","off"),f=""===e.val()||0<e.val()-f.val();c.each(function(){b(this).not("."+
a.emptyCssClass).addClass(a.formCssClass)});if(c.length&&f){var h;"TR"==c.prop("tagName")?(c=this.eq(-1).children().length,d.append('<tr class="'+a.addCssClass+'"><td colspan="'+c+'"><a href="javascript:void(0)">'+a.addText+"</a></tr>"),h=d.find("tr:last a")):(c.filter(":last").after('<div class="'+a.addCssClass+'"><a href="javascript:void(0)">'+a.addText+"</a></div>"),h=c.filter(":last").next().find("a"));h.click(function(d){d.preventDefault();var f=b("#id_"+a.prefix+"-TOTAL_FORMS"),d=b("#"+a.prefix+
"-empty"),c=d.clone(true);c.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+g);c.is("tr")?c.children(":last").append('<div><a class="'+a.deleteCssClass+'" href="javascript:void(0)">'+a.deleteText+"</a></div>"):c.is("ul")||c.is("ol")?c.append('<li><a class="'+a.deleteCssClass+'" href="javascript:void(0)">'+a.deleteText+"</a></li>"):c.children(":first").append('<span><a class="'+a.deleteCssClass+'" href="javascript:void(0)">'+a.deleteText+"</a></span>");c.find("*").each(function(){i(this,
a.prefix,f.val())});c.insertBefore(b(d));b(f).val(parseInt(f.val(),10)+1);g=g+1;e.val()!==""&&e.val()-f.val()<=0&&h.parent().hide();c.find("a."+a.deleteCssClass).click(function(d){d.preventDefault();d=b(this).parents("."+a.formCssClass);d.remove();g=g-1;a.removed&&a.removed(d);d=b("."+a.formCssClass);b("#id_"+a.prefix+"-TOTAL_FORMS").val(d.length);(e.val()===""||e.val()-d.length>0)&&h.parent().show();for(var c=0,f=d.length;c<f;c++){i(b(d).get(c),a.prefix,c);b(d.get(c)).find("*").each(function(){i(this,
a.prefix,c)})}});a.added&&a.added(c)})}return this};b.fn.formset.defaults={prefix:"form",addText:"add another",deleteText:"remove",addCssClass:"add-row",deleteCssClass:"delete-row",emptyCssClass:"empty-row",formCssClass:"dynamic-form",added:null,removed:null};b.fn.tabularFormset=function(d){var a=b(this),c=function(){b(a.selector).not(".add-row").removeClass("row1 row2").filter(":even").addClass("row1").end().filter(":odd").addClass("row2")};a.formset({prefix:d.prefix,addText:d.addText,formCssClass:"dynamic-"+
d.prefix,deleteCssClass:"inline-deletelink",deleteText:d.deleteText,emptyCssClass:"empty-form",removed:c,added:function(a){a.find(".prepopulated_field").each(function(){var d=b(this).find("input, select, textarea"),c=d.data("dependency_list")||[],e=[];b.each(c,function(d,b){e.push("#"+a.find(".field-"+b).find("input, select, textarea").attr("id"))});e.length&&d.prepopulate(e,d.attr("maxlength"))});"undefined"!=typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),DateTimeShortcuts.init());"undefined"!=
typeof SelectFilter&&(b(".selectfilter").each(function(a,b){var c=b.name.split("-");SelectFilter.init(b.id,c[c.length-1],false,d.adminStaticPrefix)}),b(".selectfilterstacked").each(function(a,b){var c=b.name.split("-");SelectFilter.init(b.id,c[c.length-1],true,d.adminStaticPrefix)}));c(a)}});return a};b.fn.stackedFormset=function(d){var a=b(this),c=function(){b(a.selector).find(".inline_label").each(function(a){a+=1;b(this).html(b(this).html().replace(/(#\d+)/g,"#"+a))})};a.formset({prefix:d.prefix,
addText:d.addText,formCssClass:"dynamic-"+d.prefix,deleteCssClass:"inline-deletelink",deleteText:d.deleteText,emptyCssClass:"empty-form",removed:c,added:function(a){a.find(".prepopulated_field").each(function(){var d=b(this).find("input, select, textarea"),c=d.data("dependency_list")||[],e=[];b.each(c,function(d,b){e.push("#"+a.find(".form-row .field-"+b).find("input, select, textarea").attr("id"))});e.length&&d.prepopulate(e,d.attr("maxlength"))});"undefined"!=typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),
DateTimeShortcuts.init());"undefined"!=typeof SelectFilter&&(b(".selectfilter").each(function(a,b){var c=b.name.split("-");SelectFilter.init(b.id,c[c.length-1],false,d.adminStaticPrefix)}),b(".selectfilterstacked").each(function(a,b){var c=b.name.split("-");SelectFilter.init(b.id,c[c.length-1],true,d.adminStaticPrefix)}));c(a)}});return a}})(django.jQuery);
(function (b) {
b.fn.formset = function (d) {
var a = b.extend({}, b.fn.formset.defaults, d), c = b(this), d = c.parent(), i = function (a, e, g) {
var d = RegExp("(" + e + "-(\\d+|__prefix__))"), e = e + "-" + g;
b(a).prop("for") && b(a).prop("for", b(a).prop("for").replace(d, e));
a.id && (a.id = a.id.replace(d, e));
a.name && (a.name = a.name.replace(d, e))
}, f = b("#id_" + a.prefix + "-TOTAL_FORMS").prop("autocomplete", "off"), g = parseInt(f.val(), 10), e = b("#id_" + a.prefix + "-MAX_NUM_FORMS").prop("autocomplete", "off"), f = "" === e.val() || 0 < e.val() - f.val();
c.each(function () {
b(this).not("." +
a.emptyCssClass).addClass(a.formCssClass)
});
if (c.length && f) {
var h;
"TR" == c.prop("tagName") ? (c = this.eq(-1).children().length, d.append('<tr class="' + a.addCssClass + '"><td colspan="' + c + '"><a href="javascript:void(0)">' + a.addText + "</a></tr>"), h = d.find("tr:last a")) : (c.filter(":last").after('<div class="' + a.addCssClass + '"><a href="javascript:void(0)">' + a.addText + "</a></div>"), h = c.filter(":last").next().find("a"));
h.click(function (d) {
d.preventDefault();
var f = b("#id_" + a.prefix + "-TOTAL_FORMS"), d = b("#" + a.prefix +
"-empty"), c = d.clone(true);
c.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id", a.prefix + "-" + g);
c.is("tr") ? c.children(":last").append('<div><a class="' + a.deleteCssClass + '" href="javascript:void(0)">' + a.deleteText + "</a></div>") : c.is("ul") || c.is("ol") ? c.append('<li><a class="' + a.deleteCssClass + '" href="javascript:void(0)">' + a.deleteText + "</a></li>") : c.children(":first").append('<span><a class="' + a.deleteCssClass + '" href="javascript:void(0)">' + a.deleteText + "</a></span>");
c.find("*").each(function () {
i(this,
a.prefix, f.val())
});
c.insertBefore(b(d));
b(f).val(parseInt(f.val(), 10) + 1);
g = g + 1;
e.val() !== "" && e.val() - f.val() <= 0 && h.parent().hide();
c.find("a." + a.deleteCssClass).click(function (d) {
d.preventDefault();
d = b(this).parents("." + a.formCssClass);
d.remove();
g = g - 1;
a.removed && a.removed(d);
d = b("." + a.formCssClass);
b("#id_" + a.prefix + "-TOTAL_FORMS").val(d.length);
(e.val() === "" || e.val() - d.length > 0) && h.parent().show();
for (var c = 0, f = d.length; c < f; c++) {
i(b(d).get(c), a.prefix, c);
b(d.get(c)).find("*").each(function () {
i(this,
a.prefix, c)
})
}
});
a.added && a.added(c)
})
}
return this
};
b.fn.formset.defaults = {prefix: "form", addText: "add another", deleteText: "remove", addCssClass: "add-row", deleteCssClass: "delete-row", emptyCssClass: "empty-row", formCssClass: "dynamic-form", added: null, removed: null};
b.fn.tabularFormset = function (d) {
var a = b(this), c = function () {
b(a.selector).not(".add-row").removeClass("row1 row2").filter(":even").addClass("row1").end().filter(":odd").addClass("row2")
};
a.formset({prefix: d.prefix, addText: d.addText, formCssClass: "dynamic-" +
d.prefix, deleteCssClass: "inline-deletelink", deleteText: d.deleteText, emptyCssClass: "empty-form", removed: c, added: function (a) {
a.find(".prepopulated_field").each(function () {
var d = b(this).find("input, select, textarea"), c = d.data("dependency_list") || [], e = [];
b.each(c, function (d, b) {
e.push("#" + a.find(".field-" + b).find("input, select, textarea").attr("id"))
});
e.length && d.prepopulate(e, d.attr("maxlength"))
});
"undefined" != typeof DateTimeShortcuts && (b(".datetimeshortcuts").remove(), DateTimeShortcuts.init());
"undefined" != typeof SelectFilter && (b(".selectfilter").each(function (a, b) {
var c = b.name.split("-");
SelectFilter.init(b.id, c[c.length - 1], false, d.adminStaticPrefix)
}), b(".selectfilterstacked").each(function (a, b) {
var c = b.name.split("-");
SelectFilter.init(b.id, c[c.length - 1], true, d.adminStaticPrefix)
}));
c(a)
}});
return a
};
b.fn.stackedFormset = function (d) {
var a = b(this), c = function () {
b(a.selector).find(".inline_label").each(function (a) {
a += 1;
b(this).html(b(this).html().replace(/(#\d+)/g, "#" + a))
})
};
a.formset({prefix: d.prefix,
addText: d.addText, formCssClass: "dynamic-" + d.prefix, deleteCssClass: "inline-deletelink", deleteText: d.deleteText, emptyCssClass: "empty-form", removed: c, added: function (a) {
a.find(".prepopulated_field").each(function () {
var d = b(this).find("input, select, textarea"), c = d.data("dependency_list") || [], e = [];
b.each(c, function (d, b) {
e.push("#" + a.find(".form-row .field-" + b).find("input, select, textarea").attr("id"))
});
e.length && d.prepopulate(e, d.attr("maxlength"))
});
"undefined" != typeof DateTimeShortcuts && (b(".datetimeshortcuts").remove(),
DateTimeShortcuts.init());
"undefined" != typeof SelectFilter && (b(".selectfilter").each(function (a, b) {
var c = b.name.split("-");
SelectFilter.init(b.id, c[c.length - 1], false, d.adminStaticPrefix)
}), b(".selectfilterstacked").each(function (a, b) {
var c = b.name.split("-");
SelectFilter.init(b.id, c[c.length - 1], true, d.adminStaticPrefix)
}));
c(a)
}});
return a
}
})(django.jQuery);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
(function($) {
$.fn.prepopulate = function(dependencies, maxLength) {
(function ($) {
$.fn.prepopulate = function (dependencies, maxLength) {
/*
Depends on urlify.js
Populates a selected field with the values of the dependent fields,
@ -7,11 +7,11 @@
dependencies - array of dependent fields id's
maxLength - maximum length of the URLify'd string
*/
return this.each(function() {
return this.each(function () {
var field = $(this);
field.data('_changed', false);
field.change(function() {
field.change(function () {
field.data('_changed', true);
});
@ -20,7 +20,7 @@
if (field.data('_changed') == true) return;
var values = [];
$.each(dependencies, function(i, field) {
$.each(dependencies, function (i, field) {
if ($(field).val().length > 0) {
values.push($(field).val());
}

View File

@ -1 +1,21 @@
(function(a){a.fn.prepopulate=function(d,g){return this.each(function(){var b=a(this);b.data("_changed",false);b.change(function(){b.data("_changed",true)});var c=function(){if(b.data("_changed")!=true){var e=[];a.each(d,function(h,f){a(f).val().length>0&&e.push(a(f).val())});b.val(URLify(e.join(" "),g))}};a(d.join(",")).keyup(c).change(c).focus(c)})}})(django.jQuery);
(function (a) {
a.fn.prepopulate = function (d, g) {
return this.each(function () {
var b = a(this);
b.data("_changed", false);
b.change(function () {
b.data("_changed", true)
});
var c = function () {
if (b.data("_changed") != true) {
var e = [];
a.each(d, function (h, f) {
a(f).val().length > 0 && e.push(a(f).val())
});
b.val(URLify(e.join(" "), g))
}
};
a(d.join(",")).keyup(c).change(c).focus(c)
})
}
})(django.jQuery);

View File

@ -1,7 +1,7 @@
var timeParsePatterns = [
// 9
{ re: /^\d{1,2}$/i,
handler: function(bits) {
handler: function (bits) {
if (bits[0].length == 1) {
return '0' + bits[0] + ':00';
} else {
@ -11,19 +11,19 @@ var timeParsePatterns = [
},
// 13:00
{ re: /^\d{2}[:.]\d{2}$/i,
handler: function(bits) {
handler: function (bits) {
return bits[0].replace('.', ':');
}
},
// 9:00
{ re: /^\d[:.]\d{2}$/i,
handler: function(bits) {
handler: function (bits) {
return '0' + bits[0].replace('.', ':');
}
},
// 3 am / 3 a.m. / 3am
{ re: /^(\d+)\s*([ap])(?:.?m.?)?$/i,
handler: function(bits) {
handler: function (bits) {
var hour = parseInt(bits[1]);
if (hour == 12) {
hour = 0;
@ -44,7 +44,7 @@ var timeParsePatterns = [
},
// 3.30 am / 3:15 a.m. / 3.00am
{ re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i,
handler: function(bits) {
handler: function (bits) {
var hour = parseInt(bits[1]);
var mins = parseInt(bits[2]);
if (mins < 10) {
@ -69,13 +69,13 @@ var timeParsePatterns = [
},
// noon
{ re: /^no/i,
handler: function(bits) {
handler: function (bits) {
return '12:00';
}
},
// midnight
{ re: /^mid/i,
handler: function(bits) {
handler: function (bits) {
return '00:00';
}
}

View File

@ -1,119 +1,106 @@
var LATIN_MAP = {
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç':
'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö':
'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à':'a', 'á':'a', 'â': 'a', 'ã': 'a', 'ä':
'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e',
'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó':
'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u',
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à': 'a', 'á': 'a', 'â': 'a', 'ã': 'a', 'ä': 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e',
'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': 'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u',
'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y'
}
var LATIN_SYMBOLS_MAP = {
'©':'(c)'
'©': '(c)'
}
var GREEK_MAP = {
'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', 'ζ':'z', 'η':'h', 'θ':'8',
'ι':'i', 'κ':'k', 'λ':'l', 'μ':'m', 'ν':'n', 'ξ':'3', 'ο':'o', 'π':'p',
'ρ':'r', 'σ':'s', 'τ':'t', 'υ':'y', 'φ':'f', 'χ':'x', 'ψ':'ps', 'ω':'w',
'ά':'a', 'έ':'e', 'ί':'i', 'ό':'o', 'ύ':'y', 'ή':'h', 'ώ':'w', 'ς':'s',
'ϊ':'i', 'ΰ':'y', 'ϋ':'y', 'ΐ':'i',
'Α':'A', 'Β':'B', 'Γ':'G', 'Δ':'D', 'Ε':'E', 'Ζ':'Z', 'Η':'H', 'Θ':'8',
'Ι':'I', 'Κ':'K', 'Λ':'L', 'Μ':'M', 'Ν':'N', 'Ξ':'3', 'Ο':'O', 'Π':'P',
'Ρ':'R', 'Σ':'S', 'Τ':'T', 'Υ':'Y', 'Φ':'F', 'Χ':'X', 'Ψ':'PS', 'Ω':'W',
'Ά':'A', 'Έ':'E', 'Ί':'I', 'Ό':'O', 'Ύ':'Y', 'Ή':'H', 'Ώ':'W', 'Ϊ':'I',
'Ϋ':'Y'
'α': 'a', 'β': 'b', 'γ': 'g', 'δ': 'd', 'ε': 'e', 'ζ': 'z', 'η': 'h', 'θ': '8',
'ι': 'i', 'κ': 'k', 'λ': 'l', 'μ': 'm', 'ν': 'n', 'ξ': '3', 'ο': 'o', 'π': 'p',
'ρ': 'r', 'σ': 's', 'τ': 't', 'υ': 'y', 'φ': 'f', 'χ': 'x', 'ψ': 'ps', 'ω': 'w',
'ά': 'a', 'έ': 'e', 'ί': 'i', 'ό': 'o', 'ύ': 'y', 'ή': 'h', 'ώ': 'w', 'ς': 's',
'ϊ': 'i', 'ΰ': 'y', 'ϋ': 'y', 'ΐ': 'i',
'Α': 'A', 'Β': 'B', 'Γ': 'G', 'Δ': 'D', 'Ε': 'E', 'Ζ': 'Z', 'Η': 'H', 'Θ': '8',
'Ι': 'I', 'Κ': 'K', 'Λ': 'L', 'Μ': 'M', 'Ν': 'N', 'Ξ': '3', 'Ο': 'O', 'Π': 'P',
'Ρ': 'R', 'Σ': 'S', 'Τ': 'T', 'Υ': 'Y', 'Φ': 'F', 'Χ': 'X', 'Ψ': 'PS', 'Ω': 'W',
'Ά': 'A', 'Έ': 'E', 'Ί': 'I', 'Ό': 'O', 'Ύ': 'Y', 'Ή': 'H', 'Ώ': 'W', 'Ϊ': 'I',
'Ϋ': 'Y'
}
var TURKISH_MAP = {
'ş':'s', 'Ş':'S', 'ı':'i', 'İ':'I', 'ç':'c', 'Ç':'C', 'ü':'u', 'Ü':'U',
'ö':'o', 'Ö':'O', 'ğ':'g', 'Ğ':'G'
'ş': 's', 'Ş': 'S', 'ı': 'i', 'İ': 'I', 'ç': 'c', 'Ç': 'C', 'ü': 'u', 'Ü': 'U',
'ö': 'o', 'Ö': 'O', 'ğ': 'g', 'Ğ': 'G'
}
var RUSSIAN_MAP = {
'а':'a', 'б':'b', 'в':'v', 'г':'g', 'д':'d', 'е':'e', 'ё':'yo', 'ж':'zh',
'з':'z', 'и':'i', 'й':'j', 'к':'k', 'л':'l', 'м':'m', 'н':'n', 'о':'o',
'п':'p', 'р':'r', 'с':'s', 'т':'t', 'у':'u', 'ф':'f', 'х':'h', 'ц':'c',
'ч':'ch', 'ш':'sh', 'щ':'sh', 'ъ':'', 'ы':'y', 'ь':'', 'э':'e', 'ю':'yu',
'я':'ya',
'А':'A', 'Б':'B', 'В':'V', 'Г':'G', 'Д':'D', 'Е':'E', 'Ё':'Yo', 'Ж':'Zh',
'З':'Z', 'И':'I', 'Й':'J', 'К':'K', 'Л':'L', 'М':'M', 'Н':'N', 'О':'O',
'П':'P', 'Р':'R', 'С':'S', 'Т':'T', 'У':'U', 'Ф':'F', 'Х':'H', 'Ц':'C',
'Ч':'Ch', 'Ш':'Sh', 'Щ':'Sh', 'Ъ':'', 'Ы':'Y', 'Ь':'', 'Э':'E', 'Ю':'Yu',
'Я':'Ya'
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'yo', 'ж': 'zh',
'з': 'z', 'и': 'i', 'й': 'j', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c',
'ч': 'ch', 'ш': 'sh', 'щ': 'sh', 'ъ': '', 'ы': 'y', 'ь': '', 'э': 'e', 'ю': 'yu',
'я': 'ya',
'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'E', 'Ё': 'Yo', 'Ж': 'Zh',
'З': 'Z', 'И': 'I', 'Й': 'J', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', 'О': 'O',
'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C',
'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Sh', 'Ъ': '', 'Ы': 'Y', 'Ь': '', 'Э': 'E', 'Ю': 'Yu',
'Я': 'Ya'
}
var UKRAINIAN_MAP = {
'Є':'Ye', 'І':'I', 'Ї':'Yi', 'Ґ':'G', 'є':'ye', 'і':'i', 'ї':'yi', 'ґ':'g'
'Є': 'Ye', 'І': 'I', 'Ї': 'Yi', 'Ґ': 'G', 'є': 'ye', 'і': 'i', 'ї': 'yi', 'ґ': 'g'
}
var CZECH_MAP = {
'č':'c', 'ď':'d', 'ě':'e', 'ň': 'n', 'ř':'r', 'š':'s', 'ť':'t', 'ů':'u',
'ž':'z', 'Č':'C', 'Ď':'D', 'Ě':'E', 'Ň': 'N', 'Ř':'R', 'Š':'S', 'Ť':'T',
'Ů':'U', 'Ž':'Z'
'č': 'c', 'ď': 'd', 'ě': 'e', 'ň': 'n', 'ř': 'r', 'š': 's', 'ť': 't', 'ů': 'u',
'ž': 'z', 'Č': 'C', 'Ď': 'D', 'Ě': 'E', 'Ň': 'N', 'Ř': 'R', 'Š': 'S', 'Ť': 'T',
'Ů': 'U', 'Ž': 'Z'
}
var POLISH_MAP = {
'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ó':'o', 'ś':'s', 'ź':'z',
'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ó':'o', 'Ś':'S',
'Ź':'Z', 'Ż':'Z'
'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's', 'ź': 'z',
'ż': 'z', 'Ą': 'A', 'Ć': 'C', 'Ę': 'e', 'Ł': 'L', 'Ń': 'N', 'Ó': 'o', 'Ś': 'S',
'Ź': 'Z', 'Ż': 'Z'
}
var LATVIAN_MAP = {
'ā':'a', 'č':'c', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n',
'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'i',
'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'u', 'Ž':'Z'
'ā': 'a', 'č': 'c', 'ē': 'e', 'ģ': 'g', 'ī': 'i', 'ķ': 'k', 'ļ': 'l', 'ņ': 'n',
'š': 's', 'ū': 'u', 'ž': 'z', 'Ā': 'A', 'Č': 'C', 'Ē': 'E', 'Ģ': 'G', 'Ī': 'i',
'Ķ': 'k', 'Ļ': 'L', 'Ņ': 'N', 'Š': 'S', 'Ū': 'u', 'Ž': 'Z'
}
var ALL_DOWNCODE_MAPS=new Array()
ALL_DOWNCODE_MAPS[0]=LATIN_MAP
ALL_DOWNCODE_MAPS[1]=LATIN_SYMBOLS_MAP
ALL_DOWNCODE_MAPS[2]=GREEK_MAP
ALL_DOWNCODE_MAPS[3]=TURKISH_MAP
ALL_DOWNCODE_MAPS[4]=RUSSIAN_MAP
ALL_DOWNCODE_MAPS[5]=UKRAINIAN_MAP
ALL_DOWNCODE_MAPS[6]=CZECH_MAP
ALL_DOWNCODE_MAPS[7]=POLISH_MAP
ALL_DOWNCODE_MAPS[8]=LATVIAN_MAP
var ALL_DOWNCODE_MAPS = new Array()
ALL_DOWNCODE_MAPS[0] = LATIN_MAP
ALL_DOWNCODE_MAPS[1] = LATIN_SYMBOLS_MAP
ALL_DOWNCODE_MAPS[2] = GREEK_MAP
ALL_DOWNCODE_MAPS[3] = TURKISH_MAP
ALL_DOWNCODE_MAPS[4] = RUSSIAN_MAP
ALL_DOWNCODE_MAPS[5] = UKRAINIAN_MAP
ALL_DOWNCODE_MAPS[6] = CZECH_MAP
ALL_DOWNCODE_MAPS[7] = POLISH_MAP
ALL_DOWNCODE_MAPS[8] = LATVIAN_MAP
var Downcoder = new Object();
Downcoder.Initialize = function()
{
Downcoder.Initialize = function () {
if (Downcoder.map) // already made
return ;
Downcoder.map ={}
Downcoder.chars = '' ;
for(var i in ALL_DOWNCODE_MAPS)
{
return;
Downcoder.map = {}
Downcoder.chars = '';
for (var i in ALL_DOWNCODE_MAPS) {
var lookup = ALL_DOWNCODE_MAPS[i]
for (var c in lookup)
{
Downcoder.map[c] = lookup[c] ;
Downcoder.chars += c ;
for (var c in lookup) {
Downcoder.map[c] = lookup[c];
Downcoder.chars += c;
}
}
Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+','g') ;
Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+', 'g');
}
downcode= function( slug )
{
Downcoder.Initialize() ;
var downcoded =""
downcode = function (slug) {
Downcoder.Initialize();
var downcoded = ""
var pieces = slug.match(Downcoder.regex);
if(pieces)
{
for (var i = 0 ; i < pieces.length ; i++)
{
if (pieces[i].length == 1)
{
var mapped = Downcoder.map[pieces[i]] ;
if (mapped != null)
{
downcoded+=mapped;
continue ;
if (pieces) {
for (var i = 0; i < pieces.length; i++) {
if (pieces[i].length == 1) {
var mapped = Downcoder.map[pieces[i]];
if (mapped != null) {
downcoded += mapped;
continue;
}
}
downcoded+=pieces[i];
downcoded += pieces[i];
}
}
else
{
else {
downcoded = slug;
}
return downcoded;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -19,16 +19,18 @@ body {
background-color: #fff;
}
@media(min-width:768px) {
@media (min-width: 768px) {
#page-wrapper {
position: inherit;
margin: 0 0 0 250px;
padding: 0 30px;
border-left: 1px solid #e7e7e7;
overflow: hidden;}
overflow: hidden;
}
}
}
.navbar-top-links li {
display: inline-block;
}
@ -108,13 +110,13 @@ body {
content: "\f104";
}
.sidebar .active>a>.fa.arrow:before {
.sidebar .active > a > .fa.arrow:before {
content: "\f107";
}
.sidebar .nav-second-level li,
.sidebar .nav-third-level li {
border-bottom: 0!important;
border-bottom: 0 !important;
}
.sidebar .nav-second-level li a {
@ -125,7 +127,7 @@ body {
padding-left: 52px;
}
@media(min-width:768px) {
@media (min-width: 768px) {
.sidebar {
z-index: 1;
position: absolute;
@ -246,7 +248,7 @@ table.dataTable thead .sorting:after {
content: "\f0dc";
float: right;
font-family: fontawesome;
color: rgba(50,50,50,.5);
color: rgba(50, 50, 50, .5);
}
.btn-circle {
@ -281,7 +283,7 @@ table.dataTable thead .sorting:after {
padding-top: 10px;
padding-bottom: 10px;
border: 1px solid #ddd;
background-color: #eee!important;
background-color: #eee !important;
}
.show-grid {

File diff suppressed because one or more lines are too long

View File

@ -19,10 +19,15 @@
<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>
{% if user.is_authenticated %}
{% if user.is_authenticated %}
<div id="wrapper">
<!-- Navigation -->
@ -57,43 +62,68 @@
</li>
<li>
<a {% ifequal request.path "/dashboard/" %} class="active" {% endifequal %} href="{% url 'auth_dashboard' %}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
<a {% ifequal request.path "/dashboard/" %} class="active" {% endifequal %}
href="{% url 'auth_dashboard' %}"><i
class="fa fa-dashboard fa-fw grayiconecolor"></i> Dashboard</a>
</li>
<li>
<a {% ifequal request.path "/characters/" %} class="active" {% endifequal %} href="{% url 'auth_characters' %}"><i class="fa fa-users fa-fw"></i> Characters</a>
<a {% ifequal request.path "/characters/" %} class="active" {% endifequal %}
href="{% url 'auth_characters' %}"><i
class="fa fa-users fa-fw grayiconecolor"></i> Characters</a>
</li>
<li>
<a {% ifequal request.path "/api_key_management/" %} class="active" {% endifequal %} href="{% url 'auth_api_key_management' %}"><i class="fa fa-key fa-fw"></i> Api Keys</a>
<a {% ifequal request.path "/api_key_management/" %} class="active" {% endifequal %}
href="{% url 'auth_api_key_management' %}"><i
class="fa fa-key fa-fw grayiconecolor"></i> Api Keys</a>
</li>
<li>
<a {% ifequal request.path "/groups/" %} class="active" {% endifequal %} href="{% url 'auth_groups' %}"><i class="fa fa-cogs fa-sitemap"></i> Groups</a>
<a {% ifequal request.path "/groups/" %} class="active" {% endifequal %}
href="{% url 'auth_groups' %}"><i
class="fa fa-cogs fa-sitemap grayiconecolor"></i> Groups</a>
</li>
<li>
<a {% ifequal request.path "/services/" %} class="active" {% endifequal %} href="{% url 'auth_services' %}"><i class="fa fa-cogs fa-fw"></i> Services</a>
<a {% ifequal request.path "/services/" %} class="active" {% endifequal %}
href="{% url 'auth_services' %}"><i
class="fa fa-cogs fa-fw grayiconecolor"></i> Services</a>
</li>
<li>
<a {% ifequal request.path "/help/" %} class="active" {% endifequal %} href="{% url 'auth_help' %}"><i class="fa fa-question fa-fw"></i> Help</a>
<a {% ifequal request.path "/help/" %} class="active" {% endifequal %}
href="{% url 'auth_help' %}"><i
class="fa fa-question fa-fw grayiconecolor"></i> Help</a>
</li>
<li>
<a {% ifequal request.path "/hr_application_management/" %} class="active" {% endifequal %}
href="{% url 'auth_hrapplications_view' %}"><i
class="fa fa-file-o fa-fw grayiconecolor"></i> Applications</a>
</li>
<li class="text-center divider-horizontal">
<h5>Util</h5>
</li>
<li>
<a {% ifequal request.path "/user/password/" %} class="active" {% endifequal %} href="{% url 'password_change' %}"><i class="fa fa-lock fa-fw"></i>Change Password</a>
<a {% ifequal request.path "/user/password/" %} class="active" {% endifequal %}
href="{% url 'password_change' %}"><i
class="fa fa-lock fa-fw grayiconecolor"></i>Change Password</a>
</li>
{% if perms.auth.group_management %}
<li>
<a {% ifequal request.path "/user/group_management/" %} class="active" {% endifequal %} href="{% url 'auth_group_management' %}"><i class="fa fa-lock fa-sitemap"></i> Group Management</a>
<a {% ifequal request.path "/user/group_management/" %} class="active" {% endifequal %}
href="{% url 'auth_group_management' %}"><i
class="fa fa-lock fa-sitemap grayiconecolor"></i> Group Management</a>
</li>
{% endif %}
{% if perms.auth.jabber_broadcast %}
<li>
<a {% ifequal request.path "/serivces/jabber_broadcast/" %} class="active" {% endifequal %} href="{% url 'auth_jabber_broadcast_view' %}"><i class="fa fa-lock fa-bullhorn"></i> Jabber Broadcast</a>
<a {% ifequal request.path "/serivces/jabber_broadcast/" %}
class="active" {% endifequal %} href="{% url 'auth_jabber_broadcast_view' %}"><i
class="fa fa-lock fa-bullhorn grayiconecolor"></i> Jabber Broadcast</a>
</li>
{% endif %}
<li>
<a {% ifequal request.path "/tool/fleet_formatter_tool/" %} class="active" {% endifequal %} href="{% url 'auth_fleet_format_tool_view' %}"><i class="fa fa-space-shuttle fa-fw"></i> Fleet Broadcast Formatter</a>
<a {% ifequal request.path "/tool/fleet_formatter_tool/" %} class="active" {% endifequal %}
href="{% url 'auth_fleet_format_tool_view' %}"><i
class="fa fa-space-shuttle fa-fw grayiconecolor"></i> Fleet Broadcast Formatter</a>
</li>
</ul>
</div>
@ -107,6 +137,6 @@
{% endblock content %}
</div>
</div>
{% endif %}
{% endif %}
</body>
</html>

View File

@ -1,14 +1,14 @@
{% load staticfiles %}
<style>
html {
html {
background: url("{% static 'img/index_images/index_bg.jpg' %}") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
}
div {
div {
height: 200px;
width: 400px;
position: fixed;
@ -16,22 +16,23 @@ div {
left: 50%;
margin-top: -100px;
margin-left: -200px;
}
}
</style>
<html>
<head lang="en">
<head lang="en">
<meta charset="UTF-8">
<title>The 99 Percent Eve Alliance</title>
</head>
<body>
<div id="content">
</head>
<body>
<div id="content">
<p style="text-align:center">
<a href="/dashboard/">
<img src="{% static 'img/index_images/auth.png' %}" border="0">
</a>
</p>
<p style="text-align:center">
<a href="/forums/">
<img src="{% static 'img/index_images/forums.png' %}" border="0">
@ -49,6 +50,6 @@ div {
<img src="{% static 'img/index_images/media.png' %}" border="0">
</a>
</p>
</div>
</body>
</div>
</body>
</html>

View File

@ -24,7 +24,7 @@
}
.panel-transparent {
background: rgba(48,48,48,0.7);
background: rgba(48, 48, 48, 0.7);
color: #ffffff;
}
@ -34,7 +34,7 @@
</style>
</head>
<body>
<div class="container" style="margin-top:150px">
<div class="container" style="margin-top:150px">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default panel-transparent">
@ -45,10 +45,11 @@
<a href="{% url 'auth_register_user' %}">
<button class="btn btn- btn-success btn-block">Register</button>
</a>
<form class="form-signin" role="form" action="{% url 'auth_login_user' %}" method="POST">
{% csrf_token %}
<h2 class="form-signin-heading text-center">Please sign in</h2>
{{form|bootstrap}}
{{ form|bootstrap }}
<div class="col-md-6">
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</div>
@ -61,6 +62,6 @@
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -24,9 +24,10 @@
}
.panel-transparent {
background: rgba(48,48,48,0.7);
background: rgba(48, 48, 48, 0.7);
color: #ffffff;
}
.panel-body {
}

View File

@ -8,15 +8,18 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Add Api Key</h1>
<div class="container-fluid">
<div class="col-md-4 col-md-offset-4">
<div class="row">
<p class="text-center">
Full API Key is required for auth services
</p>
<a target="_blank" href="https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=268435455">Create a full API key</a>
<a target="_blank"
href="https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=268435455">Create
a full API key</a>
</p>
<form class="form-signin" role="form" action="{% url 'auth_add_api_key' %}" method="POST">
{% csrf_token %}
@ -27,6 +30,6 @@
</div>
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@ -8,7 +8,7 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<div class="row">
{% if apikeypairs %}
{% else %}
@ -33,13 +33,14 @@
<td class="text-center">{{ pair.api_key }}</td>
<td class="text-center">
<a href="/delete_api_pair/{{ pair.api_id }}">
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button>
<button type="button" class="btn btn-danger"><span
class="glyphicon glyphicon-remove"></span></button>
</a>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
{% endblock content %}

View File

@ -7,8 +7,9 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12 container">
<div class="col-lg-12 container">
<h1 class="page-header text-center">Characters</h1>
<div class="col-lg-12 container" id="example">
{% if authinfo.main_char_id %}
@ -25,14 +26,18 @@
<div class="row">
<div class="col-md-12">
<div class="text-left col-md-8">
{{character.character_name}}
{{ character.character_name }}
</div>
<div class="text-right col-md-4">
<a href="/main_character_change/{{character.character_id}}">
<a href="/main_character_change/{{ character.character_id }}">
{% ifequal character.character_id authinfo.main_char_id %}
<button type="button" class="btn btn-default btn-xs" disabled>Make Primary</button>
<button type="button" class="btn btn-default btn-xs" disabled>
Make Primary
</button>
{% else %}
<button type="button" class="btn btn-primary btn-xs">Make Primary</button>
<button type="button" class="btn btn-primary btn-xs">Make
Primary
</button>
{% endifequal %}
</a>
</div>
@ -44,12 +49,15 @@
<div class="panel-body">
<div class="col-lg-5 col-sm-2"><img class=
"ra-avatar img-responsive" src=
"https://image.eveonline.com/Character/{{character.character_id}}_128.jpg"></div>
"https://image.eveonline.com/Character/{{ character.character_id }}_128.jpg">
</div>
<div class="col-lg-7 col-sm-2">
<p><strong>Alliance: </strong> {{character.alliance_name}} </p>
<p><strong>Corporation: </strong>{{character.corporation_name}}</p>
<p><strong>Corporation Ticker: </strong> {{character.corporation_ticker}} </p>
<p><strong>Alliance: </strong> {{ character.alliance_name }} </p>
<p><strong>Corporation: </strong>{{ character.corporation_name }}</p>
<p><strong>Corporation Ticker: </strong> {{ character.corporation_ticker }} </p>
</div>
</div>
</div>
@ -57,6 +65,6 @@
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@ -1,10 +1,10 @@
{% extends "public/base.html" %}
{% block title %}Alliance Auth{% endblock%}
{% block title %}Alliance Auth{% endblock %}
{% block page_title %}Something something here{% endblock page_title %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Dashboard</h1>
{% if perms.auth.alliance_member %}
<div class="col-lg-12 container" id="example">
@ -20,12 +20,15 @@
<div class="panel-body">
<div class="col-lg-5 col-sm-2"><img class=
"ra-avatar img-responsive" src=
"https://image.eveonline.com/Character/{{character.character_id}}_128.jpg"></div>
"https://image.eveonline.com/Character/{{ character.character_id }}_128.jpg">
</div>
<div class="col-lg-7 col-sm-2">
<h4 class="">{{character.character_name}}</h4>
<p>{{character.corporation_name}}</p>
<p>{{character.alliance_name}}</p>
<h4 class="">{{ character.character_name }}</h4>
<p>{{ character.corporation_name }}</p>
<p>{{ character.alliance_name }}</p>
</div>
</div>
</div>
@ -58,5 +61,5 @@
{% else %}
<p> Not part of the alliance</p>
{% endif %}
</div>
</div>
{% endblock content %}

View File

@ -8,7 +8,7 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Fleet Broadcast Formatter Tool</h1>
<div class="container-fluid">
@ -20,7 +20,7 @@
{% endif %}
<form class="form-signin" role="form" action="" method="POST">
{% csrf_token %}
{{ form|bootstrap}}
{{ form|bootstrap }}
<br/>
<button class="btn btn-lg btn-primary btn-block" type="submit">Format</button>
<br/>
@ -28,6 +28,6 @@
</div>
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@ -7,7 +7,7 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h3 class="page-header text-center">Group Management</h3>
<h4 class="page-header text-center">Group Add Request</h4>
@ -70,6 +70,6 @@
</tr>
{% endfor %}
</table>
</div>
</div>
{% endblock content %}

View File

@ -7,7 +7,7 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Available Groups</h1>
{% if perms.auth.alliance_member %}
<table class="table table-bordered">
@ -25,8 +25,8 @@
<td class="text-center">{{ pair.1.description }}</td>
<td class="text-center">
{% if pair.0 in user.groups.all %}
{% if pair.2 == ""%}
<a href="/group/request_leave/{{pair.0.id}}">
{% if pair.2 == "" %}
<a href="/group/request_leave/{{ pair.0.id }}">
<button type="button" class="btn btn-danger">
Leave
</button>
@ -37,7 +37,7 @@
</button>
{% endif %}
{% elif pair.2 == "" %}
<a href="/group/request_add/{{pair.0.id}}">
<a href="/group/request_add/{{ pair.0.id }}">
<button type="button" class="btn btn-success">
Request
</button>
@ -54,6 +54,6 @@
{% else %}
<div class="alert alert-danger" role="alert">You are not in the alliance</div>
{% endif %}
</div>
</div>
{% endblock content %}

View File

@ -5,9 +5,10 @@
{% block page_title %}Something something here{% endblock page_title %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Help</h1>
<div class="container-fluid">
<div class="col-md-4 col-md-offset-4">
<div class="row">
@ -17,5 +18,5 @@
</div>
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@ -0,0 +1,23 @@
{% extends "public/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% block title %}Alliance Auth{% endblock %}
{% block page_title %}HR Application Management{% endblock page_title %}
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">HR Applications
<div class="text-right">
<a href="{% url 'auth_hrapplication_create_view' %}">
<button type="button" class="btn btn-success">Create Application</button>
</a>
</div>
</h1>
<div class="container-fluid">
</div>
</div>
{% endblock content %}

View File

@ -0,0 +1,28 @@
{% extends "public/base.html" %}
{% load bootstrap %}
{% load staticfiles %}
{% block title %}Alliance Auth - Create Application{% endblock %}
{% block page_title %}Create Application{% endblock page_title %}
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">Create Application</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">Submit Application</button>
</form>
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@ -8,8 +8,9 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Jabber Broadcast</h1>
<div class="container-fluid">
<div class="col-md-4 col-md-offset-4">
<div class="row">
@ -25,6 +26,6 @@
</div>
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@ -7,7 +7,7 @@
{% block extra_css %}{% endblock extra_css %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Available Services</h1>
{% if perms.auth.alliance_member %}
<table class="table table-bordered">
@ -26,14 +26,17 @@
<td class="text-center">
{% ifequal authinfo.forum_username "" %}
<a href="{% url 'auth_activate_forum' %}">
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
<button type="button" class="btn btn-success"><span
class="glyphicon glyphicon-ok"></span></button>
</a>
{% else %}
<a href="{% url 'auth_reset_forum_password' %}">
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span></button>
<button type="button" class="btn btn-primary"><span
class="glyphicon glyphicon-refresh"></span></button>
</a>
<a href="{% url 'auth_deactivate_forum' %}">
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button>
<button type="button" class="btn btn-danger"><span
class="glyphicon glyphicon-remove"></span></button>
</a>
{% endifequal %}
</td>
@ -46,14 +49,17 @@
<td class="text-center">
{% ifequal authinfo.jabber_username "" %}
<a href="{% url 'auth_activate_jabber' %}">
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
<button type="button" class="btn btn-success"><span
class="glyphicon glyphicon-ok"></span></button>
</a>
{% else %}
<a href="{% url 'auth_reset_jabber_password' %}">
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span></button>
<button type="button" class="btn btn-primary"><span
class="glyphicon glyphicon-refresh"></span></button>
</a>
<a href="{% url 'auth_deactivate_jabber' %}">
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button>
<button type="button" class="btn btn-danger"><span
class="glyphicon glyphicon-remove"></span></button>
</a>
{% endifequal %}
</td>
@ -66,14 +72,17 @@
<td class="text-center">
{% ifequal authinfo.mumble_username "" %}
<a href="{% url 'auth_activate_mumble' %}">
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
<button type="button" class="btn btn-success"><span
class="glyphicon glyphicon-ok"></span></button>
</a>
{% else %}
<a href="{% url 'auth_reset_mumble_password' %}">
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span></button>
<button type="button" class="btn btn-primary"><span
class="glyphicon glyphicon-refresh"></span></button>
</a>
<a href="{% url 'auth_deactivate_mumble' %}">
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button>
<button type="button" class="btn btn-danger"><span
class="glyphicon glyphicon-remove"></span></button>
</a>
{% endifequal %}
</td>
@ -82,6 +91,6 @@
{% else %}
<div class="alert alert-danger" role="alert">You are not in the alliance</div>
{% endif %}
</div>
</div>
{% endblock content %}

View File

@ -6,8 +6,9 @@
{% block title %}{% trans 'Password change' %}{% endblock %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Change Password</h1>
<div class="container-fluid">
<div class="col-md-4 col-md-offset-4">
<div class="row">
@ -17,7 +18,7 @@
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -6,8 +6,9 @@
{% block title %}{% trans 'Password change' %}{% endblock %}
{% block content %}
<div class="col-lg-12">
<div class="col-lg-12">
<h1 class="page-header text-center">Change Password</h1>
<div class="container-fluid">
<div class="col-md-4 col-md-offset-4">
<div class="row">
@ -20,7 +21,7 @@
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -25,7 +25,7 @@
}
.panel-transparent {
background: rgba(48,48,48,0.7);
background: rgba(48, 48, 48, 0.7);
color: #ffffff;
}
@ -35,7 +35,7 @@
</style>
</head>
<body>
<div class="container" style="margin-top:150px">
<div class="container" style="margin-top:150px">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default panel-transparent">
<div class="panel-body">
@ -49,6 +49,6 @@
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -25,7 +25,7 @@
}
.panel-transparent {
background: rgba(48,48,48,0.7);
background: rgba(48, 48, 48, 0.7);
color: #ffffff;
}
@ -35,7 +35,7 @@
</style>
</head>
<body>
<div class="container" style="margin-top:150px">
<div class="container" style="margin-top:150px">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default panel-transparent">
<div class="panel-body">
@ -57,6 +57,6 @@
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -25,7 +25,7 @@
}
.panel-transparent {
background: rgba(48,48,48,0.7);
background: rgba(48, 48, 48, 0.7);
color: #ffffff;
}
@ -35,7 +35,7 @@
</style>
</head>
<body>
<div class="container" style="margin-top:150px">
<div class="container" style="margin-top:150px">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default panel-transparent">
<div class="panel-body">
@ -48,6 +48,6 @@
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,15 +1,15 @@
{% load i18n %}{% autoescape off %}
{% blocktrans %}You're receiving this email because you requested a password reset for your
user account.{% endblocktrans %}
{% blocktrans %}You're receiving this email because you requested a password reset for your
user account.{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
https://the99eve.com{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
https://the99eve.com{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}
{% trans "Thanks for using our site!" %}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The The 99 Percent team{% endblocktrans %}
{% blocktrans %}The The 99 Percent team{% endblocktrans %}
{% endautoescape %}

View File

@ -25,7 +25,7 @@
}
.panel-transparent {
background: rgba(48,48,48,0.7);
background: rgba(48, 48, 48, 0.7);
color: #ffffff;
}
@ -35,15 +35,16 @@
</style>
</head>
<body>
<div class="container" style="margin-top:150px">
<div class="container" style="margin-top:150px">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default panel-transparent">
<div class="panel-body">
<form class="form-signin" role="form" action="" method="POST">
{% csrf_token %}
<h1 class="text-center">{% trans "Password Reset" %}</h1>
<p class="text-center">{% trans "Forgotten your password? Enter your email below." %}</p>
{{form|bootstrap}}
{{ form|bootstrap }}
<div class="">
<button class="btn btn-lg btn-primary btn-block" type="submit">Reset Password</button>
</div>
@ -51,6 +52,6 @@
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,7 +1,7 @@
from django.contrib.auth.models import Group
from django.contrib.auth.models import User
from authentication.managers import AuthServicesInfoManager
from authentication.managers import AuthServicesInfoManager
from services.managers.jabber_manager import JabberManager
from services.managers.forum_manager import ForumManager
from services.managers.mumble_manager import MumbleManager
@ -37,5 +37,5 @@ def deactivate_services(user):
def generate_corp_group_name(corpname):
return 'Corp_'+corpname.replace(' ', '_')
return 'Corp_' + corpname.replace(' ', '_')