diff --git a/src/main/java/com/openkm/bean/Document.java b/src/main/java/com/openkm/bean/Document.java
index 899f3cde..70122048 100644
--- a/src/main/java/com/openkm/bean/Document.java
+++ b/src/main/java/com/openkm/bean/Document.java
@@ -54,7 +54,6 @@ public class Document extends Node {
private LockInfo lockInfo;
private boolean signed;
private boolean convertibleToPdf;
- private boolean convertibleToSwf;
private String cipherName;
public LockInfo getLockInfo() {
@@ -137,14 +136,6 @@ public void setConvertibleToPdf(boolean convertibleToPdf) {
this.convertibleToPdf = convertibleToPdf;
}
- public boolean isConvertibleToSwf() {
- return convertibleToSwf;
- }
-
- public void setConvertibleToSwf(boolean convertibleToSwf) {
- this.convertibleToSwf = convertibleToSwf;
- }
-
public void setCipherName(String cipherName) {
this.cipherName = cipherName;
}
@@ -182,7 +173,6 @@ public String toString() {
sb.append(", subscriptors=").append(subscriptors);
sb.append(", uuid=").append(uuid);
sb.append(", convertibleToPdf=").append(convertibleToPdf);
- sb.append(", convertibleToSwf=").append(convertibleToSwf);
sb.append(", cipherName=").append(cipherName);
sb.append(", notes=").append(notes);
sb.append(", language=").append(language);
diff --git a/src/main/java/com/openkm/core/Config.java b/src/main/java/com/openkm/core/Config.java
index 17e595c3..5def944d 100644
--- a/src/main/java/com/openkm/core/Config.java
+++ b/src/main/java/com/openkm/core/Config.java
@@ -102,7 +102,6 @@ public class Config {
public static String REPOSITORY_CACHE_DIRNAME = "cache";
public static String REPOSITORY_CACHE_DXF;
public static String REPOSITORY_CACHE_PDF;
- public static String REPOSITORY_CACHE_SWF;
// Experimental features
public static final String PROPERTY_PLUGIN_DEBUG = "plugin.debug";
@@ -221,7 +220,6 @@ public class Config {
public static final String PROPERTY_SYSTEM_OPENOFFICE_PROGRAM = "system.openoffice.program";
public static final String PROPERTY_SYSTEM_OPENOFFICE_DICTIONARY = "system.openoffice.dictionary";
public static final String PROPERTY_SYSTEM_IMAGEMAGICK_CONVERT = "system.imagemagick.convert";
- public static final String PROPERTY_SYSTEM_SWFTOOLS_PDF2SWF = "system.swftools.pdf2swf";
public static final String PROPERTY_SYSTEM_GHOSTSCRIPT = "system.ghostscript";
public static final String PROPERTY_SYSTEM_DWG2DXF = "system.dwg2dxf";
public static final String PROPERTY_SYSTEM_ANTIVIR = "system.antivir";
@@ -486,7 +484,6 @@ public class Config {
public static String SYSTEM_OPENOFFICE_PROGRAM = "";
public static String SYSTEM_OPENOFFICE_DICTIONARY = "";
public static String SYSTEM_IMAGEMAGICK_CONVERT = "";
- public static String SYSTEM_SWFTOOLS_PDF2SWF = "";
public static String SYSTEM_GHOSTSCRIPT = "";
public static String SYSTEM_DWG2DXF = "";
public static String SYSTEM_ANTIVIR = "";
@@ -732,8 +729,6 @@ public static Properties load(ServletContext sc) {
values.put("repository.cache.dxf", REPOSITORY_CACHE_DXF);
REPOSITORY_CACHE_PDF = REPOSITORY_CACHE_HOME + File.separator + "pdf";
values.put("repository.cache.pdf", REPOSITORY_CACHE_PDF);
- REPOSITORY_CACHE_SWF = REPOSITORY_CACHE_HOME + File.separator + "swf";
- values.put("repository.cache.swf", REPOSITORY_CACHE_SWF);
values.put(PROPERTY_HIBERNATE_SEARCH_INDEX_HOME, HIBERNATE_SEARCH_INDEX_HOME);
values.put(PROPERTY_REPOSITORY_DATASTORE_BACKEND, REPOSITORY_DATASTORE_BACKEND);
values.put(PROPERTY_REPOSITORY_DATASTORE_HOME, REPOSITORY_DATASTORE_HOME);
@@ -967,8 +962,6 @@ public static void reload(ServletContext sc, Properties cfg) {
values.put(PROPERTY_SYSTEM_PDF_FORCE_OCR, Boolean.toString(SYSTEM_PDF_FORCE_OCR));
SYSTEM_IMAGEMAGICK_CONVERT = ConfigDAO.getString(PROPERTY_SYSTEM_IMAGEMAGICK_CONVERT, cfg.getProperty(PROPERTY_SYSTEM_IMAGEMAGICK_CONVERT, EnvironmentDetector.detectImagemagickConvert()));
values.put(PROPERTY_SYSTEM_IMAGEMAGICK_CONVERT, SYSTEM_IMAGEMAGICK_CONVERT);
- SYSTEM_SWFTOOLS_PDF2SWF = ConfigDAO.getString(PROPERTY_SYSTEM_SWFTOOLS_PDF2SWF, cfg.getProperty(PROPERTY_SYSTEM_SWFTOOLS_PDF2SWF, EnvironmentDetector.detectSwftoolsPdf2Swf()));
- values.put(PROPERTY_SYSTEM_SWFTOOLS_PDF2SWF, SYSTEM_SWFTOOLS_PDF2SWF);
SYSTEM_GHOSTSCRIPT = ConfigDAO.getString(PROPERTY_SYSTEM_GHOSTSCRIPT, cfg.getProperty(PROPERTY_SYSTEM_GHOSTSCRIPT, EnvironmentDetector.detectGhostscript()));
values.put(PROPERTY_SYSTEM_GHOSTSCRIPT, SYSTEM_GHOSTSCRIPT);
SYSTEM_DWG2DXF = ConfigDAO.getString(PROPERTY_SYSTEM_DWG2DXF, cfg.getProperty(PROPERTY_SYSTEM_DWG2DXF, ""));
diff --git a/src/main/java/com/openkm/core/MimeTypeConfig.java b/src/main/java/com/openkm/core/MimeTypeConfig.java
index 04059cc5..ba0acc1d 100644
--- a/src/main/java/com/openkm/core/MimeTypeConfig.java
+++ b/src/main/java/com/openkm/core/MimeTypeConfig.java
@@ -34,6 +34,8 @@ public class MimeTypeConfig {
// MIME types => NOTE Keep on sync with default.sql
public final static String MIME_UNDEFINED = "application/octet-stream";
+
+ // application
public final static String MIME_RTF = "application/rtf";
public final static String MIME_PDF = "application/pdf";
public final static String MIME_ZIP = "application/zip";
@@ -48,6 +50,9 @@ public class MimeTypeConfig {
public final static String MIME_OO_SPREADSHEET = "application/vnd.oasis.opendocument.spreadsheet";
public final static String MIME_OO_PRESENTATION = "application/vnd.oasis.opendocument.presentation";
public final static String MIME_SWF = "application/x-shockwave-flash";
+ public final static String MIME_JAR = "application/x-java-archive";
+
+ // Image
public final static String MIME_DXF = "image/vnd.dxf";
public final static String MIME_DWG = "image/vnd.dwg";
public final static String MIME_TIFF = "image/tiff";
@@ -57,28 +62,44 @@ public class MimeTypeConfig {
public final static String MIME_BMP = "image/bmp";
public final static String MIME_PSD = "image/x-psd";
public final static String MIME_ICO = "image/x-ico";
+ public final static String MIME_PBM = "image/pbm";
+ public final static String MIME_SVG = "image/svg+xml";
+
+ // Video
+ public final static String MIME_MP3 = "audio/mpeg";
+ public final static String MIME_WAV = "audio/x-wav";
+ public final static String MIME_MP4 = "video/mp4";
+ public final static String MIME_MPEG = "video/mpeg";
+ public final static String MIME_FLV = "video/x-flv";
+ public final static String MIME_WMV = "video/x-ms-wmv";
+ public final static String MIME_AVI = "video/x-msvideo";
+
+ // Text
public final static String MIME_HTML = "text/html";
public final static String MIME_TEXT = "text/plain";
public final static String MIME_XML = "text/xml";
public final static String MIME_CSV = "text/csv";
+ public final static String MIME_CSS = "text/css";
+
+ // Language
public final static String MIME_SQL = "text/x-sql";
public final static String MIME_JAVA = "text/x-java";
- public final static String MIME_JAR = "application/x-java-archive";
- public final static String MIME_SH = "application/x-shellscript";
- public final static String MIME_BSH = "application/x-bsh";
- public final static String MIME_PHP = "application/x-php";
public final static String MIME_SCALA = "text/x-scala";
public final static String MIME_PYTHON = "text/x-python";
- public final static String MIME_PERL = "application/x-perl";
- public final static String MIME_JAVASCRIPT = "application/javascript";
public final static String MIME_GROOVY = "text/x-groovy";
public final static String MIME_DIFF = "text/x-diff";
public final static String MIME_PASCAL = "text/x-pascal";
- public final static String MIME_CSS = "text/css";
public final static String MIME_CSHARP = "text/x-csharp";
public final static String MIME_CPP = "text/x-c++";
- public final static String MIME_AS3 = "application/x-font-truetype";
public final static String MIME_APPLESCRIPT = "text/applescript";
+ public final static String MIME_SH = "application/x-shellscript";
+ public final static String MIME_BSH = "application/x-bsh";
+ public final static String MIME_PHP = "application/x-php";
+ public final static String MIME_PERL = "application/x-perl";
+ public final static String MIME_JAVASCRIPT = "application/javascript";
+ public final static String MIME_AS3 = "application/x-font-truetype";
+
+ // Mail
public final static String MIME_EML = "message/rfc822";
//public final static String MIME_VB = "";
diff --git a/src/main/java/com/openkm/dao/bean/AutomationRule.java b/src/main/java/com/openkm/dao/bean/AutomationRule.java
index 89ea47c7..99b1cf6d 100644
--- a/src/main/java/com/openkm/dao/bean/AutomationRule.java
+++ b/src/main/java/com/openkm/dao/bean/AutomationRule.java
@@ -51,7 +51,6 @@ public class AutomationRule implements Serializable {
public static final String EVENT_TEXT_EXTRACTOR = "text_extractor";
public static final String EVENT_CONVERSION_PDF = "convert_pdf";
- public static final String EVENT_CONVERSION_SWF = "convert_swf";
public static final String EVENT_PROPERTY_GROUP_ADD = "prop_group_add";
public static final String EVENT_PROPERTY_GROUP_SET = "prop_group_set";
@@ -81,13 +80,12 @@ public class AutomationRule implements Serializable {
put(AutomationRule.EVENT_TEXT_EXTRACTOR, "Text extraction");
put(AutomationRule.EVENT_CONVERSION_PDF, "Convert to PDF");
- put(AutomationRule.EVENT_CONVERSION_SWF, "Convert to SWF");
put(AutomationRule.EVENT_USER_LOGIN, "User login");
put(AutomationRule.EVENT_USER_LOGOUT, "User logout");
}
};
-
+
@Id
@Column(name = "ARL_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
diff --git a/src/main/java/com/openkm/frontend/client/bean/GWTConverterStatus.java b/src/main/java/com/openkm/frontend/client/bean/GWTConverterStatus.java
index 70feb944..30d391cd 100644
--- a/src/main/java/com/openkm/frontend/client/bean/GWTConverterStatus.java
+++ b/src/main/java/com/openkm/frontend/client/bean/GWTConverterStatus.java
@@ -32,8 +32,6 @@ public class GWTConverterStatus implements IsSerializable {
public static final int STATUS_LOADING = 1;
public static final int STATUS_CONVERTING_TO_PDF = 2;
public static final int STATUS_CONVERTING_TO_PDF_FINISHED = 3;
- public static final int STATUS_CONVERTING_TO_SWF = 4;
- public static final int STATUS_CONVERTING_TO_SWF_FINISHED = 5;
public static final int STATUS_SENDING_FILE = 6;
private int status = STATUS_LOADING;
diff --git a/src/main/java/com/openkm/frontend/client/extension/widget/preview/PreviewExtension.java b/src/main/java/com/openkm/frontend/client/extension/widget/preview/PreviewExtension.java
index 32480d89..fefc4013 100644
--- a/src/main/java/com/openkm/frontend/client/extension/widget/preview/PreviewExtension.java
+++ b/src/main/java/com/openkm/frontend/client/extension/widget/preview/PreviewExtension.java
@@ -23,6 +23,7 @@
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
+import com.openkm.frontend.client.bean.GWTDocument;
/**
* TabDocumentExtension
@@ -30,11 +31,13 @@
* @author jllort
*/
public abstract class PreviewExtension extends Composite implements HasPreviewExtension {
- public abstract void createViewer(String url, int width, int height);
+ public abstract void createViewer(GWTDocument doc, String url, int width, int height);
public abstract Widget getWidget();
public abstract void setVisible(boolean visible);
public abstract void resizeViewer(int width, int height);
-}
\ No newline at end of file
+
+ public abstract boolean isPreviewAvailable(String mimeType);
+}
diff --git a/src/main/java/com/openkm/frontend/client/util/ConversionStatus.java b/src/main/java/com/openkm/frontend/client/util/ConversionStatus.java
index d9a91e13..9db2cefd 100644
--- a/src/main/java/com/openkm/frontend/client/util/ConversionStatus.java
+++ b/src/main/java/com/openkm/frontend/client/util/ConversionStatus.java
@@ -61,12 +61,6 @@ public void onSuccess(GWTConverterStatus result) {
case GWTConverterStatus.STATUS_CONVERTING_TO_PDF_FINISHED:
Main.get().mainPanel.bottomPanel.setStatus(Main.i18n("status.converter.topdf.finished"));
break;
- case GWTConverterStatus.STATUS_CONVERTING_TO_SWF:
- Main.get().mainPanel.bottomPanel.setStatus(Main.i18n("status.converter.toswf"));
- break;
- case GWTConverterStatus.STATUS_CONVERTING_TO_SWF_FINISHED:
- Main.get().mainPanel.bottomPanel.setStatus(Main.i18n("status.converter.toswf.finished"));
- break;
case GWTConverterStatus.STATUS_SENDING_FILE:
Main.get().mainPanel.bottomPanel.setStatus(Main.i18n("status.converter.sending.file"));
break;
@@ -99,4 +93,4 @@ public void run() {
refreshStatus.schedule(REFRESH_STATUS_DELAY);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/openkm/frontend/client/util/Util.java b/src/main/java/com/openkm/frontend/client/util/Util.java
index ee861aa4..40098755 100644
--- a/src/main/java/com/openkm/frontend/client/util/Util.java
+++ b/src/main/java/com/openkm/frontend/client/util/Util.java
@@ -574,83 +574,13 @@ public static native String getUserAgent() /*-{
}
}-*/;
- public static native void removeMediaPlayer() /*-{
- $wnd.swfobject.removeSWF("jsmediaplayer");
- }-*/;
-
- public static native void createMediaPlayer(String mediaUrl, String mediaProvider, String width, String height) /*-{
- $wnd.swfobject.embedSWF("../js/mediaplayer/player.swf", "mediaplayercontainer", width, height, "9.0.0", "../js/mediaplayer/expressinstall.swf", {
- file: mediaUrl,
- provider: mediaProvider,
- autostart: "true",
- width: width,
- height: height
- }, {allowscriptaccess: "always", allowfullscreen: "true"}, {id: "jsmediaplayer", name: "jsmediaplayer"});
- }-*/;
-
- public static native void resizeMediaPlayer(String width, String height) /*-{
- obj = $wnd.swfobject.getObjectById('jsmediaplayer');
- obj.width = width;
- obj.height = height;
- }-*/;
-
- public static native void createSwfViewer(String swfUrl, String width, String height) /*-{
- $wnd.swfobject.embedSWF(swfUrl, "swfviewercontainer", width, height, "9.0.0", "../js/mediaplayer/expressinstall.swf", {
- width: width,
- height: height
- }, {}, {id: "jswfviewer", name: "jswfviewer"});
- }-*/;
-
- public static native void resizeSwfViewer(String width, String height) /*-{
- obj = $wnd.swfobject.getObjectById('jswfviewer');
- obj.width = width;
- obj.height = height;
- }-*/;
-
- public static native void createPDFViewerFlexPaper(String pdfUrl, String width, String height) /*-{
- fpViewer = "../js/flexpaper/FlexPaperViewer.swf";
- pdfUrl = encodeURIComponent(pdfUrl);
- $wnd.swfobject.embedSWF(fpViewer, "pdfviewercontainer", width, height, "10.0.0", "playerProductInstall.swf",
- {
- SwfFile: pdfUrl,
- Scale: 0.6,
- ZoomTransition: "easeOut",
- ZoomTime: 0.5,
- ZoomInterval: 0.1,
- FitPageOnLoad: false,
- FitWidthOnLoad: true,
- FullScreenAsMaxWindow: false,
- ProgressiveLoading: true,
- ViewModeToolsVisible: true,
- ZoomToolsVisible: true,
- FullScreenVisible: true,
- NavToolsVisible: true,
- CursorToolsVisible: true,
- SearchToolsVisible: true,
- localeChain: "en_US"
- },
- {
- quality: "high",
- bgcolor: "#ffffff",
- allowscriptaccess: "sameDomain",
- allowfullscreen: "true"
- },
- {
- id: "FlexPaperViewer",
- name: "FlexPaperViewer"
- });
- }-*/;
-
- public static native void resizePDFViewerFlexPaper(String width, String height) /*-{
- obj = $wnd.swfobject.getObjectById('FlexPaperViewer');
- obj.width = width;
- obj.height = height;
- }-*/;
-
public static native void resizeEmbededPDF(String width, String height, String pdfId) /*-{
- obj = $wnd.document.getElementById(pdfId);
- obj.width = width;
- obj.height = height;
+ obj = $wnd.document.getElementById(pdfId);
+ // Take in consideration if object exists
+ if (obj != null) {
+ obj.width = width;
+ obj.height = height;
+ }
}-*/;
public static native void copyToClipboard(String text) /*-{
diff --git a/src/main/java/com/openkm/frontend/client/widget/properties/EmbeddedPreview.java b/src/main/java/com/openkm/frontend/client/widget/properties/EmbeddedPreview.java
index c2d98f37..91747556 100644
--- a/src/main/java/com/openkm/frontend/client/widget/properties/EmbeddedPreview.java
+++ b/src/main/java/com/openkm/frontend/client/widget/properties/EmbeddedPreview.java
@@ -64,7 +64,7 @@ public EmbeddedPreview() {
* show
*/
public void showEmbedded(String url) {
- iframe.setUrl(Main.CONTEXT + "/preview/pdfjs/web/viewer.html?" + url);
+ iframe.setUrl(Main.CONTEXT + "/Preview?" + url);
}
/**
diff --git a/src/main/java/com/openkm/frontend/client/widget/properties/HTMLPreview.java b/src/main/java/com/openkm/frontend/client/widget/properties/HTMLPreview.java
deleted file mode 100644
index 7559a1ba..00000000
--- a/src/main/java/com/openkm/frontend/client/widget/properties/HTMLPreview.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * OpenKM, Open Document Management System (http://www.openkm.com)
- * Copyright (c) 2006-2017 Paco Avila & Josep Llort
- *
- * No bytes were intentionally harmed during the development of this application.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package com.openkm.frontend.client.widget.properties;
-
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Frame;
-import com.openkm.frontend.client.Main;
-import com.openkm.frontend.client.bean.GWTDocument;
-
-/**
- * HTMLPreview
- *
- * @author jllort
- *
- */
-public class HTMLPreview extends Composite {
- private Frame iframe;
-
- /**
- * HTMLPreview
- */
- public HTMLPreview() {
- iframe = new Frame("about:blank");
-
- DOM.setElementProperty(iframe.getElement(), "frameborder", "0");
- DOM.setElementProperty(iframe.getElement(), "marginwidth", "0");
- DOM.setElementProperty(iframe.getElement(), "marginheight", "0");
- //DOM.setElementProperty(iframe.getElement(), "scrolling", "yes");
-
- // Commented because on IE show clear if allowtransparency=true
- DOM.setElementProperty(iframe.getElement(), "allowtransparency", "false");
-
- iframe.setStyleName("okm-Iframe");
- iframe.addStyleName("okm-EnableSelect");
-
- initWidget(iframe);
- }
-
- /**
- * showHTML
- */
- public void showHTML(GWTDocument doc) {
- String core = Main.get().workspaceUserProperties.getWorkspace().getHtmlSyntaxHighlighterCore();
- String theme = Main.get().workspaceUserProperties.getWorkspace().getHtmlSyntaxHighlighterTheme();
- iframe.setUrl(Main.CONTEXT + "/HtmlPreview?mimeType=" + doc.getMimeType() + "&core=" + core
- + "&theme=" + theme + "&uuid=" + doc.getUuid());
- }
-
- /**
- * isPreviewAvailable
- */
- public static boolean isPreviewAvailable(String mime) {
- return mime.equals("text/html");
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/openkm/frontend/client/widget/properties/Preview.java b/src/main/java/com/openkm/frontend/client/widget/properties/Preview.java
index 93d141da..f9ab0b20 100644
--- a/src/main/java/com/openkm/frontend/client/widget/properties/Preview.java
+++ b/src/main/java/com/openkm/frontend/client/widget/properties/Preview.java
@@ -24,12 +24,14 @@
import java.util.ArrayList;
import java.util.List;
+import com.allen_sauer.gwt.log.client.Log;
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.user.client.ui.*;
import com.openkm.frontend.client.Main;
import com.openkm.frontend.client.bean.GWTDocument;
+import com.openkm.frontend.client.bean.GWTWorkspace;
import com.openkm.frontend.client.constants.service.RPCService;
import com.openkm.frontend.client.extension.widget.preview.PreviewExtension;
import com.openkm.frontend.client.util.Util;
@@ -40,170 +42,38 @@
* @author jllort
*/
public class Preview extends Composite {
- private static final int TURN_BACK_HEIGHT = 25;
+ public static final String DOWNLOAD_TYPE_PREVIEW = "preview";
+
private VerticalPanel vPanel;
private HTML pdf;
private HTML swf;
- private HTML video;
- public HTMLPreview htmlPreview;
- public SyntaxHighlighterPreview syntaxHighlighterPreview;
+ public EmbeddedPreview embeddedPreview;
private int width = 0;
private int height = 0;
private boolean previewAvailable = false;
- private boolean previewConversion = true;
- String mediaUrl = "";
- private String mediaProvider = "";
private List widgetPreviewExtensionList;
- private HasPreviewEvent previewEvent;
- private HorizontalPanel hReturnPanel;
- private Button backButton;
- private String pdfID = "jsPdfViewer";
- public EmbeddedPreview embeddedPreview;
private String pdfContainer = "pdfembededcontainer";
+ private String flashContainer = "pdfviewercontainer";
+ private String pdfID = "jsPdfViewer";
/**
* Preview
*/
- public Preview(final HasPreviewEvent previewEvent) {
- this.previewEvent = previewEvent;
- widgetPreviewExtensionList = new ArrayList();
+ public Preview() {
+ widgetPreviewExtensionList = new ArrayList<>();
vPanel = new VerticalPanel();
- htmlPreview = new HTMLPreview();
- syntaxHighlighterPreview = new SyntaxHighlighterPreview();
- pdf = new HTML("\n");
- swf = new HTML("\n");
- video = new HTML("\n");
- hReturnPanel = new HorizontalPanel();
- hReturnPanel.setWidth("100%");
- backButton = new Button(Main.i18n("search.button.preview.back"));
- backButton.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- previewEvent.returnBack();
- }
- });
- backButton.setStylePrimaryName("okm-Button");
- HTML space2 = Util.hSpace("5px");
- hReturnPanel.add(space2);
- hReturnPanel.add(backButton);
- hReturnPanel.setCellWidth(space2, "5px");
- hReturnPanel.setCellHorizontalAlignment(backButton, HasAlignment.ALIGN_LEFT);
- hReturnPanel.setCellVerticalAlignment(backButton, HasAlignment.ALIGN_MIDDLE);
- hReturnPanel.setHeight(String.valueOf(TURN_BACK_HEIGHT) + "px");
- hReturnPanel.setStyleName("okm-TopPanel");
- hReturnPanel.addStyleName("okm-Border-Top");
- hReturnPanel.addStyleName("okm-Border-Left");
- hReturnPanel.addStyleName("okm-Border-Right");
embeddedPreview = new EmbeddedPreview();
+ pdf = new HTML("\n");
+ swf = new HTML("\n");
initWidget(vPanel);
}
@Override
public void setPixelSize(int width, int height) {
super.setPixelSize(width, height);
- this.width = (previewEvent == null) ? width : width;
- this.height = (previewEvent == null) ? height : height - TURN_BACK_HEIGHT;
- htmlPreview.setPixelSize(this.width, this.height);
- syntaxHighlighterPreview.setPixelSize(this.width, this.height);
- embeddedPreview.setPixelSize(this.width, this.height);
- }
-
- /**
- * showHTML
- */
- public void showHTML(GWTDocument doc) {
- hideWidgetExtension();
- vPanel.clear();
-
- if (previewEvent != null) {
- vPanel.add(hReturnPanel);
- vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px");
- }
-
- vPanel.add(htmlPreview);
- vPanel.setCellHorizontalAlignment(htmlPreview, HasAlignment.ALIGN_CENTER);
- vPanel.setCellVerticalAlignment(htmlPreview, HasAlignment.ALIGN_MIDDLE);
-
- if (previewAvailable) {
- htmlPreview.showHTML(doc);
- }
- }
-
- /**
- * showSyntaxHighlighterHTML
- */
- public void showSyntaxHighlighterHTML(GWTDocument doc) {
- hideWidgetExtension();
- vPanel.clear();
-
- if (previewEvent != null) {
- vPanel.add(hReturnPanel);
- vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px");
- }
-
- vPanel.add(syntaxHighlighterPreview);
- vPanel.setCellHorizontalAlignment(syntaxHighlighterPreview, HasAlignment.ALIGN_CENTER);
- vPanel.setCellVerticalAlignment(syntaxHighlighterPreview, HasAlignment.ALIGN_MIDDLE);
-
- if (previewAvailable) {
- syntaxHighlighterPreview.showHightlighterHTML(doc);
- }
- }
-
- /**
- * showEmbedSWF
- *
- * @param uuid Unique document ID to be previewed.
- */
- public void showEmbedSWF(String uuid) {
- hideWidgetExtension();
- vPanel.clear();
-
- if (previewEvent != null) {
- vPanel.add(hReturnPanel);
- vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px");
- }
-
- vPanel.add(swf);
- vPanel.setCellHorizontalAlignment(swf, HasAlignment.ALIGN_CENTER);
- vPanel.setCellVerticalAlignment(swf, HasAlignment.ALIGN_MIDDLE);
-
- if (previewAvailable) {
- if (previewConversion) {
- String url = RPCService.ConverterServlet + "?inline=true&toSwf=true&uuid=" + URL.encodeQueryString(uuid);
- swf.setHTML("\n"); // needed for rewriting purpose
-
- if (Main.get().workspaceUserProperties.getWorkspace().getPreviewer().equals("flexpaper")) {
- if (Main.get().workspaceUserProperties.getWorkspace().isPrintPreview()) {
- Util.createPDFViewerFlexPaper(url, "" + width, "" + height);
- } else {
- Util.createPDFViewerFlexPaper(url, "" + width, "" + height);
- }
- }
-
- Main.get().conversionStatus.getStatus();
- } else {
- String url = RPCService.DownloadServlet + "?inline=true&uuid=" + URL.encodeQueryString(uuid);
- swf.setHTML("\n"); // needed for rewriting purpose
- Util.createSwfViewer(url, "" + width, "" + height);
- }
- } else {
- swf.setHTML("
- * No bytes were intentionally harmed during the development of this application.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package com.openkm.frontend.client.widget.properties;
-
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Frame;
-import com.openkm.frontend.client.Main;
-import com.openkm.frontend.client.bean.GWTDocument;
-
-/**
- * SyntaxHighlighterPreview
- *
- * @author jllort
- */
-public class SyntaxHighlighterPreview extends Composite {
- private Frame iframe;
-
- /**
- * HTMLPreview
- */
- public SyntaxHighlighterPreview() {
- iframe = new Frame("about:blank");
-
- DOM.setElementProperty(iframe.getElement(), "frameborder", "0");
- DOM.setElementProperty(iframe.getElement(), "marginwidth", "0");
- DOM.setElementProperty(iframe.getElement(), "marginheight", "0");
- //DOM.setElementProperty(iframe.getElement(), "scrolling", "yes");
-
- // Commented because on IE show clear if allowtransparency=true
- DOM.setElementProperty(iframe.getElement(), "allowtransparency", "false");
-
- iframe.setStyleName("okm-Iframe");
- iframe.addStyleName("okm-EnableSelect");
-
- initWidget(iframe);
- }
-
- /**
- * showHightlighterHTML
- *
- * @param doc Document to preview.
- */
- public void showHightlighterHTML(final GWTDocument doc) {
- String core = Main.get().workspaceUserProperties.getWorkspace().getHtmlSyntaxHighlighterCore();
- String theme = Main.get().workspaceUserProperties.getWorkspace().getHtmlSyntaxHighlighterTheme();
- iframe.setUrl(Main.CONTEXT + "/SyntaxHighlighter?mimeType=" + doc.getMimeType() + "&core=" + core
- + "&theme=" + theme + "&uuid=" + doc.getUuid());
- }
-
- /**
- * isPreviewAvailable
- */
- public static boolean isPreviewAvailable(String mime) {
- return mime.equals("text/x-java") || mime.equals("text/xml") || mime.equals("text/x-sql")
- || mime.equals("text/x-scala") || mime.equals("text/x-python")
- || mime.equals("application/x-php") || mime.equals("application/x-bsh")
- || mime.equals("application/x-perl") || mime.equals("application/javascript")
- || mime.equals("text/plain") || mime.equals("text/x-groovy") || mime.equals("text/x-diff")
- || mime.equals("text/x-pascal") || mime.equals("text/css") || mime.equals("text/x-csharp")
- || mime.equals("text/x-c++") || mime.equals("application/x-font-truetype")
- || mime.equals("text/applescript") || mime.equals("application/x-shellscript");
- }
-}
diff --git a/src/main/java/com/openkm/frontend/client/widget/properties/TabDocument.java b/src/main/java/com/openkm/frontend/client/widget/properties/TabDocument.java
index bf7b3574..9898b804 100644
--- a/src/main/java/com/openkm/frontend/client/widget/properties/TabDocument.java
+++ b/src/main/java/com/openkm/frontend/client/widget/properties/TabDocument.java
@@ -103,7 +103,7 @@ public TabDocument() {
notes = new Notes(Notes.DOCUMENT_NOTE);
version = new VersionScrollTable();
security = new SecurityScrollTable();
- preview = new Preview(null);
+ preview = new Preview();
panel = new VerticalPanel();
propertyGroup = new ArrayList();
widgetExtensionList = new ArrayList();
@@ -242,10 +242,7 @@ public void setProperties(GWTDocument doc) {
}
if (previewVisible) {
- preview.setPreviewAvailable(doc.isConvertibleToSwf()
- || doc.getMimeType().equals("application/x-shockwave-flash")
- || HTMLPreview.isPreviewAvailable(doc.getMimeType())
- || SyntaxHighlighterPreview.isPreviewAvailable(doc.getMimeType()));
+ preview.setPreviewAvailable(doc);
}
if (!propertyGroup.isEmpty()) {
@@ -681,4 +678,4 @@ public void addPreviewExtension(PreviewExtension extension) {
public boolean hasPropertyGroups() {
return (propertyGroup.size() > 0);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/openkm/module/common/CommonGeneralModule.java b/src/main/java/com/openkm/module/common/CommonGeneralModule.java
index b6d7c0b7..66f24940 100644
--- a/src/main/java/com/openkm/module/common/CommonGeneralModule.java
+++ b/src/main/java/com/openkm/module/common/CommonGeneralModule.java
@@ -37,6 +37,5 @@ public class CommonGeneralModule {
public static void cleanPreviewCache(String uuid) {
new File(Config.REPOSITORY_CACHE_DXF + File.separator + uuid + ".dxf").delete();
new File(Config.REPOSITORY_CACHE_PDF + File.separator + uuid + ".pdf").delete();
- new File(Config.REPOSITORY_CACHE_SWF + File.separator + uuid + ".swf").delete();
}
}
diff --git a/src/main/java/com/openkm/module/db/base/BaseDocumentModule.java b/src/main/java/com/openkm/module/db/base/BaseDocumentModule.java
index 97c0050d..a8fd63c4 100644
--- a/src/main/java/com/openkm/module/db/base/BaseDocumentModule.java
+++ b/src/main/java/com/openkm/module/db/base/BaseDocumentModule.java
@@ -228,7 +228,6 @@ public static Document getProperties(String user, NodeDocument nDocument) throws
// Document conversion capabilities
DocConverter convert = DocConverter.getInstance();
doc.setConvertibleToPdf(convert.convertibleToPdf(doc.getMimeType()));
- doc.setConvertibleToSwf(convert.convertibleToSwf(doc.getMimeType()));
// Get user subscription & keywords
doc.setSubscriptors(nDocument.getSubscriptors());
diff --git a/src/main/java/com/openkm/servlet/HtmlPreviewServlet.java b/src/main/java/com/openkm/servlet/HtmlPreviewServlet.java
deleted file mode 100644
index 3abd4788..00000000
--- a/src/main/java/com/openkm/servlet/HtmlPreviewServlet.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * OpenKM, Open Document Management System (http://www.openkm.com)
- * Copyright (c) 2006-2017 Paco Avila & Josep Llort
- *
- * No bytes were intentionally harmed during the development of this application.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package com.openkm.servlet;
-
-import com.openkm.api.OKMDocument;
-import com.openkm.core.*;
-import com.openkm.servlet.admin.BaseServlet;
-import com.openkm.util.WebUtils;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-
-/**
- * Html Preview Servlet
- *
- * Take a look at available brushes alias at http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
- */
-public class HtmlPreviewServlet extends BaseServlet {
- private static final Logger log = LoggerFactory.getLogger(HtmlPreviewServlet.class);
- private static final long serialVersionUID = 1L;
-
- /**
- *
- */
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
- log.debug("doGet({}, {})", request, response);
- String uuid = WebUtils.getString(request, "uuid");
- String core = WebUtils.getString(request, "core");
- String theme = WebUtils.getString(request, "theme");
- InputStream fis = null;
-
- try {
- fis = OKMDocument.getInstance().getContent(null, uuid, false);
- StringWriter writer = new StringWriter();
- IOUtils.copy(fis, writer, "UTF-8");
- String content = writer.getBuffer().toString();
- content = content.replaceAll("jsOpenPathByUuid", "parent.jsOpenPathByUuid");
-
- ServletContext sc = getServletContext();
- sc.setAttribute("cssCore", core);
- sc.setAttribute("cssTheme", theme);
- sc.setAttribute("content", content);
- sc.getRequestDispatcher("/html_preview.jsp").forward(request, response);
- } catch (PathNotFoundException | AccessDeniedException | RepositoryException | DatabaseException | LockException e) {
- sendErrorRedirect(request, response, e);
- } finally {
- IOUtils.closeQuietly(fis);
- }
- }
-}
diff --git a/src/main/java/com/openkm/servlet/PreviewServlet.java b/src/main/java/com/openkm/servlet/PreviewServlet.java
new file mode 100644
index 00000000..02148458
--- /dev/null
+++ b/src/main/java/com/openkm/servlet/PreviewServlet.java
@@ -0,0 +1,379 @@
+/**
+ * OpenKM, Open Document Management System (http://www.openkm.com)
+ * Copyright (c) Paco Avila & Josep Llort
+ *
+ * No bytes were intentionally harmed during the development of this application.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
- * No bytes were intentionally harmed during the development of this application.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *