Example #1
0
        public void LoadContentViewById(int id, EditContentViewModel model)
        {
            model.Heading = "Edit Page";
            model.EditURL = "editcontent";

            var contentLoader = new ContentLoader();

            model.ContentPage.Details = contentLoader.GetDetailsById(id);

            var ext = _context.ContentPageExtensions.FirstOrDefault(ex => ex.ContentPageId == id);

            Mapper.Map(ext, model.ContentPage);

            model.ShowFieldEditor = model.ContentPage.Details.SchemaId > -1;

            // If we are editing a draft, we actually need to be editing the parent page, but keep the drafts contents (html, css, meta, etc).
            // To accomplish this, we can simply change the id of the page we're editing in memory, to the parent page.
            model.BasePageId = model.ContentPage.Details.IsRevision
                ? Convert.ToInt32(model.ContentPage.Details.ParentContentPageId)
                : model.ContentPage.Details.ContentPageId;

            var user = GetCurrentUser();

            model.UseWordWrap = user.ContentAdminWordWrap;
            model.SiteUrl     = HTTPUtils.GetFullyQualifiedApplicationPath();

            // Check to see if there is a newer version available
            var newerVersionId = GetNewerVersionId(model.BasePageId, model.ContentPage.Details.PublishDate, model.ContentPage.Details.ContentPageId);

            if (newerVersionId != 0)
            {
                model.IsNewerVersion = true;
                model.NewerVersionId = newerVersionId;
            }

            model.Templates = contentLoader.GetAllContentTemplates();
            model.Revisions = GetPageRevisions(model.BasePageId);

            // Get list of schemas for drop down
            model.Schemas = contentLoader.GetAllSchemata();

            // Grab the formatted nav list for the category drop down
            model.NavList = _navigationUtils.GetNavList();

            model.ParentNavIdsToDisable = contentLoader.GetNavItemsForContentPage(model.ContentPage.Details.ContentPageId);
            model.BookmarkTitle         = model.ContentPage.Details.Title;
        }
Example #2
0
        public void LoadContentViewById(int id, EditContentViewModel model)
        {
            model.Heading = "Edit Page";
            model.EditURL = "editcontent";

            var contentLoader = new ContentLoader();
            model.ContentPage.Details = contentLoader.GetDetailsById(id);

            var ext = _context.ContentPageExtensions.FirstOrDefault(ex => ex.ContentPageId == id);
            Mapper.Map(ext, model.ContentPage);

            model.ShowFieldEditor = model.ContentPage.Details.SchemaId > -1;

            // If we are editing a draft, we actually need to be editing the parent page, but keep the drafts contents (html, css, meta, etc).
            // To accomplish this, we can simply change the id of the page we're editing in memory, to the parent page.
            model.BasePageId = model.ContentPage.Details.IsRevision
                ? Convert.ToInt32(model.ContentPage.Details.ParentContentPageId)
                : model.ContentPage.Details.ContentPageId;

            var user = GetCurrentUser();
            model.UseWordWrap = user.ContentAdminWordWrap;
            model.SiteUrl = HTTPUtils.GetFullyQualifiedApplicationPath();

            // Check to see if there is a newer version available
            var newerVersionId = GetNewerVersionId(model.BasePageId, model.ContentPage.Details.PublishDate, model.ContentPage.Details.ContentPageId);
            if (newerVersionId != 0)
            {
                model.IsNewerVersion = true;
                model.NewerVersionId = newerVersionId;
            }

            model.Templates = contentLoader.GetAllContentTemplates();
            model.Revisions = GetPageRevisions(model.BasePageId);

            // Get list of schemas for drop down
            model.Schemas = contentLoader.GetAllSchemata();

            // Grab the formatted nav list for the category drop down
            model.NavList = _navigationUtils.GetNavList();

            model.ParentNavIdsToDisable = contentLoader.GetNavItemsForContentPage(model.ContentPage.Details.ContentPageId);
            model.BookmarkTitle = model.ContentPage.Details.Title;

        }