Browse Source

Resolvido bug onde nao apareciam pontos no mapa

producao
Marcio Mazza 10 years ago
parent
commit
f46f8dfa00
  1. 14
      sigi/apps/casas/views.py
  2. 2
      sigi/apps/convenios/admin.py
  3. 6
      sigi/apps/convenios/views.py
  4. 4
      sigi/apps/diagnosticos/static/js/jquery/jquery-1.6.4.min.js
  5. 8
      sigi/apps/diagnosticos/views.py
  6. 5
      sigi/apps/metas/views.py
  7. 2
      sigi/apps/parlamentares/views.py
  8. 2
      sigi/apps/servicos/views.py
  9. 2
      sigi/shortcuts.py
  10. 30
      sigiStatic/js/metas/mapa.js

14
sigi/apps/casas/views.py

@ -159,7 +159,7 @@ def labels_report(request, id=None, tipo=None, formato='3x9_etiqueta'):
if not qs: if not qs:
return HttpResponseRedirect('../') return HttpResponseRedirect('../')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=casas.pdf' response['Content-Disposition'] = 'attachment; filename=casas.pdf'
report = CasasLegislativasLabels(queryset=qs, formato=formato) report = CasasLegislativasLabels(queryset=qs, formato=formato)
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)
@ -187,7 +187,7 @@ def labels_report_parlamentar(request, id=None, formato='3x9_etiqueta'):
if not qs: if not qs:
return HttpResponseRedirect('../') return HttpResponseRedirect('../')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=casas.pdf' response['Content-Disposition'] = 'attachment; filename=casas.pdf'
report = ParlamentaresLabels(queryset=qs, formato=formato) report = ParlamentaresLabels(queryset=qs, formato=formato)
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)
@ -227,7 +227,7 @@ def labels_report_sem_presidente(request, id=None, formato='2x5_etiqueta'):
if not qs: if not qs:
return HttpResponseRedirect('../') return HttpResponseRedirect('../')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=casas.pdf' response['Content-Disposition'] = 'attachment; filename=casas.pdf'
report = CasasLegislativasLabelsSemPresidente(queryset=qs, formato=formato) report = CasasLegislativasLabelsSemPresidente(queryset=qs, formato=formato)
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)
@ -253,7 +253,7 @@ def report(request, id=None, tipo=None):
return HttpResponseRedirect('../') return HttpResponseRedirect('../')
# qs.order_by('municipio__uf','nome') # qs.order_by('municipio__uf','nome')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=casas.pdf' response['Content-Disposition'] = 'attachment; filename=casas.pdf'
report = CasasLegislativasReport(queryset=qs) report = CasasLegislativasReport(queryset=qs)
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)
@ -270,7 +270,7 @@ def report_complete(request, id=None):
if not qs: if not qs:
return HttpResponseRedirect('../') return HttpResponseRedirect('../')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=casas.pdf' response['Content-Disposition'] = 'attachment; filename=casas.pdf'
# Gera um relatorio para cada casa e concatena os relatorios # Gera um relatorio para cada casa e concatena os relatorios
@ -306,14 +306,14 @@ def casas_sem_convenio_report(request):
if not qs: if not qs:
return HttpResponseRedirect('../') return HttpResponseRedirect('../')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
report = CasasSemConvenioReport(queryset=qs) report = CasasSemConvenioReport(queryset=qs)
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)
return response return response
def export_csv(request): def export_csv(request):
response = HttpResponse(mimetype='text/csv') response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=casas.csv' response['Content-Disposition'] = 'attachment; filename=casas.csv'
writer = csv.writer(response) writer = csv.writer(response)

2
sigi/apps/convenios/admin.py

@ -101,7 +101,7 @@ class ConvenioAdmin(admin.ModelAdmin):
def relatorio(self, request, queryset): def relatorio(self, request, queryset):
# queryset.order_by('casa_legislativa__municipio__uf') # queryset.order_by('casa_legislativa__municipio__uf')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
report = ConvenioReport(queryset=queryset) report = ConvenioReport(queryset=queryset)
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)
return response return response

6
sigi/apps/convenios/views.py

