
Author: lgiessmann Date: Thu Jun 25 06:23:01 2009 New Revision: 65 Log: ajax-client: fixed a bug that occurs if an existing association(-type) doesn't match any constraint Modified: trunk/src/ajax/javascripts/datamodel.js Modified: trunk/src/ajax/javascripts/datamodel.js ============================================================================== --- trunk/src/ajax/javascripts/datamodel.js (original) +++ trunk/src/ajax/javascripts/datamodel.js Thu Jun 25 06:23:01 2009 @@ -2743,7 +2743,6 @@ this.__error__.insert({"before" : role.getFrame()}) } role.hideAddButton(); - } }, "__createFromContent__" : function(contents){ @@ -4096,6 +4095,7 @@ function makeTypes(myself, typeContent, xtypescopes) { var types = new Array(); + var matched = false; for(var i = 0; xtypescopes && i !== xtypescopes.length; ++i){ var xtype = xtypescopes[i].nameType; if(!xtype) xtype = xtypescopes[i].occurrenceType; @@ -4104,11 +4104,14 @@ types.push(xtype[j]); if(typeContent && typeContent[0] === xtype[j]){ var selected = xtype[j]; + matched = true; if(types.length !== 0) types[types.length - 1] = types[0]; types[0] = selected; } } } + if(matched === false && typeContent && typeContent.length !== 0) types.unshift(typeContent); + if(types.length === 0 && typeContent && typeContent.length !== 0) types = typeContent; if(!types || types.length === 0) types = new Array(""); myself.__type__ = new Object();