From 4e10da5121a8c33af75672e8f61d6dfd6f5e988c Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Wed, 13 Feb 2019 17:49:18 -0200 Subject: [PATCH 01/27] HOTFIX - tirar o caractere "/" para parlamentar sem partido na tela de Presenca --- sapl/templates/sessao/presenca.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapl/templates/sessao/presenca.html b/sapl/templates/sessao/presenca.html index a22549e19..ff7bdaed1 100644 --- a/sapl/templates/sessao/presenca.html +++ b/sapl/templates/sessao/presenca.html @@ -32,7 +32,7 @@ {% else %} @@ -40,7 +40,7 @@ {% endif %} @@ -63,7 +63,7 @@ {% if check %}
-
From 1b5fbd84573b7b96616d73aa0709dba08d26bc74 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Wed, 13 Feb 2019 22:29:42 -0200 Subject: [PATCH 02/27] Fix #2456 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit até a release 1.6.1 do django-crispy-forms, os fields em Meta.Fields eram renderizados mesmo se não mencionados no helper. Com esta mudança (https://github.com/django-crispy-forms/django-crispy-forms/commit/6b93e8a362422db8fe54aa731319c7cbc39990ba) render_unmentioned_fields foi adicionado uma condição em que a cada instância do Helper, fosse decidido se os fields não mencionados serião ou não renderizados... O Sapl até este commit: https://github.com/interlegis/sapl/commit/22b87f36ebc8659a6ecaf8831ab0f425206b0993 utilizou o django-crispy-forms na versão 1.6.1, ou seja, sem a condição render_unmentioned_fields o que fazia o FormHelper, na 1.6.1 set comportar como se, agora, na 1.7.2 o default fosse True. Como todos os Forms do Sapl foram construídos assumindo que fields não incluídos explicitamente no Helper, o helper o incluiria implicitamente, e assim o era, de acordo com commit acima do django-crispy-forms, então cria-se essa classe: class SaplFormHelper(FormHelper): render_unmentioned_fields = True onde torna o default, antes False, agora = True, o esperado pelos forms do sapl, e substituí-se todos os FormHelper por SaplFormHelper dentro do projeto Sapl esta explicação ficará aqui dentro do código, via commit, e na issue #2456. --- sapl/audiencia/forms.py | 4 +-- sapl/base/forms.py | 38 ++++++++++++------------- sapl/compilacao/forms.py | 30 +++++++++---------- sapl/crispy_layout_mixin.py | 57 +++++++++++++++++++++++++++++++++++-- sapl/crud/base.py | 4 +-- sapl/materia/forms.py | 38 ++++++++++++------------- sapl/materia/views.py | 4 +-- sapl/norma/forms.py | 8 +++--- sapl/parlamentares/forms.py | 4 +-- sapl/protocoloadm/forms.py | 24 ++++++++-------- sapl/sessao/forms.py | 14 ++++----- sapl/utils.py | 4 +-- 12 files changed, 141 insertions(+), 88 deletions(-) diff --git a/sapl/audiencia/forms.py b/sapl/audiencia/forms.py index ab2f2a6e7..2912ab58d 100755 --- a/sapl/audiencia/forms.py +++ b/sapl/audiencia/forms.py @@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _ from sapl.audiencia.models import AudienciaPublica, TipoAudienciaPublica, AnexoAudienciaPublica from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.utils import timezone @@ -134,7 +134,7 @@ class AnexoAudienciaPublicaForm(forms.ModelForm): row2 = to_row( [('assunto', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Identificação Básica'), row1, row2)) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index d97ed1804..2e54f82be 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -1,7 +1,7 @@ import logging from crispy_forms.bootstrap import FieldWithButtons, InlineRadios, StrictButton -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import HTML, Button, Div, Field, Fieldset, Layout, Row from django import forms from django.conf import settings @@ -114,7 +114,7 @@ class UsuarioCreateForm(ModelForm): row4 = to_row([(form_actions(label='Confirmar'), 6)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( row0, row1, @@ -154,7 +154,7 @@ class UsuarioEditForm(ModelForm): row3 = to_row([(form_actions(label='Salvar Alterações'), 6)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( row1, row2, @@ -432,7 +432,7 @@ class AutorForm(ModelForm): controle_acesso = Fieldset(_('Controle de Acesso do Autor'), *controle_acesso) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout(autor_select, controle_acesso) super(AutorForm, self).__init__(*args, **kwargs) @@ -697,7 +697,7 @@ class RelatorioAtasFilterSet(django_filters.FilterSet): row1 = to_row([('data_inicio', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Atas das Sessões Plenárias'), @@ -733,7 +733,7 @@ class RelatorioNormasMesFilterSet(django_filters.FilterSet): row1 = to_row([('ano', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Normas por mês do ano.'), @@ -762,7 +762,7 @@ class EstatisticasAcessoNormasForm(Form): row1 = to_row([('ano', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.form_method = 'GET' self.helper.layout = Layout( Fieldset(_('Normas por acessos nos meses do ano.'), @@ -800,7 +800,7 @@ class RelatorioNormasVigenciaFilterSet(django_filters.FilterSet): row1 = to_row([('ano', 12)]) row2 = to_row([('vigencia', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Normas por vigência.'), @@ -828,7 +828,7 @@ class RelatorioPresencaSessaoFilterSet(django_filters.FilterSet): row1 = to_row([('data_inicio', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Presença dos parlamentares nas sessões plenárias'), @@ -868,7 +868,7 @@ class RelatorioHistoricoTramitacaoFilterSet(django_filters.FilterSet): ('tramitacao__unidade_tramitacao_local', 4), ('tramitacao__status', 4)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Histórico de Tramitação'), @@ -901,7 +901,7 @@ class RelatorioDataFimPrazoTramitacaoFilterSet(django_filters.FilterSet): ('tramitacao__unidade_tramitacao_local', 4), ('tramitacao__status', 4)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Tramitações por fim de prazo'), @@ -932,7 +932,7 @@ class RelatorioReuniaoFilterSet(django_filters.FilterSet): ('nome', 4), ('tema', 4)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Reunião de Comissão'), @@ -962,7 +962,7 @@ class RelatorioAudienciaFilterSet(django_filters.FilterSet): [('tipo', 4), ('nome', 4)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Audiência Pública'), @@ -1006,7 +1006,7 @@ class RelatorioMateriasTramitacaoilterSet(django_filters.FilterSet): row3 = to_row([('tramitacao__unidade_tramitacao_destino', 12)]) row4 = to_row([('tramitacao__status', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Matéria em Tramitação'), @@ -1032,7 +1032,7 @@ class RelatorioMateriasPorAnoAutorTipoFilterSet(django_filters.FilterSet): row1 = to_row( [('ano', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisar'), @@ -1074,7 +1074,7 @@ class RelatorioMateriasPorAutorFilterSet(django_filters.FilterSet): 'limpar Autor', css_class='btn btn-primary btn-sm'), 10)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisar'), @@ -1196,7 +1196,7 @@ class RecuperarSenhaForm(PasswordResetForm): def __init__(self, *args, **kwargs): row1 = to_row( [('email', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Insira o e-mail cadastrado com a sua conta'), row1, @@ -1233,7 +1233,7 @@ class NovaSenhaForm(SetPasswordForm): [('new_password1', 6), ('new_password2', 6)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( row1, form_actions(label='Enviar')) @@ -1266,7 +1266,7 @@ class AlterarSenhaForm(Form): [('new_password1', 6), ('new_password2', 6)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( row1, row2, diff --git a/sapl/compilacao/forms.py b/sapl/compilacao/forms.py index 0e4f933d7..71d6ad7e5 100644 --- a/sapl/compilacao/forms.py +++ b/sapl/compilacao/forms.py @@ -3,7 +3,7 @@ from datetime import timedelta from crispy_forms.bootstrap import (Alert, FieldWithButtons, FormActions, InlineCheckboxes, InlineRadios, StrictButton) -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset, Layout, Row, Submit) from django import forms @@ -84,7 +84,7 @@ class TipoTaForm(ModelForm): ('perfis', 12), ]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Identificação Básica'), row1, css_class="col-md-12"), @@ -153,7 +153,7 @@ class TaForm(ModelForm): ('participacao_social', 3), ]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Identificação Básica'), row1, css_class="col-md-12"), Fieldset( @@ -268,7 +268,7 @@ class NotaForm(ModelForm): css_class='form-group row justify-content-between mr-1 ml-1' ) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Div( @@ -363,7 +363,7 @@ class VideForm(ModelForm): 'texto', placeholder=_('Texto Adicional ao Vide')), 12))))) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Div( Div(HTML(_('Vides')), css_class='card-header bg-light'), @@ -471,7 +471,7 @@ class PublicacaoForm(ModelForm): ('url_externa', 8), ]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(Publicacao._meta.verbose_name, row1, row2, row3, css_class="col-md-12")) @@ -659,7 +659,7 @@ class DispositivoEdicaoBasicaForm(ModelForm): for f in fields: self.base_fields.update({f: getattr(self, f)}) - self.helper = FormHelper() + self.helper = SaplFormHelper() if not editor_type: cancel_label = _('Ir para o Editor Sequencial') @@ -790,7 +790,7 @@ class DispositivoSearchModalForm(Form): ) ) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( fields_search, Row(to_column((Div(css_class='result-busca-dispositivo'), 12)))) @@ -903,7 +903,7 @@ class DispositivoEdicaoVigenciaForm(ModelForm): row_vigencia, css_class="col-md-12")) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( *layout, cancel_label=_('Ir para o Editor Sequencial')) @@ -1023,7 +1023,7 @@ class DispositivoDefinidorVigenciaForm(Form): row_vigencia, css_class="col-md-12")) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( *layout, cancel_label=_('Ir para o Editor Sequencial')) @@ -1162,7 +1162,7 @@ class DispositivoEdicaoAlteracaoForm(ModelForm): if hasattr(self, f): self.base_fields.update({f: getattr(self, f)}) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( *layout, cancel_label=_('Ir para o Editor Sequencial')) @@ -1328,7 +1328,7 @@ class TextNotificacoesForm(Form): (Submit('submit-form', _('Filtrar'), css_class='btn btn-primary float-right'), 2)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout(field_type_notificacoes) super(TextNotificacoesForm, self).__init__(*args, **kwargs) @@ -1374,7 +1374,7 @@ class DispositivoRegistroAlteracaoForm(Form): _fields = [Div(*layout, css_class="row")] + \ [to_row([(buttons, 12)])] - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout(*_fields) super(DispositivoRegistroAlteracaoForm, self).__init__(*args, **kwargs) @@ -1431,7 +1431,7 @@ class DispositivoRegistroRevogacaoForm(Form): _fields = [Div(*layout, css_class="row")] + \ [to_row([(buttons, 12)])] - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout(*_fields) super(DispositivoRegistroRevogacaoForm, self).__init__(*args, **kwargs) @@ -1481,7 +1481,7 @@ class DispositivoRegistroInclusaoForm(Form): _fields = [Div(*layout, css_class="row")] + \ [to_row([(buttons, 12)])] - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout(*_fields) super(DispositivoRegistroInclusaoForm, self).__init__(*args, **kwargs) diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index 245be6b82..8631df0f4 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -52,6 +52,35 @@ def form_actions(more=[Div(css_class='clearfix')], ) +class SaplFormHelper(FormHelper): + render_unmentioned_fields = True # default = False + """ + até a release 1.6.1 do django-crispy-forms, os fields em Meta.Fields eram + renderizados mesmo se não mencionados no helper. + Com esta mudança (https://github.com/django-crispy-forms/django-crispy-forms/commit/6b93e8a362422db8fe54aa731319c7cbc39990ba) + render_unmentioned_fields foi adicionado uma condição em que a cada + instância do Helper, fosse decidido se os fields não mencionados serião ou + não renderizados... + O Sapl até este commit: https://github.com/interlegis/sapl/commit/22b87f36ebc8659a6ecaf8831ab0f425206b0993 + utilizou o django-crispy-forms na versão 1.6.1, ou seja, + sem a condição render_unmentioned_fields o que fazia o FormHelper, na 1.6.1 + set comportar como se, agora, na 1.7.2 o default fosse True. + Como todos os Forms do Sapl foram construídos assumindo que fields + não incluídos explicitamente no Helper, o helper o incluiria implicitamente, + e assim o era, de acordo com commit acima do django-crispy-forms, então + cria-se essa classe: + + class SaplFormHelper(FormHelper): + render_unmentioned_fields = True + + onde torna o default, antes False, agora = True, o esperado pelos forms do sapl, + e substituí-se todos os FormHelper por SaplFormHelper dentro do projeto Sapl + + + esta explicação ficará aqui dentro do código, via commit, e na issue #2456. + """ + + class SaplFormLayout(Layout): def __init__(self, *fields, cancel_label=_('Cancelar'), @@ -188,10 +217,34 @@ class CrispyLayoutFormMixin: pass else: if self.layout_key: - form.helper = FormHelper() - form.helper.layout = SaplFormLayout(*self.get_layout()) + form.helper = SaplFormHelper() + layout = self.get_layout() + + """if hasattr(form, '_meta') and \ + hasattr(form._meta, 'fields') and \ + form._meta.fields is not None: + self.validate_layout(form, layout)""" + + form.helper.layout = SaplFormLayout(*layout) + return form + """def validate_layout(self, form, layout): + fields = set() + for fieldset in layout: + for el in fieldset: + if isinstance(el, str): + continue + for field, size in el: + fields.add(field) + + intersection = set(form._meta.fields) - fields + + if intersection: + raise Exception(_('Os campos {} não aparecem na definição de layout' + ' da interface do usuário').format(intersection)) + """ + @property def list_field_names(self): '''The list of field names to display on table diff --git a/sapl/crud/base.py b/sapl/crud/base.py index ca5469bf0..5fa4f70e5 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -2,7 +2,7 @@ import logging from braces.views import FormMessagesMixin from crispy_forms.bootstrap import FieldWithButtons, StrictButton -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import Field, Layout from django import forms from django.conf.urls import url @@ -150,7 +150,7 @@ class ListWithSearchForm(forms.Form): def __init__(self, *args, **kwargs): super(ListWithSearchForm, self).__init__(*args, **kwargs) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.form_class = 'form-inline' self.helper.form_method = 'GET' self.helper.layout = Layout( diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 2a95a47ba..e67d71fb7 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -3,7 +3,7 @@ import logging import os from crispy_forms.bootstrap import Alert, InlineRadios -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset, Layout, Row) from django import forms @@ -76,7 +76,7 @@ class AdicionarVariasAutoriasFilterSet(django_filters.FilterSet): row1 = to_row([('nome', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Filtrar Autores'), @@ -112,7 +112,7 @@ class ReceberProposicaoForm(Form): def __init__(self, *args, **kwargs): row1 = to_row([('cod_hash', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( _('Incorporar Proposição'), row1, @@ -145,7 +145,7 @@ class MateriaSimplificadaForm(ModelForm): row4 = to_row([('ementa', 12)]) row5 = to_row([('texto_original', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( _('Formulário Simplificado'), @@ -346,7 +346,7 @@ class AcompanhamentoMateriaForm(ModelForm): Column(form_actions(label='Cadastrar'), css_class='col-md-2') ) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( _('Acompanhamento de Matéria por e-mail'), row1 @@ -896,7 +896,7 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): ('tipo_listagem', 4) ]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa Básica'), @@ -1016,7 +1016,7 @@ class AutoriaForm(ModelForm): ('autor', 4), ('primeiro_autor', 4)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Autoria'), row1, 'data_relativa', form_actions(label='Salvar'))) @@ -1077,7 +1077,7 @@ class AutoriaMultiCreateForm(Form): row2 = to_row([('autor', 12), ]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( _('Autorias'), row1, row2, 'data_relativa', 'autores', @@ -1117,7 +1117,7 @@ class AcessorioEmLoteFilterSet(django_filters.FilterSet): row1 = to_row([('tipo', 12)]) row2 = to_row([('data_apresentacao', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Documentos Acessórios em Lote'), @@ -1142,7 +1142,7 @@ class PrimeiraTramitacaoEmLoteFilterSet(django_filters.FilterSet): row1 = to_row([('tipo', 12)]) row2 = to_row([('data_apresentacao', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Primeira Tramitação'), @@ -1177,7 +1177,7 @@ class TramitacaoEmLoteFilterSet(django_filters.FilterSet): ('tramitacao__status', 4)]) row2 = to_row([('data_apresentacao', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Tramitação em Lote'), @@ -1241,7 +1241,7 @@ class TipoProposicaoForm(ModelForm): ) ) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout(tipo_select) super(TipoProposicaoForm, self).__init__(*args, **kwargs) @@ -1431,7 +1431,7 @@ class ProposicaoForm(forms.ModelForm): ('ano_materia', 6)]), ), 12)), ) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout(*fields) super(ProposicaoForm, self).__init__(*args, **kwargs) @@ -1579,7 +1579,7 @@ class DevolverProposicaoForm(forms.ModelForm): ) ) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout(*fields) def clean(self): @@ -1762,7 +1762,7 @@ class ConfirmarProposicaoForm(ProposicaoForm): fields.append( Fieldset(_('Registro de Incorporação'), Row(*itens_incorporacao))) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout(*fields) self.fields['tipo_readonly'].initial = self.instance.tipo.descricao @@ -2118,7 +2118,7 @@ class EtiquetaPesquisaForm(forms.Form): [('processo_inicial', 6), ('processo_final', 6)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( ('Formulário de Etiqueta'), @@ -2203,7 +2203,7 @@ class FichaPesquisaForm(forms.Form): ('data_inicial', 3), ('data_final', 3)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( ('Formulário de Ficha'), @@ -2244,7 +2244,7 @@ class FichaSelecionaForm(forms.Form): row1 = to_row( [('materia', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( ('Selecione a ficha que deseja imprimir'), @@ -2314,7 +2314,7 @@ class ExcluirTramitacaoEmLote(forms.Form): [('unidade_tramitacao_local', 6), ('unidade_tramitacao_destino', 6)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Dados das Tramitações'), row1, diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 505f04758..37d177156 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -3,7 +3,7 @@ import logging from random import choice from string import ascii_letters, digits -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import HTML from django.conf import settings from django.contrib import messages @@ -1350,7 +1350,7 @@ class TramitacaoCrud(MasterDetailCrud): def montar_helper_documento_acessorio(self): autor_row = montar_row_autor('autor') - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout(*self.get_layout()) # Adiciona o novo campo 'autor' e mecanismo de busca diff --git a/sapl/norma/forms.py b/sapl/norma/forms.py index bf676c242..e4423c956 100644 --- a/sapl/norma/forms.py +++ b/sapl/norma/forms.py @@ -1,7 +1,7 @@ import logging -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import Fieldset, Layout from django import forms from django.core.exceptions import ObjectDoesNotExist, ValidationError @@ -71,7 +71,7 @@ class NormaFilterSet(django_filters.FilterSet): row4 = to_row([('data_vigencia', 12)]) row5 = to_row([('o', 6), ('indexacao', 6)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Norma'), @@ -238,7 +238,7 @@ class AutoriaNormaForm(ModelForm): ('autor', 4), ('primeiro_autor', 4)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Autoria'), row1, 'data_relativa', form_actions(label='Salvar'))) @@ -400,7 +400,7 @@ class NormaPesquisaSimplesForm(forms.Form): row2 = to_row( [('titulo', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( ('Índice de Normas'), diff --git a/sapl/parlamentares/forms.py b/sapl/parlamentares/forms.py index 0c0f8887d..9c694d3e9 100755 --- a/sapl/parlamentares/forms.py +++ b/sapl/parlamentares/forms.py @@ -1,7 +1,7 @@ from datetime import timedelta import logging -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import Fieldset, Layout from django import forms from django.contrib.auth import get_user_model @@ -446,7 +446,7 @@ class VotanteForm(ModelForm): def __init__(self, *args, **kwargs): row1 = to_row([('username', 4)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Votante'), row1, form_actions(label='Salvar')) diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index d650c7de1..d358a9d8c 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -2,7 +2,7 @@ import logging from crispy_forms.bootstrap import InlineRadios, Alert -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout, Div from django import forms from django.core.exceptions import (MultipleObjectsReturned, @@ -57,7 +57,7 @@ class AcompanhamentoDocumentoForm(ModelForm): Column(form_actions(label='Cadastrar'), css_class='col-md-2') ) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( _('Acompanhamento de Documento por e-mail'), row1 @@ -136,7 +136,7 @@ class ProtocoloFilterSet(django_filters.FilterSet): row5 = to_row( [('tipo_processo', 6), ('o', 6)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisar Protocolo'), @@ -212,7 +212,7 @@ class DocumentoAdministrativoFilterSet(django_filters.FilterSet): ('tramitacaoadministrativo__unidade_tramitacao_destino', 5), ]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisar Documento'), @@ -305,7 +305,7 @@ class AnularProcoloAdmForm(ModelForm): row2 = to_row( [('justificativa_anulacao', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação do Protocolo'), row1, @@ -404,7 +404,7 @@ class ProtocoloDocumentForm(ModelForm): row7 = to_row( [('numero', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação de Documento'), row1, @@ -583,7 +583,7 @@ class ProtocoloMateriaForm(ModelForm): row6 = to_row( [('numero', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação da Matéria'), row1, @@ -910,7 +910,7 @@ class DocumentoAdministrativoForm(ModelForm): row7 = to_row( [('observacao', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Identificação Básica'), row1, row2, row3, row4, row5), @@ -978,7 +978,7 @@ class DesvincularDocumentoForm(ModelForm): ('ano', 4), ('tipo', 4)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação do Documento'), row1, @@ -1043,7 +1043,7 @@ class DesvincularMateriaForm(forms.Form): ('ano', 4), ('tipo', 4)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação da Matéria'), row1, @@ -1111,7 +1111,7 @@ class FichaPesquisaAdmForm(forms.Form): ('data_inicial', 3), ('data_final', 3)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( ('Formulário de Ficha'), @@ -1152,7 +1152,7 @@ class FichaSelecionaAdmForm(forms.Form): row1 = to_row( [('documento', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset( ('Selecione a ficha que deseja imprimir'), diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index 2b8ec4742..b576545d2 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -1,6 +1,6 @@ from datetime import datetime -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import HTML, Button, Fieldset, Layout from django import forms from django.contrib.contenttypes.models import ContentType @@ -207,7 +207,7 @@ class RetiradaPautaForm(ModelForm): ('expediente', 6)]) row3 = to_row([('observacao', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Retirada de Pauta'), row1, row2, row3)) @@ -591,7 +591,7 @@ class SessaoPlenariaFilterSet(django_filters.FilterSet): ('data_inicio__day', 3), ('tipo', 3)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(self.titulo, @@ -664,7 +664,7 @@ class AdicionarVariasMateriasFilterSet(MateriaLegislativaFilterSet): row9 = to_row( [('ementa', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Matéria'), @@ -787,7 +787,7 @@ class ResumoOrdenacaoForm(forms.Form): row11 = to_row( [('decimo_primeiro', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_(''), row1, row2, row3, row4, row5, @@ -853,7 +853,7 @@ class JustificativaAusenciaForm(ModelForm): row8 = to_row( [('observacao', 12)]) - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Justificativa de Ausência'), row1, row2, row3, @@ -981,7 +981,7 @@ class VotacaoEmBlocoFilterSet(MateriaLegislativaFilterSet): row9 = to_row( [('ementa', 12)]) - self.form.helper = FormHelper() + self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Matéria'), diff --git a/sapl/utils.py b/sapl/utils.py index 56a61d06d..16652698e 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -6,7 +6,7 @@ import re from unicodedata import normalize as unicodedata_normalize import unicodedata -from crispy_forms.helper import FormHelper +from sapl.crispy_layout_mixin import SaplFormHelper from crispy_forms.layout import HTML, Button from django import forms from django.apps import apps @@ -111,7 +111,7 @@ def montar_row_autor(name): def montar_helper_autor(self): autor_row = montar_row_autor('nome') - self.helper = FormHelper() + self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout(*self.get_layout()) # Adiciona o novo campo 'autor' e mecanismo de busca From e48398ce9ca112c8fca146ca2aa461c4a93b209a Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Wed, 13 Feb 2019 22:47:19 -0200 Subject: [PATCH 03/27] =?UTF-8?q?retira=20c=C3=B3digo=20desnecess=C3=A1rio?= =?UTF-8?q?=20de=20verifica=C3=A7=C3=A3o=20de=20fields=20de=20formul=C3=A1?= =?UTF-8?q?rios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/crispy_layout_mixin.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index 8631df0f4..11f2c0000 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -220,31 +220,10 @@ class CrispyLayoutFormMixin: form.helper = SaplFormHelper() layout = self.get_layout() - """if hasattr(form, '_meta') and \ - hasattr(form._meta, 'fields') and \ - form._meta.fields is not None: - self.validate_layout(form, layout)""" - form.helper.layout = SaplFormLayout(*layout) return form - """def validate_layout(self, form, layout): - fields = set() - for fieldset in layout: - for el in fieldset: - if isinstance(el, str): - continue - for field, size in el: - fields.add(field) - - intersection = set(form._meta.fields) - fields - - if intersection: - raise Exception(_('Os campos {} não aparecem na definição de layout' - ' da interface do usuário').format(intersection)) - """ - @property def list_field_names(self): '''The list of field names to display on table From 10bf34bf9a0344ba43be7603a18ab15f1c0c2fd9 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Thu, 14 Feb 2019 09:09:18 -0200 Subject: [PATCH 04/27] ajusta SaplFormHelper --- sapl/crispy_layout_mixin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index 11f2c0000..c76bc0f65 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -53,17 +53,17 @@ def form_actions(more=[Div(css_class='clearfix')], class SaplFormHelper(FormHelper): - render_unmentioned_fields = True # default = False + render_hidden_fields = True # default = False """ até a release 1.6.1 do django-crispy-forms, os fields em Meta.Fields eram renderizados mesmo se não mencionados no helper. Com esta mudança (https://github.com/django-crispy-forms/django-crispy-forms/commit/6b93e8a362422db8fe54aa731319c7cbc39990ba) - render_unmentioned_fields foi adicionado uma condição em que a cada + render_hidden_fields foi adicionado uma condição em que a cada instância do Helper, fosse decidido se os fields não mencionados serião ou não renderizados... O Sapl até este commit: https://github.com/interlegis/sapl/commit/22b87f36ebc8659a6ecaf8831ab0f425206b0993 utilizou o django-crispy-forms na versão 1.6.1, ou seja, - sem a condição render_unmentioned_fields o que fazia o FormHelper, na 1.6.1 + sem a condição render_hidden_fields o que fazia o FormHelper, na 1.6.1 set comportar como se, agora, na 1.7.2 o default fosse True. Como todos os Forms do Sapl foram construídos assumindo que fields não incluídos explicitamente no Helper, o helper o incluiria implicitamente, From 3b3e2ef642cd692365892abdcfee8bb56da497a1 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Thu, 14 Feb 2019 09:17:59 -0200 Subject: [PATCH 05/27] =?UTF-8?q?altera=20coment=C3=A1rio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/crispy_layout_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index c76bc0f65..200f24db1 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -71,7 +71,7 @@ class SaplFormHelper(FormHelper): cria-se essa classe: class SaplFormHelper(FormHelper): - render_unmentioned_fields = True + render_hidden_fields = True onde torna o default, antes False, agora = True, o esperado pelos forms do sapl, e substituí-se todos os FormHelper por SaplFormHelper dentro do projeto Sapl From 0d15d77acd5be0c03ad6a75103032a57a3660771 Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Thu, 14 Feb 2019 10:33:05 -0200 Subject: [PATCH 06/27] =?UTF-8?q?HOTFIX=20-=20Corre=C3=A7=C3=A3o=20da=20vo?= =?UTF-8?q?ta=C3=A7=C3=A3o=20em=20bloco=20quando=20n=C3=A3o=20h=C3=A1=20pr?= =?UTF-8?q?esen=C3=A7a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/sessao/views.py | 6 +- .../sessao/votacao/votacao_nominal_bloco.html | 156 ++++++++++-------- .../votacao/votacao_simbolica_bloco.html | 131 ++++++++------- 3 files changed, 161 insertions(+), 132 deletions(-) diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 096130162..e5f98c03c 100755 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -3335,9 +3335,10 @@ class VotacaoEmBlocoSimbolicaView(PermissionRequiredForAppCrudMixin, TemplateVie if not 'context' in locals(): context = {'pk': self.kwargs['pk'], 'root_pk': self.kwargs['pk'], - 'title': SessaoPlenaria.objects.get(id=self.kwargs['pk']) + 'title': SessaoPlenaria.objects.get(id=self.kwargs['pk']), + 'origem': request.POST['origem'] } - + if 'marcadas_1' in request.POST: context.update({'resultado_votacao': TipoResultadoVotacao.objects.all(), @@ -3514,6 +3515,7 @@ class VotacaoEmBlocoNominalView(PermissionRequiredForAppCrudMixin, TemplateView) context = {'pk': self.kwargs['pk'], 'root_pk': self.kwargs['pk'], 'title': SessaoPlenaria.objects.get(id=self.kwargs['pk']), + 'origem': request.POST['origem'], 'subnav_template_name': 'sessao/subnav.yaml'} if 'marcadas_2' in request.POST: diff --git a/sapl/templates/sessao/votacao/votacao_nominal_bloco.html b/sapl/templates/sessao/votacao/votacao_nominal_bloco.html index 9234da02a..5d083716f 100644 --- a/sapl/templates/sessao/votacao/votacao_nominal_bloco.html +++ b/sapl/templates/sessao/votacao/votacao_nominal_bloco.html @@ -7,88 +7,102 @@
Votação Nominal - {% if ordens %} - {% for o in ordens %} - -
- Matéria: {{o.materia}} -
- Ementa: {{o.materia.ementa|safe}} -
-
- {% endfor %} - {% else %} - {% for e in expedientes %} - -
- Matéria: {{e.materia}} -
- Ementa: {{e.materia.ementa|safe}} + {% if ordens or expedientes %} + {% if total_presentes == 0 %} + -
- {% endfor %} - {% endif %} - {% if total_presentes == 0 %} - - Voltar - {% else %} - -
- - {% if parlamentares %} - Votos -
- {% for parlamentar in parlamentares %} -
{{parlamentar.0.nome_parlamentar}}
-
- {% if parlamentar.1 %} {% endif %} - + {% if origem == 'ordem' %} + Voltar + {% elif origem == 'expediente' %} + Voltar + {% endif %} + {% else %} + {% if ordens %} + {% for o in ordens %} + +
+ Matéria: {{o.materia}} +
+ Ementa: {{o.materia.ementa|safe}}
- {% endfor %} -
+
+ {% endfor %} + {% elif expedientes %} + {% for e in expedientes %} + +
+ Matéria: {{e.materia}} +
+ Ementa: {{e.materia.ementa|safe}} +
+
+ {% endfor %} {% endif %} -
- Situação da Votação: +
+ + {% if parlamentares %} + Votos +
+ {% for parlamentar in parlamentares %} +
{{parlamentar.0.nome_parlamentar}}
+
+ {% if parlamentar.1 %} {% endif %} + +
+ {% endfor %} +
+ {% endif %} +
+ Situação da Votação: -
- - - - +
+ + + + -
+
-
-
- Resultado da Votação - +
+
+ Resultado da Votação + +
-
-
-
-
- Observações
- +
+
+
+ Observações
+ +
-
- + -

