// Added by Hongwei Shen([email protected]) 10/9/2005
        // for supporting version comparison

        /// <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 CompareButton_Click(Object sender, EventArgs e)
        {
            HtmlTextDB text = new HtmlTextDB();

            HtmlHolder.Controls.Clear();

            if (IsComparing == 0)
            {
                Content                  = Server.HtmlDecode(text.GetHtmlTextString(ModuleID, Version));
                HtmlLiteral              = new LiteralControl(Content.ToString());
                HtmlLiteral.DataBinding += new EventHandler(HtmlLiteral_DataBinding);
                HtmlLiteral.DataBind();
                HtmlHolder.Controls.Add(HtmlLiteral);
                IsComparing = 1;
            }
            else
            {
                string prod   = Server.HtmlDecode(text.GetHtmlTextString(ModuleID, WorkFlowVersion.Production));
                string stag   = Server.HtmlDecode(text.GetHtmlTextString(ModuleID, WorkFlowVersion.Staging));
                Merger merger = new Merger(prod, stag);
                Content                  = Server.HtmlDecode(merger.merge());
                HtmlLiteral              = new LiteralControl(Content.ToString());
                HtmlLiteral.DataBinding += new EventHandler(HtmlLiteral_DataBinding);
                HtmlLiteral.DataBind();
                HtmlHolder.Controls.Add(HtmlLiteral);
                IsComparing = 0;
            }
        }
Example #2
0
        /// <summary>
        /// It will Published selected version
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void btnPsVersion_Click(object sender, EventArgs e)
        {
            HtmlTextDB versionDB  = new HtmlTextDB();
            int        maxVersion = Convert.ToInt32(drpVirsionList.SelectedItem.Value);

            if (this.IsCodeWriter)
            {
                this.DesktopText.Text = string.Format("<style type='text/css'>{0}</style>{1}<script type='text/javascript'>{2}</script>", this.cwCSS.InnerText, this.cwHTML.InnerText, this.cwJS.InnerText);
            }
            versionDB.UpdateHtmlText(
                this.ModuleID,
                this.Server.HtmlEncode(this.DesktopText.Text),
                this.Server.HtmlEncode(this.MobileSummary.Text),
                this.Server.HtmlEncode(this.MobileDetails.Text),
                maxVersion,
                Convert.ToBoolean(1),
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName,
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName
                , this.cwCSS.InnerText, this.cwJS.InnerText, this.cwHTML.InnerText, this.cwJSCSSRef.InnerText);

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
            }
            else
            {
                this.RedirectBackToReferringPage();
            }
        }
Example #3
0
        /// <summary>
        /// Method is used to save give htmltext data
        /// </summary>
        /// <param name="moduleID">moduleID</param>
        /// <param name="publishedData">published (1/0)</param>
        /// <param name="HtmlText">DesktopHtmlText</param>
        /// <param name="version">HtmlText version no</param>
        private static void SaveMergeData(string moduleID, string publishedData, string HtmlText, string version)
        {
            string mobSummary = string.Empty;
            string mobDetails = string.Empty;

            HtmlTextDB    saveText = new HtmlTextDB();
            SqlDataReader textData = saveText.GetHtmlText(Convert.ToInt32(moduleID), WorkFlowVersion.Staging, Convert.ToInt32(version));

            if (textData.HasRows)
            {
                while (textData.Read())
                {
                    mobSummary = textData["MobileSummary"].ToString();
                    mobDetails = textData["MobileDetails"].ToString();
                }
            }
            textData.Close(); //Added by Ashish - Connection pool issue fixed
            saveText.UpdateHtmlText(
                Convert.ToInt32(moduleID),
                HtmlText,
                mobSummary,
                mobDetails,
                Convert.ToInt32(version),
                Convert.ToBoolean(publishedData),
                DateTime.Now, Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName, DateTime.Now, Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName
                );
        }
Example #4
0
        private void LoadHTMLText()
        {
            // 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, Convert.ToInt32(drpVirsionList.SelectedItem.Value));

            // 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();
            }
        }
