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 549 webui.validator.error.message.report_not_found = The requested report was not found on the server
550 550  
551 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 555 webui.validator.validation_report.validation_request.heading = Validation request information
553 556 webui.validator.validation_report.validation_statistics.heading = Statistics
554 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 549 webui.validator.error.message.report_not_found = O relatório pedido não foi encontrado.
550 550  
551 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 555 webui.validator.validation_report.validation_request.heading = Informação do pedido de validação
553 556 webui.validator.validation_report.validation_statistics.heading = Estatísticas de validação
554 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 476  
477 477 // number of records validated
478 478 appendTableRowHtml(sb, "validation_statistics.number_of_records", lang,
479   - numberOfRecords + "", "100%");
  479 + numberOfRecords + "", "100%","");
480 480  
481 481 // number of records with problems
482 482 appendTableRowHtml(
... ... @@ -485,8 +485,7 @@ public class ValidationResults {
485 485 lang,
486 486 numberOfRecordsWithProblems + "",
487 487 formatPercentage(getPercentage(numberOfRecordsWithProblems,
488   - numberOfRecords)) + "%");
489   -
  488 + numberOfRecords)) + "%","");
490 489 // number of records with warnings
491 490 appendTableRowHtml(
492 491 sb,
... ... @@ -494,7 +493,7 @@ public class ValidationResults {
494 493 lang,
495 494 numberOfRecordsWithWarnings + "",
496 495 formatPercentage(getPercentage(numberOfRecordsWithWarnings,
497   - numberOfRecords)) + "%");
  496 + numberOfRecords)) + "%","#results");
498 497  
499 498 // number of records with errors
500 499 appendTableRowHtml(
... ... @@ -503,18 +502,24 @@ public class ValidationResults {
503 502 lang,
504 503 numberOfRecordsWithErrors + "",
505 504 formatPercentage(getPercentage(numberOfRecordsWithErrors,
506   - numberOfRecords)) + "%");
  505 + numberOfRecords)) + "%","#results");
507 506  
508 507 sb.append("</table></div><div class=\"clearfix\">&nbsp;</div>");
509 508 }
510 509  
511 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 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 518 "webui.validator.validation_report." + i18n, lang)
517   - + "</strong></td>");
  519 + + "</strong>");
  520 + if(isAnchored)
  521 + sb.append("</a>");
  522 + sb.append("</td>");
518 523 sb.append("<td class=\"text-right\" style=\"width:" + COL_2_WIDTH
519 524 + "\">" + td2 + "</td>");
520 525 sb.append("<td class=\"text-right\" style=\"width:" + COL_3_WIDTH
... ... @@ -526,25 +531,26 @@ public class ValidationResults {
526 531 sb.append("<div class=\"metadataStatistics\">" + Constants.LINE_SEP);
527 532  
528 533 // dc.type stats
529   - addMetadataFieldStatisticsTableHtml(sb, types.entrySet(), "dc.type");
  534 + addMetadataFieldStatisticsTableHtml(sb, types.entrySet(), "dc.type", lang);
530 535  
531 536 // dc.format stats
532   - addMetadataFieldStatisticsTableHtml(sb, formats.entrySet(), "dc.format");
  537 + addMetadataFieldStatisticsTableHtml(sb, formats.entrySet(), "dc.format", lang);
533 538  
534 539 // dc.language stats
535   - addMetadataFieldStatisticsTableHtml(sb, languages.entrySet(),
536   - "dc.language");
  540 + addMetadataFieldStatisticsTableHtml(sb, languages.entrySet(), "dc.language", lang);
537 541  
538 542 // dc.rights stats
539   - addMetadataFieldStatisticsTableHtml(sb, rights.entrySet(), "dc.rights");
  543 + addMetadataFieldStatisticsTableHtml(sb, rights.entrySet(), "dc.rights", lang);
540 544  
541 545 sb.append("</div><div class=\"clearfix\">&nbsp;</div>");
542 546 }
543 547  
544 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 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 554 sb.append("<table class=\"table table-condensed table-hover\">");
549 555  
550 556 int notIdentified = numberOfRecords;
... ... @@ -640,7 +646,7 @@ public class ValidationResults {
640 646 ValidationRequestInfo validationRequest, StringBuilder sb) {
641 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 650 + LocalizationManager
645 651 .getMessage(
646 652 "webui.validator.validation_report.validation_results.heading",
... ...