@ -174,7 +174,7 @@ def report(request, id=None):
else: else:
report = ConvenioPorCMReport(queryset=qs) report = ConvenioPorCMReport(queryset=qs)
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
if report: if report:
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)
else: else:
@ -279,7 +279,7 @@ def report_regiao(request, regiao='NE'):
data = datetime.datetime.now().strftime('%d/%m/%Y') data = datetime.datetime.now().strftime('%d/%m/%Y')
hora = datetime.datetime.now().strftime('%H:%M') hora = datetime.datetime.now().strftime('%H:%M')
pisa.showLogging() pisa.showLogging()
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=RelatorioRegiao_' + regiao + '.pdf' response['Content-Disposition'] = 'attachment; filename=RelatorioRegiao_' + regiao + '.pdf'
#tabelas = ({'projeto':"PI"},{'projeto':"PML"},) #tabelas = ({'projeto':"PI"},{'projeto':"PML"},)
t = loader.get_template('convenios/tabela_regiao.html') t = loader.get_template('convenios/tabela_regiao.html')
@ -292,7 +292,7 @@ def report_regiao(request, regiao='NE'):
def export_csv(request): def export_csv(request):
response = HttpResponse(mimetype='text/csv') response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=convenios.csv' response['Content-Disposition'] = 'attachment; filename=convenios.csv'
csv_writer = csv.writer(response) csv_writer = csv.writer(response)

4
sigi/apps/diagnosticos/static/js/jquery/jquery-1.6.4.min.js

File diff suppressed because one or more lines are too long

8
sigi/apps/diagnosticos/views.py

@ -93,7 +93,7 @@ def categoria_detalhes(request, id_diagnostico, id_categoria):
'erros': form.errors 'erros': form.errors
} }
json = simplejson.dumps(resposta) json = simplejson.dumps(resposta)
return HttpResponse(json, mimetype="application/json") return HttpResponse(json, content_type='application/json')
else: else:
form = DiagnosticoMobileForm(instance=diagnostico, form = DiagnosticoMobileForm(instance=diagnostico,
category=id_categoria) category=id_categoria)
@ -131,7 +131,7 @@ def categoria_casa_legislativa(request, id_diagnostico):
'erros': form.errors 'erros': form.errors
} }
json = simplejson.dumps(resposta) json = simplejson.dumps(resposta)
return HttpResponse(json, mimetype="application/json") return HttpResponse(json, content_type='application/json')
else: else:
form = CasaLegislativaMobileForm(instance=casa_legislativa) form = CasaLegislativaMobileForm(instance=casa_legislativa)
@ -213,7 +213,7 @@ def categoria_contatos(request, id_diagnostico):
resposta['erros'][key] = value resposta['erros'][key] = value
json = simplejson.dumps(resposta) json = simplejson.dumps(resposta)
return HttpResponse(json, mimetype="application/json") return HttpResponse(json, content_type='application/json')
else: else:
forms = [FuncionariosMobileForm(prefix=f.setor, instance=f) forms = [FuncionariosMobileForm(prefix=f.setor, instance=f)
for f, c in funcionarios] for f, c in funcionarios]
@ -340,4 +340,4 @@ def municipios_diagnosticados(self):
'fim': d.data_visita_fim, 'equipe': "<ul><li>" + "</li><li>".join([m.user.get_full_name() for m in d.membros]) + "</li></ul>", } 'fim': d.data_visita_fim, 'equipe': "<ul><li>" + "</li><li>".join([m.user.get_full_name() for m in d.membros]) + "</li></ul>", }
municipios.append(municipio) municipios.append(municipio)
return HttpResponse(simplejson.dumps(municipios), mimetype="application/json") return HttpResponse(simplejson.dumps(municipios), content_type='application/json')

5
sigi/apps/metas/views.py

