Exemple #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Title               = SiteUtils.FormatPageTitle(siteSettings, Resource.AccessDenied);
            lnkHome.Text        = Resource.ReturnHomeLabel;
            lnkHome.ToolTip     = Resource.ReturnHomeLabel;
            lnkHome.NavigateUrl = SiteRoot + "/Default.aspx";
            SiteUtils.AddNoIndexMeta(this);
            //lblEditAccessDeniedMessage.Text = ResourceHelper.GetMessageTemplate("EditAccessDeniedMessage.config");

            AddClassToBody("accessdenied");
        }
Exemple #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //having this here causes a redirect to the login page.
            //Response.StatusCode = 401;

            Title               = SiteUtils.FormatPageTitle(siteSettings, Resource.AccessDenied);
            lnkHome.Text        = Resource.ReturnHomeLabel;
            lnkHome.ToolTip     = Resource.ReturnHomeLabel;
            lnkHome.NavigateUrl = SiteRoot + "/Default.aspx";

            SiteUtils.AddNoIndexMeta(this);

            lblAccessDenied.Text = ResourceHelper.GetMessageTemplate("AccessDeniedMessage.config");

            AddClassToBody("accessdenied");
        }
Exemple #3
0
        private void LoadSettings()
        {
            AddClassToBody("webstore webstorecart");

            SiteUtils.AddNoIndexMeta(Page);

            commerceConfig  = SiteUtils.GetCommerceConfig();
            currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code);

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
            if (moduleSettings != null)
            {
                config = new WebStoreConfiguration(moduleSettings);
            }

            litCartFooter.Text = config.CartPageFooter;

            if (Request.IsAuthenticated)
            {
                siteUser = SiteUtils.GetCurrentSiteUser();
            }

            store = StoreHelper.GetStore();
            if (store == null)
            {
                return;
            }

            if (
                (StoreHelper.UserHasCartCookie(store.Guid)) ||
                (Request.IsAuthenticated)
                )
            {
                cart = StoreHelper.GetCart();
            }

            //if we can't process cards internally there is no reason (except a free order) to go to the ConfirmOrder.aspx page
            //and the order can be processed wtithout the user signing in or if the user is already signed in
            if (
                ((!commerceConfig.CanProcessStandardCards) && (commerceConfig.WorldPayInstallationId.Length == 0)) &&
                ((Request.IsAuthenticated) || (canCheckoutWithoutAuthentication))
                )
            {
                lnkCheckout.Visible = false;
            }

            if (cart == null)
            {
                pnlDiscountCode.Visible = false;
                lnkCheckout.Visible     = false;
                return;
            }

            if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0))
            {
                StoreHelper.EnsureValidDiscounts(store, cart);
            }

            if (store != null)
            {
                canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart);
            }

            cartList.Store           = store;
            cartList.ShoppingCart    = cart;
            cartList.CurrencyCulture = currencyCulture;

            cartListAlt.Store           = store;
            cartListAlt.ShoppingCart    = cart;
            cartListAlt.CurrencyCulture = currencyCulture;

            if (displaySettings.UseAltCartList)
            {
                cartList.Visible    = false;
                cartListAlt.Visible = true;
            }


            // disable till I finish
            //canCheckoutWithoutAuthentication = false;

            ConfigureCheckoutButtons();

            int countOfDiscountCodes = Discount.GetCountOfActiveDiscountCodes(store.ModuleGuid);

            pnlDiscountCode.Visible = (countOfDiscountCodes > 0);

            // don't show the discount code panel if the cart is empty
            if (cart.SubTotal == 0)
            {
                // allow checkout if cart has items (support checkout with free items)
                if (cart.CartOffers.Count == 0)
                {
                    lnkCheckout.Visible = false;
                }
                else
                {
                    //cart has free items
                    lnkCheckout.Visible = true;
                }
                //litOr.Visible = false;
                //btnPayPal.Visible = false;
                //btnGoogleCheckout.Visible = false;
                pnlDiscountCode.Visible = false;
            }

            // kill switch to disable discount codes (doesn't prevent use of ones already in the cart but prevents new uses
            bool disableDiscounts = false;

            ConfigHelper.GetBoolProperty("WebStoreDisabledDiscounts", disableDiscounts);
            if (disableDiscounts)
            {
                pnlDiscountCode.Visible = false;
            }



            //if (!Page.IsPostBack)
            //{
            //    if ((commerceConfig.PayPalIsEnabled) && (commerceConfig.PayPalUsePayPalStandard))
            //    {
            //        if (Request.IsAuthenticated)
            //        {
            //            siteUser = SiteUtils.GetCurrentSiteUser();
            //            SetupPayPalStandardForm();
            //        }
            //        else
            //        {
            //            //TODO: if the cart has no download items allow checkout without registration/sign in

            //            // we need the user to be signed in before we send them to paypal if using PayPal Standard
            //            // because we want to return them to their order summary and that requires login
            //            // so we need to know who the user is before sending them to PayPal
            //            litOr.Visible = false;
            //            btnPayPal.Visible = false;
            //            btnGoogleCheckout.Visible = false;
            //        }
            //    }
            //}



            //if (!Request.IsAuthenticated)
            //{


            //    if (commerceConfig.GoogleCheckoutIsEnabled)
            //    {
            //        if (
            //        (!commerceConfig.Is503TaxExempt)
            //        && (cart != null)
            //        && (cart.HasDonations())
            //        )
            //        {
            //            lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage;
            //            lblGoogleMessage.Visible = true;
            //            PaymentAcceptanceMark mark = (PaymentAcceptanceMark)pam1;
            //            mark.SuppressGoogleCheckout = true;

            //            btnGoogleCheckout.Visible = true;
            //            btnGoogleCheckout.Enabled = false;
            //        }
            //    }
            //}
            //else
            //{
            //    if (
            //        (!commerceConfig.Is503TaxExempt)
            //        && (cart != null)
            //        && (cart.HasDonations())
            //        && (commerceConfig.GoogleCheckoutIsEnabled)
            //        )
            //    {
            //        btnGoogleCheckout.Visible = true;
            //        btnGoogleCheckout.Enabled = false;
            //        lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage;
            //        lblGoogleMessage.Visible = true;
            //    }


            //}
        }
        private void PopulateControls()
        {
            if (forum == null)
            {
                return;
            }
            if (thread == null)
            {
                return;
            }

            if (ForumConfiguration.UsePageNameInThreadTitle)
            {
                Title = SiteUtils.FormatPageTitle(siteSettings, CurrentPage.PageName + " - " + SecurityHelper.RemoveMarkup(FormatTitle(thread)));
            }
            else
            {
                Title = SiteUtils.FormatPageTitle(siteSettings, SecurityHelper.RemoveMarkup(FormatTitle(thread)));
            }

            if (thread.PageTitleOverride.Length > 0)
            {
                Title = thread.PageTitleOverride;
            }

            if (thread.SetNoIndexMeta)
            {
                SiteUtils.AddNoIndexMeta(this);
            }

            litForumDescription.Text = forum.Description;
            divDescription.Visible   = (forum.Description.Length > 0) && !displaySettings.HideForumDescriptionOnPostList;

            // google does not use meta description in page rankings
            //http://googlewebmastercentral.blogspot.com/2009/09/google-does-not-use-keywords-meta-tag.html

            // big forum sites like stackoverflow don't use meta descrition on posts
            //http://webmasters.stackexchange.com/questions/1721/why-dont-websites-have-a-description-meta-tag-in-the-head-section
            // if you view the source of a post page on http://forums.asp.net/ you will also see no meta description
            // therefore as of 2012-06-18 I've added a setting to disable it by default but to allow it to be used for those who may disagree
            if (ForumConfiguration.UseMetaDescriptionOnThreads)
            {
                MetaDescription = string.Format(
                    CultureInfo.InvariantCulture,
                    ForumResources.ForumThreadMetaDescriptionFormat,
                    SecurityHelper.RemoveMarkup(thread.Subject));
            }

            if (ForumConfiguration.CombineUrlParams)
            {
                lnkForum.HRef = SiteRoot + "/Forums/ForumView.aspx?pageid=" + PageId.ToInvariantString()
                                + "&amp;f=" + forum.ItemId.ToInvariantString() + "~1";
            }
            else
            {
                lnkForum.HRef = SiteRoot + "/Forums/ForumView.aspx?ItemID="
                                + forum.ItemId.ToInvariantString()
                                + "&amp;pageid=" + PageId.ToInvariantString()
                                + "&amp;mid=" + forum.ModuleId.ToInvariantString();
            }

            lnkForum.InnerHtml = forum.Title;

            if (displaySettings.HideHeadingOnThreadView)
            {
                heading.Visible = false;
            }
            else
            {
                heading.Text = Server.HtmlEncode(thread.Subject);
            }
            if (!displaySettings.HideCurrentCrumbOnThreadcrumbs)
            {
                litThreadDescription.Text = Server.HtmlEncode(thread.Subject);
            }
        }
        private void LoadSettings()
        {
            AddClassToBody($"webstore webstorecart {displaySettings.AdditionalBodyClass}");

            SiteUtils.AddNoIndexMeta(Page);

            commerceConfig  = SiteUtils.GetCommerceConfig();
            currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code);

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
            if (moduleSettings != null)
            {
                config = new WebStoreConfiguration(moduleSettings);
            }

            litCartFooter.Text = config.CartPageFooter;

            if (Request.IsAuthenticated)
            {
                siteUser = SiteUtils.GetCurrentSiteUser();
            }

            store = StoreHelper.GetStore();
            if (store == null)
            {
                return;
            }

            if (
                (StoreHelper.UserHasCartCookie(store.Guid)) ||
                (Request.IsAuthenticated)
                )
            {
                cart = StoreHelper.GetCart();
            }

            //if we can't process cards internally there is no reason (except a free order) to go to the ConfirmOrder.aspx page
            //and the order can be processed wtithout the user signing in or if the user is already signed in
            if (
                ((!commerceConfig.CanProcessStandardCards) && (commerceConfig.WorldPayInstallationId.Length == 0))
                //&& ((Request.IsAuthenticated) || (canCheckoutWithoutAuthentication)) //moved login prompt to cart so we don't need to have a link to the confirmorder page
                )
            {
                //lnkConfirmOrder.Visible = false;
                litConfirmOrder.Visible = false;
            }

            if (cart == null)
            {
                pnlDiscountCode.Visible = false;
                //lnkConfirmOrder.Visible = false;
                litConfirmOrder.Visible = false;
                return;
            }

            if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0))
            {
                StoreHelper.EnsureValidDiscounts(store, cart);
            }

            if (store != null)
            {
                canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart);
            }

            cartList.Store           = store;
            cartList.ShoppingCart    = cart;
            cartList.CurrencyCulture = currencyCulture;
            cartList.DisplaySettings = displaySettings;

            cartListAlt.Store           = store;
            cartListAlt.ShoppingCart    = cart;
            cartListAlt.CurrencyCulture = currencyCulture;

            if (displaySettings.UseAltCartList)
            {
                cartList.Visible    = false;
                cartListAlt.Visible = true;
            }

            ConfigureCheckoutButtons();

            int countOfDiscountCodes = Discount.GetCountOfActiveDiscountCodes(store.ModuleGuid);

            pnlDiscountCode.Visible = (countOfDiscountCodes > 0);

            // don't show the discount code panel if the cart is empty
            if (cart.SubTotal == 0)
            {
                // allow checkout if cart has items (support checkout with free items)
                if (cart.CartOffers.Count == 0)
                {
                    //lnkConfirmOrder.Visible = false;
                    litConfirmOrder.Visible = false;
                }
                else
                {
                    //cart has free items
                    //lnkConfirmOrder.Visible = true;
                }
                //litOr.Visible = false;
                //btnPayPal.Visible = false;
                pnlDiscountCode.Visible = false;
            }

            // kill switch to disable discount codes (doesn't prevent use of ones already in the cart but prevents new uses
            bool disableDiscounts = false;

            ConfigHelper.GetBoolProperty("WebStoreDisabledDiscounts", disableDiscounts);
            if (disableDiscounts)
            {
                pnlDiscountCode.Visible = false;
            }
        }