private static bool CheckShowBumper(Homepage homepage)
        {
            // Can't show bumper page is none is available
            if (!homepage.HasBumperPage)
            {
                return(false);
            }

            // Show bumper if querystring value is set
            if (WebUtils.GetIntRequestParam("ShowBumper", 0) == 1)
            {
                return(true);
            }

            // Show bumper if querystring value is set
            if (WebUtils.GetIntRequestParam("HideBumper", 0) == 1)
            {
                return(false);
            }

            // Don't show bumper if it's been seen
            if (CookieManager.GetValue(COOKIE_KEY, string.Empty).Contains("|" + homepage.HomepageId + "|"))
            {
                return(false);
            }

            return(true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                // Get the selected order from the session.  This should've been set in the last page
                Order selectedOrder = Session["SelectedOrder"] as Order;

                // Get the selected order items from the session.  This should've been set in the last page
                SelectedOrderItemList selectedOrderItems = Session["SelectedOrderItems"] as SelectedOrderItemList;

                // Ensure we have an order and order items, or redirect back to the download manager
                if (selectedOrder == null || selectedOrderItems == null)
                {
                    Response.Redirect("ViewOrders.aspx?error=MissingOrderOrNoItems&source=DownloadToFtp");
                }

                // Copy the order into this page's viewstate
                SelectedOrder = selectedOrder;

                // Copy the selected order items into this page's viewstate
                SelectedOrderItems = selectedOrderItems;

                // Remove the selected order items from the session
                Session.Remove("SelectedOrderItems");

                // Remove the order from the session
                Session.Remove("SelectedOrder");

                // Populate form from cookie if user has been here before
                FtpHostTextBox.Text            = CookieManager.GetValue("FtpHost");
                FtpPortTextBox.Text            = CookieManager.GetValue("FtpPort");
                FtpPassiveModeCheckBox.Checked = (CookieManager.GetValue("FtpPassiveMode", "0") == "1");
                FtpUsernameTextBox.Text        = CookieManager.GetValue("FtpUsername");
                FtpRemoteFolderTextBox.Text    = CookieManager.GetValue("FtpRemoteFolder");

                // Default values
                if (StringUtils.IsBlank(FtpPortTextBox.Text))
                {
                    FtpPortTextBox.Text = "21";
                }
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PasswordReminderButton.Visible = (ConfigurationManager.AppSettings.GetBoolValue("PasswordResetEnabled"));

            if (!Page.IsPostBack)
            {
                if (!CurrentUser.IsNull && WebUtils.GetRequestParam("action") == "logout")
                {
                    SessionEndModule.EndSession();
                    LoginManager.Logout(CurrentUser);
                    SessionInfo.Current.Reset();

                    const string url = "~/login.aspx?message=LoggedOut";
                    Response.Redirect(url, false);

                    return;
                }

                // Get message key from querystring
                string message = WebUtils.GetRequestParam("message", string.Empty);

                switch (message)
                {
                case "AccountReactivated":
                    MessageLabel1.SetSuccessMessage("Your account has been reactivated successfully");
                    break;

                case "PasswordChanged":
                    MessageLabel1.SetSuccessMessage("Your new password has been activated");
                    break;

                case "LoggedOut":
                    MessageLabel1.SetSuccessMessage("You have been logged out");
                    break;

                case "EmailConfirmed":
                    MessageLabel1.SetSuccessMessage("Your email address has been confirmed.  Please login below.");
                    break;

                case "AccessDenied":
                    MessageLabel1.SetErrorMessage("Access to the requested page is denied due to insufficient user credentials.");
                    break;

                case "NoUserOnLoad":
                case "NoUserOnPostback":

                    break;
                }


                string cookieEmail = CookieManager.GetValue("EmailAddress");
                RememberMeCheckBox.Checked = (cookieEmail != string.Empty);

                DropDownList dd = SiteUtils.FindControlRecursive(Page, "UserDropDownList") as DropDownList;

                if (dd != null)
                {
                    ListItem li = dd.Items.FindByValue(cookieEmail);

                    if (li != null)
                    {
                        dd.SelectedIndex = -1;
                        li.Selected      = true;
                    }
                }
                else
                {
                    EmailTextBox.Text = cookieEmail;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Set up the session for the user in SessionInfo.Current.User
        /// </summary>
        internal static void SetupSessionForCurrentSessionUser()
        {
            // Ensure user has lightbox
            LightboxManager.EnsureUserHasDefaultLightbox(SessionInfo.Current.User);

            // Set the default lightbox id
            SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.SelectedLightboxId = ContextInfo.LightboxManager.GetDefaultLightbox().LightboxId.GetValueOrDefault();

            // Set other stuff from cookie
            SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.PersistentCartLightboxMode  = GeneralUtils.ParseEnum(CookieManager.GetValue("PersistentCartLightboxMode"), PersistentCartLightboxMode.Lightbox);
            SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.PersistentCartLightboxState = GeneralUtils.ParseEnum(CookieManager.GetValue("PersistentCartLightboxState"), PersistentCartLightboxState.Open);
            SessionInfo.Current.UserSessionInfo.SavedUserAssetSearch.CategoriesOpen    = true;
            SessionInfo.Current.UserSessionInfo.SavedUserAssetSearch.SearchResultsView = GeneralUtils.ParseEnum(CookieManager.GetValue("SearchResultsView"), SearchResultsView.Thumbnails);
            SessionInfo.Current.AdminSessionInfo.AdminSavedAssetSearch.PageSize        = CookieManager.GetValue("AdminSavedAssetSearchPageSize", 0);
            SessionInfo.Current.AdminSessionInfo.AdminSavedOrderSearch.PageSize        = CookieManager.GetValue("AdminSavedOrderSearchPageSize", 0);
            SessionInfo.Current.AdminSessionInfo.AdminSavedUserSearch.PageSize         = CookieManager.GetValue("AdminSavedUserSearchPageSize", 0);

            // Get uploaded asset ID's (assets that have been previously uploaded but not catalogued)
            SessionInfo.Current.AdminSessionInfo.UploadedAssetsList.Clear();
            SessionInfo.Current.AdminSessionInfo.UploadedAssetsList.AddRange(SessionInfo.Current.User.GetCatalogueAssetIdList());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (WebUtils.GetIntRequestParam("ClearBumperCookie", 0) == 1)
                {
                    CookieManager.ClearValue(COOKIE_KEY);
                }

                // Initialize to empty homepage
                Homepage homepage = Homepage.Empty;

                // Check if we're previewing a homepage
                int previewId = WebUtils.GetIntRequestParam("PreviewHomepageId", 0);

                // Get the preview homepage if required
                if (previewId > 0)
                {
                    homepage = Homepage.Get(previewId);
                }

                // Get the current homepage if required
                if (homepage.IsNull)
                {
                    homepage = HomepageManager.GetCurrentHomepage(CurrentBrandId);
                }

                // Previewed homepages must use the brand of the homepage
                if (!homepage.IsPublished)
                {
                    BrandHeader1.BrandId = homepage.BrandId;
                }

                // Preview bar only available for unpublished homepages
                PreviewToolbarPanel.Visible = !homepage.IsPublished;

                // Check if we need to show the bumper page
                bool showBumper = CheckShowBumper(homepage);

                if (showBumper)
                {
                    // Show the custom bumper page
                    ShowCustomHtmlWithoutNav(homepage.BumperPageHtml);

                    // Check if the skip option is enabled, in which case
                    // we need to add this homepage to the cookie so that
                    // subsequent visits to the homepage bypass the bumper
                    // page and take the user straight to the real homepage.

                    if (homepage.IsPublished && homepage.BumperPageSkip)
                    {
                        // Get currently seen bumper pages
                        string val = CookieManager.GetValue(COOKIE_KEY);

                        // Value to append
                        string av = "|" + homepage.HomepageId + "|";

                        // Only add val if it's not already set
                        if (!val.Contains(av))
                        {
                            // Append this one
                            val += av;

                            // Replace double pipes
                            val = val.Replace("||", "|");

                            // Set the new bumper cookie value
                            CookieManager.SetValue(COOKIE_KEY, val);
                        }
                    }
                }
                else
                {
                    int homepageTypeId = WebUtils.GetIntRequestParam("HomepageTypeId", homepage.HomepageTypeId);

                    if (homepageTypeId == 1)
                    {
                        // Standard homepage

                        IntroTextLiteral.Text     = homepage.IntroText;
                        HomepageImage1.HomepageId = homepage.HomepageId.GetValueOrDefault();
                        HomepageImage2.HomepageId = homepage.HomepageId.GetValueOrDefault();
                        HomepageImage3.HomepageId = homepage.HomepageId.GetValueOrDefault();
                        HomepageImage4.HomepageId = homepage.HomepageId.GetValueOrDefault();

                        QuickLink1HyperLink.NavigateUrl = homepage.Url1;
                        QuickLink2HyperLink.NavigateUrl = homepage.Url2;
                        QuickLink3HyperLink.NavigateUrl = homepage.Url3;
                        QuickLink4HyperLink.NavigateUrl = homepage.Url4;

                        FeaturedCategoriesRepeater.Visible    = (homepage.CategoryList.Count > 0);
                        FeaturedCategoriesRepeater.DataSource = homepage.CategoryList;
                        FeaturedCategoriesRepeater.DataBind();

                        StandardTemplatePageContentWrapper.Visible   = true;
                        CustomHtmlPageContentWrapper_NoNav.Visible   = false;
                        CustomHtmlPageContentWrapper_WithNav.Visible = false;
                    }
                    else if (homepageTypeId == 2)
                    {
                        // Custom HTML, No Navigation

                        ShowCustomHtmlWithoutNav(homepage.CustomHtml);
                    }
                    else if (homepageTypeId == 3)
                    {
                        // Custom HTML, With Navigation

                        StandardTemplatePageContentWrapper.Visible   = false;
                        CustomHtmlPageContentWrapper_NoNav.Visible   = false;
                        CustomHtmlPageContentWrapper_WithNav.Visible = true;
                        WithNav_HtmlContentLiteral.Text = homepage.CustomHtml;
                    }
                    else
                    {
                        throw new SystemException("Unknown homepage type: " + homepage.HomepageTypeId);
                    }
                }

                CheckAction();
            }
        }