From e28e737caf4dd7004a3814af050f485adadbdf57 Mon Sep 17 00:00:00 2001
From: Bruno Nocera Zanette <brunonzanette@gmail.com>
Date: Mon, 30 Jun 2014 18:13:33 -0300
Subject: [PATCH] Add Consulta-Offline page

Add Consulta-Offline page
---
 .../webapp/WEB-INF/i18n/messages.properties   |  3 +
 .../webapp/WEB-INF/spring/webmvc-config.xml   |  1 +
 .../webapp/WEB-INF/views/consultaOffline.jspx | 56 +++++++++++++++++++
 src/main/webapp/WEB-INF/views/footer.jspx     | 12 ++++
 src/main/webapp/WEB-INF/views/views.xml       |  5 ++
 src/main/webapp/styles/standard.css           |  9 +++
 6 files changed, 86 insertions(+)
 create mode 100644 src/main/webapp/WEB-INF/views/consultaOffline.jspx

diff --git a/src/main/webapp/WEB-INF/i18n/messages.properties b/src/main/webapp/WEB-INF/i18n/messages.properties
index 90ec59c..dd7c0ad 100644
--- a/src/main/webapp/WEB-INF/i18n/messages.properties
+++ b/src/main/webapp/WEB-INF/i18n/messages.properties
@@ -122,3 +122,6 @@ security_login_form_password_message=Digite sua senha
 security_login_change_password=Alterar Senha
 security_login_unsuccessful=Seu login não foi realizado, Tente outra vez. Motivo:
 security_logout=Logout
+
+#consulta_offline
+consulta_offline=Consulta Offline
diff --git a/src/main/webapp/WEB-INF/spring/webmvc-config.xml b/src/main/webapp/WEB-INF/spring/webmvc-config.xml
index f3637dc..52c89cb 100644
--- a/src/main/webapp/WEB-INF/spring/webmvc-config.xml
+++ b/src/main/webapp/WEB-INF/spring/webmvc-config.xml
@@ -30,6 +30,7 @@
     <mvc:view-controller path="/uncaughtException"/>
     <mvc:view-controller path="/resourceNotFound"/>
     <mvc:view-controller path="/dataAccessFailure"/>
+    <mvc:view-controller path="/consultaOffline"/>
 
     <!-- Resolves localized messages*.properties and application.properties files in the application to allow for internationalization. 
     The messages*.properties files translate Roo generated messages which are part of the admin interface, the 
diff --git a/src/main/webapp/WEB-INF/views/consultaOffline.jspx b/src/main/webapp/WEB-INF/views/consultaOffline.jspx
new file mode 100644
index 0000000..6086934
--- /dev/null
+++ b/src/main/webapp/WEB-INF/views/consultaOffline.jspx
@@ -0,0 +1,56 @@
+<div xmlns:spring="http://www.springframework.org/tags" xmlns:util="urn:jsptagdir:/WEB-INF/tags/util" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
+  <jsp:directive.page contentType="text/html;charset=UTF-8" />
+  <jsp:output omit-xml-declaration="yes" />
+  <spring:message var="app_name" code="application_name" htmlEscape="false" />
+  <spring:message var="title" code="consulta_offline" arguments="${app_name}" htmlEscape="false" />
+  <util:panel id="title" title="${title}">
+	
+	<p>Nesta seção estão disponíveis informações públicas, em formato aberto, relativas aos programas existentes na Estação da Juventude.</p>
+	<p><b>Para visualizar os dados:</b></p>
+	<ol>
+	<li>Faça o download do pacote</li>
+	<li>Descompacte-o</li>
+	<li>Abra o arquivo "index.html"</li>
+	</ol>
+	
+    <p><b>Atualização dos arquivos:</b> Diária</p>
+
+    <p><b>Origem das informações:</b> Banco de dados da Estação da Juventude</p>
+
+	<spring:url value="/resources/consultaoffline/consultaoffline_programas.zip" var="consultaoffline_file" />
+	<a type="application/xml" href="${consultaoffline_file}" id="download_button">Download</a>
+	<p>Obsevação: Os navegadores "Chrome" e "Chromium" não são compatíveis com os arquivos.</p>	
+	
+    <h2>Estrutura do arquivo JSON</h2>
+	<textarea style="height:200px; width:300px;">
+{
+"programas":[
+{
+    "nome_oficial":"",
+    "nome_divulgacao":"",
+    "sigla":"",
+    "nivel":"",
+    "lei_criacao":"",
+    "descricao":"",
+    "objetivos":"",
+    "beneficios":"",
+    "publico_alvo":"",
+    "criterios_acesso":"",
+    "tematicas":[
+        {
+            "nome":""
+        }
+    ],
+    "orgaos_executores":[
+        {
+            "nome":""
+        }
+    ],
+    "status":"Candidato"
+}
+]
+}
+		</textarea>
+	
+  </util:panel>
+</div>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/views/footer.jspx b/src/main/webapp/WEB-INF/views/footer.jspx
index 14e1d8a..618bd11 100644
--- a/src/main/webapp/WEB-INF/views/footer.jspx
+++ b/src/main/webapp/WEB-INF/views/footer.jspx
@@ -27,7 +27,19 @@
         <spring:message code="security_logout"/>
       </a>
     </span>
+    
+    <c:out value=" | "/>
+    
+    <span>
+      <spring:url value="/consultaOffline" var="consultaOffline"/>
+      <a href="${consultaOffline}">
+        <spring:message code="consulta_offline"/>
+      </a>
+    </span>
+    
   </c:if>
+  
+  
 
 <!--
   <span id="language">
diff --git a/src/main/webapp/WEB-INF/views/views.xml b/src/main/webapp/WEB-INF/views/views.xml
index e92932a..3080a1a 100644
--- a/src/main/webapp/WEB-INF/views/views.xml
+++ b/src/main/webapp/WEB-INF/views/views.xml
@@ -21,4 +21,9 @@
 <definition extends="public" name="login">
         <put-attribute name="body" value="/WEB-INF/views/login.jspx"/>
     </definition>
+    
+    <definition extends="default" name="consultaOffline">
+    <put-attribute name="body" value="/WEB-INF/views/consultaOffline.jspx"/>
+  </definition>
+  
 </tiles-definitions>
diff --git a/src/main/webapp/styles/standard.css b/src/main/webapp/styles/standard.css
index 411305c..2da6b5c 100644
--- a/src/main/webapp/styles/standard.css
+++ b/src/main/webapp/styles/standard.css
@@ -455,3 +455,12 @@ fieldset th {
 	height: 11px;
 	width: 16px;
 }
+
+a#download_button {
+	color:#ABC8F0;
+	background-color:#09244D;
+	height:25px;
+	border:1px solid #B3B3B3;
+	padding: 1px 6px;
+	text-decoration: none;
+}
\ No newline at end of file
-- 
GitLab