public static HtmlContainerControl CreateTab(string hRef, object content) { var li = new HtmlLi { EnableViewState = false }; li.AddCssClasses("tab"); AddTabAnchor(li, hRef, content); return(li); }
private static void CreateEmailAnchor(Control ul, string email, string politicianName, bool useLargeIcons = false) { var li = new HtmlLi().AddTo(ul); var a = new HyperLink { NavigateUrl = "mailto:" + email, ToolTip = "Send Email to " + politicianName + " at: " + email }.AddTo(li); new Image { ImageUrl = useLargeIcons ? "/images/email.2.png" : "/images/Email.png" }.AddTo(a); }
private static void CreateOneMediumAnchor(Control ul, string webAddress, SocialMedium medium, string politicianName, bool useLargeIcons = false) { var li = new HtmlLi().AddTo(ul); var a = new HyperLink { NavigateUrl = VotePage.NormalizeUrl(webAddress), Target = medium.Name.ToLowerInvariant(), ToolTip = medium.GetTooltip(politicianName) }.AddTo(li); new Image { ImageUrl = useLargeIcons ? medium.LargeImageUrl : medium.ImageUrl }.AddTo(a); }
public void CreateControls(HtmlContainerControl parent, IList <AnswersViewRow> responses, MonitorInstance monitor, Dictionary <string, string> alternateHeadings = null) { var row = responses.First(); var responsesAsDataRow = responses.Where(r => r.Sequence != null).Cast <DataRow>().ToList(); parent.AddCssClasses("answer-panel " + (_Usage == Usage.ForIssues ? "issues-answer-panel " : "intro-answer-panel ") + (SecurePage.IsPoliticianUser ? "politician-answer-panel" : "master-answer-panel")); // The panel title var heading = SecurePage.AddContainer(parent, null, null); var headingText = alternateHeadings != null && alternateHeadings.ContainsKey(row.QuestionKey) ? alternateHeadings[row.QuestionKey] : row.Question; SecurePage.AddHeading(heading, 4, null, null, headingText); SecurePage.Center(heading, true, true, "heading"); if (_Usage == Usage.ForIssues) { heading.Visible = false; } // Add undo button as next sibling to heading var undo = SecurePage.CreateUndoButton("Undo" + row.QuestionKey, monitor.GetUndoClass(null), $"Revert \"{row.Question}\" to the latest saved version"); heading.AddAfter(undo); // Same for clear button var clear = SecurePage.CreateClearButton("Clear" + row.QuestionKey, monitor.GetClearClass(null), $"Clear \"{row.Question}\""); heading.AddAfter(clear); var updatePanel = SecurePage.AddAjaxUpdatePanel(parent, "UpdatePanel" + row.QuestionKey); var container = SecurePage.AddContainer(updatePanel.ContentTemplateContainer, "Container" + row.QuestionKey, monitor.GetContainerClass("update-all updated answer-container")); SecurePage.AddHiddenField(container, "Description" + row.QuestionKey, monitor.GetDescriptionClass(null, "answer"), row.Question); SecurePage.AddHiddenField(container, "SubTab" + row.QuestionKey, "subtab subtab-" + row.QuestionKey); var hasNoResponses = row.Sequence == null; var sequenceItem = SecurePage.AddHiddenField(container, "Sequence" + row.QuestionKey, "answer-sequence", hasNoResponses ? "?" : row.Sequence.Value.ToString(CultureInfo.InvariantCulture)); SetResponseData(responsesAsDataRow, row, sequenceItem); // the action menu var menuContainer = SecurePage.AddContainer(container, "Action" + row.QuestionKey, "action-menu"); CreateActionMenu(menuContainer, responsesAsDataRow, row.Sequence == null); new HtmlP { InnerHtml = "To completely delete a response (Text and YouTube), use the Clear button (red <span>X</span> upper right) then Update." }.AddTo(container, "delete-message"); var subTabs = new HtmlDiv { ID = "answer-subtabs-" + row.QuestionKey, ClientIDMode = ClientIDMode.Static }.AddTo(container, "answer-sub-tabs shadow"); var subTabsTabs = new HtmlUl().AddTo(subTabs, "htabs unselectable"); var textSubTab = new HtmlLi { EnableViewState = false }.AddTo(subTabsTabs, "tab htab"); new HtmlAnchor { HRef = "#tab-textanswer-" + row.QuestionKey, InnerHtml = "Text<br />Response", EnableViewState = false }.AddTo(textSubTab); var youTubeSubTab = new HtmlLi { EnableViewState = false }.AddTo(subTabsTabs, "tab htab"); new HtmlAnchor { HRef = "#tab-youtubeanswer-" + row.QuestionKey, InnerHtml = "YouTube<br />Response", EnableViewState = false }.AddTo(youTubeSubTab); var textSubTabContent = new HtmlDiv { ID = "tab-textanswer-" + row.QuestionKey, ClientIDMode = ClientIDMode.Static }.AddTo(subTabs); var youTubeSubTabContent = new HtmlDiv { ID = "tab-youtubeanswer-" + row.QuestionKey, ClientIDMode = ClientIDMode.Static }.AddTo(subTabs); string moreClasses; switch (_Usage) { case Usage.ForIntroReasons: moreClasses = "mc-mt-reasons"; break; case Usage.ForIntroBio: moreClasses = "mc-mt-bio2"; break; default: var tabPrefix = MonitorPrefix + "-" + MonitorTabPrefix + "-issue" + row.IssueKey; var superTabPrefix = MonitorPrefix + "-" + MonitorSuperTabPrefix + "-igroup" + row.IssueGroupKey; moreClasses = tabPrefix + " " + superTabPrefix; break; } SecurePage.AddHiddenField(container, "HasValue" + row.QuestionKey, monitor.GetDataClass(moreClasses, "hasvalue"), string.IsNullOrWhiteSpace(row.Answer) && string.IsNullOrWhiteSpace(row.YouTubeUrl) ? string.Empty : "Y"); CreateTextSubTabContent(textSubTabContent, row, moreClasses, monitor); CreateYouTubeSubTabContent(youTubeSubTabContent, row, moreClasses, monitor); new HtmlHr().AddTo(container); // feedback AddFeedbackWithIe7Floater(container, "Feedback" + row.QuestionKey, monitor.GetFeedbackClass(null)); // update button SecurePage.AddUpdateButtonInContainer(container, "Button" + row.QuestionKey, "update-button", monitor.GetButtonClass("update-button button-1"), $"Update \"{row.Question}\"", ButtonUpdate_OnClick); SecurePage.AddClearBoth(container); }