Revision b12da07a

b/src/gr/grnet/pithos/web/client/FileShareDialog.java
59 59
 * UI for the "Share" command.
60 60
 */
61 61
public class FileShareDialog extends AbstractPropertiesDialog {
62
    private static final class PremissionsUncheckWarning extends AbstractPropertiesDialog {
63
        private PremissionsUncheckWarning(Pithos app) {
64
            super(app);
65
            final Anchor close = new Anchor("close");
66
            close.addStyleName("close");
67
            close.addClickHandler(new ClickHandler() {
68
                @Override
69
                public void onClick(ClickEvent event) {
70
                    hide();
71
                }
72
            });
73
            final String dialogText = "Info";
74
            setText(dialogText);
75
            setStyleName("pithos-DialogBox");
76

  
77
            final VerticalPanel panel = new VerticalPanel();
78
            panel.add(close);
79

  
80
            VerticalPanel inner = new VerticalPanel();
81
            inner.addStyleName("inner");
82

  
83
            inner.add(
84
                new InlineHTML(
85
                    "It seems you are already sharing this file with some users." +
86
                    "<br>" +
87
                    "Please remove all users from the sharing list, to be able to uncheck this option."
88
                )
89
            );
90

  
91
            final Button ok = new Button("OK", new ClickHandler() {
92
                @Override
93
                public void onClick(ClickEvent event) {
94
                    hide();
95
                }
96
            });
97

  
98
            ok.addStyleName("button");
99
            inner.add(ok);
100

  
101
            panel.add(inner);
102
            panel.setCellHorizontalAlignment(inner, HasHorizontalAlignment.ALIGN_CENTER);
103

  
104
            setWidget(panel);
105
        }
106

  
107
        @Override
108
        protected boolean accept() {
109
            return true;
110
        }
111
    }
112

  
62 113
    // For public sharing
63 114
	private final HorizontalPanel publicPathPanel = new HorizontalPanel();
64 115
	private final TextBox publicPathText = new TextBox();
......
235 286
        privateCheckBox.addClickHandler(new ClickHandler() {
236 287
            @Override
237 288
            public void onClick(ClickEvent event) {
289
                // This is the value *after* the click is applied :)
290
                boolean userCheckedIt = privateCheckBox.getValue();
291
                boolean userUncheckedIt = !userCheckedIt;
292

  
238 293
                if(isFilePrivatelyShared()) {
239 294
                    // ignore the click, set it always to "checked"
240 295
                    privateCheckBox.setValue(true);
241 296
                    // show permissions
242 297
                    privatePermPanel.setVisible(true);
298

  
299
                    // Refs #3593
300
                    if(userUncheckedIt) {
301
                        new PremissionsUncheckWarning(app).center();
302
                    }
243 303
                }
244 304
                else {
245
                    // This is the value *after* the click is applied :)
246
                    boolean isChecked = privateCheckBox.getValue();
247
                    privatePermPanel.setVisible(isChecked);
305
                    privatePermPanel.setVisible(userCheckedIt);
248 306
                }
249 307
            }
250 308
        });
......
569 627
            permList.getPermissions()
570 628
        );
571 629
    }
630

  
572 631
    @Override
573 632
	protected void onPreviewNativeEvent(NativePreviewEvent preview) {
574 633
	    super.onPreviewNativeEvent(preview);

Also available in: Unified diff