private void InsertRoot(ContentItem root) { if (root.ID == Status.RootItemID) { ltRootNode.Text = "<span class='ok'>Root node inserted.</span>"; phSame.Visible = false; phDiffer.Visible = false; } else { ltRootNode.Text = string.Format( "<span class='warning'>Root node inserted but you must update web.config with root item id: <b>{0}</b></span> ", root.ID); phSame.Visible = true; phDiffer.Visible = false; RootId = root.ID; StartId = root.ID; phSame.DataBind(); } // try to find a suitable start page foreach (ContentItem item in root.Children) { ItemDefinition id = Engine.Definitions.GetDefinition(item); if (InstallationManager.Is(id.Installer, InstallerHint.PreferredStartPage)) { if (item.ID == Status.StartPageID && root.ID == Status.RootItemID) { ltRootNode.Text = "<span class='ok'>Root and start page inserted.</span>"; Installer.UpdateStatus(SystemStatusLevel.UpAndRunning); } else { ltRootNode.Text = string.Format( "<span class='warning'>Start page inserted but you must update web.config with root item id: <b>{0}</b> and start page id: <b>{1}</b></span>", root.ID, item.ID); phSame.Visible = false; phDiffer.Visible = true; StartId = item.ID; RootId = root.ID; } break; } phDiffer.DataBind(); } if (!phSame.Visible && !phDiffer.Visible) { ShowTab("Finish"); } Engine.Resolve <N2.Persistence.Search.IContentIndexer>().Update(root); }
private void InsertRoot(ContentItem root) { if (root.ID == Status.RootItemID) { ltRootNode.Text = "<span class='ok'>Root node inserted.</span>"; phSame.Visible = false; phDiffer.Visible = false; } else { ltRootNode.Text = string.Format( "<span class='warning'>Root node inserted but you must update web.config with root item id: <b>{0}</b></span> ", root.ID); phSame.Visible = true; phDiffer.Visible = false; RootId = root.ID; StartId = root.ID; phSame.DataBind(); } // try to find a suitable start page foreach (ContentItem item in root.Children) { ItemDefinition id = N2.Context.Definitions.GetDefinition(item.GetContentType()); if (InstallationManager.Is(id.Installer, InstallerHint.PreferredStartPage)) { if (item.ID == Status.StartPageID && root.ID == Status.RootItemID) { ltRootNode.Text = "<span class='ok'>Root and start page inserted.</span>"; } else { ltRootNode.Text = string.Format( "<span class='warning'>Start page inserted but you must update web.config with root item id: <b>{0}</b> and start page id: <b>{1}</b></span>", root.ID, item.ID); phSame.Visible = false; phDiffer.Visible = true; StartId = item.ID; RootId = root.ID; } break; } phDiffer.DataBind(); } }