diff --git a/Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/arquivosHtml/arquivosHtml.jsp b/Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/arquivosHtml/arquivosHtml.jsp new file mode 100644 index 0000000..2ce993f --- /dev/null +++ b/Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/arquivosHtml/arquivosHtml.jsp @@ -0,0 +1 @@ +${html} \ No newline at end of file diff --git a/Desenvolvimento/Codificacao/e-Selo/WebContent/static/js/chart.js b/Desenvolvimento/Codificacao/e-Selo/WebContent/static/js/chart.js new file mode 100644 index 0000000..ec4b9e0 --- /dev/null +++ b/Desenvolvimento/Codificacao/e-Selo/WebContent/static/js/chart.js @@ -0,0 +1,34 @@ +$(document).ready(function() { + + var data = { + labels: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + datasets: [ + { + label: "The First Dataset", + fillColor: "rgba(153,0,76,0.2)", // magenta + strokeColor: "rgba(153,0,76,1)", // magenta + pointColor: "rgba(153,0,76,1)", // magenta + pointStrokeColor: "#fff", // white + pointHighlightFill: "#fff", // white + pointHighlightStroke: "rgba(153,0,76,1)", // magenta + data: [100, 34, 21, 56, 23, 90, 40] + }, + { + label: "The Second dataset", + fillColor: "rgba(76,0,153,0.2)", + strokeColor: "rgba(76,0,153,1)", + pointColor: "rgba(76,0,153,1)", + pointStrokeColor: "#fff", // white + pointHighlightFill: "#fff", // white + pointHighlightStroke: "rgba(76,0,153,1)", + data: [28, 48, 40, 19, 86, 27, 90] + } + ] + }; + var option = {}; + + + var ctx = document.getElementById("myChart"); + var myLineChart = new Chart(ctx).Line(data, option); + +}); \ No newline at end of file diff --git a/Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/AvaliacaoController.java b/Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/AvaliacaoController.java index 54331cf..6d82880 100644 --- a/Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/AvaliacaoController.java +++ b/Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/AvaliacaoController.java @@ -7,11 +7,14 @@ import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStreamWriter; import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -550,9 +553,8 @@ public class AvaliacaoController { String nomeArquivo = url.replace("https://", "").replace("http://", "").replace("/", "").replace(".", "").replace("\"", "") + ".json"; - File diretorioJson = new File(this.application.getRealPath("") - + "/WEB-INF/arquivosJson/" - + nomeArquivo); + File diretorioJson = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosJson/"+ nomeArquivo);//"http://189.9.137.162:8080/eselo/arquivosJson/" + //+ nomeArquivo); ResumoAvaliacao resumoAvaliacao = null; @@ -583,10 +585,16 @@ public class AvaliacaoController { } public void salvarAvaliacao(ResumoAvaliacao resumoAvaliacao) { - File diretorioJson = new File(this.application.getRealPath("") - + "/WEB-INF/arquivosJson"); + File diretorioJson = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosJson"); + + //File diretorioJson = new File("http://189.9.137.162:8080/eselo/arquivosJson"); + diretorioJson.mkdir(); + //File diretorioHtml = new File(this.application.getRealPath("") + "/WEB-INF/arquivosHtml"); + + File diretorioHtml = new File("http://189.9.137.162:8080/eselo/arquivosHtml"); + String nomeArquivo = ""; try { @@ -596,7 +604,7 @@ public class AvaliacaoController { e1.printStackTrace(); } - resumoAvaliacao.setUrlResultado(diretorioJson.toString() + "/" + resumoAvaliacao.setUrlResultado(diretorioHtml.toString() + "/" + nomeArquivo + ".html"); String json; @@ -613,6 +621,8 @@ public class AvaliacaoController { gravarArq.printf(json); arq.close(); + + } catch (IOException e) { e.printStackTrace(); } @@ -627,93 +637,279 @@ public class AvaliacaoController { Recomendacao recomendacao; // File diretorioHtml = new File("arquivosHtml"); - File diretorioHtml = new File(this.application.getRealPath("") - + "/WEB-INF/arquivosHtml"); + File diretorioHtml = new File(this.application.getRealPath("") + "/WEB-INF/arquivosHtml"); diretorioHtml.mkdir(); String nomeArquivo; StringBuffer html = new StringBuffer(); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - - html.append("Painel de Acessibilidade Digital do Governo"); - - html.append(""); - html.append(""); - - html.append(""); - html.append(""); - html.append("
"); - html.append("
"); - html.append("
"); - html.append(" "); - html.append("
"); - html.append("

"); - html.append(" Painel de Acessibilidade Digital do Governo"); - html.append(" "); - html.append("

"); - html.append("
"); + + try { + nomeArquivo = URLNormalizer.normalize(resumoAvaliacao.getUrl()) + .replace("/", "").replace(".", "") + + ".txt"; + + OutputStreamWriter bufferOut = new OutputStreamWriter(new FileOutputStream(diretorioHtml + "/" + nomeArquivo),"UTF-8"); + + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + + bufferOut.write(""); + + bufferOut.write("Painel de Acessibilidade Digital do Governo"); + bufferOut.write(""); + bufferOut.write(""); + + + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write(" "); + + + bufferOut.write("
"); + bufferOut.write("

"); + bufferOut.write(" Painel de Acessibilidade Digital do Governo"); + bufferOut.write(" "); + bufferOut.write("

"); + bufferOut.write("
"); + + bufferOut.write("
"); + + bufferOut.write(""); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); + + bufferOut.write(""); + + bufferOut.write("
"); + bufferOut.write("Início do conteúdo"); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write(" "); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); + + bufferOut.write("
"); + bufferOut.write(" "); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); + + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("Voltar para o topo"); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + + bufferOut.close(); + + if (diretorioHtml.exists()) { + salvarAvaliacao(resumoAvaliacao); + } + } catch (UnsupportedEncodingException e1) { + e1.printStackTrace(); + } catch (FileNotFoundException e1) { + e1.printStackTrace(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + + + /* bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + + bufferOut.write(""); + + bufferOut.write("Painel de Acessibilidade Digital do Governo"); + bufferOut.write(""); + bufferOut.write(""); + + + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write(" "); + + + bufferOut.write("
"); + bufferOut.write("

"); + bufferOut.write(" Painel de Acessibilidade Digital do Governo"); + bufferOut.write(" "); + bufferOut.write("

"); + bufferOut.write("
"); - html.append("
"); - - html.append(""); - html.append("
"); - html.append("
"); - html.append("
"); - - html.append(""); - - html.append("
"); - html.append("Início do conteúdo"); - html.append("
"); - html.append("
"); - html.append(" "); - html.append("
"); - html.append("
"); - html.append("
"); + bufferOut.write("
"); + + bufferOut.write("
"); + bufferOut.write(" Ministério do Planejamento - http://www.planejamento.gov.br (link para um novo sítio)"); + bufferOut.write("
"); + + bufferOut.write("
"); + bufferOut.write("Início do conteúdo"); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write(" "); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); - html.append("
"); - html.append(" Gráfico "); - html.append("
"); - html.append("
"); - html.append("
"); + bufferOut.write("
"); + bufferOut.write(" Gráfico "); + bufferOut.write("
"); + bufferOut.write("
"); + bufferOut.write("
"); - html.append("
"); + bufferOut.write(""); + bufferOut.write("
"); } - html.append("Fim do conteúdo"); - html.append("
"); - html.append("
"); - html.append("Voltar para o topo"); - html.append("
"); - html.append("
"); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + bufferOut.write("Fim do conteúdo"); + bufferOut.write(""); + bufferOut.write("
"); + bufferOut.write("Voltar para o topo"); + bufferOut.write("
"); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); + bufferOut.write(""); FileWriter arq; PrintWriter gravarArq; try { nomeArquivo = URLNormalizer.normalize(resumoAvaliacao.getUrl()) .replace("/", "").replace(".", "") - + ".html"; + + ".txt"; arq = new FileWriter(diretorioHtml + "/" + nomeArquivo); gravarArq = new PrintWriter(arq); gravarArq.printf(html.toString()); @@ -814,7 +1010,7 @@ public class AvaliacaoController { } catch (IOException e) { e.printStackTrace(); - } + }*/ } } diff --git a/Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/arquivosHtmlController.java b/Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/arquivosHtmlController.java new file mode 100644 index 0000000..3120c81 --- /dev/null +++ b/Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/arquivosHtmlController.java @@ -0,0 +1,66 @@ +package br.com.eselo.controller; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import javax.servlet.ServletContext; +import javax.swing.text.html.HTML; + +import br.com.caelum.vraptor.Get; +import br.com.caelum.vraptor.Resource; +import br.com.caelum.vraptor.Result; +import br.com.eselo.model.ResumoAvaliacao; + +@Resource +public class arquivosHtmlController { + + private ServletContext application; + private Result result; + + + + public arquivosHtmlController(ServletContext application, Result result) { + super(); + this.application = application; + this.result = result; + + + } + + + + + + + @Get("/arquivosHtml/{nomeArquivo}") + public void arquivosHtml(String nomeArquivo) + { + + File diretorioHtml = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosHtml/"+ nomeArquivo.replace(".html",".txt")); + //+ nomeArquivo); + StringBuilder html = new StringBuilder(); + try { + BufferedReader myBuffer = new BufferedReader(new InputStreamReader(new FileInputStream(diretorioHtml), "UTF-8")); + String linha; + + + while ( ( linha = myBuffer.readLine() ) != null) { + html.append(linha); + } + myBuffer.close(); + + result.include("html", html); + + } catch (FileNotFoundException e1) { + e1.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + +} +} -- libgit2 0.21.2