/// <summary> /// Creates a LinkButton for each revision and attaches an event handler to it. /// </summary> private void CreateRevisionLinks() { var business = new Content(); IContentEntity entity = business.GetContentEntity(_contentID); var revisions = business.LoadRevisions(_contentID, _siteID); plcRevisionLinks.Controls.Clear(); foreach (var rev in revisions) { LinkButton lnk = new LinkButton(); lnk.ID = rev.VersionID.ToString(); lnk.Text = rev.TimeStamp.ToString(); if (lnk.ID == entity.CurrentRevision.ToString()) { lnk.Text = lnk.Text.Insert(0, "LIVE - "); } lnk.Click += new EventHandler(PromoteVersion); plcRevisionLinks.Controls.Add(lnk); Literal l = new Literal(); l.Text = "<br/>"; plcRevisionLinks.Controls.Add(l); } }
/// <summary> /// Loads content and revisions for editing. /// </summary> private void LoadExistingContent() { if (_contentID.HasValue) { _contentEntity = _content.GetContentEntity(_contentID.Value); ValidateCurrentSite(); _contentRevisions = _content.LoadRevisions(_contentID.Value, _siteID); _currentRevision = ((List <IContentRevision>)_contentRevisions).Find(i => i.VersionID == _contentEntity.CurrentRevision); } else { // this is new content, so assign some IDs for use throughout the page _contentID = Guid.NewGuid(); } }