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