root / src / gr / grnet / pithos / web / client / FilePropertiesDialog.java @ 749068ba
History | View | Annotate | Download (19 kB)
1 |
/*
|
---|---|
2 |
* Copyright 2011 GRNET S.A. All rights reserved.
|
3 |
*
|
4 |
* Redistribution and use in source and binary forms, with or
|
5 |
* without modification, are permitted provided that the following
|
6 |
* conditions are met:
|
7 |
*
|
8 |
* 1. Redistributions of source code must retain the above
|
9 |
* copyright notice, this list of conditions and the following
|
10 |
* disclaimer.
|
11 |
*
|
12 |
* 2. Redistributions in binary form must reproduce the above
|
13 |
* copyright notice, this list of conditions and the following
|
14 |
* disclaimer in the documentation and/or other materials
|
15 |
* provided with the distribution.
|
16 |
*
|
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
* POSSIBILITY OF SUCH DAMAGE.
|
29 |
*
|
30 |
* The views and conclusions contained in the software and
|
31 |
* documentation are those of the authors and should not be
|
32 |
* interpreted as representing official policies, either expressed
|
33 |
* or implied, of GRNET S.A.
|
34 |
*/
|
35 |
package gr.grnet.pithos.web.client; |
36 |
|
37 |
import com.google.gwt.core.client.Scheduler; |
38 |
import gr.grnet.pithos.web.client.foldertree.File; |
39 |
import gr.grnet.pithos.web.client.foldertree.Resource; |
40 |
import gr.grnet.pithos.web.client.rest.PostCommand; |
41 |
import gr.grnet.pithos.web.client.rest.PutRequest; |
42 |
import gr.grnet.pithos.web.client.rest.RestException; |
43 |
|
44 |
import com.google.gwt.core.client.GWT; |
45 |
import com.google.gwt.event.dom.client.ClickEvent; |
46 |
import com.google.gwt.event.dom.client.ClickHandler; |
47 |
import com.google.gwt.i18n.client.DateTimeFormat; |
48 |
import com.google.gwt.json.client.JSONBoolean; |
49 |
import com.google.gwt.json.client.JSONObject; |
50 |
import com.google.gwt.resources.client.ClientBundle; |
51 |
import com.google.gwt.resources.client.ImageResource; |
52 |
import com.google.gwt.user.client.Command; |
53 |
import com.google.gwt.user.client.DeferredCommand; |
54 |
import com.google.gwt.user.client.ui.Button; |
55 |
import com.google.gwt.user.client.ui.CheckBox; |
56 |
import com.google.gwt.user.client.ui.DecoratedTabPanel; |
57 |
import com.google.gwt.user.client.ui.DisclosurePanel; |
58 |
import com.google.gwt.user.client.ui.FlexTable; |
59 |
import com.google.gwt.user.client.ui.FlowPanel; |
60 |
import com.google.gwt.user.client.ui.FocusPanel; |
61 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
62 |
import com.google.gwt.user.client.ui.HorizontalPanel; |
63 |
import com.google.gwt.user.client.ui.TextBox; |
64 |
import com.google.gwt.user.client.ui.VerticalPanel; |
65 |
|
66 |
/**
|
67 |
* The 'File properties' dialog box implementation.
|
68 |
*
|
69 |
*/
|
70 |
public class FilePropertiesDialog extends AbstractPropertiesDialog { |
71 |
|
72 |
private PermissionsList permList;
|
73 |
|
74 |
private CheckBox readForAll;
|
75 |
|
76 |
/**
|
77 |
* An image bundle for this widgets images.
|
78 |
*/
|
79 |
public interface Images extends ClientBundle,MessagePanel.Images { |
80 |
|
81 |
@Source("gr/grnet/pithos/resources/edit_user.png") |
82 |
ImageResource permUser(); |
83 |
|
84 |
@Source("gr/grnet/pithos/resources/groupevent.png") |
85 |
ImageResource permGroup(); |
86 |
|
87 |
@Source("gr/grnet/pithos/resources/editdelete.png") |
88 |
ImageResource delete(); |
89 |
|
90 |
@Source("gr/grnet/pithos/resources/db_update.png") |
91 |
ImageResource restore(); |
92 |
|
93 |
@Source("gr/grnet/pithos/resources/folder_inbox.png") |
94 |
ImageResource download(); |
95 |
} |
96 |
|
97 |
/**
|
98 |
* The widget that holds the name of the file.
|
99 |
*/
|
100 |
private TextBox name = new TextBox(); |
101 |
|
102 |
private final CheckBox versioned = new CheckBox(); |
103 |
|
104 |
final File file; |
105 |
|
106 |
private String userFullName; |
107 |
|
108 |
private Pithos app;
|
109 |
|
110 |
/**
|
111 |
* The widget's constructor.
|
112 |
*/
|
113 |
public FilePropertiesDialog(Pithos _app, File _file) { |
114 |
app = _app; |
115 |
file = _file; |
116 |
|
117 |
// Set the dialog's caption.
|
118 |
setText("File properties");
|
119 |
|
120 |
|
121 |
// permList = new PermissionsList(images, file.getPermissions(), file.getOwner());
|
122 |
|
123 |
// Outer contains inner and buttons.
|
124 |
final VerticalPanel outer = new VerticalPanel(); |
125 |
final FocusPanel focusPanel = new FocusPanel(outer); |
126 |
// Inner contains generalPanel and permPanel.
|
127 |
inner = new DecoratedTabPanel();
|
128 |
inner.setAnimationEnabled(true);
|
129 |
|
130 |
|
131 |
inner.add(createGeneralPanel(), "General");
|
132 |
|
133 |
inner.add(createSharingPanel(), "Sharing");
|
134 |
|
135 |
inner.add(createVersionPanel(), "Versions");
|
136 |
|
137 |
inner.selectTab(0);
|
138 |
|
139 |
outer.add(inner); |
140 |
|
141 |
final HorizontalPanel buttons = new HorizontalPanel(); |
142 |
// Create the 'OK' button, along with a listener that hides the dialog
|
143 |
// when the button is clicked.
|
144 |
final Button ok = new Button("OK", new ClickHandler() { |
145 |
@Override
|
146 |
public void onClick(ClickEvent event) { |
147 |
accept(); |
148 |
closeDialog(); |
149 |
} |
150 |
}); |
151 |
|
152 |
buttons.add(ok); |
153 |
buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); |
154 |
// Create the 'Cancel' button, along with a listener that hides the
|
155 |
// dialog when the button is clicked.
|
156 |
final Button cancel = new Button("Cancel", new ClickHandler() { |
157 |
@Override
|
158 |
public void onClick(ClickEvent event) { |
159 |
closeDialog(); |
160 |
} |
161 |
}); |
162 |
buttons.add(cancel); |
163 |
buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); |
164 |
buttons.setSpacing(8);
|
165 |
buttons.addStyleName("pithos-TabPanelBottom");
|
166 |
|
167 |
outer.add(buttons); |
168 |
outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER); |
169 |
outer.addStyleName("pithos-TabPanelBottom");
|
170 |
|
171 |
focusPanel.setFocus(true);
|
172 |
setWidget(outer); |
173 |
|
174 |
// Asynchronously retrieve the tags defined by this user.
|
175 |
DeferredCommand.addCommand(new Command() {
|
176 |
|
177 |
@Override
|
178 |
public void execute() { |
179 |
// updateTags();
|
180 |
} |
181 |
}); |
182 |
} |
183 |
|
184 |
private VerticalPanel createGeneralPanel() {
|
185 |
final VerticalPanel generalPanel = new VerticalPanel(); |
186 |
final FlexTable generalTable = new FlexTable(); |
187 |
generalTable.setText(0, 0, "Name"); |
188 |
generalTable.setText(1, 0, "Folder"); |
189 |
generalTable.setText(2, 0, "Owner"); |
190 |
generalTable.setText(3, 0, "Last modified"); |
191 |
// generalTable.setText(4, 0, "Tags");
|
192 |
|
193 |
name.setWidth("100%");
|
194 |
name.setText(file.getName()); |
195 |
generalTable.setWidget(0, 1, name); |
196 |
if(file.getParent() != null) |
197 |
generalTable.setText(1, 1, file.getParent().getName()); |
198 |
else
|
199 |
generalTable.setText(1, 1, "-"); |
200 |
generalTable.setText(2, 1, file.getOwner()); |
201 |
|
202 |
final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); |
203 |
generalTable.setText(3, 1, formatter.format(file.getLastModified())); |
204 |
|
205 |
// Get the tags.
|
206 |
// StringBuffer tagsBuffer = new StringBuffer();
|
207 |
// Iterator i = file.getTags().iterator();
|
208 |
// while (i.hasNext()) {
|
209 |
// String tag = (String) i.next();
|
210 |
// tagsBuffer.append(tag).append(", ");
|
211 |
// }
|
212 |
// if (tagsBuffer.length() > 1)
|
213 |
// tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1);
|
214 |
// initialTagText = tagsBuffer.toString();
|
215 |
// tags.setWidth("100%");
|
216 |
// tags.getElement().setId("filePropertiesDialog.textBox.tags");
|
217 |
// tags.setText(initialTagText);
|
218 |
// generalTable.setWidget(4, 1, tags);
|
219 |
|
220 |
generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); |
221 |
generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); |
222 |
generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels"); |
223 |
generalTable.getFlexCellFormatter().setStyleName(3, 0, "props-labels"); |
224 |
// generalTable.getFlexCellFormatter().setStyleName(4, 0, "props-labels");
|
225 |
generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values"); |
226 |
generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values"); |
227 |
generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values"); |
228 |
generalTable.getFlexCellFormatter().setStyleName(3, 1, "props-values"); |
229 |
// generalTable.getFlexCellFormatter().setStyleName(4, 1, "props-values");
|
230 |
generalTable.setCellSpacing(4);
|
231 |
|
232 |
generalPanel.add(generalTable); |
233 |
|
234 |
DisclosurePanel allTags = new DisclosurePanel("All tags"); |
235 |
allTagsContent = new FlowPanel();
|
236 |
allTagsContent.setWidth("100%");
|
237 |
allTags.setContent(allTagsContent); |
238 |
generalPanel.add(allTags); |
239 |
generalPanel.setSpacing(4);
|
240 |
return generalPanel;
|
241 |
} |
242 |
|
243 |
private VerticalPanel createSharingPanel() {
|
244 |
VerticalPanel permPanel = new VerticalPanel();
|
245 |
//
|
246 |
// permList = new PermissionsList(images, file.getPermissions(), file.getOwner());
|
247 |
// permPanel.add(permList);
|
248 |
//
|
249 |
// HorizontalPanel permButtons = new HorizontalPanel();
|
250 |
// Button add = new Button("Add Group", new ClickHandler() {
|
251 |
// @Override
|
252 |
// public void onClick(ClickEvent event) {
|
253 |
// PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, false);
|
254 |
// dlg.center();
|
255 |
// }
|
256 |
// });
|
257 |
// permButtons.add(add);
|
258 |
// permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER);
|
259 |
//
|
260 |
// final Button addUser = new Button("Add User", new ClickHandler() {
|
261 |
// @Override
|
262 |
// public void onClick(ClickEvent event) {
|
263 |
// PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, true);
|
264 |
// dlg.center();
|
265 |
// }
|
266 |
// });
|
267 |
// permButtons.add(addUser);
|
268 |
// permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER);
|
269 |
//
|
270 |
// permButtons.setSpacing(8);
|
271 |
// permButtons.addStyleName("pithos-TabPanelBottom");
|
272 |
// permPanel.add(permButtons);
|
273 |
//
|
274 |
// final Label readForAllNote = new Label("When this option is enabled, the file will be readable" +
|
275 |
// " by everyone. By checking this option, you are certifying that you have the right to " +
|
276 |
// "distribute this file and that it does not violate the Terms of Use.", true);
|
277 |
// readForAllNote.setVisible(false);
|
278 |
// readForAllNote.setStylePrimaryName("pithos-readForAllNote");
|
279 |
//
|
280 |
// readForAll = new CheckBox();
|
281 |
// readForAll.setValue(file.isReadForAll());
|
282 |
// readForAll.addClickHandler(new ClickHandler() {
|
283 |
// @Override
|
284 |
// public void onClick(ClickEvent event) {
|
285 |
// readForAllNote.setVisible(readForAll.getValue());
|
286 |
// }
|
287 |
//
|
288 |
// });
|
289 |
//
|
290 |
// // Only show the read for all permission if the user is the owner.
|
291 |
// if (file.getOwner().equals(app.getUsername())) {
|
292 |
// final HorizontalPanel permForAll = new HorizontalPanel();
|
293 |
// permForAll.add(new Label("Public"));
|
294 |
// permForAll.add(readForAll);
|
295 |
// permForAll.setSpacing(8);
|
296 |
// permForAll.addStyleName("pithos-TabPanelBottom");
|
297 |
// permForAll.add(readForAllNote);
|
298 |
// permPanel.add(permForAll);
|
299 |
// }
|
300 |
//
|
301 |
//
|
302 |
// final HorizontalPanel pathPanel = new HorizontalPanel();
|
303 |
// pathPanel.setWidth("100%");
|
304 |
// pathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
|
305 |
// pathPanel.add(new Label("Link"));
|
306 |
// pathPanel.setSpacing(8);
|
307 |
// pathPanel.addStyleName("pithos-TabPanelBottom");
|
308 |
//
|
309 |
// TextBox path = new TextBox();
|
310 |
// path.setWidth("100%");
|
311 |
// path.addClickHandler(new ClickHandler() {
|
312 |
// @Override
|
313 |
// public void onClick(ClickEvent event) {
|
314 |
// Pithos.enableIESelection();
|
315 |
// ((TextBox) event.getSource()).selectAll();
|
316 |
// Pithos.preventIESelection();
|
317 |
// }
|
318 |
// });
|
319 |
// path.setText(file.getUri());
|
320 |
// path.setTitle("Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)");
|
321 |
// path.setWidth("100%");
|
322 |
// path.setReadOnly(true);
|
323 |
// pathPanel.add(path);
|
324 |
// permPanel.add(pathPanel);
|
325 |
|
326 |
return permPanel;
|
327 |
} |
328 |
|
329 |
private VerticalPanel createVersionPanel() {
|
330 |
VerticalPanel versionPanel = new VerticalPanel();
|
331 |
|
332 |
// VersionsList verList = new VersionsList(this, images, bodies);
|
333 |
// versionPanel.add(verList);
|
334 |
//
|
335 |
// HorizontalPanel vPanel = new HorizontalPanel();
|
336 |
//
|
337 |
// vPanel.setSpacing(8);
|
338 |
// vPanel.addStyleName("pithos-TabPanelBottom");
|
339 |
// vPanel.add(new Label("Versioned"));
|
340 |
//
|
341 |
// versioned.setValue(file.isVersioned());
|
342 |
// vPanel.add(versioned);
|
343 |
// versionPanel.add(vPanel);
|
344 |
//
|
345 |
// HorizontalPanel vPanel2 = new HorizontalPanel();
|
346 |
// vPanel2.setSpacing(8);
|
347 |
// vPanel2.addStyleName("pithos-TabPanelBottom");
|
348 |
//
|
349 |
// HTML removeAllVersion = new HTML("<span>Remove all previous versions?</span>");
|
350 |
// vPanel2.add(removeAllVersion);
|
351 |
//
|
352 |
// Button removeVersionsButton = new Button(AbstractImagePrototype.create(images.delete()).getHTML(), new ClickHandler() {
|
353 |
// @Override
|
354 |
// public void onClick(ClickEvent event) {
|
355 |
// ConfirmationDialog confirm = new ConfirmationDialog("Really " +
|
356 |
// "remove all previous versions?", "Remove") {
|
357 |
//
|
358 |
// @Override
|
359 |
// public void cancel() {
|
360 |
// }
|
361 |
//
|
362 |
// @Override
|
363 |
// public void confirm() {
|
364 |
// FilePropertiesDialog.this.closeDialog();
|
365 |
// removeAllOldVersions();
|
366 |
// }
|
367 |
//
|
368 |
// };
|
369 |
// confirm.center();
|
370 |
// }
|
371 |
//
|
372 |
// });
|
373 |
// vPanel2.add(removeVersionsButton);
|
374 |
// if(!file.isVersioned())
|
375 |
// vPanel2.setVisible(false);
|
376 |
//
|
377 |
// versionPanel.add(vPanel2);
|
378 |
|
379 |
return versionPanel;
|
380 |
} |
381 |
|
382 |
/**
|
383 |
* Accepts any change and updates the file
|
384 |
*
|
385 |
*/
|
386 |
@Override
|
387 |
protected void accept() { |
388 |
String newFilename = null; |
389 |
// permList.updatePermissionsAccordingToInput();
|
390 |
// Set<PermissionHolder> perms = permList.getPermissions();
|
391 |
// JSONObject json = new JSONObject();
|
392 |
if (!name.getText().equals(file.getName())) {
|
393 |
newFilename = name.getText(); |
394 |
// json.put("name", new JSONString(newFilename));
|
395 |
} |
396 |
// if (versioned.getValue() != file.isVersioned())
|
397 |
// json.put("versioned", JSONBoolean.getInstance(versioned.getValue()));
|
398 |
//only update the read for all perm if the user is the owner
|
399 |
// if (readForAll.getValue() != file.isReadForAll())
|
400 |
// if (file.getOwner().equals(Pithos.get().getCurrentUserResource().getUsername()))
|
401 |
// json.put("readForAll", JSONBoolean.getInstance(readForAll.getValue()));
|
402 |
// int i = 0;
|
403 |
// if (permList.hasChanges()) {
|
404 |
// GWT.log("Permissions change", null);
|
405 |
// JSONArray perma = new JSONArray();
|
406 |
//
|
407 |
// for (PermissionHolder p : perms) {
|
408 |
// JSONObject po = new JSONObject();
|
409 |
// if (p.getUser() != null)
|
410 |
// po.put("user", new JSONString(p.getUser()));
|
411 |
// if (p.getGroup() != null)
|
412 |
// po.put("group", new JSONString(p.getGroup()));
|
413 |
// po.put("read", JSONBoolean.getInstance(p.isRead()));
|
414 |
// po.put("write", JSONBoolean.getInstance(p.isWrite()));
|
415 |
// po.put("modifyACL", JSONBoolean.getInstance(p.isModifyACL()));
|
416 |
// perma.set(i, po);
|
417 |
// i++;
|
418 |
// }
|
419 |
// json.put("permissions", perma);
|
420 |
// }
|
421 |
// JSONArray taga = new JSONArray();
|
422 |
// i = 0;
|
423 |
// if (!tags.getText().equals(initialTagText)) {
|
424 |
// String[] tagset = tags.getText().split(",");
|
425 |
// for (String t : tagset) {
|
426 |
// JSONString to = new JSONString(t);
|
427 |
// taga.set(i, to);
|
428 |
// i++;
|
429 |
// }
|
430 |
// json.put("tags", taga);
|
431 |
// }
|
432 |
// String jsonString = json.toString();
|
433 |
// if(jsonString.equals("{}")){
|
434 |
// GWT.log("NO CHANGES", null);
|
435 |
// return;
|
436 |
// }
|
437 |
final String newFilenameFinal = newFilename; |
438 |
|
439 |
if (newFilename == null) |
440 |
return;
|
441 |
String path = app.getApiPath() + app.getUsername() + file.getParent().getUri() + "/" + newFilename; |
442 |
PutRequest updateFile = new PutRequest(path) {
|
443 |
@Override
|
444 |
public void onSuccess(Resource result) { |
445 |
app.updateFolder(file.getParent()); |
446 |
} |
447 |
|
448 |
@Override
|
449 |
public void onError(Throwable t) { |
450 |
GWT.log("", t);
|
451 |
app.displayError("System error modifying file:" + t.getMessage());
|
452 |
} |
453 |
}; |
454 |
updateFile.setHeader("X-Auth-Token", app.getToken());
|
455 |
updateFile.setHeader("X-Move-From", file.getUri());
|
456 |
updateFile.setHeader("Content-Type", file.getContentType());
|
457 |
Scheduler.get().scheduleDeferred(updateFile); |
458 |
} |
459 |
|
460 |
private void removeAllOldVersions() { |
461 |
JSONObject json = new JSONObject();
|
462 |
json.put("versioned", JSONBoolean.getInstance(false)); |
463 |
GWT.log(json.toString(), null);
|
464 |
PostCommand cf = new PostCommand(file.getUri() + "?update=", json.toString(), 200) { |
465 |
|
466 |
@Override
|
467 |
public void onComplete() { |
468 |
toggleVersioned(true);
|
469 |
} |
470 |
|
471 |
@Override
|
472 |
public void onError(Throwable t) { |
473 |
GWT.log("", t);
|
474 |
if (t instanceof RestException) { |
475 |
int statusCode = ((RestException) t).getHttpStatusCode();
|
476 |
if (statusCode == 405) |
477 |
Pithos.get().displayError("You don't have the necessary permissions");
|
478 |
else if (statusCode == 404) |
479 |
Pithos.get().displayError("User in permissions does not exist");
|
480 |
else if (statusCode == 409) |
481 |
Pithos.get().displayError("A folder with the same name already exists");
|
482 |
else if (statusCode == 413) |
483 |
Pithos.get().displayError("Your quota has been exceeded");
|
484 |
else
|
485 |
Pithos.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());
|
486 |
} else
|
487 |
Pithos.get().displayError("System error moifying file:" + t.getMessage());
|
488 |
} |
489 |
}; |
490 |
DeferredCommand.addCommand(cf); |
491 |
} |
492 |
|
493 |
private void toggleVersioned(boolean versionedValue) { |
494 |
JSONObject json = new JSONObject();
|
495 |
json.put("versioned", JSONBoolean.getInstance(versionedValue));
|
496 |
GWT.log(json.toString(), null);
|
497 |
PostCommand cf = new PostCommand(file.getUri() + "?update=", json.toString(), 200) { |
498 |
|
499 |
@Override
|
500 |
public void onComplete() { |
501 |
Pithos.get().getTreeView().refreshCurrentNode(false);
|
502 |
} |
503 |
|
504 |
@Override
|
505 |
public void onError(Throwable t) { |
506 |
GWT.log("", t);
|
507 |
if (t instanceof RestException) { |
508 |
int statusCode = ((RestException) t).getHttpStatusCode();
|
509 |
if (statusCode == 405) |
510 |
Pithos.get().displayError("You don't have the necessary permissions");
|
511 |
else if (statusCode == 404) |
512 |
Pithos.get().displayError("User in permissions does not exist");
|
513 |
else if (statusCode == 409) |
514 |
Pithos.get().displayError("A folder with the same name already exists");
|
515 |
else if (statusCode == 413) |
516 |
Pithos.get().displayError("Your quota has been exceeded");
|
517 |
else
|
518 |
Pithos.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());
|
519 |
} else
|
520 |
Pithos.get().displayError("System error moifying file:" + t.getMessage());
|
521 |
} |
522 |
}; |
523 |
DeferredCommand.addCommand(cf); |
524 |
} |
525 |
|
526 |
} |