protected void Page_Load(object sender, EventArgs e)
    {
        formId   = QueryHelper.GetInteger("formid", 0);
        recordId = QueryHelper.GetInteger("formRecordId", 0);

        var presentationUrl = SiteContext.CurrentSite.SitePresentationURL;

        if (String.IsNullOrEmpty(presentationUrl))
        {
            ShowError(ResHelper.GetString("bizform.formBuilderMVC.presentationURLMissing"));
            return;
        }

        var path = String.Format(FORM_ITEM_EDIT_ROUTE_TEMPLATE, formId);

        if (recordId > 0)
        {
            path += $"/{recordId}";
        }

        // Modify frame 'src' attribute and add administration domain into it
        ScriptHelper.RegisterModule(this, "CMS.Builder/FrameSrcAttributeModifier", new
        {
            frameId  = formBuilderFrame.ClientID,
            frameSrc = presentationUrl.TrimEnd('/') + VirtualContext.GetFormBuilderPath(path, CurrentUser.UserName),
        });
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var presentationUrl = SiteContext.CurrentSite.SitePresentationURL;

        if (String.IsNullOrEmpty(presentationUrl))
        {
            ShowError(ResHelper.GetString("bizform.formBuilderMVC.presentationURLMissing"));
            return;
        }

        var uri          = new Uri(presentationUrl);
        var targetOrigin = uri.GetLeftPart(UriPartial.Authority);
        var path         = string.Format(FORMBUILDER_ROUTE_TEMPLATE, EditedForm.FormID);

        ScriptHelper.RegisterModule(this, "CMS.Builder/FormBuilder/Messaging", new
        {
            frameId = formBuilderFrame.ClientID,
            origin  = targetOrigin
        });

        // Modify frame 'src' attribute and add administration domain into it
        ScriptHelper.RegisterModule(this, "CMS.Builder/FrameSrcAttributeModifier", new
        {
            frameId  = formBuilderFrame.ClientID,
            frameSrc = URLHelper.AddParameterToUrl(presentationUrl.TrimEnd('/') + VirtualContext.GetFormBuilderPath(path, CurrentUser.UserName), BUILDER_MODE_QUERY_STRING_NAME, FORM_BUILDER_MODE),
        });
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        formId   = QueryHelper.GetInteger("formid", 0);
        recordId = QueryHelper.GetInteger("formRecordId", 0);
        var presentationUrl = new PresentationUrlRetriever().RetrieveForAdministration(SiteContext.CurrentSiteName);

        if (String.IsNullOrEmpty(presentationUrl))
        {
            ShowError(ResHelper.GetString("bizform.formBuilderMVC.presentationURLMissing"));
            return;
        }

        var path = String.Format(FORM_ITEM_EDIT_ROUTE_TEMPLATE, formId);

        if (recordId > 0)
        {
            path += $"/{recordId}";
        }

        // Modify frame 'src' attribute and add administration domain into it
        ScriptHelper.RegisterModule(this, "CMS.Builder/FrameSrcAttributeModifier", new
        {
            frameId             = formBuilderFrame.ClientID,
            frameSrc            = presentationUrl.TrimEnd('/') + VirtualContext.GetFormBuilderPath(path, MembershipContext.AuthenticatedUser.UserGUID),
            mixedContentMessage = GetString("builder.ui.mixedcontenterrormessage"),
            applicationPath     = SystemContext.ApplicationPath
        });

        RegisterCookiePolicyDetection();
    }
