integrated the Google Docs viewer

task/19600
Francesco Mangiacrapa 4 years ago
parent 4721a48c31
commit 6c1c00c238

@ -31,8 +31,10 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.http.client.URL;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
@ -91,6 +93,9 @@ public class DialogGetInfoBootstrap extends Composite {
@UiField
HTMLPanel htmlPanelImagePreview;
@UiField
HTMLPanel htmlPanelFilePreview;
@UiField
HTML txtName;
@ -320,10 +325,11 @@ public class DialogGetInfoBootstrap extends Composite {
if (typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM)) {
loadGcubeItemProperties();
}
/*
if(typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE) ||
typeEnum.equals(GXTFolderItemTypeEnum.PDF_DOCUMENT)) {
typeEnum.equals(GXTFolderItemTypeEnum.PDF_DOCUMENT) ||
typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_FILE)) {
GWT.log("The file is a PDF");
@ -339,36 +345,17 @@ public class DialogGetInfoBootstrap extends Composite {
GWT.log("The PublicLink link is: "+result);
if(result!=null) {
// String pdfPreview = "<object "
// + "width=\"300\" "
// + "height=\"300\" "
// + "type=\"application/pdf\" "
// + "data=\""+result.getCompleteURL()+"?#zoom=85&scrollbar=0&toolbar=0&navpanes=0\">"
// + "<p>This browser does not support PDFs</p>"
// + "</object>";
//
// String pdfPreview = "<iframe "
// + "src=\"http://docs.google.com/gview?url="+result.getCompleteURL()+"&embedded=true\" "
// + "style=\"width:90%; max-height:400px;\" frameborder=\"0\"></iframe>";
//
String pdfPreview = "<object data=\""+result.getCompleteURL()+"\" type=\"application/pdf\" width=\"250\" height=\"300\">"
+ "<iframe src=\""+result.getCompleteURL()+"\" style=\"border: none;\" width=\"100%\" height=\"100%\">"
+ "This browser does not support PDFs. Please download the PDF to view it: "
+ "<a href=\""+result.getCompleteURL()+"\">Download PDF</a></iframe>"
+ "</object>";
//
String pdfPreview = "<object data=\""+result.getCompleteURL()+"\" type=\"application/pdf\" width=\"100%\" height=\"100%\">"</object>";
String pdfPreview = "<iframe frameBorder=\"0\" class=\"my-preview-doc\" "
+ "src=\"https://docs.google.com/viewer?url="+URL.encode(result.getCompleteURL())+"&embedded=true\">"
+ "</iframe>";
//pdfPreview = "<embed src=\""+result.getCompleteURL()+"\" type=\"application/pdf\" width=\"100%\" height=\"100%\">";
htmlPanelImagePreview.add(new HTML(pdfPreview));
htmlPanelImagePreview.setVisible(true);
htmlPanelFilePreview.add(new HTML(pdfPreview));
htmlPanelFilePreview.setVisible(true);
}
}
});
}*/
}
}
addHandlers();

@ -19,6 +19,9 @@
<g:HTMLPanel ui:field="htmlPanelImagePreview"
visible="false" addStyleNames="preview-image-style">
</g:HTMLPanel>
<g:HTMLPanel ui:field="htmlPanelFilePreview"
visible="false" addStyleNames="preview-file-style">
</g:HTMLPanel>
<b:Form type="HORIZONTAL">
<b:Alert ui:field="actionAlert" close="false" type="INFO"
visible="false">
@ -53,7 +56,7 @@
<b:ControlGroup
addStyleNames="my-control-group-get-info" ui:field="cgTxtIsPublic"
visible="false">
<b:ControlLabel>Public Folder</b:ControlLabel>
<b:ControlLabel>Public</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtIsPublic">
</g:HTML>
@ -84,12 +87,12 @@
readOnly="true">
</b:TextArea>
<b:Tooltip text="Edit the Description">
<b:Button icon="EDIT"
ui:field="buttonUpdateDescription" type="LINK">Edit</b:Button>
<b:Button icon="EDIT" ui:field="buttonUpdateDescription"
type="LINK">Edit</b:Button>
</b:Tooltip>
<b:Tooltip text="Save the Description">
<b:Button icon="SAVE"
ui:field="buttonSaveDescription" type="LINK" visible="false">Save</b:Button>
<b:Button icon="SAVE" ui:field="buttonSaveDescription"
type="LINK" visible="false">Save</b:Button>
</b:Tooltip>
</b:Controls>
</b:ControlGroup>

@ -304,7 +304,7 @@ table.userssuggest th {
.my-control-group-get-info {
margin-bottom: 5px !important;
margin-left: 10px;
margin-left: 15px;
font-size: 14px !important;
font-family: Arial, serif;
color: #222;
@ -330,7 +330,9 @@ table.userssuggest th {
.my-control-group-get-info .gwt-HTML {
padding-top: 5px;
font-family: Roboto, Arial, serif !important;
overflow-wrap: break-word;
word-wrap: break-word;
overflow-wrap: anywhere;
overflow: hidden;
}
.my-control-group-get-info .gwt-TextBox:hover {
@ -410,10 +412,21 @@ IN THE 'DETAILS' PANEL*/
width: 95%;
display: flex;
align-items: center;
justify-content: center;
justify-content: center;
}
.preview-image-style img {
max-width: 400px;
}
.preview-file-style {
width: 95%;
display: flex;
align-items: center;
justify-content: center;
}
.my-preview-doc {
width: 350px;
height: 350px;
}
Loading…
Cancel
Save