Browse Source

Merge branch '119-migracao-documentos-zope'

Fix #119
pull/978/head
Marcio Mazza 8 years ago
parent
commit
4adb8f6d91
  1. 2
      sapl/base/migrations/0001_initial.py
  2. 10
      sapl/base/models.py
  3. 11
      sapl/legacy/management/commands/migracao_documentos.py
  4. 188
      sapl/legacy/migracao_documentos.py
  5. 2
      sapl/legacy_migration_settings.py
  6. 11
      sapl/static/XSLT/HTML/.objects
  7. 95
      sapl/static/XSLT/HTML/estilo.css
  8. 51
      sapl/static/XSLT/HTML/indicacao.xsl
  9. 41
      sapl/static/XSLT/HTML/mocao.xsl
  10. 45
      sapl/static/XSLT/HTML/mocao2.xsl
  11. 41
      sapl/static/XSLT/HTML/parecer.xsl
  12. 47
      sapl/static/XSLT/HTML/pedido.xsl
  13. 53
      sapl/static/XSLT/HTML/pedido2.xsl
  14. 105
      sapl/static/XSLT/HTML/pl.xsl
  15. 100
      sapl/static/XSLT/HTML/pl2.xsl
  16. 52
      sapl/static/XSLT/HTML/requerimento.xsl
  17. 57
      sapl/static/XSLT/HTML/requerimento2.xsl
  18. 4
      sapl/urls.py

2
sapl/base/migrations/0001_initial.py

@ -66,7 +66,7 @@ class Migration(migrations.Migration):
('uf', models.CharField(choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=100, verbose_name='UF')), ('uf', models.CharField(choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=100, verbose_name='UF')),
('telefone', models.CharField(blank=True, max_length=100, verbose_name='Telefone')), ('telefone', models.CharField(blank=True, max_length=100, verbose_name='Telefone')),
('fax', models.CharField(blank=True, max_length=100, verbose_name='Fax')), ('fax', models.CharField(blank=True, max_length=100, verbose_name='Fax')),
('logotipo', models.ImageField(blank=True, upload_to=sapl.base.models.get_casa_media_path, verbose_name='Logotipo')), ('logotipo', models.ImageField(blank=True, upload_to='sapl/casa/logotipo/', verbose_name='Logotipo')),
('endereco_web', models.URLField(blank=True, max_length=100, verbose_name='HomePage')), ('endereco_web', models.URLField(blank=True, max_length=100, verbose_name='HomePage')),
('email', models.EmailField(blank=True, max_length=100, verbose_name='E-mail')), ('email', models.EmailField(blank=True, max_length=100, verbose_name='E-mail')),
('informacao_geral', models.TextField(blank=True, max_length=100, verbose_name='Informação Geral')), ('informacao_geral', models.TextField(blank=True, max_length=100, verbose_name='Informação Geral')),

10
sapl/base/models.py

@ -13,14 +13,6 @@ SEQUENCIA_NUMERACAO = (('A', _('Sequencial por ano')),
('U', _('Sequencial único'))) ('U', _('Sequencial único')))
def get_sessao_media_path(instance, subpath, filename):
return './sapl/casa/%s/%s' % (subpath, filename)
def get_casa_media_path(instance, filename):
return get_sessao_media_path(instance, 'Logotipo', filename)
@reversion.register() @reversion.register()
class CasaLegislativa(models.Model): class CasaLegislativa(models.Model):
# TODO ajustar todos os max_length !!!! # TODO ajustar todos os max_length !!!!
@ -41,7 +33,7 @@ class CasaLegislativa(models.Model):
max_length=100, blank=True, verbose_name=_('Fax')) max_length=100, blank=True, verbose_name=_('Fax'))
logotipo = models.ImageField( logotipo = models.ImageField(
blank=True, blank=True,
upload_to=get_casa_media_path, upload_to='sapl/casa/logotipo/',
verbose_name=_('Logotipo')) verbose_name=_('Logotipo'))
endereco_web = models.URLField( endereco_web = models.URLField(
max_length=100, blank=True, verbose_name=_('HomePage')) max_length=100, blank=True, verbose_name=_('HomePage'))

11
sapl/legacy/management/commands/migracao_documentos.py

