(r'^fleet/(?P<fleetname>[ a-zA-Z0-9_]+)/lastpos$', 'ais.djais.views.fleet_lastpos'),
(r'^vessel/$', 'ais.djais.views.vessel_search'),
(r'^vessel/(?P<strmmsi>[0-9A-Z]{9})/$', 'ais.djais.views.vessel'),
+ (r'^vessel/(?P<strmmsi>[0-9A-Z]{9})/lastpos$', 'ais.djais.views.vessel_lastpos'),
(r'^vessel/(?P<strmmsi>[0-9A-Z]{9})/manual_input$', 'ais.djais.views.vessel_manual_input'),
(r'^vessel/(?P<strmmsi>[0-9A-Z]{9})/history$', 'ais.djais.views.vessel_history'),
(r'^vessel/(?P<strmmsi>[0-9A-Z]{9})/track$', 'ais.djais.views.vessel_history', {'format': u'track'}),
class HistoryForm(forms.Form):
- format = forms.ChoiceField(choices=(('track', 'Track line (Google Earth)'), ('animation', 'Animation (Google Earth)'), ('csv', 'Coma separated values (SpreadSheet)')), widget=forms.Select(attrs={'onchange': mark_safe("if (this.value=='csv') $('#csvhint').show(); else $('#csvhint').hide();")}))
+ format = forms.ChoiceField(choices=(('animation', 'Animation (Google Earth v5)'), ('track', 'Track line (Google Earth)'), ('csv', 'Coma separated values (SpreadSheet)')), widget=forms.Select(attrs={'onchange': mark_safe("if (this.value=='csv') $('#csvhint').show(); else $('#csvhint').hide();")}))
period_type = forms.ChoiceField(choices=(('duration', 'Duration until now'), ('date_date','Between two dates'), ('start_duration', 'Start date and duration')), widget=forms.RadioSelect(attrs={'onchange': mark_safe("show_hide_start_end_time(this.value);")}))
start_date = forms.DateTimeField(required=False, widget=AisCalendarWidget(attrs={'class':'vDateField'}))
duration = PeriodField(required=False, label='Period length', initial=7*86400)
return render_to_response('vessel_manual_input.html', {'form': form, 'nmea': nmea}, RequestContext(request))
+@http_authenticate(auth, 'ais')
+def vessel_lastpos(request, strmmsi):
+ value = kml_to_kmz(format_fleet([ strmmsi ], document_name=strmmsi).encode('utf-8'))
+ response = HttpResponse(value, mimetype="application/vnd.google-earth.kml")
+ response['Content-Disposition'] = 'attachment; filename=%s.kmz' % strmmsi
+ return response
+
@http_authenticate(auth, 'ais')
def vessel_history(request, strmmsi):
"""