Firt version of publish dialog.

This commit is contained in:
Paulo Gustavo Veiga 2012-05-20 21:46:55 -03:00
parent 93da41dcf5
commit fdc4a20667
13 changed files with 223 additions and 273 deletions

View File

@ -1,69 +0,0 @@
/*
* 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.controller;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MindmapPublishController extends BaseMultiActionController {
protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
final MindMap mindmap = this.getMindmapFromRequest(httpServletRequest);
if (mindmap == null) {
throw new IllegalStateException("Map could not be found");
}
return new ModelAndView("mindmapPublish", "mindmap", mindmap);
}
public ModelAndView save(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws WiseMappingException {
final MindMap mindmap = this.getMindmapFromRequest(httpServletRequest);
if (mindmap == null) {
throw new IllegalStateException("Map could not be found");
}
User user = Utils.getUser();
if (!mindmap.getOwner().equals(user)) {
throw new IllegalStateException("No enought right to execute this operation");
}
final String publicViewStr = httpServletRequest.getParameter("publicView");
boolean publicView = Boolean.valueOf(publicViewStr);
if (mindmap.isPublic() != publicView) {
mindmap.setPublic(publicView);
getMindmapService().updateMindmap(mindmap, false);
}
return new ModelAndView("closeDialog");
}
}

View File

@ -49,9 +49,16 @@ public class MindmapController {
return view; return view;
} }
@RequestMapping(value = "map/{id}/publish")
public ModelAndView showPublishPage(@PathVariable int id) {
final MindMap mindmap = findMindmap(id);
final ModelAndView view = new ModelAndView("mindmapPublish", "mindmap", mindmap);
view.addObject("user", Utils.getUser());
return view;
}
@RequestMapping(value = "map/{id}/edit") @RequestMapping(value = "map/{id}/edit")
public ModelAndView editMap(@PathVariable int id, @NotNull HttpServletRequest request) public ModelAndView editMap(@PathVariable int id, @NotNull HttpServletRequest request) {
{
ModelAndView view; ModelAndView view;
final UserAgent userAgent = UserAgent.create(request); final UserAgent userAgent = UserAgent.create(request);
if (userAgent.needsGCF()) { if (userAgent.needsGCF()) {

View File

@ -110,10 +110,26 @@ public class MindmapController extends BaseController {
updateMindmap(true, mindMap, user); updateMindmap(true, mindMap, user);
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json", "text/html", "application/xml"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void changeMapPublish(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
final MindMap mindMap = mindmapService.getMindmapById(id);
final User user = Utils.getUser();
if (!mindMap.getOwner().equals(user)) {
throw new IllegalArgumentException("No enough to execute this operation");
}
// Update map status ...
mindMap.setPublic(Boolean.parseBoolean(value));
updateMindmap(true, mindMap, user);
}
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}") @RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}")
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateMap(@PathVariable int id) throws IOException, WiseMappingException { public void updateMap( @PathVariable int id) throws IOException, WiseMappingException {
final User user = Utils.getUser(); final User user = Utils.getUser();
final MindMap mindmap = mindmapService.getMindmapById(id); final MindMap mindmap = mindmapService.getMindmapById(id);
mindmapService.removeMindmap(mindmap, user); mindmapService.removeMindmap(mindmap, user);
@ -187,7 +203,7 @@ public class MindmapController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"}) @RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"})
@ResponseStatus(value = HttpStatus.CREATED) @ResponseStatus(value = HttpStatus.CREATED)
public void copyMap(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException { public void copyMap(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
// Validate ... // Validate ...
final BindingResult result = new BeanPropertyBindingResult(restMindmap, ""); final BindingResult result = new BeanPropertyBindingResult(restMindmap, "");
new MapInfoValidator(mindmapService).validate(restMindmap.getDelegated(), result); new MapInfoValidator(mindmapService).validate(restMindmap.getDelegated(), result);
if (result.hasErrors()) { if (result.hasErrors()) {

View File

@ -70,6 +70,15 @@ public class RestMindmapInfo {
return mindmap.getCreator(); return mindmap.getCreator();
} }
public String getOwnerEmail() {
return mindmap.getOwner().getEmail();
}
public String getOwner() {
final User owner = mindmap.getOwner();
return owner.getUsername();
}
public String getLastModifierUser() { public String getLastModifierUser() {
return mindmap.getLastModifierUser(); return mindmap.getLastModifierUser();
} }
@ -109,6 +118,12 @@ public class RestMindmapInfo {
public void setLastModifierUser(String value) { public void setLastModifierUser(String value) {
} }
public void setOwnerEmail(String value) {
}
public void setOwner(String value) {
}
@JsonIgnore @JsonIgnore
public MindMap getDelegated() { public MindMap getDelegated() {
return this.mindmap; return this.mindmap;

View File

@ -1,7 +1,7 @@
log4j.rootLogger=WARN, stdout, R log4j.rootLogger=WARN, stdout, R
log4j.logger.com.wisemapping=WARN,stdout,R log4j.logger.com.wisemapping=WARN,stdout,R
log4j.logger.org.springframework=DEBUG,stdout,R log4j.logger.org.springframework=WARN,stdout,R
log4j.logger.org.codehaus.jackson=DEBUG,stdout,R log4j.logger.org.codehaus.jackson=WARN,stdout,R
# Stdout logger <20> # Stdout logger <20>
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout=org.apache.log4j.ConsoleAppender

View File

@ -115,8 +115,8 @@ VIEWER=Viewer
PRIVATE=Private PRIVATE=Private
PUBLIC=Public PUBLIC=Public
SHARED=Shared SHARED=Shared
ONLY_VIEW_PRIVATE = This document can be viewed by you only. ONLY_VIEW_PRIVATE = This mindmap can be viewed by you only.
ALL_VIEW_PUBLIC = This document can be viewed by any user. ALL_VIEW_PUBLIC = This mindmap can be viewed by any user.
EMAILS_ADRESSES = E-mails Addresses EMAILS_ADRESSES = E-mails Addresses
CURRENT_CONTACTS = Current Contacts CURRENT_CONTACTS = Current Contacts
@ -128,7 +128,7 @@ NEW_MAP_MSG=Fill all the fields to create a new map
TAG=Tag TAG=Tag
PUBLISH=Publish PUBLISH=Publish
PUBLISH_MSG = What about using your maps in sites and blogs? PUBLISH_MSG = What about using your maps in sites and blogs?
PUBLISH_DETAILS=By publishing the map you make it visible to everyone on the Internet. Copy the code snippets below to integrate it into your website or blog. PUBLISH_DETAILS=By publishing the map you make it visible to everyone on the Internet.
DETAIL=Detail DETAIL=Detail
RECENT_FILES=Recent Maps RECENT_FILES=Recent Maps
MINDMAP_DETAIL = Mind Map Detail MINDMAP_DETAIL = Mind Map Detail
@ -180,7 +180,8 @@ MAX_CHARACTER_SIZE= Maximum allowed message length of 512 characters.
PUBLISH_MAP_TO_INTERNET=Publish map to the Internet PUBLISH_MAP_TO_INTERNET=Publish map to the Internet
URL=URL URL=URL
DIRECT_LINK=Direct Link DIRECT_LINK=Direct Link
BLOG_INCLUSION=For inclusion in blogs and web pages BLOG_INCLUSION=You can customize the code snippet to embed this map on your blog or website. Make sure you enter the correct dimensions of the content area of your blog so that the map fits nicely
BLOG_SNIPPET=Copy this snippet of code to embed in your blog or page
OPEN=Open OPEN=Open
OPEN_MSG=Open map for edition OPEN_MSG=Open map for edition
@ -303,3 +304,5 @@ BROWSER_NOT_SUPPOERTED= Current Browser is not supported.
CHECK_BROWSERS= You can check supported browser at CHECK_BROWSERS= You can check supported browser at
NO_PRODUCTION_DATABASE_CONFIGURED=Note: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.5 instead. You can find more information how to configure MySQL NO_PRODUCTION_DATABASE_CONFIGURED=Note: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.5 instead. You can find more information how to configure MySQL
IMPORT=Import IMPORT=Import
EMBEDDED_MAP_SIZE=* Note: You can change embedded map size modifying 'height' and 'width' style properties. You can also adjust the zoom factor modifying 'zoom' parameter from the URL.

View File

@ -52,12 +52,6 @@
</bean> </bean>
<bean id="publishController" class="com.wisemapping.controller.MindmapPublishController">
<property name="methodNameResolver" ref="paramResolverByAction2"/>
<property name="mindmapService" ref="mindmapService"/>
<property name="userService" ref="userService"/>
</bean>
<bean id="userValidator" class="com.wisemapping.validator.UserValidator"> <bean id="userValidator" class="com.wisemapping.validator.UserValidator">
<property name="userService" ref="userService"/> <property name="userService" ref="userService"/>
<property name="captchaService" ref="reCaptcha"/> <property name="captchaService" ref="reCaptcha"/>
@ -205,7 +199,6 @@
<prop key="/c/changePassword.htm">changePasswordController</prop> <prop key="/c/changePassword.htm">changePasswordController</prop>
<prop key="/c/cooker.htm">cookerController</prop> <prop key="/c/cooker.htm">cookerController</prop>
<prop key="/c/settings.htm">settingsController</prop> <prop key="/c/settings.htm">settingsController</prop>
<prop key="/c/publish.htm">publishController</prop>
<prop key="/c/editProfile.htm">editProfileController</prop> <prop key="/c/editProfile.htm">editProfileController</prop>
<prop key="/c/tags.htm">tagsController</prop> <prop key="/c/tags.htm">tagsController</prop>
<prop key="/c/publicView.htm">publicView</prop> <prop key="/c/publicView.htm">publicView</prop>

View File

@ -159,6 +159,4 @@ input#selectAll {
width:100%; width:100%;
height:50px; height:50px;
white-space:nowrap; white-space:nowrap;
} }

View File

@ -31,7 +31,7 @@ jQuery.fn.dataTableExt.selectAllMaps = function() {
$(this).prop("checked", false); $(this).prop("checked", false);
}); });
} }
updateToolbar(); updateStatus();
}; };
jQuery.fn.dataTableExt.getSelectedMapsIds = function() { jQuery.fn.dataTableExt.getSelectedMapsIds = function() {
@ -107,11 +107,6 @@ jQuery.fn.dialogForm = function(options) {
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 400) { if (jqXHR.status == 400) {
var errors = JSON.parse(jqXHR.responseText); var errors = JSON.parse(jqXHR.responseText);
// Clean previous marks ....
$("#" + containerId + ' input').each(function(index, elem) {
$(elem).removeClass("ui-state-error");
});
// Mark fields with errors ... // Mark fields with errors ...
var fieldErrors = errors.fieldErrors; var fieldErrors = errors.fieldErrors;
if (fieldErrors) { if (fieldErrors) {
@ -145,27 +140,30 @@ jQuery.fn.dialogForm = function(options) {
// Update toolbar events ... // Update toolbar events ...
function updateToolbar() { function updateStatus() {
// Mark column row selection values ...
$("#mindmapListTable tbody input:checked").parent().parent().addClass('row-selected'); $("#mindmapListTable tbody input:checked").parent().parent().addClass('row-selected');
$("#mindmapListTable tbody input:not(:checked)").parent().parent().removeClass('row-selected'); $("#mindmapListTable tbody input:not(:checked)").parent().parent().removeClass('row-selected');
var inputs = $("#mindmapListTable tbody input:checked"); // Update toolbar ...
$("#buttonsToolbar .act-multiple").hide(); $("#buttonsToolbar .act-multiple").hide();
$("#buttonsToolbar .act-single").hide(); $("#buttonsToolbar .act-single").hide();
var tableElem = $('#mindmapListTable');
var selectedRows = tableElem.dataTableExt.getSelectedRows();
console.log($("#buttonsToolbar .act-multiple")); if (selectedRows.length > 0) {
if (selectedRows.length == 1) {
if (inputs.length > 0) {
if (inputs.length == 1) {
$("#buttonsToolbar .act-single").show(); $("#buttonsToolbar .act-single").show();
$("#buttonsToolbar .act-multiple").show(); $("#buttonsToolbar .act-multiple").show();
// Can be executed by the owner ?
var rowData = tableElem.dataTable().fnGetData(selectedRows[0]);
if (rowData.ownerEmail != principalEmail) {
$("#buttonsToolbar #publishBtn").hide();
$("#buttonsToolbar #shareBtn").hide();
}
} else { } else {
$("#buttonsToolbar .act-multiple").show(); $("#buttonsToolbar .act-multiple").show();
} }

View File

@ -37,38 +37,27 @@
</div> </div>
<div class="tab-pane fade" id="publish"> <div class="tab-pane fade" id="publish">
<ul class="unstyled"> <c:choose>
<c:choose> <c:when test="${wisemapDetail.public}">
<c:when test="${wisemapDetail.public}"> <ul class="unstyled">
<li><strong><spring:message code="PUBLIC"/>: </strong><spring:message code="ALL_VIEW_PUBLIC"/> <p><spring:message code="ALL_VIEW_PUBLIC"/></p>
</li>
<li><<strong><spring:message code="URL"/>: </strong> <li><strong><spring:message code="URL"/>:</strong>
<input name="url" <li><input name="url"
value="http://www.wisemapping.com/c/publicView.htm?mapId=${wisemapDetail.id}" value="http://www.wisemapping.com/c/publicView.htm?mapId=${wisemapDetail.id}"
style="width:400px" readonly="readonly"/> style="width:400px" readonly="readonly"/>
</li> </li>
<li><strong><spring:message code="DIRECT_LINK"/>: </strong> <li><strong><spring:message code="BLOG_SNIPPET"/></strong>
<textarea style="width:400px;height:30px;overflow:hidden;" cols="55" rows="3" <pre>&lt;iframe style="border:0;width:600px;height:400px;border: 1px solid black" src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${wisemapDetail.id}&amp;amzoom=1"&gt;&lt;/iframe&gt;</pre>
readonly="readonly">
&lt;a
href="http://www.wisemapping.com/c/publicView.htm?mapId=${wisemapDetail.id}">${wisemapDetail.title}&lt;/a></textarea>
<li><strong><spring:message code="BLOG_INCLUSION"/>: </strong>
<textarea style="width:400px;height:70px;overflow:hidden;" cols="55" rows="5"
readonly="readonly">
&lt;iframe
style="border:0;width:600px;height:400px;border: 1px solid black"
src="http://www.wisemapping.com/c/embeddedView.htm?mapId=${wisemapDetail.id}&amp;amzoom=1"&gt;
&lt;/iframe&gt;
</textarea>
</li> </li>
<li><spring:message code="EMBEDDED_MAP_SIZE"/></li> <li><spring:message code="EMBEDDED_MAP_SIZE"/></li>
</c:when> </ul>
<c:otherwise>
<li><strong><spring:message code="PUBLIC"/>:</strong><spring:message code="ONLY_VIEW_PRIVATE"/> </c:when>
</li> <c:otherwise>
</c:otherwise> <p><spring:message code="ONLY_VIEW_PRIVATE"/></p>
</c:choose> </c:otherwise>
</ul> </c:choose>
</div> </div>
</div> </div>
</div> </div>

View File

@ -16,7 +16,6 @@
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script> <script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script>
<script src="js/less.js" type="text/javascript"></script> <script src="js/less.js" type="text/javascript"></script>
<!--jQuery DataTables--> <!--jQuery DataTables-->
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.min.js"></script> <script type="text/javascript" language="javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="js/mymaps.js"></script> <script type="text/javascript" language="javascript" src="js/mymaps.js"></script>
@ -25,20 +24,20 @@
<script type="text/javascript" language="javascript" src="js/jquery.timeago.js"></script> <script type="text/javascript" language="javascript" src="js/jquery.timeago.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
var principalEmail = '${principal.email}';
$(function() { $(function() {
var jQueryDataTable = $('#mindmapListTable').dataTable({ var jQueryDataTable = $('#mindmapListTable').dataTable({
bProcessing : true, bProcessing : true,
sAjaxSource : "../service/maps", sAjaxSource : "../service/maps",
sAjaxDataProp: 'mindmapsInfo', sAjaxDataProp: 'mindmapsInfo',
fnInitComplete: function() { fnInitComplete: function() {
$('#mindmapListTable tbody').change(updateToolbar); $('#mindmapListTable tbody').change(updateStatus);
}, },
aoColumns: [ aoColumns: [
{ {
sTitle : '<input type="checkbox" id="selectAll"/>', sTitle : '<input type="checkbox" id="selectAll"/>',
sWidth : "15px", sWidth : "15px",
sClass : "select center", sClass : "select",
bSortable : false, bSortable : false,
bSearchable : false, bSearchable : false,
fnRender : function(obj) { fnRender : function(obj) {
@ -46,7 +45,6 @@
} }
}, },
{ {
sClass : "columName",
sTitle : "Name", sTitle : "Name",
bUseRendered : false, bUseRendered : false,
mDataProp: "title", mDataProp: "title",
@ -54,9 +52,15 @@
return '<a href="c/map/' + obj.aData.id + '/edit.htm">' + obj.aData.title + '</a>'; return '<a href="c/map/' + obj.aData.id + '/edit.htm">' + obj.aData.title + '</a>';
} }
}, },
{
bVisible: false,
bSearchable : false,
sTitle : "Owner Email",
mDataProp: "ownerEmail"
},
{ {
sTitle : "Owner", sTitle : "Owner",
mDataProp :"creator" mDataProp :"owner"
}, },
{ {
bSearchable : false, bSearchable : false,
@ -98,11 +102,9 @@
$('#nPageBtn').click(function() { $('#nPageBtn').click(function() {
$('#mindmapListTable_next').click(); $('#mindmapListTable_next').click();
}); });
$('#pPageBtn').click(function() { $('#pPageBtn').click(function() {
$('#mindmapListTable_previous').click(); $('#mindmapListTable_previous').click();
}); });
}); });
</script> </script>
@ -216,17 +218,18 @@
} }
}); });
$("#exportBtn").click(function() { $("#publishBtn").click(function() {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds(); var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0) { if (mapIds.length > 0) {
$('#export-dialog-modal .modal-body').load("c/map/" + mapIds[0] + "/export.htm", function() { $('#publish-dialog-modal .modal-body').load("c/map/" + mapIds[0] + "/publish.htm",
$('#export-dialog-modal').modal(); function() {
}); $('#publish-dialog-modal .btn-accept').click(function() {
$('#publish-dialog-modal #publishForm').submit();
});
$('#publish-dialog-modal').modal();
});
} }
}); });
$("#actionButtons .publishMap").click(function() {
});
$("#actionButtons .shareMap").click(function() { $("#actionButtons .shareMap").click(function() {
}); });
@ -250,7 +253,7 @@
</script> </script>
</head> </head>
<body> <body>
<div class="content"> <div style="min-height: 500px">
<jsp:include page="header.jsp"> <jsp:include page="header.jsp">
<jsp:param name="removeSignin" value="false"/> <jsp:param name="removeSignin" value="false"/>
<jsp:param name="showLogout" value="true"/> <jsp:param name="showLogout" value="true"/>
@ -261,21 +264,21 @@
<div id="buttonsToolbar" class="btn-toolbar"> <div id="buttonsToolbar" class="btn-toolbar">
<div class="btn-group"> <div class="btn-group">
<button class="btn" id="newBtn"><i class="icon-file"></i> New</button> <button class="btn btn-info" id="newBtn"><i class="icon-file icon-white"></i> New</button>
<button class="btn" id="importBtn"><i class="icon-upload"></i> Import</button> <button class="btn btn-info" id="importBtn"><i class="icon-upload icon-white"></i> Import</button>
</div> </div>
<div class="btn-group act-multiple" id="deleteBtn" style="display:none"> <div class="btn-group act-multiple" id="deleteBtn" style="display:none">
<button class="btn"><i class="icon-trash"></i> Delete</button> <button class="btn btn-info"><i class="icon-trash icon-white"></i> Delete</button>
</div> </div>
<div class="btn-group act-single" id="infoBtn" style="display:none"> <div class="btn-group act-single" id="infoBtn" style="display:none">
<button class="btn"><i class="icon-exclamation-sign"></i> Info</button> <button class="btn btn-info"><i class="icon-exclamation-sign icon-white"></i> Info</button>
</div> </div>
<div class="btn-group act-single" id="actionsBtn" style="display:none"> <div class="btn-group act-single" id="actionsBtn" style="display:none">
<button class="btn dropdown-toggle" data-toggle="dropdown"> <button class="btn btn-info dropdown-toggle" data-toggle="dropdown">
<i class="icon-asterisk"></i> More <i class="icon-asterisk icon-white"></i> More
<span class="caret"></span> <span class="caret"></span>
</button> </button>
@ -284,10 +287,8 @@
Duplicate</a></li> Duplicate</a></li>
<li id="renameBtn"><a href="#" onclick="return false"><i class="icon-edit"></i> Rename</a></li> <li id="renameBtn"><a href="#" onclick="return false"><i class="icon-edit"></i> Rename</a></li>
<li id="printBtn"><a href="#" onclick="return false"><i class="icon-print"></i> Print</a></li> <li id="printBtn"><a href="#" onclick="return false"><i class="icon-print"></i> Print</a></li>
<li id="publishMap"><a href="#" onclick="return false"><i class="icon-globe"></i>Publish</a></li> <li id="publishBtn"><a href="#" onclick="return false"><i class="icon-globe"></i>Publish</a></li>
<li id="exportBtn"><a href="#" onclick="return false"><i class="icon-download-alt"></i> Export</a> <li id="shareBtn"><a href="#" onclick="return false"><i class="icon-share"></i> Share</a></li>
</li>
<li id="shareMap"><a href="#" onclick="return false"><i class="icon-share"></i> Share</a></li>
<li id="tagMap"><a href="#" onclick="return false"><i class="icon-tags"></i> Tag</a></li> <li id="tagMap"><a href="#" onclick="return false"><i class="icon-tags"></i> Tag</a></li>
</ul> </ul>
</div> </div>
@ -423,20 +424,21 @@
</div> </div>
</div> </div>
<div id="export-dialog-modal" class="modal fade" style="display: none"> <!-- Publish Dialog Config -->
<div id="publish-dialog-modal" class="modal fade" style="display: none">
<div class="modal-header"> <div class="modal-header">
<button class="close" data-dismiss="modal">x</button> <button class="close" data-dismiss="modal">x</button>
<h3>Export</h3> <h3>Publish</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-cancel" data-dismiss="modal">Close</button> <button class="btn btn-primary btn-accept" data-loading-text="Saving...">Accept</button>
<button class="btn btn-cancel" data-dismiss="modal">Cancel</button>
</div> </div>
</div> </div>
<div id="map-table"> <div id="map-table">
<table class="table table-bordered" id="mindmapListTable"> <table class="table table-bordered" id="mindmapListTable">
@ -445,7 +447,6 @@
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,124 +1,123 @@
<%@ include file="/jsp/init.jsp" %> <%@ include file="/jsp/init.jsp" %>
<h1>
<spring:message code="PUBLISH"/>
'${mindmap.title}'
</h1>
<h2>
<spring:message code="PUBLISH_DETAILS"/>
</h2>
<div> <form method="post" id="publishForm" action="#" class="form-horizontal">
<form method="post" id="publishForm" name="publishForm" action="<c:url value="publish.htm"/>" style="height:100%;"> <fieldset>
<input type="hidden" name="actionId" value="save"/> <div class="control-group">
<input type="hidden" name="mapId" value="${mindmap.id}"/> <label for="enablePublicView" class="control-label">Enable Sharing:
<table> <input type="checkbox" id="enablePublicView" name="publicView" class="control"
<colgroup> <c:if test="${mindmap.public}">
<col width="20%"/> checked="checked"
<col width="80%"/> </c:if>/>
</colgroup> </label>
<tbody> </div>
<tr> </fieldset>
<td> </form>
&nbsp;
</td>
<td>
<input type="checkbox" id="publicViewId" name="publicView" value="true" <p><span class="label label-important">Warning</span> <spring:message code="PUBLISH_DETAILS"/></p>
<c:if test="${mindmap.public}">
checked="checked" <div id="sharingPanel">
</c:if>
/> <ul class="nav nav-tabs">
<spring:message code="PUBLISH_MAP_TO_INTERNET"/> <li class="active"><a href="#embedTab" data-toggle="pill">Embed</a></li>
</td> <li><a href="#publicUrlTab" data-toggle="pill">Public URLs</a></li>
</tr> </ul>
<tr>
<td>
&nbsp;
</td>
<td>
<div id="disabledPanel"
style="position:absolute;background-color:white;opacity:0.8;width:600px;height:160px;left:10px;visibility:hidden;">
</div> <div class="tab-content">
</td> <div class="tab-pane fade active in" id="embedTab">
</tr>
<tr>
<td class="formLabel">
<spring:message code="URL"/>:
</td>
<td style="padding-bottom: 5px;">
<input name="url" value="http://www.wisemapping.com/c/publicView.htm?mapId=${mindmap.id}"
style="width:400px" readonly="readonly"/>
</td>
</tr>
<tr>
<td class="formLabel">
<spring:message code="DIRECT_LINK"/>:
</td>
<td>
<textarea style="width:400px;height:30px;overflow:hidden;" cols="55" rows="3" readonly="readonly">
&lt;a href="http://www.wisemapping.com/c/publicView.htm?mapId=${mindmap.id}">${mindmap.title}&lt;/a></textarea>
</td>
</tr>
<tr>
<td class="formLabel">
&nbsp;
</td>
<td>
&nbsp;
</td>
</tr>
<tr>
<td class="formLabel" style="white-space:normal;">
<spring:message code="BLOG_INCLUSION"/>:
</td>
<td>
<textarea style="width:400px;height:70px;overflow:hidden;" cols="55" rows="5" readonly="readonly">
&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;
</textarea>
<p><spring:message code="EMBEDDED_MAP_SIZE"/></p> <spring:message code="BLOG_INCLUSION"/>
</td>
</tr> <form class="form-inline" action="#" style="text-align: center">
<tr> <fieldset>
<td style="text-align:center;margin-top:30px;" colspan="2">
<input type="submit" id="ok" value="<spring:message code="OK"/>" class="btn-primary"> <label for="frameWith">Frame width:</label>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn-secondary" id="cancelBtn"> <input type="number" id="frameWith" name="frameWith" value="600" class="span1" min="0"/>
</td>
</tr> <label for="frameHeight" class="control-label">Frame height:</label>
</tbody> <input type="number" id="frameHeight" name="frameHeight" value="400" class="span1" min="0"/>
</table>
</form> <label for="mapZoom">Zoom %:</label>
<input type="number" id="mapZoom" name="mapZoom" value="80" class="span1" min="10"
max="200" step="10"/>
</fieldset>
</form>
<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>
</div>
<div class="tab-pane fade" id="publicUrlTab">
<spring:message code="URL"/>:
<input name="url" value="http://www.wisemapping.com/c/publicView.htm?mapId=${mindmap.id}"
style="width:400px"
readonly="readonly"/>
</div>
</div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
// Update tabs display status ...
var checkboxElems = $('#publishForm input:checkbox');
var updateTabsDisplay = function() {
var divElem = $('#sharingPanel');
checkboxElems[0].checked ? divElem.show() : divElem.hide();
};
checkboxElems.change(updateTabsDisplay);
updateTabsDisplay();
var isPublicPanelEnabled = false; // Change snippet code based on the user options ...
var panelEnabler = function() var replaceCode = function(regExpr, strReplace, factor) {
{ var preElem = $('#sharingPanel #embedCode')[0];
if (isPublicPanelEnabled) var fieldValue = this.value;
{ if (!isNaN(fieldValue) && fieldValue.length > 0) {
$('disabledPanel').setStyle("visibility", "hidden"); var textVal = $(preElem).text().replace(regExpr, strReplace.replace('%s', fieldValue * factor));
} else $(preElem).text(textVal);
{
$('disabledPanel').setStyle("visibility", "visible");
} }
isPublicPanelEnabled = !isPublicPanelEnabled;
}; };
if (${mindmap.public==false}) $('#sharingPanel #frameWith').keyup(function() {
{ replaceCode.bind(this)(/width:[0-9]+px/g, "width:%spx", 1);
panelEnabler();
}
$('publicViewId').addEvent('click', panelEnabler);
$('cancelBtn').addEvent('click', function(event) {
MooDialog.Request.active.close();
}); });
$('#sharingPanel #frameWith').change(function() {
replaceCode.bind(this)(/width:[0-9]+px/g, "width:%spx", 1);
});
$('#sharingPanel #frameHeight').keyup(function() {
replaceCode.bind(this)(/height:[0-9]+px/g, "height:%spx", 1);
});
$('#sharingPanel #frameHeight').change(function() {
replaceCode.bind(this)(/height:[0-9]+px/g, "height:%spx", 1);
});
$('#sharingPanel #mapZoom').keyup(function() {
replaceCode.bind(this)(/zoom=.+\"/g, "zoom=%s\"", 0.1);
});
$('#sharingPanel #mapZoom').change(function() {
replaceCode.bind(this)(/zoom=.+\"/g, "zoom=%s\"", 0.01);
});
// Save status on click ...
$('#publishForm').submit(function(event) {
jQuery.ajax("service/maps/${mindmap.id}/publish", {
async:false,
dataType: 'json',
data: $('#publishForm #enablePublicView')[0].checked ? 'true' : 'false',
type: 'PUT',
contentType:"text/plain",
success : function(data, textStatus, jqXHR) {
$('#publish-dialog-modal').modal('hide');
},
error: function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
event.preventDefault();
});
</script> </script>

View File

@ -1,6 +1,6 @@
INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE()); INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE());
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail) INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
values(1,'WiseMapping Test User','Wise','test', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1); values(1,'wi','Wise','test', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1);
INSERT INTO COLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURDATE()); INSERT INTO COLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURDATE());
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail) INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)