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) { core.Utils.innerXML = function(/*Node*/node) {
// summary: // summary:
@ -51,7 +48,7 @@ core.Utils.createDocument = function() {
doc = new ActiveXObject(prefixes[i] + ".XMLDOM"); doc = new ActiveXObject(prefixes[i] + ".XMLDOM");
} catch(e) { /* squelch */ } catch(e) { /* squelch */
} }
;
if ($defined(doc)) { if ($defined(doc)) {
break; break;
@ -65,77 +62,3 @@ core.Utils.createDocument = function() {
return doc; return doc;
// DOMDocument // 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 pos = screen.getWorkspaceMousePosition(event);
var topic = null; var topic = null;
if (point == 0) { 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.setFrom(cords.x, cords.y);
this._line.setSrcControlPoint(new core.Point(pos.x - cords.x, pos.y - cords.y)); this._line.setSrcControlPoint(new core.Point(pos.x - cords.x, pos.y - cords.y));
} else { } 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.setTo(cords.x, cords.y);
this._line.setDestControlPoint(new core.Point(pos.x - cords.x, pos.y - 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); this._line2d.setStroke(2);
var ctrlPoints = this._line2d.getControlPoints(); var ctrlPoints = this._line2d.getControlPoints();
if (!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()) { 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].x = defaultPoints[0].x;
ctrlPoints[0].y = defaultPoints[0].y; ctrlPoints[0].y = defaultPoints[0].y;
ctrlPoints[1].x = defaultPoints[1].x; ctrlPoints[1].x = defaultPoints[1].x;
@ -73,8 +73,8 @@ mindplot.RelationshipLine = new Class({
var tpoint = new core.Point(); var tpoint = new core.Point();
tpoint.x = parseInt(ctrlPoints[1].x) + parseInt(targetPosition.x); tpoint.x = parseInt(ctrlPoints[1].x) + parseInt(targetPosition.x);
tpoint.y = parseInt(ctrlPoints[1].y) + parseInt(targetPosition.y); tpoint.y = parseInt(ctrlPoints[1].y) + parseInt(targetPosition.y);
sPos = core.Utils.calculateRelationShipPointCoordinates(sourceTopic, spoint); sPos = mindplot.util.Shape.calculateRelationShipPointCoordinates(sourceTopic, spoint);
tPos = core.Utils.calculateRelationShipPointCoordinates(targetTopic, tpoint); tPos = mindplot.util.Shape.calculateRelationShipPointCoordinates(targetTopic, tpoint);
line2d.setFrom(sPos.x, sPos.y); line2d.setFrom(sPos.x, sPos.y);
line2d.setTo(tPos.x, tPos.y); line2d.setTo(tPos.x, tPos.y);

View File

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

View File

@ -41,6 +41,57 @@ mindplot.util.Shape =
} }
return result; 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'); var imgContainer = new Element('div');
imgContainer.setStyles({ imgContainer.setStyles({
width: '100%', width: '100%',
textAlign: 'center', textAlign: 'right',
'padding-bottom':'5px', 'padding-bottom':'5px',
'padding-top': '5px' 'padding-top': '5px'
}); });

View File

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

View File

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

View File

@ -1,10 +1,11 @@
TestCase("Model Migration Tests",{ TestCase("Model Migration Tests", {
setUp:function(){ 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>'; 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(){ testModelMigration:function() {
ids=[]; ids = [];
var domDocument = core.Utils.createDocumentFromText(mapXml); var parser = new DOMParser();
var domDocument = parser.parseFromString(xml, "text/xml");
var betaSerializer = new mindplot.persistence.XMLSerializer_Beta(); var betaSerializer = new mindplot.persistence.XMLSerializer_Beta();
var betaMap = betaSerializer.loadFromDom(domDocument); var betaMap = betaSerializer.loadFromDom(domDocument);
@ -22,31 +23,31 @@ TestCase("Model Migration Tests",{
//Assert same nodes recursively //Assert same nodes recursively
//Since Id can change let's assume the order is the same //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]; var branch = betaBranches[i];
this._findAndCompareNodes(branch, branches[i]); this._findAndCompareNodes(branch, branches[i]);
} }
}, },
_findAndCompareNodes:function(betaNode, node){ _findAndCompareNodes:function(betaNode, node) {
this._compareNodes(betaNode, node); this._compareNodes(betaNode, node);
//Assert same nodes recursively //Assert same nodes recursively
//Since Id can change let's assume the order is the same //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 betaChild = betaNode.getChildren()[i];
var child = node.getChildren()[i]; var child = node.getChildren()[i];
this._findAndCompareNodes(betaChild, child); this._findAndCompareNodes(betaChild, child);
} }
}, },
_compareNodes:function(node1, node2){ _compareNodes:function(node1, node2) {
assertNotNull(node1); assertNotNull(node1);
assertNotNull(node2); assertNotNull(node2);
//In Pela Version every id is different //In Pela Version every id is different
var pelaId = node2.getId(); var pelaId = node2.getId();
assertTrue(ids[pelaId]==undefined); assertTrue(ids[pelaId] == undefined);
ids.push(pelaId); ids.push(pelaId);
var children1 = node1.getChildren(); var children1 = node1.getChildren();
@ -55,9 +56,9 @@ TestCase("Model Migration Tests",{
var position1 = node1.getPosition(); var position1 = node1.getPosition();
var position2 = node2.getPosition(); var position2 = node2.getPosition();
if(position1==null){ if (position1 == null) {
assertNull(position2); assertNull(position2);
}else{ } else {
assertEquals(position1.x, position2.x); assertEquals(position1.x, position2.x);
assertEquals(position1.y, position2.y); assertEquals(position1.y, position2.y);
} }
@ -69,13 +70,13 @@ TestCase("Model Migration Tests",{
assertEquals(node1.getSize().height, node2.getSize().height); assertEquals(node1.getSize().height, node2.getSize().height);
this._compareIcons(node1.getIcons(), node2.getIcons()); this._compareIcons(node1.getIcons(), node2.getIcons());
this._compareLinks(node1.getLinks(), node2.getLinks()); this._compareLinks(node1.getLinks(), node2.getLinks());
this._compareNotes(node1.getNotes(),node2.getNotes()); this._compareNotes(node1.getNotes(), node2.getNotes());
var order1 = node1.getOrder(); var order1 = node1.getOrder();
var order2 = node2.getOrder(); var order2 = node2.getOrder();
if(order1==null){ if (order1 == null) {
assertNull(order2); assertNull(order2);
}else{ } else {
assertEquals(order1, order2); assertEquals(order1, order2);
} }
assertEquals(node1.getShapeType(), node2.getShapeType()); assertEquals(node1.getShapeType(), node2.getShapeType());
@ -86,27 +87,27 @@ TestCase("Model Migration Tests",{
assertEquals(node1.getBorderColor(), node2.getBorderColor()); assertEquals(node1.getBorderColor(), node2.getBorderColor());
assertEquals(node1.getBackgroundColor(), node2.getBackgroundColor()); assertEquals(node1.getBackgroundColor(), node2.getBackgroundColor());
}, },
_compareLinks:function(links1, links2){ _compareLinks:function(links1, links2) {
assertEquals(links1.length, links2.length); 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 link1 = links1[i];
var link2 = links2[i]; var link2 = links2[i];
assertEquals(link1.getUrl(), link2.getUrl()); assertEquals(link1.getUrl(), link2.getUrl());
} }
}, },
_compareIcons:function(icons1, icons2){ _compareIcons:function(icons1, icons2) {
assertEquals(icons1.length, icons2.length); 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 icon1 = icons1[i];
var icon2 = icons2[i]; var icon2 = icons2[i];
assertEquals(icon1.getIconType(), icon2.getIconType()); assertEquals(icon1.getIconType(), icon2.getIconType());
} }
}, },
_compareNotes:function(notes1, notes2){ _compareNotes:function(notes1, notes2) {
assertEquals(notes1.length, notes2.length); 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 note1 = notes1[i];
var note2 = notes2[i]; var note2 = notes2[i];
assertEquals(note1.getText(), note2.getText()); assertEquals(note1.getText(), note2.getText());

View File

@ -178,7 +178,7 @@ web2d.peer.svg.CurvedLinePeer = new Class({
_calculateAutoControlPoints : function(avoidControlPointFix) { _calculateAutoControlPoints : function(avoidControlPointFix) {
//Both points available, calculate real points //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)) { if (!this._customControlPoint_1 && !($defined(avoidControlPointFix) && avoidControlPointFix == 0)) {
this._control1.x = defaultpoints[0].x; this._control1.x = defaultpoints[0].x;
this._control1.y = defaultpoints[0].y; this._control1.y = defaultpoints[0].y;

View File

@ -44,7 +44,8 @@ function createStorageManager(mindplot) {
if (xml == null) { if (xml == null) {
throw "Map could not be loaded"; 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; font-size: 11px;
} }
/* */
.btn-primary { .btn-primary {
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
@ -143,160 +142,48 @@ div#small_error_icon {
/** */ /** */
/* Modal dialogs definitions */ /* Modal dialogs definitions */
.tagItModalDialog, .historyModalDialog, .shareItModalDialog, .exportModalDialog, .publishModalDialog { div.modalDialog {
position: fixed; position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
z-index: 11000; z-index: 11000;
width: 400px; width: 500px;
margin: -250px 0 0 -250px; margin: -250px 0 0 -250px;
background-color: #ffffff; background-color: #ffffff;
border: 1px solid #999; border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, 0.3); padding: 10px;
border: 1px solid #999; overflow: auto;
/* IE6-7 */
/* IE6-7 */
-webkit-border-radius: 6px; -webkit-border-radius: 6px;
-moz-border-radius: 6px; -moz-border-radius: 6px;
border-radius: 6px; border-radius: 6px;
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-moz-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); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
-moz-background-clip: padding-box; -moz-background-clip: padding-box;
background-clip: padding-box; background-clip: padding-box;
padding: 30px;
} }
.shareItModalDialog { div.modalDialog .content {
width: 500px; padding: 5px 5px;
} }
.publishModalDialog { div.modalDialog .title
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;
font-weight: bold; font-weight: bold;
text-shadow: 1px 1px 0 #fff; text-shadow: 1px 1px 0 #fff;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
padding: 5px 30px; padding: 5px 15px;
font-size: 18px 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 ---*/ /*--- End Modal Dialog Form ---*/
.publishModalDialog .content{
height:420px;
}

View File

@ -56,6 +56,10 @@ public class ExtensionsController {
return new ModelAndView("termsOfUse"); 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 int TRY_EXAMPLE_MINDMAP_ID = 3;
public static final String MAP_XML_PARAM = "mapXml"; public static final String MAP_XML_PARAM = "mapXml";

View File

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

View File

@ -22,6 +22,7 @@ import com.wisemapping.service.MindmapService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@Controller @Controller
@ -30,10 +31,6 @@ public class PublicPagesController {
@Autowired @Autowired
private MindmapService mindmapService; private MindmapService mindmapService;
@RequestMapping(value = "faq")
public ModelAndView faq() {
return new ModelAndView("faq");
}
@RequestMapping(value = "aboutUs") @RequestMapping(value = "aboutUs")
public ModelAndView aboutUs() { public ModelAndView aboutUs() {
@ -59,4 +56,10 @@ public class PublicPagesController {
public ModelAndView home() { public ModelAndView home() {
return new ModelAndView("homepage"); 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"/> <put name="body" value="/jsp/error.jsp" type="page"/>
</definition> </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="title" value="title" type="string"/>
<put name="details" value="details" type="string"/> <put name="details" value="details" type="string"/>
<put name="body" value="/jsp/error.jsp" type="page"/> <put name="body" value="/jsp/error.jsp" type="page"/>
@ -32,6 +38,9 @@
<put name="body" value="/jsp/errorTemplate.jsp" type="page"/> <put name="body" value="/jsp/errorTemplate.jsp" type="page"/>
</definition> </definition>
<definition name="iframeWrapper" page="/jsp/iframeWrapper.jsp"/>
<!-- Error Pages -->
<definition name="gcfPluginNeeded" extends="pageTemplate"> <definition name="gcfPluginNeeded" extends="pageTemplate">
<put name="body" value="/jsp/gcfPluginNeeded.jsp" type="page"/> <put name="body" value="/jsp/gcfPluginNeeded.jsp" type="page"/>
<put name="title" value="INSTALL_CFG"/> <put name="title" value="INSTALL_CFG"/>
@ -42,7 +51,6 @@
<put name="title" value="INSTALL_CFG"/> <put name="title" value="INSTALL_CFG"/>
</definition> </definition>
<!-- Error Pages -->
<definition name="unexpectedError" extends="errorTemplate"> <definition name="unexpectedError" extends="errorTemplate">
<put name="title" value="UNEXPECTED_ERROR"/> <put name="title" value="UNEXPECTED_ERROR"/>
<put name="details" value="UNEXPECTED_ERROR_DETAILS"/> <put name="details" value="UNEXPECTED_ERROR_DETAILS"/>
@ -87,54 +95,60 @@
<!-- Dialog Forms --> <!-- Dialog Forms -->
<definition name="mindmapDetail" extends="formDialogTemplate"> <definition name="mindmapDetail" extends="dialogTemplate">
<put name="title" value="MINDMAP_DETAIL"/> <put name="title" value="MINDMAP_DETAIL"/>
<put name="body" value="/jsp/mindmapDetail.jsp"/> <put name="body" value="/jsp/mindmapDetail.jsp"/>
</definition> </definition>
<definition name="setting" extends="formDialogTemplate"> <definition name="setting" extends="dialogTemplate">
<put name="title" value="SETTINGS"/> <put name="title" value="SETTINGS"/>
<put name="details" value="SETTINGS_MSG"/> <put name="details" value="SETTINGS_MSG"/>
<put name="body" value="/jsp/setting.jsp"/> <put name="body" value="/jsp/setting.jsp"/>
</definition> </definition>
<definition name="editProfile" extends="formDialogTemplate"> <definition name="editProfile" extends="dialogTemplate">
<put name="title" value="EDIT_PROFILE"/> <put name="title" value="EDIT_PROFILE"/>
<put name="details" value="FIELD_REQUIRED_MSG"/> <put name="details" value="FIELD_REQUIRED_MSG"/>
<put name="body" value="/jsp/editProfile.jsp"/> <put name="body" value="/jsp/editProfile.jsp"/>
</definition> </definition>
<definition name="changePassword" extends="formDialogTemplate"> <definition name="changePassword" extends="dialogTemplate">
<put name="title" value="CHANGE_PASSWORD"/> <put name="title" value="CHANGE_PASSWORD"/>
<put name="details" value="FIELD_REQUIRED_MSG"/> <put name="details" value="FIELD_REQUIRED_MSG"/>
<put name="body" value="/jsp/changePassword.jsp"/> <put name="body" value="/jsp/changePassword.jsp"/>
</definition> </definition>
<definition name="mindmapTags" extends="formDialogTemplate"> <definition name="mindmapTags" extends="dialogTemplate">
<put name="title" value=""/> <put name="title" value=""/>
<put name="details" value=""/> <put name="details" value=""/>
<put name="body" value="/jsp/mindmapTags.jsp"/> <put name="body" value="/jsp/mindmapTags.jsp"/>
</definition> </definition>
<definition name="mindmapExport" extends="formDialogTemplate"> <definition name="mindmapExport" extends="dialogTemplate">
<put name="title" value=""/> <put name="title" value=""/>
<put name="details" value=""/> <put name="details" value=""/>
<put name="body" value="/jsp/mindmapExport.jsp"/> <put name="body" value="/jsp/mindmapExport.jsp"/>
</definition> </definition>
<definition name="mindmapPublish" extends="formDialogTemplate"> <definition name="mindmapPublish" extends="dialogTemplate">
<put name="title" value=""/> <put name="title" value=""/>
<put name="details" value=""/> <put name="details" value=""/>
<put name="body" value="/jsp/mindmapPublish.jsp"/> <put name="body" value="/jsp/mindmapPublish.jsp"/>
</definition> </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="title" value=""/>
<put name="details" value=""/> <put name="details" value=""/>
<put name="body" value="/jsp/mindmapCollaborator.jsp"/> <put name="body" value="/jsp/mindmapCollaborator.jsp"/>
</definition> </definition>
<definition name="keyboard" extends="formDialogTemplate"> <definition name="keyboard" extends="dialogTemplate">
<put name="title" value="KEYBOARD"/> <put name="title" value="KEYBOARD"/>
<put name="details" value="KEYBOARD_MSG"/> <put name="details" value="KEYBOARD_MSG"/>
<put name="body" value="/jsp/keyboard.jsp"/> <put name="body" value="/jsp/keyboard.jsp"/>
@ -156,7 +170,7 @@
<put name="body" value="/jsp/activationAccountConfirmationFail.jsp"/> <put name="body" value="/jsp/activationAccountConfirmationFail.jsp"/>
</definition> </definition>
<definition name="mindmapHistory" extends="formDialogTemplate"> <definition name="mindmapHistory" extends="dialogTemplate">
<put name="title" value="HISTORY"/> <put name="title" value="HISTORY"/>
<put name="details" value="HISTORY_INFO"/> <put name="details" value="HISTORY_INFO"/>
<put name="body" value="/jsp/mindmapHistory.jsp"/> <put name="body" value="/jsp/mindmapHistory.jsp"/>

View File

@ -180,7 +180,7 @@
</property> </property>
<property name="mappings"> <property name="mappings">
<props> <props>
<prop key="/c/map/import.htm">importMapController</prop> <prop key="/c/maps/import.htm">importMapController</prop>
<!-- Review --> <!-- Review -->
<prop key="/c/publicView.htm">publicView</prop> <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="title" scope="page"/>
<tiles:importAttribute name="details" scope="page"/> <tiles:importAttribute name="details" scope="page"/>
<div class="modalDialog"> <div>
<!-- Header can be customized --> <!-- Header can be customized -->
<tiles:insert name="body"/> <tiles:insert name="body"/>
</div> </div>

View File

@ -28,7 +28,9 @@
var editorProperties = {zoom:${zoom},saveOnLoad:true,collab:'standalone',readOnly:true}; var editorProperties = {zoom:${zoom},saveOnLoad:true,collab:'standalone',readOnly:true};
designer = buildDesigner(editorProperties); 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 serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromDocument(domDocument);
var mindmap = serializer.loadFromDom(domDocument, mapId); 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); var designer = buildDesigner(options);
// Load map from XML ... // 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 persistence = mindplot.PersistenceManager.getInstance();
var mindmap = persistence.loadFromDom(mapId, domDocument); var mindmap = persistence.loadFromDom(mapId, domDocument);
designer.loadMap(mindmap); designer.loadMap(mindmap);

View File

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

View File

@ -87,7 +87,9 @@
var designer = buildDesigner(options); var designer = buildDesigner(options);
// Load map from XML ... // 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 persistence = mindplot.PersistenceManager.getInstance();
var mindmap = persistence.loadFromDom(mapId, domDocument); var mindmap = persistence.loadFromDom(mapId, domDocument);
designer.loadMap(mindmap); designer.loadMap(mindmap);

View File

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