protected void HandleArticleDate( Sitecore.Data.Items.Item article, DateTime articleDate) { Sitecore.Data.Items.Item root = this.GetNewsRoot(article); root = this.GetOrCreateChild( root, String.Format("{0:yyyy}", articleDate), this._yearTemplate, -articleDate.Year); if (this._monthTemplate != null) { root = this.GetOrCreateChild( root, String.Format("{0:MMMM}", articleDate), this._monthTemplate, -articleDate.Month); if (this._dayTemplate != null) { root = this.GetOrCreateChild( root, String.Format("{0:dd}", articleDate), this._dayTemplate, -articleDate.Day); } } if (String.Compare(article.Parent.Paths.FullPath, root.Paths.FullPath, true) == 0) { return; } Sitecore.Data.Items.Item orphaned = article.Parent; article.MoveTo(root); while ((!orphaned.HasChildren) && (orphaned.TemplateID == this._yearTemplate.ID || (this._monthTemplate != null && orphaned.TemplateID == this._monthTemplate.ID) || (this._dayTemplate != null && orphaned.Template.ID == this._dayTemplate.ID))) { Sitecore.Data.Items.Item parent = orphaned.Parent; orphaned.Delete(); orphaned = parent; } if ((!Sitecore.Context.IsBackgroundThread) && Sitecore.Context.ClientPage.IsEvent) { string message = String.Format("item:refreshchildren(id={0})", article.Database.GetRootItem().ID); Sitecore.Context.ClientPage.SendMessage(this, message); } }