Commit 0284d35b8b6750da8f347b9193b3da062c2cef75

Authored by Fernando Ribeiro
1 parent 47c070216c
Exists in master

Changes to validator2. Added anchors

config/Messages_en.properties
@@ -549,6 +549,9 @@ webui.validator.error.message.default = Something went wrong! Please try again a @@ -549,6 +549,9 @@ webui.validator.error.message.default = Something went wrong! Please try again a
549 webui.validator.error.message.report_not_found = The requested report was not found on the server 549 webui.validator.error.message.report_not_found = The requested report was not found on the server
550 550
551 webui.validator.validation_report.heading = Validation report 551 webui.validator.validation_report.heading = Validation report
  552 +webui.validator.validation_report.translation.dc.type = Document type
  553 +webui.validator.validation_report.translation.dc.language = Language
  554 +webui.validator.validation_report.translation.dc.rights = Access type
552 webui.validator.validation_report.validation_request.heading = Validation request information 555 webui.validator.validation_report.validation_request.heading = Validation request information
553 webui.validator.validation_report.validation_statistics.heading = Statistics 556 webui.validator.validation_report.validation_statistics.heading = Statistics
554 webui.validator.validation_report.validation_statistics.records = Summary 557 webui.validator.validation_report.validation_statistics.records = Summary
config/Messages_pt.properties
@@ -549,6 +549,9 @@ webui.validator.error.message.default = Aconteceu um erro! Tente novamente e cas @@ -549,6 +549,9 @@ webui.validator.error.message.default = Aconteceu um erro! Tente novamente e cas
549 webui.validator.error.message.report_not_found = O relatório pedido não foi encontrado. 549 webui.validator.error.message.report_not_found = O relatório pedido não foi encontrado.
550 550
551 webui.validator.validation_report.heading = Relatório de validação 551 webui.validator.validation_report.heading = Relatório de validação
  552 +webui.validator.validation_report.translation.dc.type = Tipo de documento
  553 +webui.validator.validation_report.translation.dc.language = Linguagem
  554 +webui.validator.validation_report.translation.dc.rights = Tipo de acesso
