Accept links in appname:id format

This commit is contained in:
Nathan Gray 2012-05-24 17:49:28 +00:00
parent efbb743cc6
commit acd7f43303

View File

@ -700,10 +700,19 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], {
set_value: function(_value) {
if(typeof _value != 'object' && _value && !this.options.application)
{
if(_value.indexOf(':') >= 0)
{
var app = _value.split(':',1);
var id = _value.substr(app[0].length+1);
_value = {'app': app[0], 'id': id};
}
else
{
console.warn("Bad value for link widget. Need an object with keys 'app', 'id', and optionally 'title'", _value);
return;
}
}
// Application set, just passed ID
else if (typeof _value != "object")
{