Exemple #1
0
        private HtmlContainerControl CreateIssue(AnswersViewRow row, Control tabs,
                                                 Control container)
        {
            if (_IssueTabFont == null)
            {
                // We use bold as worst-case
                _IssueTabFont = new Font(IssueTabFontFamily, IssueTabFontSize,
                                         FontStyle.Bold);
            }

            // create panel
            var panel = AddContainer(container, "tab-" + row.IssueKey,
                                     "content-panel tab-panel vtab-panel");

            // create accordion control
            var accordion = AddAccordionControl(panel, null, null, "accordion-deferred");

            // create vertical tab
            var tabKey      = MonitorTabPrefix + "-issue" + row.IssueKey;
            var verticalTab = AddVertTab(tabs, "#" + panel.ClientID,
                                         BreakForTab(row.Issue, _IssueTabFont, IssueTabMaxWidth), tabKey + " vcentered-tab");

            // center the a tag -- the first child of the tab always
            Center(verticalTab.Controls[0], false, true);

            AddAsteriskIndicator(verticalTab, null, null,
                                 $"There are unsaved changes to {row.Issue}");

            AddStarIndicator(verticalTab, null, null,
                             $"We have at least one response from you for {row.Issue}");

            return(accordion);
        }
Exemple #2
0
        private static PlaceHolder GetMainTabLabel(AnswersViewRow row)
        {
            // The database entry has pre-defined breaks. Here we verify the count and
            // pad with blank lines at the end, if necessary

            var container = new PlaceHolder {
                EnableViewState = false
            };

            var formattedHeading = ValidateBreaks(row.IssueGroupHeading,
                                                  LinesInCategoryHeading, true,
                                                  "Too many lines in category heading: " + row.IssueGroupKey);

            new LiteralControl(formattedHeading)
            {
                EnableViewState = false
            }.AddTo(
                container);

            var formattedSubHeading = ValidateBreaks(row.IssueGroupSubHeading,
                                                     LinesInCategorySubHeading, true,
                                                     "Too many lines in category subheading: " + row.IssueGroupKey);

            new HtmlSpan
            {
                EnableViewState = false,
                InnerHtml       = formattedSubHeading
            }.AddTo(container);

            return(container);
        }
        private static void CreateTextSubTabContent(HtmlControl parent, AnswersViewRow row,
                                                    string moreClasses, MonitorInstance monitor)
        {
            // the text answer field
            SecurePage.AddTextAreaInputElement(parent, "TextBox" + row.QuestionKey,
                                               monitor.GetDataClass("shadow answer-textbox for-star " + moreClasses, "answer"),
                                               row.Answer, "Type or paste your response into this box", true,
                                               null, false, "Text Response", "answer wide", null, null, null);

            // the remove-line-breaks button
            if (!SecurePage.IsPoliticianUser)
            {
                SecurePage.AddButtonInputElement(parent, null,
                                                 "remove-line-breaks button-2 button-smallest", "Remove Line Breaks", "remove-line-breaks");
            }

            if (!SecurePage.IsPoliticianUser) // add source and date boxes
            {
                var textSourceAndDateDiv = new HtmlDiv().AddTo(parent,
                                                               "text-source-and-date-container source-and-date-container");
                var textSourceDiv = new HtmlDiv().AddTo(textSourceAndDateDiv,
                                                        "text-source-container source-container");
                var sourceRequiredSpan = row.IsTextSourceOptional.GetValueOrDefault()
          ? string.Empty
          : " <span class=\"reqd\">◄</span>";
                SecurePage.AddTextAreaInputElement(textSourceDiv, "Source" + row.QuestionKey,
                                                   monitor.GetDataClass("shadow source-textbox " + moreClasses, "source"),
                                                   row.Source, "Copy and paste the url of the web page (with or without http://) where" +
                                                   " you obtained the answer or a description of the source into this box.", false,
                                                   "Copy and paste the url of the web page (with or without http://) where" +
                                                   " you obtained the answer or a description of the source into this box.",
                                                   false, "Text Source" + sourceRequiredSpan, "text-source source", null, null, null);
                var textDateDiv = new HtmlDiv().AddTo(textSourceAndDateDiv, "text-date-container date-container");
                SecurePage.AddTextInputElement(textDateDiv, "Date" + row.QuestionKey,
                                               monitor.GetDataClass("shadow-2 date-textbox date-picker " + moreClasses, "date sourcedate"),
                                               row.DateStamp.DbDateToShortDate(),
                                               "Enter the date of the answer if today is not an appropriate date. For" +
                                               " example if you obtained the answer from the candidate's campaign website," +
                                               " and the election is over, enter some date a couple days prior to the" +
                                               " election.", false, "Text Date", "date", null, null, null);
                SecurePage.AddButtonInputElement(textDateDiv, null,
                                                 "today-button for-date button-1 button-smallest", "Today", "today for-date");
            }
        }
