diff --git a/fitnesse/copyjars.xml b/fitnesse/copyjars.xml index 24c2ff572f..c8f80f0bda 100644 --- a/fitnesse/copyjars.xml +++ b/fitnesse/copyjars.xml @@ -1,6 +1,6 @@ - + diff --git a/org.adempiere.base/copyjars.xml b/org.adempiere.base/copyjars.xml index 0bb6756b88..1fe2a28dad 100644 --- a/org.adempiere.base/copyjars.xml +++ b/org.adempiere.base/copyjars.xml @@ -5,9 +5,9 @@ http://mvnrepository.com/artifact/org.apache.bsf/bsf-all/3.0-beta3 --> - - - + + + @@ -20,6 +20,6 @@ - + diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index 26a50e3c85..70c5e58287 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -16,9 +16,9 @@ *****************************************************************************/ package org.compiere.print; -import static org.compiere.model.SystemIDs.TABLE_AD_TABLE; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_MOVEMENT; +import static org.compiere.model.SystemIDs.TABLE_AD_TABLE; import java.awt.Color; import java.awt.Font; @@ -807,14 +807,14 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) if (extension != null && extension.getStyleURL() != null) { // maybe cache style content with key is path - String pathStyleFile = extension.getFullPathStyle(); + String pathStyleFile = extension.getFullPathStyle(); // creates a temp file - delete below Path path = Paths.get(pathStyleFile); List styleLines = Files.readAllLines(path, Ini.getCharset()); + Files.delete(path); // delete temp file StringBuilder styleBuild = new StringBuilder(); for (String styleLine : styleLines){ - styleBuild.append(styleLine); + styleBuild.append(styleLine); //.append("\n"); } - appendInlineCss (doc, styleBuild); } if (extension != null && extension.getScriptURL() != null && !isExport) @@ -2092,4 +2092,5 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) return String.format(CSS_SELECTOR_TEMPLATE, index + 1); } } + } // ReportEngine diff --git a/org.adempiere.extend/copyjars.xml b/org.adempiere.extend/copyjars.xml index 0b6afab9ae..e3120a779d 100644 --- a/org.adempiere.extend/copyjars.xml +++ b/org.adempiere.extend/copyjars.xml @@ -1,6 +1,6 @@ - - + + diff --git a/org.adempiere.payment.processor/copyjars.xml b/org.adempiere.payment.processor/copyjars.xml index 78be53f86e..2395a105f0 100644 --- a/org.adempiere.payment.processor/copyjars.xml +++ b/org.adempiere.payment.processor/copyjars.xml @@ -2,8 +2,8 @@ - - - + + + diff --git a/org.adempiere.report.jasper.library/copyjars.xml b/org.adempiere.report.jasper.library/copyjars.xml index b306124507..c71107db67 100644 --- a/org.adempiere.report.jasper.library/copyjars.xml +++ b/org.adempiere.report.jasper.library/copyjars.xml @@ -7,7 +7,7 @@ - + diff --git a/org.adempiere.server-feature/copyjars.xml b/org.adempiere.server-feature/copyjars.xml index b267463fac..1f65c23d7e 100644 --- a/org.adempiere.server-feature/copyjars.xml +++ b/org.adempiere.server-feature/copyjars.xml @@ -1,9 +1,9 @@ - - - + + + @@ -18,21 +18,21 @@ - + - - + + - - - + + + - + diff --git a/org.adempiere.server/copyjars.xml b/org.adempiere.server/copyjars.xml index f01c631d08..6c571ab2c8 100644 --- a/org.adempiere.server/copyjars.xml +++ b/org.adempiere.server/copyjars.xml @@ -1,7 +1,7 @@ - - + + diff --git a/org.adempiere.ui.swing/copyjars.xml b/org.adempiere.ui.swing/copyjars.xml index 1718f17aa9..9e1e200986 100644 --- a/org.adempiere.ui.swing/copyjars.xml +++ b/org.adempiere.ui.swing/copyjars.xml @@ -4,6 +4,6 @@ - + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java index 832e6b3941..37175c593c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java @@ -798,8 +798,7 @@ public class DashboardController implements EventListener { Iframe iframe = new Iframe(); iframe.setSclass("dashboard-report-iframe"); File file = File.createTempFile(re.getName(), ".html"); - re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getDesktop().getWebApp().getRealPath("/"), - Executions.getCurrent().getContextPath(), "rp", + re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp", SessionManager.getAppDesktop().getComponent().getUuid())); AMedia media = new AMedia(re.getName(), "html", "text/html", file, false); iframe.setContent(media); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java index e33129af42..39dea76afe 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java @@ -269,8 +269,7 @@ public class WAttachment extends Window implements EventListener bLoad.setId("bLoad"); // bLoad.setAttribute("org.zkoss.zul.image.preload", Boolean.TRUE); bLoad.setTooltiptext(Msg.getMsg(Env.getCtx(), "Load")); -// bLoad.setUpload(AdempiereWebUI.getUploadSetting()); - bLoad.setUpload("true,accept=audio/*|video/*|image/*|MIME_type,native"); + bLoad.setUpload("multiple=true," + AdempiereWebUI.getUploadSetting()); bLoad.addEventListener(Events.ON_UPLOAD, this); bDelete.addEventListener(Events.ON_CLICK, this); @@ -386,6 +385,7 @@ public class WAttachment extends Window implements EventListener } else { + clearPreview(); return false; } } @@ -478,7 +478,11 @@ public class WAttachment extends Window implements EventListener if (e instanceof UploadEvent) { preview.setVisible(false); UploadEvent ue = (UploadEvent) e; - processUploadMedia(ue.getMedia()); + for (Media media : ue.getMedias()) { + processUploadMedia(media); + } + clearPreview(); + autoPreview (cbContent.getSelectedIndex(), false); } else if (e.getTarget() == bOk || DialogEvents.ON_WINDOW_CLOSE.equals(e.getName())) { if (m_attachment != null) { String newText = text.getText(); @@ -552,8 +556,6 @@ public class WAttachment extends Window implements EventListener { m_attachment.updateEntry(i, getMediaData(media)); cbContent.setSelectedIndex(i); - clearPreview(); - autoPreview(cbContent.getSelectedIndex(), false); m_change = true; return; } @@ -564,8 +566,6 @@ public class WAttachment extends Window implements EventListener { cbContent.appendItem(media.getName(), media.getName()); cbContent.setSelectedIndex(cbContent.getItemCount()-1); - autoPreview(cbContent.getSelectedIndex(), false); - clearPreview(); m_change = true; } } @@ -610,8 +610,10 @@ public class WAttachment extends Window implements EventListener { if (result) { - m_attachment.delete(true); - m_attachment = null; + if (m_attachment != null) { + m_attachment.delete(true); + m_attachment = null; + } } } }); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java index 52b16af718..3a1d3335ce 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java @@ -13,6 +13,13 @@ *****************************************************************************/ package org.adempiere.webui.report; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import org.adempiere.exceptions.AdempiereException; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.theme.ThemeManager; import org.apache.ecs.ConcreteElement; @@ -36,9 +43,8 @@ public class HTMLExtension implements IHTMLExtension { private String componentId; private String scriptURL; private String styleURL; - private String contextFullPath; - public HTMLExtension(String contextFullPath, String contextPath, String classPrefix, String componentId) { + public HTMLExtension(String contextPath, String classPrefix, String componentId) { String theme = MSysConfig.getValue(MSysConfig.HTML_REPORT_THEME, "/", Env.getAD_Client_ID(Env.getCtx())); @@ -51,7 +57,6 @@ public class HTMLExtension implements IHTMLExtension { this.componentId = componentId; this.scriptURL = contextPath + theme + "js/report.js"; this.styleURL = contextPath + theme + "css/report.css"; - this.contextFullPath = contextFullPath; } public void extendIDColumn(int row, ConcreteElement columnElement, a href, @@ -94,15 +99,44 @@ public class HTMLExtension implements IHTMLExtension { } - public String getFullPathStyle (){ + public String getFullPathStyle() { String theme = MSysConfig.getValue(MSysConfig.HTML_REPORT_THEME, "/", Env.getAD_Client_ID(Env.getCtx())); - if (! theme.startsWith("/")) theme = "/" + theme; if (! theme.endsWith("/")) theme = theme + "/"; - - return contextFullPath + theme + "css/report.css"; + String resFile = theme + "css/report.css"; + URL urlFile = this.getClass().getResource(resFile); + if (urlFile == null) { + resFile = "/css/report.css"; // default + urlFile = this.getClass().getResource(resFile); + } + if (urlFile != null) { + FileOutputStream cssStream = null; + File cssFile = null; + try { + // copy the resource to a temporary file to process it with 2pack + InputStream stream = urlFile.openStream(); + cssFile = File.createTempFile("report", ".css"); + cssStream = new FileOutputStream(cssFile); + byte[] buffer = new byte[1024]; + int read; + while((read = stream.read(buffer)) != -1){ + cssStream.write(buffer, 0, read); + } + } catch (IOException e) { + throw new AdempiereException(e); + } finally{ + if (cssStream != null) { + try { + cssStream.close(); + } catch (Exception e2) {} + } + } + return cssFile.getAbsolutePath(); + } else { + return null; + } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index d097d5d39a..340a2587e8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -1043,8 +1043,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab { StringWriter sw = new StringWriter(); String contextPath = Executions.getCurrent().getContextPath(); - String contextFullPath = Executions.getCurrent().getDesktop().getWebApp().getRealPath("/"); - m_reportEngine.createHTML(sw, false, m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextFullPath, contextPath, "rp", this.getUuid()), true); + m_reportEngine.createHTML(sw, false, m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextPath, "rp", this.getUuid()), true); data = sw.getBuffer().toString().getBytes(); } else if (ext.equals("xls")) @@ -1424,13 +1423,11 @@ public class ZkReportViewer extends Window implements EventListener, ITab private ZkReportViewer viewer; private String contextPath; - private String contextFullPath; public HTMLRendererRunnable(ZkReportViewer viewer) { super(); this.viewer = viewer; contextPath = Executions.getCurrent().getContextPath(); - contextFullPath = Executions.getCurrent().getDesktop().getWebApp().getRealPath("/"); } @Override @@ -1445,7 +1442,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab log.log(Level.FINE, "Path="+path + " Prefix="+prefix); } File file = File.createTempFile(prefix, ".html", new File(path)); - viewer.m_reportEngine.createHTML(file, false, viewer.m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextFullPath, contextPath, "rp", viewer.getUuid())); + viewer.m_reportEngine.createHTML(file, false, viewer.m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextPath, "rp", viewer.getUuid())); viewer.media = new AMedia(file.getName(), "html", "text/html", file, false); } catch (Exception e) { if (e instanceof RuntimeException) diff --git a/org.adempiere.ui.zk/copyjars.xml b/org.adempiere.ui.zk/copyjars.xml index a28a3e1bb7..611171cf52 100644 --- a/org.adempiere.ui.zk/copyjars.xml +++ b/org.adempiere.ui.zk/copyjars.xml @@ -5,7 +5,7 @@ - + diff --git a/org.adempiere.ui/copyjars.xml b/org.adempiere.ui/copyjars.xml index 9b9dfd83ed..64e0f1064b 100644 --- a/org.adempiere.ui/copyjars.xml +++ b/org.adempiere.ui/copyjars.xml @@ -4,7 +4,7 @@ http://central.maven.org/maven2/org/codeartisans/thirdparties/swing/org-netbeans-api-visual/2.23.1/org-netbeans-api-visual-2.23.1.jar http://central.maven.org/maven2/org/codeartisans/thirdparties/swing/org-openide-util/8.6.2/org-openide-util-8.6.2.jar --> - - + + diff --git a/org.compiere.db.oracle.provider/copyjars.xml b/org.compiere.db.oracle.provider/copyjars.xml index 8cddd65746..77cf8bbbb6 100644 --- a/org.compiere.db.oracle.provider/copyjars.xml +++ b/org.compiere.db.oracle.provider/copyjars.xml @@ -2,7 +2,7 @@ - - + + diff --git a/org.idempiere.fitnesse.server/copyjars.xml b/org.idempiere.fitnesse.server/copyjars.xml index 17bf269c7e..f7c22ea584 100644 --- a/org.idempiere.fitnesse.server/copyjars.xml +++ b/org.idempiere.fitnesse.server/copyjars.xml @@ -1,9 +1,9 @@ - - - + + +