@ -98,14 +98,13 @@ def map_data(request):
Tenta ler esse json do arquivo JSON_FILE_NAME. Se não encontrar, chama a rotina Tenta ler esse json do arquivo JSON_FILE_NAME. Se não encontrar, chama a rotina
gera_map_data_file(). gera_map_data_file().
""" """
try: try:
file = open(JSON_FILE_NAME, 'r') file = open(JSON_FILE_NAME, 'r')
json = file.read() json = file.read()
except: except:
json = gera_map_data_file() json = gera_map_data_file()
return HttpResponse(json, mimetype="application/json") return HttpResponse(json, content_type='application/json')
def map_search(request): def map_search(request):
@ -120,7 +119,7 @@ def map_search(request):
if casas.count() > 0: if casas.count() > 0:
response = {'result': 'FOUND', 'ids': [c.pk for c in casas]} response = {'result': 'FOUND', 'ids': [c.pk for c in casas]}
return HttpResponse(simplejson.dumps(response), mimetype="application/json") return HttpResponse(simplejson.dumps(response), content_type='application/json')
@cache_page(86400) # Cache de um dia (24 horas = 86400 segundos) @cache_page(86400) # Cache de um dia (24 horas = 86400 segundos)

2
sigi/apps/parlamentares/views.py

@ -139,7 +139,7 @@ def labels_report(request, id=None, formato='3x9_etiqueta'):
if not qs: if not qs:
return HttpResponseRedirect('../') return HttpResponseRedirect('../')
response = HttpResponse(mimetype='application/pdf') response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=casas.pdf' response['Content-Disposition'] = 'attachment; filename=casas.pdf'
report = ParlamentaresLabels(queryset=qs, formato=formato) report = ParlamentaresLabels(queryset=qs, formato=formato)
report.generate_by(PDFGenerator, filename=response) report.generate_by(PDFGenerator, filename=response)

2
sigi/apps/servicos/views.py

@ -47,7 +47,7 @@ def municipios_atendidos(self, servico):
'servicos': "<ul><li>" + "</li><li>".join([s.tipo_servico.nome for s in casa.servico_set.filter(query)]) + "</li></ul>", } 'servicos': "<ul><li>" + "</li><li>".join([s.tipo_servico.nome for s in casa.servico_set.filter(query)]) + "</li></ul>", }
municipios.append(municipio) municipios.append(municipio)
return HttpResponse(simplejson.dumps(municipios), mimetype="application/json") return HttpResponse(simplejson.dumps(municipios), content_type='application/json')
class CasaManifestaProtoForm(forms.Form): class CasaManifestaProtoForm(forms.Form):

2
sigi/shortcuts.py

@ -21,5 +21,5 @@ def render_to_pdf(template_src, context_dict):
pdf = pisa.pisaDocument(StringIO.StringIO(html.encode('utf-8')), result, link_callback=fetch_resources) pdf = pisa.pisaDocument(StringIO.StringIO(html.encode('utf-8')), result, link_callback=fetch_resources)
if not pdf.err: if not pdf.err:
return HttpResponse(result.getvalue(), mimetype='application/pdf') return HttpResponse(result.getvalue(), content_type='application/pdf')
return HttpResponse('We had some errors<pre>%s</pre>' % escape(html)) return HttpResponse('We had some errors<pre>%s</pre>' % escape(html))

30
sigiStatic/js/metas/mapa.js

