コード例 #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Check if the user is authorized
            if (!(PortalSecurity.HasApprovePermissions(ModuleID)))
            {
                PortalSecurity.AccessDeniedEdit();
            }

            // Fill email form with default
            if (!IsPostBack)
            {
                // Destinators
                ModuleSettings ms = null;
                for (int i = 0; i < portalSettings.ActiveTab.Modules.Count; i++)
                {
                    ms = (ModuleSettings)portalSettings.ActiveTab.Modules[i];
                    if (ms.ModuleID == ModuleID)
                    {
                        break;
                    }
                }
                string tmp = ms.AuthorizedAddRoles.Trim();
                tmp += ms.AuthorizedEditRoles.Trim();
                tmp += ms.AuthorizedDeleteRoles.Trim();
                string[] emails = MailHelper.GetEmailAddressesInRoles(tmp.Split(";".ToCharArray()), portalSettings.PortalID);
                for (int i = 0; i < emails.Length; i++)
                {
                    emailForm.To.Add(emails[i]);
                }
                // Subject
                emailForm.Subject = Esperantus.Localize.GetString("SWI_REJECT_SUBJECT1", "The new content of ") + "'" + ms.ModuleTitle + "'" + Localize.GetString("SWI_REJECT_SUBJECT2", " has been rejected");
                // Message
                emailForm.HtmlBodyText = Esperantus.Localize.GetString("SWI_REJECT_BODY", "You can find the rejected content at:") + "<br><br><a href='" + UrlReferrer + "'>" + UrlReferrer + "</a>";
            }
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </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)
        {
            // Check if the user is authorized
            if (!(PortalSecurity.HasApprovePermissions(ModuleID)))
            {
                PortalSecurity.AccessDeniedEdit();
            }

            // Fill email form with default
            if (!IsPostBack)
            {
                // Destinators
                ModuleSettings ms = null;
                for (int i = 0; i < portalSettings.ActivePage.Modules.Count; i++)
                {
                    ms = (ModuleSettings)portalSettings.ActivePage.Modules[i];
                    if (ms.ModuleID == ModuleID)
                    {
                        break;
                    }
                }
                string[] emails =
                    MailHelper.GetEmailAddressesInRoles(ms.AuthorizedPublishingRoles.Split(";".ToCharArray()),
                                                        portalSettings.PortalID);
                for (int i = 0; i < emails.Length; i++)
                {
                    emailForm.To.Add(emails[i]);
                }
                // Subject
                emailForm.Subject =
                    General.GetString("SWI_REQUEST_PUBLISH_SUBJECT", "Request publishing for the new content of '") +
                    ms.ModuleTitle + "'";
                // Message
                emailForm.HtmlBodyText = General.GetString("SWI_REQUEST_BODY", "You can find the new content at:") +
                                         "<br><br><a href='" + UrlReferrer + "'>" + UrlReferrer + "</a>";
            }
        }