Add zoom support for embedded maps.

Add new url to embedded maps
This commit is contained in:
Paulo Gustavo Veiga
2012-06-03 20:23:31 -03:00
parent 3907e04ff6
commit 88b0efa859
20 changed files with 134 additions and 277 deletions

View File

@@ -1,106 +0,0 @@
<!DOCTYPE HTML>
<%@ include file="/jsp/init.jsp" %>
<html>
<head>
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<![endif]-->
<title><spring:message code="SITE.TITLE"/> - ${mindmap.title} </title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../css/embedded.css"/>
<script type='text/javascript' src='../js/mootools-core.js'></script>
<script type='text/javascript' src='../js/mootools-more.js'></script>
<script type='text/javascript' src='../js/core.js'></script>
<script type="text/javascript">
var mapId = '${mindmap.id}';
var mapXml = '${mapXml}';
var mindReady = false;
$(document).addEvent('loadcomplete', function(resource) {
mindReady = resource == 'mind' ? true : mindReady;
if (mindReady) {
var editorProperties = {zoom:${zoom},saveOnLoad:true,collab:'standalone',readOnly:true};
designer = buildDesigner(editorProperties);
var parser = new DOMParser();
var domDocument = parser.parseFromString(mapXml, "text/xml");
var serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromDocument(domDocument);
var mindmap = serializer.loadFromDom(domDocument, mapId);
// Now, load the map ...
designer.loadMap(mindmap);
// If not problem has arisen, close the dialog ...
if (!window.hasUnexpectedErrors) {
waitDialog.deactivate();
}
$('zoomIn').addEvent('click', function() {
designer.zoomIn();
});
$('zoomOut').addEvent('click', function() {
designer.zoomOut();
});
}
});
</script>
</head>
<body>
<div id="waitDialog" style="display:none">
<div id="waitingContainer">
<div class="loadingIcon"></div>
<div class="loadingText">
Loading ...
</div>
</div>
</div>
<div id="errorDialog" style="display:none">
<div id="errorContainer">
<div class="loadingIcon"></div>
<div class="loadingText">
Unexpected error loading your map :(
</div>
</div>
</div>
<script type="text/javascript">
var waitDialog = new core.WaitDialog();
waitDialog.activate(true, $("waitDialog"));
$(window).addEvent("error", function(event) {
// Show error dialog ...
waitDialog.changeContent($("errorDialog"), false);
return false;
});
</script>
<div id="mapContainer">
<div id="mindplot"></div>
<div id="embFooter">
<a href="${pageContext.request.contextPath}/c/home" target="new">
<div id="logo"></div>
</a>
<div id="zoomIn" class="button"></div>
<div id="zoomOut" class="button"></div>
<div id="mapDetails">
<%--<span class="title"><spring:message code="CREATOR"/>:</span><span>${mindmap.creator}</span>--%>
<span class="title"><spring:message code="DESCRIPTION"/>:</span><span>${mindmap.title}</span>
</div>
</div>
</div>
<script type="text/javascript" src="../js/editor.js"></script>
</body>
</html>

View File

@@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<%@ include file="/jsp/init.jsp" %>
<html>
<head>
<title>
<spring:message code="NO_ENOUGH_PERMISSIONS"/>
</title>
<meta http-equiv="Content-type" value="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../css/embedded.css">
<link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon">
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="../css/wisehomeOldIE.css"/>
<![endif]-->
</head>
<body>
<div class="pageBodyContent" style="padding:40px;padding-top:100px;">
<h1>
<spring:message code="NO_ENOUGH_PERMISSIONS"/>
</h1>
<p>
<spring:message code="NO_ENOUGH_PERMISSIONS_DETAILS"/>
</p>
</div>
<div id="embFooter">
<a href="${pageContext.request.contextPath}/c/home" target="new">
<div id="logo"></div>
</a>
</div>
</body>
</html>

View File

@@ -1,18 +0,0 @@
<!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

@@ -17,7 +17,7 @@
<li><strong><spring:message code="CREATION_TIME"/>:</strong> ${wisemapDetail.creationTime}</li>
<li><strong><spring:message code="LAST_UPDATE"/>:</strong> ${wisemapDetail.lastEditTime}</li>
<li><strong><spring:message code="LAST_UPDATE_BY"/>:</strong> ${wisemapDetail.lastEditor}</li>
<li><strong> <spring:message code="TAGS"/>:</strong> ${wisemapDetail.tags}</li>
<li><strong> <spring:message code="STARRED"/>:</strong> ${wisemapDetail.starred}</li>
</ul>
</div>
<div class="tab-pane fade" id="collaborators">

View File

@@ -6,10 +6,6 @@
<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%>
<%@ include file="/jsp/init.jsp" %>
<c:url value="maps/" var="shareMap">
<c:param name="action" value="collaborator"/>
<c:param name="userEmail" value="${pageContext.request.userPrincipal.name}"/>
</c:url>
<html>
<head>
<base href="../../../"/>
@@ -60,12 +56,6 @@
<body>
<div id="actionsContainer"></div>
<div>
<c:url value="maps/" var="shareMap">
<c:param name="action" value="collaborator"/>
<c:param name="userEmail" value="${pageContext.request.userPrincipal.name}"/>
</c:url>
</div>
<div id="header">
<div id="headerInfo">

View File

@@ -0,0 +1,93 @@
<!DOCTYPE HTML>
<%--@elvariable id="mindmap" type="com.wisemapping.model.MindMap"--%>
<%--@elvariable id="editorTryMode" type="java.lang.Boolean"--%>
<%--@elvariable id="editorTryMode" type="java.lang.String"--%>
<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Calendar" %>
<%@ include file="/jsp/init.jsp" %>
<html>
<head>
<base href="${pageContext.request.contextPath}/"/>
<title><spring:message code="SITE.TITLE"/> - ${mindmap.title} </title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<![endif]-->
<link rel="stylesheet/less" type="text/css" href="css/embedded.less"/>
<script type='text/javascript' src='js/mootools-core.js'></script>
<script type='text/javascript' src='js/mootools-more.js'></script>
<script type='text/javascript' src='js/core.js'></script>
<script type='text/javascript' src='js/less.js'></script>
<script type="text/javascript">
var mapId = '${mindmap.id}';
var mapXml = '${mindmap.xmlAsJsLiteral}';
$(document).addEvent('loadcomplete', function(resource) {
// Configure designer options ...
var options = loadDesignerOptions();
options.size.height = options.size.height + 50;
options.persistenceManager = new mindplot.RESTPersistenceManager("service/maps/");
var userOptions = ${mindmap.properties};
options.zoom = ${zoom};
// Set map id ...
options.mapId = mapId;
// Print is read only ...
options.readOnly = true;
// Build designer ...
var designer = buildDesigner(options);
// Load map from XML ...
var parser = new DOMParser();
var domDocument = parser.parseFromString(mapXml, "text/xml");
var persistence = mindplot.PersistenceManager.getInstance();
var mindmap = persistence.loadFromDom(mapId, domDocument);
designer.loadMap(mindmap);
$('zoomIn').addEvent('click', function() {
designer.zoomIn();
});
$('zoomOut').addEvent('click', function() {
designer.zoomOut();
});
});
</script>
</head>
<body>
<div id="mapContainer">
<div id="mindplot"></div>
<div id="embFooter">
<a href="${pageContext.request.contextPath}/c/home" target="new">
<div id="footerLogo"></div>
</a>
<div id="zoomIn" class="button"></div>
<div id="zoomOut" class="button"></div>
<div id="mapDetails">
<span class="title"><spring:message code="CREATOR"/>:</span><span>${mindmap.creator}</span>
<span class="title"><spring:message code="DESCRIPTION"/>:</span><span>${mindmap.title}</span>
</div>
</div>
</div>
<script type="text/javascript" src="../js/editor.js"></script>
</body>
</html>

View File

@@ -22,7 +22,8 @@
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<![endif]-->
<link rel="stylesheet" type="text/css" href="css/embedded.less"/>
<link rel="stylesheet/less" type="text/css" href="css/embedded.less"/>
<style type="text/css" media="print">
@page {
size: A4 landscape;
@@ -59,6 +60,7 @@
<script type='text/javascript' src='js/mootools-core.js'></script>
<script type='text/javascript' src='js/mootools-more.js'></script>
<script type='text/javascript' src='js/core.js'></script>
<script type='text/javascript' src='js/less.js'></script>
<link rel="icon" href="images/favicon.ico" type="image/x-icon">

View File

@@ -45,12 +45,12 @@
</div>
<label><spring:message code="BLOG_SNIPPET"/></label>
<pre id="embedCode">&lt;iframe style="width:600px;height:400px;border: 1px
solid black" src="http://www.wisemapping.com/c/embeddedView?mapId=${mindmap.id}&zoom=1"&gt; &lt;/iframe&gt;</pre>
solid black" src="http://www.wisemapping.com/c/maps/${mindmap.id}/embed?zoom=1"&gt; &lt;/iframe&gt;</pre>
</div>
<div class="tab-pane fade" id="publicUrlTab">
<spring:message code="URL"/>:
<input name="url" value="http://www.wisemapping.com/c/publicView?mapId=${mindmap.id}"
<input name="url" value="???"
style="width:400px"
readonly="readonly"/>
</div>