Example #5
0
        /// <summary>
        /// Get data for compare and merge
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["mID"].ToString() != null)
                {
                    HtmlTextDB    text           = new HtmlTextDB();
                    SqlDataReader sqlLeftverText = text.GetHtmlText(Convert.ToInt32(Request.QueryString["mID"]), WorkFlowVersion.Staging, Convert.ToInt32(Request.QueryString["lvn"]));
                    if (sqlLeftverText.HasRows)
                    {
                        while (sqlLeftverText.Read())
                        {
                            hdnLvn.Value          = sqlLeftverText["DesktopHtml"].ToString();
                            hdnLvnPublished.Value = sqlLeftverText["Published"].ToString();
                        }
                    }
                    sqlLeftverText.Close();

                    SqlDataReader sqlRightverText = text.GetHtmlText(Convert.ToInt32(Request.QueryString["mID"]), WorkFlowVersion.Staging, Convert.ToInt32(Request.QueryString["rvn"]));
                    if (sqlRightverText.HasRows)
                    {
                        while (sqlRightverText.Read())
                        {
                            hdnRvn.Value          = sqlRightverText["DesktopHtml"].ToString();
                            hdnRvnPublished.Value = sqlRightverText["Published"].ToString();
                        }
                    }
                    sqlRightverText.Close();
                }
            }
        }