552 webui.validator.validation_report.validation_request.heading = Informação do pedido de validação 555 webui.validator.validation_report.validation_request.heading = Informação do pedido de validação
553 webui.validator.validation_report.validation_statistics.heading = Estatísticas de validação 556 webui.validator.validation_report.validation_statistics.heading = Estatísticas de validação
554 webui.validator.validation_report.validation_statistics.records = Sumário 557 webui.validator.validation_report.validation_statistics.records = Sumário
src/pt/keep/metarepository/core/validator2/application/ValidationResults.java
@@ -476,7 +476,7 @@ public class ValidationResults { @@ -476,7 +476,7 @@ public class ValidationResults {
476 476
477 // number of records validated 477 // number of records validated
478 appendTableRowHtml(sb, "validation_statistics.number_of_records", lang, 478 appendTableRowHtml(sb, "validation_statistics.number_of_records", lang,
479 - numberOfRecords + "", "100%"); 479 + numberOfRecords + "", "100%","");
480 480
481 // number of records with problems 481 // number of records with problems
482 appendTableRowHtml( 482 appendTableRowHtml(
@@ -485,8 +485,7 @@ public class ValidationResults { @@ -485,8 +485,7 @@ public class ValidationResults {
485 lang, 485 lang,
486 numberOfRecordsWithProblems + "", 486 numberOfRecordsWithProblems + "",
487 formatPercentage(getPercentage(numberOfRecordsWithProblems, 487 formatPercentage(getPercentage(numberOfRecordsWithProblems,
488 - numberOfRecords)) + "%");  
489 - 488 + numberOfRecords)) + "%","");
490 // number of records with warnings 489 // number of records with warnings
491 appendTableRowHtml( 490 appendTableRowHtml(
492 sb, 491 sb,
@@ -494,7 +493,7 @@ public class ValidationResults { @@ -494,7 +493,7 @@ public class ValidationResults {
494 lang, 493 lang,
495 numberOfRecordsWithWarnings + "", 494 numberOfRecordsWithWarnings + "",
496 formatPercentage(getPercentage(numberOfRecordsWithWarnings, 495 formatPercentage(getPercentage(numberOfRecordsWithWarnings,
497 - numberOfRecords)) + "%"); 496 + numberOfRecords)) + "%","#results");
498 497
499 // number of records with errors 498 // number of records with errors
500 appendTableRowHtml( 499 appendTableRowHtml(
@@ -503,18 +502,24 @@ public class ValidationResults { @@ -503,18 +502,24 @@ public class ValidationResults {
503 lang, 502 lang,
504 numberOfRecordsWithErrors + "", 503 numberOfRecordsWithErrors + "",
505 formatPercentage(getPercentage(numberOfRecordsWithErrors, 504 formatPercentage(getPercentage(numberOfRecordsWithErrors,
506 - numberOfRecords)) + "%"); 505 + numberOfRecords)) + "%","#results");
507 506
508 sb.append("</table></div><div class=\"clearfix\">&nbsp;</div>"); 507 sb.append("</table></div><div class=\"clearfix\">&nbsp;</div>");
509 } 508 }
510 509
511 private void appendTableRowHtml(StringBuilder sb, String i18n, String lang, 510 private void appendTableRowHtml(StringBuilder sb, String i18n, String lang,
512 - String td2, String td3) { 511 + String td2, String td3, String anchorTag) {
  512 + boolean isAnchored = !anchorTag.equals("");
513 sb.append("<tr>"); 513 sb.append("<tr>");
514 - sb.append("<td class=\"text-label\"><strong>"  
515 - + LocalizationManager.getMessage( 514 + sb.append("<td class=\"text-label\">");
  515 + if(isAnchored)
  516 + sb.append("<a href=\"#results\">");
  517 + sb.append("<strong>"+ LocalizationManager.getMessage(
516 "webui.validator.validation_report." + i18n, lang) 518 "webui.validator.validation_report." + i18n, lang)
517 - + "</strong></td>"); 519 + + "</strong>");
  520 + if(isAnchored)
  521 + sb.append("</a>");
  522 + sb.append("</td>");
518 sb.append("<td class=\"text-right\" style=\"width:" + COL_2_WIDTH 523 sb.append("<td class=\"text-right\" style=\"width:" + COL_2_WIDTH
519 + "\">" + td2 + "</td>"); 524 + "\">" + td2 + "</td>");
520 sb.append("<td class=\"text-right\" style=\"width:" + COL_3_WIDTH 525 sb.append("<td class=\"text-right\" style=\"width:" + COL_3_WIDTH
@@ -526,25 +531,26 @@ public class ValidationResults { @@ -526,25 +531,26 @@ public class ValidationResults {
526 sb.append("<div class=\"metadataStatistics\">" + Constants.LINE_SEP); 531 sb.append("<div class=\"metadataStatistics\">" + Constants.LINE_SEP);
527 532
528 // dc.type stats 533 // dc.type stats
529 - addMetadataFieldStatisticsTableHtml(sb, types.entrySet(), "dc.type"); 534 + addMetadataFieldStatisticsTableHtml(sb, types.entrySet(), "dc.type", lang);
530 535
531 // dc.format stats 536 // dc.format stats
532 - addMetadataFieldStatisticsTableHtml(sb, formats.entrySet(), "dc.format"); 537 + addMetadataFieldStatisticsTableHtml(sb, formats.entrySet(), "dc.format", lang);
533 538
534 // dc.language stats 539 // dc.language stats
535 - addMetadataFieldStatisticsTableHtml(sb, languages.entrySet(),  
536 - "dc.language"); 540 + addMetadataFieldStatisticsTableHtml(sb, languages.entrySet(), "dc.language", lang);
537 541
538 // dc.rights stats 542 // dc.rights stats
539 - addMetadataFieldStatisticsTableHtml(sb, rights.entrySet(), "dc.rights"); 543 + addMetadataFieldStatisticsTableHtml(sb, rights.entrySet(), "dc.rights", lang);
540 544
541 sb.append("</div><div class=\"clearfix\">&nbsp;</div>"); 545 sb.append("</div><div class=\"clearfix\">&nbsp;</div>");
542 } 546 }
543 547
544 private void addMetadataFieldStatisticsTableHtml(StringBuilder sb, 548 private void addMetadataFieldStatisticsTableHtml(StringBuilder sb,
545 - Set<Entry<String, Integer>> entries, String header) { 549 + Set<Entry<String, Integer>> entries, String header, String lang) {
546 if (entries.size() > 0) { 550 if (entries.size() > 0) {
547 - sb.append("<h4>" + header + "</h4>" + Constants.LINE_SEP); 551 + sb.append("<h4>" + header + " ( "+LocalizationManager.getMessage(
  552 + "webui.validator.validation_report.translation."
  553 + + header, lang)+" )" + "</h4>"+ Constants.LINE_SEP);
548 sb.append("<table class=\"table table-condensed table-hover\">"); 554 sb.append("<table class=\"table table-condensed table-hover\">");
549 555
550 int notIdentified = numberOfRecords; 556 int notIdentified = numberOfRecords;
@@ -640,7 +646,7 @@ public class ValidationResults { @@ -640,7 +646,7 @@ public class ValidationResults {
640 ValidationRequestInfo validationRequest, StringBuilder sb) { 646 ValidationRequestInfo validationRequest, StringBuilder sb) {
641 String lang = validationRequest.getLang(); 647 String lang = validationRequest.getLang();
642 648
643 - sb.append("<div class=\"panel panel-default recordsWithProblems\"><div class=\"panel-heading\"><h3>" 649 + sb.append("<div id=\"results\" class=\"panel panel-default recordsWithProblems\"><div class=\"panel-heading\"><h3>"
644 + LocalizationManager 650 + LocalizationManager
645 .getMessage( 651 .getMessage(
646 "webui.validator.validation_report.validation_results.heading", 652 "webui.validator.validation_report.validation_results.heading",