Revision 287c3d8d web_client/src/gr/grnet/pithos/web/client/FolderPropertiesDialog.java
b/web_client/src/gr/grnet/pithos/web/client/FolderPropertiesDialog.java | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
package gr.grnet.pithos.web.client; |
36 | 36 |
|
37 |
import gr.grnet.pithos.web.client.FilePropertiesDialog.Images; |
|
37 |
import com.google.gwt.event.dom.client.KeyDownEvent; |
|
38 |
import com.google.gwt.user.client.Event; |
|
39 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
|
38 | 40 |
import gr.grnet.pithos.web.client.rest.PostCommand; |
39 | 41 |
import gr.grnet.pithos.web.client.rest.RestException; |
40 |
import gr.grnet.pithos.web.client.rest.resource.FolderResource; |
|
41 |
import gr.grnet.pithos.web.client.rest.resource.GroupResource; |
|
42 |
import gr.grnet.pithos.web.client.rest.resource.PermissionHolder; |
|
43 | 42 |
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper; |
44 | 43 |
|
45 |
import java.util.List; |
|
46 |
import java.util.Set; |
|
47 |
|
|
48 | 44 |
import com.google.gwt.core.client.GWT; |
49 | 45 |
import com.google.gwt.dom.client.NativeEvent; |
50 |
import com.google.gwt.event.dom.client.ChangeEvent; |
|
51 |
import com.google.gwt.event.dom.client.ChangeHandler; |
|
52 | 46 |
import com.google.gwt.event.dom.client.ClickEvent; |
53 | 47 |
import com.google.gwt.event.dom.client.ClickHandler; |
54 | 48 |
import com.google.gwt.event.dom.client.KeyCodes; |
55 | 49 |
import com.google.gwt.http.client.URL; |
56 | 50 |
import com.google.gwt.i18n.client.DateTimeFormat; |
57 |
import com.google.gwt.json.client.JSONArray; |
|
58 |
import com.google.gwt.json.client.JSONBoolean; |
|
59 |
import com.google.gwt.json.client.JSONObject; |
|
60 |
import com.google.gwt.json.client.JSONString; |
|
61 | 51 |
import com.google.gwt.user.client.DeferredCommand; |
62 | 52 |
import com.google.gwt.user.client.Event.NativePreviewEvent; |
63 | 53 |
import com.google.gwt.user.client.ui.Button; |
... | ... | |
77 | 67 |
*/ |
78 | 68 |
public class FolderPropertiesDialog extends DialogBox { |
79 | 69 |
|
80 |
private List<GroupResource> groups = null; |
|
81 |
|
|
82 |
final PermissionsList permList; |
|
83 |
|
|
84 | 70 |
private CheckBox readForAll; |
85 | 71 |
|
86 | 72 |
/** |
... | ... | |
94 | 80 |
*/ |
95 | 81 |
private final boolean create; |
96 | 82 |
|
97 |
final FolderResource folder;
|
|
83 |
final Folder folder; |
|
98 | 84 |
|
99 | 85 |
final TabPanel inner; |
100 | 86 |
|
101 | 87 |
/** |
102 | 88 |
* The widget's constructor. |
103 | 89 |
* |
104 |
* @param images the image icons from the file properties dialog |
|
105 | 90 |
* @param _create true if the dialog is displayed for creating a new |
106 | 91 |
* sub-folder of the selected folder, false if it is displayed |
107 | 92 |
* for modifying the selected folder |
108 | 93 |
*/ |
109 |
public FolderPropertiesDialog(Images images, boolean _create, final List<GroupResource> _groups) {
|
|
94 |
public FolderPropertiesDialog(boolean _create, Folder selected) {
|
|
110 | 95 |
setAnimationEnabled(true); |
111 | 96 |
|
112 | 97 |
// Enable IE selection for the dialog (must disable it upon closing it) |
... | ... | |
114 | 99 |
|
115 | 100 |
create = _create; |
116 | 101 |
|
117 |
folder = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource(); |
|
118 |
permList = new PermissionsList(images, folder.getPermissions(), folder.getOwner()); |
|
119 |
groups = _groups; |
|
102 |
folder = selected; |
|
120 | 103 |
|
121 | 104 |
// Use this opportunity to set the dialog's caption. |
122 | 105 |
if (create) |
... | ... | |
141 | 124 |
inner.add(permPanel, "Sharing"); |
142 | 125 |
inner.selectTab(0); |
143 | 126 |
|
144 |
final Label folderNameNote = new Label("Please note that slashes ('/') are not allowed in folder names.", true); |
|
145 |
folderNameNote.setVisible(false); |
|
146 |
folderNameNote.setStylePrimaryName("pithos-readForAllNote"); |
|
147 |
|
|
148 | 127 |
FlexTable generalTable = new FlexTable(); |
149 | 128 |
generalTable.setText(0, 0, "Name"); |
150 | 129 |
generalTable.setText(1, 0, "Parent"); |
151 | 130 |
generalTable.setText(2, 0, "Creator"); |
152 | 131 |
generalTable.setText(3, 0, "Last modified"); |
153 | 132 |
folderName.setText(create ? "" : folder.getName()); |
154 |
folderName.getElement().setId("folderPropertiesDialog.textBox.name"); |
|
155 | 133 |
generalTable.setWidget(0, 1, folderName); |
156 |
folderName.addChangeHandler(new ChangeHandler() { |
|
157 |
|
|
158 |
@Override |
|
159 |
public void onChange(ChangeEvent event) { |
|
160 |
if(folderName.getText().contains("/")) |
|
161 |
folderNameNote.setVisible(true); |
|
162 |
else |
|
163 |
folderNameNote.setVisible(false); |
|
164 |
|
|
165 |
} |
|
166 |
}); |
|
167 |
|
|
168 | 134 |
|
169 | 135 |
if (create) |
170 | 136 |
generalTable.setText(1, 1, folder.getName()); |
171 |
else if(folder.getParentName() == null) |
|
172 |
generalTable.setText(1, 1, "-"); |
|
173 | 137 |
else |
174 |
generalTable.setText(1, 1, folder.getParentName()); |
|
175 |
generalTable.setWidget(0, 2, folderNameNote); |
|
176 |
generalTable.setText(2, 1, folder.getOwner()); |
|
138 |
generalTable.setText(1, 1, folder.getPrefix()); |
|
139 |
generalTable.setText(2, 1, ""); |
|
177 | 140 |
DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); |
178 |
if(folder.getModificationDate() != null)
|
|
179 |
generalTable.setText(3, 1, formatter.format(folder.getModificationDate()));
|
|
141 |
if(folder.getLastModified() != null)
|
|
142 |
generalTable.setText(3, 1, formatter.format(folder.getLastModified()));
|
|
180 | 143 |
generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); |
181 | 144 |
generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); |
182 | 145 |
generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels"); |
... | ... | |
196 | 159 |
okLabel = "Update"; |
197 | 160 |
Button ok = new Button(okLabel, new ClickHandler() { |
198 | 161 |
@Override |
199 |
public void onClick(ClickEvent event) { |
|
200 |
if(folderName.getText().contains("/")) |
|
201 |
folderNameNote.setVisible(true); |
|
202 |
else { |
|
203 |
folderNameNote.setVisible(false); |
|
204 |
createOrUpdateFolder(); |
|
205 |
closeDialog(); |
|
206 |
} |
|
207 |
|
|
162 |
public void onClick(ClickEvent event) { |
|
163 |
createOrUpdateFolder(); |
|
164 |
closeDialog(); |
|
208 | 165 |
} |
209 | 166 |
}); |
210 |
ok.getElement().setId("folderPropertiesDialog.button.ok"); |
|
211 | 167 |
buttons.add(ok); |
212 | 168 |
buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); |
213 | 169 |
// Create the 'Cancel' button, along with a listener that hides the |
... | ... | |
219 | 175 |
closeDialog(); |
220 | 176 |
} |
221 | 177 |
}); |
222 |
cancel.getElement().setId("folderPropertiesDialog.button.cancel"); |
|
223 | 178 |
buttons.add(cancel); |
224 | 179 |
buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); |
225 | 180 |
buttons.setSpacing(8); |
226 | 181 |
buttons.addStyleName("pithos-TabPanelBottom"); |
227 | 182 |
|
228 |
Button add = new Button("Add Group", new ClickHandler() { |
|
229 |
@Override |
|
230 |
public void onClick(ClickEvent event) { |
|
231 |
PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, false); |
|
232 |
dlg.center(); |
|
233 |
} |
|
234 |
}); |
|
235 |
add.getElement().setId("folderPropertiesDialog.button.addGroup"); |
|
236 |
permButtons.add(add); |
|
237 |
permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER); |
|
238 |
|
|
239 |
Button addUser = new Button("Add User", new ClickHandler() { |
|
240 |
@Override |
|
241 |
public void onClick(ClickEvent event) { |
|
242 |
PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, true); |
|
243 |
dlg.center(); |
|
244 |
} |
|
245 |
}); |
|
246 |
addUser.getElement().setId("folderPropertiesDialog.button.addUser"); |
|
247 |
permButtons.add(addUser); |
|
248 |
permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER); |
|
249 |
|
|
250 |
permButtons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); |
|
251 |
permButtons.setSpacing(8); |
|
252 |
permButtons.addStyleName("pithos-TabPanelBottom"); |
|
253 |
|
|
254 |
final Label readForAllNote = new Label("When this option is enabled, the folder will be readable" + |
|
255 |
" by everyone. By checking this option, you are certifying that you have the right to " + |
|
256 |
"distribute this folder's contents and that it does not violate the Terms of Use.", true); |
|
257 |
readForAllNote.setVisible(false); |
|
258 |
readForAllNote.setStylePrimaryName("pithos-readForAllNote"); |
|
259 |
|
|
260 |
readForAll = new CheckBox(); |
|
261 |
readForAll.getElement().setId("folderPropertiesDialog.checkBox.public"); |
|
262 |
readForAll.setValue(folder.isReadForAll()); |
|
263 |
readForAll.addClickHandler(new ClickHandler() { |
|
264 |
@Override |
|
265 |
public void onClick(ClickEvent event) { |
|
266 |
readForAllNote.setVisible(readForAll.getValue()); |
|
267 |
} |
|
268 |
|
|
269 |
}); |
|
270 |
|
|
271 | 183 |
generalPanel.add(generalTable); |
272 |
permPanel.add(permList); |
|
273 |
permPanel.add(permButtons); |
|
274 |
|
|
275 |
// Only show the read for all permission if the user is the owner. |
|
276 |
if (folder.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) { |
|
277 |
permForAll.add(new Label("Public")); |
|
278 |
permForAll.add(readForAll); |
|
279 |
permForAll.setSpacing(8); |
|
280 |
permForAll.addStyleName("pithos-TabPanelBottom"); |
|
281 |
permForAll.add(readForAllNote); |
|
282 |
permPanel.add(permForAll); |
|
283 |
} |
|
284 |
TextBox path = new TextBox(); |
|
285 |
path.getElement().setId("folderPropertiesDialog.textBox.link"); |
|
286 |
path.setWidth("100%"); |
|
287 |
path.addClickHandler(new ClickHandler() { |
|
288 |
@Override |
|
289 |
public void onClick(ClickEvent event) { |
|
290 |
GSS.enableIESelection(); |
|
291 |
((TextBox) event.getSource()).selectAll(); |
|
292 |
GSS.preventIESelection(); |
|
293 |
} |
|
294 | 184 |
|
295 |
}); |
|
296 |
path.setText(folder.getUri()); |
|
297 |
path.setTitle("Use this link for sharing the folder via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)"); |
|
298 |
path.setWidth("100%"); |
|
299 |
path.setReadOnly(true); |
|
300 |
pathPanel.setWidth("100%"); |
|
301 |
pathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); |
|
302 |
pathPanel.add(new Label("Link")); |
|
303 |
pathPanel.setSpacing(8); |
|
304 |
pathPanel.addStyleName("pithos-TabPanelBottom"); |
|
305 |
pathPanel.add(path); |
|
306 |
permPanel.add(pathPanel); |
|
307 | 185 |
|
308 | 186 |
outer.add(inner); |
309 | 187 |
outer.add(buttons); |
... | ... | |
329 | 207 |
super.onPreviewNativeEvent(preview); |
330 | 208 |
|
331 | 209 |
NativeEvent evt = preview.getNativeEvent(); |
332 |
if (evt.getType().equals("keydown"))
|
|
210 |
if (evt.getType().equals(KeyDownEvent.getType().getName()))
|
|
333 | 211 |
// Use the popup's key preview hooks to close the dialog when either |
334 | 212 |
// enter or escape is pressed. |
335 | 213 |
switch (evt.getKeyCode()) { |
... | ... | |
355 | 233 |
|
356 | 234 |
/** |
357 | 235 |
* Generate an RPC request to create a new folder. |
358 |
* |
|
359 |
* @param userId the ID of the user whose namespace will be searched for |
|
360 |
* folders |
|
361 |
* @param _folderName the name of the folder to create |
|
362 | 236 |
*/ |
363 | 237 |
private void createFolder() { |
364 | 238 |
String name = folderName.getText(); |
365 |
if (!GSS.isValidResourceName(name)) { |
|
366 |
GSS.get().displayError("The folder name '" + name + "' is invalid"); |
|
367 |
return; |
|
368 |
} |
|
369 |
PostCommand ep = new PostCommand(folder.getUri() + "?new=" + |
|
370 |
URL.encodeComponent(name), "", 201) { |
|
371 | 239 |
|
372 |
@Override |
|
373 |
public void onComplete() { |
|
374 |
//TODO:CELLTREE |
|
375 |
if(folder.getUri().equals(GSS.get().getTreeView().getMyFolders().getUri())){ |
|
376 |
GSS.get().getTreeView().updateRootNode(); |
|
377 |
} |
|
378 |
else |
|
379 |
GSS.get().getTreeView().updateNodeChildren((RestResourceWrapper) GSS.get().getTreeView().getSelection()); |
|
380 |
//GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent()); |
|
381 |
} |
|
382 |
|
|
383 |
@Override |
|
384 |
public void onError(Throwable t) { |
|
385 |
GWT.log("", t); |
|
386 |
if(t instanceof RestException){ |
|
387 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
|
388 |
if(statusCode == 405) |
|
389 |
GSS.get().displayError("You don't have the necessary" + |
|
390 |
" permissions or a folder with same name " + |
|
391 |
"already exists"); |
|
392 |
else if(statusCode == 404) |
|
393 |
GSS.get().displayError("Resource not found"); |
|
394 |
else |
|
395 |
GSS.get().displayError("Unable to create folder:" + |
|
396 |
((RestException)t).getHttpStatusText()); |
|
397 |
} |
|
398 |
else |
|
399 |
GSS.get().displayError("System error creating folder:" + |
|
400 |
t.getMessage()); |
|
401 |
} |
|
402 |
}; |
|
403 |
DeferredCommand.addCommand(ep); |
|
240 |
// PostCommand ep = new PostCommand(folder.getUri() + "?new=" + |
|
241 |
// URL.encodeComponent(name), "", 201) { |
|
242 |
// |
|
243 |
// @Override |
|
244 |
// public void onComplete() { |
|
245 |
// //TODO:CELLTREE |
|
246 |
// if(folder.getUri().equals(GSS.get().getTreeView().getMyFolders().getUri())){ |
|
247 |
// GSS.get().getTreeView().updateRootNode(); |
|
248 |
// } |
|
249 |
// else |
|
250 |
// GSS.get().getTreeView().updateNodeChildren((RestResourceWrapper) GSS.get().getTreeView().getSelection()); |
|
251 |
// //GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent()); |
|
252 |
// } |
|
253 |
// |
|
254 |
// @Override |
|
255 |
// public void onError(Throwable t) { |
|
256 |
// GWT.log("", t); |
|
257 |
// if(t instanceof RestException){ |
|
258 |
// int statusCode = ((RestException)t).getHttpStatusCode(); |
|
259 |
// if(statusCode == 405) |
|
260 |
// GSS.get().displayError("You don't have the necessary" + |
|
261 |
// " permissions or a folder with same name " + |
|
262 |
// "already exists"); |
|
263 |
// else if(statusCode == 404) |
|
264 |
// GSS.get().displayError("Resource not found"); |
|
265 |
// else |
|
266 |
// GSS.get().displayError("Unable to create folder:" + |
|
267 |
// ((RestException)t).getHttpStatusText()); |
|
268 |
// } |
|
269 |
// else |
|
270 |
// GSS.get().displayError("System error creating folder:" + |
|
271 |
// t.getMessage()); |
|
272 |
// } |
|
273 |
// }; |
|
274 |
// DeferredCommand.addCommand(ep); |
|
404 | 275 |
|
405 | 276 |
} |
406 | 277 |
|
... | ... | |
408 | 279 |
* Upon closing the dialog by clicking OK or pressing ENTER this method does |
409 | 280 |
* the actual work of modifying folder properties or creating a new Folder |
410 | 281 |
* depending on the value of the create field |
411 |
* |
|
412 |
* @param userId |
|
413 | 282 |
*/ |
414 | 283 |
private void createOrUpdateFolder() { |
415 | 284 |
if (create) |
... | ... | |
420 | 289 |
} |
421 | 290 |
|
422 | 291 |
private void updateFolder() { |
423 |
permList.updatePermissionsAccordingToInput(); |
|
424 |
Set<PermissionHolder> perms = permList.getPermissions(); |
|
425 |
JSONObject json = new JSONObject(); |
|
426 |
if(!folder.getName().equals(folderName.getText())) |
|
427 |
json.put("name", new JSONString(folderName.getText())); |
|
428 |
//only update the read for all perm if the user is the owner |
|
429 |
if (readForAll.getValue() != folder.isReadForAll()) |
|
430 |
if (folder.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) |
|
431 |
json.put("readForAll", JSONBoolean.getInstance(readForAll.getValue())); |
|
432 |
if (permList.hasChanges()) { |
|
433 |
JSONArray perma = new JSONArray(); |
|
434 |
int i=0; |
|
435 |
for(PermissionHolder p : perms){ |
|
436 |
JSONObject po = new JSONObject(); |
|
437 |
if(p.getUser() != null) |
|
438 |
po.put("user", new JSONString(p.getUser())); |
|
439 |
if(p.getGroup() != null) |
|
440 |
po.put("group", new JSONString(p.getGroup())); |
|
441 |
po.put("read", JSONBoolean.getInstance(p.isRead())); |
|
442 |
po.put("write", JSONBoolean.getInstance(p.isWrite())); |
|
443 |
po.put("modifyACL", JSONBoolean.getInstance(p.isModifyACL())); |
|
444 |
perma.set(i,po); |
|
445 |
i++; |
|
446 |
} |
|
447 |
json.put("permissions", perma); |
|
448 |
GWT.log(json.toString(), null); |
|
449 |
} |
|
450 |
PostCommand ep = new PostCommand(folder.getUri()+"?update=", json.toString(), 200){ |
|
451 |
|
|
452 |
@Override |
|
453 |
public void onComplete() { |
|
454 |
//TODO:CELLTREE |
|
455 |
|
|
456 |
if(getPostBody() != null && !"".equals(getPostBody().trim())){ |
|
457 |
|
|
458 |
|
|
459 |
FolderResource fres = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource(); |
|
460 |
String initialPath = fres.getUri(); |
|
461 |
String newPath = getPostBody().trim(); |
|
462 |
fres.setUri(newPath); |
|
463 |
((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource().setUri(newPath); |
|
464 |
((RestResourceWrapper) GSS.get().getTreeView().getSelection()).setUri(newPath); |
|
465 |
GSS.get().getTreeView().updateNodeChildren(fres.getParentURI()); |
|
466 |
if (permList.hasChanges()) { |
|
467 |
GSS.get().getTreeView().updateMySharedNode(); |
|
468 |
} |
|
469 |
/* |
|
470 |
if(folderItem.getParentItem() != null && ((DnDTreeItem)folderItem.getParentItem()).getFolderResource() != null){ |
|
471 |
((DnDTreeItem)folderItem.getParentItem()).getFolderResource().removeSubfolderPath(initialPath); |
|
472 |
((DnDTreeItem)folderItem.getParentItem()).getFolderResource().getSubfolderPaths().add(newPath); |
|
473 |
}*/ |
|
474 |
} |
|
475 |
//GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent()); |
|
476 |
|
|
477 |
GSS.get().showFileList(true); |
|
478 |
} |
|
479 |
|
|
480 |
@Override |
|
481 |
public void onError(Throwable t) { |
|
482 |
GWT.log("", t); |
|
483 |
if(t instanceof RestException){ |
|
484 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
|
485 |
if(statusCode == 405) |
|
486 |
GSS.get().displayError("You don't have the necessary permissions or" + |
|
487 |
" a folder with same name already exists"); |
|
488 |
else if(statusCode == 404) |
|
489 |
GSS.get().displayError("Resource not found, or user specified in sharing does not exist"); |
|
490 |
else |
|
491 |
GSS.get().displayError("Unable to update folder: "+((RestException)t).getHttpStatusText()); |
|
492 |
} |
|
493 |
else |
|
494 |
GSS.get().displayError("System error moifying file: "+t.getMessage()); |
|
495 |
//TODO:CELLTREE |
|
496 |
//GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent()); |
|
497 |
} |
|
498 |
}; |
|
499 |
DeferredCommand.addCommand(ep); |
|
292 |
// permList.updatePermissionsAccordingToInput();
|
|
293 |
// Set<PermissionHolder> perms = permList.getPermissions();
|
|
294 |
// JSONObject json = new JSONObject();
|
|
295 |
// if(!folder.getName().equals(folderName.getText()))
|
|
296 |
// json.put("name", new JSONString(folderName.getText()));
|
|
297 |
// //only update the read for all perm if the user is the owner
|
|
298 |
// if (readForAll.getValue() != folder.isReadForAll())
|
|
299 |
// if (folder.getOwner().equals(GSS.get().getCurrentUserResource().getUsername()))
|
|
300 |
// json.put("readForAll", JSONBoolean.getInstance(readForAll.getValue()));
|
|
301 |
// if (permList.hasChanges()) {
|
|
302 |
// JSONArray perma = new JSONArray();
|
|
303 |
// int i=0;
|
|
304 |
// for(PermissionHolder p : perms){
|
|
305 |
// JSONObject po = new JSONObject();
|
|
306 |
// if(p.getUser() != null)
|
|
307 |
// po.put("user", new JSONString(p.getUser()));
|
|
308 |
// if(p.getGroup() != null)
|
|
309 |
// po.put("group", new JSONString(p.getGroup()));
|
|
310 |
// po.put("read", JSONBoolean.getInstance(p.isRead()));
|
|
311 |
// po.put("write", JSONBoolean.getInstance(p.isWrite()));
|
|
312 |
// po.put("modifyACL", JSONBoolean.getInstance(p.isModifyACL()));
|
|
313 |
// perma.set(i,po);
|
|
314 |
// i++;
|
|
315 |
// }
|
|
316 |
// json.put("permissions", perma);
|
|
317 |
// GWT.log(json.toString(), null);
|
|
318 |
// }
|
|
319 |
// PostCommand ep = new PostCommand(folder.getUri()+"?update=", json.toString(), 200){
|
|
320 |
// |
|
321 |
// @Override
|
|
322 |
// public void onComplete() {
|
|
323 |
// //TODO:CELLTREE
|
|
324 |
// |
|
325 |
// if(getPostBody() != null && !"".equals(getPostBody().trim())){
|
|
326 |
// |
|
327 |
// |
|
328 |
// FolderResource fres = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource();
|
|
329 |
// String initialPath = fres.getUri();
|
|
330 |
// String newPath = getPostBody().trim();
|
|
331 |
// fres.setUri(newPath);
|
|
332 |
// ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource().setUri(newPath);
|
|
333 |
// ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).setUri(newPath);
|
|
334 |
// GSS.get().getTreeView().updateNodeChildren(fres.getParentURI());
|
|
335 |
// if (permList.hasChanges()) {
|
|
336 |
// GSS.get().getTreeView().updateMySharedNode();
|
|
337 |
// }
|
|
338 |
// /*
|
|
339 |
// if(folderItem.getParentItem() != null && ((DnDTreeItem)folderItem.getParentItem()).getFolderResource() != null){
|
|
340 |
// ((DnDTreeItem)folderItem.getParentItem()).getFolderResource().removeSubfolderPath(initialPath);
|
|
341 |
// ((DnDTreeItem)folderItem.getParentItem()).getFolderResource().getSubfolderPaths().add(newPath);
|
|
342 |
// }*/
|
|
343 |
// }
|
|
344 |
// //GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent());
|
|
345 |
// |
|
346 |
// GSS.get().showFileList(true);
|
|
347 |
// }
|
|
348 |
// |
|
349 |
// @Override
|
|
350 |
// public void onError(Throwable t) {
|
|
351 |
// GWT.log("", t);
|
|
352 |
// if(t instanceof RestException){
|
|
353 |
// int statusCode = ((RestException)t).getHttpStatusCode();
|
|
354 |
// if(statusCode == 405)
|
|
355 |
// GSS.get().displayError("You don't have the necessary permissions or" +
|
|
356 |
// " a folder with same name already exists");
|
|
357 |
// else if(statusCode == 404)
|
|
358 |
// GSS.get().displayError("Resource not found, or user specified in sharing does not exist");
|
|
359 |
// else
|
|
360 |
// GSS.get().displayError("Unable to update folder: "+((RestException)t).getHttpStatusText());
|
|
361 |
// }
|
|
362 |
// else
|
|
363 |
// GSS.get().displayError("System error moifying file: "+t.getMessage());
|
|
364 |
// //TODO:CELLTREE
|
|
365 |
// //GSS.get().getFolders().updateFolder( (DnDTreeItem) GSS.get().getFolders().getCurrent());
|
|
366 |
// }
|
|
367 |
// };
|
|
368 |
// DeferredCommand.addCommand(ep);
|
|
500 | 369 |
} |
501 | 370 |
|
502 | 371 |
public void selectTab(int _tab) { |
Also available in: Unified diff