protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            var versions = versioner.GetVersionsOf(publishedItem)
                           .Select(v => new VersionInfoViewModel
            {
                ID        = v.ID,
                Title     = v.Title,
                State     = v.State,
                IconUrl   = Url.ResolveTokens(v.IconUrl ?? "{IconsUrl}/page.png"),
                Updated   = v.Updated,
                Published = v.Published, Expires = v.Expires, VersionIndex = v.VersionIndex, SavedBy = v.SavedBy, Content = v
            })
                           .ToList();

#if FIXUP_HISTORY
            // SW: hmm - I think it is a bad idea to make up this data here, it should be correct in the database
            DateTime?previousExpired = publishedItem.Published;
            foreach (var version in versions.OrderBy(v => v.VersionIndex))
            {
                version.Published = previousExpired;
                previousExpired   = version.Expires;
            }
#endif

            gvHistory.DataSource = versions;
            gvHistory.DataBind();
        }
        public void ItemMarkedForFuturePublishing_IsPublished_WhenPublishingTimeIsReached()
        {
            var item = new ExternalItem {
                Title = "Original", State = ContentState.Published, Published = DateTime.Now.AddSeconds(-10)
            };

            using (engine.SecurityManager.Disable())
            {
                engine.Persister.Save(item);

                var version = versionManager.AddVersion(item, asPreviousVersion: false);
                version.Title = "ToBePublished";
                action.MarkForFuturePublishing(version, DateTime.Now.AddSeconds(-5));
                versionManager.UpdateVersion(version);
            }

            action.Execute();

            var published   = engine.Persister.Get(item.ID);
            var allVersions = versionManager.GetVersionsOf(published);
            var unpublished = allVersions.Single(v => v.State == ContentState.Unpublished);

            allVersions.Count.ShouldBe(2);
            published.Title.ShouldBe("ToBePublished");
            unpublished.Title.ShouldBe("Original");
        }
Beispiel #3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            IList <ContentItem> versions = versioner.GetVersionsOf(publishedItem);

            gvHistory.DataSource = versions.Select(v => new { v.ID, v.Title, v.State, v.IconUrl, v.Published, v.Expires, v.VersionIndex, v.SavedBy, Content = v });
            gvHistory.DataBind();
        }
        protected void Dump(ContentItem item)
        {
            var history = versions.GetVersionsOf(item).Select(v => string.Format("{0} '{1}' [{2}] u:{3} p:{4} e:{5} by:{6}",
                                                                                 v.VersionIndex, v.Title, v.State, v.Updated, v.Published, v.Expires, v.SavedBy));

            foreach (var h in history)
            {
                Logger.Debug(h);
            }
        }
Beispiel #5
0
        //public class VersionInfo
        //{
        //    public int ID { get; set; }
        //    public string Title { get; set; }
        //    public ContentState State { get; set; }
        //    public string IconUrl { get; set; }
        //    public DateTime? Published { get; set; }
        //    public DateTime? Expires { get; set; }
        //    public int VersionIndex { get; set; }
        //    public string SavedBy { get; set; }
        //    public ContentItem Content { get; set; }
        //}

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            var versions = versioner.GetVersionsOf(publishedItem)
                           //.Select(v => new VersionInfo { ID = v.ID, Title = v.Title, State = v.State, IconUrl = v.IconUrl, Published = v.Published, Expires = v.Expires, VersionIndex = v.VersionIndex, SavedBy = v.SavedBy, Content = v })
                           .ToList();

            gvHistory.DataSource = versions;
            gvHistory.DataBind();
        }
Beispiel #6
0
        public override void Process(CommandContext state)
        {
            var masterVersion = state.Content.VersionOf ?? state.Content;
            var versions      = versionProvider.GetVersionsOf(masterVersion);

            if (versions.Count > 1)
            {
                int greatestIndex = versions.Max(v => v.VersionIndex);
                state.Content.VersionIndex = greatestIndex + 1;
            }
            else
            {
                state.Content.VersionIndex = 0;
            }
        }
Beispiel #7
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            var versions = versioner.GetVersionsOf(publishedItem)
                           .Select(v => new VersionInfo {
                ID = v.ID, Title = v.Title, State = v.State, IconUrl = v.IconUrl, Published = v.Published, Expires = v.Expires, VersionIndex = v.VersionIndex, SavedBy = v.SavedBy, Content = v
            })
                           .ToList();


            DateTime?previousExpired = publishedItem.Published;

            foreach (var version in versions.OrderBy(v => v.VersionIndex))
            {
                version.Published = previousExpired;
                previousExpired   = version.Expires;
            }

            gvHistory.DataSource = versions;
            gvHistory.DataBind();
        }