Пример #1
0
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Initialize editor
        bbEditor.TextArea.Columns  = ValidationHelper.GetInteger(GetValue("cols"), 40);
        bbEditor.TextArea.Rows     = ValidationHelper.GetInteger(GetValue("rows"), 5);
        bbEditor.ShowURL           = ValidationHelper.GetBoolean(GetValue("showurl"), true);
        bbEditor.ShowQuote         = ValidationHelper.GetBoolean(GetValue("showquote"), true);
        bbEditor.ShowImage         = ValidationHelper.GetBoolean(GetValue("showimage"), true);
        bbEditor.ShowBold          = ValidationHelper.GetBoolean(GetValue("showbold"), true);
        bbEditor.ShowItalic        = ValidationHelper.GetBoolean(GetValue("showitalic"), true);
        bbEditor.ShowUnderline     = ValidationHelper.GetBoolean(GetValue("showunderline"), true);
        bbEditor.ShowStrike        = ValidationHelper.GetBoolean(GetValue("showstrike"), true);
        bbEditor.ShowColor         = ValidationHelper.GetBoolean(GetValue("showcolor"), true);
        bbEditor.ShowCode          = ValidationHelper.GetBoolean(GetValue("showcode"), true);
        bbEditor.UsePromptDialog   = ValidationHelper.GetBoolean(GetValue("usepromptdialog"), true);
        bbEditor.ShowAdvancedImage = ValidationHelper.GetBoolean(GetValue("showadvancedimage"), false);
        bbEditor.ShowAdvancedURL   = ValidationHelper.GetBoolean(GetValue("showadvancedurl"), false);
        int size = ValidationHelper.GetInteger(GetValue("size"), 0);

        if (size > 0)
        {
            bbEditor.TextArea.MaxLength = size;
        }

        bbEditor.IsLiveSite = IsLiveSite;

        if (!String.IsNullOrEmpty(CssClass))
        {
            bbEditor.CssClass = CssClass;
            CssClass          = null;
        }
        else if (String.IsNullOrEmpty(bbEditor.CssClass))
        {
            bbEditor.CssClass = "BBEditorField";
        }
        if (!string.IsNullOrEmpty(ControlStyle))
        {
            bbEditor.TextArea.Attributes.Add("style", ControlStyle);
            ControlStyle = null;
        }

        DialogConfiguration config = GetDialogConfiguration(FieldInfo);

        bbEditor.ImageDialogConfig = config;
        bbEditor.URLDialogConfig   = config.Clone();

        CheckRegularExpression = true;
        CheckFieldEmptiness    = true;
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set control properties
        editor.AutoDetectLanguage = false;
        editor.DefaultLanguage    = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;

        if (Form != null)
        {
            editor.DialogParameters = Form.DialogParameters;
        }

        // 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 cssStylesheet = ValidationHelper.GetString(GetValue("cssstylesheet"), String.Empty);

        if (!String.IsNullOrEmpty(cssStylesheet))
        {
            editor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(cssStylesheet);
        }
        else if (SiteContext.CurrentSite != null)
        {
            editor.EditorAreaCSS = CssStylesheetInfoProvider.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName);
        }

        // Set live site info
        editor.IsLiveSite = IsLiveSite;

        // 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();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set control properties
        editor.AutoDetectLanguage = false;
        editor.DefaultLanguage    = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;

        string toolbarSet = editor.ToolbarSet;

        if (Form != null)
        {
            editor.DialogParameters = Form.DialogParameters;
        }

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

        // Set form dimensions
        UnitType widthUnitType  = GetUnitType(GetValue("widthunittype"));
        UnitType heightUnitType = GetUnitType(GetValue("heightunittype"));

        editor.Width  = new Unit(ValidationHelper.GetInteger(GetValue("width"), 700), widthUnitType);
        editor.Height = new Unit(ValidationHelper.GetInteger(GetValue("height"), 300), heightUnitType);

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

        editor.StartingPath = startingPath;

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

        // Get editor area css file
        string mCssStylesheet = ValidationHelper.GetString(GetValue("cssstylesheet"), "");

        if (!String.IsNullOrEmpty(mCssStylesheet))
        {
            editor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(mCssStylesheet);
        }
        else if (toolbarSet.EqualsCSafe("Wireframe", true))
        {
            // Special case for wireframe editor
            editor.EditorAreaCSS = "~/CMSAdminControls/CKeditor/skins/kentico/wireframe.css";
        }
        else if (CMSContext.CurrentSite != null)
        {
            editor.EditorAreaCSS = FormHelper.GetHtmlEditorAreaCss(CMSContext.CurrentSiteName);
        }

        // Set live site info
        editor.IsLiveSite = IsLiveSite;

        // Set direction
        if (CultureHelper.IsPreferredCultureRTL())
        {
            editor.ContentsLangDirection = LanguageDirection.RightToLeft;
        }
        else
        {
            editor.ContentsLangDirection = LanguageDirection.LeftToRight;
        }

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

        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;
            CssClass        = null;
        }

        CheckRegularExpression = true;
        CheckFieldEmptiness    = true;
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set control properties
        editor.AutoDetectLanguage = false;
        editor.DefaultLanguage    = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        string toolbarSet = editor.ToolbarSet;

        if (this.Form != null)
        {
            editor.DialogParameters = this.Form.DialogParameters;
            // Get editor area toolbar
            toolbarSet             = DataHelper.GetNotEmpty(this.GetValue("toolbarset"), this.Form.HtmlAreaToolbar);
            editor.ToolbarSet      = toolbarSet;
            editor.ToolbarLocation = DataHelper.GetNotEmpty(this.GetValue("toolbarlocation"), this.Form.HtmlAreaToolbarLocation);

            // Set form dimensions
            editor.Width  = new Unit(ValidationHelper.GetInteger(this.GetValue("width"), 700));
            editor.Height = new Unit(ValidationHelper.GetInteger(this.GetValue("height"), 300));

            // Get editor area starting path
            editor.StartingPath = ValidationHelper.GetString(this.GetValue("startingpath"), "");

            // Get editor area css file
            string mCssStylesheet = ValidationHelper.GetString(this.GetValue("cssstylesheet"), "");
            if (!String.IsNullOrEmpty(mCssStylesheet))
            {
                editor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(mCssStylesheet);
            }
            else if (toolbarSet.Equals("Wireframe", StringComparison.InvariantCultureIgnoreCase))
            {
                // Special case for wireframe editor
                editor.EditorAreaCSS = CSSHelper.GetCSSUrl("~/CMSAdminControls/CKeditor/skins/kentico/wireframe.css");
            }
            else if (CMSContext.CurrentSite != null)
            {
                editor.EditorAreaCSS = FormHelper.GetHtmlEditorAreaCss(CMSContext.CurrentSiteName);
            }
        }

        // Set live site info
        editor.IsLiveSite = this.IsLiveSite;

        // Set direction
        if (CultureHelper.IsPreferredCultureRTL())
        {
            editor.ContentsLangDirection = LanguageDirection.RightToLeft;
        }
        else
        {
            editor.ContentsLangDirection = LanguageDirection.LeftToRight;
        }

        // Get dialog configuration
        DialogConfiguration mediaConfig = GetDialogConfiguration(this.FieldInfo);

        if (mediaConfig != null)
        {
            // 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(this.ControlStyle))
        {
            editor.Attributes.Add("style", this.ControlStyle);
            this.ControlStyle = null;
        }
        if (!String.IsNullOrEmpty(this.CssClass))
        {
            editor.CssClass = this.CssClass;
            this.CssClass   = null;
        }

        this.CheckRegularExpression = true;
        this.CheckFieldEmptiness    = true;
    }