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("


" + Main.i18n("preview.unavailable") - + "
\n"); // needed for rewriting purpose - } - } - - /** - * resizeEmbedSWF - */ - public void resizeEmbedSWF(int width, int height) { - if (previewConversion) { - if (Main.get().workspaceUserProperties.getWorkspace().getPreviewer().equals("flexpaper")) { - Util.resizePDFViewerFlexPaper("" + width, "" + height); - } - } else { - Util.resizeSwfViewer("" + width, "" + height); - } + this.width = width; + this.height = height; + embeddedPreview.setPixelSize(width, height); } /** @@ -215,90 +85,55 @@ public void showEmbedPDF(String uuid) { hideWidgetExtension(); vPanel.clear(); - if (previewEvent != null) { - vPanel.add(hReturnPanel); - vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px"); - } - vPanel.add(pdf); - vPanel.setCellHorizontalAlignment(pdf, HasAlignment.ALIGN_CENTER); + vPanel.setCellHorizontalAlignment(pdf, HasAlignment.ALIGN_DEFAULT); vPanel.setCellVerticalAlignment(pdf, HasAlignment.ALIGN_MIDDLE); if (previewAvailable) { - String url = RPCService.DownloadServlet + "?inline=true&uuid=" + URL.encodeQueryString(uuid); - pdf.setHTML("
" + + String url = RPCService.ConverterServlet + "?inline=true&toPdf=true&uuid=" + URL.encodeQueryString(uuid) + + "&downloadType=" + DOWNLOAD_TYPE_PREVIEW; + pdf.setHTML("
" + "" + - "

Browser plugin suppport error, PDF can not be displayed

" + + "

Browser plugin support error, PDF can not be displayed

" + "
" + "
\n"); // needed for rewriting purpose } else { - swf.setHTML("


" + Main.i18n("preview.unavailable") + "
\n"); + pdf.setHTML("


" + Main.i18n("preview.unavailable") + "
\n"); } } /** - * cleanPreview - */ - public void cleanPreview() { - swf.setHTML("
\n"); - embeddedPreview.clear(); - } - - /** - * Set the media file to reproduce - * - * @param mediaUrl The media file url + * showSystemEmbeddedPreview */ - public void showMediaFile(String mediaUrl, String mimeType) { + public void showSystemEmbeddedPreview(String url) { hideWidgetExtension(); vPanel.clear(); - if (previewEvent != null) { - vPanel.add(hReturnPanel); - vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px"); - } - - vPanel.add(video); - vPanel.setCellHorizontalAlignment(video, HasAlignment.ALIGN_CENTER); - vPanel.setCellVerticalAlignment(video, HasAlignment.ALIGN_MIDDLE); - - this.mediaUrl = mediaUrl; - Util.removeMediaPlayer(); - video.setHTML("
\n"); - - if (mimeType.equals("audio/mpeg")) { - mediaProvider = "sound"; - } else if (mimeType.equals("video/x-flv") || mimeType.equals("video/mp4")) { - mediaProvider = "video"; - } else if (mimeType.equals("application/x-shockwave-flash")) { - mediaProvider = ""; - } + vPanel.add(embeddedPreview); + vPanel.setCellHorizontalAlignment(embeddedPreview, HasAlignment.ALIGN_CENTER); + vPanel.setCellVerticalAlignment(embeddedPreview, HasAlignment.ALIGN_MIDDLE); - Util.createMediaPlayer(mediaUrl, mediaProvider, "" + width, "" + height); + embeddedPreview.showEmbedded(url); } /** - * resizeMediaPlayer + * cleanPreview */ - public void resizeMediaPlayer(int width, int height) { - Util.resizeMediaPlayer("" + width, "" + height); + public void cleanPreview() { + swf.setHTML("
\n"); + embeddedPreview.clear(); } /** * setPreviewExtension */ - public void showPreviewExtension(PreviewExtension preview, String url) { + public void showPreviewExtension(PreviewExtension preview, String url, GWTDocument doc) { hideWidgetExtension(); vPanel.clear(); - if (previewEvent != null) { - vPanel.add(hReturnPanel); - vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px"); - } - if (previewAvailable) { + preview.createViewer(doc, url, width, height); vPanel.add(preview.getWidget()); - preview.createViewer(url, width, height); } } @@ -316,17 +151,26 @@ private void hideWidgetExtension() { /** * Sets the boolean value if previewing document is available * - * @param previewAvailable Set preview availability status. - */ - public void setPreviewAvailable(boolean previewAvailable) { - this.previewAvailable = previewAvailable; - } - - /** - * Sets the boolean value if document preview does not need conversion - */ - public void setPreviewConversion(boolean previewConversion) { - this.previewConversion = previewConversion; + * @param doc Set preview availability status. + */ + public void setPreviewAvailable(GWTDocument doc) { + if (doc.getMimeType().equals("video/x-flv") || doc.getMimeType().equals("video/mp4") || doc.getMimeType().equals("audio/mpeg") + || doc.getMimeType().equals("audio/x-wav") || doc.getMimeType().equals("application/pdf") + || doc.getMimeType().equals("application/postscript") || doc.getMimeType().equals("application/x-shockwave-flash") + || isHTMLPreviewAvailable(doc.getMimeType()) + || isSyntaxHighlighterPreviewAvailable(doc.getMimeType()) + || doc.isConvertibleToSwf() || doc.isConvertibleToPdf()) { + previewAvailable = true; + } else { + boolean found = false; + for (PreviewExtension preview : widgetPreviewExtensionList) { + if (preview.isPreviewAvailable(doc.getMimeType())) { + found = true; + break; + } + } + previewAvailable = found; + } } /** @@ -337,107 +181,73 @@ public void langRefresh() { swf.setHTML("


" + Main.i18n("preview.unavailable") + "
\n"); // needed for rewriting purpose } - backButton.setHTML(Main.i18n("search.button.preview.back")); + } + + /** + * addPreviewExtension + */ + public void addPreviewExtension(PreviewExtension extension) { + widgetPreviewExtensionList.add(extension); } /** * previewDocument */ public void previewDocument(boolean refreshing, GWTDocument doc) { - if (doc.getMimeType().equals("video/x-flv") || doc.getMimeType().equals("video/mp4") || doc.getMimeType().equals("audio/mpeg")) { + Log.debug("PreviewDocument: " + doc.getPath()); + + if (doc.getMimeType().equals("video/x-flv") || doc.getMimeType().equals("video/mp4") || doc.getMimeType().equals("audio/mpeg") + || doc.getMimeType().equals("audio/x-wav")) { + Log.debug("Preview: Media Player"); + String url = RPCService.DownloadServlet + "?uuid=" + URL.encodeQueryString(doc.getUuid()) + "&downloadType=" + + DOWNLOAD_TYPE_PREVIEW; + showSystemEmbeddedPreview(EmbeddedPreview.MPG_URL + URL.encodeQueryString(url) + "&mimeType=" + doc.getMimeType() + + "&width=" + width + "&height=" + height); + } else if (isHTMLPreviewAvailable(doc.getMimeType())) { + Log.debug("Preview: HTML"); if (!refreshing) { - showMediaFile(RPCService.DownloadServlet + "?uuid=" + URL.encodeQueryString(doc.getUuid()), doc.getMimeType()); - } else { - resizeMediaPlayer(width, height); - } - } else if (HTMLPreview.isPreviewAvailable(doc.getMimeType())) { - if (!refreshing) { - showHTML(doc); - } - } else if (SyntaxHighlighterPreview.isPreviewAvailable(doc.getMimeType())) { - if (!refreshing) { - showSyntaxHighlighterHTML(doc); + String url = "mimeType=" + doc.getMimeType() + "&uuid=" + doc.getUuid(); + showSystemEmbeddedPreview(url); } - } else if (doc.getMimeType().equals("application/pdf")) { - setPreviewConversion(false); + } else if (isSyntaxHighlighterPreviewAvailable(doc.getMimeType())) { + Log.debug("Preview: Syntax Highlighter"); if (!refreshing) { - showPDF(doc.getUuid()); + String url = "mimeType=" + doc.getMimeType() + "&uuid=" + doc.getUuid(); + showSystemEmbeddedPreview(url); } } else if (doc.getMimeType().equals("application/x-shockwave-flash")) { - setPreviewConversion(false); - - if (!refreshing) { - showEmbedSWF(doc.getUuid()); - } else { - resizeEmbedSWF(width, height); - } + String url = RPCService.ConverterServlet + "?inline=true&toSwf=true&uuid=" + URL.encodeQueryString(doc.getUuid()) + "&downloadType=" + + DOWNLOAD_TYPE_PREVIEW; + showSystemEmbeddedPreview(EmbeddedPreview.SWF_URL + URL.encodeQueryString(url) + "&uuid=" + URL.encodeQueryString(doc.getUuid())); } else { - if (Main.get().workspaceUserProperties.getWorkspace().isAcrobatPluginPreview() && doc.getMimeType().equals("application/pdf")) { - if (!refreshing) { - showEmbedPDF(doc.getUuid()); - } else { + if (refreshing) { + if (Main.get().workspaceUserProperties.getWorkspace().isAcrobatPluginPreview()) { Util.resizeEmbededPDF("" + width, "" + height, pdfID); } } else { - setPreviewConversion(true); - - if (!refreshing) { - if (doc.isConvertibleToPdf()) { - showPDF(doc.getUuid()); - } else { - showEmbedSWF(doc.getUuid()); - } - } else { - if (!doc.isConvertibleToPdf()) { - resizeEmbedSWF(width, height); - } - } + showEmbedPDF(doc.getUuid()); } } } /** - * addPreviewExtension - */ - public void addPreviewExtension(PreviewExtension extension) { - widgetPreviewExtensionList.add(extension); - } - - /** - * Preview PDF, take in consideration profile selection + * isHTMLPreviewAvailable */ - public void showPDF(String uuid) { - hideWidgetExtension(); - vPanel.clear(); - - vPanel.add(pdf); - vPanel.setCellHorizontalAlignment(pdf, HasAlignment.ALIGN_CENTER); - vPanel.setCellVerticalAlignment(pdf, HasAlignment.ALIGN_MIDDLE); - - if (previewAvailable) { - pdf.setHTML("
\n"); // needed for rewriting purpose - showSystemEmbeddedPreview(EmbeddedPreview.PDFJS_URL + URL.encodeQueryString(RPCService.ConverterServlet +"?toPdf=true&inline=true&uuid=" + uuid)); - } else { - pdf.setHTML("


" + Main.i18n("preview.unavailable") + "
\n"); - } + public static boolean isHTMLPreviewAvailable(String mime) { + return mime.equals("text/html"); } /** - * showSystemEmbeddedPreview + * isPreviewAvailable */ - public void showSystemEmbeddedPreview(String url) { - hideWidgetExtension(); - vPanel.clear(); - - if (previewEvent != null) { - vPanel.add(hReturnPanel); - vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px"); - } - - vPanel.add(embeddedPreview); - vPanel.setCellHorizontalAlignment(embeddedPreview, HasAlignment.ALIGN_CENTER); - vPanel.setCellVerticalAlignment(embeddedPreview, HasAlignment.ALIGN_MIDDLE); - - embeddedPreview.showEmbedded(url); + public static boolean isSyntaxHighlighterPreviewAvailable(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/SyntaxHighlighterPreview.java b/src/main/java/com/openkm/frontend/client/widget/properties/SyntaxHighlighterPreview.java deleted file mode 100644 index 613e31d3..00000000 --- a/src/main/java/com/openkm/frontend/client/widget/properties/SyntaxHighlighterPreview.java +++ /dev/null @@ -1,83 +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; - -/** - * 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. + *

+ * 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.OKMAuth; +import com.openkm.api.OKMDocument; +import com.openkm.bean.Document; +import com.openkm.core.*; +import com.openkm.dao.ConfigDAO; +import com.openkm.dao.bean.Profile; +import com.openkm.principal.PrincipalAdapterException; +import com.openkm.servlet.admin.BaseServlet; +import com.openkm.spring.PrincipalUtils; +import com.openkm.util.DocConverter; +import com.openkm.util.PathUtils; +import com.openkm.util.WebUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringEscapeUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URL; +import java.net.URLEncoder; + +/** + * In case of HTML5 Preview, Access-Control-Allow-Origin header is needed. + * See http://www.html5rocks.com/en/tutorials/cors/ + * + * @author sochoa + */ +@WebServlet("/Preview") +public class PreviewServlet extends BaseServlet { + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(PreviewServlet.class); + public static final String DOWNLOAD_TYPE_PREVIEW = "preview"; + public static final String PREVIEWER_PDFJS = "PDF.js"; + + @Override + public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + log.debug("doGet({}, {})", request, response); + PreviewParams params = new PreviewParams(request, response); + + try { + if (!params.swfUrl.isEmpty() || !params.pdfUrl.isEmpty()) { + pdfPreview(params); + } else if (!params.htmUrl.isEmpty()) { + html(params); + } else if (!params.codUrl.isEmpty()) { + code(params); + } else if (!params.mpgUrl.isEmpty()) { + html5player(params); + } else if (!params.docUrl.isEmpty()) { + if (params.docUrl.endsWith(".swf") || params.contentType.equals(MimeTypeConfig.MIME_SWF) + || params.mimeType.equals(MimeTypeConfig.MIME_SWF)) { + params.swfUrl = params.docUrl; + pdfPreview(params); + } else if (params.docUrl.endsWith(".pdf") || params.contentType.equals(MimeTypeConfig.MIME_PDF) + || params.mimeType.equals(MimeTypeConfig.MIME_PDF)) { + params.pdfUrl = params.docUrl; + pdfPreview(params); + } else if (params.docUrl.endsWith(".mp3") || params.contentType.equals(MimeTypeConfig.MIME_MP3) + || params.mimeType.equals(MimeTypeConfig.MIME_MP3)) { + params.mpgUrl = params.docUrl; + html5player(params); + } else if (params.docUrl.endsWith(".wav") || params.contentType.equals(MimeTypeConfig.MIME_WAV) + || params.mimeType.equals(MimeTypeConfig.MIME_WAV)) { + params.mpgUrl = params.docUrl; + html5player(params); + } else if (params.docUrl.endsWith(".mp4") || params.contentType.equals(MimeTypeConfig.MIME_MP4) + || params.mimeType.equals(MimeTypeConfig.MIME_MP4)) { + params.mpgUrl = params.docUrl; + html5player(params); + } else if (params.docUrl.endsWith(".swf") || params.contentType.equals(MimeTypeConfig.MIME_SWF) + || params.mimeType.equals(MimeTypeConfig.MIME_SWF)) { + params.mpgUrl = params.docUrl; + html5player(params); + } else if (params.docUrl.endsWith(".html") || params.contentType.equals(MimeTypeConfig.MIME_HTML) + || params.mimeType.equals(MimeTypeConfig.MIME_HTML)) { + params.htmUrl = params.docUrl; + html(params); + } else if (DocConverter.validSourceCode.contains(params.contentType) || DocConverter.validSourceCode.contains(params.mimeType)) { + params.codUrl = params.docUrl; + code(params); + } else { + generatePreviewNotAvailablePdf(request, response); + } + } else if (!params.uuid.isEmpty()) { + Document doc = null; + + if (params.mimeType.isEmpty()) { + doc = OKMDocument.getInstance().getProperties(null, params.uuid); + params.mimeType = doc.getMimeType(); + } + + if (params.mimeType.equals(MimeTypeConfig.MIME_SWF)) { + buildUrl(params, doc); + pdfPreview(params); + } else if (params.mimeType.equals(MimeTypeConfig.MIME_PDF)) { + buildUrl(params, doc); + pdfPreview(params); + } else if (params.mimeType.equals(MimeTypeConfig.MIME_MP3)) { + buildUrl(params, doc); + html5player(params); + } else if (params.mimeType.equals(MimeTypeConfig.MIME_WAV)) { + buildUrl(params, doc); + html5player(params); + } else if (params.mimeType.equals(MimeTypeConfig.MIME_MP4)) { + buildUrl(params, doc); + html5player(params); + } else if (params.mimeType.equals(MimeTypeConfig.MIME_SWF)) { + html5player(params); + } else if (params.mimeType.equals(MimeTypeConfig.MIME_HTML)) { + // does not need buildURL it does automatically by internal logic + html(params); + } else if (DocConverter.validSourceCode.contains(params.mimeType)) { + code(params); + } else if (doc != null && doc.isConvertibleToPdf()) { + buildUrl(params, doc); + pdfPreview(params); + } else { + generatePreviewNotAvailablePdf(request, response); + } + } else { + generatePreviewNotAvailablePdf(request, response); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + sendErrorRedirect(request, response, e); + } + } + + /** + * Generate preview not available content. Return a pdf with text instead to raise an error. + */ + private void generatePreviewNotAvailablePdf(HttpServletRequest request, HttpServletResponse response) { + try { + InputStream is = PreviewServlet.class.getResourceAsStream("frontend/preview_not_available.pdf"); + WebUtils.sendFile(request, response, "preview_not_available.pdf", MimeTypeConfig.MIME_PDF, true, is); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + + /** + * buildUrl + */ + private void buildUrl(PreviewParams params, Document doc) throws DatabaseException, UnsupportedEncodingException { + String publicUrl = ConfigDAO.getString("application.url", ""); + + if (params.mimeType.equals(MimeTypeConfig.MIME_SWF)) { + publicUrl = publicUrl.replace("/index", "/frontend/Download"); // using frontend download + publicUrl += "?uuid=" + URLEncoder.encode(doc.getUuid(), "UTF-8") + "&downloadType=" + DOWNLOAD_TYPE_PREVIEW + + "&version=" + doc.getActualVersion().getName(); + params.swfUrl = publicUrl; + } else if (params.mimeType.equals(MimeTypeConfig.MIME_PDF)) { + publicUrl = publicUrl.replace("/index", "/frontend/Download"); // using frontend download + publicUrl += "?uuid=" + URLEncoder.encode(doc.getUuid(), "UTF-8") + "&downloadType=" + DOWNLOAD_TYPE_PREVIEW + + "&version=" + doc.getActualVersion().getName(); + params.pdfUrl = publicUrl; + } else if (params.mimeType.equals(MimeTypeConfig.MIME_MP3) || params.mimeType.equals(MimeTypeConfig.MIME_WAV) + || params.mimeType.equals(MimeTypeConfig.MIME_MP4)) { + publicUrl = publicUrl.replace("/index", "/frontend/Download"); // using frontend download + publicUrl += "?uuid=" + URLEncoder.encode(doc.getUuid(), "UTF-8") + "&downloadType=" + DOWNLOAD_TYPE_PREVIEW + + "&version=" + doc.getActualVersion().getName(); + params.mpgUrl = publicUrl; + } else if (doc.isConvertibleToPdf()) { + params.mimeType = MimeTypeConfig.MIME_PDF; + publicUrl = publicUrl.replace("/index", "/frontend/Converter"); // using frontend download + publicUrl += "?inline=true&toPdf=true&uuid=" + URLEncoder.encode(doc.getUuid(), "UTF-8") + "&downloadType=" + + DOWNLOAD_TYPE_PREVIEW + "&version=" + doc.getActualVersion().getName(); + params.pdfUrl = publicUrl; + } + } + + /** + * Get PDF preview. Look into profile to get configured preview + */ + private void pdfPreview(PreviewParams params) throws IOException, PrincipalAdapterException { + pdfjs(params); + } + + /** + * Show PDF.js preview + */ + private void pdfjs(PreviewParams params) throws IOException { + String contextPath = params.request.getContextPath(); + String url = contextPath + "/preview/pdfjs/index.jsp?pdfUrl=" + URLEncoder.encode(params.pdfUrl, "UTF-8"); + params.response.sendRedirect(url); + } + + /** + * Show html preview + */ + private void html(PreviewParams params) throws ServletException, IOException { + String version = WebUtils.getString(params.request, "version"); + InputStream fis = null; + String content = ""; + + try { + if (!params.htmUrl.isEmpty()) { + URL url = new URL(params.htmUrl); + fis = url.openStream(); + } else if (!params.uuid.isEmpty()) { + if (version.isEmpty()) { + fis = OKMDocument.getInstance().getContent(null, params.uuid, false); + } else { + fis = OKMDocument.getInstance().getContentByVersion(null, params.uuid, version); + } + } + + if (fis != null) { + StringWriter writer = new StringWriter(); + IOUtils.copy(fis, writer, "UTF-8"); + content = writer.getBuffer().toString(); + content = content.replaceAll("jsOpenPathByUuid", "parent.jsOpenPathByUuid"); + content = content.replaceAll("jsDownloadByUuid", "parent.jsDownloadByUuid"); + content = content.replaceAll("href=\"#\">", "href=\"javascript:void(0);\">"); // solve refreshing issue into iframe + } + + ServletContext sc = getServletContext(); + sc.setAttribute("content", content); + sc.getRequestDispatcher("/preview/html/index.jsp").forward(params.request, params.response); + } catch (Exception e) { + sendErrorRedirect(params.request, params.response, e); + } finally { + IOUtils.closeQuietly(fis); + } + } + + /** + * Source code preview + */ + private void code(PreviewParams params) throws ServletException, IOException { + String version = WebUtils.getString(params.request, "version"); + InputStream fis = null; + String content = ""; + String markup = ""; + + try { + if (!params.codUrl.isEmpty()) { + URL url = new URL(params.codUrl); + fis = url.openStream(); + } else if (!params.uuid.isEmpty()) { + if (version.isEmpty()) { + fis = OKMDocument.getInstance().getContent(null, params.uuid, false); + } else { + fis = OKMDocument.getInstance().getContentByVersion(null, params.uuid, version); + } + } + + if (fis != null) { + content = IOUtils.toString(fis); + } + + if (params.mimeType.equals(MimeTypeConfig.MIME_HTML) || params.mimeType.equals(MimeTypeConfig.MIME_TEXT)) { + markup = "no-highlight"; + } else { + markup = "auto"; + } + + ServletContext sc = getServletContext(); + sc.setAttribute("markup", markup); + sc.setAttribute("content", StringEscapeUtils.escapeHtml(content)); + sc.getRequestDispatcher("/preview/code/index.jsp").forward(params.request, params.response); + } catch (Exception e) { + sendErrorRedirect(params.request, params.response, e); + } finally { + IOUtils.closeQuietly(fis); + } + } + + /** + * Show mp3, wav, mp4 preview + */ + private void html5player(PreviewParams params) throws ServletException, IOException { + String width = WebUtils.getString(params.request, "width", "100%"); + String height = WebUtils.getString(params.request, "height", "100%"); + String mediaProvider = ""; + + if (params.mimeType.equals(MimeTypeConfig.MIME_MP3) || params.mimeType.equals(MimeTypeConfig.MIME_WAV)) { + mediaProvider = "sound"; + } else if (params.mimeType.equals(MimeTypeConfig.MIME_FLV) || params.mimeType.equals(MimeTypeConfig.MIME_MP4)) { + mediaProvider = "video"; + } else if (params.mimeType.equals(MimeTypeConfig.MIME_SWF)) { + mediaProvider = ""; + } else if (params.mpgUrl.endsWith(".mp3") || params.mpgUrl.endsWith(".wav")) { + mediaProvider = "sound"; + } else if (params.mpgUrl.endsWith(".mp4")) { + mediaProvider = "video"; + } + + ServletContext sc = getServletContext(); + sc.setAttribute("mediaUrl", params.mpgUrl); + sc.setAttribute("mediaProvider", mediaProvider); + sc.setAttribute("width", width); + sc.setAttribute("height", height); + sc.getRequestDispatcher("/preview/html5player/index.jsp").forward(params.request, params.response); + } + + /** + * Inner class for parameters + */ + private static class PreviewParams { + public HttpServletRequest request; + public HttpServletResponse response; + public boolean buildUrl = false; + public String previewEngine; + public String contentType; + public String mimeType; + public String docUrl; + public String swfUrl; + public String pdfUrl; + public String htmUrl; + public String codUrl; + public String mpgUrl; + public String jsUrl; + public String uuid; + + public PreviewParams(HttpServletRequest request, HttpServletResponse response) { + this.request = request; + this.response = response; + this.previewEngine = WebUtils.getString(request, "previewEngine"); + this.contentType = WebUtils.getHeader(request, "Content-Type"); + this.buildUrl = WebUtils.getBoolean(request, "buildUrl"); + this.mimeType = WebUtils.getString(request, "mimeType"); + this.docUrl = WebUtils.getString(request, "docUrl"); + this.swfUrl = WebUtils.getString(request, "swfUrl"); + this.pdfUrl = WebUtils.getString(request, "pdfUrl"); + this.htmUrl = WebUtils.getString(request, "htmUrl"); + this.codUrl = WebUtils.getString(request, "codUrl"); + this.mpgUrl = WebUtils.getString(request, "mpgUrl"); + this.jsUrl = WebUtils.getString(request, "jsUrl"); + this.uuid = WebUtils.getString(request, "uuid"); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("previewEngine=").append(previewEngine); + sb.append(", contentType=").append(contentType); + sb.append(", mimeType=").append(mimeType); + sb.append(", buildUrl=").append(buildUrl); + sb.append(", docUrl=").append(docUrl); + sb.append(", swfUrl=").append(swfUrl); + sb.append(", pdfUrl=").append(pdfUrl); + sb.append(", htmUrl=").append(htmUrl); + sb.append(", codUrl=").append(codUrl); + sb.append(", mpgUrl=").append(mpgUrl); + sb.append(", uuid=").append(uuid); + sb.append("}"); + return sb.toString(); + } + } +} diff --git a/src/main/java/com/openkm/servlet/RepositoryStartupServlet.java b/src/main/java/com/openkm/servlet/RepositoryStartupServlet.java index f327f458..df17e1d5 100644 --- a/src/main/java/com/openkm/servlet/RepositoryStartupServlet.java +++ b/src/main/java/com/openkm/servlet/RepositoryStartupServlet.java @@ -381,13 +381,6 @@ private static void createMissingDirs() { pdfCacheFolder.mkdirs(); } - // Initialize SWF cache folder - File swfCacheFolder = new File(Config.REPOSITORY_CACHE_SWF); - if (!swfCacheFolder.exists()) { - log.info("Create missing directory {}", swfCacheFolder.getPath()); - swfCacheFolder.mkdirs(); - } - // Initialize chroot folder if (Config.SYSTEM_MULTIPLE_INSTANCES || Config.CLOUD_MODE) { File chrootFolder = new File(Config.INSTANCE_CHROOT_PATH); diff --git a/src/main/java/com/openkm/servlet/SyntaxHighlighterServlet.java b/src/main/java/com/openkm/servlet/SyntaxHighlighterServlet.java deleted file mode 100644 index fba676c3..00000000 --- a/src/main/java/com/openkm/servlet/SyntaxHighlighterServlet.java +++ /dev/null @@ -1,146 +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.ibm.icu.text.CharsetDetector; -import com.ibm.icu.text.CharsetMatch; -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.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; - -/** - * Syntax Highlighter Servlet - */ -public class SyntaxHighlighterServlet extends BaseServlet { - private static final Logger log = LoggerFactory.getLogger(SyntaxHighlighterServlet.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 mimeType = WebUtils.getString(request, "mimeType"); - String core = WebUtils.getString(request, "core"); - String theme = WebUtils.getString(request, "theme"); - CharsetDetector detector = new CharsetDetector(); - InputStream fis = null; - - try { - fis = OKMDocument.getInstance().getContent(null, uuid, false); - detector.setText(new BufferedInputStream(fis)); - CharsetMatch cm = detector.detect(); - String content = cm.getString(); - handlePreviewContent(request, response, mimeType, content, core, theme); - } catch (PathNotFoundException | AccessDeniedException | DatabaseException | RepositoryException | LockException e) { - sendErrorRedirect(request, response, e); - } finally { - IOUtils.closeQuietly(fis); - } - } - - /** - * Used when syntax highlight - */ - private void sendHighlight(HttpServletRequest request, HttpServletResponse response, String brushType, String brush, - String core, String theme, String content) throws ServletException, IOException { - ServletContext sc = getServletContext(); - sc.setAttribute("brushType", brushType); - sc.setAttribute("brush", brush); - sc.setAttribute("cssCore", core); - sc.setAttribute("cssTheme", theme); - sc.setAttribute("content", content); - sc.getRequestDispatcher("/syntax_highlighter.jsp").forward(request, response); - } - - /** - * Used when no syntax highlight - */ - private void sendContent(HttpServletRequest request, HttpServletResponse response, String content) throws IOException { - PrintWriter out = response.getWriter(); - out.print(content); - out.flush(); - IOUtils.closeQuietly(out); - } - - /** - * Handle syntax highlight representation - */ - private void handlePreviewContent(HttpServletRequest request, HttpServletResponse response, String mimeType, - String content, String core, String theme) throws ServletException, IOException { - if (mimeType.equals("text/html")) { - sendContent(request, response, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_JAVA) || mimeType.equals(MimeTypeConfig.MIME_BSH)) { - sendHighlight(request, response, "java", "shBrushJava.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_XML)) { - sendHighlight(request, response, "xml", "shBrushXml.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_SQL)) { - sendHighlight(request, response, "sql", "shBrushSql.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_SCALA)) { - sendHighlight(request, response, "scala", "shBrushScala.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_PYTHON)) { - sendHighlight(request, response, "python", "shBrushPython.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_PHP)) { - sendHighlight(request, response, "php", "shBrushPhp.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_PERL)) { - sendHighlight(request, response, "perl", "shBrushPerl.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_TEXT)) { - sendHighlight(request, response, "plain", "shBrushPlain.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_JAVASCRIPT)) { - sendHighlight(request, response, "javascript", "shBrushJScript.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_GROOVY)) { - sendHighlight(request, response, "groovy", "shBrushGroovy.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_DIFF)) { - sendHighlight(request, response, "diff", "shBrushDiff.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_PASCAL)) { - sendHighlight(request, response, "pascal", "shBrushDelphi.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_CSS)) { - sendHighlight(request, response, "css", "shBrushCss.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_CSHARP)) { - sendHighlight(request, response, "csharp", "shBrushCSharp.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_CPP)) { - sendHighlight(request, response, "c", "shBrushCpp.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_SH)) { - sendHighlight(request, response, "bash", "shBrushBash.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_AS3)) { - sendHighlight(request, response, "as3", "shBrushAS3.js", core, theme, content); - } else if (mimeType.equals(MimeTypeConfig.MIME_APPLESCRIPT)) { - sendHighlight(request, response, "applescript", "shBrushAppleScript.js", core, theme, content); - } else { - sendContent(request, response, content); - } - } -} diff --git a/src/main/java/com/openkm/servlet/admin/ConfigServlet.java b/src/main/java/com/openkm/servlet/admin/ConfigServlet.java index 0062f304..5d64c427 100644 --- a/src/main/java/com/openkm/servlet/admin/ConfigServlet.java +++ b/src/main/java/com/openkm/servlet/admin/ConfigServlet.java @@ -412,11 +412,6 @@ private void check(String userId, HttpServletRequest request, HttpServletRespons try { out.println("