fix rendering issues

This commit is contained in:
Grahame Grieve 2024-08-03 23:46:31 +08:00
parent af5eaafd34
commit 7fda67ca7e
3 changed files with 35 additions and 7 deletions

View File

@ -126,14 +126,13 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
private void renderOptions(List<ResourceWrapper> items, XhtmlNode x) {
for (ResourceWrapper i : items) {
renderItemOptions(x, i);
renderItemOptionsList(x, i);
renderOptions(i.children("item"), x);
}
}
public void renderItemOptions(XhtmlNode x, ResourceWrapper i) {
if (i.has("answerOption")) {
assert x.getName().equals("select");
for (ResourceWrapper opt : i.children("answerOption")) {
String value = "??";
String text = "??";
@ -157,6 +156,35 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
x.option(value, text, selected);
}
}
}
public void renderItemOptionsList(XhtmlNode x, ResourceWrapper i) {
if (i.has("answerOption")) {
x.an(context.prefixAnchor("opt-item."+i.primitiveValue("linkId")));
x.para().b().tx(context.formatPhrase(RenderingContext.QUEST_ANSW, i.primitiveValue("linkId"))+" ");
XhtmlNode ul = x.ul();
for (ResourceWrapper opt : i.children("answerOption")) {
XhtmlNode li = ul.li();
li.style("font-size: 11px");
ResourceWrapper v = opt.child("value");
if (v.isPrimitive()) {
li.tx(v.primitiveValue());
} else if (v.fhirType().equals("Coding")) {
String link = v.has("system") ? new ContextUtilities(context.getWorker()).getLinkForUrl(context.getLink(KnownLinkType.SPEC), v.primitiveValue("system")) : null;
if (link == null) {
li.tx(v.primitiveValue("system")+"#"+v.primitiveValue("code"));
} else {
li.ah(link).tx(displaySystem(v.primitiveValue("system")));
li.tx(": "+v.primitiveValue("code"));
}
if (v.has("display")) {
li.tx(" (\""+v.primitiveValue("display")+"\")");
}
} else {
li.tx("??");
}
}
}
}
private boolean hasAnyOptions(List<ResourceWrapper> items) {

View File

@ -3330,7 +3330,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} else if (count > 1) {
warning(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, false, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_XHTML_MULTIPLE_MATCHES, href, xpath, node.allText(), CommaSeparatedStringBuilder.join(", ", refs));
}
} else if (href.contains(":")) {
} else if (href.contains(":") && Utilities.isAbsoluteUrl(href)) {
String scheme = href.substring(0, href.indexOf(":"));
if (rule(errors, "2024-07-20", IssueType.INVALID, e.line(), e.col(), path, !isActiveScheme(scheme), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_XHTML_ACTIVE_HREF, href, xpath, Utilities.stripEoln(node.allText()).trim(), scheme)) {
if (rule(errors, "2024-07-20", IssueType.INVALID, e.line(), e.col(), path, isLiteralScheme(scheme), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_XHTML_LITERAL_HREF, href, xpath, Utilities.stripEoln(node.allText()).trim(), scheme)) {

View File

@ -736,8 +736,8 @@ public class StructureMapValidator extends BaseValidator {
type = "string";
break;
default:
rule(errors, "2023-03-01", IssueType.INVALID, target.line(), target.col(), stack.getLiteralPath(), false, I18nConstants.SM_TARGET_TRANSFORM_NOT_CHECKED, transform);
ok = false;
warning(errors, "2023-03-01", IssueType.INVALID, target.line(), target.col(), stack.getLiteralPath(), false, I18nConstants.SM_TARGET_TRANSFORM_NOT_CHECKED, transform);
// ok = false;
}
if (vn != null && type != null) {
@ -910,8 +910,8 @@ public class StructureMapValidator extends BaseValidator {
}
break;
default:
rule(errors, "2023-03-01", IssueType.INVALID, target.line(), target.col(), stack.getLiteralPath(), false, I18nConstants.SM_TARGET_TRANSFORM_NOT_CHECKED, transform);
ok = false;
warning(errors, "2023-03-01", IssueType.INVALID, target.line(), target.col(), stack.getLiteralPath(), false, I18nConstants.SM_TARGET_TRANSFORM_NOT_CHECKED, transform);
// ok = false;
}
if (vn != null) {
// it's just a warning: maybe this'll work out at run time?