Don't show Upload and Paste options in My Shared and Other's Shared pseudo-folders.
[pithos] / src / gr / ebs / gss / client / FilePropertiesDialog.java
1 /*\r
2  * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.\r
3  *\r
4  * This file is part of GSS.\r
5  *\r
6  * GSS is free software: you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation, either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * GSS is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with GSS.  If not, see <http://www.gnu.org/licenses/>.\r
18  */\r
19 package gr.ebs.gss.client;\r
20 \r
21 import gr.ebs.gss.client.rest.GetCommand;\r
22 import gr.ebs.gss.client.rest.PostCommand;\r
23 import gr.ebs.gss.client.rest.RestException;\r
24 import gr.ebs.gss.client.rest.resource.FileResource;\r
25 import gr.ebs.gss.client.rest.resource.GroupResource;\r
26 import gr.ebs.gss.client.rest.resource.PermissionHolder;\r
27 import gr.ebs.gss.client.rest.resource.TagsResource;\r
28 \r
29 import java.util.Iterator;\r
30 import java.util.List;\r
31 import java.util.Set;\r
32 \r
33 import com.google.gwt.core.client.GWT;\r
34 import com.google.gwt.i18n.client.DateTimeFormat;\r
35 import com.google.gwt.json.client.JSONArray;\r
36 import com.google.gwt.json.client.JSONBoolean;\r
37 import com.google.gwt.json.client.JSONObject;\r
38 import com.google.gwt.json.client.JSONString;\r
39 import com.google.gwt.user.client.Command;\r
40 import com.google.gwt.user.client.DeferredCommand;\r
41 import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
42 import com.google.gwt.user.client.ui.Button;\r
43 import com.google.gwt.user.client.ui.CheckBox;\r
44 import com.google.gwt.user.client.ui.ClickListener;\r
45 import com.google.gwt.user.client.ui.DialogBox;\r
46 import com.google.gwt.user.client.ui.DisclosurePanel;\r
47 import com.google.gwt.user.client.ui.FlexTable;\r
48 import com.google.gwt.user.client.ui.FlowPanel;\r
49 import com.google.gwt.user.client.ui.FocusPanel;\r
50 import com.google.gwt.user.client.ui.HTML;\r
51 import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
52 import com.google.gwt.user.client.ui.HorizontalPanel;\r
53 import com.google.gwt.user.client.ui.KeyboardListener;\r
54 import com.google.gwt.user.client.ui.Label;\r
55 import com.google.gwt.user.client.ui.TabPanel;\r
56 import com.google.gwt.user.client.ui.TextBox;\r
57 import com.google.gwt.user.client.ui.VerticalPanel;\r
58 import com.google.gwt.user.client.ui.Widget;\r
59 \r
60 /**\r
61  * The 'File properties' dialog box implementation.\r
62  *\r
63  * @author past\r
64  */\r
65 public class FilePropertiesDialog extends DialogBox {\r
66 \r
67         final PermissionsList permList;\r
68 \r
69         private CheckBox readForAll;\r
70 \r
71         /**\r
72          * An image bundle for this widgets images.\r
73          */\r
74         public interface Images extends MessagePanel.Images {\r
75 \r
76                 @Resource("gr/ebs/gss/resources/edit_user.png")\r
77                 AbstractImagePrototype permUser();\r
78 \r
79                 @Resource("gr/ebs/gss/resources/groupevent.png")\r
80                 AbstractImagePrototype permGroup();\r
81 \r
82                 @Resource("gr/ebs/gss/resources/editdelete.png")\r
83                 AbstractImagePrototype delete();\r
84 \r
85                 @Resource("gr/ebs/gss/resources/db_update.png")\r
86                 AbstractImagePrototype restore();\r
87 \r
88                 @Resource("gr/ebs/gss/resources/folder_inbox.png")\r
89                 AbstractImagePrototype download();\r
90         }\r
91 \r
92         /**\r
93          * The widget that holds the name of the file.\r
94          */\r
95         private TextBox name = new TextBox();\r
96 \r
97         /**\r
98          * Text box with the tags associated with the file\r
99          */\r
100         private TextBox tags = new TextBox();\r
101 \r
102         /**\r
103          * A FlowPanel with all user tags\r
104          */\r
105         private FlowPanel allTagsContent;\r
106 \r
107         private final CheckBox versioned = new CheckBox();\r
108 \r
109         final FileResource file;\r
110 \r
111         String initialTagText;\r
112 \r
113         final TabPanel inner;\r
114 \r
115         /**\r
116          * The widget's constructor.\r
117          *\r
118          * @param images the dialog's ImageBundle\r
119          * @param groups\r
120          * @param bodies\r
121          */\r
122         public FilePropertiesDialog(final Images images, final List<GroupResource> groups, List<FileResource> bodies) {\r
123 \r
124                 // Enable IE selection for the dialog (must disable it upon closing it)\r
125                 GSS.enableIESelection();\r
126 \r
127                 // Set the dialog's caption.\r
128                 setText("File properties");\r
129                 setAnimationEnabled(true);\r
130                 file = (FileResource) GSS.get().getCurrentSelection();\r
131                 permList = new PermissionsList(images, file.getPermissions(), file.getOwner());\r
132 \r
133                 // Outer contains inner and buttons.\r
134                 final VerticalPanel outer = new VerticalPanel();\r
135                 final FocusPanel focusPanel = new FocusPanel(outer);\r
136                 // Inner contains generalPanel and permPanel.\r
137                 inner = new TabPanel();\r
138                 final VerticalPanel generalPanel = new VerticalPanel();\r
139                 final VerticalPanel permPanel = new VerticalPanel();\r
140                 final HorizontalPanel buttons = new HorizontalPanel();\r
141                 final HorizontalPanel permButtons = new HorizontalPanel();\r
142                 final HorizontalPanel permForAll = new HorizontalPanel();\r
143                 final HorizontalPanel pathPanel = new HorizontalPanel();\r
144                 final VerticalPanel verPanel = new VerticalPanel();\r
145                 final HorizontalPanel vPanel = new HorizontalPanel();\r
146                 final HorizontalPanel vPanel2 = new HorizontalPanel();\r
147 \r
148                 versioned.setChecked(file.isVersioned());\r
149                 inner.add(generalPanel, "General");\r
150                 inner.add(permPanel, "Sharing");\r
151                 inner.add(verPanel, "Versions");\r
152                 inner.selectTab(0);\r
153 \r
154                 final FlexTable generalTable = new FlexTable();\r
155                 generalTable.setText(0, 0, "Name");\r
156                 generalTable.setText(1, 0, "Folder");\r
157                 generalTable.setText(2, 0, "Owner");\r
158                 generalTable.setText(3, 0, "Date");\r
159                 generalTable.setText(4, 0, "Tags");\r
160                 name.setText(file.getName());\r
161                 generalTable.setWidget(0, 1, name);\r
162                 if(file.getFolderName() != null)\r
163                         generalTable.setText(1, 1, file.getFolderName());\r
164                 else\r
165                         generalTable.setText(1, 1, "-");\r
166                 generalTable.setText(2, 1, file.getOwner());\r
167                 final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");\r
168                 generalTable.setText(3, 1, formatter.format(file.getCreationDate()));\r
169                 // Get the tags.\r
170                 StringBuffer tagsBuffer = new StringBuffer();\r
171                 Iterator i = file.getTags().iterator();\r
172                 while (i.hasNext()) {\r
173                         String tag = (String) i.next();\r
174                         tagsBuffer.append(tag).append(", ");\r
175                 }\r
176                 if (tagsBuffer.length() > 1)\r
177                         tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1);\r
178                 initialTagText = tagsBuffer.toString();\r
179                 tags.setText(initialTagText);\r
180                 generalTable.setWidget(4, 1, tags);\r
181                 generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");\r
182                 generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels");\r
183                 generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels");\r
184                 generalTable.getFlexCellFormatter().setStyleName(3, 0, "props-labels");\r
185                 generalTable.getFlexCellFormatter().setStyleName(4, 0, "props-labels");\r
186                 generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values");\r
187                 generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values");\r
188                 generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values");\r
189                 generalTable.getFlexCellFormatter().setStyleName(3, 1, "props-values");\r
190                 generalTable.getFlexCellFormatter().setStyleName(4, 1, "props-values");\r
191                 generalTable.setCellSpacing(4);\r
192 \r
193                 // Create the 'OK' button, along with a listener that hides the dialog\r
194                 // when the button is clicked.\r
195                 final Button ok = new Button("OK", new ClickListener() {\r
196 \r
197                         public void onClick(Widget sender) {\r
198                                 accept();\r
199                                 closeDialog();\r
200                         }\r
201                 });\r
202                 buttons.add(ok);\r
203                 buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);\r
204                 // Create the 'Cancel' button, along with a listener that hides the\r
205                 // dialog when the button is clicked.\r
206                 final Button cancel = new Button("Cancel", new ClickListener() {\r
207 \r
208                         public void onClick(Widget sender) {\r
209                                 closeDialog();\r
210                         }\r
211                 });\r
212                 buttons.add(cancel);\r
213                 buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
214                 buttons.setSpacing(8);\r
215                 buttons.addStyleName("gwt-TabPanelBottom");\r
216 \r
217                 generalPanel.add(generalTable);\r
218 \r
219                 // Asynchronously retrieve the tags defined by this user.\r
220                 DeferredCommand.addCommand(new Command() {\r
221 \r
222                         public void execute() {\r
223                                 updateTags();\r
224                         }\r
225                 });\r
226 \r
227                 DisclosurePanel allTags = new DisclosurePanel("All tags");\r
228                 allTagsContent = new FlowPanel();\r
229                 allTags.setContent(allTagsContent);\r
230                 generalPanel.add(allTags);\r
231                 generalPanel.setSpacing(4);\r
232 \r
233                 final Button add = new Button("Add Group", new ClickListener() {\r
234 \r
235                         public void onClick(Widget sender) {\r
236                                 PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, false);\r
237                                 dlg.center();\r
238                         }\r
239                 });\r
240                 permButtons.add(add);\r
241                 permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER);\r
242 \r
243                 final Button addUser = new Button("Add User", new ClickListener() {\r
244 \r
245                         public void onClick(Widget sender) {\r
246                                 PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, true);\r
247                                 dlg.center();\r
248                         }\r
249                 });\r
250                 permButtons.add(addUser);\r
251                 permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER);\r
252 \r
253                 permButtons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
254                 permButtons.setSpacing(8);\r
255                 permButtons.addStyleName("gwt-TabPanelBottom");\r
256 \r
257                 final Label readForAllNote = new Label("When this option is enabled, the file will be readable" +\r
258                                         " by everyone. By checking this option, you are certifying that you have the right to " +\r
259                                         "distribute this file and that it does not violate the Terms of Use.", true);\r
260                 readForAllNote.setVisible(false);\r
261                 readForAllNote.setStylePrimaryName("gss-readForAllNote");\r
262 \r
263                 readForAll = new CheckBox();\r
264                 readForAll.setChecked(file.isReadForAll());\r
265                 readForAll.addClickListener(new ClickListener() {\r
266 \r
267                         public void onClick(Widget sender) {\r
268                                 if (readForAll.isChecked()) {\r
269                                         readForAllNote.setVisible(true);\r
270                                         pathPanel.setVisible(true);\r
271                                 }\r
272                                 else {\r
273                                         readForAllNote.setVisible(false);\r
274                                         pathPanel.setVisible(false);\r
275                                 }\r
276                         }\r
277 \r
278                 });\r
279 \r
280                 permPanel.add(permList);\r
281                 permPanel.add(permButtons);\r
282                 // Only show the read for all permission if the user is the owner.\r
283                 if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) {\r
284                         permForAll.add(new Label("Make Public"));\r
285                         permForAll.add(readForAll);\r
286                         permForAll.setSpacing(8);\r
287                         permForAll.addStyleName("gwt-TabPanelBottom");\r
288                         permPanel.add(permForAll);\r
289                         permPanel.add(readForAllNote);\r
290                 }\r
291 \r
292                 TextBox path = new TextBox();\r
293                 path.addClickListener(new ClickListener () {\r
294 \r
295                         public void onClick(Widget sender) {\r
296                                 GSS.enableIESelection();\r
297                                 ((TextBox) sender).selectAll();\r
298                                 GSS.preventIESelection();\r
299                         }\r
300 \r
301                 });\r
302                 path.setText(file.getUri());\r
303                 path.setTitle("Use this URI for sharing this file with the world");\r
304                 path.setReadOnly(true);\r
305                 pathPanel.add(new Label("Sharing URI"));\r
306                 pathPanel.setSpacing(8);\r
307                 pathPanel.addStyleName("gwt-TabPanelBottom");\r
308                 pathPanel.add(path);\r
309                 pathPanel.setVisible(file.isReadForAll());\r
310                 permPanel.add(pathPanel);\r
311 \r
312                 VersionsList verList = new VersionsList(this, images, bodies);\r
313                 verPanel.add(verList);\r
314 \r
315                 vPanel.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
316                 vPanel.setSpacing(8);\r
317                 vPanel.addStyleName("gwt-TabPanelBottom");\r
318                 vPanel.add(new Label("Versioned"));\r
319 \r
320                 vPanel.add(versioned);\r
321                 verPanel.add(vPanel);\r
322                 vPanel2.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
323                 vPanel2.setSpacing(8);\r
324                 vPanel2.addStyleName("gwt-TabPanelBottom");\r
325                 Button removeVersionsButton = new Button(images.delete().getHTML(), new ClickListener() {\r
326 \r
327                         public void onClick(Widget sender) {\r
328                                 ConfirmationDialog confirm = new ConfirmationDialog(images,"Really remove all previous versions?","Remove"){\r
329 \r
330                                         public void cancel() {\r
331                                         }\r
332 \r
333 \r
334                                         public void confirm() {\r
335                                                 FilePropertiesDialog.this.closeDialog();\r
336                                                 removeAllOldVersions();\r
337                                         }\r
338 \r
339                                 };\r
340                                 confirm.center();\r
341                         }\r
342 \r
343                 });\r
344                 HTML removeAllVersion = new HTML("<span>Remove all previous versions?</span>");\r
345                 vPanel2.add(removeAllVersion);\r
346                 vPanel2.add(removeVersionsButton);\r
347                 verPanel.add(vPanel2);\r
348                 if(!file.isVersioned())\r
349                         vPanel2.setVisible(false);\r
350                 outer.add(inner);\r
351                 outer.add(buttons);\r
352                 outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);\r
353                 outer.addStyleName("gwt-TabPanelBottom");\r
354 \r
355                 focusPanel.setFocus(true);\r
356                 setWidget(outer);\r
357         }\r
358 \r
359         /**\r
360          * Retrieves all user tags from the server and updates the FlowPanel\r
361          *\r
362          * @param userId\r
363          */\r
364         private void updateTags() {\r
365                 GetCommand<TagsResource> tc = new GetCommand<TagsResource>(TagsResource.class, GSS.get().getCurrentUserResource().getTagsPath()) {\r
366 \r
367                         public void onComplete() {\r
368                                 allTagsContent.clear();\r
369                                 TagsResource tagr = getResult();\r
370                                 List<String> userTags = tagr.getTags();\r
371                                 Iterator t = userTags.iterator();\r
372                                 while (t.hasNext()) {\r
373                                         final Button tag = new Button((String) t.next(), new ClickListener() {\r
374 \r
375                                                 public void onClick(Widget sender) {\r
376                                                         String existing = tags.getText();\r
377                                                         String newTag = ((Button) sender).getText().trim();\r
378                                                         // insert the new tag only if it is not in the list\r
379                                                         // already\r
380                                                         if (existing.indexOf(newTag + ",") == -1 && !existing.trim().endsWith(newTag))\r
381                                                                 tags.setText(existing.trim() + (existing.length() > 0 ? ", " : "") + newTag);\r
382                                                 }\r
383                                         });\r
384                                         allTagsContent.add(tag);\r
385                                 }\r
386                         }\r
387 \r
388                         @Override\r
389                         public void onError(Throwable t) {\r
390                                 GWT.log("", t);\r
391                                 GSS.get().displayError("Unable to fetch user tags");\r
392                         }\r
393                 };\r
394                 DeferredCommand.addCommand(tc);\r
395 \r
396         }\r
397 \r
398         @Override\r
399         @SuppressWarnings("fallthrough")\r
400         public boolean onKeyDownPreview(char key, int modifiers) {\r
401                 // Use the popup's key preview hooks to close the dialog when either\r
402                 // enter or escape is pressed.\r
403                 switch (key) {\r
404                         case KeyboardListener.KEY_ENTER:\r
405                                 accept();\r
406                         case KeyboardListener.KEY_ESCAPE:\r
407                                 closeDialog();\r
408                                 break;\r
409                 }\r
410 \r
411                 return true;\r
412         }\r
413 \r
414         /**\r
415          * Accepts any change and updates the file\r
416          *\r
417          * @param userId\r
418          */\r
419         private void accept() {\r
420                 permList.updatePermissionsAccordingToInput();\r
421                 Set<PermissionHolder> perms = permList.getPermissions();\r
422                 JSONObject json = new JSONObject();\r
423                 if (!name.getText().equals(file.getName()))\r
424                         json.put("name", new JSONString(name.getText()));\r
425                 if (versioned.isChecked() != file.isVersioned())\r
426                         json.put("versioned", JSONBoolean.getInstance(versioned.isChecked()));\r
427                 //only update the read for all perm if the user is the owner\r
428                 if (readForAll.isChecked() != file.isReadForAll())\r
429                         if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername()))\r
430                                 json.put("readForAll", JSONBoolean.getInstance(readForAll.isChecked()));\r
431                 int i = 0;\r
432                 if (permList.hasChanges()) {\r
433                         GWT.log("Permissions change", null);\r
434                         JSONArray perma = new JSONArray();\r
435 \r
436                         for (PermissionHolder p : perms) {\r
437                                 JSONObject po = new JSONObject();\r
438                                 if (p.getUser() != null)\r
439                                         po.put("user", new JSONString(p.getUser()));\r
440                                 if (p.getGroup() != null)\r
441                                         po.put("group", new JSONString(p.getGroup()));\r
442                                 po.put("read", JSONBoolean.getInstance(p.isRead()));\r
443                                 po.put("write", JSONBoolean.getInstance(p.isWrite()));\r
444                                 po.put("modifyACL", JSONBoolean.getInstance(p.isModifyACL()));\r
445                                 perma.set(i, po);\r
446                                 i++;\r
447                         }\r
448                         json.put("permissions", perma);\r
449                 }\r
450                 JSONArray taga = new JSONArray();\r
451                 i = 0;\r
452                 if (!tags.getText().equals(initialTagText)) {\r
453                         String[] tagset = tags.getText().split(",");\r
454                         for (String t : tagset) {\r
455                                 JSONString to = new JSONString(t);\r
456                                 taga.set(i, to);\r
457                                 i++;\r
458                         }\r
459                         json.put("tags", taga);\r
460                 }\r
461                 String jsonString = json.toString();\r
462                 if(jsonString.equals("{}")){\r
463                         GWT.log("NO CHANGES", null);\r
464                         return;\r
465                 }\r
466                 PostCommand cf = new PostCommand(file.getUri() + "?update=", jsonString, 200) {\r
467 \r
468                         public void onComplete() {\r
469                                 GSS.get().getFileList().updateFileCache(true, false /* do not clear selected file*/);\r
470                         }\r
471 \r
472                         public void onError(Throwable t) {\r
473                                 GWT.log("", t);\r
474                                 if (t instanceof RestException) {\r
475                                         int statusCode = ((RestException) t).getHttpStatusCode();\r
476                                         if (statusCode == 405)\r
477                                                 GSS.get().displayError("You don't have the necessary permissions");\r
478                                         else if (statusCode == 404)\r
479                                                 GSS.get().displayError("User in permissions does not exist");\r
480                                         else if (statusCode == 409)\r
481                                                 GSS.get().displayError("A file with the same name already exists");\r
482                                         else if (statusCode == 413)\r
483                                                 GSS.get().displayError("Your quota has been exceeded");\r
484                                         else\r
485                                                 GSS.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
486                                 } else\r
487                                         GSS.get().displayError("System error modifying file:" + t.getMessage());\r
488                         }\r
489 \r
490                 };\r
491                 DeferredCommand.addCommand(cf);\r
492 \r
493         }\r
494 \r
495         private void removeAllOldVersions() {\r
496                 JSONObject json = new JSONObject();\r
497                 json.put("versioned", JSONBoolean.getInstance(false));\r
498                 GWT.log(json.toString(), null);\r
499                 PostCommand cf = new PostCommand(file.getUri() + "?update=", json.toString(), 200) {\r
500 \r
501                         public void onComplete() {\r
502                                 toggleVersioned(true);\r
503                         }\r
504 \r
505                         public void onError(Throwable t) {\r
506                                 GWT.log("", t);\r
507                                 if (t instanceof RestException) {\r
508                                         int statusCode = ((RestException) t).getHttpStatusCode();\r
509                                         if (statusCode == 405)\r
510                                                 GSS.get().displayError("You don't have the necessary permissions");\r
511                                         else if (statusCode == 404)\r
512                                                 GSS.get().displayError("User in permissions does not exist");\r
513                                         else if (statusCode == 409)\r
514                                                 GSS.get().displayError("A folder with the same name already exists");\r
515                                         else if (statusCode == 413)\r
516                                                 GSS.get().displayError("Your quota has been exceeded");\r
517                                         else\r
518                                                 GSS.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
519                                 } else\r
520                                         GSS.get().displayError("System error moifying file:" + t.getMessage());\r
521                         }\r
522                 };\r
523                 DeferredCommand.addCommand(cf);\r
524         }\r
525 \r
526         private void toggleVersioned(boolean versionedValue) {\r
527                 JSONObject json = new JSONObject();\r
528                 json.put("versioned", JSONBoolean.getInstance(versionedValue));\r
529                 GWT.log(json.toString(), null);\r
530                 PostCommand cf = new PostCommand(file.getUri() + "?update=", json.toString(), 200) {\r
531 \r
532                         public void onComplete() {\r
533                                 GSS.get().getFileList().updateFileCache(true, false /* do not clear selected file*/);\r
534                         }\r
535 \r
536                         public void onError(Throwable t) {\r
537                                 GWT.log("", t);\r
538                                 if (t instanceof RestException) {\r
539                                         int statusCode = ((RestException) t).getHttpStatusCode();\r
540                                         if (statusCode == 405)\r
541                                                 GSS.get().displayError("You don't have the necessary permissions");\r
542                                         else if (statusCode == 404)\r
543                                                 GSS.get().displayError("User in permissions does not exist");\r
544                                         else if (statusCode == 409)\r
545                                                 GSS.get().displayError("A folder with the same name already exists");\r
546                                         else if (statusCode == 413)\r
547                                                 GSS.get().displayError("Your quota has been exceeded");\r
548                                         else\r
549                                                 GSS.get().displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
550                                 } else\r
551                                         GSS.get().displayError("System error moifying file:" + t.getMessage());\r
552                         }\r
553                 };\r
554                 DeferredCommand.addCommand(cf);\r
555         }\r
556 \r
557         public void selectTab(int _tab) {\r
558                 inner.selectTab(_tab);\r
559         }\r
560 \r
561         /**\r
562          * Enables IE selection prevention and hides the dialog\r
563          * (we disable the prevention on creation of the dialog)\r
564          */\r
565         public void closeDialog() {\r
566                 GSS.preventIESelection();\r
567                 hide();\r
568         }\r
569 \r
570 }\r