コード例 #1
0
ファイル: EditHtml.ascx.cs プロジェクト: ws-phil/Dnn.Platform
        /// <summary>
        ///   Displays the content but hide the editor if editing is locked from the current user.
        /// </summary>
        /// <param name = "htmlContent">Content of the HTML.</param>
        /// <param name = "lastPublishedContent">Last content of the published.</param>
        private void DisplayLockedContent(HtmlTextInfo htmlContent, HtmlTextInfo lastPublishedContent)
        {
            this.txtContent.Visible = false;
            this.cmdSave.Visible    = false;

            // cmdPreview.Enabled = false;
            this.divPublish.Visible = false;

            this.divSubmittedContent.Visible = true;

            this.lblCurrentWorkflowInUse.Text = this.GetLocalizedString(htmlContent.WorkflowName);
            this.lblCurrentWorkflowState.Text = this.GetLocalizedString(htmlContent.StateName);

            this.litCurrentContentPreview.Text = HtmlTextController.FormatHtmlText(this.ModuleId, htmlContent.Content, this.Settings, this.PortalSettings, this.Page);
            this.lblCurrentVersion.Text        = htmlContent.Version.ToString();
            this.DisplayVersions();

            if (lastPublishedContent != null)
            {
                this.DisplayPreview(lastPublishedContent);

                // DisplayHistory(lastPublishedContent);
            }
            else
            {
                this.dnnSitePanelEditHTMLHistory.Visible = false;
                this.fsEditHtmlHistory.Visible           = false;
                this.DisplayPreview(htmlContent.Content);
            }
        }
コード例 #2
0
        /// <summary>
        ///   Displays the content but hide the editor if editing is locked from the current user
        /// </summary>
        /// <param name = "htmlContent">Content of the HTML.</param>
        /// <param name = "lastPublishedContent">Last content of the published.</param>
        private void DisplayLockedContent(HtmlTextInfo htmlContent, HtmlTextInfo lastPublishedContent)
        {
            txtContent.Visible = false;
            cmdSave.Visible    = false;
            //cmdPreview.Visible = false;
            divPublish.Visible = false;

            divSubmittedContent.Visible = true;

            lblCurrentWorkflowInUse.Text = GetLocalizedString(htmlContent.WorkflowName);
            lblCurrentWorkflowState.Text = GetLocalizedString(htmlContent.StateName);

            litCurrentContentPreview.Text = HtmlTextController.FormatHtmlText(ModuleId, htmlContent.Content, Settings);
            lblCurrentVersion.Text        = htmlContent.Version.ToString();
            DisplayVersions();

            if ((lastPublishedContent != null))
            {
                DisplayPreview(lastPublishedContent);
                //DisplayHistory(lastPublishedContent);
            }
            else
            {
                dnnSitePanelEditHTMLHistory.Visible = false;
                fsEditHtmlHistory.Visible           = false;
                DisplayPreview(htmlContent.Content);
            }
        }
コード例 #3
0
 /// <summary>
 ///   Displays the content preview in the preview section
 /// </summary>
 /// <param name = "htmlContent">Content of the HTML.</param>
 private void DisplayPreview(HtmlTextInfo htmlContent)
 {
     lblPreviewVersion.Text       = htmlContent.Version.ToString();
     lblPreviewWorkflowInUse.Text = GetLocalizedString(htmlContent.WorkflowName);
     lblPreviewWorkflowState.Text = GetLocalizedString(htmlContent.StateName);
     litPreview.Text = HtmlTextController.FormatHtmlText(ModuleId, htmlContent.Content, Settings);
     DisplayHistory(htmlContent);
 }
コード例 #4
0
        /// <summary>
        ///   Displays the preview in the preview section
        /// </summary>
        /// <param name = "htmlContent">Content of the HTML.</param>
        private void DisplayPreview(string htmlContent)
        {
            litPreview.Text            = HtmlTextController.FormatHtmlText(ModuleId, htmlContent, Settings);
            divPreviewVersion.Visible  = false;
            divPreviewWorlflow.Visible = false;

            divPreviewWorkflowState.Visible = true;
            lblPreviewWorkflowState.Text    = GetLocalizedString("EditPreviewState");
        }
