Ejemplo n.º 1
0
        /// <summary>
        /// Handles OnInit event
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param>
        /// <remarks>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        ///   of the xml module to edit.
        ///   It then uses the Appleseed.HtmlTextDB() data component
        ///   to populate the page's edit controls with the text details.
        /// </remarks>
        protected override void OnInit(EventArgs e)
        {
            // Controls must be created here
            this.UpdateButton = new LinkButton();
            this.CancelButton = new LinkButton();

            // Add the setting
            var editor = this.ModuleSettings["Editor"].ToString();
            var width = this.ModuleSettings["Width"].ToString();
            var height = this.ModuleSettings["Height"].ToString();
            var showUpload = this.ModuleSettings["ShowUpload"].ToBoolean(CultureInfo.InvariantCulture);
            var showMobile = this.ModuleSettings["ShowMobile"].ToBoolean(CultureInfo.InvariantCulture);

            var h = new HtmlEditorDataType { Value = editor };
            this.DesktopText = h.GetEditor(
                this.PlaceHolderHTMLEditor,
                this.ModuleID,
                showUpload,
                this.PortalSettings);

            this.DesktopText.Width = new Unit(width);
            this.DesktopText.Height = new Unit(height);
            if (showMobile)
            {
                this.MobileRow.Visible = true;
                this.MobileSummary.Width = new Unit(width);
                this.MobileDetails.Width = new Unit(width);
            }
            else
            {
                this.MobileRow.Visible = false;
            }

            // Construct the page
            // Added css Styles by Mario Endara <*****@*****.**> (2004/10/26)
            this.UpdateButton.CssClass = "CommandButton";
            this.PlaceHolderButtons.Controls.Add(this.UpdateButton);
            this.PlaceHolderButtons.Controls.Add(new LiteralControl("&#160;"));
            this.CancelButton.CssClass = "CommandButton";
            this.PlaceHolderButtons.Controls.Add(this.CancelButton);

            // Obtain a single row of text information
            var text = new HtmlTextDB();

            // Change by [email protected] - Date: 7/2/2003
            // Original: SqlDataReader dr = text.GetHtmlText(ModuleID);
            var dr = text.GetHtmlText(this.ModuleID, WorkFlowVersion.Staging);

            // End Change [email protected]
            try
            {
                if (dr.Read())
                {
                    this.DesktopText.Text = this.Server.HtmlDecode((string)dr["DesktopHtml"]);
                    this.MobileSummary.Text = this.Server.HtmlDecode((string)dr["MobileSummary"]);
                    this.MobileDetails.Text = this.Server.HtmlDecode((string)dr["MobileDetails"]);
                }
                else
                {
                    this.DesktopText.Text = General.GetString(
                        "HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                    this.MobileSummary.Text = General.GetString(
                        "HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                    this.MobileDetails.Text = General.GetString(
                        "HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                }
            }
            finally
            {
                dr.Close();
            }

            base.OnInit(e);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The UpdateBtn_Click event handler on this Page is used to save
        ///   the text changes to the database.
        /// </summary>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            // Create an instance of the HtmlTextDB component
            var text = new HtmlTextDB();

            // Update the text within the HtmlText table
            text.UpdateHtmlText(
                this.ModuleID,
                this.Server.HtmlEncode(this.DesktopText.Text),
                this.Server.HtmlEncode(this.MobileSummary.Text),
                this.Server.HtmlEncode(this.MobileDetails.Text));

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
            else
                this.RedirectBackToReferringPage();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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;
            }
        }
Ejemplo n.º 5
0
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            // Create an instance of the HtmlTextDB component
            var text = new HtmlTextDB();

            // Update the text within the HtmlText table
            text.UpdateHtmlText(
                this.ModuleID,
                this.Server.HtmlEncode(this.DesktopText.Text),
                this.Server.HtmlEncode(""),
                this.Server.HtmlEncode(""));

            Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
        }