Example #6
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.MobileSummary.Text),
                this.Server.HtmlEncode(this.MobileDetails.Text),
                Convert.ToInt32(drpVirsionList.SelectedItem.Value),
                Convert.ToBoolean(drpVirsionList.SelectedItem.Text.Contains("Published") ? 1 : 0),
                DateTime.Now, Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName, DateTime.Now, Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName
                );

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
            }
            else
            {
                this.RedirectBackToReferringPage();
            }
        }
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// of the xml module to edit.
        /// It then uses the Rainbow.HtmlTextDB() data component
        /// to populate the page's edit controls with the text details.
        /// </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 Page_Load(object sender, EventArgs e)
        {
            // Add the setting
            HtmlEditorDataType h = new HtmlEditorDataType();

            h.Value     = moduleSettings["Editor"].ToString();
            DesktopText =
                h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()),
                            portalSettings);
            DesktopText.Width  = new Unit(moduleSettings["Width"].ToString());
            DesktopText.Height = new Unit(moduleSettings["Height"].ToString());
            if (bool.Parse(moduleSettings["ShowMobile"].ToString()))
            {
                MobileRow.Visible   = true;
                MobileSummary.Width = new Unit(moduleSettings["Width"].ToString());
                MobileDetails.Width = new Unit(moduleSettings["Width"].ToString());
            }
            else
            {
                MobileRow.Visible = false;
            }
            // Construct the page
            // Added css Styles by Mario Endara <*****@*****.**> (2004/10/26)
            updateButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(updateButton);
            PlaceHolderButtons.Controls.Add(new LiteralControl("&#160;"));
            cancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(cancelButton);
            if (Page.IsPostBack == false)
            {
                // Obtain a single row of text information
                HtmlTextDB text = new HtmlTextDB();
                // Change by [email protected] - Date: 7/2/2003
                // Original: SqlDataReader dr = text.GetHtmlText(ModuleID);
                SqlDataReader dr = text.GetHtmlText(ModuleID, WorkFlowVersion.Staging);
                // End Change [email protected]
                try
                {
                    if (dr.Read())
                    {
                        DesktopText.Text   = Server.HtmlDecode((string)dr["DesktopHtml"]);
                        MobileSummary.Text = Server.HtmlDecode((string)dr["MobileSummary"]);
                        MobileDetails.Text = Server.HtmlDecode((string)dr["MobileDetails"]);
                    }
                    else
                    {
                        DesktopText.Text =
                            General.GetString("HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                        MobileSummary.Text =
                            General.GetString("HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                        MobileDetails.Text =
                            General.GetString("HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                    }
                }
                finally
                {
                    dr.Close();
                }
            }
        }
        private void Page_Load(object sender, EventArgs e)
        {
            HtmlTextDB text = new HtmlTextDB();

            Content                  = Server.HtmlDecode(text.GetHtmlTextString(ModuleID, Version));
            HtmlLiteral              = new LiteralControl(Content.ToString());
            HtmlLiteral.DataBinding += new EventHandler(HtmlLiteral_DataBinding);
            HtmlLiteral.DataBind();
            HtmlHolder.Controls.Add(HtmlLiteral);
        }
        /// <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
            HtmlTextDB text = new HtmlTextDB();

            // Update the text within the HtmlText table
            text.UpdateHtmlText(ModuleID, Server.HtmlEncode(DesktopText.Text), Server.HtmlEncode(MobileSummary.Text),
                                Server.HtmlEncode(MobileDetails.Text));
            RedirectBackToReferringPage();
        }
Example #10
0
        private void LoadHTMLText()
        {
            // 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, Convert.ToInt32(drpVirsionList.SelectedItem.Value));

            this.hdnModuleId.Value     = this.ModuleID.ToString();
            this.hdnPageId.Value       = this.PageID.ToString();
            this.hdnDefaultJSCSS.Value = $"<link type='text/css' rel='stylesheet' href='/Design/Themes/{this.GetCurrentTheme()}/default.css'></link><script src='/aspnet_client/jQuery/jquery-1.8.3.js'></script>";

            // End Change [email protected]
            try
            {
                if (dr.Read())
                {
                    if (this.IsCodeWriter)
                    {
                        this.cwCSS.InnerText      = this.Server.HtmlDecode((string)dr["CWCSS"]);
                        this.cwHTML.InnerText     = this.Server.HtmlDecode((string)dr["CWHTML"]);
                        this.cwJS.InnerText       = this.Server.HtmlDecode((string)dr["CWJS"]);
                        this.cwJSCSSRef.InnerText = this.Server.HtmlDecode((string)dr["CWJSCSSREF"]);
                        this.DesktopText.Text     = this.Server.HtmlDecode((string)dr["DesktopHtml"]);
                        if (this.cwCSS.InnerText.Trim() == string.Empty && this.cwHTML.InnerText.Trim() == string.Empty && this.cwJS.InnerText.Trim() == string.Empty && this.DesktopText.Text != string.Empty)
                        {
                            this.cwHTML.InnerText = this.DesktopText.Text;
                        }
                        this.cwCKEditor.Text  = this.cwHTML.InnerText;
                        this.DesktopText.Text = string.Empty;
                    }
                    else
                    {
                        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();
            }
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                HtmlTextDB versionDB = new HtmlTextDB();

                DataTable versionTable = versionDB.GetVersionHistory(Convert.ToInt32(Request.QueryString["mID"].ToString())).Tables[0];

                RptVersionHistory.DataSource = versionTable;
                RptVersionHistory.DataBind();
            }
        }
Example #12
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;
            }
        }
Example #13
0
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            // Create an instance of the HtmlTextDB component
            HtmlTextDB 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(""));

            int           version   = 0;
            bool          published = true;
            SqlDataReader drList    = text.GetHtmlTextRecord(Convert.ToInt32(this.ModuleID));

            if (drList.HasRows)
            {
                while (drList.Read())
                {
                    if (Convert.ToBoolean(drList["Published"]))
                    {
                        version   = Convert.ToInt32(drList["VersionNo"]);
                        published = Convert.ToBoolean(drList["Published"]);
                    }
                }
            }
            //Added by Ashish - Connection pool Issue
            if (drList != null)
            {
                drList.Close();
            }
            text.UpdateHtmlText(
                this.ModuleID,
                this.Server.HtmlEncode(this.DesktopText.Text),
                this.Server.HtmlEncode(""),
                this.Server.HtmlEncode(""),
                version,
                published,
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName,
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName
                );



            Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
        }
Example #14
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>");
        }
