diff --git a/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java b/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java index 9522642183c56fe94234543057fc3a6856aa5892..2353da27a64864a86dfa1e75b1c668a935e611bf 100644 --- a/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java +++ b/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java @@ -710,6 +710,17 @@ public class VelocityRenderDecorator implements Closeable { return notEmpty; } + public int parseInt(String text) { + try { + if(StringHelper.containsNonWhitespace(text)) { + return Integer.parseInt(text); + } + return -1; + } catch (NumberFormatException e) { + return -1; + } + } + /** * @param componentName * @return true if the component with name componentName is a child of the current container. Used to "if" the render diff --git a/src/main/java/org/olat/ims/qti21/ui/components/_content/drawingInteraction.html b/src/main/java/org/olat/ims/qti21/ui/components/_content/drawingInteraction.html index e4100668ebdb34d596a244fb2569007588fbe09e..e54e00e355853b8cbc5a4da3f0b42bd35c4456bf 100644 --- a/src/main/java/org/olat/ims/qti21/ui/components/_content/drawingInteraction.html +++ b/src/main/java/org/olat/ims/qti21/ui/components/_content/drawingInteraction.html @@ -47,9 +47,8 @@ </div> #end - #set($Integer = 0) - #set($widthWithBorder = $Integer.parseInt(${interaction.object.width}) + 2) - #set($heightWithBorder = $Integer.parseInt(${interaction.object.height}) + 2) + #set($widthWithBorder = $r.parseInt(${interaction.object.width}) + 2) + #set($heightWithBorder = $r.parseInt(${interaction.object.height}) + 2) <div id="sketch" style="border:1px solid black; width:${widthWithBorder}px; height:${heightWithBorder}px;" draggable="false" ondragstart="return false;"> <canvas id="paint" width="${interaction.object.width}" height="${interaction.object.height}" style="background:url('${r.convertLinkFull($interaction.object.data)}')" draggable="false" ondragstart="return false;"></canvas> </div>