コード例 #5
0
ファイル: EditHtml.ascx.cs プロジェクト: ws-phil/Dnn.Platform
        /// <summary>
        ///   Displays the content of the master language if localized content is enabled.
        /// </summary>
        private void DisplayMasterLanguageContent()
        {
            // Get master language
            var objModule = ModuleController.Instance.GetModule(this.ModuleId, this.TabId, false);

            if (objModule.DefaultLanguageModule != null)
            {
                var masterContent = this._htmlTextController.GetTopHtmlText(objModule.DefaultLanguageModule.ModuleID, false, this.WorkflowID);
                if (masterContent != null)
                {
                    this.placeMasterContent.Controls.Add(new LiteralControl(HtmlTextController.FormatHtmlText(objModule.DefaultLanguageModule.ModuleID, this.FormatContent(masterContent.Content), this.Settings, this.PortalSettings, this.Page)));
                }
            }
        }
コード例 #6
0
        /// <summary>
        ///   Displays the content of the master language if localized content is enabled.
        /// </summary>
        private void DisplayMasterLanguageContent()
        {
            //Get master language
            var objModule = ModuleController.Instance.GetModule(ModuleId, TabId, false);

            if (objModule.DefaultLanguageModule != null)
            {
                var masterContent = _htmlTextController.GetTopHtmlText(objModule.DefaultLanguageModule.ModuleID, false, WorkflowID);
                if (masterContent != null)
                {
                    placeMasterContent.Controls.Add(new LiteralControl(HtmlTextController.FormatHtmlText(objModule.DefaultLanguageModule.ModuleID, FormatContent(masterContent.Content), Settings)));
                }
            }
        }
コード例 #7
0
ファイル: EditHtml.ascx.cs プロジェクト: ws-phil/Dnn.Platform
 /// <summary>
 ///   Displays the content preview in the preview section.
 /// </summary>
 /// <param name = "htmlContent">Content of the HTML.</param>
 private void DisplayPreview(HtmlTextInfo htmlContent)
 {
     this.lblPreviewVersion.Text       = htmlContent.Version.ToString();
     this.lblPreviewWorkflowInUse.Text = this.GetLocalizedString(htmlContent.WorkflowName);
     this.lblPreviewWorkflowState.Text = this.GetLocalizedString(htmlContent.StateName);
     this.litPreview.Text    = HtmlTextController.FormatHtmlText(this.ModuleId, htmlContent.Content, this.Settings, this.PortalSettings, this.Page);
     this.phEdit.Visible     = false;
     this.phPreview.Visible  = true;
     this.phHistory.Visible  = false;
     this.cmdEdit.Enabled    = true;
     this.cmdPreview.Enabled = false;
     this.cmdHistory.Enabled = true;
     this.DisplayHistory(htmlContent);
     this.cmdMasterContent.Visible = false;
     this.ddlRender.Visible        = false;
 }
コード例 #8
0
ファイル: EditHtml.ascx.cs プロジェクト: ws-phil/Dnn.Platform
        /// <summary>
        ///   Displays the preview in the preview section.
        /// </summary>
        /// <param name = "htmlContent">Content of the HTML.</param>
        private void DisplayPreview(string htmlContent)
        {
            this.litPreview.Text            = HtmlTextController.FormatHtmlText(this.ModuleId, htmlContent, this.Settings, this.PortalSettings, this.Page);
            this.divPreviewVersion.Visible  = false;
            this.divPreviewWorlflow.Visible = false;

            this.divPreviewWorkflowState.Visible = true;
            this.lblPreviewWorkflowState.Text    = this.GetLocalizedString("EditPreviewState");

            this.phEdit.Visible           = false;
            this.phPreview.Visible        = true;
            this.phHistory.Visible        = false;
            this.cmdEdit.Enabled          = true;
            this.cmdPreview.Enabled       = false;
            this.cmdHistory.Enabled       = true;
            this.cmdMasterContent.Visible = false;
            this.ddlRender.Visible        = false;
        }
