Skip to content

Commit

Permalink
Fixing #3926 - crach boom if use do "Add Page" and positioning = sele…
Browse files Browse the repository at this point in the history
…ct position and Next.
  • Loading branch information
mawtex committed Apr 24, 2012
1 parent c9e53d2 commit b124fad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,12 @@ private void PrepareStep2_ExecuteCode(object sender, EventArgs e)

if (this.GetBinding<string>("SelectedSortOrder") == "Relative")
{
var existingPages =
(from page in PageServices.GetChildren(GetParentId())
select new { Title = page.Title, Id = page.Id }).ToList();
var existingPages = new Dictionary<Guid, string>();

foreach (IPage page in PageServices.GetChildren(GetParentId()))
{
existingPages.Add(page.Id, page.Title);
}

if (this.BindingExist("ExistingPages") == false)
{
Expand All @@ -451,11 +454,11 @@ private void PrepareStep2_ExecuteCode(object sender, EventArgs e)

if (this.BindingExist("RelativeSelectedPageId") == false)
{
this.Bindings.Add("RelativeSelectedPageId", existingPages[0].Id);
this.Bindings.Add("RelativeSelectedPageId", existingPages.First().Key);
}
else
{
this.Bindings["RelativeSelectedPageId"] = existingPages[0].Id;
this.Bindings["RelativeSelectedPageId"] = existingPages.First().Key;
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<cms:formdefinition xmlns="http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0" xmlns:f="http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0" xmlns:cms="http://www.composite.net/ns/management/bindingforms/1.0">
<cms:bindings>
<cms:binding name="NewPage" type="Composite.Data.Types.IPage" />
<cms:binding name="ExistingPages" type="System.Collections.IList" optional="true" />
<cms:binding name="ExistingPages" type="System.Collections.IEnumerable" optional="true" />
<cms:binding name="RelativeSelectedPageId" type="System.Guid" optional="true" />
<cms:binding name="UrlTitleIsRequired" type="System.Boolean"/>
</cms:bindings>
Expand All @@ -29,7 +29,7 @@
</f:NullCheck.CheckValue>
<f:NullCheck.WhenNotNull>
<FieldGroup Label="${Composite.Plugins.PageElementProvider, AddNewPageStep2.LabelPositionSelectorPanel}">
<KeySelector Label="${Composite.Plugins.PageElementProvider, AddNewPageStep2.LabelPositionSelector}" OptionsKeyField="Id" OptionsLabelField="Title" Help="${Composite.Plugins.PageElementProvider, AddNewPageStep2.HelpPositionSelector}">
<KeySelector Label="${Composite.Plugins.PageElementProvider, AddNewPageStep2.LabelPositionSelector}" OptionsKeyField="Key" OptionsLabelField="Value" Help="${Composite.Plugins.PageElementProvider, AddNewPageStep2.HelpPositionSelector}">
<KeySelector.Options>
<cms:read source="ExistingPages" />
</KeySelector.Options>
Expand Down

0 comments on commit b124fad

Please sign in to comment.