Commit 72e56f6be336dcc1effcf2febdf69178fe61b14c
1 parent
00506d9b
Exists in
master
Exibição das avaliações.
Showing
4 changed files
with
420 additions
and
123 deletions
Show diff stats
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/arquivosHtml/arquivosHtml.jsp
0 → 100644
Desenvolvimento/Codificacao/e-Selo/WebContent/static/js/chart.js
0 → 100644
@@ -0,0 +1,34 @@ | @@ -0,0 +1,34 @@ | ||
1 | +$(document).ready(function() { | ||
2 | + | ||
3 | + var data = { | ||
4 | + labels: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], | ||
5 | + datasets: [ | ||
6 | + { | ||
7 | + label: "The First Dataset", | ||
8 | + fillColor: "rgba(153,0,76,0.2)", // magenta | ||
9 | + strokeColor: "rgba(153,0,76,1)", // magenta | ||
10 | + pointColor: "rgba(153,0,76,1)", // magenta | ||
11 | + pointStrokeColor: "#fff", // white | ||
12 | + pointHighlightFill: "#fff", // white | ||
13 | + pointHighlightStroke: "rgba(153,0,76,1)", // magenta | ||
14 | + data: [100, 34, 21, 56, 23, 90, 40] | ||
15 | + }, | ||
16 | + { | ||
17 | + label: "The Second dataset", | ||
18 | + fillColor: "rgba(76,0,153,0.2)", | ||
19 | + strokeColor: "rgba(76,0,153,1)", | ||
20 | + pointColor: "rgba(76,0,153,1)", | ||
21 | + pointStrokeColor: "#fff", // white | ||
22 | + pointHighlightFill: "#fff", // white | ||
23 | + pointHighlightStroke: "rgba(76,0,153,1)", | ||
24 | + data: [28, 48, 40, 19, 86, 27, 90] | ||
25 | + } | ||
26 | + ] | ||
27 | + }; | ||
28 | + var option = {}; | ||
29 | + | ||
30 | + | ||
31 | + var ctx = document.getElementById("myChart"); | ||
32 | + var myLineChart = new Chart(ctx).Line(data, option); | ||
33 | + | ||
34 | +}); | ||
0 | \ No newline at end of file | 35 | \ No newline at end of file |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/AvaliacaoController.java
@@ -7,11 +7,14 @@ import java.awt.image.BufferedImage; | @@ -7,11 +7,14 @@ import java.awt.image.BufferedImage; | ||
7 | import java.io.BufferedReader; | 7 | import java.io.BufferedReader; |
8 | import java.io.File; | 8 | import java.io.File; |
9 | import java.io.FileNotFoundException; | 9 | import java.io.FileNotFoundException; |
10 | +import java.io.FileOutputStream; | ||
10 | import java.io.FileReader; | 11 | import java.io.FileReader; |
11 | import java.io.FileWriter; | 12 | import java.io.FileWriter; |
12 | import java.io.IOException; | 13 | import java.io.IOException; |
13 | import java.io.InputStream; | 14 | import java.io.InputStream; |
15 | +import java.io.OutputStreamWriter; | ||
14 | import java.io.PrintWriter; | 16 | import java.io.PrintWriter; |
17 | +import java.io.UnsupportedEncodingException; | ||
15 | import java.net.MalformedURLException; | 18 | import java.net.MalformedURLException; |
16 | import java.text.SimpleDateFormat; | 19 | import java.text.SimpleDateFormat; |
17 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
@@ -550,9 +553,8 @@ public class AvaliacaoController { | @@ -550,9 +553,8 @@ public class AvaliacaoController { | ||
550 | 553 | ||
551 | String nomeArquivo = url.replace("https://", "").replace("http://", "").replace("/", "").replace(".", "").replace("\"", "") + ".json"; | 554 | String nomeArquivo = url.replace("https://", "").replace("http://", "").replace("/", "").replace(".", "").replace("\"", "") + ".json"; |
552 | 555 | ||
553 | - File diretorioJson = new File(this.application.getRealPath("") | ||
554 | - + "/WEB-INF/arquivosJson/" | ||
555 | - + nomeArquivo); | 556 | + File diretorioJson = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosJson/"+ nomeArquivo);//"http://189.9.137.162:8080/eselo/arquivosJson/" |
557 | + //+ nomeArquivo); | ||
556 | 558 | ||
557 | ResumoAvaliacao resumoAvaliacao = null; | 559 | ResumoAvaliacao resumoAvaliacao = null; |
558 | 560 | ||
@@ -583,10 +585,16 @@ public class AvaliacaoController { | @@ -583,10 +585,16 @@ public class AvaliacaoController { | ||
583 | } | 585 | } |
584 | 586 | ||
585 | public void salvarAvaliacao(ResumoAvaliacao resumoAvaliacao) { | 587 | public void salvarAvaliacao(ResumoAvaliacao resumoAvaliacao) { |
586 | - File diretorioJson = new File(this.application.getRealPath("") | ||
587 | - + "/WEB-INF/arquivosJson"); | 588 | + File diretorioJson = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosJson"); |
589 | + | ||
590 | + //File diretorioJson = new File("http://189.9.137.162:8080/eselo/arquivosJson"); | ||
591 | + | ||
588 | diretorioJson.mkdir(); | 592 | diretorioJson.mkdir(); |
589 | 593 | ||
594 | + //File diretorioHtml = new File(this.application.getRealPath("") + "/WEB-INF/arquivosHtml"); | ||
595 | + | ||
596 | + File diretorioHtml = new File("http://189.9.137.162:8080/eselo/arquivosHtml"); | ||
597 | + | ||
590 | String nomeArquivo = ""; | 598 | String nomeArquivo = ""; |
591 | 599 | ||
592 | try { | 600 | try { |
@@ -596,7 +604,7 @@ public class AvaliacaoController { | @@ -596,7 +604,7 @@ public class AvaliacaoController { | ||
596 | e1.printStackTrace(); | 604 | e1.printStackTrace(); |
597 | } | 605 | } |
598 | 606 | ||
599 | - resumoAvaliacao.setUrlResultado(diretorioJson.toString() + "/" | 607 | + resumoAvaliacao.setUrlResultado(diretorioHtml.toString() + "/" |
600 | + nomeArquivo + ".html"); | 608 | + nomeArquivo + ".html"); |
601 | 609 | ||
602 | String json; | 610 | String json; |
@@ -613,6 +621,8 @@ public class AvaliacaoController { | @@ -613,6 +621,8 @@ public class AvaliacaoController { | ||
613 | gravarArq.printf(json); | 621 | gravarArq.printf(json); |
614 | 622 | ||
615 | arq.close(); | 623 | arq.close(); |
624 | + | ||
625 | + | ||
616 | } catch (IOException e) { | 626 | } catch (IOException e) { |
617 | e.printStackTrace(); | 627 | e.printStackTrace(); |
618 | } | 628 | } |
@@ -627,93 +637,279 @@ public class AvaliacaoController { | @@ -627,93 +637,279 @@ public class AvaliacaoController { | ||
627 | Recomendacao recomendacao; | 637 | Recomendacao recomendacao; |
628 | 638 | ||
629 | // File diretorioHtml = new File("arquivosHtml"); | 639 | // File diretorioHtml = new File("arquivosHtml"); |
630 | - File diretorioHtml = new File(this.application.getRealPath("") | ||
631 | - + "/WEB-INF/arquivosHtml"); | 640 | + File diretorioHtml = new File(this.application.getRealPath("") + "/WEB-INF/arquivosHtml"); |
632 | diretorioHtml.mkdir(); | 641 | diretorioHtml.mkdir(); |
633 | String nomeArquivo; | 642 | String nomeArquivo; |
634 | StringBuffer html = new StringBuffer(); | 643 | StringBuffer html = new StringBuffer(); |
635 | 644 | ||
636 | - html.append("<!DOCTYPE html>"); | ||
637 | - html.append("<html lang=\"pt-br\">"); | ||
638 | - html.append("<head>"); | ||
639 | - html.append("<meta charset=\"utf-8\">"); | ||
640 | - html.append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"); | ||
641 | - html.append("<meta name=\"description\" content=\"\">"); | ||
642 | - html.append("<meta name=\"author\" content=\"\">"); | ||
643 | - html.append("<link rel=\"shortcut icon\" href=\"static/ico/favicon.png\">"); | ||
644 | - | ||
645 | - html.append("<title>Painel de Acessibilidade Digital do Governo</title>"); | ||
646 | - | ||
647 | - html.append("<link href=\"" + this.application.getRealPath("") | ||
648 | - + "/static/css/painelAcessibilidade.css\" rel=\"stylesheet\">"); | ||
649 | - html.append("<link href=\"" + this.application.getRealPath("") | ||
650 | - + "/static/css/barra_brasil.css\" rel=\"stylesheet\">"); | ||
651 | - | ||
652 | - html.append("</head>"); | ||
653 | - html.append("<body>"); | ||
654 | - html.append("<header id=\"topoPagina\">"); | ||
655 | - html.append("<div>"); | ||
656 | - html.append(" <div id=\"topo\">"); | ||
657 | - html.append(" <ul id=\"accessibility\">"); | ||
658 | - html.append(" <li><a accesskey=\"1\" href=\"#inicioConteudo\" id=\"link-conteudo\">Ir"); | ||
659 | - html.append(" para o conteúdo <span>1</span>"); | ||
660 | - html.append(" </a></li>"); | ||
661 | - html.append(" <li><a accesskey=\"4\" href=\"#footer-brasil\" id=\"link-rodape\">Ir"); | ||
662 | - html.append(" para o rodapé <span>4</span>"); | ||
663 | - html.append(" </a></li>"); | ||
664 | - html.append(" </ul>"); | ||
665 | 645 | ||
666 | 646 | ||
667 | - html.append("<div id=\"logo\">"); | ||
668 | - html.append("<h1>"); | ||
669 | - html.append(" <span id=\"portal-title-1\">Painel de Acessibilidade Digital do Governo"); | ||
670 | - html.append(" </span> "); | ||
671 | - html.append("</h1>"); | ||
672 | - html.append("</div>"); | 647 | + |
648 | + try { | ||
649 | + nomeArquivo = URLNormalizer.normalize(resumoAvaliacao.getUrl()) | ||
650 | + .replace("/", "").replace(".", "") | ||
651 | + + ".txt"; | ||
652 | + | ||
653 | + OutputStreamWriter bufferOut = new OutputStreamWriter(new FileOutputStream(diretorioHtml + "/" + nomeArquivo),"UTF-8"); | ||
654 | + | ||
655 | + bufferOut.write("<!DOCTYPE html>"); | ||
656 | + bufferOut.write("<html lang=\"pt-br\">"); | ||
657 | + bufferOut.write("<head>"); | ||
658 | + bufferOut.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"); | ||
659 | + bufferOut.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"); | ||
660 | + | ||
661 | + bufferOut.write("<link rel=\"shortcut icon\" href=\"static/ico/favicon.png\">"); | ||
662 | + | ||
663 | + bufferOut.write("<title>Painel de Acessibilidade Digital do Governo</title>"); | ||
664 | + bufferOut.write("<link href=\"/eselo/static/css/painelAcessibilidade.css\" rel=\"stylesheet\">"); | ||
665 | + bufferOut.write("<link href=\"/eselo/static/css/barra_brasil.css\" rel=\"stylesheet\">"); | ||
666 | + | ||
667 | + | ||
668 | + bufferOut.write("</head>"); | ||
669 | + bufferOut.write("<body>"); | ||
670 | + bufferOut.write("<header id=\"topoPagina\">"); | ||
671 | + bufferOut.write("<div>"); | ||
672 | + bufferOut.write(" <div id=\"topo\">"); | ||
673 | + bufferOut.write(" <ul id=\"accessibility\">"); | ||
674 | + bufferOut.write(" <li><a accesskey=\"1\" href=\"#inicioConteudo\" id=\"link-conteudo\">Ir"); | ||
675 | + bufferOut.write(" para o conteúdo <span>1</span>"); | ||
676 | + bufferOut.write(" </a></li>"); | ||
677 | + bufferOut.write(" <li><a accesskey=\"4\" href=\"#footer-brasil\" id=\"link-rodape\">Ir"); | ||
678 | + bufferOut.write(" para o rodapé <span>4</span>"); | ||
679 | + bufferOut.write(" </a></li>"); | ||
680 | + bufferOut.write(" </ul>"); | ||
681 | + | ||
682 | + | ||
683 | + bufferOut.write("<div id=\"logo\">"); | ||
684 | + bufferOut.write("<h1>"); | ||
685 | + bufferOut.write(" <span id=\"portal-title-1\">Painel de Acessibilidade Digital do Governo"); | ||
686 | + bufferOut.write(" </span> "); | ||
687 | + bufferOut.write("</h1>"); | ||
688 | + bufferOut.write("</div>"); | ||
689 | + | ||
690 | + bufferOut.write("<div id=\"barra-brasil\" class=\"barra_brasil\">"); | ||
691 | + | ||
692 | + bufferOut.write("<ul id=\"menu-barra-temp\">"); | ||
693 | + bufferOut.write("<li><a class=\"primeiro-link\" href=\"http://brasil.gov.br\">Portal"); | ||
694 | + bufferOut.write("do Governo Brasileiro</a></li>"); | ||
695 | + bufferOut.write("<li><a class=\"segundo-link\""); | ||
696 | + bufferOut.write("href=\"http://epwg.governoeletronico.gov.br/barra/atualize.html\">Atualize"); | ||
697 | + bufferOut.write("sua Barra de Governo</a></li>"); | ||
698 | + bufferOut.write("</ul>"); | ||
699 | + bufferOut.write("</div>"); | ||
700 | + bufferOut.write("</header>"); | ||
701 | + bufferOut.write("<div class=\"contanner\"> "); | ||
702 | + | ||
703 | + bufferOut.write("<div id=\"contato\">"); | ||
704 | + bufferOut.write(" <a href=\"http://www.planejamento.gov.br/\">Ministério do Planejamento - http://www.planejamento.gov.br (link para um novo sítio)</a>"); | ||
705 | + bufferOut.write("</div>"); | ||
706 | + | ||
707 | + bufferOut.write("<div class=\"contanner\">"); | ||
708 | + bufferOut.write("<a id=\"inicioConteudo\" class=\"oculto\">Início do conteúdo</a>"); | ||
709 | + bufferOut.write(" <div class=\"logoAvaliacao\">"); | ||
710 | + bufferOut.write(" <div id=\"emag\">"); | ||
711 | + bufferOut.write(" <label>eMAG</label> "); | ||
712 | + bufferOut.write(" </div>"); | ||
713 | + bufferOut.write(" <div id=\"testesAutomaticos\"> "); | ||
714 | + bufferOut.write(" <label>Testes Automáticos<br>" | ||
715 | + + resumoAvaliacao.getValor() + "/100</label> </div> "); | ||
716 | + | ||
717 | + bufferOut.write(" <div id=\"grafico\"> "); | ||
718 | + bufferOut.write(" <canvas id=\"myChart\" width=\"400\" height=\"400\"></canvas> "); | ||
719 | + bufferOut.write(" </div>"); | ||
720 | + bufferOut.write(" </div>"); | ||
721 | + bufferOut.write("<div class=\"avaliacao\">"); | ||
722 | + | ||
723 | + bufferOut.write("<label><h2><strong>Teste Automático de Acessibilidade</strong></label></h2>"); | ||
724 | + bufferOut.write("<label><strong>Órgão: </strong>" | ||
725 | + + avaliacao.getUrl().getUrl() + "</label><br>"); | ||
726 | + bufferOut.write("<label><strong>Página: </strong>" | ||
727 | + + avaliacao.getUrl().getUrl() + "</label><br>"); | ||
728 | + bufferOut.write("<label><strong>Data de Avaliação: </strong>" | ||
729 | + + Util.dataHoraAtual() + "</label><br>"); | ||
730 | + bufferOut.write("<label><strong>Nota: </strong>" + avaliacao.getNota() | ||
731 | + + "</label><br>"); | ||
732 | + bufferOut.write("<hr>"); | ||
733 | + | ||
734 | + resultadosRecomendacao = new ArrayList<ResultadoRecomendacao>(); | ||
735 | + resultadosRecomendacao = daoResultadoRecomendacao | ||
736 | + .getResultadoRecomendacao(avaliacao); | ||
737 | + | ||
738 | + for (ResultadoRecomendacao resultadoRecomendacao : resultadosRecomendacao) { | ||
739 | + | ||
740 | + recomendacao = new Recomendacao(); | ||
741 | + recomendacao = daoRecomendacao | ||
742 | + .getRecomendacaoPorNumeroRecomendacao(resultadoRecomendacao | ||
743 | + .getNumRecomendacao()); | ||
744 | + | ||
745 | + bufferOut.write("<h3><label><strong>Recomendação " | ||
746 | + + resultadoRecomendacao.getNumRecomendacao() + " - " | ||
747 | + + recomendacao.getDescricao() + "</strong></label></h3>"); | ||
748 | + bufferOut.write("<label><strong>Peso da Recomendação: </strong>" | ||
749 | + + recomendacao.getPeso() + "</label><br>"); | ||
750 | + bufferOut.write("<label><strong>Nota da Recomendação: </strong>" | ||
751 | + + resultadoRecomendacao.getNotaRecomendacao() | ||
752 | + + "</label><br>"); | ||
753 | + | ||
754 | + resultadosCriterio = daoResultadoCriterio | ||
755 | + .getResultadoCriterio(resultadoRecomendacao); | ||
756 | + | ||
757 | + bufferOut.write("<h3><label><strong>Critérios Avaliados</strong></label></h3>"); | ||
758 | + bufferOut.write("<table>"); | ||
759 | + | ||
760 | + bufferOut.write("<thead>"); | ||
761 | + bufferOut.write("<tr>"); | ||
762 | + bufferOut.write("<th id=\"numero\">Nº Critério</th>"); | ||
763 | + bufferOut.write("<th id=\"criterio\">Critério</th>"); | ||
764 | + bufferOut.write("<th id=\"tipoTeste\">Tipo de Teste</th>"); | ||
765 | + bufferOut.write("<th id=\"peso\">Peso</th>"); | ||
766 | + bufferOut.write("<th id=\"erros\">Erros</th>"); | ||
767 | + bufferOut.write("<th id=\"itens\">Itens</th>"); | ||
768 | + bufferOut.write("<th id=\"nota\">Nota</th>"); | ||
769 | + bufferOut.write("</tr>"); | ||
770 | + bufferOut.write("</thead>"); | ||
771 | + | ||
772 | + bufferOut.write("<tbody>"); | ||
773 | + bufferOut.write("</tbody>"); | ||
774 | + | ||
775 | + for (ResultadoCriterio resultadoCriterio : resultadosCriterio) { | ||
776 | + criterio = new Criterio(); | ||
777 | + criterio = daoCriterio.load(resultadoCriterio.getIdCriterio()); | ||
778 | + | ||
779 | + bufferOut.write("<tr>"); | ||
780 | + bufferOut.write("<td headers=\"numero\" class=\"celula\">" | ||
781 | + + criterio.getNumeroCriterio() + "</td>"); | ||
782 | + bufferOut.write("<td headers=\"criterio\" class=\"celula\">" | ||
783 | + + criterio.getDescricao() + "</td>"); | ||
784 | + bufferOut.write("<td headers=\"tipoTeste\" class=\"celula\">" | ||
785 | + + criterio.getTipoTeste().getTipo() + "</td>"); | ||
786 | + bufferOut.write("<td headers=\"peso\" class=\"celula\">" | ||
787 | + + criterio.getPeso() + "</td>"); | ||
788 | + bufferOut.write("<td headers=\"erros\" class=\"celula\">" | ||
789 | + + resultadoCriterio.getNumErros() + "</td>"); | ||
790 | + bufferOut.write("<td headers=\"itens\" class=\"celula\">" | ||
791 | + + resultadoCriterio.getNumItens() + "</td>"); | ||
792 | + bufferOut.write("<td headers=\"nota\" class=\"celula\">" | ||
793 | + + resultadoCriterio.getNotaCriterio() + "</td>"); | ||
794 | + bufferOut.write("</tr>"); | ||
795 | + | ||
796 | + } | ||
797 | + bufferOut.write("</div>"); | ||
798 | + bufferOut.write("</tbody>"); | ||
799 | + bufferOut.write("</table><br>"); | ||
800 | + } | ||
801 | + | ||
802 | + bufferOut.write("<a id=\"fimConteudo\" class=\"oculto\">Fim do conteúdo</a>"); | ||
803 | + bufferOut.write("</div>"); | ||
804 | + bufferOut.write("<div id=\"voltar-topo\">"); | ||
805 | + bufferOut.write("<a href=\"#topoPagina\">Voltar para o topo</a>"); | ||
806 | + bufferOut.write("</div>"); | ||
807 | + bufferOut.write("</div>"); | ||
808 | + bufferOut.write("<footer id=\"footer-brasil\"></footer>"); | ||
809 | + bufferOut.write("<script defer=\"defer\" src=\"//barra.brasil.gov.br/barra.js\""); | ||
810 | + bufferOut.write("type=\"text/javascript\"></script>"); | ||
811 | + bufferOut.write("<script src=\"http://code.jquery.com/jquery-2.1.4.min.js\"></script>"); | ||
812 | + bufferOut.write("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js\"></script>"); | ||
813 | + bufferOut.write("<script src=\"/static/js/chart.js\"></script>"); | ||
814 | + bufferOut.write("<noscript>Seu navegador não possui suporte para JavaScript!</noscript>"); | ||
815 | + bufferOut.write("</body>"); | ||
816 | + bufferOut.write("</html>"); | ||
817 | + | ||
818 | + bufferOut.close(); | ||
819 | + | ||
820 | + if (diretorioHtml.exists()) { | ||
821 | + salvarAvaliacao(resumoAvaliacao); | ||
822 | + } | ||
823 | + } catch (UnsupportedEncodingException e1) { | ||
824 | + e1.printStackTrace(); | ||
825 | + } catch (FileNotFoundException e1) { | ||
826 | + e1.printStackTrace(); | ||
827 | + } catch (MalformedURLException e) { | ||
828 | + e.printStackTrace(); | ||
829 | + } catch (IOException e) { | ||
830 | + e.printStackTrace(); | ||
831 | + } | ||
832 | + | ||
833 | + | ||
834 | + | ||
835 | + /* bufferOut.write("<!DOCTYPE html>"); | ||
836 | + bufferOut.write("<html lang=\"pt-br\">"); | ||
837 | + bufferOut.write("<head>"); | ||
838 | + bufferOut.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"); | ||
839 | + bufferOut.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"); | ||
840 | + | ||
841 | + bufferOut.write("<link rel=\"shortcut icon\" href=\"static/ico/favicon.png\">"); | ||
842 | + | ||
843 | + bufferOut.write("<title>Painel de Acessibilidade Digital do Governo</title>"); | ||
844 | + bufferOut.write("<link href=\"/eselo/static/css/painelAcessibilidade.css\" rel=\"stylesheet\">"); | ||
845 | + bufferOut.write("<link href=\"/eselo/static/css/barra_brasil.css\" rel=\"stylesheet\">"); | ||
846 | + | ||
847 | + | ||
848 | + bufferOut.write("</head>"); | ||
849 | + bufferOut.write("<body>"); | ||
850 | + bufferOut.write("<header id=\"topoPagina\">"); | ||
851 | + bufferOut.write("<div>"); | ||
852 | + bufferOut.write(" <div id=\"topo\">"); | ||
853 | + bufferOut.write(" <ul id=\"accessibility\">"); | ||
854 | + bufferOut.write(" <li><a accesskey=\"1\" href=\"#inicioConteudo\" id=\"link-conteudo\">Ir"); | ||
855 | + bufferOut.write(" para o conteúdo <span>1</span>"); | ||
856 | + bufferOut.write(" </a></li>"); | ||
857 | + bufferOut.write(" <li><a accesskey=\"4\" href=\"#footer-brasil\" id=\"link-rodape\">Ir"); | ||
858 | + bufferOut.write(" para o rodapé <span>4</span>"); | ||
859 | + bufferOut.write(" </a></li>"); | ||
860 | + bufferOut.write(" </ul>"); | ||
861 | + | ||
862 | + | ||
863 | + bufferOut.write("<div id=\"logo\">"); | ||
864 | + bufferOut.write("<h1>"); | ||
865 | + bufferOut.write(" <span id=\"portal-title-1\">Painel de Acessibilidade Digital do Governo"); | ||
866 | + bufferOut.write(" </span> "); | ||
867 | + bufferOut.write("</h1>"); | ||
868 | + bufferOut.write("</div>"); | ||
673 | 869 | ||
674 | - html.append("<div id=\"barra-brasil\" class=\"barra_brasil\">"); | ||
675 | - | ||
676 | - html.append("<ul id=\"menu-barra-temp\">"); | ||
677 | - html.append("<li><a class=\"primeiro-link\" href=\"http://brasil.gov.br\">Portal"); | ||
678 | - html.append("do Governo Brasileiro</a></li>"); | ||
679 | - html.append("<li><a class=\"segundo-link\""); | ||
680 | - html.append("href=\"http://epwg.governoeletronico.gov.br/barra/atualize.html\">Atualize"); | ||
681 | - html.append("sua Barra de Governo</a></li>"); | ||
682 | - html.append("</ul>"); | ||
683 | - html.append("</div>"); | ||
684 | - html.append("</header>"); | ||
685 | - html.append("<div class=\"contanner\"> "); | ||
686 | - | ||
687 | - html.append("<div id=\"contato\">"); | ||
688 | - html.append(" <a href=\"http://www.planejamento.gov.br/\">Ministério do Planejamento - http://www.planejamento.gov.br (link para um novo sítio)</a>"); | ||
689 | - html.append("</div>"); | ||
690 | - | ||
691 | - html.append("<div class=\"contanner\">"); | ||
692 | - html.append("<a id=\"inicioConteudo\" class=\"oculto\">Início do conteúdo</a>"); | ||
693 | - html.append(" <div class=\"logoAvaliacao\">"); | ||
694 | - html.append(" <div id=\"emag\">"); | ||
695 | - html.append(" <label>eMAG</label> "); | ||
696 | - html.append(" </div>"); | ||
697 | - html.append(" <div id=\"testesAutomaticos\"> "); | ||
698 | - html.append(" <label>Testes Automáticos<br>" | 870 | + bufferOut.write("<div id=\"barra-brasil\" class=\"barra_brasil\">"); |
871 | + | ||
872 | + bufferOut.write("<ul id=\"menu-barra-temp\">"); | ||
873 | + bufferOut.write("<li><a class=\"primeiro-link\" href=\"http://brasil.gov.br\">Portal"); | ||
874 | + bufferOut.write("do Governo Brasileiro</a></li>"); | ||
875 | + bufferOut.write("<li><a class=\"segundo-link\""); | ||
876 | + bufferOut.write("href=\"http://epwg.governoeletronico.gov.br/barra/atualize.html\">Atualize"); | ||
877 | + bufferOut.write("sua Barra de Governo</a></li>"); | ||
878 | + bufferOut.write("</ul>"); | ||
879 | + bufferOut.write("</div>"); | ||
880 | + bufferOut.write("</header>"); | ||
881 | + bufferOut.write("<div class=\"contanner\"> "); | ||
882 | + | ||
883 | + bufferOut.write("<div id=\"contato\">"); | ||
884 | + bufferOut.write(" <a href=\"http://www.planejamento.gov.br/\">Ministério do Planejamento - http://www.planejamento.gov.br (link para um novo sítio)</a>"); | ||
885 | + bufferOut.write("</div>"); | ||
886 | + | ||
887 | + bufferOut.write("<div class=\"contanner\">"); | ||
888 | + bufferOut.write("<a id=\"inicioConteudo\" class=\"oculto\">Início do conteúdo</a>"); | ||
889 | + bufferOut.write(" <div class=\"logoAvaliacao\">"); | ||
890 | + bufferOut.write(" <div id=\"emag\">"); | ||
891 | + bufferOut.write(" <label>eMAG</label> "); | ||
892 | + bufferOut.write(" </div>"); | ||
893 | + bufferOut.write(" <div id=\"testesAutomaticos\"> "); | ||
894 | + bufferOut.write(" <label>Testes Automáticos<br>" | ||
699 | + resumoAvaliacao.getValor() + "/100</label> </div> "); | 895 | + resumoAvaliacao.getValor() + "/100</label> </div> "); |
700 | 896 | ||
701 | - html.append(" <div id=\"grafico\"> "); | ||
702 | - html.append(" Gráfico "); | ||
703 | - html.append(" </div>"); | ||
704 | - html.append(" </div>"); | ||
705 | - html.append("<div class=\"avaliacao\">"); | 897 | + bufferOut.write(" <div id=\"grafico\"> "); |
898 | + bufferOut.write(" Gráfico "); | ||
899 | + bufferOut.write(" </div>"); | ||
900 | + bufferOut.write(" </div>"); | ||
901 | + bufferOut.write("<div class=\"avaliacao\">"); | ||
706 | 902 | ||
707 | - html.append("<label><h2><strong>Teste Automático de Acessibilidade</strong></label></h2>"); | ||
708 | - html.append("<label><strong>Órgão: </strong>" | 903 | + bufferOut.write("<label><h2><strong>Teste Automático de Acessibilidade</strong></label></h2>"); |
904 | + bufferOut.write("<label><strong>Órgão: </strong>" | ||
709 | + avaliacao.getUrl().getUrl() + "</label><br>"); | 905 | + avaliacao.getUrl().getUrl() + "</label><br>"); |
710 | - html.append("<label><strong>Página: </strong>" | 906 | + bufferOut.write("<label><strong>Página: </strong>" |
711 | + avaliacao.getUrl().getUrl() + "</label><br>"); | 907 | + avaliacao.getUrl().getUrl() + "</label><br>"); |
712 | - html.append("<label><strong>Data de Avaliação: </strong>" | 908 | + bufferOut.write("<label><strong>Data de Avaliação: </strong>" |
713 | + Util.dataHoraAtual() + "</label><br>"); | 909 | + Util.dataHoraAtual() + "</label><br>"); |
714 | - html.append("<label><strong>Nota: </strong>" + avaliacao.getNota() | 910 | + bufferOut.write("<label><strong>Nota: </strong>" + avaliacao.getNota() |
715 | + "</label><br>"); | 911 | + "</label><br>"); |
716 | - html.append("<hr>"); | 912 | + bufferOut.write("<hr>"); |
717 | 913 | ||
718 | resultadosRecomendacao = new ArrayList<ResultadoRecomendacao>(); | 914 | resultadosRecomendacao = new ArrayList<ResultadoRecomendacao>(); |
719 | resultadosRecomendacao = daoResultadoRecomendacao | 915 | resultadosRecomendacao = daoResultadoRecomendacao |
@@ -726,82 +922,82 @@ public class AvaliacaoController { | @@ -726,82 +922,82 @@ public class AvaliacaoController { | ||
726 | .getRecomendacaoPorNumeroRecomendacao(resultadoRecomendacao | 922 | .getRecomendacaoPorNumeroRecomendacao(resultadoRecomendacao |
727 | .getNumRecomendacao()); | 923 | .getNumRecomendacao()); |
728 | 924 | ||
729 | - html.append("<h3><label><strong>Recomendação " | 925 | + bufferOut.write("<h3><label><strong>Recomendação " |
730 | + resultadoRecomendacao.getNumRecomendacao() + " - " | 926 | + resultadoRecomendacao.getNumRecomendacao() + " - " |
731 | + recomendacao.getDescricao() + "</strong></label></h3>"); | 927 | + recomendacao.getDescricao() + "</strong></label></h3>"); |
732 | - html.append("<label><strong>Peso da Recomendação: </strong>" | 928 | + bufferOut.write("<label><strong>Peso da Recomendação: </strong>" |
733 | + recomendacao.getPeso() + "</label><br>"); | 929 | + recomendacao.getPeso() + "</label><br>"); |
734 | - html.append("<label><strong>Nota da Recomendação: </strong>" | 930 | + bufferOut.write("<label><strong>Nota da Recomendação: </strong>" |
735 | + resultadoRecomendacao.getNotaRecomendacao() | 931 | + resultadoRecomendacao.getNotaRecomendacao() |
736 | + "</label><br>"); | 932 | + "</label><br>"); |
737 | 933 | ||
738 | resultadosCriterio = daoResultadoCriterio | 934 | resultadosCriterio = daoResultadoCriterio |
739 | .getResultadoCriterio(resultadoRecomendacao); | 935 | .getResultadoCriterio(resultadoRecomendacao); |
740 | 936 | ||
741 | - html.append("<h3><label><strong>Critérios Avaliados</strong></label></h3>"); | ||
742 | - html.append("<table>"); | 937 | + bufferOut.write("<h3><label><strong>Critérios Avaliados</strong></label></h3>"); |
938 | + bufferOut.write("<table>"); | ||
743 | 939 | ||
744 | - html.append("<thead>"); | ||
745 | - html.append("<tr>"); | ||
746 | - html.append("<th id=\"numero\">Nº Critério</th>"); | ||
747 | - html.append("<th id=\"criterio\">Critério</th>"); | ||
748 | - html.append("<th id=\"tipoTeste\">Tipo de Teste</th>"); | ||
749 | - html.append("<th id=\"peso\">Peso</th>"); | ||
750 | - html.append("<th id=\"erros\">Erros</th>"); | ||
751 | - html.append("<th id=\"itens\">Itens</th>"); | ||
752 | - html.append("<th id=\"nota\">Nota</th>"); | ||
753 | - html.append("</tr>"); | ||
754 | - html.append("</thead>"); | 940 | + bufferOut.write("<thead>"); |
941 | + bufferOut.write("<tr>"); | ||
942 | + bufferOut.write("<th id=\"numero\">Nº Critério</th>"); | ||
943 | + bufferOut.write("<th id=\"criterio\">Critério</th>"); | ||
944 | + bufferOut.write("<th id=\"tipoTeste\">Tipo de Teste</th>"); | ||
945 | + bufferOut.write("<th id=\"peso\">Peso</th>"); | ||
946 | + bufferOut.write("<th id=\"erros\">Erros</th>"); | ||
947 | + bufferOut.write("<th id=\"itens\">Itens</th>"); | ||
948 | + bufferOut.write("<th id=\"nota\">Nota</th>"); | ||
949 | + bufferOut.write("</tr>"); | ||
950 | + bufferOut.write("</thead>"); | ||
755 | 951 | ||
756 | - html.append("<tbody>"); | ||
757 | - html.append("</tbody>"); | 952 | + bufferOut.write("<tbody>"); |
953 | + bufferOut.write("</tbody>"); | ||
758 | 954 | ||
759 | for (ResultadoCriterio resultadoCriterio : resultadosCriterio) { | 955 | for (ResultadoCriterio resultadoCriterio : resultadosCriterio) { |
760 | criterio = new Criterio(); | 956 | criterio = new Criterio(); |
761 | criterio = daoCriterio.load(resultadoCriterio.getIdCriterio()); | 957 | criterio = daoCriterio.load(resultadoCriterio.getIdCriterio()); |
762 | 958 | ||
763 | - html.append("<tr>"); | ||
764 | - html.append("<td headers=\"numero\" class=\"celula\">" | 959 | + bufferOut.write("<tr>"); |
960 | + bufferOut.write("<td headers=\"numero\" class=\"celula\">" | ||
765 | + criterio.getNumeroCriterio() + "</td>"); | 961 | + criterio.getNumeroCriterio() + "</td>"); |
766 | - html.append("<td headers=\"criterio\" class=\"celula\">" | 962 | + bufferOut.write("<td headers=\"criterio\" class=\"celula\">" |
767 | + criterio.getDescricao() + "</td>"); | 963 | + criterio.getDescricao() + "</td>"); |
768 | - html.append("<td headers=\"tipoTeste\" class=\"celula\">" | 964 | + bufferOut.write("<td headers=\"tipoTeste\" class=\"celula\">" |
769 | + criterio.getTipoTeste().getTipo() + "</td>"); | 965 | + criterio.getTipoTeste().getTipo() + "</td>"); |
770 | - html.append("<td headers=\"peso\" class=\"celula\">" | 966 | + bufferOut.write("<td headers=\"peso\" class=\"celula\">" |
771 | + criterio.getPeso() + "</td>"); | 967 | + criterio.getPeso() + "</td>"); |
772 | - html.append("<td headers=\"erros\" class=\"celula\">" | 968 | + bufferOut.write("<td headers=\"erros\" class=\"celula\">" |
773 | + resultadoCriterio.getNumErros() + "</td>"); | 969 | + resultadoCriterio.getNumErros() + "</td>"); |
774 | - html.append("<td headers=\"itens\" class=\"celula\">" | 970 | + bufferOut.write("<td headers=\"itens\" class=\"celula\">" |
775 | + resultadoCriterio.getNumItens() + "</td>"); | 971 | + resultadoCriterio.getNumItens() + "</td>"); |
776 | - html.append("<td headers=\"nota\" class=\"celula\">" | 972 | + bufferOut.write("<td headers=\"nota\" class=\"celula\">" |
777 | + resultadoCriterio.getNotaCriterio() + "</td>"); | 973 | + resultadoCriterio.getNotaCriterio() + "</td>"); |
778 | - html.append("</tr>"); | 974 | + bufferOut.write("</tr>"); |
779 | 975 | ||
780 | } | 976 | } |
781 | - html.append("</div>"); | ||
782 | - html.append("</tbody>"); | ||
783 | - html.append("</table><br>"); | 977 | + bufferOut.write("</div>"); |
978 | + bufferOut.write("</tbody>"); | ||
979 | + bufferOut.write("</table><br>"); | ||
784 | } | 980 | } |
785 | 981 | ||
786 | - html.append("<a id=\"fimConteudo\" class=\"oculto\">Fim do conteúdo</a>"); | ||
787 | - html.append("</div>"); | ||
788 | - html.append("<div id=\"voltar-topo\">"); | ||
789 | - html.append("<a href=\"#topoPagina\">Voltar para o topo</a>"); | ||
790 | - html.append("</div>"); | ||
791 | - html.append("</div>"); | ||
792 | - html.append("<footer id=\"footer-brasil\"></footer>"); | ||
793 | - html.append("<script defer=\"defer\" src=\"//barra.brasil.gov.br/barra.js\""); | ||
794 | - html.append("type=\"text/javascript\"></script>"); | ||
795 | - html.append("<noscript>Seu navegador não possui suporte para JavaScript!</noscript>"); | ||
796 | - html.append("</body>"); | ||
797 | - html.append("</html>"); | 982 | + bufferOut.write("<a id=\"fimConteudo\" class=\"oculto\">Fim do conteúdo</a>"); |
983 | + bufferOut.write("</div>"); | ||
984 | + bufferOut.write("<div id=\"voltar-topo\">"); | ||
985 | + bufferOut.write("<a href=\"#topoPagina\">Voltar para o topo</a>"); | ||
986 | + bufferOut.write("</div>"); | ||
987 | + bufferOut.write("</div>"); | ||
988 | + bufferOut.write("<footer id=\"footer-brasil\"></footer>"); | ||
989 | + bufferOut.write("<script defer=\"defer\" src=\"//barra.brasil.gov.br/barra.js\""); | ||
990 | + bufferOut.write("type=\"text/javascript\"></script>"); | ||
991 | + bufferOut.write("<noscript>Seu navegador não possui suporte para JavaScript!</noscript>"); | ||
992 | + bufferOut.write("</body>"); | ||
993 | + bufferOut.write("</html>"); | ||
798 | 994 | ||
799 | FileWriter arq; | 995 | FileWriter arq; |
800 | PrintWriter gravarArq; | 996 | PrintWriter gravarArq; |
801 | try { | 997 | try { |
802 | nomeArquivo = URLNormalizer.normalize(resumoAvaliacao.getUrl()) | 998 | nomeArquivo = URLNormalizer.normalize(resumoAvaliacao.getUrl()) |
803 | .replace("/", "").replace(".", "") | 999 | .replace("/", "").replace(".", "") |
804 | - + ".html"; | 1000 | + + ".txt"; |
805 | arq = new FileWriter(diretorioHtml + "/" + nomeArquivo); | 1001 | arq = new FileWriter(diretorioHtml + "/" + nomeArquivo); |
806 | gravarArq = new PrintWriter(arq); | 1002 | gravarArq = new PrintWriter(arq); |
807 | gravarArq.printf(html.toString()); | 1003 | gravarArq.printf(html.toString()); |
@@ -814,7 +1010,7 @@ public class AvaliacaoController { | @@ -814,7 +1010,7 @@ public class AvaliacaoController { | ||
814 | 1010 | ||
815 | } catch (IOException e) { | 1011 | } catch (IOException e) { |
816 | e.printStackTrace(); | 1012 | e.printStackTrace(); |
817 | - } | 1013 | + }*/ |
818 | } | 1014 | } |
819 | 1015 | ||
820 | } | 1016 | } |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/arquivosHtmlController.java
0 → 100644
@@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
1 | +package br.com.eselo.controller; | ||
2 | + | ||
3 | +import java.io.BufferedReader; | ||
4 | +import java.io.File; | ||
5 | +import java.io.FileInputStream; | ||
6 | +import java.io.FileNotFoundException; | ||
7 | +import java.io.FileReader; | ||
8 | +import java.io.IOException; | ||
9 | +import java.io.InputStreamReader; | ||
10 | + | ||
11 | +import javax.servlet.ServletContext; | ||
12 | +import javax.swing.text.html.HTML; | ||
13 | + | ||
14 | +import br.com.caelum.vraptor.Get; | ||
15 | +import br.com.caelum.vraptor.Resource; | ||
16 | +import br.com.caelum.vraptor.Result; | ||
17 | +import br.com.eselo.model.ResumoAvaliacao; | ||
18 | + | ||
19 | +@Resource | ||
20 | +public class arquivosHtmlController { | ||
21 | + | ||
22 | + private ServletContext application; | ||
23 | + private Result result; | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + public arquivosHtmlController(ServletContext application, Result result) { | ||
28 | + super(); | ||
29 | + this.application = application; | ||
30 | + this.result = result; | ||
31 | + | ||
32 | + | ||
33 | + } | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + @Get("/arquivosHtml/{nomeArquivo}") | ||
41 | + public void arquivosHtml(String nomeArquivo) | ||
42 | + { | ||
43 | + | ||
44 | + File diretorioHtml = new File(this.application.getRealPath("")+ "/WEB-INF/arquivosHtml/"+ nomeArquivo.replace(".html",".txt")); | ||
45 | + //+ nomeArquivo); | ||
46 | + StringBuilder html = new StringBuilder(); | ||
47 | + try { | ||
48 | + BufferedReader myBuffer = new BufferedReader(new InputStreamReader(new FileInputStream(diretorioHtml), "UTF-8")); | ||
49 | + String linha; | ||
50 | + | ||
51 | + | ||
52 | + while ( ( linha = myBuffer.readLine() ) != null) { | ||
53 | + html.append(linha); | ||
54 | + } | ||
55 | + myBuffer.close(); | ||
56 | + | ||
57 | + result.include("html", html); | ||
58 | + | ||
59 | + } catch (FileNotFoundException e1) { | ||
60 | + e1.printStackTrace(); | ||
61 | + } catch (IOException e) { | ||
62 | + e.printStackTrace(); | ||
63 | + } | ||
64 | + | ||
65 | +} | ||
66 | +} |