Revision 6e6e914e src/gr/ebs/gss/client/CredentialsDialog.java
b/src/gr/ebs/gss/client/CredentialsDialog.java | ||
---|---|---|
71 | 71 |
HorizontalPanel buttons = new HorizontalPanel(); |
72 | 72 |
|
73 | 73 |
HTML text; |
74 |
text = new HTML("<table><tr><td>" + AbstractImagePrototype.create(images.warn()).getHTML() + "</td><td>" + "Are you sure you want to create a new WebDAV password?</td></tr></table>"); |
|
74 |
text = new HTML("<table><tr><td>" + |
|
75 |
AbstractImagePrototype.create(images.warn()).getHTML() + |
|
76 |
"</td><td>" + "Are you sure you want to create a new " + |
|
77 |
"WebDAV password?</td></tr></table>"); |
|
75 | 78 |
text.setStyleName("gss-warnMessage"); |
76 | 79 |
outer.add(text); |
77 | 80 |
|
78 |
// Create the 'Yes' button, along with a listener that hides the dialog
|
|
79 |
// when the button is clicked and resets the password. |
|
81 |
// Create the 'Yes' button, along with a listener that hides the |
|
82 |
// dialog when the button is clicked and resets the password.
|
|
80 | 83 |
Button ok = new Button("Yes", new ClickHandler() { |
81 | 84 |
@Override |
82 | 85 |
public void onClick(ClickEvent event) { |
... | ... | |
108 | 111 |
@Override |
109 | 112 |
protected void onPreviewNativeEvent(NativePreviewEvent preview) { |
110 | 113 |
super.onPreviewNativeEvent(preview); |
111 |
|
|
112 | 114 |
NativeEvent evt = preview.getNativeEvent(); |
113 | 115 |
if (evt.getType().equals("keydown")) |
114 | 116 |
// Use the popup's key preview hooks to close the dialog when either |
... | ... | |
134 | 136 |
VerticalPanel outer = new VerticalPanel(); |
135 | 137 |
|
136 | 138 |
// Create the text and set a style name so we can style it with CSS. |
137 |
HTML text = new HTML("<p>A new WebDAV password has been created.</p>"+ |
|
138 |
"<p>You will now be redirected to the initial screen for the changes to take effect. " + |
|
139 |
"Choose \"Show Credentials\" again afterwards to see the new password.</p>"); |
|
139 |
HTML text = new HTML("<p>A new WebDAV password has been created." + |
|
140 |
"</p><p>You will now be redirected to the initial screen" + |
|
141 |
" for the changes to take effect. Choose \"Show " + |
|
142 |
"Credentials\" again afterwards to see the new password.</p>"); |
|
140 | 143 |
text.setStyleName("gss-AboutText"); |
141 | 144 |
outer.add(text); |
142 | 145 |
|
143 |
// Create the 'OK' button, along with a listener that hides the dialog
|
|
144 |
// when the button is clicked. |
|
146 |
// Create the 'OK' button, along with a listener that hides the |
|
147 |
// dialog when the button is clicked.
|
|
145 | 148 |
Button confirm = new Button("Proceed", new ClickHandler() { |
146 | 149 |
@Override |
147 | 150 |
public void onClick(ClickEvent event) { |
... | ... | |
158 | 161 |
@Override |
159 | 162 |
protected void onPreviewNativeEvent(NativePreviewEvent preview) { |
160 | 163 |
super.onPreviewNativeEvent(preview); |
161 |
|
|
162 | 164 |
NativeEvent evt = preview.getNativeEvent(); |
163 | 165 |
if (evt.getType().equals("keydown")) |
164 |
// Use the popup's key preview hooks to close the dialog when either
|
|
165 |
// enter or escape is pressed. |
|
166 |
// Use the popup's key preview hooks to close the dialog when |
|
167 |
// either enter or escape is pressed.
|
|
166 | 168 |
switch (evt.getKeyCode()) { |
167 | 169 |
case KeyCodes.KEY_ENTER: |
168 | 170 |
GSS.get().authenticateUser(); |
... | ... | |
183 | 185 |
// Set the dialog's caption. |
184 | 186 |
setText("User Credentials"); |
185 | 187 |
setAnimationEnabled(true); |
186 |
// Create a VerticalPanel to contain the 'about' label and the 'OK' |
|
187 |
// button. |
|
188 |
// A VerticalPanel that contains the 'about' label and the 'OK' button. |
|
188 | 189 |
VerticalPanel outer = new VerticalPanel(); |
189 | 190 |
Configuration conf = (Configuration) GWT.create(Configuration.class); |
190 | 191 |
String service = conf.serviceName(); |
191 | 192 |
String webdavUrl = conf.serviceHome() + conf.webdavUrl(); |
192 | 193 |
String tokenNote = conf.tokenTTLNote(); |
193 | 194 |
// Create the text and set a style name so we can style it with CSS. |
194 |
HTML text = new HTML("<p>These are the user credentials that are required " +
|
|
195 |
"for interacting with " + service + ". " +
|
|
196 |
"You can copy and paste the username and password in the WebDAV client" +
|
|
197 |
" in order to use " + service + " through the WebDAV interface, at:<br/> " +
|
|
198 |
webdavUrl +
|
|
199 |
"<br/>" + tokenNote + "</p>");
|
|
195 |
HTML text = new HTML("<p>These are the user credentials that are " + |
|
196 |
"required for interacting with " + service + ". You can copy" +
|
|
197 |
" and paste the username and password in the WebDAV client " +
|
|
198 |
"in order to use " + service + " through the WebDAV " +
|
|
199 |
"interface, at:<br/> " + webdavUrl + "<br/>" + tokenNote +
|
|
200 |
"</p>"); |
|
200 | 201 |
text.setStyleName("gss-AboutText"); |
201 | 202 |
text.setWidth(WIDTH_TEXT); |
202 | 203 |
outer.add(text); |
... | ... | |
268 | 269 |
outer.add(confirm); |
269 | 270 |
outer.setCellHorizontalAlignment(confirm, HasHorizontalAlignment.ALIGN_CENTER); |
270 | 271 |
|
271 |
// Create the 'Reset password' button, along with a listener that hides the dialog
|
|
272 |
// when the button is clicked. |
|
272 |
// Create the 'Reset password' button, along with a listener that hides |
|
273 |
// the dialog when the button is clicked.
|
|
273 | 274 |
Button resetPassword = new Button("Reset Password", new ClickHandler() { |
274 | 275 |
@Override |
275 | 276 |
public void onClick(ClickEvent event) { |
... | ... | |
287 | 288 |
@Override |
288 | 289 |
protected void onPreviewNativeEvent(NativePreviewEvent preview) { |
289 | 290 |
super.onPreviewNativeEvent(preview); |
290 |
|
|
291 | 291 |
NativeEvent evt = preview.getNativeEvent(); |
292 | 292 |
if (evt.getType().equals("keydown")) |
293 |
// Use the popup's key preview hooks to close the dialog when either
|
|
294 |
// enter or escape is pressed. |
|
293 |
// Use the popup's key preview hooks to close the dialog when |
|
294 |
// either enter or escape is pressed.
|
|
295 | 295 |
switch (evt.getKeyCode()) { |
296 | 296 |
case KeyCodes.KEY_ENTER: |
297 | 297 |
case KeyCodes.KEY_ESCAPE: |
... | ... | |
327 | 327 |
if(t instanceof RestException){ |
328 | 328 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
329 | 329 |
if(statusCode == 405) |
330 |
GSS.get().displayError("You don't have the necessary permissions"); |
|
330 |
GSS.get().displayError("You don't have the necessary" + |
|
331 |
" permissions"); |
|
331 | 332 |
else if(statusCode == 404) |
332 | 333 |
GSS.get().displayError("Resource does not exist"); |
333 | 334 |
else |
334 |
GSS.get().displayError("Unable to reset password:"+((RestException)t).getHttpStatusText()); |
|
335 |
GSS.get().displayError("Unable to reset password:" + |
|
336 |
((RestException)t).getHttpStatusText()); |
|
335 | 337 |
} |
336 | 338 |
else |
337 |
GSS.get().displayError("System error resetting password:"+t.getMessage()); |
|
339 |
GSS.get().displayError("System error resetting password:" + |
|
340 |
t.getMessage()); |
|
338 | 341 |
} |
339 | 342 |
}; |
340 | 343 |
DeferredCommand.addCommand(cg); |
341 |
|
|
342 | 344 |
} |
343 | 345 |
|
344 | 346 |
} |
Also available in: Unified diff