From c4c3f30303b7e682e6c729b8a0b017b8a8af9749 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 3 Sep 2012 21:13:35 -0300 Subject: [PATCH] Bug TypeError: c is undefined, line:4491 fixed. --- .../src/main/javascript/model/LinkModel.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mindplot/src/main/javascript/model/LinkModel.js b/mindplot/src/main/javascript/model/LinkModel.js index b30d93cf..259adc87 100644 --- a/mindplot/src/main/javascript/model/LinkModel.js +++ b/mindplot/src/main/javascript/model/LinkModel.js @@ -17,33 +17,37 @@ */ mindplot.model.LinkModel = new Class({ - Extends: mindplot.model.FeatureModel, - initialize : function(attributes) { + Extends:mindplot.model.FeatureModel, + initialize:function (attributes) { this.parent(mindplot.model.LinkModel.FEATURE_TYPE); this.setUrl(attributes.url); }, - getUrl : function() { + getUrl:function () { return this.getAttribute('url'); }, - setUrl : function(url) { + setUrl:function (url) { $assert(url, 'url can not be null'); var fixedUrl = this._fixUrl(url); this.setAttribute('url', fixedUrl); var type = fixedUrl.contains('mailto:') ? 'mail' : 'url'; - this.setAttribute('type', type); - + this.setAttribute('urlType', type); }, - _fixUrl : function(url) { + _fixUrl:function (url) { var result = url; if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) { result = "http://" + result; } return result; + }, + + setUrlType:function (urlType) { + $assert(urlType, 'urlType can not be null'); + this.setAttribute('urlType', urlType); } });