public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            string staff = HttpUtility.HtmlDecode((string)requestContext.RouteData.Values["staff"]);

            HttpPageHelper.CurrentItem = null;
            var p = new IdeaSeedCMS.Core.Domain.Page();

            if (HttpPageHelper.CurrentUser == null)
            {
                p = new PageServices().GetByNameAccessLevel(staff.Replace("-", " "), 0, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"]));
            }
            else
            {
                p = new PageServices().GetByNameAccessLevel(staff.Replace("-", " "), HttpPageHelper.CurrentUser.AccessLevel, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"]));
            }
            HttpPageHelper.CurrentPage = p;

            var item = new Item();

            item.Description           = p.Name;
            item.Name                  = p.Name;
            item.SEOTitle              = p.SEOTitle;
            item.ItemReference         = item;
            HttpPageHelper.CurrentItem = item;

            IdeaSeedCMSBasePage page;

            page = (IdeaSeedCMSBasePage)BuildManager.CreateInstanceFromVirtualPath(p.URLRoute, typeof(System.Web.UI.Page));

            HttpPageHelper.IsValidRequest = true;
            return(page);
        }
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            HttpPageHelper.CurrentItem = null;
            var p = new IdeaSeedCMS.Core.Domain.Page();

            if (HttpPageHelper.CurrentUser == null)
            {
                p = new PageServices().GetByNameAccessLevel(VirtualPath, 60, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"]));
            }
            else
            {
                p = new PageServices().GetByNameAccessLevel(VirtualPath, HttpPageHelper.CurrentUser.AccessLevel, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"]));
            }
            HttpPageHelper.CurrentPage = p;
            if (p != null)
            {
                var item = new Item();
                item.Description           = p.Name;
                item.Name                  = p.Name;
                item.SEOTitle              = p.SEOTitle;
                item.ItemReference         = p;
                HttpPageHelper.CurrentItem = item;
            }
            AdminBasePage page;

            page = (AdminBasePage)BuildManager.CreateInstanceFromVirtualPath(ActualPath, typeof(System.Web.UI.Page));

            HttpPageHelper.IsValidRequest = true;
            return(page);
        }
Exemple #3
0
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            string title = HttpUtility.HtmlDecode((string)requestContext.RouteData.Values["title"]);

            HttpPageHelper.CurrentItem = null;
            HttpPageHelper.CurrentBlog = null;

            var p = new IdeaSeedCMS.Core.Domain.Page();

            p = new PageServices().GetByNameAccessLevel(VirtualPath, 0, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"]));
            HttpPageHelper.CurrentPage = p;

            var b = new BlogServices().GetByTitle(title.Replace("-", " "));

            var item = new Item();

            item.Description           = p.Name;
            item.Name                  = p.Name;
            item.SEOTitle              = b.Title;
            item.SEODescription        = b.SEODescription;
            item.SEOKeywords           = b.SEOKeywords;
            item.ItemReference         = item;
            p.SEODescription           = b.SEODescription;
            p.SEOKeywords              = b.SEOKeywords;
            p.SEOTitle                 = b.Title;
            HttpPageHelper.CurrentItem = item;
            HttpPageHelper.CurrentBlog = b;

            IdeaSeedCMSBasePage page;

            page = (IdeaSeedCMSBasePage)BuildManager.CreateInstanceFromVirtualPath(p.URLRoute, typeof(System.Web.UI.Page));

            HttpPageHelper.IsValidRequest = true;
            return(page);
        }
Exemple #4
0
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            string id     = HttpUtility.HtmlDecode((string)requestContext.RouteData.Values["id"]);
            string action = HttpUtility.HtmlDecode((string)requestContext.RouteData.Values["action"]);

            HttpPageHelper.CurrentItem = null;
            var           p = new IdeaSeedCMS.Core.Domain.Page();
            AdminBasePage page;

            if (!this.VirtualPath.Equals("new"))
            {
                p = new PageServices().GetByID(Convert.ToInt32(id));
                var item = new Item();
                item.Description           = p.Name;
                item.Name                  = p.Name;
                item.SEOTitle              = p.SEOTitle;
                item.ItemReference         = p;
                HttpPageHelper.CurrentItem = item;
                page = (AdminBasePage)BuildManager.CreateInstanceFromVirtualPath("~/Default.aspx", typeof(System.Web.UI.Page));
            }
            else
            {
                var item = new Item();
                item.Description           = "New Root Page";
                item.Name                  = "New Root Page";
                item.SEOTitle              = "New Root Page";
                item.ItemReference         = p;
                HttpPageHelper.CurrentItem = item;
                page = (AdminBasePage)BuildManager.CreateInstanceFromVirtualPath("~/Page.aspx", typeof(System.Web.UI.Page));
            }
            HttpPageHelper.CurrentPage = p;



            HttpPageHelper.IsValidRequest = true;
            return(page);
        }
        private void SavePage()
        {
            if (SecurityContextManager.Current.CurrentURL.Contains("/edit"))
            {
                this.CurrentPage.IsExternal     = cbIsExternal.Checked;
                this.CurrentPage.IsActive       = cbOnline.Checked;
                this.CurrentPage.ChangedBy      = SecurityContextManager.Current.CurrentUser.ID;
                this.CurrentPage.DisplayName    = tbName.Text;
                this.CurrentPage.ExternalURL    = tbExternalURL.Text;
                this.CurrentPage.LastUpdated    = DateTime.Now;
                this.CurrentPage.Name           = tbName.Text.Replace("&", "").Replace("'", "").Replace("?", "").Replace("@", "").Replace("$", "").Replace("#", "");
                this.CurrentPage.SEODescription = tbSeoDescription.Text;
                this.CurrentPage.SEOKeywords    = tbSeoKeywords.Text;
                this.CurrentPage.SEOTitle       = tbSeoTitle.Text;

                if (radAsyncUpload.UploadedFiles.Count > 0)
                {
                    UploadedFile file     = radAsyncUpload.UploadedFiles[0];
                    string       filePath = DateTime.Now.Ticks.ToString() + "_" +
                                            file.FileName;
                    //string filePath = file.FileName;
                    file.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["IMAGEURL"]) + filePath, false);
                    this.CurrentPage.HeaderImagePath = ConfigurationManager.AppSettings["IMAGEURL"] + filePath;
                }

                var content = new PageContentServices().GetByPageID(this.CurrentPage.ID);
                content.PageData    = reContent.Content;
                content.Title       = tbTitle.Text;
                content.SubTitle    = tbSubTitle.Text;
                content.LastUpdated = DateTime.Now;
                content.ChangedBy   = SecurityContextManager.Current.CurrentUser.ID;

                new PageServices().Save(this.CurrentPage);
                new PageContentServices().Save(content);
                Response.Redirect(SecurityContextManager.Current.CurrentURL);
            }
            else
            {
                var p = new IdeaSeedCMS.Core.Domain.Page();
                p.IsActive    = cbOnline.Checked;
                p.AccessLevel = 0;
                p.ChangedBy   = SecurityContextManager.Current.CurrentUser.ID;
                p.DateCreated = DateTime.Now;
                p.DisplayName = tbName.Text;
                p.EnteredBy   = SecurityContextManager.Current.CurrentUser.ID;
                p.ExternalURL = tbExternalURL.Text;
                if (radAsyncUpload.UploadedFiles.Count > 0)
                {
                    UploadedFile file     = radAsyncUpload.UploadedFiles[0];
                    string       filePath = DateTime.Now.Ticks.ToString() + "_" +
                                            file.FileName;
                    //string filePath = file.FileName;
                    file.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["IMAGEURL"]) + filePath, false);
                    p.HeaderImagePath = ConfigurationManager.AppSettings["IMAGEURL"] + filePath;
                }
                p.IsExternal        = cbIsExternal.Checked;
                p.LastUpdated       = DateTime.Now;
                p.MarkedForDeletion = false;
                p.Name       = tbName.Text.Replace("&", "").Replace("'", "").Replace("?", "").Replace("@", "").Replace("$", "").Replace("#", "");
                p.PageTypeID = (int)PageType.PROFILE;
                if (SecurityContextManager.Current.CurrentURL.Contains("/add"))
                {
                    p.ParentID         = ((IdeaSeedCMS.Core.Domain.Page)SecurityContextManager.Current.CurrentPage).ID;
                    p.NavigationTypeID = (int)NavigationType.NONE;
                }
                else
                {
                    p.NavigationTypeID = (int)NavigationType.MAIN;
                }
                p.SEODescription = tbSeoDescription.Text;
                p.SEOKeywords    = tbSeoKeywords.Text;
                p.SEOTitle       = tbSeoTitle.Text;
                p.URLRoute       = "/Default.aspx";
                p.ApplicationID  = Convert.ToInt16(SecurityContextManager.Current.CurrentManagedApplication.ID);
                new PageServices().Save(p);

                var pav = new PageApplicationView();
                pav.ApplicationViewID = Convert.ToInt16(ConfigurationManager.AppSettings["DEFAULTAPPLICATIONVIEWID"]);
                pav.PageID            = p.ID;
                pav.ViewLayout        = ApplicationViewLayout.MAIN;
                pav.SortOrder         = 0;
                new PageViewServices().Save(pav);

                var content = new PageContent();
                content.PageData    = reContent.Content;
                content.Title       = tbTitle.Text;
                content.SubTitle    = tbSubTitle.Text;
                content.LastUpdated = DateTime.Now;
                content.ChangedBy   = SecurityContextManager.Current.CurrentUser.ID;
                content.DateCreated = DateTime.Now;
                content.EnteredBy   = SecurityContextManager.Current.CurrentUser.ID;
                content.PageID      = p.ID;
                new PageContentServices().Save(content);

                Response.Redirect(SecurityContextManager.Current.CurrentURL.Replace("New", p.ID.ToString() + "/edit"));
            }
            //HttpContext.Current.Cache.Remove(ResourceStrings.Cache_PrimaryPublicNavData);
            //Context.Cache.Insert(ResourceStrings.Cache_PrimaryPublicNavData, new PageServices().GetByNavigationTypeID(1, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"])));
        }