@ -0,0 +1,11 @@
from django.core.management.base import BaseCommand
from sapl.legacy.migracao_documentos import migrar_documentos
class Command(BaseCommand):
help = u'Migração documentos do SAPL 2.5 para o SAPL 3.1'
def handle(self, *args, **options):
migrar_documentos()

188
sapl/legacy/migracao_documentos.py

@ -0,0 +1,188 @@
import mimetypes
import os
import re
import magic
from sapl.base.models import CasaLegislativa
from sapl.materia.models import (DocumentoAcessorio, MateriaLegislativa,
Proposicao)
from sapl.norma.models import NormaJuridica
from sapl.parlamentares.models import Parlamentar
from sapl.protocoloadm.models import DocumentoAdministrativo
from sapl.sessao.models import SessaoPlenaria
from sapl.settings import MEDIA_ROOT
# MIGRAÇÃO DE DOCUMENTOS ###################################################
EXTENSOES = {
'application/msword': '.doc',
'application/pdf': '.pdf',
'application/vnd.oasis.opendocument.text': '.odt',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': '.docx', # noqa
'application/xml': '.xml',
'application/zip': '.zip',
'image/jpeg': '.jpeg',
'image/png': '.png',
'text/html': '.html',
'text/rtf': '.rtf',
'text/x-python': '.py',
# sem extensao
'application/octet-stream': '', # binário
'inode/x-empty': '', # vazio
}
DOCS = {
CasaLegislativa: [(
'logotipo',
'props_sapl/logo_casa.gif',
'casa/logotipo/logo_casa.gif')],
Parlamentar: [(
'fotografia',
'parlamentar/fotos/{}_foto_parlamentar',
'parlamentar/{0}/{0}_foto_parlamentar{1}')],
MateriaLegislativa: [(
'texto_original',
'materia/{}_texto_integral',
'materialegislativa/{0}/{0}_texto_integral{1}')],
DocumentoAcessorio: [(
'arquivo',
'materia/{}',
'documentoacessorio/{0}/{0}{1}')],
NormaJuridica: [(
'texto_original',
'norma_juridica/{}_texto_integral',
'normajuridica/{0}/{0}_texto_integral{1}')],
SessaoPlenaria: [
('upload_ata',
'ata_sessao/{}_ata_sessao',
'sessaoplenaria/{0}/ata/{0}_ata_sessao{1}'),
('upload_anexo',
'anexo_sessao/{}_texto_anexado',
'sessaoplenaria/{0}/anexo/{0}_texto_anexado{1}')
],
Proposicao: [(
'texto_original',
'proposicao/{}',
'proposicao/{0}/{0}{1}')],
DocumentoAdministrativo: [(
'texto_integral',
'administrativo/{}_texto_integral',
'documentoadministrativo/{0}/{0}_texto_integral{1}')],
}
DOCS = {tipo: [(campo,
os.path.join('sapl_documentos', origem),
os.path.join('sapl', destino))
for campo, origem, destino in campos]
for tipo, campos in DOCS.items()}
def em_media(caminho):
return os.path.join(MEDIA_ROOT, caminho)
def mover_documento(origem, destino):
origem, destino = [em_media(c) if not os.path.isabs(c) else c
for c in (origem, destino)]
os.makedirs(os.path.dirname(destino), exist_ok=True)
os.rename(origem, destino)
def get_casa_legislativa():
casa = CasaLegislativa.objects.first()
if not casa:
casa = CasaLegislativa.objects.create(**{k: 'PREENCHER...' for k in [
'codigo', 'nome', 'sigla', 'endereco', 'cep', 'municipio', 'uf',
]})
return casa
def migrar_docs_logo():
print('#### Migrando logotipo da casa ####')
[(_, origem, destino)] = DOCS[CasaLegislativa]
props_sapl = os.path.dirname(origem)
# a pasta props_sapl deve conter apenas o origem e metadatas!
assert set(os.listdir(em_media(props_sapl))) < {
'logo_casa.gif', '.metadata', 'logo_casa.gif.metadata'}
mover_documento(origem, destino)
casa = get_casa_legislativa()
casa.logotipo = destino
casa.save()
def get_extensao(caminho):
mime = magic.from_file(caminho, mime=True)
try:
return EXTENSOES[mime]
except KeyError as e:
raise Exception('\n'.join([
'Extensão não conhecida para o arquivo:',
caminho,
'E mimetype:',
mime,
' Algumas possibilidades são:', ] +
[" '{}': '{}',".format(mime, ext)
for ext in mimetypes.guess_all_extensions(mime)] +
['Atualize o código do dicionário EXTENSOES!']
)) from e
def migrar_docs_por_ids(tipo):
for campo, base_origem, base_destino in DOCS[tipo]:
print('#### Migrando {} de {} ####'.format(campo, tipo.__name__))
dir_origem, nome_origem = os.path.split(em_media(base_origem))
pat = re.compile('^{}$'.format(nome_origem.format('(\d+)')))
if not os.path.isdir(dir_origem):
print(' >>> O diretório {} não existe! Abortado.'.format(
dir_origem))
continue
for arq in os.listdir(dir_origem):
match = pat.match(arq)
if match:
origem = os.path.join(dir_origem, match.group(0))
id = match.group(1)
extensao = get_extensao(origem)
destino = base_destino.format(id, extensao)
mover_documento(origem, destino)
# associa documento ao objeto
try:
obj = tipo.objects.get(pk=id)
setattr(obj, campo, destino)
obj.save()
except tipo.DoesNotExist:
msg = ' {} (pk={}) não encontrado para documento em [{}]'
print(msg.format(
tipo.__name__, id, destino))
def migrar_documentos():
# aqui supomos que uma pasta chamada sapl_documentos está em MEDIA_ROOT
# com o conteúdo da pasta de mesmo nome do zope
# Os arquivos da pasta serão movidos para a nova estrutura e a pasta será
# apagada
migrar_docs_logo()
for tipo in [
Parlamentar,
MateriaLegislativa,
DocumentoAcessorio,
NormaJuridica,
SessaoPlenaria,
Proposicao,
DocumentoAdministrativo,
]:
migrar_docs_por_ids(tipo)
sobrando = [os.path.join(dir, file)
for (dir, _, files) in os.walk(em_media('sapl_documentos'))
for file in files]
if sobrando:
print('\n#### Encerrado ####\n\n'
'{} documentos sobraram sem ser migrados!!!'.format(
len(sobrando)))
for doc in sobrando:
print(' {}'. format(doc))

