mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
- Read only mode remove actions over topic icons
- Fix other JS Injection issues.
This commit is contained in:
parent
96de014d52
commit
592886519e
@ -18,23 +18,19 @@
|
|||||||
|
|
||||||
mindplot.ImageIcon = new Class({
|
mindplot.ImageIcon = new Class({
|
||||||
Extends:mindplot.Icon,
|
Extends:mindplot.Icon,
|
||||||
initialize:function(topic, iconModel) {
|
initialize:function (topic, iconModel, readOnly) {
|
||||||
$assert(iconModel, 'iconModel can not be null');
|
$assert(iconModel, 'iconModel can not be null');
|
||||||
$assert(topic, 'topic can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
|
|
||||||
this._topicId = topic.getId();
|
this._topicId = topic.getId();
|
||||||
this._featureModel = iconModel;
|
this._featureModel = iconModel;
|
||||||
|
|
||||||
// @Todo: Read only must be a property ...
|
|
||||||
this._readOnly = designer._readOnly;
|
|
||||||
|
|
||||||
// Build graph image representation ...
|
// Build graph image representation ...
|
||||||
var iconType = iconModel.getIconType();
|
var iconType = iconModel.getIconType();
|
||||||
var imgUrl = this._getImageUrl(iconType);
|
var imgUrl = this._getImageUrl(iconType);
|
||||||
this.parent(imgUrl);
|
this.parent(imgUrl);
|
||||||
|
|
||||||
//Remove
|
if (!readOnly) {
|
||||||
if (!this._readOnly) {
|
|
||||||
|
|
||||||
//Icon
|
//Icon
|
||||||
var image = this.getImage();
|
var image = this.getImage();
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
mindplot.LinkIcon = new Class({
|
mindplot.LinkIcon = new Class({
|
||||||
|
|
||||||
Extends:mindplot.Icon,
|
Extends:mindplot.Icon,
|
||||||
initialize : function(topic, linkModel) {
|
initialize:function (topic, linkModel, readOnly) {
|
||||||
$assert(topic, 'topic can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
$assert(linkModel, 'linkModel can not be null');
|
$assert(linkModel, 'linkModel can not be null');
|
||||||
|
|
||||||
|
|
||||||
this.parent(mindplot.LinkIcon.IMAGE_URL);
|
this.parent(mindplot.LinkIcon.IMAGE_URL);
|
||||||
this._linksModel = linkModel;
|
this._linksModel = linkModel;
|
||||||
this._topic = topic;
|
this._topic = topic;
|
||||||
|
this._readOnly = readOnly;
|
||||||
|
|
||||||
this._registerEvents();
|
this._registerEvents();
|
||||||
},
|
},
|
||||||
@ -34,11 +34,13 @@ mindplot.LinkIcon = new Class({
|
|||||||
_registerEvents:function () {
|
_registerEvents:function () {
|
||||||
this._image.setCursor('pointer');
|
this._image.setCursor('pointer');
|
||||||
|
|
||||||
|
if (!this._readOnly) {
|
||||||
// Add on click event to open the editor ...
|
// Add on click event to open the editor ...
|
||||||
this.addEvent('click', function (event) {
|
this.addEvent('click', function (event) {
|
||||||
this._topic.showLinkEditor();
|
this._topic.showLinkEditor();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
this._tip = new mindplot.widget.LinkIconTooltip(this);
|
this._tip = new mindplot.widget.LinkIconTooltip(this);
|
||||||
},
|
},
|
||||||
|
@ -18,12 +18,13 @@
|
|||||||
|
|
||||||
mindplot.NoteIcon = new Class({
|
mindplot.NoteIcon = new Class({
|
||||||
Extends:mindplot.Icon,
|
Extends:mindplot.Icon,
|
||||||
initialize : function(topic, noteModel) {
|
initialize:function (topic, noteModel, readOnly) {
|
||||||
$assert(topic, 'topic can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
|
|
||||||
this.parent(mindplot.NoteIcon.IMAGE_URL);
|
this.parent(mindplot.NoteIcon.IMAGE_URL);
|
||||||
this._linksModel = noteModel;
|
this._linksModel = noteModel;
|
||||||
this._topic = topic;
|
this._topic = topic;
|
||||||
|
this._readOnly = readOnly;
|
||||||
|
|
||||||
this._registerEvents();
|
this._registerEvents();
|
||||||
},
|
},
|
||||||
@ -31,11 +32,14 @@ mindplot.NoteIcon = new Class({
|
|||||||
_registerEvents:function () {
|
_registerEvents:function () {
|
||||||
this._image.setCursor('pointer');
|
this._image.setCursor('pointer');
|
||||||
|
|
||||||
|
if (!this._readOnly) {
|
||||||
|
|
||||||
// Add on click event to open the editor ...
|
// Add on click event to open the editor ...
|
||||||
this.addEvent('click', function (event) {
|
this.addEvent('click', function (event) {
|
||||||
this._topic.showNoteEditor();
|
this._topic.showNoteEditor();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
this._tip = new mindplot.widget.FloatingTip(this.getImage()._peer._native, {
|
this._tip = new mindplot.widget.FloatingTip(this.getImage()._peer._native, {
|
||||||
// Content can also be a function of the target element!
|
// Content can also be a function of the target element!
|
||||||
|
@ -267,8 +267,8 @@ mindplot.Topic = new Class({
|
|||||||
var featuresModel = model.getFeatures();
|
var featuresModel = model.getFeatures();
|
||||||
for (var i = 0; i < featuresModel.length; i++) {
|
for (var i = 0; i < featuresModel.length; i++) {
|
||||||
var featureModel = featuresModel[i];
|
var featureModel = featuresModel[i];
|
||||||
var icon = mindplot.TopicFeature.createIcon(this, featureModel);
|
var icon = mindplot.TopicFeature.createIcon(this, featureModel, this.isReadOnly());
|
||||||
result.addIcon(icon, featureModel.getType() == "icon"); // @Todo: Remove hack ...
|
result.addIcon(icon, featureModel.getType() == mindplot.TopicFeature.Icon.id && !this.isReadOnly());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -284,8 +284,8 @@ mindplot.Topic = new Class({
|
|||||||
var feature = model.createFeature(type, attributes);
|
var feature = model.createFeature(type, attributes);
|
||||||
model.addFeature(feature);
|
model.addFeature(feature);
|
||||||
|
|
||||||
var result = mindplot.TopicFeature.createIcon(this, feature);
|
var result = mindplot.TopicFeature.createIcon(this, feature, this.isReadOnly());
|
||||||
iconGroup.addIcon(result, type == "icon"); // @Todo: Remove hack ...
|
iconGroup.addIcon(result, type == mindplot.TopicFeature.Icon.id && !this.isReadOnly());
|
||||||
|
|
||||||
this._adjustShapes();
|
this._adjustShapes();
|
||||||
return result;
|
return result;
|
||||||
@ -669,6 +669,7 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
showNoteEditor:function () {
|
showNoteEditor:function () {
|
||||||
|
|
||||||
|
|
||||||
var topicId = this.getId();
|
var topicId = this.getId();
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var editorModel = {
|
var editorModel = {
|
||||||
|
@ -51,14 +51,14 @@ mindplot.TopicFeature = {
|
|||||||
return new model(attributes);
|
return new model(attributes);
|
||||||
},
|
},
|
||||||
|
|
||||||
createIcon : function(topic, model) {
|
createIcon:function (topic, model, readOnly) {
|
||||||
$assert(topic, 'topic can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
$assert(model, 'model can not be null');
|
$assert(model, 'model can not be null');
|
||||||
|
|
||||||
var icon = mindplot.TopicFeature._featuresMetadataById.filter(function (elem) {
|
var icon = mindplot.TopicFeature._featuresMetadataById.filter(function (elem) {
|
||||||
return elem.id == model.getType();
|
return elem.id == model.getType();
|
||||||
})[0].icon;
|
})[0].icon;
|
||||||
return new icon(topic, model);
|
return new icon(topic, model, readOnly);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<base href="${baseURL}/">
|
<base href="${baseURL}/">
|
||||||
<title><spring:message code="SITE.TITLE"/> - ${mindmap.title} </title>
|
<title><spring:message code="SITE.TITLE"/> - <c:out value="${mindmap.title}"/></title>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
@ -73,14 +73,15 @@
|
|||||||
</c:if>
|
</c:if>
|
||||||
<c:if test="${memoryPersistence}">
|
<c:if test="${memoryPersistence}">
|
||||||
<span><a href="c/keyboard" id="keyboardShortcuts"><spring:message code="SHORTCUTS"/></a></span> |
|
<span><a href="c/keyboard" id="keyboardShortcuts"><spring:message code="SHORTCUTS"/></a></span> |
|
||||||
<span><a href="c/user/registration" title="<spring:message code="REGISTER"/>"><spring:message code="REGISTER"/></a></span>
|
<span><a href="c/user/registration" title="<spring:message code="REGISTER"/>"><spring:message
|
||||||
|
code="REGISTER"/></a></span>
|
||||||
</c:if>
|
</c:if>
|
||||||
</div>
|
</div>
|
||||||
<a href="c/maps/">
|
<a href="c/maps/">
|
||||||
<div id="headerLogo"></div>
|
<div id="headerLogo"></div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div id="headerMapTitle"><spring:message code="NAME"/>: <span>${mindmap.title}</span></div>
|
<div id="headerMapTitle"><spring:message code="NAME"/>: <span><c:out value="${mindmap.title}"/></span></div>
|
||||||
</div>
|
</div>
|
||||||
<%@ include file="/jsp/mindmapEditorToolbar.jsf" %>
|
<%@ include file="/jsp/mindmapEditorToolbar.jsf" %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
bUseRendered:false,
|
bUseRendered:false,
|
||||||
mDataProp:"title",
|
mDataProp:"title",
|
||||||
fnRender:function (obj) {
|
fnRender:function (obj) {
|
||||||
return $('<a href="c/maps/' + obj.aData.id + '/edit"></a>').text(obj.aData.title).html();
|
return '<a href="c/maps/' + obj.aData.id + '/edit">' + $('<span></span>').text(obj.aData.title).html() + '</a>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user