Example #15
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/CoreModules/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.Settings["Editor"].Value

            this.HtmlLiteral              = new LiteralControl(this.Content.ToString());
            this.HtmlLiteral.DataBinding += HtmlLiteralDataBinding;
            this.HtmlLiteral.DataBind();
            if (HasEditPermission())
            {
                if (this.IsAlohaCurrentEditor)
                {
                    this.HtmlLiteral.Text = "<div id='aloha-editor-" + this.ModuleID + "' class='area-content' pageid='" + this.PageID + "' moduleid='" + this.ModuleID + "'>" + this.HtmlLiteral.Text + "</div>";
                }
                this.HtmlHolder.Controls.Add(this.HtmlLiteral);
            }
            else
            {
                this.HtmlHolder2.Controls.Add(this.HtmlLiteral);
            }

            base.OnInit(e);
        }
        public void UpdateHtmlData(string moduleid, string data)
        {
            HtmlTextDB text     = new HtmlTextDB();
            HtmlTextDB saveText = new HtmlTextDB();

            // Update the text within the HtmlText table
            int           version       = 0;
            bool          published     = true;
            string        mobileSummary = string.Empty;
            string        mobileDetails = string.Empty;
            SqlDataReader drList        = text.GetHtmlTextRecord(Convert.ToInt32(moduleid));

            if (drList.HasRows)
            {
                while (drList.Read())
                {
                    if (Convert.ToBoolean(drList["Published"]))
                    {
                        version       = Convert.ToInt32(drList["VersionNo"]);
                        published     = Convert.ToBoolean(drList["Published"]);
                        mobileSummary = drList["MobileSummary"].ToString();
                        mobileDetails = drList["MobileDetails"].ToString();
                    }
                }
            }
            //Added by Ashish - Connection pool Issue
            if (drList != null)
            {
                drList.Close();
            }
            text.UpdateHtmlText(
                Convert.ToInt32(moduleid),
                data,
                mobileSummary,
                mobileDetails,
                version,
                published,
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName,
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName
                );
        }
Example #17
0
        protected void btnCreateNewVersion_Click(object sender, EventArgs e)
        {
            HtmlTextDB versionDB  = new HtmlTextDB();
            int        maxVersion = drpVirsionList.Items.Count + 1;

            versionDB.UpdateHtmlText(
                this.ModuleID,
                this.Server.HtmlEncode(this.DesktopText.Text),
                this.Server.HtmlEncode(this.MobileSummary.Text),
                this.Server.HtmlEncode(this.MobileDetails.Text),
                maxVersion,
                Convert.ToBoolean(0),
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName,
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName
                );
            Response.Redirect(Request.Url.PathAndQuery, true);
        }
Example #18
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();
        }
Example #19
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            HtmlTextDB versionDB = new HtmlTextDB();
            int        modId     = Convert.ToInt32(Request.QueryString["mID"].ToString());

            foreach (RepeaterItem aItem in RptVersionHistory.Items)
            {
                CheckBox chkVersion = (CheckBox)aItem.FindControl("chkVersion");
                if (chkVersion.Checked)
                {
                    try
                    {
                        versionDB.DeleteHtmlVersion(modId, Convert.ToInt32(chkVersion.Attributes["verno"]));
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.Publish(LogLevel.Error, ex);
                    }
                }
            }
            Response.Redirect(Request.RawUrl);
        }
Example #20
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);
            }

            base.OnInit(e);
        }
Example #21
0
        /// <summary>
        /// Create new version
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void btnCreateNewVersion_Click(object sender, EventArgs e)
        {
            HtmlTextDB versionDB  = new HtmlTextDB();
            int        maxVersion = 1;

            foreach (ListItem item in drpVirsionList.Items)
            {
                int cvInt = 0;
                if (int.TryParse(item.Value, out cvInt))
                {
                    if (cvInt > maxVersion)
                    {
                        maxVersion = cvInt;
                    }
                }
            }
            maxVersion++;
            //int maxVersion = drpVirsionList.Items.Count + 1;
            if (this.IsCodeWriter)
            {
                this.DesktopText.Text = string.Format("<style type='text/css'>{0}</style>{1}<script type='text/javascript'>{2}</script>", this.cwCSS.InnerText, this.cwHTML.InnerText, this.cwJS.InnerText);
            }

            versionDB.UpdateHtmlText(
                this.ModuleID,
                this.Server.HtmlEncode(this.DesktopText.Text),
                this.Server.HtmlEncode(this.MobileSummary.Text),
                this.Server.HtmlEncode(this.MobileDetails.Text),
                maxVersion,
                Convert.ToBoolean(0),
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName,
                DateTime.Now,
                Appleseed.Framework.Site.Configuration.PortalSettings.CurrentUser.Identity.UserName
                , this.cwCSS.InnerText, this.cwJS.InnerText, this.cwHTML.InnerText, this.cwJSCSSRef.InnerText);
            Response.Redirect(Request.Url.PathAndQuery, true);
        }
Example #22
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);
        }
