Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["pageid"] != null)
            {
                PageID = Request.QueryString["pageid"];
            }
            CmsPage page = BaseObject.GetById <CmsPage>(new Guid(PageID));

            if (page == null)
            {
                throw new Exception("Geen pagina geladen met id: " + PageID);
            }

            //je kunt niet zien of een pagina in editmode zit, want zit in iframe
            //hierom kijken we of er een bitplateuser is ingelogd.
            //zo ja, dan wordt er geen check gedaan op site-autorisatie en of de pagina actief is.
            bool allowEdit = (SessionObject.CurrentBitplateUser != null);

            if (allowEdit)
            {
                if (!CheckBitplateAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten om deze pagina te bewerken.");
                }
            }
            else
            {
                if (!CheckIfActive(page))
                {
                    throw new Exception("Deze pagina is momenteel niet actief.");
                }

                if (!CheckSiteAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten op deze pagina.");
                }
            }

            if (Request.Form["hiddenModuleType"] != null)
            {
                string          moduleType     = Request.Form["hiddenModuleType"].ToString();
                string          id             = Request.Form["hiddenModuleID"].ToString();
                BaseModule      module         = BaseObject.GetById <BaseModule>(new Guid(id));
                IPostableModule postableModule = module.ConvertToType() as IPostableModule;
                postableModule.HandlePost(Request.Form);
            }

            string pageHtml = page.Publish2();

            Response.Write(pageHtml);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["pageid"] != null)
            {
                PageID = Request.QueryString["pageid"];
            }
            CmsPage page = BaseObject.GetById <CmsPage>(new Guid(PageID));

            if (page == null)
            {
                throw new Exception("Geen pagina geladen met id: " + PageID);
            }

            //je kunt niet zien of een pagina in editmode zit, want zit in iframe
            //hierom kijken we of er een bitplateuser is ingelogd.
            //zo ja, dan wordt er geen check gedaan op site-autorisatie en of de pagina actief is.
            bool allowEdit = (SessionObject.CurrentBitplateUser != null);

            if (allowEdit)
            {
                if (!CheckBitplateAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten om deze pagina te bewerken.");
                }
            }
            else
            {
                if (!CheckIfActive(page))
                {
                    throw new Exception("Deze pagina is momenteel niet actief.");
                }

                if (!CheckSiteAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten op deze pagina.");
                }
            }

            if (Request.Form["hiddenIFramePost"] != null)
            {
                string          id             = Request.Form["hiddenModuleID"].ToString();
                BaseModule      module         = BaseObject.GetById <BaseModule>(new Guid(id));
                IPostableModule postableModule = module.ConvertToType() as IPostableModule;
                PostResult      postResult     = postableModule.HandlePost(page, CollectionsHelper.ConvertFormParametersToDictionary(Request.Form));
                Response.Clear();
                Response.Write(postResult.ToJsonString());
                Response.Flush();
                Response.End();
            }

            if (Request.QueryString.AllKeys.Contains("mailing") && Request.QueryString["mailing"] != "")
            {
                Guid mailingId = Guid.Empty;
                Guid.TryParse(Request.QueryString["mailing"], out mailingId);
                if (mailingId != Guid.Empty)
                {
                    RegisterMailingLink(mailingId, page);
                }
            }

            if (!IsPostBack)
            {
                //if (SessionObject.CurrentLicense != null && SessionObject.CurrentLicense.IsValid)
                //{
                string pageHtml = page.Publish2();
                Response.Write(pageHtml);
                //}
                //else
                //{
                //    Response.Write("<div style=\"width: 350px; padding-top: 150px; margin: auto; font-size: 24px; text-align: center;\">Uw bitplate licentie is ongeldig!!</div>");
                //}
            }
        }