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

@ -26,3 +26,59 @@ $assert = function(assert, message) {
}
};
Math.sign = function(value) {
return (value >= 0) ? 1 : -1;
};
/*
* DOMParser HTML extension
* 2012-02-02
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */
/*global document, DOMParser*/
(function(DOMParser) {
"use strict";
var DOMParser_proto = DOMParser.prototype , real_parseFromString = DOMParser_proto.parseFromString;
// Firefox/Opera/IE throw errors on unsupported types
try {
// WebKit returns null on unsupported types
if ((new DOMParser).parseFromString("", "text/html")) {
// text/html parsing is natively supported
return;
}
} catch (ex) {
}
DOMParser_proto.parseFromString = function(markup, type) {
if (/^\s*text\/html\s*(?:;|$)/i.test(type)) {
var
doc = document.implementation.createHTMLDocument("")
, doc_elt = doc.documentElement
, first_elt
;
doc_elt.innerHTML = markup;
first_elt = doc_elt.firstElementChild;
if (// are we dealing with an entire document or a fragment?
doc_elt.childElementCount === 1
&& first_elt.localName.toLowerCase() === "html"
) {
doc.replaceChild(first_elt, doc_elt);
}
return doc;
} else {
return real_parseFromString.apply(this, arguments);
}
};
}(DOMParser));

View File

@ -20,9 +20,6 @@ core.Utils = {
};
Math.sign = function(value) {
return (value >= 0) ? 1 : -1;
};
core.Utils.innerXML = function(/*Node*/node) {
// summary:
@ -51,7 +48,7 @@ core.Utils.createDocument = function() {
doc = new ActiveXObject(prefixes[i] + ".XMLDOM");
} catch(e) { /* squelch */
}
;
if ($defined(doc)) {
break;
@ -65,77 +62,3 @@ core.Utils.createDocument = function() {
return doc;
// DOMDocument
};
core.Utils.createDocumentFromText = function(/*string*/str, /*string?*/mimetype) {
// summary:
// attempts to create a Document object based on optional mime-type,
// using str as the contents of the document
if (!$defined(mimetype)) {
mimetype = "text/xml";
}
if ($defined(window.DOMParser)) {
var parser = new DOMParser();
return parser.parseFromString(str, mimetype);
// DOMDocument
} else if ($defined(window.ActiveXObject)) {
var domDoc = core.Utils.createDocument();
if ($defined(domDoc)) {
domDoc.async = false;
domDoc.loadXML(str);
return domDoc;
// DOMDocument
}
}
return null;
};
core.Utils.calculateRelationShipPointCoordinates = function(topic, controlPoint) {
var size = topic.getSize();
var position = topic.getPosition();
var m = (position.y - controlPoint.y) / (position.x - controlPoint.x);
var y,x;
var gap = 5;
if (controlPoint.y > position.y + (size.height / 2)) {
y = position.y + (size.height / 2) + gap;
x = position.x - ((position.y - y) / m);
if (x > position.x + (size.width / 2)) {
x = position.x + (size.width / 2);
} else if (x < position.x - (size.width / 2)) {
x = position.x - (size.width / 2);
}
} else if (controlPoint.y < position.y - (size.height / 2)) {
y = position.y - (size.height / 2) - gap;
x = position.x - ((position.y - y) / m);
if (x > position.x + (size.width / 2)) {
x = position.x + (size.width / 2);
} else if (x < position.x - (size.width / 2)) {
x = position.x - (size.width / 2);
}
} else if (controlPoint.x < (position.x - size.width / 2)) {
x = position.x - (size.width / 2) - gap;
y = position.y - (m * (position.x - x));
} else {
x = position.x + (size.width / 2) + gap;
y = position.y - (m * (position.x - x));
}
return new core.Point(x, y);
};
core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos) {
var y = srcPos.y - tarPos.y;
var x = srcPos.x - tarPos.x;
var m = y / x;
var l = Math.sqrt(y * y + x * x) / 3;
var fix = 1;
if (srcPos.x > tarPos.x) {
fix = -1;
}
var x1 = srcPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix;
var y1 = m * (x1 - srcPos.x) + srcPos.y;
var x2 = tarPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix * -1;
var y2 = m * (x2 - tarPos.x) + tarPos.y;
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
};

View File

@ -96,11 +96,11 @@ mindplot.ControlPoint = new Class({
var pos = screen.getWorkspaceMousePosition(event);
var topic = null;
if (point == 0) {
var cords = core.Utils.calculateRelationShipPointCoordinates(this._line.getSourceTopic(), pos);
var cords = mindplot.util.Shape.calculateRelationShipPointCoordinates(this._line.getSourceTopic(), pos);
this._line.setFrom(cords.x, cords.y);
this._line.setSrcControlPoint(new core.Point(pos.x - cords.x, pos.y - cords.y));
} else {
var cords = core.Utils.calculateRelationShipPointCoordinates(this._line.getTargetTopic(), pos);
var cords = mindplot.util.Shape.calculateRelationShipPointCoordinates(this._line.getTargetTopic(), pos);
this._line.setTo(cords.x, cords.y);
this._line.setDestControlPoint(new core.Point(pos.x - cords.x, pos.y - cords.y));
}

View File

@ -51,7 +51,9 @@ mindplot.LocalStorageManager = new Class({
}
}
return core.Utils.createDocumentFromText(xml);
var parser = new DOMParser();
return parser.parseFromString(xml, "text/xml");
}
}
);

