34 |
34 |
import com.google.gwt.http.client.URL;
|
35 |
35 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
36 |
36 |
import com.google.gwt.user.client.DeferredCommand;
|
|
37 |
import com.google.gwt.user.client.Window;
|
37 |
38 |
import com.google.gwt.user.client.ui.ClickListener;
|
38 |
39 |
import com.google.gwt.user.client.ui.Composite;
|
39 |
40 |
import com.google.gwt.user.client.ui.FlexTable;
|
... | ... | |
103 |
104 |
toRemove = null;
|
104 |
105 |
}
|
105 |
106 |
for (final FileResource dto : versions) {
|
106 |
|
HTML restoreVersion = new HTML("<a href='#' class='hidden-link info'>"+images.restore().getHTML()+"<span>Restore this Version</span></a>");
|
|
107 |
HTML restoreVersion = new HTML("<a href='#' class='hidden-link info'><span>"+images.restore().getHTML()+"</span><div>Restore this Version</div></a>");
|
107 |
108 |
restoreVersion.addClickListener( new ClickListener() {
|
108 |
109 |
|
109 |
110 |
public void onClick(Widget sender) {
|
... | ... | |
115 |
116 |
permTable.setHTML(i, 1, "<span>" + formatDate(dto.getCreationDate()) + "</span>");
|
116 |
117 |
permTable.setHTML(i, 2, "<span>" + formatDate(dto.getModificationDate()) + "</span>");
|
117 |
118 |
permTable.setHTML(i, 3, "<span>" + dto.getFileSizeAsString() + "</span>");
|
118 |
|
String[] link = {"", ""};
|
119 |
|
createDownloadLink(link, dto);
|
120 |
|
HTML downloadHtml = new HTML(link[0]+images.download().getHTML()+"<span>View This Version</span>"+link[1]);
|
|
119 |
HTML downloadHtml = new HTML("<a class='hidden-link info' href='#'><span>"+images.download().getHTML()+"</span><div>View this Version</div></a>");
|
|
120 |
downloadHtml.addClickListener(new ClickListener(){
|
|
121 |
|
|
122 |
public void onClick(Widget arg0) {
|
|
123 |
String dateString = AbstractRestCommand.getDate();
|
|
124 |
String resource = dto.getUri().substring(GSS.GSS_REST_PATH.length()-1, dto.getUri().length());
|
|
125 |
String sig = GSS.get().getCurrentUserResource().getUsername()+" "+AbstractRestCommand.calculateSig("GET", dateString, resource, AbstractRestCommand.base64decode(GSS.get().getToken()));
|
|
126 |
String fileUrl = dto.getUri() + "&Authorization=" + URL.encodeComponent(sig) + "&Date="+URL.encodeComponent(dateString);
|
|
127 |
Window.open(fileUrl, "_BLANK", "");
|
|
128 |
|
|
129 |
}
|
|
130 |
});
|
|
131 |
GWT.log("images:"+images.download().getHTML(), null);
|
121 |
132 |
permTable.setWidget(i, 4, downloadHtml);
|
122 |
133 |
permTable.setWidget(i, 5, restoreVersion);
|
123 |
134 |
permTable.getFlexCellFormatter().setStyleName(i, 0, "props-labels");
|
... | ... | |
132 |
143 |
permTable.removeRow(i);
|
133 |
144 |
}
|
134 |
145 |
|
135 |
|
void createDownloadLink(String[] link, FileResource file) {
|
136 |
|
String dateString = AbstractRestCommand.getDate();
|
137 |
|
String resource = file.getUri().substring(GSS.GSS_REST_PATH.length()-1,file.getUri().length());
|
138 |
|
String sig = GSS.get().getCurrentUserResource().getUsername()+" "+AbstractRestCommand.calculateSig("GET", dateString, resource, AbstractRestCommand.base64decode(GSS.get().getToken()));
|
139 |
|
link[0] = "<a class='hidden-link info' href='" + file.getUri() + "&Authorization=" + URL.encodeComponent(sig) + "&Date="+URL.encodeComponent(dateString) + "' target='_blank'>";
|
140 |
|
link[1] = "</a>";
|
141 |
|
}
|
142 |
146 |
|
143 |
147 |
void removeVersion(final FileResource version) {
|
144 |
148 |
ExecuteDelete df = new ExecuteDelete(version.getUri()){
|