Changeset 9579
- Timestamp:
- Aug 26, 2011, 8:54:24 PM (13 years ago)
- Location:
- src/django_gheat
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/admin.py
r9395 r9579 2 2 from django.contrib import admin 3 3 4 admin.site.register(Accespoint) 4 class AccespointAdmin(admin.ModelAdmin): 5 list_display = ['ssid','mac', 'organization'] 6 search_fields = ['ssid', 'mac', 'organization'] 7 8 admin.site.register(Accespoint, AccespointAdmin) 5 9 admin.site.register(Apparatuur) 6 10 admin.site.register(Gebruiker) -
src/django_gheat/gheat/management/commands/import_droidstumbler.py
r9565 r9579 96 96 ssid, encryption = ap_pool[bssid] 97 97 # Special trick in SSID ts avoid escaping in later stage 98 item = str((bssid.upper(),ssid.replace('%','%%'),encryption ))98 item = str((bssid.upper(),ssid.replace('%','%%'),encryption,Accespoint.get_organization(ssid))) 99 99 sql_values.append(item) 100 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie` )',sql_values)100 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie`, `organization`)',sql_values) 101 101 102 102 # Build mapping for meting import -
src/django_gheat/gheat/management/commands/import_kismet.py
r9565 r9579 76 76 ssid, encryption = ap_pool[bssid] 77 77 # Special trick in SSID ts avoid escaping in later stage 78 item = str((bssid.upper(),ssid.replace('%','%%'),encryption ))78 item = str((bssid.upper(),ssid.replace('%','%%'),encryption,Accespoint.get_organization(ssid))) 79 79 sql_values.append(item) 80 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie` )',sql_values)80 counters['ap_added'] = bulk_sql('gheat_accespoint (`mac`, `ssid`, `encryptie`, `organization`)',sql_values) 81 81 82 82 # Determine which Wireless Clients to add -
src/django_gheat/gheat/models.py
r9562 r9579 57 57 return self.mac 58 58 59 60 ORGANIZATION_CHOICES = ( 61 ('WirelessLeiden', 'Wireless Leiden'), 62 ) 63 59 64 class Accespoint(models.Model): 60 65 mac = models.CharField(max_length=17) 61 66 ssid = models.CharField(max_length=64) 67 organization = models.CharField(max_length="50",choices=ORGANIZATION_CHOICES,null=True,blank=True) 62 68 encryptie = models.BooleanField() 63 69 class Meta: … … 65 71 def __unicode__(self): 66 72 return "%s - %s" % (self.mac, self.ssid) 73 74 @staticmethod 75 def get_organization(ssid): 76 """ Try to determine the organization via the SSID """ 77 organization = '' 78 if ssid.startswith('ap') and ssid.endswith('wleiden.net'): 79 organization = 'WirelessLeiden' 80 elif ssid.startswith('ap') and 'WirelessLeiden' in ssid: 81 organization = 'WirelessLeiden' 82 return organization 83 84 def save(self, *args, **kwargs): 85 self.organization = self.get_organization(self.ssid) 86 super(Accespoint, self).save(*args, **kwargs) 67 87 68 88 class Gebruiker(models.Model): -
src/django_gheat/wlheatmap/filters.py
r9577 r9579 20 20 # Get list if accespoints found in the specific 'Meting', and make this is list. 21 21 wirelessleiden_ssid = Meting.objects.filter(meetrondje=mr, 22 accespoint__ ssid__contains='WirelessLeiden').\22 accespoint__organization='WirelessLeiden').\ 23 23 values_list('accespoint__ssid',flat=True).\ 24 24 order_by('accespoint__ssid').distinct() -
src/django_gheat/wlheatmap/nodelist.py
r9244 r9579 40 40 filter = {} 41 41 filter.update({ 42 ' ssid__contains' : 'WirelessLeiden',42 'organization' : 'WirelessLeiden', 43 43 'meting__latitude__lt' : maxlat, 44 44 'meting__longitude__lt' : maxlon, -
src/django_gheat/wlheatmap/templates/js/LayerBase.js
r9549 r9579 168 168 OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, { 169 169 initialize: function(name, options) { 170 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=90,90,90'); 170 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, 171 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=90,90,90'); 171 172 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 172 173 var newArguments = [name, url, options]; … … 182 183 OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, { 183 184 initialize: function(name, options) { 184 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden'); 185 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, 186 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__organization=WirelessLeiden'); 185 187 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 186 188 var newArguments = [name, url, options]; … … 196 198 OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, { 197 199 initialize: function(name, options) { 198 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=50,150,50&signaal__gte=0&signaal__lte=100'); 200 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, 201 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=50,150,50&signaal__gte=0&signaal__lte=100'); 199 202 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 200 203 var newArguments = [name, url, options];
Note:
See TracChangeset
for help on using the changeset viewer.