- - +

+ + + {% endif %} + {% else %} + + {% if origem == 'ordem' %} + Voltar + {% elif origem == 'expediente' %} + Voltar + {% endif %} {% endif %}
diff --git a/sapl/templates/sessao/votacao/votacao_simbolica_bloco.html b/sapl/templates/sessao/votacao/votacao_simbolica_bloco.html index 4a3bafe5a..580fc2c6f 100644 --- a/sapl/templates/sessao/votacao/votacao_simbolica_bloco.html +++ b/sapl/templates/sessao/votacao/votacao_simbolica_bloco.html @@ -7,74 +7,87 @@
Votação Simbólica - -
- {% if ordens %} - {% for o in ordens %} - - Matéria: {{o.materia|safe}} -
- Ementa: {{o.materia.ementa|safe}} -

- {% endfor %} + {% if ordens or expedientes %} + {% if total_presentes == 0 %} + + {% if origem == 'ordem' %} + Voltar + {% elif origem == 'expediente' %} + Voltar + {% endif %} {% else %} - {% for e in expedientes %} - - Matéria: {{e.materia|safe}} -
- Ementa: {{e.materia.ementa|safe}} -

- {% endfor %} - {% endif %} - Total presentes: {{total_presentes}} (com presidente) - -
-
- {% if total_presentes == 0 %} - - Voltar - {% else %} - -
-
Sim:
-
Não:
-
Abstenções:
-
- -
-
- A totalização inclui o voto do Presidente? - + {% if ordens %} + {% for o in ordens %} + + Matéria: {{o.materia|safe}} +
+ Ementa: {{o.materia.ementa|safe}} +

+ {% endfor %} + {% else %} + {% for e in expedientes %} + + Matéria: {{e.materia|safe}} +
+ Ementa: {{e.materia.ementa|safe}} +

+ {% endfor %} + {% endif %} + Total presentes: {{total_presentes}} (com presidente) +
+
-
- Resultado da Votação - +
+
Sim:
+
Não:
+
Abstenções:
-
-
-
- Observações - +
+
+ A totalização inclui o voto do Presidente? + +
+ +
+ Resultado da Votação + +
-
- +
+
+ Observações + +
+
-

- - +

