Esempio n. 1
0
        /// <summary>
        ///   Gets the latest html content of the module
        /// </summary>
        /// <returns></returns>
        private HtmlTextInfo GetLatestHTMLContent()
        {
            var htmlContent = _htmlTextController.GetTopHtmlText(ModuleId, false, WorkflowID);

            if (htmlContent == null)
            {
                htmlContent            = new HtmlTextInfo();
                htmlContent.ItemID     = -1;
                htmlContent.StateID    = _workflowStateController.GetFirstWorkflowStateID(WorkflowID);
                htmlContent.WorkflowID = WorkflowID;
                htmlContent.ModuleID   = ModuleId;
            }

            return(htmlContent);
        }
Esempio n. 2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   GetTopHtmlText gets the most recent HtmlTextInfo object for the Module, Workflow, and State
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "moduleId">The ID of the Module</param>
        /// <param name = "isPublished">Whether the content has been published or not</param>
        /// <param name="workflowId">The Workflow ID</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public HtmlTextInfo GetTopHtmlText(int moduleId, bool isPublished, int workflowId)
        {
            var htmlText = CBO.FillObject <HtmlTextInfo>(DataProvider.Instance().GetTopHtmlText(moduleId, isPublished));

            if (htmlText != null)
            {
                // check if workflow has changed
                if (isPublished == false && htmlText.WorkflowID != workflowId)
                {
                    // get proper state for workflow
                    htmlText.WorkflowID   = workflowId;
                    htmlText.WorkflowName = "[REPAIR_WORKFLOW]";

                    var workflowStateController = new WorkflowStateController();
                    htmlText.StateID = htmlText.IsPublished
                                        ? workflowStateController.GetLastWorkflowStateID(workflowId)
                                        : workflowStateController.GetFirstWorkflowStateID(workflowId);
                    // update object
                    UpdateHtmlText(htmlText, GetMaximumVersionHistory(htmlText.PortalID));

                    // get object again
                    htmlText = CBO.FillObject <HtmlTextInfo>(DataProvider.Instance().GetTopHtmlText(moduleId, false));
                }
            }
            return(htmlText);
        }
Esempio n. 3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   ImportModule implements the IPortable ImportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "ModuleID">The ID of the Module being imported</param>
        /// <param name = "Content">The Content being imported</param>
        /// <param name = "Version">The Version of the Module Content being imported</param>
        /// <param name = "UserId">The UserID of the User importing the Content</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public void ImportModule(int ModuleID, string Content, string Version, int UserId)
        {
            ModuleInfo module = ModuleController.Instance.GetModule(ModuleID, Null.NullInteger, true);
            var        workflowStateController = new WorkflowStateController();
            int        workflowID = GetWorkflow(ModuleID, module.TabID, module.PortalID).Value;
            XmlNode    xml        = Globals.GetContent(Content, "htmltext");

            var htmlContent = new HtmlTextInfo();

            htmlContent.ModuleID = ModuleID;
            // convert Version to System.Version
            var objVersion = new Version(Version);

            if (objVersion >= new Version(5, 1, 0))
            {
                // current module content
                htmlContent.Content = DeTokeniseLinks(xml.SelectSingleNode("content").InnerText, module.PortalID);
            }
            else
            {
                // legacy module content
                htmlContent.Content = DeTokeniseLinks(xml.SelectSingleNode("desktophtml").InnerText, module.PortalID);
            }
            htmlContent.WorkflowID = workflowID;
            htmlContent.StateID    = workflowStateController.GetFirstWorkflowStateID(workflowID);
            // import
            UpdateHtmlText(htmlContent, GetMaximumVersionHistory(module.PortalID));
        }
