Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java @ 6986:e562a9a42495
GWT client: Do not assumed there is always a SAML ticket when generating Wiki links.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 11 Sep 2013 11:41:29 +0200 |
parents | 244beb29418e |
children | bef9937a2dd9 |
comparison
equal
deleted
inserted
replaced
6985:1faf543e267c | 6986:e562a9a42495 |
---|---|
48 String quotedUrl = SafeHtmlUtils.htmlEscape(url); | 48 String quotedUrl = SafeHtmlUtils.htmlEscape(url); |
49 String quotedText = SafeHtmlUtils.htmlEscape(text); | 49 String quotedText = SafeHtmlUtils.htmlEscape(text); |
50 | 50 |
51 if (currentUser != null) { | 51 if (currentUser != null) { |
52 String saml = currentUser.getSamlXMLBase64(); | 52 String saml = currentUser.getSamlXMLBase64(); |
53 final DynamicForm form = new DynamicForm(); | 53 if (saml != null) { |
54 form.setMethod(FormMethod.POST); | 54 final DynamicForm form = new DynamicForm(); |
55 form.setTarget("_blank"); | 55 form.setMethod(FormMethod.POST); |
56 form.setAction(quotedUrl); | 56 form.setTarget("_blank"); |
57 form.setCanSubmit(true); | 57 form.setAction(quotedUrl); |
58 LinkItem item = new LinkItem("saml"); | 58 form.setCanSubmit(true); |
59 item.setShowTitle(false); | 59 LinkItem item = new LinkItem("saml"); |
60 item.setLinkTitle(quotedText); | 60 item.setTextBoxStyle("font-size: large;"); |
61 item.setValue(SafeHtmlUtils.htmlEscape(saml)); | 61 item.setShowTitle(false); |
62 item.addClickHandler(new ClickHandler() { | 62 item.setLinkTitle(quotedText); |
63 @Override | 63 item.setValue(SafeHtmlUtils.htmlEscape(saml)); |
64 public void onClick(ClickEvent event) { | 64 item.addClickHandler(new ClickHandler() { |
65 form.submitForm(); | 65 @Override |
66 } | 66 public void onClick(ClickEvent event) { |
67 }); | 67 form.submitForm(); |
68 form.setFields(item); | 68 } |
69 return form; | 69 }); |
70 form.setFields(item); | |
71 return form; | |
72 } | |
70 } | 73 } |
71 else { | 74 DynamicForm form = new DynamicForm(); |
72 DynamicForm form = new DynamicForm(); | 75 LinkItem item = new LinkItem(quotedText); |
73 LinkItem item = new LinkItem(quotedText); | 76 item.setShowTitle(false); |
74 item.setShowTitle(false); | 77 item.setTarget(quotedUrl); |
75 item.setTarget(quotedUrl); | 78 return form; |
76 return form; | |
77 } | |
78 } | 79 } |
79 | 80 |
80 public static DynamicForm dynamicForm(FLYS flys, String url) { | 81 public static DynamicForm dynamicForm(FLYS flys, String url) { |
81 User currentUser = flys.getCurrentUser(); | 82 User currentUser = flys.getCurrentUser(); |
82 String quotedUrl = SafeHtmlUtils.htmlEscape(url); | 83 String quotedUrl = SafeHtmlUtils.htmlEscape(url); |
83 | 84 |
84 if (currentUser != null) { | 85 if (currentUser != null) { |
85 String saml = currentUser.getSamlXMLBase64(); | 86 String saml = currentUser.getSamlXMLBase64(); |
86 saml = SafeHtmlUtils.htmlEscape(saml); | 87 if (saml != null) { |
87 GWT.log("saml=" + saml); | 88 saml = SafeHtmlUtils.htmlEscape(saml); |
88 DynamicForm form = new DynamicForm(); | 89 GWT.log("saml=" + saml); |
89 form.setID("wikiDynamicForm"); | 90 DynamicForm form = new DynamicForm(); |
90 form.setMethod(FormMethod.POST); | 91 form.setID("wikiDynamicForm"); |
91 form.setTarget("_blank"); | 92 form.setMethod(FormMethod.POST); |
92 form.setAction(quotedUrl); | 93 form.setTarget("_blank"); |
93 form.setCanSubmit(true); | 94 form.setAction(quotedUrl); |
94 HiddenItem item = new HiddenItem("saml"); | 95 form.setCanSubmit(true); |
95 item.setDefaultValue(saml); | 96 HiddenItem item = new HiddenItem("saml"); |
96 item.setValue(saml); | 97 item.setDefaultValue(saml); |
97 form.setFields(item); | 98 item.setValue(saml); |
98 //form.setValue("saml", saml); | 99 form.setFields(item); |
99 return form; | 100 //form.setValue("saml", saml); |
101 return form; | |
102 } | |
100 } | 103 } |
101 else { | 104 DynamicForm form = new DynamicForm(); |
102 DynamicForm form = new DynamicForm(); | 105 form.setTarget("_blank"); |
103 form.setTarget("_blank"); | 106 form.setAction(quotedUrl); |
104 form.setAction(quotedUrl); | 107 return form; |
105 return form; | |
106 } | |
107 } | 108 } |
108 } | 109 } |