diff --git a/mindplot/src/main/resources/messages_zh_CN.properties b/mindplot/src/main/resources/messages_zh_CN.properties index 802931cf..bf601cd8 100644 --- a/mindplot/src/main/resources/messages_zh_CN.properties +++ b/mindplot/src/main/resources/messages_zh_CN.properties @@ -42,3 +42,9 @@ SUB_TOPIC=子节点 ISOLATED_TOPIC=独立节点 CENTRAL_TOPIC=中心节点 SHORTCUTS=快捷键 +ENTITIES_COULD_NOT_BE_DELETED=不能删除节点或者关系。至少应选择一个对象。 +AT_LEAST_ONE_TOPIC_MUST_BE_SELECTED=至少应选择一个节点。 +CLIPBOARD_IS_EMPTY=无法拷贝。 粘贴板是空的。 +CENTRAL_TOPIC_CAN_NOT_BE_DELETED=不能删除根节点。 +RELATIONSHIP_COULD_NOT_BE_CREATED=不能创建关系。 应先选择创建关系的一对上级节点。 +SELECTION_COPIED_TO_CLIPBOARD=节点已拷贝到粘贴板。 diff --git a/mindplot/src/main/resources/messages_zh_TW.properties b/mindplot/src/main/resources/messages_zh_TW.properties index 39fb991f..80897533 100644 --- a/mindplot/src/main/resources/messages_zh_TW.properties +++ b/mindplot/src/main/resources/messages_zh_TW.properties @@ -43,3 +43,10 @@ SUB_TOPIC=子節點 ISOLATED_TOPIC=獨立節點 CENTRAL_TOPIC=中心節點 SHORTCUTS=快捷鍵 +ENTITIES_COULD_NOT_BE_DELETED=不能刪除節點或者關係。至少應選擇一個對象。 +AT_LEAST_ONE_TOPIC_MUST_BE_SELECTED=至少應選擇一個節點。 +CLIPBOARD_IS_EMPTY=無法拷貝。 粘貼板是空的。 +CENTRAL_TOPIC_CAN_NOT_BE_DELETED=不能刪除根節點。 +RELATIONSHIP_COULD_NOT_BE_CREATED=不能創建關係。 應先選擇創建關係的一對上級節點。 +SELECTION_COPIED_TO_CLIPBOARD=節點已拷貝到粘貼板。 + diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java index 21856075..0e15c6c5 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java @@ -1,86 +1,78 @@ -/* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.wisemapping.exporter; - -public class ExportProperties { - private ExportFormat format; - private String baseImgPath; - - public ExportFormat getFormat() { - return format; - } - - private ExportProperties(final ExportFormat format) { - this.format = format; - } - - public static ExportProperties create(final ExportFormat format) { - ExportProperties result; - if (format == ExportFormat.JPG || format == ExportFormat.PNG) { - result = new ImageProperties(format); - } else { - result = new GenericProperties(format); - } - return result; - } - - public void setBaseImagePath(String baseUrl) { - this.baseImgPath = baseUrl; - } - - public String getBaseImgPath() { - return baseImgPath; - } - - static public class GenericProperties extends ExportProperties { - private GenericProperties(ExportFormat format) { - super(format); - } - } - - static public class ImageProperties extends ExportProperties { - private Size size; - - public Size getSize() { - return size; - } - - public void setSize(Size size) { - this.size = size; - } - - public ImageProperties(ExportFormat format) { - super(format); - } - - public enum Size { - SMALL(100), MEDIUM(800), XMEDIUM(1024), LARGE(2048); - private int width; - - Size(int width) { - this.width = width; - } - - public Float getWidth() { - return (float) width; - } - } - } - -} +/* +* Copyright [2011] [wisemapping] +* +* Licensed under WiseMapping Public License, Version 1.0 (the "License"). +* It is basically the Apache License, Version 2.0 (the "License") plus the +* "powered by wisemapping" text requirement on every single page; +* you may not use this file except in compliance with the License. +* You may obtain a copy of the license at +* +* http://www.wisemapping.org/license +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package com.wisemapping.exporter; + +public class ExportProperties { + private ExportFormat format; + private String baseImgPath; + + public ExportFormat getFormat() { + return format; + } + + private ExportProperties(final ExportFormat format) { + this.format = format; + } + + public static ExportProperties create(final ExportFormat format) { + ExportProperties result; + if (format == ExportFormat.JPG || format == ExportFormat.PNG) { + result = new ImageProperties(format); + } else { + result = new GenericProperties(format); + } + return result; + } + + static public class GenericProperties extends ExportProperties { + private GenericProperties(ExportFormat format) { + super(format); + } + } + + static public class ImageProperties extends ExportProperties { + private Size size; + + public Size getSize() { + return size; + } + + public void setSize(Size size) { + this.size = size; + } + + public ImageProperties(ExportFormat format) { + super(format); + } + + public enum Size { + SMALL(100), MEDIUM(800), XMEDIUM(1024), LARGE(2048); + private int width; + + Size(int width) { + this.width = width; + } + + public Float getWidth() { + return (float) width; + } + } + } + +} diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java index 1a40ca1c..b04b1f15 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java @@ -31,7 +31,9 @@ import org.jetbrains.annotations.Nullable; import org.w3c.dom.*; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import sun.misc.BASE64Encoder; +import javax.servlet.ServletContext; import javax.xml.bind.JAXBException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -48,16 +50,19 @@ public class ExporterFactory { private static final String GROUP_NODE_NAME = "g"; private static final String RECT_NODE_NAME = "rect"; private static final String IMAGE_NODE_NAME = "image"; + private File baseImgDir; - - private ExporterFactory() throws ParserConfigurationException { - + public ExporterFactory(@NotNull final ServletContext servletContext) throws ParserConfigurationException { + this.baseImgDir = new File(servletContext.getRealPath("/")); } - public static void export(@NotNull ExportProperties properties, @Nullable String xml, @NotNull OutputStream output, @Nullable String mapSvg) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException { + public ExporterFactory(@NotNull final File baseImgDir) throws ParserConfigurationException { + this.baseImgDir = baseImgDir; + } + + public void export(@NotNull ExportProperties properties, @Nullable String xml, @NotNull OutputStream output, @Nullable String mapSvg) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException { final ExportFormat format = properties.getFormat(); - final String imgPath = properties.getBaseImgPath(); switch (format) { case PNG: { // Create a JPEG transcoder @@ -68,7 +73,7 @@ public class ExporterFactory { transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, size.getWidth()); // Create the transcoder input. - final Document document = normalizeSvg(mapSvg, imgPath); + final Document document = normalizeSvg(mapSvg, false); final String svgString = domToString(document); final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); @@ -89,7 +94,7 @@ public class ExporterFactory { transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, size.getWidth()); // Create the transcoder input. - final Document document = normalizeSvg(mapSvg, imgPath); + final Document document = normalizeSvg(mapSvg, false); final String svgString = domToString(document); final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); @@ -104,7 +109,7 @@ public class ExporterFactory { final Transcoder transcoder = new PDFTranscoder(); // Create the transcoder input. - final Document document = normalizeSvg(mapSvg, imgPath); + final Document document = normalizeSvg(mapSvg, false); final String svgString = domToString(document); final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); @@ -115,7 +120,7 @@ public class ExporterFactory { break; } case SVG: { - final Document dom = normalizeSvg(mapSvg, imgPath); + final Document dom = normalizeSvg(mapSvg, true); output.write(domToString(dom).getBytes("UTF-8")); break; } @@ -129,7 +134,7 @@ public class ExporterFactory { } } - private static Document normalizeSvg(@NotNull String svgXml, final String imgBaseUrl) throws XMLStreamException, ParserConfigurationException, IOException, SAXException, TransformerException { + private Document normalizeSvg(@NotNull String svgXml, boolean embedImg) throws XMLStreamException, ParserConfigurationException, IOException, SAXException, TransformerException { final DocumentBuilder documentBuilder = getDocumentBuilder(); svgXml = svgXml.replaceFirst(" mvc-servlet org.springframework.web.servlet.DispatcherServlet - 1 - contextConfigLocation /WEB-INF/wisemapping-servlet.xml - + 1 mvc-rest org.springframework.web.servlet.DispatcherServlet - 1 - contextConfigLocation /WEB-INF/wisemapping-rest.xml - + 1 diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml index 45239e8a..a9de0c13 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml @@ -1,4 +1,5 @@ + + + + + + + diff --git a/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java b/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java index 0cefc9a4..dbf2c3a4 100644 --- a/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java +++ b/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java @@ -6,7 +6,6 @@ import com.wisemapping.exporter.ExportProperties; import com.wisemapping.exporter.ExporterFactory; import com.wisemapping.importer.ImporterException; -import com.wisemapping.model.MindMap; import org.apache.batik.transcoder.TranscoderException; import org.apache.commons.io.FileUtils; import org.jetbrains.annotations.NotNull; @@ -33,20 +32,17 @@ public class ExportTest { final ExportProperties properties = ExportProperties.create(format); final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties; imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE); - String baseUrl = "file://" + svgFile.getParentFile().getAbsolutePath() + "/../../../../../../wise-editor/src/main/webapp/icons"; - properties.setBaseImagePath(baseUrl); + String baseUrl = svgFile.getParentFile().getAbsolutePath() + "/../../../../../../wise-editor/src/main/webapp"; + ExporterFactory factory = new ExporterFactory(new File(baseUrl)); // Write content ... if (pngFile.exists()) { // Export mile content ... final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ExporterFactory.export(imageProperties, null, bos, svgXml); - -// Assert.assertEquals(expContent.toString().trim(), expContent.toString().trim()); - + factory.export(imageProperties, null, bos, svgXml); } else { OutputStream outputStream = new FileOutputStream(pngFile, false); - ExporterFactory.export(imageProperties, null, outputStream, svgXml); + factory.export(imageProperties, null, outputStream, svgXml); outputStream.close(); } } diff --git a/wise-webapp/src/test/resources/data/svg/map4.png b/wise-webapp/src/test/resources/data/svg/map4.png index e69de29b..e5776d88 100644 Binary files a/wise-webapp/src/test/resources/data/svg/map4.png and b/wise-webapp/src/test/resources/data/svg/map4.png differ diff --git a/wise-webapp/src/test/resources/data/svg/map5.png b/wise-webapp/src/test/resources/data/svg/map5.png index e69de29b..079a3bb9 100644 Binary files a/wise-webapp/src/test/resources/data/svg/map5.png and b/wise-webapp/src/test/resources/data/svg/map5.png differ diff --git a/wise-webapp/src/test/resources/data/svg/map6.png b/wise-webapp/src/test/resources/data/svg/map6.png new file mode 100644 index 00000000..34a5dd0f Binary files /dev/null and b/wise-webapp/src/test/resources/data/svg/map6.png differ diff --git a/wise-webapp/src/test/resources/data/svg/map6.svg b/wise-webapp/src/test/resources/data/svg/map6.svg new file mode 100644 index 00000000..3cf30098 --- /dev/null +++ b/wise-webapp/src/test/resources/data/svg/map6.svg @@ -0,0 +1,2843 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PPM Plan + + + + + + + + Community Outreach + + + + + + + + + Probono + + + + + + + + + Sub Topic + + + + + + + + + Backlog Management + + + + + + + + + + + Client Project Management + + + + + + + + + Human Resources + + + + + + + + + + + Freeform IT + + + + + + + + + Administration + + + + + + + + + Freeform IT Plan + + + + + + + + + Fragile + + + + + + + + + Tools + + + + + + + + + Learning Needs Plan + + + + + + + + + Governance & Executive + + + + + + + + + Sub Topic + + + + + + + + + Finance + + + + + + + + + Freeform Hosting + + + + + + + + + Business Development + + + + + + + + + R&D + + + + + + + + + Goals + + + + + + + + + Formulize + + + + + + + + + Strategy 2: Talent Development + + + + + + + + + + + Strategic Priority 2a: Personal Plans + + + + + + + + + + + Strategic Priority 2b: External learning matches organ. goals + + + + + + + + + + + Strategic Priority 2c: Learning Environment + + + + + + + + + + + So That... + + + + + + + + + + + + Strategy 1: Recruit & Retain + + + + + + + + + + + So that... + + + + + + + + + + + Strategic Priority 1a: Recruitment + + + + + + + + + + + Modify App Form + + + + + + + + + + + Strategy integrated with hiring plan + + + + + + + + + + + Strategic Priority 1b: Hiring + + + + + + + + + + + Strategic Priority 1c: Onboarding + + + + + + + + + + + 3 Month Onboarding Process + + + + + + + + + Tools & Guidelines + + + + + + + + + Mentoring + + + + + + + + + Strategic Priority 1d: Incentives + + + + + + + + + + + Raises + + + + + + + + + Benefits + + + + + + + + + Rewards Message + + + + + + + + + + + Strategic Priority 1e: Offboarding + + + + + + + + + + + Business Development Plan + + + + + + + + + Target + + + + + + + + + Goals + + + + + + + + + Increase new clients + + + + + + + + + Academic Research + + + + + + + + + Strategy 4: Inclusive, Positive Environment + + + + + + + + + + + Strategic Priority 4a:Feedback + + + + + + + + + + + Strategic Priority 4b: Anti Harassment + + + + + + + + + + + Strategic Priority 4c: Diversity + + + + + + + + + + + Sub Topic + + + + + + + + + So That... + + + + + + + + + + + + Sub Topic + + + + + + + + + Support New Products + + + + + + + + + Formulize + + + + + + + + + Sub Topic + + + + + + + + + Sub Topic + + + + + + + + + Support CiviCRM + + + + + + + + + Identify Opportunites + + + + + + + + + Sub Topic + + + + + + + + + Sub Topic + + + + + + + + + Sub Topic + + + + + + + + + Sub Topic + + + + + + + + + Hosting NG Plan + + + + + + + + + Project Teams + + + + + + + + + Projects 1-3 + + + + + + + + + Projects 4-6 + + + + + + + + + Projects 7 & 8 + + + + + + + + + General Work + + + + + + + + + Restructure + + + + + + + + + Client Centric Process + + + + + + + + + Freeform Project Process + + + + + + + + + Supportive Systems Plan + + + + + + + + + Board and C Planning + + + + + + + + + Mission Statements + + + + + + + + + + + Values + + + + + + + + + Bylaw Review + + + + + + + + + Policies + + + + + + + + + Business Plan + + + + + + + + + Strategy 3: Safety and Wellness + + + + + + + + + + + Strategic Priority 3a: H&S Policies & Practices + + + + + + + + + + + Sub Topic + + + + + + + + + Strategic Priority 3b: Health Promotion + + + + + + + + + + + Health and Wellness Committee + + + + + + + + + + + Work-life Balance Initiative + + + + + + + + + + + So that... + + + + + + + + + + + + Benefits + + + + + + + + + + + As Freeform Staff + + + + + + + + + + + Responsibility: HZ, JC + + + + + + + + + Release 3 + + + + + + + + + + + Have Heather create list benefits against Best Practice & cost + + + + + + + + + + + Have Jason review list + + + + + + + + + + + Have JC & HZ consult with staff + + + + + + + + + + + Have best benefits we can afford + + + + + + + + + + + So that... + + + + + + + + + + + + Community Outreach Plan + + + + + + + + + Goals + + + + + + + + + CSI + + + + + + + + + Drupal Community + + + + + + + + + CiviCRM + + + + + + + + + Other + + + + + + + + + Backlog Plan + + + + + + + + + + + Go To Backlog Plan + + + + + + + + + + + + Strategies Marketing + + + + + + + + + Isolated Topic + + + + + + + + + Exit Interviews + + + + + + + + + As Freeform + + + + + + + + + + + Responsiblity: HZ, KS + + + + + + + + + Release + + + + + + + + + + + Have Heather write procedures for exit interview process + + + + + + + + + So that + + + + + + + + + + + + 3 Month Onboarding Process + + + + + + + + + Human Resources Plan + + + + + + + + + Related Org Objectives + + + + + + + + + 1 + + + + + + + + + + + 2 + + + + + + + + + + + 3 + + + + + + + + + + + 4 + + + + + + + + + + + Related Documents + + + + + + + + + + + Goals + + + + + + + + + Goal:Staff=Optimal Bus. Growth + + + + + + + + + + + + So that... + + + + + + + + + + + Related Strategic Priorities: + + + + + + + + + KPI: HR Level equals Planned Growth + + + + + + + + + + + Methodology + + + + + + + + + + + Target + + + + + + + + + + + Goal: Increase Job Satisfaction + + + + + + + + + So That + + + + + + + + + + + + Related Strategic Priorities + + + + + + + + + Sub Topic + + + + + + + + + KPI: Employee Satisfaction + + + + + + + + + + + Sub Topic + + + + + + + + + Methodology + + + + + + + + + + + Target + + + + + + + + + + + Goal: Improve Performance + + + + + + + + + + + + So That + + + + + + + + + + + + Related Strategic Priorities + + + + + + + + + + + KPI: Employee Performance + + + + + + + + + + + Methodology + + + + + + + + + Target + + + + + + + + + Goal: Reduce Turnover + + + + + + + + + + + + So That + + + + + + + + + + + + Related Strategic Priorities + + + + + + + + + KPI: Retention Rate + + + + + + + + + + + Methodology + + + + + + + + + Risk & Compliance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file