@ -19,7 +19,7 @@
map = new google.maps.Map(document.getElementById("map"), myOptions); map = new google.maps.Map(document.getElementById("map"), myOptions);
ajax_submit(); ajax_submit();
}) })
function ajax_submit(event) { function ajax_submit(event) {
$.ajax({ $.ajax({
url: "/dashboard/mapdata/", url: "/dashboard/mapdata/",
@ -31,7 +31,7 @@
municipiosArray[i].setMap(null); municipiosArray[i].setMap(null);
} }
municipiosArray = {} municipiosArray = {}
// Create new markers // Create new markers
for (var i in return_data) { for (var i in return_data) {
var municipio = return_data[i]; var municipio = return_data[i];
@ -39,7 +39,7 @@
map: null, // Just create the mark, dont plot it map: null, // Just create the mark, dont plot it
position: new google.maps.LatLng(parseFloat(municipio.lat), parseFloat(municipio.lng)), position: new google.maps.LatLng(parseFloat(municipio.lat), parseFloat(municipio.lng)),
title: municipio.nome, title: municipio.nome,
icon: municipio.icone icon: '/static/img/mapmarker.png'
} }
var mark = new google.maps.Marker(markData); var mark = new google.maps.Marker(markData);
var infoWin = new google.maps.InfoWindow({content: '<strong>' + municipio.nome + '</strong><br/><br/>' + municipio.info }); var infoWin = new google.maps.InfoWindow({content: '<strong>' + municipio.nome + '</strong><br/><br/>' + municipio.info });
@ -56,20 +56,20 @@
function linkMarkMessage(mark, infoWin, map) { function linkMarkMessage(mark, infoWin, map) {
google.maps.event.addListener(mark, 'click', function() {infoWin.open(map, mark);}); google.maps.event.addListener(mark, 'click', function() {infoWin.open(map, mark);});
} }
function closeAllInfowindows() { function closeAllInfowindows() {
for (var i in municipiosArray) { for (var i in municipiosArray) {
municipiosArray[i]['infowindow'].close(); municipiosArray[i]['infowindow'].close();
} }
} }
function filter(event) { function filter(event) {
var data = $("#filter_form").serializeArray(); var data = $("#filter_form").serializeArray();
var estados = []; var estados = [];
var regioes = []; var regioes = [];
$(".totalizador").text("0"); $(".totalizador").text("0");
for (var i in data) { for (var i in data) {
var name = data[i].name, value = data[i].value; var name = data[i].name, value = data[i].value;
if (name == 'estados') { if (name == 'estados') {
@ -80,14 +80,14 @@
delete data[i]; delete data[i];
} }
} }
for (var i in municipiosArray) { for (var i in municipiosArray) {
var municipio = municipiosArray[i]; var municipio = municipiosArray[i];
municipio['infowindow'].close(); municipio['infowindow'].close();
var aparece = false; var aparece = false;
if (regioes.indexOf(municipio.regiao) == -1 && estados.indexOf(municipio.estado) == -1) { if (regioes.indexOf(municipio.regiao) == -1 && estados.indexOf(municipio.estado) == -1) {
aparece = false; aparece = false;
} else { } else {
for (var j in data) { for (var j in data) {
if (data[j]) { if (data[j]) {
@ -108,10 +108,10 @@
qtde = parseInt(qtde); qtde = parseInt(qtde);
qtde++; qtde++;
$("#" + municipio.regiao + ".totalizador").text(qtde); $("#" + municipio.regiao + ".totalizador").text(qtde);
qtde = parseInt($("#" + municipio.estado + ".totalizador").text()); qtde = parseInt($("#" + municipio.estado + ".totalizador").text());
$("#" + municipio.estado + ".totalizador").text(++qtde); $("#" + municipio.estado + ".totalizador").text(++qtde);
for (var j in municipio.seit) { for (var j in municipio.seit) {
qtde = parseInt($("#" + municipio.seit[j] + ".totalizador").text()); qtde = parseInt($("#" + municipio.seit[j] + ".totalizador").text());
$("#" + municipio.seit[j] + ".totalizador").text(++qtde); $("#" + municipio.seit[j] + ".totalizador").text(++qtde);
@ -126,7 +126,7 @@
qtde = parseInt($("#equip_" + municipio.equipadas[j] + ".totalizador").text()); qtde = parseInt($("#equip_" + municipio.equipadas[j] + ".totalizador").text());
$("#equip_" + municipio.equipadas[j] + ".totalizador").text(++qtde); $("#equip_" + municipio.equipadas[j] + ".totalizador").text(++qtde);
} }
for (var j in municipio.diagnosticos) { for (var j in municipio.diagnosticos) {
qtde = parseInt($("#diagnostico_" + municipio.diagnosticos[j] + ".totalizador").text()); qtde = parseInt($("#diagnostico_" + municipio.diagnosticos[j] + ".totalizador").text());
$("#diagnostico_" + municipio.diagnosticos[j] + ".totalizador").text(++qtde); $("#diagnostico_" + municipio.diagnosticos[j] + ".totalizador").text(++qtde);
@ -138,7 +138,7 @@
} }
} }
} }
function search(event) { function search(event) {
$.ajax({ $.ajax({
url: "/dashboard/mapsearch/", url: "/dashboard/mapsearch/",
@ -179,7 +179,7 @@
}}); }});
return false; return false;
} }
function open_report(event) { function open_report(event) {
var data = $("#filter_form").serialize(); var data = $("#filter_form").serialize();
var href = this.href; var href = this.href;
@ -192,5 +192,5 @@
win.focus(); win.focus();
return false; return false;
} }
})(django.jQuery); })(django.jQuery);

Loading…
Cancel
Save