示例#4
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Check permissions
        if (!QueryHelper.ValidateHash("hash"))
        {
            return;
        }

        int bizId = QueryHelper.GetInteger("bizid", 0);
        int recId = QueryHelper.GetInteger("recid", 0);

        if ((bizId > 0) && (recId > 0))
        {
            var bfi = BizFormInfo.Provider.Get(bizId);
            if (bfi == null)
            {
                return;
            }

            var path = string.Format(FORM_ITEM_PREVIEW_ROUTE_TEMPLATE, bfi.FormID, recId);
            var site = bfi.Site as SiteInfo;
            var url  = new PresentationUrlRetriever().RetrieveForAdministration(site.SiteName);

            // Modify frame 'src' attribute and add administration domain into it
            ScriptHelper.RegisterModule(this, "CMS.Builder/FrameSrcAttributeModifier", new
            {
                frameId             = mvcFrame.ClientID,
                frameSrc            = url.TrimEnd('/') + VirtualContext.GetFormBuilderPath(path, MembershipContext.AuthenticatedUser.UserGUID),
                mixedContentMessage = GetString("builder.ui.mixedcontenterrormessage"),
                applicationPath     = SystemContext.ApplicationPath
            });

            RegisterCookiePolicyDetection();
        }
    }
示例#5
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Check permissions
        if (!QueryHelper.ValidateHash("hash"))
        {
            return;
        }

        int bizId = QueryHelper.GetInteger("bizid", 0);
        int recId = QueryHelper.GetInteger("recid", 0);

        if ((bizId > 0) && (recId > 0))
        {
            var bfi = BizFormInfoProvider.GetBizFormInfo(bizId);

            if (bfi == null)
            {
                return;
            }

            if (bfi.FormDevelopmentModel == (int)FormDevelopmentModelEnum.Mvc)
            {
                var path = string.Format(FORM_ITEM_PREVIEW_ROUTE_TEMPLATE, bfi.FormID, recId);

                string url = (bfi.Site as SiteInfo).SitePresentationURL;
                mvcFrame.Visible = true;

                // Modify frame 'src' attribute and add administration domain into it
                ScriptHelper.RegisterModule(this, "CMS.Builder/FrameSrcAttributeModifier", new
                {
                    frameId             = mvcFrame.ClientID,
                    frameSrc            = url.TrimEnd('/') + VirtualContext.GetFormBuilderPath(path, CurrentUser.UserName),
                    mixedContentMessage = GetString("builder.ui.mixedcontenterrormessage"),
                    applicationPath     = SystemContext.ApplicationPath
                });
            }
            else
            {
                bizRecord.ItemID   = recId;
                bizRecord.SiteName = SiteInfoProvider.GetSiteName(bfi.FormSiteID);
                bizRecord.FormName = bfi.FormName;
                bizRecord.Visible  = true;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var presentationUrl = new PresentationUrlRetriever().RetrieveForAdministration(SiteContext.CurrentSiteName);

        if (String.IsNullOrEmpty(presentationUrl))
        {
            ShowError(ResHelper.GetString("bizform.formBuilderMVC.presentationURLMissing"));
            return;
        }

        var uri          = new Uri(presentationUrl);
        var targetOrigin = uri.GetLeftPart(UriPartial.Authority);
        var path         = string.Format(FORMBUILDER_ROUTE_TEMPLATE, EditedForm.FormID);

        ScriptHelper.RegisterModule(this, "CMS.Builder/FormBuilder/Messaging", new
        {
            frameId = formBuilderFrame.ClientID,
            origin  = targetOrigin
        });

        // Modify frame 'src' attribute and add administration domain into it
        ScriptHelper.RegisterModule(this, "CMS.Builder/FrameSrcAttributeModifier", new
        {
            frameId             = formBuilderFrame.ClientID,
            frameSrc            = URLHelper.AddParameterToUrl(presentationUrl.TrimEnd('/') + VirtualContext.GetFormBuilderPath(path, MembershipContext.AuthenticatedUser.UserGUID), BUILDER_MODE_QUERY_STRING_NAME, FORM_BUILDER_MODE),
            mixedContentMessage = GetString("builder.ui.mixedcontenterrormessage"),
            applicationPath     = SystemContext.ApplicationPath
        });

        RegisterCookiePolicyDetection();
    }