Commit c9ed744693c1754d9cf31c3f9c6a7cee93fd41e2

Authored by lyandro.santana
1 parent 8ad3b91a

conteudo

git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/ASES%20-%20Web/ASES%20-%20Web/Fontes/avaliador-api@10367 c2178572-b5ca-4887-91d2-9e3a90c7d55b
src/main/java/br/com/checker/emag/core/ContentEvaluation.java
@@ -259,8 +259,7 @@ public class ContentEvaluation extends Evaluation{ @@ -259,8 +259,7 @@ public class ContentEvaluation extends Evaluation{
259 259
260 private boolean isLinkUnavailable(Element link){ 260 private boolean isLinkUnavailable(Element link){
261 261
262 - //if(link.getAttributeValue("href") != null && !link.getAttributeValue("href").equals("#") && !link.getAttributeValue("href").equals("/") && !link.getAttributeValue("href").contains("javascript")){  
263 - if(link.getAttributeValue("href") != null && link.getAttributeValue("href").contains("http://")){ 262 + if(link.getAttributeValue("href") != null && !link.getAttributeValue("href").equals("#") && !link.getAttributeValue("href").equals("/") && !link.getAttributeValue("href").contains("javascript")){
264 263
265 int[] codErro ={400, 401,402, 403,404, 405, 406, 407, 408,409, 410, 411, 412, 414,415, 416, 417, 418,422, 423,424,425,426,450,499,500,501,502,503,504,505}; 264 int[] codErro ={400, 401,402, 403,404, 405, 406, 407, 408,409, 410, 411, 412, 414,415, 416, 417, 418,422, 423,424,425,426,450,499,500,501,502,503,504,505};
266 int codResponse = 0; 265 int codResponse = 0;
@@ -487,9 +486,60 @@ public class ContentEvaluation extends Evaluation{ @@ -487,9 +486,60 @@ public class ContentEvaluation extends Evaluation{
487 486
488 } 487 }
489 488
490 - Map<String, String> aMap = new HashMap<String, String>(); 489 +
  490 + Map<String, Element> aMap = new HashMap<String, Element>();
  491 +
  492 +
  493 +
  494 + for (Element img : getDocument().getAllElements("img")) {
  495 +
  496 + Attribute src = img.getAttributes().get("src");
  497 + Attribute alt = img.getAttributes().get("alt");
  498 +
  499 + boolean isVerificado = false;
  500 +
  501 + if (alt != null && !alt.getValue().isEmpty()) {
  502 +
  503 + if(!aMap.containsKey(src.getValue())){
  504 +
  505 + int rowImgVerificado = this.getRow(img);
  506 +
  507 + for (Element imgA : getDocument().getAllElements("img")) {
  508 + int rowImgA = this.getRow(imgA);
  509 +
  510 + if(rowImgA > rowImgVerificado){
  511 +
  512 + Attribute srcAtt = imgA.getAttributes().get("src");
  513 + Attribute altAtt = imgA.getAttributes().get("alt");
  514 +
  515 + if (altAtt != null && !altAtt.getValue().isEmpty()) {
  516 + if(alt.getValue().equals(altAtt.getValue())){
  517 + if(srcAtt != null){
  518 + if(!src.getValue().equals(srcAtt.getValue())){
  519 + occurrences.add(buildOccurrence("3.6", false, imgA.toString(), imgA, "5"));
  520 + aMap.put(srcAtt.getValue(), img);
  521 + isVerificado = true;
  522 + }
  523 + }
  524 + }
  525 + }
  526 + }
  527 + }
  528 + }
  529 +
  530 + aMap.put(src.getValue(), img);
  531 +
  532 + if(isVerificado)
  533 + occurrences.add(buildOccurrence("3.6", false, img.toString(), img, "5"));
  534 + }
  535 + }
  536 +
  537 +
  538 + /*Map<String, String> aMap = new HashMap<String, String>();
491 539
492 for (Element img : getDocument().getAllElements("img")) { 540 for (Element img : getDocument().getAllElements("img")) {
  541 +
  542 + Attribute src = img.getAttributes().get("src");
493 Attribute altAtt = img.getAttributes().get("alt"); 543 Attribute altAtt = img.getAttributes().get("alt");
494 if (altAtt != null && !altAtt.getValue().isEmpty()) { 544 if (altAtt != null && !altAtt.getValue().isEmpty()) {
495 if(aMap.containsKey(altAtt.getValue())){ 545 if(aMap.containsKey(altAtt.getValue())){
@@ -502,7 +552,7 @@ public class ContentEvaluation extends Evaluation{ @@ -502,7 +552,7 @@ public class ContentEvaluation extends Evaluation{
502 aMap.put(altAtt.getValue(), img.toString()); 552 aMap.put(altAtt.getValue(), img.toString());
503 } 553 }
504 } 554 }
505 - } 555 + }*/
506 556
507 for (Element img : getDocument().getAllElements("img")) { 557 for (Element img : getDocument().getAllElements("img")) {
508 Attribute alt = img.getAttributes().get("alt"); 558 Attribute alt = img.getAttributes().get("alt");
src/main/java/br/com/checker/emag/core/MarkEvaluation.java
@@ -759,7 +759,8 @@ public class MarkEvaluation extends Evaluation { @@ -759,7 +759,8 @@ public class MarkEvaluation extends Evaluation {
759 759
760 if(footer == null) 760 if(footer == null)
761 occurrences.add(this.buildOccurrence("1.8", false, "Observa&ccedil;&atilde;o - Sem fonte (N&atilde;o existe tag <FOOTER>)", getDocument().getFirstElement(),"1")); 761 occurrences.add(this.buildOccurrence("1.8", false, "Observa&ccedil;&atilde;o - Sem fonte (N&atilde;o existe tag <FOOTER>)", getDocument().getFirstElement(),"1"));
762 - 762 +
  763 + }else{
763 764
764 boolean hasBanner = false; 765 boolean hasBanner = false;
765 boolean hasNavigation = false; 766 boolean hasNavigation = false;
@@ -788,9 +789,9 @@ public class MarkEvaluation extends Evaluation { @@ -788,9 +789,9 @@ public class MarkEvaluation extends Evaluation {
788 789
789 if(!hasMain) 790 if(!hasMain)
790 occurrences.add(this.buildOccurrence("1.8", false, "Observa&ccedil;&atilde;o - Sem fonte (N&atilde;o existe LANDMARKS na p&aacute;gina - <MAIN>)", getDocument().getFirstElement(),"2")); 791 occurrences.add(this.buildOccurrence("1.8", false, "Observa&ccedil;&atilde;o - Sem fonte (N&atilde;o existe LANDMARKS na p&aacute;gina - <MAIN>)", getDocument().getFirstElement(),"2"));
  792 +
791 } 793 }
792 794
793 -  
794 return occurrences; 795 return occurrences;
795 } 796 }
796 797