Beispiel #1
0
        protected void cmdPreview_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(SkinSrc))
            {
                string strType = SkinRoot.Substring(0, SkinRoot.Length - 1);

                string strURL = Globals.AddHTTP(Globals.GetDomainName(Request)) + Globals.ApplicationURL(_objPortal.HomeTabId).Replace("~", "");
                //detect if there is already a '?' in the URL (in case of a child portal)
                if (strURL.IndexOf("?") > 0)
                {
                    strURL += "&";
                }
                else
                {
                    strURL += "?";
                }
                strURL += "portalid=" + _objPortal.PortalID + "&" + strType + "Src=" + Globals.QueryStringEncode(SkinSrc.Replace(".ascx", ""));

                if (SkinRoot == SkinInfo.RootContainer)
                {
                    if (Request.QueryString["ModuleId"] != null)
                    {
                        strURL += "&ModuleId=" + Request.QueryString["ModuleId"];
                    }
                }

                Response.Write("<script>window.open('" + strURL + "','_blank')</script>");
            }
        }
Beispiel #2
0
        /// <summary>
        /// cmdGoogle_Click runs when the Submit to Google Linkbutton is clicked.
        /// It submits the site's Description, DomainName and Keywords to the Google Site.
        /// </summary>
        /// <history>
        ///     [cnurse]	9/9/2004	Modified
        /// </history>
        protected void cmdGoogle_Click(object sender, EventArgs e)
        {
            try
            {
                string strURL      = "";
                string strComments = "";

                PortalController objPortalController = new PortalController();
                PortalInfo       objPortal           = objPortalController.GetPortal(intPortalId);
                if (objPortal != null)
                {
                    strComments += objPortal.PortalName;
                    if (!String.IsNullOrEmpty(objPortal.Description))
                    {
                        strComments += " " + objPortal.Description;
                    }
                    if (!String.IsNullOrEmpty(objPortal.KeyWords))
                    {
                        strComments += " " + objPortal.KeyWords;
                    }
                }

                strURL += "http://www.google.com/addurl?q=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request)));
                strURL += "&dq=" + Globals.HTTPPOSTEncode(strComments);
                strURL += "&submit=Add+URL";

                UrlUtils.OpenNewWindow(strURL);
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        /// FormatExpiryDate formats the format name as an a tag
        /// </summary>
        public string FormatPortalAliases(int portalID)
        {
            var str = new StringBuilder();

            try
            {
                var             objPortalAliasController = new PortalAliasController();
                var             arr = objPortalAliasController.GetPortalAliasArrayByPortalID(portalID);
                PortalAliasInfo objPortalAliasInfo;
                int             i;
                for (i = 0; i <= arr.Count - 1; i++)
                {
                    objPortalAliasInfo = (PortalAliasInfo)arr[i];

                    var httpAlias   = Globals.AddHTTP(objPortalAliasInfo.HTTPAlias);
                    var originalUrl = HttpContext.Current.Items["UrlRewrite:OriginalUrl"].ToString().ToLowerInvariant();

                    httpAlias = Globals.AddPort(httpAlias, originalUrl);

                    str.Append("<a href=\"" + httpAlias + "\">" + objPortalAliasInfo.HTTPAlias + "</a>" + "<BR>");
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
            return(str.ToString());
        }
        /// <summary>
        /// cmdGoogle_Click runs when the Submit Page to Google  Button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdGoogle_Click(object sender, EventArgs e)
        {
            try
            {
                string strURL      = "";
                string strComments = "";

                strComments += txtTitle.Text;
                if (!String.IsNullOrEmpty(txtDescription.Text))
                {
                    strComments += " " + txtDescription.Text;
                }
                if (!String.IsNullOrEmpty(txtKeyWords.Text))
                {
                    strComments += " " + txtKeyWords.Text;
                }

                strURL += "http://www.google.com/addurl?q=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request)) + "/" + Globals.glbDefaultPage + "?tabid=" + TabId);
                strURL += "&dq=" + Globals.HTTPPOSTEncode(strComments);
                strURL += "&submit=Add+URL";

                Response.Redirect(strURL, true);
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #5
0
 /// <summary>
 /// cmdProcessor_Click runs when the Processor Website Linkbutton is clicked. It
 /// redirects the user to the selected processor's website.
 /// </summary>
 /// <history>
 ///     [cnurse]	9/9/2004	Modified
 /// </history>
 protected void cmdProcessor_Click(object sender, EventArgs e)
 {
     try
     {
         Response.Redirect(Globals.AddHTTP(cboProcessor.SelectedItem.Value), true);
     }
     catch (Exception exc)  //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
Beispiel #6
0
        protected string PreviewPopup()
        {
            var previewUrl = string.Format("{0}/Default.aspx?ctl={1}&previewTab={2}&TabID={2}",
                                           Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias),
                                           "MobilePreview",
                                           PortalSettings.ActiveTab.TabID);

            if (PortalSettings.EnablePopUps)
            {
                return(UrlUtils.PopUpUrl(previewUrl, this, PortalSettings, true, false, 660, 800));
            }

            return(string.Format("location.href = \"{0}\"", previewUrl));
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdDelete_Click runs when the Delete LinkButton is clicked.
        /// It deletes the current portal form the Database.  It can only run in Host
        /// (SuperUser) mode
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/9/2004	Modified
        ///     [VMasanas]  9/12/2004   Move skin deassignment to DeletePortalInfo.
        ///     [jmarino]  16/06/2011   Modify redirection after deletion of portal
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void DeletePortal(object sender, EventArgs e)
        {
            try
            {
                var        objPortalController = new PortalController();
                PortalInfo objPortalInfo       = objPortalController.GetPortal(_portalId);
                if (objPortalInfo != null)
                {
                    string strMessage = PortalController.DeletePortal(objPortalInfo, Globals.GetAbsoluteServerPath(Request));

                    if (string.IsNullOrEmpty(strMessage))
                    {
                        var objEventLog = new EventLogController();
                        objEventLog.AddLog("PortalName", objPortalInfo.PortalName, PortalSettings, UserId, EventLogController.EventLogType.PORTAL_DELETED);

                        //Redirect to another site
                        if (_portalId == PortalId)
                        {
                            if (!string.IsNullOrEmpty(Host.HostURL))
                            {
                                Response.Redirect(Globals.AddHTTP(Host.HostURL));
                            }
                            else
                            {
                                Response.End();
                            }
                        }
                        else
                        {
                            if (ViewState["UrlReferrer"] != null)
                            {
                                Response.Redirect(Convert.ToString(ViewState["UrlReferrer"]), true);
                            }
                            else
                            {
                                Response.Redirect(Globals.NavigateURL(), true);
                            }
                        }
                    }
                    else
                    {
                        UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #8
0
        /// <summary>
        /// GetFriendlyAlias gets the Alias root of the friendly url
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="path">The path to format.</param>
        /// <param name="portalAlias">The portal alias of the site.</param>
        /// <returns>The formatted url</returns>
        /// <history>
        ///		[cnurse]	12/16/2004	created
        /// </history>
        private string GetFriendlyAlias(string path, string portalAlias)
        {
            string friendlyPath = path;
            string matchString  = "";

            if (!(portalAlias == Null.NullString))
            {
                if (!(HttpContext.Current.Items["UrlRewrite:OriginalUrl"] == null))
                {
                    string originalUrl = HttpContext.Current.Items["UrlRewrite:OriginalUrl"].ToString();

                    //For Each entry As String In arrAlias
                    Match portalMatch = Regex.Match(originalUrl, "^" + Globals.AddHTTP(portalAlias), RegexOptions.IgnoreCase);
                    if (!(portalMatch == Match.Empty))
                    {
                        matchString = Globals.AddHTTP(portalAlias);
                    }

                    if (matchString == "")
                    {
                        //Manage the special case where original url contains the alias as
                        //http://www.domain.com/Default.aspx?alias=www.domain.com/child"
                        portalMatch = Regex.Match(originalUrl, "^?alias=" + portalAlias, RegexOptions.IgnoreCase);
                        if (!(portalMatch == Match.Empty))
                        {
                            matchString = Globals.AddHTTP(portalAlias);
                        }
                    }
                }
            }

            if (!String.IsNullOrEmpty(matchString))
            {
                if (path.IndexOf("~") != -1)
                {
                    friendlyPath = friendlyPath.Replace("~", matchString);
                }
                else
                {
                    friendlyPath = matchString + friendlyPath;
                }
            }
            else
            {
                friendlyPath = Globals.ResolveUrl(friendlyPath);
            }

            return(friendlyPath);
        }
        private void BindMarketing(PortalInfo portal)
        {
            //Load DocTypes
            var searchEngines = new Dictionary <string, string>
            {
                { "Google", "http://www.google.com/addurl?q=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request))) },
                { "Yahoo", "http://siteexplorer.search.yahoo.com/submit" },
                { "Microsoft", "http://search.msn.com.sg/docs/submit.aspx" }
            };

            cboSearchEngine.DataSource = searchEngines;
            cboSearchEngine.DataBind();

            var portalAliasController = new PortalAliasController();
            var aliases = portalAliasController.GetPortalAliasArrayByPortalID(portal.PortalID);

            if (PortalController.IsChildPortal(portal, Globals.GetAbsoluteServerPath(Request)))
            {
                txtSiteMap.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + @"/SiteMap.aspx?portalid=" + portal.PortalID;
            }
            else
            {
                if (aliases.Count > 0)
                {
                    //Get the first Alias
                    var objPortalAliasInfo = (PortalAliasInfo)aliases[0];
                    txtSiteMap.Text = Globals.AddHTTP(objPortalAliasInfo.HTTPAlias) + @"/SiteMap.aspx";
                }
                else
                {
                    txtSiteMap.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + @"/SiteMap.aspx";
                }
            }
            optBanners.SelectedIndex = portal.BannerAdvertising;
            if (UserInfo.IsSuperUser)
            {
                lblBanners.Visible = false;
            }
            else
            {
                optBanners.Enabled = portal.BannerAdvertising != 2;
                lblBanners.Visible = portal.BannerAdvertising == 2;
            }
        }
Beispiel #10
0
        protected new string GetRedirectUrl(bool checkSettings = true)
        {
            var redirectUrl        = "";
            var redirectAfterLogin = PortalSettings.Registration.RedirectAfterLogin;

            if (checkSettings && redirectAfterLogin > 0)             //redirect to after registration page
            {
                redirectUrl = Globals.NavigateURL(redirectAfterLogin);
            }
            else
            {
                if (Request.QueryString["returnurl"] != null)
                {
                    //return to the url passed to register
                    redirectUrl = HttpUtility.UrlDecode(Request.QueryString["returnurl"]);
                    //redirect url should never contain a protocol ( if it does, it is likely a cross-site request forgery attempt )
                    if (redirectUrl.Contains("://") &&
                        !redirectUrl.StartsWith(Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias),
                                                StringComparison.InvariantCultureIgnoreCase))
                    {
                        redirectUrl = "";
                    }
                    if (redirectUrl.Contains("?returnurl"))
                    {
                        string baseURL = redirectUrl.Substring(0,
                                                               redirectUrl.IndexOf("?returnurl", StringComparison.Ordinal));
                        string returnURL =
                            redirectUrl.Substring(redirectUrl.IndexOf("?returnurl", StringComparison.Ordinal) + 11);

                        redirectUrl = string.Concat(baseURL, "?returnurl", HttpUtility.UrlEncode(returnURL));
                    }
                }
                if (String.IsNullOrEmpty(redirectUrl))
                {
                    //redirect to current page
                    redirectUrl = Globals.NavigateURL();
                }
            }

            return(redirectUrl);
        }
        /// <summary>
        /// FormatExpiryDate formats the format name as an <a> tag
        /// </summary>
        /// <history>
        ///     [cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        public string FormatPortalAliases(int PortalID)
        {
            StringBuilder str = new StringBuilder();

            try
            {
                PortalAliasController objPortalAliasController = new PortalAliasController();
                ArrayList             arr = objPortalAliasController.GetPortalAliasArrayByPortalID(PortalID);

                for (int i = 0; i < arr.Count; i++)
                {
                    PortalAliasInfo objPortalAliasInfo = (PortalAliasInfo)arr[i];
                    str.Append("<a href=\"" + Globals.AddHTTP(objPortalAliasInfo.HTTPAlias) + "\">" + objPortalAliasInfo.HTTPAlias + "</a>" + "<BR>");
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
            return(str.ToString());
        }
Beispiel #12
0
        protected string PreviewPopup()
        {
            //Fariborz Khosravi
            //var previewUrl = string.Format("{0}/Default.aspx?ctl={1}&previewTab={2}",
            //                            Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias),
            //                            "MobilePreview",
            //                            PortalSettings.ActiveTab.TabID);
            var previewUrl = string.Format("{0}/{3}?ctl={1}&previewTab={2}",
                                           Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias),
                                           "MobilePreview",
                                           PortalSettings.ActiveTab.TabID, Globals.glbDefaultPage);

            if (PortalSettings.EnablePopUps)
            {
                return(UrlUtils.PopUpUrl(previewUrl, this, PortalSettings, true, false, 660, 800));
            }
            else
            {
                return(string.Format("location.href = \"{0}\"", previewUrl));
            }
        }
Beispiel #13
0
        /// <summary>
        /// FormatExpiryDate formats the format name as an a tag
        /// </summary>
        public string FormatPortalAliases(int portalID)
        {
            var str = new StringBuilder();

            try
            {
                var arr = PortalAliasController.Instance.GetPortalAliasesByPortalId(portalID).ToList();
                foreach (PortalAliasInfo portalAliasInfo in arr)
                {
                    var httpAlias   = Globals.AddHTTP(portalAliasInfo.HTTPAlias);
                    var originalUrl = HttpContext.Current.Items["UrlRewrite:OriginalUrl"].ToString().ToLowerInvariant();

                    httpAlias = Globals.AddPort(httpAlias, originalUrl);

                    str.Append("<a href=\"" + httpAlias + "\">" + portalAliasInfo.HTTPAlias + "</a>" + "<BR>");
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
            return(str.ToString());
        }
        private void BindPaymentProcessor(PortalInfo portal)
        {
            var listController = new ListController();

            currencyCombo.DataSource = listController.GetListEntryInfoItems("Currency", "");
            var currency = portal.Currency;

            if (String.IsNullOrEmpty(currency))
            {
                currency = "USD";
            }
            currencyCombo.DataBind(currency);

            processorCombo.DataSource = listController.GetListEntryInfoItems("Processor", "");
            processorCombo.DataBind();
            processorCombo.InsertItem(0, "<" + Localization.GetString("None_Specified") + ">", "");
            processorCombo.Select(Host.PaymentProcessor, true);

            processorLink.NavigateUrl = Globals.AddHTTP(processorCombo.SelectedItem.Value);

            txtUserId.Text = portal.ProcessorUserId;
            txtPassword.Attributes.Add("value", portal.ProcessorPassword);

            // use sandbox?
            bool bolPayPalSandbox = Boolean.Parse(PortalController.GetPortalSetting("paypalsandbox", portal.PortalID, "false"));

            chkPayPalSandboxEnabled.Checked = bolPayPalSandbox;

            // return url after payment or on cancel
            string strPayPalReturnURL = PortalController.GetPortalSetting("paypalsubscriptionreturn", portal.PortalID, Null.NullString);

            txtPayPalReturnURL.Text = strPayPalReturnURL;
            string strPayPalCancelURL = PortalController.GetPortalSetting("paypalsubscriptioncancelreturn", portal.PortalID, Null.NullString);

            txtPayPalCancelURL.Text = strPayPalCancelURL;
        }
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                UserInfo objUserInfo = null;
                int      intUserID   = -1;
                if (Request.IsAuthenticated)
                {
                    objUserInfo = UserController.GetCurrentUserInfo();
                    if (objUserInfo != null)
                    {
                        intUserID = objUserInfo.UserID;
                    }
                }

                int intRoleId = -1;
                if (Request.QueryString["roleid"] != null)
                {
                    intRoleId = int.Parse(Request.QueryString["roleid"]);
                }

                string           strProcessorUserId  = "";
                PortalController objPortalController = new PortalController();
                PortalInfo       objPortalInfo       = objPortalController.GetPortal(PortalSettings.PortalId);
                if (objPortalInfo != null)
                {
                    strProcessorUserId = objPortalInfo.ProcessorUserId;
                }

                Hashtable settings = PortalSettings.GetSiteSettings(PortalSettings.PortalId);
                string    strPayPalURL;

                if (intUserID != -1 && intRoleId != -1 && !String.IsNullOrEmpty(strProcessorUserId))
                {
                    strPayPalURL = "https://www.paypal.com/cgi-bin/webscr?";

                    if (Request.QueryString["cancel"] != null)
                    {
                        // build the cancellation PayPal URL
                        strPayPalURL += "cmd=_subscr-find&alias=" + Globals.HTTPPOSTEncode(strProcessorUserId);
                    }
                    else
                    {
                        strPayPalURL += "cmd=_ext-enter";

                        RoleController objRoles = new RoleController();

                        RoleInfo objRole = objRoles.GetRole(intRoleId, PortalSettings.PortalId);
                        if (objRole.RoleID != -1)
                        {
                            int intTrialPeriod = 1;
                            if (objRole.TrialPeriod != 0)
                            {
                                intTrialPeriod = objRole.TrialPeriod;
                            }
                            int intBillingPeriod = 1;
                            if (objRole.BillingPeriod != 0)
                            {
                                intBillingPeriod = objRole.BillingPeriod;
                            }
                            // explicitely format numbers using en-US so numbers are correctly built
                            CultureInfo enFormat   = new CultureInfo("en-US");
                            string      strService = string.Format(enFormat.NumberFormat, "{0:#####0.00}", objRole.ServiceFee);
                            string      strTrial   = string.Format(enFormat.NumberFormat, "{0:#####0.00}", objRole.TrialFee);

                            if (objRole.BillingFrequency == "O" || objRole.TrialFrequency == "O")  //one-time payment
                            {
                                // build the payment PayPal URL
                                strPayPalURL += "&redirect_cmd=_xclick&business=" + Globals.HTTPPOSTEncode(strProcessorUserId);
                                strPayPalURL += "&item_name=" + Globals.HTTPPOSTEncode(PortalSettings.PortalName + " - " + objRole.RoleName + " ( " + string.Format("{0:0.00}", objRole.ServiceFee) + " " + PortalSettings.Currency + " )");
                                strPayPalURL += "&item_number=" + Globals.HTTPPOSTEncode(intRoleId.ToString());
                                strPayPalURL += "&no_shipping=1&no_note=1";
                                strPayPalURL += "&quantity=1";
                                strPayPalURL += "&amount=" + Globals.HTTPPOSTEncode(strService);
                                strPayPalURL += "&currency_code=" + Globals.HTTPPOSTEncode(PortalSettings.Currency);
                            }
                            else //recurring payments
                            {
                                // build the subscription PayPal URL
                                strPayPalURL += "&redirect_cmd=_xclick-subscriptions&business=" + Globals.HTTPPOSTEncode(strProcessorUserId);
                                strPayPalURL += "&item_name=" + Globals.HTTPPOSTEncode(PortalSettings.PortalName + " - " + objRole.RoleName + " ( " + string.Format("{0:0.00}", objRole.ServiceFee) + " " + PortalSettings.Currency + " every " + intBillingPeriod.ToString() + " " + GetBillingFrequencyCode(objRole.BillingFrequency) + " )");
                                strPayPalURL += "&item_number=" + Globals.HTTPPOSTEncode(intRoleId.ToString());
                                strPayPalURL += "&no_shipping=1&no_note=1";
                                if (objRole.TrialFrequency != "N")
                                {
                                    strPayPalURL += "&a1=" + Globals.HTTPPOSTEncode(strTrial);
                                    strPayPalURL += "&p1=" + Globals.HTTPPOSTEncode(intTrialPeriod.ToString());
                                    strPayPalURL += "&t1=" + Globals.HTTPPOSTEncode(objRole.TrialFrequency);
                                }
                                strPayPalURL += "&a3=" + Globals.HTTPPOSTEncode(strService);
                                strPayPalURL += "&p3=" + Globals.HTTPPOSTEncode(intBillingPeriod.ToString());
                                strPayPalURL += "&t3=" + Globals.HTTPPOSTEncode(objRole.BillingFrequency);
                                strPayPalURL += "&src=1";
                                strPayPalURL += "&currency_code=" + Globals.HTTPPOSTEncode(PortalSettings.Currency);
                            }
                        }

                        ListController ctlList = new ListController();

                        strPayPalURL += "&custom=" + Globals.HTTPPOSTEncode(intUserID.ToString());
                        strPayPalURL += "&first_name=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.FirstName);
                        strPayPalURL += "&last_name=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.LastName);
                        try
                        {
                            if (objUserInfo.Profile.Country == "United States")
                            {
                                ListEntryInfo colList = ctlList.GetListEntryInfo("Region", objUserInfo.Profile.Region, "Country:US");
                                strPayPalURL += "&address1=" + Globals.HTTPPOSTEncode(Convert.ToString(!String.IsNullOrEmpty(objUserInfo.Profile.Unit) ? objUserInfo.Profile.Unit + " " : "") + objUserInfo.Profile.Street);
                                strPayPalURL += "&city=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.City);
                                strPayPalURL += "&state=" + Globals.HTTPPOSTEncode(colList.Value);
                                strPayPalURL += "&zip=" + Globals.HTTPPOSTEncode(objUserInfo.Profile.PostalCode);
                            }
                        }
                        catch
                        {
                            // issue getting user address
                        }

                        // Return URL
                        if (Convert.ToString(settings["paypalsubscriptionreturn"]) != "")
                        {
                            strPayPalURL += "&return=" + Globals.HTTPPOSTEncode(Convert.ToString(settings["paypalsubscriptionreturn"]));
                        }
                        else
                        {
                            strPayPalURL += "&return=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request)));
                        }

                        // Cancellation URL
                        if (Convert.ToString(settings["paypalsubscriptioncancelreturn"]) != "")
                        {
                            strPayPalURL += "&cancel_return=" + Globals.HTTPPOSTEncode(Convert.ToString(settings["paypalsubscriptioncancelreturn"]));
                        }
                        else
                        {
                            strPayPalURL += "&cancel_return=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request)));
                        }

                        // Instant Payment Notification URL
                        if (Convert.ToString(settings["paypalsubscriptionnotifyurl"]) != "")
                        {
                            strPayPalURL += "&notify_url=" + Globals.HTTPPOSTEncode(Convert.ToString(settings["paypalsubscriptionnotifyurl"]));
                        }
                        else
                        {
                            strPayPalURL += "&notify_url=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request)) + "/admin/Sales/PayPalIPN.aspx");
                        }

                        strPayPalURL += "&sra=1"; // reattempt on failure
                    }

                    // redirect to PayPal
                    Response.Redirect(strPayPalURL, true);
                }
                else
                {
                    // Cancellation URL
                    if (Convert.ToString(settings["paypalsubscriptioncancelreturn"]) != "")
                    {
                        strPayPalURL = Convert.ToString(settings["paypalsubscriptioncancelreturn"]);
                    }
                    else
                    {
                        strPayPalURL = Globals.AddHTTP(Globals.GetDomainName(Request));
                    }

                    // redirect to PayPal
                    Response.Redirect(strPayPalURL, true);
                }
            }
            catch (Exception exc)  //Page failed to load
            {
                Exceptions.ProcessPageLoadException(exc);
            }
        }
Beispiel #16
0
 protected void OnRsvpCodeChanged(object sender, EventArgs e)
 {
     lblRSVPLink.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + @"/" + Globals.glbDefaultPage + @"?rsvp=" + txtRSVPCode.Text + @"&portalid=" + PortalId;
 }
Beispiel #17
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            jQuery.RequestDnnPluginsRegistration();

            cboBillingFrequency.SelectedIndexChanged += OnBillingFrequencyIndexChanged;
            cboTrialFrequency.SelectedIndexChanged   += OnTrialFrequencyIndexChanged;
            cmdDelete.Click         += OnDeleteClick;
            cmdManage.Click         += OnManageClick;
            cmdUpdate.Click         += OnUpdateClick;
            txtRSVPCode.TextChanged += OnRsvpCodeChanged;

            try
            {
                if ((Request.QueryString["RoleID"] != null))
                {
                    _roleID = Int32.Parse(Request.QueryString["RoleID"]);
                }
                var objPortalController = new PortalController();
                var objPortalInfo       = objPortalController.GetPortal(PortalSettings.PortalId);
                if ((objPortalInfo == null || string.IsNullOrEmpty(objPortalInfo.ProcessorUserId)))
                {
                    //Warn users about fee based roles if we have a Processor Id
                    lblProcessorWarning.Visible = true;
                }
                else
                {
                    divServiceFee.Visible    = true;
                    divBillingPeriod.Visible = true;
                    divTrialFee.Visible      = true;
                    divTrialPeriod.Visible   = true;
                }
                if (Page.IsPostBack == false)
                {
                    cmdCancel.NavigateUrl = Globals.NavigateURL();

                    var ctlList        = new ListController();
                    var colFrequencies = ctlList.GetListEntryInfoItems("Frequency", "");

                    cboBillingFrequency.DataSource = colFrequencies;
                    cboBillingFrequency.DataBind();
                    cboBillingFrequency.FindItemByValue("N").Selected = true;

                    cboTrialFrequency.DataSource = colFrequencies;
                    cboTrialFrequency.DataBind();
                    cboTrialFrequency.FindItemByValue("N").Selected = true;

                    securityModeList.Items.Clear();
                    foreach (var enumValue in Enum.GetValues(typeof(SecurityMode)))
                    {
                        var enumName = Enum.GetName(typeof(SecurityMode), enumValue);
                        var enumItem = new ListItem(enumName, ((int)enumValue).ToString(CultureInfo.InvariantCulture));

                        securityModeList.AddItem(enumItem.Text, enumItem.Value);
                    }

                    statusList.Items.Clear();
                    foreach (var enumValue in Enum.GetValues(typeof(RoleStatus)))
                    {
                        var enumName = Enum.GetName(typeof(RoleStatus), enumValue);
                        var enumItem = new ListItem(enumName, ((int)enumValue).ToString(CultureInfo.InvariantCulture));

                        statusList.AddItem(enumItem.Text, enumItem.Value);
                    }

                    BindGroups();

                    ctlIcon.FileFilter = Globals.glbImageFileTypes;
                    if (_roleID != -1)
                    {
                        var role = TestableRoleController.Instance.GetRole(PortalSettings.PortalId, r => r.RoleID == _roleID);
                        if (role != null)
                        {
                            lblRoleName.Visible = role.IsSystemRole;
                            txtRoleName.Visible = !role.IsSystemRole;
                            valRoleName.Enabled = !role.IsSystemRole;

                            lblRoleName.Text = role.RoleName;
                            txtRoleName.Text = role.RoleName;

                            txtDescription.Text = role.Description;
                            if (cboRoleGroups.FindItemByValue(role.RoleGroupID.ToString(CultureInfo.InvariantCulture)) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.FindItemByValue(role.RoleGroupID.ToString(CultureInfo.InvariantCulture)).Selected = true;
                            }
                            if (!String.IsNullOrEmpty(role.BillingFrequency))
                            {
                                if (role.ServiceFee > 0)
                                {
                                    txtServiceFee.Text    = role.ServiceFee.ToString("N2", CultureInfo.CurrentCulture);
                                    txtBillingPeriod.Text = role.BillingPeriod.ToString(CultureInfo.InvariantCulture);
                                    if (cboBillingFrequency.FindItemByValue(role.BillingFrequency) != null)
                                    {
                                        cboBillingFrequency.ClearSelection();
                                        cboBillingFrequency.FindItemByValue(role.BillingFrequency).Selected = true;
                                    }
                                }
                            }
                            if (!String.IsNullOrEmpty(role.TrialFrequency))
                            {
                                if (role.TrialFee > 0)
                                {
                                    txtTrialFee.Text    = role.TrialFee.ToString("N2", CultureInfo.CurrentCulture);
                                    txtTrialPeriod.Text = role.TrialPeriod.ToString(CultureInfo.InvariantCulture);
                                    if (cboTrialFrequency.FindItemByValue(role.TrialFrequency) != null)
                                    {
                                        cboTrialFrequency.ClearSelection();
                                        cboTrialFrequency.FindItemByValue(role.TrialFrequency).Selected = true;
                                    }
                                }
                            }

                            if (securityModeList.FindItemByValue(Convert.ToString((int)role.SecurityMode)) != null)
                            {
                                securityModeList.ClearSelection();
                                securityModeList.FindItemByValue(Convert.ToString((int)role.SecurityMode)).Selected = true;
                            }

                            if (statusList.FindItemByValue(Convert.ToString((int)role.Status)) != null)
                            {
                                statusList.ClearSelection();
                                statusList.FindItemByValue(Convert.ToString((int)role.Status)).Selected = true;
                            }

                            chkIsPublic.Checked       = role.IsPublic;
                            chkAutoAssignment.Checked = role.AutoAssignment;
                            txtRSVPCode.Text          = role.RSVPCode;
                            if (!String.IsNullOrEmpty(txtRSVPCode.Text))
                            {
                                lblRSVPLink.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + "/" + Globals.glbDefaultPage + "?rsvp=" + txtRSVPCode.Text + "&portalid=" + PortalId;
                            }
                            ctlIcon.Url = role.IconFile;

                            UpdateFeeTextBoxes();
                            cmdManage.Visible = role.Status == RoleStatus.Approved;
                        }
                        else //security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(Globals.NavigateURL("Security Roles"));
                        }

                        if (role.IsSystemRole) //disable controls if it's a system role
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("SystemRoleWarning.Text", LocalResourceFile), ModuleMessage.ModuleMessageType.BlueInfo);
                            ActivateControls(false);
                        }

                        if (_roleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdManage.Visible = false;
                        }
                    }
                    else
                    {
                        cmdDelete.Visible   = false;
                        cmdManage.Visible   = false;
                        lblRoleName.Visible = false;
                        txtRoleName.Visible = true;

                        statusList.SelectedIndex = 1;

                        //select default role group id
                        if (Request.QueryString["RoleGroupID"] != null)
                        {
                            var roleGroupID = Request.QueryString["RoleGroupID"];
                            if (cboRoleGroups.FindItemByValue(roleGroupID) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.FindItemByValue(roleGroupID).Selected = true;
                            }
                        }
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [VMasanas]  9/28/2004   Changed redirect to Access Denied
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                // Verify that the current user has access to edit this module
                if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false && PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString()) == false)
                {
                    Response.Redirect(Globals.NavigateURL("Access Denied"), true);
                }

                if ((Request.QueryString["action"] != null))
                {
                    strAction = Request.QueryString["action"].ToLower();
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                if (Page.IsPostBack == false)
                {
                    //Set the tab id of the permissions grid to the TabId (Note If in add mode
                    //this means that the default permissions inherit from the parent)
                    if (strAction == "edit" || strAction == "delete")
                    {
                        dgPermissions.TabID = TabId;
                    }
                    else
                    {
                        dgPermissions.TabID = -1;
                    }

                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    // load the list of files found in the upload directory
                    ctlIcon.ShowFiles = true;
                    ctlIcon.ShowTabs  = false;
                    ctlIcon.ShowUrls  = false;
                    ctlIcon.Required  = false;

                    ctlIcon.ShowLog       = false;
                    ctlIcon.ShowNewWindow = false;
                    ctlIcon.ShowTrack     = false;
                    ctlIcon.FileFilter    = Globals.glbImageFileTypes;
                    ctlIcon.Width         = "275px";

                    // tab administrators can only manage their own tab
                    if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false)
                    {
                        cboTab.Enabled = false;
                    }

                    ctlSkin.Width         = "275px";
                    ctlSkin.SkinRoot      = SkinInfo.RootSkin;
                    ctlContainer.Width    = "275px";
                    ctlContainer.SkinRoot = SkinInfo.RootContainer;

                    ctlURL.Width = "275px";

                    rowCopySkin.Visible = false;
                    rowCopyPerm.Visible = false;

                    switch (strAction)
                    {
                    case "":     // add
                        CheckQuota();
                        InitializeTab();
                        cboCopyPage.SelectedIndex = 0;
                        cmdDelete.Visible         = false;
                        break;

                    case "edit":
                        rowCopySkin.Visible = true;
                        rowCopyPerm.Visible = true;
                        BindData();
                        rowTemplate.Visible = false;
                        dshCopy.Visible     = false;
                        tblCopy.Visible     = false;
                        break;

                    case "copy":
                        CheckQuota();
                        BindData();
                        rowTemplate.Visible = false;
                        if (cboCopyPage.Items.FindByValue(TabId.ToString()) != null)
                        {
                            cboCopyPage.Items.FindByValue(TabId.ToString()).Selected = true;
                            DisplayTabModules();
                        }
                        cmdDelete.Visible = false;
                        break;

                    case "delete":

                        if (DeleteTab(TabId))
                        {
                            Response.Redirect(Globals.AddHTTP(PortalAlias.HTTPAlias), true);
                        }
                        else
                        {
                            strAction = "edit";
                            BindData();
                            rowTemplate.Visible = false;
                            dshCopy.Visible     = false;
                            tblCopy.Visible     = false;
                        }
                        break;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #19
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            jQuery.RequestDnnPluginsRegistration();

            cboBillingFrequency.SelectedIndexChanged += OnBillingFrequencyIndexChanged;
            cboTrialFrequency.SelectedIndexChanged   += OnTrialFrequencyIndexChanged;
            cmdDelete.Click         += OnDeleteClick;
            cmdManage.Click         += OnManageClick;
            cmdUpdate.Click         += OnUpdateClick;
            txtRSVPCode.TextChanged += OnRsvpCodeChanged;

            try
            {
                if ((Request.QueryString["RoleID"] != null))
                {
                    _roleID = Int32.Parse(Request.QueryString["RoleID"]);
                }
                var objPortalController = new PortalController();
                var objPortalInfo       = objPortalController.GetPortal(PortalSettings.PortalId);
                if ((objPortalInfo == null || string.IsNullOrEmpty(objPortalInfo.ProcessorUserId)))
                {
                    //Warn users about fee based roles if we have a Processor Id
                    lblProcessorWarning.Visible = true;
                }
                else
                {
                    divServiceFee.Visible    = true;
                    divBillingPeriod.Visible = true;
                    divTrialFee.Visible      = true;
                    divTrialPeriod.Visible   = true;
                }
                if (Page.IsPostBack == false)
                {
                    cmdCancel.NavigateUrl = Globals.NavigateURL();

                    var objUser = new RoleController();

                    var ctlList        = new ListController();
                    var colFrequencies = ctlList.GetListEntryInfoItems("Frequency", "");

                    cboBillingFrequency.DataSource = colFrequencies;
                    cboBillingFrequency.DataBind();
                    cboBillingFrequency.Items.FindByValue("N").Selected = true;

                    cboTrialFrequency.DataSource = colFrequencies;
                    cboTrialFrequency.DataBind();
                    cboTrialFrequency.Items.FindByValue("N").Selected = true;

                    BindGroups();

                    ctlIcon.FileFilter = Globals.glbImageFileTypes;
                    if (_roleID != -1)
                    {
                        lblRoleName.Visible = true;
                        txtRoleName.Visible = false;
                        valRoleName.Enabled = false;

                        var objRoleInfo = objUser.GetRole(_roleID, PortalSettings.PortalId);
                        if (objRoleInfo != null)
                        {
                            lblRoleName.Text    = objRoleInfo.RoleName;
                            txtDescription.Text = objRoleInfo.Description;
                            if (cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()).Selected = true;
                            }
                            if (objRoleInfo.BillingFrequency != "N")
                            {
                                txtServiceFee.Text    = objRoleInfo.ServiceFee.ToString("N2", CultureInfo.CurrentCulture);
                                txtBillingPeriod.Text = objRoleInfo.BillingPeriod.ToString();
                                if (cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency) != null)
                                {
                                    cboBillingFrequency.ClearSelection();
                                    cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency).Selected = true;
                                }
                            }
                            if (objRoleInfo.TrialFrequency != "N")
                            {
                                txtTrialFee.Text    = objRoleInfo.TrialFee.ToString("N2", CultureInfo.CurrentCulture);
                                txtTrialPeriod.Text = objRoleInfo.TrialPeriod.ToString();
                                if (cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency) != null)
                                {
                                    cboTrialFrequency.ClearSelection();
                                    cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency).Selected = true;
                                }
                            }
                            chkIsPublic.Checked       = objRoleInfo.IsPublic;
                            chkAutoAssignment.Checked = objRoleInfo.AutoAssignment;
                            txtRSVPCode.Text          = objRoleInfo.RSVPCode;
                            if (!String.IsNullOrEmpty(txtRSVPCode.Text))
                            {
                                lblRSVPLink.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + "/" + Globals.glbDefaultPage + "?rsvp=" + txtRSVPCode.Text + "&portalid=" + PortalId;
                            }
                            ctlIcon.Url = objRoleInfo.IconFile;

                            UpdateFeeTextBoxes();
                        }
                        else //security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(Globals.NavigateURL("Security Roles"));
                        }
                        if (_roleID == PortalSettings.AdministratorRoleId || _roleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdDelete.Visible = false;
                            ActivateControls(false);
                        }
                        if (_roleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdManage.Visible = false;
                        }
                    }
                    else
                    {
                        cmdDelete.Visible   = false;
                        cmdManage.Visible   = false;
                        lblRoleName.Visible = false;
                        txtRoleName.Visible = true;

                        //select default role group id
                        if (Request.QueryString["RoleGroupID"] != null)
                        {
                            var roleGroupID = Request.QueryString["RoleGroupID"];
                            if (cboRoleGroups.Items.FindByValue(roleGroupID) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.Items.FindByValue(roleGroupID).Selected = true;
                            }
                        }
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #20
0
        protected void cmdPurchase_Click(object sender, EventArgs e)
        {
            var objEvent = default(EventInfo);

            try
            {
                if (this.Page.IsValid)
                {
                    objEvent = this._objCtlEvent.EventsGet(this._itemID, this.ModuleId);
                    // User wants to purchase event, create Event Signup Record
                    this._objEventSignups = new EventSignupsInfo();

                    //Just in case the user has clicked back and has now clicked Purchase again!!
                    var objEventSignupsChk = default(EventSignupsInfo);
                    if (string.IsNullOrEmpty(this._anonEmail))
                    {
                        objEventSignupsChk =
                            this._objCtlEventSignups.EventsSignupsGetUser(
                                objEvent.EventID, this.UserId, objEvent.ModuleID);
                    }
                    else
                    {
                        objEventSignupsChk =
                            this._objCtlEventSignups.EventsSignupsGetAnonUser(
                                objEvent.EventID, this._anonEmail, objEvent.ModuleID);
                    }
                    if (!ReferenceEquals(objEventSignupsChk, null))
                    {
                        this._objEventSignups.SignupID = objEventSignupsChk.SignupID;
                    }
                    this._objEventSignups.EventID  = objEvent.EventID;
                    this._objEventSignups.ModuleID = objEvent.ModuleID;
                    if (string.IsNullOrEmpty(this._anonEmail))
                    {
                        this._objEventSignups.UserID         = this.UserId;
                        this._objEventSignups.AnonEmail      = null;
                        this._objEventSignups.AnonName       = null;
                        this._objEventSignups.AnonTelephone  = null;
                        this._objEventSignups.AnonCulture    = null;
                        this._objEventSignups.AnonTimeZoneId = null;
                    }
                    else
                    {
                        var objSecurity = new PortalSecurity();
                        this._objEventSignups.UserID    = -1;
                        this._objEventSignups.AnonEmail =
                            objSecurity.InputFilter(this._anonEmail, PortalSecurity.FilterFlag.NoScripting);
                        this._objEventSignups.AnonName =
                            objSecurity.InputFilter(this._anonName, PortalSecurity.FilterFlag.NoScripting);
                        this._objEventSignups.AnonTelephone =
                            objSecurity.InputFilter(this._anonTelephone, PortalSecurity.FilterFlag.NoScripting);
                        this._objEventSignups.AnonCulture    = Thread.CurrentThread.CurrentCulture.Name;
                        this._objEventSignups.AnonTimeZoneId = this.GetDisplayTimeZoneId();
                    }
                    this._objEventSignups.PayPalStatus      = "none";
                    this._objEventSignups.PayPalReason      = "PayPal call initiated...";
                    this._objEventSignups.PayPalPaymentDate = DateTime.UtcNow;
                    this._objEventSignups.Approved          = false;
                    this._objEventSignups.NoEnrolees        = int.Parse(this.lblNoEnrolees.Text);

                    this._objEventSignups = this.CreateEnrollment(this._objEventSignups, objEvent);

                    if (!ReferenceEquals(objEventSignupsChk, null))
                    {
                        this._objEventSignups =
                            this._objCtlEventSignups.EventsSignupsGet(objEventSignupsChk.SignupID,
                                                                      objEventSignupsChk.ModuleID, false);
                    }

                    // Mail users
                    if (this.Settings.SendEnrollMessagePaying)
                    {
                        var objEventEmailInfo = new EventEmailInfo();
                        var objEventEmail     = new EventEmails(this.PortalId, this.ModuleId, this.LocalResourceFile,
                                                                ((PageBase)this.Page).PageCulture.Name);
                        objEventEmailInfo.TxtEmailSubject = this.Settings.Templates.txtEnrollMessageSubject;
                        objEventEmailInfo.TxtEmailBody    = this.Settings.Templates.txtEnrollMessagePaying;
                        objEventEmailInfo.TxtEmailFrom    = this.Settings.StandardEmail;
                        if (string.IsNullOrEmpty(this._anonEmail))
                        {
                            objEventEmailInfo.UserEmails.Add(this.PortalSettings.UserInfo.Email);
                            objEventEmailInfo.UserLocales.Add(this.PortalSettings.UserInfo.Profile.PreferredLocale);
                            objEventEmailInfo.UserTimeZoneIds.Add(this.PortalSettings.UserInfo.Profile.PreferredTimeZone
                                                                  .Id);
                        }
                        else
                        {
                            objEventEmailInfo.UserEmails.Add(this._objEventSignups.AnonEmail);
                            objEventEmailInfo.UserLocales.Add(this._objEventSignups.AnonCulture);
                            objEventEmailInfo.UserTimeZoneIds.Add(this._objEventSignups.AnonTimeZoneId);
                        }
                        objEventEmailInfo.UserIDs.Add(objEvent.OwnerID);
                        objEventEmail.SendEmails(objEventEmailInfo, objEvent, this._objEventSignups);
                    }

                    // build PayPal URL
                    var ppurl = this.Settings.Paypalurl + "/cgi-bin/webscr?cmd=_xclick&business=";

                    var socialGroupId = this.GetUrlGroupId();

                    var objEventInfoHelper =
                        new EventInfoHelper(this.ModuleId, this.TabId, this.PortalId, this.Settings);
                    var returnURL = "";
                    if (socialGroupId > 0)
                    {
                        returnURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=enrolled", "groupid=" + socialGroupId), "?");
                    }
                    else
                    {
                        returnURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=enrolled"), "?");
                    }
                    if (returnURL.IndexOf("://") + 1 == 0)
                    {
                        returnURL = Globals.AddHTTP(Globals.GetDomainName(this.Request)) + returnURL;
                    }
                    var cancelURL = "";
                    if (socialGroupId > 0)
                    {
                        cancelURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=cancelled", "groupid=" + socialGroupId), "?");
                    }
                    else
                    {
                        cancelURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=cancelled"), "?");
                    }
                    if (cancelURL.IndexOf("://") + 1 == 0)
                    {
                        cancelURL = Globals.AddHTTP(Globals.GetDomainName(this.Request)) + cancelURL;
                    }
                    var strPayPalURL = "";
                    strPayPalURL = ppurl + Globals.HTTPPOSTEncode(objEvent.PayPalAccount);
                    strPayPalURL = strPayPalURL + "&item_name=" +
                                   Globals.HTTPPOSTEncode(objEvent.ModuleTitle + " - " + this.lblEventName.Text +
                                                          " ( " + this.lblFee.Text + " " + this.lblFeeCurrency.Text +
                                                          " )");
                    strPayPalURL = strPayPalURL + "&item_number=" +
                                   Globals.HTTPPOSTEncode(Convert.ToString(this._objEventSignups.SignupID));
                    strPayPalURL = strPayPalURL + "&quantity=" +
                                   Globals.HTTPPOSTEncode(Convert.ToString(this._objEventSignups.NoEnrolees));
                    strPayPalURL = strPayPalURL + "&custom=" +
                                   Globals.HTTPPOSTEncode(
                        Convert.ToDateTime(this.lblStartDate.Text).ToShortDateString());

                    // Make sure currency is in correct format
                    var dblFee    = double.Parse(this.lblFee.Text);
                    var uiculture = Thread.CurrentThread.CurrentCulture;
                    Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                    strPayPalURL = strPayPalURL + "&amount=" +
                                   Globals.HTTPPOSTEncode(Strings.Format(dblFee, "#,##0.00"));
                    Thread.CurrentThread.CurrentCulture = uiculture;

                    strPayPalURL = strPayPalURL + "&currency_code=" +
                                   Globals.HTTPPOSTEncode(this.lblTotalCurrency.Text);
                    strPayPalURL = strPayPalURL + "&return=" + returnURL;
                    strPayPalURL = strPayPalURL + "&cancel_return=" + cancelURL;
                    strPayPalURL = strPayPalURL + "&notify_url=" +
                                   Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(this.Request)) +
                                                          "/DesktopModules/Events/EventIPN.aspx");
                    strPayPalURL = strPayPalURL + "&undefined_quantity=&no_note=1&no_shipping=1";
                    //strPayPalURL = strPayPalURL & "&undefined_quantity=&no_note=1&no_shipping=1&rm=2"

                    // redirect to PayPal
                    this.Response.Redirect(strPayPalURL, true);
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #21
0
        /// <summary>
        /// The Page_Load server event handler on this page is used to populate the role information for the page
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                if (!Page.IsPostBack)
                {
                    if (!String.IsNullOrEmpty(_URL))
                    {
                        lblLogURL.Text = URL; // saved for loading Log grid

                        TabType URLType = Globals.GetURLType(_URL);
                        if (URLType == TabType.File && _URL.ToLower().StartsWith("fileid=") == false)
                        {
                            // to handle legacy scenarios before the introduction of the FileServerHandler
                            FileController objFiles = new FileController();
                            lblLogURL.Text = "FileID=" + objFiles.ConvertFilePathToFileId(_URL, PortalSettings.PortalId);
                        }

                        UrlController   objUrls        = new UrlController();
                        UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(PortalSettings.PortalId, lblLogURL.Text, ModuleID);
                        if (objUrlTracking != null)
                        {
                            if (_FormattedURL == "")
                            {
                                if (!URL.StartsWith("http") && !URL.StartsWith("mailto"))
                                {
                                    lblURL.Text = Globals.AddHTTP(Request.Url.Host);
                                }
                                lblURL.Text += Globals.LinkClick(URL, PortalSettings.ActiveTab.TabID, ModuleID, false);
                            }
                            else
                            {
                                lblURL.Text = _FormattedURL;
                            }
                            lblCreatedDate.Text = objUrlTracking.CreatedDate.ToString();

                            if (objUrlTracking.TrackClicks)
                            {
                                pnlTrack.Visible = true;
                                if (_TrackingURL == "")
                                {
                                    if (!URL.StartsWith("http"))
                                    {
                                        lblTrackingURL.Text = Globals.AddHTTP(Request.Url.Host);
                                    }
                                    lblTrackingURL.Text += Globals.LinkClick(URL, PortalSettings.ActiveTab.TabID, ModuleID, objUrlTracking.TrackClicks);
                                }
                                else
                                {
                                    lblTrackingURL.Text = _TrackingURL;
                                }
                                lblClicks.Text = objUrlTracking.Clicks.ToString();
                                if (!Null.IsNull(objUrlTracking.LastClick))
                                {
                                    lblLastClick.Text = objUrlTracking.LastClick.ToString();
                                }
                            }

                            if (objUrlTracking.LogActivity)
                            {
                                pnlLog.Visible = true;

                                txtStartDate.Text = DateAndTime.DateAdd(DateInterval.Day, -6, DateTime.Today).ToShortDateString();
                                txtEndDate.Text   = DateAndTime.DateAdd(DateInterval.Day, 1, DateTime.Today).ToShortDateString();
                            }
                        }
                    }
                    else
                    {
                        this.Visible = false;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #22
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmdLogin.Click += OnLoginClick;

            cmdCancel.Click += OnCancelClick;

            ClientAPI.RegisterKeyCapture(Parent, cmdLogin, 13);

            if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration)
            {
                liRegister.Visible = false;
            }
            lblLogin.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_LOGIN_INSTRUCTIONS");

            if (!string.IsNullOrEmpty(Response.Cookies["USERNAME_CHANGED"].Value))
            {
                txtUsername.Text = Response.Cookies["USERNAME_CHANGED"].Value;
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetSystemMessage(PortalSettings, "MESSAGE_USERNAME_CHANGED_INSTRUCTIONS"), ModuleMessage.ModuleMessageType.BlueInfo);
            }

            var    returnUrl = Globals.NavigateURL();
            string url;

            if (PortalSettings.UserRegistration != (int)Globals.PortalRegistrationType.NoRegistration)
            {
                if (!string.IsNullOrEmpty(UrlUtils.ValidReturnUrl(Request.QueryString["returnurl"])))
                {
                    returnUrl = Request.QueryString["returnurl"];
                }
                returnUrl = HttpUtility.UrlEncode(returnUrl);

                url = Globals.RegisterURL(returnUrl, Null.NullString);
                registerLink.NavigateUrl = url;
                if (PortalSettings.EnablePopUps && PortalSettings.RegisterTabId == Null.NullInteger &&
                    !HasSocialAuthenticationEnabled())
                {
                    registerLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 600, 950));
                }
            }
            else
            {
                registerLink.Visible = false;
            }

            //see if the portal supports persistant cookies
            chkCookie.Visible = Host.RememberCheckbox;



            // no need to show password link if feature is disabled, let's check this first
            if (MembershipProviderConfig.PasswordRetrievalEnabled || MembershipProviderConfig.PasswordResetEnabled)
            {
                url = Globals.NavigateURL("SendPassword", "returnurl=" + returnUrl);
                passwordLink.NavigateUrl = url;
                if (PortalSettings.EnablePopUps)
                {
                    passwordLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 300, 650));
                }
            }
            else
            {
                passwordLink.Visible = false;
            }


            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["verificationcode"]) && PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration)
                {
                    if (Request.IsAuthenticated)
                    {
                        Controls.Clear();
                    }

                    var verificationCode = Request.QueryString["verificationcode"];


                    try
                    {
                        UserController.VerifyUser(verificationCode.Replace(".", "+").Replace("-", "/").Replace("_", "="));

                        var redirectTabId = PortalSettings.Registration.RedirectAfterRegistration;

                        if (Request.IsAuthenticated)
                        {
                            Response.Redirect(Globals.NavigateURL(redirectTabId > 0 ? redirectTabId : PortalSettings.HomeTabId, string.Empty, "VerificationSuccess=true"), true);
                        }
                        else
                        {
                            if (redirectTabId > 0)
                            {
                                var redirectUrl = Globals.NavigateURL(redirectTabId, string.Empty, "VerificationSuccess=true");
                                redirectUrl = redirectUrl.Replace(Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias), string.Empty);
                                Response.Cookies.Add(new HttpCookie("returnurl", redirectUrl)
                                {
                                    Path = (!string.IsNullOrEmpty(Globals.ApplicationPath) ? Globals.ApplicationPath : "/")
                                });
                            }

                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("VerificationSuccess", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
                        }
                    }
                    catch (UserAlreadyVerifiedException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserAlreadyVerified", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    }
                    catch (InvalidVerificationCodeException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    catch (UserDoesNotExistException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserDoesNotExist", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    catch (Exception)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                }
            }

            if (!Request.IsAuthenticated)
            {
                if (!Page.IsPostBack)
                {
                    try
                    {
                        if (Request.QueryString["username"] != null)
                        {
                            txtUsername.Text = Request.QueryString["username"];
                        }
                    }
                    catch (Exception ex)
                    {
                        //control not there
                        Logger.Error(ex);
                    }
                }
                try
                {
                    Globals.SetFormFocus(string.IsNullOrEmpty(txtUsername.Text) ? txtUsername : txtPassword);
                }
                catch (Exception ex)
                {
                    //Not sure why this Try/Catch may be necessary, logic was there in old setFormFocus location stating the following
                    //control not there or error setting focus
                    Logger.Error(ex);
                }
            }

            var  registrationType = PortalSettings.Registration.RegistrationFormType;
            bool useEmailAsUserName;

            if (registrationType == 0)
            {
                useEmailAsUserName = PortalSettings.Registration.UseEmailAsUserName;
            }
            else
            {
                var registrationFields = PortalSettings.Registration.RegistrationFields;
                useEmailAsUserName = !registrationFields.Contains("Username");
            }

            plUsername.Text     = LocalizeString(useEmailAsUserName ? "Email" : "Username");
            divCaptcha1.Visible = UseCaptcha;
            divCaptcha2.Visible = UseCaptcha;
        }
Beispiel #23
0
        /// <summary>
        /// cmdUpdate_Click runs when the Update button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	5/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdUpdate_Click(Object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    bool   blnChild;
                    string strMessage = String.Empty;
                    string strPortalAlias;
                    int    intCounter;
                    string strServerPath;

                    string strChildPath = String.Empty;

                    PortalController objPortalController = new PortalController();
                    PortalSecurity   objSecurity         = new PortalSecurity();

                    // check template validity
                    ArrayList messages           = new ArrayList();
                    string    schemaFilename     = Server.MapPath("admin/Portal/portal.template.xsd");
                    string    xmlFilename        = Globals.HostMapPath + cboTemplate.SelectedItem.Text + ".template";
                    PortalTemplateValidator xval = new PortalTemplateValidator();
                    if (!xval.Validate(xmlFilename, schemaFilename))
                    {
                        strMessage      = Localization.GetString("InvalidTemplate", this.LocalResourceFile);
                        lblMessage.Text = string.Format(strMessage, cboTemplate.SelectedItem.Text + ".template");
                        messages.AddRange(xval.Errors);
                        lstResults.Visible    = true;
                        lstResults.DataSource = messages;
                        lstResults.DataBind();
                        return;
                    }

                    //Set Portal Name
                    txtPortalName.Text = txtPortalName.Text.ToLower();
                    txtPortalName.Text = txtPortalName.Text.Replace("http://", "");

                    //Validate Portal Name
                    if (PortalSettings.ActiveTab.ParentId != PortalSettings.SuperTabId)
                    {
                        blnChild = true;

                        // child portal
                        for (intCounter = 1; intCounter <= txtPortalName.Text.Length; intCounter++)
                        {
                            if ("abcdefghijklmnopqrstuvwxyz0123456789-".IndexOf(txtPortalName.Text.Substring(intCounter, 1)) == 0)
                            {
                                strMessage += "<br>" + Localization.GetString("InvalidName", this.LocalResourceFile);
                            }
                        }

                        strPortalAlias = txtPortalName.Text;
                    }
                    else
                    {
                        blnChild = optType.SelectedValue == "C";

                        if (blnChild)
                        {
                            strPortalAlias = txtPortalName.Text.Substring(txtPortalName.Text.LastIndexOf("/") + 1);
                        }
                        else
                        {
                            strPortalAlias = txtPortalName.Text;
                        }

                        string strValidChars = "abcdefghijklmnopqrstuvwxyz0123456789-";
                        if (!blnChild)
                        {
                            strValidChars += "./:";
                        }

                        for (intCounter = 1; intCounter <= strPortalAlias.Length; intCounter++)
                        {
                            if (strValidChars.IndexOf(strPortalAlias.Substring(intCounter - 1, 1)) == 0)
                            {
                                strMessage += "<br>" + Localization.GetString("InvalidName", this.LocalResourceFile);
                            }
                        }
                    }

                    //Validate Password
                    if (txtPassword.Text != txtConfirm.Text)
                    {
                        strMessage += "<br>" + Localization.GetString("InvalidPassword", this.LocalResourceFile);
                    }

                    strServerPath = Globals.GetAbsoluteServerPath(Request);

                    //Set Portal Alias for Child Portals
                    if (strMessage == "")
                    {
                        if (blnChild)
                        {
                            strChildPath = strServerPath + strPortalAlias;

                            if (Directory.Exists(strChildPath))
                            {
                                strMessage = Localization.GetString("ChildExists", this.LocalResourceFile);
                            }
                            else
                            {
                                if (PortalSettings.ActiveTab.ParentId != PortalSettings.SuperTabId)
                                {
                                    strPortalAlias = Globals.GetDomainName(Request) + "/" + strPortalAlias;
                                }
                                else
                                {
                                    strPortalAlias = txtPortalName.Text;
                                }
                            }
                        }
                    }

                    //Get Home Directory
                    string HomeDir;
                    if (txtHomeDirectory.Text != "Portals/[PortalID]")
                    {
                        HomeDir = txtHomeDirectory.Text;
                    }
                    else
                    {
                        HomeDir = "";
                    }

                    //Create Portal
                    if (strMessage == "")
                    {
                        string strTemplateFile = cboTemplate.SelectedItem.Text + ".template";

                        //Attempt to create the portal
                        int intPortalId;
                        try
                        {
                            intPortalId = objPortalController.CreatePortal(txtTitle.Text, txtFirstName.Text, txtLastName.Text, txtUsername.Text, objSecurity.Encrypt(Convert.ToString(Globals.HostSettings["EncryptionKey"]), txtPassword.Text), txtEmail.Text, txtDescription.Text, txtKeyWords.Text, Globals.HostMapPath, strTemplateFile, HomeDir, strPortalAlias, strServerPath, strChildPath, blnChild);
                        }
                        catch (Exception ex)
                        {
                            intPortalId = Null.NullInteger;
                            strMessage  = ex.Message;
                        }

                        if (intPortalId != -1)
                        {
                            // notification
                            UserInfo objUser = UserController.GetUserByName(intPortalId, txtUsername.Text, false);

                            //Create a Portal Settings object for the new Portal
                            PortalSettings newSettings = new PortalSettings();
                            newSettings.PortalAlias           = new PortalAliasInfo();
                            newSettings.PortalAlias.HTTPAlias = strPortalAlias;
                            newSettings.PortalId = intPortalId;
                            string webUrl = Globals.AddHTTP(strPortalAlias);

                            try
                            {
                                if (PortalSettings.ActiveTab.ParentId != PortalSettings.SuperTabId)
                                {
                                    Mail.SendMail(PortalSettings.Email, txtEmail.Text, PortalSettings.Email + ";" + Convert.ToString(PortalSettings.HostSettings["HostEmail"]), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", objUser), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", objUser), "", "", "", "", "", "");
                                }
                                else
                                {
                                    Mail.SendMail(Convert.ToString(PortalSettings.HostSettings["HostEmail"]), txtEmail.Text, Convert.ToString(PortalSettings.HostSettings["HostEmail"]), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", objUser), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", objUser), "", "", "", "", "", "");
                                }
                            }
                            catch (Exception)
                            {
                                strMessage = string.Format(Localization.GetString("SendMail.Error", this.LocalResourceFile), webUrl, null);
                            }

                            EventLogController objEventLog = new EventLogController();
                            objEventLog.AddLog(objPortalController.GetPortal(intPortalId), PortalSettings, UserId, "", EventLogController.EventLogType.PORTAL_CREATED);

                            // Redirect to this new site
                            if (strMessage == Null.NullString)
                            {
                                Response.Redirect(webUrl, true);
                            }
                        }
                    }

                    lblMessage.Text = "<br>" + strMessage + "<br><br>";
                }
                catch (Exception exc)  //Module failed to load
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }
            }
        }
