MINOR fixed bug where widget area editor would not be activated (from r94829)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@95652 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-12-16 06:00:08 +00:00
parent 5ac94c6c2c
commit a56f9775d3

View File

@ -5,8 +5,7 @@ WidgetAreaEditorClass.prototype = {
this.name = this.getAttribute('name'); this.name = this.getAttribute('name');
this.rewriteWidgetAreaAttributes(); this.rewriteWidgetAreaAttributes();
UsedWidget.applyToChildren($('usedWidgets-'+this.name), 'div.Widget'); UsedWidget.applyToChildren($('usedWidgets-'+this.name), 'div.Widget');
// Make available widgets draggable
var availableWidgets = $('availableWidgets-'+this.name).childNodes; var availableWidgets = $('availableWidgets-'+this.name).childNodes;
for(var i = 0; i < availableWidgets.length; i++) { for(var i = 0; i < availableWidgets.length; i++) {
@ -114,8 +113,8 @@ WidgetAreaEditorClass.prototype = {
if ($('WidgetAreaEditor-'+holder).getAttribute('maxwidgets')) { if ($('WidgetAreaEditor-'+holder).getAttribute('maxwidgets')) {
var maxCount = $('WidgetAreaEditor-'+holder).getAttribute('maxwidgets'); var maxCount = $('WidgetAreaEditor-'+holder).getAttribute('maxwidgets');
var count = $$('#usedWidgets-'+holder+' .Widget').length; var count = $$('#usedWidgets-'+holder+' .Widget').length;
if (count > maxCount) { if (count+1 > maxCount) {
alert('Sorry, you have reached the maximum number of widgets in this area'); alert(ss.i18n._t('WidgetAreaEditor.TOOMANY'));
return; return;
} }
} }
@ -255,11 +254,4 @@ WidgetTreeDropdownField.prototype = {
} }
WidgetTreeDropdownField.applyTo('div.usedWidgets .TreeDropdownField'); WidgetTreeDropdownField.applyTo('div.usedWidgets .TreeDropdownField');
WidgetAreaEditorClass.applyTo('.WidgetAreaEditor');
// Loop over all WidgetAreas and fire 'em up
var wAs = $$('.WidgetAreaEditor');
for(var i = 0; i < wAs.length; i++) {
WidgetAreaEditorClass.applyTo('div#'+wAs[i].id);
}