Пример #1
0
        public override void DataBind()
        {
            if (!this.Visible)
            {
                return;
            }

            if (NewsDetails == null)
            {
                //If the article is not found or it's status is set to no display
                //this.Page.Response.StatusCode = 404;
                //this.Page.Response.StatusDescription = "404 Not Found";

                return;
            }

            if (Bound)
            {
                return;
            }
            Bound = true;



            DataItem = NewsDetails;

            if (MyPage.Editable)
            {
                MyPage.RegisterLoadScript("NewsId", "document.__MyPageId = " + NewsDetails.NewsId.ToString() + ";");
            }

            base.DataBind();
            if (OverridePageTitle)
            {
                Config cfg = new Config();

                if (MyPage != null)
                {
                    if (!String.IsNullOrEmpty(NewsDetails.Title))
                    {
                        MyPage.CustomTitle = string.Format("{0} - {1}",
                                                           StringUtils.StripOutHtmlTags(NewsDetails.Title),
                                                           cfg.GetKey("SiteName"));
                    }

                    if (!String.IsNullOrEmpty(NewsDetails.Header))
                    {
                        MyPage.Description = string.Format("{0}",
                                                           StringUtils.StripOutHtmlTags(NewsDetails.Header));
                    }
                }
            }
        }
Пример #2
0
        public override void DataBind()
        {
            if (!this.Visible)
            {
                return;
            }

            if (PageDetails == null)
            {
                //If the article is not found or it's status is set to no display
                this.Page.Response.StatusCode        = 404;
                this.Page.Response.StatusDescription = "404 Not Found";
                this.Page.Response.End();
                return;
            }

            if (Bound)
            {
                return;
            }
            Bound = true;



            DataItem = PageDetails;

            if (MyPage.Editable)
            {
                MyPage.RegisterLoadScript("PageId", "document.__MyPageId = " + PageDetails.PageId.ToString() + ";");
            }

            base.DataBind();
            if (OverridePageTitle)
            {
                Config cfg = new Config();

                if (MyPage != null)
                {
                    if (!String.IsNullOrEmpty(PageDetails.Header))
                    {
                        MyPage.CustomTitle = string.Format("{0} - {1}",
                                                           StringUtils.StripOutHtmlTags(PageDetails.Header),
                                                           cfg.GetKey("SiteName"));
                    }

                    if (!String.IsNullOrEmpty(PageDetails.SmallDescription))
                    {
                        MyPage.Description = string.Format("{0}",
                                                           StringUtils.StripOutHtmlTags(PageDetails.SmallDescription));
                    }

                    if (!String.IsNullOrEmpty(PageDetails.Image))
                    {
                        MyPage.Image = string.Format("{0}://{1}{2}/{3}/Page_{4}/{5}", WebContext.Protocol, WebContext.ServerName, WebContext.Root, lw.CTE.Folders.PagesFolder, PageDetails.PageId, PageDetails.Image);
                    }

                    if (!String.IsNullOrEmpty(PageDetails.FullURL))
                    {
                        MyPage.Url = WebContext.Request.Url.AbsoluteUri;
                    }
                }
            }
        }
Пример #3
0
        public override void DataBind()
        {
            if (!this.Visible)
            {
                return;
            }

            if (PageDetails == null)
            {
                //If the article is not found or it's status is set to no display
                //this.Page.Response.TrySkipIisCustomErrors = true;
                this.Page.Response.StatusCode        = 404;
                this.Page.Response.StatusDescription = "404 Not Found";
                this.Page.Response.End();
                return;

                //throw new HttpException(404, "Page not found");

                // return;
            }

            if (Bound)
            {
                return;
            }
            Bound = true;



            DataItem = PageDetails;

            if (MyPage.Editable)
            {
                MyPage.RegisterLoadScript("PageId", "document.__MyPageId = " + PageDetails.PageId.ToString() + ";");
                MyPage.RegisterLoadScript("PageRoles", "document.__MyPageEditingRoles = " + (PageDetails.EditingRoles != null ? PageDetails.EditingRoles.ToString() : "0") + ";");
            }

            base.DataBind();
            if (OverridePageTitle)
            {
                Config cfg = new Config();

                if (MyPage != null)
                {
                    if (!String.IsNullOrEmpty(PageDetails.Title))
                    {
                        MyPage.CustomTitle = string.Format("{0} - {1}",
                                                           StringUtils.StripOutHtmlTags(PageDetails.Title),
                                                           cfg.GetKey("SiteName"));
                    }

                    if (!String.IsNullOrEmpty(PageDetails.SmallDescription))
                    {
                        MyPage.Description = string.Format("{0}",
                                                           StringUtils.StripOutHtmlTags(PageDetails.SmallDescription));
                    }

                    if (!String.IsNullOrEmpty(PageDetails.Image))
                    {
                        MyPage.Image = string.Format("{0}://{1}{2}/{3}/Page_{4}/{5}", WebContext.Protocol, WebContext.ServerName, WebContext.Root, lw.CTE.Folders.PagesFolder, PageDetails.PageId, PageDetails.Image.Replace(".", "-l."));
                    }

                    if (!String.IsNullOrEmpty(PageDetails.FullURL))
                    {
                        MyPage.Url = WebContext.Request.Url.AbsoluteUri;
                    }

                    if (PageDetails.IsSecure != null)
                    {
                        MyPage.isSecure = (bool)PageDetails.IsSecure;
                    }

                    if (!String.IsNullOrEmpty(PageDetails.Keywords))
                    {
                        MyPage.Keywords = string.Format("{0}",
                                                        StringUtils.StripOutHtmlTags(PageDetails.Keywords));
                    }
                }
            }
        }