Beispiel #24
0
        private void Page_Load(object sender, EventArgs e)
        {
            var iDaysBefore   = 0;
            var iDaysAfter    = 0;
            var iMax          = 0;
            var iOwnerID      = 0;
            var iLocationID   = 0;
            var iImportance   = 0;
            var categoryIDs   = new ArrayList();
            var locationIDs   = new ArrayList();
            var iGroupId      = -1;
            var iUserId       = -1;
            var iCategoryName = "";
            var iLocationName = "";
            var iOwnerName    = "";
            var txtPriority   = "";

            if (!(HttpContext.Current.Request.QueryString["Mid"] == ""))
            {
                this._moduleID = Convert.ToInt32(HttpContext.Current.Request.QueryString["mid"]);
            }
            else
            {
                this.Response.Redirect(Globals.NavigateURL(), true);
            }
            if (!(HttpContext.Current.Request.QueryString["tabid"] == ""))
            {
                this._tabID = Convert.ToInt32(HttpContext.Current.Request.QueryString["tabid"]);
            }
            else
            {
                this.Response.Redirect(Globals.NavigateURL(), true);
            }

            var localResourceFile = this.TemplateSourceDirectory + "/" + Localization.LocalResourceDirectory +
                                    "/EventRSS.aspx.resx";

            if (!(HttpContext.Current.Request.QueryString["CategoryName"] == ""))
            {
                iCategoryName = HttpContext.Current.Request.QueryString["CategoryName"];
                var objSecurity = new PortalSecurity();
                iCategoryName = objSecurity.InputFilter(iCategoryName, PortalSecurity.FilterFlag.NoSQL);
            }
            if (!(HttpContext.Current.Request.QueryString["CategoryID"] == ""))
            {
                categoryIDs.Add(Convert.ToInt32(HttpContext.Current.Request.QueryString["CategoryID"]));
            }
            if (!(HttpContext.Current.Request.QueryString["LocationName"] == ""))
            {
                iLocationName = HttpContext.Current.Request.QueryString["LocationName"];
                var objSecurity = new PortalSecurity();
                iLocationName = objSecurity.InputFilter(iLocationName, PortalSecurity.FilterFlag.NoSQL);
            }
            if (!(HttpContext.Current.Request.QueryString["LocationID"] == ""))
            {
                locationIDs.Add(Convert.ToInt32(HttpContext.Current.Request.QueryString["LocationID"]));
            }
            if (!(HttpContext.Current.Request.QueryString["groupid"] == ""))
            {
                iGroupId = Convert.ToInt32(HttpContext.Current.Request.QueryString["groupid"]);
            }
            if (!(HttpContext.Current.Request.QueryString["DaysBefore"] == ""))
            {
                iDaysBefore = Convert.ToInt32(HttpContext.Current.Request.QueryString["DaysBefore"]);
            }
            if (!(HttpContext.Current.Request.QueryString["DaysAfter"] == ""))
            {
                iDaysAfter = Convert.ToInt32(HttpContext.Current.Request.QueryString["DaysAfter"]);
            }
            if (!(HttpContext.Current.Request.QueryString["MaxNumber"] == ""))
            {
                iMax = Convert.ToInt32(HttpContext.Current.Request.QueryString["MaxNumber"]);
            }
            if (!(HttpContext.Current.Request.QueryString["OwnerName"] == ""))
            {
                iOwnerName = HttpContext.Current.Request.QueryString["OwnerName"];
            }
            if (!(HttpContext.Current.Request.QueryString["OwnerID"] == ""))
            {
                iOwnerID = Convert.ToInt32(HttpContext.Current.Request.QueryString["OwnerID"]);
            }
            if (!(HttpContext.Current.Request.QueryString["LocationName"] == ""))
            {
                iLocationName = HttpContext.Current.Request.QueryString["LocationName"];
            }
            if (!(HttpContext.Current.Request.QueryString["LocationID"] == ""))
            {
                iLocationID = Convert.ToInt32(HttpContext.Current.Request.QueryString["LocationID"]);
            }
            if (!(HttpContext.Current.Request.QueryString["Priority"] == ""))
            {
                var iPriority = "";
                iPriority = HttpContext.Current.Request.QueryString["Priority"];
                var lHigh   = "";
                var lMedium = "";
                var lLow    = "";
                lHigh   = Localization.GetString("High", localResourceFile);
                lMedium = Localization.GetString("Normal", localResourceFile);
                lLow    = Localization.GetString("Low", localResourceFile);

                txtPriority = "Medium";
                if (iPriority == lHigh)
                {
                    txtPriority = "High";
                }
                else if (iPriority == lMedium)
                {
                    txtPriority = "Medium";
                }
                else if (iPriority == lLow)
                {
                    txtPriority = "Low";
                }
                else if (iPriority == "High")
                {
                    txtPriority = "High";
                }
                else if (iPriority == "Normal")
                {
                    txtPriority = "Medium";
                }
                else if (iPriority == "Low")
                {
                    txtPriority = "Low";
                }
            }
            if (!(HttpContext.Current.Request.QueryString["Importance"] == ""))
            {
                iImportance = Convert.ToInt32(HttpContext.Current.Request.QueryString["Importance"]);
            }

            var portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

            this._portalID = portalSettings.PortalId;
            this._userinfo = (UserInfo)HttpContext.Current.Items["UserInfo"];
            if (portalSettings.DefaultLanguage != "")
            {
                var userculture = new CultureInfo(portalSettings.DefaultLanguage, false);
                Thread.CurrentThread.CurrentCulture = userculture;
            }
            if (this._userinfo.UserID > 0)
            {
                if (this._userinfo.Profile.PreferredLocale != "")
                {
                    var userculture = new CultureInfo(this._userinfo.Profile.PreferredLocale, false);
                    Thread.CurrentThread.CurrentCulture = userculture;
                }
            }

            this._settings = EventModuleSettings.GetEventModuleSettings(this._moduleID, localResourceFile);

            if (this._settings.Enablecategories == EventModuleSettings.DisplayCategories.DoNotDisplay)
            {
                categoryIDs   = this._settings.ModuleCategoryIDs;
                iCategoryName = "";
            }
            if (!string.IsNullOrEmpty(iCategoryName))
            {
                var oCntrlEventCategory = new EventCategoryController();
                var oEventCategory      = oCntrlEventCategory.EventCategoryGetByName(iCategoryName, this._portalID);
                if (!ReferenceEquals(oEventCategory, null))
                {
                    categoryIDs.Add(oEventCategory.Category);
                }
            }
            if (this._settings.Enablelocations == EventModuleSettings.DisplayLocations.DoNotDisplay)
            {
                locationIDs   = this._settings.ModuleLocationIDs;
                iLocationName = "";
            }
            if (!string.IsNullOrEmpty(iLocationName))
            {
                var oCntrlEventLocation = new EventLocationController();
                var oEventLocation      = oCntrlEventLocation.EventsLocationGetByName(iLocationName, this._portalID);
                if (!ReferenceEquals(oEventLocation, null))
                {
                    locationIDs.Add(oEventLocation.Location);
                }
            }

            if (!this._settings.RSSEnable)
            {
                this.Response.Redirect(Globals.NavigateURL(), true);
            }

            if (this._settings.SocialGroupModule == EventModuleSettings.SocialModule.UserProfile)
            {
                iUserId = this._userinfo.UserID;
            }
            var getSubEvents = this._settings.MasterEvent;

            var dtEndDate = default(DateTime);

            if (HttpContext.Current.Request.QueryString["DaysAfter"] == "" &&
                HttpContext.Current.Request.QueryString["DaysBefore"] == "")
            {
                iDaysAfter = this._settings.RSSDays;
            }
            var objEventTimeZoneUtilities = new EventTimeZoneUtilities();
            var currDate =
                objEventTimeZoneUtilities.ConvertFromUTCToModuleTimeZone(DateTime.UtcNow, this._settings.TimeZoneId);

            dtEndDate = DateAndTime.DateAdd(DateInterval.Day, iDaysAfter, currDate).Date;

            var dtStartDate = default(DateTime);

            dtStartDate = DateAndTime.DateAdd(DateInterval.Day, Convert.ToDouble(-iDaysBefore), currDate).Date;

            var txtFeedRootTitle       = "";
            var txtFeedRootDescription = "";
            var txtRSSDateField        = "";

            txtFeedRootTitle       = this._settings.RSSTitle;
            txtFeedRootDescription = this._settings.RSSDesc;
            txtRSSDateField        = this._settings.RSSDateField;

            this.Response.ContentType     = "text/xml";
            this.Response.ContentEncoding = Encoding.UTF8;


            using (var sw = new StringWriter())
            {
                using (var writer = new XmlTextWriter(sw))
                {
                    //                Dim writer As XmlTextWriter = New XmlTextWriter(sw)
                    writer.Formatting  = Formatting.Indented;
                    writer.Indentation = 4;

                    writer.WriteStartElement("rss");
                    writer.WriteAttributeString("version", "2.0");
                    writer.WriteAttributeString("xmlns:wfw", "http://wellformedweb.org/CommentAPI/");
                    writer.WriteAttributeString("xmlns:slash", "http://purl.org/rss/1.0/modules/slash/");
                    writer.WriteAttributeString("xmlns:dc", "http://purl.org/dc/elements/1.1/");
                    writer.WriteAttributeString("xmlns:trackback",
                                                "http://madskills.com/public/xml/rss/module/trackback/");
                    writer.WriteAttributeString("xmlns:atom", "http://www.w3.org/2005/Atom");
                    writer.WriteAttributeString("xmlns", NsPre, null, NsFull);

                    writer.WriteStartElement("channel");

                    writer.WriteStartElement("atom:link");
                    writer.WriteAttributeString("href", HttpContext.Current.Request.Url.AbsoluteUri);
                    writer.WriteAttributeString("rel", "self");
                    writer.WriteAttributeString("type", "application/rss+xml");
                    writer.WriteEndElement();

                    writer.WriteElementString("title", portalSettings.PortalName + " - " + txtFeedRootTitle);

                    if (portalSettings.PortalAlias.HTTPAlias.IndexOf("http://", StringComparison.Ordinal) == -1 &&
                        portalSettings.PortalAlias.HTTPAlias.IndexOf("https://", StringComparison.Ordinal) == -1)
                    {
                        writer.WriteElementString("link", Globals.AddHTTP(portalSettings.PortalAlias.HTTPAlias));
                    }
                    else
                    {
                        writer.WriteElementString("link", portalSettings.PortalAlias.HTTPAlias);
                    }

                    writer.WriteElementString("description", txtFeedRootDescription);
                    writer.WriteElementString("ttl", "60");

                    var objEventInfoHelper =
                        new EventInfoHelper(this._moduleID, this._tabID, this._portalID, this._settings);
                    var lstEvents      = default(ArrayList);
                    var tcc            = new TokenReplaceControllerClass(this._moduleID, localResourceFile);
                    var tmpTitle       = this._settings.Templates.txtRSSTitle;
                    var tmpDescription = this._settings.Templates.txtRSSDescription;
                    if (categoryIDs.Count == 0)
                    {
                        categoryIDs.Add("-1");
                    }
                    if (locationIDs.Count == 0)
                    {
                        locationIDs.Add("-1");
                    }

                    lstEvents = objEventInfoHelper.GetEvents(dtStartDate, dtEndDate, getSubEvents, categoryIDs,
                                                             locationIDs, iGroupId, iUserId);

                    var objEventBase      = new EventBase();
                    var displayTimeZoneId = objEventBase.GetDisplayTimeZoneId(this._settings, this._portalID);

                    var rssCount = 0;
                    foreach (EventInfo eventInfo in lstEvents)
                    {
                        var objEvent = eventInfo;

                        if ((Convert.ToInt32(categoryIDs[0]) == 0) &
                            (objEvent.Category != Convert.ToInt32(categoryIDs[0])))
                        {
                            continue;
                        }
                        if ((Convert.ToInt32(locationIDs[0]) == 0) &
                            (objEvent.Location != Convert.ToInt32(locationIDs[0])))
                        {
                            continue;
                        }
                        if ((iOwnerID > 0) & (objEvent.OwnerID != iOwnerID))
                        {
                            continue;
                        }
                        if (!string.IsNullOrEmpty(iOwnerName) && objEvent.OwnerName != iOwnerName)
                        {
                            continue;
                        }
                        if ((iLocationID > 0) & (objEvent.Location != iLocationID))
                        {
                            continue;
                        }
                        if (!string.IsNullOrEmpty(iLocationName) && objEvent.LocationName != iLocationName)
                        {
                            continue;
                        }
                        if (iImportance > 0 && (int)objEvent.Importance != iImportance)
                        {
                            continue;
                        }
                        if (!string.IsNullOrEmpty(txtPriority) && objEvent.Importance.ToString() != txtPriority)
                        {
                            continue;
                        }

                        // If full enrollments should be hidden, ignore
                        if (this.HideFullEvent(objEvent))
                        {
                            continue;
                        }

                        var pubDate       = default(DateTime);
                        var pubTimeZoneId = "";
                        switch (txtRSSDateField)
                        {
                        case "UPDATEDDATE":
                            pubDate       = objEvent.LastUpdatedAt;
                            pubTimeZoneId = objEvent.OtherTimeZoneId;
                            break;

                        case "CREATIONDATE":
                            pubDate       = objEvent.CreatedDate;
                            pubTimeZoneId = objEvent.OtherTimeZoneId;
                            break;

                        case "EVENTDATE":
                            pubDate       = objEvent.EventTimeBegin;
                            pubTimeZoneId = objEvent.EventTimeZoneId;
                            break;
                        }

                        objEvent = objEventInfoHelper.ConvertEventToDisplayTimeZone(objEvent, displayTimeZoneId);

                        writer.WriteStartElement("item");
                        var eventTitle = tcc.TokenReplaceEvent(objEvent, tmpTitle);
                        writer.WriteElementString("title", eventTitle);

                        var eventDescription = tcc.TokenReplaceEvent(objEvent, tmpDescription);
                        var txtDescription   = HttpUtility.HtmlDecode(eventDescription);
                        writer.WriteElementString("description", txtDescription);

                        var txtURL = objEventInfoHelper.DetailPageURL(objEvent);
                        writer.WriteElementString("link", txtURL);
                        writer.WriteElementString("guid", txtURL);

                        writer.WriteElementString("pubDate", GetRFC822Date(pubDate, pubTimeZoneId));

                        writer.WriteElementString("dc:creator", objEvent.OwnerName);

                        if (objEvent.Category > 0)
                        {
                            writer.WriteElementString("category", objEvent.CategoryName);
                        }
                        if (objEvent.Location > 0)
                        {
                            writer.WriteElementString("category", objEvent.LocationName);
                        }
                        if ((int)objEvent.Importance != 2)
                        {
                            var strImportance = Localization.GetString(objEvent.Importance + "Prio", localResourceFile);
                            writer.WriteElementString("category", strImportance);
                        }

                        // specific event data
                        writer.WriteElementString(NsPre, "AllDayEvent", null, objEvent.AllDayEvent.ToString());
                        writer.WriteElementString(NsPre, "Approved", null, objEvent.Approved.ToString());
                        writer.WriteElementString(NsPre, "Cancelled", null, objEvent.Cancelled.ToString());
                        writer.WriteElementString(NsPre, "Category", null, objEvent.CategoryName);
                        //writer.WriteElementString(NsPre, "Location", Nothing, objEvent.LocationName)
                        writer.WriteElementString(NsPre, "DetailURL", null, objEvent.DetailURL);
                        writer.WriteElementString(NsPre, "EventTimeBegin", null,
                                                  objEvent.EventTimeBegin.ToString("yyyy-MM-dd HH:mm:ss"));
                        writer.WriteElementString(NsPre, "EventTimeZoneId", null, objEvent.EventTimeZoneId);
                        writer.WriteElementString(NsPre, "Duration", null, objEvent.Duration.ToString());
                        writer.WriteElementString(NsPre, "ImageURL", null, objEvent.ImageURL);
                        writer.WriteElementString(NsPre, "LocationName", null, objEvent.LocationName);
                        writer.WriteElementString(NsPre, "OriginalDateBegin", null,
                                                  objEvent.OriginalDateBegin.ToString("yyyy-MM-dd HH:mm:ss"));
                        writer.WriteElementString(NsPre, "Signups", null, objEvent.Signups.ToString());
                        writer.WriteElementString(NsPre, "OtherTimeZoneId", null, objEvent.OtherTimeZoneId);

                        writer.WriteEndElement();

                        rssCount++;
                        if ((iMax > 0) & (rssCount == iMax))
                        {
                            break;
                        }
                    }

                    writer.WriteEndElement();
                    writer.WriteEndElement();

                    this.Response.Write(sw.ToString());
                }
            }
        }