Changeset 9819
- Timestamp:
- Dec 23, 2011, 8:31:50 AM (13 years ago)
- Location:
- src/django_gheat
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/admin.py
r9818 r9819 2 2 from django.contrib import admin 3 3 4 class Acces pointAdmin(admin.ModelAdmin):4 class AccesspointAdmin(admin.ModelAdmin): 5 5 list_display = ['ssid','type', 'mac', 'organization'] 6 6 search_fields = ['ssid', 'mac', 'organization'] 7 7 ordering = ['ssid'] 8 admin.site.register(Acces point, AccespointAdmin)8 admin.site.register(Accesspoint, AccesspointAdmin) 9 9 10 10 class MeetBestandInline(admin.TabularInline): … … 35 35 36 36 class MetingAdmin(admin.ModelAdmin): 37 list_display = ['acces point', 'latitude', 'longitude', 'signaal']38 search_fields = ['acces point__ssid']37 list_display = ['accesspoint', 'latitude', 'longitude', 'signaal'] 38 search_fields = ['accesspoint__ssid'] 39 39 admin.site.register(Meting, MetingAdmin) -
src/django_gheat/gheat/base.py
r9041 r9819 7 7 import gheat 8 8 import gheat.opacity 9 from gheat.models import Acces point, Gebruiker, Meting9 from gheat.models import Accesspoint, Gebruiker, Meting 10 10 from gheat import gheatsettings as settings 11 11 from gheat import gmerc -
src/django_gheat/gheat/dataimport/__init__.py
r9818 r9819 74 74 75 75 76 def import_acces points(ap_pool, counters):77 # Determine which Acces points to add78 bssid_list_present = Acces point.objects.filter(mac__in=ap_pool.keys()).\76 def import_accesspoints(ap_pool, counters): 77 # Determine which Accesspoints to add 78 bssid_list_present = Accesspoint.objects.filter(mac__in=ap_pool.keys()).\ 79 79 values_list('mac', flat=True) 80 80 bssid_list_insert = set(ap_pool.keys()) - set(bssid_list_present) … … 85 85 for bssid in bssid_list_insert: 86 86 ssid, encryption = ap_pool[bssid] 87 type = Acces point.get_type_by_ssid(ssid)87 type = Accesspoint.get_type_by_ssid(ssid) 88 88 # Special trick in SSID ts avoid escaping in later stage 89 89 item = str((bssid.upper(),ssid.replace('%','%%'),encryption, 90 Acces point.get_type_by_ssid(ssid),90 Accesspoint.get_type_by_ssid(ssid), 91 91 get_organization_id_by_ssid(ssid))) 92 92 sql_values.append(item) 93 counters['ap_added'] = bulk_sql('gheat_acces point (`mac`, `ssid`,\93 counters['ap_added'] = bulk_sql('gheat_accesspoint (`mac`, `ssid`,\ 94 94 `encryptie`, `type`, `organization_id`)',sql_values) 95 95 return counters … … 104 104 # Build mapping for meting import 105 105 mac2id = {} 106 for mac,id in Acces point.objects.filter(mac__in=bssid_list).\106 for mac,id in Accesspoint.objects.filter(mac__in=bssid_list).\ 107 107 values_list('mac','id'): 108 108 mac2id[mac] = int(id) … … 134 134 if sql_values: 135 135 counters['meting_added'] = bulk_sql('gheat_meting (`meetrondje_id`,\ 136 `acces point_id`, `latitude`, `longitude`, `signaal`)',sql_values)136 `accesspoint_id`, `latitude`, `longitude`, `signaal`)',sql_values) 137 137 return counters 138 138 … … 186 186 187 187 if ap_pool: 188 counters = import_acces points(ap_pool, counters)188 counters = import_accesspoints(ap_pool, counters) 189 189 if client_pool: 190 190 counters = import_clients(client_pool, counters) … … 192 192 counters = import_metingen(meetrondje, meting_pool, counters) 193 193 194 logger.debug("summary acces points: total:%(ap_total)-6s added:%(ap_added)-6s failed:%(ap_failed)-6s ignored:%(ap_ignored)-6s" % counters)194 logger.debug("summary accesspoints: total:%(ap_total)-6s added:%(ap_added)-6s failed:%(ap_failed)-6s ignored:%(ap_ignored)-6s" % counters) 195 195 logger.debug("summary client : total:%(client_total)-6s added:%(client_added)-6s failed:%(client_failed)-6s ignored:%(client_ignored)-6s" % counters) 196 196 logger.debug("summary metingen : total:%(meting_total)-6s added:%(meting_added)-6s failed:%(meting_failed)-6s ignored:%(meting_ignored)-6s" % counters) -
src/django_gheat/gheat/dataimport/kismet.py
r9668 r9819 17 17 raise IOError(e) 18 18 19 # Prepare new acces points and measurements19 # Prepare new accesspoints and measurements 20 20 wnetworks = netxml_doc.findall('wireless-network') 21 21 … … 55 55 bssid_failed = defaultdict(int) 56 56 57 # Prepare new acces points and measurements57 # Prepare new accesspoints and measurements 58 58 points = gpsxml_doc.findall('gps-point') 59 59 -
src/django_gheat/gheat/management/commands/add_random_points.py
r9057 r9819 19 19 equipment, created = Apparatuur.objects.get_or_create(antenne='itern', kaart='device') 20 20 21 acces point, created = Accespoint.objects.get_or_create(mac='00:11:22:33:44',21 accesspoint, created = Accesspoint.objects.get_or_create(mac='00:11:22:33:44', 22 22 ssid='ap-WirelessLeiden-Test', encryptie=True) 23 23 … … 27 27 rondje.save() 28 28 29 sql_insert = "INSERT INTO gheat_meting (meetrondje_id, acces point_id, lat, lng, signaal) VALUES ";29 sql_insert = "INSERT INTO gheat_meting (meetrondje_id, accesspoint_id, lat, lng, signaal) VALUES "; 30 30 sql_insert_values = [] 31 31 for i in range(0,count): … … 38 38 # print "#Importing Random mesurements: %s/%s" % (i,count) 39 39 #meting = Meting.objects.create(meetrondje=rondje, 40 # acces point=accespoint,latitude=latitude,40 # accesspoint=accesspoint,latitude=latitude, 41 41 # longitude=longitude,signaal=signal) 42 42 #meting.save() 43 sql_insert_values.append("('" + "','".join(map(str,[rondje.id, acces point.id, latitude, longitude, signal])) + "')")43 sql_insert_values.append("('" + "','".join(map(str,[rondje.id, accesspoint.id, latitude, longitude, signal])) + "')") 44 44 45 45 sql_insert += ','.join(sql_insert_values) + ';'; -
src/django_gheat/gheat/management/commands/import_datafile.py
r9669 r9819 139 139 140 140 counters = import_file(filename,meetrondje) 141 logger.info("summary acces points: total:%(ap_total)-6s added:%(ap_added)-6s failed:%(ap_failed)-6s ignored:%(ap_ignored)-6s" % counters)141 logger.info("summary accesspoints: total:%(ap_total)-6s added:%(ap_added)-6s failed:%(ap_failed)-6s ignored:%(ap_ignored)-6s" % counters) 142 142 logger.info("summary client : total:%(client_total)-6s added:%(client_added)-6s failed:%(client_failed)-6s ignored:%(client_ignored)-6s" % counters) 143 143 logger.info("summary metingen : total:%(meting_total)-6s added:%(meting_added)-6s failed:%(meting_failed)-6s ignored:%(meting_ignored)-6s" % counters) -
src/django_gheat/gheat/models.py
r9818 r9819 7 7 MAX_SIGNAL = 100 8 8 9 ACCES POINT_TYPE_CHOICES= (10 ('acces point', 'Acess Point'),9 ACCESSPOINT_TYPE_CHOICES= ( 10 ('accesspoint', 'Acess Point'), 11 11 ('interlink', 'InterLink'), 12 12 ) … … 72 72 return "%s - %s" % (self.name, self.organization) 73 73 74 class Acces point(models.Model):74 class Accesspoint(models.Model): 75 75 mac = models.CharField(max_length=17) 76 76 ssid = models.CharField(max_length=64) 77 type = models.CharField(max_length=20, null=True, blank=True, choices=ACCES POINT_TYPE_CHOICES)77 type = models.CharField(max_length=20, null=True, blank=True, choices=ACCESSPOINT_TYPE_CHOICES) 78 78 organization = models.ForeignKey(Organization,null=True, blank=True) 79 79 encryptie = models.BooleanField() … … 86 86 def get_type_by_ssid(ssid): 87 87 if ssid.startswith('ap'): 88 type = 'acces point'88 type = 'accesspoint' 89 89 elif ssid.startswith('il'): 90 90 type = 'interlink' … … 94 94 95 95 def save(self, *args, **kwargs): 96 super(Acces point, self).save(*args, **kwargs)96 super(Accesspoint, self).save(*args, **kwargs) 97 97 98 98 class Gebruiker(models.Model): … … 141 141 class Meting(models.Model): 142 142 meetrondje = models.ForeignKey(MeetRondje) 143 acces point = models.ForeignKey(Accespoint)143 accesspoint = models.ForeignKey(Accesspoint) 144 144 latitude = models.FloatField() 145 145 longitude = models.FloatField() 146 146 signaal = IntegerRangeField(max_length=3,min_value=MIN_SIGNAL,max_value=MAX_SIGNAL) 147 147 def __unicode__(self): 148 return "%s @ %.5f,%.5f : %s" % (self.acces point.ssid, float(self.latitude), float(self.longitude), self.signaal)148 return "%s @ %.5f,%.5f : %s" % (self.accesspoint.ssid, float(self.latitude), float(self.longitude), self.signaal) 149 149 class Meta: 150 150 # This implies that you cannot have multiple messurements on the same 151 151 # location for a single 'run', thus the data needs cleaned before to make 152 152 # this properly hold. 153 unique_together = ('meetrondje', 'acces point', 'latitude', 'longitude'),153 unique_together = ('meetrondje', 'accesspoint', 'latitude', 'longitude'), 154 154 verbose_name_plural = 'Metingen' 155 155 -
src/django_gheat/wlheatmap/filters.py
r9778 r9819 18 18 sum_ssid = set() 19 19 for mr in MeetRondje.objects.filter(gebruiker=user).order_by('naam'): 20 # Get list if acces points found in the specific 'Meting', and make this is list.20 # Get list if accesspoints found in the specific 'Meting', and make this is list. 21 21 wirelessleiden_ssid = Meting.objects.filter(meetrondje=mr, 22 acces point__organization__name__startswith='Wireless').\23 values_list('acces point__ssid',flat=True).\24 order_by('acces point__ssid').distinct()22 accesspoint__organization__name__startswith='Wireless').\ 23 values_list('accesspoint__ssid',flat=True).\ 24 order_by('accesspoint__ssid').distinct() 25 25 # The explicit cast to list is required as django lists are special and 26 26 # cannot be handled by simplejson. -
src/django_gheat/wlheatmap/nodelist.py
r9596 r9819 47 47 }) 48 48 49 objquery = Acces point.objects.filter(**filter).distinct()49 objquery = Accesspoint.objects.filter(**filter).distinct() 50 50 nodelist = serializers.serialize('json', objquery, fields=('fields','ssid')) 51 51 -
src/django_gheat/wlheatmap/static/heatmap_extensions.js
r9816 r9819 313 313 initialize: function(name, options) { 314 314 var url = [ 315 "tile/${z}/${x},${y}.png?&colour=" + colour + "&acces point__ssid=" + node315 "tile/${z}/${x},${y}.png?&colour=" + colour + "&accesspoint__ssid=" + node 316 316 ]; 317 317 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); … … 357 357 } 358 358 if (wlnode != 'all') { 359 query_array.push('acces point__ssid=' + wlnode);359 query_array.push('accesspoint__ssid=' + wlnode); 360 360 } 361 361 if (nodetype) { -
src/django_gheat/wlheatmap/templates/home.html
r9816 r9819 47 47 <select id="select_node" style="width:104px"></select> Node<br /> 48 48 <select id="select_nodetype" style="width:104px"> 49 <option value="acces point__ssid__icontains=ap-WirelessLeiden">WL Nodes</option>50 <option value="acces point__ssid__icontains=WirelessLeiden">WL Nodes & WL InterLinks</option>49 <option value="accesspoint__ssid__icontains=ap-WirelessLeiden">WL Nodes</option> 50 <option value="accesspoint__ssid__icontains=WirelessLeiden">WL Nodes & WL InterLinks</option> 51 51 <option value="">Alle AccessPoints (ook niet WL)</option> 52 52 </select> Type<br /> -
src/django_gheat/wlheatmap/templates/js/LayerBase.js
r9653 r9819 162 162 163 163 /** 164 * All acces points164 * All accesspoints 165 165 */ 166 166 OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, { … … 182 182 initialize: function(name, options) { 183 183 var url = get_balanced_urls('{{ settings.DJANGO_CDN_DOMAINS_PROTOCOL }}', {{ settings.DJANGO_CDN_DOMAINS|safe }}, 184 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&acces point__organization__name__startswith=Wireless');184 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accesspoint__organization__name__startswith=Wireless'); 185 185 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 186 186 var newArguments = [name, url, options];
Note:
See TracChangeset
for help on using the changeset viewer.