mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 20:40:17 +02:00
Reformatted code for easy reading.
This commit is contained in:
parent
6e99823252
commit
19e19d89e4
30
.idea/dataSources.xml
generated
Normal file
30
.idea/dataSources.xml
generated
Normal 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>
|
||||||
|
|
7
.idea/inspectionProfiles/profiles_settings.xml
generated
7
.idea/inspectionProfiles/profiles_settings.xml
generated
@ -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>
|
|
@ -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, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import djcelery
|
import djcelery
|
||||||
|
|
||||||
|
|
||||||
djcelery.setup_loader()
|
djcelery.setup_loader()
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
|
||||||
@ -154,7 +157,7 @@ STATIC_URL = '/static/'
|
|||||||
DEFAULT_ALLIANCE_GROUP = 'AllianceMember'
|
DEFAULT_ALLIANCE_GROUP = 'AllianceMember'
|
||||||
|
|
||||||
# ALLIANCE INFO
|
# ALLIANCE INFO
|
||||||
ALLIANCE_ID = '0'
|
ALLIANCE_ID = '99001336'
|
||||||
ALLIANCE_NAME = 'Somealliance'
|
ALLIANCE_NAME = 'Somealliance'
|
||||||
|
|
||||||
# Forum URL
|
# Forum URL
|
||||||
@ -167,7 +170,7 @@ JABBER_SERVER = "someadddress.com"
|
|||||||
OPENFIRE_ADDRESS = "http://someaddress.com:9090/"
|
OPENFIRE_ADDRESS = "http://someaddress.com:9090/"
|
||||||
OPENFIRE_SECRET_KEY = "somekey"
|
OPENFIRE_SECRET_KEY = "somekey"
|
||||||
|
|
||||||
BROADCAST_USER = "broadcast@"+JABBER_URL
|
BROADCAST_USER = "broadcast@" + JABBER_URL
|
||||||
BROADCAST_USER_PASSWORD = "somepassword"
|
BROADCAST_USER_PASSWORD = "somepassword"
|
||||||
|
|
||||||
# Mumble settings
|
# Mumble settings
|
||||||
|
@ -1,72 +1,96 @@
|
|||||||
from django.conf.urls import patterns, include, url
|
from django.conf.urls import patterns, include, url
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
||||||
# Admin urls
|
# Admin urls
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
|
|
||||||
# Index
|
# Index
|
||||||
url(r'^$', 'portal.views.index_view', name='auth_index'),
|
url(r'^$', 'portal.views.index_view', name='auth_index'),
|
||||||
|
|
||||||
# Authentication Urls
|
# Authentication Urls
|
||||||
url(r'^login_user/', 'authentication.views.login_user', name='auth_login_user'),
|
url(r'^login_user/', 'authentication.views.login_user', name='auth_login_user'),
|
||||||
url(r'^logout_user/', 'authentication.views.logout_user', name='auth_logout_user'),
|
url(r'^logout_user/', 'authentication.views.logout_user', name='auth_logout_user'),
|
||||||
url(r'^register_user/', 'registration.views.register_user_view', name='auth_register_user'),
|
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/$', '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/done/$', 'django.contrib.auth.views.password_change_done',
|
||||||
url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset', name='password_reset'),
|
name='password_change_done'),
|
||||||
url(r'^user/password/password/reset/done/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'),
|
url(r'^user/password/reset/$', 'django.contrib.auth.views.password_reset',
|
||||||
url(r'^user/password/reset/complete/$', 'django.contrib.auth.views.password_reset_complete', name='password_reset_complete'),
|
name='password_reset'),
|
||||||
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/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
|
# Portal Urls
|
||||||
url(r'^dashboard/$', 'portal.views.dashboard_view', name='auth_dashboard'),
|
url(r'^dashboard/$', 'portal.views.dashboard_view', name='auth_dashboard'),
|
||||||
url(r'^help/$', 'portal.views.help_view', name='auth_help'),
|
url(r'^help/$', 'portal.views.help_view', name='auth_help'),
|
||||||
|
|
||||||
# Eveonline Urls
|
# Eveonline Urls
|
||||||
url(r'^add_api_key/', 'eveonline.views.add_api_key', name='auth_add_api_key'),
|
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',
|
||||||
url(r'^delete_api_pair/(\w+)/$', 'eveonline.views.api_key_removal', name='auth_api_key_removal'),
|
name='auth_api_key_management'),
|
||||||
url(r'^characters/', 'eveonline.views.characters_view', name='auth_characters'),
|
url(r'^delete_api_pair/(\w+)/$', 'eveonline.views.api_key_removal', name='auth_api_key_removal'),
|
||||||
url(r'^main_character_change/(\w+)/$', 'eveonline.views.main_character_change', name='auth_main_character_change'),
|
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'),
|
||||||
|
|
||||||
# Group management
|
# Group management
|
||||||
url(r'^groups/', 'groupmanagement.views.groups_view', name='auth_groups'),
|
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/management/', 'groupmanagement.views.group_management',
|
||||||
url(r'^group/request_add/(\w+)', 'groupmanagement.views.group_request_add', name='auth_group_request_add'),
|
name='auth_group_management'),
|
||||||
url(r'^group/request/accept/(\w+)', 'groupmanagement.views.group_accept_request', name='auth_group_accept_request'),
|
url(r'^group/request_add/(\w+)', 'groupmanagement.views.group_request_add',
|
||||||
url(r'^group/request/reject/(\w+)', 'groupmanagement.views.group_reject_request', name='auth_group_reject_request'),
|
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',
|
||||||
url(r'group/leave_request/accept/(\w+)', 'groupmanagement.views.group_leave_accept_request',
|
name='auth_group_request_leave'),
|
||||||
name='auth_group_leave_accept_request'),
|
url(r'group/leave_request/accept/(\w+)', 'groupmanagement.views.group_leave_accept_request',
|
||||||
url(r'^group/leave_request/reject/(\w+)', 'groupmanagement.views.group_leave_reject_request',
|
name='auth_group_leave_accept_request'),
|
||||||
name='auth_group_leave_reject_request'),
|
url(r'^group/leave_request/reject/(\w+)', 'groupmanagement.views.group_leave_reject_request',
|
||||||
|
name='auth_group_leave_reject_request'),
|
||||||
|
|
||||||
# Service Urls
|
# HR Application Management
|
||||||
url(r'^services/', 'services.views.services_view', name='auth_services'),
|
url(r'^hr_application_management/', 'hrapplications.views.hr_application_management_view',
|
||||||
url(r'^serivces/jabber_broadcast/$', 'services.views.jabber_broadcast_view', name='auth_jabber_broadcast_view'),
|
name="auth_hrapplications_view"),
|
||||||
|
url(r'^hr_application_create/', 'hrapplications.views.hr_application_create_view',
|
||||||
|
name="auth_hrapplication_create_view"),
|
||||||
|
|
||||||
# Forum Service Control
|
# Service Urls
|
||||||
url(r'^activate_forum/$', 'services.views.activate_forum', name='auth_activate_forum'),
|
url(r'^services/', 'services.views.services_view', name='auth_services'),
|
||||||
url(r'^deactivate_forum/$', 'services.views.deactivate_forum', name='auth_deactivate_forum'),
|
url(r'^serivces/jabber_broadcast/$', 'services.views.jabber_broadcast_view',
|
||||||
url(r'^reset_forum_password/$', 'services.views.reset_forum_password', name='auth_reset_forum_password'),
|
name='auth_jabber_broadcast_view'),
|
||||||
|
|
||||||
# Jabber Service Control
|
# Forum Service Control
|
||||||
url(r'^activate_jabber/$', 'services.views.activate_jabber', name='auth_activate_jabber'),
|
url(r'^activate_forum/$', 'services.views.activate_forum', name='auth_activate_forum'),
|
||||||
url(r'^deactivate_jabber/$', 'services.views.deactivate_jabber', name='auth_deactivate_jabber'),
|
url(r'^deactivate_forum/$', 'services.views.deactivate_forum', name='auth_deactivate_forum'),
|
||||||
url(r'^reset_jabber_password/$', 'services.views.reset_jabber_password', name='auth_reset_jabber_password'),
|
url(r'^reset_forum_password/$', 'services.views.reset_forum_password',
|
||||||
|
name='auth_reset_forum_password'),
|
||||||
|
|
||||||
# Mumble service contraol
|
# Jabber Service Control
|
||||||
url(r'^activate_mumble/$', 'services.views.activate_mumble', name='auth_activate_mumble'),
|
url(r'^activate_jabber/$', 'services.views.activate_jabber', name='auth_activate_jabber'),
|
||||||
url(r'^deactivate_mumble/$', 'services.views.deactivate_mumble', name='auth_deactivate_mumble'),
|
url(r'^deactivate_jabber/$', 'services.views.deactivate_jabber', name='auth_deactivate_jabber'),
|
||||||
url(r'^reset_mumble_password/$', 'services.views.reset_mumble_password', name='auth_reset_mumble_password'),
|
url(r'^reset_jabber_password/$', 'services.views.reset_jabber_password',
|
||||||
|
name='auth_reset_jabber_password'),
|
||||||
|
|
||||||
# Tools
|
# Mumble service contraol
|
||||||
url(r'^tool/fleet_formatter_tool/$', 'services.views.fleet_formatter_view', name='auth_fleet_format_tool_view'),
|
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'),
|
||||||
|
|
||||||
|
# Tools
|
||||||
|
url(r'^tool/fleet_formatter_tool/$', 'services.views.fleet_formatter_view',
|
||||||
|
name='auth_fleet_format_tool_view'),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,9 @@ https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alliance_auth.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alliance_auth.settings")
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from models import AuthServicesInfo
|
from models import AuthServicesInfo
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
admin.site.register(AuthServicesInfo)
|
admin.site.register(AuthServicesInfo)
|
@ -4,7 +4,6 @@ from models import AuthServicesInfo
|
|||||||
|
|
||||||
|
|
||||||
class AuthServicesInfoManager:
|
class AuthServicesInfoManager:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -4,6 +4,7 @@ from django.contrib.auth import authenticate
|
|||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|
||||||
from forms import LoginForm
|
from forms import LoginForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from models import SyncGroupCache
|
from models import SyncGroupCache
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
admin.site.register(SyncGroupCache)
|
admin.site.register(SyncGroupCache)
|
@ -1,5 +1,4 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib import admin
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
from models import SyncGroupCache
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from celery.task import periodic_task
|
from celery.task import periodic_task
|
||||||
from celery.task.schedules import crontab
|
|
||||||
from django.contrib.auth.models import User
|
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.jabber_manager import JabberManager
|
||||||
from services.managers.mumble_manager import MumbleManager
|
from services.managers.mumble_manager import MumbleManager
|
||||||
from services.managers.forum_manager import ForumManager
|
from services.managers.forum_manager import ForumManager
|
||||||
@ -52,7 +53,6 @@ def update_forum_groups(user):
|
|||||||
|
|
||||||
|
|
||||||
def add_to_databases(user, groups, syncgroups):
|
def add_to_databases(user, groups, syncgroups):
|
||||||
|
|
||||||
authserviceinfo = None
|
authserviceinfo = None
|
||||||
try:
|
try:
|
||||||
authserviceinfo = AuthServicesInfo.objects.get(user=user)
|
authserviceinfo = AuthServicesInfo.objects.get(user=user)
|
||||||
@ -134,14 +134,15 @@ def run_api_refresh():
|
|||||||
authserviceinfo = AuthServicesInfo.objects.get(user=user)
|
authserviceinfo = AuthServicesInfo.objects.get(user=user)
|
||||||
# We do a check on the authservice info to insure that we shoud run the check
|
# 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
|
# 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:
|
||||||
if authserviceinfo.main_char_id != "":
|
if authserviceinfo.main_char_id != "":
|
||||||
for api_key_pair in api_key_pairs:
|
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):
|
if EveApiManager.api_key_is_valid(api_key_pair.api_id, api_key_pair.api_key):
|
||||||
# Update characters
|
# 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)
|
EveManager.update_characters_from_list(characters)
|
||||||
valid_key = True
|
valid_key = True
|
||||||
else:
|
else:
|
||||||
@ -156,7 +157,14 @@ def run_api_refresh():
|
|||||||
else:
|
else:
|
||||||
deactivate_services(user)
|
deactivate_services(user)
|
||||||
else:
|
else:
|
||||||
#nuke it
|
# nuke it
|
||||||
deactivate_services(user)
|
deactivate_services(user)
|
||||||
else:
|
else:
|
||||||
print 'No main_char_id set'
|
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)
|
||||||
|
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from models import EveCharacter
|
from models import EveCharacter
|
||||||
from models import EveApiKeyPair
|
from models import EveApiKeyPair
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(EveCharacter)
|
admin.site.register(EveCharacter)
|
||||||
admin.site.register(EveApiKeyPair)
|
admin.site.register(EveApiKeyPair)
|
@ -1,4 +1,5 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from services.managers.eve_api_manager import EveApiManager
|
from services.managers.eve_api_manager import EveApiManager
|
||||||
from eveonline.managers import EveManager
|
from eveonline.managers import EveManager
|
||||||
|
|
||||||
@ -13,10 +14,10 @@ class UpdateKeyForm(forms.Form):
|
|||||||
|
|
||||||
if not EveApiManager.check_api_is_type_account(self.cleaned_data['api_id'],
|
if not EveApiManager.check_api_is_type_account(self.cleaned_data['api_id'],
|
||||||
self.cleaned_data['api_key']):
|
self.cleaned_data['api_key']):
|
||||||
raise forms.ValidationError(u'API not of type account')
|
raise forms.ValidationError(u'API not of type account')
|
||||||
|
|
||||||
if not EveApiManager.check_api_is_full(self.cleaned_data['api_id'],
|
if not EveApiManager.check_api_is_full(self.cleaned_data['api_id'],
|
||||||
self.cleaned_data['api_key']):
|
self.cleaned_data['api_key']):
|
||||||
raise forms.ValidationError(u'API supplied is not a full api key')
|
raise forms.ValidationError(u'API supplied is not a full api key')
|
||||||
|
|
||||||
return self.cleaned_data
|
return self.cleaned_data
|
@ -1,16 +1,18 @@
|
|||||||
from models import EveCharacter
|
from models import EveCharacter
|
||||||
from models import EveApiKeyPair
|
from models import EveApiKeyPair
|
||||||
|
from models import EveAllianceInfo
|
||||||
|
from models import EveCorporationInfo
|
||||||
|
|
||||||
from services.managers.eve_api_manager import EveApiManager
|
from services.managers.eve_api_manager import EveApiManager
|
||||||
|
|
||||||
|
|
||||||
class EveManager:
|
class EveManager:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_character(character_id, character_name, corporation_id,
|
def create_character(character_id, character_name, corporation_id,
|
||||||
corporation_name, corporation_ticker, alliance_id,
|
corporation_name, corporation_ticker, alliance_id,
|
||||||
alliance_name, user, api_id):
|
alliance_name, user, api_id):
|
||||||
|
|
||||||
if not EveCharacter.objects.filter(character_id=character_id).exists():
|
if not EveCharacter.objects.filter(character_id=character_id).exists():
|
||||||
@ -32,13 +34,14 @@ class EveManager:
|
|||||||
for char in chars.result:
|
for char in chars.result:
|
||||||
if not EveManager.check_if_character_exist(chars.result[char]['name']):
|
if not EveManager.check_if_character_exist(chars.result[char]['name']):
|
||||||
EveManager.create_character(chars.result[char]['id'],
|
EveManager.create_character(chars.result[char]['id'],
|
||||||
chars.result[char]['name'],
|
chars.result[char]['name'],
|
||||||
chars.result[char]['corp']['id'],
|
chars.result[char]['corp']['id'],
|
||||||
chars.result[char]['corp']['name'],
|
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]['alliance']['id'],
|
chars.result[char]['corp']['id']),
|
||||||
chars.result[char]['alliance']['name'],
|
chars.result[char]['alliance']['id'],
|
||||||
user, api_id)
|
chars.result[char]['alliance']['name'],
|
||||||
|
user, api_id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_characters_from_list(chars):
|
def update_characters_from_list(chars):
|
||||||
@ -47,7 +50,8 @@ class EveManager:
|
|||||||
eve_char = EveManager.get_character_by_character_name(chars.result[char]['name'])
|
eve_char = EveManager.get_character_by_character_name(chars.result[char]['name'])
|
||||||
eve_char.corporation_id = chars.result[char]['corp']['id']
|
eve_char.corporation_id = chars.result[char]['corp']['id']
|
||||||
eve_char.corporation_name = chars.result[char]['corp']['name']
|
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_id = chars.result[char]['alliance']['id']
|
||||||
eve_char.alliance_name = chars.result[char]['alliance']['name']
|
eve_char.alliance_name = chars.result[char]['alliance']['name']
|
||||||
eve_char.save()
|
eve_char.save()
|
||||||
@ -62,6 +66,38 @@ class EveManager:
|
|||||||
api_pair.user = user_id
|
api_pair.user = user_id
|
||||||
api_pair.save()
|
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
|
@staticmethod
|
||||||
def get_api_key_pairs(user):
|
def get_api_key_pairs(user):
|
||||||
if EveApiKeyPair.objects.filter(user=user).exists():
|
if EveApiKeyPair.objects.filter(user=user).exists():
|
||||||
@ -112,7 +148,7 @@ class EveManager:
|
|||||||
def get_character_by_id(char_id):
|
def get_character_by_id(char_id):
|
||||||
if EveCharacter.objects.filter(character_id=char_id).exists():
|
if EveCharacter.objects.filter(character_id=char_id).exists():
|
||||||
return EveCharacter.objects.get(character_id=char_id)
|
return EveCharacter.objects.get(character_id=char_id)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -126,5 +162,13 @@ class EveManager:
|
|||||||
|
|
||||||
if character.user.id == user.id:
|
if character.user.id == user.id:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
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()
|
@ -23,4 +23,27 @@ class EveApiKeyPair(models.Model):
|
|||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.username + " - ApiKeyPair"
|
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
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -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.conf import settings
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.contrib.auth.decorators import login_required
|
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 forms import UpdateKeyForm
|
||||||
from managers import EveManager
|
from managers import EveManager
|
||||||
|
|
||||||
from authentication.managers import AuthServicesInfoManager
|
from authentication.managers import AuthServicesInfoManager
|
||||||
from services.managers.eve_api_manager import EveApiManager
|
from services.managers.eve_api_manager import EveApiManager
|
||||||
from util.common_task import add_user_to_group
|
from util.common_task import add_user_to_group
|
||||||
@ -29,7 +28,8 @@ def add_api_key(request):
|
|||||||
request.user)
|
request.user)
|
||||||
|
|
||||||
# Grab characters associated with the key pair
|
# 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'])
|
EveManager.create_characters_from_list(characters, request.user, form.cleaned_data['api_id'])
|
||||||
return HttpResponseRedirect("/api_key_management/")
|
return HttpResponseRedirect("/api_key_management/")
|
||||||
else:
|
else:
|
||||||
@ -67,7 +67,6 @@ def api_key_removal(request, api_id):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def characters_view(request):
|
def characters_view(request):
|
||||||
|
|
||||||
render_items = {'characters': EveManager.get_characters_by_owner_id(request.user.id),
|
render_items = {'characters': EveManager.get_characters_by_owner_id(request.user.id),
|
||||||
'authinfo': AuthServicesInfoManager.get_auth_service_info(request.user)}
|
'authinfo': AuthServicesInfoManager.get_auth_service_info(request.user)}
|
||||||
return render_to_response('registered/characters.html', render_items, context_instance=RequestContext(request))
|
return render_to_response('registered/characters.html', render_items, context_instance=RequestContext(request))
|
||||||
@ -75,7 +74,6 @@ def characters_view(request):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def main_character_change(request, char_id):
|
def main_character_change(request, char_id):
|
||||||
|
|
||||||
if EveManager.check_if_character_owned_by_user(char_id, request.user):
|
if EveManager.check_if_character_owned_by_user(char_id, request.user):
|
||||||
previousmainid = AuthServicesInfoManager.get_auth_service_info(request.user).main_char_id
|
previousmainid = AuthServicesInfoManager.get_auth_service_info(request.user).main_char_id
|
||||||
AuthServicesInfoManager.update_main_char_Id(char_id, request.user)
|
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,
|
add_user_to_group(request.user,
|
||||||
generate_corp_group_name(EveManager.get_character_by_id(char_id).corporation_name))
|
generate_corp_group_name(EveManager.get_character_by_id(char_id).corporation_name))
|
||||||
else:
|
else:
|
||||||
#TODO: disable serivces
|
# TODO: disable serivces
|
||||||
if check_if_user_has_permission(request.user, 'alliance_member'):
|
if check_if_user_has_permission(request.user, 'alliance_member'):
|
||||||
remove_member_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, settings.DEFAULT_ALLIANCE_GROUP)
|
||||||
remove_user_from_group(request.user,
|
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)
|
deactivate_services(request.user)
|
||||||
|
|
||||||
return HttpResponseRedirect("/characters")
|
return HttpResponseRedirect("/characters")
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from models import GroupDescription
|
from models import GroupDescription
|
||||||
from models import GroupRequest
|
from models import GroupRequest
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(GroupDescription)
|
admin.site.register(GroupDescription)
|
||||||
admin.site.register(GroupRequest)
|
admin.site.register(GroupRequest)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
|
|
||||||
from eveonline.models import EveCharacter
|
from eveonline.models import EveCharacter
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -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 login_required
|
||||||
from django.contrib.auth.decorators import permission_required
|
from django.contrib.auth.decorators import permission_required
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
from models import GroupDescription
|
from models import GroupDescription
|
||||||
from models import GroupRequest
|
from models import GroupRequest
|
||||||
|
|
||||||
from authentication.managers import AuthServicesInfoManager
|
from authentication.managers import AuthServicesInfoManager
|
||||||
from eveonline.managers import EveManager
|
from eveonline.managers import EveManager
|
||||||
|
|
||||||
@ -88,9 +86,9 @@ def group_leave_reject_request(request, group_request_id):
|
|||||||
|
|
||||||
return HttpResponseRedirect("/group/management/")
|
return HttpResponseRedirect("/group/management/")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def groups_view(request):
|
def groups_view(request):
|
||||||
|
|
||||||
paired_list = []
|
paired_list = []
|
||||||
|
|
||||||
for group in Group.objects.all():
|
for group in Group.objects.all():
|
||||||
@ -119,6 +117,7 @@ def groups_view(request):
|
|||||||
return render_to_response('registered/groups.html',
|
return render_to_response('registered/groups.html',
|
||||||
render_items, context_instance=RequestContext(request))
|
render_items, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def group_request_add(request, group_id):
|
def group_request_add(request, group_id):
|
||||||
auth_info = AuthServicesInfoManager.get_auth_service_info(request.user)
|
auth_info = AuthServicesInfoManager.get_auth_service_info(request.user)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from models import HRApplications
|
from models import HRApplications
|
||||||
from models import HRApplicationComment
|
from models import HRApplicationComment
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(HRApplications)
|
admin.site.register(HRApplications)
|
||||||
admin.site.register(HRApplicationComment)
|
admin.site.register(HRApplicationComment)
|
@ -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")
|
@ -6,8 +6,8 @@ class HRApplications(models.Model):
|
|||||||
character_name = models.CharField(max_length=254, default="")
|
character_name = models.CharField(max_length=254, default="")
|
||||||
full_api_id = models.CharField(max_length=254, default="")
|
full_api_id = models.CharField(max_length=254, default="")
|
||||||
full_api_key = models.CharField(max_length=254, default="")
|
full_api_key = models.CharField(max_length=254, default="")
|
||||||
prefered_corp = models.CharField(max_length=254, default="")
|
preferred_corp = models.CharField(max_length=254, default="")
|
||||||
is_a_spi = models.BooleanField(default=False)
|
is_a_spi = models.CharField(max_length=254, default="")
|
||||||
about = models.TextField(default="")
|
about = models.TextField(default="")
|
||||||
extra = models.TextField(default="")
|
extra = models.TextField(default="")
|
||||||
|
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -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))
|
@ -1,3 +1 @@
|
|||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.db import models
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
from django.conf import settings
|
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth.decorators import permission_required
|
|
||||||
|
|
||||||
from eveonline.managers import EveManager
|
from eveonline.managers import EveManager
|
||||||
|
|
||||||
from authentication.managers import AuthServicesInfoManager
|
from authentication.managers import AuthServicesInfoManager
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
def index_view(request):
|
def index_view(request):
|
||||||
return render_to_response('public/index.html', None, context_instance=RequestContext(request))
|
return render_to_response('public/index.html', None, context_instance=RequestContext(request))
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.db import models
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -2,11 +2,11 @@ from django.contrib.auth.models import User
|
|||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|
||||||
from forms import RegistrationForm
|
from forms import RegistrationForm
|
||||||
|
|
||||||
|
|
||||||
def register_user_view(request):
|
def register_user_view(request):
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = RegistrationForm(request.POST)
|
form = RegistrationForm(request.POST)
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ def register_user_view(request):
|
|||||||
|
|
||||||
if not User.objects.filter(username=form.cleaned_data['username']).exists():
|
if not User.objects.filter(username=form.cleaned_data['username']).exists():
|
||||||
user = User.objects.create_user(form.cleaned_data['username'],
|
user = User.objects.create_user(form.cleaned_data['username'],
|
||||||
form.cleaned_data['email'], form.cleaned_data['password'])
|
form.cleaned_data['email'], form.cleaned_data['password'])
|
||||||
|
|
||||||
user.save()
|
user.save()
|
||||||
|
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
@ -4,7 +4,6 @@ import evelink.eve
|
|||||||
|
|
||||||
|
|
||||||
class EveApiManager():
|
class EveApiManager():
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -34,6 +33,32 @@ class EveApiManager():
|
|||||||
|
|
||||||
return ticker
|
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
|
@staticmethod
|
||||||
def check_api_is_type_account(api_id, api_key):
|
def check_api_is_type_account(api_id, api_key):
|
||||||
try:
|
try:
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
import calendar
|
import calendar
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from passlib.apps import phpbb3_context
|
from passlib.apps import phpbb3_context
|
||||||
from django.db import connections
|
from django.db import connections
|
||||||
|
|
||||||
|
|
||||||
class ForumManager:
|
class ForumManager:
|
||||||
|
|
||||||
SQL_ADD_USER = r"INSERT INTO phpbb_users (username, username_clean, " \
|
SQL_ADD_USER = r"INSERT INTO phpbb_users (username, username_clean, " \
|
||||||
r"user_password, user_email, group_id, user_regdate, user_permissions, " \
|
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)"
|
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
|
@staticmethod
|
||||||
def __create_group(groupname):
|
def __create_group(groupname):
|
||||||
cursor = connections['phpbb3'].cursor()
|
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)
|
return ForumManager.__get_group_id(groupname)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -185,7 +185,7 @@ class ForumManager:
|
|||||||
cursor.execute(ForumManager.SQL_USER_ID_FROM_USERNAME, [ForumManager.__santatize_username(username)])
|
cursor.execute(ForumManager.SQL_USER_ID_FROM_USERNAME, [ForumManager.__santatize_username(username)])
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
if row:
|
if row:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
from urlparse import urlparse
|
||||||
|
|
||||||
import xmpp
|
import xmpp
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from openfire import exception
|
from openfire import exception
|
||||||
from openfire import UserService
|
from openfire import UserService
|
||||||
from urlparse import urlparse
|
|
||||||
|
|
||||||
from authentication.managers import AuthServicesInfoManager
|
from authentication.managers import AuthServicesInfoManager
|
||||||
from eveonline.managers import EveManager
|
|
||||||
|
|
||||||
class JabberManager:
|
class JabberManager:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -83,7 +82,7 @@ class JabberManager:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def delete_user_groups(username, groups):
|
def delete_user_groups(username, groups):
|
||||||
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
|
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
|
||||||
api.delete_group(username,groups)
|
api.delete_group(username, groups)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def send_broadcast_message(group_name, broadcast_message):
|
def send_broadcast_message(group_name, broadcast_message):
|
||||||
@ -98,7 +97,7 @@ class JabberManager:
|
|||||||
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
|
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
|
||||||
if auth_info:
|
if auth_info:
|
||||||
if auth_info.jabber_username != "":
|
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 = xmpp.Message(to_address, broadcast_message)
|
||||||
message.setAttr('type', 'chat')
|
message.setAttr('type', 'chat')
|
||||||
client.send(message)
|
client.send(message)
|
||||||
@ -108,11 +107,10 @@ class JabberManager:
|
|||||||
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
|
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
|
||||||
if auth_info:
|
if auth_info:
|
||||||
if auth_info.jabber_username != "":
|
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 = xmpp.Message(to_address, broadcast_message)
|
||||||
message.setAttr('type', 'chat')
|
message.setAttr('type', 'chat')
|
||||||
client.send(message)
|
client.send(message)
|
||||||
client.Process(1)
|
client.Process(1)
|
||||||
|
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
@ -1,11 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from django.db import connections
|
from django.db import connections
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
class MumbleManager:
|
class MumbleManager:
|
||||||
|
|
||||||
SQL_SELECT_USER_MAX_ID = r"SELECT max(user_id)+1 as next_id from murmur_users"
|
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"
|
SQL_SELECT_GROUP_MAX_ID = r"SELECT MAX(group_id)+1 FROM murmur_groups"
|
||||||
@ -54,7 +54,7 @@ class MumbleManager:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __generate_username(username, corp_ticker):
|
def __generate_username(username, corp_ticker):
|
||||||
return "["+corp_ticker+"]"+username
|
return "[" + corp_ticker + "]" + username
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _gen_pwhash(password):
|
def _gen_pwhash(password):
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.db import models
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
@ -1,3 +1 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
@ -1,21 +1,17 @@
|
|||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.shortcuts import HttpResponseRedirect
|
from django.shortcuts import HttpResponseRedirect
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth.decorators import permission_required
|
from django.contrib.auth.decorators import permission_required
|
||||||
|
|
||||||
from managers.jabber_manager import JabberManager
|
from managers.jabber_manager import JabberManager
|
||||||
from managers.forum_manager import ForumManager
|
from managers.forum_manager import ForumManager
|
||||||
from managers.mumble_manager import MumbleManager
|
from managers.mumble_manager import MumbleManager
|
||||||
|
|
||||||
from authentication.managers import AuthServicesInfoManager
|
from authentication.managers import AuthServicesInfoManager
|
||||||
from eveonline.managers import EveManager
|
from eveonline.managers import EveManager
|
||||||
|
|
||||||
from celerytask.tasks import update_jabber_groups
|
from celerytask.tasks import update_jabber_groups
|
||||||
from celerytask.tasks import update_mumble_groups
|
from celerytask.tasks import update_mumble_groups
|
||||||
from celerytask.tasks import update_forum_groups
|
from celerytask.tasks import update_forum_groups
|
||||||
|
|
||||||
from forms import JabberBroadcastForm
|
from forms import JabberBroadcastForm
|
||||||
from forms import FleetFormatterForm
|
from forms import FleetFormatterForm
|
||||||
|
|
||||||
@ -25,16 +21,18 @@ def fleet_formatter_view(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = FleetFormatterForm(request.POST)
|
form = FleetFormatterForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
generated = "Fleet Name: "+form.cleaned_data['fleet_name']+"\n"
|
generated = "Fleet Name: " + form.cleaned_data['fleet_name'] + "\n"
|
||||||
generated = generated + "FC: "+form.cleaned_data['fleet_commander']+"\n"
|
generated = generated + "FC: " + form.cleaned_data['fleet_commander'] + "\n"
|
||||||
generated = generated + "Comms: "+form.cleaned_data['fleet_comms']+"\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 + "Fleet Type: " + form.cleaned_data['fleet_type'] + " || " + form.cleaned_data[
|
||||||
generated = generated + "Form Up: "+form.cleaned_data['formup_location']+" @ "+form.cleaned_data['formup_time']+"\n"
|
'ship_priorities'] + "\n"
|
||||||
generated = generated + "Duration: "+form.cleaned_data['expected_duration']+"\n"
|
generated = generated + "Form Up: " + form.cleaned_data['formup_location'] + " @ " + form.cleaned_data[
|
||||||
generated = generated + "Reimbursable: "+form.cleaned_data['reimbursable']+"\n"
|
'formup_time'] + "\n"
|
||||||
generated = generated + "Important: "+form.cleaned_data['important']+"\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'] != "":
|
if form.cleaned_data['comments'] != "":
|
||||||
generated = generated + "Why: "+form.cleaned_data['comments']+"\n"
|
generated = generated + "Why: " + form.cleaned_data['comments'] + "\n"
|
||||||
else:
|
else:
|
||||||
form = FleetFormatterForm()
|
form = FleetFormatterForm()
|
||||||
generated = ""
|
generated = ""
|
||||||
@ -64,7 +62,8 @@ def jabber_broadcast_view(request):
|
|||||||
def services_view(request):
|
def services_view(request):
|
||||||
authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
|
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
|
@login_required
|
||||||
|
@ -6,7 +6,7 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 12px;
|
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;
|
color: #333;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ p {
|
|||||||
line-height: 140%;
|
line-height: 140%;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1,h2,h3,h4,h5 {
|
h1, h2, h3, h4, h5 {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,12 +323,12 @@ thead th.sorted {
|
|||||||
}
|
}
|
||||||
|
|
||||||
thead th.sorted .text {
|
thead th.sorted .text {
|
||||||
padding-right: 42px;
|
padding-right: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table thead th .text span {
|
table thead th .text span {
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
display:block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
table thead th .text a {
|
table thead th .text a {
|
||||||
@ -405,7 +405,7 @@ table.orderable tbody tr td:first-child {
|
|||||||
background-repeat: repeat-y;
|
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;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,9 +445,9 @@ textarea, select, .vTextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button[disabled], input[type=submit][disabled], input[type=button][disabled] {
|
.button[disabled], input[type=submit][disabled], input[type=button][disabled] {
|
||||||
background-image: url(../img/nav-bg.gif);
|
background-image: url(../img/nav-bg.gif);
|
||||||
background-position: bottom;
|
background-position: bottom;
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button.default, input[type=submit].default, .submit-row input.default {
|
.button.default, input[type=submit].default, .submit-row input.default {
|
||||||
@ -464,12 +464,11 @@ textarea, select, .vTextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button[disabled].default, input[type=submit][disabled].default, input[type=button][disabled].default {
|
.button[disabled].default, input[type=submit][disabled].default, input[type=button][disabled].default {
|
||||||
background-image: url(../img/default-bg.gif);
|
background-image: url(../img/default-bg.gif);
|
||||||
background-position: bottom;
|
background-position: bottom;
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* MODULES */
|
/* MODULES */
|
||||||
|
|
||||||
.module {
|
.module {
|
||||||
@ -526,11 +525,11 @@ ul.messagelist li {
|
|||||||
background: #ffc url(../img/icon_success.gif) 5px .3em no-repeat;
|
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);
|
background-image: url(../img/icon_alert.gif);
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.messagelist li.error{
|
ul.messagelist li.error {
|
||||||
background-image: url(../img/icon_error.gif);
|
background-image: url(../img/icon_error.gif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +559,7 @@ ul.errorlist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.errorlist li a {
|
.errorlist li a {
|
||||||
color: white;
|
color: white;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -642,7 +641,7 @@ a.deletelink:hover {
|
|||||||
.object-tools {
|
.object-tools {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-family: Arial,Helvetica,sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
float: right;
|
float: right;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.change-list .hiddenfields { display:none; }
|
.change-list .hiddenfields {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.change-list .filtered table {
|
.change-list .filtered table {
|
||||||
border-right: 1px solid #ddd;
|
border-right: 1px solid #ddd;
|
||||||
@ -33,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#changelist-form .results {
|
#changelist-form .results {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#changelist .toplinks {
|
#changelist .toplinks {
|
||||||
@ -75,7 +77,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#changelist table tbody td.action-checkbox {
|
#changelist table tbody td.action-checkbox {
|
||||||
text-align:center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#changelist table tfoot {
|
#changelist table tfoot {
|
||||||
|
@ -154,7 +154,7 @@ fieldset.collapsed .collapse-toggle {
|
|||||||
/* MONOSPACE TEXTAREAS */
|
/* MONOSPACE TEXTAREAS */
|
||||||
|
|
||||||
fieldset.monospace textarea {
|
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 */
|
/* SUBMIT ROW */
|
||||||
|
@ -41,8 +41,8 @@ body.login {
|
|||||||
padding: 6px;
|
padding: 6px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login span.help {
|
.login span.help {
|
||||||
|
@ -81,12 +81,12 @@ div.breadcrumbs {
|
|||||||
/* SORTABLE TABLES */
|
/* SORTABLE TABLES */
|
||||||
|
|
||||||
table thead th.sorted .sortoptions {
|
table thead th.sorted .sortoptions {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
thead th.sorted .text {
|
thead th.sorted .text {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
padding-left: 42px;
|
padding-left: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dashboard styles */
|
/* dashboard styles */
|
||||||
@ -129,10 +129,10 @@ thead th.sorted .text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.filtered .actions {
|
.filtered .actions {
|
||||||
border-left:1px solid #DDDDDD;
|
border-left: 1px solid #DDDDDD;
|
||||||
margin-left:160px !important;
|
margin-left: 160px !important;
|
||||||
border-right: 0 none;
|
border-right: 0 none;
|
||||||
margin-right:0 !important;
|
margin-right: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#changelist table tbody td:first-child, #changelist table tbody th:first-child {
|
#changelist table tbody td:first-child, #changelist table tbody th:first-child {
|
||||||
@ -231,7 +231,7 @@ fieldset .field-box {
|
|||||||
padding-left: inherit;
|
padding-left: inherit;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
right: inherit;
|
right: inherit;
|
||||||
float:left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-related h3 span.delete label {
|
.inline-related h3 span.delete label {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var SelectBox = {
|
var SelectBox = {
|
||||||
cache: new Object(),
|
cache: new Object(),
|
||||||
init: function(id) {
|
init: function (id) {
|
||||||
var box = document.getElementById(id);
|
var box = document.getElementById(id);
|
||||||
var node;
|
var node;
|
||||||
SelectBox.cache[id] = new Array();
|
SelectBox.cache[id] = new Array();
|
||||||
@ -9,7 +9,7 @@ var SelectBox = {
|
|||||||
cache.push({value: node.value, text: node.text, displayed: 1});
|
cache.push({value: node.value, text: node.text, displayed: 1});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
redisplay: function(id) {
|
redisplay: function (id) {
|
||||||
// Repopulate HTML select box from cache
|
// Repopulate HTML select box from cache
|
||||||
var box = document.getElementById(id);
|
var box = document.getElementById(id);
|
||||||
box.options.length = 0; // clear all options
|
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
|
// Redisplay the HTML select box, displaying only the choices containing ALL
|
||||||
// the words in text. (It's an AND search.)
|
// the words in text. (It's an AND search.)
|
||||||
var tokens = text.toLowerCase().split(/\s+/);
|
var tokens = text.toLowerCase().split(/\s+/);
|
||||||
@ -35,7 +35,7 @@ var SelectBox = {
|
|||||||
}
|
}
|
||||||
SelectBox.redisplay(id);
|
SelectBox.redisplay(id);
|
||||||
},
|
},
|
||||||
delete_from_cache: function(id, value) {
|
delete_from_cache: function (id, value) {
|
||||||
var node, delete_index = null;
|
var node, delete_index = null;
|
||||||
for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
|
for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
|
||||||
if (node.value == value) {
|
if (node.value == value) {
|
||||||
@ -45,14 +45,14 @@ var SelectBox = {
|
|||||||
}
|
}
|
||||||
var j = SelectBox.cache[id].length - 1;
|
var j = SelectBox.cache[id].length - 1;
|
||||||
for (var i = delete_index; i < j; i++) {
|
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--;
|
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});
|
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
|
// Check if an item is contained in the cache
|
||||||
var node;
|
var node;
|
||||||
for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
|
for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
|
||||||
@ -62,7 +62,7 @@ var SelectBox = {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
move: function(from, to) {
|
move: function (from, to) {
|
||||||
var from_box = document.getElementById(from);
|
var from_box = document.getElementById(from);
|
||||||
var to_box = document.getElementById(to);
|
var to_box = document.getElementById(to);
|
||||||
var option;
|
var option;
|
||||||
@ -75,7 +75,7 @@ var SelectBox = {
|
|||||||
SelectBox.redisplay(from);
|
SelectBox.redisplay(from);
|
||||||
SelectBox.redisplay(to);
|
SelectBox.redisplay(to);
|
||||||
},
|
},
|
||||||
move_all: function(from, to) {
|
move_all: function (from, to) {
|
||||||
var from_box = document.getElementById(from);
|
var from_box = document.getElementById(from);
|
||||||
var to_box = document.getElementById(to);
|
var to_box = document.getElementById(to);
|
||||||
var option;
|
var option;
|
||||||
@ -88,8 +88,8 @@ var SelectBox = {
|
|||||||
SelectBox.redisplay(from);
|
SelectBox.redisplay(from);
|
||||||
SelectBox.redisplay(to);
|
SelectBox.redisplay(to);
|
||||||
},
|
},
|
||||||
sort: function(id) {
|
sort: function (id) {
|
||||||
SelectBox.cache[id].sort( function(a, b) {
|
SelectBox.cache[id].sort(function (a, b) {
|
||||||
a = a.text.toLowerCase();
|
a = a.text.toLowerCase();
|
||||||
b = b.text.toLowerCase();
|
b = b.text.toLowerCase();
|
||||||
try {
|
try {
|
||||||
@ -100,9 +100,9 @@ var SelectBox = {
|
|||||||
// silently fail on IE 'unknown' exception
|
// silently fail on IE 'unknown' exception
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} );
|
});
|
||||||
},
|
},
|
||||||
select_all: function(id) {
|
select_all: function (id) {
|
||||||
var box = document.getElementById(id);
|
var box = document.getElementById(id);
|
||||||
for (var i = 0; i < box.options.length; i++) {
|
for (var i = 0; i < box.options.length; i++) {
|
||||||
box.options[i].selected = 'selected';
|
box.options[i].selected = 'selected';
|
||||||
|
@ -1,161 +1,179 @@
|
|||||||
/*
|
/*
|
||||||
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.
|
Requires core.js, SelectBox.js and addevent.js.
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function ($) {
|
||||||
function findForm(node) {
|
function findForm(node) {
|
||||||
// returns the node of the form containing the given node
|
// returns the node of the form containing the given node
|
||||||
if (node.tagName.toLowerCase() != 'form') {
|
if (node.tagName.toLowerCase() != 'form') {
|
||||||
return findForm(node.parentNode);
|
return findForm(node.parentNode);
|
||||||
|
}
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.SelectFilter = {
|
window.SelectFilter = {
|
||||||
init: function(field_id, field_name, is_stacked, admin_static_prefix) {
|
init: function (field_id, field_name, is_stacked, admin_static_prefix) {
|
||||||
if (field_id.match(/__prefix__/)){
|
if (field_id.match(/__prefix__/)) {
|
||||||
// Don't intialize on empty forms.
|
// Don't intialize on empty forms.
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
var from_box = document.getElementById(field_id);
|
|
||||||
from_box.id += '_from'; // change its ID
|
|
||||||
from_box.className = 'filtered';
|
|
||||||
|
|
||||||
var ps = from_box.parentNode.getElementsByTagName('p');
|
|
||||||
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]);
|
|
||||||
} else if (ps[i].className.indexOf("help") != -1) {
|
|
||||||
// Move help text up to the top so it isn't below the select
|
|
||||||
// boxes or wrapped off on the side to the right of the add
|
|
||||||
// button:
|
|
||||||
from_box.parentNode.insertBefore(ps[i], from_box.parentNode.firstChild);
|
|
||||||
}
|
}
|
||||||
}
|
var from_box = document.getElementById(field_id);
|
||||||
|
from_box.id += '_from'; // change its ID
|
||||||
|
from_box.className = 'filtered';
|
||||||
|
|
||||||
// <div class="selector"> or <div class="selector stacked">
|
var ps = from_box.parentNode.getElementsByTagName('p');
|
||||||
var selector_div = quickElement('div', from_box.parentNode);
|
for (var i = 0; i < ps.length; i++) {
|
||||||
selector_div.className = is_stacked ? 'selector stacked' : 'selector';
|
if (ps[i].className.indexOf("info") != -1) {
|
||||||
|
// Remove <p class="info">, because it just gets in the way.
|
||||||
// <div class="selector-available">
|
from_box.parentNode.removeChild(ps[i]);
|
||||||
var selector_available = quickElement('div', selector_div, '');
|
} else if (ps[i].className.indexOf("help") != -1) {
|
||||||
selector_available.className = 'selector-available';
|
// Move help text up to the top so it isn't below the select
|
||||||
var title_available = quickElement('h2', selector_available, interpolate(gettext('Available %s') + ' ', [field_name]));
|
// boxes or wrapped off on the side to the right of the add
|
||||||
quickElement('img', title_available, '', 'src', admin_static_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of available %s. You may choose some by selecting them in the box below and then clicking the "Choose" arrow between the two boxes.'), [field_name]));
|
// button:
|
||||||
|
from_box.parentNode.insertBefore(ps[i], from_box.parentNode.firstChild);
|
||||||
var filter_p = quickElement('p', selector_available, '', 'id', field_id + '_filter');
|
}
|
||||||
filter_p.className = 'selector-filter';
|
|
||||||
|
|
||||||
var search_filter_label = quickElement('label', filter_p, '', 'for', field_id + "_input");
|
|
||||||
|
|
||||||
var search_selector_img = quickElement('img', search_filter_label, '', 'src', admin_static_prefix + 'img/selector-search.gif', 'class', 'help-tooltip', 'alt', '', 'title', interpolate(gettext("Type into this box to filter down the list of available %s."), [field_name]));
|
|
||||||
|
|
||||||
filter_p.appendChild(document.createTextNode(' '));
|
|
||||||
|
|
||||||
var filter_input = quickElement('input', filter_p, '', 'type', 'text', 'placeholder', gettext("Filter"));
|
|
||||||
filter_input.id = field_id + '_input';
|
|
||||||
|
|
||||||
selector_available.appendChild(from_box);
|
|
||||||
var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'title', interpolate(gettext('Click to choose all %s at once.'), [field_name]), 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_all_link');
|
|
||||||
choose_all.className = 'selector-chooseall';
|
|
||||||
|
|
||||||
// <ul class="selector-chooser">
|
|
||||||
var selector_chooser = quickElement('ul', selector_div, '');
|
|
||||||
selector_chooser.className = 'selector-chooser';
|
|
||||||
var add_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Choose'), 'title', gettext('Choose'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_link');
|
|
||||||
add_link.className = 'selector-add';
|
|
||||||
var remove_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Remove'), 'title', gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_link');
|
|
||||||
remove_link.className = 'selector-remove';
|
|
||||||
|
|
||||||
// <div class="selector-chosen">
|
|
||||||
var selector_chosen = quickElement('div', selector_div, '');
|
|
||||||
selector_chosen.className = 'selector-chosen';
|
|
||||||
var title_chosen = quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s') + ' ', [field_name]));
|
|
||||||
quickElement('img', title_chosen, '', 'src', admin_static_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of chosen %s. You may remove some by selecting them in the box below and then clicking the "Remove" arrow between the two boxes.'), [field_name]));
|
|
||||||
|
|
||||||
var to_box = quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name'));
|
|
||||||
to_box.className = 'filtered';
|
|
||||||
var clear_all = quickElement('a', selector_chosen, gettext('Remove all'), 'title', interpolate(gettext('Click to remove all chosen %s at once.'), [field_name]), 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_all_link');
|
|
||||||
clear_all.className = 'selector-clearall';
|
|
||||||
|
|
||||||
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'); });
|
|
||||||
SelectBox.init(field_id + '_from');
|
|
||||||
SelectBox.init(field_id + '_to');
|
|
||||||
// Move selected from_box options to to_box
|
|
||||||
SelectBox.move(field_id + '_from', field_id + '_to');
|
|
||||||
|
|
||||||
if (!is_stacked) {
|
|
||||||
// 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()); }
|
|
||||||
if (j_from_box.outerHeight() > 0) {
|
|
||||||
resize_filters(); // This fieldset is already open. Resize now.
|
|
||||||
} else {
|
|
||||||
// This fieldset is probably collapsed. Wait for its 'show' event.
|
|
||||||
j_to_box.closest('fieldset').one('show.fieldset', resize_filters);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Initial icon refresh
|
// <div class="selector"> or <div class="selector stacked">
|
||||||
SelectFilter.refresh_icons(field_id);
|
var selector_div = quickElement('div', from_box.parentNode);
|
||||||
},
|
selector_div.className = is_stacked ? 'selector stacked' : 'selector';
|
||||||
refresh_icons: function(field_id) {
|
|
||||||
var from = $('#' + field_id + '_from');
|
// <div class="selector-available">
|
||||||
var to = $('#' + field_id + '_to');
|
var selector_available = quickElement('div', selector_div, '');
|
||||||
var is_from_selected = from.find('option:selected').length > 0;
|
selector_available.className = 'selector-available';
|
||||||
var is_to_selected = to.find('option:selected').length > 0;
|
var title_available = quickElement('h2', selector_available, interpolate(gettext('Available %s') + ' ', [field_name]));
|
||||||
// Active if at least one item is selected
|
quickElement('img', title_available, '', 'src', admin_static_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of available %s. You may choose some by selecting them in the box below and then clicking the "Choose" arrow between the two boxes.'), [field_name]));
|
||||||
$('#' + field_id + '_add_link').toggleClass('active', is_from_selected);
|
|
||||||
$('#' + field_id + '_remove_link').toggleClass('active', is_to_selected);
|
var filter_p = quickElement('p', selector_available, '', 'id', field_id + '_filter');
|
||||||
// Active if the corresponding box isn't empty
|
filter_p.className = 'selector-filter';
|
||||||
$('#' + field_id + '_add_all_link').toggleClass('active', from.find('option').length > 0);
|
|
||||||
$('#' + field_id + '_remove_all_link').toggleClass('active', to.find('option').length > 0);
|
var search_filter_label = quickElement('label', filter_p, '', 'for', field_id + "_input");
|
||||||
},
|
|
||||||
filter_key_up: function(event, field_id) {
|
var search_selector_img = quickElement('img', search_filter_label, '', 'src', admin_static_prefix + 'img/selector-search.gif', 'class', 'help-tooltip', 'alt', '', 'title', interpolate(gettext("Type into this box to filter down the list of available %s."), [field_name]));
|
||||||
var from = document.getElementById(field_id + '_from');
|
|
||||||
// don't submit form if user pressed Enter
|
filter_p.appendChild(document.createTextNode(' '));
|
||||||
if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
|
|
||||||
from.selectedIndex = 0;
|
var filter_input = quickElement('input', filter_p, '', 'type', 'text', 'placeholder', gettext("Filter"));
|
||||||
|
filter_input.id = field_id + '_input';
|
||||||
|
|
||||||
|
selector_available.appendChild(from_box);
|
||||||
|
var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'title', interpolate(gettext('Click to choose all %s at once.'), [field_name]), 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_all_link');
|
||||||
|
choose_all.className = 'selector-chooseall';
|
||||||
|
|
||||||
|
// <ul class="selector-chooser">
|
||||||
|
var selector_chooser = quickElement('ul', selector_div, '');
|
||||||
|
selector_chooser.className = 'selector-chooser';
|
||||||
|
var add_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Choose'), 'title', gettext('Choose'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_link');
|
||||||
|
add_link.className = 'selector-add';
|
||||||
|
var remove_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Remove'), 'title', gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_link');
|
||||||
|
remove_link.className = 'selector-remove';
|
||||||
|
|
||||||
|
// <div class="selector-chosen">
|
||||||
|
var selector_chosen = quickElement('div', selector_div, '');
|
||||||
|
selector_chosen.className = 'selector-chosen';
|
||||||
|
var title_chosen = quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s') + ' ', [field_name]));
|
||||||
|
quickElement('img', title_chosen, '', 'src', admin_static_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of chosen %s. You may remove some by selecting them in the box below and then clicking the "Remove" arrow between the two boxes.'), [field_name]));
|
||||||
|
|
||||||
|
var to_box = quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name'));
|
||||||
|
to_box.className = 'filtered';
|
||||||
|
var clear_all = quickElement('a', selector_chosen, gettext('Remove all'), 'title', interpolate(gettext('Click to remove all chosen %s at once.'), [field_name]), 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_all_link');
|
||||||
|
clear_all.className = 'selector-clearall';
|
||||||
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
SelectBox.init(field_id + '_from');
|
||||||
|
SelectBox.init(field_id + '_to');
|
||||||
|
// Move selected from_box options to to_box
|
||||||
SelectBox.move(field_id + '_from', field_id + '_to');
|
SelectBox.move(field_id + '_from', field_id + '_to');
|
||||||
from.selectedIndex = 0;
|
|
||||||
return false;
|
if (!is_stacked) {
|
||||||
|
// 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());
|
||||||
|
}
|
||||||
|
if (j_from_box.outerHeight() > 0) {
|
||||||
|
resize_filters(); // This fieldset is already open. Resize now.
|
||||||
|
} else {
|
||||||
|
// This fieldset is probably collapsed. Wait for its 'show' event.
|
||||||
|
j_to_box.closest('fieldset').one('show.fieldset', resize_filters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initial icon refresh
|
||||||
|
SelectFilter.refresh_icons(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;
|
||||||
|
var is_to_selected = to.find('option:selected').length > 0;
|
||||||
|
// Active if at least one item is selected
|
||||||
|
$('#' + field_id + '_add_link').toggleClass('active', is_from_selected);
|
||||||
|
$('#' + field_id + '_remove_link').toggleClass('active', is_to_selected);
|
||||||
|
// Active if the corresponding box isn't empty
|
||||||
|
$('#' + 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) {
|
||||||
|
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)) {
|
||||||
|
from.selectedIndex = 0;
|
||||||
|
SelectBox.move(field_id + '_from', field_id + '_to');
|
||||||
|
from.selectedIndex = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var temp = from.selectedIndex;
|
||||||
|
SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
|
||||||
|
from.selectedIndex = temp;
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
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)) {
|
||||||
|
var old_index = from.selectedIndex;
|
||||||
|
SelectBox.move(field_id + '_from', field_id + '_to');
|
||||||
|
from.selectedIndex = (old_index == from.length) ? from.length - 1 : old_index;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// down arrow -- wrap around
|
||||||
|
if ((event.which && event.which == 40) || (event.keyCode && event.keyCode == 40)) {
|
||||||
|
from.selectedIndex = (from.length == from.selectedIndex + 1) ? 0 : from.selectedIndex + 1;
|
||||||
|
}
|
||||||
|
// up arrow -- wrap around
|
||||||
|
if ((event.which && event.which == 38) || (event.keyCode && event.keyCode == 38)) {
|
||||||
|
from.selectedIndex = (from.selectedIndex == 0) ? from.length - 1 : from.selectedIndex - 1;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
var temp = from.selectedIndex;
|
|
||||||
SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
|
|
||||||
from.selectedIndex = temp;
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
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)) {
|
|
||||||
var old_index = from.selectedIndex;
|
|
||||||
SelectBox.move(field_id + '_from', field_id + '_to');
|
|
||||||
from.selectedIndex = (old_index == from.length) ? from.length - 1 : old_index;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// down arrow -- wrap around
|
|
||||||
if ((event.which && event.which == 40) || (event.keyCode && event.keyCode == 40)) {
|
|
||||||
from.selectedIndex = (from.length == from.selectedIndex + 1) ? 0 : from.selectedIndex + 1;
|
|
||||||
}
|
|
||||||
// up arrow -- wrap around
|
|
||||||
if ((event.which && event.which == 38) || (event.keyCode && event.keyCode == 38)) {
|
|
||||||
from.selectedIndex = (from.selectedIndex == 0) ? from.length - 1 : from.selectedIndex - 1;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
|
@ -1,139 +1,141 @@
|
|||||||
(function($) {
|
(function ($) {
|
||||||
$.fn.actions = function(opts) {
|
$.fn.actions = function (opts) {
|
||||||
var options = $.extend({}, $.fn.actions.defaults, opts);
|
var options = $.extend({}, $.fn.actions.defaults, opts);
|
||||||
var actionCheckboxes = $(this);
|
var actionCheckboxes = $(this);
|
||||||
var list_editable_changed = false;
|
var list_editable_changed = false;
|
||||||
var checker = function(checked) {
|
var checker = function (checked) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
showQuestion();
|
showQuestion();
|
||||||
} else {
|
} else {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
$(actionCheckboxes).prop("checked", checked)
|
$(actionCheckboxes).prop("checked", checked)
|
||||||
.parent().parent().toggleClass(options.selectedClass, checked);
|
.parent().parent().toggleClass(options.selectedClass, checked);
|
||||||
},
|
},
|
||||||
updateCounter = function() {
|
updateCounter = function () {
|
||||||
var sel = $(actionCheckboxes).filter(":checked").length;
|
var sel = $(actionCheckboxes).filter(":checked").length;
|
||||||
$(options.counterContainer).html(interpolate(
|
$(options.counterContainer).html(interpolate(
|
||||||
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
|
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
|
||||||
sel: sel,
|
sel: sel,
|
||||||
cnt: _actions_icnt
|
cnt: _actions_icnt
|
||||||
}, true));
|
}, true));
|
||||||
$(options.allToggle).prop("checked", function() {
|
$(options.allToggle).prop("checked", function () {
|
||||||
if (sel == actionCheckboxes.length) {
|
if (sel == actionCheckboxes.length) {
|
||||||
value = true;
|
value = true;
|
||||||
showQuestion();
|
showQuestion();
|
||||||
} else {
|
} else {
|
||||||
value = false;
|
value = false;
|
||||||
clearAcross();
|
clearAcross();
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showQuestion = function() {
|
showQuestion = function () {
|
||||||
$(options.acrossClears).hide();
|
$(options.acrossClears).hide();
|
||||||
$(options.acrossQuestions).show();
|
$(options.acrossQuestions).show();
|
||||||
$(options.allContainer).hide();
|
$(options.allContainer).hide();
|
||||||
},
|
},
|
||||||
showClear = function() {
|
showClear = function () {
|
||||||
$(options.acrossClears).show();
|
$(options.acrossClears).show();
|
||||||
$(options.acrossQuestions).hide();
|
$(options.acrossQuestions).hide();
|
||||||
$(options.actionContainer).toggleClass(options.selectedClass);
|
$(options.actionContainer).toggleClass(options.selectedClass);
|
||||||
$(options.allContainer).show();
|
$(options.allContainer).show();
|
||||||
$(options.counterContainer).hide();
|
$(options.counterContainer).hide();
|
||||||
},
|
},
|
||||||
reset = function() {
|
reset = function () {
|
||||||
$(options.acrossClears).hide();
|
$(options.acrossClears).hide();
|
||||||
$(options.acrossQuestions).hide();
|
$(options.acrossQuestions).hide();
|
||||||
$(options.allContainer).hide();
|
$(options.allContainer).hide();
|
||||||
$(options.counterContainer).show();
|
$(options.counterContainer).show();
|
||||||
},
|
},
|
||||||
clearAcross = function() {
|
clearAcross = function () {
|
||||||
reset();
|
reset();
|
||||||
$(options.acrossInput).val(0);
|
$(options.acrossInput).val(0);
|
||||||
$(options.actionContainer).removeClass(options.selectedClass);
|
$(options.actionContainer).removeClass(options.selectedClass);
|
||||||
};
|
};
|
||||||
// Show counter by default
|
// Show counter by default
|
||||||
$(options.counterContainer).show();
|
$(options.counterContainer).show();
|
||||||
// Check state of checkboxes and reinit state if needed
|
// 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);
|
$(this).parent().parent().toggleClass(options.selectedClass);
|
||||||
updateCounter();
|
updateCounter();
|
||||||
if ($(options.acrossInput).val() == 1) {
|
if ($(options.acrossInput).val() == 1) {
|
||||||
showClear();
|
showClear();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(options.allToggle).show().click(function() {
|
$(options.allToggle).show().click(function () {
|
||||||
checker($(this).prop("checked"));
|
checker($(this).prop("checked"));
|
||||||
updateCounter();
|
updateCounter();
|
||||||
});
|
});
|
||||||
$("div.actions span.question a").click(function(event) {
|
$("div.actions span.question a").click(function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(options.acrossInput).val(1);
|
$(options.acrossInput).val(1);
|
||||||
showClear();
|
showClear();
|
||||||
});
|
});
|
||||||
$("div.actions span.clear a").click(function(event) {
|
$("div.actions span.clear a").click(function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(options.allToggle).prop("checked", false);
|
$(options.allToggle).prop("checked", false);
|
||||||
clearAcross();
|
clearAcross();
|
||||||
checker(0);
|
checker(0);
|
||||||
updateCounter();
|
updateCounter();
|
||||||
});
|
});
|
||||||
lastChecked = null;
|
lastChecked = null;
|
||||||
$(actionCheckboxes).click(function(event) {
|
$(actionCheckboxes).click(function (event) {
|
||||||
if (!event) { event = window.event; }
|
if (!event) {
|
||||||
var target = event.target ? event.target : event.srcElement;
|
event = window.event;
|
||||||
if (lastChecked && $.data(lastChecked) != $.data(target) && event.shiftKey === true) {
|
}
|
||||||
var inrange = false;
|
var target = event.target ? event.target : event.srcElement;
|
||||||
$(lastChecked).prop("checked", target.checked)
|
if (lastChecked && $.data(lastChecked) != $.data(target) && event.shiftKey === true) {
|
||||||
.parent().parent().toggleClass(options.selectedClass, target.checked);
|
var inrange = false;
|
||||||
$(actionCheckboxes).each(function() {
|
$(lastChecked).prop("checked", target.checked)
|
||||||
if ($.data(this) == $.data(lastChecked) || $.data(this) == $.data(target)) {
|
.parent().parent().toggleClass(options.selectedClass, target.checked);
|
||||||
inrange = (inrange) ? false : true;
|
$(actionCheckboxes).each(function () {
|
||||||
}
|
if ($.data(this) == $.data(lastChecked) || $.data(this) == $.data(target)) {
|
||||||
if (inrange) {
|
inrange = (inrange) ? false : true;
|
||||||
$(this).prop("checked", target.checked)
|
}
|
||||||
.parent().parent().toggleClass(options.selectedClass, target.checked);
|
if (inrange) {
|
||||||
}
|
$(this).prop("checked", target.checked)
|
||||||
});
|
.parent().parent().toggleClass(options.selectedClass, target.checked);
|
||||||
}
|
}
|
||||||
$(target).parent().parent().toggleClass(options.selectedClass, target.checked);
|
});
|
||||||
lastChecked = target;
|
}
|
||||||
updateCounter();
|
$(target).parent().parent().toggleClass(options.selectedClass, target.checked);
|
||||||
});
|
lastChecked = target;
|
||||||
$('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function() {
|
updateCounter();
|
||||||
list_editable_changed = true;
|
});
|
||||||
});
|
$('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function () {
|
||||||
$('form#changelist-form button[name="index"]').click(function(event) {
|
list_editable_changed = true;
|
||||||
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 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) {
|
}
|
||||||
var action_changed = false;
|
});
|
||||||
$('div.actions select option:selected').each(function() {
|
$('form#changelist-form input[name="_save"]').click(function (event) {
|
||||||
if ($(this).val()) {
|
var action_changed = false;
|
||||||
action_changed = true;
|
$('div.actions select option:selected').each(function () {
|
||||||
}
|
if ($(this).val()) {
|
||||||
});
|
action_changed = true;
|
||||||
if (action_changed) {
|
}
|
||||||
if (list_editable_changed) {
|
});
|
||||||
return 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."));
|
if (action_changed) {
|
||||||
} else {
|
if (list_editable_changed) {
|
||||||
return 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."));
|
return 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."));
|
||||||
}
|
} else {
|
||||||
}
|
return 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."));
|
||||||
});
|
}
|
||||||
};
|
}
|
||||||
/* Setup plugin defaults */
|
});
|
||||||
$.fn.actions.defaults = {
|
};
|
||||||
actionContainer: "div.actions",
|
/* Setup plugin defaults */
|
||||||
counterContainer: "span.action-counter",
|
$.fn.actions.defaults = {
|
||||||
allContainer: "div.actions span.all",
|
actionContainer: "div.actions",
|
||||||
acrossInput: "div.actions input.select-across",
|
counterContainer: "span.action-counter",
|
||||||
acrossQuestions: "div.actions span.question",
|
allContainer: "div.actions span.all",
|
||||||
acrossClears: "div.actions span.clear",
|
acrossInput: "div.actions input.select-across",
|
||||||
allToggle: "#action-toggle",
|
acrossQuestions: "div.actions span.question",
|
||||||
selectedClass: "selected"
|
acrossClears: "div.actions span.clear",
|
||||||
};
|
allToggle: "#action-toggle",
|
||||||
|
selectedClass: "selected"
|
||||||
|
};
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
|
102
static/admin/js/actions.min.js
vendored
102
static/admin/js/actions.min.js
vendored
@ -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) {
|
||||||
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.fn.actions = function (n) {
|
||||||
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?
|
var b = a.extend({}, a.fn.actions.defaults, n), e = a(this), g = false, k = function (c) {
|
||||||
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=
|
c ? i() : j();
|
||||||
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.")):
|
a(e).prop("checked", c).parent().parent().toggleClass(b.selectedClass, c)
|
||||||
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);
|
}, 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);
|
||||||
|
@ -15,7 +15,7 @@ var DateTimeShortcuts = {
|
|||||||
clockLinkName: 'clocklink', // name of the link that is used to toggle
|
clockLinkName: 'clocklink', // name of the link that is used to toggle
|
||||||
shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
|
shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
|
||||||
admin_media_prefix: '',
|
admin_media_prefix: '',
|
||||||
init: function() {
|
init: function () {
|
||||||
// Get admin_media_prefix by grabbing it off the window object. It's
|
// 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
|
// 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
|
// overridden the template. In that case, we'll set a clearly-invalid
|
||||||
@ -27,7 +27,7 @@ var DateTimeShortcuts = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var inputs = document.getElementsByTagName('input');
|
var inputs = document.getElementsByTagName('input');
|
||||||
for (i=0; i<inputs.length; i++) {
|
for (i = 0; i < inputs.length; i++) {
|
||||||
var inp = inputs[i];
|
var inp = inputs[i];
|
||||||
if (inp.getAttribute('type') == 'text' && inp.className.match(/vTimeField/)) {
|
if (inp.getAttribute('type') == 'text' && inp.className.match(/vTimeField/)) {
|
||||||
DateTimeShortcuts.addClock(inp);
|
DateTimeShortcuts.addClock(inp);
|
||||||
@ -38,10 +38,13 @@ var DateTimeShortcuts = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Add clock widget to a given field
|
// Add clock widget to a given field
|
||||||
addClock: function(inp) {
|
addClock: function (inp) {
|
||||||
var num = DateTimeShortcuts.clockInputs.length;
|
var num = DateTimeShortcuts.clockInputs.length;
|
||||||
DateTimeShortcuts.clockInputs[num] = inp;
|
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)
|
// Shortcut links (clock icon and "Now" link)
|
||||||
var shortcuts_span = document.createElement('span');
|
var shortcuts_span = document.createElement('span');
|
||||||
@ -93,7 +96,7 @@ var DateTimeShortcuts = {
|
|||||||
var cancel_p = quickElement('p', clock_box, '');
|
var cancel_p = quickElement('p', clock_box, '');
|
||||||
cancel_p.className = 'calendar-cancel';
|
cancel_p.className = 'calendar-cancel';
|
||||||
quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissClock(' + num + ');');
|
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) {
|
if (event.which == 27) {
|
||||||
// ESC key closes popup
|
// ESC key closes popup
|
||||||
DateTimeShortcuts.dismissClock(num);
|
DateTimeShortcuts.dismissClock(num);
|
||||||
@ -101,13 +104,13 @@ var DateTimeShortcuts = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openClock: function(num) {
|
openClock: function (num) {
|
||||||
var clock_box = document.getElementById(DateTimeShortcuts.clockDivName+num)
|
var clock_box = document.getElementById(DateTimeShortcuts.clockDivName + num)
|
||||||
var clock_link = document.getElementById(DateTimeShortcuts.clockLinkName+num)
|
var clock_link = document.getElementById(DateTimeShortcuts.clockLinkName + num)
|
||||||
|
|
||||||
// Recalculate the clockbox position
|
// Recalculate the clockbox position
|
||||||
// is it left-to-right or right-to-left layout ?
|
// 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';
|
clock_box.style.left = findPosX(clock_link) + 17 + 'px';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -123,21 +126,24 @@ var DateTimeShortcuts = {
|
|||||||
clock_box.style.display = 'block';
|
clock_box.style.display = 'block';
|
||||||
addEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
|
addEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
|
||||||
},
|
},
|
||||||
dismissClock: function(num) {
|
dismissClock: function (num) {
|
||||||
document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
|
document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
|
||||||
removeEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
|
removeEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
|
||||||
},
|
},
|
||||||
handleClockQuicklink: function(num, val) {
|
handleClockQuicklink: function (num, val) {
|
||||||
DateTimeShortcuts.clockInputs[num].value = val;
|
DateTimeShortcuts.clockInputs[num].value = val;
|
||||||
DateTimeShortcuts.clockInputs[num].focus();
|
DateTimeShortcuts.clockInputs[num].focus();
|
||||||
DateTimeShortcuts.dismissClock(num);
|
DateTimeShortcuts.dismissClock(num);
|
||||||
},
|
},
|
||||||
// Add calendar widget to a given field.
|
// Add calendar widget to a given field.
|
||||||
addCalendar: function(inp) {
|
addCalendar: function (inp) {
|
||||||
var num = DateTimeShortcuts.calendars.length;
|
var num = DateTimeShortcuts.calendars.length;
|
||||||
|
|
||||||
DateTimeShortcuts.calendarInputs[num] = inp;
|
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)
|
// Shortcut links (calendar icon and "Today" link)
|
||||||
var shortcuts_span = document.createElement('span');
|
var shortcuts_span = document.createElement('span');
|
||||||
@ -182,9 +188,9 @@ var DateTimeShortcuts = {
|
|||||||
|
|
||||||
// next-prev links
|
// next-prev links
|
||||||
var cal_nav = quickElement('div', cal_box, '');
|
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';
|
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';
|
cal_nav_next.className = 'calendarnav-next';
|
||||||
|
|
||||||
// main box
|
// main box
|
||||||
@ -206,7 +212,7 @@ var DateTimeShortcuts = {
|
|||||||
var cancel_p = quickElement('p', cal_box, '');
|
var cancel_p = quickElement('p', cal_box, '');
|
||||||
cancel_p.className = 'calendar-cancel';
|
cancel_p.className = 'calendar-cancel';
|
||||||
quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissCalendar(' + num + ');');
|
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) {
|
if (event.which == 27) {
|
||||||
// ESC key closes popup
|
// ESC key closes popup
|
||||||
DateTimeShortcuts.dismissCalendar(num);
|
DateTimeShortcuts.dismissCalendar(num);
|
||||||
@ -214,9 +220,9 @@ var DateTimeShortcuts = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openCalendar: function(num) {
|
openCalendar: function (num) {
|
||||||
var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num)
|
var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1 + num)
|
||||||
var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName+num)
|
var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName + num)
|
||||||
var inp = DateTimeShortcuts.calendarInputs[num];
|
var inp = DateTimeShortcuts.calendarInputs[num];
|
||||||
|
|
||||||
// Determine if the current value in the input has a valid date.
|
// Determine if the current value in the input has a valid date.
|
||||||
@ -232,7 +238,7 @@ var DateTimeShortcuts = {
|
|||||||
|
|
||||||
// Recalculate the clockbox position
|
// Recalculate the clockbox position
|
||||||
// is it left-to-right or right-to-left layout ?
|
// 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';
|
cal_box.style.left = findPosX(cal_link) + 17 + 'px';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -247,17 +253,17 @@ var DateTimeShortcuts = {
|
|||||||
cal_box.style.display = 'block';
|
cal_box.style.display = 'block';
|
||||||
addEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
addEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
||||||
},
|
},
|
||||||
dismissCalendar: function(num) {
|
dismissCalendar: function (num) {
|
||||||
document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'none';
|
document.getElementById(DateTimeShortcuts.calendarDivName1 + num).style.display = 'none';
|
||||||
removeEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
removeEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
||||||
},
|
},
|
||||||
drawPrev: function(num) {
|
drawPrev: function (num) {
|
||||||
DateTimeShortcuts.calendars[num].drawPreviousMonth();
|
DateTimeShortcuts.calendars[num].drawPreviousMonth();
|
||||||
},
|
},
|
||||||
drawNext: function(num) {
|
drawNext: function (num) {
|
||||||
DateTimeShortcuts.calendars[num].drawNextMonth();
|
DateTimeShortcuts.calendars[num].drawNextMonth();
|
||||||
},
|
},
|
||||||
handleCalendarCallback: function(num) {
|
handleCalendarCallback: function (num) {
|
||||||
format = get_format('DATE_INPUT_FORMATS')[0];
|
format = get_format('DATE_INPUT_FORMATS')[0];
|
||||||
// the format needs to be escaped a little
|
// the format needs to be escaped a little
|
||||||
format = format.replace('\\', '\\\\');
|
format = format.replace('\\', '\\\\');
|
||||||
@ -266,21 +272,21 @@ var DateTimeShortcuts = {
|
|||||||
format = format.replace('\t', '\\t');
|
format = format.replace('\t', '\\t');
|
||||||
format = format.replace("'", "\\'");
|
format = format.replace("'", "\\'");
|
||||||
return ["function(y, m, d) { DateTimeShortcuts.calendarInputs[",
|
return ["function(y, m, d) { DateTimeShortcuts.calendarInputs[",
|
||||||
num,
|
num,
|
||||||
"].value = new Date(y, m-1, d).strftime('",
|
"].value = new Date(y, m-1, d).strftime('",
|
||||||
format,
|
format,
|
||||||
"');DateTimeShortcuts.calendarInputs[",
|
"');DateTimeShortcuts.calendarInputs[",
|
||||||
num,
|
num,
|
||||||
"].focus();document.getElementById(DateTimeShortcuts.calendarDivName1+",
|
"].focus();document.getElementById(DateTimeShortcuts.calendarDivName1+",
|
||||||
num,
|
num,
|
||||||
").style.display='none';}"].join('');
|
").style.display='none';}"].join('');
|
||||||
},
|
},
|
||||||
handleCalendarQuickLink: function(num, offset) {
|
handleCalendarQuickLink: function (num, offset) {
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
d.setDate(d.getDate() + offset)
|
d.setDate(d.getDate() + offset)
|
||||||
DateTimeShortcuts.calendarInputs[num].value = d.strftime(get_format('DATE_INPUT_FORMATS')[0]);
|
DateTimeShortcuts.calendarInputs[num].value = d.strftime(get_format('DATE_INPUT_FORMATS')[0]);
|
||||||
DateTimeShortcuts.calendarInputs[num].focus();
|
DateTimeShortcuts.calendarInputs[num].focus();
|
||||||
DateTimeShortcuts.dismissCalendar(num);
|
DateTimeShortcuts.dismissCalendar(num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ function showAddAnotherPopup(triggeringLink) {
|
|||||||
if (href.indexOf('?') == -1) {
|
if (href.indexOf('?') == -1) {
|
||||||
href += '?_popup=1';
|
href += '?_popup=1';
|
||||||
} else {
|
} else {
|
||||||
href += '&_popup=1';
|
href += '&_popup=1';
|
||||||
}
|
}
|
||||||
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
||||||
win.focus();
|
win.focus();
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
calendar.js - Calendar functions by Adrian Holovaty
|
calendar.js - Calendar functions by Adrian Holovaty
|
||||||
depends on core.js for utility functions like removeChildren or quickElement
|
depends on core.js for utility functions like removeChildren or quickElement
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
|
// CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
|
||||||
var CalendarNamespace = {
|
var CalendarNamespace = {
|
||||||
monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
|
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(' '),
|
daysOfWeek: gettext('S M T W T F S').split(' '),
|
||||||
firstDayOfWeek: parseInt(get_format('FIRST_DAY_OF_WEEK')),
|
firstDayOfWeek: parseInt(get_format('FIRST_DAY_OF_WEEK')),
|
||||||
isLeapYear: function(year) {
|
isLeapYear: function (year) {
|
||||||
return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0));
|
return (((year % 4) == 0) && ((year % 100) != 0) || ((year % 400) == 0));
|
||||||
},
|
},
|
||||||
getDaysInMonth: function(month,year) {
|
getDaysInMonth: function (month, year) {
|
||||||
var days;
|
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;
|
days = 31;
|
||||||
}
|
}
|
||||||
else if (month==4 || month==6 || month==9 || month==11) {
|
else if (month == 4 || month == 6 || month == 9 || month == 11) {
|
||||||
days = 30;
|
days = 30;
|
||||||
}
|
}
|
||||||
else if (month==2 && CalendarNamespace.isLeapYear(year)) {
|
else if (month == 2 && CalendarNamespace.isLeapYear(year)) {
|
||||||
days = 29;
|
days = 29;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -27,10 +27,10 @@ var CalendarNamespace = {
|
|||||||
}
|
}
|
||||||
return days;
|
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 today = new Date();
|
||||||
var todayDay = today.getDate();
|
var todayDay = today.getDate();
|
||||||
var todayMonth = today.getMonth()+1;
|
var todayMonth = today.getMonth() + 1;
|
||||||
var todayYear = today.getFullYear();
|
var todayYear = today.getFullYear();
|
||||||
var todayClass = '';
|
var todayClass = '';
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ var CalendarNamespace = {
|
|||||||
var calDiv = document.getElementById(div_id);
|
var calDiv = document.getElementById(div_id);
|
||||||
removeChildren(calDiv);
|
removeChildren(calDiv);
|
||||||
var calTable = document.createElement('table');
|
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);
|
var tableBody = quickElement('tbody', calTable);
|
||||||
|
|
||||||
// Draw days-of-week header
|
// Draw days-of-week header
|
||||||
@ -48,7 +48,7 @@ var CalendarNamespace = {
|
|||||||
quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
|
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);
|
var days = CalendarNamespace.getDaysInMonth(month, year);
|
||||||
|
|
||||||
// Draw blanks before first of month
|
// Draw blanks before first of month
|
||||||
@ -61,17 +61,17 @@ var CalendarNamespace = {
|
|||||||
// Draw days of month
|
// Draw days of month
|
||||||
var currentDay = 1;
|
var currentDay = 1;
|
||||||
for (var i = startingPos; currentDay <= days; i++) {
|
for (var i = startingPos; currentDay <= days; i++) {
|
||||||
if (i%7 == 0 && currentDay != 1) {
|
if (i % 7 == 0 && currentDay != 1) {
|
||||||
tableRow = quickElement('tr', tableBody);
|
tableRow = quickElement('tr', tableBody);
|
||||||
}
|
}
|
||||||
if ((currentDay==todayDay) && (month==todayMonth) && (year==todayYear)) {
|
if ((currentDay == todayDay) && (month == todayMonth) && (year == todayYear)) {
|
||||||
todayClass='today';
|
todayClass = 'today';
|
||||||
} else {
|
} else {
|
||||||
todayClass='';
|
todayClass = '';
|
||||||
}
|
}
|
||||||
var cell = quickElement('td', tableRow, '', 'class', 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++;
|
currentDay++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,15 +99,15 @@ function Calendar(div_id, callback) {
|
|||||||
this.currentYear = this.today.getFullYear();
|
this.currentYear = this.today.getFullYear();
|
||||||
}
|
}
|
||||||
Calendar.prototype = {
|
Calendar.prototype = {
|
||||||
drawCurrent: function() {
|
drawCurrent: function () {
|
||||||
CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback);
|
CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback);
|
||||||
},
|
},
|
||||||
drawDate: function(month, year) {
|
drawDate: function (month, year) {
|
||||||
this.currentMonth = month;
|
this.currentMonth = month;
|
||||||
this.currentYear = year;
|
this.currentYear = year;
|
||||||
this.drawCurrent();
|
this.drawCurrent();
|
||||||
},
|
},
|
||||||
drawPreviousMonth: function() {
|
drawPreviousMonth: function () {
|
||||||
if (this.currentMonth == 1) {
|
if (this.currentMonth == 1) {
|
||||||
this.currentMonth = 12;
|
this.currentMonth = 12;
|
||||||
this.currentYear--;
|
this.currentYear--;
|
||||||
@ -117,7 +117,7 @@ Calendar.prototype = {
|
|||||||
}
|
}
|
||||||
this.drawCurrent();
|
this.drawCurrent();
|
||||||
},
|
},
|
||||||
drawNextMonth: function() {
|
drawNextMonth: function () {
|
||||||
if (this.currentMonth == 12) {
|
if (this.currentMonth == 12) {
|
||||||
this.currentMonth = 1;
|
this.currentMonth = 1;
|
||||||
this.currentYear++;
|
this.currentYear++;
|
||||||
@ -127,11 +127,11 @@ Calendar.prototype = {
|
|||||||
}
|
}
|
||||||
this.drawCurrent();
|
this.drawCurrent();
|
||||||
},
|
},
|
||||||
drawPreviousYear: function() {
|
drawPreviousYear: function () {
|
||||||
this.currentYear--;
|
this.currentYear--;
|
||||||
this.drawCurrent();
|
this.drawCurrent();
|
||||||
},
|
},
|
||||||
drawNextYear: function() {
|
drawNextYear: function () {
|
||||||
this.currentYear++;
|
this.currentYear++;
|
||||||
this.drawCurrent();
|
this.drawCurrent();
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
(function($) {
|
(function ($) {
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
// Add anchor tag for Show/Hide link
|
// 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
|
// Don't hide if fields in this fieldset have errors
|
||||||
if ($(elem).find("div.errors").length == 0) {
|
if ($(elem).find("div.errors").length == 0) {
|
||||||
$(elem).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser' +
|
$(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>)');
|
'</a>)');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Add toggle to anchor tag
|
// 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")) {
|
if ($(this).closest("fieldset").hasClass("collapsed")) {
|
||||||
// Show
|
// Show
|
||||||
$(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]);
|
$(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]);
|
||||||
} else {
|
} else {
|
||||||
// Hide
|
// Hide
|
||||||
$(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]);
|
$(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
|
14
static/admin/js/collapse.min.js
vendored
14
static/admin/js/collapse.min.js
vendored
@ -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",
|
(function (a) {
|
||||||
[a(this).attr("id")]);return!1})})})(django.jQuery);
|
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);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Core javascript helper functions
|
// Core javascript helper functions
|
||||||
|
|
||||||
// basic browser identification & version
|
// 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]);
|
var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]);
|
||||||
|
|
||||||
// Cross-browser event handlers.
|
// Cross-browser event handlers.
|
||||||
@ -44,7 +44,7 @@ function quickElement() {
|
|||||||
}
|
}
|
||||||
var len = arguments.length;
|
var len = arguments.length;
|
||||||
for (var i = 3; i < len; i += 2) {
|
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);
|
arguments[1].appendChild(obj);
|
||||||
return obj;
|
return obj;
|
||||||
@ -62,20 +62,20 @@ function removeChildren(a) {
|
|||||||
var xmlhttp;
|
var xmlhttp;
|
||||||
/*@cc_on @*/
|
/*@cc_on @*/
|
||||||
/*@if (@_jscript_version >= 5)
|
/*@if (@_jscript_version >= 5)
|
||||||
try {
|
try {
|
||||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||||
} catch (E) {
|
} catch (E) {
|
||||||
xmlhttp = false;
|
xmlhttp = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@else
|
@else
|
||||||
xmlhttp = false;
|
xmlhttp = false;
|
||||||
@end @*/
|
@end @*/
|
||||||
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
|
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
|
||||||
xmlhttp = new XMLHttpRequest();
|
xmlhttp = new XMLHttpRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -90,7 +90,7 @@ function findPosX(obj) {
|
|||||||
obj = obj.offsetParent;
|
obj = obj.offsetParent;
|
||||||
}
|
}
|
||||||
// IE offsetParent does not include the top-level
|
// IE offsetParent does not include the top-level
|
||||||
if (isIE && obj.parentElement){
|
if (isIE && obj.parentElement) {
|
||||||
curleft += obj.offsetLeft - obj.scrollLeft;
|
curleft += obj.offsetLeft - obj.scrollLeft;
|
||||||
}
|
}
|
||||||
} else if (obj.x) {
|
} else if (obj.x) {
|
||||||
@ -107,7 +107,7 @@ function findPosY(obj) {
|
|||||||
obj = obj.offsetParent;
|
obj = obj.offsetParent;
|
||||||
}
|
}
|
||||||
// IE offsetParent does not include the top-level
|
// IE offsetParent does not include the top-level
|
||||||
if (isIE && obj.parentElement){
|
if (isIE && obj.parentElement) {
|
||||||
curtop += obj.offsetTop - obj.scrollTop;
|
curtop += obj.offsetTop - obj.scrollTop;
|
||||||
}
|
}
|
||||||
} else if (obj.y) {
|
} else if (obj.y) {
|
||||||
@ -120,49 +120,49 @@ function findPosY(obj) {
|
|||||||
// Date object extensions
|
// Date object extensions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
Date.prototype.getTwelveHours = function() {
|
Date.prototype.getTwelveHours = function () {
|
||||||
hours = this.getHours();
|
hours = this.getHours();
|
||||||
if (hours == 0) {
|
if (hours == 0) {
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return hours <= 12 ? hours : hours-12
|
return hours <= 12 ? hours : hours - 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Date.prototype.getTwoDigitMonth = function() {
|
Date.prototype.getTwoDigitMonth = function () {
|
||||||
return (this.getMonth() < 9) ? '0' + (this.getMonth()+1) : (this.getMonth()+1);
|
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();
|
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();
|
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();
|
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();
|
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();
|
return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
Date.prototype.getHourMinute = function() {
|
Date.prototype.getHourMinute = function () {
|
||||||
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute();
|
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute();
|
||||||
}
|
}
|
||||||
|
|
||||||
Date.prototype.getHourMinuteSecond = function() {
|
Date.prototype.getHourMinuteSecond = function () {
|
||||||
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute() + ':' + this.getTwoDigitSecond();
|
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute() + ':' + this.getTwoDigitSecond();
|
||||||
}
|
}
|
||||||
|
|
||||||
Date.prototype.strftime = function(format) {
|
Date.prototype.strftime = function (format) {
|
||||||
var fields = {
|
var fields = {
|
||||||
c: this.toString(),
|
c: this.toString(),
|
||||||
d: this.getTwoDigitDate(),
|
d: this.getTwoDigitDate(),
|
||||||
@ -177,7 +177,7 @@ Date.prototype.strftime = function(format) {
|
|||||||
X: this.toLocaleTimeString(),
|
X: this.toLocaleTimeString(),
|
||||||
y: ('' + this.getFullYear()).substr(2, 4),
|
y: ('' + this.getFullYear()).substr(2, 4),
|
||||||
Y: '' + this.getFullYear(),
|
Y: '' + this.getFullYear(),
|
||||||
'%' : '%'
|
'%': '%'
|
||||||
};
|
};
|
||||||
var result = '', i = 0;
|
var result = '', i = 0;
|
||||||
while (i < format.length) {
|
while (i < format.length) {
|
||||||
@ -196,7 +196,7 @@ Date.prototype.strftime = function(format) {
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// String object extensions
|
// 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;
|
var new_string = this;
|
||||||
for (var i = 0; new_string.length < pad_length; i++) {
|
for (var i = 0; new_string.length < pad_length; i++) {
|
||||||
new_string = pad_string + new_string;
|
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
|
// Get the computed style for and element
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
function getStyle(oElm, strCssRule){
|
function getStyle(oElm, strCssRule) {
|
||||||
var strValue = "";
|
var strValue = "";
|
||||||
if(document.defaultView && document.defaultView.getComputedStyle){
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
||||||
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
|
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
|
||||||
}
|
}
|
||||||
else if(oElm.currentStyle){
|
else if (oElm.currentStyle) {
|
||||||
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
|
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1) {
|
||||||
return p1.toUpperCase();
|
return p1.toUpperCase();
|
||||||
});
|
});
|
||||||
strValue = oElm.currentStyle[strCssRule];
|
strValue = oElm.currentStyle[strCssRule];
|
||||||
|
@ -14,259 +14,258 @@
|
|||||||
* Licensed under the New BSD License
|
* Licensed under the New BSD License
|
||||||
* See: http://www.opensource.org/licenses/bsd-license.php
|
* See: http://www.opensource.org/licenses/bsd-license.php
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function ($) {
|
||||||
$.fn.formset = function(opts) {
|
$.fn.formset = function (opts) {
|
||||||
var options = $.extend({}, $.fn.formset.defaults, opts);
|
var options = $.extend({}, $.fn.formset.defaults, opts);
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $parent = $this.parent();
|
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 id_regex = new RegExp("(" + prefix + "-(\\d+|__prefix__))");
|
||||||
var replacement = prefix + "-" + ndx;
|
var replacement = prefix + "-" + ndx;
|
||||||
if ($(el).prop("for")) {
|
if ($(el).prop("for")) {
|
||||||
$(el).prop("for", $(el).prop("for").replace(id_regex, replacement));
|
$(el).prop("for", $(el).prop("for").replace(id_regex, replacement));
|
||||||
}
|
}
|
||||||
if (el.id) {
|
if (el.id) {
|
||||||
el.id = el.id.replace(id_regex, replacement);
|
el.id = el.id.replace(id_regex, replacement);
|
||||||
}
|
}
|
||||||
if (el.name) {
|
if (el.name) {
|
||||||
el.name = el.name.replace(id_regex, replacement);
|
el.name = el.name.replace(id_regex, replacement);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS").prop("autocomplete", "off");
|
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS").prop("autocomplete", "off");
|
||||||
var nextIndex = parseInt(totalForms.val(), 10);
|
var nextIndex = parseInt(totalForms.val(), 10);
|
||||||
var maxForms = $("#id_" + options.prefix + "-MAX_NUM_FORMS").prop("autocomplete", "off");
|
var maxForms = $("#id_" + options.prefix + "-MAX_NUM_FORMS").prop("autocomplete", "off");
|
||||||
// only show the add button if we are allowed to add more items,
|
// only show the add button if we are allowed to add more items,
|
||||||
// note that max_num = None translates to a blank string.
|
// note that max_num = None translates to a blank string.
|
||||||
var showAddButton = maxForms.val() === '' || (maxForms.val()-totalForms.val()) > 0;
|
var showAddButton = maxForms.val() === '' || (maxForms.val() - totalForms.val()) > 0;
|
||||||
$this.each(function(i) {
|
$this.each(function (i) {
|
||||||
$(this).not("." + options.emptyCssClass).addClass(options.formCssClass);
|
$(this).not("." + options.emptyCssClass).addClass(options.formCssClass);
|
||||||
});
|
|
||||||
if ($this.length && showAddButton) {
|
|
||||||
var addButton;
|
|
||||||
if ($this.prop("tagName") == "TR") {
|
|
||||||
// If forms are laid out as table rows, insert the
|
|
||||||
// "add" button in a new table row:
|
|
||||||
var numCols = this.eq(-1).children().length;
|
|
||||||
$parent.append('<tr class="' + options.addCssClass + '"><td colspan="' + numCols + '"><a href="javascript:void(0)">' + options.addText + "</a></tr>");
|
|
||||||
addButton = $parent.find("tr:last a");
|
|
||||||
} else {
|
|
||||||
// Otherwise, insert it immediately after the last form:
|
|
||||||
$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) {
|
|
||||||
e.preventDefault();
|
|
||||||
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
|
|
||||||
var template = $("#" + options.prefix + "-empty");
|
|
||||||
var row = template.clone(true);
|
|
||||||
row.removeClass(options.emptyCssClass)
|
|
||||||
.addClass(options.formCssClass)
|
|
||||||
.attr("id", options.prefix + "-" + nextIndex);
|
|
||||||
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>");
|
|
||||||
} 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>");
|
|
||||||
} 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() {
|
|
||||||
updateElementIndex(this, options.prefix, totalForms.val());
|
|
||||||
});
|
});
|
||||||
// Insert the new form when it has been fully edited
|
if ($this.length && showAddButton) {
|
||||||
row.insertBefore($(template));
|
var addButton;
|
||||||
// Update number of total forms
|
if ($this.prop("tagName") == "TR") {
|
||||||
$(totalForms).val(parseInt(totalForms.val(), 10) + 1);
|
// If forms are laid out as table rows, insert the
|
||||||
nextIndex += 1;
|
// "add" button in a new table row:
|
||||||
// Hide add button in case we've hit the max, except we want to add infinitely
|
var numCols = this.eq(-1).children().length;
|
||||||
if ((maxForms.val() !== '') && (maxForms.val()-totalForms.val()) <= 0) {
|
$parent.append('<tr class="' + options.addCssClass + '"><td colspan="' + numCols + '"><a href="javascript:void(0)">' + options.addText + "</a></tr>");
|
||||||
addButton.parent().hide();
|
addButton = $parent.find("tr:last a");
|
||||||
}
|
} else {
|
||||||
// The delete button of each row triggers a bunch of other things
|
// Otherwise, insert it immediately after the last form:
|
||||||
row.find("a." + options.deleteCssClass).click(function(e) {
|
$this.filter(":last").after('<div class="' + options.addCssClass + '"><a href="javascript:void(0)">' + options.addText + "</a></div>");
|
||||||
e.preventDefault();
|
addButton = $this.filter(":last").next().find("a");
|
||||||
// Remove the parent form containing this button:
|
}
|
||||||
var row = $(this).parents("." + options.formCssClass);
|
addButton.click(function (e) {
|
||||||
row.remove();
|
e.preventDefault();
|
||||||
nextIndex -= 1;
|
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
|
||||||
// If a post-delete callback was provided, call it with the deleted form:
|
var template = $("#" + options.prefix + "-empty");
|
||||||
if (options.removed) {
|
var row = template.clone(true);
|
||||||
options.removed(row);
|
row.removeClass(options.emptyCssClass)
|
||||||
}
|
.addClass(options.formCssClass)
|
||||||
// Update the TOTAL_FORMS form count.
|
.attr("id", options.prefix + "-" + nextIndex);
|
||||||
var forms = $("." + options.formCssClass);
|
if (row.is("tr")) {
|
||||||
$("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
|
// If the forms are laid out in table rows, insert
|
||||||
// Show add button again once we drop below max
|
// the remove button into the last table cell:
|
||||||
if ((maxForms.val() === '') || (maxForms.val()-forms.length) > 0) {
|
row.children(":last").append('<div><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText + "</a></div>");
|
||||||
addButton.parent().show();
|
} else if (row.is("ul") || row.is("ol")) {
|
||||||
}
|
// If they're laid out as an ordered/unordered list,
|
||||||
// Also, update names and ids for all remaining form controls
|
// insert an <li> after the last list item:
|
||||||
// so they remain in sequence:
|
row.append('<li><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText + "</a></li>");
|
||||||
for (var i=0, formCount=forms.length; i<formCount; i++)
|
} else {
|
||||||
{
|
// Otherwise, just insert the remove button as the
|
||||||
updateElementIndex($(forms).get(i), options.prefix, i);
|
// last child element of the form's container:
|
||||||
$(forms.get(i)).find("*").each(function() {
|
row.children(":first").append('<span><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText + "</a></span>");
|
||||||
updateElementIndex(this, options.prefix, i);
|
}
|
||||||
|
row.find("*").each(function () {
|
||||||
|
updateElementIndex(this, options.prefix, totalForms.val());
|
||||||
|
});
|
||||||
|
// Insert the new form when it has been fully edited
|
||||||
|
row.insertBefore($(template));
|
||||||
|
// Update number of total forms
|
||||||
|
$(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) {
|
||||||
|
addButton.parent().hide();
|
||||||
|
}
|
||||||
|
// The delete button of each row triggers a bunch of other things
|
||||||
|
row.find("a." + options.deleteCssClass).click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// Remove the parent form containing this button:
|
||||||
|
var row = $(this).parents("." + options.formCssClass);
|
||||||
|
row.remove();
|
||||||
|
nextIndex -= 1;
|
||||||
|
// If a post-delete callback was provided, call it with the deleted form:
|
||||||
|
if (options.removed) {
|
||||||
|
options.removed(row);
|
||||||
|
}
|
||||||
|
// Update the TOTAL_FORMS form count.
|
||||||
|
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) {
|
||||||
|
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++) {
|
||||||
|
updateElementIndex($(forms).get(i), options.prefix, i);
|
||||||
|
$(forms.get(i)).find("*").each(function () {
|
||||||
|
updateElementIndex(this, options.prefix, i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// If a post-add callback was supplied, call it with the added form:
|
||||||
|
if (options.added) {
|
||||||
|
options.added(row);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
// If a post-add callback was supplied, call it with the added form:
|
|
||||||
if (options.added) {
|
|
||||||
options.added(row);
|
|
||||||
}
|
}
|
||||||
});
|
return this;
|
||||||
}
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Setup plugin defaults */
|
|
||||||
$.fn.formset.defaults = {
|
|
||||||
prefix: "form", // The form prefix for your django formset
|
|
||||||
addText: "add another", // Text for the add link
|
|
||||||
deleteText: "remove", // Text for the delete link
|
|
||||||
addCssClass: "add-row", // CSS class applied to the add link
|
|
||||||
deleteCssClass: "delete-row", // CSS class applied to the delete link
|
|
||||||
emptyCssClass: "empty-row", // CSS class applied to the empty row
|
|
||||||
formCssClass: "dynamic-form", // CSS class applied to each form in a formset
|
|
||||||
added: null, // Function called each time a new form is added
|
|
||||||
removed: null // Function called each time a form is deleted
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Tabular inlines ---------------------------------------------------------
|
|
||||||
$.fn.tabularFormset = function(options) {
|
|
||||||
var $rows = $(this);
|
|
||||||
var alternatingRows = function(row) {
|
|
||||||
$($rows.selector).not(".add-row").removeClass("row1 row2")
|
|
||||||
.filter(":even").addClass("row1").end()
|
|
||||||
.filter(":odd").addClass("row2");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var reinitDateTimeShortCuts = function() {
|
/* Setup plugin defaults */
|
||||||
// Reinitialize the calendar and clock widgets by force
|
$.fn.formset.defaults = {
|
||||||
if (typeof DateTimeShortcuts != "undefined") {
|
prefix: "form", // The form prefix for your django formset
|
||||||
$(".datetimeshortcuts").remove();
|
addText: "add another", // Text for the add link
|
||||||
DateTimeShortcuts.init();
|
deleteText: "remove", // Text for the delete link
|
||||||
}
|
addCssClass: "add-row", // CSS class applied to the add link
|
||||||
|
deleteCssClass: "delete-row", // CSS class applied to the delete link
|
||||||
|
emptyCssClass: "empty-row", // CSS class applied to the empty row
|
||||||
|
formCssClass: "dynamic-form", // CSS class applied to each form in a formset
|
||||||
|
added: null, // Function called each time a new form is added
|
||||||
|
removed: null // Function called each time a form is deleted
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateSelectFilter = function() {
|
|
||||||
// If any SelectFilter widgets are a part of the new form,
|
// Tabular inlines ---------------------------------------------------------
|
||||||
// instantiate a new SelectFilter instance for it.
|
$.fn.tabularFormset = function (options) {
|
||||||
if (typeof SelectFilter != 'undefined'){
|
var $rows = $(this);
|
||||||
$('.selectfilter').each(function(index, value){
|
var alternatingRows = function (row) {
|
||||||
var namearr = value.name.split('-');
|
$($rows.selector).not(".add-row").removeClass("row1 row2")
|
||||||
SelectFilter.init(value.id, namearr[namearr.length-1], false, options.adminStaticPrefix );
|
.filter(":even").addClass("row1").end()
|
||||||
|
.filter(":odd").addClass("row2");
|
||||||
|
};
|
||||||
|
|
||||||
|
var reinitDateTimeShortCuts = function () {
|
||||||
|
// Reinitialize the calendar and clock widgets by force
|
||||||
|
if (typeof DateTimeShortcuts != "undefined") {
|
||||||
|
$(".datetimeshortcuts").remove();
|
||||||
|
DateTimeShortcuts.init();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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) {
|
||||||
|
var namearr = value.name.split('-');
|
||||||
|
SelectFilter.init(value.id, namearr[namearr.length - 1], false, options.adminStaticPrefix);
|
||||||
|
});
|
||||||
|
$('.selectfilterstacked').each(function (index, value) {
|
||||||
|
var namearr = value.name.split('-');
|
||||||
|
SelectFilter.init(value.id, namearr[namearr.length - 1], true, options.adminStaticPrefix);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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) {
|
||||||
|
dependencies.push('#' + row.find('.field-' + field_name).find('input, select, textarea').attr('id'));
|
||||||
|
});
|
||||||
|
if (dependencies.length) {
|
||||||
|
input.prepopulate(dependencies, input.attr('maxlength'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$rows.formset({
|
||||||
|
prefix: options.prefix,
|
||||||
|
addText: options.addText,
|
||||||
|
formCssClass: "dynamic-" + options.prefix,
|
||||||
|
deleteCssClass: "inline-deletelink",
|
||||||
|
deleteText: options.deleteText,
|
||||||
|
emptyCssClass: "empty-form",
|
||||||
|
removed: alternatingRows,
|
||||||
|
added: function (row) {
|
||||||
|
initPrepopulatedFields(row);
|
||||||
|
reinitDateTimeShortCuts();
|
||||||
|
updateSelectFilter();
|
||||||
|
alternatingRows(row);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$('.selectfilterstacked').each(function(index, value){
|
|
||||||
var namearr = value.name.split('-');
|
return $rows;
|
||||||
SelectFilter.init(value.id, namearr[namearr.length-1], true, options.adminStaticPrefix );
|
};
|
||||||
|
|
||||||
|
// Stacked inlines ---------------------------------------------------------
|
||||||
|
$.fn.stackedFormset = function (options) {
|
||||||
|
var $rows = $(this);
|
||||||
|
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 () {
|
||||||
|
// Reinitialize the calendar and clock widgets by force, yuck.
|
||||||
|
if (typeof DateTimeShortcuts != "undefined") {
|
||||||
|
$(".datetimeshortcuts").remove();
|
||||||
|
DateTimeShortcuts.init();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var updateSelectFilter = function () {
|
||||||
|
// If any SelectFilter widgets were added, instantiate a new instance.
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
$(".selectfilterstacked").each(function (index, value) {
|
||||||
|
var namearr = value.name.split('-');
|
||||||
|
SelectFilter.init(value.id, namearr[namearr.length - 1], true, options.adminStaticPrefix);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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) {
|
||||||
|
dependencies.push('#' + row.find('.form-row .field-' + field_name).find('input, select, textarea').attr('id'));
|
||||||
|
});
|
||||||
|
if (dependencies.length) {
|
||||||
|
input.prepopulate(dependencies, input.attr('maxlength'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$rows.formset({
|
||||||
|
prefix: options.prefix,
|
||||||
|
addText: options.addText,
|
||||||
|
formCssClass: "dynamic-" + options.prefix,
|
||||||
|
deleteCssClass: "inline-deletelink",
|
||||||
|
deleteText: options.deleteText,
|
||||||
|
emptyCssClass: "empty-form",
|
||||||
|
removed: updateInlineLabel,
|
||||||
|
added: (function (row) {
|
||||||
|
initPrepopulatedFields(row);
|
||||||
|
reinitDateTimeShortCuts();
|
||||||
|
updateSelectFilter();
|
||||||
|
updateInlineLabel(row);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
return $rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
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) {
|
|
||||||
dependencies.push('#' + row.find('.field-' + field_name).find('input, select, textarea').attr('id'));
|
|
||||||
});
|
|
||||||
if (dependencies.length) {
|
|
||||||
input.prepopulate(dependencies, input.attr('maxlength'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$rows.formset({
|
|
||||||
prefix: options.prefix,
|
|
||||||
addText: options.addText,
|
|
||||||
formCssClass: "dynamic-" + options.prefix,
|
|
||||||
deleteCssClass: "inline-deletelink",
|
|
||||||
deleteText: options.deleteText,
|
|
||||||
emptyCssClass: "empty-form",
|
|
||||||
removed: alternatingRows,
|
|
||||||
added: function(row) {
|
|
||||||
initPrepopulatedFields(row);
|
|
||||||
reinitDateTimeShortCuts();
|
|
||||||
updateSelectFilter();
|
|
||||||
alternatingRows(row);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return $rows;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Stacked inlines ---------------------------------------------------------
|
|
||||||
$.fn.stackedFormset = function(options) {
|
|
||||||
var $rows = $(this);
|
|
||||||
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() {
|
|
||||||
// Reinitialize the calendar and clock widgets by force, yuck.
|
|
||||||
if (typeof DateTimeShortcuts != "undefined") {
|
|
||||||
$(".datetimeshortcuts").remove();
|
|
||||||
DateTimeShortcuts.init();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var updateSelectFilter = function() {
|
|
||||||
// If any SelectFilter widgets were added, instantiate a new instance.
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
$(".selectfilterstacked").each(function(index, value){
|
|
||||||
var namearr = value.name.split('-');
|
|
||||||
SelectFilter.init(value.id, namearr[namearr.length-1], true, options.adminStaticPrefix);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
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) {
|
|
||||||
dependencies.push('#' + row.find('.form-row .field-' + field_name).find('input, select, textarea').attr('id'));
|
|
||||||
});
|
|
||||||
if (dependencies.length) {
|
|
||||||
input.prepopulate(dependencies, input.attr('maxlength'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$rows.formset({
|
|
||||||
prefix: options.prefix,
|
|
||||||
addText: options.addText,
|
|
||||||
formCssClass: "dynamic-" + options.prefix,
|
|
||||||
deleteCssClass: "inline-deletelink",
|
|
||||||
deleteText: options.deleteText,
|
|
||||||
emptyCssClass: "empty-form",
|
|
||||||
removed: updateInlineLabel,
|
|
||||||
added: (function(row) {
|
|
||||||
initPrepopulatedFields(row);
|
|
||||||
reinitDateTimeShortCuts();
|
|
||||||
updateSelectFilter();
|
|
||||||
updateInlineLabel(row);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
return $rows;
|
|
||||||
};
|
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
|
116
static/admin/js/inlines.min.js
vendored
116
static/admin/js/inlines.min.js
vendored
@ -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("."+
|
(function (b) {
|
||||||
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+
|
b.fn.formset = function (d) {
|
||||||
"-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,
|
var a = b.extend({}, b.fn.formset.defaults, d), c = b(this), d = c.parent(), i = function (a, e, g) {
|
||||||
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,
|
var d = RegExp("(" + e + "-(\\d+|__prefix__))"), e = e + "-" + g;
|
||||||
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-"+
|
b(a).prop("for") && b(a).prop("for", b(a).prop("for").replace(d, e));
|
||||||
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"!=
|
a.id && (a.id = a.id.replace(d, e));
|
||||||
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,
|
a.name && (a.name = a.name.replace(d, e))
|
||||||
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(),
|
}, 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();
|
||||||
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);
|
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);
|
||||||
|
17674
static/admin/js/jquery.js
vendored
17674
static/admin/js/jquery.js
vendored
File diff suppressed because it is too large
Load Diff
2207
static/admin/js/jquery.min.js
vendored
2207
static/admin/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,29 +1,29 @@
|
|||||||
(function($) {
|
(function ($) {
|
||||||
$.fn.prepopulate = function(dependencies, maxLength) {
|
$.fn.prepopulate = function (dependencies, maxLength) {
|
||||||
/*
|
/*
|
||||||
Depends on urlify.js
|
Depends on urlify.js
|
||||||
Populates a selected field with the values of the dependent fields,
|
Populates a selected field with the values of the dependent fields,
|
||||||
URLifies and shortens the string.
|
URLifies and shortens the string.
|
||||||
dependencies - array of dependent fields id's
|
dependencies - array of dependent fields id's
|
||||||
maxLength - maximum length of the URLify'd string
|
maxLength - maximum length of the URLify'd string
|
||||||
*/
|
*/
|
||||||
return this.each(function() {
|
return this.each(function () {
|
||||||
var field = $(this);
|
var field = $(this);
|
||||||
|
|
||||||
field.data('_changed', false);
|
field.data('_changed', false);
|
||||||
field.change(function() {
|
field.change(function () {
|
||||||
field.data('_changed', true);
|
field.data('_changed', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
var populate = function () {
|
var populate = function () {
|
||||||
// Bail if the fields value has changed
|
// Bail if the fields value has changed
|
||||||
if (field.data('_changed') == true) return;
|
if (field.data('_changed') == true) return;
|
||||||
|
|
||||||
var values = [];
|
var values = [];
|
||||||
$.each(dependencies, function(i, field) {
|
$.each(dependencies, function (i, field) {
|
||||||
if ($(field).val().length > 0) {
|
if ($(field).val().length > 0) {
|
||||||
values.push($(field).val());
|
values.push($(field).val());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
field.val(URLify(values.join(' '), maxLength));
|
field.val(URLify(values.join(' '), maxLength));
|
||||||
};
|
};
|
||||||
|
22
static/admin/js/prepopulate.min.js
vendored
22
static/admin/js/prepopulate.min.js
vendored
@ -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);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
var timeParsePatterns = [
|
var timeParsePatterns = [
|
||||||
// 9
|
// 9
|
||||||
{ re: /^\d{1,2}$/i,
|
{ re: /^\d{1,2}$/i,
|
||||||
handler: function(bits) {
|
handler: function (bits) {
|
||||||
if (bits[0].length == 1) {
|
if (bits[0].length == 1) {
|
||||||
return '0' + bits[0] + ':00';
|
return '0' + bits[0] + ':00';
|
||||||
} else {
|
} else {
|
||||||
@ -11,19 +11,19 @@ var timeParsePatterns = [
|
|||||||
},
|
},
|
||||||
// 13:00
|
// 13:00
|
||||||
{ re: /^\d{2}[:.]\d{2}$/i,
|
{ re: /^\d{2}[:.]\d{2}$/i,
|
||||||
handler: function(bits) {
|
handler: function (bits) {
|
||||||
return bits[0].replace('.', ':');
|
return bits[0].replace('.', ':');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 9:00
|
// 9:00
|
||||||
{ re: /^\d[:.]\d{2}$/i,
|
{ re: /^\d[:.]\d{2}$/i,
|
||||||
handler: function(bits) {
|
handler: function (bits) {
|
||||||
return '0' + bits[0].replace('.', ':');
|
return '0' + bits[0].replace('.', ':');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 3 am / 3 a.m. / 3am
|
// 3 am / 3 a.m. / 3am
|
||||||
{ re: /^(\d+)\s*([ap])(?:.?m.?)?$/i,
|
{ re: /^(\d+)\s*([ap])(?:.?m.?)?$/i,
|
||||||
handler: function(bits) {
|
handler: function (bits) {
|
||||||
var hour = parseInt(bits[1]);
|
var hour = parseInt(bits[1]);
|
||||||
if (hour == 12) {
|
if (hour == 12) {
|
||||||
hour = 0;
|
hour = 0;
|
||||||
@ -44,7 +44,7 @@ var timeParsePatterns = [
|
|||||||
},
|
},
|
||||||
// 3.30 am / 3:15 a.m. / 3.00am
|
// 3.30 am / 3:15 a.m. / 3.00am
|
||||||
{ re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i,
|
{ re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i,
|
||||||
handler: function(bits) {
|
handler: function (bits) {
|
||||||
var hour = parseInt(bits[1]);
|
var hour = parseInt(bits[1]);
|
||||||
var mins = parseInt(bits[2]);
|
var mins = parseInt(bits[2]);
|
||||||
if (mins < 10) {
|
if (mins < 10) {
|
||||||
@ -69,13 +69,13 @@ var timeParsePatterns = [
|
|||||||
},
|
},
|
||||||
// noon
|
// noon
|
||||||
{ re: /^no/i,
|
{ re: /^no/i,
|
||||||
handler: function(bits) {
|
handler: function (bits) {
|
||||||
return '12:00';
|
return '12:00';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// midnight
|
// midnight
|
||||||
{ re: /^mid/i,
|
{ re: /^mid/i,
|
||||||
handler: function(bits) {
|
handler: function (bits) {
|
||||||
return '00:00';
|
return '00:00';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,119 +1,106 @@
|
|||||||
var LATIN_MAP = {
|
var LATIN_MAP = {
|
||||||
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç':
|
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
|
||||||
'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
|
'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
|
||||||
'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö':
|
'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à': 'a', 'á': 'a', 'â': 'a', 'ã': 'a', 'ä': 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e',
|
||||||
'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
|
'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': 'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': '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'
|
'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y'
|
||||||
}
|
}
|
||||||
var LATIN_SYMBOLS_MAP = {
|
var LATIN_SYMBOLS_MAP = {
|
||||||
'©':'(c)'
|
'©': '(c)'
|
||||||
}
|
}
|
||||||
var GREEK_MAP = {
|
var GREEK_MAP = {
|
||||||
'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', 'ζ':'z', 'η':'h', 'θ':'8',
|
'α': 'a', 'β': 'b', 'γ': 'g', 'δ': 'd', 'ε': 'e', 'ζ': 'z', 'η': 'h', 'θ': '8',
|
||||||
'ι':'i', 'κ':'k', 'λ':'l', 'μ':'m', 'ν':'n', 'ξ':'3', 'ο':'o', 'π':'p',
|
'ι': 'i', 'κ': 'k', 'λ': 'l', 'μ': 'm', 'ν': 'n', 'ξ': '3', 'ο': 'o', 'π': 'p',
|
||||||
'ρ':'r', 'σ':'s', 'τ':'t', 'υ':'y', 'φ':'f', 'χ':'x', 'ψ':'ps', 'ω':'w',
|
'ρ': 'r', 'σ': 's', 'τ': 't', 'υ': 'y', 'φ': 'f', 'χ': 'x', 'ψ': 'ps', 'ω': 'w',
|
||||||
'ά':'a', 'έ':'e', 'ί':'i', 'ό':'o', 'ύ':'y', 'ή':'h', 'ώ':'w', 'ς':'s',
|
'ά': 'a', 'έ': 'e', 'ί': 'i', 'ό': 'o', 'ύ': 'y', 'ή': 'h', 'ώ': 'w', 'ς': 's',
|
||||||
'ϊ':'i', 'ΰ':'y', 'ϋ':'y', 'ΐ':'i',
|
'ϊ': 'i', 'ΰ': 'y', 'ϋ': 'y', 'ΐ': 'i',
|
||||||
'Α':'A', 'Β':'B', 'Γ':'G', 'Δ':'D', 'Ε':'E', 'Ζ':'Z', 'Η':'H', 'Θ':'8',
|
'Α': 'A', 'Β': 'B', 'Γ': 'G', 'Δ': 'D', 'Ε': 'E', 'Ζ': 'Z', 'Η': 'H', 'Θ': '8',
|
||||||
'Ι':'I', 'Κ':'K', 'Λ':'L', 'Μ':'M', 'Ν':'N', 'Ξ':'3', 'Ο':'O', 'Π':'P',
|
'Ι': 'I', 'Κ': 'K', 'Λ': 'L', 'Μ': 'M', 'Ν': 'N', 'Ξ': '3', 'Ο': 'O', 'Π': 'P',
|
||||||
'Ρ':'R', 'Σ':'S', 'Τ':'T', 'Υ':'Y', 'Φ':'F', 'Χ':'X', 'Ψ':'PS', 'Ω':'W',
|
'Ρ': 'R', 'Σ': 'S', 'Τ': 'T', 'Υ': 'Y', 'Φ': 'F', 'Χ': 'X', 'Ψ': 'PS', 'Ω': 'W',
|
||||||
'Ά':'A', 'Έ':'E', 'Ί':'I', 'Ό':'O', 'Ύ':'Y', 'Ή':'H', 'Ώ':'W', 'Ϊ':'I',
|
'Ά': 'A', 'Έ': 'E', 'Ί': 'I', 'Ό': 'O', 'Ύ': 'Y', 'Ή': 'H', 'Ώ': 'W', 'Ϊ': 'I',
|
||||||
'Ϋ':'Y'
|
'Ϋ': 'Y'
|
||||||
}
|
}
|
||||||
var TURKISH_MAP = {
|
var TURKISH_MAP = {
|
||||||
'ş':'s', 'Ş':'S', 'ı':'i', 'İ':'I', 'ç':'c', 'Ç':'C', 'ü':'u', 'Ü':'U',
|
'ş': 's', 'Ş': 'S', 'ı': 'i', 'İ': 'I', 'ç': 'c', 'Ç': 'C', 'ü': 'u', 'Ü': 'U',
|
||||||
'ö':'o', 'Ö':'O', 'ğ':'g', 'Ğ':'G'
|
'ö': 'o', 'Ö': 'O', 'ğ': 'g', 'Ğ': 'G'
|
||||||
}
|
}
|
||||||
var RUSSIAN_MAP = {
|
var RUSSIAN_MAP = {
|
||||||
'а':'a', 'б':'b', 'в':'v', 'г':'g', 'д':'d', 'е':'e', 'ё':'yo', 'ж':'zh',
|
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'yo', 'ж': 'zh',
|
||||||
'з':'z', 'и':'i', 'й':'j', 'к':'k', 'л':'l', 'м':'m', 'н':'n', 'о':'o',
|
'з': 'z', 'и': 'i', 'й': 'j', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
|
||||||
'п':'p', 'р':'r', 'с':'s', 'т':'t', 'у':'u', 'ф':'f', 'х':'h', 'ц':'c',
|
'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c',
|
||||||
'ч':'ch', 'ш':'sh', 'щ':'sh', 'ъ':'', 'ы':'y', 'ь':'', 'э':'e', 'ю':'yu',
|
'ч': 'ch', 'ш': 'sh', 'щ': 'sh', 'ъ': '', 'ы': 'y', 'ь': '', 'э': 'e', 'ю': 'yu',
|
||||||
'я':'ya',
|
'я': 'ya',
|
||||||
'А':'A', 'Б':'B', 'В':'V', 'Г':'G', 'Д':'D', 'Е':'E', 'Ё':'Yo', 'Ж':'Zh',
|
'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'E', 'Ё': 'Yo', 'Ж': 'Zh',
|
||||||
'З':'Z', 'И':'I', 'Й':'J', 'К':'K', 'Л':'L', 'М':'M', 'Н':'N', 'О':'O',
|
'З': 'Z', 'И': 'I', 'Й': 'J', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', 'О': 'O',
|
||||||
'П':'P', 'Р':'R', 'С':'S', 'Т':'T', 'У':'U', 'Ф':'F', 'Х':'H', 'Ц':'C',
|
'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C',
|
||||||
'Ч':'Ch', 'Ш':'Sh', 'Щ':'Sh', 'Ъ':'', 'Ы':'Y', 'Ь':'', 'Э':'E', 'Ю':'Yu',
|
'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Sh', 'Ъ': '', 'Ы': 'Y', 'Ь': '', 'Э': 'E', 'Ю': 'Yu',
|
||||||
'Я':'Ya'
|
'Я': 'Ya'
|
||||||
}
|
}
|
||||||
var UKRAINIAN_MAP = {
|
var UKRAINIAN_MAP = {
|
||||||
'Є':'Ye', 'І':'I', 'Ї':'Yi', 'Ґ':'G', 'є':'ye', 'і':'i', 'ї':'yi', 'ґ':'g'
|
'Є': 'Ye', 'І': 'I', 'Ї': 'Yi', 'Ґ': 'G', 'є': 'ye', 'і': 'i', 'ї': 'yi', 'ґ': 'g'
|
||||||
}
|
}
|
||||||
var CZECH_MAP = {
|
var CZECH_MAP = {
|
||||||
'č':'c', 'ď':'d', 'ě':'e', 'ň': 'n', 'ř':'r', 'š':'s', 'ť':'t', 'ů':'u',
|
'č': 'c', 'ď': 'd', 'ě': 'e', 'ň': 'n', 'ř': 'r', 'š': 's', 'ť': 't', 'ů': 'u',
|
||||||
'ž':'z', 'Č':'C', 'Ď':'D', 'Ě':'E', 'Ň': 'N', 'Ř':'R', 'Š':'S', 'Ť':'T',
|
'ž': 'z', 'Č': 'C', 'Ď': 'D', 'Ě': 'E', 'Ň': 'N', 'Ř': 'R', 'Š': 'S', 'Ť': 'T',
|
||||||
'Ů':'U', 'Ž':'Z'
|
'Ů': 'U', 'Ž': 'Z'
|
||||||
}
|
}
|
||||||
|
|
||||||
var POLISH_MAP = {
|
var POLISH_MAP = {
|
||||||
'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ó':'o', 'ś':'s', 'ź':'z',
|
'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's', 'ź': 'z',
|
||||||
'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ó':'o', 'Ś':'S',
|
'ż': 'z', 'Ą': 'A', 'Ć': 'C', 'Ę': 'e', 'Ł': 'L', 'Ń': 'N', 'Ó': 'o', 'Ś': 'S',
|
||||||
'Ź':'Z', 'Ż':'Z'
|
'Ź': 'Z', 'Ż': 'Z'
|
||||||
}
|
}
|
||||||
|
|
||||||
var LATVIAN_MAP = {
|
var LATVIAN_MAP = {
|
||||||
'ā':'a', 'č':'c', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n',
|
'ā': 'a', 'č': 'c', 'ē': 'e', 'ģ': 'g', 'ī': 'i', 'ķ': 'k', 'ļ': 'l', 'ņ': 'n',
|
||||||
'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'i',
|
'š': 's', 'ū': 'u', 'ž': 'z', 'Ā': 'A', 'Č': 'C', 'Ē': 'E', 'Ģ': 'G', 'Ī': 'i',
|
||||||
'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'u', 'Ž':'Z'
|
'Ķ': 'k', 'Ļ': 'L', 'Ņ': 'N', 'Š': 'S', 'Ū': 'u', 'Ž': 'Z'
|
||||||
}
|
}
|
||||||
|
|
||||||
var ALL_DOWNCODE_MAPS=new Array()
|
var ALL_DOWNCODE_MAPS = new Array()
|
||||||
ALL_DOWNCODE_MAPS[0]=LATIN_MAP
|
ALL_DOWNCODE_MAPS[0] = LATIN_MAP
|
||||||
ALL_DOWNCODE_MAPS[1]=LATIN_SYMBOLS_MAP
|
ALL_DOWNCODE_MAPS[1] = LATIN_SYMBOLS_MAP
|
||||||
ALL_DOWNCODE_MAPS[2]=GREEK_MAP
|
ALL_DOWNCODE_MAPS[2] = GREEK_MAP
|
||||||
ALL_DOWNCODE_MAPS[3]=TURKISH_MAP
|
ALL_DOWNCODE_MAPS[3] = TURKISH_MAP
|
||||||
ALL_DOWNCODE_MAPS[4]=RUSSIAN_MAP
|
ALL_DOWNCODE_MAPS[4] = RUSSIAN_MAP
|
||||||
ALL_DOWNCODE_MAPS[5]=UKRAINIAN_MAP
|
ALL_DOWNCODE_MAPS[5] = UKRAINIAN_MAP
|
||||||
ALL_DOWNCODE_MAPS[6]=CZECH_MAP
|
ALL_DOWNCODE_MAPS[6] = CZECH_MAP
|
||||||
ALL_DOWNCODE_MAPS[7]=POLISH_MAP
|
ALL_DOWNCODE_MAPS[7] = POLISH_MAP
|
||||||
ALL_DOWNCODE_MAPS[8]=LATVIAN_MAP
|
ALL_DOWNCODE_MAPS[8] = LATVIAN_MAP
|
||||||
|
|
||||||
var Downcoder = new Object();
|
var Downcoder = new Object();
|
||||||
Downcoder.Initialize = function()
|
Downcoder.Initialize = function () {
|
||||||
{
|
|
||||||
if (Downcoder.map) // already made
|
if (Downcoder.map) // already made
|
||||||
return ;
|
return;
|
||||||
Downcoder.map ={}
|
Downcoder.map = {}
|
||||||
Downcoder.chars = '' ;
|
Downcoder.chars = '';
|
||||||
for(var i in ALL_DOWNCODE_MAPS)
|
for (var i in ALL_DOWNCODE_MAPS) {
|
||||||
{
|
|
||||||
var lookup = ALL_DOWNCODE_MAPS[i]
|
var lookup = ALL_DOWNCODE_MAPS[i]
|
||||||
for (var c in lookup)
|
for (var c in lookup) {
|
||||||
{
|
Downcoder.map[c] = lookup[c];
|
||||||
Downcoder.map[c] = lookup[c] ;
|
Downcoder.chars += c;
|
||||||
Downcoder.chars += c ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+','g') ;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
downcoded+=pieces[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+', 'g');
|
||||||
{
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
downcoded += pieces[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
downcoded = slug;
|
downcoded = slug;
|
||||||
}
|
}
|
||||||
return downcoded;
|
return downcoded;
|
||||||
@ -125,9 +112,9 @@ function URLify(s, num_chars) {
|
|||||||
// remove all these words from the string before urlifying
|
// remove all these words from the string before urlifying
|
||||||
s = downcode(s);
|
s = downcode(s);
|
||||||
removelist = ["a", "an", "as", "at", "before", "but", "by", "for", "from",
|
removelist = ["a", "an", "as", "at", "before", "but", "by", "for", "from",
|
||||||
"is", "in", "into", "like", "of", "off", "on", "onto", "per",
|
"is", "in", "into", "like", "of", "off", "on", "onto", "per",
|
||||||
"since", "than", "the", "this", "that", "to", "up", "via",
|
"since", "than", "the", "this", "that", "to", "up", "via",
|
||||||
"with"];
|
"with"];
|
||||||
r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
|
r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
|
||||||
s = s.replace(r, '');
|
s = s.replace(r, '');
|
||||||
// if downcode doesn't hit, the char will be stripped here
|
// if downcode doesn't hit, the char will be stripped here
|
||||||
|
450
static/css/bootstrap-theme.min.css
vendored
450
static/css/bootstrap-theme.min.css
vendored
File diff suppressed because one or more lines are too long
6663
static/css/bootstrap.min.css
vendored
6663
static/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
1964
static/css/font-awesome.min.css
vendored
1964
static/css/font-awesome.min.css
vendored
File diff suppressed because one or more lines are too long
@ -19,16 +19,18 @@ body {
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(min-width:768px) {
|
@media (min-width: 768px) {
|
||||||
#page-wrapper {
|
#page-wrapper {
|
||||||
position: inherit;
|
position: inherit;
|
||||||
margin: 0 0 0 250px;
|
margin: 0 0 0 250px;
|
||||||
padding: 0 30px;
|
padding: 0 30px;
|
||||||
border-left: 1px solid #e7e7e7;
|
border-left: 1px solid #e7e7e7;
|
||||||
overflow: hidden;}
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.navbar-top-links li {
|
.navbar-top-links li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
@ -108,13 +110,13 @@ body {
|
|||||||
content: "\f104";
|
content: "\f104";
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar .active>a>.fa.arrow:before {
|
.sidebar .active > a > .fa.arrow:before {
|
||||||
content: "\f107";
|
content: "\f107";
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar .nav-second-level li,
|
.sidebar .nav-second-level li,
|
||||||
.sidebar .nav-third-level li {
|
.sidebar .nav-third-level li {
|
||||||
border-bottom: 0!important;
|
border-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar .nav-second-level li a {
|
.sidebar .nav-second-level li a {
|
||||||
@ -125,7 +127,7 @@ body {
|
|||||||
padding-left: 52px;
|
padding-left: 52px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(min-width:768px) {
|
@media (min-width: 768px) {
|
||||||
.sidebar {
|
.sidebar {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -246,7 +248,7 @@ table.dataTable thead .sorting:after {
|
|||||||
content: "\f0dc";
|
content: "\f0dc";
|
||||||
float: right;
|
float: right;
|
||||||
font-family: fontawesome;
|
font-family: fontawesome;
|
||||||
color: rgba(50,50,50,.5);
|
color: rgba(50, 50, 50, .5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-circle {
|
.btn-circle {
|
||||||
@ -281,7 +283,7 @@ table.dataTable thead .sorting:after {
|
|||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
background-color: #eee!important;
|
background-color: #eee !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.show-grid {
|
.show-grid {
|
||||||
|
651
static/js/bootstrap.min.js
vendored
651
static/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@ -19,10 +19,15 @@
|
|||||||
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
|
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
|
||||||
<link href="{% static 'css/sb-admin-2.css' %}" rel="stylesheet">
|
<link href="{% static 'css/sb-admin-2.css' %}" rel="stylesheet">
|
||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
<style>
|
||||||
|
.grayiconecolor {
|
||||||
|
color: #505050;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<!-- Navigation -->
|
<!-- Navigation -->
|
||||||
|
|
||||||
@ -38,11 +43,11 @@
|
|||||||
<!-- /.navbar-header -->
|
<!-- /.navbar-header -->
|
||||||
|
|
||||||
<ul class="nav navbar-top-links navbar-right">
|
<ul class="nav navbar-top-links navbar-right">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<li><a href="{% url 'auth_logout_user' %}">Logout</a></li>
|
<li><a href="{% url 'auth_logout_user' %}">Logout</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{% url 'auth_login_user' %}">Login</a></li>
|
<li><a href="{% url 'auth_login_user' %}">Login</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<!-- /.navbar-top-links -->
|
<!-- /.navbar-top-links -->
|
||||||
|
|
||||||
@ -57,44 +62,69 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<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>
|
||||||
<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>
|
||||||
<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>
|
||||||
<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>
|
||||||
<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>
|
||||||
<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>
|
||||||
|
|
||||||
<li class="text-center divider-horizontal">
|
<li class="text-center divider-horizontal">
|
||||||
<h5>Util</h5>
|
<h5>Util</h5>
|
||||||
</li>
|
</li>
|
||||||
<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>
|
</li>
|
||||||
{% if perms.auth.group_management %}
|
{% if perms.auth.group_management %}
|
||||||
<li>
|
<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 %}
|
||||||
</li>
|
href="{% url 'auth_group_management' %}"><i
|
||||||
|
class="fa fa-lock fa-sitemap grayiconecolor"></i> Group Management</a>
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if perms.auth.jabber_broadcast %}
|
{% if perms.auth.jabber_broadcast %}
|
||||||
<li>
|
<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/" %}
|
||||||
</li>
|
class="active" {% endifequal %} href="{% url 'auth_jabber_broadcast_view' %}"><i
|
||||||
|
class="fa fa-lock fa-bullhorn grayiconecolor"></i> Jabber Broadcast</a>
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<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 %}
|
||||||
</li>
|
href="{% url 'auth_fleet_format_tool_view' %}"><i
|
||||||
|
class="fa fa-space-shuttle fa-fw grayiconecolor"></i> Fleet Broadcast Formatter</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.sidebar-collapse -->
|
<!-- /.sidebar-collapse -->
|
||||||
@ -107,6 +137,6 @@
|
|||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,54 +1,55 @@
|
|||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
background: url("{% static 'img/index_images/index_bg.jpg' %}") no-repeat center center fixed;
|
background: url("{% static 'img/index_images/index_bg.jpg' %}") no-repeat center center fixed;
|
||||||
-webkit-background-size: cover;
|
-webkit-background-size: cover;
|
||||||
-moz-background-size: cover;
|
-moz-background-size: cover;
|
||||||
-o-background-size: cover;
|
-o-background-size: cover;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 60%;
|
top: 60%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-top: -100px;
|
margin-top: -100px;
|
||||||
margin-left: -200px;
|
margin-left: -200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head lang="en">
|
<head lang="en">
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>The 99 Percent Eve Alliance</title>
|
<title>The 99 Percent Eve Alliance</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<p style="text-align:center">
|
<p style="text-align:center">
|
||||||
<a href="/dashboard/">
|
<a href="/dashboard/">
|
||||||
<img src="{% static 'img/index_images/auth.png' %}" border="0">
|
<img src="{% static 'img/index_images/auth.png' %}" border="0">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p style="text-align:center">
|
|
||||||
<a href="/forums/">
|
|
||||||
<img src="{% static 'img/index_images/forums.png' %}" border="0">
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p style="text-align:center">
|
<p style="text-align:center">
|
||||||
<a href="/killboard/">
|
<a href="/forums/">
|
||||||
<img src="{% static 'img/index_images/killboard.png' %}" border="0">
|
<img src="{% static 'img/index_images/forums.png' %}" border="0">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p style="text-align:center">
|
<p style="text-align:center">
|
||||||
<a href="https://www.youtube.com/playlist?list=PLXM5OIn59G5Gn7eri-lWkXvE15oP5yUUk">
|
<a href="/killboard/">
|
||||||
<img src="{% static 'img/index_images/media.png' %}" border="0">
|
<img src="{% static 'img/index_images/killboard.png' %}" border="0">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
|
||||||
</body>
|
<p style="text-align:center">
|
||||||
|
<a href="https://www.youtube.com/playlist?list=PLXM5OIn59G5Gn7eri-lWkXvE15oP5yUUk">
|
||||||
|
<img src="{% static 'img/index_images/media.png' %}" border="0">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
@ -24,8 +24,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.panel-transparent {
|
.panel-transparent {
|
||||||
background: rgba(48,48,48,0.7);
|
background: rgba(48, 48, 48, 0.7);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
@ -34,33 +34,34 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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="col-md-4 col-md-offset-4">
|
||||||
<div class="panel panel-default panel-transparent">
|
<div class="panel panel-default panel-transparent">
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div class="alert alert-danger" role="alert">Username/Password Invalid</div>
|
<div class="alert alert-danger" role="alert">Username/Password Invalid</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'auth_register_user' %}">
|
<a href="{% url 'auth_register_user' %}">
|
||||||
<button class="btn btn- btn-success btn-block">Register</button>
|
<button class="btn btn- btn-success btn-block">Register</button>
|
||||||
</a>
|
</a>
|
||||||
<form class="form-signin" role="form" action="{% url 'auth_login_user' %}" method="POST">
|
|
||||||
{% csrf_token %}
|
<form class="form-signin" role="form" action="{% url 'auth_login_user' %}" method="POST">
|
||||||
<h2 class="form-signin-heading text-center">Please sign in</h2>
|
{% csrf_token %}
|
||||||
{{form|bootstrap}}
|
<h2 class="form-signin-heading text-center">Please sign in</h2>
|
||||||
<div class="col-md-6">
|
{{ form|bootstrap }}
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<a href="{% url 'password_reset' %}">
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
|
||||||
<button class="btn btn-lg btn-danger btn-block">Reset</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<a href="{% url 'password_reset' %}">
|
||||||
|
<button class="btn btn-lg btn-danger btn-block">Reset</button>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -24,9 +24,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.panel-transparent {
|
.panel-transparent {
|
||||||
background: rgba(48,48,48,0.7);
|
background: rgba(48, 48, 48, 0.7);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -37,14 +38,14 @@
|
|||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<div class="panel panel-default panel-transparent">
|
<div class="panel panel-default panel-transparent">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div class="alert alert-danger" role="alert">Username Already Registered</div>
|
<div class="alert alert-danger" role="alert">Username Already Registered</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form action="{% url 'auth_register_user' %}" method="POST">
|
<form action="{% url 'auth_register_user' %}" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h2 class="form-signin-heading">Register Account</h2>
|
<h2 class="form-signin-heading">Register Account</h2>
|
||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -8,25 +8,28 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Add Api Key</h1>
|
<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="container-fluid">
|
||||||
<div class="row">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<p class="text-center">
|
<div class="row">
|
||||||
Full API Key is required for auth services
|
<p class="text-center">
|
||||||
</p>
|
Full API Key is required for auth services
|
||||||
<a target="_blank" href="https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=268435455">Create a full API key</a>
|
</p>
|
||||||
</p>
|
<a target="_blank"
|
||||||
<form class="form-signin" role="form" action="{% url 'auth_add_api_key' %}" method="POST">
|
href="https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=268435455">Create
|
||||||
{% csrf_token %}
|
a full API key</a>
|
||||||
{{ form|bootstrap }}
|
</p>
|
||||||
<br/>
|
<form class="form-signin" role="form" action="{% url 'auth_add_api_key' %}" method="POST">
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Add Key</button>
|
{% csrf_token %}
|
||||||
</form>
|
{{ form|bootstrap }}
|
||||||
|
<br/>
|
||||||
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Add Key</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -8,38 +8,39 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if apikeypairs %}
|
{% if apikeypairs %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="alert alert-danger" role="alert">No api keys found</div>
|
<div class="alert alert-danger" role="alert">No api keys found</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h1 class="page-header text-center">API Key Management
|
<h1 class="page-header text-center">API Key Management
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<a href="{% url 'auth_add_api_key' %}">
|
<a href="{% url 'auth_add_api_key' %}">
|
||||||
<button type="button" class="btn btn-success">Add Key</button>
|
<button type="button" class="btn btn-success">Add Key</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-center">API ID</th>
|
<th class="text-center">API ID</th>
|
||||||
<th class="text-center">API Key</th>
|
<th class="text-center">API Key</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for pair in apikeypairs %}
|
{% for pair in apikeypairs %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">{{ pair.api_id }}</td>
|
<td class="text-center">{{ pair.api_id }}</td>
|
||||||
<td class="text-center">{{ pair.api_key }}</td>
|
<td class="text-center">{{ pair.api_key }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="/delete_api_pair/{{ pair.api_id }}">
|
<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
|
||||||
</a>
|
class="glyphicon glyphicon-remove"></span></button>
|
||||||
</td>
|
</a>
|
||||||
</tr>
|
</td>
|
||||||
{% endfor %}
|
</tr>
|
||||||
</table>
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -7,56 +7,64 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12 container">
|
<div class="col-lg-12 container">
|
||||||
<h1 class="page-header text-center">Characters</h1>
|
<h1 class="page-header text-center">Characters</h1>
|
||||||
<div class="col-lg-12 container" id="example">
|
|
||||||
|
|
||||||
{% if authinfo.main_char_id %}
|
<div class="col-lg-12 container" id="example">
|
||||||
{% else %}
|
|
||||||
<div class="alert alert-danger" role="alert">No primary character set</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="row">
|
|
||||||
{% for character in characters %}
|
|
||||||
<div class="col-lg-6">
|
|
||||||
|
|
||||||
<div class="panel panel-default">
|
{% if authinfo.main_char_id %}
|
||||||
<div class="panel-heading">
|
{% else %}
|
||||||
<div class="panel-title">
|
<div class="alert alert-danger" role="alert">No primary character set</div>
|
||||||
<div class="row">
|
{% endif %}
|
||||||
<div class="col-md-12">
|
<div class="row">
|
||||||
<div class="text-left col-md-8">
|
{% for character in characters %}
|
||||||
{{character.character_name}}
|
<div class="col-lg-6">
|
||||||
</div>
|
|
||||||
<div class="text-right col-md-4">
|
<div class="panel panel-default">
|
||||||
<a href="/main_character_change/{{character.character_id}}">
|
<div class="panel-heading">
|
||||||
{% ifequal character.character_id authinfo.main_char_id %}
|
<div class="panel-title">
|
||||||
<button type="button" class="btn btn-default btn-xs" disabled>Make Primary</button>
|
<div class="row">
|
||||||
{% else %}
|
<div class="col-md-12">
|
||||||
<button type="button" class="btn btn-primary btn-xs">Make Primary</button>
|
<div class="text-left col-md-8">
|
||||||
{% endifequal %}
|
{{ character.character_name }}
|
||||||
</a>
|
</div>
|
||||||
|
<div class="text-right col-md-4">
|
||||||
|
<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>
|
||||||
|
{% else %}
|
||||||
|
<button type="button" class="btn btn-primary btn-xs">Make
|
||||||
|
Primary
|
||||||
|
</button>
|
||||||
|
{% endifequal %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
<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>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -1,62 +1,65 @@
|
|||||||
{% extends "public/base.html" %}
|
{% extends "public/base.html" %}
|
||||||
{% block title %}Alliance Auth{% endblock%}
|
{% block title %}Alliance Auth{% endblock %}
|
||||||
{% block page_title %}Something something here{% endblock page_title %}
|
{% block page_title %}Something something here{% endblock page_title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Dashboard</h1>
|
<h1 class="page-header text-center">Dashboard</h1>
|
||||||
{% if perms.auth.alliance_member %}
|
{% if perms.auth.alliance_member %}
|
||||||
<div class="col-lg-12 container" id="example">
|
<div class="col-lg-12 container" id="example">
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
{% for character in characters %}
|
{% for character in characters %}
|
||||||
{% ifequal character.character_id authinfo.main_char_id %}
|
{% ifequal character.character_id authinfo.main_char_id %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">Main character</div>
|
<div class="panel-heading">Main character</div>
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="col-lg-5 col-sm-2"><img class=
|
<div class="col-lg-5 col-sm-2"><img class=
|
||||||
"ra-avatar img-responsive" src=
|
"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">
|
<div class="col-lg-7 col-sm-2">
|
||||||
<h4 class="">{{character.character_name}}</h4>
|
<h4 class="">{{ character.character_name }}</h4>
|
||||||
<p>{{character.corporation_name}}</p>
|
|
||||||
<p>{{character.alliance_name}}</p>
|
<p>{{ character.corporation_name }}</p>
|
||||||
|
|
||||||
|
<p>{{ character.alliance_name }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endifequal %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Groups</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div style="height: 128px;overflow:-moz-scrollbars-vertical;overflow-y:auto;">
|
||||||
|
<table class="table table-striped">
|
||||||
|
{% for group in user.groups.all %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p class="">{{ group.name }}</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endifequal %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">Groups</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<div style="height: 128px;overflow:-moz-scrollbars-vertical;overflow-y:auto;">
|
|
||||||
<table class="table table-striped">
|
|
||||||
{% for group in user.groups.all %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<p class="">{{ group.name }}</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
</div>
|
<p> Not part of the alliance</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<p> Not part of the alliance</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -8,26 +8,26 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Fleet Broadcast Formatter Tool</h1>
|
<h1 class="page-header text-center">Fleet Broadcast Formatter Tool</h1>
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="col-md-6 col-md-offset-3">
|
<div class="col-md-6 col-md-offset-3">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if generated != "" %}
|
{% if generated != "" %}
|
||||||
<textarea class="form-control" rows="10" cols="60">{{ generated }}
|
<textarea class="form-control" rows="10" cols="60">{{ generated }}
|
||||||
</textarea>
|
</textarea>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form class="form-signin" role="form" action="" method="POST">
|
<form class="form-signin" role="form" action="" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|bootstrap}}
|
{{ form|bootstrap }}
|
||||||
<br/>
|
<br/>
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Format</button>
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Format</button>
|
||||||
<br/>
|
<br/>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -7,69 +7,69 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h3 class="page-header text-center">Group Management</h3>
|
<h3 class="page-header text-center">Group Management</h3>
|
||||||
<h4 class="page-header text-center">Group Add Request</h4>
|
<h4 class="page-header text-center">Group Add Request</h4>
|
||||||
|
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
|
||||||
<th class="text-center">RequestID</th>
|
|
||||||
<th class="text-center">CharacterName</th>
|
|
||||||
<th class="text-center">GroupName</th>
|
|
||||||
<th class="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% for acceptrequest in acceptrequests %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">{{ acceptrequest.id }}</td>
|
<th class="text-center">RequestID</th>
|
||||||
<td class="text-center">{{ acceptrequest.main_char.character_name }}</td>
|
<th class="text-center">CharacterName</th>
|
||||||
<td class="text-center">{{ acceptrequest.group.name }}</td>
|
<th class="text-center">GroupName</th>
|
||||||
<td class="text-center">
|
<th class="text-center">Action</th>
|
||||||
<a href="/group/request/accept/{{ acceptrequest.id }}">
|
|
||||||
<button type="button" class="btn btn-success">
|
|
||||||
Accept
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="/group/request/reject/{{ acceptrequest.id }}">
|
|
||||||
<button type="button" class="btn btn-danger">
|
|
||||||
Reject
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
<h4 class="page-header text-center">Group Leave Request</h4>
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<tr>
|
|
||||||
<th class="text-center">RequestID</th>
|
|
||||||
<th class="text-center">CharacterName</th>
|
|
||||||
<th class="text-center">GroupName</th>
|
|
||||||
<th class="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% for leaverequest in leaverequests %}
|
{% for acceptrequest in acceptrequests %}
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ acceptrequest.id }}</td>
|
||||||
|
<td class="text-center">{{ acceptrequest.main_char.character_name }}</td>
|
||||||
|
<td class="text-center">{{ acceptrequest.group.name }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<a href="/group/request/accept/{{ acceptrequest.id }}">
|
||||||
|
<button type="button" class="btn btn-success">
|
||||||
|
Accept
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="/group/request/reject/{{ acceptrequest.id }}">
|
||||||
|
<button type="button" class="btn btn-danger">
|
||||||
|
Reject
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<h4 class="page-header text-center">Group Leave Request</h4>
|
||||||
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">{{ leaverequest.id }}</td>
|
<th class="text-center">RequestID</th>
|
||||||
<td class="text-center">{{ leaverequest.main_char.character_name }}</td>
|
<th class="text-center">CharacterName</th>
|
||||||
<td class="text-center">{{ leaverequest.group.name }}</td>
|
<th class="text-center">GroupName</th>
|
||||||
<td class="text-center">
|
<th class="text-center">Action</th>
|
||||||
<a href="/group/leave_request/accept/{{ leaverequest.id }}">
|
|
||||||
<button type="button" class="btn btn-success">
|
|
||||||
Accept
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="/group/leave_request/reject/{{ leaverequest.id }}">
|
|
||||||
<button type="button" class="btn btn-danger">
|
|
||||||
Reject
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
|
||||||
</table>
|
{% for leaverequest in leaverequests %}
|
||||||
</div>
|
<tr>
|
||||||
|
<td class="text-center">{{ leaverequest.id }}</td>
|
||||||
|
<td class="text-center">{{ leaverequest.main_char.character_name }}</td>
|
||||||
|
<td class="text-center">{{ leaverequest.group.name }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<a href="/group/leave_request/accept/{{ leaverequest.id }}">
|
||||||
|
<button type="button" class="btn btn-success">
|
||||||
|
Accept
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="/group/leave_request/reject/{{ leaverequest.id }}">
|
||||||
|
<button type="button" class="btn btn-danger">
|
||||||
|
Reject
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -7,53 +7,53 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Available Groups</h1>
|
<h1 class="page-header text-center">Available Groups</h1>
|
||||||
{% if perms.auth.alliance_member %}
|
{% if perms.auth.alliance_member %}
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-center">GroupID</th>
|
<th class="text-center">GroupID</th>
|
||||||
<th class="text-center">GroupName</th>
|
<th class="text-center">GroupName</th>
|
||||||
<th class="text-center">GroupDesc</th>
|
<th class="text-center">GroupDesc</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for pair in pairs %}
|
{% for pair in pairs %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">{{ pair.0.id }}</td>
|
<td class="text-center">{{ pair.0.id }}</td>
|
||||||
<td class="text-center">{{ pair.0.name }}</td>
|
<td class="text-center">{{ pair.0.name }}</td>
|
||||||
<td class="text-center">{{ pair.1.description }}</td>
|
<td class="text-center">{{ pair.1.description }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
{% if pair.0 in user.groups.all %}
|
{% if pair.0 in user.groups.all %}
|
||||||
{% if pair.2 == ""%}
|
{% if pair.2 == "" %}
|
||||||
<a href="/group/request_leave/{{pair.0.id}}">
|
<a href="/group/request_leave/{{ pair.0.id }}">
|
||||||
<button type="button" class="btn btn-danger">
|
<button type="button" class="btn btn-danger">
|
||||||
Leave
|
Leave
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<button type="button" class="btn btn-primary" disabled>
|
<button type="button" class="btn btn-primary" disabled>
|
||||||
{{ pair.2.status }}
|
{{ pair.2.status }}
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif pair.2 == "" %}
|
{% 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">
|
<button type="button" class="btn btn-success">
|
||||||
Request
|
Request
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<button type="button" class="btn btn-primary" disabled>
|
<button type="button" class="btn btn-primary" disabled>
|
||||||
{{ pair.2.status }}
|
{{ pair.2.status }}
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="alert alert-danger" role="alert">You are not in the alliance</div>
|
<div class="alert alert-danger" role="alert">You are not in the alliance</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -5,17 +5,18 @@
|
|||||||
{% block page_title %}Something something here{% endblock page_title %}
|
{% block page_title %}Something something here{% endblock page_title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
|
|
||||||
<h1 class="page-header text-center">Help</h1>
|
<h1 class="page-header text-center">Help</h1>
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<p class="text-center">
|
<div class="row">
|
||||||
Contact IT
|
<p class="text-center">
|
||||||
</p>
|
Contact IT
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
23
templates/registered/hrapplicationmanagement.html
Normal file
23
templates/registered/hrapplicationmanagement.html
Normal 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 %}
|
28
templates/registered/hrcreateapplication.html
Normal file
28
templates/registered/hrcreateapplication.html
Normal 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 %}
|
@ -8,23 +8,24 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Jabber Broadcast</h1>
|
<h1 class="page-header text-center">Jabber Broadcast</h1>
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
{% if success %}
|
<div class="row">
|
||||||
<div class="alert alert-success" role="alert">Broadcast Sent!!</div>
|
{% if success %}
|
||||||
{% endif %}
|
<div class="alert alert-success" role="alert">Broadcast Sent!!</div>
|
||||||
<form class="form-signin" role="form" action="" method="POST">
|
{% endif %}
|
||||||
{% csrf_token %}
|
<form class="form-signin" role="form" action="" method="POST">
|
||||||
{{ form|bootstrap }}
|
{% csrf_token %}
|
||||||
<br/>
|
{{ form|bootstrap }}
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Broadcast</button>
|
<br/>
|
||||||
</form>
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Broadcast</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -7,81 +7,90 @@
|
|||||||
{% block extra_css %}{% endblock extra_css %}
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Available Services</h1>
|
<h1 class="page-header text-center">Available Services</h1>
|
||||||
{% if perms.auth.alliance_member %}
|
{% if perms.auth.alliance_member %}
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-center">Service</th>
|
<th class="text-center">Service</th>
|
||||||
<th class="text-center">Username</th>
|
<th class="text-center">Username</th>
|
||||||
<th class="text-center">Password</th>
|
<th class="text-center">Password</th>
|
||||||
<th class="text-center">Domain</th>
|
<th class="text-center">Domain</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">Forums</td>
|
<td class="text-center">Forums</td>
|
||||||
<td class="text-center">{{ authinfo.forum_username }}</td>
|
<td class="text-center">{{ authinfo.forum_username }}</td>
|
||||||
<td class="text-center">{{ authinfo.forum_password }}</td>
|
<td class="text-center">{{ authinfo.forum_password }}</td>
|
||||||
<td class="text-center"><a href="{{ FORUM_URL }}">{{ FORUM_URL }}</a></td>
|
<td class="text-center"><a href="{{ FORUM_URL }}">{{ FORUM_URL }}</a></td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
{% ifequal authinfo.forum_username "" %}
|
{% ifequal authinfo.forum_username "" %}
|
||||||
<a href="{% url 'auth_activate_forum' %}">
|
<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
|
||||||
</a>
|
class="glyphicon glyphicon-ok"></span></button>
|
||||||
{% else %}
|
</a>
|
||||||
<a href="{% url 'auth_reset_forum_password' %}">
|
{% else %}
|
||||||
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span></button>
|
<a href="{% url 'auth_reset_forum_password' %}">
|
||||||
</a>
|
<button type="button" class="btn btn-primary"><span
|
||||||
<a href="{% url 'auth_deactivate_forum' %}">
|
class="glyphicon glyphicon-refresh"></span></button>
|
||||||
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button>
|
</a>
|
||||||
</a>
|
<a href="{% url 'auth_deactivate_forum' %}">
|
||||||
{% endifequal %}
|
<button type="button" class="btn btn-danger"><span
|
||||||
</td>
|
class="glyphicon glyphicon-remove"></span></button>
|
||||||
</tr>
|
</a>
|
||||||
<tr>
|
{% endifequal %}
|
||||||
<td class="text-center">Jabber</td>
|
</td>
|
||||||
<td class="text-center">{{ authinfo.jabber_username }}</td>
|
</tr>
|
||||||
<td class="text-center">{{ authinfo.jabber_password }}</td>
|
<tr>
|
||||||
<td class="text-center">{{ JABBER_URL }}</td>
|
<td class="text-center">Jabber</td>
|
||||||
<td class="text-center">
|
<td class="text-center">{{ authinfo.jabber_username }}</td>
|
||||||
{% ifequal authinfo.jabber_username "" %}
|
<td class="text-center">{{ authinfo.jabber_password }}</td>
|
||||||
<a href="{% url 'auth_activate_jabber' %}">
|
<td class="text-center">{{ JABBER_URL }}</td>
|
||||||
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
|
<td class="text-center">
|
||||||
</a>
|
{% ifequal authinfo.jabber_username "" %}
|
||||||
{% else %}
|
<a href="{% url 'auth_activate_jabber' %}">
|
||||||
<a href="{% url 'auth_reset_jabber_password' %}">
|
<button type="button" class="btn btn-success"><span
|
||||||
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span></button>
|
class="glyphicon glyphicon-ok"></span></button>
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url 'auth_deactivate_jabber' %}">
|
{% else %}
|
||||||
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button>
|
<a href="{% url 'auth_reset_jabber_password' %}">
|
||||||
</a>
|
<button type="button" class="btn btn-primary"><span
|
||||||
{% endifequal %}
|
class="glyphicon glyphicon-refresh"></span></button>
|
||||||
</td>
|
</a>
|
||||||
</tr>
|
<a href="{% url 'auth_deactivate_jabber' %}">
|
||||||
<tr>
|
<button type="button" class="btn btn-danger"><span
|
||||||
<td class="text-center">Mumble</td>
|
class="glyphicon glyphicon-remove"></span></button>
|
||||||
<td class="text-center">{{ authinfo.mumble_username }}</td>
|
</a>
|
||||||
<td class="text-center">{{ authinfo.mumble_password }}</td>
|
{% endifequal %}
|
||||||
<td class="text-center">{{ MUMBLE_URL }}</td>
|
</td>
|
||||||
<td class="text-center">
|
</tr>
|
||||||
{% ifequal authinfo.mumble_username "" %}
|
<tr>
|
||||||
<a href="{% url 'auth_activate_mumble' %}">
|
<td class="text-center">Mumble</td>
|
||||||
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></button>
|
<td class="text-center">{{ authinfo.mumble_username }}</td>
|
||||||
</a>
|
<td class="text-center">{{ authinfo.mumble_password }}</td>
|
||||||
{% else %}
|
<td class="text-center">{{ MUMBLE_URL }}</td>
|
||||||
<a href="{% url 'auth_reset_mumble_password' %}">
|
<td class="text-center">
|
||||||
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span></button>
|
{% ifequal authinfo.mumble_username "" %}
|
||||||
</a>
|
<a href="{% url 'auth_activate_mumble' %}">
|
||||||
<a href="{% url 'auth_deactivate_mumble' %}">
|
<button type="button" class="btn btn-success"><span
|
||||||
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button>
|
class="glyphicon glyphicon-ok"></span></button>
|
||||||
</a>
|
</a>
|
||||||
{% endifequal %}
|
{% else %}
|
||||||
</td>
|
<a href="{% url 'auth_reset_mumble_password' %}">
|
||||||
</tr>
|
<button type="button" class="btn btn-primary"><span
|
||||||
</table>
|
class="glyphicon glyphicon-refresh"></span></button>
|
||||||
{% else %}
|
</a>
|
||||||
<div class="alert alert-danger" role="alert">You are not in the alliance</div>
|
<a href="{% url 'auth_deactivate_mumble' %}">
|
||||||
{% endif %}
|
<button type="button" class="btn btn-danger"><span
|
||||||
</div>
|
class="glyphicon glyphicon-remove"></span></button>
|
||||||
|
</a>
|
||||||
|
{% endifequal %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-danger" role="alert">You are not in the alliance</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -6,18 +6,19 @@
|
|||||||
{% block title %}{% trans 'Password change' %}{% endblock %}
|
{% block title %}{% trans 'Password change' %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Change Password</h1>
|
<h1 class="page-header text-center">Change Password</h1>
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<p class="text-center">
|
<div class="row">
|
||||||
Completed
|
<p class="text-center">
|
||||||
</p>
|
Completed
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -6,21 +6,22 @@
|
|||||||
{% block title %}{% trans 'Password change' %}{% endblock %}
|
{% block title %}{% trans 'Password change' %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">Change Password</h1>
|
<h1 class="page-header text-center">Change Password</h1>
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<form class="form-signin" role="form" action="" method="POST">
|
<div class="row">
|
||||||
{% csrf_token %}
|
<form class="form-signin" role="form" action="" method="POST">
|
||||||
{{ form|bootstrap }}
|
{% csrf_token %}
|
||||||
<br/>
|
{{ form|bootstrap }}
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Change Password</button>
|
<br/>
|
||||||
</form>
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Change Password</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.panel-transparent {
|
.panel-transparent {
|
||||||
background: rgba(48,48,48,0.7);
|
background: rgba(48, 48, 48, 0.7);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
@ -35,20 +35,20 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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="col-md-4 col-md-offset-4">
|
||||||
<div class="panel panel-default panel-transparent">
|
<div class="panel panel-default panel-transparent">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h1 class="text-center">{% trans 'Password reset complete' %}</h1>
|
<h1 class="text-center">{% trans 'Password reset complete' %}</h1>
|
||||||
|
|
||||||
<p class="text-center">{% trans "Your password has been set." %}</p>
|
<p class="text-center">{% trans "Your password has been set." %}</p>
|
||||||
|
|
||||||
<a href="{{ login_url }}">
|
<a href="{{ login_url }}">
|
||||||
<button class="btn btn-lg btn-success btn-block">Log In</button>
|
<button class="btn btn-lg btn-success btn-block">Log In</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.panel-transparent {
|
.panel-transparent {
|
||||||
background: rgba(48,48,48,0.7);
|
background: rgba(48, 48, 48, 0.7);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
@ -35,11 +35,11 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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="col-md-4 col-md-offset-4">
|
||||||
<div class="panel panel-default panel-transparent">
|
<div class="panel panel-default panel-transparent">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if validlink %}
|
{% if validlink %}
|
||||||
<form class="form-signin" role="form" action="" method="POST">
|
<form class="form-signin" role="form" action="" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form |bootstrap }}
|
{{ form |bootstrap }}
|
||||||
@ -47,16 +47,16 @@
|
|||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Change Password</button>
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Change Password</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<h1>{% trans 'Password reset unsuccessful' %}</h1>
|
<h1>{% trans 'Password reset unsuccessful' %}</h1>
|
||||||
|
|
||||||
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
|
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.panel-transparent {
|
.panel-transparent {
|
||||||
background: rgba(48,48,48,0.7);
|
background: rgba(48, 48, 48, 0.7);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
@ -35,19 +35,19 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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="col-md-4 col-md-offset-4">
|
||||||
<div class="panel panel-default panel-transparent">
|
<div class="panel panel-default panel-transparent">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h1 class="text-center">{% trans 'Password Reset Success' %}</h1>
|
<h1 class="text-center">{% trans 'Password Reset Success' %}</h1>
|
||||||
|
|
||||||
<p>{% trans "We've emailed you instructions for setting your password. You should be receiving them shortly." %}</p>
|
<p>{% trans "We've emailed you instructions for setting your password. You should be receiving them shortly." %}</p>
|
||||||
|
|
||||||
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
|
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{% load i18n %}{% autoescape off %}
|
{% load i18n %}{% autoescape off %}
|
||||||
{% blocktrans %}You're receiving this email because you requested a password reset for your
|
{% blocktrans %}You're receiving this email because you requested a password reset for your
|
||||||
user account.{% endblocktrans %}
|
user account.{% endblocktrans %}
|
||||||
|
|
||||||
{% trans "Please go to the following page and choose a new password:" %}
|
{% trans "Please go to the following page and choose a new password:" %}
|
||||||
{% block reset_link %}
|
{% block reset_link %}
|
||||||
https://the99eve.com{% url 'password_reset_confirm' uidb64=uid token=token %}
|
https://the99eve.com{% url 'password_reset_confirm' uidb64=uid token=token %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}
|
{% 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 %}
|
{% endautoescape %}
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.panel-transparent {
|
.panel-transparent {
|
||||||
background: rgba(48,48,48,0.7);
|
background: rgba(48, 48, 48, 0.7);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
@ -35,22 +35,23 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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="col-md-4 col-md-offset-4">
|
||||||
<div class="panel panel-default panel-transparent">
|
<div class="panel panel-default panel-transparent">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form class="form-signin" role="form" action="" method="POST">
|
<form class="form-signin" role="form" action="" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h1 class="text-center">{% trans "Password Reset" %}</h1>
|
<h1 class="text-center">{% trans "Password Reset" %}</h1>
|
||||||
<p class="text-center">{% trans "Forgotten your password? Enter your email below." %}</p>
|
|
||||||
{{form|bootstrap}}
|
<p class="text-center">{% trans "Forgotten your password? Enter your email below." %}</p>
|
||||||
<div class="">
|
{{ form|bootstrap }}
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Reset Password</button>
|
<div class="">
|
||||||
</div>
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Reset Password</button>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.contrib.auth.models import User
|
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.jabber_manager import JabberManager
|
||||||
from services.managers.forum_manager import ForumManager
|
from services.managers.forum_manager import ForumManager
|
||||||
from services.managers.mumble_manager import MumbleManager
|
from services.managers.mumble_manager import MumbleManager
|
||||||
@ -37,5 +37,5 @@ def deactivate_services(user):
|
|||||||
|
|
||||||
|
|
||||||
def generate_corp_group_name(corpname):
|
def generate_corp_group_name(corpname):
|
||||||
return 'Corp_'+corpname.replace(' ', '_')
|
return 'Corp_' + corpname.replace(' ', '_')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user