コード例 #9
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                var objHTML = new HtmlTextController();

                // edit in place
                if (EditorEnabled && IsEditable && PortalSettings.UserMode == PortalSettings.Mode.Edit)
                {
                    EditorEnabled = true;
                }
                else
                {
                    EditorEnabled = false;
                }

                // get content
                HtmlTextInfo htmlTextInfo  = null;
                string       contentString = "";

                htmlTextInfo = objHTML.GetTopHtmlText(ModuleId, !IsEditable, WorkflowID);

                if ((htmlTextInfo != null))
                {
                    //don't decode yet (this is done in FormatHtmlText)
                    contentString = htmlTextInfo.Content;
                }
                else
                {
                    // get default content from resource file
                    if (PortalSettings.UserMode == PortalSettings.Mode.Edit)
                    {
                        if (EditorEnabled)
                        {
                            contentString = Localization.GetString("AddContentFromToolBar.Text", LocalResourceFile);
                        }
                        else
                        {
                            contentString = Localization.GetString("AddContentFromActionMenu.Text", LocalResourceFile);
                        }
                    }
                    else
                    {
                        // hide the module if no content and in view mode
                        ContainerControl.Visible = false;
                    }
                }

                // token replace
                EditorEnabled = EditorEnabled && !Settings.ReplaceTokens;

                // localize toolbar
                if (EditorEnabled)
                {
                    foreach (DNNToolBarButton button in editorDnnToobar.Buttons)
                    {
                        button.ToolTip = Localization.GetString(button.ToolTip + ".ToolTip", LocalResourceFile);
                    }
                }
                else
                {
                    editorDnnToobar.Visible = false;
                }

                lblContent.EditEnabled = EditorEnabled;

                // add content to module
                lblContent.Controls.Add(new LiteralControl(HtmlTextController.FormatHtmlText(ModuleId, contentString, Settings, PortalSettings, Page)));

                //set normalCheckBox on the content wrapper to prevent form decoration if its disabled.
                if (!Settings.UseDecorate)
                {
                    lblContent.CssClass = string.Format("{0} normalCheckBox", lblContent.CssClass);
                }

                if (IsPostBack && AJAX.IsEnabled() && AJAX.GetScriptManager(Page).IsInAsyncPostBack)
                {
                    var resetScript = $@"
if(typeof dnn !== 'undefined' && typeof dnn.controls !== 'undefined' && typeof dnn.controls.controls !== 'undefined'){{
    var control = dnn.controls.controls['{lblContent.ClientID}'];
    if(control && control.container !== $get('{lblContent.ClientID}')){{
        dnn.controls.controls['{lblContent.ClientID}'] = null;
    }}
}};";
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), $"ResetHtmlModule{ClientID}", resetScript, true);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #10
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                var objHTML = new HtmlTextController();

                // edit in place
                if (EditorEnabled && IsEditable && PortalSettings.UserMode == PortalSettings.Mode.Edit)
                {
                    EditorEnabled = true;
                }
                else
                {
                    EditorEnabled = false;
                }

                // get content
                HtmlTextInfo htmlTextInfo  = null;
                string       contentString = "";

                htmlTextInfo = objHTML.GetTopHtmlText(ModuleId, !IsEditable, WorkflowID);

                if ((htmlTextInfo != null))
                {
                    //don't decode yet (this is done in FormatHtmlText)
                    contentString = htmlTextInfo.Content;
                }
                else
                {
                    // get default content from resource file
                    if (!IsPostBack)
                    {
                        if (PortalSettings.UserMode == PortalSettings.Mode.Edit)
                        {
                            if (EditorEnabled)
                            {
                                contentString = Localization.GetString("AddContentFromToolBar.Text", LocalResourceFile);
                            }
                            else
                            {
                                contentString = Localization.GetString("AddContentFromActionMenu.Text", LocalResourceFile);
                            }
                        }
                        else
                        {
                            // hide the module if no content and in view mode
                            ContainerControl.Visible = false;
                        }
                    }
                }

                // token replace
                if (EditorEnabled && Settings["HtmlText_ReplaceTokens"] != null)
                {
                    EditorEnabled = !Convert.ToBoolean(Settings["HtmlText_ReplaceTokens"]);
                }

                // localize toolbar
                if (!IsPostBack)
                {
                    if (EditorEnabled)
                    {
                        foreach (DNNToolBarButton button in editorDnnToobar.Buttons)
                        {
                            button.ToolTip = Localization.GetString(button.ToolTip + ".ToolTip", LocalResourceFile);
                        }
                    }
                    else
                    {
                        editorDnnToobar.Visible = false;
                    }
                }

                lblContent.EditEnabled = EditorEnabled;

                // add content to module
                lblContent.Controls.Add(new LiteralControl(HtmlTextController.FormatHtmlText(ModuleId, contentString, Settings)));

                //set normalCheckBox on the content wrapper to prevent form decoration if its disabled.
                if (Settings.ContainsKey("HtmlText_UseDecorate") && Settings["HtmlText_UseDecorate"].ToString() == "0")
                {
                    lblContent.CssClass = string.Format("{0} normalCheckBox", lblContent.CssClass);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }