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({
|
||||
Extends:mindplot.Icon,
|
||||
initialize:function(topic, iconModel) {
|
||||
initialize:function (topic, iconModel, readOnly) {
|
||||
$assert(iconModel, 'iconModel can not be null');
|
||||
$assert(topic, 'topic can not be null');
|
||||
|
||||
this._topicId = topic.getId();
|
||||
this._featureModel = iconModel;
|
||||
|
||||
// @Todo: Read only must be a property ...
|
||||
this._readOnly = designer._readOnly;
|
||||
|
||||
// Build graph image representation ...
|
||||
var iconType = iconModel.getIconType();
|
||||
var imgUrl = this._getImageUrl(iconType);
|
||||
this.parent(imgUrl);
|
||||
|
||||
//Remove
|
||||
if (!this._readOnly) {
|
||||
if (!readOnly) {
|
||||
|
||||
//Icon
|
||||
var image = this.getImage();
|
||||
|
@ -19,14 +19,14 @@
|
||||
mindplot.LinkIcon = new Class({
|
||||
|
||||
Extends:mindplot.Icon,
|
||||
initialize : function(topic, linkModel) {
|
||||
initialize:function (topic, linkModel, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(linkModel, 'linkModel can not be null');
|
||||
|
||||
|
||||
this.parent(mindplot.LinkIcon.IMAGE_URL);
|
||||
this._linksModel = linkModel;
|
||||
this._topic = topic;
|
||||
this._readOnly = readOnly;
|
||||
|
||||
this._registerEvents();
|
||||
},
|
||||
@ -34,11 +34,13 @@ mindplot.LinkIcon = new Class({
|
||||
_registerEvents:function () {
|
||||
this._image.setCursor('pointer');
|
||||
|
||||
if (!this._readOnly) {
|
||||
// Add on click event to open the editor ...
|
||||
this.addEvent('click', function (event) {
|
||||
this._topic.showLinkEditor();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this._tip = new mindplot.widget.LinkIconTooltip(this);
|
||||
},
|
||||
|
@ -18,12 +18,13 @@
|
||||
|
||||
mindplot.NoteIcon = new Class({
|
||||
Extends:mindplot.Icon,
|
||||
initialize : function(topic, noteModel) {
|
||||
initialize:function (topic, noteModel, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
|
||||
this.parent(mindplot.NoteIcon.IMAGE_URL);
|
||||
this._linksModel = noteModel;
|
||||
this._topic = topic;
|
||||
this._readOnly = readOnly;
|
||||
|
||||
this._registerEvents();
|
||||
},
|
||||
@ -31,11 +32,14 @@ mindplot.NoteIcon = new Class({
|
||||
_registerEvents:function () {
|
||||
this._image.setCursor('pointer');
|
||||
|
||||
if (!this._readOnly) {
|
||||
|
||||
// Add on click event to open the editor ...
|
||||
this.addEvent('click', function (event) {
|
||||
this._topic.showNoteEditor();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this._tip = new mindplot.widget.FloatingTip(this.getImage()._peer._native, {
|
||||
// Content can also be a function of the target element!
|
||||
|
@ -267,8 +267,8 @@ mindplot.Topic = new Class({
|
||||
var featuresModel = model.getFeatures();
|
||||
for (var i = 0; i < featuresModel.length; i++) {
|
||||
var featureModel = featuresModel[i];
|
||||
var icon = mindplot.TopicFeature.createIcon(this, featureModel);
|
||||
result.addIcon(icon, featureModel.getType() == "icon"); // @Todo: Remove hack ...
|
||||
var icon = mindplot.TopicFeature.createIcon(this, featureModel, this.isReadOnly());
|
||||
result.addIcon(icon, featureModel.getType() == mindplot.TopicFeature.Icon.id && !this.isReadOnly());
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -284,8 +284,8 @@ mindplot.Topic = new Class({
|
||||
var feature = model.createFeature(type, attributes);
|
||||
model.addFeature(feature);
|
||||
|
||||
var result = mindplot.TopicFeature.createIcon(this, feature);
|
||||
iconGroup.addIcon(result, type == "icon"); // @Todo: Remove hack ...
|
||||
var result = mindplot.TopicFeature.createIcon(this, feature, this.isReadOnly());
|
||||
iconGroup.addIcon(result, type == mindplot.TopicFeature.Icon.id && !this.isReadOnly());
|
||||
|
||||
this._adjustShapes();
|
||||
return result;
|
||||
@ -669,6 +669,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
showNoteEditor:function () {
|
||||
|
||||
|
||||
var topicId = this.getId();
|
||||
var model = this.getModel();
|
||||
var editorModel = {
|
||||
|
@ -51,14 +51,14 @@ mindplot.TopicFeature = {
|
||||
return new model(attributes);
|
||||
},
|
||||
|
||||
createIcon : function(topic, model) {
|
||||
createIcon:function (topic, model, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(model, 'model can not be null');
|
||||
|
||||
var icon = mindplot.TopicFeature._featuresMetadataById.filter(function (elem) {
|
||||
return elem.id == model.getType();
|
||||
})[0].icon;
|
||||
return new icon(topic, model);
|
||||
return new icon(topic, model, readOnly);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<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]>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<![endif]-->
|
||||
@ -73,14 +73,15 @@
|
||||
</c:if>
|
||||
<c:if test="${memoryPersistence}">
|
||||
<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>
|
||||
</div>
|
||||
<a href="c/maps/">
|
||||
<div id="headerLogo"></div>
|
||||
</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>
|
||||
<%@ include file="/jsp/mindmapEditorToolbar.jsf" %>
|
||||
</div>
|
||||
|
@ -58,7 +58,7 @@
|
||||
bUseRendered:false,
|
||||
mDataProp:"title",
|
||||
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