Revision b432ea43

b/src/gr/grnet/pithos/web/client/FeedbackDialog.java
34 34
 */
35 35
package gr.grnet.pithos.web.client;
36 36

  
37
import gr.grnet.pithos.web.client.foldertree.Resource;
38
import gr.grnet.pithos.web.client.rest.PostRequest;
39

  
40
import com.google.gwt.core.client.GWT;
41
import com.google.gwt.core.client.Scheduler;
37 42
import com.google.gwt.dom.client.NativeEvent;
38 43
import com.google.gwt.event.dom.client.ClickEvent;
39 44
import com.google.gwt.event.dom.client.ClickHandler;
40 45
import com.google.gwt.event.dom.client.KeyCodes;
46
import com.google.gwt.http.client.Response;
41 47
import com.google.gwt.user.client.Event.NativePreviewEvent;
42 48
import com.google.gwt.user.client.ui.Anchor;
43 49
import com.google.gwt.user.client.ui.Button;
......
62 68
	/**
63 69
	 * The widget constructor.
64 70
	 */
65
	public FeedbackDialog() {
71
	public FeedbackDialog(final Pithos app) {
66 72
		// Set the dialog's caption.
67 73
		Anchor close = new Anchor();
68 74
		close.addStyleName("close");
......
88 94
		inner.add(text);
89 95
		FlexTable table = new FlexTable();
90 96
		table.setText(0, 0, "Please describe your problem here, provide as many details as possible");
91
		TextArea msg = new TextArea();
97
		final TextArea msg = new TextArea();
92 98
		msg.setWidth("100%");
93 99
		msg.setHeight("100px");
94 100
		table.setWidget(1, 0, msg);
......
102 108
		Button confirm = new Button("Submit feedback", new ClickHandler() {
103 109
			@Override
104 110
			public void onClick(ClickEvent event) {
111
				PostRequest sendFeedback = new PostRequest("/tools/", "", "feedback", "feedback-msg=" + msg.getText()) {
112
					
113
					@Override
114
					protected void onUnauthorized(Response response) {
115
						app.sessionExpired();
116
					}
117
					
118
					@Override
119
					public void onSuccess(Resource result) {
120
						app.displayInformation("Feedback sent");
121
					}
122
					
123
					@Override
124
					public void onError(Throwable t) {
125
						GWT.log("", t);
126
					}
127
				};
128
				sendFeedback.setHeader("X-Auth-Token", app.getToken());
129
				Scheduler.get().scheduleDeferred(sendFeedback);
105 130
				hide();
106 131
			}
107 132
		});
b/src/gr/grnet/pithos/web/client/TopPanel.java
140 140
			
141 141
			@Override
142 142
			public void execute() {
143
				new FeedbackDialog().center();
143
				new FeedbackDialog(app).center();
144 144
			}
145 145
		}));
146 146
        userItemMenu.addItem(new MenuItem("API access", new Command() {

Also available in: Unified diff