2
sapl/legacy_migration_settings.py

@ -23,7 +23,7 @@ if DATABASE_NAME_OVERRIDE:
DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ] DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ]
DEBUG = False DEBUG = True
MOMMY_CUSTOM_FIELDS_GEN = { MOMMY_CUSTOM_FIELDS_GEN = {
'django.db.models.ForeignKey': 'sapl.legacy.migration.make_with_log' 'django.db.models.ForeignKey': 'sapl.legacy.migration.make_with_log'

11
sapl/static/XSLT/HTML/.objects

@ -0,0 +1,11 @@
estilo.css:DTML Method
indicacao.xsl:File
mocao.xsl:File
mocao2.xsl:File
parecer.xsl:File
pedido.xsl:File
pedido2.xsl:File
pl.xsl:File
pl2.xsl:File
requerimento.xsl:File
requerimento2.xsl:File

95
sapl/static/XSLT/HTML/estilo.css

@ -0,0 +1,95 @@
body {
font-family: Times;
text-align: justify;
font-size: 12 pt;
margin: 5px 1cm 20px 2cm;
}
p,
.p{
font-family: Times;
text-align: justify;
font-size: 12pt;
text-indent: 1.5cm;
margin: 40px 0 20px 0;
}
.pequeno {
font-family: Times;
text-align: left;
font-size: 13pt;
margin: 0px 0 0px 0;
}
.cabecalho {
font-family: Times;
font-weight:bold;
text-align: left;
font-size: 15pt;
margin: 10px 0 0px 0;
}
.texto {
font-family: Times;
text-align: justify;
font-size: 12pt;
margin: 0px 0px 0px 0px;
}
.data {
text-align: right;
}
.autor {
text-align: center;
}
.center {
text-align: center;
}
.semrecuo {
text-indent: 0;
}
.ementa {
text-align: justify;
margin-left: 50%;
text-indent: 0;
}
.titulos1 {
text-align: center;
margin: 10px 0 0px 0;
}
.titulos2 {
text-align: center;
margin: 0px 0 0px 0;
}
p.artigo {
text-align: justify;
text-indent: 1cm;
margin: 10px 0 0px 0;
}
#imagem {
float:left;
}
#autores
{
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
width:50px;
}
#col1 { width: 33%; float: left; center: 10px; }
#col2 { width: 33%; float: left; center: 10px; }
#col3 { width: 33%; float: left; center: 10px; }

51
sapl/static/XSLT/HTML/indicacao.xsl

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ind="/XSD/Indicacao">
<xsl:template match="/">
<html>
<head>
<link href="/XSLT/HTML/estilo.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="ind:ementa_text">
<div>
<div id="imagem">
<img border="0" src="http://sapl.agudo.rs.leg.br/generico/sapl_documentos/props_sapl/logo_casa"/><br></br>
</div><br></br>
<p class ="cabecalho">Câmara Municipal de Agudo</p>
<p class ="pequeno"> Estado do Rio Grande do Sul <br></br><br></br><br></br></p>
</div>
<p class="autor"><strong><xsl:value-of select="text()" /></strong></p>
</xsl:template>
<xsl:template match="ind:autoria_text">
<p class="semrecuo"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:destinatario_text">
<p class="semrecuo"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:indicacao_text">
<p><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:data_text">
<p><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:autor_text">
<p class="autor"><xsl:value-of select="text()" /></p>
</xsl:template>
</xsl:stylesheet>

41
sapl/static/XSLT/HTML/mocao.xsl

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:moc="/XSD/Mocao">
<xsl:template match="/">
<html>
<body>
<table>
<xsl:apply-templates />
</table>
</body>
</html>
</xsl:template>
<xsl:template match="moc:ementa_text">
<tr>
<td width="50%"></td>
<td width="50%" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="moc:mocao_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="moc:data_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="moc:autor_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>

45
sapl/static/XSLT/HTML/mocao2.xsl

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ind="/XSD/Mocao">
<xsl:template match="/">
<html>
<head>
<link href="/sapl/XSLT/HTML/estilo.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div>
<div id="imagem">
<img border="0" src="/sapl/sapl_documentos/props_sapl/logo_casa"/>
</div><br></br>
<p class ="cabecalho">Câmara Municipal de Agudo</p>
<p class ="pequeno">Estado do Rio Grande do Sul<br></br><br></br><br></br> </p>
</div>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="ind:ementa_text">
<p class ="autor"><strong><xsl:value-of select="text()" /></strong></p>
</xsl:template>
<xsl:template match="ind:mocao_text">
<p class ="texto"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:justificativa_text">
<p class ="texto"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:data_text">
<p><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:autor_text">
<p class="autor"><xsl:value-of select="text()" /></p>
</xsl:template>
</xsl:stylesheet>

41
sapl/static/XSLT/HTML/parecer.xsl

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:par="/XSD/Parecer">
<xsl:template match="/">
<html>
<body>
<table>
<xsl:apply-templates />
</table>
</body>
</html>
</xsl:template>
<xsl:template match="par:ementa_text">
<tr>
<td width="50%"></td>
<td width="50%" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="par:parecer_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="par:data_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="par:autor_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>

47
sapl/static/XSLT/HTML/pedido.xsl

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:req="/XSD/Requerimento">
<xsl:template match="/">
<html>
<body>
<table>
<xsl:apply-templates />
</table>
</body>
</html>
</xsl:template>
<xsl:template match="req:ementa_text">
<tr>
<td width="50%"></td>
<td width="50%" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:requisicao_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:justificativa_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:data_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:autor_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>

53
sapl/static/XSLT/HTML/pedido2.xsl

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ind="/XSD/Pedido">
<xsl:template match="/">
<html>
<head>
<link href="/sapl/XSLT/HTML/estilo.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div>
<div id="imagem">
<img border="0" src="/sapl/sapl_documentos/props_sapl/logo_casa"/>
</div><br></br>
<p class ="cabecalho">Câmara Municipal de Agudo</p>
<p class ="pequeno">Estado do Rio Grande do Sul<br></br><br></br><br></br> </p>
</div>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="ind:ementa_text">
<p class ="autor"><strong><xsl:value-of select="text()" /></strong></p>
</xsl:template>
<xsl:template match="ind:autoria_text">
<p class="semrecuo"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:destinatario_text">
<p class="semrecuo"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:solicitacao_text">
<p class="texto"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:alinea_text">
<p class="texto"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:data_text">
<p><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:autor_text">
<p class="autor"><xsl:value-of select="text()" /></p>
</xsl:template>
</xsl:stylesheet>

105
sapl/static/XSLT/HTML/pl.xsl

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pl="/XSD/ProjLei">
<xsl:output encoding="ISO-8859-1"/>
<xsl:template match="/pl:pl">
<html>
<head>
<title>
<xsl:value-of select="@id"/>
</title>
<style type="text/css">
body {margin-left: 2cm; margin-right: 1cm;}
p {font-family: Times; font-size: 12pt;}
p.epigrafe {text-align: center; text-transform: uppercase;}
p.ementa {text-align: justify; margin-left: 50%;}
p.preambulo {text-transform: uppercase; text-indent: 1cm;}
p.artigo {text-align: justify; text-indent: 1cm;}
p.paragrafo {text-align: justify; text-indent: 1cm;}
p.inciso {text-align: justify; text-indent: 1cm;}
p.alinea {text-align: justify; text-indent: 1cm;}
p.item {text-align: justify; text-indent: 1cm;}
p.justificativa {text-align: justify; text-indent: 1cm;}
p.mensagem {text-align: justify;}
p.data_apresentacao {text-align: justify; text-indent: 1cm;}
p.autor {text-align: center; text-transform: uppercase;}
h3.cab_secao {text-align: center; font-size: 12pt;}
</style>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="pl:proposicao">
<hr/>
<h3 class="cab_secao">PROPOSIÇÃO</h3>
<hr/>
<xsl:apply-templates select="./*"/>
</xsl:template>
<xsl:template match="pl:epigrafe">
<p class="epigrafe">
<xsl:value-of select="pl:epigrafe_text"/>
</p>
</xsl:template>
<xsl:template match="pl:ementa">
<p class="ementa">
<xsl:value-of select="pl:ementa_text"/>
</p>
</xsl:template>
<xsl:template match="pl:preambulo">
<p class="preambulo">
<xsl:value-of select="pl:preambulo_text"/>
</p>
</xsl:template>
<xsl:template match="pl:artigo_text">
<p class="artigo">
<xsl:value-of select="concat(../@Rotulo,' ',text())"/>
</p>
</xsl:template>
<xsl:template match="pl:paragrafo_text">
<p class="paragrafo">
<xsl:value-of select="concat(../@Rotulo,' ',text())"/>
</p>
</xsl:template>
<xsl:template match="pl:inciso_text">
<p class="inciso">
<xsl:value-of select="concat(../@Rotulo,' - ',text())"/>
</p>
</xsl:template>
<xsl:template match="pl:alinea_text">
<p class="alinea">
<xsl:value-of select="concat(../@Rotulo,' ',text())"/>
</p>
</xsl:template>
<xsl:template match="pl:item_text">
<p class="item">
<xsl:value-of select="concat(../@Rotulo,' ',text())"/>
</p>
</xsl:template>
<xsl:template match="pl:data_apresentacao_text">
<p class="data_apresentacao">
<xsl:value-of select="text()"/>
</p>
</xsl:template>
<xsl:template match="pl:autor_text">
<p class="autor">
<xsl:value-of select="text()"/>
</p>
</xsl:template>
<xsl:template match="pl:justificativa">
<hr/>
<h3 class="cab_secao">JUSTIFICATIVA</h3>
<hr/>
<p class="justificativa">
<xsl:value-of select="pl:justificativa_text"/>
</p>
</xsl:template>
<xsl:template match="pl:mensagem">
<hr/>
<h3 class="cab_secao">MENSAGEM</h3>
<hr/>
<p class="mensagem">
<xsl:value-of select="pl:mensagem_text"/>
</p>
</xsl:template>
</xsl:stylesheet>

100
sapl/static/XSLT/HTML/pl2.xsl

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ind="/XSD/ProjLei">
<xsl:template match="/">
<html>
<head>
<link href="/sapl/XSLT/HTML/estilo.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div>
<div id="imagem">
<img border="0" src="/sapl/sapl_documentos/props_sapl/logo_casa"/>
</div><br></br>
<p class ="cabecalho">Câmara Municipal de Agudo</p>
<p class ="pequeno">Estado do Rio Grande do Sul<br></br><br></br><br></br> </p>
</div>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="ind:epigrafe_text">
<p class ="autor"><strong><xsl:value-of select="text()" /></strong></p>
</xsl:template>
<xsl:template match="ind:ementa_text">
<p class ="ementa"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:preambulo_text">
<p class ="artigo"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:parte_text">
<p class ="titulos1"><xsl:value-of select="concat(../@Rotulo,' ')"/></p>
<p class ="titulos2"><xsl:value-of select="text()"/></p>
</xsl:template>
<xsl:template match="ind:livro_text">
<p class ="titulos1"><xsl:value-of select="concat(../@Rotulo,' ')"/></p>
<p class ="titulos2"><xsl:value-of select="text()"/></p>
</xsl:template>
<xsl:template match="ind:titulo_text">
<p class ="titulos1"><xsl:value-of select="concat(../@Rotulo,' ')"/></p>
<p class ="titulos2"><xsl:value-of select="text()"/></p>
</xsl:template>
<xsl:template match="ind:capitulo_text">
<p class ="titulos1"><xsl:value-of select="concat(../@Rotulo,' ')"/></p>
<p class ="titulos2"><xsl:value-of select="text()"/></p>
</xsl:template>
<xsl:template match="ind:secao_text">
<p class ="titulos1"><xsl:value-of select="concat(../@Rotulo,' ')"/></p>
<p class ="titulos2"><xsl:value-of select="text()"/></p>
</xsl:template>
<xsl:template match="ind:subsecao_text">
<p class ="titulos1"><xsl:value-of select="concat(../@Rotulo,' ')"/></p>
<p class ="titulos2"><xsl:value-of select="text()"/></p>
</xsl:template>
<xsl:template match="ind:artigo_text">
<p class="artigo"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:paragrafo_text">
<p class="artigo"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:inciso_text">
<p class="artigo"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:alinea_text">
<p class="artigo"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:item_text">
<p class="artigo"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:data_apresentacao_text">
<p class="artigo"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:autor_text">
<p class="artigo"><xsl:value-of select="concat(../@Rotulo,' ',text())"/></p>
</xsl:template>
<xsl:template match="ind:justificativa_text">
<p class="artigo"><xsl:value-of select="text()" /></p>
</xsl:template>
</xsl:stylesheet>

52
sapl/static/XSLT/HTML/requerimento.xsl

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:req="/XSD/Requerimento">
<xsl:template match="/">
<html>
<body>
<table>
<xsl:apply-templates />
</table>
</body>
</html>
</xsl:template>
<xsl:template match="req:destinatario_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:ementa_text">
<tr>
<td width="50%"></td>
<td width="50%" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:requisicao_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:justificativa_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:data_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
<xsl:template match="req:autor_text">
<tr>
<td colspan="2" align="left"><xsl:value-of select="text()" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>

57
sapl/static/XSLT/HTML/requerimento2.xsl

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ind="/XSD/Requerimento">
<xsl:template match="/">
<html>
<head>
<link href="/sapl/XSLT/HTML/estilo.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div>
<div id="imagem">
<img border="0" src="/sapl/sapl_documentos/props_sapl/logo_casa"/>
</div><br></br>
<p class ="cabecalho">Câmara Municipal de Agudo</p>
<p class ="pequeno">Estado do Rio Grande do Sul<br></br><br></br><br></br> </p>
</div>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="ind:ementa_text">
<p class="autor"><strong><xsl:value-of select="text()" /></strong></p>
</xsl:template>
<xsl:template match="ind:formatratamento_text">
<p class="semrecuo"><xsl:value-of select="text()"/> </p>
</xsl:template>
<xsl:template match="ind:parlamentar_text">
<p class="semrecuo"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:cargofuncao_text">
<p class="semrecuo"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:requisicao_text">
<p class="texto"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:justificativa_text">
<p class="texto"><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:data_text">
<p><xsl:value-of select="text()" /></p>
</xsl:template>
<xsl:template match="ind:autor_text">
<p class="autor"><xsl:value-of select="text()" /></p>
</xsl:template>
</xsl:stylesheet>

4
sapl/urls.py

@ -57,6 +57,10 @@ urlpatterns = [
url(r'^favicon\.ico$', RedirectView.as_view( url(r'^favicon\.ico$', RedirectView.as_view(
url='/static/img/favicon.ico', permanent=True)), url='/static/img/favicon.ico', permanent=True)),
# Folhas XSLT e extras referenciadas por documentos migrados do sapl 2.5
url(r'^XSLT/HTML/(?P<path>.*)$', RedirectView.as_view(
url='/static/XSLT/HTML/%(path)s', permanent=False)),
] ]

Loading…
Cancel
Save