Example #1
0
        protected void OnUpdateCommand(object sender, CommandEventArgs args)
        {
            if (chkPermanentRedirect.Checked && previousParent != null)
            {
                var redirect = Engine.Resolve <ContentActivator>().CreateInstance <PermanentRedirect>(previousParent);
                redirect.Title       = previousName + GetLocalResourceString("PermanentRedirect", " (permanent redirect)");
                redirect.Name        = previousName;
                redirect.RedirectUrl = Selection.SelectedItem.Url;
                redirect.RedirectTo  = Selection.SelectedItem;
                redirect.AddTo(previousParent);

                Engine.Persister.Save(redirect);
            }

            tracker.UpdateReferencesTo(Selection.SelectedItem, previousUrl, isRenamingDirectory: Selection.SelectedItem is IFileSystemDirectory);

            if (Selection.SelectedItem is IFileSystemFile)
            {
                var sizes = this.Engine.Resolve <ImageSizeCache>().ImageSizes;
                foreach (var sizedImage in Selection.SelectedItem.Children)
                {
                    var size            = ImagesUtility.GetSize(sizedImage.Url, sizes);
                    var previousSizeUrl = ImagesUtility.GetResizedPath(previousUrl, size);

                    tracker.UpdateReferencesTo(sizedImage, previousSizeUrl, isRenamingDirectory: false);
                }
            }

            if (chkChildren.Checked)
            {
                mvPhase.ActiveViewIndex = 1;
                //rptDescendants.DataSource = Content.Search.Find.Where.AncestralTrail.Like(Selection.SelectedItem.GetTrail() + "%").Select()
                //  .Where(Content.Is.Accessible());
                rptDescendants.DataSource = Content.Search.Repository.Find(N2.Persistence.Parameter.Below(Selection.SelectedItem)).Where(Content.Is.Accessible());
                rptDescendants.DataBind();
            }
            else
            {
                Refresh(Selection.SelectedItem, ToolbarArea.Both);
            }
        }