mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
removing svg from save operation
This commit is contained in:
parent
6cc4d2eaff
commit
c4021bf3c4
@ -352,9 +352,8 @@ mindplot.MindmapDesigner.prototype.save = function(onSavedHandler, saveHistory)
|
|||||||
var persistantManager = mindplot.PersistanceManager;
|
var persistantManager = mindplot.PersistanceManager;
|
||||||
var mindmap = this._mindmap;
|
var mindmap = this._mindmap;
|
||||||
|
|
||||||
var xmlChart = this._workspace.dumpNativeChart();
|
|
||||||
var properties = {zoom:this._zoom};
|
var properties = {zoom:this._zoom};
|
||||||
persistantManager.save(mindmap, xmlChart, properties, onSavedHandler, saveHistory);
|
persistantManager.save(mindmap, properties, onSavedHandler, saveHistory);
|
||||||
this._fireEvent("save", {type:saveHistory});
|
this._fireEvent("save", {type:saveHistory});
|
||||||
|
|
||||||
// Refresh undo state...
|
// Refresh undo state...
|
||||||
|
@ -18,10 +18,9 @@
|
|||||||
|
|
||||||
mindplot.PersistanceManager = {};
|
mindplot.PersistanceManager = {};
|
||||||
|
|
||||||
mindplot.PersistanceManager.save = function(mindmap, xmlChart, editorProperties, onSavedHandler,saveHistory)
|
mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHandler,saveHistory)
|
||||||
{
|
{
|
||||||
core.assert(mindmap, "mindmap can not be null");
|
core.assert(mindmap, "mindmap can not be null");
|
||||||
core.assert(xmlChart, "xmlChart can not be null");
|
|
||||||
core.assert(editorProperties, "editorProperties can not be null");
|
core.assert(editorProperties, "editorProperties can not be null");
|
||||||
|
|
||||||
var mapId = mindmap.getId();
|
var mapId = mindmap.getId();
|
||||||
@ -31,7 +30,7 @@ mindplot.PersistanceManager.save = function(mindmap, xmlChart, editorProperties,
|
|||||||
var xmlMapStr = core.Utils.innerXML(xmlMap);
|
var xmlMapStr = core.Utils.innerXML(xmlMap);
|
||||||
|
|
||||||
var pref = Json.toString(editorProperties);
|
var pref = Json.toString(editorProperties);
|
||||||
window.MapEditorService.saveMap(mapId, xmlMapStr, xmlChart, pref,saveHistory,
|
window.MapEditorService.saveMap(mapId, xmlMapStr, pref,saveHistory,
|
||||||
{
|
{
|
||||||
callback:function(response) {
|
callback:function(response) {
|
||||||
|
|
||||||
|
@ -64,8 +64,7 @@ public class EmbeddedViewController extends BaseMultiActionController {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
view = new ModelAndView("embeddedViewImg");
|
view = new ModelAndView("embeddedViewNotSupported");
|
||||||
view.addObject("mindmap", mindmap);
|
|
||||||
}
|
}
|
||||||
view.addObject("fullView", fullView);
|
view.addObject("fullView", fullView);
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ package com.wisemapping.controller;
|
|||||||
|
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.MindMapNative;
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
@ -55,8 +54,6 @@ public class NewMindmapController
|
|||||||
final String defaultNativeMap = getDefaultMindmapXml(title);
|
final String defaultNativeMap = getDefaultMindmapXml(title);
|
||||||
mindmap.setNativeXml(defaultNativeMap);
|
mindmap.setNativeXml(defaultNativeMap);
|
||||||
|
|
||||||
final MindMapNative nativeBrowser = new MindMapNative();
|
|
||||||
mindmap.setNativeBrowser(nativeBrowser);
|
|
||||||
final User dbUSer = getUserService().getUserBy(user.getId());
|
final User dbUSer = getUserService().getUserBy(user.getId());
|
||||||
|
|
||||||
service.addMindmap(mindmap, dbUSer);
|
service.addMindmap(mindmap, dbUSer);
|
||||||
|
@ -32,7 +32,6 @@ import java.util.Calendar;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.MindMapNative;
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
@ -50,22 +49,12 @@ public class MapEditorService
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResponseMessage saveMap(final int mapId, final String nativeXml,
|
public ResponseMessage saveMap(final int mapId, final String nativeXml,
|
||||||
String chartXml, final String editorProperties,boolean saveHistory)
|
final String editorProperties,boolean saveHistory)
|
||||||
throws IOException, WiseMappingException {
|
throws IOException, WiseMappingException {
|
||||||
final MindmapService serservice = getMindmapService();
|
final MindmapService serservice = getMindmapService();
|
||||||
final MindMap mindMap = serservice.getMindmapById(mapId);
|
final MindMap mindMap = serservice.getMindmapById(mapId);
|
||||||
final User user = this.getUser();
|
final User user = this.getUser();
|
||||||
|
|
||||||
MindMapNative nativeBrowser = mindMap.getNativeBrowser();
|
|
||||||
|
|
||||||
if (nativeBrowser == null) {
|
|
||||||
nativeBrowser = new MindMapNative();
|
|
||||||
}
|
|
||||||
|
|
||||||
nativeBrowser.setSvgXml(chartXml);
|
|
||||||
nativeBrowser.setVmlXml((byte[]) null);
|
|
||||||
|
|
||||||
mindMap.setNativeBrowser(nativeBrowser);
|
|
||||||
mindMap.setProperties(editorProperties);
|
mindMap.setProperties(editorProperties);
|
||||||
|
|
||||||
final Calendar now = Calendar.getInstance();
|
final Calendar now = Calendar.getInstance();
|
||||||
|
@ -23,7 +23,6 @@ import com.wisemapping.importer.Importer;
|
|||||||
import com.wisemapping.importer.ImporterException;
|
import com.wisemapping.importer.ImporterException;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.ShapeStyle;
|
import com.wisemapping.model.ShapeStyle;
|
||||||
import com.wisemapping.model.MindMapNative;
|
|
||||||
import com.wisemapping.util.JAXBUtils;
|
import com.wisemapping.util.JAXBUtils;
|
||||||
import com.wisemapping.xml.freemind.*;
|
import com.wisemapping.xml.freemind.*;
|
||||||
import com.wisemapping.xml.freemind.Map;
|
import com.wisemapping.xml.freemind.Map;
|
||||||
@ -93,7 +92,6 @@ public class FreemindImporter
|
|||||||
map.setNativeXml(new String(out.toByteArray(), Charset.forName("UTF-8")));
|
map.setNativeXml(new String(out.toByteArray(), Charset.forName("UTF-8")));
|
||||||
map.setTitle(mapName);
|
map.setTitle(mapName);
|
||||||
map.setDescription(description);
|
map.setDescription(description);
|
||||||
map.setNativeBrowser(new MindMapNative());
|
|
||||||
|
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
throw new ImporterException(e);
|
throw new ImporterException(e);
|
||||||
|
@ -64,7 +64,7 @@ public class MindMap {
|
|||||||
private String lastModifierUser;
|
private String lastModifierUser;
|
||||||
|
|
||||||
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
||||||
private MindMapNative nativeBrowser;
|
private MindMapNative nativeBrowser = new MindMapNative();
|
||||||
private User owner;
|
private User owner;
|
||||||
private String properties;
|
private String properties;
|
||||||
private String tags;
|
private String tags;
|
||||||
@ -218,38 +218,15 @@ public class MindMap {
|
|||||||
public char[] generateSvgXml(String mapSvg)
|
public char[] generateSvgXml(String mapSvg)
|
||||||
throws IOException, JAXBException {
|
throws IOException, JAXBException {
|
||||||
String svgText = mapSvg;
|
String svgText = mapSvg;
|
||||||
final MindMapNative mindmapNativeBrowser = this.getNativeBrowser();
|
|
||||||
if(svgText==null){
|
|
||||||
svgText = mindmapNativeBrowser.getUnzippedSvgXml();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (svgText == null || svgText.length() == 0) {
|
|
||||||
// The map must be saved using IE. Convert VML to SVG.
|
|
||||||
|
|
||||||
// Add namespace to the converter ...
|
String result = "<?xml version='1.0' encoding='UTF-8'?>\n" + svgText;
|
||||||
String vmlXml = mindmapNativeBrowser.getUnzippedVmlXml();
|
|
||||||
vmlXml = vmlXml.replaceFirst("<v:group ", "<v:group xmlns:v=\"http://wisemapping.com/xml/vmlmap\" ");
|
|
||||||
|
|
||||||
char[] bytes = vmlXml.toCharArray();
|
// Add namespace...
|
||||||
final CharArrayReader is = new CharArrayReader(bytes);
|
result = result.replaceFirst("<svg ", "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" ");
|
||||||
|
|
||||||
// Convert Map ...
|
|
||||||
final VmlToSvgConverter converter = new VmlToSvgConverter();
|
|
||||||
converter.convert(is);
|
|
||||||
|
|
||||||
final CharArrayWriter os = new CharArrayWriter();
|
|
||||||
converter.toXml(os);
|
|
||||||
|
|
||||||
return os.toCharArray();
|
|
||||||
} else {
|
|
||||||
String result = "<?xml version='1.0' encoding='UTF-8'?>\n" + svgText;
|
|
||||||
|
|
||||||
// Add namespace...
|
|
||||||
result = result.replaceFirst("<svg ", "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" ");
|
|
||||||
// result = result.replaceAll("<image([^>]+)>", "<image$1/>");
|
// result = result.replaceAll("<image([^>]+)>", "<image$1/>");
|
||||||
|
|
||||||
return result.toCharArray();
|
return result.toCharArray();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
@ -229,12 +229,6 @@ public class MindmapServiceImpl
|
|||||||
welcomeMap.setDescription(savedWelcome.getDescription());
|
welcomeMap.setDescription(savedWelcome.getDescription());
|
||||||
welcomeMap.setXml(savedWelcome.getXml());
|
welcomeMap.setXml(savedWelcome.getXml());
|
||||||
|
|
||||||
final MindMapNative mindmapNative = new MindMapNative();
|
|
||||||
mindmapNative.setSvgXml(savedWelcome.getNativeBrowser().getSvgXml());
|
|
||||||
mindmapNative.setVmlXml(savedWelcome.getNativeBrowser().getVmlXml());
|
|
||||||
|
|
||||||
welcomeMap.setNativeBrowser(mindmapNative);
|
|
||||||
|
|
||||||
addMindmap(welcomeMap, user);
|
addMindmap(welcomeMap, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,3 +329,5 @@ INSTALL_CFG_BROWSERS=This plug in is not necessary for Internet Explorer 9, or a
|
|||||||
INSTALL_CFG_CLICK_HERE=To download click here
|
INSTALL_CFG_CLICK_HERE=To download click here
|
||||||
|
|
||||||
INVALID_EMAIL_ERROR = The e-mail was not verified
|
INVALID_EMAIL_ERROR = The e-mail was not verified
|
||||||
|
BROWSER_NOT_SUPPOERTED= Current Browser is not supported.
|
||||||
|
CHECK_BROWSERS= You can check supported browser at
|
@ -10,6 +10,7 @@
|
|||||||
<definition name="mindmapList" page="/jsp/mindmapList.jsp"/>
|
<definition name="mindmapList" page="/jsp/mindmapList.jsp"/>
|
||||||
<definition name="embeddedView" page="/jsp/embeddedView.jsp"/>
|
<definition name="embeddedView" page="/jsp/embeddedView.jsp"/>
|
||||||
<definition name="embeddedViewImg" page="/jsp/embeddedViewImg.jsp"/>
|
<definition name="embeddedViewImg" page="/jsp/embeddedViewImg.jsp"/>
|
||||||
|
<definition name="embeddedViewNotSupported" page="/jsp/embeddedViewNotSupported.jsp"/>
|
||||||
<definition name="mindmapEditor" page="/jsp/mindmapEditor.jsp"/>
|
<definition name="mindmapEditor" page="/jsp/mindmapEditor.jsp"/>
|
||||||
<definition name="mindmapCooker" page="/jsp/mindmapCooker.jsp"/>
|
<definition name="mindmapCooker" page="/jsp/mindmapCooker.jsp"/>
|
||||||
<definition name="closeDialog" page="/jsp/closeDialog.jsp"/>
|
<definition name="closeDialog" page="/jsp/closeDialog.jsp"/>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div id="mapContainer">
|
<div id="mapContainer">
|
||||||
<div id='mindplot'
|
<div id='mindplot'
|
||||||
style='background: url( ../images/grid.gif ) bottom left repeat !important;overflow:hidden;width:100%;height:100%;'>
|
style='background: url( ../images/grid.gif ) bottom left repeat !important;overflow:hidden;width:100%;height:100%;'>
|
||||||
<div style="100%;height:100%;background: url( ${exportImgUrl} );background-position: 0px -100px;background-repeat: no-repeat;"></div>
|
<div style="width:100%;height:100%;background: url( ${exportImgUrl} );background-position: 0px -100px;background-repeat: no-repeat;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="embFooter">
|
<div id="embFooter">
|
||||||
<a href="${pageContext.request.contextPath}/c/home.htm" target="new">
|
<a href="${pageContext.request.contextPath}/c/home.htm" target="new">
|
||||||
|
18
wise-webapp/src/main/webapp/jsp/embeddedViewNotSupported.jsp
Normal file
18
wise-webapp/src/main/webapp/jsp/embeddedViewNotSupported.jsp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
|
||||||
|
<%@ include file="/jsp/init.jsp" %>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-type" value="text/html; charset=utf-8">
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/embedded.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="mapContainer">
|
||||||
|
<spring:message code="BROWSER_NOT_SUPPOERTED"/>
|
||||||
|
<spring:message code="CHECK_BROWSERS"/><a href="www.wisemapping.com">www.wisemapping.com</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -6,7 +6,6 @@ import com.wisemapping.exporter.ExportProperties;
|
|||||||
import com.wisemapping.importer.ImporterException;
|
import com.wisemapping.importer.ImporterException;
|
||||||
|
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.MindMapNative;
|
|
||||||
import org.apache.batik.transcoder.TranscoderException;
|
import org.apache.batik.transcoder.TranscoderException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
@ -47,9 +46,6 @@ public class ExportTest {
|
|||||||
|
|
||||||
// Write content ...
|
// Write content ...
|
||||||
MindMap mindMap = new MindMap();
|
MindMap mindMap = new MindMap();
|
||||||
MindMapNative nativeBrowser = new MindMapNative();
|
|
||||||
nativeBrowser.setSvgXml(svgXml);
|
|
||||||
mindMap.setNativeBrowser(nativeBrowser);
|
|
||||||
|
|
||||||
if(pngFile.exists()){
|
if(pngFile.exists()){
|
||||||
// Export mile content ...
|
// Export mile content ...
|
||||||
|
Loading…
Reference in New Issue
Block a user