Esempio n. 4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   ModuleAction_Click handles all ModuleAction events raised from the action menu
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        private void ModuleAction_Click(object sender, ActionEventArgs e)
        {
            try
            {
                if (e.Action.CommandArgument == "publish")
                {
                    // verify security
                    if (IsEditable && PortalSettings.UserMode == PortalSettings.Mode.Edit)
                    {
                        // get content
                        var          objHTML    = new HtmlTextController();
                        HtmlTextInfo objContent = objHTML.GetTopHtmlText(ModuleId, false, WorkflowID);

                        var objWorkflow = new WorkflowStateController();
                        if (objContent.StateID == objWorkflow.GetFirstWorkflowStateID(WorkflowID))
                        {
                            // publish content
                            objContent.StateID = objWorkflow.GetNextWorkflowStateID(objContent.WorkflowID, objContent.StateID);

                            // save the content
                            objHTML.UpdateHtmlText(objContent, objHTML.GetMaximumVersionHistory(PortalId));

                            // refresh page
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   GetTopHtmlText gets the most recent HtmlTextInfo object for the Module, Workflow, and State
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "ModuleID">The ID of the Module</param>
        /// <param name = "IsPublished">Whether the content has been published or not</param>
        /// <param name="WorkflowID">The Workflow ID</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public HtmlTextInfo GetTopHtmlText(int ModuleID, bool IsPublished, int WorkflowID)
        {
            var objHtmlText = (HtmlTextInfo)(CBO.FillObject(DataProvider.Instance().GetTopHtmlText(ModuleID, IsPublished), typeof(HtmlTextInfo)));

            if (objHtmlText != null)
            {
                // check if workflow has changed
                if (IsPublished == false && objHtmlText.WorkflowID != WorkflowID)
                {
                    // get proper state for workflow
                    var objWorkflow = new WorkflowStateController();
                    objHtmlText.WorkflowID   = WorkflowID;
                    objHtmlText.WorkflowName = "[REPAIR_WORKFLOW]";
                    if (objHtmlText.IsPublished)
                    {
                        objHtmlText.StateID = objWorkflow.GetLastWorkflowStateID(WorkflowID);
                    }
                    else
                    {
                        objHtmlText.StateID = objWorkflow.GetFirstWorkflowStateID(WorkflowID);
                    }
                    // update object
                    UpdateHtmlText(objHtmlText, GetMaximumVersionHistory(objHtmlText.PortalID));
                    // get object again
                    objHtmlText = (HtmlTextInfo)(CBO.FillObject(DataProvider.Instance().GetTopHtmlText(ModuleID, IsPublished), typeof(HtmlTextInfo)));
                }
            }
            return(objHtmlText);
        }
Esempio n. 6
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   lblContent_UpdateLabel allows for inline editing of content
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        private void lblContent_UpdateLabel(object source, DNNLabelEditEventArgs e)
        {
            try
            {
                // verify security
                if ((!PortalSecurity.Instance.InputFilter(e.Text, PortalSecurity.FilterFlag.NoScripting).Equals(e.Text)))
                {
                    throw new SecurityException();
                }
                else if (EditorEnabled && IsEditable && PortalSettings.UserMode == PortalSettings.Mode.Edit)
                {
                    // get content
                    var          objHTML     = new HtmlTextController();
                    var          objWorkflow = new WorkflowStateController();
                    HtmlTextInfo objContent  = objHTML.GetTopHtmlText(ModuleId, false, WorkflowID);
                    if (objContent == null)
                    {
                        objContent        = new HtmlTextInfo();
                        objContent.ItemID = -1;
                    }

                    // set content attributes
                    objContent.ModuleID   = ModuleId;
                    objContent.Content    = Server.HtmlEncode(e.Text);
                    objContent.WorkflowID = WorkflowID;
                    objContent.StateID    = objWorkflow.GetFirstWorkflowStateID(WorkflowID);

                    // save the content
                    objHTML.UpdateHtmlText(objContent, objHTML.GetMaximumVersionHistory(PortalId));
                }
                else
                {
                    throw new SecurityException();
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 7
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   CreateUserNotifications creates HtmlTextUser records and optionally sends email notifications to participants in a Workflow
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="objHtmlText">An HtmlTextInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        private void CreateUserNotifications(HtmlTextInfo objHtmlText)
        {
            var _htmlTextUserController = new HtmlTextUserController();
            HtmlTextUserInfo _htmlTextUser = null;
            UserInfo _user = null;

            // clean up old user notification records
            _htmlTextUserController.DeleteHtmlTextUsers();

            // ensure we have latest htmltext object loaded
            objHtmlText = GetHtmlText(objHtmlText.ModuleID, objHtmlText.ItemID);

            // build collection of users to notify
            var objWorkflow = new WorkflowStateController();
            var arrUsers = new ArrayList();

            // if not published
            if (objHtmlText.IsPublished == false)
            {
                arrUsers.Add(objHtmlText.CreatedByUserID); // include content owner 
            }

            // if not draft and not published
            if (objHtmlText.StateID != objWorkflow.GetFirstWorkflowStateID(objHtmlText.WorkflowID) && objHtmlText.IsPublished == false)
            {
                // get users from permissions for state
                var objRoles = new RoleController();
                foreach (WorkflowStatePermissionInfo permission in
                    WorkflowStatePermissionController.GetWorkflowStatePermissions(objHtmlText.StateID))
                {
                    if (permission.AllowAccess)
                    {
                        if (Null.IsNull(permission.UserID))
                        {
                            int roleId = permission.RoleID;
                            RoleInfo objRole = TestableRoleController.Instance.GetRole(objHtmlText.PortalID, r => r.RoleID == roleId);
                            if ((objRole != null))
                            {
                                foreach (UserRoleInfo objUserRole in objRoles.GetUserRoles(objHtmlText.PortalID, null, objRole.RoleName))
                                {
                                    if (!arrUsers.Contains(objUserRole.UserID))
                                    {
                                        arrUsers.Add(objUserRole.UserID);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!arrUsers.Contains(permission.UserID))
                            {
                                arrUsers.Add(permission.UserID);
                            }
                        }
                    }
                }
            }

            // process notifications
            if (arrUsers.Count > 0 || (objHtmlText.IsPublished && objHtmlText.Notify))
            {
                // get tabid from module 
                var objModules = new ModuleController();
                ModuleInfo objModule = objModules.GetModule(objHtmlText.ModuleID);

                PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings();
                if (objPortalSettings != null)
                {
                    string strResourceFile = string.Format("{0}/DesktopModules/{1}/{2}/{3}",
                                                           Globals.ApplicationPath,
                                                           objModule.DesktopModule.FolderName,
                                                           Localization.LocalResourceDirectory,
                                                           Localization.LocalSharedResourceFile);
                    string strSubject = Localization.GetString("NotificationSubject", strResourceFile);
                    string strBody = Localization.GetString("NotificationBody", strResourceFile);
                    strBody = strBody.Replace("[URL]", Globals.NavigateURL(objModule.TabID));
                    strBody = strBody.Replace("[STATE]", objHtmlText.StateName);

                    // process user notification collection

                    foreach (int intUserID in arrUsers)
                    {
                        // create user notification record 
                        _htmlTextUser = new HtmlTextUserInfo();
                        _htmlTextUser.ItemID = objHtmlText.ItemID;
                        _htmlTextUser.StateID = objHtmlText.StateID;
                        _htmlTextUser.ModuleID = objHtmlText.ModuleID;
                        _htmlTextUser.TabID = objModule.TabID;
                        _htmlTextUser.UserID = intUserID;
                        _htmlTextUserController.AddHtmlTextUser(_htmlTextUser);

                        // send an email notification to a user if the state indicates to do so
                        if (objHtmlText.Notify)
                        {
                            _user = UserController.GetUserById(objHtmlText.PortalID, intUserID);
                            if (_user != null)
                            {
                                AddHtmlNotification(strSubject, strBody, _user);
                            }
                        }
                    }

                    // if published and the published state specifies to notify members of the workflow
                    if (objHtmlText.IsPublished && objHtmlText.Notify)
                    {
                        // send email notification to the author
                        _user = UserController.GetUserById(objHtmlText.PortalID, objHtmlText.CreatedByUserID);
                        if (_user != null)
                        {
                            try
                            {
                                Services.Mail.Mail.SendEmail(objPortalSettings.Email, objPortalSettings.Email, strSubject, strBody);
                            }
                            catch (Exception exc)
                            {
                                Exceptions.LogException(exc);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   ImportModule implements the IPortable ImportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "ModuleID">The ID of the Module being imported</param>
        /// <param name = "Content">The Content being imported</param>
        /// <param name = "Version">The Version of the Module Content being imported</param>
        /// <param name = "UserId">The UserID of the User importing the Content</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public void ImportModule(int ModuleID, string Content, string Version, int UserId)
        {
            var moduleController = new ModuleController();
            ModuleInfo module = moduleController.GetModule(ModuleID);
            var workflowStateController = new WorkflowStateController();
            int workflowID = GetWorkflow(ModuleID, module.TabID, module.PortalID).Value;
            XmlNode xml = Globals.GetContent(Content, "htmltext");

            var htmlContent = new HtmlTextInfo();
            htmlContent.ModuleID = ModuleID;
            // convert Version to System.Version
            var objVersion = new Version(Version);
            if (objVersion >= new Version(5, 1, 0))
            {
                // current module content
                htmlContent.Content = DeTokeniseLinks(xml.SelectSingleNode("content").InnerText, module.PortalID);
            }
            else
            {
                // legacy module content
                htmlContent.Content = DeTokeniseLinks(xml.SelectSingleNode("desktophtml").InnerText, module.PortalID);
            }
            htmlContent.WorkflowID = workflowID;
            htmlContent.StateID = workflowStateController.GetFirstWorkflowStateID(workflowID);
            // import
            UpdateHtmlText(htmlContent, GetMaximumVersionHistory(module.PortalID));
        }
Esempio n. 9
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   GetTopHtmlText gets the most recent HtmlTextInfo object for the Module, Workflow, and State
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name = "ModuleID">The ID of the Module</param>
 /// <param name = "IsPublished">Whether the content has been published or not</param>
 /// <param name="WorkflowID">The Workflow ID</param>
 /// <history>
 /// </history>
 /// -----------------------------------------------------------------------------
 public HtmlTextInfo GetTopHtmlText(int ModuleID, bool IsPublished, int WorkflowID)
 {
     var objHtmlText = (HtmlTextInfo) (CBO.FillObject(DataProvider.Instance().GetTopHtmlText(ModuleID, IsPublished), typeof (HtmlTextInfo)));
     if (objHtmlText != null)
     {
         // check if workflow has changed
         if (IsPublished == false && objHtmlText.WorkflowID != WorkflowID)
         {
             // get proper state for workflow
             var objWorkflow = new WorkflowStateController();
             objHtmlText.WorkflowID = WorkflowID;
             objHtmlText.WorkflowName = "[REPAIR_WORKFLOW]";
             if (objHtmlText.IsPublished)
             {
                 objHtmlText.StateID = objWorkflow.GetLastWorkflowStateID(WorkflowID);
             }
             else
             {
                 objHtmlText.StateID = objWorkflow.GetFirstWorkflowStateID(WorkflowID);
             }
             // update object
             UpdateHtmlText(objHtmlText, GetMaximumVersionHistory(objHtmlText.PortalID));
             // get object again
             objHtmlText = (HtmlTextInfo) (CBO.FillObject(DataProvider.Instance().GetTopHtmlText(ModuleID, IsPublished), typeof (HtmlTextInfo)));
         }
     }
     return objHtmlText;
 }
Esempio n. 10
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   ModuleAction_Click handles all ModuleAction events raised from the action menu
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        private void ModuleAction_Click(object sender, ActionEventArgs e)
        {
            try
            {
                if (e.Action.CommandArgument == "publish")
                {
                    // verify security 
                    if (IsEditable && PortalSettings.UserMode == PortalSettings.Mode.Edit)
                    {
                        // get content
                        var objHTML = new HtmlTextController();
                        HtmlTextInfo objContent = objHTML.GetTopHtmlText(ModuleId, false, WorkflowID);

                        var objWorkflow = new WorkflowStateController();
                        if (objContent.StateID == objWorkflow.GetFirstWorkflowStateID(WorkflowID))
                        {
                            // publish content
                            objContent.StateID = objWorkflow.GetNextWorkflowStateID(objContent.WorkflowID, objContent.StateID);

                            // save the content
                            objHTML.UpdateHtmlText(objContent, objHTML.GetMaximumVersionHistory(PortalId));

                            // refresh page
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 11
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   lblContent_UpdateLabel allows for inline editing of content
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        private void lblContent_UpdateLabel(object source, DNNLabelEditEventArgs e)
        {
            try
            {
                // verify security 
                if ((!new PortalSecurity().InputFilter(e.Text, PortalSecurity.FilterFlag.NoScripting).Equals(e.Text)))
                {
                    throw new SecurityException();
                }
                else if (EditorEnabled && IsEditable && PortalSettings.UserMode == PortalSettings.Mode.Edit)
                {
                    // get content
                    var objHTML = new HtmlTextController();
                    var objWorkflow = new WorkflowStateController();
                    HtmlTextInfo objContent = objHTML.GetTopHtmlText(ModuleId, false, WorkflowID);
                    if (objContent == null)
                    {
                        objContent = new HtmlTextInfo();
                        objContent.ItemID = -1;
                    }

                    // set content attributes
                    objContent.ModuleID = ModuleId;
                    objContent.Content = Server.HtmlEncode(e.Text);
                    objContent.WorkflowID = WorkflowID;
                    objContent.StateID = objWorkflow.GetFirstWorkflowStateID(WorkflowID);

                    // save the content
                    objHTML.UpdateHtmlText(objContent, objHTML.GetMaximumVersionHistory(PortalId));
                }
                else
                {
                    throw new SecurityException();
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 12
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   CreateUserNotifications creates HtmlTextUser records and optionally sends email notifications to participants in a Workflow
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="objHtmlText">An HtmlTextInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        private void CreateUserNotifications(HtmlTextInfo objHtmlText)
        {
            var _htmlTextUserController    = new HtmlTextUserController();
            HtmlTextUserInfo _htmlTextUser = null;
            UserInfo         _user         = null;

            // clean up old user notification records
            _htmlTextUserController.DeleteHtmlTextUsers();

            // ensure we have latest htmltext object loaded
            objHtmlText = GetHtmlText(objHtmlText.ModuleID, objHtmlText.ItemID);

            // build collection of users to notify
            var objWorkflow = new WorkflowStateController();
            var arrUsers    = new ArrayList();

            // if not published
            if (objHtmlText.IsPublished == false)
            {
                arrUsers.Add(objHtmlText.CreatedByUserID); // include content owner
            }

            // if not draft and not published
            if (objHtmlText.StateID != objWorkflow.GetFirstWorkflowStateID(objHtmlText.WorkflowID) && objHtmlText.IsPublished == false)
            {
                // get users from permissions for state
                foreach (WorkflowStatePermissionInfo permission in WorkflowStatePermissionController.GetWorkflowStatePermissions(objHtmlText.StateID))
                {
                    if (permission.AllowAccess)
                    {
                        if (Null.IsNull(permission.UserID))
                        {
                            int      roleId  = permission.RoleID;
                            RoleInfo objRole = RoleController.Instance.GetRole(objHtmlText.PortalID, r => r.RoleID == roleId);
                            if ((objRole != null))
                            {
                                foreach (UserRoleInfo objUserRole in RoleController.Instance.GetUserRoles(objHtmlText.PortalID, null, objRole.RoleName))
                                {
                                    if (!arrUsers.Contains(objUserRole.UserID))
                                    {
                                        arrUsers.Add(objUserRole.UserID);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!arrUsers.Contains(permission.UserID))
                            {
                                arrUsers.Add(permission.UserID);
                            }
                        }
                    }
                }
            }

            // process notifications
            if (arrUsers.Count > 0 || (objHtmlText.IsPublished && objHtmlText.Notify))
            {
                // get tabid from module
                ModuleInfo objModule = ModuleController.Instance.GetModule(objHtmlText.ModuleID, Null.NullInteger, true);

                PortalSettings objPortalSettings = PortalController.Instance.GetCurrentPortalSettings();
                if (objPortalSettings != null)
                {
                    string strResourceFile = string.Format("{0}/DesktopModules/{1}/{2}/{3}",
                                                           Globals.ApplicationPath,
                                                           objModule.DesktopModule.FolderName,
                                                           Localization.LocalResourceDirectory,
                                                           Localization.LocalSharedResourceFile);
                    string strSubject = Localization.GetString("NotificationSubject", strResourceFile);
                    string strBody    = Localization.GetString("NotificationBody", strResourceFile);
                    strBody = strBody.Replace("[URL]", Globals.NavigateURL(objModule.TabID));
                    strBody = strBody.Replace("[STATE]", objHtmlText.StateName);

                    // process user notification collection

                    foreach (int intUserID in arrUsers)
                    {
                        // create user notification record
                        _htmlTextUser          = new HtmlTextUserInfo();
                        _htmlTextUser.ItemID   = objHtmlText.ItemID;
                        _htmlTextUser.StateID  = objHtmlText.StateID;
                        _htmlTextUser.ModuleID = objHtmlText.ModuleID;
                        _htmlTextUser.TabID    = objModule.TabID;
                        _htmlTextUser.UserID   = intUserID;
                        _htmlTextUserController.AddHtmlTextUser(_htmlTextUser);

                        // send an email notification to a user if the state indicates to do so
                        if (objHtmlText.Notify)
                        {
                            _user = UserController.GetUserById(objHtmlText.PortalID, intUserID);
                            if (_user != null)
                            {
                                AddHtmlNotification(strSubject, strBody, _user);
                            }
                        }
                    }

                    // if published and the published state specifies to notify members of the workflow
                    if (objHtmlText.IsPublished && objHtmlText.Notify)
                    {
                        // send email notification to the author
                        _user = UserController.GetUserById(objHtmlText.PortalID, objHtmlText.CreatedByUserID);
                        if (_user != null)
                        {
                            try
                            {
                                Services.Mail.Mail.SendEmail(objPortalSettings.Email, objPortalSettings.Email, strSubject, strBody);
                            }
                            catch (Exception exc)
                            {
                                Exceptions.LogException(exc);
                            }
                        }
                    }
                }
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   GetTopHtmlText gets the most recent HtmlTextInfo object for the Module, Workflow, and State
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "moduleId">The ID of the Module</param>
        /// <param name = "isPublished">Whether the content has been published or not</param>
        /// <param name="workflowId">The Workflow ID</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public HtmlTextInfo GetTopHtmlText(int moduleId, bool isPublished, int workflowId)
        {
            var htmlText = CBO.FillObject<HtmlTextInfo>(DataProvider.Instance().GetTopHtmlText(moduleId, isPublished));
            if (htmlText != null)
            {
                // check if workflow has changed
                if (isPublished == false && htmlText.WorkflowID != workflowId)
                {
                    // get proper state for workflow
                    htmlText.WorkflowID = workflowId;
                    htmlText.WorkflowName = "[REPAIR_WORKFLOW]";

                    var workflowStateController = new WorkflowStateController();
                    htmlText.StateID = htmlText.IsPublished 
                                        ? workflowStateController.GetLastWorkflowStateID(workflowId) 
                                        : workflowStateController.GetFirstWorkflowStateID(workflowId);
                    // update object
                    UpdateHtmlText(htmlText, GetMaximumVersionHistory(htmlText.PortalID));

                    // get object again
                    htmlText = CBO.FillObject<HtmlTextInfo>(DataProvider.Instance().GetTopHtmlText(moduleId, false));
                }
            }
            return htmlText;
        }