Repository: interlegis/sapl

Issue:
Implementar visão reduzida de parlamentares.
Existia na versão 2.5 parâmetros de url que permitiam páginas do SAPL fossem embutidas no portal modelo. Por exemplo:

http://sapl.pirai.rj.leg.br/consultas/parlamentar/parlamentar_mostrar_proc?cod_parlamentar=11&iframe=1

Seria interessante implementar uma maneira de realizar o mesmo no sapl3. Algo que permita embutir informações do sapl no portal modelo.


Discussion:

Resolving patch:
diff --git a/sapl/redireciona_urls/views.py b/sapl/redireciona_urls/views.py
--- a/sapl/redireciona_urls/views.py
+++ b/sapl/redireciona_urls/views.py
@@ -50,6 +50,20 @@
 historico_tramitacoes = (app_relatorios + ':historico_tramitacoes')
 
 
+
+def has_iframe(url, request):
+
+    iframe = request.GET.get(
+        'iframe',
+        EMPTY_STRING)
+    if iframe:
+        iframe_qs= ("iframe=" + iframe)
+        url += ("&" if "?" in url else "?")
+        url += iframe_qs
+
+    return url
+
+
 class RedirecionaSAPLIndex(RedirectView):
     permanent = True
 
@@ -59,6 +73,9 @@ def get_redirect_url(self):
             url = reverse(url_pattern)
         except NoReverseMatch:
             raise UnknownUrlNameError(url_pattern)
+
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -90,6 +107,8 @@ def get_redirect_url(self):
                 args = '?pk=' + numero_legislatura
                 url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -112,6 +131,9 @@ def get_redirect_url(self):
                 url = reverse(comissao_list)
             except NoReverseMatch:
                 raise UnknownUrlNameError(comissao_list)
+
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -151,6 +173,8 @@ def get_redirect_url(self):
                 args += "&tipo=&salvar=Pesquisar"
                 url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -198,6 +222,8 @@ def get_redirect_url(self):
             args += "&tipo=%s&salvar=Pesquisar" % (tipo_sessao)
             url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -210,6 +236,9 @@ def get_redirect_url(self):
             url = reverse(relatorios_list)
         except NoReverseMatch:
             raise UnknownUrlNameError(relatorios_list)
+
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -253,6 +282,8 @@ def get_redirect_url(self):
             args += "&salvar=%s" % (salvar)
             url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -260,13 +291,18 @@ class RedirecionaMateriaLegislativaDetail(RedirectView):
     permanent = True
 
     def get_redirect_url(self):
+        url = EMPTY_STRING
         pk = self.request.GET.get('cod_materia', EMPTY_STRING)
 
         if pk:
             kwargs = {'pk': pk}
-            return reverse(materialegislativa_detail, kwargs=kwargs)
+            url = reverse(materialegislativa_detail, kwargs=kwargs)
         else:
-            return reverse(materialegislativa_list)
+            url = reverse(materialegislativa_list)
+
+        url = has_iframe(url, self.request)
+
+        return url
 
 
 class RedirecionaMateriaLegislativaList(RedirectView):
@@ -339,6 +375,8 @@ def get_redirect_url(self):
 
         url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -346,11 +384,14 @@ class RedirecionaMesaDiretoraView(RedirectView):
     permanent = True
 
     def get_redirect_url(self):
+        url = EMPTY_STRING
         try:
             url = reverse(parlamentar_mesa_diretora)
         except NoReverseMatch:
             raise UnknownUrlNameError(parlamentar_mesa_diretora)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -358,13 +399,18 @@ class RedirecionaNormasJuridicasDetail(RedirectView):
     permanent = True
 
     def get_redirect_url(self):
+        url = EMPTY_STRING
         pk_norma = self.request.GET.get('cod_norma', EMPTY_STRING)
 
         if pk_norma:
             kwargs = {'pk': pk_norma}
-            return reverse(norma_juridica_detail, kwargs=kwargs)
+            url = reverse(norma_juridica_detail, kwargs=kwargs)
         else:
-            return reverse(norma_juridica_pesquisa)
+            url = reverse(norma_juridica_pesquisa)
+
+        url = has_iframe(url, self.request)
+
+        return url
 
 
 class RedirecionaNormasJuridicasList(RedirectView):
@@ -420,6 +466,8 @@ def get_redirect_url(self):
 
         url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -475,6 +523,8 @@ def get_redirect_url(self):
 
             url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -507,6 +557,8 @@ def get_redirect_url(self):
 
         url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -539,6 +591,8 @@ def get_redirect_url(self):
 
         url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -553,6 +607,8 @@ def get_redirect_url(self):
         except NoReverseMatch:
             raise UnknownUrlNameError(relatorio_materia_por_autor)
 
+        url = has_iframe(url, self.request)
+
         return url
 
 
@@ -574,4 +630,6 @@ def get_redirect_url(self):
             args += "&salvar=%s" % ('Pesquisar')
             url = "%s%s" % (url, args)
 
+        url = has_iframe(url, self.request)
+
         return url


Test patch: