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();
    }
    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();
    }
Example #3
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();
        }
    }
Example #4
0
    /// <summary>
    /// Actions handler.
    /// </summary>
    private void Validate()
    {
        pnlLog.Visible  = true;
        DataSource      = null;
        pnlGrid.Visible = false;

        CurrentError = string.Empty;

        // Get the full domain
        ctlAsyncLog.EnsureLog();
        var presentationUrl = new PresentationUrlRetriever().RetrieveForAdministration(CurrentSite.SiteID, CultureCode);

        ctlAsyncLog.Parameter = new Uri(presentationUrl).GetLeftPart(UriPartial.Authority) + ";" + presentationUrl + ";" + URLHelper.RemoveProtocolAndDomain(Url);
        ctlAsyncLog.RunAsync(CheckCss, WindowsIdentity.GetCurrent());
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set control properties
        editor.AutoDetectLanguage = false;
        editor.DefaultLanguage    = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;

        if (Form != null)
        {
            // Set current node
            var node = Form.EditedObject as CMS.DocumentEngine.TreeNode;
            if (node != null)
            {
                editor.Node = node;
            }
        }

        // Get editor area toolbar
        editor.ToolbarSet      = DataHelper.GetNotEmpty(GetValue("toolbarset"), (Form != null) ? Form.HtmlAreaToolbar : String.Empty);
        editor.ToolbarLocation = DataHelper.GetNotEmpty(GetValue("toolbarlocation"), (Form != null) ? Form.HtmlAreaToolbarLocation : String.Empty);

        // Set form dimensions
        editor.Width  = Width;
        editor.Height = Height;

        // Get editor area starting path
        String startingPath = ValidationHelper.GetString(GetValue("startingpath"), String.Empty);

        editor.StartingPath = startingPath;

        // Set current context resolver
        editor.ResolverName = ResolverName;

        // Get editor area css file
        string cssStylesheetUrl = ValidationHelper.GetString(GetValue("cssstylesheeturl"), String.Empty);

        if (SiteContext.CurrentSite != null)
        {
            // Set editor area css
            if (!string.IsNullOrEmpty(cssStylesheetUrl))
            {
                var presentationUrl = new PresentationUrlRetriever().RetrieveForAdministration(SiteContext.CurrentSiteName);
                editor.EditorAreaCSS = URLHelper.CombinePath(cssStylesheetUrl, '/', presentationUrl, null);
            }
            else
            {
                editor.EditorAreaCSS = PortalHelper.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName);
            }
        }

        // Set direction
        editor.ContentsLangDirection = CultureHelper.IsPreferredCultureRTL() ? LanguageDirection.RightToLeft : LanguageDirection.LeftToRight;

        // Get dialog configuration
        DialogConfiguration mediaConfig = GetDialogConfiguration();

        if (mediaConfig != null)
        {
            // Override starting path from main configuration
            if (!String.IsNullOrEmpty(startingPath))
            {
                mediaConfig.ContentStartingPath = startingPath;
                mediaConfig.LibStartingPath     = startingPath;
            }

            // Set configuration for 'Insert image or media' dialog
            editor.MediaDialogConfig = mediaConfig;
            // Set configuration for 'Insert link' dialog
            editor.LinkDialogConfig = mediaConfig.Clone();
            // Set configuration for 'Quickly insert image' dialog
            editor.QuickInsertConfig = mediaConfig.Clone();
        }

        // Set CSS settings
        if (!String.IsNullOrEmpty(ControlStyle))
        {
            editor.Attributes.Add("style", ControlStyle);
            ControlStyle = null;
        }
        if (!String.IsNullOrEmpty(CssClass))
        {
            editor.CssClass = CssClass;
        }

        CheckRegularExpression = true;
        CheckFieldEmptiness    = true;

        if (ShowAddStampButton)
        {
            //Add stamp button
            RegisterAndShowStampButton();
        }
    }