- Read only mode remove actions over topic icons

- Fix other JS Injection issues.
This commit is contained in:
Paulo Gustavo Veiga 2012-08-29 20:17:35 -03:00
parent 96de014d52
commit 592886519e
8 changed files with 135 additions and 131 deletions

View File

@ -17,12 +17,12 @@
*/ */
mindplot.IconGroup = new Class({ mindplot.IconGroup = new Class({
initialize : function(topicId, iconSize) { initialize:function (topicId, iconSize) {
$assert($defined(topicId), "topicId can not be null"); $assert($defined(topicId), "topicId can not be null");
$assert($defined(iconSize), "iconSize can not be null"); $assert($defined(iconSize), "iconSize can not be null");
this._icons = []; this._icons = [];
this._group = new web2d.Group({width: 0, height:iconSize,x: 0, y:0, coordSizeWidth:0,coordSizeHeight:100}); this._group = new web2d.Group({width:0, height:iconSize, x:0, y:0, coordSizeWidth:0, coordSizeHeight:100});
this._removeTip = new mindplot.IconGroup.RemoveTip(this._group, topicId); this._removeTip = new mindplot.IconGroup.RemoveTip(this._group, topicId);
this.seIconSize(iconSize, iconSize); this.seIconSize(iconSize, iconSize);
@ -30,28 +30,28 @@ mindplot.IconGroup = new Class({
}, },
setPosition : function(x, y) { setPosition:function (x, y) {
this._group.setPosition(x, y); this._group.setPosition(x, y);
}, },
getPosition : function() { getPosition:function () {
return this._group.getPosition(); return this._group.getPosition();
}, },
getNativeElement : function() { getNativeElement:function () {
return this._group; return this._group;
}, },
getSize : function() { getSize:function () {
return this._group.getSize(); return this._group.getSize();
}, },
seIconSize : function(width, height) { seIconSize:function (width, height) {
this._iconSize = {width:width,height:height}; this._iconSize = {width:width, height:height};
this._resize(this._icons.length); this._resize(this._icons.length);
}, },
addIcon : function(icon, remove) { addIcon:function (icon, remove) {
$defined(icon, "icon is not defined"); $defined(icon, "icon is not defined");
icon.setGroup(this); icon.setGroup(this);
@ -70,9 +70,9 @@ mindplot.IconGroup = new Class({
} }
}, },
_findIconFromModel : function(iconModel) { _findIconFromModel:function (iconModel) {
var result = null; var result = null;
this._icons.each(function(icon) { this._icons.each(function (icon) {
var elModel = icon.getModel(); var elModel = icon.getModel();
if (elModel.getId() == iconModel.getId()) { if (elModel.getId() == iconModel.getId()) {
result = icon; result = icon;
@ -86,14 +86,14 @@ mindplot.IconGroup = new Class({
return result; return result;
}, },
removeIconByModel : function(featureModel) { removeIconByModel:function (featureModel) {
$assert(featureModel, "featureModel can not be null"); $assert(featureModel, "featureModel can not be null");
var icon = this._findIconFromModel(featureModel); var icon = this._findIconFromModel(featureModel);
this._removeIcon(icon); this._removeIcon(icon);
}, },
_removeIcon : function(icon) { _removeIcon:function (icon) {
$assert(icon, "icon can not be null"); $assert(icon, "icon can not be null");
this._removeTip.close(0); this._removeTip.close(0);
@ -103,36 +103,36 @@ mindplot.IconGroup = new Class({
this._resize(this._icons.length); this._resize(this._icons.length);
// Add all again ... // Add all again ...
this._icons.each(function(elem, i) { this._icons.each(function (elem, i) {
this._positionIcon(elem, i); this._positionIcon(elem, i);
}.bind(this)); }.bind(this));
}, },
moveToFront : function() { moveToFront:function () {
this._group.moveToFront(); this._group.moveToFront();
}, },
_registerListeners : function() { _registerListeners:function () {
this._group.addEvent('click', function(event) { this._group.addEvent('click', function (event) {
// Avoid node creation ... // Avoid node creation ...
event.stopPropagation(); event.stopPropagation();
}); });
this._group.addEvent('dblclick', function(event) { this._group.addEvent('dblclick', function (event) {
event.stopPropagation(); event.stopPropagation();
}); });
}, },
_resize : function(iconsLength) { _resize:function (iconsLength) {
this._group.setSize(iconsLength * this._iconSize.width, this._iconSize.height); this._group.setSize(iconsLength * this._iconSize.width, this._iconSize.height);
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2); var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
this._group.setCoordSize(iconsLength * iconSize, iconSize); this._group.setCoordSize(iconsLength * iconSize, iconSize);
}, },
_positionIcon : function(icon, order) { _positionIcon:function (icon, order) {
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2); var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
icon.getImage().setPosition(iconSize * order + mindplot.IconGroup.ICON_PADDING, mindplot.IconGroup.ICON_PADDING); icon.getImage().setPosition(iconSize * order + mindplot.IconGroup.ICON_PADDING, mindplot.IconGroup.ICON_PADDING);
@ -141,13 +141,13 @@ mindplot.IconGroup = new Class({
mindplot.IconGroup.ICON_PADDING = 5; mindplot.IconGroup.ICON_PADDING = 5;
mindplot.IconGroup.RemoveTip = new Class({ mindplot.IconGroup.RemoveTip = new Class({
initialize : function(container) { initialize:function (container) {
$assert(container, "group can not be null"); $assert(container, "group can not be null");
this._fadeElem = container; this._fadeElem = container;
}, },
show : function(topicId, icon) { show:function (topicId, icon) {
$assert(icon, 'icon can not be null'); $assert(icon, 'icon can not be null');
// Nothing to do ... // Nothing to do ...
@ -162,15 +162,15 @@ mindplot.IconGroup.RemoveTip = new Class({
// Register events ... // Register events ...
var widget = this._buildWeb2d(); var widget = this._buildWeb2d();
widget.addEvent('click', function() { widget.addEvent('click', function () {
icon.remove(); icon.remove();
}); });
widget.addEvent('mouseover', function() { widget.addEvent('mouseover', function () {
this.show(topicId, icon); this.show(topicId, icon);
}.bind(this)); }.bind(this));
widget.addEvent('mouseout', function() { widget.addEvent('mouseout', function () {
this.hide(); this.hide();
}.bind(this)); }.bind(this));
@ -186,11 +186,11 @@ mindplot.IconGroup.RemoveTip = new Class({
} }
}, },
hide : function() { hide:function () {
this.close(200); this.close(200);
}, },
close : function(delay) { close:function (delay) {
// This is not ok, trying to close the same dialog twice ? // This is not ok, trying to close the same dialog twice ?
if (this._closeTimeoutId) { if (this._closeTimeoutId) {
@ -199,7 +199,7 @@ mindplot.IconGroup.RemoveTip = new Class({
if (this._activeIcon) { if (this._activeIcon) {
var widget = this._widget; var widget = this._widget;
var close = function() { var close = function () {
this._activeIcon = null; this._activeIcon = null;
this._fadeElem.removeChild(widget); this._fadeElem.removeChild(widget);
@ -218,19 +218,19 @@ mindplot.IconGroup.RemoveTip = new Class({
} }
}, },
_buildWeb2d : function() { _buildWeb2d:function () {
var result = new web2d.Group({ var result = new web2d.Group({
width: 10, width:10,
height:10, height:10,
x: 0, x:0,
y:0, y:0,
coordSizeWidth:10, coordSizeWidth:10,
coordSizeHeight:10 coordSizeHeight:10
}); });
var outerRect = new web2d.Rect(0, { var outerRect = new web2d.Rect(0, {
x: 0, x:0,
y: 0, y:0,
width:10, width:10,
height:10, height:10,
stroke:'0', stroke:'0',
@ -240,8 +240,8 @@ mindplot.IconGroup.RemoveTip = new Class({
outerRect.setCursor('pointer'); outerRect.setCursor('pointer');
var innerRect = new web2d.Rect(0, { var innerRect = new web2d.Rect(0, {
x: 1, x:1,
y: 1, y:1,
width:8, width:8,
height:8, height:8,
stroke:'1 solid white', stroke:'1 solid white',
@ -260,10 +260,10 @@ mindplot.IconGroup.RemoveTip = new Class({
result.appendChild(line2); result.appendChild(line2);
// Some events ... // Some events ...
result.addEvent('mouseover', function() { result.addEvent('mouseover', function () {
innerRect.setFill('#CC0033'); innerRect.setFill('#CC0033');
}); });
result.addEvent('mouseout', function() { result.addEvent('mouseout', function () {
innerRect.setFill('gray'); innerRect.setFill('gray');
}); });
@ -271,14 +271,14 @@ mindplot.IconGroup.RemoveTip = new Class({
return result; return result;
}, },
decorate : function(topicId, icon) { decorate:function (topicId, icon) {
if (!icon.__remove) { if (!icon.__remove) {
icon.addEvent('mouseover', function() { icon.addEvent('mouseover', function () {
this.show(topicId, icon); this.show(topicId, icon);
}.bind(this)); }.bind(this));
icon.addEvent('mouseout', function() { icon.addEvent('mouseout', function () {
this.hide(); this.hide();
}.bind(this)); }.bind(this));
icon.__remove = true; icon.__remove = true;

View File

@ -18,27 +18,23 @@
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();
image.addEvent('click', function() { image.addEvent('click', function () {
var iconType = iconModel.getIconType(); var iconType = iconModel.getIconType();
var newIconType = this._getNextFamilyIconId(iconType); var newIconType = this._getNextFamilyIconId(iconType);
@ -52,15 +48,15 @@ mindplot.ImageIcon = new Class({
} }
}, },
_getImageUrl : function(iconId) { _getImageUrl:function (iconId) {
return "icons/" + iconId + ".png"; return "icons/" + iconId + ".png";
}, },
getModel : function() { getModel:function () {
return this._featureModel; return this._featureModel;
}, },
_getNextFamilyIconId : function(iconId) { _getNextFamilyIconId:function (iconId) {
var familyIcons = this._getFamilyIcons(iconId); var familyIcons = this._getFamilyIcons(iconId);
$assert(familyIcons != null, "Family Icon not found!"); $assert(familyIcons != null, "Family Icon not found!");
@ -81,7 +77,7 @@ mindplot.ImageIcon = new Class({
return result; return result;
}, },
_getFamilyIcons : function(iconId) { _getFamilyIcons:function (iconId) {
$assert(iconId != null, "id must not be null"); $assert(iconId != null, "id must not be null");
$assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')"); $assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')");
@ -98,7 +94,7 @@ mindplot.ImageIcon = new Class({
return result; return result;
}, },
remove : function() { remove:function () {
var actionDispatcher = mindplot.ActionDispatcher.getInstance(); var actionDispatcher = mindplot.ActionDispatcher.getInstance();
var featureId = this._featureModel.getId(); var featureId = this._featureModel.getId();
var topicId = this._topicId; var topicId = this._topicId;
@ -108,29 +104,29 @@ mindplot.ImageIcon = new Class({
mindplot.ImageIcon.prototype.ICON_FAMILIES = [ mindplot.ImageIcon.prototype.ICON_FAMILIES = [
{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]}, {"id":"face", "icons":["face_plain", "face_sad", "face_crying", "face_smile", "face_surprise", "face_wink"]},
{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]}, {"id":"funy", "icons":["funy_angel", "funy_devilish", "funy_glasses", "funy_grin", "funy_kiss", "funy_monkey"]},
{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]}, {"id":"conn", "icons":["conn_connect", "conn_disconnect"]},
{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]}, {"id":"sport", "icons":["sport_basketball", "sport_football", "sport_golf", "sport_raquet", "sport_shuttlecock", "sport_soccer", "sport_tennis"]},
{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]}, {"id":"bulb", "icons":["bulb_light_on", "bulb_light_off"]},
{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]}, {"id":"thumb", "icons":["thumb_thumb_up", "thumb_thumb_down"]},
{"id": "tick", "icons" : ["tick_tick","tick_cross"]}, {"id":"tick", "icons":["tick_tick", "tick_cross"]},
{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]}, {"id":"onoff", "icons":["onoff_clock", "onoff_clock_red", "onoff_add", "onoff_delete", "onoff_status_offline", "onoff_status_online"]},
{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]}, {"id":"money", "icons":["money_money", "money_dollar", "money_euro", "money_pound", "money_yen", "money_coins", "money_ruby"]},
{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]}, {"id":"time", "icons":["time_calendar", "time_clock", "time_hourglass"]},
{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]}, {"id":"chart", "icons":["chart_bar", "chart_line", "chart_curve", "chart_pie", "chart_organisation"]},
{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]}, {"id":"sign", "icons":["sign_warning", "sign_info", "sign_stop", "sign_help", "sign_cancel"]},
{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]}, {"id":"hard", "icons":["hard_cd", "hard_computer", "hard_controller", "hard_driver_disk", "hard_ipod", "hard_keyboard", "hard_mouse", "hard_printer"]},
{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]}, {"id":"soft", "icons":["soft_bug", "soft_cursor", "soft_database_table", "soft_database", "soft_feed", "soft_folder_explore", "soft_rss", "soft_penguin"]},
{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]}, {"id":"arrow", "icons":["arrow_up", "arrow_down", "arrow_left", "arrow_right"]},
{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]}, {"id":"arrowc", "icons":["arrowc_rotate_anticlockwise", "arrowc_rotate_clockwise", "arrowc_turn_left", "arrowc_turn_right"]},
{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]}, {"id":"people", "icons":["people_group", "people_male1", "people_male2", "people_female1", "people_female2"]},
{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]}, {"id":"mail", "icons":["mail_envelop", "mail_mailbox", "mail_edit", "mail_list"]},
{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]}, {"id":"flag", "icons":["flag_blue", "flag_green", "flag_orange", "flag_pink", "flag_purple", "flag_yellow"]},
{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]}, {"id":"bullet", "icons":["bullet_black", "bullet_blue", "bullet_green", "bullet_orange", "bullet_red", "bullet_pink", "bullet_purple"]},
{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]}, {"id":"tag", "icons":["tag_blue", "tag_green", "tag_orange", "tag_red", "tag_pink", "tag_yellow"]},
{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]}, {"id":"object", "icons":["object_bell", "object_clanbomber", "object_key", "object_pencil", "object_phone", "object_magnifier", "object_clip", "object_music", "object_star", "object_wizard", "object_house", "object_cake", "object_camera", "object_palette", "object_rainbow"]},
{"id": "weather", "icons" : ["weather_clear-night","weather_clear","weather_few-clouds-night","weather_few-clouds","weather_overcast","weather_severe-alert","weather_showers-scattered","weather_showers","weather_snow","weather_storm"]} {"id":"weather", "icons":["weather_clear-night", "weather_clear", "weather_few-clouds-night", "weather_few-clouds", "weather_overcast", "weather_severe-alert", "weather_showers-scattered", "weather_showers", "weather_snow", "weather_storm"]}
]; ];

View File

@ -18,32 +18,34 @@
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();
}, },
_registerEvents : function() { _registerEvents:function () {
this._image.setCursor('pointer'); this._image.setCursor('pointer');
// Add on click event to open the editor ... if (!this._readOnly) {
this.addEvent('click', function(event) { // Add on click event to open the editor ...
this._topic.showLinkEditor(); this.addEvent('click', function (event) {
event.stopPropagation(); this._topic.showLinkEditor();
}.bind(this)); event.stopPropagation();
}.bind(this));
}
this._tip = new mindplot.widget.LinkIconTooltip(this); this._tip = new mindplot.widget.LinkIconTooltip(this);
}, },
getModel : function() { getModel:function () {
return this._linksModel; return this._linksModel;
} }
}); });

View File

@ -17,29 +17,33 @@
*/ */
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();
}, },
_registerEvents : function() { _registerEvents:function () {
this._image.setCursor('pointer'); this._image.setCursor('pointer');
// Add on click event to open the editor ... if (!this._readOnly) {
this.addEvent('click', function(event) {
this._topic.showNoteEditor(); // Add on click event to open the editor ...
event.stopPropagation(); this.addEvent('click', function (event) {
}.bind(this)); this._topic.showNoteEditor();
event.stopPropagation();
}.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!
content: function() { content:function () {
var result = new Element('div'); var result = new Element('div');
result.setStyles({padding:'5px'}); result.setStyles({padding:'5px'});
@ -48,14 +52,14 @@ mindplot.NoteIcon = new Class({
'font-weight':'bold', 'font-weight':'bold',
color:'black', color:'black',
'padding-bottom':'5px', 'padding-bottom':'5px',
width: '100px' width:'100px'
}); });
title.inject(result); title.inject(result);
var text = new Element('div', {text:this._linksModel.getText()}); var text = new Element('div', {text:this._linksModel.getText()});
text.setStyles({ text.setStyles({
'white-space': 'pre-wrap', 'white-space':'pre-wrap',
'word-wrap': 'break-word' 'word-wrap':'break-word'
} }
); );
text.inject(result); text.inject(result);
@ -63,17 +67,17 @@ mindplot.NoteIcon = new Class({
return result; return result;
}.bind(this), }.bind(this),
html: true, html:true,
position: 'bottom', position:'bottom',
arrowOffset : 10, arrowOffset:10,
center: true, center:true,
arrowSize: 15, arrowSize:15,
offset : {x:10,y:20}, offset:{x:10, y:20},
className:'notesTip' className:'notesTip'
}); });
}, },
getModel : function() { getModel:function () {
return this._linksModel; return this._linksModel;
} }
}); });

View File

@ -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 = {

View File

@ -17,51 +17,51 @@
*/ */
mindplot.TopicFeature = { mindplot.TopicFeature = {
Icon: { Icon:{
id:mindplot.model.IconModel.FEATURE_TYPE, id:mindplot.model.IconModel.FEATURE_TYPE,
model: mindplot.model.IconModel, model:mindplot.model.IconModel,
icon : mindplot.ImageIcon icon:mindplot.ImageIcon
}, },
Link: { Link:{
id: mindplot.model.LinkModel.FEATURE_TYPE, id:mindplot.model.LinkModel.FEATURE_TYPE,
model: mindplot.model.LinkModel, model:mindplot.model.LinkModel,
icon : mindplot.LinkIcon icon:mindplot.LinkIcon
}, },
Note: { Note:{
id: mindplot.model.NoteModel.FEATURE_TYPE, id:mindplot.model.NoteModel.FEATURE_TYPE,
model: mindplot.model.NoteModel, model:mindplot.model.NoteModel,
icon : mindplot.NoteIcon icon:mindplot.NoteIcon
}, },
isSupported : function(id) { isSupported:function (id) {
return mindplot.TopicFeature._featuresMetadataById.some(function(elem) { return mindplot.TopicFeature._featuresMetadataById.some(function (elem) {
return elem.id == id; return elem.id == id;
}); });
}, },
createModel : function(id, attributes) { createModel:function (id, attributes) {
$assert(id, 'type can not be null'); $assert(id, 'type can not be null');
$assert(attributes, 'attributes can not be null'); $assert(attributes, 'attributes can not be null');
var model = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) { var model = mindplot.TopicFeature._featuresMetadataById.filter(function (elem) {
return elem.id == id; return elem.id == id;
})[0].model; })[0].model;
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);
} }
}; };
mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon,mindplot.TopicFeature.Link,mindplot.TopicFeature.Note]; mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon, mindplot.TopicFeature.Link, mindplot.TopicFeature.Note];

View File

@ -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>

View File

@ -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>';
} }
}, },
{ {