img conformance in xhtml

This commit is contained in:
Grahame Grieve 2022-09-08 22:22:17 +10:00
parent 15e738e373
commit 4cbbce4ec8
9 changed files with 33 additions and 33 deletions

View File

@ -81,7 +81,7 @@ public class BinaryRenderer {
String fn = "Binary-Native-"+bin.getId()+ext;
TextFile.bytesToFile(bin.getContent(), Utilities.path(folder, fn));
filenames.add(fn);
x.img("Binary-Native-"+bin.getId()+ext);
x.img("Binary-Native-"+bin.getId()+ext, "Binary");
}
}

View File

@ -383,10 +383,10 @@ public class LibraryRenderer extends ResourceRenderer {
p.code().tx(att.getContentType()+lang(att));
}
if (att.getData().length < LibraryRenderer.DATA_IMG_SIZE_CUTOFF) {
x.img("data: "+att.getContentType()+">;base64,"+b64(att.getData()));
x.img("data: "+att.getContentType()+">;base64,"+b64(att.getData()), "data");
} else {
String filename = "Library-"+baseId+(counter == 0 ? "" : "-"+Integer.toString(counter))+"."+imgExtension(att.getContentType());
x.img(filename);
x.img(filename, "data");
}
} else if (txt != null && !noShowData) {
XhtmlNode p = x.para();

View File

@ -124,9 +124,9 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
li.style("font-size: 11px");
if (useSelect) {
if (opt.getInitialSelected()) {
li.img("icon-selected.png");
li.img("icon-selected.png", "icon");
} else {
li.img("icon-not-selected.png");
li.img("icon-not-selected.png", "icon");
}
}
if (opt.getValue().isPrimitive()) {
@ -678,26 +678,26 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "Can change the subject of the questionnaire").img(Utilities.path(context.getLocalPrefix(), "icon-qi-subject.png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "Can change the subject of the questionnaire").img(Utilities.path(context.getLocalPrefix(), "icon-qi-subject.png"), "icon");
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
hasFlag = true;
flags.ah(Utilities.pathURL(context.getSpecificationLink(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"));
flags.ah(Utilities.pathURL(context.getSpecificationLink(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"), "icon");
d.style("background-color: #eeeeee");
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "Is optional to display").img(Utilities.path(context.getLocalPrefix(), "icon-qi-optional.png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "Is optional to display").img(Utilities.path(context.getLocalPrefix(), "icon-qi-optional.png"), "icon");
}
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "Is linked to an observation").img(Utilities.path(context.getLocalPrefix(), "icon-qi-observation.png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "Is linked to an observation").img(Utilities.path(context.getLocalPrefix(), "icon-qi-observation.png"), "icon");
}
if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory")) {
CodeableConcept cc = i.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").getValueCodeableConcept();
String code = cc.getCode("http://hl7.org/fhir/questionnaire-display-category");
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-displayCategory", "Category: "+code).img(Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-displayCategory", "Category: "+code).img(Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"), "icon");
}
if (i.hasMaxLength()) {
@ -853,7 +853,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
boolean ext = false;
XhtmlNode td = tbl.tr().td("structure").colspan("2").span(null, null).attribute("class", "self-link-parent");
td.an(q.getId());
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_root.gif"));
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_root.gif"), "icon");
td.tx(" Questionnaire ");
td.b().tx(q.getId());
@ -906,10 +906,10 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
XhtmlNode td = tbl.tr().td("structure").colspan("2").span(null, null).attribute("class", "self-link-parent");
td.an("item."+qi.getLinkId());
for (QuestionnaireItemComponent p : parents) {
td.ah("#item."+p.getLinkId()).img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"));
td.ah("#item."+p.getLinkId()).img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"), "icon");
td.tx(" > ");
}
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"));
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"), "icon");
td.tx(" Item ");
td.b().tx(qi.getLinkId());

View File

@ -81,7 +81,7 @@ public class BinaryRenderer {
String fn = "Binary-Native-"+bin.getId()+ext;
TextFile.bytesToFile(bin.getContent(), Utilities.path(folder, fn));
filenames.add(fn);
x.img("Binary-Native-"+bin.getId()+ext);
x.img("Binary-Native-"+bin.getId()+ext, "binary");
}
}

View File

@ -383,10 +383,10 @@ public class LibraryRenderer extends ResourceRenderer {
p.code().tx(att.getContentType()+lang(att));
}
if (att.getData().length < LibraryRenderer.DATA_IMG_SIZE_CUTOFF) {
x.img("data: "+att.getContentType()+">;base64,"+b64(att.getData()));
x.img("data: "+att.getContentType()+">;base64,"+b64(att.getData()), "data");
} else {
String filename = "Library-"+baseId+(counter == 0 ? "" : "-"+Integer.toString(counter))+"."+imgExtension(att.getContentType());
x.img(filename);
x.img(filename, "data");
}
} else if (txt != null && !noShowData) {
XhtmlNode p = x.para();

View File

@ -766,11 +766,11 @@ public class PatientRenderer extends ResourceRenderer {
att.getData() != null && (!context.isInlineGraphics() || (att.getData().length > 0 && att.getData().length < MAX_IMAGE_LENGTH))) {
String ext = extensionForType(att.getContentType());
if (context.isInlineGraphics() || Utilities.noString(context.getDestDir()) || ext == null) {
td.img("data:"+att.getContentType()+";base64,"+att.getDataElement().asStringValue());
td.img("data:"+att.getContentType()+";base64,"+att.getDataElement().asStringValue(), "patient photo");
} else {
String n = UUID.randomUUID().toString().toLowerCase()+ext;
TextFile.bytesToFile(att.getData(), new File(Utilities.path(context.getDestDir(), n)));
td.img(n);
td.img(n, "patient photo");
}
return;
}

View File

@ -124,9 +124,9 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
li.style("font-size: 11px");
if (useSelect) {
if (opt.getInitialSelected()) {
li.img("icon-selected.png");
li.img("icon-selected.png", "icon");
} else {
li.img("icon-not-selected.png");
li.img("icon-not-selected.png", "icon");
}
}
if (opt.getValue().isPrimitive()) {
@ -679,26 +679,26 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "Can change the subject of the questionnaire").img(Utilities.path(context.getLocalPrefix(), "icon-qi-subject.png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "Can change the subject of the questionnaire").img(Utilities.path(context.getLocalPrefix(), "icon-qi-subject.png"), "icon");
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
hasFlag = true;
flags.ah(Utilities.pathURL(context.getSpecificationLink(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"));
flags.ah(Utilities.pathURL(context.getSpecificationLink(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"), "icon");
d.style("background-color: #eeeeee");
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "Is optional to display").img(Utilities.path(context.getLocalPrefix(), "icon-qi-optional.png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "Is optional to display").img(Utilities.path(context.getLocalPrefix(), "icon-qi-optional.png"), "icon");
}
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "Is linked to an observation").img(Utilities.path(context.getLocalPrefix(), "icon-qi-observation.png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "Is linked to an observation").img(Utilities.path(context.getLocalPrefix(), "icon-qi-observation.png"), "icon");
}
if (i.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory")) {
CodeableConcept cc = i.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").getValueCodeableConcept();
String code = cc.getCode("http://hl7.org/fhir/questionnaire-display-category");
hasFlag = true;
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-displayCategory", "Category: "+code).img(Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"));
flags.ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-displayCategory", "Category: "+code).img(Utilities.path(context.getLocalPrefix(), "icon-qi-"+code+".png"), "icon");
}
if (i.hasMaxLength()) {
@ -854,7 +854,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
boolean ext = false;
XhtmlNode td = tbl.tr().td("structure").colspan("2").span(null, null).attribute("class", "self-link-parent");
td.an(q.getId());
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_root.gif"));
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_root.gif"), "icon");
td.tx(" Questionnaire ");
td.b().tx(q.getId());
@ -907,10 +907,10 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
XhtmlNode td = tbl.tr().td("structure").colspan("2").span(null, null).attribute("class", "self-link-parent");
td.an("item."+qi.getLinkId());
for (QuestionnaireItemComponent p : parents) {
td.ah("#item."+p.getLinkId()).img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"));
td.ah("#item."+p.getLinkId()).img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"), "icon");
td.tx(" > ");
}
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"));
td.img(Utilities.path(context.getLocalPrefix(), "icon_q_item.png"), "icon");
td.tx(" Item ");
td.b().tx(qi.getLinkId());

View File

@ -323,7 +323,7 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
protected void clipboard(XhtmlNode x, String img, String title, String source) {
XhtmlNode span = x.span("cursor: pointer", "Copy "+title+" Format to clipboard");
span.attribute("onClick", "navigator.clipboard.writeText('"+Utilities.escapeJson(source)+"');");
span.img(img).setAttribute("width", "24px").setAttribute("height", "16px");
span.img(img, "btn").setAttribute("width", "24px").setAttribute("height", "16px");
}

View File

@ -656,12 +656,12 @@ public class XhtmlNode implements IBaseXhtml {
return addTag("a").attribute("href", href).attribute("title", title);
}
public XhtmlNode img(String src) {
return addTag("img").attribute("src", src);
public XhtmlNode img(String src, String alt) {
return addTag("img").attribute("src", src).attribute("alt", alt);
}
public XhtmlNode img(String src, String title) {
return addTag("img").attribute("src", src).attribute("title", title);
public XhtmlNode img(String src, String alt, String title) {
return addTag("img").attribute("src", src).attribute("alt", alt).attribute("title", title);
}
public XhtmlNode an(String href) {