Exemplo n.º 1
0
        /// <summary>
        /// Handle the request for comparison
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        private void CompareButtonClick(object sender, EventArgs e)
        {
            var text = new HtmlTextDB();
            if (HasEditPermission())
                this.HtmlHolder.Controls.Clear();
            else
                this.HtmlHolder2.Controls.Clear();

            if (this.IsComparing == 0)
            {
                this.Content = this.Server.HtmlDecode(text.GetHtmlTextString(this.ModuleID, this.Version));
                this.HtmlLiteral = new LiteralControl(this.Content.ToString());
                this.HtmlLiteral.DataBinding += HtmlLiteralDataBinding;
                this.HtmlLiteral.DataBind();
                if (HasEditPermission())
                    this.HtmlHolder.Controls.Add(this.HtmlLiteral);
                else
                    this.HtmlHolder2.Controls.Add(this.HtmlLiteral);

                this.IsComparing = 1;
            }
            else
            {
                var prod = this.Server.HtmlDecode(text.GetHtmlTextString(this.ModuleID, WorkFlowVersion.Production));
                var stag = this.Server.HtmlDecode(text.GetHtmlTextString(this.ModuleID, WorkFlowVersion.Staging));
                var merger = new Merger(prod, stag);
                this.Content = this.Server.HtmlDecode(merger.merge());
                this.HtmlLiteral = new LiteralControl(this.Content.ToString());
                this.HtmlLiteral.DataBinding += HtmlLiteralDataBinding;
                this.HtmlLiteral.DataBind();
                if (HasEditPermission())
                    this.HtmlHolder.Controls.Add(this.HtmlLiteral);
                else
                    this.HtmlHolder2.Controls.Add(this.HtmlLiteral);

                this.IsComparing = 0;
            }
        }
Exemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            if (HasEditPermission())
                this.HtmlHolder.EnableViewState = false;
            else
                this.HtmlHolder2.EnableViewState = false;

            // Add title
            // ModuleTitle = new DesktopModuleTitle();
            this.EditUrl = "~/DesktopModules/CommunityModules/HTMLDocument/HtmlEdit.aspx";

            // Controls.AddAt(0, ModuleTitle);
            var text = new HtmlTextDB();
            this.Content = this.Server.HtmlDecode(text.GetHtmlTextString(this.ModuleID, this.Version));
            if(PortalSecurity.HasEditPermissions(this.ModuleID) && string.IsNullOrEmpty(this.Content.ToString())){
                this.Content = "Add content here ...<br/><br/><br/><br/>";

            }

            this.HtmlLiteral = new LiteralControl(this.Content.ToString());
            this.HtmlLiteral.DataBinding += HtmlLiteralDataBinding;
            this.HtmlLiteral.DataBind();
            if (HasEditPermission())
                this.HtmlHolder.Controls.Add(this.HtmlLiteral);
            else
                this.HtmlHolder2.Controls.Add(this.HtmlLiteral);

            //if (PortalSecurity.HasEditPermissions(this.ModuleID)) {
            //    var editor = Settings["Editor"].ToString();
            //    var width = int.Parse(Settings["Width"].ToString()) + 100;
            //    var height = int.Parse(Settings["Height"].ToString());
            //    if (editor.Equals("FreeTextBox")) {
            //        height += 220;
            //    } else if (editor.Equals("FCKeditor")) {
            //        height += 120;
            //    } else if (editor.Equals("TinyMCE Editor")) {
            //        height += 140;
            //    } else if (editor.Equals("Code Mirror Plain Text")) {
            //        height += 140;
            //    } else if (editor.Equals("Syrinx CkEditor")) {
            //        height += 300;
            //    } else {
            //        height += 140;
            //    }
            //    string title = Resources.Appleseed.HTML_TITLE;
            //    var url = HttpUrlBuilder.BuildUrl("~/DesktopModules/CommunityModules/HTMLDocument/HtmlEditModal.aspx?mID="+this.ModuleID);
            //    this.HtmlModuleText.Attributes.Add("OnDblClick", "setDialog(" + ModuleID.ToString() + "," + width.ToString() + "," + (height + 10).ToString() + ");editHtml(" + ModuleID.ToString() + "," + this.PageID + ",\"" + url + "\");");
            //    this.HtmlModuleText.Attributes.Add("class", "Html_Edit");
            //    this.HtmlModuleDialog.Attributes.Add("class", "HtmlModuleDialog" + ModuleID.ToString());
            //    this.HtmlMoudleIframe.Attributes.Add("class", "HtmlMoudleIframe" + ModuleID.ToString());
            //    this.HtmlMoudleIframe.Attributes.Add("width", "98%");
            //    this.HtmlMoudleIframe.Attributes.Add("height", "99%");
            //    this.HtmlModuleText.Attributes.Add("title", title);
            //    this.HtmlModuleDialog.Attributes.Add("title", General.GetString("HTML_EDITOR", "Html Editor"));
            //    if ((Request.Browser.Browser.Contains("IE") || Request.Browser.Browser.Contains("ie")) && Request.Browser.MajorVersion == 7) {

            //        this.HTMLEditContainer.Attributes.Add("style", "position: relative;overflow: auto;");
            //    }
            //}

            base.OnInit(e);
        }