Mercurial > dive4elements > river
changeset 6230:954dbb0806f3
Add imageLinkHTML function to WikiLinks class
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 07 Jun 2013 11:47:47 +0200 |
parents | 3fea9701d58d |
children | bfbccad9c3f0 |
files | gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java Thu Jun 06 18:23:17 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java Fri Jun 07 11:47:47 2013 +0200 @@ -16,6 +16,27 @@ public class WikiLinks { + public static String imageLinkHTML(FLYS instance, String url, String imageUrl) { + String saml = null; + if (instance != null && instance.getCurrentUser() != null) { + saml = instance.getCurrentUser().getSamlXMLBase64(); + } + String quotedUrl = SafeHtmlUtils.htmlEscape(url); + String quotedImage = SafeHtmlUtils.htmlEscape(imageUrl); + + if (saml != null) { + return "<form method=\"POST\" target=\"_blank\" action=\"" + + quotedUrl + "\">" + + "<input type=\"hidden\" name=\"saml\" value=\"" + + SafeHtmlUtils.htmlEscape(saml) + "\">" + + "<input type=\"image\" src=\""+ quotedImage + "\">" + + "</form>"; + } + else { + return "<a href=\"" + quotedUrl + "\"><img src=\"" + quotedImage + "\"></a>"; + } + } + public static String linkHTML(FLYS flys, String url, String text) { String saml = flys.getCurrentUser().getSamlXMLBase64(); String quotedUrl = SafeHtmlUtils.htmlEscape(url);