Exemple #4
0
        private HtmlContainerControl CreateCategory(AnswersViewRow row,
                                                    Control horizontalTabs)
        {
            // create panel
            var panel = AddContainer(MainTabsPlaceholder, "tab-" + row.IssueGroupKey,
                                     "content-panel tab-panel htab-panel");

            // create vertical tab control
            var verticalTabs = AddVertTabControl(panel, null, "tabs-nested");

            // create horizontal tab
            var superTabKey   = MonitorSuperTabPrefix + "-igroup" + row.IssueGroupKey;
            var horizontalTab = AddHorzTab(horizontalTabs, "#" + panel.ClientID,
                                           GetMainTabLabel(row), superTabKey);

            AddAsteriskIndicator(horizontalTab, null, null,
                                 $"There are unsaved changes to the {row.IssueGroupHeading} category");

            AddStarIndicator(horizontalTab, null, null,
                             $"We have at least one response from you for the {row.IssueGroupHeading} category");

            return(verticalTabs);
        }
        private static void CreateYouTubeSubTabContent(HtmlControl parent, AnswersViewRow row,
                                                       string moreClasses, MonitorInstance monitor)
        {
            var wasUploadedByCandidate = !string.IsNullOrWhiteSpace(row.YouTubeUrl) &&
                                         row.YouTubeSource == YouTubeInfo.VideoUploadedByCandidateMessage;

            var wasUploadedByVoteUsa = !string.IsNullOrWhiteSpace(row.YouTubeUrl) &&
                                       row.YouTubeSource != YouTubeInfo.VideoUploadedByCandidateMessage;

            // the Source heading and Uploaded by candidate checkbox (only for master users)
            if (!SecurePage.IsPoliticianUser)
            {
                var heading = new HtmlDiv().AddTo(parent, "category-heading");
                new HtmlSpan {
                    InnerText = "Select Type of Video to be Shown"
                }.AddTo(heading);

                SecurePage.AddCheckboxInputElement(parent, "YouTubeFromCandidate" + row.QuestionKey,
                                                   monitor.GetDataClass("youtubefrom-checkbox youtubefromcandidate-checkbox " + moreClasses,
                                                                        "youtubefromcandidate"),
                                                   null, wasUploadedByCandidate, "Complete Video on YouTube (not created by Vote USA)", "fromcandidate clearfix",
                                                   null, null, null, string.Empty);

                SecurePage.AddCheckboxInputElement(parent, "YouTubeFromVoteUSA" + row.QuestionKey,
                                                   monitor.GetDataClass("youtubefrom-checkbox youtubefromvoteusa-checkbox " + moreClasses,
                                                                        "youtubefromvoteusa"),
                                                   null, wasUploadedByVoteUsa, "Shortened Video Extracted from an Existing Video (on Vote USA or other Private Channel)", "fromvoteusa clearfix",
                                                   null, null, null, string.Empty);
            }

            // the Vote-USA heading (only for master users)
            //if (!SecurePage.IsPoliticianUser)
            //{
            //  var heading = new HtmlDiv().AddTo(parent, "category-heading");
            //  new HtmlSpan {InnerText = "Uploaded Vote USA YouTube Video"}.AddTo(heading);
            //}

            var youTubeSourceFields = new HtmlDiv().AddTo(parent, "youtube-source-fields");

            if (!SecurePage.IsPoliticianUser)
            {
                SecurePage.AddTextInputElement(youTubeSourceFields, "YouTubeSourceUrl" + row.QuestionKey,
                                               monitor.GetDataClass("shadow-2 youtubesourceurl-textbox " + moreClasses, "youtubesourceurl"),
                                               row.YouTubeSourceUrl, "Enter the url (with or without http://) of the source video.",
                                               false, "Url of Longer Video Used to Extract Shortened Video (on Vote USA or Private Channel)", "youtubeurl wide", null, null, null);
            }

            var youTubeSourceAndDateDiv = new HtmlDiv().AddTo(youTubeSourceFields,
                                                              "youtube-source-and-date-container source-and-date-container");

            if (wasUploadedByCandidate)
            {
                youTubeSourceFields.AddCssClasses("hidden");
            }
            else
            {
                youTubeSourceFields.RemoveCssClass("hidden");
            }

            if (!SecurePage.IsPoliticianUser)
            {
                var youTubeSourceDiv = new HtmlDiv().AddTo(youTubeSourceAndDateDiv,
                                                           "youtube-source-container source-container");
                SecurePage.AddTextAreaInputElement(youTubeSourceDiv, "YouTubeSource" + row.QuestionKey,
                                                   monitor.GetDataClass("shadow youtubesource-textbox " + moreClasses,
                                                                        "youtube-source source"),
                                                   row.YouTubeSource, "Enter a description of the source video into this box.", false,
                                                   "Enter a description of the source video into this box.",
                                                   true, "Source Description of Longer Video", "source", null, null, null);
                var youTubeDateDiv = new HtmlDiv().AddTo(youTubeSourceAndDateDiv,
                                                         "youtube-date-container date-container");
                SecurePage.AddTextInputElement(youTubeDateDiv, "YouTubeDate" + row.QuestionKey,
                                               monitor.GetDataClass("shadow-2 youtubedate-textbox date-picker " + moreClasses,
                                                                    "youtubedate sourcedate"), row.YouTubeDate.DbDateToShortDate(),
                                               "Enter the date of the video if today is not an appropriate date.", false,
                                               "Source Date", "youtubedate", null, null, null);
                SecurePage.AddButtonInputElement(youTubeDateDiv, null,
                                                 "today-button for-youtubedate button-1 button-smallest", "Today", "today  for-youtubedate");
            }

            SecurePage.AddTextInputElement(parent, "YouTubeUrl" + row.QuestionKey,
                                           monitor.GetDataClass("shadow-2 youtubeurl-textbox for-star " + moreClasses, "youtubeurl"),
                                           row.YouTubeUrl,
                                           SecurePage.IsPoliticianUser
         ? "Enter a YouTube url that addresses the question."
         : "Enter the YouTube url of the Vote-USA video.",
                                           false,
                                           //SecurePage.IsPoliticianUser
                                           // ? "YouTube Url"
                                           // : "Url Provided by YouTube",
                                           "YouTube Url to be Shown",
                                           "youtubeurl wide", null, null, null);

            new HtmlP {
                InnerText = "When you Update, the Video Description and Running Time will be automatically retrieved from YouTube."
            }.AddTo(parent, "url-message");

            var displayYouTubeDescription = row.YouTubeDescription.SafeString();
            var displayYouTubeRunningTime = row.YouTubeRunningTime.FormatRunningTime();

            if (!string.IsNullOrWhiteSpace(row.YouTubeAutoDisable))
            {
                displayYouTubeDescription = ">>> This video has been temporarily disabled on Vote-USA: " +
                                            row.YouTubeAutoDisable;
                displayYouTubeRunningTime = string.Empty;
            }

            var youTubeDescriptionAndTimeDiv = new HtmlDiv().AddTo(parent,
                                                                   "youtube-description-and-time-container");

            var youTubeDescriptionDiv = new HtmlDiv().AddTo(youTubeDescriptionAndTimeDiv,
                                                            "youtube-description-container");

            SecurePage.AddTextAreaInputElement(youTubeDescriptionDiv, "YouTubeDescription" + row.QuestionKey,
                                               monitor.GetDataClass("shadow youtubedescription-textbox " + moreClasses, "youtubedescription"),
                                               displayYouTubeDescription, null, false, null, false, "Video Description", "youtubedescription wide",
                                               null, null, null, true);

            var youTubeTimeDiv = new HtmlDiv().AddTo(youTubeDescriptionAndTimeDiv,
                                                     "youtube-time-container");

            SecurePage.AddTextInputElement(youTubeTimeDiv, "YouTubeRunningTime" + row.QuestionKey,
                                           monitor.GetDataClass("shadow-2 youtuberunningtime-textbox " + moreClasses, "youtuberunningtime"),
                                           displayYouTubeRunningTime, null, false, "Running Time", "youtuberunningtime",
                                           null, null, null, true);
        }