Exemplo n.º 1
0
        /// <summary>
        /// On Load
        /// </summary>
        /// <param name="e">
        /// The e.
        /// </param>
        protected override void OnLoad(EventArgs e)
        {
            Assert.ArgumentNotNull(e, "e");
            base.OnLoad(e);
            if (!Sitecore.Context.ClientPage.IsEvent)
            {
                var url2 = new RichTextEditorUrl
                {
                    Conversion = RichTextEditorUrl.HtmlConversion.DoNotConvert,
                    Disabled   = this.Disabled,
                    FieldID    = this.FieldID,
                    ID         = this.ID,
                    ItemID     = this.ItemID,
                    Language   = this.ItemLanguage,
                    Mode       = "ContentEditor",
                    Source     = this.Source,
                    Url        = string.Empty,
                    Value      = this.Value,
                    Version    = this.ItemVersion
                };
                var urlReturn = url2.GetUrl().ToString();
                if (this.GetViewStateString("Source").Contains("&"))
                {
                    urlReturn = this.GetViewStateString("Source").Split('&').Aggregate(urlReturn, (current, queryString) => current + "&" + queryString);
                }

                this.handle = url2.Handle;
                this.setValueOnPreRender = true;
                this.SourceUri           = urlReturn;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edit Text Button
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        private new void EditText(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (!this.Disabled)
            {
                if (args.IsPostBack)
                {
                    if ((args.Result != null) && (args.Result != "undefined"))
                    {
                        this.UpdateHtml(args);
                    }
                }
                else
                {
                    var url2 = new RichTextEditorUrl
                    {
                        Conversion = RichTextEditorUrl.HtmlConversion.DoNotConvert,
                        Disabled   = this.Disabled,
                        FieldID    = this.FieldID,
                        ID         = this.ID,
                        ItemID     = this.ItemID,
                        Language   = this.ItemLanguage,
                        Mode       = string.Empty,
                        Source     = this.Source,
                        Url        = "/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx",
                        Value      = this.Value,
                        Version    = this.ItemVersion
                    };
                    var urlReturn = url2.GetUrl().ToString();
                    if (this.GetViewStateString("Source").Contains("&"))
                    {
                        urlReturn = this.GetViewStateString("Source").Split('&').Aggregate(urlReturn, (current, queryString) => current + "&" + queryString);
                    }

                    this.handle = url2.Handle;
                    var id = MainUtil.GetMD5Hash(this.Source + this.ItemLanguage);
                    SheerResponse.Eval(string.Concat(new object[] { "scContent.editRichText(\"", urlReturn, "\", \"", id.ToShortID(), "\", ", StringUtil.EscapeJavascriptString(this.Value), ")" }));
                    args.WaitForPostBack();
                }
            }
        }
        /// <summary>
        /// On Load
        /// </summary>
        /// <param name="e">
        /// The e.
        /// </param>
        protected override void OnLoad(EventArgs e)
        {
            Assert.ArgumentNotNull(e, "e");
            base.OnLoad(e);
            if (!Sitecore.Context.ClientPage.IsEvent)
            {
                var url2 = new RichTextEditorUrl
                {
                    Conversion = RichTextEditorUrl.HtmlConversion.DoNotConvert,
                    Disabled = this.Disabled,
                    FieldID = this.FieldID,
                    ID = this.ID,
                    ItemID = this.ItemID,
                    Language = this.ItemLanguage,
                    Mode = "ContentEditor",
                    Source = this.Source,
                    Url = string.Empty,
                    Value = this.Value,
                    Version = this.ItemVersion
                };
                var urlReturn = url2.GetUrl().ToString();
                if (this.GetViewStateString("Source").Contains("&"))
                {
                    urlReturn = this.GetViewStateString("Source").Split('&').Aggregate(urlReturn, (current, queryString) => current + "&" + queryString);
                }

                this.handle = url2.Handle;
                this.setValueOnPreRender = true;
                this.SourceUri = urlReturn;
            }
        }
        /// <summary>
        /// Edit Text Button
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        private new void EditText(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (!this.Disabled)
            {
                if (args.IsPostBack)
                {
                    if ((args.Result != null) && (args.Result != "undefined"))
                    {
                        this.UpdateHtml(args);
                    }
                }
                else
                {
                    var url2 = new RichTextEditorUrl
                    {
                        Conversion = RichTextEditorUrl.HtmlConversion.DoNotConvert,
                        Disabled = this.Disabled,
                        FieldID = this.FieldID,
                        ID = this.ID,
                        ItemID = this.ItemID,
                        Language = this.ItemLanguage,
                        Mode = string.Empty,
                        Source = this.Source,
                        Url = "/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx",
                        Value = this.Value,
                        Version = this.ItemVersion
                    };
                    var urlReturn = url2.GetUrl().ToString();
                    if (this.GetViewStateString("Source").Contains("&"))
                    {
                        urlReturn = this.GetViewStateString("Source").Split('&').Aggregate(urlReturn, (current, queryString) => current + "&" + queryString);
                    }

                    this.handle = url2.Handle;
                    var id = MainUtil.GetMD5Hash(this.Source + this.ItemLanguage);
                    SheerResponse.Eval(string.Concat(new object[] { "scContent.editRichText(\"", urlReturn, "\", \"", id.ToShortID(), "\", ", StringUtil.EscapeJavascriptString(this.Value), ")" }));
                    args.WaitForPostBack();
                }
            }
        }