+ + + {% endif %} + {% else %} + + {% if origem == 'ordem' %} + Voltar + {% elif origem == 'expediente' %} + Voltar + {% endif %} {% endif %} + +
{% endblock detail_content %} From f2bdf53139a7ef077689fc64765ecd2f969e2793 Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Thu, 14 Feb 2019 10:44:14 -0200 Subject: [PATCH 07/27] =?UTF-8?q?Corre=C3=A7=C3=A3o=20do=20template=20da?= =?UTF-8?q?=20presenca=20quando=20n=C3=A3o=20h=C3=A1=20partido?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/templates/sessao/presenca.html | 6 +++--- sapl/templates/sessao/presenca_ordemdia.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sapl/templates/sessao/presenca.html b/sapl/templates/sessao/presenca.html index ff7bdaed1..21f270481 100644 --- a/sapl/templates/sessao/presenca.html +++ b/sapl/templates/sessao/presenca.html @@ -32,7 +32,7 @@ {% else %} @@ -40,7 +40,7 @@ {% endif %} @@ -63,7 +63,7 @@ {% if check %}
-
diff --git a/sapl/templates/sessao/presenca_ordemdia.html b/sapl/templates/sessao/presenca_ordemdia.html index a15501eaf..ddbcbda72 100644 --- a/sapl/templates/sessao/presenca_ordemdia.html +++ b/sapl/templates/sessao/presenca_ordemdia.html @@ -37,7 +37,7 @@ {% else %} @@ -45,7 +45,7 @@ {% endif %} @@ -67,7 +67,7 @@ {% for parlamentar, check in view.get_presencas_ordem %} {% if check %}
-
+
{% endif %} {% endfor %} From 387913b0d15f7bdfa6ac86ac6afffc61785ea6cd Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Thu, 14 Feb 2019 10:55:52 -0200 Subject: [PATCH 08/27] =?UTF-8?q?Correcao=20no=20template=20de=20Resumo=20?= =?UTF-8?q?quando=20o=20parlamentar=20n=C3=A3o=20tem=20partido?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/templates/sessao/blocos_resumo/lista_presenca.html | 2 +- .../sessao/blocos_resumo/lista_presenca_ordem_dia.html | 2 +- sapl/templates/sessao/blocos_resumo/mesa_diretora.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sapl/templates/sessao/blocos_resumo/lista_presenca.html b/sapl/templates/sessao/blocos_resumo/lista_presenca.html index 8f5ac10e2..474d3f5d8 100644 --- a/sapl/templates/sessao/blocos_resumo/lista_presenca.html +++ b/sapl/templates/sessao/blocos_resumo/lista_presenca.html @@ -4,7 +4,7 @@ Lista de Presença na Sessão
{% for p in presenca_sessao %} -
{{p.nome_parlamentar}} / {{ p|filiacao_data_filter:object.data_inicio }}
+
{{p.nome_parlamentar}} / {% if p|filiacao_data_filter:object.data_inicio %} {{ p|filiacao_data_filter:object.data_inicio }} {% else %} Sem partido {% endif %}
{% endfor %}



