private void SetupUI() { var uploadedAssets = GetUploadedAssets(); if (uploadedAssets.Count > 0) { NoAssetsPanel.Visible = false; FormPanel.Visible = true; int assetId = WebUtils.GetIntRequestParam("AssetId", 0); BindAssetList(); if (assetId > 0) { ListItem li = SessionAssetsListBox.Items.FindByValue(assetId.ToString()); if (li != null) { SessionAssetsListBox.SelectedIndex = -1; li.Selected = true; AssetSelectionChanged(); } } } else { NoAssetsPanel.Visible = true; FormPanel.Visible = false; } Label BreadCrumbsLabel = (Label)SiteUtils.FindControlRecursive(Page.Master, "BreadCrumbsLabel"); BreadCrumbsLabel.Text = string.Format("Manage Assets{0}Catalogue Assets: Step One", AdminNavigation.BreadcrumbsSpacer); }
private void OpenPanel(string controlName) { if (String.IsNullOrEmpty(controlName)) { throw new ArgumentException("ControlName cannot be empty"); } // Close all panels LightboxOpen.Visible = false; LightboxClosed.Visible = false; CartOpen.Visible = false; CartClosed.Visible = false; // Open panel Control placeHolder = SiteUtils.FindControlRecursive(this, controlName); if (placeHolder == null) { throw new NullReferenceException(string.Format("Control with ID: {0} not found", controlName)); } // Make the control visible placeHolder.Visible = true; switch (controlName) { case "LightboxOpen": PersistentLightboxCartInfo.PersistentCartLightboxMode = PersistentCartLightboxMode.Lightbox; PersistentLightboxCartInfo.PersistentCartLightboxState = PersistentCartLightboxState.Open; break; case "LightboxClosed": PersistentLightboxCartInfo.PersistentCartLightboxMode = PersistentCartLightboxMode.Lightbox; PersistentLightboxCartInfo.PersistentCartLightboxState = PersistentCartLightboxState.Closed; break; case "CartOpen": PersistentLightboxCartInfo.PersistentCartLightboxMode = PersistentCartLightboxMode.Cart; PersistentLightboxCartInfo.PersistentCartLightboxState = PersistentCartLightboxState.Open; break; case "CartClosed": PersistentLightboxCartInfo.PersistentCartLightboxMode = PersistentCartLightboxMode.Cart; PersistentLightboxCartInfo.PersistentCartLightboxState = PersistentCartLightboxState.Closed; break; } CookieManager.SetValue("PersistentCartLightboxMode", PersistentLightboxCartInfo.PersistentCartLightboxMode); CookieManager.SetValue("PersistentCartLightboxState", PersistentLightboxCartInfo.PersistentCartLightboxState); // Update the dropdowns in all the panels CartOpen_ModeDropDownList.SafeSelectValue(PersistentLightboxCartInfo.PersistentCartLightboxMode); CartClosed_ModeDropDownList.SafeSelectValue(PersistentLightboxCartInfo.PersistentCartLightboxMode); LightboxOpen_ModeDropDownList.SafeSelectValue(PersistentLightboxCartInfo.PersistentCartLightboxMode); LightboxClosed_ModeDropDownList.SafeSelectValue(PersistentLightboxCartInfo.PersistentCartLightboxMode); // Mode has changed, so rebind Bind(); }
private string GetEmailAddress() { string email = EmailTextBox.Text.Trim(); DropDownList dd = SiteUtils.FindControlRecursive(Page, "UserDropDownList") as DropDownList; if (dd != null) { email = dd.SelectedValue; } return(email); }
protected override void OnItemDataBound(RepeaterItemEventArgs e) { base.OnItemDataBound(e); switch (e.Item.ItemType) { case ListItemType.Header: for (int i = 1; i < ColumnCount + 1; i++) { HtmlTableCell cell = (HtmlTableCell)e.Item.FindControl("HeaderCell" + i); LinkButton lb = (LinkButton)cell.FindControl("LinkButton" + i); Image existingImage = SiteUtils.FindControlRecursive(cell, "ArrowImage") as Image; Literal lit = SiteUtils.FindControlRecursive(cell, "ArrowImageSpacer") as Literal; if (existingImage != null) { cell.Controls.Remove(existingImage); } if (lit != null) { cell.Controls.Remove(lit); } if (lb.CommandArgument == SortExpression) { Image image = new Image { ID = "ArrowImage", ImageUrl = (SortAscending) ? SiteUtils.GetIconPath("arrowU.gif") : SiteUtils.GetIconPath("arrowD.gif"), AlternateText = (SortAscending) ? "[Ascending]" : "[Descending]" }; lit = new Literal { ID = "ArrowImageSpacer", Text = " " }; cell.Controls.Add(lit); cell.Controls.Add(image); } } break; } }
private void UpdatePagingControls(Repeater repeater, int offset, int total) { string prefix = (repeater.ID == LightboxRepeater.ID) ? "Lightbox" : "Cart"; string leftArrowImageButtonId = string.Concat(prefix, "LeftArrowImageButton"); string rightArrowImageButtonId = string.Concat(prefix, "RightArrowImageButton"); ImageButton LeftArrowImageButton = (ImageButton)SiteUtils.FindControlRecursive(repeater, leftArrowImageButtonId); ImageButton RightArrowImageButton = (ImageButton)SiteUtils.FindControlRecursive(repeater, rightArrowImageButtonId); LeftArrowImageButton.CommandArgument = Convert.ToString(offset - 1); RightArrowImageButton.CommandArgument = Convert.ToString(offset + 1); LeftArrowImageButton.Visible = (total != 0 && offset > 0); RightArrowImageButton.Visible = (total != 0 && offset + NumberOfAssetsToDisplay < total); }
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; } } }
private void Bind(int page, bool updateAuditLog) { AssetFinder finder = SavedUserAssetSearch.AssetFinder; EntityList <Asset> assets = Asset.FindMany(finder, page - 1, PageSize); if (assets.Count == 0) { NoSearchResultsPanel.Visible = true; SearchResultListRepeater.Visible = false; SearchResultThumbnailsDataList.Visible = false; } else { // Hide the no results panel; we have some assets NoSearchResultsPanel.Visible = false; // Update page size SavedUserAssetSearch.PageSize = PageSize; // Update page SavedUserAssetSearch.Page = page; // Show filters panel if a search term was entered, we're on page 1, and have more than the specified number of results if (!StringUtils.IsBlank(finder.GeneralKeyword) && (page == 1) && (ShowFiltersCount > 0) && (assets.PagingInfo.TotalRecords > ShowFiltersCount)) { PageHeader pageHeader = (PageHeader)SiteUtils.FindControlRecursive(Page, "PageHeader1"); pageHeader.ToggleSearchVisibility(SavedUserAssetSearch.FilterOpen, SavedUserAssetSearch.CategoriesOpen); string message = string.Format("Your search has returned more than {0} results. Use the filters above to refine your search.", ShowFiltersCount); LargeSearchResultFeedbackLabel.SetErrorMessage(message); LargeSearchResultFeedbackLabel.Pinned = true; } else { LargeSearchResultFeedbackLabel.Visible = false; LargeSearchResultFeedbackLabel.Pinned = false; } // Log which assets were returned as part of this search if (updateAuditLog) { int index = 0; foreach (Asset asset in assets) { index++; AuditLogManager.LogAssetInSearchResult(SavedUserAssetSearch.AuditAssetSearchId, asset.AssetId.GetValueOrDefault()); AuditLogManager.LogAssetAction(asset, CurrentUser, AuditAssetAction.ReturnedInSearch, string.Format("Search Criteria: {0}. Total assets: {1}. Displayed on page: {2}, asset number: {3}", finder.GeneralKeyword, assets.PagingInfo.TotalRecords, assets.PagingInfo.CurrentPage + 1, index)); } } // The current view is thumbnails, so ensure we have at last a single row and toggle // the relevant data controls (ie. hide the list repeater and show the thumbnail datalist) if (SavedUserAssetSearch.SearchResultsView == SearchResultsView.Thumbnails) { // In thumbnail view, we need to make sure we have at least one row of assets, or the // layout gets really messed up. Here, we're doing a check, and adding in empty assets // to pad out the asset list to at least a single row. while (assets.Count < SearchResultThumbnailsDataList.RepeatColumns) { assets.Add(Asset.Empty); } SearchResultListRepeater.Visible = false; SearchResultThumbnailsDataList.Visible = true; SearchResultThumbnailsDataList.DataSource = assets; SearchResultThumbnailsDataList.DataBind(); } else { SearchResultListRepeater.Visible = true; SearchResultThumbnailsDataList.Visible = false; SearchResultListRepeater.DataSource = assets; SearchResultListRepeater.DataBind(); } } TopPager.CurrentPage = assets.PagingInfo.CurrentPage + 1; TopPager.PageSize = assets.PagingInfo.PageSize; TopPager.PageCount = assets.PagingInfo.TotalPages; TopPager.ItemCount = assets.PagingInfo.TotalRecords; BottomPager.CurrentPage = TopPager.CurrentPage; BottomPager.PageSize = TopPager.PageSize; BottomPager.PageCount = TopPager.PageCount; BottomPager.ItemCount = TopPager.ItemCount; CurrentPage = page; TotalPages = assets.PagingInfo.TotalPages; AssetCount = assets.PagingInfo.TotalRecords; }