Add publish map on editor.

This commit is contained in:
Paulo Gustavo Veiga
2012-05-27 18:15:46 -03:00
parent 2b4953ea11
commit 5d1399017f
27 changed files with 343 additions and 335 deletions

View File

@@ -1,22 +1,24 @@
<%@ include file="/jsp/init.jsp" %>
<style type="text/css">
#wizardContainer input {
width: 50px;
height: 25px;
display: inline-block;
}
</style>
<form method="post" id="publishForm" action="#" class="form-horizontal">
<fieldset>
<div class="control-group">
<label for="enablePublicView" class="control-label">Enable Sharing:
<input type="checkbox" id="enablePublicView" name="publicView" class="control"
<c:if test="${mindmap.public}">
checked="checked"
</c:if>/>
</label>
</div>
</fieldset>
<form method="post" id="dialogMainForm" action="#" class="well form-inline">
<label for="enablePublicView" class="control-label">Enable Sharing:
<input type="checkbox" id="enablePublicView" name="publicView"
<c:if test="${mindmap.public}">
checked="checked"
</c:if> />
</label>
</form>
<p><span class="label label-important">Warning</span> <spring:message code="PUBLISH_DETAILS"/></p>
<div id="sharingPanel">
<div id="publishPanel">
<ul class="nav nav-tabs">
<li class="active"><a href="#embedTab" data-toggle="pill">Embed</a></li>
@@ -25,23 +27,22 @@
<div class="tab-content">
<div class="tab-pane fade active in" id="embedTab">
<spring:message code="BLOG_INCLUSION"/>
<form class="form-inline" action="#" style="text-align: center">
<fieldset>
<div id="wizardContainer">
<form class="form-inline" action="#">
<label for="frameWith">Frame width:</label>
<input type="number" id="frameWith" name="frameWith" value="600" class="span1" min="0"/>
<input type="number" id="frameWith" name="frameWith" value="600" class="span2"
min="0"/>
<label for="frameHeight" class="control-label">Frame height:</label>
<input type="number" id="frameHeight" name="frameHeight" value="400" class="span1" min="0"/>
<label for="frameHeight">Frame height:</label>
<input type="number" id="frameHeight" name="frameHeight" value="400" class="span2" min="0"/>
<label for="mapZoom">Zoom %:</label>
<input type="number" id="mapZoom" name="mapZoom" value="80" class="span1" min="10"
max="200" step="10"/>
</fieldset>
</form>
<input type="number" id="mapZoom"
name="mapZoom" value="80"
class="span2" min="10" max="200" step="10"/>
</form>
</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.htm?mapId=${mindmap.id}&zoom=1"&gt; &lt;/iframe&gt;</pre>
@@ -58,9 +59,9 @@ solid black" src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${mindmap.
<script type="text/javascript">
// Update tabs display status ...
var checkboxElems = $('#publishForm input:checkbox');
var checkboxElems = $('#dialogMainForm input:checkbox');
var updateTabsDisplay = function() {
var divElem = $('#sharingPanel');
var divElem = $('#publishPanel');
checkboxElems[0].checked ? divElem.show() : divElem.hide();
};
checkboxElems.change(updateTabsDisplay);
@@ -68,7 +69,7 @@ solid black" src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${mindmap.
// Change snippet code based on the user options ...
var replaceCode = function(regExpr, strReplace, factor) {
var preElem = $('#sharingPanel #embedCode')[0];
var preElem = $('#publishPanel #embedCode')[0];
var fieldValue = this.value;
if (!isNaN(fieldValue) && fieldValue.length > 0) {
var textVal = $(preElem).text().replace(regExpr, strReplace.replace('%s', fieldValue * factor));
@@ -76,37 +77,37 @@ solid black" src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${mindmap.
}
};
$('#sharingPanel #frameWith').keyup(function() {
$('#publishPanel #frameWith').keyup(function() {
replaceCode.bind(this)(/width:[0-9]+px/g, "width:%spx", 1);
});
$('#sharingPanel #frameWith').change(function() {
$('#publishPanel #frameWith').change(function() {
replaceCode.bind(this)(/width:[0-9]+px/g, "width:%spx", 1);
});
$('#sharingPanel #frameHeight').keyup(function() {
$('#publishPanel #frameHeight').keyup(function() {
replaceCode.bind(this)(/height:[0-9]+px/g, "height:%spx", 1);
});
$('#sharingPanel #frameHeight').change(function() {
$('#publishPanel #frameHeight').change(function() {
replaceCode.bind(this)(/height:[0-9]+px/g, "height:%spx", 1);
});
$('#sharingPanel #mapZoom').keyup(function() {
$('#publishPanel #mapZoom').keyup(function() {
replaceCode.bind(this)(/zoom=.+\"/g, "zoom=%s\"", 0.1);
});
$('#sharingPanel #mapZoom').change(function() {
$('#publishPanel #mapZoom').change(function() {
replaceCode.bind(this)(/zoom=.+\"/g, "zoom=%s\"", 0.01);
});
// Save status on click ...
$('#publishForm').submit(function(event) {
$('#dialogMainForm').submit(function(event) {
jQuery.ajax("service/maps/${mindmap.id}/publish", {
async:false,
dataType: 'json',
data: $('#publishForm #enablePublicView')[0].checked ? 'true' : 'false',
data: $('#dialogMainForm #enablePublicView')[0].checked ? 'true' : 'false',
type: 'PUT',
contentType:"text/plain",
success : function(data, textStatus, jqXHR) {
@@ -119,5 +120,9 @@ solid black" src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${mindmap.
event.preventDefault();
});
// Hook for interaction with the main parent window ...
var submitDialogForm = function() {
$('#dialogMainForm').submit();
}
</script>