fixed http 301 moved permanently dipaply for workspace links
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@95741 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
69bd35eaad
commit
e4e7ff0a41
|
@ -14,6 +14,8 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
|
||||
public class LinkPreviewer extends Composite {
|
||||
|
||||
private static final String HTTP_ERROR_301 = "Moved Permanently";
|
||||
|
||||
private static LinkPreviewUiBinder uiBinder = GWT
|
||||
.create(LinkPreviewUiBinder.class);
|
||||
|
||||
|
@ -26,6 +28,8 @@ public class LinkPreviewer extends Composite {
|
|||
|
||||
private SaveInWorkspaceBox saveCopy;
|
||||
|
||||
private boolean showImage = true;
|
||||
|
||||
@UiField
|
||||
HTML closeImage;
|
||||
@UiField
|
||||
|
@ -50,11 +54,18 @@ public class LinkPreviewer extends Composite {
|
|||
this.parent = parent;
|
||||
this.toShow = toShow;
|
||||
|
||||
titleArea.setHTML("<a class=\"link\" target=\"_blank\" href=\"" + toShow.getUrl() + "\">"+toShow.getTitle()+"</a> <span style=\"color: #333;\"> - " + toShow.getHost() + "</span>");
|
||||
String title = toShow.getTitle();
|
||||
String desc = toShow.getDescription();
|
||||
if (title.compareTo(HTTP_ERROR_301) == 0) {
|
||||
this.toShow.setTitle(title = "HTTP Link");
|
||||
this.toShow.setDescription(desc = "");
|
||||
this.showImage = false;
|
||||
}
|
||||
titleArea.setHTML("<a class=\"link\" target=\"_blank\" href=\"" + title + "\">" + title + "</a> <span style=\"color: #333;\"> - " + toShow.getHost() + "</span>");
|
||||
descText.setHTML((desc.length() > 256) ? desc.substring(0, 256)+"..." : desc);
|
||||
String url = toShow.getUrl();
|
||||
urlText.setHTML((url.length() > 80) ? url.substring(0, 80)+"..." : url);
|
||||
String desc = toShow.getDescription();
|
||||
descText.setHTML((desc.length() > 256) ? desc.substring(0, 256)+"..." : desc);
|
||||
|
||||
switcher.setImages(toShow.getImageUrls());
|
||||
if (isFilePreview) {
|
||||
saveCopy = new SaveInWorkspaceBox();
|
||||
|
@ -62,9 +73,6 @@ public class LinkPreviewer extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ImageSwitcher getSwitcher() {
|
||||
return switcher;
|
||||
}
|
||||
|
@ -97,6 +105,8 @@ public class LinkPreviewer extends Composite {
|
|||
return toShow.getHost();
|
||||
}
|
||||
public String getUrlThumbnail() {
|
||||
if (!showImage)
|
||||
return null;
|
||||
return switcher.getSelectedImageURL();
|
||||
}
|
||||
protected boolean isSharingFile() {
|
||||
|
|
Loading…
Reference in New Issue