removing svg from save operation

This commit is contained in:
Pablo Luna 2011-03-31 15:16:45 +01:00
parent 6cc4d2eaff
commit c4021bf3c4
13 changed files with 32 additions and 63 deletions

View File

@ -352,9 +352,8 @@ mindplot.MindmapDesigner.prototype.save = function(onSavedHandler, saveHistory)
var persistantManager = mindplot.PersistanceManager;
var mindmap = this._mindmap;
var xmlChart = this._workspace.dumpNativeChart();
var properties = {zoom:this._zoom};
persistantManager.save(mindmap, xmlChart, properties, onSavedHandler, saveHistory);
persistantManager.save(mindmap, properties, onSavedHandler, saveHistory);
this._fireEvent("save", {type:saveHistory});
// Refresh undo state...

View File

@ -18,10 +18,9 @@
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(xmlChart, "xmlChart can not be null");
core.assert(editorProperties, "editorProperties can not be null");
var mapId = mindmap.getId();
@ -31,7 +30,7 @@ mindplot.PersistanceManager.save = function(mindmap, xmlChart, editorProperties,
var xmlMapStr = core.Utils.innerXML(xmlMap);
var pref = Json.toString(editorProperties);
window.MapEditorService.saveMap(mapId, xmlMapStr, xmlChart, pref,saveHistory,
window.MapEditorService.saveMap(mapId, xmlMapStr, pref,saveHistory,
{
callback:function(response) {

View File

@ -64,8 +64,7 @@ public class EmbeddedViewController extends BaseMultiActionController {
} else {
view = new ModelAndView("embeddedViewImg");
view.addObject("mindmap", mindmap);
view = new ModelAndView("embeddedViewNotSupported");
}
view.addObject("fullView", fullView);

View File

@ -20,7 +20,6 @@ package com.wisemapping.controller;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.MindMapNative;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.MindmapService;
@ -55,8 +54,6 @@ public class NewMindmapController
final String defaultNativeMap = getDefaultMindmapXml(title);
mindmap.setNativeXml(defaultNativeMap);
final MindMapNative nativeBrowser = new MindMapNative();
mindmap.setNativeBrowser(nativeBrowser);
final User dbUSer = getUserService().getUserBy(user.getId());
service.addMindmap(mindmap, dbUSer);

View File

@ -32,7 +32,6 @@ import java.util.Calendar;
import java.util.Date;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.MindMapNative;
import com.wisemapping.model.User;
import com.wisemapping.service.MindmapService;
import com.wisemapping.exceptions.WiseMappingException;
@ -50,22 +49,12 @@ public class MapEditorService
}
public ResponseMessage saveMap(final int mapId, final String nativeXml,
String chartXml, final String editorProperties,boolean saveHistory)
final String editorProperties,boolean saveHistory)
throws IOException, WiseMappingException {
final MindmapService serservice = getMindmapService();
final MindMap mindMap = serservice.getMindmapById(mapId);
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);
final Calendar now = Calendar.getInstance();

View File

@ -23,7 +23,6 @@ import com.wisemapping.importer.Importer;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.ShapeStyle;
import com.wisemapping.model.MindMapNative;
import com.wisemapping.util.JAXBUtils;
import com.wisemapping.xml.freemind.*;
import com.wisemapping.xml.freemind.Map;
@ -93,7 +92,6 @@ public class FreemindImporter
map.setNativeXml(new String(out.toByteArray(), Charset.forName("UTF-8")));
map.setTitle(mapName);
map.setDescription(description);
map.setNativeBrowser(new MindMapNative());
} catch (JAXBException e) {
throw new ImporterException(e);

View File

@ -64,7 +64,7 @@ public class MindMap {
private String lastModifierUser;
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
private MindMapNative nativeBrowser;
private MindMapNative nativeBrowser = new MindMapNative();
private User owner;
private String properties;
private String tags;
@ -218,30 +218,8 @@ public class MindMap {
public char[] generateSvgXml(String mapSvg)
throws IOException, JAXBException {
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 vmlXml = mindmapNativeBrowser.getUnzippedVmlXml();
vmlXml = vmlXml.replaceFirst("<v:group ", "<v:group xmlns:v=\"http://wisemapping.com/xml/vmlmap\" ");
char[] bytes = vmlXml.toCharArray();
final CharArrayReader is = new CharArrayReader(bytes);
// 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...
@ -250,7 +228,6 @@ public class MindMap {
return result.toCharArray();
}
}
public String getDescription() {
return description;

View File

@ -229,12 +229,6 @@ public class MindmapServiceImpl
welcomeMap.setDescription(savedWelcome.getDescription());
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);
}
}

View File

@ -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
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

View File

@ -10,6 +10,7 @@
<definition name="mindmapList" page="/jsp/mindmapList.jsp"/>
<definition name="embeddedView" page="/jsp/embeddedView.jsp"/>
<definition name="embeddedViewImg" page="/jsp/embeddedViewImg.jsp"/>
<definition name="embeddedViewNotSupported" page="/jsp/embeddedViewNotSupported.jsp"/>
<definition name="mindmapEditor" page="/jsp/mindmapEditor.jsp"/>
<definition name="mindmapCooker" page="/jsp/mindmapCooker.jsp"/>
<definition name="closeDialog" page="/jsp/closeDialog.jsp"/>

View File

@ -17,7 +17,7 @@
<div id="mapContainer">
<div id='mindplot'
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 id="embFooter">
<a href="${pageContext.request.contextPath}/c/home.htm" target="new">

View 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>

View File

@ -6,7 +6,6 @@ import com.wisemapping.exporter.ExportProperties;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.MindMapNative;
import org.apache.batik.transcoder.TranscoderException;
import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
@ -47,9 +46,6 @@ public class ExportTest {
// Write content ...
MindMap mindMap = new MindMap();
MindMapNative nativeBrowser = new MindMapNative();
nativeBrowser.setSvgXml(svgXml);
mindMap.setNativeBrowser(nativeBrowser);
if(pngFile.exists()){
// Export mile content ...