diff --git a/sapl/templates/sessao/blocos_resumo/lista_presenca_ordem_dia.html b/sapl/templates/sessao/blocos_resumo/lista_presenca_ordem_dia.html index ea58e160e..b3074c0ea 100644 --- a/sapl/templates/sessao/blocos_resumo/lista_presenca_ordem_dia.html +++ b/sapl/templates/sessao/blocos_resumo/lista_presenca_ordem_dia.html @@ -4,7 +4,7 @@ Lista de Presença na Ordem do Dia
{% for p in presenca_ordem %} -
{{p.nome_parlamentar}} / {{ p|filiacao_data_filter:object.data_inicio }}
+
{{p.nome_parlamentar}} / {% if p|filiacao_data_filter:object.data_inicio %} {{ p|filiacao_data_filter:object.data_inicio }} {% else %} Sem partido {% endif %}
{% endfor %}
\ No newline at end of file diff --git a/sapl/templates/sessao/blocos_resumo/mesa_diretora.html b/sapl/templates/sessao/blocos_resumo/mesa_diretora.html index 7baf0cb67..d8340c477 100644 --- a/sapl/templates/sessao/blocos_resumo/mesa_diretora.html +++ b/sapl/templates/sessao/blocos_resumo/mesa_diretora.html @@ -3,7 +3,7 @@
{% for m in mesa %}
{{m.cargo}}: - {{m.parlamentar.nome_parlamentar}} / {{ m.parlamentar.filiacao_atual }} + {{m.parlamentar.nome_parlamentar}} / {% if m.parlamentar.filiacao_atual %} {{ m.parlamentar.filiacao_atual }} {% else %} Sem partido {% endif %}
{% endfor %}
From 17c8f37cce3e07ec7b5ce798c5788eec09fa4535 Mon Sep 17 00:00:00 2001 From: Gabriel R F Date: Thu, 14 Feb 2019 11:03:26 -0200 Subject: [PATCH 09/27] Fix typo Retidara (#2495) --- sapl/sessao/migrations/0028_auto_20181031_0902.py | 2 +- sapl/sessao/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sapl/sessao/migrations/0028_auto_20181031_0902.py b/sapl/sessao/migrations/0028_auto_20181031_0902.py index 3ff3c0dc5..c08a01640 100644 --- a/sapl/sessao/migrations/0028_auto_20181031_0902.py +++ b/sapl/sessao/migrations/0028_auto_20181031_0902.py @@ -38,7 +38,7 @@ class Migration(migrations.Migration): ], options={ 'verbose_name_plural': 'Tipos de Retirada de Pauta', - 'verbose_name': 'Tipo de Retidara de Pauta', + 'verbose_name': 'Tipo de Retirada de Pauta', 'ordering': ['descricao'], }, ), diff --git a/sapl/sessao/models.py b/sapl/sessao/models.py index 8cc162a05..05cef9802 100644 --- a/sapl/sessao/models.py +++ b/sapl/sessao/models.py @@ -590,7 +590,7 @@ class TipoRetiradaPauta(models.Model): descricao = models.CharField(max_length=150, verbose_name=_('Descrição')) class Meta: - verbose_name = _('Tipo de Retidara de Pauta') + verbose_name = _('Tipo de Retirada de Pauta') verbose_name_plural = _('Tipos de Retirada de Pauta') ordering = ['descricao'] From 56310609f43243bd60ee67ae03ac4b68234cd677 Mon Sep 17 00:00:00 2001 From: Edward Date: Thu, 14 Feb 2019 13:08:46 -0200 Subject: [PATCH 10/27] Fixes #35 (#2465) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vinícius Cantuária --- Dockerfile | 3 +- requirements/requirements.txt | 2 + sapl/lexml/OAIServer.py | 285 ++++++++++++++++++++++++++++++++++ sapl/lexml/urls.py | 3 +- sapl/lexml/views.py | 12 ++ 5 files changed, 303 insertions(+), 2 deletions(-) create mode 100644 sapl/lexml/OAIServer.py diff --git a/Dockerfile b/Dockerfile index 8c2dc0fb5..584370e50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,8 @@ RUN rm -rf /var/interlegis/sapl/sapl/.env && \ RUN chmod +x /var/interlegis/sapl/start.sh && \ ln -sf /dev/stdout /var/log/nginx/access.log && \ ln -sf /dev/stderr /var/log/nginx/error.log && \ - mkdir /var/log/sapl/ + mkdir /var/log/sapl/ && touch /var/log/sapl/sapl.log && \ + ln -s /var/interlegis/sapl/sapl.log /var/log/sapl/sapl.log VOLUME ["/var/interlegis/sapl/data", "/var/interlegis/sapl/media"] diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 5edc99d50..ad26b229a 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -30,5 +30,7 @@ textract==1.5.0 pysolr==3.6.0 whoosh==2.7.4 +pyoai==2.5.0 + git+git://github.com/interlegis/trml2pdf.git git+git://github.com/interlegis/django-admin-bootstrapped diff --git a/sapl/lexml/OAIServer.py b/sapl/lexml/OAIServer.py new file mode 100644 index 000000000..3cee92a4a --- /dev/null +++ b/sapl/lexml/OAIServer.py @@ -0,0 +1,285 @@ +from datetime import datetime + +import oaipmh +import oaipmh.error +import oaipmh.metadata +import oaipmh.server +from django.urls import reverse +from lxml import etree +from lxml.builder import ElementMaker + +from sapl.base.models import AppConfig, CasaLegislativa +from sapl.lexml.models import LexmlPublicador +from sapl.norma.models import NormaJuridica + + +class OAILEXML: + """ + Padrao OAI do LeXML + Esta registrado sobre o nome 'oai_lexml' + """ + + def __init__(self, prefix): + self.prefix = prefix + self.ns = {'oai_lexml': 'http://www.lexml.gov.br/oai_lexml', } + self.schemas = {'oai_lexml': 'http://projeto.lexml.gov.br/esquemas/oai_lexml.xsd'} + + def __call__(self, element, metadata): + data = metadata.record + value = etree.XML(data['metadata']) + element.append(value) + + +class OAIServer: + """ + An OAI-2.0 compliant oai server. + Underlying code is based on pyoai's oaipmh.server' + """ + + XSI_NS = 'http://www.w3.org/2001/XMLSchema-instance' + ns = {'lexml': 'http://www.lexml.gov.br/oai_lexml'} + schema = {'oai_lexml': 'http://projeto.lexml.gov.br/esquemas/oai_lexml.xsd'} + + def __init__(self, config={}): + self.config = config + + def identify(self): + result = oaipmh.common.Identify( + repositoryName=self.config['titulo'], + baseURL=self.config['base_url'], + protocolVersion='2.0', + adminEmails=self.config['email'], + earliestDatestamp=datetime(2001, 1, 1, 10, 00), + deletedRecord='transient', + granularity='YYYY-MM-DDThh:mm:ssZ', + compression=['identity'], + toolkit_description=False) + if not self.config['descricao']: + result.add_description(self.config['descricao']) + return result + + def create_header_and_metadata(self, record): + header = self.create_header(record) + metadata = oaipmh.common.Metadata(None, record['metadata']) + metadata.record = record + return header, metadata + + def list_query(self, from_date=None, until_date=None, offset=0, batch_size=10, identifier=None): + if identifier: + identifier = int(identifier.split('/')[-1]) # Get internal id + else: + identifier = '' + until_date = datetime.now() if not until_date or until_date > datetime.now() else until_date + return self.oai_query(offset=offset, batch_size=batch_size, from_date=from_date, until_date=until_date, + identifier=identifier) + + def check_metadata_prefix(self, metadata_prefix): + if not metadata_prefix in self.config['metadata_prefixes']: + raise oaipmh.error.CannotDisseminateFormatError + + def listRecords(self, metadataPrefix, from_date=None, until_date=None, cursor=0, batch_size=10): + self.check_metadata_prefix(metadataPrefix) + for record in self.list_query(from_date, until_date, cursor, batch_size): + header, metadata = self.create_header_and_metadata(record) + yield header, metadata, None # None? + + def get_oai_id(self, internal_id): + return "oai:{}".format(internal_id) + + def create_header(self, record): + oai_id = self.get_oai_id(record['record']['id']) + timestamp = record['record']['when_modified'] + timestamp = timestamp.replace(tzinfo=None) + sets = [] + deleted = record['record']['deleted'] + return oaipmh.common.Header(None, oai_id, timestamp, sets, deleted) + + def get_esfera_federacao(self): + appconfig = AppConfig.objects.first() + return appconfig.esfera_federacao + + def recupera_norma(self, offset, batch_size, from_date, until_date, identifier, esfera): + kwargs = {'data__lte': until_date} + if from_date: + kwargs['data__gte'] = from_date + if identifier: + kwargs['numero'] = identifier + if esfera: + kwargs['esfera_federacao'] = esfera + return NormaJuridica.objects.select_related('tipo').filter(**kwargs)[offset:offset + batch_size] + + def monta_id(self, norma): + if norma: + num = len(casa.endereco_web.split('.')) + dominio = '.'.join(casa.endereco_web.split('.')[1:num]) + prefixo_oai = '{}.{}:sapl/'.format(casa.sigla.lower(), dominio) + numero_interno = norma.numero + tipo_norma = norma.tipo.equivalente_lexml + ano_norma = norma.ano + identificador = '{}{};{};{}'.format(prefixo_oai, tipo_norma, ano_norma, numero_interno) + return identificador + else: + return None + + def monta_urn(self, norma, esfera): + if norma: + urn = 'urn:lex:br;' + esferas = {'M': 'municipal', 'E': 'estadual'} + municipio = casa.municipio.lower() + uf = casa.uf.lower() + for x in [' ', '.de.', '.da.', '.das.', '.do.', '.dos.']: + municipio = municipio.replace(x, '.') + uf = uf.replace(x, '.') + if esfera == 'M': + urn += '{};{}:'.format(uf, municipio) + if norma.tipo.equivalente_lexml == 'regimento.interno' or norma.tipo.equivalente_lexml == 'resolucao': + urn += 'camara.' + urn += esferas[esfera] + ':' + elif esfera == 'E': + urn += '{}:{}:'.format(uf, esferas[esfera]) + else: + urn += ':' + if norma.tipo.equivalente_lexml: + urn += '{}:{};'.format(norma.tipo.equivalente_lexml, norma.data.isoformat()) + else: + urn += '{};'.format(norma.data.isoformat()) + if norma.tipo.equivalente_lexml == 'lei.organica' or norma.tipo.equivalente_lexml == 'constituicao': + urn += norma.ano + else: + urn += norma.numero + if norma.data_vigencia and norma.data_publicacao: + urn += '@{};publicacao;{}'.format(norma.data_vigencia.isoformat(), norma.data_publicacao.isoformat()) + elif norma.data_publicacao: + urn += '@inicio.vigencia;publicacao;{}'.format(norma.data_publicacao.isoformat()) + return urn + else: + return None + + def data_por_extenso(self, data): + data = data.strftime('%d-%m-%Y') + if data != '': + meses = {1: 'Janeiro', 2: 'Fevereiro', 3: 'Março', 4: 'Abril', 5: 'Maio', 6: 'Junho', 7: 'Julho', + 8: 'Agosto', 9: 'Setembro', 10: 'Outubro', 11: 'Novembro', 12: 'Dezembro'} + return '{} de {} de {}'.format(data[0:2], meses[int(data[3:5])], data[6:]) + else: + return '' + + def monta_xml(self, urn, norma): + publicador = LexmlPublicador.objects.first() + if norma and publicador: + LEXML = ElementMaker(namespace=self.ns['lexml'], nsmap=self.ns) + oai_lexml = LEXML.LexML() + oai_lexml.attrib['{{}}schemaLocation'.format(self.XSI_NS)] = '{} {}'.format( + 'http://www.lexml.gov.br/oai_lexml', 'http://projeto.lexml.gov.br/esquemas/oai_lexml.xsd') + texto_integral = norma.texto_integral + mime_types = {'doc': 'application/msword', + 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'odt': 'application/vnd.oasis.opendocument.text', + 'pdf': 'application/pdf', + 'rtf': 'application/rtf'} + if texto_integral: + url_conteudo = self.config['base_url'] + texto_integral.url + extensao = texto_integral.url.split('.')[-1] + formato = mime_types.get(extensao, 'application/octet-stream') + else: + formato = 'text/html' + url_conteudo = self.config['base_url'] + reverse('sapl.norma:normajuridica_detail', + kwargs={'pk': norma.numero}) + element_maker = ElementMaker() + id_publicador = str(publicador.id_publicador) + item_conteudo = element_maker.Item(url_conteudo, formato=formato, idPublicador=id_publicador, + tipo='conteudo') + oai_lexml.append(item_conteudo) + url = self.config['base_url'] + reverse('sapl.norma:normajuridica_detail', kwargs={'pk': norma.numero}) + item_metadado = element_maker.Item(url, formato='text/html', idPublicador=id_publicador, tipo='metadado') + oai_lexml.append(item_metadado) + documento_individual = element_maker.DocumentoIndividual(urn) + oai_lexml.append(documento_individual) + if norma.tipo.equivalente_lexml == 'lei.organica': + epigrafe = '{} de {} - {}, de {}'.format(norma.tipo.descricao, casa.municipio, + casa.uf, norma.ano) + elif norma.tipo.equivalente_lexml == 'constituicao': + epigrafe = '{} do Estado de {}, de {}'.format(norma.tipo.descricao, casa.municipio, + norma.ano) + else: + epigrafe = '{} n° {}, de {}'.format(norma.tipo.descricao, norma.numero, + self.data_por_extenso(norma.data)) + oai_lexml.append(element_maker.Epigrafe(epigrafe)) + oai_lexml.append(element_maker.Ementa(norma.ementa)) + indexacao = norma.indexacao + if indexacao: + oai_lexml.append(element_maker.Indexacao(indexacao)) + return etree.tostring(oai_lexml) + else: + return None + + def oai_query(self, offset=0, batch_size=10, from_date=None, until_date=None, identifier=None): + esfera = self.get_esfera_federacao() + offset = 0 if offset < 0 else offset + batch_size = 10 if batch_size < 0 else batch_size + until_date = datetime.now() if not until_date or until_date > datetime.now() else until_date + normas = self.recupera_norma(offset, batch_size, from_date, until_date, identifier, esfera) + for norma in normas: + resultado = {} + identificador = self.monta_id(norma) + urn = self.monta_urn(norma, esfera) + xml_lexml = self.monta_xml(urn, norma) + resultado['tx_metadado_xml'] = xml_lexml + resultado['cd_status'] = 'N' + resultado['id'] = identificador + resultado['when_modified'] = norma.timestamp + resultado['deleted'] = 0 + yield {'record': resultado, + 'metadata': resultado['tx_metadado_xml']} + + +def OAIServerFactory(config={}): + """ + Create a new OAI batching OAI Server given a config and a database + """ + for prefix in config['metadata_prefixes']: + metadata_registry = oaipmh.metadata.MetadataRegistry() + metadata_registry.registerWriter(prefix, OAILEXML(prefix)) + return oaipmh.server.BatchingServer( + OAIServer(config), + metadata_registry=metadata_registry, + resumption_batch_size=config['batch_size'] + ) + + +casa = None + + +def casa_legislativa(): + global casa + if not casa: + casa = CasaLegislativa.objects.first() + return casa if casa else CasaLegislativa() # retorna objeto dummy + + +def get_config(url, batch_size): + config = {'content_type': None, + 'delay': 0, + 'base_asset_path': None, + 'metadata_prefixes': ['oai_lexml']} + config.update({'titulo': casa_legislativa().nome, # Inicializa variável global casa + 'email': casa.email, + 'base_url': url[:url.find('/', 8)], + 'descricao': casa.informacao_geral, + 'batch_size': batch_size}) + return config + + +if __name__ == '__main__': + """ + Para executar localmente (estando no diretório raiz): + + $ ./manage.py shell_plus + + Executar comando + %run sapl/lexml/OAIServer.py + """ + oai_server = OAIServerFactory(get_config('http://127.0.0.1:8000/', 10)) + r = oai_server.handleRequest({'verb': 'ListRecords', + 'metadataPrefix': 'oai_lexml'}) + print(r.decode('UTF-8')) diff --git a/sapl/lexml/urls.py b/sapl/lexml/urls.py index e7d582030..59fb4ab69 100644 --- a/sapl/lexml/urls.py +++ b/sapl/lexml/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import include, url -from sapl.lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud +from sapl.lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud, lexml_request from .apps import AppConfig @@ -11,4 +11,5 @@ urlpatterns = [ include(LexmlProvedorCrud.get_urls())), url(r'^sistema/lexml/publicador/', include(LexmlPublicadorCrud.get_urls())), + url(r'^sistema/lexml', lexml_request, name='lexml_endpoint') ] diff --git a/sapl/lexml/views.py b/sapl/lexml/views.py index 3627d5829..4662e4911 100644 --- a/sapl/lexml/views.py +++ b/sapl/lexml/views.py @@ -1,6 +1,18 @@ +from django.http import HttpResponse + from sapl.crud.base import CrudAux +from sapl.lexml.OAIServer import OAIServerFactory, get_config from .models import LexmlProvedor, LexmlPublicador LexmlProvedorCrud = CrudAux.build(LexmlProvedor, 'lexml_provedor') LexmlPublicadorCrud = CrudAux.build(LexmlPublicador, 'lexml_publicador') + + +def lexml_request(request): + config = get_config(request.get_raw_uri(), int(request.GET.get('batch_size', 10))) + oai_server = OAIServerFactory(config) + r = oai_server.handleRequest({'verb': request.GET.get('verb', 'ListRecords'), + 'metadataPrefix': request.GET.get('metadataPrefix', 'oai_lexml')}) + response = r.decode('UTF-8') + return HttpResponse(response, content_type='text/xml') From 308a50dff06bc0497e553b6713378743e152c5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Rodrigues?= Date: Thu, 14 Feb 2019 13:12:28 -0200 Subject: [PATCH 11/27] =?UTF-8?q?Apresenta=20inconsist=C3=AAncias=20(#2454?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adicionar identificação de protocolos duplicados * Identificar protocolos com duas ou mais matérias * Identificar matérias com protocolos inexistentes * sobe alteracoes * Identificar parl. com mandatos com intersecção * Alterar a apresentação dos resultados * Adicionar identificação de protocolos duplicados * Identificar protocolos com duas ou mais matérias * Identificar matérias com protocolos inexistentes * sobe alteracoes * Identificar parl. com mandatos com intersecção * Alterar a apresentação dos resultados * Adicionar identificação de autores duplicados * Identificar bancadas e comissões com autor externo * Adicionar migrações necessárias * Alterar a apresentação dos resultados * Alterar a apresentação dos resultados * Acelerar identificação de protocolos com matérias * Adicionar identificação de protocolos duplicados * Identificar protocolos com duas ou mais matérias * Identificar matérias com protocolos inexistentes * sobe alteracoes * Adicionar identificação de protocolos duplicados * Identificar protocolos com duas ou mais matérias * Identificar matérias com protocolos inexistentes * Identificar parl. com mandatos com intersecção * Alterar a apresentação dos resultados * Adicionar identificação de autores duplicados * Identificar bancadas e comissões com autor externo * Alterar a apresentação dos resultados * Alterar a apresentação dos resultados * Acelerar identificação de protocolos com matérias * Adicionar migrações necessárias * Alterar a apresentação dos resultados * Adicionar migrações necessárias * Alterar apresentação de resultados * Identificar legislatura infindável * Identificar legislatura sem data fim * Adicionar identificação de protocolos duplicados * sobe alteracoes * Adicionar identificação de protocolos duplicados * Identificar protocolos com duas ou mais matérias * Identificar matérias com protocolos inexistentes * Identificar parl. com mandatos com intersecção * Alterar a apresentação dos resultados * Alterar a apresentação dos resultados * Identificar bancadas e comissões com autor externo * Adicionar identificação de protocolos duplicados * Identificar protocolos com duas ou mais matérias * Adicionar identificação de protocolos duplicados * Identificar protocolos com duas ou mais matérias * sobe alteracoes * Identificar parl. com mandatos com intersecção * Alterar a apresentação dos resultados * Adicionar identificação de autores duplicados * Identificar bancadas e comissões com autor externo * Alterar apresentação de resultados * Identificar legislatura infindável * Identificar legislatura sem data fim * Adicionar migrações necessárias * Tratar mandato sem data -> mandatos interseção * Adicionar importação itertools * Corregir função autores_duplicados * Refatorar função legislatura_infindavel Excluir comentários desnecessários Refatorar identificação autores duplicados Remover migrations de outro PR Correções Excluir arquivos desnecessários Alterar apresentação de resultados Identificar mandato sem data inicial * Correção templates --- sapl/base/urls.py | 42 ++- sapl/base/views.py | 352 +++++++++++++++++- sapl/templates/base/autores_duplicados.html | 30 ++ .../base/bancada_comissao_autor_externo.html | 34 ++ .../base/legislatura_infindavel.html | 30 ++ .../templates/base/lista_inconsistencias.html | 20 + .../base/mandato_sem_data_inicio.html | 30 ++ .../base/materias_protocolo_inexistente.html | 32 ++ .../parlamentares_mandatos_intersecao.html | 32 ++ .../base/protocolos_com_materias.html | 28 ++ .../templates/base/protocolos_duplicados.html | 30 ++ sapl/templates/navbar.yaml | 3 + 12 files changed, 658 insertions(+), 5 deletions(-) create mode 100644 sapl/templates/base/autores_duplicados.html create mode 100644 sapl/templates/base/bancada_comissao_autor_externo.html create mode 100644 sapl/templates/base/legislatura_infindavel.html create mode 100644 sapl/templates/base/lista_inconsistencias.html create mode 100644 sapl/templates/base/mandato_sem_data_inicio.html create mode 100644 sapl/templates/base/materias_protocolo_inexistente.html create mode 100644 sapl/templates/base/parlamentares_mandatos_intersecao.html create mode 100644 sapl/templates/base/protocolos_com_materias.html create mode 100644 sapl/templates/base/protocolos_duplicados.html diff --git a/sapl/base/urls.py b/sapl/base/urls.py index ae4add258..28d5d5361 100644 --- a/sapl/base/urls.py +++ b/sapl/base/urls.py @@ -16,18 +16,27 @@ from .forms import LoginForm, NovaSenhaForm, RecuperarSenhaForm from .views import (AlterarSenha, AppConfigCrud, CasaLegislativaCrud, CreateUsuarioView, DeleteUsuarioView, EditUsuarioView, HelpTopicView, ListarUsuarioView, LogotipoView, - RelatorioAtasView, RelatorioAudienciaView, + RelatorioAtasView, RelatorioAudienciaView, RelatorioDataFimPrazoTramitacaoView, RelatorioHistoricoTramitacaoView, RelatorioMateriasPorAnoAutorTipoView, RelatorioMateriasPorAutorView, RelatorioMateriasTramitacaoView, - RelatorioPresencaSessaoView, + RelatorioPresencaSessaoView, RelatorioReuniaoView, SaplSearchView, RelatorioNormasPublicadasMesView, RelatorioNormasVigenciaView, EstatisticasAcessoNormas, - RelatoriosListView) + RelatoriosListView, + ListarInconsistenciasView, ListarProtocolosDuplicadosView, + ListarProtocolosComMateriasView, + ListarMatProtocoloInexistenteView, + ListarParlMandatosIntersecaoView, + ListarAutoresDuplicadosView, + ListarBancadaComissaoAutorExternoView, + ListarLegislaturaInfindavelView, + ListarMandatoSemDataInicioView) + app_name = AppConfig.name @@ -127,6 +136,33 @@ urlpatterns = [ '(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})$', ConfirmarEmailView.as_view(), name='confirmar_email'), + url(r'^sistema/inconsistencias/$', + ListarInconsistenciasView.as_view(), + name='lista_inconsistencias'), + url(r'^sistema/inconsistencias/protocolos_duplicados$', + ListarProtocolosDuplicadosView.as_view(), + name='lista_protocolos_duplicados'), + url(r'^sistema/inconsistencias/protocolos_com_materias$', + ListarProtocolosComMateriasView.as_view(), + name='lista_protocolos_com_materias'), + url(r'^sistema/inconsistencias/materias_protocolo_inexistente$', + ListarMatProtocoloInexistenteView.as_view(), + name='lista_materias_protocolo_inexistente'), + url(r'^sistema/inconsistencias/mandato_sem_data_inicio', + ListarMandatoSemDataInicioView.as_view(), + name='lista_mandato_sem_data_inicio'), + url(r'^sistema/inconsistencias/parlamentares_mandatos_intersecao$', + ListarParlMandatosIntersecaoView.as_view(), + name='lista_parlamentares_mandatos_intersecao'), + url(r'^sistema/inconsistencias/autores_duplicados$', + ListarAutoresDuplicadosView.as_view(), + name='lista_autores_duplicados'), + url(r'^sistema/inconsistencias/bancada_comissao_autor_externo$', + ListarBancadaComissaoAutorExternoView.as_view(), + name='lista_bancada_comissao_autor_externo'), + url(r'^sistema/inconsistencias/legislatura_infindavel$', + ListarLegislaturaInfindavelView.as_view(), + name='lista_legislatura_infindavel'), # todos os sublinks de sistema devem vir acima deste url(r'^sistema/$', permission_required('base.view_tabelas_auxiliares') diff --git a/sapl/base/views.py b/sapl/base/views.py index 278ee4f61..59f787e83 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -1,4 +1,5 @@ import collections +import itertools import datetime import logging import os @@ -35,10 +36,13 @@ from sapl.crud.base import CrudAux, make_pagination from sapl.materia.models import (Autoria, MateriaLegislativa, Proposicao, TipoMateriaLegislativa, StatusTramitacao, UnidadeTramitacao) from sapl.norma.models import (NormaJuridica, NormaEstatisticas) +from sapl.parlamentares.models import Parlamentar, Legislatura, Mandato +from sapl.protocoloadm.models import Protocolo from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria, - SessaoPlenariaPresenca) + SessaoPlenariaPresenca, Bancada) from sapl.utils import (parlamentares_ativos, gerar_hash_arquivo, SEPARADOR_HASH_PROPOSICAO, - show_results_filter_set, mail_service_configured) + show_results_filter_set, mail_service_configured, + intervalos_tem_intersecao,) from .forms import (AlterarSenhaForm, CasaLegislativaForm, ConfiguracoesAppForm, RelatorioAtasFilterSet, @@ -918,6 +922,350 @@ class EstatisticasAcessoNormas(TemplateView): return self.render_to_response(context) +class ListarInconsistenciasView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/lista_inconsistencias.html' + context_object_name = 'tabela_inconsistencias' + permission_required = ('base.list_appconfig',) + + def get_queryset(self): + tabela = [] + tabela.append( + ('protocolos_duplicados', + 'Protocolos duplicados', + len(protocolos_duplicados()) + ) + ) + tabela.append( + ('protocolos_com_materias', + 'Protocolos que excedem o limite de matérias vinculadas', + len(protocolos_com_materias()) + ) + ) + tabela.append( + ('materias_protocolo_inexistente', + 'Matérias Legislativas com protocolo inexistente', + len(materias_protocolo_inexistente()) + ) + ) + tabela.append( + ('mandato_sem_data_inicio', + 'Mandatos sem data inicial', + len(mandato_sem_data_inicio()) + ) + ) + tabela.append( + ('parlamentares_mandatos_intersecao', + 'Parlamentares com mandatos com interseção', + len(parlamentares_mandatos_intersecao()) + ) + ) + tabela.append( + ('autores_duplicados', + 'Autores duplicados', + len(autores_duplicados()) + ) + ) + tabela.append( + ('bancada_comissao_autor_externo', + 'Bancadas e Comissões com autor externo', + len(bancada_comissao_autor_externo()) + ) + ) + tabela.append( + ('legislatura_infindavel', + 'Legislaturas sem data fim', + len(legislatura_infindavel()) + ) + ) + + return tabela + + +def legislatura_infindavel(): + return Legislatura.objects.filter(data_fim__isnull=True).order_by('-numero') + + +class ListarLegislaturaInfindavelView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/legislatura_infindavel.html' + context_object_name = 'legislatura_infindavel' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return legislatura_infindavel() + + def get_context_data(self, **kwargs): + context = super( + ListarLegislaturaInfindavelView, self + ).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhuma encontrada.' + return context + + +def bancada_comissao_autor_externo(): + tipo_autor_externo = TipoAutor.objects.filter(descricao='Externo') + + lista_bancada_autor_externo = [] + for bancada in Bancada.objects.all().order_by('nome'): + autor_externo = bancada.autor.filter(tipo=tipo_autor_externo) + + if autor_externo: + q_autor_externo = bancada.autor.get(tipo=tipo_autor_externo) + lista_bancada_autor_externo.append( + (q_autor_externo, bancada, 'Bancada', 'sistema/bancada') + ) + + lista_comissao_autor_externo = [] + for comissao in Comissao.objects.all().order_by('nome'): + autor_externo = comissao.autor.filter(tipo=tipo_autor_externo) + + if autor_externo: + q_autor_externo = comissao.autor.get(tipo=tipo_autor_externo) + lista_comissao_autor_externo.append( + (q_autor_externo, comissao, 'Comissão', 'comissao') + ) + + return lista_bancada_autor_externo + lista_comissao_autor_externo + + +class ListarBancadaComissaoAutorExternoView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/bancada_comissao_autor_externo.html' + context_object_name = 'bancada_comissao_autor_externo' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return bancada_comissao_autor_externo() + + def get_context_data(self, **kwargs): + context = super( + ListarBancadaComissaoAutorExternoView, self + ).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhum encontrado.' + return context + + +def autores_duplicados(): + return [autor.values() for autor in Autor.objects.values('nome', 'tipo__descricao').annotate(count=Count('nome')).filter(count__gt=1)] + + +class ListarAutoresDuplicadosView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/autores_duplicados.html' + context_object_name = 'autores_duplicados' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return autores_duplicados() + + def get_context_data(self, **kwargs): + context = super( + ListarAutoresDuplicadosView, self).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhum encontrado.' + return context + + +def parlamentares_mandatos_intersecao(): + intersecoes = [] + + for parlamentar in Parlamentar.objects.all().order_by('nome_completo'): + mandatos = parlamentar.mandato_set.all() + combinacoes = itertools.combinations(mandatos, 2) + + for c in combinacoes: + data_inicio_mandato1 = c[0].data_inicio_mandato + data_fim_mandato1 = c[0].data_fim_mandato if c[0].data_fim_mandato else timezone.now().date() + + data_inicio_mandato2 = c[1].data_inicio_mandato + data_fim_mandato2 = c[1].data_fim_mandato if c[1].data_fim_mandato else timezone.now().date() + + if data_inicio_mandato1 and data_inicio_mandato2: + exists = intervalos_tem_intersecao( + data_inicio_mandato1, data_fim_mandato1, + data_inicio_mandato2, data_fim_mandato2) + if exists: + intersecoes.append((parlamentar, c[0], c[1])) + + return intersecoes + + +class ListarParlMandatosIntersecaoView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/parlamentares_mandatos_intersecao.html' + context_object_name = 'parlamentares_mandatos_intersecao' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return parlamentares_mandatos_intersecao() + + def get_context_data(self, **kwargs): + context = super( + ListarParlMandatosIntersecaoView, self).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhum encontrado.' + return context + + +def mandato_sem_data_inicio(): + return Mandato.objects.filter(data_inicio_mandato__isnull=True).order_by('parlamentar') + + +class ListarMandatoSemDataInicioView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/mandato_sem_data_inicio.html' + context_object_name = 'mandato_sem_data_inicio' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return mandato_sem_data_inicio() + + def get_context_data(self, **kwargs): + context = super( + ListarMandatoSemDataInicioView, self + ).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhum encontrada.' + return context + + +def materias_protocolo_inexistente(): + materias = [] + for materia in MateriaLegislativa.objects.filter(numero_protocolo__isnull=False).order_by('-ano', 'numero'): + exists = Protocolo.objects.filter( + ano=materia.ano, numero=materia.numero_protocolo).exists() + if not exists: + materias.append( + (materia, materia.ano, materia.numero_protocolo)) + return materias + + +class ListarMatProtocoloInexistenteView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/materias_protocolo_inexistente.html' + context_object_name = 'materias_protocolo_inexistente' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return materias_protocolo_inexistente() + + def get_context_data(self, **kwargs): + context = super( + ListarMatProtocoloInexistenteView, self + ).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhuma encontrada.' + return context + + +def protocolos_com_materias(): + protocolos = {} + + for m in MateriaLegislativa.objects.filter(numero_protocolo__isnull=False).order_by('-ano', 'numero_protocolo'): + if Protocolo.objects.filter(numero=m.numero_protocolo, ano=m.ano).exists(): + key = "{}/{}".format(m.numero_protocolo, m.ano) + val = protocolos.get(key, list()) + val.append(m) + protocolos[key] = val + + return [(v[0], len(v)) for (k, v) in protocolos.items() if len(v) > 1] + + +class ListarProtocolosComMateriasView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/protocolos_com_materias.html' + context_object_name = 'protocolos_com_materias' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return protocolos_com_materias() + + def get_context_data(self, **kwargs): + context = super( + ListarProtocolosComMateriasView, self).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhum encontrado.' + return context + + +def protocolos_duplicados(): + protocolos = {} + for p in Protocolo.objects.order_by('-ano', 'numero'): + key = "{}/{}".format(p.numero, p.ano) + val = protocolos.get(key, list()) + val.append(p) + protocolos[key] = val + + return [(v[0], len(v)) for (k, v) in protocolos.items() if len(v) > 1] + +class ListarProtocolosDuplicadosView(PermissionRequiredMixin, ListView): + model = get_user_model() + template_name = 'base/protocolos_duplicados.html' + context_object_name = 'protocolos_duplicados' + permission_required = ('base.list_appconfig',) + paginate_by = 10 + + def get_queryset(self): + return protocolos_duplicados() + + def get_context_data(self, **kwargs): + context = super( + ListarProtocolosDuplicadosView, self).get_context_data(**kwargs) + paginator = context['paginator'] + page_obj = context['page_obj'] + context['page_range'] = make_pagination( + page_obj.number, paginator.num_pages) + context[ + 'NO_ENTRIES_MSG' + ] = 'Nenhum encontrado.' + return context + + class ListarUsuarioView(PermissionRequiredMixin, ListView): model = get_user_model() template_name = 'auth/user_list.html' diff --git a/sapl/templates/base/autores_duplicados.html b/sapl/templates/base/autores_duplicados.html new file mode 100644 index 000000000..57068375b --- /dev/null +++ b/sapl/templates/base/autores_duplicados.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Autores Duplicados

+ {% if not autores_duplicados %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + + {% for autor, tipo, quantidade in autores_duplicados %} + + + + + + {% endfor %} + +
AutorTipo de AutorQuantidade
{{ autor }}{{ tipo }}{{ quantidade }}
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/bancada_comissao_autor_externo.html b/sapl/templates/base/bancada_comissao_autor_externo.html new file mode 100644 index 000000000..b4471ed1c --- /dev/null +++ b/sapl/templates/base/bancada_comissao_autor_externo.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Bancadas e Comissões com Autor Externo

+ {% if not bancada_comissao_autor_externo %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + + {% for autor, objeto, descricao_objeto, link in bancada_comissao_autor_externo %} + + + + + + {% endfor %} + +
Descrição do ObjetoObjetoAutor
{{ descricao_objeto }} + {{ objeto }} + + {{ autor.nome }} +
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/legislatura_infindavel.html b/sapl/templates/base/legislatura_infindavel.html new file mode 100644 index 000000000..b2a772ecc --- /dev/null +++ b/sapl/templates/base/legislatura_infindavel.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Legislaturas sem Data Fim

+ {% if not legislatura_infindavel %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + + {% for legislatura in legislatura_infindavel %} + + + + + + {% endfor %} + +
Número LegislaturaData EleiçãoData Início
{{ legislatura.numero }}{{ legislatura.data_eleicao }}{{ legislatura.data_inicio }}
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/lista_inconsistencias.html b/sapl/templates/base/lista_inconsistencias.html new file mode 100644 index 000000000..735dd21d1 --- /dev/null +++ b/sapl/templates/base/lista_inconsistencias.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Inconsistências

+ + + {% for complemento_link, nome, valor in tabela_inconsistencias %} + + + + + {% endfor %} + +
+ {{ nome }} + {{ valor }}
+
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/mandato_sem_data_inicio.html b/sapl/templates/base/mandato_sem_data_inicio.html new file mode 100644 index 000000000..110995ad2 --- /dev/null +++ b/sapl/templates/base/mandato_sem_data_inicio.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Mandatos sem Data Inicial

+ {% if not mandato_sem_data_inicio %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + {% for mandato in mandato_sem_data_inicio %} + + + + + {% endfor %} + +
Parlamentar do MandatoLegislatura do Mandato
+ {{ mandato.parlamentar }} + {{ mandato.legislatura }}
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/materias_protocolo_inexistente.html b/sapl/templates/base/materias_protocolo_inexistente.html new file mode 100644 index 000000000..40bf34b78 --- /dev/null +++ b/sapl/templates/base/materias_protocolo_inexistente.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Matérias Legislativas com Protocolo Inexistente

+ {% if not materias_protocolo_inexistente %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + + {% for materia, ano, numero_protocolo in materias_protocolo_inexistente %} + + + + + + {% endfor %} + +
Matéria LegislativaAnoNúmero Protocolo
+ {{ materia }} + {{ ano }}{{ numero_protocolo }}
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/parlamentares_mandatos_intersecao.html b/sapl/templates/base/parlamentares_mandatos_intersecao.html new file mode 100644 index 000000000..2c8999e6f --- /dev/null +++ b/sapl/templates/base/parlamentares_mandatos_intersecao.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Parlamentares com Mandatos com Interseção

+ {% if not parlamentares_mandatos_intersecao %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + + {% for parlamentar, mandato_a, mandato_b in parlamentares_mandatos_intersecao %} + + + + + + {% endfor %} + +
ParlamentarMandato 1Mandato 2
+ {{ parlamentar }} + {{ mandato_a }}{{ mandato_b }}
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/protocolos_com_materias.html b/sapl/templates/base/protocolos_com_materias.html new file mode 100644 index 000000000..29dd84bf9 --- /dev/null +++ b/sapl/templates/base/protocolos_com_materias.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Protocolos que Excedem o Limite de Matérias Vinculadas

+ {% if not protocolos_com_materias %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + {% for materia, quantidade in protocolos_com_materias %} + + + + + {% endfor %} + +
ProtocoloQuantidade de Matérias Vinculas
{{ materia.numero_protocolo }}/{{ materia.ano }}{{ quantidade }}
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/base/protocolos_duplicados.html b/sapl/templates/base/protocolos_duplicados.html new file mode 100644 index 000000000..e5217c908 --- /dev/null +++ b/sapl/templates/base/protocolos_duplicados.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load common_tags %} +{% block base_content %} +
+

Lista de Protocolos Duplicados

+ {% if not protocolos_duplicados %} +

{{ NO_ENTRIES_MSG }}

+ {% else %} + + + + + + + + + {% for protocolo, quantidade in protocolos_duplicados %} + + + + + {% endfor %} + +
ProtocoloQuantidade
+ {{ protocolo }} + {{ quantidade }}
+ {% endif %} +
+ {% include 'paginacao.html'%} +{% endblock base_content %} \ No newline at end of file diff --git a/sapl/templates/navbar.yaml b/sapl/templates/navbar.yaml index b80cb7acd..3d539eb0c 100644 --- a/sapl/templates/navbar.yaml +++ b/sapl/templates/navbar.yaml @@ -75,6 +75,9 @@ - title: {% trans 'Administração de Usuários' %} url: {% url 'sapl.base:user_list' %} check_permission: user.is_superuser + - title: {% trans 'Inconsistências da Aplicação' %} + url: {% url 'sapl.base:lista_inconsistencias' %} + check_permission: user.is_superuser {% comment %} From ee5a70f35f8dbdcc64e93456c98e06b2fce47a0a Mon Sep 17 00:00:00 2001 From: Victor Fabre Date: Thu, 14 Feb 2019 15:41:03 -0200 Subject: [PATCH 12/27] Muda label de pesquisa para melhor entendimento --- sapl/base/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 2e54f82be..3476ac09d 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -859,7 +859,7 @@ class RelatorioHistoricoTramitacaoFilterSet(django_filters.FilterSet): self.filters['tipo'].label = 'Tipo de Matéria' self.filters['tramitacao__unidade_tramitacao_local' - ].label = _('Unidade Local (Último Local)') + ].label = _('Unidade Local') self.filters['tramitacao__status'].label = _('Status') row1 = to_row([('tramitacao__data_tramitacao', 12)]) From 578ff757a76f10789f558548e8926cfd46484d62 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Thu, 14 Feb 2019 23:22:58 -0200 Subject: [PATCH 13/27] torna sapl + sapl-frontend instalavel em outro projeto --- MANIFEST.in | 3 ++- sapl/static/{ => sapl}/audio/ring.mp3 | Bin .../{ => sapl}/css/chunk-vendors.f109b7f2.css | 0 sapl/static/{ => sapl}/css/compilacao.1e862898.css | 0 sapl/static/{ => sapl}/css/global.d2e0a784.css | 0 sapl/static/{ => sapl}/css/painel.61177241.css | 0 .../{ => sapl}/fonts/fa-brands-400.3186ebd2.eot | Bin .../{ => sapl}/fonts/fa-brands-400.662c24d0.woff2 | Bin .../{ => sapl}/fonts/fa-brands-400.a995bae1.ttf | Bin .../{ => sapl}/fonts/fa-brands-400.c7d7a2a1.woff | Bin .../{ => sapl}/fonts/fa-regular-400.6a9d786e.woff2 | Bin .../{ => sapl}/fonts/fa-regular-400.72f15fa7.woff | Bin .../{ => sapl}/fonts/fa-regular-400.80efa56b.eot | Bin .../{ => sapl}/fonts/fa-regular-400.fcb220ee.ttf | Bin .../{ => sapl}/fonts/fa-solid-900.20c189aa.ttf | Bin .../{ => sapl}/fonts/fa-solid-900.3638e62e.woff2 | Bin .../{ => sapl}/fonts/fa-solid-900.9a52a4e9.eot | Bin .../{ => sapl}/fonts/fa-solid-900.9c73abbd.woff | Bin sapl/static/{ => sapl}/img/arrow.png | Bin sapl/static/{ => sapl}/img/authenticated.png | Bin sapl/static/{ => sapl}/img/avatar.png | Bin sapl/static/{ => sapl}/img/beta.png | Bin sapl/static/{ => sapl}/img/brasao_transp.gif | Bin sapl/static/{ => sapl}/img/down_arrow_select.jpg | Bin sapl/static/{ => sapl}/img/etiqueta.png | Bin .../{ => sapl}/img/fa-brands-400.e4fed0a5.svg | 0 .../{ => sapl}/img/fa-regular-400.304f31f4.svg | 0 .../static/{ => sapl}/img/fa-solid-900.c8ea4c79.svg | 0 sapl/static/{ => sapl}/img/favicon.ico | Bin sapl/static/{ => sapl}/img/file.png | Bin sapl/static/{ => sapl}/img/hand-note.png | Bin sapl/static/{ => sapl}/img/icon_comissoes.png | Bin sapl/static/{ => sapl}/img/icon_delete_white.png | Bin .../{ => sapl}/img/icon_materia_legislativa.png | Bin sapl/static/{ => sapl}/img/icon_mesa_diretora.png | Bin .../static/{ => sapl}/img/icon_normas_juridicas.png | Bin sapl/static/{ => sapl}/img/icon_parlamentares.png | Bin sapl/static/{ => sapl}/img/icon_pautas.png | Bin sapl/static/{ => sapl}/img/icon_plenarias.png | Bin sapl/static/{ => sapl}/img/icon_relatorios.png | Bin sapl/static/{ => sapl}/img/icon_save_white.png | Bin sapl/static/{ => sapl}/img/lexml.gif | Bin sapl/static/{ => sapl}/img/logo.png | Bin sapl/static/{ => sapl}/img/logo_cc.png | Bin sapl/static/{ => sapl}/img/logo_interlegis.png | Bin sapl/static/{ => sapl}/img/manual.png | Bin sapl/static/{ => sapl}/img/pdflogo.png | Bin sapl/static/{ => sapl}/img/perfil.png | Bin sapl/static/{ => sapl}/img/search-gray.png | Bin sapl/static/{ => sapl}/img/search.png | Bin .../img/ui-icons_2694e8_256x240.274157b3.png | Bin .../img/ui-icons_2e83ff_256x240.602e5d4d.png | Bin .../img/ui-icons_3d80b3_256x240.24fcd129.png | Bin .../img/ui-icons_72a7cf_256x240.55a4c5ce.png | Bin .../img/ui-icons_ffffff_256x240.bb2a88be.png | Bin sapl/static/{ => sapl}/img/user.png | Bin sapl/static/{ => sapl}/js/chunk-vendors.406f40ec.js | 0 .../js/compilacao.9db618b1.js} | 2 +- .../js/global.2675c725.js} | 2 +- .../js/painel.ddd6e27e.js} | 2 +- sapl/webpack-stats.json | 1 + webpack-stats.json | 1 - 62 files changed, 6 insertions(+), 5 deletions(-) rename sapl/static/{ => sapl}/audio/ring.mp3 (100%) rename sapl/static/{ => sapl}/css/chunk-vendors.f109b7f2.css (100%) rename sapl/static/{ => sapl}/css/compilacao.1e862898.css (100%) rename sapl/static/{ => sapl}/css/global.d2e0a784.css (100%) rename sapl/static/{ => sapl}/css/painel.61177241.css (100%) rename sapl/static/{ => sapl}/fonts/fa-brands-400.3186ebd2.eot (100%) rename sapl/static/{ => sapl}/fonts/fa-brands-400.662c24d0.woff2 (100%) rename sapl/static/{ => sapl}/fonts/fa-brands-400.a995bae1.ttf (100%) rename sapl/static/{ => sapl}/fonts/fa-brands-400.c7d7a2a1.woff (100%) rename sapl/static/{ => sapl}/fonts/fa-regular-400.6a9d786e.woff2 (100%) rename sapl/static/{ => sapl}/fonts/fa-regular-400.72f15fa7.woff (100%) rename sapl/static/{ => sapl}/fonts/fa-regular-400.80efa56b.eot (100%) rename sapl/static/{ => sapl}/fonts/fa-regular-400.fcb220ee.ttf (100%) rename sapl/static/{ => sapl}/fonts/fa-solid-900.20c189aa.ttf (100%) rename sapl/static/{ => sapl}/fonts/fa-solid-900.3638e62e.woff2 (100%) rename sapl/static/{ => sapl}/fonts/fa-solid-900.9a52a4e9.eot (100%) rename sapl/static/{ => sapl}/fonts/fa-solid-900.9c73abbd.woff (100%) rename sapl/static/{ => sapl}/img/arrow.png (100%) rename sapl/static/{ => sapl}/img/authenticated.png (100%) rename sapl/static/{ => sapl}/img/avatar.png (100%) rename sapl/static/{ => sapl}/img/beta.png (100%) rename sapl/static/{ => sapl}/img/brasao_transp.gif (100%) rename sapl/static/{ => sapl}/img/down_arrow_select.jpg (100%) rename sapl/static/{ => sapl}/img/etiqueta.png (100%) rename sapl/static/{ => sapl}/img/fa-brands-400.e4fed0a5.svg (100%) rename sapl/static/{ => sapl}/img/fa-regular-400.304f31f4.svg (100%) rename sapl/static/{ => sapl}/img/fa-solid-900.c8ea4c79.svg (100%) rename sapl/static/{ => sapl}/img/favicon.ico (100%) rename sapl/static/{ => sapl}/img/file.png (100%) rename sapl/static/{ => sapl}/img/hand-note.png (100%) rename sapl/static/{ => sapl}/img/icon_comissoes.png (100%) rename sapl/static/{ => sapl}/img/icon_delete_white.png (100%) rename sapl/static/{ => sapl}/img/icon_materia_legislativa.png (100%) rename sapl/static/{ => sapl}/img/icon_mesa_diretora.png (100%) rename sapl/static/{ => sapl}/img/icon_normas_juridicas.png (100%) rename sapl/static/{ => sapl}/img/icon_parlamentares.png (100%) rename sapl/static/{ => sapl}/img/icon_pautas.png (100%) rename sapl/static/{ => sapl}/img/icon_plenarias.png (100%) rename sapl/static/{ => sapl}/img/icon_relatorios.png (100%) rename sapl/static/{ => sapl}/img/icon_save_white.png (100%) rename sapl/static/{ => sapl}/img/lexml.gif (100%) rename sapl/static/{ => sapl}/img/logo.png (100%) rename sapl/static/{ => sapl}/img/logo_cc.png (100%) rename sapl/static/{ => sapl}/img/logo_interlegis.png (100%) rename sapl/static/{ => sapl}/img/manual.png (100%) rename sapl/static/{ => sapl}/img/pdflogo.png (100%) rename sapl/static/{ => sapl}/img/perfil.png (100%) rename sapl/static/{ => sapl}/img/search-gray.png (100%) rename sapl/static/{ => sapl}/img/search.png (100%) rename sapl/static/{ => sapl}/img/ui-icons_2694e8_256x240.274157b3.png (100%) rename sapl/static/{ => sapl}/img/ui-icons_2e83ff_256x240.602e5d4d.png (100%) rename sapl/static/{ => sapl}/img/ui-icons_3d80b3_256x240.24fcd129.png (100%) rename sapl/static/{ => sapl}/img/ui-icons_72a7cf_256x240.55a4c5ce.png (100%) rename sapl/static/{ => sapl}/img/ui-icons_ffffff_256x240.bb2a88be.png (100%) rename sapl/static/{ => sapl}/img/user.png (100%) rename sapl/static/{ => sapl}/js/chunk-vendors.406f40ec.js (100%) rename sapl/static/{js/compilacao.9bf86742.js => sapl/js/compilacao.9db618b1.js} (99%) rename sapl/static/{js/global.594a728f.js => sapl/js/global.2675c725.js} (99%) rename sapl/static/{js/painel.518bdc14.js => sapl/js/painel.ddd6e27e.js} (99%) create mode 100644 sapl/webpack-stats.json delete mode 100644 webpack-stats.json diff --git a/MANIFEST.in b/MANIFEST.in index 3fe372d5d..7c730520d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ include README.rst LICENSE.txt -recursive-include sapl *.html *.yaml +include sapl/webpack-stats.json +recursive-include sapl *.html *.yaml recursive-include sapl/static * recursive-include sapl/relatorios/templates *.py recursive-include sapl/compilacao *.sql diff --git a/sapl/static/audio/ring.mp3 b/sapl/static/sapl/audio/ring.mp3 similarity index 100% rename from sapl/static/audio/ring.mp3 rename to sapl/static/sapl/audio/ring.mp3 diff --git a/sapl/static/css/chunk-vendors.f109b7f2.css b/sapl/static/sapl/css/chunk-vendors.f109b7f2.css similarity index 100% rename from sapl/static/css/chunk-vendors.f109b7f2.css rename to sapl/static/sapl/css/chunk-vendors.f109b7f2.css diff --git a/sapl/static/css/compilacao.1e862898.css b/sapl/static/sapl/css/compilacao.1e862898.css similarity index 100% rename from sapl/static/css/compilacao.1e862898.css rename to sapl/static/sapl/css/compilacao.1e862898.css diff --git a/sapl/static/css/global.d2e0a784.css b/sapl/static/sapl/css/global.d2e0a784.css similarity index 100% rename from sapl/static/css/global.d2e0a784.css rename to sapl/static/sapl/css/global.d2e0a784.css diff --git a/sapl/static/css/painel.61177241.css b/sapl/static/sapl/css/painel.61177241.css similarity index 100% rename from sapl/static/css/painel.61177241.css rename to sapl/static/sapl/css/painel.61177241.css diff --git a/sapl/static/fonts/fa-brands-400.3186ebd2.eot b/sapl/static/sapl/fonts/fa-brands-400.3186ebd2.eot similarity index 100% rename from sapl/static/fonts/fa-brands-400.3186ebd2.eot rename to sapl/static/sapl/fonts/fa-brands-400.3186ebd2.eot diff --git a/sapl/static/fonts/fa-brands-400.662c24d0.woff2 b/sapl/static/sapl/fonts/fa-brands-400.662c24d0.woff2 similarity index 100% rename from sapl/static/fonts/fa-brands-400.662c24d0.woff2 rename to sapl/static/sapl/fonts/fa-brands-400.662c24d0.woff2 diff --git a/sapl/static/fonts/fa-brands-400.a995bae1.ttf b/sapl/static/sapl/fonts/fa-brands-400.a995bae1.ttf similarity index 100% rename from sapl/static/fonts/fa-brands-400.a995bae1.ttf rename to sapl/static/sapl/fonts/fa-brands-400.a995bae1.ttf diff --git a/sapl/static/fonts/fa-brands-400.c7d7a2a1.woff b/sapl/static/sapl/fonts/fa-brands-400.c7d7a2a1.woff similarity index 100% rename from sapl/static/fonts/fa-brands-400.c7d7a2a1.woff rename to sapl/static/sapl/fonts/fa-brands-400.c7d7a2a1.woff diff --git a/sapl/static/fonts/fa-regular-400.6a9d786e.woff2 b/sapl/static/sapl/fonts/fa-regular-400.6a9d786e.woff2 similarity index 100% rename from sapl/static/fonts/fa-regular-400.6a9d786e.woff2 rename to sapl/static/sapl/fonts/fa-regular-400.6a9d786e.woff2 diff --git a/sapl/static/fonts/fa-regular-400.72f15fa7.woff b/sapl/static/sapl/fonts/fa-regular-400.72f15fa7.woff similarity index 100% rename from sapl/static/fonts/fa-regular-400.72f15fa7.woff rename to sapl/static/sapl/fonts/fa-regular-400.72f15fa7.woff diff --git a/sapl/static/fonts/fa-regular-400.80efa56b.eot b/sapl/static/sapl/fonts/fa-regular-400.80efa56b.eot similarity index 100% rename from sapl/static/fonts/fa-regular-400.80efa56b.eot rename to sapl/static/sapl/fonts/fa-regular-400.80efa56b.eot diff --git a/sapl/static/fonts/fa-regular-400.fcb220ee.ttf b/sapl/static/sapl/fonts/fa-regular-400.fcb220ee.ttf similarity index 100% rename from sapl/static/fonts/fa-regular-400.fcb220ee.ttf rename to sapl/static/sapl/fonts/fa-regular-400.fcb220ee.ttf diff --git a/sapl/static/fonts/fa-solid-900.20c189aa.ttf b/sapl/static/sapl/fonts/fa-solid-900.20c189aa.ttf similarity index 100% rename from sapl/static/fonts/fa-solid-900.20c189aa.ttf rename to sapl/static/sapl/fonts/fa-solid-900.20c189aa.ttf diff --git a/sapl/static/fonts/fa-solid-900.3638e62e.woff2 b/sapl/static/sapl/fonts/fa-solid-900.3638e62e.woff2 similarity index 100% rename from sapl/static/fonts/fa-solid-900.3638e62e.woff2 rename to sapl/static/sapl/fonts/fa-solid-900.3638e62e.woff2 diff --git a/sapl/static/fonts/fa-solid-900.9a52a4e9.eot b/sapl/static/sapl/fonts/fa-solid-900.9a52a4e9.eot similarity index 100% rename from sapl/static/fonts/fa-solid-900.9a52a4e9.eot rename to sapl/static/sapl/fonts/fa-solid-900.9a52a4e9.eot diff --git a/sapl/static/fonts/fa-solid-900.9c73abbd.woff b/sapl/static/sapl/fonts/fa-solid-900.9c73abbd.woff similarity index 100% rename from sapl/static/fonts/fa-solid-900.9c73abbd.woff rename to sapl/static/sapl/fonts/fa-solid-900.9c73abbd.woff diff --git a/sapl/static/img/arrow.png b/sapl/static/sapl/img/arrow.png similarity index 100% rename from sapl/static/img/arrow.png rename to sapl/static/sapl/img/arrow.png diff --git a/sapl/static/img/authenticated.png b/sapl/static/sapl/img/authenticated.png similarity index 100% rename from sapl/static/img/authenticated.png rename to sapl/static/sapl/img/authenticated.png diff --git a/sapl/static/img/avatar.png b/sapl/static/sapl/img/avatar.png similarity index 100% rename from sapl/static/img/avatar.png rename to sapl/static/sapl/img/avatar.png diff --git a/sapl/static/img/beta.png b/sapl/static/sapl/img/beta.png similarity index 100% rename from sapl/static/img/beta.png rename to sapl/static/sapl/img/beta.png diff --git a/sapl/static/img/brasao_transp.gif b/sapl/static/sapl/img/brasao_transp.gif similarity index 100% rename from sapl/static/img/brasao_transp.gif rename to sapl/static/sapl/img/brasao_transp.gif diff --git a/sapl/static/img/down_arrow_select.jpg b/sapl/static/sapl/img/down_arrow_select.jpg similarity index 100% rename from sapl/static/img/down_arrow_select.jpg rename to sapl/static/sapl/img/down_arrow_select.jpg diff --git a/sapl/static/img/etiqueta.png b/sapl/static/sapl/img/etiqueta.png similarity index 100% rename from sapl/static/img/etiqueta.png rename to sapl/static/sapl/img/etiqueta.png diff --git a/sapl/static/img/fa-brands-400.e4fed0a5.svg b/sapl/static/sapl/img/fa-brands-400.e4fed0a5.svg similarity index 100% rename from sapl/static/img/fa-brands-400.e4fed0a5.svg rename to sapl/static/sapl/img/fa-brands-400.e4fed0a5.svg diff --git a/sapl/static/img/fa-regular-400.304f31f4.svg b/sapl/static/sapl/img/fa-regular-400.304f31f4.svg similarity index 100% rename from sapl/static/img/fa-regular-400.304f31f4.svg rename to sapl/static/sapl/img/fa-regular-400.304f31f4.svg diff --git a/sapl/static/img/fa-solid-900.c8ea4c79.svg b/sapl/static/sapl/img/fa-solid-900.c8ea4c79.svg similarity index 100% rename from sapl/static/img/fa-solid-900.c8ea4c79.svg rename to sapl/static/sapl/img/fa-solid-900.c8ea4c79.svg diff --git a/sapl/static/img/favicon.ico b/sapl/static/sapl/img/favicon.ico similarity index 100% rename from sapl/static/img/favicon.ico rename to sapl/static/sapl/img/favicon.ico diff --git a/sapl/static/img/file.png b/sapl/static/sapl/img/file.png similarity index 100% rename from sapl/static/img/file.png rename to sapl/static/sapl/img/file.png diff --git a/sapl/static/img/hand-note.png b/sapl/static/sapl/img/hand-note.png similarity index 100% rename from sapl/static/img/hand-note.png rename to sapl/static/sapl/img/hand-note.png diff --git a/sapl/static/img/icon_comissoes.png b/sapl/static/sapl/img/icon_comissoes.png similarity index 100% rename from sapl/static/img/icon_comissoes.png rename to sapl/static/sapl/img/icon_comissoes.png diff --git a/sapl/static/img/icon_delete_white.png b/sapl/static/sapl/img/icon_delete_white.png similarity index 100% rename from sapl/static/img/icon_delete_white.png rename to sapl/static/sapl/img/icon_delete_white.png diff --git a/sapl/static/img/icon_materia_legislativa.png b/sapl/static/sapl/img/icon_materia_legislativa.png similarity index 100% rename from sapl/static/img/icon_materia_legislativa.png rename to sapl/static/sapl/img/icon_materia_legislativa.png diff --git a/sapl/static/img/icon_mesa_diretora.png b/sapl/static/sapl/img/icon_mesa_diretora.png similarity index 100% rename from sapl/static/img/icon_mesa_diretora.png rename to sapl/static/sapl/img/icon_mesa_diretora.png diff --git a/sapl/static/img/icon_normas_juridicas.png b/sapl/static/sapl/img/icon_normas_juridicas.png similarity index 100% rename from sapl/static/img/icon_normas_juridicas.png rename to sapl/static/sapl/img/icon_normas_juridicas.png diff --git a/sapl/static/img/icon_parlamentares.png b/sapl/static/sapl/img/icon_parlamentares.png similarity index 100% rename from sapl/static/img/icon_parlamentares.png rename to sapl/static/sapl/img/icon_parlamentares.png diff --git a/sapl/static/img/icon_pautas.png b/sapl/static/sapl/img/icon_pautas.png similarity index 100% rename from sapl/static/img/icon_pautas.png rename to sapl/static/sapl/img/icon_pautas.png diff --git a/sapl/static/img/icon_plenarias.png b/sapl/static/sapl/img/icon_plenarias.png similarity index 100% rename from sapl/static/img/icon_plenarias.png rename to sapl/static/sapl/img/icon_plenarias.png diff --git a/sapl/static/img/icon_relatorios.png b/sapl/static/sapl/img/icon_relatorios.png similarity index 100% rename from sapl/static/img/icon_relatorios.png rename to sapl/static/sapl/img/icon_relatorios.png diff --git a/sapl/static/img/icon_save_white.png b/sapl/static/sapl/img/icon_save_white.png similarity index 100% rename from sapl/static/img/icon_save_white.png rename to sapl/static/sapl/img/icon_save_white.png diff --git a/sapl/static/img/lexml.gif b/sapl/static/sapl/img/lexml.gif similarity index 100% rename from sapl/static/img/lexml.gif rename to sapl/static/sapl/img/lexml.gif diff --git a/sapl/static/img/logo.png b/sapl/static/sapl/img/logo.png similarity index 100% rename from sapl/static/img/logo.png rename to sapl/static/sapl/img/logo.png diff --git a/sapl/static/img/logo_cc.png b/sapl/static/sapl/img/logo_cc.png similarity index 100% rename from sapl/static/img/logo_cc.png rename to sapl/static/sapl/img/logo_cc.png diff --git a/sapl/static/img/logo_interlegis.png b/sapl/static/sapl/img/logo_interlegis.png similarity index 100% rename from sapl/static/img/logo_interlegis.png rename to sapl/static/sapl/img/logo_interlegis.png diff --git a/sapl/static/img/manual.png b/sapl/static/sapl/img/manual.png similarity index 100% rename from sapl/static/img/manual.png rename to sapl/static/sapl/img/manual.png diff --git a/sapl/static/img/pdflogo.png b/sapl/static/sapl/img/pdflogo.png similarity index 100% rename from sapl/static/img/pdflogo.png rename to sapl/static/sapl/img/pdflogo.png diff --git a/sapl/static/img/perfil.png b/sapl/static/sapl/img/perfil.png similarity index 100% rename from sapl/static/img/perfil.png rename to sapl/static/sapl/img/perfil.png diff --git a/sapl/static/img/search-gray.png b/sapl/static/sapl/img/search-gray.png similarity index 100% rename from sapl/static/img/search-gray.png rename to sapl/static/sapl/img/search-gray.png diff --git a/sapl/static/img/search.png b/sapl/static/sapl/img/search.png similarity index 100% rename from sapl/static/img/search.png rename to sapl/static/sapl/img/search.png diff --git a/sapl/static/img/ui-icons_2694e8_256x240.274157b3.png b/sapl/static/sapl/img/ui-icons_2694e8_256x240.274157b3.png similarity index 100% rename from sapl/static/img/ui-icons_2694e8_256x240.274157b3.png rename to sapl/static/sapl/img/ui-icons_2694e8_256x240.274157b3.png diff --git a/sapl/static/img/ui-icons_2e83ff_256x240.602e5d4d.png b/sapl/static/sapl/img/ui-icons_2e83ff_256x240.602e5d4d.png similarity index 100% rename from sapl/static/img/ui-icons_2e83ff_256x240.602e5d4d.png rename to sapl/static/sapl/img/ui-icons_2e83ff_256x240.602e5d4d.png diff --git a/sapl/static/img/ui-icons_3d80b3_256x240.24fcd129.png b/sapl/static/sapl/img/ui-icons_3d80b3_256x240.24fcd129.png similarity index 100% rename from sapl/static/img/ui-icons_3d80b3_256x240.24fcd129.png rename to sapl/static/sapl/img/ui-icons_3d80b3_256x240.24fcd129.png diff --git a/sapl/static/img/ui-icons_72a7cf_256x240.55a4c5ce.png b/sapl/static/sapl/img/ui-icons_72a7cf_256x240.55a4c5ce.png similarity index 100% rename from sapl/static/img/ui-icons_72a7cf_256x240.55a4c5ce.png rename to sapl/static/sapl/img/ui-icons_72a7cf_256x240.55a4c5ce.png diff --git a/sapl/static/img/ui-icons_ffffff_256x240.bb2a88be.png b/sapl/static/sapl/img/ui-icons_ffffff_256x240.bb2a88be.png similarity index 100% rename from sapl/static/img/ui-icons_ffffff_256x240.bb2a88be.png rename to sapl/static/sapl/img/ui-icons_ffffff_256x240.bb2a88be.png diff --git a/sapl/static/img/user.png b/sapl/static/sapl/img/user.png similarity index 100% rename from sapl/static/img/user.png rename to sapl/static/sapl/img/user.png diff --git a/sapl/static/js/chunk-vendors.406f40ec.js b/sapl/static/sapl/js/chunk-vendors.406f40ec.js similarity index 100% rename from sapl/static/js/chunk-vendors.406f40ec.js rename to sapl/static/sapl/js/chunk-vendors.406f40ec.js diff --git a/sapl/static/js/compilacao.9bf86742.js b/sapl/static/sapl/js/compilacao.9db618b1.js similarity index 99% rename from sapl/static/js/compilacao.9bf86742.js rename to sapl/static/sapl/js/compilacao.9db618b1.js index 8f8bc266b..850c64bc5 100644 --- a/sapl/static/js/compilacao.9bf86742.js +++ b/sapl/static/sapl/js/compilacao.9db618b1.js @@ -136,7 +136,7 @@ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/static/"; +/******/ __webpack_require__.p = "/static/sapl/"; /******/ /******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); diff --git a/sapl/static/js/global.594a728f.js b/sapl/static/sapl/js/global.2675c725.js similarity index 99% rename from sapl/static/js/global.594a728f.js rename to sapl/static/sapl/js/global.2675c725.js index f519005c5..6344c59e6 100644 --- a/sapl/static/js/global.594a728f.js +++ b/sapl/static/sapl/js/global.2675c725.js @@ -136,7 +136,7 @@ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/static/"; +/******/ __webpack_require__.p = "/static/sapl/"; /******/ /******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); diff --git a/sapl/static/js/painel.518bdc14.js b/sapl/static/sapl/js/painel.ddd6e27e.js similarity index 99% rename from sapl/static/js/painel.518bdc14.js rename to sapl/static/sapl/js/painel.ddd6e27e.js index 58d298a1c..d77e2638a 100644 --- a/sapl/static/js/painel.518bdc14.js +++ b/sapl/static/sapl/js/painel.ddd6e27e.js @@ -136,7 +136,7 @@ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/static/"; +/******/ __webpack_require__.p = "/static/sapl/"; /******/ /******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); diff --git a/sapl/webpack-stats.json b/sapl/webpack-stats.json new file mode 100644 index 000000000..e28ce906e --- /dev/null +++ b/sapl/webpack-stats.json @@ -0,0 +1 @@ +{"status":"done","publicPath":"/static/sapl/","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.f109b7f2.css","publicPath":"/static/sapl/css/chunk-vendors.f109b7f2.css","path":"../sapl/sapl/static/sapl/css/chunk-vendors.f109b7f2.css"},{"name":"js/chunk-vendors.406f40ec.js","publicPath":"/static/sapl/js/chunk-vendors.406f40ec.js","path":"../sapl/sapl/static/sapl/js/chunk-vendors.406f40ec.js"}],"compilacao":[{"name":"css/compilacao.1e862898.css","publicPath":"/static/sapl/css/compilacao.1e862898.css","path":"../sapl/sapl/static/sapl/css/compilacao.1e862898.css"},{"name":"js/compilacao.9db618b1.js","publicPath":"/static/sapl/js/compilacao.9db618b1.js","path":"../sapl/sapl/static/sapl/js/compilacao.9db618b1.js"}],"global":[{"name":"css/global.d2e0a784.css","publicPath":"/static/sapl/css/global.d2e0a784.css","path":"../sapl/sapl/static/sapl/css/global.d2e0a784.css"},{"name":"js/global.2675c725.js","publicPath":"/static/sapl/js/global.2675c725.js","path":"../sapl/sapl/static/sapl/js/global.2675c725.js"}],"painel":[{"name":"css/painel.61177241.css","publicPath":"/static/sapl/css/painel.61177241.css","path":"../sapl/sapl/static/sapl/css/painel.61177241.css"},{"name":"js/painel.ddd6e27e.js","publicPath":"/static/sapl/js/painel.ddd6e27e.js","path":"../sapl/sapl/static/sapl/js/painel.ddd6e27e.js"}]}} \ No newline at end of file diff --git a/webpack-stats.json b/webpack-stats.json deleted file mode 100644 index aaa000102..000000000 --- a/webpack-stats.json +++ /dev/null @@ -1 +0,0 @@ -{"status":"done","publicPath":"/static/","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.f109b7f2.css","publicPath":"/static/css/chunk-vendors.f109b7f2.css","path":"../sapl/sapl/static/css/chunk-vendors.f109b7f2.css"},{"name":"js/chunk-vendors.406f40ec.js","publicPath":"/static/js/chunk-vendors.406f40ec.js","path":"../sapl/sapl/static/js/chunk-vendors.406f40ec.js"}],"compilacao":[{"name":"css/compilacao.1e862898.css","publicPath":"/static/css/compilacao.1e862898.css","path":"../sapl/sapl/static/css/compilacao.1e862898.css"},{"name":"js/compilacao.9bf86742.js","publicPath":"/static/js/compilacao.9bf86742.js","path":"../sapl/sapl/static/js/compilacao.9bf86742.js"}],"global":[{"name":"css/global.d2e0a784.css","publicPath":"/static/css/global.d2e0a784.css","path":"../sapl/sapl/static/css/global.d2e0a784.css"},{"name":"js/global.594a728f.js","publicPath":"/static/js/global.594a728f.js","path":"../sapl/sapl/static/js/global.594a728f.js"}],"painel":[{"name":"css/painel.61177241.css","publicPath":"/static/css/painel.61177241.css","path":"../sapl/sapl/static/css/painel.61177241.css"},{"name":"js/painel.518bdc14.js","publicPath":"/static/js/painel.518bdc14.js","path":"../sapl/sapl/static/js/painel.518bdc14.js"}]}} \ No newline at end of file From c32ebb9dcf8848209347daf214a6bd3156dfd7a3 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Thu, 14 Feb 2019 23:57:11 -0200 Subject: [PATCH 14/27] altera local da leitura do webpack_stats.json --- sapl/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapl/settings.py b/sapl/settings.py index a44b3f73e..b50f271a7 100755 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -273,7 +273,7 @@ WEBPACK_LOADER = { 'DEFAULT': { 'CACHE': not DEBUG, 'BUNDLE_DIR_NAME': 'sapl/static/', - 'STATS_FILE': (PROJECT_DIR if not FRONTEND_CUSTOM else PROJECT_DIR.parent.child('sapl-frontend')).child('webpack-stats.json'), + 'STATS_FILE': (BASE_DIR if not FRONTEND_CUSTOM else PROJECT_DIR.parent.child('sapl-frontend')).child('webpack-stats.json'), 'POLL_INTERVAL': 0.1, 'TIMEOUT': None, 'IGNORE': [r'.+\.hot-update.js', r'.+\.map'] From 312ee68cf6cf1e070002eff56e48337388546f53 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Fri, 15 Feb 2019 08:58:05 -0200 Subject: [PATCH 15/27] =?UTF-8?q?adequa=20captura=20de=20imagem=20a=20mund?= =?UTF-8?q?an=C3=A7a=20de=20local=20do=20sapl-frontend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/base/tests/test_login.py | 2 +- sapl/urls.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sapl/base/tests/test_login.py b/sapl/base/tests/test_login.py index 7fe7672e5..3122fcb7e 100755 --- a/sapl/base/tests/test_login.py +++ b/sapl/base/tests/test_login.py @@ -13,7 +13,7 @@ def user(): def test_login_aparece_na_barra_para_usuario_nao_logado(client): response = client.get('/') - assert '' in str( + assert '' in str( response.content) diff --git a/sapl/urls.py b/sapl/urls.py index 904b4357e..12528e07e 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -60,7 +60,7 @@ urlpatterns = [ url(r'', include(sapl.api.urls)), url(r'^favicon\.ico$', RedirectView.as_view( - url='/static/img/favicon.ico', permanent=True)), + url='/static/sapl/img/favicon.ico', permanent=True)), url(r'', include(sapl.redireciona_urls.urls)), ] From fba688f72ccd46c76a37a14ac261b44dd825e6bf Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Fri, 15 Feb 2019 10:32:46 -0200 Subject: [PATCH 16/27] ajuste de webpack --- sapl/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapl/settings.py b/sapl/settings.py index b50f271a7..a85b6b18d 100755 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -272,7 +272,7 @@ FRONTEND_CUSTOM = config('FRONTEND_CUSTOM', default=False, cast=bool) WEBPACK_LOADER = { 'DEFAULT': { 'CACHE': not DEBUG, - 'BUNDLE_DIR_NAME': 'sapl/static/', + 'BUNDLE_DIR_NAME': 'sapl/static/sapl/', 'STATS_FILE': (BASE_DIR if not FRONTEND_CUSTOM else PROJECT_DIR.parent.child('sapl-frontend')).child('webpack-stats.json'), 'POLL_INTERVAL': 0.1, 'TIMEOUT': None, From 55494e17913ffeb9746a4c8330d5f63a2a8579a3 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Fri, 15 Feb 2019 10:45:16 -0200 Subject: [PATCH 17/27] Fix #2493 --- sapl/templates/compilacao/text_list_blocoalteracao.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapl/templates/compilacao/text_list_blocoalteracao.html b/sapl/templates/compilacao/text_list_blocoalteracao.html index ed9876fd9..adc6ff2a4 100644 --- a/sapl/templates/compilacao/text_list_blocoalteracao.html +++ b/sapl/templates/compilacao/text_list_blocoalteracao.html @@ -20,15 +20,15 @@ {% if ch.rotulo %} {{ ch.rotulo }} {{ ch.tipo_dispositivo.rotulo_sufixo_html|safe }} - {{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{{ ch.texto|safe }} + {{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{% if ch.texto_atualizador %}{{ ch.texto_atualizador|safe }}{%else%}{{ ch.texto|safe }}{% endif %} {% elif not ch.rotulo and not ch.auto_inserido %} {{ ch.tipo_dispositivo.rotulo_sufixo_html|safe }} - {{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{{ ch.texto|safe }} + {{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{% if ch.texto_atualizador %}{{ ch.texto_atualizador|safe }}{%else%}{{ ch.texto|safe }}{% endif %} {% else %} {{ ch.tipo_dispositivo.rotulo_sufixo_html|safe }} - {{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{{ ch.texto|safe }} + {{ ch.tipo_dispositivo.texto_prefixo_html|safe }}{% if ch.texto_atualizador %}{{ ch.texto_atualizador|safe }}{%else%}{{ ch.texto|safe }}{% endif %} {% endif %} From 844af1f5b2883bb9a7fff7fd51f50c05dad30e52 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Fri, 15 Feb 2019 17:04:31 -0200 Subject: [PATCH 18/27] ajustes de layout no painel --- .gitignore | 2 +- sapl/static/sapl/css/painel.61177241.css | 1 - sapl/static/sapl/js/compilacao.9db618b1.js | 240 --------------------- sapl/templates/painel/index.html | 72 ++++--- sapl/webpack-stats.json | 2 +- 5 files changed, 41 insertions(+), 276 deletions(-) delete mode 100644 sapl/static/sapl/css/painel.61177241.css delete mode 100644 sapl/static/sapl/js/compilacao.9db618b1.js diff --git a/.gitignore b/.gitignore index c656b3b8f..e59540379 100644 --- a/.gitignore +++ b/.gitignore @@ -54,7 +54,7 @@ coverage.xml # Django stuff: *.log - +sapl.log.* *.swp # Sphinx documentation diff --git a/sapl/static/sapl/css/painel.61177241.css b/sapl/static/sapl/css/painel.61177241.css deleted file mode 100644 index 1bd8169d7..000000000 --- a/sapl/static/sapl/css/painel.61177241.css +++ /dev/null @@ -1 +0,0 @@ -.painel-principal{background:#1c1b1b;font-family:Verdana}.painel-principal .text-title{color:#4fa64d}.painel-principal .text-subtitle{color:#459170}.painel-principal .text-value{color:#fff}.painel-principal .logo-painel{max-width:100%}.painel-principal .painels{-ms-flex-wrap:wrap;flex-wrap:wrap} \ No newline at end of file diff --git a/sapl/static/sapl/js/compilacao.9db618b1.js b/sapl/static/sapl/js/compilacao.9db618b1.js deleted file mode 100644 index 850c64bc5..000000000 --- a/sapl/static/sapl/js/compilacao.9db618b1.js +++ /dev/null @@ -1,240 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ function webpackJsonpCallback(data) { -/******/ var chunkIds = data[0]; -/******/ var moreModules = data[1]; -/******/ var executeModules = data[2]; -/******/ -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(data); -/******/ -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ deferredModules.push.apply(deferredModules, executeModules || []); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); -/******/ }; -/******/ function checkDeferredModules() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ return result; -/******/ } -/******/ -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded and loading chunks -/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded -/******/ var installedChunks = { -/******/ "compilacao": 0 -/******/ }; -/******/ -/******/ var deferredModules = []; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/static/sapl/"; -/******/ -/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; -/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); -/******/ jsonpArray.push = webpackJsonpCallback; -/******/ jsonpArray = jsonpArray.slice(); -/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); -/******/ var parentJsonpFunction = oldJsonpFunction; -/******/ -/******/ -/******/ // add entry module to deferred list -/******/ deferredModules.push([1,"chunk-vendors"]); -/******/ // run deferred modules when ready -/******/ return checkDeferredModules(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "08cb": -/*!*******************************************************!*\ - !*** ./src/apps/compilacao/js/old/compilacao_view.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(jQuery) {/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/web.dom.iterable */ \"ac6a\");\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_search__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.search */ \"386d\");\n/* harmony import */ var core_js_modules_es6_regexp_search__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_search__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.array.iterator */ \"cadf\");\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es6_promise__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es6.promise */ \"551c\");\n/* harmony import */ var core_js_modules_es6_promise__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_promise__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es6.object.assign */ \"f751\");\n/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_es7_promise_finally__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es7.promise.finally */ \"097d\");\n/* harmony import */ var core_js_modules_es7_promise_finally__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es7_promise_finally__WEBPACK_IMPORTED_MODULE_5__);\n\n\n\n\n\n\nvar _$ = window.$;\n\nvar JsDiff = __webpack_require__(/*! diff */ \"bf68\");\n\nfunction isElementInViewport(el) {\n if (typeof jQuery === 'function' && el instanceof jQuery) {\n el = el[0];\n }\n\n var rect = el.getBoundingClientRect();\n return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);\n}\n\nfunction textoMultiVigente(item, diff) {\n var elv = null;\n\n var ldpts = _$('.dptt');\n\n for (var i = 0; i < ldpts.length; i++) {\n if (_$(ldpts[i]).hasClass('displaynone')) continue;\n\n if (isElementInViewport(ldpts[i])) {\n if (i + 1 < ldpts.length) elv = ldpts[i + 1];else {\n elv = ldpts[i];\n }\n break;\n }\n }\n\n _$('.cp .tipo-vigencias a').removeClass('selected');\n\n _$(item).addClass('selected');\n\n _$('.dptt.desativado').removeClass('displaynone');\n\n _$('.dtxt').removeClass('displaynone');\n\n _$('.dtxt.diff').remove();\n\n _$('.nota-alteracao').removeClass('displaynone');\n\n if (diff) {\n _$('.dtxt[id^=\"da\"').each(function () {\n if (_$(this).html().search(/<\\/\\w+>/g) > 0) {\n return;\n }\n\n var pk = _$(this).attr('pk');\n\n var pks = _$(this).attr('pks');\n\n var a = _$('#d' + pks).contents().filter(function () {\n return this.nodeType === Node.TEXT_NODE;\n });\n\n var b = _$('#da' + pk).contents().filter(function () {\n return this.nodeType === Node.TEXT_NODE;\n });\n\n var diff = JsDiff.diffWordsWithSpace(_$(a).text(), _$(b).text());\n\n if (diff.length > 0) {\n _$('#d' + pks).closest('.desativado').addClass('displaynone');\n\n var clone = _$('#da' + pk).clone();\n\n _$('#da' + pk).after(clone);\n\n _$('#da' + pk).addClass('displaynone');\n\n _$(clone).addClass('diff').html('');\n\n diff.forEach(function (part) {\n // let color = part.added ? '#018' : part.removed ? '#faa' : ''\n var span = document.createElement('span');\n var value = part.value;\n\n if (part.removed) {\n _$(span).addClass('desativado');\n\n value += ' ';\n } else if (part.added) {\n _$(span).addClass('added');\n }\n\n span.appendChild(document.createTextNode(value));\n\n _$(clone).append(span);\n });\n }\n }); // textoVigente(item, true)\n\n }\n\n if (elv) {\n try {\n _$('html, body').animate({\n scrollTop: _$(elv).parent().offset().top - 60\n }, 0);\n } catch (err) {\n console.log(err);\n }\n }\n}\n\nfunction textoVigente(item, link) {\n var elv = null;\n\n var ldpts = _$('.dptt');\n\n for (var i = 0; i < ldpts.length; i++) {\n if (_$(ldpts[i]).hasClass('displaynone')) continue;\n\n if (isElementInViewport(ldpts[i])) {\n if (i + 1 < ldpts.length) elv = ldpts[i + 1];else {\n elv = ldpts[i];\n }\n break;\n }\n }\n\n _$('.cp .tipo-vigencias a').removeClass('selected');\n\n _$(item).addClass('selected');\n\n _$('.dptt.desativado').addClass('displaynone');\n\n _$('.nota-alteracao').removeClass('displaynone');\n\n if (!link) _$('.nota-alteracao').addClass('displaynone');\n\n if (elv) {\n try {\n _$('html, body').animate({\n scrollTop: _$(elv).parent().offset().top - 60\n }, 0);\n } catch (err) {\n console.log(err);\n }\n }\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n isElementInViewport: isElementInViewport,\n textoMultiVigente: textoMultiVigente,\n textoVigente: textoVigente\n});\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ \"1157\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDhjYi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy9hcHBzL2NvbXBpbGFjYW8vanMvb2xkL2NvbXBpbGFjYW9fdmlldy5qcz8wOGNiIl0sInNvdXJjZXNDb250ZW50IjpbImxldCBfJCA9IHdpbmRvdy4kXG5sZXQgSnNEaWZmID0gcmVxdWlyZSgnZGlmZicpXG5cbmZ1bmN0aW9uIGlzRWxlbWVudEluVmlld3BvcnQgKGVsKSB7XG4gIGlmICh0eXBlb2YgalF1ZXJ5ID09PSAnZnVuY3Rpb24nICYmIGVsIGluc3RhbmNlb2YgalF1ZXJ5KSB7XG4gICAgZWwgPSBlbFswXVxuICB9XG5cbiAgbGV0IHJlY3QgPSBlbC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKVxuXG4gIHJldHVybiAoXG4gICAgcmVjdC50b3AgPj0gMCAmJlxuICAgIHJlY3QubGVmdCA+PSAwICYmXG4gICAgcmVjdC5ib3R0b20gPD1cbiAgICAgICh3aW5kb3cuaW5uZXJIZWlnaHQgfHwgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LmNsaWVudEhlaWdodCkgJiZcbiAgICByZWN0LnJpZ2h0IDw9ICh3aW5kb3cuaW5uZXJXaWR0aCB8fCBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50V2lkdGgpXG4gIClcbn1cblxuZnVuY3Rpb24gdGV4dG9NdWx0aVZpZ2VudGUgKGl0ZW0sIGRpZmYpIHtcbiAgbGV0IGVsdiA9IG51bGxcbiAgbGV0IGxkcHRzID0gXyQoJy5kcHR0JylcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZHB0cy5sZW5ndGg7IGkrKykge1xuICAgIGlmIChfJChsZHB0c1tpXSkuaGFzQ2xhc3MoJ2Rpc3BsYXlub25lJykpIGNvbnRpbnVlXG4gICAgaWYgKGlzRWxlbWVudEluVmlld3BvcnQobGRwdHNbaV0pKSB7XG4gICAgICBpZiAoaSArIDEgPCBsZHB0cy5sZW5ndGgpIGVsdiA9IGxkcHRzW2kgKyAxXVxuICAgICAgZWxzZSB7XG4gICAgICAgIGVsdiA9IGxkcHRzW2ldXG4gICAgICB9XG4gICAgICBicmVha1xuICAgIH1cbiAgfVxuXG4gIF8kKCcuY3AgLnRpcG8tdmlnZW5jaWFzIGEnKS5yZW1vdmVDbGFzcygnc2VsZWN0ZWQnKVxuICBfJChpdGVtKS5hZGRDbGFzcygnc2VsZWN0ZWQnKVxuICBfJCgnLmRwdHQuZGVzYXRpdmFkbycpLnJlbW92ZUNsYXNzKCdkaXNwbGF5bm9uZScpXG4gIF8kKCcuZHR4dCcpLnJlbW92ZUNsYXNzKCdkaXNwbGF5bm9uZScpXG4gIF8kKCcuZHR4dC5kaWZmJykucmVtb3ZlKClcbiAgXyQoJy5ub3RhLWFsdGVyYWNhbycpLnJlbW92ZUNsYXNzKCdkaXNwbGF5bm9uZScpXG5cbiAgaWYgKGRpZmYpIHtcbiAgICBfJCgnLmR0eHRbaWRePVwiZGFcIicpLmVhY2goZnVuY3Rpb24gKCkge1xuICAgICAgaWYgKF8kKHRoaXMpXG4gICAgICAgIC5odG1sKClcbiAgICAgICAgLnNlYXJjaCgvPFxcL1xcdys+L2cpID4gMCkge1xuICAgICAgICByZXR1cm5cbiAgICAgIH1cblxuICAgICAgbGV0IHBrID0gXyQodGhpcykuYXR0cigncGsnKVxuICAgICAgbGV0IHBrcyA9IF8kKHRoaXMpLmF0dHIoJ3BrcycpXG5cbiAgICAgIGxldCBhID0gXyQoJyNkJyArIHBrcylcbiAgICAgICAgLmNvbnRlbnRzKClcbiAgICAgICAgLmZpbHRlcihmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgcmV0dXJuIHRoaXMubm9kZVR5cGUgPT09IE5vZGUuVEVYVF9OT0RFXG4gICAgICAgIH0pXG4gICAgICBsZXQgYiA9IF8kKCcjZGEnICsgcGspXG4gICAgICAgIC5jb250ZW50cygpXG4gICAgICAgIC5maWx0ZXIoZnVuY3Rpb24gKCkge1xuICAgICAgICAgIHJldHVybiB0aGlzLm5vZGVUeXBlID09PSBOb2RlLlRFWFRfTk9ERVxuICAgICAgICB9KVxuXG4gICAgICBsZXQgZGlmZiA9IEpzRGlmZi5kaWZmV29yZHNXaXRoU3BhY2UoXyQoYSkudGV4dCgpLCBfJChiKS50ZXh0KCkpXG5cbiAgICAgIGlmIChkaWZmLmxlbmd0aCA+IDApIHtcbiAgICAgICAgXyQoJyNkJyArIHBrcylcbiAgICAgICAgICAuY2xvc2VzdCgnLmRlc2F0aXZhZG8nKVxuICAgICAgICAgIC5hZGRDbGFzcygnZGlzcGxheW5vbmUnKVxuXG4gICAgICAgIGxldCBjbG9uZSA9IF8kKCcjZGEnICsgcGspLmNsb25lKClcbiAgICAgICAgXyQoJyNkYScgKyBwaykuYWZ0ZXIoY2xvbmUpXG4gICAgICAgIF8kKCcjZGEnICsgcGspLmFkZENsYXNzKCdkaXNwbGF5bm9uZScpXG4gICAgICAgIF8kKGNsb25lKVxuICAgICAgICAgIC5hZGRDbGFzcygnZGlmZicpXG4gICAgICAgICAgLmh0bWwoJycpXG5cbiAgICAgICAgZGlmZi5mb3JFYWNoKGZ1bmN0aW9uIChwYXJ0KSB7XG4gICAgICAgICAgLy8gbGV0IGNvbG9yID0gcGFydC5hZGRlZCA/ICcjMDE4JyA6IHBhcnQucmVtb3ZlZCA/ICcjZmFhJyA6ICcnXG5cbiAgICAgICAgICBsZXQgc3BhbiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NwYW4nKVxuXG4gICAgICAgICAgbGV0IHZhbHVlID0gcGFydC52YWx1ZVxuXG4gICAgICAgICAgaWYgKHBhcnQucmVtb3ZlZCkge1xuICAgICAgICAgICAgXyQoc3BhbikuYWRkQ2xhc3MoJ2Rlc2F0aXZhZG8nKVxuICAgICAgICAgICAgdmFsdWUgKz0gJyAnXG4gICAgICAgICAgfSBlbHNlIGlmIChwYXJ0LmFkZGVkKSB7XG4gICAgICAgICAgICBfJChzcGFuKS5hZGRDbGFzcygnYWRkZWQnKVxuICAgICAgICAgIH1cblxuICAgICAgICAgIHNwYW4uYXBwZW5kQ2hpbGQoZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUodmFsdWUpKVxuICAgICAgICAgIF8kKGNsb25lKS5hcHBlbmQoc3BhbilcbiAgICAgICAgfSlcbiAgICAgIH1cbiAgICB9KVxuICAgIC8vIHRleHRvVmlnZW50ZShpdGVtLCB0cnVlKVxuICB9XG5cbiAgaWYgKGVsdikge1xuICAgIHRyeSB7XG4gICAgICBfJCgnaHRtbCwgYm9keScpLmFuaW1hdGUoXG4gICAgICAgIHtcbiAgICAgICAgICBzY3JvbGxUb3A6XG4gICAgICAgICAgICBfJChlbHYpXG4gICAgICAgICAgICAgIC5wYXJlbnQoKVxuICAgICAgICAgICAgICAub2Zmc2V0KCkudG9wIC0gNjBcbiAgICAgICAgfSxcbiAgICAgICAgMFxuICAgICAgKVxuICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgY29uc29sZS5sb2coZXJyKVxuICAgIH1cbiAgfVxufVxuXG5mdW5jdGlvbiB0ZXh0b1ZpZ2VudGUgKGl0ZW0sIGxpbmspIHtcbiAgbGV0IGVsdiA9IG51bGxcbiAgbGV0IGxkcHRzID0gXyQoJy5kcHR0JylcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZHB0cy5sZW5ndGg7IGkrKykge1xuICAgIGlmIChfJChsZHB0c1tpXSkuaGFzQ2xhc3MoJ2Rpc3BsYXlub25lJykpIGNvbnRpbnVlXG4gICAgaWYgKGlzRWxlbWVudEluVmlld3BvcnQobGRwdHNbaV0pKSB7XG4gICAgICBpZiAoaSArIDEgPCBsZHB0cy5sZW5ndGgpIGVsdiA9IGxkcHRzW2kgKyAxXVxuICAgICAgZWxzZSB7XG4gICAgICAgIGVsdiA9IGxkcHRzW2ldXG4gICAgICB9XG4gICAgICBicmVha1xuICAgIH1cbiAgfVxuXG4gIF8kKCcuY3AgLnRpcG8tdmlnZW5jaWFzIGEnKS5yZW1vdmVDbGFzcygnc2VsZWN0ZWQnKVxuICBfJChpdGVtKS5hZGRDbGFzcygnc2VsZWN0ZWQnKVxuXG4gIF8kKCcuZHB0dC5kZXNhdGl2YWRvJykuYWRkQ2xhc3MoJ2Rpc3BsYXlub25lJylcbiAgXyQoJy5ub3RhLWFsdGVyYWNhbycpLnJlbW92ZUNsYXNzKCdkaXNwbGF5bm9uZScpXG4gIGlmICghbGluaykgXyQoJy5ub3RhLWFsdGVyYWNhbycpLmFkZENsYXNzKCdkaXNwbGF5bm9uZScpXG5cbiAgaWYgKGVsdikge1xuICAgIHRyeSB7XG4gICAgICBfJCgnaHRtbCwgYm9keScpLmFuaW1hdGUoXG4gICAgICAgIHtcbiAgICAgICAgICBzY3JvbGxUb3A6XG4gICAgICAgICAgICBfJChlbHYpXG4gICAgICAgICAgICAgIC5wYXJlbnQoKVxuICAgICAgICAgICAgICAub2Zmc2V0KCkudG9wIC0gNjBcbiAgICAgICAgfSxcbiAgICAgICAgMFxuICAgICAgKVxuICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgY29uc29sZS5sb2coZXJyKVxuICAgIH1cbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCB7XG4gIGlzRWxlbWVudEluVmlld3BvcnQsXG4gIHRleHRvTXVsdGlWaWdlbnRlLFxuICB0ZXh0b1ZpZ2VudGVcbn1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUFBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFBQTtBQUNBO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBR0E7QUFDQTtBQUNBO0FBQUE7QUFHQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBR0E7QUFDQTtBQUFBO0FBQ0E7QUFBQTtBQUNBO0FBQUE7QUFDQTtBQUdBO0FBQ0E7QUFFQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFEQTtBQVFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQURBO0FBUUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFIQTtBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///08cb\n"); - -/***/ }), - -/***/ 1: -/*!*******************************************!*\ - !*** multi ./src/apps/compilacao/main.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! ./src/apps/compilacao/main.js */"ef7e"); - - -/***/ }), - -/***/ "42f9": -/*!**************************************************!*\ - !*** ./src/apps/compilacao/js/old/compilacao.js ***! - \**************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _home_leandro_desenvolvimento_envs_sapl_frontend_node_modules_babel_runtime_corejs2_core_js_json_stringify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime-corejs2/core-js/json/stringify */ \"f499\");\n/* harmony import */ var _home_leandro_desenvolvimento_envs_sapl_frontend_node_modules_babel_runtime_corejs2_core_js_json_stringify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_home_leandro_desenvolvimento_envs_sapl_frontend_node_modules_babel_runtime_corejs2_core_js_json_stringify__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_array_find__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.array.find */ \"7514\");\n/* harmony import */ var core_js_modules_es6_array_find__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_find__WEBPACK_IMPORTED_MODULE_1__);\n\n\nvar _$ = window.$;\n\nfunction SetCookie(cookieName, cookieValue, nDays) {\n var today = new Date();\n var expire = new Date();\n if (nDays === null || nDays === 0) nDays = 1;\n expire.setTime(today.getTime() + 3600000 * 24 * nDays);\n document.cookie = cookieName + '=' + escape(cookieValue) + ';expires=' + expire.toGMTString();\n}\n\nfunction ReadCookie(cookieName) {\n var theCookie = ' ' + document.cookie;\n var ind = theCookie.indexOf(' ' + cookieName + '=');\n if (ind === -1) ind = theCookie.indexOf(';' + cookieName + '=');\n if (ind === -1 || cookieName === '') return '';\n var ind1 = theCookie.indexOf(';', ind + 1);\n if (ind1 === -1) ind1 = theCookie.length;\n return unescape(theCookie.substring(ind + cookieName.length + 2, ind1));\n}\n\nfunction insertWaitAjax(element) {\n // jQuery(element).append('
')\n _$(element).append('
');\n}\n\nfunction DispositivoSearch(opts) {\n _$(function () {\n var formData = {};\n\n var containerDs = _$('body').children('#container_ds');\n\n if (containerDs.length > 0) {\n _$(containerDs).remove();\n }\n\n containerDs = _$('
');\n\n _$('body').prepend(containerDs);\n\n var fields = _$('[data-sapl-ta=\"DispositivoSearch\"]');\n\n fields.each(function () {\n var field = _$(this);\n\n var dataTypeSelection = field.attr('data-type-selection');\n var dataField = field.attr('data-field');\n var dataFunction = field.attr('data-function');\n\n var onChangeFieldSelects = function onChangeFieldSelects(event) {\n if (dataTypeSelection === 'checkbox') {\n var tas = field.find('input[name=\"ta_select_all\"]'); // tas - Textos Articulados\n\n tas.off();\n tas.on('change', function (event) {\n _$(this).closest('ul').find('input[name=\"' + dataField + '\"]').prop('checked', this.checked); // _$(this).prop('checked', false)\n\n });\n } else {\n var dpts = field.find('input');\n dpts.off();\n dpts.attr('type', 'hidden');\n\n _$('').insertBefore(dpts).append(_$('×')).on('click', function () {\n if (_$(this).closest('ul').find('li').length === 2) {\n _$(this).closest('ul').remove();\n } else {\n _$(this).closest('li').remove();\n }\n });\n }\n };\n\n onChangeFieldSelects();\n\n var onChangeParamTA = function onChangeParamTA(event) {\n var tipoTa = _$('select[name=\"tipo_ta\"]').val();\n\n var tipoModel = _$('select[name=\"tipo_model\"]').val();\n\n var numTa = _$('input[name=\"num_ta\"]').val();\n\n var anoTa = _$('input[name=\"ano_ta\"]').val();\n\n var dispositivosInternos = _$('input[name=\"dispositivos_internos\"]:checked').val();\n\n var rotuloDispositivo = _$('input[name=\"rotulo_dispositivo\"]').val();\n\n var textoDispositivo = _$('input[name=\"texto_dispositivo\"]').val();\n\n var maxResults = _$('select[name=\"max_results\"]').val();\n\n var url = '';\n\n if (rotuloDispositivo.length > 0 || textoDispositivo.length > 0) {\n _$('input[name=\"dispositivos_internos\"]').prop('disabled', false);\n\n _$('input[name=\"dispositivos_internos\"]').each(function (idx, element) {\n element.parentElement.classList.remove('disabled');\n });\n\n _$('input[name=\"dispositivos_internos\"]').closest('#div_id_dispositivos_internos').css('opacity', '1');\n } else {\n _$('input[name=\"dispositivos_internos\"]').filter('[value=\"False\"]').prop('checked', true);\n\n _$('input[name=\"dispositivos_internos\"]').prop('disabled', true);\n\n _$('input[name=\"dispositivos_internos\"]').each(function (idx, element) {\n element.parentElement.classList.add('disabled');\n });\n\n _$('input[name=\"dispositivos_internos\"]').closest('#div_id_dispositivos_internos').css('opacity', '0.3');\n\n dispositivosInternos = 'False';\n }\n\n formData = {\n 'tipo_ta': tipoTa,\n 'tipo_model': tipoModel,\n 'num_ta': numTa,\n 'ano_ta': anoTa,\n 'texto': textoDispositivo,\n 'rotulo': rotuloDispositivo,\n 'dispositivos_internos': dispositivosInternos,\n 'max_results': maxResults,\n 'data_type_selection': dataTypeSelection,\n 'data_field': dataField,\n 'data_function': dataFunction\n };\n window.localStorage.setItem('dispositivo_search_form_data', _home_leandro_desenvolvimento_envs_sapl_frontend_node_modules_babel_runtime_corejs2_core_js_json_stringify__WEBPACK_IMPORTED_MODULE_0___default()(formData));\n url = '/ta/search_fragment_form';\n\n _$('.result-busca-dispositivo').html('');\n\n insertWaitAjax('.result-busca-dispositivo');\n\n _$.get(url, formData).done(function (data) {\n _$('.result-busca-dispositivo').html(data); // OptionalCustomFrontEnd().init()\n\n\n if (dataTypeSelection === 'checkbox') {\n var tas = _$('.result-busca-dispositivo').find('input[name=\"ta_select_all\"]');\n\n tas.off();\n tas.on('change', function (event) {\n _$(this).closest('ul').find('input[name=\"' + dataField + '\"]').prop('checked', this.checked);\n });\n }\n });\n };\n\n var onKeyPressRotuloBuscaTextual = function onKeyPressRotuloBuscaTextual(event) {\n var rotuloDispositivo = _$('input[name=\"rotulo_dispositivo\"]').val();\n\n var textoDispositivo = _$('input[name=\"texto_dispositivo\"]').val(); // let dispositivosInternos = _$('input[name=\"dispositivos_internos\"]:checked').val()\n\n\n if (rotuloDispositivo.length > 0 || textoDispositivo.length > 0) {\n _$('input[name=\"dispositivos_internos\"]').prop('disabled', false);\n\n _$('input[name=\"dispositivos_internos\"]').each(function (idx, element) {\n element.parentElement.classList.remove('disabled');\n });\n\n _$('input[name=\"dispositivos_internos\"]').closest('#div_id_dispositivos_internos').css('opacity', '1');\n } else {\n _$('input[name=\"dispositivos_internos\"]').filter('[value=\"False\"]').prop('checked', true);\n\n _$('input[name=\"dispositivos_internos\"]').prop('disabled', true);\n\n _$('input[name=\"dispositivos_internos\"]').each(function (idx, element) {\n element.parentElement.classList.add('disabled');\n });\n\n _$('input[name=\"dispositivos_internos\"]').closest('#div_id_dispositivos_internos').css('opacity', '0.3'); // dispositivosInternos = 'False'\n\n }\n };\n\n var buttonDs = field.children('#buttonDs');\n\n if (buttonDs.length > 0) {\n _$(buttonDs).remove();\n }\n\n buttonDs = _$('
');\n field.prepend(buttonDs);\n\n var btnOpenSearch = _$('