View File

@ -60,7 +60,7 @@ mindplot.RelationshipLine = new Class({
this._line2d.setStroke(2);
var ctrlPoints = this._line2d.getControlPoints();
if (!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()) {
var defaultPoints = core.Utils.calculateDefaultControlPoints(sourcePosition, targetPosition);
var defaultPoints = mindplot.util.Shape.calculateDefaultControlPoints(sourcePosition, targetPosition);
ctrlPoints[0].x = defaultPoints[0].x;
ctrlPoints[0].y = defaultPoints[0].y;
ctrlPoints[1].x = defaultPoints[1].x;
@ -73,8 +73,8 @@ mindplot.RelationshipLine = new Class({
var tpoint = new core.Point();
tpoint.x = parseInt(ctrlPoints[1].x) + parseInt(targetPosition.x);
tpoint.y = parseInt(ctrlPoints[1].y) + parseInt(targetPosition.y);
sPos = core.Utils.calculateRelationShipPointCoordinates(sourceTopic, spoint);
tPos = core.Utils.calculateRelationShipPointCoordinates(targetTopic, tpoint);
sPos = mindplot.util.Shape.calculateRelationShipPointCoordinates(sourceTopic, spoint);
tPos = mindplot.util.Shape.calculateRelationShipPointCoordinates(targetTopic, tpoint);
line2d.setFrom(sPos.x, sPos.y);
line2d.setTo(tPos.x, tPos.y);

View File

@ -42,11 +42,10 @@ var MooDialog = new Class({
options = this.options;
var wrapper = this.wrapper = new Element('div.' + options['class'].replace(' ', '.')).inject(options.inject);
this.content = new Element('div.content').inject(wrapper);
if (options.title){
this.title = new Element('div.title').set('text', options.title).inject(wrapper);
wrapper.addClass('MooDialogTitle');
// this.title.addClass('MooDialogTitle');
}
if (options.closeButton){
@ -54,6 +53,7 @@ var MooDialog = new Class({
events: {click: this.close.bind(this)}
}).inject(wrapper);
}
this.content = new Element('div.content').inject(wrapper);
/*<ie6>*/// IE 6 scroll

View File

@ -41,6 +41,57 @@ mindplot.util.Shape =
}
return result;
},
calculateRelationShipPointCoordinates : function(topic, controlPoint) {
var size = topic.getSize();
var position = topic.getPosition();
var m = (position.y - controlPoint.y) / (position.x - controlPoint.x);
var y,x;
var gap = 5;
if (controlPoint.y > position.y + (size.height / 2)) {
y = position.y + (size.height / 2) + gap;
x = position.x - ((position.y - y) / m);
if (x > position.x + (size.width / 2)) {
x = position.x + (size.width / 2);
} else if (x < position.x - (size.width / 2)) {
x = position.x - (size.width / 2);
}
} else if (controlPoint.y < position.y - (size.height / 2)) {
y = position.y - (size.height / 2) - gap;
x = position.x - ((position.y - y) / m);
if (x > position.x + (size.width / 2)) {
x = position.x + (size.width / 2);
} else if (x < position.x - (size.width / 2)) {
x = position.x - (size.width / 2);
}
} else if (controlPoint.x < (position.x - size.width / 2)) {
x = position.x - (size.width / 2) - gap;
y = position.y - (m * (position.x - x));
} else {
x = position.x + (size.width / 2) + gap;
y = position.y - (m * (position.x - x));
}
return new core.Point(x, y);
},
calculateDefaultControlPoints : function(srcPos, tarPos) {
var y = srcPos.y - tarPos.y;
var x = srcPos.x - tarPos.x;
var m = y / x;
var l = Math.sqrt(y * y + x * x) / 3;
var fix = 1;
if (srcPos.x > tarPos.x) {
fix = -1;
}
var x1 = srcPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix;
var y1 = m * (x1 - srcPos.x) + srcPos.y;
var x2 = tarPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix * -1;
var y2 = m * (x2 - tarPos.x) + tarPos.y;
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
}
};

View File

@ -61,7 +61,7 @@ mindplot.widget.LinkIconTooltip = new Class({
var imgContainer = new Element('div');
imgContainer.setStyles({
width: '100%',
textAlign: 'center',
textAlign: 'right',
'padding-bottom':'5px',
'padding-top': '5px'
});

View File

@ -193,7 +193,7 @@ mindplot.widget.Menu = new Class({
this._addButton('export', false, false, function() {
var reqDialog = new MooDialog.Request('c/map/' + mapId + '/export.htm', null,
{'class': 'exportModalDialog',
{'class': 'modalDialog exportModalDialog',
closeButton:true,
destroyOnClose:true,
title:'Export'
@ -317,7 +317,7 @@ mindplot.widget.Menu = new Class({
if (tagElem) {
this._addButton('tagIt', false, false, function() {
var reqDialog = new MooDialog.Request('c/tags.htm?mapId=' + mapId, null,
{'class': 'tagItModalDialog',
{'class': 'modalDialog tagItModalDialog',
closeButton:true,
destroyOnClose:true,
title:'Tags'
@ -335,7 +335,7 @@ mindplot.widget.Menu = new Class({
if (shareElem) {
this._addButton('shareIt', false, false, function() {
var reqDialog = new MooDialog.Request('c/mymaps.htm?action=collaborator&mapId=' + mapId, null,
{'class': 'shareItModalDialog',
{'class': 'modalDialog shareItModalDialog',
closeButton:true,
destroyOnClose:true,
title:'Share It'
@ -354,8 +354,8 @@ mindplot.widget.Menu = new Class({
var publishElem = $('publishIt');
if (publishElem) {
this._addButton('publishIt', false, false, function() {
var reqDialog = new MooDialog.Request('c/publish.htm?mapId=' + mapId, null,
{'class': 'publishModalDialog',
var reqDialog = new MooDialog.Request('c/iframeWrapper.htm?url=c/maps/' + mapId + "/publishf.htm", null,
{'class': 'modalDialog publishModalDialog',
closeButton:true,
destroyOnClose:true,
title:'Publish'
@ -365,6 +365,7 @@ mindplot.widget.Menu = new Class({
reqDialog.setContent('loading...');
}
});
MooDialog.Request.active = reqDialog;
});
this._registerTooltip('publishIt', "Publish");
@ -375,7 +376,7 @@ mindplot.widget.Menu = new Class({
this._addButton('history', false, false, function() {
var reqDialog = new MooDialog.Request('c/history.htm?action=list&goToMindmapList&mapId=' + mapId, null,
{'class': 'historyModalDialog',
{'class': 'modalDialog historyModalDialog',
closeButton:true,
destroyOnClose:true,
title:'History'

View File

@ -93,7 +93,7 @@ mindplot.widget.NoteEditor = new Class({
}.bind(this));
// Add buttons ...
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'right'});
// Create accept button ...
var okButton = new Element('input', {type:'submit', value:'Accept','class':'btn-primary'});
@ -113,7 +113,6 @@ mindplot.widget.NoteEditor = new Class({
buttonContainer.inject(form);
}
// Create cancel button ...
var cButton = new Element('input', {type:'button', value:'Cancel','class':'btn-secondary'});
cButton.setStyle('margin', '5px');

View File

@ -1,10 +1,11 @@
TestCase("Model Migration Tests",{
setUp:function(){
TestCase("Model Migration Tests", {
setUp:function() {
mapXml = '<map name="1"><topic central="true" text="test"><topic position="-127,-100" fontStyle="Verdana;;#038f39;;italic;" brColor="#db770b"><topic order="0"/><topic order="1"/><topic order="2"><topic order="0"/><topic order="1"/><topic order="2"/></topic></topic><topic position="-168,50" shape="line"><icon id="conn_disconnect"/><icon id="chart_curve"/></topic><topic position="166,-100" shape="elipse"><note text="this%20is%20a%20note"/><topic order="0"/><topic order="1"/><topic order="2"/></topic><topic position="173,0" shape="rectagle" bgColor="#f2a2b5"><link url="www.google.com"/></topic></topic><topic position="-391,-2" text="im alone"/></map>';
},
testModelMigration:function(){
ids=[];
var domDocument = core.Utils.createDocumentFromText(mapXml);
testModelMigration:function() {
ids = [];
var parser = new DOMParser();
var domDocument = parser.parseFromString(xml, "text/xml");
var betaSerializer = new mindplot.persistence.XMLSerializer_Beta();
var betaMap = betaSerializer.loadFromDom(domDocument);
@ -22,31 +23,31 @@ TestCase("Model Migration Tests",{
//Assert same nodes recursively
//Since Id can change let's assume the order is the same
for(var i = 0; i<betaBranches.length; i++){
for (var i = 0; i < betaBranches.length; i++) {
var branch = betaBranches[i];
this._findAndCompareNodes(branch, branches[i]);
}
},
_findAndCompareNodes:function(betaNode, node){
_findAndCompareNodes:function(betaNode, node) {
this._compareNodes(betaNode, node);
//Assert same nodes recursively
//Since Id can change let's assume the order is the same
for(var i = 0; i<betaNode.getChildren().length; i++){
for (var i = 0; i < betaNode.getChildren().length; i++) {
var betaChild = betaNode.getChildren()[i];
var child = node.getChildren()[i];
this._findAndCompareNodes(betaChild, child);
}
},
_compareNodes:function(node1, node2){
_compareNodes:function(node1, node2) {
assertNotNull(node1);
assertNotNull(node2);
//In Pela Version every id is different
var pelaId = node2.getId();
assertTrue(ids[pelaId]==undefined);
assertTrue(ids[pelaId] == undefined);
ids.push(pelaId);
var children1 = node1.getChildren();
@ -55,9 +56,9 @@ TestCase("Model Migration Tests",{
var position1 = node1.getPosition();
var position2 = node2.getPosition();
if(position1==null){
if (position1 == null) {
assertNull(position2);
}else{
} else {
assertEquals(position1.x, position2.x);
assertEquals(position1.y, position2.y);
}
@ -69,13 +70,13 @@ TestCase("Model Migration Tests",{
assertEquals(node1.getSize().height, node2.getSize().height);
this._compareIcons(node1.getIcons(), node2.getIcons());
this._compareLinks(node1.getLinks(), node2.getLinks());
this._compareNotes(node1.getNotes(),node2.getNotes());
this._compareNotes(node1.getNotes(), node2.getNotes());
var order1 = node1.getOrder();
var order2 = node2.getOrder();
if(order1==null){
if (order1 == null) {
assertNull(order2);
}else{
} else {
assertEquals(order1, order2);
}
assertEquals(node1.getShapeType(), node2.getShapeType());
@ -86,27 +87,27 @@ TestCase("Model Migration Tests",{
assertEquals(node1.getBorderColor(), node2.getBorderColor());
assertEquals(node1.getBackgroundColor(), node2.getBackgroundColor());
},
_compareLinks:function(links1, links2){
_compareLinks:function(links1, links2) {
assertEquals(links1.length, links2.length);
for(var i=0; i<links1.length; i++){
for (var i = 0; i < links1.length; i++) {
var link1 = links1[i];
var link2 = links2[i];
assertEquals(link1.getUrl(), link2.getUrl());
}
},
_compareIcons:function(icons1, icons2){
_compareIcons:function(icons1, icons2) {
assertEquals(icons1.length, icons2.length);
for(var i=0; i<icons1.length; i++){
for (var i = 0; i < icons1.length; i++) {
var icon1 = icons1[i];
var icon2 = icons2[i];
assertEquals(icon1.getIconType(), icon2.getIconType());
}
},
_compareNotes:function(notes1, notes2){
_compareNotes:function(notes1, notes2) {
assertEquals(notes1.length, notes2.length);
for(var i=0; i<notes1.length; i++){
for (var i = 0; i < notes1.length; i++) {
var note1 = notes1[i];
var note2 = notes2[i];
assertEquals(note1.getText(), note2.getText());

View File

@ -178,7 +178,7 @@ web2d.peer.svg.CurvedLinePeer = new Class({
_calculateAutoControlPoints : function(avoidControlPointFix) {
//Both points available, calculate real points
var defaultpoints = core.Utils.calculateDefaultControlPoints(new core.Point(this._x1, this._y1), new core.Point(this._x2, this._y2));
var defaultpoints = mindplot.util.Shape.calculateDefaultControlPoints(new core.Point(this._x1, this._y1), new core.Point(this._x2, this._y2));
if (!this._customControlPoint_1 && !($defined(avoidControlPointFix) && avoidControlPointFix == 0)) {
this._control1.x = defaultpoints[0].x;
this._control1.y = defaultpoints[0].y;

View File

@ -44,7 +44,8 @@ function createStorageManager(mindplot) {
if (xml == null) {
throw "Map could not be loaded";
}
return core.Utils.createDocumentFromText(xml);
var parser = new DOMParser();
return parser.parseFromString(xml, "text/xml");
}
}

View File

@ -59,7 +59,6 @@ div#small_error_icon {
font-size: 11px;
}
/* */
.btn-primary {
cursor: pointer;
display: inline-block;
@ -143,160 +142,48 @@ div#small_error_icon {
/** */
/* Modal dialogs definitions */
.tagItModalDialog, .historyModalDialog, .shareItModalDialog, .exportModalDialog, .publishModalDialog {
div.modalDialog {
position: fixed;
top: 50%;
left: 50%;
z-index: 11000;
width: 400px;
width: 500px;
margin: -250px 0 0 -250px;
background-color: #ffffff;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, 0.3);
border: 1px solid #999;
/* IE6-7 */
padding: 10px;
overflow: auto;
/* IE6-7 */
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-webkit-background-clip: padding-box;
-moz-background-clip: padding-box;
background-clip: padding-box;
padding: 30px;
}
.shareItModalDialog {
width: 500px;
div.modalDialog .content {
padding: 5px 5px;
}
.publishModalDialog {
width: 600px;
}
.tagItModalDialog .title, .historyModalDialog .title, .shareItModalDialog .title, .exportModalDialog .title, .publishModalDialog .title {
position: absolute;
top: 0;
left: 0;
right: 0;
border-bottom: 1px solid #a1aec5;
div.modalDialog .title
{
font-weight: bold;
text-shadow: 1px 1px 0 #fff;
border-bottom: 1px solid #eee;
padding: 5px 30px;
font-size: 18px
padding: 5px 15px;
font-size: 18px;
}
.tagItModalDialog .content {
height: 130px;
}
.historyModalDialog .content {
height: 300px;
}
.shareItModalDialog .content {
height: 300px;
}
.exportModalDialog .content {
height: 280px;
}
.publishModalDialog .content {
height: 330px;
}
.modalDialog h1 {
font-size: 14px;
}
.modalDialog h2 {
font-size: 14px;
margin: 5px;
}
td.formLabel {
text-align: right;
padding: 2px 10px;
font-weight: bolder;
vertical-align: top;
}
#keyboardTable {
clear: both;
width: 100%;
height: 300px;
overflow: auto;
border: 0 solid gray;
background-color: white;
z-index: 2;
position: relative;
}
#keyboardTable table {
width: 100%;
border: 0 solid gray;
}
#keyboardTable thead {
background-color: #093A9D;
font-size: 12px;
font-weight: normal;
padding: 5px;
}
#keyboardTable td {
border-bottom: 1px solid #EEEEEE;
color: #5f5f5f;
font-size: 12px;
padding: 3px;
}
#keyboardTable th {
color: white;
border-right: 1px dotted #ffffff;
font-weight: bold;
text-align: center;
font-size: 12px;
padding: 5px;
}
#keyboardTable tbody tr:hover {
background-color: #E2f0f6;
}
#keyboardTable tr {
padding: 5px;
}
/*--- Modal Dialog Form ---*/
div.modalDialog {
padding: 15px 30px;
}
div.modalDialog td {
padding: 3px;
}
div.modalDialog h1 {
color: #093A9D;
font-size: 200%;
margin-bottom: 5px;
font-weight: bold;
}
div.modalDialog h2 {
color: gray;
font-size: 110%;
margin: 9px 0;
}
div.modalDialog h5 {
color: gray;
font-size: 90%; /*border-bottom: 1px dashed #BBB4D6;*/
}
/*--- End Modal Dialog Form ---*/
.publishModalDialog .content{
height:420px;
}

View File

@ -56,6 +56,10 @@ public class ExtensionsController {
return new ModelAndView("termsOfUse");
}
@RequestMapping(value = "faq")
public ModelAndView faq() {
return new ModelAndView("faq");
}
public static final int TRY_EXAMPLE_MINDMAP_ID = 3;
public static final String MAP_XML_PARAM = "mapXml";

View File

@ -27,13 +27,13 @@ public class MindmapController {
@Autowired
private MindmapService mindmapService;
@RequestMapping(value = "map/{id}/export")
@RequestMapping(value = "maps/{id}/export")
public ModelAndView export(@PathVariable int id) throws IOException {
final MindMapBean modelObject = findMindmapBean(id);
return new ModelAndView("mindmapExport", "mindmap", modelObject);
}
@RequestMapping(value = "map/{id}/details")
@RequestMapping(value = "maps/{id}/details")
public ModelAndView showDetails(@PathVariable int id) {
final MindMapBean modelObject = findMindmapBean(id);
final ModelAndView view = new ModelAndView("mindmapDetail", "wisemapDetail", modelObject);
@ -41,23 +41,25 @@ public class MindmapController {
return view;
}
@RequestMapping(value = "map/{id}/print")
@RequestMapping(value = "maps/{id}/print")
public ModelAndView showPrintPage(@PathVariable int id) {
final MindMap mindmap = findMindmap(id);
final ModelAndView view = new ModelAndView("mindmapPrint", "mindmap", mindmap);
view.addObject("user", Utils.getUser());
return view;
return new ModelAndView("mindmapPrint", "mindmap", mindmap);
}
@RequestMapping(value = "map/{id}/publish")
@RequestMapping(value = "maps/{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;
return new ModelAndView("mindmapPublish", "mindmap", mindmap);
}
@RequestMapping(value = "map/{id}/edit")
@RequestMapping(value = "maps/{id}/publishf")
public ModelAndView showPublishPageFull(@PathVariable int id) {
final MindMap mindmap = findMindmap(id);
return new ModelAndView("mindmapPublishFull", "mindmap", mindmap);
}
@RequestMapping(value = "maps/{id}/edit")
public ModelAndView editMap(@PathVariable int id, @NotNull HttpServletRequest request) {
ModelAndView view;
final UserAgent userAgent = UserAgent.create(request);

View File

@ -22,6 +22,7 @@ import com.wisemapping.service.MindmapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
@ -30,10 +31,6 @@ public class PublicPagesController {
@Autowired
private MindmapService mindmapService;
@RequestMapping(value = "faq")
public ModelAndView faq() {
return new ModelAndView("faq");
}
@RequestMapping(value = "aboutUs")
public ModelAndView aboutUs() {
@ -59,4 +56,10 @@ public class PublicPagesController {
public ModelAndView home() {
return new ModelAndView("homepage");
}
@RequestMapping(value = "iframeWrapper")
public ModelAndView showIframe(@RequestParam(required = true) String url) {
return new ModelAndView("iframeWrapper", "url", url);
}
}

View File

@ -22,7 +22,13 @@
<put name="body" value="/jsp/error.jsp" type="page"/>
</definition>
<definition name="formDialogTemplate" page="/jsp/formDialogTemplate.jsp">
<definition name="dialogTemplate" page="/jsp/dialogTemplate.jsp">
<put name="title" value="title" type="string"/>
<put name="details" value="details" type="string"/>
<put name="body" value="/jsp/error.jsp" type="page"/>
</definition>
<definition name="dialogFullTemplate" page="/jsp/dialogFullTemplate.jsp">
<put name="title" value="title" type="string"/>
<put name="details" value="details" type="string"/>
<put name="body" value="/jsp/error.jsp" type="page"/>
@ -32,6 +38,9 @@
<put name="body" value="/jsp/errorTemplate.jsp" type="page"/>
</definition>
<definition name="iframeWrapper" page="/jsp/iframeWrapper.jsp"/>
<!-- Error Pages -->
<definition name="gcfPluginNeeded" extends="pageTemplate">
<put name="body" value="/jsp/gcfPluginNeeded.jsp" type="page"/>
<put name="title" value="INSTALL_CFG"/>
@ -42,7 +51,6 @@
<put name="title" value="INSTALL_CFG"/>
</definition>
<!-- Error Pages -->
<definition name="unexpectedError" extends="errorTemplate">
<put name="title" value="UNEXPECTED_ERROR"/>
<put name="details" value="UNEXPECTED_ERROR_DETAILS"/>
@ -87,54 +95,60 @@
<!-- Dialog Forms -->
<definition name="mindmapDetail" extends="formDialogTemplate">
<definition name="mindmapDetail" extends="dialogTemplate">
<put name="title" value="MINDMAP_DETAIL"/>
<put name="body" value="/jsp/mindmapDetail.jsp"/>
</definition>
<definition name="setting" extends="formDialogTemplate">
<definition name="setting" extends="dialogTemplate">
<put name="title" value="SETTINGS"/>
<put name="details" value="SETTINGS_MSG"/>
<put name="body" value="/jsp/setting.jsp"/>
</definition>
<definition name="editProfile" extends="formDialogTemplate">
<definition name="editProfile" extends="dialogTemplate">
<put name="title" value="EDIT_PROFILE"/>
<put name="details" value="FIELD_REQUIRED_MSG"/>
<put name="body" value="/jsp/editProfile.jsp"/>
</definition>
<definition name="changePassword" extends="formDialogTemplate">
<definition name="changePassword" extends="dialogTemplate">
<put name="title" value="CHANGE_PASSWORD"/>
<put name="details" value="FIELD_REQUIRED_MSG"/>
<put name="body" value="/jsp/changePassword.jsp"/>
</definition>
<definition name="mindmapTags" extends="formDialogTemplate">
<definition name="mindmapTags" extends="dialogTemplate">
<put name="title" value=""/>
<put name="details" value=""/>
<put name="body" value="/jsp/mindmapTags.jsp"/>
</definition>
<definition name="mindmapExport" extends="formDialogTemplate">
<definition name="mindmapExport" extends="dialogTemplate">
<put name="title" value=""/>
<put name="details" value=""/>
<put name="body" value="/jsp/mindmapExport.jsp"/>
</definition>
<definition name="mindmapPublish" extends="formDialogTemplate">
<definition name="mindmapPublish" extends="dialogTemplate">
<put name="title" value=""/>
<put name="details" value=""/>
<put name="body" value="/jsp/mindmapPublish.jsp"/>
</definition>
<definition name="mindmapCollaborator" extends="formDialogTemplate">
<definition name="mindmapPublishFull" extends="dialogFullTemplate">
<put name="title" value=""/>
<put name="details" value=""/>
<put name="body" value="/jsp/mindmapPublish.jsp"/>
</definition>
<definition name="mindmapCollaborator" extends="dialogTemplate">
<put name="title" value=""/>
<put name="details" value=""/>
<put name="body" value="/jsp/mindmapCollaborator.jsp"/>
</definition>
<definition name="keyboard" extends="formDialogTemplate">
<definition name="keyboard" extends="dialogTemplate">
<put name="title" value="KEYBOARD"/>
<put name="details" value="KEYBOARD_MSG"/>
<put name="body" value="/jsp/keyboard.jsp"/>
@ -156,7 +170,7 @@
<put name="body" value="/jsp/activationAccountConfirmationFail.jsp"/>
</definition>
<definition name="mindmapHistory" extends="formDialogTemplate">
<definition name="mindmapHistory" extends="dialogTemplate">
<put name="title" value="HISTORY"/>
<put name="details" value="HISTORY_INFO"/>
<put name="body" value="/jsp/mindmapHistory.jsp"/>

View File

@ -180,7 +180,7 @@
</property>
<property name="mappings">
<props>
<prop key="/c/map/import.htm">importMapController</prop>
<prop key="/c/maps/import.htm">importMapController</prop>
<!-- Review -->
<prop key="/c/publicView.htm">publicView</prop>

View File

@ -0,0 +1,23 @@
<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles" %>
<%@ include file="/jsp/init.jsp" %>
<tiles:importAttribute name="title" scope="page"/>
<tiles:importAttribute name="details" scope="page"/>
<html>
<head>
<base href="${pageContext.request.contextPath}/"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css"/>
<script type="text/javascript" language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-responsive.min.css"/>
<body>
<div style="padding-top:20px">
<tiles:insert name="body"/>
</div>
</body>
</html>

View File

@ -5,7 +5,7 @@
<tiles:importAttribute name="title" scope="page"/>
<tiles:importAttribute name="details" scope="page"/>
<div class="modalDialog">
<div>
<!-- Header can be customized -->
<tiles:insert name="body"/>
</div>

View File

@ -28,7 +28,9 @@
var editorProperties = {zoom:${zoom},saveOnLoad:true,collab:'standalone',readOnly:true};
designer = buildDesigner(editorProperties);
var domDocument = core.Utils.createDocumentFromText(mapXml);
var parser = new DOMParser();
var domDocument = parser.parseFromString(mapXml, "text/xml");
var serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromDocument(domDocument);
var mindmap = serializer.loadFromDom(domDocument, mapId);

View File

@ -0,0 +1,27 @@
<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles" %>
<%@ include file="/jsp/init.jsp" %>
<div>
<iframe src='${url}' style="border: 0;width: 100%;height:100%" id="dialogContentIframe"></iframe>
<div style="float: right;margin-right: 25px">
<input type="button" class="btn-primary" value="Accept" id="submitBtn"/>
<input type="button" class="btn-secondary" value="Cancel" id="cancelBtn"/>
</div>
</div>
<script type="text/javascript">
$('submitBtn').addEvent('click', function() {
var iframeWindow = $('dialogContentIframe').contentWindow;
iframeWindow.submitDialogForm();
if (MooDialog.Request.active) {
MooDialog.Request.active.close();
}
});
$('cancelBtn').addEvent('click', function() {
if (MooDialog.Request.active) {
MooDialog.Request.active.close();
}
});
</script>

View File

@ -48,7 +48,9 @@
var designer = buildDesigner(options);
// Load map from XML ...
var domDocument = core.Utils.createDocumentFromText(mapXml);
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);

View File

@ -49,7 +49,7 @@
bUseRendered : false,
mDataProp: "title",
fnRender : function(obj) {
return '<a href="c/map/' + obj.aData.id + '/edit.htm">' + obj.aData.title + '</a>';
return '<a href="c/maps/' + obj.aData.id + '/edit.htm">' + obj.aData.title + '</a>';
}
},
{
@ -110,13 +110,13 @@
$("#newBtn").click(
function() {
$("#new-dialog-modal").dialogForm({
redirect: "c/map/{header.resourceId}/edit.htm",
redirect: "c/maps/{header.resourceId}/edit.htm",
url : "../service/maps"
});
});
$("#importBtn").click(function() {
window.open('c/map/import.htm');
window.open('c/maps/import.htm');
});
$("#duplicateBtn").click(function() {
@ -134,7 +134,7 @@
// Initialize dialog ...
$("#duplicate-dialog-modal").dialogForm({
redirect: "c/map/{header.resourceId}/edit.htm",
redirect: "c/maps/{header.resourceId}/edit.htm",
url : "../service/maps/" + mapId
});
}
@ -194,14 +194,14 @@
$("#printBtn").click(function() {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0) {
window.open('c/map/' + mapIds[0] + '/print.htm');
window.open('c/maps/' + mapIds[0] + '/print.htm');
}
});
$("#infoBtn").click(function() {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0) {
$('#info-dialog-modal .modal-body').load("c/map/" + mapIds[0] + "/details.htm", function() {
$('#info-dialog-modal .modal-body').load("c/maps/" + mapIds[0] + "/details.htm", function() {
$('#info-dialog-modal').modal();
});
@ -211,7 +211,7 @@
$("#publishBtn").click(function() {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0) {
$('#publish-dialog-modal .modal-body').load("c/map/" + mapIds[0] + "/publish.htm",
$('#publish-dialog-modal .modal-body').load("c/maps/" + mapIds[0] + "/publish.htm",
function() {
$('#publish-dialog-modal .btn-accept').click(function() {
$('#publish-dialog-modal #publishForm').submit();
@ -309,10 +309,12 @@
Duplicate</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="publishBtn"><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="shareBtn"><a href="#" onclick="return false"><i class="icon-share"></i> Share</a></li>
<li id="tagBtn"><a href="#" onclick="return false"><i class="icon-tags"></i> Tag</a></li>
<li id="historyBtn"><a href="#" onclick="return false"><i class="icon-time"></i> History</a></li>
<li id="historyBtn"><a href="#" onclick="return false"><i class="icon-time"></i> History</a>
</li>
</ul>
</div>
@ -470,5 +472,6 @@
<button class="btn btn-cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</body>
</html>

View File

@ -87,7 +87,9 @@
var designer = buildDesigner(options);
// Load map from XML ...
var domDocument = core.Utils.createDocumentFromText(mapXml);
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);

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">
<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" class="control"
<input type="checkbox" id="enablePublicView" name="publicView"
<c:if test="${mindmap.public}">
checked="checked"
</c:if>/>
</c:if> />
</label>
</div>
</fieldset>
</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>
<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>