MINOR Better failsafes for tree hints (allows add if hint for class is if not defined)

This commit is contained in:
Ingo Schommer 2012-01-09 13:20:11 +01:00
parent d88075edea
commit e34f56dcc6
1 changed files with 5 additions and 2 deletions

View File

@ -44,8 +44,11 @@
metadata = this.find('#ParentID .TreeDropdownField').data('metadata'),
id = this.find('#ParentID .TreeDropdownField').getValue(),
newClassName = metadata ? metadata.ClassName : null,
disallowedChildren = hints[newClassName ? newClassName : 'Root'].disallowedChildren || [],
defaultChildClass = hints[newClassName ? newClassName : 'Root'].defaultChild || null;
hintKey = newClassName ? newClassName : 'Root',
hint = (typeof hints[hintKey] != 'undefined') ? hints[key] : null;
var disallowedChildren = (hint && typeof hint.disallowedChildren != 'undefined') ? hint.disallowedChildren : [],
defaultChildClass = (hint && typeof hint.defaultChild != 'undefined') ? hint.defaultChild : null;
// Limit selection
this.find('#PageType li').each(function() {