Example #23
0
        protected override void OnInit(EventArgs e)
        {
            // Controls must be created here
            this.UpdateButton = new LinkButton();
            this.CancelButton = new LinkButton();
            //this.VersionHistory = 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);

            //Get versionList
            //["*****@*****.**", "2014/11/20", "Get HtmlText versions by ModuleID"]
            HtmlTextDB    versionDB = new HtmlTextDB();
            SqlDataReader drList    = versionDB.GetHtmlTextRecord(this.ModuleID);
            ListItem      item      = new ListItem();

            if (drList.HasRows)
            {
                while (drList.Read())
                {
                    item = new ListItem();
                    if (Convert.ToBoolean(drList["Published"]))
                    {
                        item.Text     = drList["VersionNo"].ToString() + " [Published]";
                        item.Value    = drList["VersionNo"].ToString();
                        item.Selected = true;
                    }
                    else
                    {
                        item.Text  = drList["VersionNo"].ToString();
                        item.Value = drList["VersionNo"].ToString();
                    }
                    drpVirsionList.Items.Add(item);
                }
            }
            //Added by Ashish - Connection pool Issue
            if (drList != null)
            {
                drList.Close();
            }

            if (drpVirsionList.Items.Count == 0)
            {
                item.Text     = "1 [Published]";
                item.Value    = "1";
                item.Selected = true;
                drpVirsionList.Items.Add(item);
            }

            LoadHTMLText();

            base.OnInit(e);
        }
Example #24
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 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);


            // 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.CancelButton.ID       = "EditHtmlCancelButton";
            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, 1);

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

            this.dialogclass.Attributes.Add("class", this.ModuleID.ToString());

            base.OnInit(e);
        }
Example #25
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);

            if (this.IsCodeWriter && !Request.Url.PathAndQuery.ToLower().Contains("modalchangemaster"))
            {
                Response.Redirect(Request.Url.PathAndQuery + "&ModalChangeMaster=true", true);
            }

            plcCodewriter.Visible   = editor.ToLower() == "codewriter";
            plcNoCodeWriter.Visible = editor.ToLower() != "codewriter";
            plcCSSCMEditor.Visible  = editor.ToLower() == "code mirror plain text";
            plcCSSCKEditor.Visible  = editor.ToLower() == "ckeditor";

            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 (editor.ToLower() == "codewriter")
            {
                var moduleImageFolder = Appleseed.Framework.Site.Configuration.ModuleSettings.GetModuleSettings(this.ModuleID)["MODULE_IMAGE_FOLDER"].ToString();
                cwCKEditor = new Framework.UI.WebControls.CKEditorTextbox
                {
                    ImageFolder   = moduleImageFolder,
                    ResizeEnabled = false,
                    Language      = PortalSettings.PortalUILanguage.TwoLetterISOLanguageName
                };
                cwCKEditor.Height   = 470;
                cwCKEditor.BasePath = Appleseed.Framework.Settings.Path.WebPathCombine(Appleseed.Framework.Settings.Path.ApplicationRoot, "/aspnet_client/CKEditorV4.6.2");
                this.plcCWCKEditor.Controls.Add((Control)cwCKEditor);
            }

            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);

            //Get versionList
            HtmlTextDB    versionDB = new HtmlTextDB();
            SqlDataReader drList    = versionDB.GetHtmlTextRecord(this.ModuleID);
            ListItem      item      = new ListItem();

            if (drList.HasRows)
            {
                while (drList.Read())
                {
                    item = new ListItem();
                    if (Convert.ToBoolean(drList["Published"]))
                    {
                        item.Text     = drList["VersionNo"].ToString() + " [Published]";
                        item.Value    = drList["VersionNo"].ToString();
                        item.Selected = true;
                    }
                    else
                    {
                        item.Text  = drList["VersionNo"].ToString();
                        item.Value = drList["VersionNo"].ToString();
                    }
                    drpVirsionList.Items.Add(item);
                }
            }
            //Added by Ashish - Connection pool Issue
            if (drList != null)
            {
                drList.Close();
            }

            if (drpVirsionList.Items.Count == 0)
            {
                item.Text     = "1 [Published]";
                item.Value    = "1";
                item.Selected = true;
                drpVirsionList.Items.Add(item);
            }
            LoadHTMLText();

            base.OnInit(e);
        }