Beispiel #1
0
    /// <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);
        }
    }
Beispiel #2
0
    /// <summary>
    /// Promotes a revision to the current live content.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void PromoteVersion(object sender, EventArgs e)
    {
        var link = (LinkButton)sender;

        Content        c      = new Content();
        IContentEntity entity = c.GetContentEntity(_contentID);

        entity.CurrentRevision = new Guid(link.ID);
        c.SaveEntity(entity);

        Response.Redirect(Request.RawUrl);
    }
Beispiel #3
0
    /// <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();
        }
    }
        /// <summary>
        /// Loads the content for a page.
        /// </summary>
        /// <param name="id">the ID of the page</param>
        private void LoadContent(Guid id)
        {
            var business = new Content();

            _entity = business.GetContentEntity(id);

            IList <IContentRow> content = business.LoadContent(_entity.CurrentRevision.Value);

            foreach (IContentRow c in content)
            {
                string bucket = String.Empty;
                switch (c.bucketID)
                {
                case 1:
                    bucket = "header.ascx";
                    break;

                case 2:
                    bucket = "primarynav.ascx";
                    break;

                case 3:
                    bucket = "content.ascx";
                    break;

                case 4:
                    bucket = "subnav.ascx";
                    break;

                case 5:
                    bucket = "footer.ascx";
                    break;
                }

                LoadBuckets(bucket, c.embeddableID);
            }
        }